Use explicit call indices (#6449)

* cargo update -p sp-io

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>

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
Oliver Tale-Yazdi
2022-12-19 23:13:34 +01:00
committed by GitHub
parent b9a55985bd
commit d387338fb0
21 changed files with 309 additions and 180 deletions
@@ -521,6 +521,7 @@ pub mod pallet {
#[pallet::call]
impl<T: Config> Pallet<T> {
/// Set the validation upgrade cooldown.
#[pallet::call_index(0)]
#[pallet::weight((
T::WeightInfo::set_config_with_block_number(),
DispatchClass::Operational,
@@ -536,6 +537,7 @@ pub mod pallet {
}
/// Set the validation upgrade delay.
#[pallet::call_index(1)]
#[pallet::weight((
T::WeightInfo::set_config_with_block_number(),
DispatchClass::Operational,
@@ -551,6 +553,7 @@ pub mod pallet {
}
/// Set the acceptance period for an included candidate.
#[pallet::call_index(2)]
#[pallet::weight((
T::WeightInfo::set_config_with_block_number(),
DispatchClass::Operational,
@@ -566,6 +569,7 @@ pub mod pallet {
}
/// Set the max validation code size for incoming upgrades.
#[pallet::call_index(3)]
#[pallet::weight((
T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational,
@@ -578,6 +582,7 @@ pub mod pallet {
}
/// Set the max POV block size for incoming upgrades.
#[pallet::call_index(4)]
#[pallet::weight((
T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational,
@@ -590,6 +595,7 @@ pub mod pallet {
}
/// Set the max head data size for paras.
#[pallet::call_index(5)]
#[pallet::weight((
T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational,
@@ -602,6 +608,7 @@ pub mod pallet {
}
/// Set the number of parathread execution cores.
#[pallet::call_index(6)]
#[pallet::weight((
T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational,
@@ -614,6 +621,7 @@ pub mod pallet {
}
/// Set the number of retries for a particular parathread.
#[pallet::call_index(7)]
#[pallet::weight((
T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational,
@@ -626,6 +634,7 @@ pub mod pallet {
}
/// Set the parachain validator-group rotation frequency
#[pallet::call_index(8)]
#[pallet::weight((
T::WeightInfo::set_config_with_block_number(),
DispatchClass::Operational,
@@ -641,6 +650,7 @@ pub mod pallet {
}
/// Set the availability period for parachains.
#[pallet::call_index(9)]
#[pallet::weight((
T::WeightInfo::set_config_with_block_number(),
DispatchClass::Operational,
@@ -656,6 +666,7 @@ pub mod pallet {
}
/// Set the availability period for parathreads.
#[pallet::call_index(10)]
#[pallet::weight((
T::WeightInfo::set_config_with_block_number(),
DispatchClass::Operational,
@@ -671,6 +682,7 @@ pub mod pallet {
}
/// Set the scheduling lookahead, in expected number of blocks at peak throughput.
#[pallet::call_index(11)]
#[pallet::weight((
T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational,
@@ -683,6 +695,7 @@ pub mod pallet {
}
/// Set the maximum number of validators to assign to any core.
#[pallet::call_index(12)]
#[pallet::weight((
T::WeightInfo::set_config_with_option_u32(),
DispatchClass::Operational,
@@ -698,6 +711,7 @@ pub mod pallet {
}
/// Set the maximum number of validators to use in parachain consensus.
#[pallet::call_index(13)]
#[pallet::weight((
T::WeightInfo::set_config_with_option_u32(),
DispatchClass::Operational,
@@ -710,6 +724,7 @@ pub mod pallet {
}
/// Set the dispute period, in number of sessions to keep for disputes.
#[pallet::call_index(14)]
#[pallet::weight((
T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational,
@@ -722,6 +737,7 @@ pub mod pallet {
}
/// Set the dispute post conclusion acceptance period.
#[pallet::call_index(15)]
#[pallet::weight((
T::WeightInfo::set_config_with_block_number(),
DispatchClass::Operational,
@@ -737,6 +753,7 @@ pub mod pallet {
}
/// Set the maximum number of dispute spam slots.
#[pallet::call_index(16)]
#[pallet::weight((
T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational,
@@ -749,6 +766,7 @@ pub mod pallet {
}
/// Set the dispute conclusion by time out period.
#[pallet::call_index(17)]
#[pallet::weight((
T::WeightInfo::set_config_with_block_number(),
DispatchClass::Operational,
@@ -765,6 +783,7 @@ pub mod pallet {
/// Set the no show slots, in number of number of consensus slots.
/// Must be at least 1.
#[pallet::call_index(18)]
#[pallet::weight((
T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational,
@@ -777,6 +796,7 @@ pub mod pallet {
}
/// Set the total number of delay tranches.
#[pallet::call_index(19)]
#[pallet::weight((
T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational,
@@ -789,6 +809,7 @@ pub mod pallet {
}
/// Set the zeroth delay tranche width.
#[pallet::call_index(20)]
#[pallet::weight((
T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational,
@@ -801,6 +822,7 @@ pub mod pallet {
}
/// Set the number of validators needed to approve a block.
#[pallet::call_index(21)]
#[pallet::weight((
T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational,
@@ -813,6 +835,7 @@ pub mod pallet {
}
/// Set the number of samples to do of the `RelayVRFModulo` approval assignment criterion.
#[pallet::call_index(22)]
#[pallet::weight((
T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational,
@@ -825,6 +848,7 @@ pub mod pallet {
}
/// Sets the maximum items that can present in a upward dispatch queue at once.
#[pallet::call_index(23)]
#[pallet::weight((
T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational,
@@ -837,6 +861,7 @@ pub mod pallet {
}
/// Sets the maximum total size of items that can present in a upward dispatch queue at once.
#[pallet::call_index(24)]
#[pallet::weight((
T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational,
@@ -849,6 +874,7 @@ pub mod pallet {
}
/// Set the critical downward message size.
#[pallet::call_index(25)]
#[pallet::weight((
T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational,
@@ -861,6 +887,7 @@ pub mod pallet {
}
/// Sets the soft limit for the phase of dispatching dispatchable upward messages.
#[pallet::call_index(26)]
#[pallet::weight((
T::WeightInfo::set_config_with_weight(),
DispatchClass::Operational,
@@ -873,6 +900,7 @@ pub mod pallet {
}
/// Sets the maximum size of an upward message that can be sent by a candidate.
#[pallet::call_index(27)]
#[pallet::weight((
T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational,
@@ -885,6 +913,7 @@ pub mod pallet {
}
/// Sets the maximum number of messages that a candidate can contain.
#[pallet::call_index(28)]
#[pallet::weight((
T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational,
@@ -900,6 +929,7 @@ pub mod pallet {
}
/// Sets the number of sessions after which an HRMP open channel request expires.
#[pallet::call_index(29)]
#[pallet::weight((
T::WeightInfo::set_hrmp_open_request_ttl(),
DispatchClass::Operational,
@@ -911,6 +941,7 @@ pub mod pallet {
}
/// Sets the amount of funds that the sender should provide for opening an HRMP channel.
#[pallet::call_index(30)]
#[pallet::weight((
T::WeightInfo::set_config_with_balance(),
DispatchClass::Operational,
@@ -924,6 +955,7 @@ pub mod pallet {
/// Sets the amount of funds that the recipient should provide for accepting opening an HRMP
/// channel.
#[pallet::call_index(31)]
#[pallet::weight((
T::WeightInfo::set_config_with_balance(),
DispatchClass::Operational,
@@ -936,6 +968,7 @@ pub mod pallet {
}
/// Sets the maximum number of messages allowed in an HRMP channel at once.
#[pallet::call_index(32)]
#[pallet::weight((
T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational,
@@ -948,6 +981,7 @@ pub mod pallet {
}
/// Sets the maximum total size of messages in bytes allowed in an HRMP channel at once.
#[pallet::call_index(33)]
#[pallet::weight((
T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational,
@@ -960,6 +994,7 @@ pub mod pallet {
}
/// Sets the maximum number of inbound HRMP channels a parachain is allowed to accept.
#[pallet::call_index(34)]
#[pallet::weight((
T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational,
@@ -975,6 +1010,7 @@ pub mod pallet {
}
/// Sets the maximum number of inbound HRMP channels a parathread is allowed to accept.
#[pallet::call_index(35)]
#[pallet::weight((
T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational,
@@ -990,6 +1026,7 @@ pub mod pallet {
}
/// Sets the maximum size of a message that could ever be put into an HRMP channel.
#[pallet::call_index(36)]
#[pallet::weight((
T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational,
@@ -1002,6 +1039,7 @@ pub mod pallet {
}
/// Sets the maximum number of outbound HRMP channels a parachain is allowed to open.
#[pallet::call_index(37)]
#[pallet::weight((
T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational,
@@ -1017,6 +1055,7 @@ pub mod pallet {
}
/// Sets the maximum number of outbound HRMP channels a parathread is allowed to open.
#[pallet::call_index(38)]
#[pallet::weight((
T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational,
@@ -1032,6 +1071,7 @@ pub mod pallet {
}
/// Sets the maximum number of outbound HRMP messages can be sent by a candidate.
#[pallet::call_index(39)]
#[pallet::weight((
T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational,
@@ -1047,6 +1087,7 @@ pub mod pallet {
}
/// Sets the maximum amount of weight any individual upward message may consume.
#[pallet::call_index(40)]
#[pallet::weight((
T::WeightInfo::set_config_with_weight(),
DispatchClass::Operational,
@@ -1059,6 +1100,7 @@ pub mod pallet {
}
/// Enable or disable PVF pre-checking. Consult the field documentation prior executing.
#[pallet::call_index(41)]
#[pallet::weight((
// Using u32 here is a little bit of cheating, but that should be fine.
T::WeightInfo::set_config_with_u32(),
@@ -1072,6 +1114,7 @@ pub mod pallet {
}
/// Set the number of session changes after which a PVF pre-checking voting is rejected.
#[pallet::call_index(42)]
#[pallet::weight((
T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational,
@@ -1087,6 +1130,7 @@ pub mod pallet {
/// upgrade taking place.
///
/// See the field documentation for information and constraints for the new value.
#[pallet::call_index(43)]
#[pallet::weight((
T::WeightInfo::set_config_with_block_number(),
DispatchClass::Operational,
@@ -1103,6 +1147,7 @@ pub mod pallet {
/// Setting this to true will disable consistency checks for the configuration setters.
/// Use with caution.
#[pallet::call_index(44)]
#[pallet::weight((
T::DbWeight::get().writes(1),
DispatchClass::Operational,
@@ -525,6 +525,7 @@ pub mod pallet {
#[pallet::call]
impl<T: Config> Pallet<T> {
#[pallet::call_index(0)]
#[pallet::weight(<T as Config>::WeightInfo::force_unfreeze())]
pub fn force_unfreeze(origin: OriginFor<T>) -> DispatchResult {
ensure_root(origin)?;
@@ -475,6 +475,7 @@ pub mod pallet {
#[pallet::call]
impl<T: Config> Pallet<T> {
#[pallet::call_index(0)]
#[pallet::weight(<T as Config>::WeightInfo::report_dispute_lost(
key_owner_proof.validator_count()
))]
+8
View File
@@ -465,6 +465,7 @@ pub mod pallet {
///
/// The channel can be opened only after the recipient confirms it and only on a session
/// change.
#[pallet::call_index(0)]
#[pallet::weight(<T as Config>::WeightInfo::hrmp_init_open_channel())]
pub fn hrmp_init_open_channel(
origin: OriginFor<T>,
@@ -491,6 +492,7 @@ pub mod pallet {
/// Accept a pending open channel request from the given sender.
///
/// The channel will be opened only on the next session boundary.
#[pallet::call_index(1)]
#[pallet::weight(<T as Config>::WeightInfo::hrmp_accept_open_channel())]
pub fn hrmp_accept_open_channel(origin: OriginFor<T>, sender: ParaId) -> DispatchResult {
let origin = ensure_parachain(<T as Config>::RuntimeOrigin::from(origin))?;
@@ -503,6 +505,7 @@ pub mod pallet {
/// recipient in the channel being closed.
///
/// The closure can only happen on a session change.
#[pallet::call_index(2)]
#[pallet::weight(<T as Config>::WeightInfo::hrmp_close_channel())]
pub fn hrmp_close_channel(
origin: OriginFor<T>,
@@ -521,6 +524,7 @@ pub mod pallet {
/// Origin must be Root.
///
/// Number of inbound and outbound channels for `para` must be provided as witness data of weighing.
#[pallet::call_index(3)]
#[pallet::weight(<T as Config>::WeightInfo::force_clean_hrmp(*_inbound, *_outbound))]
pub fn force_clean_hrmp(
origin: OriginFor<T>,
@@ -539,6 +543,7 @@ pub mod pallet {
/// function process all of those requests immediately.
///
/// Total number of opening channels must be provided as witness data of weighing.
#[pallet::call_index(4)]
#[pallet::weight(<T as Config>::WeightInfo::force_process_hrmp_open(*_channels))]
pub fn force_process_hrmp_open(origin: OriginFor<T>, _channels: u32) -> DispatchResult {
ensure_root(origin)?;
@@ -553,6 +558,7 @@ pub mod pallet {
/// function process all of those requests immediately.
///
/// Total number of closing channels must be provided as witness data of weighing.
#[pallet::call_index(5)]
#[pallet::weight(<T as Config>::WeightInfo::force_process_hrmp_close(*_channels))]
pub fn force_process_hrmp_close(origin: OriginFor<T>, _channels: u32) -> DispatchResult {
ensure_root(origin)?;
@@ -568,6 +574,7 @@ pub mod pallet {
///
/// Total number of open requests (i.e. `HrmpOpenChannelRequestsList`) must be provided as
/// witness data.
#[pallet::call_index(6)]
#[pallet::weight(<T as Config>::WeightInfo::hrmp_cancel_open_request(*open_requests))]
pub fn hrmp_cancel_open_request(
origin: OriginFor<T>,
@@ -591,6 +598,7 @@ pub mod pallet {
///
/// Expected use is when one of the `ParaId`s involved in the channel is governed by the
/// Relay Chain, e.g. a common good parachain.
#[pallet::call_index(7)]
#[pallet::weight(<T as Config>::WeightInfo::force_open_hrmp_channel())]
pub fn force_open_hrmp_channel(
origin: OriginFor<T>,
@@ -210,6 +210,7 @@ pub mod pallet {
/// Issue a signal to the consensus engine to forcibly act as though all parachain
/// blocks in all relay chain blocks up to and including the given number in the current
/// chain are valid and should be finalized.
#[pallet::call_index(0)]
#[pallet::weight((
<T as Config>::WeightInfo::force_approve(
frame_system::Pallet::<T>::digest().logs.len() as u32,
@@ -788,6 +788,7 @@ pub mod pallet {
#[pallet::call]
impl<T: Config> Pallet<T> {
/// Set the storage for the parachain validation code immediately.
#[pallet::call_index(0)]
#[pallet::weight(<T as Config>::WeightInfo::force_set_current_code(new_code.0.len() as u32))]
pub fn force_set_current_code(
origin: OriginFor<T>,
@@ -815,6 +816,7 @@ pub mod pallet {
}
/// Set the storage for the current parachain head data immediately.
#[pallet::call_index(1)]
#[pallet::weight(<T as Config>::WeightInfo::force_set_current_head(new_head.0.len() as u32))]
pub fn force_set_current_head(
origin: OriginFor<T>,
@@ -827,6 +829,7 @@ pub mod pallet {
}
/// Schedule an upgrade as if it was scheduled in the given relay parent block.
#[pallet::call_index(2)]
#[pallet::weight(<T as Config>::WeightInfo::force_schedule_code_upgrade(new_code.0.len() as u32))]
pub fn force_schedule_code_upgrade(
origin: OriginFor<T>,
@@ -842,6 +845,7 @@ pub mod pallet {
}
/// Note a new block head for para within the context of the current block.
#[pallet::call_index(3)]
#[pallet::weight(<T as Config>::WeightInfo::force_note_new_head(new_head.0.len() as u32))]
pub fn force_note_new_head(
origin: OriginFor<T>,
@@ -858,6 +862,7 @@ pub mod pallet {
/// Put a parachain directly into the next session's action queue.
/// We can't queue it any sooner than this without going into the
/// initializer...
#[pallet::call_index(4)]
#[pallet::weight(<T as Config>::WeightInfo::force_queue_action())]
pub fn force_queue_action(origin: OriginFor<T>, para: ParaId) -> DispatchResult {
ensure_root(origin)?;
@@ -884,6 +889,7 @@ pub mod pallet {
///
/// This function is mainly meant to be used for upgrading parachains that do not follow
/// the go-ahead signal while the PVF pre-checking feature is enabled.
#[pallet::call_index(5)]
#[pallet::weight(<T as Config>::WeightInfo::add_trusted_validation_code(validation_code.0.len() as u32))]
pub fn add_trusted_validation_code(
origin: OriginFor<T>,
@@ -932,6 +938,7 @@ pub mod pallet {
/// This is better than removing the storage directly, because it will not remove the code
/// that was suddenly got used by some parachain while this dispatchable was pending
/// dispatching.
#[pallet::call_index(6)]
#[pallet::weight(<T as Config>::WeightInfo::poke_unused_validation_code())]
pub fn poke_unused_validation_code(
origin: OriginFor<T>,
@@ -946,6 +953,7 @@ pub mod pallet {
/// Includes a statement for a PVF pre-checking vote. Potentially, finalizes the vote and
/// enacts the results if that was the last vote before achieving the supermajority.
#[pallet::call_index(7)]
#[pallet::weight(
<T as Config>::WeightInfo::include_pvf_check_statement_finalize_upgrade_accept()
.max(<T as Config>::WeightInfo::include_pvf_check_statement_finalize_upgrade_reject())
@@ -277,6 +277,7 @@ pub mod pallet {
#[pallet::call]
impl<T: Config> Pallet<T> {
/// Enter the paras inherent. This will process bitfields and backed candidates.
#[pallet::call_index(0)]
#[pallet::weight((
paras_inherent_total_weight::<T>(
data.backed_candidates.as_slice(),
+1
View File
@@ -349,6 +349,7 @@ pub mod pallet {
///
/// Events:
/// - `OverweightServiced`: On success.
#[pallet::call_index(0)]
#[pallet::weight(weight_limit.saturating_add(<T as Config>::WeightInfo::service_overweight()))]
pub fn service_overweight(
origin: OriginFor<T>,