mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 20:31:13 +00:00
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:
committed by
GitHub
parent
6e0453a298
commit
31f5119ecd
@@ -181,6 +181,7 @@ pub mod pallet {
|
||||
/// `BatchInterrupted` event is deposited, along with the number of successful calls made
|
||||
/// and the error of the failed call. If all were successful, then the `BatchCompleted`
|
||||
/// event is deposited.
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight({
|
||||
let dispatch_infos = calls.iter().map(|call| call.get_dispatch_info()).collect::<Vec<_>>();
|
||||
let dispatch_weight = dispatch_infos.iter()
|
||||
@@ -254,6 +255,7 @@ pub mod pallet {
|
||||
/// NOTE: Prior to version *12, this was called `as_limited_sub`.
|
||||
///
|
||||
/// The dispatch origin for this call must be _Signed_.
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight({
|
||||
let dispatch_info = call.get_dispatch_info();
|
||||
(
|
||||
@@ -302,6 +304,7 @@ pub mod pallet {
|
||||
/// # <weight>
|
||||
/// - Complexity: O(C) where C is the number of calls to be batched.
|
||||
/// # </weight>
|
||||
#[pallet::call_index(2)]
|
||||
#[pallet::weight({
|
||||
let dispatch_infos = calls.iter().map(|call| call.get_dispatch_info()).collect::<Vec<_>>();
|
||||
let dispatch_weight = dispatch_infos.iter()
|
||||
@@ -377,6 +380,7 @@ pub mod pallet {
|
||||
/// - One DB write (event).
|
||||
/// - Weight of derivative `call` execution + T::WeightInfo::dispatch_as().
|
||||
/// # </weight>
|
||||
#[pallet::call_index(3)]
|
||||
#[pallet::weight({
|
||||
let dispatch_info = call.get_dispatch_info();
|
||||
(
|
||||
@@ -414,6 +418,7 @@ pub mod pallet {
|
||||
/// # <weight>
|
||||
/// - Complexity: O(C) where C is the number of calls to be batched.
|
||||
/// # </weight>
|
||||
#[pallet::call_index(4)]
|
||||
#[pallet::weight({
|
||||
let dispatch_infos = calls.iter().map(|call| call.get_dispatch_info()).collect::<Vec<_>>();
|
||||
let dispatch_weight = dispatch_infos.iter()
|
||||
@@ -481,6 +486,7 @@ pub mod pallet {
|
||||
/// Root origin to specify the weight of the call.
|
||||
///
|
||||
/// The dispatch origin for this call must be _Root_.
|
||||
#[pallet::call_index(5)]
|
||||
#[pallet::weight((*_weight, call.get_dispatch_info().class))]
|
||||
pub fn with_weight(
|
||||
origin: OriginFor<T>,
|
||||
|
||||
@@ -53,11 +53,13 @@ pub mod example {
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight(*_weight)]
|
||||
pub fn noop(_origin: OriginFor<T>, _weight: Weight) -> DispatchResult {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight(*_start_weight)]
|
||||
pub fn foobar(
|
||||
origin: OriginFor<T>,
|
||||
@@ -78,6 +80,7 @@ pub mod example {
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::call_index(2)]
|
||||
#[pallet::weight(0)]
|
||||
pub fn big_variant(_origin: OriginFor<T>, _arg: [u8; 400]) -> DispatchResult {
|
||||
Ok(())
|
||||
@@ -105,6 +108,7 @@ mod mock_democracy {
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pallet::call_index(3)]
|
||||
#[pallet::weight(0)]
|
||||
pub fn external_propose_majority(origin: OriginFor<T>) -> DispatchResult {
|
||||
T::ExternalMajorityOrigin::ensure_origin(origin)?;
|
||||
|
||||
Reference in New Issue
Block a user