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
+10
View File
@@ -458,6 +458,7 @@ pub mod pallet {
#[pallet::call]
impl<T: Config> Pallet<T> {
#[pallet::call_index(0)]
#[pallet::weight(100_000_000)]
pub fn send(
origin: OriginFor<T>,
@@ -493,6 +494,7 @@ pub mod pallet {
/// `dest` side. May not be empty.
/// - `fee_asset_item`: The index into `assets` of the item which should be used to pay
/// fees.
#[pallet::call_index(1)]
#[pallet::weight({
let maybe_assets: Result<MultiAssets, ()> = (*assets.clone()).try_into();
let maybe_dest: Result<MultiLocation, ()> = (*dest.clone()).try_into();
@@ -534,6 +536,7 @@ pub mod pallet {
/// `dest` side.
/// - `fee_asset_item`: The index into `assets` of the item which should be used to pay
/// fees.
#[pallet::call_index(2)]
#[pallet::weight({
match ((*assets.clone()).try_into(), (*dest.clone()).try_into()) {
(Ok(assets), Ok(dest)) => {
@@ -574,6 +577,7 @@ pub mod pallet {
///
/// NOTE: A successful return to this does *not* imply that the `msg` was executed successfully
/// to completion; only that *some* of it was executed.
#[pallet::call_index(3)]
#[pallet::weight(Weight::from_ref_time(max_weight.saturating_add(100_000_000u64)))]
pub fn execute(
origin: OriginFor<T>,
@@ -602,6 +606,7 @@ pub mod pallet {
/// - `origin`: Must be Root.
/// - `location`: The destination that is being described.
/// - `xcm_version`: The latest version of XCM that `location` supports.
#[pallet::call_index(4)]
#[pallet::weight(100_000_000u64)]
pub fn force_xcm_version(
origin: OriginFor<T>,
@@ -624,6 +629,7 @@ pub mod pallet {
///
/// - `origin`: Must be Root.
/// - `maybe_xcm_version`: The default XCM encoding version, or `None` to disable.
#[pallet::call_index(5)]
#[pallet::weight(100_000_000u64)]
pub fn force_default_xcm_version(
origin: OriginFor<T>,
@@ -638,6 +644,7 @@ pub mod pallet {
///
/// - `origin`: Must be Root.
/// - `location`: The location to which we should subscribe for XCM version notifications.
#[pallet::call_index(6)]
#[pallet::weight(100_000_000u64)]
pub fn force_subscribe_version_notify(
origin: OriginFor<T>,
@@ -661,6 +668,7 @@ pub mod pallet {
/// - `origin`: Must be Root.
/// - `location`: The location to which we are currently subscribed for XCM version
/// notifications which we no longer desire.
#[pallet::call_index(7)]
#[pallet::weight(100_000_000u64)]
pub fn force_unsubscribe_version_notify(
origin: OriginFor<T>,
@@ -696,6 +704,7 @@ pub mod pallet {
/// - `fee_asset_item`: The index into `assets` of the item which should be used to pay
/// fees.
/// - `weight_limit`: The remote-side weight limit, if any, for the XCM fee purchase.
#[pallet::call_index(8)]
#[pallet::weight({
match ((*assets.clone()).try_into(), (*dest.clone()).try_into()) {
(Ok(assets), Ok(dest)) => {
@@ -743,6 +752,7 @@ pub mod pallet {
/// - `fee_asset_item`: The index into `assets` of the item which should be used to pay
/// fees.
/// - `weight_limit`: The remote-side weight limit, if any, for the XCM fee purchase.
#[pallet::call_index(9)]
#[pallet::weight({
let maybe_assets: Result<MultiAssets, ()> = (*assets.clone()).try_into();
let maybe_dest: Result<MultiLocation, ()> = (*dest.clone()).try_into();
+3
View File
@@ -73,6 +73,7 @@ pub mod pallet_test_notifier {
#[pallet::call]
impl<T: Config> Pallet<T> {
#[pallet::call_index(0)]
#[pallet::weight(1_000_000)]
pub fn prepare_new_query(origin: OriginFor<T>) -> DispatchResult {
let who = ensure_signed(origin)?;
@@ -87,6 +88,7 @@ pub mod pallet_test_notifier {
Ok(())
}
#[pallet::call_index(1)]
#[pallet::weight(1_000_000)]
pub fn prepare_new_notify_query(origin: OriginFor<T>) -> DispatchResult {
let who = ensure_signed(origin)?;
@@ -104,6 +106,7 @@ pub mod pallet_test_notifier {
Ok(())
}
#[pallet::call_index(2)]
#[pallet::weight(1_000_000)]
pub fn notification_received(
origin: OriginFor<T>,