Use explicit call indices (#12891)

* frame-system: explicit call index

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Use explicit call indices

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* pallet-template: explicit call index

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* DNM: Temporarily require call_index

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Revert "DNM: Temporarily require call_index"

This reverts commit c4934e312e12af72ca05a8029d7da753a9c99346.

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
Oliver Tale-Yazdi
2022-12-12 15:32:41 +01:00
committed by GitHub
parent 6e0453a298
commit 31f5119ecd
67 changed files with 403 additions and 0 deletions
@@ -210,6 +210,7 @@ pub mod pallet {
/// May only be called from `T::AddOrigin`.
///
/// - `node`: identifier of the node.
#[pallet::call_index(0)]
#[pallet::weight((T::WeightInfo::add_well_known_node(), DispatchClass::Operational))]
pub fn add_well_known_node(
origin: OriginFor<T>,
@@ -239,6 +240,7 @@ pub mod pallet {
/// May only be called from `T::RemoveOrigin`.
///
/// - `node`: identifier of the node.
#[pallet::call_index(1)]
#[pallet::weight((T::WeightInfo::remove_well_known_node(), DispatchClass::Operational))]
pub fn remove_well_known_node(origin: OriginFor<T>, node: PeerId) -> DispatchResult {
T::RemoveOrigin::ensure_origin(origin)?;
@@ -264,6 +266,7 @@ pub mod pallet {
///
/// - `remove`: the node which will be moved out from the list.
/// - `add`: the node which will be put in the list.
#[pallet::call_index(2)]
#[pallet::weight((T::WeightInfo::swap_well_known_node(), DispatchClass::Operational))]
pub fn swap_well_known_node(
origin: OriginFor<T>,
@@ -300,6 +303,7 @@ pub mod pallet {
/// May only be called from `T::ResetOrigin`.
///
/// - `nodes`: the new nodes for the allow list.
#[pallet::call_index(3)]
#[pallet::weight((T::WeightInfo::reset_well_known_nodes(), DispatchClass::Operational))]
pub fn reset_well_known_nodes(
origin: OriginFor<T>,
@@ -318,6 +322,7 @@ pub mod pallet {
/// PeerId, so claim it right away!
///
/// - `node`: identifier of the node.
#[pallet::call_index(4)]
#[pallet::weight(T::WeightInfo::claim_node())]
pub fn claim_node(origin: OriginFor<T>, node: PeerId) -> DispatchResult {
let sender = ensure_signed(origin)?;
@@ -335,6 +340,7 @@ pub mod pallet {
/// needs to reach consensus among the network participants.
///
/// - `node`: identifier of the node.
#[pallet::call_index(5)]
#[pallet::weight(T::WeightInfo::remove_claim())]
pub fn remove_claim(origin: OriginFor<T>, node: PeerId) -> DispatchResult {
let sender = ensure_signed(origin)?;
@@ -355,6 +361,7 @@ pub mod pallet {
///
/// - `node`: identifier of the node.
/// - `owner`: new owner of the node.
#[pallet::call_index(6)]
#[pallet::weight(T::WeightInfo::transfer_node())]
pub fn transfer_node(
origin: OriginFor<T>,
@@ -378,6 +385,7 @@ pub mod pallet {
///
/// - `node`: identifier of the node.
/// - `connections`: additonal nodes from which the connections are allowed.
#[pallet::call_index(7)]
#[pallet::weight(T::WeightInfo::add_connections())]
pub fn add_connections(
origin: OriginFor<T>,
@@ -412,6 +420,7 @@ pub mod pallet {
///
/// - `node`: identifier of the node.
/// - `connections`: additonal nodes from which the connections are not allowed anymore.
#[pallet::call_index(8)]
#[pallet::weight(T::WeightInfo::remove_connections())]
pub fn remove_connections(
origin: OriginFor<T>,