From 08ce140b8ed68ad9b0b288def23a5efa4b75b68b Mon Sep 17 00:00:00 2001 From: Tarek Mohamed Abdalla Date: Tue, 14 Jan 2025 14:09:17 +0200 Subject: [PATCH 01/10] Send priority fees to collators (#3120) * feat: send eth tips to collator * style: fix import order * fix: tests * fix: tests * style: fix formatting * test: fix test * test: fix test * style: formatting * fix: test * fix: test * fix: test * fix: parameters tests. * fix: contract tests. * fix: fix test-eth-pool-resubmit-txn.ts * fix: fix test-eth-pool-error.ts * fix: Update balance transfer tests to use CHARLETH_ADDRESS in tests * style: fix * fix: Refactor xtokens test and disable tip fee burning * fix: fix test-contract tests * fix: commands in update-local-types * refactor: fee calculation logic and improve modularity. * fix: FeesTreasuryProportion test logic and helpers * fix: argument order in calculateFeePortions function call * test: Add verification for latest block fees and add a check for tips. * refactor: separate fee and tip calculation * fix: fee and tip handling logic for clarity and correctness * refactor: clean up unused imports in Moonbeam runtime * style: correct indentation in runtime lib.rs * test: also check LatestBlockFees in eth transactions * tmp: check if all tests pass * refactor: remove unnecessary console logs in tests * tmp: change default value * Revert "tmp: change default value" This reverts commit 7b16ab2cbb5924463a9b68f5dcdb465b068913a5. * tmp: change default value * tmp: change default value * test: add comment explaining test file * Revert "tmp: change default value" This reverts commit 56b62d345d6e022ee2c9a81dd47be7e9b4ef2a00. * Revert "tmp: change default value" This reverts commit fdab76fea2596ff38a6c7c67b3cd8341524ad131. * feature: send substrate tips to block author * fix: incorrect generics * style: fix formatting * test: refine fee and tip handling logic for runtime tests * test(runtime): fix incorrect runtime references in tests * refactor: move all deal with fees logic into common crate * refactor: remove unused imports * style: add copyright * Update runtime/common/src/deal_with_fees.rs * test: fix test --------- Co-authored-by: Rodrigo Quelhas <22591718+RomarQ@users.noreply.github.com> --- runtime/common/src/deal_with_fees.rs | 114 ++++++++ .../src/impl_on_charge_evm_transaction.rs | 14 +- runtime/common/src/lib.rs | 1 + runtime/moonbase/src/lib.rs | 67 ++--- runtime/moonbase/tests/common/mod.rs | 3 + runtime/moonbase/tests/integration_test.rs | 120 ++++++--- runtime/moonbase/tests/runtime_apis.rs | 3 + runtime/moonbeam/src/lib.rs | 68 ++--- runtime/moonbeam/tests/common/mod.rs | 3 + runtime/moonbeam/tests/integration_test.rs | 128 ++++++--- runtime/moonriver/src/lib.rs | 67 ++--- runtime/moonriver/tests/common/mod.rs | 3 + runtime/moonriver/tests/integration_test.rs | 127 ++++++--- test/helpers/block.ts | 47 ++-- test/helpers/fees.ts | 31 +++ test/helpers/index.ts | 2 + test/helpers/parameters.ts | 14 + test/scripts/update-local-types.ts | 3 +- .../test-balance/test-balance-transfer.ts | 11 +- .../test-contract/test-contract-error.ts | 36 ++- .../test-eth-pool/test-eth-pool-error.ts | 9 +- .../test-eth-pool-resubmit-txn.ts | 30 ++- .../test-fees/test-fees-repartition.ts | 1 + ...rameters-runtime-FeesTreasuryProportion.ts | 243 +++++++++++------- .../test-precompile-xtokens.ts | 14 +- 25 files changed, 756 insertions(+), 403 deletions(-) create mode 100644 runtime/common/src/deal_with_fees.rs create mode 100644 test/helpers/fees.ts create mode 100644 test/helpers/parameters.ts diff --git a/runtime/common/src/deal_with_fees.rs b/runtime/common/src/deal_with_fees.rs new file mode 100644 index 0000000000..dd65f9c2d6 --- /dev/null +++ b/runtime/common/src/deal_with_fees.rs @@ -0,0 +1,114 @@ +// Copyright 2024 Moonbeam foundation +// This file is part of Moonbeam. + +// Moonbeam is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Moonbeam is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Moonbeam. If not, see . + +use frame_support::__private::Get; +use frame_support::pallet_prelude::TypedGet; +use frame_support::traits::fungible::Credit; +use frame_support::traits::tokens::imbalance::ResolveTo; +use frame_support::traits::Imbalance; +use frame_support::traits::OnUnbalanced; +use pallet_treasury::TreasuryAccountId; +use sp_runtime::Perbill; + +/// Deal with substrate based fees and tip. This should be used with pallet_transaction_payment. +pub struct DealWithSubstrateFeesAndTip( + sp_std::marker::PhantomData<(R, FeesTreasuryProportion)>, +); +impl DealWithSubstrateFeesAndTip +where + R: pallet_balances::Config + pallet_treasury::Config + pallet_author_inherent::Config, + pallet_author_inherent::Pallet: Get, + FeesTreasuryProportion: Get, +{ + fn deal_with_fees(amount: Credit>) { + // Balances pallet automatically burns dropped Credits by decreasing + // total_supply accordingly + let treasury_proportion = FeesTreasuryProportion::get(); + let treasury_part = treasury_proportion.deconstruct(); + let burn_part = Perbill::one().deconstruct() - treasury_part; + let (_, to_treasury) = amount.ration(burn_part, treasury_part); + ResolveTo::, pallet_balances::Pallet>::on_unbalanced(to_treasury); + } + + fn deal_with_tip(amount: Credit>) { + ResolveTo::, pallet_balances::Pallet>::on_unbalanced(amount); + } +} + +impl OnUnbalanced>> + for DealWithSubstrateFeesAndTip +where + R: pallet_balances::Config + pallet_treasury::Config + pallet_author_inherent::Config, + pallet_author_inherent::Pallet: Get, + FeesTreasuryProportion: Get, +{ + fn on_unbalanceds( + mut fees_then_tips: impl Iterator>>, + ) { + if let Some(fees) = fees_then_tips.next() { + Self::deal_with_fees(fees); + if let Some(tip) = fees_then_tips.next() { + Self::deal_with_tip(tip); + } + } + } +} + +/// Deal with ethereum based fees. To handle tips/priority fees, use DealWithEthereumPriorityFees. +pub struct DealWithEthereumBaseFees( + sp_std::marker::PhantomData<(R, FeesTreasuryProportion)>, +); +impl OnUnbalanced>> + for DealWithEthereumBaseFees +where + R: pallet_balances::Config + pallet_treasury::Config, + FeesTreasuryProportion: Get, +{ + fn on_nonzero_unbalanced(amount: Credit>) { + // Balances pallet automatically burns dropped Credits by decreasing + // total_supply accordingly + let treasury_proportion = FeesTreasuryProportion::get(); + let treasury_part = treasury_proportion.deconstruct(); + let burn_part = Perbill::one().deconstruct() - treasury_part; + let (_, to_treasury) = amount.ration(burn_part, treasury_part); + ResolveTo::, pallet_balances::Pallet>::on_unbalanced(to_treasury); + } +} + +pub struct BlockAuthorAccountId(sp_std::marker::PhantomData); +impl TypedGet for BlockAuthorAccountId +where + R: frame_system::Config + pallet_author_inherent::Config, + pallet_author_inherent::Pallet: Get, +{ + type Type = R::AccountId; + fn get() -> Self::Type { + as Get>::get() + } +} + +/// Deal with ethereum based priority fees/tips. See DealWithEthereumBaseFees for base fees. +pub struct DealWithEthereumPriorityFees(sp_std::marker::PhantomData); +impl OnUnbalanced>> + for DealWithEthereumPriorityFees +where + R: pallet_balances::Config + pallet_author_inherent::Config, + pallet_author_inherent::Pallet: Get, +{ + fn on_nonzero_unbalanced(amount: Credit>) { + ResolveTo::, pallet_balances::Pallet>::on_unbalanced(amount); + } +} diff --git a/runtime/common/src/impl_on_charge_evm_transaction.rs b/runtime/common/src/impl_on_charge_evm_transaction.rs index 0fe3b9c026..1cb816c73c 100644 --- a/runtime/common/src/impl_on_charge_evm_transaction.rs +++ b/runtime/common/src/impl_on_charge_evm_transaction.rs @@ -22,13 +22,17 @@ macro_rules! impl_on_charge_evm_transaction { type BalanceFor = <::Currency as Inspect>>::Balance; - pub struct OnChargeEVMTransaction(sp_std::marker::PhantomData); + pub struct OnChargeEVMTransaction( + sp_std::marker::PhantomData<(BaseFeesOU, PriorityFeesOU)> + ); - impl OnChargeEVMTransactionT for OnChargeEVMTransaction + impl OnChargeEVMTransactionT + for OnChargeEVMTransaction where T: pallet_evm::Config, T::Currency: Balanced>, - OU: OnUnbalanced, T::Currency>>, + BaseFeesOU: OnUnbalanced, T::Currency>>, + PriorityFeesOU: OnUnbalanced, T::Currency>>, U256: UniqueSaturatedInto<>>::Balance>, T::AddressMapping: pallet_evm::AddressMapping, { @@ -48,14 +52,14 @@ macro_rules! impl_on_charge_evm_transaction { base_fee: U256, already_withdrawn: Self::LiquidityInfo, ) -> Self::LiquidityInfo { - ::Currency, OU> as OnChargeEVMTransactionT< + ::Currency, BaseFeesOU> as OnChargeEVMTransactionT< T, >>::correct_and_deposit_fee(who, corrected_fee, base_fee, already_withdrawn) } fn pay_priority_fee(tip: Self::LiquidityInfo) { if let Some(tip) = tip { - OU::on_unbalanced(tip); + PriorityFeesOU::on_unbalanced(tip); } } } diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 735a565ce3..1df85e1e52 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -19,6 +19,7 @@ mod apis; #[cfg(feature = "runtime-benchmarks")] pub mod benchmarking; +pub mod deal_with_fees; mod impl_moonbeam_xcm_call; mod impl_moonbeam_xcm_call_tracing; mod impl_on_charge_evm_transaction; diff --git a/runtime/moonbase/src/lib.rs b/runtime/moonbase/src/lib.rs index 073da4d764..ab9a1db6c8 100644 --- a/runtime/moonbase/src/lib.rs +++ b/runtime/moonbase/src/lib.rs @@ -64,10 +64,9 @@ use frame_support::{ parameter_types, traits::{ fungible::{Balanced, Credit, HoldConsideration, Inspect}, - tokens::imbalance::ResolveTo, tokens::{PayFromAccount, UnityAssetBalanceConversion}, ConstBool, ConstU128, ConstU16, ConstU32, ConstU64, ConstU8, Contains, EitherOfDiverse, - EqualPrivilegeOnly, FindAuthor, Imbalance, InstanceFilter, LinearStoragePrice, OnFinalize, + EqualPrivilegeOnly, FindAuthor, InstanceFilter, LinearStoragePrice, OnFinalize, OnUnbalanced, }, weights::{ @@ -90,7 +89,6 @@ use pallet_evm::{ OnChargeEVMTransaction as OnChargeEVMTransactionT, Runner, }; use pallet_transaction_payment::{FungibleAdapter, Multiplier, TargetedFeeAdjustment}; -use pallet_treasury::TreasuryAccountId; use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use runtime_params::*; use scale_info::TypeInfo; @@ -338,52 +336,6 @@ impl pallet_balances::Config for Runtime { type WeightInfo = moonbase_weights::pallet_balances::WeightInfo; } -pub struct DealWithFees(sp_std::marker::PhantomData); -impl OnUnbalanced>> for DealWithFees -where - R: pallet_balances::Config + pallet_treasury::Config, -{ - // this seems to be called for substrate-based transactions - fn on_unbalanceds( - mut fees_then_tips: impl Iterator>>, - ) { - if let Some(fees) = fees_then_tips.next() { - let treasury_proportion = - runtime_params::dynamic_params::runtime_config::FeesTreasuryProportion::get(); - let treasury_part = treasury_proportion.deconstruct(); - let burn_part = Perbill::one().deconstruct() - treasury_part; - let (_, to_treasury) = fees.ration(burn_part, treasury_part); - // Balances pallet automatically burns dropped Credits by decreasing - // total_supply accordingly - ResolveTo::, pallet_balances::Pallet>::on_unbalanced( - to_treasury, - ); - - // handle tip if there is one - if let Some(tip) = fees_then_tips.next() { - // for now we use the same burn/treasury strategy used for regular fees - let (_, to_treasury) = tip.ration(burn_part, treasury_part); - ResolveTo::, pallet_balances::Pallet>::on_unbalanced( - to_treasury, - ); - } - } - } - - // this is called from pallet_evm for Ethereum-based transactions - // (technically, it calls on_unbalanced, which calls this when non-zero) - fn on_nonzero_unbalanced(amount: Credit>) { - // Balances pallet automatically burns dropped Credits by decreasing - // total_supply accordingly - let treasury_proportion = - runtime_params::dynamic_params::runtime_config::FeesTreasuryProportion::get(); - let treasury_part = treasury_proportion.deconstruct(); - let burn_part = Perbill::one().deconstruct() - treasury_part; - let (_, to_treasury) = amount.ration(burn_part, treasury_part); - ResolveTo::, pallet_balances::Pallet>::on_unbalanced(to_treasury); - } -} - pub struct LengthToFee; impl WeightToFeePolynomial for LengthToFee { type Balance = Balance; @@ -408,7 +360,13 @@ impl WeightToFeePolynomial for LengthToFee { impl pallet_transaction_payment::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type OnChargeTransaction = FungibleAdapter>; + type OnChargeTransaction = FungibleAdapter< + Balances, + DealWithSubstrateFeesAndTip< + Runtime, + dynamic_params::runtime_config::FeesTreasuryProportion, + >, + >; type OperationalFeeMultiplier = ConstU8<5>; type WeightToFee = ConstantMultiplier>; type LengthToFee = LengthToFee; @@ -542,7 +500,10 @@ impl pallet_evm::Config for Runtime { type PrecompilesType = MoonbasePrecompiles; type PrecompilesValue = PrecompilesValue; type ChainId = EthereumChainId; - type OnChargeTransaction = OnChargeEVMTransaction>; + type OnChargeTransaction = OnChargeEVMTransaction< + DealWithEthereumBaseFees, + DealWithEthereumPriorityFees, + >; type BlockGasLimit = BlockGasLimit; type FindAuthor = FindAuthorAdapter; type OnCreate = (); @@ -1496,6 +1457,10 @@ pub type Executive = frame_executive::Executive< #[cfg(feature = "runtime-benchmarks")] use moonbeam_runtime_common::benchmarking::BenchmarkHelper; +use moonbeam_runtime_common::deal_with_fees::{ + DealWithEthereumBaseFees, DealWithEthereumPriorityFees, DealWithSubstrateFeesAndTip, +}; + #[cfg(feature = "runtime-benchmarks")] mod benches { frame_support::parameter_types! { diff --git a/runtime/moonbase/tests/common/mod.rs b/runtime/moonbase/tests/common/mod.rs index 19df108ab7..794988584f 100644 --- a/runtime/moonbase/tests/common/mod.rs +++ b/runtime/moonbase/tests/common/mod.rs @@ -364,6 +364,9 @@ pub fn set_parachain_inherent_data() { use cumulus_primitives_core::PersistedValidationData; use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder; + let author = AccountId::from(>::find_author()); + pallet_author_inherent::Author::::put(author); + let mut relay_sproof = RelayStateSproofBuilder::default(); relay_sproof.para_id = 100u32.into(); relay_sproof.included_para_head = Some(HeadData(vec![1, 2, 3])); diff --git a/runtime/moonbase/tests/integration_test.rs b/runtime/moonbase/tests/integration_test.rs index 5bf1b851cb..20f1200381 100644 --- a/runtime/moonbase/tests/integration_test.rs +++ b/runtime/moonbase/tests/integration_test.rs @@ -77,12 +77,13 @@ use moonkit_xcm_primitives::AccountIdAssetIdConversion; use nimbus_primitives::NimbusId; use pallet_evm::PrecompileSet; //use pallet_evm_precompileset_assets_erc20::{SELECTOR_LOG_APPROVAL, SELECTOR_LOG_TRANSFER}; +use moonbase_runtime::runtime_params::dynamic_params; use pallet_moonbeam_foreign_assets::AssetStatus; use pallet_transaction_payment::Multiplier; use pallet_xcm_transactor::{Currency, CurrencyPayment, HrmpOperation, TransactWeights}; use parity_scale_codec::Encode; use sha3::{Digest, Keccak256}; -use sp_core::{crypto::UncheckedFrom, ByteArray, Pair, H160, H256, U256}; +use sp_core::{crypto::UncheckedFrom, ByteArray, Get, Pair, H160, H256, U256}; use sp_runtime::{bounded_vec, DispatchError, ModuleError}; use std::cell::Cell; use std::rc::Rc; @@ -1881,6 +1882,7 @@ fn transfer_ed_0_evm() { ]) .build() .execute_with(|| { + set_parachain_inherent_data(); // EVM transfer assert_ok!(RuntimeCall::EVM(pallet_evm::Call::::call { source: H160::from(ALICE), @@ -1933,7 +1935,7 @@ fn refund_ed_0_evm() { } #[test] -fn author_does_not_receive_priority_fee() { +fn author_does_receive_priority_fee() { ExtBuilder::default() .with_balances(vec![( AccountId::from(BOB), @@ -1943,6 +1945,7 @@ fn author_does_not_receive_priority_fee() { .execute_with(|| { // Some block author as seen by pallet-evm. let author = AccountId::from(>::find_author()); + pallet_author_inherent::Author::::put(author); // Currently the default impl of the evm uses `deposit_into_existing`. // If we were to use this implementation, and for an author to receive eventual tips, // the account needs to be somehow initialized, otherwise the deposit would fail. @@ -1961,8 +1964,10 @@ fn author_does_not_receive_priority_fee() { access_list: Vec::new(), }) .dispatch(::RuntimeOrigin::root())); - // Author free balance didn't change. - assert_eq!(Balances::free_balance(author), 100 * UNIT,); + + let priority_fee = 200 * GIGAWEI * 21_000; + // Author free balance increased by priority fee. + assert_eq!(Balances::free_balance(author), 100 * UNIT + priority_fee,); }); } @@ -1983,6 +1988,8 @@ fn total_issuance_after_evm_transaction_with_priority_fee() { .build() .execute_with(|| { let issuance_before = ::Currency::total_issuance(); + let author = AccountId::from(>::find_author()); + pallet_author_inherent::Author::::put(author); // EVM transfer. assert_ok!(RuntimeCall::EVM(pallet_evm::Call::::call { source: H160::from(BOB), @@ -1998,14 +2005,18 @@ fn total_issuance_after_evm_transaction_with_priority_fee() { .dispatch(::RuntimeOrigin::root())); let issuance_after = ::Currency::total_issuance(); - // Fee is 1 * base_fee + tip. - let fee = ((2 * BASE_FEE_GENISIS) * 21_000) as f64; - // 80% was burned. - let expected_burn = (fee * 0.8) as u128; - assert_eq!(issuance_after, issuance_before - expected_burn,); - // 20% was sent to treasury. - let expected_treasury = (fee * 0.2) as u128; - assert_eq!(moonbase_runtime::Treasury::pot(), expected_treasury); + + let base_fee: Balance = BASE_FEE_GENISIS * 21_000; + + let treasury_proportion = dynamic_params::runtime_config::FeesTreasuryProportion::get(); + + // only base fee is split between being burned and sent to treasury + let treasury_base_fee_part: Balance = treasury_proportion.mul_floor(base_fee); + let burnt_base_fee_part: Balance = base_fee - treasury_base_fee_part; + + assert_eq!(issuance_after, issuance_before - burnt_base_fee_part); + + assert_eq!(moonbase_runtime::Treasury::pot(), treasury_base_fee_part); }); } @@ -2026,6 +2037,7 @@ fn total_issuance_after_evm_transaction_without_priority_fee() { ]) .build() .execute_with(|| { + set_parachain_inherent_data(); let issuance_before = ::Currency::total_issuance(); // EVM transfer. assert_ok!(RuntimeCall::EVM(pallet_evm::Call::::call { @@ -2045,13 +2057,18 @@ fn total_issuance_after_evm_transaction_without_priority_fee() { // Fee is 1 GWEI base fee. let base_fee = TransactionPaymentAsGasPrice::min_gas_price().0; assert_eq!(base_fee.as_u128(), BASE_FEE_GENISIS); // hint in case following asserts fail - let fee = (base_fee.as_u128() * 21_000u128) as f64; - // 80% was burned. - let expected_burn = (fee * 0.8) as u128; - assert_eq!(issuance_after, issuance_before - expected_burn,); - // 20% was sent to treasury. - let expected_treasury = (fee * 0.2) as u128; - assert_eq!(moonbase_runtime::Treasury::pot(), expected_treasury); + + let base_fee: Balance = BASE_FEE_GENISIS * 21_000; + + let treasury_proportion = dynamic_params::runtime_config::FeesTreasuryProportion::get(); + + // only base fee is split between being burned and sent to treasury + let treasury_base_fee_part: Balance = treasury_proportion.mul_floor(base_fee); + let burnt_base_fee_part: Balance = base_fee - treasury_base_fee_part; + + assert_eq!(issuance_after, issuance_before - burnt_base_fee_part); + + assert_eq!(moonbase_runtime::Treasury::pot(), treasury_base_fee_part); }); } @@ -2780,21 +2797,27 @@ fn substrate_based_fees_zero_txn_costs_only_base_extrinsic() { #[test] fn deal_with_fees_handles_tip() { use frame_support::traits::OnUnbalanced; - use moonbase_runtime::{DealWithFees, Treasury}; + use moonbase_runtime::Treasury; + use moonbeam_runtime_common::deal_with_fees::DealWithSubstrateFeesAndTip; ExtBuilder::default().build().execute_with(|| { - // This test checks the functionality of the `DealWithFees` trait implementation in the runtime. - // It simulates a scenario where a fee and a tip are issued to an account and ensures that the - // treasury receives the correct amount (20% of the total), and the rest is burned (80%). - // - // The test follows these steps: - // 1. It issues a fee of 100 and a tip of 1000. - // 2. It checks the total supply before the fee and tip are dealt with, which should be 1_100. - // 3. It checks that the treasury's balance is initially 0. - // 4. It calls `DealWithFees::on_unbalanceds` with the fee and tip. - // 5. It checks that the treasury's balance is now 220 (20% of the fee and tip). - // 6. It checks that the total supply has decreased by 880 (80% of the fee and tip), indicating - // that this amount was burned. + set_parachain_inherent_data(); + // This test validates the functionality of the `DealWithSubstrateFeesAndTip` trait implementation + // in the Moonbeam runtime. It verifies that: + // - The correct proportion of the fee is sent to the treasury. + // - The remaining fee is burned (removed from the total supply). + // - The entire tip is sent to the block author. + + // The test details: + // 1. Simulate issuing a `fee` of 100 and a `tip` of 1000. + // 2. Confirm the initial total supply is 1,100 (equal to the sum of the issued fee and tip). + // 3. Confirm the treasury's balance is initially 0. + // 4. Execute the `DealWithSubstrateFeesAndTip::on_unbalanceds` function with the `fee` and `tip`. + // 5. Validate that the treasury's balance has increased by 20% of the fee (based on FeesTreasuryProportion). + // 6. Validate that 80% of the fee is burned, and the total supply decreases accordingly. + // 7. Validate that the entire tip (100%) is sent to the block author (collator). + + // Step 1: Issue the fee and tip amounts. let fee = as frame_support::traits::fungible::Balanced< AccountId, >>::issue(100); @@ -2802,18 +2825,41 @@ fn deal_with_fees_handles_tip() { AccountId, >>::issue(1000); + // Step 2: Validate the initial supply and balances. let total_supply_before = Balances::total_issuance(); + let block_author = pallet_author_inherent::Pallet::::get(); + let block_author_balance_before = Balances::free_balance(&block_author); assert_eq!(total_supply_before, 1_100); assert_eq!(Balances::free_balance(&Treasury::account_id()), 0); - DealWithFees::on_unbalanceds(vec![fee, tip].into_iter()); + // Step 3: Execute the fees handling logic. + DealWithSubstrateFeesAndTip::< + Runtime, + dynamic_params::runtime_config::FeesTreasuryProportion, + >::on_unbalanceds(vec![fee, tip].into_iter()); + + // Step 4: Compute the split between treasury and burned fees based on FeesTreasuryProportion (20%). + let treasury_proportion = dynamic_params::runtime_config::FeesTreasuryProportion::get(); + + let treasury_fee_part: Balance = treasury_proportion.mul_floor(100); + let burnt_fee_part: Balance = 100 - treasury_fee_part; - // treasury should have received 20% - assert_eq!(Balances::free_balance(&Treasury::account_id()), 220); + // Step 5: Validate the treasury received 20% of the fee. + assert_eq!( + Balances::free_balance(&Treasury::account_id()), + treasury_fee_part, + ); - // verify 80% burned + // Step 6: Verify that 80% of the fee was burned (removed from the total supply). let total_supply_after = Balances::total_issuance(); - assert_eq!(total_supply_before - total_supply_after, 880); + assert_eq!(total_supply_before - total_supply_after, burnt_fee_part,); + + // Step 7: Validate that the block author (collator) received 100% of the tip. + let block_author_balance_after = Balances::free_balance(&block_author); + assert_eq!( + block_author_balance_after - block_author_balance_before, + 1000, + ); }); } diff --git a/runtime/moonbase/tests/runtime_apis.rs b/runtime/moonbase/tests/runtime_apis.rs index 7cfb9dc103..66f1e0edce 100644 --- a/runtime/moonbase/tests/runtime_apis.rs +++ b/runtime/moonbase/tests/runtime_apis.rs @@ -216,6 +216,8 @@ fn ethereum_runtime_rpc_api_current_transaction_statuses() { )]) .build() .execute_with(|| { + set_parachain_inherent_data(); + let _result = Executive::apply_extrinsic(unchecked_eth_tx(VALID_ETH_TX)); rpc_run_to_block(2); let statuses = @@ -273,6 +275,7 @@ fn ethereum_runtime_rpc_api_current_receipts() { )]) .build() .execute_with(|| { + set_parachain_inherent_data(); let _result = Executive::apply_extrinsic(unchecked_eth_tx(VALID_ETH_TX)); rpc_run_to_block(2); let receipts = Runtime::current_receipts().expect("Receipts result."); diff --git a/runtime/moonbeam/src/lib.rs b/runtime/moonbeam/src/lib.rs index b5816bede2..74be2eeeec 100644 --- a/runtime/moonbeam/src/lib.rs +++ b/runtime/moonbeam/src/lib.rs @@ -46,11 +46,9 @@ use frame_support::{ parameter_types, traits::{ fungible::{Balanced, Credit, HoldConsideration, Inspect}, - tokens::imbalance::ResolveTo, tokens::{PayFromAccount, UnityAssetBalanceConversion}, ConstBool, ConstU128, ConstU16, ConstU32, ConstU64, ConstU8, Contains, EitherOfDiverse, - EqualPrivilegeOnly, Imbalance, InstanceFilter, LinearStoragePrice, OnFinalize, - OnUnbalanced, + EqualPrivilegeOnly, InstanceFilter, LinearStoragePrice, OnFinalize, OnUnbalanced, }, weights::{ constants::WEIGHT_REF_TIME_PER_SECOND, ConstantMultiplier, Weight, WeightToFeeCoefficient, @@ -75,7 +73,6 @@ use pallet_evm::{ }; pub use pallet_parachain_staking::{weights::WeightInfo, InflationInfo, Range}; use pallet_transaction_payment::{FungibleAdapter, Multiplier, TargetedFeeAdjustment}; -use pallet_treasury::TreasuryAccountId; use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use serde::{Deserialize, Serialize}; @@ -332,52 +329,6 @@ impl pallet_balances::Config for Runtime { type WeightInfo = moonbeam_weights::pallet_balances::WeightInfo; } -pub struct DealWithFees(sp_std::marker::PhantomData); -impl OnUnbalanced>> for DealWithFees -where - R: pallet_balances::Config + pallet_treasury::Config, -{ - // this seems to be called for substrate-based transactions - fn on_unbalanceds( - mut fees_then_tips: impl Iterator>>, - ) { - if let Some(fees) = fees_then_tips.next() { - let treasury_proportion = - runtime_params::dynamic_params::runtime_config::FeesTreasuryProportion::get(); - let treasury_part = treasury_proportion.deconstruct(); - let burn_part = Perbill::one().deconstruct() - treasury_part; - let (_, to_treasury) = fees.ration(burn_part, treasury_part); - // Balances pallet automatically burns dropped Credits by decreasing - // total_supply accordingly - ResolveTo::, pallet_balances::Pallet>::on_unbalanced( - to_treasury, - ); - - // handle tip if there is one - if let Some(tip) = fees_then_tips.next() { - // for now we use the same burn/treasury strategy used for regular fees - let (_, to_treasury) = tip.ration(burn_part, treasury_part); - ResolveTo::, pallet_balances::Pallet>::on_unbalanced( - to_treasury, - ); - } - } - } - - // this is called from pallet_evm for Ethereum-based transactions - // (technically, it calls on_unbalanced, which calls this when non-zero) - fn on_nonzero_unbalanced(amount: Credit>) { - // Balances pallet automatically burns dropped Credits by decreasing - // total_supply accordingly - let treasury_proportion = - runtime_params::dynamic_params::runtime_config::FeesTreasuryProportion::get(); - let treasury_part = treasury_proportion.deconstruct(); - let burn_part = Perbill::one().deconstruct() - treasury_part; - let (_, to_treasury) = amount.ration(burn_part, treasury_part); - ResolveTo::, pallet_balances::Pallet>::on_unbalanced(to_treasury); - } -} - pub struct LengthToFee; impl WeightToFeePolynomial for LengthToFee { type Balance = Balance; @@ -402,7 +353,13 @@ impl WeightToFeePolynomial for LengthToFee { impl pallet_transaction_payment::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type OnChargeTransaction = FungibleAdapter>; + type OnChargeTransaction = FungibleAdapter< + Balances, + DealWithSubstrateFeesAndTip< + Runtime, + dynamic_params::runtime_config::FeesTreasuryProportion, + >, + >; type OperationalFeeMultiplier = ConstU8<5>; type WeightToFee = ConstantMultiplier>; type LengthToFee = LengthToFee; @@ -533,7 +490,10 @@ impl pallet_evm::Config for Runtime { type PrecompilesType = MoonbeamPrecompiles; type PrecompilesValue = PrecompilesValue; type ChainId = EthereumChainId; - type OnChargeTransaction = OnChargeEVMTransaction>; + type OnChargeTransaction = OnChargeEVMTransaction< + DealWithEthereumBaseFees, + DealWithEthereumPriorityFees, + >; type BlockGasLimit = BlockGasLimit; type FindAuthor = FindAuthorAdapter; type OnCreate = (); @@ -1491,6 +1451,10 @@ construct_runtime! { #[cfg(feature = "runtime-benchmarks")] use moonbeam_runtime_common::benchmarking::BenchmarkHelper; +use moonbeam_runtime_common::deal_with_fees::{ + DealWithEthereumBaseFees, DealWithEthereumPriorityFees, DealWithSubstrateFeesAndTip, +}; + #[cfg(feature = "runtime-benchmarks")] mod benches { frame_support::parameter_types! { diff --git a/runtime/moonbeam/tests/common/mod.rs b/runtime/moonbeam/tests/common/mod.rs index 9301dd123b..f83d7ad8a0 100644 --- a/runtime/moonbeam/tests/common/mod.rs +++ b/runtime/moonbeam/tests/common/mod.rs @@ -345,6 +345,9 @@ pub fn set_parachain_inherent_data() { use cumulus_primitives_core::PersistedValidationData; use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder; + let author = AccountId::from(>::find_author()); + pallet_author_inherent::Author::::put(author); + let mut relay_sproof = RelayStateSproofBuilder::default(); relay_sproof.para_id = 100u32.into(); relay_sproof.included_para_head = Some(HeadData(vec![1, 2, 3])); diff --git a/runtime/moonbeam/tests/integration_test.rs b/runtime/moonbeam/tests/integration_test.rs index 7147220384..1e9bc5c73a 100644 --- a/runtime/moonbeam/tests/integration_test.rs +++ b/runtime/moonbeam/tests/integration_test.rs @@ -33,6 +33,7 @@ use frame_support::{ StorageHasher, Twox128, }; use moonbeam_runtime::currency::{GIGAWEI, WEI}; +use moonbeam_runtime::runtime_params::dynamic_params; use moonbeam_runtime::{ asset_config::ForeignAssetInstance, currency::GLMR, @@ -57,7 +58,7 @@ use precompile_utils::{ testing::*, }; use sha3::{Digest, Keccak256}; -use sp_core::{ByteArray, Pair, H160, U256}; +use sp_core::{ByteArray, Get, Pair, H160, U256}; use sp_runtime::{ traits::{Convert, Dispatchable}, BuildStorage, DispatchError, ModuleError, @@ -1444,6 +1445,7 @@ fn transfer_ed_0_evm() { ]) .build() .execute_with(|| { + set_parachain_inherent_data(); // EVM transfer assert_ok!(RuntimeCall::EVM(pallet_evm::Call::::call { source: H160::from(ALICE), @@ -1474,6 +1476,7 @@ fn refund_ed_0_evm() { ]) .build() .execute_with(|| { + set_parachain_inherent_data(); // EVM transfer that zeroes ALICE assert_ok!(RuntimeCall::EVM(pallet_evm::Call::::call { source: H160::from(ALICE), @@ -1496,7 +1499,7 @@ fn refund_ed_0_evm() { } #[test] -fn author_does_not_receive_priority_fee() { +fn author_does_receive_priority_fee() { ExtBuilder::default() .with_balances(vec![( AccountId::from(BOB), @@ -1506,6 +1509,7 @@ fn author_does_not_receive_priority_fee() { .execute_with(|| { // Some block author as seen by pallet-evm. let author = AccountId::from(>::find_author()); + pallet_author_inherent::Author::::put(author); // Currently the default impl of the evm uses `deposit_into_existing`. // If we were to use this implementation, and for an author to receive eventual tips, // the account needs to be somehow initialized, otherwise the deposit would fail. @@ -1524,13 +1528,16 @@ fn author_does_not_receive_priority_fee() { access_list: Vec::new(), }) .dispatch(::RuntimeOrigin::root())); - // Author free balance didn't change. - assert_eq!(Balances::free_balance(author), 100 * GLMR,); + + let priority_fee = 200 * GIGAWEI * 21_000; + // Author free balance increased by priority fee. + assert_eq!(Balances::free_balance(author), 100 * GLMR + priority_fee,); }); } #[test] fn total_issuance_after_evm_transaction_with_priority_fee() { + use fp_evm::FeeCalculator; ExtBuilder::default() .with_balances(vec![ ( @@ -1545,6 +1552,8 @@ fn total_issuance_after_evm_transaction_with_priority_fee() { .build() .execute_with(|| { let issuance_before = ::Currency::total_issuance(); + let author = AccountId::from(>::find_author()); + pallet_author_inherent::Author::::put(author); // EVM transfer. assert_ok!(RuntimeCall::EVM(pallet_evm::Call::::call { source: H160::from(BOB), @@ -1560,19 +1569,26 @@ fn total_issuance_after_evm_transaction_with_priority_fee() { .dispatch(::RuntimeOrigin::root())); let issuance_after = ::Currency::total_issuance(); - // Fee is 25 GWEI base fee + 100 GWEI tip. - let fee = ((125 * GIGAWEI) * 21_000) as f64; - // 80% was burned. - let expected_burn = (fee * 0.8) as u128; - assert_eq!(issuance_after, issuance_before - expected_burn,); - // 20% was sent to treasury. - let expected_treasury = (fee * 0.2) as u128; - assert_eq!(moonbeam_runtime::Treasury::pot(), expected_treasury); + + let base_fee = TransactionPaymentAsGasPrice::min_gas_price().0.as_u128(); + + let base_fee: Balance = base_fee * 21_000; + + let treasury_proportion = dynamic_params::runtime_config::FeesTreasuryProportion::get(); + + // only base fee is split between being burned and sent to treasury + let treasury_base_fee_part: Balance = treasury_proportion.mul_floor(base_fee); + let burnt_base_fee_part: Balance = base_fee - treasury_base_fee_part; + + assert_eq!(issuance_after, issuance_before - burnt_base_fee_part); + + assert_eq!(moonbeam_runtime::Treasury::pot(), treasury_base_fee_part); }); } #[test] fn total_issuance_after_evm_transaction_without_priority_fee() { + use fp_evm::FeeCalculator; ExtBuilder::default() .with_balances(vec![ ( @@ -1586,6 +1602,7 @@ fn total_issuance_after_evm_transaction_without_priority_fee() { ]) .build() .execute_with(|| { + set_parachain_inherent_data(); let issuance_before = ::Currency::total_issuance(); // EVM transfer. assert_ok!(RuntimeCall::EVM(pallet_evm::Call::::call { @@ -1602,14 +1619,20 @@ fn total_issuance_after_evm_transaction_without_priority_fee() { .dispatch(::RuntimeOrigin::root())); let issuance_after = ::Currency::total_issuance(); - // Fee is 100 GWEI base fee. - let fee = (BASE_FEE_GENESIS * 21_000) as f64; - // 80% was burned. - let expected_burn = (fee * 0.8) as u128; - assert_eq!(issuance_after, issuance_before - expected_burn,); - // 20% was sent to treasury. - let expected_treasury = (fee * 0.2) as u128; - assert_eq!(moonbeam_runtime::Treasury::pot(), expected_treasury); + + let base_fee = TransactionPaymentAsGasPrice::min_gas_price().0.as_u128(); + + let base_fee: Balance = base_fee * 21_000; + + let treasury_proportion = dynamic_params::runtime_config::FeesTreasuryProportion::get(); + + // only base fee is split between being burned and sent to treasury + let treasury_base_fee_part: Balance = treasury_proportion.mul_floor(base_fee); + let burnt_base_fee_part: Balance = base_fee - treasury_base_fee_part; + + assert_eq!(issuance_after, issuance_before - burnt_base_fee_part); + + assert_eq!(moonbeam_runtime::Treasury::pot(), treasury_base_fee_part); }); } @@ -2595,21 +2618,27 @@ fn removed_precompiles() { #[test] fn deal_with_fees_handles_tip() { use frame_support::traits::OnUnbalanced; - use moonbeam_runtime::{DealWithFees, Treasury}; + use moonbeam_runtime::Treasury; + use moonbeam_runtime_common::deal_with_fees::DealWithSubstrateFeesAndTip; ExtBuilder::default().build().execute_with(|| { - // This test checks the functionality of the `DealWithFees` trait implementation in the runtime. - // It simulates a scenario where a fee and a tip are issued to an account and ensures that the - // treasury receives the correct amount (20% of the total), and the rest is burned (80%). - // - // The test follows these steps: - // 1. It issues a fee of 100 and a tip of 1000. - // 2. It checks the total supply before the fee and tip are dealt with, which should be 1_100. - // 3. It checks that the treasury's balance is initially 0. - // 4. It calls `DealWithFees::on_unbalanceds` with the fee and tip. - // 5. It checks that the treasury's balance is now 220 (20% of the fee and tip). - // 6. It checks that the total supply has decreased by 880 (80% of the fee and tip), indicating - // that this amount was burned. + set_parachain_inherent_data(); + // This test validates the functionality of the `DealWithSubstrateFeesAndTip` trait implementation + // in the Moonbeam runtime. It verifies that: + // - The correct proportion of the fee is sent to the treasury. + // - The remaining fee is burned (removed from the total supply). + // - The entire tip is sent to the block author. + + // The test details: + // 1. Simulate issuing a `fee` of 100 and a `tip` of 1000. + // 2. Confirm the initial total supply is 1,100 (equal to the sum of the issued fee and tip). + // 3. Confirm the treasury's balance is initially 0. + // 4. Execute the `DealWithSubstrateFeesAndTip::on_unbalanceds` function with the `fee` and `tip`. + // 5. Validate that the treasury's balance has increased by 20% of the fee (based on FeesTreasuryProportion). + // 6. Validate that 80% of the fee is burned, and the total supply decreases accordingly. + // 7. Validate that the entire tip (100%) is sent to the block author (collator). + + // Step 1: Issue the fee and tip amounts. let fee = as frame_support::traits::fungible::Balanced< AccountId, >>::issue(100); @@ -2617,18 +2646,41 @@ fn deal_with_fees_handles_tip() { AccountId, >>::issue(1000); + // Step 2: Validate the initial supply and balances. let total_supply_before = Balances::total_issuance(); + let block_author = pallet_author_inherent::Pallet::::get(); + let block_author_balance_before = Balances::free_balance(&block_author); assert_eq!(total_supply_before, 1_100); assert_eq!(Balances::free_balance(&Treasury::account_id()), 0); - DealWithFees::on_unbalanceds(vec![fee, tip].into_iter()); + // Step 3: Execute the fees handling logic. + DealWithSubstrateFeesAndTip::< + Runtime, + dynamic_params::runtime_config::FeesTreasuryProportion, + >::on_unbalanceds(vec![fee, tip].into_iter()); + + // Step 4: Compute the split between treasury and burned fees based on FeesTreasuryProportion (20%). + let treasury_proportion = dynamic_params::runtime_config::FeesTreasuryProportion::get(); - // treasury should have received 20% - assert_eq!(Balances::free_balance(&Treasury::account_id()), 220); + let treasury_fee_part: Balance = treasury_proportion.mul_floor(100); + let burnt_fee_part: Balance = 100 - treasury_fee_part; - // verify 80% burned + // Step 5: Validate the treasury received 20% of the fee. + assert_eq!( + Balances::free_balance(&Treasury::account_id()), + treasury_fee_part, + ); + + // Step 6: Verify that 80% of the fee was burned (removed from the total supply). let total_supply_after = Balances::total_issuance(); - assert_eq!(total_supply_before - total_supply_after, 880); + assert_eq!(total_supply_before - total_supply_after, burnt_fee_part,); + + // Step 7: Validate that the block author (collator) received 100% of the tip. + let block_author_balance_after = Balances::free_balance(&block_author); + assert_eq!( + block_author_balance_after - block_author_balance_before, + 1000, + ); }); } diff --git a/runtime/moonriver/src/lib.rs b/runtime/moonriver/src/lib.rs index 47e564ea5a..f0e5062258 100644 --- a/runtime/moonriver/src/lib.rs +++ b/runtime/moonriver/src/lib.rs @@ -47,11 +47,9 @@ use frame_support::{ parameter_types, traits::{ fungible::{Balanced, Credit, HoldConsideration, Inspect}, - tokens::imbalance::ResolveTo, tokens::{PayFromAccount, UnityAssetBalanceConversion}, ConstBool, ConstU128, ConstU16, ConstU32, ConstU64, ConstU8, Contains, EitherOfDiverse, - EqualPrivilegeOnly, Imbalance, InstanceFilter, LinearStoragePrice, OnFinalize, - OnUnbalanced, + EqualPrivilegeOnly, InstanceFilter, LinearStoragePrice, OnFinalize, OnUnbalanced, }, weights::{ constants::WEIGHT_REF_TIME_PER_SECOND, ConstantMultiplier, Weight, WeightToFeeCoefficient, @@ -65,6 +63,9 @@ pub use moonbeam_core_primitives::{ Index, Signature, }; use moonbeam_rpc_primitives_txpool::TxPoolResponse; +use moonbeam_runtime_common::deal_with_fees::{ + DealWithEthereumBaseFees, DealWithEthereumPriorityFees, DealWithSubstrateFeesAndTip, +}; use moonbeam_runtime_common::timestamp::{ConsensusHookWrapperForRelayTimestamp, RelayTimestamp}; pub use pallet_author_slot_filter::EligibilityValue; use pallet_ethereum::Call::transact; @@ -76,7 +77,6 @@ use pallet_evm::{ }; pub use pallet_parachain_staking::{weights::WeightInfo, InflationInfo, Range}; use pallet_transaction_payment::{FungibleAdapter, Multiplier, TargetedFeeAdjustment}; -use pallet_treasury::TreasuryAccountId; use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use sp_api::impl_runtime_apis; @@ -334,52 +334,6 @@ impl pallet_balances::Config for Runtime { type WeightInfo = moonriver_weights::pallet_balances::WeightInfo; } -pub struct DealWithFees(sp_std::marker::PhantomData); -impl OnUnbalanced>> for DealWithFees -where - R: pallet_balances::Config + pallet_treasury::Config, -{ - // this seems to be called for substrate-based transactions - fn on_unbalanceds( - mut fees_then_tips: impl Iterator>>, - ) { - if let Some(fees) = fees_then_tips.next() { - let treasury_proportion = - runtime_params::dynamic_params::runtime_config::FeesTreasuryProportion::get(); - let treasury_part = treasury_proportion.deconstruct(); - let burn_part = Perbill::one().deconstruct() - treasury_part; - let (_, to_treasury) = fees.ration(burn_part, treasury_part); - // Balances pallet automatically burns dropped Credits by decreasing - // total_supply accordingly - ResolveTo::, pallet_balances::Pallet>::on_unbalanced( - to_treasury, - ); - - // handle tip if there is one - if let Some(tip) = fees_then_tips.next() { - // for now we use the same burn/treasury strategy used for regular fees - let (_, to_treasury) = tip.ration(burn_part, treasury_part); - ResolveTo::, pallet_balances::Pallet>::on_unbalanced( - to_treasury, - ); - } - } - } - - // this is called from pallet_evm for Ethereum-based transactions - // (technically, it calls on_unbalanced, which calls this when non-zero) - fn on_nonzero_unbalanced(amount: Credit>) { - // Balances pallet automatically burns dropped Credits by decreasing - // total_supply accordingly - let treasury_proportion = - runtime_params::dynamic_params::runtime_config::FeesTreasuryProportion::get(); - let treasury_part = treasury_proportion.deconstruct(); - let burn_part = Perbill::one().deconstruct() - treasury_part; - let (_, to_treasury) = amount.ration(burn_part, treasury_part); - ResolveTo::, pallet_balances::Pallet>::on_unbalanced(to_treasury); - } -} - pub struct LengthToFee; impl WeightToFeePolynomial for LengthToFee { type Balance = Balance; @@ -404,7 +358,13 @@ impl WeightToFeePolynomial for LengthToFee { impl pallet_transaction_payment::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type OnChargeTransaction = FungibleAdapter>; + type OnChargeTransaction = FungibleAdapter< + Balances, + DealWithSubstrateFeesAndTip< + Runtime, + dynamic_params::runtime_config::FeesTreasuryProportion, + >, + >; type OperationalFeeMultiplier = ConstU8<5>; type WeightToFee = ConstantMultiplier>; type LengthToFee = LengthToFee; @@ -535,7 +495,10 @@ impl pallet_evm::Config for Runtime { type PrecompilesType = MoonriverPrecompiles; type PrecompilesValue = PrecompilesValue; type ChainId = EthereumChainId; - type OnChargeTransaction = OnChargeEVMTransaction>; + type OnChargeTransaction = OnChargeEVMTransaction< + DealWithEthereumBaseFees, + DealWithEthereumPriorityFees, + >; type BlockGasLimit = BlockGasLimit; type FindAuthor = FindAuthorAdapter; type OnCreate = (); diff --git a/runtime/moonriver/tests/common/mod.rs b/runtime/moonriver/tests/common/mod.rs index 249debb227..32d0dd8b33 100644 --- a/runtime/moonriver/tests/common/mod.rs +++ b/runtime/moonriver/tests/common/mod.rs @@ -352,6 +352,9 @@ pub fn set_parachain_inherent_data() { use cumulus_primitives_core::PersistedValidationData; use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder; + let author = AccountId::from(>::find_author()); + pallet_author_inherent::Author::::put(author); + let mut relay_sproof = RelayStateSproofBuilder::default(); relay_sproof.para_id = 100u32.into(); relay_sproof.included_para_head = Some(HeadData(vec![1, 2, 3])); diff --git a/runtime/moonriver/tests/integration_test.rs b/runtime/moonriver/tests/integration_test.rs index 2e45b0976f..0109796f46 100644 --- a/runtime/moonriver/tests/integration_test.rs +++ b/runtime/moonriver/tests/integration_test.rs @@ -33,6 +33,7 @@ use frame_support::{ use moonbeam_xcm_benchmarks::weights::XcmWeight; use moonkit_xcm_primitives::AccountIdAssetIdConversion; use moonriver_runtime::currency::{GIGAWEI, WEI}; +use moonriver_runtime::runtime_params::dynamic_params; use moonriver_runtime::{ asset_config::ForeignAssetInstance, xcm_config::{CurrencyId, SelfReserve}, @@ -53,7 +54,7 @@ use precompile_utils::{ testing::*, }; use sha3::{Digest, Keccak256}; -use sp_core::{ByteArray, Pair, H160, U256}; +use sp_core::{ByteArray, Get, Pair, H160, U256}; use sp_runtime::{ traits::{Convert, Dispatchable}, BuildStorage, DispatchError, ModuleError, @@ -1428,6 +1429,7 @@ fn transfer_ed_0_evm() { ]) .build() .execute_with(|| { + set_parachain_inherent_data(); // EVM transfer assert_ok!(RuntimeCall::EVM(pallet_evm::Call::::call { source: H160::from(ALICE), @@ -1458,6 +1460,7 @@ fn refund_ed_0_evm() { ]) .build() .execute_with(|| { + set_parachain_inherent_data(); // EVM transfer that zeroes ALICE assert_ok!(RuntimeCall::EVM(pallet_evm::Call::::call { source: H160::from(ALICE), @@ -1480,7 +1483,7 @@ fn refund_ed_0_evm() { } #[test] -fn author_does_not_receive_priority_fee() { +fn author_does_receive_priority_fee() { ExtBuilder::default() .with_balances(vec![( AccountId::from(BOB), @@ -1490,6 +1493,7 @@ fn author_does_not_receive_priority_fee() { .execute_with(|| { // Some block author as seen by pallet-evm. let author = AccountId::from(>::find_author()); + pallet_author_inherent::Author::::put(author); // Currently the default impl of the evm uses `deposit_into_existing`. // If we were to use this implementation, and for an author to receive eventual tips, // the account needs to be somehow initialized, otherwise the deposit would fail. @@ -1508,13 +1512,16 @@ fn author_does_not_receive_priority_fee() { access_list: Vec::new(), }) .dispatch(::RuntimeOrigin::root())); - // Author free balance didn't change. - assert_eq!(Balances::free_balance(author), 100 * MOVR,); + + let priority_fee = 200 * GIGAWEI * 21_000; + // Author free balance increased by priority fee. + assert_eq!(Balances::free_balance(author), 100 * MOVR + priority_fee,); }); } #[test] fn total_issuance_after_evm_transaction_with_priority_fee() { + use fp_evm::FeeCalculator; ExtBuilder::default() .with_balances(vec![ ( @@ -1529,6 +1536,8 @@ fn total_issuance_after_evm_transaction_with_priority_fee() { .build() .execute_with(|| { let issuance_before = ::Currency::total_issuance(); + let author = AccountId::from(>::find_author()); + pallet_author_inherent::Author::::put(author); // EVM transfer. assert_ok!(RuntimeCall::EVM(pallet_evm::Call::::call { source: H160::from(BOB), @@ -1544,18 +1553,26 @@ fn total_issuance_after_evm_transaction_with_priority_fee() { .dispatch(::RuntimeOrigin::root())); let issuance_after = ::Currency::total_issuance(); - let fee = ((2 * BASE_FEE_GENESIS) * 21_000) as f64; - // 80% was burned. - let expected_burn = (fee * 0.8) as u128; - assert_eq!(issuance_after, issuance_before - expected_burn,); - // 20% was sent to treasury. - let expected_treasury = (fee * 0.2) as u128; - assert_eq!(moonriver_runtime::Treasury::pot(), expected_treasury); + + let base_fee = TransactionPaymentAsGasPrice::min_gas_price().0.as_u128(); + + let base_fee: Balance = base_fee * 21_000; + + let treasury_proportion = dynamic_params::runtime_config::FeesTreasuryProportion::get(); + + // only base fee is split between being burned and sent to treasury + let treasury_base_fee_part: Balance = treasury_proportion.mul_floor(base_fee); + let burnt_base_fee_part: Balance = base_fee - treasury_base_fee_part; + + assert_eq!(issuance_after, issuance_before - burnt_base_fee_part); + + assert_eq!(moonriver_runtime::Treasury::pot(), treasury_base_fee_part); }); } #[test] fn total_issuance_after_evm_transaction_without_priority_fee() { + use fp_evm::FeeCalculator; ExtBuilder::default() .with_balances(vec![ ( @@ -1578,20 +1595,27 @@ fn total_issuance_after_evm_transaction_without_priority_fee() { value: (1 * MOVR).into(), gas_limit: 21_000u64, max_fee_per_gas: U256::from(BASE_FEE_GENESIS), - max_priority_fee_per_gas: Some(U256::from(BASE_FEE_GENESIS)), + max_priority_fee_per_gas: None, nonce: Some(U256::from(0)), access_list: Vec::new(), }) .dispatch(::RuntimeOrigin::root())); let issuance_after = ::Currency::total_issuance(); - let fee = ((1 * BASE_FEE_GENESIS) * 21_000) as f64; - // 80% was burned. - let expected_burn = (fee * 0.8) as u128; - assert_eq!(issuance_after, issuance_before - expected_burn,); - // 20% was sent to treasury. - let expected_treasury = (fee * 0.2) as u128; - assert_eq!(moonriver_runtime::Treasury::pot(), expected_treasury); + + let base_fee = TransactionPaymentAsGasPrice::min_gas_price().0.as_u128(); + + let base_fee: Balance = base_fee * 21_000; + + let treasury_proportion = dynamic_params::runtime_config::FeesTreasuryProportion::get(); + + // only base fee is split between being burned and sent to treasury + let treasury_base_fee_part: Balance = treasury_proportion.mul_floor(base_fee); + let burnt_base_fee_part: Balance = base_fee - treasury_base_fee_part; + + assert_eq!(issuance_after, issuance_before - burnt_base_fee_part); + + assert_eq!(moonriver_runtime::Treasury::pot(), treasury_base_fee_part); }); } @@ -2493,21 +2517,27 @@ fn removed_precompiles() { #[test] fn deal_with_fees_handles_tip() { use frame_support::traits::OnUnbalanced; - use moonriver_runtime::{DealWithFees, Treasury}; + use moonbeam_runtime_common::deal_with_fees::DealWithSubstrateFeesAndTip; + use moonriver_runtime::Treasury; ExtBuilder::default().build().execute_with(|| { - // This test checks the functionality of the `DealWithFees` trait implementation in the runtime. - // It simulates a scenario where a fee and a tip are issued to an account and ensures that the - // treasury receives the correct amount (20% of the total), and the rest is burned (80%). - // - // The test follows these steps: - // 1. It issues a fee of 100 and a tip of 1000. - // 2. It checks the total supply before the fee and tip are dealt with, which should be 1_100. - // 3. It checks that the treasury's balance is initially 0. - // 4. It calls `DealWithFees::on_unbalanceds` with the fee and tip. - // 5. It checks that the treasury's balance is now 220 (20% of the fee and tip). - // 6. It checks that the total supply has decreased by 880 (80% of the fee and tip), indicating - // that this amount was burned. + set_parachain_inherent_data(); + // This test validates the functionality of the `DealWithSubstrateFeesAndTip` trait implementation + // in the Moonriver runtime. It verifies that: + // - The correct proportion of the fee is sent to the treasury. + // - The remaining fee is burned (removed from the total supply). + // - The entire tip is sent to the block author. + + // The test details: + // 1. Simulate issuing a `fee` of 100 and a `tip` of 1000. + // 2. Confirm the initial total supply is 1,100 (equal to the sum of the issued fee and tip). + // 3. Confirm the treasury's balance is initially 0. + // 4. Execute the `DealWithSubstrateFeesAndTip::on_unbalanceds` function with the `fee` and `tip`. + // 5. Validate that the treasury's balance has increased by 20% of the fee (based on FeesTreasuryProportion). + // 6. Validate that 80% of the fee is burned, and the total supply decreases accordingly. + // 7. Validate that the entire tip (100%) is sent to the block author (collator). + + // Step 1: Issue the fee and tip amounts. let fee = as frame_support::traits::fungible::Balanced< AccountId, >>::issue(100); @@ -2515,18 +2545,41 @@ fn deal_with_fees_handles_tip() { AccountId, >>::issue(1000); + // Step 2: Validate the initial supply and balances. let total_supply_before = Balances::total_issuance(); + let block_author = pallet_author_inherent::Pallet::::get(); + let block_author_balance_before = Balances::free_balance(&block_author); assert_eq!(total_supply_before, 1_100); assert_eq!(Balances::free_balance(&Treasury::account_id()), 0); - DealWithFees::on_unbalanceds(vec![fee, tip].into_iter()); + // Step 3: Execute the fees handling logic. + DealWithSubstrateFeesAndTip::< + Runtime, + dynamic_params::runtime_config::FeesTreasuryProportion, + >::on_unbalanceds(vec![fee, tip].into_iter()); + + // Step 4: Compute the split between treasury and burned fees based on FeesTreasuryProportion (20%). + let treasury_proportion = dynamic_params::runtime_config::FeesTreasuryProportion::get(); - // treasury should have received 20% - assert_eq!(Balances::free_balance(&Treasury::account_id()), 220); + let treasury_fee_part: Balance = treasury_proportion.mul_floor(100); + let burnt_fee_part: Balance = 100 - treasury_fee_part; - // verify 80% burned + // Step 5: Validate the treasury received 20% of the fee. + assert_eq!( + Balances::free_balance(&Treasury::account_id()), + treasury_fee_part, + ); + + // Step 6: Verify that 80% of the fee was burned (removed from the total supply). let total_supply_after = Balances::total_issuance(); - assert_eq!(total_supply_before - total_supply_after, 880); + assert_eq!(total_supply_before - total_supply_after, burnt_fee_part,); + + // Step 7: Validate that the block author (collator) received 100% of the tip. + let block_author_balance_after = Balances::free_balance(&block_author); + assert_eq!( + block_author_balance_after - block_author_balance_before, + 1000, + ); }); } diff --git a/test/helpers/block.ts b/test/helpers/block.ts index a2ab88991f..076c3ba34d 100644 --- a/test/helpers/block.ts +++ b/test/helpers/block.ts @@ -4,7 +4,6 @@ import { type BlockRangeOption, EXTRINSIC_BASE_WEIGHT, WEIGHT_PER_GAS, - calculateFeePortions, mapExtrinsics, } from "@moonwall/util"; import type { ApiPromise } from "@polkadot/api"; @@ -17,6 +16,8 @@ import type { AccountId20, Block } from "@polkadot/types/interfaces/runtime/type import chalk from "chalk"; import type { Debugger } from "debug"; import Debug from "debug"; +import { calculateFeePortions, split } from "./fees.ts"; +import { getFeesTreasuryProportion } from "./parameters.ts"; const debug = Debug("test:blocks"); @@ -149,6 +150,8 @@ export const verifyBlockFees = async ( ? (event.data[0] as DispatchInfo) : (event.data[1] as DispatchInfo); + const feesTreasuryProportion = await getFeesTreasuryProportion(context); + // We are only interested in fee paying extrinsics: // Either ethereum transactions or signed extrinsics with fees (substrate tx) if ( @@ -175,40 +178,47 @@ export const verifyBlockFees = async ( const baseFeePerGas = ( await context.viem().getBlock({ blockNumber: BigInt(number - 1) }) ).baseFeePerGas!; - let priorityFee; + let priorityFee; + let gasFee; // Transaction is an enum now with as many variants as supported transaction types. if (ethTxWrapper.isLegacy) { priorityFee = ethTxWrapper.asLegacy.gasPrice.toBigInt(); + gasFee = priorityFee; } else if (ethTxWrapper.isEip2930) { priorityFee = ethTxWrapper.asEip2930.gasPrice.toBigInt(); + gasFee = priorityFee; } else if (ethTxWrapper.isEip1559) { priorityFee = ethTxWrapper.asEip1559.maxPriorityFeePerGas.toBigInt(); + gasFee = ethTxWrapper.asEip1559.maxFeePerGas.toBigInt(); } - let effectiveTipPerGas = priorityFee - baseFeePerGas; - if (effectiveTipPerGas < 0n) { - effectiveTipPerGas = 0n; + let effectiveTipPerGas = gasFee - baseFeePerGas; + if (effectiveTipPerGas > priorityFee) { + effectiveTipPerGas = priorityFee; } - // Calculate the fees paid for base fee independently from tip fee. Both are subject - // to 80/20 split (burn/treasury) but calculating these over the sum of the two - // rather than independently leads to off-by-one errors. + // Calculate the fees paid for the base fee and tip fee independently. + // Only the base fee is subject to the split between burn and treasury. const baseFeesPaid = gasUsed * baseFeePerGas; const tipAsFeesPaid = gasUsed * effectiveTipPerGas; - const baseFeePortions = calculateFeePortions(baseFeesPaid); - const tipFeePortions = calculateFeePortions(tipAsFeesPaid); + const { burnt: baseFeePortionsBurnt } = calculateFeePortions( + feesTreasuryProportion, + baseFeesPaid + ); txFees += baseFeesPaid + tipAsFeesPaid; - txBurnt += baseFeePortions.burnt; - txBurnt += tipFeePortions.burnt; + txBurnt += baseFeePortionsBurnt; } else { // For a regular substrate tx, we use the partialFee - const feePortions = calculateFeePortions(fee.partialFee.toBigInt()); - const tipPortions = calculateFeePortions(extrinsic.tip.toBigInt()); + const feePortions = calculateFeePortions( + feesTreasuryProportion, + fee.partialFee.toBigInt() + ); + txFees += fee.partialFee.toBigInt() + extrinsic.tip.toBigInt(); - txBurnt += feePortions.burnt + tipPortions.burnt; + txBurnt += feePortions.burnt; // verify entire substrate txn fee const apiAt = await context.polkadotJs().at(previousBlockHash); @@ -239,11 +249,12 @@ export const verifyBlockFees = async ( })) as any ).toBigInt(); - // const tip = extrinsic.tip.toBigInt(); + const tip = extrinsic.tip.toBigInt(); const expectedPartialFee = lengthFee + weightFee + baseFee; - // Verify the computed fees are equal to the actual fees - expect(expectedPartialFee).to.eq((paymentEvent!.data[1] as u128).toBigInt()); + // Verify the computed fees are equal to the actual fees + tip + expect(expectedPartialFee + tip).to.eq((paymentEvent!.data[1] as u128).toBigInt()); + expect(tip).to.eq((paymentEvent!.data[2] as u128).toBigInt()); // Verify the computed fees are equal to the rpc computed fees expect(expectedPartialFee).to.eq(fee.partialFee.toBigInt()); diff --git a/test/helpers/fees.ts b/test/helpers/fees.ts new file mode 100644 index 0000000000..2b832c77d9 --- /dev/null +++ b/test/helpers/fees.ts @@ -0,0 +1,31 @@ +import { BN } from "@polkadot/util"; + +/// Recreation of fees.ration(burn_part, treasury_part) +export const split = (value: BN, part1: BN, part2: BN): [BN, BN] => { + const total = part1.add(part2); + if (total.eq(new BN(0)) || value.eq(new BN(0))) { + return [new BN(0), new BN(0)]; + } + const part1BN = value.mul(part1).div(total); + const part2BN = value.sub(part1BN); + return [part1BN, part2BN]; +}; + +export const calculateFeePortions = ( + feesTreasuryProportion: bigint, + fees: bigint +): { + burnt: bigint; + treasury: bigint; +} => { + const feesBN = new BN(fees.toString()); + const treasuryPartBN = new BN(feesTreasuryProportion.toString()); + const burntPartBN = new BN(1e9).sub(treasuryPartBN); + + const [burntBN, treasuryBN] = split(feesBN, burntPartBN, treasuryPartBN); + + return { + burnt: BigInt(burntBN.toString()), + treasury: BigInt(treasuryBN.toString()), + }; +}; diff --git a/test/helpers/index.ts b/test/helpers/index.ts index 3c64aadda8..71efcf002a 100644 --- a/test/helpers/index.ts +++ b/test/helpers/index.ts @@ -24,3 +24,5 @@ export * from "./voting"; export * from "./wormhole"; export * from "./xcm"; export * from "./tracingFns"; +export * from "./fees.ts"; +export * from "./parameters.ts"; diff --git a/test/helpers/parameters.ts b/test/helpers/parameters.ts new file mode 100644 index 0000000000..1bdb6d0c5c --- /dev/null +++ b/test/helpers/parameters.ts @@ -0,0 +1,14 @@ +import type { DevModeContext } from "@moonwall/cli"; + +export const getFeesTreasuryProportion = async (context: DevModeContext): Promise => { + const parameter = await context.polkadotJs().query.parameters.parameters({ + RuntimeConfig: "FeesTreasuryProportion", + }); + + // 20% default value + let feesTreasuryProportion = 200_000_000n; + if (parameter.isSome) { + feesTreasuryProportion = parameter.value.asRuntimeConfig.asFeesTreasuryProportion.toBigInt(); + } + return feesTreasuryProportion; +}; diff --git a/test/scripts/update-local-types.ts b/test/scripts/update-local-types.ts index 8e9945dfb2..d143bb741d 100644 --- a/test/scripts/update-local-types.ts +++ b/test/scripts/update-local-types.ts @@ -60,6 +60,7 @@ const startNode = (network: string, rpcPort: string, port: string) => { "--wasm-execution=interpreted-i-know-what-i-do", "--no-telemetry", "--no-prometheus", + "--rpc-cors=all", "--tmp", ], { @@ -107,7 +108,7 @@ const executeUpdateAPIScript = async () => { // Bundle types await executeScript("../../moonbeam-types-bundle", "pnpm i"); await executeScript("../../moonbeam-types-bundle", "pnpm build"); - await executeScript("../../moonbeam-types-bundle", "pnpm fmt:fix"); + await executeScript("../../moonbeam-types-bundle", "pnpm check:fix"); // Generate types console.log("Extracting metadata for all runtimes..."); diff --git a/test/suites/dev/moonbase/test-balance/test-balance-transfer.ts b/test/suites/dev/moonbase/test-balance/test-balance-transfer.ts index b4cc85ae45..13608adc3d 100644 --- a/test/suites/dev/moonbase/test-balance/test-balance-transfer.ts +++ b/test/suites/dev/moonbase/test-balance/test-balance-transfer.ts @@ -2,6 +2,7 @@ import "@moonbeam-network/api-augment"; import { beforeEach, describeSuite, expect } from "@moonwall/cli"; import { ALITH_ADDRESS, + CHARLETH_ADDRESS, BALTATHAR_ADDRESS, BALTATHAR_PRIVATE_KEY, CHARLETH_PRIVATE_KEY, @@ -77,16 +78,17 @@ describeSuite({ id: "T03", title: "should decrease from account", test: async function () { - const balanceBefore = await context.viem().getBalance({ address: ALITH_ADDRESS }); + const balanceBefore = await context.viem().getBalance({ address: CHARLETH_ADDRESS }); const fees = 21000n * GENESIS_BASE_FEE; await context.createBlock( await createRawTransfer(context, randomAddress, 512n, { gas: 21000n, gasPrice: GENESIS_BASE_FEE, txnType: "legacy", + privateKey: CHARLETH_PRIVATE_KEY, }) ); - const balanceAfter = await context.viem().getBalance({ address: ALITH_ADDRESS }); + const balanceAfter = await context.viem().getBalance({ address: CHARLETH_ADDRESS }); expect(balanceBefore - balanceAfter - fees).toBe(512n); }, }); @@ -190,7 +192,7 @@ describeSuite({ id: "T08", title: "should handle max_fee_per_gas", test: async function () { - const balanceBefore = await checkBalance(context); + const balanceBefore = await checkBalance(context, CHARLETH_ADDRESS); await context.createBlock( await createRawTransfer(context, randomAddress, 1n * GLMR, { gas: 21000n, @@ -198,9 +200,10 @@ describeSuite({ maxPriorityFeePerGas: parseGwei("0.2"), gasPrice: GENESIS_BASE_FEE, type: "eip1559", + privateKey: CHARLETH_PRIVATE_KEY, }) ); - const balanceAfter = await checkBalance(context); + const balanceAfter = await checkBalance(context, CHARLETH_ADDRESS); const fee = 21000n * GENESIS_BASE_FEE; expect(balanceAfter + fee + 1n * GLMR).toBe(balanceBefore); diff --git a/test/suites/dev/moonbase/test-contract/test-contract-error.ts b/test/suites/dev/moonbase/test-contract/test-contract-error.ts index 67c2563ccd..e886d92f1a 100644 --- a/test/suites/dev/moonbase/test-contract/test-contract-error.ts +++ b/test/suites/dev/moonbase/test-contract/test-contract-error.ts @@ -6,7 +6,12 @@ import { describeSuite, expect, } from "@moonwall/cli"; -import { ALITH_ADDRESS, createEthersTransaction } from "@moonwall/util"; +import { + CHARLETH_PRIVATE_KEY, + CHARLETH_ADDRESS, + createEthersTransaction, + ALITH_ADDRESS, +} from "@moonwall/util"; import { encodeFunctionData, type Abi } from "viem"; import { verifyLatestBlockFees } from "../../../../helpers"; @@ -31,10 +36,10 @@ describeSuite({ id: `T0${TransactionTypes.indexOf(txnType) + 1}`, title: `"should return OutOfGas on inifinite loop ${txnType} call`, test: async function () { - expect( + await expect( async () => await context.viem().call({ - account: ALITH_ADDRESS, + account: CHARLETH_ADDRESS, to: looperAddress, data: encodeFunctionData({ abi: looperAbi, functionName: "infinite", args: [] }), gas: 12_000_000n, @@ -45,16 +50,25 @@ describeSuite({ }); it({ - id: `T0${TransactionTypes.indexOf(txnType) * 2 + 1}`, + id: `T0${TransactionTypes.indexOf(txnType) + 1 + TransactionTypes.length}`, title: `should fail with OutOfGas on infinite loop ${txnType} transaction`, test: async function () { + const nonce = await context.viem().getTransactionCount({ address: CHARLETH_ADDRESS }); + const rawSigned = await createEthersTransaction(context, { to: looperAddress, data: encodeFunctionData({ abi: looperAbi, functionName: "infinite", args: [] }), txnType, + nonce, + privateKey: CHARLETH_PRIVATE_KEY, + }); + + const { result } = await context.createBlock(rawSigned, { + signer: { type: "ethereum", privateKey: CHARLETH_PRIVATE_KEY }, }); - const { result } = await context.createBlock(rawSigned); + expect(result.successful).to.be.true; + const receipt = await context .viem("public") .getTransactionReceipt({ hash: result!.hash as `0x${string}` }); @@ -63,16 +77,24 @@ describeSuite({ }); it({ - id: `T0${TransactionTypes.indexOf(txnType) * 3 + 1}`, + id: `T0${TransactionTypes.indexOf(txnType) + 1 + TransactionTypes.length * 2}`, title: `should fail with OutOfGas on infinite loop ${txnType} transaction - check fees`, test: async function () { + const nonce = await context.viem().getTransactionCount({ address: CHARLETH_ADDRESS }); + const rawSigned = await createEthersTransaction(context, { to: looperAddress, data: encodeFunctionData({ abi: looperAbi, functionName: "infinite", args: [] }), txnType, + nonce, + privateKey: CHARLETH_PRIVATE_KEY, + }); + + const { result } = await context.createBlock(rawSigned, { + signer: { type: "ethereum", privateKey: CHARLETH_PRIVATE_KEY }, }); - await context.createBlock(rawSigned); + expect(result.successful).to.be.true; await verifyLatestBlockFees(context); }, }); diff --git a/test/suites/dev/moonbase/test-eth-pool/test-eth-pool-error.ts b/test/suites/dev/moonbase/test-eth-pool/test-eth-pool-error.ts index dbb560dced..b026a5ca48 100644 --- a/test/suites/dev/moonbase/test-eth-pool/test-eth-pool-error.ts +++ b/test/suites/dev/moonbase/test-eth-pool/test-eth-pool-error.ts @@ -13,6 +13,7 @@ import { } from "@moonwall/util"; import { parseGwei } from "viem"; import { ALITH_GENESIS_TRANSFERABLE_BALANCE, ConstantStore } from "../../../../helpers"; +import { UNIT } from "../test-parameters/test-parameters"; describeSuite({ id: "D011102", @@ -155,8 +156,12 @@ describeSuite({ id: "T07", title: "insufficient funds for gas * price + value", test: async function () { - const amount = ALITH_GENESIS_TRANSFERABLE_BALANCE - 21000n * 10_000_000_000n + 1n; - const tx = await createRawTransfer(context, BALTATHAR_ADDRESS, amount); + const CHARLETH_GENESIS_TRANSFERABLE_BALANCE = + ALITH_GENESIS_TRANSFERABLE_BALANCE + 1000n * UNIT + 10n * 100_000_000_000_000n; + const amount = CHARLETH_GENESIS_TRANSFERABLE_BALANCE - 21000n * 10_000_000_000n + 1n; + const tx = await createRawTransfer(context, BALTATHAR_ADDRESS, amount, { + privateKey: CHARLETH_PRIVATE_KEY, + }); expect( async () => await customDevRpcRequest("eth_sendRawTransaction", [tx]) diff --git a/test/suites/dev/moonbase/test-eth-pool/test-eth-pool-resubmit-txn.ts b/test/suites/dev/moonbase/test-eth-pool/test-eth-pool-resubmit-txn.ts index b5ba7380dd..80f95da08c 100644 --- a/test/suites/dev/moonbase/test-eth-pool/test-eth-pool-resubmit-txn.ts +++ b/test/suites/dev/moonbase/test-eth-pool/test-eth-pool-resubmit-txn.ts @@ -1,5 +1,11 @@ import { beforeEach, describeSuite, expect } from "@moonwall/cli"; -import { ALITH_ADDRESS, createRawTransfer, GLMR, sendRawTransaction } from "@moonwall/util"; +import { + CHARLETH_ADDRESS, + CHARLETH_PRIVATE_KEY, + createRawTransfer, + GLMR, + sendRawTransaction, +} from "@moonwall/util"; import { parseGwei } from "viem"; import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"; @@ -10,10 +16,14 @@ describeSuite({ testCases: ({ context, it, log }) => { let randomAddress: `0x${string}`; let currentNonce: number; + let actorPrivateKey: `0x${string}`; + let actorAddress: `0x${string}`; beforeEach(async function () { + actorPrivateKey = CHARLETH_PRIVATE_KEY; + actorAddress = CHARLETH_ADDRESS; randomAddress = privateKeyToAccount(generatePrivateKey()).address; - currentNonce = await context.viem().getTransactionCount({ address: ALITH_ADDRESS }); + currentNonce = await context.viem().getTransactionCount({ address: actorAddress }); }); it({ @@ -25,11 +35,13 @@ describeSuite({ nonce: currentNonce, maxFeePerGas: parseGwei("300"), maxPriorityFeePerGas: parseGwei("300"), + privateKey: actorPrivateKey, }), await createRawTransfer(context, randomAddress, 2, { nonce: currentNonce, maxFeePerGas: parseGwei("400"), maxPriorityFeePerGas: parseGwei("300"), + privateKey: actorPrivateKey, // same priority fee but higher max fee so higher tip }), ]); @@ -45,10 +57,12 @@ describeSuite({ await createRawTransfer(context, randomAddress, 1, { nonce: currentNonce, maxFeePerGas: parseGwei("20"), + privateKey: actorPrivateKey, }), await createRawTransfer(context, randomAddress, 2, { nonce: currentNonce, maxFeePerGas: parseGwei("10"), + privateKey: actorPrivateKey, }), ]); expect(await context.viem().getBalance({ address: randomAddress })).to.equal(1n); @@ -65,11 +79,13 @@ describeSuite({ nonce: currentNonce, maxFeePerGas: parseGwei("10"), gas: 1048575n, + privateKey: actorPrivateKey, }), await createRawTransfer(context, randomAddress, 2, { nonce: currentNonce, maxFeePerGas: parseGwei("20"), gas: 65536n, + privateKey: actorPrivateKey, }), ]); @@ -82,13 +98,14 @@ describeSuite({ title: "should prioritize higher gas tips", test: async function () { // GasFee are using very high value to ensure gasPrice is not impacting - const alithGLMR = (await context.viem().getBalance({ address: ALITH_ADDRESS })) / GLMR; + const addressGLMR = (await context.viem().getBalance({ address: actorAddress })) / GLMR; await sendRawTransaction( context, await createRawTransfer(context, randomAddress, 66, { nonce: currentNonce, maxFeePerGas: 1n * GLMR, maxPriorityFeePerGas: 1n * GLMR, + privateKey: actorPrivateKey, }) ); @@ -100,14 +117,15 @@ describeSuite({ nonce: currentNonce, maxFeePerGas: gasPrice, maxPriorityFeePerGas: gasPrice, + privateKey: actorPrivateKey, }) ) ); await context.createBlock(txns); - expect((await context.viem().getBalance({ address: ALITH_ADDRESS })) / GLMR).to.equal( - alithGLMR - 21000n * 20n + expect((await context.viem().getBalance({ address: actorAddress })) / GLMR).to.equal( + addressGLMR - 21000n * 20n ); expect(await context.viem().getBalance({ address: randomAddress })).to.equal(77n); }, @@ -122,11 +140,13 @@ describeSuite({ nonce: currentNonce, maxFeePerGas: parseGwei("300"), maxPriorityFeePerGas: parseGwei("10"), + privateKey: actorPrivateKey, }), await createRawTransfer(context, randomAddress, 2, { nonce: currentNonce, maxFeePerGas: parseGwei("400"), maxPriorityFeePerGas: parseGwei("10"), + privateKey: actorPrivateKey, }), ]); expect(await context.viem().getBalance({ address: randomAddress })).to.equal(1n); diff --git a/test/suites/dev/moonbase/test-fees/test-fees-repartition.ts b/test/suites/dev/moonbase/test-fees/test-fees-repartition.ts index 81ee135eed..cd6047c78c 100644 --- a/test/suites/dev/moonbase/test-fees/test-fees-repartition.ts +++ b/test/suites/dev/moonbase/test-fees/test-fees-repartition.ts @@ -2,6 +2,7 @@ import "@moonbeam-network/api-augment"; import { TransactionTypes, describeSuite, expect } from "@moonwall/cli"; import { BALTATHAR_ADDRESS, TREASURY_ACCOUNT, createRawTransfer, extractFee } from "@moonwall/util"; +// These tests are checking the default value of FeesTreasuryProportion which is set to 20% describeSuite({ id: "D011605", title: "Fees - Transaction", diff --git a/test/suites/dev/moonbase/test-parameters/test-parameters-runtime-FeesTreasuryProportion.ts b/test/suites/dev/moonbase/test-parameters/test-parameters-runtime-FeesTreasuryProportion.ts index 7b9a5b017a..bc3b13b4ff 100644 --- a/test/suites/dev/moonbase/test-parameters/test-parameters-runtime-FeesTreasuryProportion.ts +++ b/test/suites/dev/moonbase/test-parameters/test-parameters-runtime-FeesTreasuryProportion.ts @@ -1,176 +1,223 @@ -import { describeSuite, expect, TransactionTypes } from "@moonwall/cli"; +import { describeSuite, expect, extractInfo, TransactionTypes } from "@moonwall/cli"; import { alith, + ALITH_ADDRESS, baltathar, - BALTATHAR_ADDRESS, + BALTATHAR_PRIVATE_KEY, + CHARLETH_ADDRESS, createRawTransfer, extractFee, Perbill, TREASURY_ACCOUNT, + WEIGHT_PER_GAS, } from "@moonwall/util"; import { parameterType, UNIT } from "./test-parameters"; import { BN } from "@polkadot/util"; +import { calculateFeePortions, ConstantStore, verifyLatestBlockFees } from "../../../../helpers"; +import { parseGwei } from "viem"; interface TestCase { proportion: Perbill; transfer_amount: bigint; tipAmount: bigint; + priorityFeePerGas: bigint; } -// Recreation on fees.ration(burn_part, treasury_part) -const split = (value: BN, part1: BN, part2: BN): [BN, BN] => { - const total = part1.add(part2); - if (total.eq(new BN(0)) || value.eq(new BN(0))) { - return [new BN(0), new BN(0)]; - } - const part1BN = value.mul(part1).div(total); - const part2BN = value.sub(part1BN); - return [part1BN, part2BN]; -}; - describeSuite({ id: "DTemp03", title: "Parameters - RuntimeConfig", foundationMethods: "dev", testCases: ({ it, context, log }) => { let testCounter = 0; + const collatorAddress = ALITH_ADDRESS; + const senderPrivateKey = BALTATHAR_PRIVATE_KEY; + const senderKeyPair = baltathar; + const receiver = CHARLETH_ADDRESS; const testCases: TestCase[] = [ { proportion: new Perbill(0), transfer_amount: 10n * UNIT, tipAmount: 1n * UNIT, + priorityFeePerGas: parseGwei("1"), }, { proportion: new Perbill(1, 100), transfer_amount: 1000n, tipAmount: 100n, + priorityFeePerGas: 100n, }, { proportion: new Perbill(355, 1000), transfer_amount: 5n * UNIT, tipAmount: 111112n, + priorityFeePerGas: 111112n, }, { proportion: new Perbill(400, 1000), transfer_amount: 10n * UNIT, - tipAmount: 1n * UNIT, + tipAmount: 2n * UNIT, + priorityFeePerGas: parseGwei("2"), }, { proportion: new Perbill(500, 1000), transfer_amount: 10n * UNIT, tipAmount: 1n * UNIT, + priorityFeePerGas: parseGwei("1"), }, { proportion: new Perbill(963, 1000), transfer_amount: 10n * UNIT, tipAmount: 128n, + priorityFeePerGas: 128, }, { proportion: new Perbill(99, 100), transfer_amount: 10n * UNIT, tipAmount: 3n, + priorityFeePerGas: 3n, }, { proportion: new Perbill(1, 1), transfer_amount: 10n * UNIT, tipAmount: 32n, + priorityFeePerGas: 32n, }, ]; for (const t of testCases) { - const burnProportion = new Perbill(new BN(1e9).sub(t.proportion.value())); - + const treasuryPerbill = new BN(t.proportion.value()); const treasuryPercentage = t.proportion.value().toNumber() / 1e7; - const burnPercentage = burnProportion.value().toNumber() / 1e7; + const burnPercentage = 100 - treasuryPercentage; const calcTreasuryIncrease = (feeWithTip: bigint, tip?: bigint): bigint => { const issuanceDecrease = calcIssuanceDecrease(feeWithTip, tip); const treasuryIncrease = feeWithTip - issuanceDecrease; return treasuryIncrease; }; - const calcIssuanceDecrease = (feeWithTip: bigint, tip?: bigint): bigint => { - const feeWithTipBN = new BN(feeWithTip.toString()); - const tipBN = new BN(tip?.toString() || "0"); - const feeWithoutTipBN = feeWithTipBN.sub(tipBN); - - const [burnFeePart, _treasuryFeePart] = split( - feeWithoutTipBN, - burnProportion.value(), - t.proportion.value() - ); - const [burnTipPart, _treasuryTipPart] = split( - tipBN, - burnProportion.value(), - t.proportion.value() - ); - - return BigInt(burnFeePart.add(burnTipPart).toString()); + const calcIssuanceDecrease = (feeWithTip: bigint, maybeTip?: bigint): bigint => { + const tip = maybeTip ?? 0n; + const feeWithoutTip = feeWithTip - tip; + const { burnt: feeBurnt } = calculateFeePortions(treasuryPerbill, feeWithoutTip); + const { burnt: tipBurnt } = calculateFeePortions(treasuryPerbill, tip); + + return feeBurnt + tipBurnt; }; for (const txnType of TransactionTypes) { - it({ - id: `T${++testCounter}`, - title: - `Changing FeesTreasuryProportion to ${treasuryPercentage}% for Ethereum ` + - `${txnType} transfers`, - test: async () => { - const param = parameterType( - context, - "RuntimeConfig", - "FeesTreasuryProportion", - t.proportion.value() - ); - await context.createBlock( - context - .polkadotJs() - .tx.sudo.sudo(context.polkadotJs().tx.parameters.setParameter(param.toU8a())) - .signAsync(alith), - { allowFailures: false } - ); + for (const withTip of txnType === "eip1559" ? [false, true] : [false]) { + testCounter++; + it({ + id: `T${testCounter}x`, + title: + `Changing FeesTreasuryProportion to ${treasuryPercentage}% for Ethereum ` + + `${txnType} transfers with ${withTip ? "" : "no "}tip`, + test: async () => { + const { specVersion } = context.polkadotJs().consts.system.version; + const GENESIS_BASE_FEE = ConstantStore(context).GENESIS_BASE_FEE.get( + specVersion.toNumber() + ); + const WEIGHT_FEE = ConstantStore(context).WEIGHT_FEE.get(specVersion.toNumber()); - const balBefore = await context.viem().getBalance({ address: TREASURY_ACCOUNT }); - const issuanceBefore = ( - await context.polkadotJs().query.balances.totalIssuance() - ).toBigInt(); - const { result } = await context.createBlock( - await createRawTransfer(context, BALTATHAR_ADDRESS, t.transfer_amount, { - type: txnType, - }) - ); + const param = parameterType( + context, + "RuntimeConfig", + "FeesTreasuryProportion", + t.proportion.value() + ); + await context.createBlock( + context + .polkadotJs() + .tx.sudo.sudo(context.polkadotJs().tx.parameters.setParameter(param.toU8a())) + .signAsync(alith), + { allowFailures: false } + ); - const balAfter = await context.viem().getBalance({ address: TREASURY_ACCOUNT }); - const issuanceAfter = ( - await context.polkadotJs().query.balances.totalIssuance() - ).toBigInt(); + const balBefore = await context.viem().getBalance({ address: TREASURY_ACCOUNT }); + const collatorBalBefore = await context + .viem() + .getBalance({ address: collatorAddress }); + const issuanceBefore = ( + await context.polkadotJs().query.balances.totalIssuance() + ).toBigInt(); - const treasuryIncrease = balAfter - balBefore; - const issuanceDecrease = issuanceBefore - issuanceAfter; - const fee = extractFee(result?.events)!.amount.toBigInt(); + const nextFeeMultiplier = ( + await context.polkadotJs().query.transactionPayment.nextFeeMultiplier() + ).toBigInt(); + const baseFee = + (nextFeeMultiplier * (WEIGHT_FEE * WEIGHT_PER_GAS)) / 1_000_000_000_000_000_000n; - expect( - treasuryIncrease + issuanceDecrease, - `Sum of TreasuryIncrease and IssuanceDecrease should be equal to the fees` - ).to.equal(fee); + const { result } = await context.createBlock( + await createRawTransfer(context, receiver, t.transfer_amount, { + privateKey: senderPrivateKey, + type: txnType, + maxFeePerGas: withTip ? GENESIS_BASE_FEE : undefined, + maxPriorityFeePerGas: withTip ? t.priorityFeePerGas : undefined, + }) + ); - expect( - treasuryIncrease, - `${treasuryPercentage}% of the fees should go to treasury` - ).to.equal(calcTreasuryIncrease(fee)); + const receipt = await context + .viem("public") + .getTransactionReceipt({ hash: result!.hash as `0x${string}` }); - expect(issuanceDecrease, `${burnPercentage}% of the fees should be burned`).to.equal( - calcIssuanceDecrease(fee) - ); - }, - }); + const balAfter = await context.viem().getBalance({ address: TREASURY_ACCOUNT }); + const collatorBalAfter = await context + .viem() + .getBalance({ address: collatorAddress }); + const issuanceAfter = ( + await context.polkadotJs().query.balances.totalIssuance() + ).toBigInt(); + + const treasuryIncrease = balAfter - balBefore; + const issuanceDecrease = issuanceBefore - issuanceAfter; + const collatorIncrease = collatorBalAfter - collatorBalBefore; + const tipPaid = withTip + ? (() => { + let priorityPerGas = GENESIS_BASE_FEE - baseFee; + if (priorityPerGas > t.priorityFeePerGas) { + priorityPerGas = t.priorityFeePerGas; + } + return BigInt(priorityPerGas) * BigInt(receipt!.gasUsed); + })() + : 0n; + const fee = extractFee(result?.events)!.amount.toBigInt(); + const feeWithoutTip = fee - tipPaid; + + expect( + treasuryIncrease + issuanceDecrease, + `Sum of TreasuryIncrease and IssuanceDecrease should be equal to the fees without tip` + ).to.equal(feeWithoutTip); + + expect( + treasuryIncrease, + `${treasuryPercentage}% of the fees should go to treasury` + ).to.equal(calcTreasuryIncrease(feeWithoutTip)); + + expect(issuanceDecrease, `${burnPercentage}% of the fees should be burned`).to.equal( + calcIssuanceDecrease(feeWithoutTip) + ); + + if (withTip) { + expect(collatorIncrease, "100% of the tip should go to the collator").to.equal( + tipPaid + ); + } else { + expect(collatorIncrease, "No tip should be paid to the collator").to.equal(0n); + } + + await verifyLatestBlockFees(context, t.transfer_amount); + }, + }); + } } for (const withTip of [false, true]) { + testCounter++; it({ - id: `T${++testCounter}`, + id: `T${testCounter}x`, title: - `Changing FeesTreasuryProportion to ${treasuryPercentage}% for Substrate based` + + `Changing FeesTreasuryProportion to ${treasuryPercentage}% for Substrate based ` + `transactions with ${withTip ? "" : "no "}tip`, test: async () => { const param = parameterType( @@ -191,12 +238,13 @@ describeSuite({ const issuanceBefore = ( await context.polkadotJs().query.balances.totalIssuance() ).toBigInt(); + const collatorBalBefore = await context.viem().getBalance({ address: collatorAddress }); const { result } = await context.createBlock( context .polkadotJs() - .tx.balances.transferKeepAlive(alith.address, t.transfer_amount) - .signAsync(baltathar, { tip: withTip ? t.tipAmount : 0n }), + .tx.balances.transferKeepAlive(receiver, t.transfer_amount) + .signAsync(senderKeyPair, { tip: withTip ? t.tipAmount : 0n }), { allowFailures: false } ); @@ -204,24 +252,37 @@ describeSuite({ const issuanceAfter = ( await context.polkadotJs().query.balances.totalIssuance() ).toBigInt(); + const collatorBalAfter = await context.viem().getBalance({ address: collatorAddress }); const treasuryIncrease = balanceAfter - balanceBefore; const issuanceDecrease = issuanceBefore - issuanceAfter; - const fee = extractFee(result?.events)!.amount.toBigInt(); + const collatorIncrease = collatorBalAfter - collatorBalBefore; + const tipPaid = withTip ? t.tipAmount : 0n; + const feeWithoutTip = extractFee(result?.events)!.amount.toBigInt() - tipPaid; expect( treasuryIncrease + issuanceDecrease, - `Sum of TreasuryIncrease and IssuanceDecrease should be equal to the fees` - ).to.equal(fee); + `Sum of TreasuryIncrease and IssuanceDecrease should be equal to the fees without tip` + ).to.equal(feeWithoutTip); expect( treasuryIncrease, `${treasuryPercentage}% of the fees should go to treasury` - ).to.equal(calcTreasuryIncrease(fee, withTip ? t.tipAmount : undefined)); + ).to.equal(calcTreasuryIncrease(feeWithoutTip)); expect(issuanceDecrease, `${burnPercentage}% of the fees should be burned`).to.equal( - calcIssuanceDecrease(fee, withTip ? t.tipAmount : undefined) + calcIssuanceDecrease(feeWithoutTip) ); + + if (withTip) { + expect(collatorIncrease, "100% of the tip should go to the collator").to.equal( + t.tipAmount + ); + } else { + expect(collatorIncrease, "No tip should be paid to the collator").to.equal(0n); + } + + await verifyLatestBlockFees(context, t.transfer_amount); }, }); } diff --git a/test/suites/dev/moonbase/test-precompile/test-precompile-xtokens.ts b/test/suites/dev/moonbase/test-precompile/test-precompile-xtokens.ts index db14721c5d..89fe34d91f 100644 --- a/test/suites/dev/moonbase/test-precompile/test-precompile-xtokens.ts +++ b/test/suites/dev/moonbase/test-precompile/test-precompile-xtokens.ts @@ -1,6 +1,13 @@ import "@moonbeam-network/api-augment"; import { beforeAll, describeSuite, expect, fetchCompiledContract } from "@moonwall/cli"; -import { ALITH_ADDRESS, GLMR, PRECOMPILES, createViemTransaction } from "@moonwall/util"; +import { + ALITH_ADDRESS, + GLMR, + PRECOMPILES, + createViemTransaction, + CHARLETH_ADDRESS, + CHARLETH_PRIVATE_KEY, +} from "@moonwall/util"; import { verifyLatestBlockFees, expectEVMResult, @@ -214,7 +221,7 @@ describeSuite({ const fee_item = 0; const weight = 100; - const balBefore = await context.viem().getBalance({ address: ALITH_ADDRESS }); + const balBefore = await context.viem().getBalance({ address: CHARLETH_ADDRESS }); const { abi } = fetchCompiledContract("Xtokens"); const data = encodeFunctionData({ abi, @@ -229,10 +236,11 @@ describeSuite({ txnType: "legacy", gas: 500_000n, gasPrice: BigInt(DEFAULT_TXN_MAX_BASE_FEE), + privateKey: CHARLETH_PRIVATE_KEY, }); const { result } = await context.createBlock(rawTxn); - const balAfter = await context.viem().getBalance({ address: ALITH_ADDRESS }); + const balAfter = await context.viem().getBalance({ address: CHARLETH_ADDRESS }); const receipt = await context .viem() .getTransactionReceipt({ hash: result!.hash as `0x${string}` }); From dc75e3bdbdf8d83b1fd812698597a6a3829536af Mon Sep 17 00:00:00 2001 From: Manuel Mauro Date: Tue, 14 Jan 2025 13:18:32 +0100 Subject: [PATCH 02/10] Fix notify inactive collators failures at the end of a round (#3128) * fix: :bug: call ParachainStaking::on_finalize on mock blocks rolling * fix: :bug: pass correct block number to ParachainStaking::on_finalize * test: :white_check_mark: fix happy path test for notify inactive collator * revert: :fire: remove debug code * feat: :sparkles: add round length-aware block rolling functions * test: :white_check_mark: increase MaxOfflineRounds to 2 to match RewardPaymentDelay * test: :white_check_mark: call ParachainStaking::on_finalize before Balances and System on_finalize * test: :white_check_mark: add test reproducing a bug in notify_inactive_collator * refactor: :fire: remove unused use statement * test: :white_check_mark: minimize changes to mocking framework for ParachainStaking * docs: :memo: improve comment * fix: :bug: add historical staking information * refactor: :recycle: make roll_to_round functions round length-aware * test: :sparkles: improve mock fidelity * refactor: :art: use POINTS_PER_ROUND const in set_author invocations * docs: :memo: restore comments in tests * perf: :zap: use a WasInactive storage to keep track of inactive collators * test: :white_check_mark: fix benchmark test * fix: :bug: update benchmarks * fix: :bug: correctly update weight calculation on mark_collators_as_inactive invocation * refactor: :zap: use a more realistic upper bound to the number of collators in benchmarks * chore: :wrench: compute new weights * test: :white_check_mark: update test with new weights for operations on initialize * perf: :zap: improve estimation of mark_collators_as_inactive weights * test: :white_check_mark: update test test_on_initialize_weights --- pallets/parachain-staking/src/benchmarks.rs | 41 +- pallets/parachain-staking/src/lib.rs | 70 ++- pallets/parachain-staking/src/mock.rs | 31 +- pallets/parachain-staking/src/tests.rs | 451 +++++++++++------- pallets/parachain-staking/src/weights.rs | 45 ++ .../src/weights/pallet_parachain_staking.rs | 22 + .../src/weights/pallet_parachain_staking.rs | 22 + .../src/weights/pallet_parachain_staking.rs | 22 + 8 files changed, 507 insertions(+), 197 deletions(-) diff --git a/pallets/parachain-staking/src/benchmarks.rs b/pallets/parachain-staking/src/benchmarks.rs index d9067aef03..b6e5a2033a 100644 --- a/pallets/parachain-staking/src/benchmarks.rs +++ b/pallets/parachain-staking/src/benchmarks.rs @@ -2275,7 +2275,7 @@ benchmarks! { } notify_inactive_collator { - use crate::{AtStake, CollatorSnapshot, AwardedPts}; + use crate::{WasInactive}; // Blocks per-round must be greater than TotalSelected Pallet::::set_blocks_per_round(RawOrigin::Root.into(), 101u32)?; @@ -2325,11 +2325,8 @@ benchmarks! { // Manually change these values for inactive_collator, // so that it can be marked as inactive. - >::insert(1, &inactive_collator, CollatorSnapshot::default()); - >::insert(1, &inactive_collator, 0); - - >::insert(2, &inactive_collator, CollatorSnapshot::default()); - >::insert(2, &inactive_collator, 0); + >::insert(1, &inactive_collator, ()); + >::insert(2, &inactive_collator, ()); // Enable killswitch >::set(true); @@ -2338,6 +2335,38 @@ benchmarks! { verify { assert!(!Pallet::::candidate_info(&inactive_collator).expect("must exist").is_active()); } + + mark_collators_as_inactive { + let x in 0..50; // num collators + + // must come after 'let foo in 0..` statements for macro + use crate::{AtStake, CollatorSnapshot, AwardedPts}; + + let round = 2; + let prev = round - 1; + + + + for i in 0..x { + let collator = create_funded_collator::( + "collator", + USER_SEED + i, + min_candidate_stk::() * 1_000_000u32.into(), + true, + 999999, + )?; + + // All collators were inactinve in previous round + >::insert(prev, &collator, CollatorSnapshot::default()); + >::insert(prev, &collator, 0); + } + + }: { + let cur = 2; + let inactive_info = Pallet::::mark_collators_as_inactive(cur); + } + verify { + } } #[cfg(test)] diff --git a/pallets/parachain-staking/src/lib.rs b/pallets/parachain-staking/src/lib.rs index 7f1a13e177..8730c1cbbc 100644 --- a/pallets/parachain-staking/src/lib.rs +++ b/pallets/parachain-staking/src/lib.rs @@ -489,6 +489,8 @@ pub mod pallet { selected_collators_number: collator_count, total_balance: total_staked, }); + // record inactive collators + weight = weight.saturating_add(Self::mark_collators_as_inactive(round.current)); // account for Round write weight = weight.saturating_add(T::DbWeight::get().reads_writes(0, 1)); } else { @@ -496,13 +498,14 @@ pub mod pallet { } // add on_finalize weight - // read: Author, Points, AwardedPts - // write: Points, AwardedPts - weight = weight.saturating_add(T::DbWeight::get().reads_writes(3, 2)); + // read: Author, Points, AwardedPts, WasInactive + // write: Points, AwardedPts, WasInactive + weight = weight.saturating_add(T::DbWeight::get().reads_writes(4, 3)); weight } fn on_finalize(_n: BlockNumberFor) { Self::award_points_to_block_author(); + Self::cleanup_inactive_collator_info(); } } @@ -643,6 +646,13 @@ pub mod pallet { OptionQuery, >; + #[pallet::storage] + #[pallet::getter(fn was_inactive)] + /// Records collators' inactivity. + /// Data persists for MaxOfflineRounds + 1 rounds before being pruned. + pub type WasInactive = + StorageDoubleMap<_, Twox64Concat, RoundIndex, Twox64Concat, T::AccountId, (), OptionQuery>; + #[pallet::storage] #[pallet::getter(fn delayed_payouts)] /// Delayed payouts @@ -1417,17 +1427,9 @@ pub mod pallet { // the collator should be notified as inactive let mut inactive_counter: RoundIndex = 0u32; - // Iter rounds to check - // - // - The collator has AtStake associated and their AwardedPts are zero - // - // If the previous condition is met in all rounds of rounds_to_check, - // the collator is notified as inactive + // Iter rounds and check whether the collator has been inactive for r in rounds_to_check { - let stake = >::get(r, &collator); - let pts = >::get(r, &collator); - - if stake.is_some() && pts.is_zero() { + if >::get(r, &collator).is_some() { inactive_counter = inactive_counter.saturating_add(1); } } @@ -1704,8 +1706,8 @@ pub mod pallet { let return_stake = |bond: Bond>| { // remove delegation from delegator state let mut delegator = DelegatorState::::get(&bond.owner).expect( - "Collator state and delegator state are consistent. - Collator state has a record of this delegation. Therefore, + "Collator state and delegator state are consistent. + Collator state has a record of this delegation. Therefore, Delegator state also has a record. qed.", ); @@ -2333,11 +2335,9 @@ pub mod pallet { }); }; } - } - /// Add reward points to block authors: - /// * 20 points to the block producer for producing a block in the chain - impl Pallet { + /// Add reward points to block authors: + /// * 20 points to the block producer for producing a block in the chain fn award_points_to_block_author() { let author = T::BlockAuthor::get(); let now = >::get().current; @@ -2345,6 +2345,38 @@ pub mod pallet { >::insert(now, author, score_plus_20); >::mutate(now, |x| *x = x.saturating_add(20)); } + + /// Marks collators as inactive for the previous round if they received zero awarded points. + pub fn mark_collators_as_inactive(cur: RoundIndex) -> Weight { + // This function is called after round index increment, + // We don't need to saturate here because the genesis round is 1. + let prev = cur - 1; + + let mut collators_at_stake_count = 0u32; + for (account, _) in >::iter_prefix(prev) { + collators_at_stake_count = collators_at_stake_count.saturating_add(1u32); + if >::get(prev, &account).is_zero() { + >::insert(prev, account, ()); + } + } + + ::WeightInfo::mark_collators_as_inactive(collators_at_stake_count) + } + + /// Cleans up historical staking information that is older than MaxOfflineRounds + /// by removing entries from the WasIactive storage map. + fn cleanup_inactive_collator_info() { + let now = >::get().current; + let minimum_rounds_required = T::MaxOfflineRounds::get() + 1; + + if now < minimum_rounds_required { + return; + } + + let _ = >::iter_prefix(now - minimum_rounds_required) + .drain() + .next(); + } } impl nimbus_primitives::CanAuthor for Pallet { diff --git a/pallets/parachain-staking/src/mock.rs b/pallets/parachain-staking/src/mock.rs index 703effac14..4079b56f54 100644 --- a/pallets/parachain-staking/src/mock.rs +++ b/pallets/parachain-staking/src/mock.rs @@ -116,9 +116,13 @@ const GENESIS_BLOCKS_PER_ROUND: BlockNumber = 5; const GENESIS_COLLATOR_COMMISSION: Perbill = Perbill::from_percent(20); const GENESIS_PARACHAIN_BOND_RESERVE_PERCENT: Percent = Percent::from_percent(30); const GENESIS_NUM_SELECTED_CANDIDATES: u32 = 5; + +pub const POINTS_PER_BLOCK: u32 = 20; +pub const POINTS_PER_ROUND: u32 = GENESIS_BLOCKS_PER_ROUND * POINTS_PER_BLOCK; + parameter_types! { pub const MinBlocksPerRound: u32 = 3; - pub const MaxOfflineRounds: u32 = 1; + pub const MaxOfflineRounds: u32 = 2; pub const LeaveCandidatesDelay: u32 = 2; pub const CandidateBondLessDelay: u32 = 2; pub const LeaveDelegatorsDelay: u32 = 2; @@ -278,6 +282,7 @@ impl ExtBuilder { /// Rolls forward one block. Returns the new block number. fn roll_one_block() -> BlockNumber { + ParachainStaking::on_finalize(System::block_number()); Balances::on_finalize(System::block_number()); System::on_finalize(System::block_number()); System::set_block_number(System::block_number() + 1); @@ -312,15 +317,31 @@ pub(crate) fn roll_blocks(num_blocks: u32) -> BlockNumber { /// This will complete the block in which the round change occurs. /// Returns the number of blocks played. pub(crate) fn roll_to_round_begin(round: BlockNumber) -> BlockNumber { - let block = (round - 1) * GENESIS_BLOCKS_PER_ROUND; - roll_to(block) + let r = ParachainStaking::round(); + + // Return 0 if target round has already passed + if round < r.current + 1 { + return 0; + } + + // Calculate target block by adding round length for each round difference + let target = r.first + (round - r.current) * r.length; + roll_to(target) } /// Rolls block-by-block to the end of the specified round. /// The block following will be the one in which the specified round change occurs. pub(crate) fn roll_to_round_end(round: BlockNumber) -> BlockNumber { - let block = round * GENESIS_BLOCKS_PER_ROUND - 1; - roll_to(block) + let r = ParachainStaking::round(); + + // Return 0 if target round has already passed + if round < r.current { + return 0; + } + + // Calculate target block by adding round length for each round difference + let target = r.first + (round - r.current + 1) * r.length - 1; + roll_to(target) } pub(crate) fn inflation_configs( diff --git a/pallets/parachain-staking/src/tests.rs b/pallets/parachain-staking/src/tests.rs index fd034e7345..acc6841f75 100644 --- a/pallets/parachain-staking/src/tests.rs +++ b/pallets/parachain-staking/src/tests.rs @@ -27,15 +27,16 @@ use crate::delegation_requests::{CancelledScheduledRequest, DelegationAction, Sc use crate::mock::{ inflation_configs, roll_blocks, roll_to, roll_to_round_begin, roll_to_round_end, set_author, set_block_author, AccountId, Balances, BlockNumber, ExtBuilder, ParachainStaking, RuntimeEvent, - RuntimeOrigin, Test, + RuntimeOrigin, Test, POINTS_PER_BLOCK, POINTS_PER_ROUND, }; use crate::{ assert_events_emitted, assert_events_emitted_match, assert_events_eq, assert_no_events, AtStake, Bond, CollatorStatus, DelegationScheduledRequests, DelegatorAdded, - EnableMarkingOffline, Error, Event, InflationDistributionInfo, Range, DELEGATOR_LOCK_ID, + EnableMarkingOffline, Error, Event, InflationDistributionInfo, Range, WasInactive, + DELEGATOR_LOCK_ID, }; use frame_support::traits::{Currency, ExistenceRequirement, WithdrawReasons}; -use frame_support::{assert_err, assert_noop, assert_ok, pallet_prelude::*, BoundedVec}; +use frame_support::{assert_err, assert_noop, assert_ok, BoundedVec}; use pallet_balances::{Event as BalancesEvent, PositiveImbalance}; use sp_runtime::{traits::Zero, DispatchError, ModuleError, Perbill, Percent}; // ~~ ROOT ~~ @@ -1173,8 +1174,78 @@ fn enable_marking_offline_fails_bad_origin() { }); } +#[test] +fn was_inactive_is_cleaned_up_after_max_offline_rounds() { + const ACTIVE_COLLATOR: AccountId = 1; + const INACTIVE_COLLATOR: AccountId = 2; + + ExtBuilder::default() + .with_balances(vec![(1, 20), (2, 20)]) + .with_candidates(vec![(1, 20), (2, 20)]) + .build() + .execute_with(|| { + assert_eq!(::MaxOfflineRounds::get(), 2); + assert_eq!(::RewardPaymentDelay::get(), 2); + + // ACTIVE_COLLATOR authors all the blocks + set_block_author(ACTIVE_COLLATOR); + + // Round 2 + roll_to_round_begin(2); + + assert!(>::contains_key(1, ACTIVE_COLLATOR)); + assert!(!>::contains_key(1, ACTIVE_COLLATOR)); + + assert!(>::contains_key(1, INACTIVE_COLLATOR)); + assert!(>::contains_key(1, INACTIVE_COLLATOR)); + + // Round 3 + roll_to_round_begin(3); + + assert!(>::contains_key(2, ACTIVE_COLLATOR)); + assert!(!>::contains_key(2, ACTIVE_COLLATOR)); + + assert!(>::contains_key(2, INACTIVE_COLLATOR)); + assert!(>::contains_key(2, INACTIVE_COLLATOR)); + + // End of round 3 + roll_to_round_end(3); + + assert!( + !>::contains_key(1, ACTIVE_COLLATOR), + "Active collator should have no stake in round 1 due to the distribution of rewards" + ); + assert!( + !>::contains_key(1, INACTIVE_COLLATOR), + "Inactive collator should have no stake in round 1 due to the distribution of rewards" + ); + + assert!( + !>::contains_key(1, ACTIVE_COLLATOR), + "Active collator should not be in WasInactive for round 1" + ); + assert!( + >::contains_key(1, INACTIVE_COLLATOR), + "Inactive collator should still be in WasInactive for round 1" + ); + + // Round 4 + roll_to_round_end(4); + + assert!( + !>::contains_key(1, INACTIVE_COLLATOR), + "Round 1 WasInactive should be cleaned up after MaxOfflineRounds" + ); + assert!(>::contains_key(2, INACTIVE_COLLATOR)); + assert!(>::contains_key(3, INACTIVE_COLLATOR)); + }); +} + #[test] fn notify_inactive_collator_works() { + const INACTIVE_COLLATOR: AccountId = 1; + const ACTIVE_COLLATOR: AccountId = 2; + ExtBuilder::default() .with_balances(vec![(1, 20), (2, 20), (3, 20), (4, 20), (5, 20)]) .with_candidates(vec![(1, 20), (2, 20), (3, 20), (4, 20), (5, 20)]) @@ -1183,38 +1254,91 @@ fn notify_inactive_collator_works() { // Enable killswitch >::set(true); - // Round 2 + assert_eq!(::MaxOfflineRounds::get(), 2); + assert_eq!(::RewardPaymentDelay::get(), 2); + + // Round 2 - INACTIVE_COLLATOR authors blocks + set_block_author(INACTIVE_COLLATOR); roll_to_round_begin(2); // Change block author - set_block_author(1); + set_block_author(ACTIVE_COLLATOR); - // Finalize the first block of round 2 - ParachainStaking::on_finalize(5); - - // We don't produce blocks on round 3 - roll_to_round_begin(3); + // INACTIVE_COLLATOR does not produce blocks on round 2 and 3 + roll_to_round_begin(4); roll_blocks(1); - // We don't produce blocks on round 4 - roll_to_round_begin(4); + // On round 4 notify inactive collator + assert_ok!(ParachainStaking::notify_inactive_collator( + RuntimeOrigin::signed(1), + INACTIVE_COLLATOR + )); + + // Check the collator was marked as offline as it hasn't produced blocks + assert_events_eq!(Event::CandidateWentOffline { + candidate: INACTIVE_COLLATOR + },); + }); +} + +#[test] +fn notify_inactive_collator_succeeds_even_after_rewards_are_distributed() { + const INACTIVE_COLLATOR: AccountId = 1; + const ACTIVE_COLLATOR: AccountId = 2; + + ExtBuilder::default() + .with_balances(vec![(1, 20), (2, 20), (3, 20), (4, 20), (5, 20)]) + .with_candidates(vec![(1, 20), (2, 20), (3, 20), (4, 20), (5, 20)]) + .build() + .execute_with(|| { + // Enable killswitch + >::set(true); + + // We need (strictly) more blocks per round than collators so rewards + // can be distributed before the end of a round + assert_ok!(ParachainStaking::set_blocks_per_round( + RuntimeOrigin::root(), + 6u32 + )); + + // ACTIVE_COLLATOR authors all the blocks while INACTIVE_COLLATOR stays inactive + set_block_author(ACTIVE_COLLATOR); + + // Round 2 + roll_to_round_begin(2); roll_blocks(1); - // Round 6 - notify the collator as inactive - roll_to_round_begin(6); + // INACTIVE_COLLATOR has a stake in round 1 + assert!(>::contains_key(1, INACTIVE_COLLATOR)); + + // Round 3 + roll_to_round_begin(3); roll_blocks(1); - assert_eq!(::MaxOfflineRounds::get(), 1); - assert_eq!(::RewardPaymentDelay::get(), 2); + // INACTIVE_COLLATOR has a stake in round 2 + assert!(>::contains_key(2, INACTIVE_COLLATOR)); - // Call 'notify_inactive_collator' extrinsic + // End of round 3 + roll_to_round_end(3); + + // INACTIVE_COLLATOR has a no stake in round 1 anymore due to the distribution of rewards + assert!(!>::contains_key(1, INACTIVE_COLLATOR)); + + // Call 'notify_inactive_collator' extrinsic on INACTIVE_COLLATOR assert_ok!(ParachainStaking::notify_inactive_collator( RuntimeOrigin::signed(1), - 1 + INACTIVE_COLLATOR )); - // Check the collator was marked as offline as it hasn't produced blocks - assert_events_eq!(Event::CandidateWentOffline { candidate: 1 },); + assert_events_eq!( + Event::Rewarded { + account: 2, + rewards: 0, + }, + Event::CandidateWentOffline { + candidate: INACTIVE_COLLATOR + }, + ); }); } @@ -1356,16 +1480,10 @@ fn notify_inactive_collator_fails_cannot_be_notified_as_inactive() { // Change block author set_block_author(1); - // Finalize the first block of round 2 - ParachainStaking::on_finalize(5); - // Round 3 roll_to_round_begin(3); roll_blocks(1); - // Finalize a block of round 3 - ParachainStaking::on_finalize(11); - // Round 4 roll_to_round_begin(4); roll_blocks(1); @@ -4147,14 +4265,14 @@ fn parachain_bond_inflation_reserve_matches_config() { ); assert_eq!(Balances::free_balance(&11), 1); // ~ set block author as 1 for all blocks this round - set_author(2, 1, 100); + set_author(2, 1, POINTS_PER_ROUND); roll_to_round_begin(4); // distribute total issuance to collator 1 and its delegators 6, 7, 19 assert_eq!(Balances::free_balance(&11), 16); - // ~ set block author as 1 for all blocks this round - set_author(3, 1, 100); - set_author(4, 1, 100); - set_author(5, 1, 100); + // ~ set block author as 1 for all blocks in rounds 3, 4, and 5 + set_author(3, 1, POINTS_PER_ROUND); + set_author(4, 1, POINTS_PER_ROUND); + set_author(5, 1, POINTS_PER_ROUND); // 1. ensure delegators are paid for 2 rounds after they leave assert_noop!( ParachainStaking::schedule_revoke_delegation(RuntimeOrigin::signed(66), 1), @@ -4443,7 +4561,7 @@ fn parachain_bond_inflation_reserve_matches_config() { new: inflation_configs(11, 50, 0, 0), }); // 6 won't be paid for this round because they left already - set_author(6, 1, 100); + set_author(6, 1, POINTS_PER_ROUND); roll_to_round_begin(8); // keep paying 6 assert_events_eq!( @@ -4505,7 +4623,7 @@ fn parachain_bond_inflation_reserve_matches_config() { }, ); assert_eq!(Balances::free_balance(&11), 95); - set_author(7, 1, 100); + set_author(7, 1, POINTS_PER_ROUND); roll_to_round_begin(9); // no more paying 6 assert_events_eq!( @@ -4567,7 +4685,7 @@ fn parachain_bond_inflation_reserve_matches_config() { }, ); assert_eq!(Balances::free_balance(&11), 127); - set_author(8, 1, 100); + set_author(8, 1, POINTS_PER_ROUND); roll_blocks(1); assert_ok!(ParachainStaking::delegate( RuntimeOrigin::signed(8), @@ -4644,8 +4762,8 @@ fn parachain_bond_inflation_reserve_matches_config() { }, ); assert_eq!(Balances::free_balance(&11), 160); - set_author(9, 1, 100); - set_author(10, 1, 100); + set_author(9, 1, POINTS_PER_ROUND); + set_author(10, 1, POINTS_PER_ROUND); roll_to_round_begin(11); // new delegation is still not rewarded yet assert_events_eq!( @@ -4867,7 +4985,7 @@ fn paid_collator_commission_matches_config() { }, ); // only reward author with id 4 - set_author(3, 4, 100); + set_author(3, 4, POINTS_PER_ROUND); roll_to_round_begin(5); // 20% of 10 is commission + due_portion (0) = 2 + 4 = 6 // all delegator payouts are 10-2 = 8 * stake_pct @@ -4894,15 +5012,15 @@ fn paid_collator_commission_matches_config() { assert_events_eq!( Event::Rewarded { account: 4, - rewards: 18, + rewards: 9, }, Event::Rewarded { account: 5, - rewards: 6, + rewards: 3, }, Event::Rewarded { account: 6, - rewards: 6, + rewards: 3, }, ); }); @@ -5124,7 +5242,7 @@ fn payout_distribution_to_solo_collators() { }, ); // ~ set block author as 1 for all blocks this round - set_author(2, 1, 100); + set_author(2, 1, POINTS_PER_ROUND); roll_to_round_begin(4); assert_events_eq!( Event::CollatorChosen { @@ -5158,12 +5276,12 @@ fn payout_distribution_to_solo_collators() { roll_blocks(3); assert_events_eq!(Event::Rewarded { account: 1, - rewards: 205, + rewards: 102, }); // ~ set block author as 1 for 3 blocks this round - set_author(4, 1, 60); + set_author(4, 1, POINTS_PER_BLOCK * 3); // ~ set block author as 2 for 2 blocks this round - set_author(4, 2, 40); + set_author(4, 2, POINTS_PER_BLOCK * 2); roll_to_round_begin(6); // pay 60% total issuance to 1 and 40% total issuance to 2 assert_events_eq!( @@ -5197,18 +5315,18 @@ fn payout_distribution_to_solo_collators() { roll_blocks(3); assert_events_eq!(Event::Rewarded { account: 1, - rewards: 129, + rewards: 63, }); roll_blocks(1); assert_events_eq!(Event::Rewarded { account: 2, - rewards: 86, + rewards: 42, },); - // ~ each collator produces 1 block this round - set_author(6, 1, 20); - set_author(6, 2, 20); - set_author(6, 3, 20); - set_author(6, 4, 20); + // ~ each collator produces at least 1 block this round + set_author(6, 1, POINTS_PER_BLOCK * 2); + set_author(6, 2, POINTS_PER_BLOCK); + set_author(6, 3, POINTS_PER_BLOCK); + set_author(6, 4, POINTS_PER_BLOCK); roll_to_round_begin(8); // pay 20% issuance for all collators assert_events_eq!( @@ -5242,22 +5360,22 @@ fn payout_distribution_to_solo_collators() { roll_blocks(1); assert_events_eq!(Event::Rewarded { account: 3, - rewards: 56, + rewards: 21, }); roll_blocks(1); assert_events_eq!(Event::Rewarded { account: 4, - rewards: 56, + rewards: 21, }); roll_blocks(1); assert_events_eq!(Event::Rewarded { account: 1, - rewards: 56, + rewards: 43, }); roll_blocks(1); assert_events_eq!(Event::Rewarded { account: 2, - rewards: 56, + rewards: 21, }); // check that distributing rewards clears awarded pts assert!(ParachainStaking::awarded_pts(1, 1).is_zero()); @@ -5569,8 +5687,8 @@ fn payouts_follow_delegation_changes() { .build() .execute_with(|| { // ~ set block author as 1 for all blocks this round - set_author(1, 1, 100); - set_author(2, 1, 100); + set_author(1, 1, POINTS_PER_ROUND); + set_author(2, 1, POINTS_PER_ROUND); roll_to_round_begin(2); // chooses top TotalSelectedCandidates (5), in order assert_events_eq!( @@ -5602,8 +5720,8 @@ fn payouts_follow_delegation_changes() { }, ); - set_author(3, 1, 100); - set_author(4, 1, 100); + set_author(3, 1, POINTS_PER_ROUND); + set_author(4, 1, POINTS_PER_ROUND); roll_to_round_begin(4); // distribute total issuance to collator 1 and its delegators 6, 7, 19 @@ -5639,23 +5757,23 @@ fn payouts_follow_delegation_changes() { assert_events_eq!( Event::Rewarded { account: 1, - rewards: 23, + rewards: 11, }, Event::Rewarded { account: 6, - rewards: 7, + rewards: 4, }, Event::Rewarded { account: 7, - rewards: 7, + rewards: 4, }, Event::Rewarded { account: 10, - rewards: 7, + rewards: 4, }, ); // ~ set block author as 1 for all blocks this round - set_author(5, 1, 100); + set_author(5, 1, POINTS_PER_ROUND); roll_blocks(1); // 1. ensure delegators are paid for 2 rounds after they leave @@ -5707,23 +5825,23 @@ fn payouts_follow_delegation_changes() { assert_events_eq!( Event::Rewarded { account: 1, - rewards: 24, + rewards: 12, }, Event::Rewarded { account: 6, - rewards: 8, + rewards: 4, }, Event::Rewarded { account: 7, - rewards: 8, + rewards: 4, }, Event::Rewarded { account: 10, - rewards: 8, + rewards: 4, }, ); - set_author(6, 1, 100); + set_author(6, 1, POINTS_PER_ROUND); // keep paying 6 (note: inflation is in terms of total issuance so that's why 1 is 21) roll_to_round_begin(6); assert_ok!(ParachainStaking::execute_delegation_request( @@ -5778,23 +5896,23 @@ fn payouts_follow_delegation_changes() { assert_events_eq!( Event::Rewarded { account: 1, - rewards: 26, + rewards: 12, }, Event::Rewarded { account: 6, - rewards: 8, + rewards: 4, }, Event::Rewarded { account: 7, - rewards: 8, + rewards: 4, }, Event::Rewarded { account: 10, - rewards: 8, + rewards: 4, }, ); // 6 won't be paid for this round because they left already - set_author(7, 1, 100); + set_author(7, 1, POINTS_PER_ROUND); roll_to_round_begin(7); // keep paying 6 assert_events_eq!( @@ -5829,18 +5947,18 @@ fn payouts_follow_delegation_changes() { assert_events_eq!( Event::Rewarded { account: 1, - rewards: 31, + rewards: 14, }, Event::Rewarded { account: 7, - rewards: 10, + rewards: 5, }, Event::Rewarded { account: 10, - rewards: 10, + rewards: 5, }, ); - set_author(8, 1, 100); + set_author(8, 1, POINTS_PER_ROUND); roll_to_round_begin(8); assert_events_eq!( Event::CollatorChosen { @@ -5874,18 +5992,18 @@ fn payouts_follow_delegation_changes() { assert_events_eq!( Event::Rewarded { account: 1, - rewards: 32, + rewards: 15, }, Event::Rewarded { account: 7, - rewards: 11, + rewards: 5, }, Event::Rewarded { account: 10, - rewards: 11, + rewards: 5, }, ); - set_author(9, 1, 100); + set_author(9, 1, POINTS_PER_ROUND); roll_to_round_begin(9); // no more paying 6 assert_events_eq!( @@ -5920,15 +6038,15 @@ fn payouts_follow_delegation_changes() { assert_events_eq!( Event::Rewarded { account: 1, - rewards: 34, + rewards: 15, }, Event::Rewarded { account: 7, - rewards: 11, + rewards: 5, }, Event::Rewarded { account: 10, - rewards: 11, + rewards: 5, }, ); roll_blocks(1); @@ -5947,7 +6065,7 @@ fn payouts_follow_delegation_changes() { auto_compound: Percent::zero(), }); - set_author(10, 1, 100); + set_author(10, 1, POINTS_PER_ROUND); roll_to_round_begin(10); // new delegation is not rewarded yet assert_events_eq!( @@ -5982,15 +6100,15 @@ fn payouts_follow_delegation_changes() { assert_events_eq!( Event::Rewarded { account: 1, - rewards: 36, + rewards: 15, }, Event::Rewarded { account: 7, - rewards: 12, + rewards: 5, }, Event::Rewarded { account: 10, - rewards: 12, + rewards: 5, }, ); roll_to_round_begin(11); @@ -6027,15 +6145,15 @@ fn payouts_follow_delegation_changes() { assert_events_eq!( Event::Rewarded { account: 1, - rewards: 37, + rewards: 15, }, Event::Rewarded { account: 7, - rewards: 12, + rewards: 5, }, Event::Rewarded { account: 10, - rewards: 12, + rewards: 5, }, ); roll_to_round_begin(12); @@ -6073,19 +6191,19 @@ fn payouts_follow_delegation_changes() { assert_events_eq!( Event::Rewarded { account: 1, - rewards: 34, + rewards: 14, }, Event::Rewarded { account: 7, - rewards: 10, + rewards: 4, }, Event::Rewarded { account: 10, - rewards: 10, + rewards: 4, }, Event::Rewarded { account: 8, - rewards: 10, + rewards: 4, }, ); }); @@ -6491,11 +6609,9 @@ fn no_rewards_paid_until_after_reward_payment_delay() { .build() .execute_with(|| { // payouts for round 1 - set_author(1, 1, 1); - set_author(1, 2, 1); - set_author(1, 2, 1); - set_author(1, 3, 1); - set_author(1, 3, 1); + set_author(1, 1, POINTS_PER_BLOCK); + set_author(1, 2, POINTS_PER_BLOCK * 2); + set_author(1, 3, POINTS_PER_BLOCK * 2); roll_to_round_begin(2); assert_events_eq!( @@ -6556,7 +6672,7 @@ fn no_rewards_paid_until_after_reward_payment_delay() { roll_blocks(1); assert_events_eq!(Event::Rewarded { account: 1, - rewards: 1, + rewards: 0, }); roll_blocks(1); @@ -6584,8 +6700,8 @@ fn deferred_payment_storage_items_are_cleaned_up() { .with_candidates(vec![(1, 20), (2, 20)]) .build() .execute_with(|| { - set_author(1, 1, 1); - set_author(1, 2, 1); + set_author(1, 1, POINTS_PER_BLOCK * 3); + set_author(1, 2, POINTS_PER_BLOCK * 2); // reflects genesis? assert!(>::contains_key(1, 1)); @@ -6666,16 +6782,16 @@ fn deferred_payment_storage_items_are_cleaned_up() { "DelayedPayouts should be populated after RewardPaymentDelay" ); assert!(>::contains_key(1)); - assert!(!>::contains_key(2)); + assert!(>::contains_key(2)); assert!( - !>::contains_key(2), - "We never rewarded points for round 2" + >::contains_key(2), + "We awarded points for round 2" ); assert!(!>::contains_key(3)); assert!( - !>::contains_key(3), - "We never awarded points for round 3" + >::contains_key(3), + "We awarded points for round 3" ); // collator 1 has been paid in this last block and associated storage cleaned up @@ -6690,7 +6806,7 @@ fn deferred_payment_storage_items_are_cleaned_up() { roll_blocks(1); assert_events_eq!(Event::Rewarded { account: 2, - rewards: 1, + rewards: 0, },); roll_to_round_begin(4); @@ -6736,8 +6852,8 @@ fn deferred_payment_and_at_stake_storage_items_cleaned_up_for_candidates_not_pro .build() .execute_with(|| { // candidate 3 will not produce blocks - set_author(1, 1, 1); - set_author(1, 2, 1); + set_author(1, 1, POINTS_PER_BLOCK * 3); + set_author(1, 2, POINTS_PER_BLOCK * 2); // reflects genesis? assert!(>::contains_key(1, 1)); @@ -6808,10 +6924,10 @@ fn deferred_payment_steady_state_event_flow() { .execute_with(|| { // convenience to set the round points consistently let set_round_points = |round: BlockNumber| { - set_author(round as BlockNumber, 1, 1); - set_author(round as BlockNumber, 2, 1); - set_author(round as BlockNumber, 3, 1); - set_author(round as BlockNumber, 4, 1); + set_author(round as BlockNumber, 1, 2 * POINTS_PER_ROUND); + set_author(round as BlockNumber, 2, POINTS_PER_ROUND); + set_author(round as BlockNumber, 3, POINTS_PER_ROUND); + set_author(round as BlockNumber, 4, POINTS_PER_ROUND); }; // grab initial issuance -- we will reset it before round issuance is calculated so that @@ -6892,15 +7008,15 @@ fn deferred_payment_steady_state_event_flow() { assert_events_eq!( Event::Rewarded { account: 3, - rewards: 19, + rewards: 13, }, Event::Rewarded { account: 22, - rewards: 6, + rewards: 4, }, Event::Rewarded { account: 33, - rewards: 6, + rewards: 4, }, ); @@ -6908,15 +7024,15 @@ fn deferred_payment_steady_state_event_flow() { assert_events_eq!( Event::Rewarded { account: 4, - rewards: 19, + rewards: 13, }, Event::Rewarded { account: 33, - rewards: 6, + rewards: 4, }, Event::Rewarded { account: 44, - rewards: 6, + rewards: 4, }, ); @@ -6924,15 +7040,15 @@ fn deferred_payment_steady_state_event_flow() { assert_events_eq!( Event::Rewarded { account: 1, - rewards: 19, + rewards: 27, }, Event::Rewarded { account: 11, - rewards: 6, + rewards: 9, }, Event::Rewarded { account: 44, - rewards: 6, + rewards: 9, }, ); @@ -6940,15 +7056,15 @@ fn deferred_payment_steady_state_event_flow() { assert_events_eq!( Event::Rewarded { account: 2, - rewards: 19, + rewards: 13, }, Event::Rewarded { account: 11, - rewards: 6, + rewards: 4, }, Event::Rewarded { account: 22, - rewards: 6, + rewards: 4, }, ); @@ -7085,7 +7201,7 @@ fn test_delegator_scheduled_for_revoke_is_rewarded_for_previous_rounds_but_not_f .build() .execute_with(|| { // preset rewards for rounds 1, 2 and 3 - (1..=3).for_each(|round| set_author(round, 1, 1)); + (1..=3).for_each(|round| set_author(round, 1, POINTS_PER_ROUND)); assert_ok!(ParachainStaking::schedule_revoke_delegation( RuntimeOrigin::signed(2), @@ -7113,7 +7229,7 @@ fn test_delegator_scheduled_for_revoke_is_rewarded_for_previous_rounds_but_not_f assert_events_eq!( Event::Rewarded { account: 1, - rewards: 4, + rewards: 2, }, Event::Rewarded { account: 2, @@ -7126,7 +7242,7 @@ fn test_delegator_scheduled_for_revoke_is_rewarded_for_previous_rounds_but_not_f roll_blocks(3); assert_events_eq!(Event::Rewarded { account: 1, - rewards: 5, + rewards: 2, },); let collator_snapshot = ParachainStaking::at_stake(ParachainStaking::round().current, 1) @@ -7152,7 +7268,7 @@ fn test_delegator_scheduled_for_revoke_is_rewarded_when_request_cancelled() { .build() .execute_with(|| { // preset rewards for rounds 2, 3 and 4 - (2..=4).for_each(|round| set_author(round, 1, 1)); + (2..=4).for_each(|round| set_author(round, 1, POINTS_PER_ROUND)); assert_ok!(ParachainStaking::schedule_revoke_delegation( RuntimeOrigin::signed(2), @@ -7185,7 +7301,7 @@ fn test_delegator_scheduled_for_revoke_is_rewarded_when_request_cancelled() { roll_blocks(3); assert_events_eq!(Event::Rewarded { account: 1, - rewards: 5, + rewards: 2, },); let collator_snapshot = ParachainStaking::at_stake(ParachainStaking::round().current, 1) @@ -7206,7 +7322,7 @@ fn test_delegator_scheduled_for_revoke_is_rewarded_when_request_cancelled() { assert_events_eq!( Event::Rewarded { account: 1, - rewards: 4, + rewards: 1, }, Event::Rewarded { account: 2, @@ -7226,7 +7342,7 @@ fn test_delegator_scheduled_for_bond_decrease_is_rewarded_for_previous_rounds_bu .build() .execute_with(|| { // preset rewards for rounds 1, 2 and 3 - (1..=3).for_each(|round| set_author(round, 1, 1)); + (1..=3).for_each(|round| set_author(round, 1, POINTS_PER_ROUND)); assert_ok!(ParachainStaking::schedule_delegator_bond_less( RuntimeOrigin::signed(2), @@ -7255,11 +7371,11 @@ fn test_delegator_scheduled_for_bond_decrease_is_rewarded_for_previous_rounds_bu assert_events_eq!( Event::Rewarded { account: 1, - rewards: 3, + rewards: 2, }, Event::Rewarded { account: 2, - rewards: 2, + rewards: 1, }, ); @@ -7269,7 +7385,7 @@ fn test_delegator_scheduled_for_bond_decrease_is_rewarded_for_previous_rounds_bu assert_events_eq!( Event::Rewarded { account: 1, - rewards: 4, + rewards: 1, }, Event::Rewarded { account: 2, @@ -7300,7 +7416,7 @@ fn test_delegator_scheduled_for_bond_decrease_is_rewarded_when_request_cancelled .build() .execute_with(|| { // preset rewards for rounds 2, 3 and 4 - (2..=4).for_each(|round| set_author(round, 1, 1)); + (2..=4).for_each(|round| set_author(round, 1, POINTS_PER_ROUND)); assert_ok!(ParachainStaking::schedule_delegator_bond_less( RuntimeOrigin::signed(2), @@ -7335,7 +7451,7 @@ fn test_delegator_scheduled_for_bond_decrease_is_rewarded_when_request_cancelled assert_events_eq!( Event::Rewarded { account: 1, - rewards: 4, + rewards: 1, }, Event::Rewarded { account: 2, @@ -7361,11 +7477,11 @@ fn test_delegator_scheduled_for_bond_decrease_is_rewarded_when_request_cancelled assert_events_eq!( Event::Rewarded { account: 1, - rewards: 3, + rewards: 1, }, Event::Rewarded { account: 2, - rewards: 2, + rewards: 1, }, ); }); @@ -7380,7 +7496,7 @@ fn test_delegator_scheduled_for_leave_is_rewarded_for_previous_rounds_but_not_fo .build() .execute_with(|| { // preset rewards for rounds 1, 2 and 3 - (1..=3).for_each(|round| set_author(round, 1, 1)); + (1..=3).for_each(|round| set_author(round, 1, POINTS_PER_ROUND)); assert_ok!(ParachainStaking::schedule_revoke_delegation( RuntimeOrigin::signed(2), @@ -7420,7 +7536,7 @@ fn test_delegator_scheduled_for_leave_is_rewarded_for_previous_rounds_but_not_fo assert_events_eq!( Event::Rewarded { account: 1, - rewards: 4, + rewards: 2, }, Event::Rewarded { account: 2, @@ -7433,7 +7549,7 @@ fn test_delegator_scheduled_for_leave_is_rewarded_for_previous_rounds_but_not_fo roll_blocks(3); assert_events_eq!(Event::Rewarded { account: 1, - rewards: 5, + rewards: 2, },); let collator_snapshot = ParachainStaking::at_stake(ParachainStaking::round().current, 1) @@ -7459,7 +7575,7 @@ fn test_delegator_scheduled_for_leave_is_rewarded_when_request_cancelled() { .build() .execute_with(|| { // preset rewards for rounds 2, 3 and 4 - (2..=4).for_each(|round| set_author(round, 1, 1)); + (2..=4).for_each(|round| set_author(round, 1, POINTS_PER_ROUND)); assert_ok!(ParachainStaking::schedule_revoke_delegation( RuntimeOrigin::signed(2), @@ -7508,7 +7624,7 @@ fn test_delegator_scheduled_for_leave_is_rewarded_when_request_cancelled() { roll_blocks(3); assert_events_eq!(Event::Rewarded { account: 1, - rewards: 5, + rewards: 2, },); let collator_snapshot = ParachainStaking::at_stake(ParachainStaking::round().current, 1) @@ -7529,7 +7645,7 @@ fn test_delegator_scheduled_for_leave_is_rewarded_when_request_cancelled() { assert_events_eq!( Event::Rewarded { account: 1, - rewards: 4, + rewards: 1, }, Event::Rewarded { account: 2, @@ -8187,7 +8303,7 @@ fn test_rewards_do_not_auto_compound_on_payment_if_delegation_scheduled_revoke_e .with_delegations(vec![(2, 1, 200), (3, 1, 200)]) .build() .execute_with(|| { - (2..=5).for_each(|round| set_author(round, 1, 1)); + (2..=5).for_each(|round| set_author(round, 1, POINTS_PER_ROUND)); assert_ok!(ParachainStaking::set_auto_compound( RuntimeOrigin::signed(2), 1, @@ -8229,22 +8345,22 @@ fn test_rewards_do_not_auto_compound_on_payment_if_delegation_scheduled_revoke_e assert_events_eq!( Event::Rewarded { account: 1, - rewards: 9, + rewards: 4, }, // no compound since revoke request exists Event::Rewarded { account: 2, - rewards: 8, + rewards: 4, }, // 50% Event::Rewarded { account: 3, - rewards: 8, + rewards: 4, }, Event::Compounded { candidate: 1, delegator: 3, - amount: 4, + amount: 2, }, ); }); @@ -8258,7 +8374,7 @@ fn test_rewards_auto_compound_on_payment_as_per_auto_compound_config() { .with_delegations(vec![(2, 1, 200), (3, 1, 200), (4, 1, 200), (5, 1, 200)]) .build() .execute_with(|| { - (2..=6).for_each(|round| set_author(round, 1, 1)); + (2..=6).for_each(|round| set_author(round, 1, POINTS_PER_ROUND)); assert_ok!(ParachainStaking::set_auto_compound( RuntimeOrigin::signed(2), 1, @@ -8300,37 +8416,37 @@ fn test_rewards_auto_compound_on_payment_as_per_auto_compound_config() { assert_events_eq!( Event::Rewarded { account: 1, - rewards: 13, + rewards: 6, }, // 0% Event::Rewarded { account: 2, - rewards: 8, + rewards: 4, }, // 50% Event::Rewarded { account: 3, - rewards: 8, + rewards: 4, }, Event::Compounded { candidate: 1, delegator: 3, - amount: 4, + amount: 2, }, // 100% Event::Rewarded { account: 4, - rewards: 8, + rewards: 4, }, Event::Compounded { candidate: 1, delegator: 4, - amount: 8, + amount: 4, }, // no-config Event::Rewarded { account: 5, - rewards: 8, + rewards: 4, }, ); }); @@ -8849,10 +8965,10 @@ fn test_on_initialize_weights() { let weight = ParachainStaking::on_initialize(1); // TODO: build this with proper db reads/writes - assert_eq!(Weight::from_parts(277168000, 0), weight); + assert_eq!(Weight::from_parts(402168000, 0), weight); // roll to the end of the round, then run on_init again, we should see round change... - set_author(3, 1, 100); // must set some points for prepare_staking_payouts + set_author(3, 1, POINTS_PER_ROUND); // must set some points for prepare_staking_payouts roll_to_round_end(3); let block = System::block_number() + 1; let weight = ParachainStaking::on_initialize(block); @@ -8863,13 +8979,14 @@ fn test_on_initialize_weights() { // // following this assertion, we add individual weights together to show that we can // derive this number independently. - let expected_on_init = 2404547135; - assert_eq!(Weight::from_parts(expected_on_init, 32562), weight); + let expected_on_init = 3541628080; + assert_eq!(Weight::from_parts(expected_on_init, 51512), weight); // assemble weight manually to ensure it is well understood let mut expected_weight = 0u64; expected_weight += PalletWeights::::base_on_initialize().ref_time(); expected_weight += PalletWeights::::prepare_staking_payouts().ref_time(); + expected_weight += PalletWeights::::mark_collators_as_inactive(5).ref_time(); // TODO: this should be the same as >. I believe this relates to // genesis building @@ -8884,9 +9001,9 @@ fn test_on_initialize_weights() { // Round write, done in on-round-change code block inside on_initialize() expected_weight += RocksDbWeight::get().reads_writes(0, 1).ref_time(); // more reads/writes manually accounted for for on_finalize - expected_weight += RocksDbWeight::get().reads_writes(3, 2).ref_time(); + expected_weight += RocksDbWeight::get().reads_writes(4, 3).ref_time(); - assert_eq!(Weight::from_parts(expected_weight, 32562), weight); + assert_eq!(Weight::from_parts(expected_weight, 51512), weight); assert_eq!(expected_on_init, expected_weight); // magic number == independent accounting }); } diff --git a/pallets/parachain-staking/src/weights.rs b/pallets/parachain-staking/src/weights.rs index f614712c3f..42f01dd4e5 100644 --- a/pallets/parachain-staking/src/weights.rs +++ b/pallets/parachain-staking/src/weights.rs @@ -91,6 +91,7 @@ pub trait WeightInfo { fn delegate_with_auto_compound_worst() -> Weight; fn mint_collator_reward() -> Weight; fn notify_inactive_collator() -> Weight; + fn mark_collators_as_inactive(x: u32) -> Weight; } /// Weights for pallet_parachain_staking using the Substrate node and recommended hardware. @@ -918,6 +919,28 @@ impl WeightInfo for SubstrateWeight { .saturating_add(T::DbWeight::get().reads(10_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } + + /// Storage: `ParachainStaking::AtStake` (r:52 w:0) + /// Proof: `ParachainStaking::AtStake` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `ParachainStaking::AwardedPts` (r:51 w:0) + /// Proof: `ParachainStaking::AwardedPts` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `ParachainStaking::WasInactive` (r:0 w:51) + /// Proof: `ParachainStaking::WasInactive` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `x` is `[0, 50]`. + fn mark_collators_as_inactive(x: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `108 + x * (104 ±0)` + // Estimated: `6050 + x * (2580 ±0)` + // Minimum execution time: 16_000_000 picoseconds. + Weight::from_parts(27_982_315, 6050) + // Standard Error: 27_443 + .saturating_add(Weight::from_parts(11_819_726, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(x.into()))) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(x.into()))) + .saturating_add(Weight::from_parts(0, 2580).saturating_mul(x.into())) + } } // For backwards compatibility and tests @@ -1743,4 +1766,26 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(10_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } + + /// Storage: `ParachainStaking::AtStake` (r:52 w:0) + /// Proof: `ParachainStaking::AtStake` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `ParachainStaking::AwardedPts` (r:51 w:0) + /// Proof: `ParachainStaking::AwardedPts` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `ParachainStaking::WasInactive` (r:0 w:51) + /// Proof: `ParachainStaking::WasInactive` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `x` is `[0, 50]`. + fn mark_collators_as_inactive(x: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `108 + x * (104 ±0)` + // Estimated: `6050 + x * (2580 ±0)` + // Minimum execution time: 16_000_000 picoseconds. + Weight::from_parts(27_982_315, 6050) + // Standard Error: 27_443 + .saturating_add(Weight::from_parts(11_819_726, 0).saturating_mul(x.into())) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(x.into()))) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(x.into()))) + .saturating_add(Weight::from_parts(0, 2580).saturating_mul(x.into())) + } } diff --git a/runtime/moonbase/src/weights/pallet_parachain_staking.rs b/runtime/moonbase/src/weights/pallet_parachain_staking.rs index dc333d595a..697df3971f 100644 --- a/runtime/moonbase/src/weights/pallet_parachain_staking.rs +++ b/runtime/moonbase/src/weights/pallet_parachain_staking.rs @@ -872,4 +872,26 @@ impl pallet_parachain_staking::WeightInfo for WeightInf .saturating_add(T::DbWeight::get().reads(10_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } + + /// Storage: `ParachainStaking::AtStake` (r:52 w:0) + /// Proof: `ParachainStaking::AtStake` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `ParachainStaking::AwardedPts` (r:51 w:0) + /// Proof: `ParachainStaking::AwardedPts` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `ParachainStaking::WasInactive` (r:0 w:51) + /// Proof: `ParachainStaking::WasInactive` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `x` is `[0, 50]`. + fn mark_collators_as_inactive(x: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `108 + x * (104 ±0)` + // Estimated: `6050 + x * (2580 ±0)` + // Minimum execution time: 16_000_000 picoseconds. + Weight::from_parts(27_982_315, 6050) + // Standard Error: 27_443 + .saturating_add(Weight::from_parts(11_819_726, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(x.into()))) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(x.into()))) + .saturating_add(Weight::from_parts(0, 2580).saturating_mul(x.into())) + } } diff --git a/runtime/moonbeam/src/weights/pallet_parachain_staking.rs b/runtime/moonbeam/src/weights/pallet_parachain_staking.rs index 88e69f21a5..e8bf9a8e95 100644 --- a/runtime/moonbeam/src/weights/pallet_parachain_staking.rs +++ b/runtime/moonbeam/src/weights/pallet_parachain_staking.rs @@ -874,4 +874,26 @@ impl pallet_parachain_staking::WeightInfo for WeightInf .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } + + /// Storage: `ParachainStaking::AtStake` (r:52 w:0) + /// Proof: `ParachainStaking::AtStake` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `ParachainStaking::AwardedPts` (r:51 w:0) + /// Proof: `ParachainStaking::AwardedPts` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `ParachainStaking::WasInactive` (r:0 w:51) + /// Proof: `ParachainStaking::WasInactive` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `x` is `[0, 50]`. + fn mark_collators_as_inactive(x: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `108 + x * (104 ±0)` + // Estimated: `6050 + x * (2580 ±0)` + // Minimum execution time: 16_000_000 picoseconds. + Weight::from_parts(27_982_315, 6050) + // Standard Error: 27_443 + .saturating_add(Weight::from_parts(11_819_726, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(x.into()))) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(x.into()))) + .saturating_add(Weight::from_parts(0, 2580).saturating_mul(x.into())) + } } diff --git a/runtime/moonriver/src/weights/pallet_parachain_staking.rs b/runtime/moonriver/src/weights/pallet_parachain_staking.rs index 461e6f7da1..a6d026688d 100644 --- a/runtime/moonriver/src/weights/pallet_parachain_staking.rs +++ b/runtime/moonriver/src/weights/pallet_parachain_staking.rs @@ -874,4 +874,26 @@ impl pallet_parachain_staking::WeightInfo for WeightInf .saturating_add(T::DbWeight::get().reads(10_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } + + /// Storage: `ParachainStaking::AtStake` (r:52 w:0) + /// Proof: `ParachainStaking::AtStake` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `ParachainStaking::AwardedPts` (r:51 w:0) + /// Proof: `ParachainStaking::AwardedPts` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `ParachainStaking::WasInactive` (r:0 w:51) + /// Proof: `ParachainStaking::WasInactive` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `x` is `[0, 50]`. + fn mark_collators_as_inactive(x: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `108 + x * (104 ±0)` + // Estimated: `6050 + x * (2580 ±0)` + // Minimum execution time: 16_000_000 picoseconds. + Weight::from_parts(27_982_315, 6050) + // Standard Error: 27_443 + .saturating_add(Weight::from_parts(11_819_726, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(x.into()))) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(x.into()))) + .saturating_add(Weight::from_parts(0, 2580).saturating_mul(x.into())) + } } From 66ae1104625f73f9a0d313d9324bf3d3c84ff47c Mon Sep 17 00:00:00 2001 From: Manuel Mauro Date: Wed, 15 Jan 2025 18:14:41 +0100 Subject: [PATCH 03/10] Remove any XCM v2 reference in codebase (#3131) * test: :white_check_mark: use XCM v3 as default in runtime tests * test: :white_check_mark: use XCM v3 as default in mocks * test: :white_check_mark: remove unused XCM v2 compatibility function deposit_asset in TS tests --- pallets/xcm-transactor/src/mock.rs | 2 +- runtime/moonbase/tests/xcm_tests.rs | 4 ++-- runtime/moonbeam/tests/xcm_tests.rs | 2 +- runtime/moonriver/tests/xcm_tests.rs | 4 ++-- test/helpers/xcm.ts | 20 +------------------ .../test-mock-dmp-error-and-appendix-1.ts | 2 +- .../test-mock-dmp-error-and-appendix-2.ts | 2 +- .../test-mock-dmp-error-and-appendix-3.ts | 2 +- .../test-mock-dmp-error-and-appendix-4.ts | 2 +- .../test-mock-dmp-error-and-appendix-5.ts | 2 +- .../test-mock-dmp-error-and-appendix-6.ts | 2 +- .../test-mock-hrmp-asset-transfer-2.ts | 2 +- .../test-mock-hrmp-asset-transfer-3.ts | 2 +- .../test-mock-hrmp-asset-transfer-4.ts | 2 +- .../test-mock-hrmp-asset-transfer-5.ts | 2 +- .../test-mock-hrmp-asset-transfer-6.ts | 2 +- .../test-mock-hrmp-asset-transfer-8.ts | 2 +- .../test-mock-hrmp-transact-ethereum-3.ts | 4 ++-- .../test-xcm-v3/test-xcm-erc20-excess-gas.ts | 4 ++-- .../test-xcm-erc20-fees-and-trap.ts | 6 +++--- .../test-xcm-v3/test-xcm-erc20-v3-filter.ts | 2 +- .../moonbase/test-xcm-v3/test-xcm-erc20-v3.ts | 2 +- .../test-xcm-v4/test-auto-pause-xcm.ts | 2 +- .../test-mock-dmp-error-and-appendix-1.ts | 2 +- .../test-mock-dmp-error-and-appendix-2.ts | 2 +- .../test-mock-dmp-error-and-appendix-3.ts | 2 +- .../test-mock-dmp-error-and-appendix-4.ts | 2 +- .../test-mock-dmp-error-and-appendix-5.ts | 2 +- .../test-mock-dmp-error-and-appendix-6.ts | 2 +- .../test-mock-hrmp-asset-transfer-1.ts | 2 +- .../test-mock-hrmp-asset-transfer-2.ts | 2 +- .../test-mock-hrmp-asset-transfer-3.ts | 2 +- .../test-mock-hrmp-asset-transfer-4.ts | 2 +- .../test-mock-hrmp-asset-transfer-5.ts | 2 +- .../test-mock-hrmp-asset-transfer-6.ts | 2 +- .../test-xcm-v4/test-xcm-dry-run-api.ts | 2 +- .../test-xcm-erc20-transfer-two-ERC20.ts | 2 +- .../test-xcm-v4/test-xcm-erc20-transfer.ts | 2 +- .../test-xcm-v4/test-xcm-ver-conversion-1.ts | 2 +- .../test-xcm-v4/test-xcm-ver-conversion-2.ts | 2 +- .../tracing-tests/test-trace-erc20-xcm.ts | 2 +- 41 files changed, 47 insertions(+), 65 deletions(-) diff --git a/pallets/xcm-transactor/src/mock.rs b/pallets/xcm-transactor/src/mock.rs index a6576dcccc..111401196b 100644 --- a/pallets/xcm-transactor/src/mock.rs +++ b/pallets/xcm-transactor/src/mock.rs @@ -137,7 +137,7 @@ impl WrapVersion for CustomVersionWrapper { xcm: impl Into>, ) -> Result, ()> { let xcm_version: u32 = - frame_support::storage::unhashed::get(XCM_VERSION_ROOT_KEY).unwrap_or(2); + frame_support::storage::unhashed::get(XCM_VERSION_ROOT_KEY).unwrap_or(3); let xcm_converted = xcm.into().into_version(xcm_version)?; Ok(xcm_converted) } diff --git a/runtime/moonbase/tests/xcm_tests.rs b/runtime/moonbase/tests/xcm_tests.rs index a7f38123be..3dcb131550 100644 --- a/runtime/moonbase/tests/xcm_tests.rs +++ b/runtime/moonbase/tests/xcm_tests.rs @@ -2085,7 +2085,7 @@ fn test_automatic_versioning_on_runtime_upgrade_with_relay() { // This sets the default version, for not known destinations assert_ok!(RelayChainPalletXcm::force_default_xcm_version( relay_chain::RuntimeOrigin::root(), - Some(2) + Some(3) )); // Wrap version, which sets VersionedStorage @@ -2214,7 +2214,7 @@ fn test_automatic_versioning_on_runtime_upgrade_with_para_b() { // This sets the default version, for not known destinations assert_ok!(ParachainPalletXcm::force_default_xcm_version( parachain::RuntimeOrigin::root(), - Some(2) + Some(3) )); // Wrap version, which sets VersionedStorage assert_ok!(::wrap_version( diff --git a/runtime/moonbeam/tests/xcm_tests.rs b/runtime/moonbeam/tests/xcm_tests.rs index 916190d68c..68074e4a58 100644 --- a/runtime/moonbeam/tests/xcm_tests.rs +++ b/runtime/moonbeam/tests/xcm_tests.rs @@ -1960,7 +1960,7 @@ fn test_automatic_versioning_on_runtime_upgrade_with_relay() { // This sets the default version, for not known destinations assert_ok!(RelayChainPalletXcm::force_default_xcm_version( relay_chain::RuntimeOrigin::root(), - Some(2) + Some(3) )); // Wrap version, which sets VersionedStorage diff --git a/runtime/moonriver/tests/xcm_tests.rs b/runtime/moonriver/tests/xcm_tests.rs index 920f440dda..b4b5145235 100644 --- a/runtime/moonriver/tests/xcm_tests.rs +++ b/runtime/moonriver/tests/xcm_tests.rs @@ -2119,7 +2119,7 @@ fn test_automatic_versioning_on_runtime_upgrade_with_relay() { // This sets the default version, for not known destinations assert_ok!(RelayChainPalletXcm::force_default_xcm_version( relay_chain::RuntimeOrigin::root(), - Some(2) + Some(3) )); // Wrap version, which sets VersionedStorage @@ -2249,7 +2249,7 @@ fn test_automatic_versioning_on_runtime_upgrade_with_para_b() { // This sets the default version, for not known destinations assert_ok!(ParachainPalletXcm::force_default_xcm_version( parachain::RuntimeOrigin::root(), - Some(2) + Some(3) )); // Wrap version, which sets VersionedStorage assert_ok!(::wrap_version( diff --git a/test/helpers/xcm.ts b/test/helpers/xcm.ts index 2fb34da13d..a153485937 100644 --- a/test/helpers/xcm.ts +++ b/test/helpers/xcm.ts @@ -348,25 +348,7 @@ export class XcmFragment { } // Add a `DepositAsset` instruction - deposit_asset(max_assets = 1n, network: "Any" | XcmV3JunctionNetworkId["type"] = "Any"): this { - if (this.config.beneficiary == null) { - console.warn("!Building a DepositAsset instruction without a configured beneficiary"); - } - this.instructions.push({ - DepositAsset: { - assets: { Wild: "All" }, - maxAssets: max_assets, - beneficiary: { - parents: 0, - interior: { X1: { AccountKey20: { network, key: this.config.beneficiary } } }, - }, - }, - }); - return this; - } - - // Add a `DepositAsset` instruction for xcm v3 - deposit_asset_v3(max_assets = 1n, network: XcmV3JunctionNetworkId["type"] | null = null): this { + deposit_asset(max_assets = 1n, network: XcmV3JunctionNetworkId["type"] | null = null): this { if (this.config.beneficiary == null) { console.warn("!Building a DepositAsset instruction without a configured beneficiary"); } diff --git a/test/suites/dev/moonbase/test-xcm-v3/test-mock-dmp-error-and-appendix-1.ts b/test/suites/dev/moonbase/test-xcm-v3/test-mock-dmp-error-and-appendix-1.ts index f25702e13a..f5e3940b9f 100644 --- a/test/suites/dev/moonbase/test-xcm-v3/test-mock-dmp-error-and-appendix-1.ts +++ b/test/suites/dev/moonbase/test-xcm-v3/test-mock-dmp-error-and-appendix-1.ts @@ -56,7 +56,7 @@ describeSuite({ // But since there is no error, and the deposit is on the error handler, the assets // will be trapped .with(function () { - return this.set_error_handler_with([this.deposit_asset_v3]); + return this.set_error_handler_with([this.deposit_asset]); }) .clear_origin() .as_v3(); diff --git a/test/suites/dev/moonbase/test-xcm-v3/test-mock-dmp-error-and-appendix-2.ts b/test/suites/dev/moonbase/test-xcm-v3/test-mock-dmp-error-and-appendix-2.ts index 431f70da2b..a3a2127f82 100644 --- a/test/suites/dev/moonbase/test-xcm-v3/test-mock-dmp-error-and-appendix-2.ts +++ b/test/suites/dev/moonbase/test-xcm-v3/test-mock-dmp-error-and-appendix-2.ts @@ -55,7 +55,7 @@ describeSuite({ // BuyExecution does not charge for fees because we registered it for not doing so // As a consequence the trapped assets will be entirely credited .with(function () { - return this.set_error_handler_with([this.deposit_asset_v3]); + return this.set_error_handler_with([this.deposit_asset]); }) .trap() .as_v3(); diff --git a/test/suites/dev/moonbase/test-xcm-v3/test-mock-dmp-error-and-appendix-3.ts b/test/suites/dev/moonbase/test-xcm-v3/test-mock-dmp-error-and-appendix-3.ts index 8fe81b516d..f6a99a5202 100644 --- a/test/suites/dev/moonbase/test-xcm-v3/test-mock-dmp-error-and-appendix-3.ts +++ b/test/suites/dev/moonbase/test-xcm-v3/test-mock-dmp-error-and-appendix-3.ts @@ -54,7 +54,7 @@ describeSuite({ .buy_execution() // Set an appendix to be executed after the XCM message is executed. No matter if errors .with(function () { - return this.set_appendix_with([this.deposit_asset_v3]); + return this.set_appendix_with([this.deposit_asset]); }) .as_v3(); diff --git a/test/suites/dev/moonbase/test-xcm-v3/test-mock-dmp-error-and-appendix-4.ts b/test/suites/dev/moonbase/test-xcm-v3/test-mock-dmp-error-and-appendix-4.ts index 0976776440..3b1e56931c 100644 --- a/test/suites/dev/moonbase/test-xcm-v3/test-mock-dmp-error-and-appendix-4.ts +++ b/test/suites/dev/moonbase/test-xcm-v3/test-mock-dmp-error-and-appendix-4.ts @@ -56,7 +56,7 @@ describeSuite({ // As a consequence the trapped assets will be entirely credited // The goal is to show appendix runs even if there is an error .with(function () { - return this.set_appendix_with([this.deposit_asset_v3]); + return this.set_appendix_with([this.deposit_asset]); }) .trap() .as_v3(); diff --git a/test/suites/dev/moonbase/test-xcm-v3/test-mock-dmp-error-and-appendix-5.ts b/test/suites/dev/moonbase/test-xcm-v3/test-mock-dmp-error-and-appendix-5.ts index 508a49fa70..1d25770869 100644 --- a/test/suites/dev/moonbase/test-xcm-v3/test-mock-dmp-error-and-appendix-5.ts +++ b/test/suites/dev/moonbase/test-xcm-v3/test-mock-dmp-error-and-appendix-5.ts @@ -56,7 +56,7 @@ describeSuite({ // As a consequence the trapped assets will be entirely credited // The goal is to show appendix runs even if there is an error .with(function () { - return this.set_appendix_with([this.deposit_asset_v3]); + return this.set_appendix_with([this.deposit_asset]); }) .trap() .as_v3(); diff --git a/test/suites/dev/moonbase/test-xcm-v3/test-mock-dmp-error-and-appendix-6.ts b/test/suites/dev/moonbase/test-xcm-v3/test-mock-dmp-error-and-appendix-6.ts index 599ed58484..3f6ec922a4 100644 --- a/test/suites/dev/moonbase/test-xcm-v3/test-mock-dmp-error-and-appendix-6.ts +++ b/test/suites/dev/moonbase/test-xcm-v3/test-mock-dmp-error-and-appendix-6.ts @@ -99,7 +99,7 @@ describeSuite({ .claim_asset() .buy_execution() // Deposit assets, this time correctly, on Alith - .deposit_asset_v3() + .deposit_asset() .as_v3(); const receivedMessage: XcmVersionedXcm = context diff --git a/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-asset-transfer-2.ts b/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-asset-transfer-2.ts index 5d7671b1d4..deabdfcb63 100644 --- a/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-asset-transfer-2.ts +++ b/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-asset-transfer-2.ts @@ -78,7 +78,7 @@ describeSuite({ .reserve_asset_deposited() .clear_origin() .buy_execution() - .deposit_asset_v3() + .deposit_asset() .as_v3(); // Send an XCM and create block to execute it diff --git a/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-asset-transfer-3.ts b/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-asset-transfer-3.ts index a1e0149c9c..44fbb6f600 100644 --- a/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-asset-transfer-3.ts +++ b/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-asset-transfer-3.ts @@ -89,7 +89,7 @@ describeSuite({ .reserve_asset_deposited() .clear_origin() .buy_execution() - .deposit_asset_v3() + .deposit_asset() .as_v3(); // Send an XCM and create block to execute it diff --git a/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-asset-transfer-4.ts b/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-asset-transfer-4.ts index 4ed35bfa49..bdf615248b 100644 --- a/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-asset-transfer-4.ts +++ b/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-asset-transfer-4.ts @@ -73,7 +73,7 @@ describeSuite({ .withdraw_asset() .clear_origin() .buy_execution() - .deposit_asset_v3() + .deposit_asset() .as_v3(); // Send an XCM and create block to execute it diff --git a/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-asset-transfer-5.ts b/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-asset-transfer-5.ts index c8a5672a81..a1c2e6c18d 100644 --- a/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-asset-transfer-5.ts +++ b/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-asset-transfer-5.ts @@ -71,7 +71,7 @@ describeSuite({ .withdraw_asset() .clear_origin() .buy_execution() - .deposit_asset_v3() + .deposit_asset() .as_v3(); const chargedWeight = await weightMessage( diff --git a/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-asset-transfer-6.ts b/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-asset-transfer-6.ts index 39b8c4a1e7..1b37282fc1 100644 --- a/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-asset-transfer-6.ts +++ b/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-asset-transfer-6.ts @@ -113,7 +113,7 @@ describeSuite({ .reserve_asset_deposited() .clear_origin() .buy_execution(1) // buy execution with asset at index 1 - .deposit_asset_v3(2n) + .deposit_asset(2n) .as_v3(); // Send an XCM and create block to execute it diff --git a/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-asset-transfer-8.ts b/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-asset-transfer-8.ts index 9237ccf4b0..b4e8044a6c 100644 --- a/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-asset-transfer-8.ts +++ b/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-asset-transfer-8.ts @@ -75,7 +75,7 @@ describeSuite({ .reserve_asset_deposited() .clear_origin() .buy_execution() - .deposit_asset_v3(2n) + .deposit_asset(2n) .as_v3(); // Send an XCM and create block to execute it diff --git a/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-transact-ethereum-3.ts b/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-transact-ethereum-3.ts index a38d9af295..127427c8ff 100644 --- a/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-transact-ethereum-3.ts +++ b/test/suites/dev/moonbase/test-xcm-v3/test-mock-hrmp-transact-ethereum-3.ts @@ -100,7 +100,7 @@ describeSuite({ .reserve_asset_deposited() .clear_origin() .buy_execution() - .deposit_asset_v3() + .deposit_asset() .as_v3() ) as any ); @@ -114,7 +114,7 @@ describeSuite({ .reserve_asset_deposited() .clear_origin() .buy_execution() - .deposit_asset_v3() + .deposit_asset() .as_v3(); // Send an XCM and create block to execute it diff --git a/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-excess-gas.ts b/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-excess-gas.ts index d6a90f26ba..e4388694a4 100644 --- a/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-excess-gas.ts +++ b/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-excess-gas.ts @@ -159,7 +159,7 @@ describeSuite({ .withdraw_asset() .clear_origin() .buy_execution() - .deposit_asset_v3(2n) + .deposit_asset(2n) .as_v3(); // Mock the reception of the xcm message @@ -258,7 +258,7 @@ describeSuite({ .withdraw_asset() .clear_origin() .buy_execution() - .deposit_asset_v3(2n) + .deposit_asset(2n) .as_v3(); // Mock the reception of the xcm message diff --git a/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-fees-and-trap.ts b/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-fees-and-trap.ts index 5a00530fe5..6f28ee4a71 100644 --- a/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-fees-and-trap.ts +++ b/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-fees-and-trap.ts @@ -99,7 +99,7 @@ describeSuite({ .withdraw_asset() .clear_origin() .buy_execution() - .deposit_asset_v3(2n) + .deposit_asset(2n) .as_v3(); // Mock the reception of the xcm message @@ -254,7 +254,7 @@ describeSuite({ const xcmMessageToClaimAssets = new XcmFragment(claimConfig) .claim_asset() .buy_execution() - .deposit_asset_v3() + .deposit_asset() .as_v3(); const balanceBefore = ( @@ -325,7 +325,7 @@ describeSuite({ const xcmMessageFailedClaim = new XcmFragment(failedClaimConfig) .claim_asset() .buy_execution() - .deposit_asset_v3() + .deposit_asset() .as_v3(); await injectHrmpMessageAndSeal(context, paraId, { diff --git a/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-v3-filter.ts b/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-v3-filter.ts index 17211a89ff..fa8044b538 100644 --- a/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-v3-filter.ts +++ b/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-v3-filter.ts @@ -117,7 +117,7 @@ describeSuite({ .withdraw_asset() .clear_origin() .buy_execution() - .deposit_asset_v3(limit) + .deposit_asset(limit) .as_v3(), }); diff --git a/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-v3.ts b/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-v3.ts index 39f0c38ba4..0216d584c4 100644 --- a/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-v3.ts +++ b/test/suites/dev/moonbase/test-xcm-v3/test-xcm-erc20-v3.ts @@ -112,7 +112,7 @@ describeSuite({ .withdraw_asset() .clear_origin() .buy_execution() - .deposit_asset_v3(2n) + .deposit_asset(2n) .as_v3(); // Mock the reception of the xcm message diff --git a/test/suites/dev/moonbase/test-xcm-v4/test-auto-pause-xcm.ts b/test/suites/dev/moonbase/test-xcm-v4/test-auto-pause-xcm.ts index 01f7e91dd5..aabf3de376 100644 --- a/test/suites/dev/moonbase/test-xcm-v4/test-auto-pause-xcm.ts +++ b/test/suites/dev/moonbase/test-xcm-v4/test-auto-pause-xcm.ts @@ -70,7 +70,7 @@ describeSuite({ .withdraw_asset() .clear_origin() .buy_execution() - .deposit_asset_v3() + .deposit_asset() .as_v4(); // Inject an XCM message that should be included in the next block but not executed diff --git a/test/suites/dev/moonbase/test-xcm-v4/test-mock-dmp-error-and-appendix-1.ts b/test/suites/dev/moonbase/test-xcm-v4/test-mock-dmp-error-and-appendix-1.ts index 9bfa872c7d..ce64448708 100644 --- a/test/suites/dev/moonbase/test-xcm-v4/test-mock-dmp-error-and-appendix-1.ts +++ b/test/suites/dev/moonbase/test-xcm-v4/test-mock-dmp-error-and-appendix-1.ts @@ -56,7 +56,7 @@ describeSuite({ // But since there is no error, and the deposit is on the error handler, the assets // will be trapped .with(function () { - return this.set_error_handler_with([this.deposit_asset_v3]); + return this.set_error_handler_with([this.deposit_asset]); }) .clear_origin() .as_v4(); diff --git a/test/suites/dev/moonbase/test-xcm-v4/test-mock-dmp-error-and-appendix-2.ts b/test/suites/dev/moonbase/test-xcm-v4/test-mock-dmp-error-and-appendix-2.ts index 49dfaa9c1b..e349699655 100644 --- a/test/suites/dev/moonbase/test-xcm-v4/test-mock-dmp-error-and-appendix-2.ts +++ b/test/suites/dev/moonbase/test-xcm-v4/test-mock-dmp-error-and-appendix-2.ts @@ -55,7 +55,7 @@ describeSuite({ // BuyExecution does not charge for fees because we registered it for not doing so // As a consequence the trapped assets will be entirely credited .with(function () { - return this.set_error_handler_with([this.deposit_asset_v3]); + return this.set_error_handler_with([this.deposit_asset]); }) .trap() .as_v4(); diff --git a/test/suites/dev/moonbase/test-xcm-v4/test-mock-dmp-error-and-appendix-3.ts b/test/suites/dev/moonbase/test-xcm-v4/test-mock-dmp-error-and-appendix-3.ts index 9a20c56bae..7f8ada7936 100644 --- a/test/suites/dev/moonbase/test-xcm-v4/test-mock-dmp-error-and-appendix-3.ts +++ b/test/suites/dev/moonbase/test-xcm-v4/test-mock-dmp-error-and-appendix-3.ts @@ -54,7 +54,7 @@ describeSuite({ .buy_execution() // Set an appendix to be executed after the XCM message is executed. No matter if errors .with(function () { - return this.set_appendix_with([this.deposit_asset_v3]); + return this.set_appendix_with([this.deposit_asset]); }) .as_v4(); diff --git a/test/suites/dev/moonbase/test-xcm-v4/test-mock-dmp-error-and-appendix-4.ts b/test/suites/dev/moonbase/test-xcm-v4/test-mock-dmp-error-and-appendix-4.ts index 3e2d85e715..e362488776 100644 --- a/test/suites/dev/moonbase/test-xcm-v4/test-mock-dmp-error-and-appendix-4.ts +++ b/test/suites/dev/moonbase/test-xcm-v4/test-mock-dmp-error-and-appendix-4.ts @@ -56,7 +56,7 @@ describeSuite({ // As a consequence the trapped assets will be entirely credited // The goal is to show appendix runs even if there is an error .with(function () { - return this.set_appendix_with([this.deposit_asset_v3]); + return this.set_appendix_with([this.deposit_asset]); }) .trap() .as_v4(); diff --git a/test/suites/dev/moonbase/test-xcm-v4/test-mock-dmp-error-and-appendix-5.ts b/test/suites/dev/moonbase/test-xcm-v4/test-mock-dmp-error-and-appendix-5.ts index b4226c91d1..a9fc58affd 100644 --- a/test/suites/dev/moonbase/test-xcm-v4/test-mock-dmp-error-and-appendix-5.ts +++ b/test/suites/dev/moonbase/test-xcm-v4/test-mock-dmp-error-and-appendix-5.ts @@ -56,7 +56,7 @@ describeSuite({ // As a consequence the trapped assets will be entirely credited // The goal is to show appendix runs even if there is an error .with(function () { - return this.set_appendix_with([this.deposit_asset_v3]); + return this.set_appendix_with([this.deposit_asset]); }) .trap() .as_v4(); diff --git a/test/suites/dev/moonbase/test-xcm-v4/test-mock-dmp-error-and-appendix-6.ts b/test/suites/dev/moonbase/test-xcm-v4/test-mock-dmp-error-and-appendix-6.ts index a51072047e..5e3d110f18 100644 --- a/test/suites/dev/moonbase/test-xcm-v4/test-mock-dmp-error-and-appendix-6.ts +++ b/test/suites/dev/moonbase/test-xcm-v4/test-mock-dmp-error-and-appendix-6.ts @@ -98,7 +98,7 @@ describeSuite({ .claim_asset() .buy_execution() // Deposit assets, this time correctly, on Alith - .deposit_asset_v3() + .deposit_asset() .as_v4(); const receivedMessage: XcmVersionedXcm = context diff --git a/test/suites/dev/moonbase/test-xcm-v4/test-mock-hrmp-asset-transfer-1.ts b/test/suites/dev/moonbase/test-xcm-v4/test-mock-hrmp-asset-transfer-1.ts index 9d517c416d..88b9c24c3d 100644 --- a/test/suites/dev/moonbase/test-xcm-v4/test-mock-hrmp-asset-transfer-1.ts +++ b/test/suites/dev/moonbase/test-xcm-v4/test-mock-hrmp-asset-transfer-1.ts @@ -78,7 +78,7 @@ describeSuite({ .reserve_asset_deposited() .clear_origin() .buy_execution() - .deposit_asset_v3() + .deposit_asset() .as_v4(); // Send an XCM and create block to execute it diff --git a/test/suites/dev/moonbase/test-xcm-v4/test-mock-hrmp-asset-transfer-2.ts b/test/suites/dev/moonbase/test-xcm-v4/test-mock-hrmp-asset-transfer-2.ts index 974b672de2..acfb6a3b16 100644 --- a/test/suites/dev/moonbase/test-xcm-v4/test-mock-hrmp-asset-transfer-2.ts +++ b/test/suites/dev/moonbase/test-xcm-v4/test-mock-hrmp-asset-transfer-2.ts @@ -89,7 +89,7 @@ describeSuite({ .reserve_asset_deposited() .clear_origin() .buy_execution() - .deposit_asset_v3() + .deposit_asset() .as_v4(); // Send an XCM and create block to execute it diff --git a/test/suites/dev/moonbase/test-xcm-v4/test-mock-hrmp-asset-transfer-3.ts b/test/suites/dev/moonbase/test-xcm-v4/test-mock-hrmp-asset-transfer-3.ts index 93cdb6d7b9..4866f4789b 100644 --- a/test/suites/dev/moonbase/test-xcm-v4/test-mock-hrmp-asset-transfer-3.ts +++ b/test/suites/dev/moonbase/test-xcm-v4/test-mock-hrmp-asset-transfer-3.ts @@ -73,7 +73,7 @@ describeSuite({ .withdraw_asset() .clear_origin() .buy_execution() - .deposit_asset_v3() + .deposit_asset() .as_v4(); // Send an XCM and create block to execute it diff --git a/test/suites/dev/moonbase/test-xcm-v4/test-mock-hrmp-asset-transfer-4.ts b/test/suites/dev/moonbase/test-xcm-v4/test-mock-hrmp-asset-transfer-4.ts index 666dc42cb3..34f4935188 100644 --- a/test/suites/dev/moonbase/test-xcm-v4/test-mock-hrmp-asset-transfer-4.ts +++ b/test/suites/dev/moonbase/test-xcm-v4/test-mock-hrmp-asset-transfer-4.ts @@ -72,7 +72,7 @@ describeSuite({ .withdraw_asset() .clear_origin() .buy_execution() - .deposit_asset_v3() + .deposit_asset() .as_v4(); const chargedWeight = await weightMessage( diff --git a/test/suites/dev/moonbase/test-xcm-v4/test-mock-hrmp-asset-transfer-5.ts b/test/suites/dev/moonbase/test-xcm-v4/test-mock-hrmp-asset-transfer-5.ts index c9de65529d..83709e4d71 100644 --- a/test/suites/dev/moonbase/test-xcm-v4/test-mock-hrmp-asset-transfer-5.ts +++ b/test/suites/dev/moonbase/test-xcm-v4/test-mock-hrmp-asset-transfer-5.ts @@ -113,7 +113,7 @@ describeSuite({ .reserve_asset_deposited() .clear_origin() .buy_execution(1) // buy execution with asset at index 1 - .deposit_asset_v3(2n) + .deposit_asset(2n) .as_v4(); // Send an XCM and create block to execute it diff --git a/test/suites/dev/moonbase/test-xcm-v4/test-mock-hrmp-asset-transfer-6.ts b/test/suites/dev/moonbase/test-xcm-v4/test-mock-hrmp-asset-transfer-6.ts index 6746e4a1ce..f656fa6774 100644 --- a/test/suites/dev/moonbase/test-xcm-v4/test-mock-hrmp-asset-transfer-6.ts +++ b/test/suites/dev/moonbase/test-xcm-v4/test-mock-hrmp-asset-transfer-6.ts @@ -75,7 +75,7 @@ describeSuite({ .reserve_asset_deposited() .clear_origin() .buy_execution() - .deposit_asset_v3(2n) + .deposit_asset(2n) .as_v4(); // Send an XCM and create block to execute it diff --git a/test/suites/dev/moonbase/test-xcm-v4/test-xcm-dry-run-api.ts b/test/suites/dev/moonbase/test-xcm-v4/test-xcm-dry-run-api.ts index 5454bc1b33..382478467d 100644 --- a/test/suites/dev/moonbase/test-xcm-v4/test-xcm-dry-run-api.ts +++ b/test/suites/dev/moonbase/test-xcm-v4/test-xcm-dry-run-api.ts @@ -189,7 +189,7 @@ describeSuite({ .reserve_asset_deposited() .clear_origin() .buy_execution() - .deposit_asset_v3() + .deposit_asset() .as_v3(); const dryRunXcm = await polkadotJs.call.dryRunApi.dryRunXcm( diff --git a/test/suites/dev/moonbase/test-xcm-v4/test-xcm-erc20-transfer-two-ERC20.ts b/test/suites/dev/moonbase/test-xcm-v4/test-xcm-erc20-transfer-two-ERC20.ts index 047bf9a9b0..42c7987a90 100644 --- a/test/suites/dev/moonbase/test-xcm-v4/test-xcm-erc20-transfer-two-ERC20.ts +++ b/test/suites/dev/moonbase/test-xcm-v4/test-xcm-erc20-transfer-two-ERC20.ts @@ -238,7 +238,7 @@ describeSuite({ .withdraw_asset() .clear_origin() .buy_execution() - .deposit_asset_v3(3n) + .deposit_asset(3n) .as_v4(); // Mock the reception of the xcm message diff --git a/test/suites/dev/moonbase/test-xcm-v4/test-xcm-erc20-transfer.ts b/test/suites/dev/moonbase/test-xcm-v4/test-xcm-erc20-transfer.ts index 0f5c991adb..aee5ee56af 100644 --- a/test/suites/dev/moonbase/test-xcm-v4/test-xcm-erc20-transfer.ts +++ b/test/suites/dev/moonbase/test-xcm-v4/test-xcm-erc20-transfer.ts @@ -173,7 +173,7 @@ describeSuite({ .withdraw_asset() .clear_origin() .buy_execution() - .deposit_asset_v3(2n) + .deposit_asset(2n) .as_v4(); // Mock the reception of the xcm message diff --git a/test/suites/dev/moonbase/test-xcm-v4/test-xcm-ver-conversion-1.ts b/test/suites/dev/moonbase/test-xcm-v4/test-xcm-ver-conversion-1.ts index a80f32418e..39b32d18c3 100644 --- a/test/suites/dev/moonbase/test-xcm-v4/test-xcm-ver-conversion-1.ts +++ b/test/suites/dev/moonbase/test-xcm-v4/test-xcm-ver-conversion-1.ts @@ -68,7 +68,7 @@ describeSuite({ .withdraw_asset() .clear_origin() .buy_execution() - .deposit_asset_v3() + .deposit_asset() .as_v4(); const chargedWeight = await weightMessage( diff --git a/test/suites/dev/moonbase/test-xcm-v4/test-xcm-ver-conversion-2.ts b/test/suites/dev/moonbase/test-xcm-v4/test-xcm-ver-conversion-2.ts index fb6e840d11..faa32fe829 100644 --- a/test/suites/dev/moonbase/test-xcm-v4/test-xcm-ver-conversion-2.ts +++ b/test/suites/dev/moonbase/test-xcm-v4/test-xcm-ver-conversion-2.ts @@ -68,7 +68,7 @@ describeSuite({ .withdraw_asset() .clear_origin() .buy_execution() - .deposit_asset_v3() + .deposit_asset() .as_v4(); const chargedWeight = await weightMessage( diff --git a/test/suites/tracing-tests/test-trace-erc20-xcm.ts b/test/suites/tracing-tests/test-trace-erc20-xcm.ts index c6873ef55e..a7a9c8427e 100644 --- a/test/suites/tracing-tests/test-trace-erc20-xcm.ts +++ b/test/suites/tracing-tests/test-trace-erc20-xcm.ts @@ -103,7 +103,7 @@ describeSuite({ .withdraw_asset() .clear_origin() .buy_execution() - .deposit_asset_v3(2n) + .deposit_asset(2n) .as_v3(); // Mock the reception of the xcm message From bbe2685836ce59ff92d819503662d5920dfab79b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?pablito=20=E3=83=86?= Date: Fri, 17 Jan 2025 12:14:36 -0300 Subject: [PATCH 04/10] remove khala & polkadet paras (#3137) --- test/helpers/foreign-chains.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/test/helpers/foreign-chains.ts b/test/helpers/foreign-chains.ts index 1236d53316..851fa6b093 100644 --- a/test/helpers/foreign-chains.ts +++ b/test/helpers/foreign-chains.ts @@ -77,10 +77,6 @@ export const ForeignChainsEndpoints = [ name: "Bifrost", paraId: 2001, }, - { - name: "Khala", - paraId: 2004, - }, { name: "Shiden", paraId: 2007, @@ -192,10 +188,6 @@ export const ForeignChainsEndpoints = [ name: "Unique", paraId: 2037, }, - { - name: "Polkadex", - paraId: 2040, - }, { name: "OriginTrail", paraId: 2043, From e167a3a15a33a47954566b057e48c0514ef3f3fd Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas <22591718+RomarQ@users.noreply.github.com> Date: Fri, 17 Jan 2025 16:14:05 +0000 Subject: [PATCH 05/10] Fix treasury spend origin (#3130) * add root as spend origin * test: add rust tests * update spender origin * test: add rust tests * fix rust code formatting * add treasury council test * improve test title * remove Treasury calls from NormalFilter and update tests * update typescript tests --- runtime/moonbase/src/lib.rs | 16 +- runtime/moonbase/tests/integration_test.rs | 172 +++++++++++++++++- runtime/moonbeam/src/lib.rs | 16 +- runtime/moonbeam/tests/integration_test.rs | 106 ++++++++++- runtime/moonriver/src/lib.rs | 16 +- runtime/moonriver/tests/integration_test.rs | 107 ++++++++++- .../test-treasury-council-origin.ts | 108 +++++++++++ .../test-treasury/test-treasury-pallet.ts | 51 ------ .../test-treasury-root-origin.ts | 72 ++++++++ 9 files changed, 570 insertions(+), 94 deletions(-) create mode 100644 test/suites/dev/moonbase/test-treasury/test-treasury-council-origin.ts delete mode 100644 test/suites/dev/moonbase/test-treasury/test-treasury-pallet.ts create mode 100644 test/suites/dev/moonbase/test-treasury/test-treasury-root-origin.ts diff --git a/runtime/moonbase/src/lib.rs b/runtime/moonbase/src/lib.rs index ab9a1db6c8..9774af7bca 100644 --- a/runtime/moonbase/src/lib.rs +++ b/runtime/moonbase/src/lib.rs @@ -558,9 +558,10 @@ parameter_types! { pub const ProposalBond: Permill = Permill::from_percent(5); pub const TreasuryId: PalletId = PalletId(*b"pc/trsry"); pub TreasuryAccount: AccountId = Treasury::account_id(); + pub const MaxSpendBalance: crate::Balance = crate::Balance::max_value(); } -type TreasuryRejectOrigin = EitherOfDiverse< +type RootOrTreasuryCouncilOrigin = EitherOfDiverse< EnsureRoot, pallet_collective::EnsureProportionMoreThan, >; @@ -569,7 +570,7 @@ impl pallet_treasury::Config for Runtime { type PalletId = TreasuryId; type Currency = Balances; // More than half of the council is required (or root) to reject a proposal - type RejectOrigin = TreasuryRejectOrigin; + type RejectOrigin = RootOrTreasuryCouncilOrigin; type RuntimeEvent = RuntimeEvent; type SpendPeriod = ConstU32<{ 6 * DAYS }>; type Burn = (); @@ -577,11 +578,8 @@ impl pallet_treasury::Config for Runtime { type MaxApprovals = ConstU32<100>; type WeightInfo = moonbase_weights::pallet_treasury::WeightInfo; type SpendFunds = (); - #[cfg(not(feature = "runtime-benchmarks"))] - type SpendOrigin = frame_support::traits::NeverEnsureOrigin; // Disabled, no spending - #[cfg(feature = "runtime-benchmarks")] type SpendOrigin = - frame_system::EnsureWithSuccess, AccountId, benches::MaxBalance>; + frame_system::EnsureWithSuccess; type AssetKind = (); type Beneficiary = AccountId; type BeneficiaryLookup = IdentityLookup; @@ -1190,12 +1188,6 @@ impl Contains for NormalFilter { // Note: It is also assumed that EVM calls are only allowed through `Origin::Root` so // this can be seen as an additional security RuntimeCall::EVM(_) => false, - RuntimeCall::Treasury( - pallet_treasury::Call::spend { .. } - | pallet_treasury::Call::payout { .. } - | pallet_treasury::Call::check_status { .. } - | pallet_treasury::Call::void_spend { .. }, - ) => false, _ => true, } } diff --git a/runtime/moonbase/tests/integration_test.rs b/runtime/moonbase/tests/integration_test.rs index 20f1200381..b7f6e3fb16 100644 --- a/runtime/moonbase/tests/integration_test.rs +++ b/runtime/moonbase/tests/integration_test.rs @@ -30,8 +30,8 @@ use frame_support::{ assert_noop, assert_ok, dispatch::DispatchClass, traits::{ - fungible::Inspect, Currency as CurrencyT, EnsureOrigin, PalletInfo, StorageInfo, - StorageInfoTrait, + fungible::Inspect, Currency as CurrencyT, EnsureOrigin, OnInitialize, PalletInfo, + StorageInfo, StorageInfoTrait, }, weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight}, StorageHasher, Twox128, @@ -56,6 +56,7 @@ use moonbase_runtime::{ System, TransactionPayment, TransactionPaymentAsGasPrice, + Treasury, TreasuryCouncilCollective, XcmTransactor, FOREIGN_ASSET_PRECOMPILE_ADDRESS_PREFIX, @@ -2973,6 +2974,173 @@ fn validate_transaction_fails_on_filtered_call() { }); } +#[cfg(test)] +mod treasury_tests { + use super::*; + use sp_runtime::traits::Hash; + + fn expect_events(events: Vec) { + let block_events: Vec = + System::events().into_iter().map(|r| r.event).collect(); + + dbg!(events.clone()); + dbg!(block_events.clone()); + + assert!(events.iter().all(|evt| block_events.contains(evt))) + } + + fn next_block() { + System::reset_events(); + System::set_block_number(System::block_number() + 1u32); + System::on_initialize(System::block_number()); + Treasury::on_initialize(System::block_number()); + } + + #[test] + fn test_treasury_spend_local_with_root_origin() { + let initial_treasury_balance = 1_000 * UNIT; + ExtBuilder::default() + .with_balances(vec![ + (AccountId::from(ALICE), 2_000 * UNIT), + (Treasury::account_id(), initial_treasury_balance), + ]) + .build() + .execute_with(|| { + let spend_amount = 100u128 * UNIT; + let spend_beneficiary = AccountId::from(BOB); + + next_block(); + + // Perform treasury spending + + assert_ok!(moonbase_runtime::Sudo::sudo( + root_origin(), + Box::new(RuntimeCall::Treasury(pallet_treasury::Call::spend { + amount: spend_amount, + asset_kind: Box::new(()), + beneficiary: Box::new(AccountId::from(BOB)), + valid_from: Some(5u32), + })) + )); + + let payout_period = + <::PayoutPeriod as Get>::get(); + let expected_events = [RuntimeEvent::Treasury( + pallet_treasury::Event::AssetSpendApproved { + index: 0, + asset_kind: (), + amount: spend_amount, + beneficiary: spend_beneficiary, + valid_from: 5u32, + expire_at: payout_period + 5u32, + }, + )] + .to_vec(); + expect_events(expected_events); + + while System::block_number() < 5u32 { + next_block(); + } + + assert_ok!(Treasury::payout(origin_of(spend_beneficiary), 0)); + + let expected_events = [ + RuntimeEvent::Treasury(pallet_treasury::Event::Paid { + index: 0, + payment_id: (), + }), + RuntimeEvent::Balances(pallet_balances::Event::Transfer { + from: Treasury::account_id(), + to: spend_beneficiary, + amount: spend_amount, + }), + ] + .to_vec(); + expect_events(expected_events); + }); + } + + #[test] + fn test_treasury_spend_local_with_council_origin() { + let initial_treasury_balance = 1_000 * UNIT; + ExtBuilder::default() + .with_balances(vec![ + (AccountId::from(ALICE), 2_000 * UNIT), + (Treasury::account_id(), initial_treasury_balance), + ]) + .build() + .execute_with(|| { + let spend_amount = 100u128 * UNIT; + let spend_beneficiary = AccountId::from(BOB); + + next_block(); + + // TreasuryCouncilCollective + assert_ok!(TreasuryCouncilCollective::set_members( + root_origin(), + vec![AccountId::from(ALICE)], + Some(AccountId::from(ALICE)), + 1 + )); + + next_block(); + + // Perform treasury spending + let proposal = RuntimeCall::Treasury(pallet_treasury::Call::spend { + amount: spend_amount, + asset_kind: Box::new(()), + beneficiary: Box::new(AccountId::from(BOB)), + valid_from: Some(5u32), + }); + assert_ok!(TreasuryCouncilCollective::propose( + origin_of(AccountId::from(ALICE)), + 1, + Box::new(proposal.clone()), + 1_000 + )); + + let payout_period = + <::PayoutPeriod as Get>::get(); + let expected_events = [ + RuntimeEvent::Treasury(pallet_treasury::Event::AssetSpendApproved { + index: 0, + asset_kind: (), + amount: spend_amount, + beneficiary: spend_beneficiary, + valid_from: 5u32, + expire_at: payout_period + 5u32, + }), + RuntimeEvent::TreasuryCouncilCollective(pallet_collective::Event::Executed { + proposal_hash: sp_runtime::traits::BlakeTwo256::hash_of(&proposal), + result: Ok(()), + }), + ] + .to_vec(); + expect_events(expected_events); + + while System::block_number() < 5u32 { + next_block(); + } + + assert_ok!(Treasury::payout(origin_of(spend_beneficiary), 0)); + + let expected_events = [ + RuntimeEvent::Treasury(pallet_treasury::Event::Paid { + index: 0, + payment_id: (), + }), + RuntimeEvent::Balances(pallet_balances::Event::Transfer { + from: Treasury::account_id(), + to: spend_beneficiary, + amount: spend_amount, + }), + ] + .to_vec(); + expect_events(expected_events); + }); + } +} + #[cfg(test)] mod fee_tests { use super::*; diff --git a/runtime/moonbeam/src/lib.rs b/runtime/moonbeam/src/lib.rs index 74be2eeeec..a4892e32d0 100644 --- a/runtime/moonbeam/src/lib.rs +++ b/runtime/moonbeam/src/lib.rs @@ -546,9 +546,10 @@ parameter_types! { pub const ProposalBond: Permill = Permill::from_percent(5); pub const TreasuryId: PalletId = PalletId(*b"py/trsry"); pub TreasuryAccount: AccountId = Treasury::account_id(); + pub const MaxSpendBalance: crate::Balance = crate::Balance::max_value(); } -type TreasuryRejectOrigin = EitherOfDiverse< +type RootOrTreasuryCouncilOrigin = EitherOfDiverse< EnsureRoot, pallet_collective::EnsureProportionMoreThan, >; @@ -557,7 +558,7 @@ impl pallet_treasury::Config for Runtime { type PalletId = TreasuryId; type Currency = Balances; // More than half of the council is required (or root) to reject a proposal - type RejectOrigin = TreasuryRejectOrigin; + type RejectOrigin = RootOrTreasuryCouncilOrigin; type RuntimeEvent = RuntimeEvent; type SpendPeriod = ConstU32<{ 6 * DAYS }>; type Burn = (); @@ -565,11 +566,8 @@ impl pallet_treasury::Config for Runtime { type MaxApprovals = ConstU32<100>; type WeightInfo = moonbeam_weights::pallet_treasury::WeightInfo; type SpendFunds = (); - #[cfg(not(feature = "runtime-benchmarks"))] - type SpendOrigin = frame_support::traits::NeverEnsureOrigin; // Disabled, no spending - #[cfg(feature = "runtime-benchmarks")] type SpendOrigin = - frame_system::EnsureWithSuccess, AccountId, benches::MaxBalance>; + frame_system::EnsureWithSuccess; type AssetKind = (); type Beneficiary = AccountId; type BeneficiaryLookup = IdentityLookup; @@ -1193,12 +1191,6 @@ impl Contains for NormalFilter { // Note: It is also assumed that EVM calls are only allowed through `Origin::Root` so // this can be seen as an additional security RuntimeCall::EVM(_) => false, - RuntimeCall::Treasury( - pallet_treasury::Call::spend { .. } - | pallet_treasury::Call::payout { .. } - | pallet_treasury::Call::check_status { .. } - | pallet_treasury::Call::void_spend { .. }, - ) => false, _ => true, } } diff --git a/runtime/moonbeam/tests/integration_test.rs b/runtime/moonbeam/tests/integration_test.rs index 1e9bc5c73a..d910eb50ea 100644 --- a/runtime/moonbeam/tests/integration_test.rs +++ b/runtime/moonbeam/tests/integration_test.rs @@ -26,8 +26,8 @@ use frame_support::{ assert_noop, assert_ok, dispatch::DispatchClass, traits::{ - fungible::Inspect, Currency as CurrencyT, EnsureOrigin, PalletInfo, StorageInfo, - StorageInfoTrait, + fungible::Inspect, Currency as CurrencyT, EnsureOrigin, OnInitialize, PalletInfo, + StorageInfo, StorageInfoTrait, }, weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight}, StorageHasher, Twox128, @@ -40,7 +40,7 @@ use moonbeam_runtime::{ xcm_config::{CurrencyId, SelfReserve}, AccountId, Balances, CrowdloanRewards, Executive, OpenTechCommitteeCollective, ParachainStaking, PolkadotXcm, Precompiles, Runtime, RuntimeBlockWeights, RuntimeCall, - RuntimeEvent, System, TransactionPayment, TransactionPaymentAsGasPrice, + RuntimeEvent, System, TransactionPayment, TransactionPaymentAsGasPrice, Treasury, TreasuryCouncilCollective, XcmTransactor, FOREIGN_ASSET_PRECOMPILE_ADDRESS_PREFIX, WEEKS, }; use moonbeam_xcm_benchmarks::weights::XcmWeight; @@ -2765,6 +2765,106 @@ fn evm_success_keeps_substrate_events() { }); } +#[cfg(test)] +mod treasury_tests { + use super::*; + use sp_runtime::traits::Hash; + + fn expect_events(events: Vec) { + let block_events: Vec = + System::events().into_iter().map(|r| r.event).collect(); + + assert!(events.iter().all(|evt| block_events.contains(evt))) + } + + fn next_block() { + System::reset_events(); + System::set_block_number(System::block_number() + 1u32); + System::on_initialize(System::block_number()); + Treasury::on_initialize(System::block_number()); + } + + #[test] + fn test_treasury_spend_local_with_council_origin() { + let initial_treasury_balance = 1_000 * GLMR; + ExtBuilder::default() + .with_balances(vec![ + (AccountId::from(ALICE), 2_000 * GLMR), + (Treasury::account_id(), initial_treasury_balance), + ]) + .build() + .execute_with(|| { + let spend_amount = 100u128 * GLMR; + let spend_beneficiary = AccountId::from(BOB); + + next_block(); + + // TreasuryCouncilCollective + assert_ok!(TreasuryCouncilCollective::set_members( + root_origin(), + vec![AccountId::from(ALICE)], + Some(AccountId::from(ALICE)), + 1 + )); + + next_block(); + + // Perform treasury spending + let proposal = RuntimeCall::Treasury(pallet_treasury::Call::spend { + amount: spend_amount, + asset_kind: Box::new(()), + beneficiary: Box::new(AccountId::from(BOB)), + valid_from: Some(5u32), + }); + assert_ok!(TreasuryCouncilCollective::propose( + origin_of(AccountId::from(ALICE)), + 1, + Box::new(proposal.clone()), + 1_000 + )); + + let payout_period = + <::PayoutPeriod as Get>::get(); + let expected_events = [ + RuntimeEvent::Treasury(pallet_treasury::Event::AssetSpendApproved { + index: 0, + asset_kind: (), + amount: spend_amount, + beneficiary: spend_beneficiary, + valid_from: 5u32, + expire_at: payout_period + 5u32, + }), + RuntimeEvent::TreasuryCouncilCollective(pallet_collective::Event::Executed { + proposal_hash: sp_runtime::traits::BlakeTwo256::hash_of(&proposal), + result: Ok(()), + }), + ] + .to_vec(); + expect_events(expected_events); + + while System::block_number() < 5u32 { + next_block(); + } + + assert_ok!(Treasury::payout(origin_of(spend_beneficiary), 0)); + + let expected_events = [ + RuntimeEvent::Treasury(pallet_treasury::Event::Paid { + index: 0, + payment_id: (), + }), + RuntimeEvent::Balances(pallet_balances::Event::Transfer { + from: Treasury::account_id(), + to: spend_beneficiary, + amount: spend_amount, + }), + ] + .to_vec(); + expect_events(expected_events); + }); + } +} + #[cfg(test)] mod fee_tests { use super::*; diff --git a/runtime/moonriver/src/lib.rs b/runtime/moonriver/src/lib.rs index f0e5062258..3c30809b75 100644 --- a/runtime/moonriver/src/lib.rs +++ b/runtime/moonriver/src/lib.rs @@ -551,9 +551,10 @@ parameter_types! { pub const ProposalBond: Permill = Permill::from_percent(5); pub const TreasuryId: PalletId = PalletId(*b"py/trsry"); pub TreasuryAccount: AccountId = Treasury::account_id(); + pub const MaxSpendBalance: crate::Balance = crate::Balance::max_value(); } -type TreasuryRejectOrigin = EitherOfDiverse< +type RootOrTreasuryCouncilOrigin = EitherOfDiverse< EnsureRoot, pallet_collective::EnsureProportionMoreThan, >; @@ -562,7 +563,7 @@ impl pallet_treasury::Config for Runtime { type PalletId = TreasuryId; type Currency = Balances; // More than half of the council is required (or root) to reject a proposal - type RejectOrigin = TreasuryRejectOrigin; + type RejectOrigin = RootOrTreasuryCouncilOrigin; type RuntimeEvent = RuntimeEvent; type SpendPeriod = ConstU32<{ 6 * DAYS }>; type Burn = (); @@ -570,11 +571,8 @@ impl pallet_treasury::Config for Runtime { type MaxApprovals = ConstU32<100>; type WeightInfo = moonriver_weights::pallet_treasury::WeightInfo; type SpendFunds = (); - #[cfg(not(feature = "runtime-benchmarks"))] - type SpendOrigin = frame_support::traits::NeverEnsureOrigin; // Disabled, no spending - #[cfg(feature = "runtime-benchmarks")] type SpendOrigin = - frame_system::EnsureWithSuccess, AccountId, benches::MaxBalance>; + frame_system::EnsureWithSuccess; type AssetKind = (); type Beneficiary = AccountId; type BeneficiaryLookup = IdentityLookup; @@ -1201,12 +1199,6 @@ impl Contains for NormalFilter { // Note: It is also assumed that EVM calls are only allowed through `Origin::Root` so // this can be seen as an additional security RuntimeCall::EVM(_) => false, - RuntimeCall::Treasury( - pallet_treasury::Call::spend { .. } - | pallet_treasury::Call::payout { .. } - | pallet_treasury::Call::check_status { .. } - | pallet_treasury::Call::void_spend { .. }, - ) => false, _ => true, } } diff --git a/runtime/moonriver/tests/integration_test.rs b/runtime/moonriver/tests/integration_test.rs index 0109796f46..26a1cd61f6 100644 --- a/runtime/moonriver/tests/integration_test.rs +++ b/runtime/moonriver/tests/integration_test.rs @@ -26,7 +26,10 @@ use frame_support::traits::fungible::Inspect; use frame_support::{ assert_noop, assert_ok, dispatch::DispatchClass, - traits::{Currency as CurrencyT, EnsureOrigin, PalletInfo, StorageInfo, StorageInfoTrait}, + traits::{ + Currency as CurrencyT, EnsureOrigin, OnInitialize, PalletInfo, StorageInfo, + StorageInfoTrait, + }, weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight}, StorageHasher, Twox128, }; @@ -38,7 +41,7 @@ use moonriver_runtime::{ asset_config::ForeignAssetInstance, xcm_config::{CurrencyId, SelfReserve}, AssetId, Balances, CrowdloanRewards, Executive, OpenTechCommitteeCollective, PolkadotXcm, - Precompiles, RuntimeBlockWeights, TransactionPayment, TransactionPaymentAsGasPrice, + Precompiles, RuntimeBlockWeights, TransactionPayment, TransactionPaymentAsGasPrice, Treasury, TreasuryCouncilCollective, XcmTransactor, FOREIGN_ASSET_PRECOMPILE_ADDRESS_PREFIX, WEEKS, }; use nimbus_primitives::NimbusId; @@ -2663,6 +2666,106 @@ fn evm_success_keeps_substrate_events() { }); } +#[cfg(test)] +mod treasury_tests { + use super::*; + use sp_runtime::traits::Hash; + + fn expect_events(events: Vec) { + let block_events: Vec = + System::events().into_iter().map(|r| r.event).collect(); + + assert!(events.iter().all(|evt| block_events.contains(evt))) + } + + fn next_block() { + System::reset_events(); + System::set_block_number(System::block_number() + 1u32); + System::on_initialize(System::block_number()); + Treasury::on_initialize(System::block_number()); + } + + #[test] + fn test_treasury_spend_local_with_council_origin() { + let initial_treasury_balance = 1_000 * MOVR; + ExtBuilder::default() + .with_balances(vec![ + (AccountId::from(ALICE), 2_000 * MOVR), + (Treasury::account_id(), initial_treasury_balance), + ]) + .build() + .execute_with(|| { + let spend_amount = 100u128 * MOVR; + let spend_beneficiary = AccountId::from(BOB); + + next_block(); + + // TreasuryCouncilCollective + assert_ok!(TreasuryCouncilCollective::set_members( + root_origin(), + vec![AccountId::from(ALICE)], + Some(AccountId::from(ALICE)), + 1 + )); + + next_block(); + + // Perform treasury spending + let proposal = RuntimeCall::Treasury(pallet_treasury::Call::spend { + amount: spend_amount, + asset_kind: Box::new(()), + beneficiary: Box::new(AccountId::from(BOB)), + valid_from: Some(5u32), + }); + assert_ok!(TreasuryCouncilCollective::propose( + origin_of(AccountId::from(ALICE)), + 1, + Box::new(proposal.clone()), + 1_000 + )); + + let payout_period = + <::PayoutPeriod as Get>::get(); + let expected_events = [ + RuntimeEvent::Treasury(pallet_treasury::Event::AssetSpendApproved { + index: 0, + asset_kind: (), + amount: spend_amount, + beneficiary: spend_beneficiary, + valid_from: 5u32, + expire_at: payout_period + 5u32, + }), + RuntimeEvent::TreasuryCouncilCollective(pallet_collective::Event::Executed { + proposal_hash: sp_runtime::traits::BlakeTwo256::hash_of(&proposal), + result: Ok(()), + }), + ] + .to_vec(); + expect_events(expected_events); + + while System::block_number() < 5u32 { + next_block(); + } + + assert_ok!(Treasury::payout(origin_of(spend_beneficiary), 0)); + + let expected_events = [ + RuntimeEvent::Treasury(pallet_treasury::Event::Paid { + index: 0, + payment_id: (), + }), + RuntimeEvent::Balances(pallet_balances::Event::Transfer { + from: Treasury::account_id(), + to: spend_beneficiary, + amount: spend_amount, + }), + ] + .to_vec(); + expect_events(expected_events); + }); + } +} + #[cfg(test)] mod fee_tests { use super::*; diff --git a/test/suites/dev/moonbase/test-treasury/test-treasury-council-origin.ts b/test/suites/dev/moonbase/test-treasury/test-treasury-council-origin.ts new file mode 100644 index 0000000000..e5105bb583 --- /dev/null +++ b/test/suites/dev/moonbase/test-treasury/test-treasury-council-origin.ts @@ -0,0 +1,108 @@ +import "@moonbeam-network/api-augment"; +import { beforeAll, describeSuite, expect } from "@moonwall/cli"; +import type { ApiPromise } from "@polkadot/api"; +import { alith, baltathar, ethan } from "@moonwall/util"; +import type { FrameSupportPalletId } from "@polkadot/types/lookup"; + +describeSuite({ + id: "D013802", + title: "Treasury pallet spend_local call (Council Origin)", + foundationMethods: "dev", + testCases: ({ context, it }) => { + let treasuryPalletId: FrameSupportPalletId; + let treasuryAddress: string; + let api: ApiPromise; + + beforeAll(async function () { + api = context.polkadotJs(); + treasuryPalletId = api.consts.treasury.palletId; + treasuryAddress = `0x6d6f646C${treasuryPalletId.toString().slice(2)}0000000000000000`; + }); + + it({ + id: "T03", + title: "Members of the treasury council can spend treasury funds", + test: async function () { + // Set Alith as member of the treasury council + const setMembersTX = api.tx.treasuryCouncilCollective.setMembers( + [alith.address, baltathar.address], + alith.address, + 3 + ); + await context.createBlock(await api.tx.sudo.sudo(setMembersTX).signAsync(alith), { + allowFailures: false, + }); + + // Fund treasury + const treasuryPot = 2_000_000_000_000_000n; + await context.createBlock( + await api.tx.balances.transferAllowDeath(treasuryAddress, treasuryPot), + { allowFailures: false } + ); + await context.createBlock(); + expect((await api.query.treasury.deactivated()).toBigInt()).toBeGreaterThan(treasuryPot); + + // Pre-checks + expect((await api.query.treasury.proposalCount()).toNumber()).to.equal(0); + expect((await api.query.treasury.approvals()).length).to.equal(0); + + // Approve treasury spend to Ethan + const proposal_value = 1_000_000_000_000_000n; + const tx = api.tx.treasury.spend(null, proposal_value, ethan.address, null); + const signedTx = api.tx.treasuryCouncilCollective.propose(2, tx, 1_000).signAsync(alith); + const blockResult = await context.createBlock(signedTx, { + allowFailures: false, + expectEvents: [api.events.treasuryCouncilCollective.Proposed], + }); + + const councilProposalHash = blockResult + .result!.events.find(({ event: { method } }) => method.toString() === "Proposed")! + .event.data[2].toHex(); + + await context.createBlock( + api.tx.treasuryCouncilCollective.vote(councilProposalHash, 0, true).signAsync(alith), + { + allowFailures: false, + expectEvents: [api.events.treasuryCouncilCollective.Voted], + } + ); + + await context.createBlock( + api.tx.treasuryCouncilCollective.vote(councilProposalHash, 0, true).signAsync(baltathar), + { + allowFailures: false, + expectEvents: [api.events.treasuryCouncilCollective.Voted], + } + ); + + await context.createBlock( + api.tx.treasuryCouncilCollective + .close( + councilProposalHash, + 0, + { + refTime: 50_000_000_000, + proofSize: 100_000, + }, + 1_000 + ) + .signAsync(alith), + { + expectEvents: [ + api.events.treasuryCouncilCollective.Closed, + api.events.treasury.AssetSpendApproved, + ], + } + ); + + // Spending was successfully submitted + expect((await api.query.treasury.spendCount()).toNumber()).to.equal(1); + + await context.createBlock(await api.tx.treasury.payout(0).signAsync(ethan), { + allowFailures: false, + expectEvents: [api.events.treasury.Paid], + }); + }, + }); + }, +}); diff --git a/test/suites/dev/moonbase/test-treasury/test-treasury-pallet.ts b/test/suites/dev/moonbase/test-treasury/test-treasury-pallet.ts deleted file mode 100644 index 8cf3725692..0000000000 --- a/test/suites/dev/moonbase/test-treasury/test-treasury-pallet.ts +++ /dev/null @@ -1,51 +0,0 @@ -import "@moonbeam-network/api-augment"; -import { beforeAll, describeSuite, expect } from "@moonwall/cli"; -import type { ApiPromise } from "@polkadot/api"; -import { alith, baltathar, ethan } from "@moonwall/util"; - -describeSuite({ - id: "D013801", - title: "Treasury pallet tests", - foundationMethods: "dev", - testCases: ({ context, log, it }) => { - let api: ApiPromise; - - beforeAll(async function () { - api = context.polkadotJs(); - }); - - it({ - id: "T01", - title: "Non root cannot spend (local)", - test: async function () { - expect((await api.query.treasury.spendCount()).toNumber()).to.equal(0); - - // Creates a proposal - const proposal_value = 1000000000n; - const tx = api.tx.treasury.spendLocal(proposal_value, ethan.address); - const signedTx = await tx.signAsync(baltathar); - await context.createBlock([signedTx]); - - expect((await api.query.treasury.spendCount()).toNumber()).to.equal(0); - }, - }); - - it({ - id: "T02", - title: "Root should be able to spend (local) and approve a proposal", - test: async function () { - expect((await api.query.treasury.spendCount()).toNumber()).to.equal(0); - // Creates a proposal - // Value needs to be higher than the transaction fee paid by ethan, - // but lower than the total treasury pot - const proposal_value = 1000000000n; - const tx = api.tx.treasury.spendLocal(proposal_value, ethan.address); - const signedTx = await api.tx.sudo.sudo(tx).signAsync(alith); - await context.createBlock([signedTx]); - - // Local spends dont upadte the spend count - expect((await api.query.treasury.spendCount()).toNumber()).to.equal(0); - }, - }); - }, -}); diff --git a/test/suites/dev/moonbase/test-treasury/test-treasury-root-origin.ts b/test/suites/dev/moonbase/test-treasury/test-treasury-root-origin.ts new file mode 100644 index 0000000000..c0eafa4c01 --- /dev/null +++ b/test/suites/dev/moonbase/test-treasury/test-treasury-root-origin.ts @@ -0,0 +1,72 @@ +import "@moonbeam-network/api-augment"; +import { beforeAll, describeSuite, expect } from "@moonwall/cli"; +import type { ApiPromise } from "@polkadot/api"; +import { alith, baltathar, ethan } from "@moonwall/util"; +import type { FrameSupportPalletId } from "@polkadot/types/lookup"; + +describeSuite({ + id: "D013801", + title: "Treasury pallet spend_local call (Root Origin)", + foundationMethods: "dev", + testCases: ({ context, it }) => { + let treasuryPalletId: FrameSupportPalletId; + let treasuryAddress: string; + let api: ApiPromise; + + beforeAll(async function () { + api = context.polkadotJs(); + treasuryPalletId = api.consts.treasury.palletId; + treasuryAddress = `0x6d6f646C${treasuryPalletId.toString().slice(2)}0000000000000000`; + }); + + it({ + id: "T01", + title: "Origins that are not Root or members of treasury council cannot spend treasury funds", + test: async function () { + const proposal_value = 1000000000n; + const tx = api.tx.treasury.spend(null, proposal_value, ethan.address, null); + const signedTx = await tx.signAsync(baltathar); + await context.createBlock(signedTx, { + expectEvents: [api.events.system.ExtrinsicFailed], + }); + + expect((await api.query.treasury.spendCount()).toNumber()).to.equal(0); + }, + }); + + it({ + id: "T02", + title: "Root can spend treasury funds", + test: async function () { + // Fund treasury + const treasuryPot = 2_000_000_000_000_000n; + await context.createBlock( + await api.tx.balances.transferAllowDeath(treasuryAddress, treasuryPot), + { allowFailures: false } + ); + await context.createBlock(); + expect((await api.query.treasury.deactivated()).toBigInt()).toBeGreaterThan(treasuryPot); + + // Pre-checks + expect((await api.query.treasury.spendCount()).toNumber()).to.equal(0); + + // Approve treasury spend to Ethan + const proposal_value = 1_000_000_000_000_000n; + const tx = api.tx.treasury.spend(null, proposal_value, ethan.address, null); + const signedTx = await api.tx.sudo.sudo(tx).signAsync(alith); + await context.createBlock(signedTx, { + allowFailures: false, + expectEvents: [api.events.treasury.AssetSpendApproved], + }); + + // Spending was successfully submitted + expect((await api.query.treasury.spendCount()).toNumber()).to.equal(1); + + await context.createBlock(await api.tx.treasury.payout(0).signAsync(ethan), { + allowFailures: false, + expectEvents: [api.events.treasury.Paid], + }); + }, + }); + }, +}); From a322ae9edd8f2f439cc9db7873899d1baee0ad08 Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas <22591718+RomarQ@users.noreply.github.com> Date: Sun, 19 Jan 2025 14:49:53 +0000 Subject: [PATCH 06/10] Allow assets managed by AssetManager and EvmForeignAssets to use the pallet-xcm precompile (#3136) * update AssetIdToLocationManager to support both EvmForeignAssets and AssetManager as asset managers * test pallet xcm precompile with old foreign assets approach * fix test --- runtime/moonbase/src/precompiles.rs | 15 +- runtime/moonbeam/src/precompiles.rs | 9 +- runtime/moonriver/src/precompiles.rs | 9 +- .../test-precompile-pallet-xcm-2.ts | 2 - ...recompile-pallet-xcm-with-asset-manager.ts | 418 ++++++++++++++++++ .../test-precompile-pallet-xcm.ts | 4 - 6 files changed, 441 insertions(+), 16 deletions(-) create mode 100644 test/suites/dev/moonbase/test-precompile/test-precompile-pallet-xcm-with-asset-manager.ts diff --git a/runtime/moonbase/src/precompiles.rs b/runtime/moonbase/src/precompiles.rs index 9f23ba2167..b5f454860f 100644 --- a/runtime/moonbase/src/precompiles.rs +++ b/runtime/moonbase/src/precompiles.rs @@ -16,10 +16,13 @@ use super::moonbase_weights; use crate::{ - asset_config::ForeignAssetInstance, xcm_config::XcmExecutorConfig, OpenTechCommitteeInstance, - TreasuryCouncilInstance, + asset_config::ForeignAssetInstance, + xcm_config::{AssetType, XcmExecutorConfig}, + OpenTechCommitteeInstance, TreasuryCouncilInstance, +}; +use crate::{ + AccountId, AssetId, AssetManager, Balances, Erc20XcmBridge, EvmForeignAssets, Runtime, H160, }; -use crate::{AccountId, AssetId, Balances, Erc20XcmBridge, EvmForeignAssets, Runtime, H160}; use frame_support::parameter_types; use moonkit_xcm_primitives::{ location_matcher::{Erc20PalletMatcher, ForeignAssetMatcher, SingleAddressMatcher}, @@ -60,6 +63,7 @@ use pallet_precompile_benchmarks::WeightInfo; use precompile_foreign_asset_migrator::ForeignAssetMigratorPrecompile; use precompile_utils::precompile_set::*; use sp_std::prelude::*; +use xcm_primitives::AsAssetType; parameter_types! { pub P256VerifyWeight: frame_support::weights::Weight = @@ -111,7 +115,10 @@ type EthereumPrecompilesChecks = (AcceptDelegateCall, CallableByContract, Callab // Pallet-xcm precompile types. // Type that converts AssetId into Location -type AssetIdToLocationManager = EvmForeignAssets; +type AssetIdToLocationManager = ( + AsAssetType, + EvmForeignAssets, +); // The pallet-balances address is identified by ERC20_BALANCES_PRECOMPILE const type SingleAddressMatch = SingleAddressMatcher; diff --git a/runtime/moonbeam/src/precompiles.rs b/runtime/moonbeam/src/precompiles.rs index 355e905975..226775d798 100644 --- a/runtime/moonbeam/src/precompiles.rs +++ b/runtime/moonbeam/src/precompiles.rs @@ -18,8 +18,8 @@ use super::moonbeam_weights; use crate::{ asset_config::ForeignAssetInstance, xcm_config::{AssetType, XcmExecutorConfig}, - AccountId, AssetId, AssetManager, Balances, Erc20XcmBridge, OpenTechCommitteeInstance, Runtime, - TreasuryCouncilInstance, H160, + AccountId, AssetId, AssetManager, Balances, Erc20XcmBridge, EvmForeignAssets, + OpenTechCommitteeInstance, Runtime, TreasuryCouncilInstance, H160, }; use frame_support::parameter_types; use moonkit_xcm_primitives::{ @@ -111,7 +111,10 @@ type EthereumPrecompilesChecks = (AcceptDelegateCall, CallableByContract, Callab // Pallet-xcm precompile types. // Type that converts AssetId into Location -type AssetIdToLocationManager = AsAssetType; +type AssetIdToLocationManager = ( + AsAssetType, + EvmForeignAssets, +); // The pallet-balances address is identified by ERC20_BALANCES_PRECOMPILE const type SingleAddressMatch = SingleAddressMatcher; diff --git a/runtime/moonriver/src/precompiles.rs b/runtime/moonriver/src/precompiles.rs index 662c429801..7dc55968b7 100644 --- a/runtime/moonriver/src/precompiles.rs +++ b/runtime/moonriver/src/precompiles.rs @@ -18,8 +18,8 @@ use super::moonriver_weights; use crate::{ asset_config::ForeignAssetInstance, xcm_config::{AssetType, XcmExecutorConfig}, - AccountId, AssetId, AssetManager, Balances, Erc20XcmBridge, OpenTechCommitteeInstance, Runtime, - TreasuryCouncilInstance, + AccountId, AssetId, AssetManager, Balances, Erc20XcmBridge, EvmForeignAssets, + OpenTechCommitteeInstance, Runtime, TreasuryCouncilInstance, }; use frame_support::parameter_types; use moonkit_xcm_primitives::location_matcher::{ @@ -105,7 +105,10 @@ type EthereumPrecompilesChecks = (AcceptDelegateCall, CallableByContract, Callab // Pallet-xcm precompile types. // Type that converts AssetId into Location -type AssetIdToLocationManager = AsAssetType; +type AssetIdToLocationManager = ( + AsAssetType, + EvmForeignAssets, +); // The pallet-balances address is identified by ERC20_BALANCES_PRECOMPILE const type SingleAddressMatch = SingleAddressMatcher; diff --git a/test/suites/dev/moonbase/test-precompile/test-precompile-pallet-xcm-2.ts b/test/suites/dev/moonbase/test-precompile/test-precompile-pallet-xcm-2.ts index 298870d041..2a533346fb 100644 --- a/test/suites/dev/moonbase/test-precompile/test-precompile-pallet-xcm-2.ts +++ b/test/suites/dev/moonbase/test-precompile/test-precompile-pallet-xcm-2.ts @@ -20,8 +20,6 @@ import { PARA_1000_SOURCE_LOCATION, mockHrmpChannelExistanceTx, ARBITRARY_ASSET_ID, - mockAssetBalance, - registerForeignAsset, relayAssetMetadata, RELAY_SOURCE_LOCATION_V4, registerAndFundAsset, diff --git a/test/suites/dev/moonbase/test-precompile/test-precompile-pallet-xcm-with-asset-manager.ts b/test/suites/dev/moonbase/test-precompile/test-precompile-pallet-xcm-with-asset-manager.ts new file mode 100644 index 0000000000..31d66cbc1b --- /dev/null +++ b/test/suites/dev/moonbase/test-precompile/test-precompile-pallet-xcm-with-asset-manager.ts @@ -0,0 +1,418 @@ +import "@moonbeam-network/api-augment"; +import { beforeAll, describeSuite, fetchCompiledContract, expect } from "@moonwall/cli"; +import { ALITH_ADDRESS, BALTATHAR_ADDRESS, alith, createEthersTransaction } from "@moonwall/util"; +import type { u128 } from "@polkadot/types-codec"; +import { numberToHex } from "@polkadot/util"; +import type { PalletAssetsAssetAccount, PalletAssetsAssetDetails } from "@polkadot/types/lookup"; +import { encodeFunctionData } from "viem"; +import { expectEVMResult, mockOldAssetBalance } from "../../../../helpers"; + +const PRECOMPILE_PALLET_XCM_ADDRESS: `0x${string}` = "0x000000000000000000000000000000000000081A"; + +describeSuite({ + id: "D012902", + title: "Precompiles - PalletXcm", + foundationMethods: "dev", + testCases: ({ context, it }) => { + let assetId: u128; + const ADDRESS_ERC20 = "0xFfFFfFff1FcaCBd218EDc0EbA20Fc2308C778080"; + const ASSET_ID = 42259045809535163221576417993425387648n; + const amountToSend = 100n; + + beforeAll(async () => { + const balance = 200000000000000n; + const assetBalance: PalletAssetsAssetAccount = context + .polkadotJs() + .createType("PalletAssetsAssetAccount", { + balance: balance, + }); + assetId = context.polkadotJs().createType("u128", ASSET_ID); + + const assetDetails: PalletAssetsAssetDetails = context + .polkadotJs() + .createType("PalletAssetsAssetDetails", { + supply: balance, + }); + + await mockOldAssetBalance( + context, + assetBalance, + assetDetails, + alith, + assetId, + ALITH_ADDRESS, + true + ); + }); + + it({ + id: "T01", + title: "allows to call transferAssetsLocation function", + test: async function () { + const { abi: xcmInterface } = fetchCompiledContract("XCM"); + const assetBalanceBefore = ( + await context.polkadotJs().query.assets.account(assetId.toU8a(), ALITH_ADDRESS) + ) + .unwrap() + .balance.toBigInt(); + + const dest: [number, any[]] = [1, []]; + + const destinationAddress = + "0101010101010101010101010101010101010101010101010101010101010101"; + const destinationNetworkId = "00"; + const beneficiary: [number, any[]] = [ + 0, + // junction: AccountId32 enum (01) + the 32 byte account + Any network selector(00) + ["0x01" + destinationAddress + destinationNetworkId], + ]; + + const assetLocation: [number, any[]] = [1, []]; + const assetLocationInfo = [[assetLocation, amountToSend]]; + + const rawTxn = await createEthersTransaction(context, { + to: PRECOMPILE_PALLET_XCM_ADDRESS, + data: encodeFunctionData({ + abi: xcmInterface, + args: [dest, beneficiary, assetLocationInfo, 0], + functionName: "transferAssetsLocation", + }), + gasLimit: 500_000n, + }); + + const result = await context.createBlock(rawTxn); + expectEVMResult(result.result!.events, "Succeed"); + + const assetBalanceAfter = ( + await context.polkadotJs().query.assets.account(assetId.toU8a(), ALITH_ADDRESS) + ) + .unwrap() + .balance.toBigInt(); + expect(assetBalanceAfter).to.equal(assetBalanceBefore - amountToSend); + }, + }); + + it({ + id: "T02", + title: "allows to call transferAssetsToPara20 function", + test: async function () { + const { abi: xcmInterface } = fetchCompiledContract("XCM"); + const assetBalanceBefore = ( + await context.polkadotJs().query.assets.account(assetId.toU8a(), ALITH_ADDRESS) + ) + .unwrap() + .balance.toBigInt(); + + const paraId = 1000n; + const assetAddressInfo = [[ADDRESS_ERC20, amountToSend]]; + + const rawTxn = await createEthersTransaction(context, { + to: PRECOMPILE_PALLET_XCM_ADDRESS, + data: encodeFunctionData({ + abi: xcmInterface, + args: [paraId, BALTATHAR_ADDRESS, assetAddressInfo, 0], + functionName: "transferAssetsToPara20", + }), + gasLimit: 500_000n, + }); + + const result = await context.createBlock(rawTxn); + expectEVMResult(result.result!.events, "Succeed"); + + const assetBalanceAfter = ( + await context.polkadotJs().query.assets.account(assetId.toU8a(), ALITH_ADDRESS) + ) + .unwrap() + .balance.toBigInt(); + expect(assetBalanceAfter).to.equal(assetBalanceBefore - amountToSend); + }, + }); + + it({ + id: "T03", + title: "allows to call transferAssetsToPara32 function", + test: async function () { + const { abi: xcmInterface } = fetchCompiledContract("XCM"); + const assetBalanceBefore = ( + await context.polkadotJs().query.assets.account(assetId.toU8a(), ALITH_ADDRESS) + ) + .unwrap() + .balance.toBigInt(); + + const paraId = 1000n; + const assetAddressInfo = [[ADDRESS_ERC20, amountToSend]]; + const beneficiaryAddress = "01010101010101010101010101010101"; + + const rawTxn = await createEthersTransaction(context, { + to: PRECOMPILE_PALLET_XCM_ADDRESS, + data: encodeFunctionData({ + abi: xcmInterface, + args: [paraId, beneficiaryAddress, assetAddressInfo, 0], + functionName: "transferAssetsToPara32", + }), + gasLimit: 500_000n, + }); + + const result = await context.createBlock(rawTxn); + expectEVMResult(result.result!.events, "Succeed"); + + const assetBalanceAfter = ( + await context.polkadotJs().query.assets.account(assetId.toU8a(), ALITH_ADDRESS) + ) + .unwrap() + .balance.toBigInt(); + expect(assetBalanceAfter).to.equal(assetBalanceBefore - amountToSend); + }, + }); + + it({ + id: "T04", + title: "allows to call transferAssetsToRelay function", + test: async function () { + const { abi: xcmInterface } = fetchCompiledContract("XCM"); + const assetBalanceBefore = ( + await context.polkadotJs().query.assets.account(assetId.toU8a(), ALITH_ADDRESS) + ) + .unwrap() + .balance.toBigInt(); + + const assetAddressInfo = [[ADDRESS_ERC20, amountToSend]]; + const beneficiaryAddress = "01010101010101010101010101010101"; + + const rawTxn = await createEthersTransaction(context, { + to: PRECOMPILE_PALLET_XCM_ADDRESS, + data: encodeFunctionData({ + abi: xcmInterface, + args: [beneficiaryAddress, assetAddressInfo, 0], + functionName: "transferAssetsToRelay", + }), + gasLimit: 500_000n, + }); + + const result = await context.createBlock(rawTxn); + expectEVMResult(result.result!.events, "Succeed"); + + const assetBalanceAfter = ( + await context.polkadotJs().query.assets.account(assetId.toU8a(), ALITH_ADDRESS) + ) + .unwrap() + .balance.toBigInt(); + expect(assetBalanceAfter).to.equal(assetBalanceBefore - amountToSend); + }, + }); + + it({ + id: "T05", + title: "allows to call transferAssetsUsingTypeAndThenLocation::8425d893 selector", + test: async function () { + const { abi: xcmInterface } = fetchCompiledContract("XCM"); + const assetBalanceBefore = ( + await context.polkadotJs().query.assets.account(assetId.toU8a(), ALITH_ADDRESS) + ) + .unwrap() + .balance.toBigInt(); + + const dest: [number, any[]] = [1, []]; + const assetLocation: [number, any[]] = [1, []]; + const assetLocationInfo = [[assetLocation, amountToSend]]; + + // DestinationReserve + const assetsAndFeesTransferType = 2; + + const message = { + V3: [ + { + ClearOrigin: null, + }, + ], + }; + const xcmOnDest = context.polkadotJs().createType("XcmVersionedXcm", message); + + const rawTxn = await createEthersTransaction(context, { + to: PRECOMPILE_PALLET_XCM_ADDRESS, + data: encodeFunctionData({ + abi: xcmInterface, + args: [ + dest, + assetLocationInfo, + assetsAndFeesTransferType, + 0n, + assetsAndFeesTransferType, + xcmOnDest.toHex(), + ], + functionName: "transferAssetsUsingTypeAndThenLocation", + }), + gasLimit: 500_000n, + }); + + const result = await context.createBlock(rawTxn); + expectEVMResult(result.result!.events, "Succeed"); + + const assetBalanceAfter = ( + await context.polkadotJs().query.assets.account(assetId.toU8a(), ALITH_ADDRESS) + ) + .unwrap() + .balance.toBigInt(); + expect(assetBalanceAfter).to.equal(assetBalanceBefore - amountToSend); + }, + }); + + it({ + id: "T06", + title: "allows to call transferAssetsUsingTypeAndThenLocation::fc19376c selector", + test: async function () { + const { abi: xcmInterface } = fetchCompiledContract("XCM"); + const assetBalanceBefore = ( + await context.polkadotJs().query.assets.account(assetId.toU8a(), ALITH_ADDRESS) + ) + .unwrap() + .balance.toBigInt(); + + const paraIdInHex = numberToHex(2000, 32); + const parachain_enum_selector = "0x00"; + + // This represents X2(Parent, Parachain(2000)) + const dest: [number, any[]] = [1, [parachain_enum_selector + paraIdInHex.slice(2)]]; + + const remoteReserve: [number, any[]] = [1, []]; + const assetLocation: [number, any[]] = [1, []]; + const assetLocationInfo = [[assetLocation, amountToSend]]; + + const message = { + V3: [ + { + ClearOrigin: null, + }, + ], + }; + const xcmOnDest = context.polkadotJs().createType("XcmVersionedXcm", message); + + const rawTxn = await createEthersTransaction(context, { + to: PRECOMPILE_PALLET_XCM_ADDRESS, + data: encodeFunctionData({ + abi: xcmInterface, + args: [dest, assetLocationInfo, 0n, xcmOnDest.toHex(), remoteReserve], + functionName: "transferAssetsUsingTypeAndThenLocation", + }), + gasLimit: 500_000n, + }); + + const result = await context.createBlock(rawTxn); + expectEVMResult(result.result!.events, "Succeed"); + + const assetBalanceAfter = ( + await context.polkadotJs().query.assets.account(assetId.toU8a(), ALITH_ADDRESS) + ) + .unwrap() + .balance.toBigInt(); + expect(assetBalanceAfter).to.equal(assetBalanceBefore - amountToSend); + }, + }); + + it({ + id: "T07", + title: "allows to call transferAssetsUsingTypeAndThenAddress::998093ee selector", + test: async function () { + const { abi: xcmInterface } = fetchCompiledContract("XCM"); + const assetBalanceBefore = ( + await context.polkadotJs().query.assets.account(assetId.toU8a(), ALITH_ADDRESS) + ) + .unwrap() + .balance.toBigInt(); + + // Relay as destination + const dest: [number, any[]] = [1, []]; + const assetAddressInfo = [[ADDRESS_ERC20, amountToSend]]; + + // DestinationReserve + const assetsAndFeesTransferType = 2; + + const message = { + V3: [ + { + ClearOrigin: null, + }, + ], + }; + const xcmOnDest = context.polkadotJs().createType("XcmVersionedXcm", message); + + const rawTxn = await createEthersTransaction(context, { + to: PRECOMPILE_PALLET_XCM_ADDRESS, + data: encodeFunctionData({ + abi: xcmInterface, + args: [ + dest, + assetAddressInfo, + assetsAndFeesTransferType, + 0n, + assetsAndFeesTransferType, + xcmOnDest.toHex(), + ], + functionName: "transferAssetsUsingTypeAndThenAddress", + }), + gasLimit: 500_000n, + }); + + const result = await context.createBlock(rawTxn); + expectEVMResult(result.result!.events, "Succeed"); + + const assetBalanceAfter = ( + await context.polkadotJs().query.assets.account(assetId.toU8a(), ALITH_ADDRESS) + ) + .unwrap() + .balance.toBigInt(); + expect(assetBalanceAfter).to.equal(assetBalanceBefore - amountToSend); + }, + }); + + it({ + id: "T08", + title: "allows to call transferAssetsUsingTypeAndThenAddress::aaecfc62 selector", + test: async function () { + const { abi: xcmInterface } = fetchCompiledContract("XCM"); + const assetBalanceBefore = ( + await context.polkadotJs().query.assets.account(assetId.toU8a(), ALITH_ADDRESS) + ) + .unwrap() + .balance.toBigInt(); + + const paraIdInHex = numberToHex(2000, 32); + const parachain_enum_selector = "0x00"; + + // This represents X2(Parent, Parachain(2000)) + const dest: [number, any[]] = [1, [parachain_enum_selector + paraIdInHex.slice(2)]]; + const assetAddressInfo = [[ADDRESS_ERC20, amountToSend]]; + const remoteReserve: [number, any[]] = [1, []]; + + const message = { + V3: [ + { + ClearOrigin: null, + }, + ], + }; + const xcmOnDest = context.polkadotJs().createType("XcmVersionedXcm", message); + + const rawTxn = await createEthersTransaction(context, { + to: PRECOMPILE_PALLET_XCM_ADDRESS, + data: encodeFunctionData({ + abi: xcmInterface, + args: [dest, assetAddressInfo, 0n, xcmOnDest.toHex(), remoteReserve], + functionName: "transferAssetsUsingTypeAndThenAddress", + }), + gasLimit: 500_000n, + }); + + const result = await context.createBlock(rawTxn); + expectEVMResult(result.result!.events, "Succeed"); + + const assetBalanceAfter = ( + await context.polkadotJs().query.assets.account(assetId.toU8a(), ALITH_ADDRESS) + ) + .unwrap() + .balance.toBigInt(); + expect(assetBalanceAfter).to.equal(assetBalanceBefore - amountToSend); + }, + }); + }, +}); diff --git a/test/suites/dev/moonbase/test-precompile/test-precompile-pallet-xcm.ts b/test/suites/dev/moonbase/test-precompile/test-precompile-pallet-xcm.ts index 750d12e144..faac1e57c2 100644 --- a/test/suites/dev/moonbase/test-precompile/test-precompile-pallet-xcm.ts +++ b/test/suites/dev/moonbase/test-precompile/test-precompile-pallet-xcm.ts @@ -5,16 +5,12 @@ import { numberToHex } from "@polkadot/util"; import { encodeFunctionData, erc20Abi } from "viem"; import { expectEVMResult, - mockAssetBalance, - registerForeignAsset, relayAssetMetadata, ARBITRARY_ASSET_ID, RELAY_SOURCE_LOCATION_V4, registerAndFundAsset, - PARA_1000_SOURCE_LOCATION, } from "../../../../helpers"; import { ethers } from "ethers"; -import { para1000AssetMetadata } from "./test-precompile-pallet-xcm-2"; const PRECOMPILE_PALLET_XCM_ADDRESS: `0x${string}` = "0x000000000000000000000000000000000000081A"; describeSuite({ From 4f01eda525ec37fa9a40c545c7b53a496ac302d0 Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas <22591718+RomarQ@users.noreply.github.com> Date: Mon, 20 Jan 2025 14:25:10 +0000 Subject: [PATCH 07/10] update proxy filter (#3141) --- runtime/moonbase/src/lib.rs | 43 ++++++------ runtime/moonbeam/src/lib.rs | 42 ++++++------ runtime/moonriver/src/lib.rs | 42 ++++++------ .../test-proxy/test-proxy-identity.ts | 65 +++++++++++++++++++ 4 files changed, 131 insertions(+), 61 deletions(-) diff --git a/runtime/moonbase/src/lib.rs b/runtime/moonbase/src/lib.rs index 9774af7bca..5cd1c82cc1 100644 --- a/runtime/moonbase/src/lib.rs +++ b/runtime/moonbase/src/lib.rs @@ -970,7 +970,6 @@ impl pallet_evm_precompile_proxy::EvmProxyCallFilter for ProxyType { && match PrecompileName::from_address(call.to.0) { Some( PrecompileName::AuthorMappingPrecompile - | PrecompileName::IdentityPrecompile | PrecompileName::ParachainStakingPrecompile, ) => true, Some(ref precompile) if is_governance_precompile(precompile) => true, @@ -1023,26 +1022,28 @@ impl InstanceFilter for ProxyType { fn filter(&self, c: &RuntimeCall) -> bool { match self { ProxyType::Any => true, - ProxyType::NonTransfer => { - matches!( - c, - RuntimeCall::System(..) - | RuntimeCall::ParachainSystem(..) - | RuntimeCall::Timestamp(..) - | RuntimeCall::ParachainStaking(..) - | RuntimeCall::Referenda(..) - | RuntimeCall::Preimage(..) - | RuntimeCall::ConvictionVoting(..) - | RuntimeCall::TreasuryCouncilCollective(..) - | RuntimeCall::OpenTechCommitteeCollective(..) - | RuntimeCall::Identity(..) - | RuntimeCall::Utility(..) - | RuntimeCall::Proxy(..) | RuntimeCall::AuthorMapping(..) - | RuntimeCall::CrowdloanRewards( - pallet_crowdloan_rewards::Call::claim { .. } - ) - ) - } + ProxyType::NonTransfer => match c { + RuntimeCall::Identity( + pallet_identity::Call::add_sub { .. } | pallet_identity::Call::set_subs { .. }, + ) => false, + call => { + matches!( + call, + RuntimeCall::System(..) + | RuntimeCall::ParachainSystem(..) + | RuntimeCall::Timestamp(..) | RuntimeCall::ParachainStaking(..) + | RuntimeCall::Referenda(..) | RuntimeCall::Preimage(..) + | RuntimeCall::ConvictionVoting(..) + | RuntimeCall::TreasuryCouncilCollective(..) + | RuntimeCall::OpenTechCommitteeCollective(..) + | RuntimeCall::Utility(..) | RuntimeCall::Proxy(..) + | RuntimeCall::Identity(..) | RuntimeCall::AuthorMapping(..) + | RuntimeCall::CrowdloanRewards( + pallet_crowdloan_rewards::Call::claim { .. } + ) + ) + } + }, ProxyType::Governance => matches!( c, RuntimeCall::Referenda(..) diff --git a/runtime/moonbeam/src/lib.rs b/runtime/moonbeam/src/lib.rs index a4892e32d0..9190d2804a 100644 --- a/runtime/moonbeam/src/lib.rs +++ b/runtime/moonbeam/src/lib.rs @@ -1020,26 +1020,28 @@ impl InstanceFilter for ProxyType { fn filter(&self, c: &RuntimeCall) -> bool { match self { ProxyType::Any => true, - ProxyType::NonTransfer => { - matches!( - c, - RuntimeCall::System(..) - | RuntimeCall::ParachainSystem(..) - | RuntimeCall::Timestamp(..) - | RuntimeCall::ParachainStaking(..) - | RuntimeCall::Referenda(..) - | RuntimeCall::Preimage(..) - | RuntimeCall::ConvictionVoting(..) - | RuntimeCall::TreasuryCouncilCollective(..) - | RuntimeCall::OpenTechCommitteeCollective(..) - | RuntimeCall::Identity(..) - | RuntimeCall::Utility(..) - | RuntimeCall::Proxy(..) | RuntimeCall::AuthorMapping(..) - | RuntimeCall::CrowdloanRewards( - pallet_crowdloan_rewards::Call::claim { .. } - ) - ) - } + ProxyType::NonTransfer => match c { + RuntimeCall::Identity( + pallet_identity::Call::add_sub { .. } | pallet_identity::Call::set_subs { .. }, + ) => false, + call => { + matches!( + call, + RuntimeCall::System(..) + | RuntimeCall::ParachainSystem(..) + | RuntimeCall::Timestamp(..) | RuntimeCall::ParachainStaking(..) + | RuntimeCall::Referenda(..) | RuntimeCall::Preimage(..) + | RuntimeCall::ConvictionVoting(..) + | RuntimeCall::TreasuryCouncilCollective(..) + | RuntimeCall::OpenTechCommitteeCollective(..) + | RuntimeCall::Utility(..) | RuntimeCall::Proxy(..) + | RuntimeCall::Identity(..) | RuntimeCall::AuthorMapping(..) + | RuntimeCall::CrowdloanRewards( + pallet_crowdloan_rewards::Call::claim { .. } + ) + ) + } + }, ProxyType::Governance => matches!( c, RuntimeCall::Referenda(..) diff --git a/runtime/moonriver/src/lib.rs b/runtime/moonriver/src/lib.rs index 3c30809b75..e8c82f3377 100644 --- a/runtime/moonriver/src/lib.rs +++ b/runtime/moonriver/src/lib.rs @@ -1028,26 +1028,28 @@ impl InstanceFilter for ProxyType { fn filter(&self, c: &RuntimeCall) -> bool { match self { ProxyType::Any => true, - ProxyType::NonTransfer => { - matches!( - c, - RuntimeCall::System(..) - | RuntimeCall::ParachainSystem(..) - | RuntimeCall::Timestamp(..) - | RuntimeCall::ParachainStaking(..) - | RuntimeCall::Referenda(..) - | RuntimeCall::Preimage(..) - | RuntimeCall::ConvictionVoting(..) - | RuntimeCall::TreasuryCouncilCollective(..) - | RuntimeCall::OpenTechCommitteeCollective(..) - | RuntimeCall::Identity(..) - | RuntimeCall::Utility(..) - | RuntimeCall::Proxy(..) | RuntimeCall::AuthorMapping(..) - | RuntimeCall::CrowdloanRewards( - pallet_crowdloan_rewards::Call::claim { .. } - ) - ) - } + ProxyType::NonTransfer => match c { + RuntimeCall::Identity( + pallet_identity::Call::add_sub { .. } | pallet_identity::Call::set_subs { .. }, + ) => false, + call => { + matches!( + call, + RuntimeCall::System(..) + | RuntimeCall::ParachainSystem(..) + | RuntimeCall::Timestamp(..) | RuntimeCall::ParachainStaking(..) + | RuntimeCall::Referenda(..) | RuntimeCall::Preimage(..) + | RuntimeCall::ConvictionVoting(..) + | RuntimeCall::TreasuryCouncilCollective(..) + | RuntimeCall::OpenTechCommitteeCollective(..) + | RuntimeCall::Utility(..) | RuntimeCall::Proxy(..) + | RuntimeCall::Identity(..) | RuntimeCall::AuthorMapping(..) + | RuntimeCall::CrowdloanRewards( + pallet_crowdloan_rewards::Call::claim { .. } + ) + ) + } + }, ProxyType::Governance => matches!( c, RuntimeCall::Referenda(..) diff --git a/test/suites/dev/moonbase/test-proxy/test-proxy-identity.ts b/test/suites/dev/moonbase/test-proxy/test-proxy-identity.ts index 0e687ab97c..86fadd263b 100644 --- a/test/suites/dev/moonbase/test-proxy/test-proxy-identity.ts +++ b/test/suites/dev/moonbase/test-proxy/test-proxy-identity.ts @@ -1,6 +1,22 @@ import "@moonbeam-network/api-augment"; import { beforeEach, describeSuite, expect } from "@moonwall/cli"; import { GLMR, type KeyringPair, alith, generateKeyringPair } from "@moonwall/util"; +import { BN, u8aToU8a } from "@polkadot/util"; +import type { EventRecord } from "@polkadot/types/interfaces"; +import type { ApiPromise } from "@polkadot/api"; +import type { RegistryError } from "@polkadot/types-codec/types"; + +const getProxyErrors = (api: ApiPromise, events: EventRecord[]): RegistryError[] => { + return events + .filter(({ event }) => api.events.proxy.ProxyExecuted.is(event)) + .map(({ event }) => { + const module = event.data["result"].toJSON()["err"]["module"]; + return api.registry.findMetaError({ + index: new BN(module.index), + error: u8aToU8a(module.error), + }); + }); +}; describeSuite({ id: "D013005", @@ -137,6 +153,55 @@ describeSuite({ }); }, }); + + it({ + id: "T03", + title: "Should fail when calling pallet_identity through a `NonTransfer` proxy", + test: async () => { + // Add Alith as NonTransfer Proxy of another account + const blockAdd = await context.createBlock( + context.polkadotJs().tx.proxy.addProxy(alith.address, "NonTransfer", 0).signAsync(signer) + ); + expect(blockAdd.result?.successful).to.be.true; + + let alithNonce = await context + .viem() + .getTransactionCount({ address: alith.address as `0x${string}` }); + const blockExecute = await context.createBlock([ + // Alith adds itself as sub account of another account using a proxy call, + // and reserves a deposit + await context + .polkadotJs() + .tx.proxy.proxy( + signer.address, + "NonTransfer", + context.polkadotJs().tx.identity.addSub(alith.address, { Raw: "test" }) + ) + .signAsync(alith, { nonce: alithNonce++ }), + // Another flavour of the call above, it does exactly the same thing. + await context + .polkadotJs() + .tx.proxy.proxy( + signer.address, + "NonTransfer", + context.polkadotJs().tx.identity.setSubs([[alith.address, { Raw: "test" }]]) + ) + .signAsync(alith, { nonce: alithNonce++ }), + ]); + expect(blockExecute.result!.length).to.equal(2); + expect(blockExecute.result!.every(({ successful }) => successful)).to.be.true; + const errors = blockExecute.result!.flatMap(({ events }) => + getProxyErrors(context.polkadotJs(), events) + ); + expect(errors.length).to.equal(2); + // We expect the calls to fail, `ProxyType` filters these calls + // for `NonTransfer` proxy calls. + for (const error of errors) { + expect(error.docs[0]).to.equal("The origin filter prevent the call to be dispatched."); + expect(error.name).to.equal("CallFiltered"); + } + }, + }); }, }); From b2b1bde7ced13aad4bd2928effc415c521fd48cb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 16:59:29 +0000 Subject: [PATCH 08/10] Notorize runtime upgrade differences: runtime-3401 (#3143) * runtime diff: v0.3401.0 * trigger checks --------- Co-authored-by: RomarQ <22591718+RomarQ@users.noreply.github.com> Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com> --- runtime-diffs/moonbase/3401.txt | 1 + runtime-diffs/moonbeam/3401.txt | 1 + runtime-diffs/moonriver/3401.txt | 1 + 3 files changed, 3 insertions(+) create mode 100644 runtime-diffs/moonbase/3401.txt create mode 100644 runtime-diffs/moonbeam/3401.txt create mode 100644 runtime-diffs/moonriver/3401.txt diff --git a/runtime-diffs/moonbase/3401.txt b/runtime-diffs/moonbase/3401.txt new file mode 100644 index 0000000000..33e8bfe49a --- /dev/null +++ b/runtime-diffs/moonbase/3401.txt @@ -0,0 +1 @@ +No difference in metadata found. diff --git a/runtime-diffs/moonbeam/3401.txt b/runtime-diffs/moonbeam/3401.txt new file mode 100644 index 0000000000..33e8bfe49a --- /dev/null +++ b/runtime-diffs/moonbeam/3401.txt @@ -0,0 +1 @@ +No difference in metadata found. diff --git a/runtime-diffs/moonriver/3401.txt b/runtime-diffs/moonriver/3401.txt new file mode 100644 index 0000000000..33e8bfe49a --- /dev/null +++ b/runtime-diffs/moonriver/3401.txt @@ -0,0 +1 @@ +No difference in metadata found. From 8545c94aa9d99c24a50785c8c9dfe75817790ff5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 22 Jan 2025 08:58:27 +0000 Subject: [PATCH 09/10] Update Rust/TS bindings (#3149) * Update Rust/TS bindings --------- Co-authored-by: RomarQ <22591718+RomarQ@users.noreply.github.com> --- .../moonbase/interfaces/augment-api-errors.ts | 8 - .../moonbase/interfaces/augment-api-events.ts | 17 + .../moonbase/interfaces/augment-api-query.ts | 29 +- .../src/moonbase/interfaces/augment-api-tx.ts | 62 ++-- .../src/moonbase/interfaces/lookup.ts | 272 ++++++++-------- .../src/moonbase/interfaces/registry.ts | 24 +- .../src/moonbase/interfaces/types-lookup.ts | 290 +++++++++--------- .../moonbeam/interfaces/augment-api-errors.ts | 8 - .../moonbeam/interfaces/augment-api-events.ts | 17 + .../moonbeam/interfaces/augment-api-query.ts | 29 +- .../src/moonbeam/interfaces/augment-api-tx.ts | 62 ++-- .../src/moonbeam/interfaces/lookup.ts | 232 +++++++------- .../src/moonbeam/interfaces/registry.ts | 24 +- .../src/moonbeam/interfaces/types-lookup.ts | 234 +++++++------- .../interfaces/augment-api-errors.ts | 8 - .../interfaces/augment-api-events.ts | 17 + .../moonriver/interfaces/augment-api-query.ts | 29 +- .../moonriver/interfaces/augment-api-tx.ts | 62 ++-- .../src/moonriver/interfaces/lookup.ts | 232 +++++++------- .../src/moonriver/interfaces/registry.ts | 24 +- .../src/moonriver/interfaces/types-lookup.ts | 234 +++++++------- 21 files changed, 984 insertions(+), 930 deletions(-) diff --git a/typescript-api/src/moonbase/interfaces/augment-api-errors.ts b/typescript-api/src/moonbase/interfaces/augment-api-errors.ts index e535858507..4ebead5643 100644 --- a/typescript-api/src/moonbase/interfaces/augment-api-errors.ts +++ b/typescript-api/src/moonbase/interfaces/augment-api-errors.ts @@ -681,10 +681,6 @@ declare module "@polkadot/api-base/types/errors" { * Contract not exist **/ ContractNotExist: AugmentedError; - /** - * The key lengths exceeds the maximum allowed - **/ - KeyTooLong: AugmentedError; /** * The limit cannot be zero **/ @@ -1091,10 +1087,6 @@ declare module "@polkadot/api-base/types/errors" { * Preimage has already been noted on-chain. **/ AlreadyNoted: AugmentedError; - /** - * No ticket with a cost was returned by [`Config::Consideration`] to store the preimage. - **/ - NoCost: AugmentedError; /** * The user is not authorized to perform this action. **/ diff --git a/typescript-api/src/moonbase/interfaces/augment-api-events.ts b/typescript-api/src/moonbase/interfaces/augment-api-events.ts index 57b8d0b861..429481243a 100644 --- a/typescript-api/src/moonbase/interfaces/augment-api-events.ts +++ b/typescript-api/src/moonbase/interfaces/augment-api-events.ts @@ -37,6 +37,7 @@ import type { MoonbaseRuntimeXcmConfigAssetType, NimbusPrimitivesNimbusCryptoPublic, PalletConvictionVotingTally, + PalletConvictionVotingVoteAccountVote, PalletMultisigTimepoint, PalletParachainStakingDelegationRequestsCancelledScheduledRequest, PalletParachainStakingDelegatorAdded, @@ -581,6 +582,22 @@ declare module "@polkadot/api-base/types/events" { * An \[account\] has cancelled a previous delegation operation. **/ Undelegated: AugmentedEvent; + /** + * An account that has voted + **/ + Voted: AugmentedEvent< + ApiType, + [who: AccountId20, vote: PalletConvictionVotingVoteAccountVote], + { who: AccountId20; vote: PalletConvictionVotingVoteAccountVote } + >; + /** + * A vote that been removed + **/ + VoteRemoved: AugmentedEvent< + ApiType, + [who: AccountId20, vote: PalletConvictionVotingVoteAccountVote], + { who: AccountId20; vote: PalletConvictionVotingVoteAccountVote } + >; /** * Generic event **/ diff --git a/typescript-api/src/moonbase/interfaces/augment-api-query.ts b/typescript-api/src/moonbase/interfaces/augment-api-query.ts index 9d7cf20d01..f3c023c7b8 100644 --- a/typescript-api/src/moonbase/interfaces/augment-api-query.ts +++ b/typescript-api/src/moonbase/interfaces/augment-api-query.ts @@ -110,10 +110,10 @@ import type { PalletXcmTransactorRemoteTransactInfoWithMaxWeight, PalletXcmVersionMigrationStage, PolkadotCorePrimitivesOutboundHrmpMessage, - PolkadotPrimitivesV7AbridgedHostConfiguration, - PolkadotPrimitivesV7PersistedValidationData, - PolkadotPrimitivesV7UpgradeGoAhead, - PolkadotPrimitivesV7UpgradeRestriction, + PolkadotPrimitivesV8AbridgedHostConfiguration, + PolkadotPrimitivesV8PersistedValidationData, + PolkadotPrimitivesV8UpgradeGoAhead, + PolkadotPrimitivesV8UpgradeRestriction, SpRuntimeDigest, SpTrieStorageProof, SpWeightsWeightV2Weight, @@ -1142,6 +1142,19 @@ declare module "@polkadot/api-base/types/storage" { **/ totalSelected: AugmentedQuery Observable, []> & QueryableStorageEntry; + /** + * Records collators' inactivity. + * Data persists for MaxOfflineRounds + 1 rounds before being pruned. + **/ + wasInactive: AugmentedQuery< + ApiType, + ( + arg1: u32 | AnyNumber | Uint8Array, + arg2: AccountId20 | string | Uint8Array + ) => Observable>, + [u32, AccountId20] + > & + QueryableStorageEntry; /** * Generic query **/ @@ -1187,7 +1200,7 @@ declare module "@polkadot/api-base/types/storage" { **/ hostConfiguration: AugmentedQuery< ApiType, - () => Observable>, + () => Observable>, [] > & QueryableStorageEntry; @@ -1333,7 +1346,7 @@ declare module "@polkadot/api-base/types/storage" { **/ upgradeGoAhead: AugmentedQuery< ApiType, - () => Observable>, + () => Observable>, [] > & QueryableStorageEntry; @@ -1348,7 +1361,7 @@ declare module "@polkadot/api-base/types/storage" { **/ upgradeRestrictionSignal: AugmentedQuery< ApiType, - () => Observable>, + () => Observable>, [] > & QueryableStorageEntry; @@ -1371,7 +1384,7 @@ declare module "@polkadot/api-base/types/storage" { **/ validationData: AugmentedQuery< ApiType, - () => Observable>, + () => Observable>, [] > & QueryableStorageEntry; diff --git a/typescript-api/src/moonbase/interfaces/augment-api-tx.ts b/typescript-api/src/moonbase/interfaces/augment-api-tx.ts index 23684897dd..70117754cc 100644 --- a/typescript-api/src/moonbase/interfaces/augment-api-tx.ts +++ b/typescript-api/src/moonbase/interfaces/augment-api-tx.ts @@ -688,8 +688,6 @@ declare module "@polkadot/api-base/types/submittable" { * * - `id`: The identifier of the asset to be destroyed. This must identify an existing * asset. - * - * The asset class must be frozen before calling `start_destroy`. **/ startDestroy: AugmentedSubmittable< (id: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, @@ -791,6 +789,32 @@ declare module "@polkadot/api-base/types/submittable" { ) => SubmittableExtrinsic, [Compact, AccountId20, Compact] >; + /** + * Transfer the entire transferable balance from the caller asset account. + * + * NOTE: This function only attempts to transfer _transferable_ balances. This means that + * any held, frozen, or minimum balance (when `keep_alive` is `true`), will not be + * transferred by this function. To ensure that this function results in a killed account, + * you might need to prepare the account by removing any reference counters, storage + * deposits, etc... + * + * The dispatch origin of this call must be Signed. + * + * - `id`: The identifier of the asset for the account holding a deposit. + * - `dest`: The recipient of the transfer. + * - `keep_alive`: A boolean to determine if the `transfer_all` operation should send all + * of the funds the asset account has, causing the sender asset account to be killed + * (false), or transfer everything except at least the minimum balance, which will + * guarantee to keep the sender asset account alive (true). + **/ + transferAll: AugmentedSubmittable< + ( + id: Compact | AnyNumber | Uint8Array, + dest: AccountId20 | string | Uint8Array, + keepAlive: bool | boolean | Uint8Array + ) => SubmittableExtrinsic, + [Compact, AccountId20, bool] + >; /** * Transfer some asset balance from a previously delegated account to some third-party * account. @@ -1855,7 +1879,7 @@ declare module "@polkadot/api-base/types/submittable" { * - `max_fee`: The maximum fee that may be paid. This should just be auto-populated as: * * ```nocompile - * Self::registrars().get(reg_index).unwrap().fee + * Registrars::::get().get(reg_index).unwrap().fee * ``` * * Emits `JudgementRequested` if successful. @@ -2814,38 +2838,6 @@ declare module "@polkadot/api-base/types/submittable" { [key: string]: SubmittableExtrinsicFunction; }; parachainSystem: { - /** - * Authorize an upgrade to a given `code_hash` for the runtime. The runtime can be supplied - * later. - * - * The `check_version` parameter sets a boolean flag for whether or not the runtime's spec - * version and name should be verified on upgrade. Since the authorization only has a hash, - * it cannot actually perform the verification. - * - * This call requires Root origin. - **/ - authorizeUpgrade: AugmentedSubmittable< - ( - codeHash: H256 | string | Uint8Array, - checkVersion: bool | boolean | Uint8Array - ) => SubmittableExtrinsic, - [H256, bool] - >; - /** - * Provide the preimage (runtime binary) `code` for an upgrade that has been authorized. - * - * If the authorization required a version check, this call will ensure the spec name - * remains unchanged and that the spec version has increased. - * - * Note that this function will not apply the new `code`, but only attempt to schedule the - * upgrade with the Relay Chain. - * - * All origins are allowed. - **/ - enactAuthorizedUpgrade: AugmentedSubmittable< - (code: Bytes | string | Uint8Array) => SubmittableExtrinsic, - [Bytes] - >; /** * Set the current validation data. * diff --git a/typescript-api/src/moonbase/interfaces/lookup.ts b/typescript-api/src/moonbase/interfaces/lookup.ts index 90f6f38905..2e32b0983b 100644 --- a/typescript-api/src/moonbase/interfaces/lookup.ts +++ b/typescript-api/src/moonbase/interfaces/lookup.ts @@ -2287,11 +2287,39 @@ export default { PalletConvictionVotingEvent: { _enum: { Delegated: "(AccountId20,AccountId20)", - Undelegated: "AccountId20" + Undelegated: "AccountId20", + Voted: { + who: "AccountId20", + vote: "PalletConvictionVotingVoteAccountVote" + }, + VoteRemoved: { + who: "AccountId20", + vote: "PalletConvictionVotingVoteAccountVote" + } + } + }, + /** + * Lookup172: pallet_conviction_voting::vote::AccountVote + **/ + PalletConvictionVotingVoteAccountVote: { + _enum: { + Standard: { + vote: "Vote", + balance: "u128" + }, + Split: { + aye: "u128", + nay: "u128" + }, + SplitAbstain: { + aye: "u128", + nay: "u128", + abstain: "u128" + } } }, /** - * Lookup172: pallet_referenda::pallet::Event + * Lookup174: pallet_referenda::pallet::Event **/ PalletReferendaEvent: { _enum: { @@ -2371,7 +2399,7 @@ export default { } }, /** - * Lookup173: frame_support::traits::preimages::Bounded + * Lookup175: frame_support::traits::preimages::Bounded **/ FrameSupportPreimagesBounded: { _enum: { @@ -2392,7 +2420,7 @@ export default { } }, /** - * Lookup175: frame_system::pallet::Call + * Lookup177: frame_system::pallet::Call **/ FrameSystemCall: { _enum: { @@ -2437,7 +2465,7 @@ export default { } }, /** - * Lookup179: pallet_utility::pallet::Call + * Lookup181: pallet_utility::pallet::Call **/ PalletUtilityCall: { _enum: { @@ -2465,7 +2493,7 @@ export default { } }, /** - * Lookup181: moonbase_runtime::OriginCaller + * Lookup183: moonbase_runtime::OriginCaller **/ MoonbaseRuntimeOriginCaller: { _enum: { @@ -2519,7 +2547,7 @@ export default { } }, /** - * Lookup182: frame_support::dispatch::RawOrigin + * Lookup184: frame_support::dispatch::RawOrigin **/ FrameSupportDispatchRawOrigin: { _enum: { @@ -2529,7 +2557,7 @@ export default { } }, /** - * Lookup183: pallet_ethereum::RawOrigin + * Lookup185: pallet_ethereum::RawOrigin **/ PalletEthereumRawOrigin: { _enum: { @@ -2537,7 +2565,7 @@ export default { } }, /** - * Lookup184: cumulus_pallet_xcm::pallet::Origin + * Lookup186: cumulus_pallet_xcm::pallet::Origin **/ CumulusPalletXcmOrigin: { _enum: { @@ -2546,7 +2574,7 @@ export default { } }, /** - * Lookup185: pallet_xcm::pallet::Origin + * Lookup187: pallet_xcm::pallet::Origin **/ PalletXcmOrigin: { _enum: { @@ -2555,7 +2583,7 @@ export default { } }, /** - * Lookup186: pallet_ethereum_xcm::RawOrigin + * Lookup188: pallet_ethereum_xcm::RawOrigin **/ PalletEthereumXcmRawOrigin: { _enum: { @@ -2563,7 +2591,7 @@ export default { } }, /** - * Lookup187: pallet_collective::RawOrigin + * Lookup189: pallet_collective::RawOrigin **/ PalletCollectiveRawOrigin: { _enum: { @@ -2573,7 +2601,7 @@ export default { } }, /** - * Lookup188: moonbase_runtime::governance::origins::custom_origins::Origin + * Lookup190: moonbase_runtime::governance::origins::custom_origins::Origin **/ MoonbaseRuntimeGovernanceOriginsCustomOriginsOrigin: { _enum: [ @@ -2585,11 +2613,11 @@ export default { ] }, /** - * Lookup190: sp_core::Void + * Lookup192: sp_core::Void **/ SpCoreVoid: "Null", /** - * Lookup191: pallet_timestamp::pallet::Call + * Lookup193: pallet_timestamp::pallet::Call **/ PalletTimestampCall: { _enum: { @@ -2599,7 +2627,7 @@ export default { } }, /** - * Lookup192: pallet_balances::pallet::Call + * Lookup194: pallet_balances::pallet::Call **/ PalletBalancesCall: { _enum: { @@ -2644,13 +2672,13 @@ export default { } }, /** - * Lookup194: pallet_balances::types::AdjustmentDirection + * Lookup196: pallet_balances::types::AdjustmentDirection **/ PalletBalancesAdjustmentDirection: { _enum: ["Increase", "Decrease"] }, /** - * Lookup195: pallet_sudo::pallet::Call + * Lookup197: pallet_sudo::pallet::Call **/ PalletSudoCall: { _enum: { @@ -2675,7 +2703,7 @@ export default { } }, /** - * Lookup196: cumulus_pallet_parachain_system::pallet::Call + * Lookup198: cumulus_pallet_parachain_system::pallet::Call **/ CumulusPalletParachainSystemCall: { _enum: { @@ -2684,56 +2712,49 @@ export default { }, sudo_send_upward_message: { message: "Bytes" - }, - authorize_upgrade: { - codeHash: "H256", - checkVersion: "bool" - }, - enact_authorized_upgrade: { - code: "Bytes" } } }, /** - * Lookup197: cumulus_primitives_parachain_inherent::ParachainInherentData + * Lookup199: cumulus_primitives_parachain_inherent::ParachainInherentData **/ CumulusPrimitivesParachainInherentParachainInherentData: { - validationData: "PolkadotPrimitivesV7PersistedValidationData", + validationData: "PolkadotPrimitivesV8PersistedValidationData", relayChainState: "SpTrieStorageProof", downwardMessages: "Vec", horizontalMessages: "BTreeMap>" }, /** - * Lookup198: polkadot_primitives::v7::PersistedValidationData + * Lookup200: polkadot_primitives::v8::PersistedValidationData **/ - PolkadotPrimitivesV7PersistedValidationData: { + PolkadotPrimitivesV8PersistedValidationData: { parentHead: "Bytes", relayParentNumber: "u32", relayParentStorageRoot: "H256", maxPovSize: "u32" }, /** - * Lookup200: sp_trie::storage_proof::StorageProof + * Lookup202: sp_trie::storage_proof::StorageProof **/ SpTrieStorageProof: { trieNodes: "BTreeSet" }, /** - * Lookup203: polkadot_core_primitives::InboundDownwardMessage + * Lookup205: polkadot_core_primitives::InboundDownwardMessage **/ PolkadotCorePrimitivesInboundDownwardMessage: { sentAt: "u32", msg: "Bytes" }, /** - * Lookup206: polkadot_core_primitives::InboundHrmpMessage + * Lookup208: polkadot_core_primitives::InboundHrmpMessage **/ PolkadotCorePrimitivesInboundHrmpMessage: { sentAt: "u32", data: "Bytes" }, /** - * Lookup209: pallet_evm::pallet::Call + * Lookup211: pallet_evm::pallet::Call **/ PalletEvmCall: { _enum: { @@ -2776,7 +2797,7 @@ export default { } }, /** - * Lookup215: pallet_ethereum::pallet::Call + * Lookup217: pallet_ethereum::pallet::Call **/ PalletEthereumCall: { _enum: { @@ -2786,7 +2807,7 @@ export default { } }, /** - * Lookup216: ethereum::transaction::TransactionV2 + * Lookup218: ethereum::transaction::TransactionV2 **/ EthereumTransactionTransactionV2: { _enum: { @@ -2796,7 +2817,7 @@ export default { } }, /** - * Lookup217: ethereum::transaction::LegacyTransaction + * Lookup219: ethereum::transaction::LegacyTransaction **/ EthereumTransactionLegacyTransaction: { nonce: "U256", @@ -2808,7 +2829,7 @@ export default { signature: "EthereumTransactionTransactionSignature" }, /** - * Lookup218: ethereum::transaction::TransactionAction + * Lookup220: ethereum::transaction::TransactionAction **/ EthereumTransactionTransactionAction: { _enum: { @@ -2817,7 +2838,7 @@ export default { } }, /** - * Lookup219: ethereum::transaction::TransactionSignature + * Lookup221: ethereum::transaction::TransactionSignature **/ EthereumTransactionTransactionSignature: { v: "u64", @@ -2825,7 +2846,7 @@ export default { s: "H256" }, /** - * Lookup221: ethereum::transaction::EIP2930Transaction + * Lookup223: ethereum::transaction::EIP2930Transaction **/ EthereumTransactionEip2930Transaction: { chainId: "u64", @@ -2841,14 +2862,14 @@ export default { s: "H256" }, /** - * Lookup223: ethereum::transaction::AccessListItem + * Lookup225: ethereum::transaction::AccessListItem **/ EthereumTransactionAccessListItem: { address: "H160", storageKeys: "Vec" }, /** - * Lookup224: ethereum::transaction::EIP1559Transaction + * Lookup226: ethereum::transaction::EIP1559Transaction **/ EthereumTransactionEip1559Transaction: { chainId: "u64", @@ -2865,7 +2886,7 @@ export default { s: "H256" }, /** - * Lookup225: pallet_parachain_staking::pallet::Call + * Lookup227: pallet_parachain_staking::pallet::Call **/ PalletParachainStakingCall: { _enum: { @@ -3003,7 +3024,7 @@ export default { } }, /** - * Lookup228: pallet_scheduler::pallet::Call + * Lookup230: pallet_scheduler::pallet::Call **/ PalletSchedulerCall: { _enum: { @@ -3059,7 +3080,7 @@ export default { } }, /** - * Lookup230: pallet_treasury::pallet::Call + * Lookup232: pallet_treasury::pallet::Call **/ PalletTreasuryCall: { _enum: { @@ -3091,13 +3112,13 @@ export default { } }, /** - * Lookup232: pallet_author_inherent::pallet::Call + * Lookup234: pallet_author_inherent::pallet::Call **/ PalletAuthorInherentCall: { _enum: ["kick_off_authorship_validation"] }, /** - * Lookup233: pallet_author_slot_filter::pallet::Call + * Lookup235: pallet_author_slot_filter::pallet::Call **/ PalletAuthorSlotFilterCall: { _enum: { @@ -3110,7 +3131,7 @@ export default { } }, /** - * Lookup234: pallet_crowdloan_rewards::pallet::Call + * Lookup236: pallet_crowdloan_rewards::pallet::Call **/ PalletCrowdloanRewardsCall: { _enum: { @@ -3137,7 +3158,7 @@ export default { } }, /** - * Lookup235: sp_runtime::MultiSignature + * Lookup237: sp_runtime::MultiSignature **/ SpRuntimeMultiSignature: { _enum: { @@ -3147,7 +3168,7 @@ export default { } }, /** - * Lookup242: pallet_author_mapping::pallet::Call + * Lookup244: pallet_author_mapping::pallet::Call **/ PalletAuthorMappingCall: { _enum: { @@ -3171,7 +3192,7 @@ export default { } }, /** - * Lookup243: pallet_proxy::pallet::Call + * Lookup245: pallet_proxy::pallet::Call **/ PalletProxyCall: { _enum: { @@ -3224,13 +3245,13 @@ export default { } }, /** - * Lookup245: pallet_maintenance_mode::pallet::Call + * Lookup247: pallet_maintenance_mode::pallet::Call **/ PalletMaintenanceModeCall: { _enum: ["enter_maintenance_mode", "resume_normal_operation"] }, /** - * Lookup246: pallet_identity::pallet::Call + * Lookup248: pallet_identity::pallet::Call **/ PalletIdentityCall: { _enum: { @@ -3315,7 +3336,7 @@ export default { } }, /** - * Lookup247: pallet_identity::legacy::IdentityInfo + * Lookup249: pallet_identity::legacy::IdentityInfo **/ PalletIdentityLegacyIdentityInfo: { additional: "Vec<(Data,Data)>", @@ -3329,7 +3350,7 @@ export default { twitter: "Data" }, /** - * Lookup283: pallet_identity::types::Judgement + * Lookup285: pallet_identity::types::Judgement **/ PalletIdentityJudgement: { _enum: { @@ -3343,11 +3364,11 @@ export default { } }, /** - * Lookup285: account::EthereumSignature + * Lookup287: account::EthereumSignature **/ AccountEthereumSignature: "[u8;65]", /** - * Lookup286: cumulus_pallet_xcmp_queue::pallet::Call + * Lookup288: cumulus_pallet_xcmp_queue::pallet::Call **/ CumulusPalletXcmpQueueCall: { _enum: { @@ -3375,7 +3396,7 @@ export default { } }, /** - * Lookup287: pallet_xcm::pallet::Call + * Lookup289: pallet_xcm::pallet::Call **/ PalletXcmCall: { _enum: { @@ -3452,7 +3473,7 @@ export default { } }, /** - * Lookup288: xcm::VersionedXcm + * Lookup290: xcm::VersionedXcm **/ XcmVersionedXcm: { _enum: { @@ -3464,11 +3485,11 @@ export default { } }, /** - * Lookup289: xcm::v2::Xcm + * Lookup291: xcm::v2::Xcm **/ XcmV2Xcm: "Vec", /** - * Lookup291: xcm::v2::Instruction + * Lookup293: xcm::v2::Instruction **/ XcmV2Instruction: { _enum: { @@ -3566,7 +3587,7 @@ export default { } }, /** - * Lookup292: xcm::v2::Response + * Lookup294: xcm::v2::Response **/ XcmV2Response: { _enum: { @@ -3577,7 +3598,7 @@ export default { } }, /** - * Lookup295: xcm::v2::traits::Error + * Lookup297: xcm::v2::traits::Error **/ XcmV2TraitsError: { _enum: { @@ -3610,13 +3631,13 @@ export default { } }, /** - * Lookup296: xcm::v2::OriginKind + * Lookup298: xcm::v2::OriginKind **/ XcmV2OriginKind: { _enum: ["Native", "SovereignAccount", "Superuser", "Xcm"] }, /** - * Lookup297: xcm::v2::multiasset::MultiAssetFilter + * Lookup299: xcm::v2::multiasset::MultiAssetFilter **/ XcmV2MultiassetMultiAssetFilter: { _enum: { @@ -3625,7 +3646,7 @@ export default { } }, /** - * Lookup298: xcm::v2::multiasset::WildMultiAsset + * Lookup300: xcm::v2::multiasset::WildMultiAsset **/ XcmV2MultiassetWildMultiAsset: { _enum: { @@ -3637,13 +3658,13 @@ export default { } }, /** - * Lookup299: xcm::v2::multiasset::WildFungibility + * Lookup301: xcm::v2::multiasset::WildFungibility **/ XcmV2MultiassetWildFungibility: { _enum: ["Fungible", "NonFungible"] }, /** - * Lookup300: xcm::v2::WeightLimit + * Lookup302: xcm::v2::WeightLimit **/ XcmV2WeightLimit: { _enum: { @@ -3652,11 +3673,11 @@ export default { } }, /** - * Lookup301: xcm::v3::Xcm + * Lookup303: xcm::v3::Xcm **/ XcmV3Xcm: "Vec", /** - * Lookup303: xcm::v3::Instruction + * Lookup305: xcm::v3::Instruction **/ XcmV3Instruction: { _enum: { @@ -3798,7 +3819,7 @@ export default { } }, /** - * Lookup304: xcm::v3::Response + * Lookup306: xcm::v3::Response **/ XcmV3Response: { _enum: { @@ -3811,7 +3832,7 @@ export default { } }, /** - * Lookup306: xcm::v3::PalletInfo + * Lookup308: xcm::v3::PalletInfo **/ XcmV3PalletInfo: { index: "Compact", @@ -3822,7 +3843,7 @@ export default { patch: "Compact" }, /** - * Lookup310: xcm::v3::QueryResponseInfo + * Lookup312: xcm::v3::QueryResponseInfo **/ XcmV3QueryResponseInfo: { destination: "StagingXcmV3MultiLocation", @@ -3830,7 +3851,7 @@ export default { maxWeight: "SpWeightsWeightV2Weight" }, /** - * Lookup311: xcm::v3::multiasset::MultiAssetFilter + * Lookup313: xcm::v3::multiasset::MultiAssetFilter **/ XcmV3MultiassetMultiAssetFilter: { _enum: { @@ -3839,7 +3860,7 @@ export default { } }, /** - * Lookup312: xcm::v3::multiasset::WildMultiAsset + * Lookup314: xcm::v3::multiasset::WildMultiAsset **/ XcmV3MultiassetWildMultiAsset: { _enum: { @@ -3857,13 +3878,13 @@ export default { } }, /** - * Lookup313: xcm::v3::multiasset::WildFungibility + * Lookup315: xcm::v3::multiasset::WildFungibility **/ XcmV3MultiassetWildFungibility: { _enum: ["Fungible", "NonFungible"] }, /** - * Lookup325: staging_xcm_executor::traits::asset_transfer::TransferType + * Lookup327: staging_xcm_executor::traits::asset_transfer::TransferType **/ StagingXcmExecutorAssetTransferTransferType: { _enum: { @@ -3874,7 +3895,7 @@ export default { } }, /** - * Lookup326: xcm::VersionedAssetId + * Lookup328: xcm::VersionedAssetId **/ XcmVersionedAssetId: { _enum: { @@ -3886,7 +3907,7 @@ export default { } }, /** - * Lookup327: pallet_assets::pallet::Call + * Lookup329: pallet_assets::pallet::Call **/ PalletAssetsCall: { _enum: { @@ -4034,11 +4055,16 @@ export default { block: { id: "Compact", who: "AccountId20" + }, + transfer_all: { + id: "Compact", + dest: "AccountId20", + keepAlive: "bool" } } }, /** - * Lookup328: pallet_asset_manager::pallet::Call + * Lookup330: pallet_asset_manager::pallet::Call **/ PalletAssetManagerCall: { _enum: { @@ -4067,7 +4093,7 @@ export default { } }, /** - * Lookup329: pallet_xcm_transactor::pallet::Call + * Lookup331: pallet_xcm_transactor::pallet::Call **/ PalletXcmTransactorCall: { _enum: { @@ -4126,20 +4152,20 @@ export default { } }, /** - * Lookup330: moonbase_runtime::xcm_config::Transactors + * Lookup332: moonbase_runtime::xcm_config::Transactors **/ MoonbaseRuntimeXcmConfigTransactors: { _enum: ["Relay"] }, /** - * Lookup331: pallet_xcm_transactor::pallet::CurrencyPayment + * Lookup333: pallet_xcm_transactor::pallet::CurrencyPayment **/ PalletXcmTransactorCurrencyPayment: { currency: "PalletXcmTransactorCurrency", feeAmount: "Option" }, /** - * Lookup332: moonbase_runtime::xcm_config::CurrencyId + * Lookup334: moonbase_runtime::xcm_config::CurrencyId **/ MoonbaseRuntimeXcmConfigCurrencyId: { _enum: { @@ -4151,7 +4177,7 @@ export default { } }, /** - * Lookup333: pallet_xcm_transactor::pallet::Currency + * Lookup335: pallet_xcm_transactor::pallet::Currency **/ PalletXcmTransactorCurrency: { _enum: { @@ -4160,14 +4186,14 @@ export default { } }, /** - * Lookup335: pallet_xcm_transactor::pallet::TransactWeights + * Lookup337: pallet_xcm_transactor::pallet::TransactWeights **/ PalletXcmTransactorTransactWeights: { transactRequiredWeightAtMost: "SpWeightsWeightV2Weight", overallWeight: "Option" }, /** - * Lookup337: pallet_moonbeam_orbiters::pallet::Call + * Lookup339: pallet_moonbeam_orbiters::pallet::Call **/ PalletMoonbeamOrbitersCall: { _enum: { @@ -4193,7 +4219,7 @@ export default { } }, /** - * Lookup338: pallet_ethereum_xcm::pallet::Call + * Lookup340: pallet_ethereum_xcm::pallet::Call **/ PalletEthereumXcmCall: { _enum: { @@ -4214,7 +4240,7 @@ export default { } }, /** - * Lookup339: xcm_primitives::ethereum_xcm::EthereumXcmTransaction + * Lookup341: xcm_primitives::ethereum_xcm::EthereumXcmTransaction **/ XcmPrimitivesEthereumXcmEthereumXcmTransaction: { _enum: { @@ -4223,7 +4249,7 @@ export default { } }, /** - * Lookup340: xcm_primitives::ethereum_xcm::EthereumXcmTransactionV1 + * Lookup342: xcm_primitives::ethereum_xcm::EthereumXcmTransactionV1 **/ XcmPrimitivesEthereumXcmEthereumXcmTransactionV1: { gasLimit: "U256", @@ -4234,7 +4260,7 @@ export default { accessList: "Option)>>" }, /** - * Lookup341: xcm_primitives::ethereum_xcm::EthereumXcmFee + * Lookup343: xcm_primitives::ethereum_xcm::EthereumXcmFee **/ XcmPrimitivesEthereumXcmEthereumXcmFee: { _enum: { @@ -4243,14 +4269,14 @@ export default { } }, /** - * Lookup342: xcm_primitives::ethereum_xcm::ManualEthereumXcmFee + * Lookup344: xcm_primitives::ethereum_xcm::ManualEthereumXcmFee **/ XcmPrimitivesEthereumXcmManualEthereumXcmFee: { gasPrice: "Option", maxFeePerGas: "Option" }, /** - * Lookup345: xcm_primitives::ethereum_xcm::EthereumXcmTransactionV2 + * Lookup347: xcm_primitives::ethereum_xcm::EthereumXcmTransactionV2 **/ XcmPrimitivesEthereumXcmEthereumXcmTransactionV2: { gasLimit: "U256", @@ -4260,13 +4286,13 @@ export default { accessList: "Option)>>" }, /** - * Lookup347: pallet_randomness::pallet::Call + * Lookup349: pallet_randomness::pallet::Call **/ PalletRandomnessCall: { _enum: ["set_babe_randomness_results"] }, /** - * Lookup348: pallet_collective::pallet::Call + * Lookup350: pallet_collective::pallet::Call **/ PalletCollectiveCall: { _enum: { @@ -4302,7 +4328,7 @@ export default { } }, /** - * Lookup349: pallet_conviction_voting::pallet::Call + * Lookup351: pallet_conviction_voting::pallet::Call **/ PalletConvictionVotingCall: { _enum: { @@ -4334,26 +4360,6 @@ export default { } } }, - /** - * Lookup350: pallet_conviction_voting::vote::AccountVote - **/ - PalletConvictionVotingVoteAccountVote: { - _enum: { - Standard: { - vote: "Vote", - balance: "u128" - }, - Split: { - aye: "u128", - nay: "u128" - }, - SplitAbstain: { - aye: "u128", - nay: "u128", - abstain: "u128" - } - } - }, /** * Lookup352: pallet_conviction_voting::conviction::Conviction **/ @@ -5143,7 +5149,7 @@ export default { CumulusPalletParachainSystemUnincludedSegmentAncestor: { usedBandwidth: "CumulusPalletParachainSystemUnincludedSegmentUsedBandwidth", paraHeadHash: "Option", - consumedGoAheadSignal: "Option" + consumedGoAheadSignal: "Option" }, /** * Lookup441: cumulus_pallet_parachain_system::unincluded_segment::UsedBandwidth @@ -5161,9 +5167,9 @@ export default { totalBytes: "u32" }, /** - * Lookup447: polkadot_primitives::v7::UpgradeGoAhead + * Lookup447: polkadot_primitives::v8::UpgradeGoAhead **/ - PolkadotPrimitivesV7UpgradeGoAhead: { + PolkadotPrimitivesV8UpgradeGoAhead: { _enum: ["Abort", "GoAhead"] }, /** @@ -5172,12 +5178,12 @@ export default { CumulusPalletParachainSystemUnincludedSegmentSegmentTracker: { usedBandwidth: "CumulusPalletParachainSystemUnincludedSegmentUsedBandwidth", hrmpWatermark: "Option", - consumedGoAheadSignal: "Option" + consumedGoAheadSignal: "Option" }, /** - * Lookup450: polkadot_primitives::v7::UpgradeRestriction + * Lookup450: polkadot_primitives::v8::UpgradeRestriction **/ - PolkadotPrimitivesV7UpgradeRestriction: { + PolkadotPrimitivesV8UpgradeRestriction: { _enum: ["Present"] }, /** @@ -5187,8 +5193,8 @@ export default { dmqMqcHead: "H256", relayDispatchQueueRemainingCapacity: "CumulusPalletParachainSystemRelayStateSnapshotRelayDispatchQueueRemainingCapacity", - ingressChannels: "Vec<(u32,PolkadotPrimitivesV7AbridgedHrmpChannel)>", - egressChannels: "Vec<(u32,PolkadotPrimitivesV7AbridgedHrmpChannel)>" + ingressChannels: "Vec<(u32,PolkadotPrimitivesV8AbridgedHrmpChannel)>", + egressChannels: "Vec<(u32,PolkadotPrimitivesV8AbridgedHrmpChannel)>" }, /** * Lookup452: cumulus_pallet_parachain_system::relay_state_snapshot::RelayDispatchQueueRemainingCapacity @@ -5198,9 +5204,9 @@ export default { remainingSize: "u32" }, /** - * Lookup455: polkadot_primitives::v7::AbridgedHrmpChannel + * Lookup455: polkadot_primitives::v8::AbridgedHrmpChannel **/ - PolkadotPrimitivesV7AbridgedHrmpChannel: { + PolkadotPrimitivesV8AbridgedHrmpChannel: { maxCapacity: "u32", maxTotalSize: "u32", maxMessageSize: "u32", @@ -5209,9 +5215,9 @@ export default { mqcHead: "Option" }, /** - * Lookup456: polkadot_primitives::v7::AbridgedHostConfiguration + * Lookup456: polkadot_primitives::v8::AbridgedHostConfiguration **/ - PolkadotPrimitivesV7AbridgedHostConfiguration: { + PolkadotPrimitivesV8AbridgedHostConfiguration: { maxCodeSize: "u32", maxHeadDataSize: "u32", maxUpwardQueueCount: "u32", @@ -5221,12 +5227,12 @@ export default { hrmpMaxMessageNumPerCandidate: "u32", validationUpgradeCooldown: "u32", validationUpgradeDelay: "u32", - asyncBackingParams: "PolkadotPrimitivesV7AsyncBackingAsyncBackingParams" + asyncBackingParams: "PolkadotPrimitivesV8AsyncBackingAsyncBackingParams" }, /** - * Lookup457: polkadot_primitives::v7::async_backing::AsyncBackingParams + * Lookup457: polkadot_primitives::v8::async_backing::AsyncBackingParams **/ - PolkadotPrimitivesV7AsyncBackingAsyncBackingParams: { + PolkadotPrimitivesV8AsyncBackingAsyncBackingParams: { maxCandidateDepth: "u32", allowedAncestryLen: "u32" }, @@ -6435,8 +6441,7 @@ export default { "Requested", "NotRequested", "TooMany", - "TooFew", - "NoCost" + "TooFew" ] }, /** @@ -6517,7 +6522,6 @@ export default { "LimitCannotBeZero", "ContractMetadataAlreadySet", "ContractNotExist", - "KeyTooLong", "SymbolTooLong", "NameTooLong", "AssetTypeNotFound", diff --git a/typescript-api/src/moonbase/interfaces/registry.ts b/typescript-api/src/moonbase/interfaces/registry.ts index e7ead8168c..47c0652062 100644 --- a/typescript-api/src/moonbase/interfaces/registry.ts +++ b/typescript-api/src/moonbase/interfaces/registry.ts @@ -310,12 +310,12 @@ import type { PolkadotCorePrimitivesInboundHrmpMessage, PolkadotCorePrimitivesOutboundHrmpMessage, PolkadotParachainPrimitivesPrimitivesHrmpChannelId, - PolkadotPrimitivesV7AbridgedHostConfiguration, - PolkadotPrimitivesV7AbridgedHrmpChannel, - PolkadotPrimitivesV7AsyncBackingAsyncBackingParams, - PolkadotPrimitivesV7PersistedValidationData, - PolkadotPrimitivesV7UpgradeGoAhead, - PolkadotPrimitivesV7UpgradeRestriction, + PolkadotPrimitivesV8AbridgedHostConfiguration, + PolkadotPrimitivesV8AbridgedHrmpChannel, + PolkadotPrimitivesV8AsyncBackingAsyncBackingParams, + PolkadotPrimitivesV8PersistedValidationData, + PolkadotPrimitivesV8UpgradeGoAhead, + PolkadotPrimitivesV8UpgradeRestriction, SessionKeysPrimitivesVrfVrfCryptoPublic, SpArithmeticArithmeticError, SpCoreVoid, @@ -713,12 +713,12 @@ declare module "@polkadot/types/types/registry" { PolkadotCorePrimitivesInboundHrmpMessage: PolkadotCorePrimitivesInboundHrmpMessage; PolkadotCorePrimitivesOutboundHrmpMessage: PolkadotCorePrimitivesOutboundHrmpMessage; PolkadotParachainPrimitivesPrimitivesHrmpChannelId: PolkadotParachainPrimitivesPrimitivesHrmpChannelId; - PolkadotPrimitivesV7AbridgedHostConfiguration: PolkadotPrimitivesV7AbridgedHostConfiguration; - PolkadotPrimitivesV7AbridgedHrmpChannel: PolkadotPrimitivesV7AbridgedHrmpChannel; - PolkadotPrimitivesV7AsyncBackingAsyncBackingParams: PolkadotPrimitivesV7AsyncBackingAsyncBackingParams; - PolkadotPrimitivesV7PersistedValidationData: PolkadotPrimitivesV7PersistedValidationData; - PolkadotPrimitivesV7UpgradeGoAhead: PolkadotPrimitivesV7UpgradeGoAhead; - PolkadotPrimitivesV7UpgradeRestriction: PolkadotPrimitivesV7UpgradeRestriction; + PolkadotPrimitivesV8AbridgedHostConfiguration: PolkadotPrimitivesV8AbridgedHostConfiguration; + PolkadotPrimitivesV8AbridgedHrmpChannel: PolkadotPrimitivesV8AbridgedHrmpChannel; + PolkadotPrimitivesV8AsyncBackingAsyncBackingParams: PolkadotPrimitivesV8AsyncBackingAsyncBackingParams; + PolkadotPrimitivesV8PersistedValidationData: PolkadotPrimitivesV8PersistedValidationData; + PolkadotPrimitivesV8UpgradeGoAhead: PolkadotPrimitivesV8UpgradeGoAhead; + PolkadotPrimitivesV8UpgradeRestriction: PolkadotPrimitivesV8UpgradeRestriction; SessionKeysPrimitivesVrfVrfCryptoPublic: SessionKeysPrimitivesVrfVrfCryptoPublic; SpArithmeticArithmeticError: SpArithmeticArithmeticError; SpCoreVoid: SpCoreVoid; diff --git a/typescript-api/src/moonbase/interfaces/types-lookup.ts b/typescript-api/src/moonbase/interfaces/types-lookup.ts index e62a24ce3e..8cfe6ee3cc 100644 --- a/typescript-api/src/moonbase/interfaces/types-lookup.ts +++ b/typescript-api/src/moonbase/interfaces/types-lookup.ts @@ -3019,10 +3019,41 @@ declare module "@polkadot/types/lookup" { readonly asDelegated: ITuple<[AccountId20, AccountId20]>; readonly isUndelegated: boolean; readonly asUndelegated: AccountId20; - readonly type: "Delegated" | "Undelegated"; + readonly isVoted: boolean; + readonly asVoted: { + readonly who: AccountId20; + readonly vote: PalletConvictionVotingVoteAccountVote; + } & Struct; + readonly isVoteRemoved: boolean; + readonly asVoteRemoved: { + readonly who: AccountId20; + readonly vote: PalletConvictionVotingVoteAccountVote; + } & Struct; + readonly type: "Delegated" | "Undelegated" | "Voted" | "VoteRemoved"; + } + + /** @name PalletConvictionVotingVoteAccountVote (172) */ + interface PalletConvictionVotingVoteAccountVote extends Enum { + readonly isStandard: boolean; + readonly asStandard: { + readonly vote: Vote; + readonly balance: u128; + } & Struct; + readonly isSplit: boolean; + readonly asSplit: { + readonly aye: u128; + readonly nay: u128; + } & Struct; + readonly isSplitAbstain: boolean; + readonly asSplitAbstain: { + readonly aye: u128; + readonly nay: u128; + readonly abstain: u128; + } & Struct; + readonly type: "Standard" | "Split" | "SplitAbstain"; } - /** @name PalletReferendaEvent (172) */ + /** @name PalletReferendaEvent (174) */ interface PalletReferendaEvent extends Enum { readonly isSubmitted: boolean; readonly asSubmitted: { @@ -3126,7 +3157,7 @@ declare module "@polkadot/types/lookup" { | "MetadataCleared"; } - /** @name FrameSupportPreimagesBounded (173) */ + /** @name FrameSupportPreimagesBounded (175) */ interface FrameSupportPreimagesBounded extends Enum { readonly isLegacy: boolean; readonly asLegacy: { @@ -3142,7 +3173,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Legacy" | "Inline" | "Lookup"; } - /** @name FrameSystemCall (175) */ + /** @name FrameSystemCall (177) */ interface FrameSystemCall extends Enum { readonly isRemark: boolean; readonly asRemark: { @@ -3203,7 +3234,7 @@ declare module "@polkadot/types/lookup" { | "ApplyAuthorizedUpgrade"; } - /** @name PalletUtilityCall (179) */ + /** @name PalletUtilityCall (181) */ interface PalletUtilityCall extends Enum { readonly isBatch: boolean; readonly asBatch: { @@ -3241,7 +3272,7 @@ declare module "@polkadot/types/lookup" { | "WithWeight"; } - /** @name MoonbaseRuntimeOriginCaller (181) */ + /** @name MoonbaseRuntimeOriginCaller (183) */ interface MoonbaseRuntimeOriginCaller extends Enum { readonly isSystem: boolean; readonly asSystem: FrameSupportDispatchRawOrigin; @@ -3272,7 +3303,7 @@ declare module "@polkadot/types/lookup" { | "OpenTechCommitteeCollective"; } - /** @name FrameSupportDispatchRawOrigin (182) */ + /** @name FrameSupportDispatchRawOrigin (184) */ interface FrameSupportDispatchRawOrigin extends Enum { readonly isRoot: boolean; readonly isSigned: boolean; @@ -3281,14 +3312,14 @@ declare module "@polkadot/types/lookup" { readonly type: "Root" | "Signed" | "None"; } - /** @name PalletEthereumRawOrigin (183) */ + /** @name PalletEthereumRawOrigin (185) */ interface PalletEthereumRawOrigin extends Enum { readonly isEthereumTransaction: boolean; readonly asEthereumTransaction: H160; readonly type: "EthereumTransaction"; } - /** @name CumulusPalletXcmOrigin (184) */ + /** @name CumulusPalletXcmOrigin (186) */ interface CumulusPalletXcmOrigin extends Enum { readonly isRelay: boolean; readonly isSiblingParachain: boolean; @@ -3296,7 +3327,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Relay" | "SiblingParachain"; } - /** @name PalletXcmOrigin (185) */ + /** @name PalletXcmOrigin (187) */ interface PalletXcmOrigin extends Enum { readonly isXcm: boolean; readonly asXcm: StagingXcmV4Location; @@ -3305,14 +3336,14 @@ declare module "@polkadot/types/lookup" { readonly type: "Xcm" | "Response"; } - /** @name PalletEthereumXcmRawOrigin (186) */ + /** @name PalletEthereumXcmRawOrigin (188) */ interface PalletEthereumXcmRawOrigin extends Enum { readonly isXcmEthereumTransaction: boolean; readonly asXcmEthereumTransaction: H160; readonly type: "XcmEthereumTransaction"; } - /** @name PalletCollectiveRawOrigin (187) */ + /** @name PalletCollectiveRawOrigin (189) */ interface PalletCollectiveRawOrigin extends Enum { readonly isMembers: boolean; readonly asMembers: ITuple<[u32, u32]>; @@ -3322,7 +3353,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Members" | "Member" | "Phantom"; } - /** @name MoonbaseRuntimeGovernanceOriginsCustomOriginsOrigin (188) */ + /** @name MoonbaseRuntimeGovernanceOriginsCustomOriginsOrigin (190) */ interface MoonbaseRuntimeGovernanceOriginsCustomOriginsOrigin extends Enum { readonly isWhitelistedCaller: boolean; readonly isGeneralAdmin: boolean; @@ -3337,10 +3368,10 @@ declare module "@polkadot/types/lookup" { | "FastGeneralAdmin"; } - /** @name SpCoreVoid (190) */ + /** @name SpCoreVoid (192) */ type SpCoreVoid = Null; - /** @name PalletTimestampCall (191) */ + /** @name PalletTimestampCall (193) */ interface PalletTimestampCall extends Enum { readonly isSet: boolean; readonly asSet: { @@ -3349,7 +3380,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Set"; } - /** @name PalletBalancesCall (192) */ + /** @name PalletBalancesCall (194) */ interface PalletBalancesCall extends Enum { readonly isTransferAllowDeath: boolean; readonly asTransferAllowDeath: { @@ -3408,14 +3439,14 @@ declare module "@polkadot/types/lookup" { | "Burn"; } - /** @name PalletBalancesAdjustmentDirection (194) */ + /** @name PalletBalancesAdjustmentDirection (196) */ interface PalletBalancesAdjustmentDirection extends Enum { readonly isIncrease: boolean; readonly isDecrease: boolean; readonly type: "Increase" | "Decrease"; } - /** @name PalletSudoCall (195) */ + /** @name PalletSudoCall (197) */ interface PalletSudoCall extends Enum { readonly isSudo: boolean; readonly asSudo: { @@ -3439,7 +3470,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Sudo" | "SudoUncheckedWeight" | "SetKey" | "SudoAs" | "RemoveKey"; } - /** @name CumulusPalletParachainSystemCall (196) */ + /** @name CumulusPalletParachainSystemCall (198) */ interface CumulusPalletParachainSystemCall extends Enum { readonly isSetValidationData: boolean; readonly asSetValidationData: { @@ -3449,56 +3480,43 @@ declare module "@polkadot/types/lookup" { readonly asSudoSendUpwardMessage: { readonly message: Bytes; } & Struct; - readonly isAuthorizeUpgrade: boolean; - readonly asAuthorizeUpgrade: { - readonly codeHash: H256; - readonly checkVersion: bool; - } & Struct; - readonly isEnactAuthorizedUpgrade: boolean; - readonly asEnactAuthorizedUpgrade: { - readonly code: Bytes; - } & Struct; - readonly type: - | "SetValidationData" - | "SudoSendUpwardMessage" - | "AuthorizeUpgrade" - | "EnactAuthorizedUpgrade"; + readonly type: "SetValidationData" | "SudoSendUpwardMessage"; } - /** @name CumulusPrimitivesParachainInherentParachainInherentData (197) */ + /** @name CumulusPrimitivesParachainInherentParachainInherentData (199) */ interface CumulusPrimitivesParachainInherentParachainInherentData extends Struct { - readonly validationData: PolkadotPrimitivesV7PersistedValidationData; + readonly validationData: PolkadotPrimitivesV8PersistedValidationData; readonly relayChainState: SpTrieStorageProof; readonly downwardMessages: Vec; readonly horizontalMessages: BTreeMap>; } - /** @name PolkadotPrimitivesV7PersistedValidationData (198) */ - interface PolkadotPrimitivesV7PersistedValidationData extends Struct { + /** @name PolkadotPrimitivesV8PersistedValidationData (200) */ + interface PolkadotPrimitivesV8PersistedValidationData extends Struct { readonly parentHead: Bytes; readonly relayParentNumber: u32; readonly relayParentStorageRoot: H256; readonly maxPovSize: u32; } - /** @name SpTrieStorageProof (200) */ + /** @name SpTrieStorageProof (202) */ interface SpTrieStorageProof extends Struct { readonly trieNodes: BTreeSet; } - /** @name PolkadotCorePrimitivesInboundDownwardMessage (203) */ + /** @name PolkadotCorePrimitivesInboundDownwardMessage (205) */ interface PolkadotCorePrimitivesInboundDownwardMessage extends Struct { readonly sentAt: u32; readonly msg: Bytes; } - /** @name PolkadotCorePrimitivesInboundHrmpMessage (206) */ + /** @name PolkadotCorePrimitivesInboundHrmpMessage (208) */ interface PolkadotCorePrimitivesInboundHrmpMessage extends Struct { readonly sentAt: u32; readonly data: Bytes; } - /** @name PalletEvmCall (209) */ + /** @name PalletEvmCall (211) */ interface PalletEvmCall extends Enum { readonly isWithdraw: boolean; readonly asWithdraw: { @@ -3543,7 +3561,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Withdraw" | "Call" | "Create" | "Create2"; } - /** @name PalletEthereumCall (215) */ + /** @name PalletEthereumCall (217) */ interface PalletEthereumCall extends Enum { readonly isTransact: boolean; readonly asTransact: { @@ -3552,7 +3570,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Transact"; } - /** @name EthereumTransactionTransactionV2 (216) */ + /** @name EthereumTransactionTransactionV2 (218) */ interface EthereumTransactionTransactionV2 extends Enum { readonly isLegacy: boolean; readonly asLegacy: EthereumTransactionLegacyTransaction; @@ -3563,7 +3581,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Legacy" | "Eip2930" | "Eip1559"; } - /** @name EthereumTransactionLegacyTransaction (217) */ + /** @name EthereumTransactionLegacyTransaction (219) */ interface EthereumTransactionLegacyTransaction extends Struct { readonly nonce: U256; readonly gasPrice: U256; @@ -3574,7 +3592,7 @@ declare module "@polkadot/types/lookup" { readonly signature: EthereumTransactionTransactionSignature; } - /** @name EthereumTransactionTransactionAction (218) */ + /** @name EthereumTransactionTransactionAction (220) */ interface EthereumTransactionTransactionAction extends Enum { readonly isCall: boolean; readonly asCall: H160; @@ -3582,14 +3600,14 @@ declare module "@polkadot/types/lookup" { readonly type: "Call" | "Create"; } - /** @name EthereumTransactionTransactionSignature (219) */ + /** @name EthereumTransactionTransactionSignature (221) */ interface EthereumTransactionTransactionSignature extends Struct { readonly v: u64; readonly r: H256; readonly s: H256; } - /** @name EthereumTransactionEip2930Transaction (221) */ + /** @name EthereumTransactionEip2930Transaction (223) */ interface EthereumTransactionEip2930Transaction extends Struct { readonly chainId: u64; readonly nonce: U256; @@ -3604,13 +3622,13 @@ declare module "@polkadot/types/lookup" { readonly s: H256; } - /** @name EthereumTransactionAccessListItem (223) */ + /** @name EthereumTransactionAccessListItem (225) */ interface EthereumTransactionAccessListItem extends Struct { readonly address: H160; readonly storageKeys: Vec; } - /** @name EthereumTransactionEip1559Transaction (224) */ + /** @name EthereumTransactionEip1559Transaction (226) */ interface EthereumTransactionEip1559Transaction extends Struct { readonly chainId: u64; readonly nonce: U256; @@ -3626,7 +3644,7 @@ declare module "@polkadot/types/lookup" { readonly s: H256; } - /** @name PalletParachainStakingCall (225) */ + /** @name PalletParachainStakingCall (227) */ interface PalletParachainStakingCall extends Enum { readonly isSetStakingExpectations: boolean; readonly asSetStakingExpectations: { @@ -3804,7 +3822,7 @@ declare module "@polkadot/types/lookup" { | "SetInflationDistributionConfig"; } - /** @name PalletSchedulerCall (228) */ + /** @name PalletSchedulerCall (230) */ interface PalletSchedulerCall extends Enum { readonly isSchedule: boolean; readonly asSchedule: { @@ -3878,7 +3896,7 @@ declare module "@polkadot/types/lookup" { | "CancelRetryNamed"; } - /** @name PalletTreasuryCall (230) */ + /** @name PalletTreasuryCall (232) */ interface PalletTreasuryCall extends Enum { readonly isSpendLocal: boolean; readonly asSpendLocal: { @@ -3917,13 +3935,13 @@ declare module "@polkadot/types/lookup" { | "VoidSpend"; } - /** @name PalletAuthorInherentCall (232) */ + /** @name PalletAuthorInherentCall (234) */ interface PalletAuthorInherentCall extends Enum { readonly isKickOffAuthorshipValidation: boolean; readonly type: "KickOffAuthorshipValidation"; } - /** @name PalletAuthorSlotFilterCall (233) */ + /** @name PalletAuthorSlotFilterCall (235) */ interface PalletAuthorSlotFilterCall extends Enum { readonly isSetEligible: boolean; readonly asSetEligible: { @@ -3932,7 +3950,7 @@ declare module "@polkadot/types/lookup" { readonly type: "SetEligible"; } - /** @name PalletCrowdloanRewardsCall (234) */ + /** @name PalletCrowdloanRewardsCall (236) */ interface PalletCrowdloanRewardsCall extends Enum { readonly isAssociateNativeIdentity: boolean; readonly asAssociateNativeIdentity: { @@ -3968,7 +3986,7 @@ declare module "@polkadot/types/lookup" { | "InitializeRewardVec"; } - /** @name SpRuntimeMultiSignature (235) */ + /** @name SpRuntimeMultiSignature (237) */ interface SpRuntimeMultiSignature extends Enum { readonly isEd25519: boolean; readonly asEd25519: U8aFixed; @@ -3979,7 +3997,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Ed25519" | "Sr25519" | "Ecdsa"; } - /** @name PalletAuthorMappingCall (242) */ + /** @name PalletAuthorMappingCall (244) */ interface PalletAuthorMappingCall extends Enum { readonly isAddAssociation: boolean; readonly asAddAssociation: { @@ -4007,7 +4025,7 @@ declare module "@polkadot/types/lookup" { | "SetKeys"; } - /** @name PalletProxyCall (243) */ + /** @name PalletProxyCall (245) */ interface PalletProxyCall extends Enum { readonly isProxy: boolean; readonly asProxy: { @@ -4077,14 +4095,14 @@ declare module "@polkadot/types/lookup" { | "ProxyAnnounced"; } - /** @name PalletMaintenanceModeCall (245) */ + /** @name PalletMaintenanceModeCall (247) */ interface PalletMaintenanceModeCall extends Enum { readonly isEnterMaintenanceMode: boolean; readonly isResumeNormalOperation: boolean; readonly type: "EnterMaintenanceMode" | "ResumeNormalOperation"; } - /** @name PalletIdentityCall (246) */ + /** @name PalletIdentityCall (248) */ interface PalletIdentityCall extends Enum { readonly isAddRegistrar: boolean; readonly asAddRegistrar: { @@ -4206,7 +4224,7 @@ declare module "@polkadot/types/lookup" { | "RemoveDanglingUsername"; } - /** @name PalletIdentityLegacyIdentityInfo (247) */ + /** @name PalletIdentityLegacyIdentityInfo (249) */ interface PalletIdentityLegacyIdentityInfo extends Struct { readonly additional: Vec>; readonly display: Data; @@ -4219,7 +4237,7 @@ declare module "@polkadot/types/lookup" { readonly twitter: Data; } - /** @name PalletIdentityJudgement (283) */ + /** @name PalletIdentityJudgement (285) */ interface PalletIdentityJudgement extends Enum { readonly isUnknown: boolean; readonly isFeePaid: boolean; @@ -4239,10 +4257,10 @@ declare module "@polkadot/types/lookup" { | "Erroneous"; } - /** @name AccountEthereumSignature (285) */ + /** @name AccountEthereumSignature (287) */ interface AccountEthereumSignature extends U8aFixed {} - /** @name CumulusPalletXcmpQueueCall (286) */ + /** @name CumulusPalletXcmpQueueCall (288) */ interface CumulusPalletXcmpQueueCall extends Enum { readonly isSuspendXcmExecution: boolean; readonly isResumeXcmExecution: boolean; @@ -4266,7 +4284,7 @@ declare module "@polkadot/types/lookup" { | "UpdateResumeThreshold"; } - /** @name PalletXcmCall (287) */ + /** @name PalletXcmCall (289) */ interface PalletXcmCall extends Enum { readonly isSend: boolean; readonly asSend: { @@ -4369,7 +4387,7 @@ declare module "@polkadot/types/lookup" { | "TransferAssetsUsingTypeAndThen"; } - /** @name XcmVersionedXcm (288) */ + /** @name XcmVersionedXcm (290) */ interface XcmVersionedXcm extends Enum { readonly isV2: boolean; readonly asV2: XcmV2Xcm; @@ -4380,10 +4398,10 @@ declare module "@polkadot/types/lookup" { readonly type: "V2" | "V3" | "V4"; } - /** @name XcmV2Xcm (289) */ + /** @name XcmV2Xcm (291) */ interface XcmV2Xcm extends Vec {} - /** @name XcmV2Instruction (291) */ + /** @name XcmV2Instruction (293) */ interface XcmV2Instruction extends Enum { readonly isWithdrawAsset: boolean; readonly asWithdrawAsset: XcmV2MultiassetMultiAssets; @@ -4531,7 +4549,7 @@ declare module "@polkadot/types/lookup" { | "UnsubscribeVersion"; } - /** @name XcmV2Response (292) */ + /** @name XcmV2Response (294) */ interface XcmV2Response extends Enum { readonly isNull: boolean; readonly isAssets: boolean; @@ -4543,7 +4561,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Null" | "Assets" | "ExecutionResult" | "Version"; } - /** @name XcmV2TraitsError (295) */ + /** @name XcmV2TraitsError (297) */ interface XcmV2TraitsError extends Enum { readonly isOverflow: boolean; readonly isUnimplemented: boolean; @@ -4602,7 +4620,7 @@ declare module "@polkadot/types/lookup" { | "WeightNotComputable"; } - /** @name XcmV2OriginKind (296) */ + /** @name XcmV2OriginKind (298) */ interface XcmV2OriginKind extends Enum { readonly isNative: boolean; readonly isSovereignAccount: boolean; @@ -4611,7 +4629,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Native" | "SovereignAccount" | "Superuser" | "Xcm"; } - /** @name XcmV2MultiassetMultiAssetFilter (297) */ + /** @name XcmV2MultiassetMultiAssetFilter (299) */ interface XcmV2MultiassetMultiAssetFilter extends Enum { readonly isDefinite: boolean; readonly asDefinite: XcmV2MultiassetMultiAssets; @@ -4620,7 +4638,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Definite" | "Wild"; } - /** @name XcmV2MultiassetWildMultiAsset (298) */ + /** @name XcmV2MultiassetWildMultiAsset (300) */ interface XcmV2MultiassetWildMultiAsset extends Enum { readonly isAll: boolean; readonly isAllOf: boolean; @@ -4631,14 +4649,14 @@ declare module "@polkadot/types/lookup" { readonly type: "All" | "AllOf"; } - /** @name XcmV2MultiassetWildFungibility (299) */ + /** @name XcmV2MultiassetWildFungibility (301) */ interface XcmV2MultiassetWildFungibility extends Enum { readonly isFungible: boolean; readonly isNonFungible: boolean; readonly type: "Fungible" | "NonFungible"; } - /** @name XcmV2WeightLimit (300) */ + /** @name XcmV2WeightLimit (302) */ interface XcmV2WeightLimit extends Enum { readonly isUnlimited: boolean; readonly isLimited: boolean; @@ -4646,10 +4664,10 @@ declare module "@polkadot/types/lookup" { readonly type: "Unlimited" | "Limited"; } - /** @name XcmV3Xcm (301) */ + /** @name XcmV3Xcm (303) */ interface XcmV3Xcm extends Vec {} - /** @name XcmV3Instruction (303) */ + /** @name XcmV3Instruction (305) */ interface XcmV3Instruction extends Enum { readonly isWithdrawAsset: boolean; readonly asWithdrawAsset: XcmV3MultiassetMultiAssets; @@ -4879,7 +4897,7 @@ declare module "@polkadot/types/lookup" { | "UnpaidExecution"; } - /** @name XcmV3Response (304) */ + /** @name XcmV3Response (306) */ interface XcmV3Response extends Enum { readonly isNull: boolean; readonly isAssets: boolean; @@ -4901,7 +4919,7 @@ declare module "@polkadot/types/lookup" { | "DispatchResult"; } - /** @name XcmV3PalletInfo (306) */ + /** @name XcmV3PalletInfo (308) */ interface XcmV3PalletInfo extends Struct { readonly index: Compact; readonly name: Bytes; @@ -4911,14 +4929,14 @@ declare module "@polkadot/types/lookup" { readonly patch: Compact; } - /** @name XcmV3QueryResponseInfo (310) */ + /** @name XcmV3QueryResponseInfo (312) */ interface XcmV3QueryResponseInfo extends Struct { readonly destination: StagingXcmV3MultiLocation; readonly queryId: Compact; readonly maxWeight: SpWeightsWeightV2Weight; } - /** @name XcmV3MultiassetMultiAssetFilter (311) */ + /** @name XcmV3MultiassetMultiAssetFilter (313) */ interface XcmV3MultiassetMultiAssetFilter extends Enum { readonly isDefinite: boolean; readonly asDefinite: XcmV3MultiassetMultiAssets; @@ -4927,7 +4945,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Definite" | "Wild"; } - /** @name XcmV3MultiassetWildMultiAsset (312) */ + /** @name XcmV3MultiassetWildMultiAsset (314) */ interface XcmV3MultiassetWildMultiAsset extends Enum { readonly isAll: boolean; readonly isAllOf: boolean; @@ -4946,14 +4964,14 @@ declare module "@polkadot/types/lookup" { readonly type: "All" | "AllOf" | "AllCounted" | "AllOfCounted"; } - /** @name XcmV3MultiassetWildFungibility (313) */ + /** @name XcmV3MultiassetWildFungibility (315) */ interface XcmV3MultiassetWildFungibility extends Enum { readonly isFungible: boolean; readonly isNonFungible: boolean; readonly type: "Fungible" | "NonFungible"; } - /** @name StagingXcmExecutorAssetTransferTransferType (325) */ + /** @name StagingXcmExecutorAssetTransferTransferType (327) */ interface StagingXcmExecutorAssetTransferTransferType extends Enum { readonly isTeleport: boolean; readonly isLocalReserve: boolean; @@ -4963,7 +4981,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Teleport" | "LocalReserve" | "DestinationReserve" | "RemoteReserve"; } - /** @name XcmVersionedAssetId (326) */ + /** @name XcmVersionedAssetId (328) */ interface XcmVersionedAssetId extends Enum { readonly isV3: boolean; readonly asV3: XcmV3MultiassetAssetId; @@ -4972,7 +4990,7 @@ declare module "@polkadot/types/lookup" { readonly type: "V3" | "V4"; } - /** @name PalletAssetsCall (327) */ + /** @name PalletAssetsCall (329) */ interface PalletAssetsCall extends Enum { readonly isCreate: boolean; readonly asCreate: { @@ -5151,6 +5169,12 @@ declare module "@polkadot/types/lookup" { readonly id: Compact; readonly who: AccountId20; } & Struct; + readonly isTransferAll: boolean; + readonly asTransferAll: { + readonly id: Compact; + readonly dest: AccountId20; + readonly keepAlive: bool; + } & Struct; readonly type: | "Create" | "ForceCreate" @@ -5183,10 +5207,11 @@ declare module "@polkadot/types/lookup" { | "SetMinBalance" | "TouchOther" | "RefundOther" - | "Block"; + | "Block" + | "TransferAll"; } - /** @name PalletAssetManagerCall (328) */ + /** @name PalletAssetManagerCall (330) */ interface PalletAssetManagerCall extends Enum { readonly isRegisterForeignAsset: boolean; readonly asRegisterForeignAsset: { @@ -5218,7 +5243,7 @@ declare module "@polkadot/types/lookup" { | "DestroyForeignAsset"; } - /** @name PalletXcmTransactorCall (329) */ + /** @name PalletXcmTransactorCall (331) */ interface PalletXcmTransactorCall extends Enum { readonly isRegister: boolean; readonly asRegister: { @@ -5295,19 +5320,19 @@ declare module "@polkadot/types/lookup" { | "HrmpManage"; } - /** @name MoonbaseRuntimeXcmConfigTransactors (330) */ + /** @name MoonbaseRuntimeXcmConfigTransactors (332) */ interface MoonbaseRuntimeXcmConfigTransactors extends Enum { readonly isRelay: boolean; readonly type: "Relay"; } - /** @name PalletXcmTransactorCurrencyPayment (331) */ + /** @name PalletXcmTransactorCurrencyPayment (333) */ interface PalletXcmTransactorCurrencyPayment extends Struct { readonly currency: PalletXcmTransactorCurrency; readonly feeAmount: Option; } - /** @name MoonbaseRuntimeXcmConfigCurrencyId (332) */ + /** @name MoonbaseRuntimeXcmConfigCurrencyId (334) */ interface MoonbaseRuntimeXcmConfigCurrencyId extends Enum { readonly isSelfReserve: boolean; readonly isForeignAsset: boolean; @@ -5319,7 +5344,7 @@ declare module "@polkadot/types/lookup" { readonly type: "SelfReserve" | "ForeignAsset" | "Erc20"; } - /** @name PalletXcmTransactorCurrency (333) */ + /** @name PalletXcmTransactorCurrency (335) */ interface PalletXcmTransactorCurrency extends Enum { readonly isAsCurrencyId: boolean; readonly asAsCurrencyId: MoonbaseRuntimeXcmConfigCurrencyId; @@ -5328,13 +5353,13 @@ declare module "@polkadot/types/lookup" { readonly type: "AsCurrencyId" | "AsMultiLocation"; } - /** @name PalletXcmTransactorTransactWeights (335) */ + /** @name PalletXcmTransactorTransactWeights (337) */ interface PalletXcmTransactorTransactWeights extends Struct { readonly transactRequiredWeightAtMost: SpWeightsWeightV2Weight; readonly overallWeight: Option; } - /** @name PalletMoonbeamOrbitersCall (337) */ + /** @name PalletMoonbeamOrbitersCall (339) */ interface PalletMoonbeamOrbitersCall extends Enum { readonly isCollatorAddOrbiter: boolean; readonly asCollatorAddOrbiter: { @@ -5371,7 +5396,7 @@ declare module "@polkadot/types/lookup" { | "RemoveCollator"; } - /** @name PalletEthereumXcmCall (338) */ + /** @name PalletEthereumXcmCall (340) */ interface PalletEthereumXcmCall extends Enum { readonly isTransact: boolean; readonly asTransact: { @@ -5398,7 +5423,7 @@ declare module "@polkadot/types/lookup" { | "ForceTransactAs"; } - /** @name XcmPrimitivesEthereumXcmEthereumXcmTransaction (339) */ + /** @name XcmPrimitivesEthereumXcmEthereumXcmTransaction (341) */ interface XcmPrimitivesEthereumXcmEthereumXcmTransaction extends Enum { readonly isV1: boolean; readonly asV1: XcmPrimitivesEthereumXcmEthereumXcmTransactionV1; @@ -5407,7 +5432,7 @@ declare module "@polkadot/types/lookup" { readonly type: "V1" | "V2"; } - /** @name XcmPrimitivesEthereumXcmEthereumXcmTransactionV1 (340) */ + /** @name XcmPrimitivesEthereumXcmEthereumXcmTransactionV1 (342) */ interface XcmPrimitivesEthereumXcmEthereumXcmTransactionV1 extends Struct { readonly gasLimit: U256; readonly feePayment: XcmPrimitivesEthereumXcmEthereumXcmFee; @@ -5417,7 +5442,7 @@ declare module "@polkadot/types/lookup" { readonly accessList: Option]>>>; } - /** @name XcmPrimitivesEthereumXcmEthereumXcmFee (341) */ + /** @name XcmPrimitivesEthereumXcmEthereumXcmFee (343) */ interface XcmPrimitivesEthereumXcmEthereumXcmFee extends Enum { readonly isManual: boolean; readonly asManual: XcmPrimitivesEthereumXcmManualEthereumXcmFee; @@ -5425,13 +5450,13 @@ declare module "@polkadot/types/lookup" { readonly type: "Manual" | "Auto"; } - /** @name XcmPrimitivesEthereumXcmManualEthereumXcmFee (342) */ + /** @name XcmPrimitivesEthereumXcmManualEthereumXcmFee (344) */ interface XcmPrimitivesEthereumXcmManualEthereumXcmFee extends Struct { readonly gasPrice: Option; readonly maxFeePerGas: Option; } - /** @name XcmPrimitivesEthereumXcmEthereumXcmTransactionV2 (345) */ + /** @name XcmPrimitivesEthereumXcmEthereumXcmTransactionV2 (347) */ interface XcmPrimitivesEthereumXcmEthereumXcmTransactionV2 extends Struct { readonly gasLimit: U256; readonly action: EthereumTransactionTransactionAction; @@ -5440,13 +5465,13 @@ declare module "@polkadot/types/lookup" { readonly accessList: Option]>>>; } - /** @name PalletRandomnessCall (347) */ + /** @name PalletRandomnessCall (349) */ interface PalletRandomnessCall extends Enum { readonly isSetBabeRandomnessResults: boolean; readonly type: "SetBabeRandomnessResults"; } - /** @name PalletCollectiveCall (348) */ + /** @name PalletCollectiveCall (350) */ interface PalletCollectiveCall extends Enum { readonly isSetMembers: boolean; readonly asSetMembers: { @@ -5485,7 +5510,7 @@ declare module "@polkadot/types/lookup" { readonly type: "SetMembers" | "Execute" | "Propose" | "Vote" | "DisapproveProposal" | "Close"; } - /** @name PalletConvictionVotingCall (349) */ + /** @name PalletConvictionVotingCall (351) */ interface PalletConvictionVotingCall extends Enum { readonly isVote: boolean; readonly asVote: { @@ -5522,27 +5547,6 @@ declare module "@polkadot/types/lookup" { readonly type: "Vote" | "Delegate" | "Undelegate" | "Unlock" | "RemoveVote" | "RemoveOtherVote"; } - /** @name PalletConvictionVotingVoteAccountVote (350) */ - interface PalletConvictionVotingVoteAccountVote extends Enum { - readonly isStandard: boolean; - readonly asStandard: { - readonly vote: Vote; - readonly balance: u128; - } & Struct; - readonly isSplit: boolean; - readonly asSplit: { - readonly aye: u128; - readonly nay: u128; - } & Struct; - readonly isSplitAbstain: boolean; - readonly asSplitAbstain: { - readonly aye: u128; - readonly nay: u128; - readonly abstain: u128; - } & Struct; - readonly type: "Standard" | "Split" | "SplitAbstain"; - } - /** @name PalletConvictionVotingConviction (352) */ interface PalletConvictionVotingConviction extends Enum { readonly isNone: boolean; @@ -6358,7 +6362,7 @@ declare module "@polkadot/types/lookup" { interface CumulusPalletParachainSystemUnincludedSegmentAncestor extends Struct { readonly usedBandwidth: CumulusPalletParachainSystemUnincludedSegmentUsedBandwidth; readonly paraHeadHash: Option; - readonly consumedGoAheadSignal: Option; + readonly consumedGoAheadSignal: Option; } /** @name CumulusPalletParachainSystemUnincludedSegmentUsedBandwidth (441) */ @@ -6377,8 +6381,8 @@ declare module "@polkadot/types/lookup" { readonly totalBytes: u32; } - /** @name PolkadotPrimitivesV7UpgradeGoAhead (447) */ - interface PolkadotPrimitivesV7UpgradeGoAhead extends Enum { + /** @name PolkadotPrimitivesV8UpgradeGoAhead (447) */ + interface PolkadotPrimitivesV8UpgradeGoAhead extends Enum { readonly isAbort: boolean; readonly isGoAhead: boolean; readonly type: "Abort" | "GoAhead"; @@ -6388,11 +6392,11 @@ declare module "@polkadot/types/lookup" { interface CumulusPalletParachainSystemUnincludedSegmentSegmentTracker extends Struct { readonly usedBandwidth: CumulusPalletParachainSystemUnincludedSegmentUsedBandwidth; readonly hrmpWatermark: Option; - readonly consumedGoAheadSignal: Option; + readonly consumedGoAheadSignal: Option; } - /** @name PolkadotPrimitivesV7UpgradeRestriction (450) */ - interface PolkadotPrimitivesV7UpgradeRestriction extends Enum { + /** @name PolkadotPrimitivesV8UpgradeRestriction (450) */ + interface PolkadotPrimitivesV8UpgradeRestriction extends Enum { readonly isPresent: boolean; readonly type: "Present"; } @@ -6401,8 +6405,8 @@ declare module "@polkadot/types/lookup" { interface CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot extends Struct { readonly dmqMqcHead: H256; readonly relayDispatchQueueRemainingCapacity: CumulusPalletParachainSystemRelayStateSnapshotRelayDispatchQueueRemainingCapacity; - readonly ingressChannels: Vec>; - readonly egressChannels: Vec>; + readonly ingressChannels: Vec>; + readonly egressChannels: Vec>; } /** @name CumulusPalletParachainSystemRelayStateSnapshotRelayDispatchQueueRemainingCapacity (452) */ @@ -6412,8 +6416,8 @@ declare module "@polkadot/types/lookup" { readonly remainingSize: u32; } - /** @name PolkadotPrimitivesV7AbridgedHrmpChannel (455) */ - interface PolkadotPrimitivesV7AbridgedHrmpChannel extends Struct { + /** @name PolkadotPrimitivesV8AbridgedHrmpChannel (455) */ + interface PolkadotPrimitivesV8AbridgedHrmpChannel extends Struct { readonly maxCapacity: u32; readonly maxTotalSize: u32; readonly maxMessageSize: u32; @@ -6422,8 +6426,8 @@ declare module "@polkadot/types/lookup" { readonly mqcHead: Option; } - /** @name PolkadotPrimitivesV7AbridgedHostConfiguration (456) */ - interface PolkadotPrimitivesV7AbridgedHostConfiguration extends Struct { + /** @name PolkadotPrimitivesV8AbridgedHostConfiguration (456) */ + interface PolkadotPrimitivesV8AbridgedHostConfiguration extends Struct { readonly maxCodeSize: u32; readonly maxHeadDataSize: u32; readonly maxUpwardQueueCount: u32; @@ -6433,11 +6437,11 @@ declare module "@polkadot/types/lookup" { readonly hrmpMaxMessageNumPerCandidate: u32; readonly validationUpgradeCooldown: u32; readonly validationUpgradeDelay: u32; - readonly asyncBackingParams: PolkadotPrimitivesV7AsyncBackingAsyncBackingParams; + readonly asyncBackingParams: PolkadotPrimitivesV8AsyncBackingAsyncBackingParams; } - /** @name PolkadotPrimitivesV7AsyncBackingAsyncBackingParams (457) */ - interface PolkadotPrimitivesV7AsyncBackingAsyncBackingParams extends Struct { + /** @name PolkadotPrimitivesV8AsyncBackingAsyncBackingParams (457) */ + interface PolkadotPrimitivesV8AsyncBackingAsyncBackingParams extends Struct { readonly maxCandidateDepth: u32; readonly allowedAncestryLen: u32; } @@ -7869,7 +7873,6 @@ declare module "@polkadot/types/lookup" { readonly isNotRequested: boolean; readonly isTooMany: boolean; readonly isTooFew: boolean; - readonly isNoCost: boolean; readonly type: | "TooBig" | "AlreadyNoted" @@ -7878,8 +7881,7 @@ declare module "@polkadot/types/lookup" { | "Requested" | "NotRequested" | "TooMany" - | "TooFew" - | "NoCost"; + | "TooFew"; } /** @name PalletWhitelistError (662) */ @@ -7969,7 +7971,6 @@ declare module "@polkadot/types/lookup" { readonly isLimitCannotBeZero: boolean; readonly isContractMetadataAlreadySet: boolean; readonly isContractNotExist: boolean; - readonly isKeyTooLong: boolean; readonly isSymbolTooLong: boolean; readonly isNameTooLong: boolean; readonly isAssetTypeNotFound: boolean; @@ -7983,7 +7984,6 @@ declare module "@polkadot/types/lookup" { | "LimitCannotBeZero" | "ContractMetadataAlreadySet" | "ContractNotExist" - | "KeyTooLong" | "SymbolTooLong" | "NameTooLong" | "AssetTypeNotFound" diff --git a/typescript-api/src/moonbeam/interfaces/augment-api-errors.ts b/typescript-api/src/moonbeam/interfaces/augment-api-errors.ts index 26967c2553..d9da3610f5 100644 --- a/typescript-api/src/moonbeam/interfaces/augment-api-errors.ts +++ b/typescript-api/src/moonbeam/interfaces/augment-api-errors.ts @@ -681,10 +681,6 @@ declare module "@polkadot/api-base/types/errors" { * Contract not exist **/ ContractNotExist: AugmentedError; - /** - * The key lengths exceeds the maximum allowed - **/ - KeyTooLong: AugmentedError; /** * The limit cannot be zero **/ @@ -1091,10 +1087,6 @@ declare module "@polkadot/api-base/types/errors" { * Preimage has already been noted on-chain. **/ AlreadyNoted: AugmentedError; - /** - * No ticket with a cost was returned by [`Config::Consideration`] to store the preimage. - **/ - NoCost: AugmentedError; /** * The user is not authorized to perform this action. **/ diff --git a/typescript-api/src/moonbeam/interfaces/augment-api-events.ts b/typescript-api/src/moonbeam/interfaces/augment-api-events.ts index d905baec3b..5ffaecb1de 100644 --- a/typescript-api/src/moonbeam/interfaces/augment-api-events.ts +++ b/typescript-api/src/moonbeam/interfaces/augment-api-events.ts @@ -37,6 +37,7 @@ import type { MoonbeamRuntimeXcmConfigAssetType, NimbusPrimitivesNimbusCryptoPublic, PalletConvictionVotingTally, + PalletConvictionVotingVoteAccountVote, PalletMultisigTimepoint, PalletParachainStakingDelegationRequestsCancelledScheduledRequest, PalletParachainStakingDelegatorAdded, @@ -581,6 +582,22 @@ declare module "@polkadot/api-base/types/events" { * An \[account\] has cancelled a previous delegation operation. **/ Undelegated: AugmentedEvent; + /** + * An account that has voted + **/ + Voted: AugmentedEvent< + ApiType, + [who: AccountId20, vote: PalletConvictionVotingVoteAccountVote], + { who: AccountId20; vote: PalletConvictionVotingVoteAccountVote } + >; + /** + * A vote that been removed + **/ + VoteRemoved: AugmentedEvent< + ApiType, + [who: AccountId20, vote: PalletConvictionVotingVoteAccountVote], + { who: AccountId20; vote: PalletConvictionVotingVoteAccountVote } + >; /** * Generic event **/ diff --git a/typescript-api/src/moonbeam/interfaces/augment-api-query.ts b/typescript-api/src/moonbeam/interfaces/augment-api-query.ts index 23ec786f53..c572d87eaf 100644 --- a/typescript-api/src/moonbeam/interfaces/augment-api-query.ts +++ b/typescript-api/src/moonbeam/interfaces/augment-api-query.ts @@ -110,10 +110,10 @@ import type { PalletXcmTransactorRemoteTransactInfoWithMaxWeight, PalletXcmVersionMigrationStage, PolkadotCorePrimitivesOutboundHrmpMessage, - PolkadotPrimitivesV7AbridgedHostConfiguration, - PolkadotPrimitivesV7PersistedValidationData, - PolkadotPrimitivesV7UpgradeGoAhead, - PolkadotPrimitivesV7UpgradeRestriction, + PolkadotPrimitivesV8AbridgedHostConfiguration, + PolkadotPrimitivesV8PersistedValidationData, + PolkadotPrimitivesV8UpgradeGoAhead, + PolkadotPrimitivesV8UpgradeRestriction, SpRuntimeDigest, SpTrieStorageProof, SpWeightsWeightV2Weight, @@ -1142,6 +1142,19 @@ declare module "@polkadot/api-base/types/storage" { **/ totalSelected: AugmentedQuery Observable, []> & QueryableStorageEntry; + /** + * Records collators' inactivity. + * Data persists for MaxOfflineRounds + 1 rounds before being pruned. + **/ + wasInactive: AugmentedQuery< + ApiType, + ( + arg1: u32 | AnyNumber | Uint8Array, + arg2: AccountId20 | string | Uint8Array + ) => Observable>, + [u32, AccountId20] + > & + QueryableStorageEntry; /** * Generic query **/ @@ -1187,7 +1200,7 @@ declare module "@polkadot/api-base/types/storage" { **/ hostConfiguration: AugmentedQuery< ApiType, - () => Observable>, + () => Observable>, [] > & QueryableStorageEntry; @@ -1333,7 +1346,7 @@ declare module "@polkadot/api-base/types/storage" { **/ upgradeGoAhead: AugmentedQuery< ApiType, - () => Observable>, + () => Observable>, [] > & QueryableStorageEntry; @@ -1348,7 +1361,7 @@ declare module "@polkadot/api-base/types/storage" { **/ upgradeRestrictionSignal: AugmentedQuery< ApiType, - () => Observable>, + () => Observable>, [] > & QueryableStorageEntry; @@ -1371,7 +1384,7 @@ declare module "@polkadot/api-base/types/storage" { **/ validationData: AugmentedQuery< ApiType, - () => Observable>, + () => Observable>, [] > & QueryableStorageEntry; diff --git a/typescript-api/src/moonbeam/interfaces/augment-api-tx.ts b/typescript-api/src/moonbeam/interfaces/augment-api-tx.ts index c9bb67c19b..9edff31688 100644 --- a/typescript-api/src/moonbeam/interfaces/augment-api-tx.ts +++ b/typescript-api/src/moonbeam/interfaces/augment-api-tx.ts @@ -688,8 +688,6 @@ declare module "@polkadot/api-base/types/submittable" { * * - `id`: The identifier of the asset to be destroyed. This must identify an existing * asset. - * - * The asset class must be frozen before calling `start_destroy`. **/ startDestroy: AugmentedSubmittable< (id: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, @@ -791,6 +789,32 @@ declare module "@polkadot/api-base/types/submittable" { ) => SubmittableExtrinsic, [Compact, AccountId20, Compact] >; + /** + * Transfer the entire transferable balance from the caller asset account. + * + * NOTE: This function only attempts to transfer _transferable_ balances. This means that + * any held, frozen, or minimum balance (when `keep_alive` is `true`), will not be + * transferred by this function. To ensure that this function results in a killed account, + * you might need to prepare the account by removing any reference counters, storage + * deposits, etc... + * + * The dispatch origin of this call must be Signed. + * + * - `id`: The identifier of the asset for the account holding a deposit. + * - `dest`: The recipient of the transfer. + * - `keep_alive`: A boolean to determine if the `transfer_all` operation should send all + * of the funds the asset account has, causing the sender asset account to be killed + * (false), or transfer everything except at least the minimum balance, which will + * guarantee to keep the sender asset account alive (true). + **/ + transferAll: AugmentedSubmittable< + ( + id: Compact | AnyNumber | Uint8Array, + dest: AccountId20 | string | Uint8Array, + keepAlive: bool | boolean | Uint8Array + ) => SubmittableExtrinsic, + [Compact, AccountId20, bool] + >; /** * Transfer some asset balance from a previously delegated account to some third-party * account. @@ -1855,7 +1879,7 @@ declare module "@polkadot/api-base/types/submittable" { * - `max_fee`: The maximum fee that may be paid. This should just be auto-populated as: * * ```nocompile - * Self::registrars().get(reg_index).unwrap().fee + * Registrars::::get().get(reg_index).unwrap().fee * ``` * * Emits `JudgementRequested` if successful. @@ -2814,38 +2838,6 @@ declare module "@polkadot/api-base/types/submittable" { [key: string]: SubmittableExtrinsicFunction; }; parachainSystem: { - /** - * Authorize an upgrade to a given `code_hash` for the runtime. The runtime can be supplied - * later. - * - * The `check_version` parameter sets a boolean flag for whether or not the runtime's spec - * version and name should be verified on upgrade. Since the authorization only has a hash, - * it cannot actually perform the verification. - * - * This call requires Root origin. - **/ - authorizeUpgrade: AugmentedSubmittable< - ( - codeHash: H256 | string | Uint8Array, - checkVersion: bool | boolean | Uint8Array - ) => SubmittableExtrinsic, - [H256, bool] - >; - /** - * Provide the preimage (runtime binary) `code` for an upgrade that has been authorized. - * - * If the authorization required a version check, this call will ensure the spec name - * remains unchanged and that the spec version has increased. - * - * Note that this function will not apply the new `code`, but only attempt to schedule the - * upgrade with the Relay Chain. - * - * All origins are allowed. - **/ - enactAuthorizedUpgrade: AugmentedSubmittable< - (code: Bytes | string | Uint8Array) => SubmittableExtrinsic, - [Bytes] - >; /** * Set the current validation data. * diff --git a/typescript-api/src/moonbeam/interfaces/lookup.ts b/typescript-api/src/moonbeam/interfaces/lookup.ts index d6ede93692..b0ca6f0596 100644 --- a/typescript-api/src/moonbeam/interfaces/lookup.ts +++ b/typescript-api/src/moonbeam/interfaces/lookup.ts @@ -1088,11 +1088,39 @@ export default { PalletConvictionVotingEvent: { _enum: { Delegated: "(AccountId20,AccountId20)", - Undelegated: "AccountId20" + Undelegated: "AccountId20", + Voted: { + who: "AccountId20", + vote: "PalletConvictionVotingVoteAccountVote" + }, + VoteRemoved: { + who: "AccountId20", + vote: "PalletConvictionVotingVoteAccountVote" + } + } + }, + /** + * Lookup94: pallet_conviction_voting::vote::AccountVote + **/ + PalletConvictionVotingVoteAccountVote: { + _enum: { + Standard: { + vote: "Vote", + balance: "u128" + }, + Split: { + aye: "u128", + nay: "u128" + }, + SplitAbstain: { + aye: "u128", + nay: "u128", + abstain: "u128" + } } }, /** - * Lookup94: pallet_referenda::pallet::Event + * Lookup96: pallet_referenda::pallet::Event **/ PalletReferendaEvent: { _enum: { @@ -1172,7 +1200,7 @@ export default { } }, /** - * Lookup95: frame_support::traits::preimages::Bounded + * Lookup97: frame_support::traits::preimages::Bounded **/ FrameSupportPreimagesBounded: { _enum: { @@ -1193,7 +1221,7 @@ export default { } }, /** - * Lookup97: frame_system::pallet::Call + * Lookup99: frame_system::pallet::Call **/ FrameSystemCall: { _enum: { @@ -1238,7 +1266,7 @@ export default { } }, /** - * Lookup101: cumulus_pallet_parachain_system::pallet::Call + * Lookup103: cumulus_pallet_parachain_system::pallet::Call **/ CumulusPalletParachainSystemCall: { _enum: { @@ -1247,56 +1275,49 @@ export default { }, sudo_send_upward_message: { message: "Bytes" - }, - authorize_upgrade: { - codeHash: "H256", - checkVersion: "bool" - }, - enact_authorized_upgrade: { - code: "Bytes" } } }, /** - * Lookup102: cumulus_primitives_parachain_inherent::ParachainInherentData + * Lookup104: cumulus_primitives_parachain_inherent::ParachainInherentData **/ CumulusPrimitivesParachainInherentParachainInherentData: { - validationData: "PolkadotPrimitivesV7PersistedValidationData", + validationData: "PolkadotPrimitivesV8PersistedValidationData", relayChainState: "SpTrieStorageProof", downwardMessages: "Vec", horizontalMessages: "BTreeMap>" }, /** - * Lookup103: polkadot_primitives::v7::PersistedValidationData + * Lookup105: polkadot_primitives::v8::PersistedValidationData **/ - PolkadotPrimitivesV7PersistedValidationData: { + PolkadotPrimitivesV8PersistedValidationData: { parentHead: "Bytes", relayParentNumber: "u32", relayParentStorageRoot: "H256", maxPovSize: "u32" }, /** - * Lookup105: sp_trie::storage_proof::StorageProof + * Lookup107: sp_trie::storage_proof::StorageProof **/ SpTrieStorageProof: { trieNodes: "BTreeSet" }, /** - * Lookup108: polkadot_core_primitives::InboundDownwardMessage + * Lookup110: polkadot_core_primitives::InboundDownwardMessage **/ PolkadotCorePrimitivesInboundDownwardMessage: { sentAt: "u32", msg: "Bytes" }, /** - * Lookup112: polkadot_core_primitives::InboundHrmpMessage + * Lookup114: polkadot_core_primitives::InboundHrmpMessage **/ PolkadotCorePrimitivesInboundHrmpMessage: { sentAt: "u32", data: "Bytes" }, /** - * Lookup115: pallet_timestamp::pallet::Call + * Lookup117: pallet_timestamp::pallet::Call **/ PalletTimestampCall: { _enum: { @@ -1306,7 +1327,7 @@ export default { } }, /** - * Lookup116: pallet_root_testing::pallet::Call + * Lookup118: pallet_root_testing::pallet::Call **/ PalletRootTestingCall: { _enum: { @@ -1317,7 +1338,7 @@ export default { } }, /** - * Lookup117: pallet_balances::pallet::Call + * Lookup119: pallet_balances::pallet::Call **/ PalletBalancesCall: { _enum: { @@ -1362,13 +1383,13 @@ export default { } }, /** - * Lookup120: pallet_balances::types::AdjustmentDirection + * Lookup122: pallet_balances::types::AdjustmentDirection **/ PalletBalancesAdjustmentDirection: { _enum: ["Increase", "Decrease"] }, /** - * Lookup121: pallet_parachain_staking::pallet::Call + * Lookup123: pallet_parachain_staking::pallet::Call **/ PalletParachainStakingCall: { _enum: { @@ -1506,13 +1527,13 @@ export default { } }, /** - * Lookup124: pallet_author_inherent::pallet::Call + * Lookup126: pallet_author_inherent::pallet::Call **/ PalletAuthorInherentCall: { _enum: ["kick_off_authorship_validation"] }, /** - * Lookup125: pallet_author_slot_filter::pallet::Call + * Lookup127: pallet_author_slot_filter::pallet::Call **/ PalletAuthorSlotFilterCall: { _enum: { @@ -1525,7 +1546,7 @@ export default { } }, /** - * Lookup126: pallet_author_mapping::pallet::Call + * Lookup128: pallet_author_mapping::pallet::Call **/ PalletAuthorMappingCall: { _enum: { @@ -1549,7 +1570,7 @@ export default { } }, /** - * Lookup127: pallet_moonbeam_orbiters::pallet::Call + * Lookup129: pallet_moonbeam_orbiters::pallet::Call **/ PalletMoonbeamOrbitersCall: { _enum: { @@ -1575,7 +1596,7 @@ export default { } }, /** - * Lookup128: pallet_utility::pallet::Call + * Lookup130: pallet_utility::pallet::Call **/ PalletUtilityCall: { _enum: { @@ -1603,7 +1624,7 @@ export default { } }, /** - * Lookup130: moonbeam_runtime::OriginCaller + * Lookup132: moonbeam_runtime::OriginCaller **/ MoonbeamRuntimeOriginCaller: { _enum: { @@ -1720,7 +1741,7 @@ export default { } }, /** - * Lookup131: frame_support::dispatch::RawOrigin + * Lookup133: frame_support::dispatch::RawOrigin **/ FrameSupportDispatchRawOrigin: { _enum: { @@ -1730,7 +1751,7 @@ export default { } }, /** - * Lookup132: pallet_ethereum::RawOrigin + * Lookup134: pallet_ethereum::RawOrigin **/ PalletEthereumRawOrigin: { _enum: { @@ -1738,7 +1759,7 @@ export default { } }, /** - * Lookup133: moonbeam_runtime::governance::origins::custom_origins::Origin + * Lookup135: moonbeam_runtime::governance::origins::custom_origins::Origin **/ MoonbeamRuntimeGovernanceOriginsCustomOriginsOrigin: { _enum: [ @@ -1750,7 +1771,7 @@ export default { ] }, /** - * Lookup134: pallet_collective::RawOrigin + * Lookup136: pallet_collective::RawOrigin **/ PalletCollectiveRawOrigin: { _enum: { @@ -1760,7 +1781,7 @@ export default { } }, /** - * Lookup136: cumulus_pallet_xcm::pallet::Origin + * Lookup138: cumulus_pallet_xcm::pallet::Origin **/ CumulusPalletXcmOrigin: { _enum: { @@ -1769,7 +1790,7 @@ export default { } }, /** - * Lookup137: pallet_xcm::pallet::Origin + * Lookup139: pallet_xcm::pallet::Origin **/ PalletXcmOrigin: { _enum: { @@ -1778,30 +1799,30 @@ export default { } }, /** - * Lookup138: staging_xcm::v4::location::Location + * Lookup140: staging_xcm::v4::location::Location **/ StagingXcmV4Location: { parents: "u8", interior: "StagingXcmV4Junctions" }, /** - * Lookup139: staging_xcm::v4::junctions::Junctions + * Lookup141: staging_xcm::v4::junctions::Junctions **/ StagingXcmV4Junctions: { _enum: { Here: "Null", - X1: "[Lookup141;1]", - X2: "[Lookup141;2]", - X3: "[Lookup141;3]", - X4: "[Lookup141;4]", - X5: "[Lookup141;5]", - X6: "[Lookup141;6]", - X7: "[Lookup141;7]", - X8: "[Lookup141;8]" + X1: "[Lookup143;1]", + X2: "[Lookup143;2]", + X3: "[Lookup143;3]", + X4: "[Lookup143;4]", + X5: "[Lookup143;5]", + X6: "[Lookup143;6]", + X7: "[Lookup143;7]", + X8: "[Lookup143;8]" } }, /** - * Lookup141: staging_xcm::v4::junction::Junction + * Lookup143: staging_xcm::v4::junction::Junction **/ StagingXcmV4Junction: { _enum: { @@ -1833,7 +1854,7 @@ export default { } }, /** - * Lookup144: staging_xcm::v4::junction::NetworkId + * Lookup146: staging_xcm::v4::junction::NetworkId **/ StagingXcmV4JunctionNetworkId: { _enum: { @@ -1856,7 +1877,7 @@ export default { } }, /** - * Lookup145: xcm::v3::junction::BodyId + * Lookup147: xcm::v3::junction::BodyId **/ XcmV3JunctionBodyId: { _enum: { @@ -1873,7 +1894,7 @@ export default { } }, /** - * Lookup146: xcm::v3::junction::BodyPart + * Lookup148: xcm::v3::junction::BodyPart **/ XcmV3JunctionBodyPart: { _enum: { @@ -1896,7 +1917,7 @@ export default { } }, /** - * Lookup154: pallet_ethereum_xcm::RawOrigin + * Lookup156: pallet_ethereum_xcm::RawOrigin **/ PalletEthereumXcmRawOrigin: { _enum: { @@ -1904,11 +1925,11 @@ export default { } }, /** - * Lookup155: sp_core::Void + * Lookup157: sp_core::Void **/ SpCoreVoid: "Null", /** - * Lookup156: pallet_proxy::pallet::Call + * Lookup158: pallet_proxy::pallet::Call **/ PalletProxyCall: { _enum: { @@ -1961,13 +1982,13 @@ export default { } }, /** - * Lookup158: pallet_maintenance_mode::pallet::Call + * Lookup160: pallet_maintenance_mode::pallet::Call **/ PalletMaintenanceModeCall: { _enum: ["enter_maintenance_mode", "resume_normal_operation"] }, /** - * Lookup159: pallet_identity::pallet::Call + * Lookup161: pallet_identity::pallet::Call **/ PalletIdentityCall: { _enum: { @@ -2052,7 +2073,7 @@ export default { } }, /** - * Lookup160: pallet_identity::legacy::IdentityInfo + * Lookup162: pallet_identity::legacy::IdentityInfo **/ PalletIdentityLegacyIdentityInfo: { additional: "Vec<(Data,Data)>", @@ -2066,7 +2087,7 @@ export default { twitter: "Data" }, /** - * Lookup198: pallet_identity::types::Judgement + * Lookup200: pallet_identity::types::Judgement **/ PalletIdentityJudgement: { _enum: { @@ -2080,11 +2101,11 @@ export default { } }, /** - * Lookup200: account::EthereumSignature + * Lookup202: account::EthereumSignature **/ AccountEthereumSignature: "[u8;65]", /** - * Lookup202: pallet_multisig::pallet::Call + * Lookup204: pallet_multisig::pallet::Call **/ PalletMultisigCall: { _enum: { @@ -2115,7 +2136,7 @@ export default { } }, /** - * Lookup204: pallet_moonbeam_lazy_migrations::pallet::Call + * Lookup206: pallet_moonbeam_lazy_migrations::pallet::Call **/ PalletMoonbeamLazyMigrationsCall: { _enum: { @@ -2140,7 +2161,7 @@ export default { } }, /** - * Lookup207: pallet_parameters::pallet::Call + * Lookup209: pallet_parameters::pallet::Call **/ PalletParametersCall: { _enum: { @@ -2150,7 +2171,7 @@ export default { } }, /** - * Lookup208: moonbeam_runtime::runtime_params::RuntimeParameters + * Lookup210: moonbeam_runtime::runtime_params::RuntimeParameters **/ MoonbeamRuntimeRuntimeParamsRuntimeParameters: { _enum: { @@ -2159,7 +2180,7 @@ export default { } }, /** - * Lookup209: moonbeam_runtime::runtime_params::dynamic_params::runtime_config::Parameters + * Lookup211: moonbeam_runtime::runtime_params::dynamic_params::runtime_config::Parameters **/ MoonbeamRuntimeRuntimeParamsDynamicParamsRuntimeConfigParameters: { _enum: { @@ -2168,7 +2189,7 @@ export default { } }, /** - * Lookup211: moonbeam_runtime::runtime_params::dynamic_params::pallet_randomness::Parameters + * Lookup213: moonbeam_runtime::runtime_params::dynamic_params::pallet_randomness::Parameters **/ MoonbeamRuntimeRuntimeParamsDynamicParamsPalletRandomnessParameters: { _enum: { @@ -2176,7 +2197,7 @@ export default { } }, /** - * Lookup213: pallet_evm::pallet::Call + * Lookup215: pallet_evm::pallet::Call **/ PalletEvmCall: { _enum: { @@ -2219,7 +2240,7 @@ export default { } }, /** - * Lookup219: pallet_ethereum::pallet::Call + * Lookup221: pallet_ethereum::pallet::Call **/ PalletEthereumCall: { _enum: { @@ -2229,7 +2250,7 @@ export default { } }, /** - * Lookup220: ethereum::transaction::TransactionV2 + * Lookup222: ethereum::transaction::TransactionV2 **/ EthereumTransactionTransactionV2: { _enum: { @@ -2239,7 +2260,7 @@ export default { } }, /** - * Lookup221: ethereum::transaction::LegacyTransaction + * Lookup223: ethereum::transaction::LegacyTransaction **/ EthereumTransactionLegacyTransaction: { nonce: "U256", @@ -2251,7 +2272,7 @@ export default { signature: "EthereumTransactionTransactionSignature" }, /** - * Lookup222: ethereum::transaction::TransactionAction + * Lookup224: ethereum::transaction::TransactionAction **/ EthereumTransactionTransactionAction: { _enum: { @@ -2260,7 +2281,7 @@ export default { } }, /** - * Lookup223: ethereum::transaction::TransactionSignature + * Lookup225: ethereum::transaction::TransactionSignature **/ EthereumTransactionTransactionSignature: { v: "u64", @@ -2268,7 +2289,7 @@ export default { s: "H256" }, /** - * Lookup225: ethereum::transaction::EIP2930Transaction + * Lookup227: ethereum::transaction::EIP2930Transaction **/ EthereumTransactionEip2930Transaction: { chainId: "u64", @@ -2284,14 +2305,14 @@ export default { s: "H256" }, /** - * Lookup227: ethereum::transaction::AccessListItem + * Lookup229: ethereum::transaction::AccessListItem **/ EthereumTransactionAccessListItem: { address: "H160", storageKeys: "Vec" }, /** - * Lookup228: ethereum::transaction::EIP1559Transaction + * Lookup230: ethereum::transaction::EIP1559Transaction **/ EthereumTransactionEip1559Transaction: { chainId: "u64", @@ -2308,7 +2329,7 @@ export default { s: "H256" }, /** - * Lookup229: pallet_scheduler::pallet::Call + * Lookup231: pallet_scheduler::pallet::Call **/ PalletSchedulerCall: { _enum: { @@ -2364,7 +2385,7 @@ export default { } }, /** - * Lookup231: pallet_preimage::pallet::Call + * Lookup233: pallet_preimage::pallet::Call **/ PalletPreimageCall: { _enum: { @@ -2395,7 +2416,7 @@ export default { } }, /** - * Lookup232: pallet_conviction_voting::pallet::Call + * Lookup234: pallet_conviction_voting::pallet::Call **/ PalletConvictionVotingCall: { _enum: { @@ -2427,26 +2448,6 @@ export default { } } }, - /** - * Lookup233: pallet_conviction_voting::vote::AccountVote - **/ - PalletConvictionVotingVoteAccountVote: { - _enum: { - Standard: { - vote: "Vote", - balance: "u128" - }, - Split: { - aye: "u128", - nay: "u128" - }, - SplitAbstain: { - aye: "u128", - nay: "u128", - abstain: "u128" - } - } - }, /** * Lookup235: pallet_conviction_voting::conviction::Conviction **/ @@ -3900,6 +3901,11 @@ export default { block: { id: "Compact", who: "AccountId20" + }, + transfer_all: { + id: "Compact", + dest: "AccountId20", + keepAlive: "bool" } } }, @@ -5015,7 +5021,7 @@ export default { CumulusPalletParachainSystemUnincludedSegmentAncestor: { usedBandwidth: "CumulusPalletParachainSystemUnincludedSegmentUsedBandwidth", paraHeadHash: "Option", - consumedGoAheadSignal: "Option" + consumedGoAheadSignal: "Option" }, /** * Lookup420: cumulus_pallet_parachain_system::unincluded_segment::UsedBandwidth @@ -5033,9 +5039,9 @@ export default { totalBytes: "u32" }, /** - * Lookup426: polkadot_primitives::v7::UpgradeGoAhead + * Lookup426: polkadot_primitives::v8::UpgradeGoAhead **/ - PolkadotPrimitivesV7UpgradeGoAhead: { + PolkadotPrimitivesV8UpgradeGoAhead: { _enum: ["Abort", "GoAhead"] }, /** @@ -5044,12 +5050,12 @@ export default { CumulusPalletParachainSystemUnincludedSegmentSegmentTracker: { usedBandwidth: "CumulusPalletParachainSystemUnincludedSegmentUsedBandwidth", hrmpWatermark: "Option", - consumedGoAheadSignal: "Option" + consumedGoAheadSignal: "Option" }, /** - * Lookup429: polkadot_primitives::v7::UpgradeRestriction + * Lookup429: polkadot_primitives::v8::UpgradeRestriction **/ - PolkadotPrimitivesV7UpgradeRestriction: { + PolkadotPrimitivesV8UpgradeRestriction: { _enum: ["Present"] }, /** @@ -5059,8 +5065,8 @@ export default { dmqMqcHead: "H256", relayDispatchQueueRemainingCapacity: "CumulusPalletParachainSystemRelayStateSnapshotRelayDispatchQueueRemainingCapacity", - ingressChannels: "Vec<(u32,PolkadotPrimitivesV7AbridgedHrmpChannel)>", - egressChannels: "Vec<(u32,PolkadotPrimitivesV7AbridgedHrmpChannel)>" + ingressChannels: "Vec<(u32,PolkadotPrimitivesV8AbridgedHrmpChannel)>", + egressChannels: "Vec<(u32,PolkadotPrimitivesV8AbridgedHrmpChannel)>" }, /** * Lookup431: cumulus_pallet_parachain_system::relay_state_snapshot::RelayDispatchQueueRemainingCapacity @@ -5070,9 +5076,9 @@ export default { remainingSize: "u32" }, /** - * Lookup434: polkadot_primitives::v7::AbridgedHrmpChannel + * Lookup434: polkadot_primitives::v8::AbridgedHrmpChannel **/ - PolkadotPrimitivesV7AbridgedHrmpChannel: { + PolkadotPrimitivesV8AbridgedHrmpChannel: { maxCapacity: "u32", maxTotalSize: "u32", maxMessageSize: "u32", @@ -5081,9 +5087,9 @@ export default { mqcHead: "Option" }, /** - * Lookup435: polkadot_primitives::v7::AbridgedHostConfiguration + * Lookup435: polkadot_primitives::v8::AbridgedHostConfiguration **/ - PolkadotPrimitivesV7AbridgedHostConfiguration: { + PolkadotPrimitivesV8AbridgedHostConfiguration: { maxCodeSize: "u32", maxHeadDataSize: "u32", maxUpwardQueueCount: "u32", @@ -5093,12 +5099,12 @@ export default { hrmpMaxMessageNumPerCandidate: "u32", validationUpgradeCooldown: "u32", validationUpgradeDelay: "u32", - asyncBackingParams: "PolkadotPrimitivesV7AsyncBackingAsyncBackingParams" + asyncBackingParams: "PolkadotPrimitivesV8AsyncBackingAsyncBackingParams" }, /** - * Lookup436: polkadot_primitives::v7::async_backing::AsyncBackingParams + * Lookup436: polkadot_primitives::v8::async_backing::AsyncBackingParams **/ - PolkadotPrimitivesV7AsyncBackingAsyncBackingParams: { + PolkadotPrimitivesV8AsyncBackingAsyncBackingParams: { maxCandidateDepth: "u32", allowedAncestryLen: "u32" }, @@ -5697,7 +5703,6 @@ export default { "LimitCannotBeZero", "ContractMetadataAlreadySet", "ContractNotExist", - "KeyTooLong", "SymbolTooLong", "NameTooLong", "AssetTypeNotFound", @@ -5887,8 +5892,7 @@ export default { "Requested", "NotRequested", "TooMany", - "TooFew", - "NoCost" + "TooFew" ] }, /** diff --git a/typescript-api/src/moonbeam/interfaces/registry.ts b/typescript-api/src/moonbeam/interfaces/registry.ts index 4b6b841562..a43c0413df 100644 --- a/typescript-api/src/moonbeam/interfaces/registry.ts +++ b/typescript-api/src/moonbeam/interfaces/registry.ts @@ -306,12 +306,12 @@ import type { PolkadotCorePrimitivesInboundHrmpMessage, PolkadotCorePrimitivesOutboundHrmpMessage, PolkadotParachainPrimitivesPrimitivesHrmpChannelId, - PolkadotPrimitivesV7AbridgedHostConfiguration, - PolkadotPrimitivesV7AbridgedHrmpChannel, - PolkadotPrimitivesV7AsyncBackingAsyncBackingParams, - PolkadotPrimitivesV7PersistedValidationData, - PolkadotPrimitivesV7UpgradeGoAhead, - PolkadotPrimitivesV7UpgradeRestriction, + PolkadotPrimitivesV8AbridgedHostConfiguration, + PolkadotPrimitivesV8AbridgedHrmpChannel, + PolkadotPrimitivesV8AsyncBackingAsyncBackingParams, + PolkadotPrimitivesV8PersistedValidationData, + PolkadotPrimitivesV8UpgradeGoAhead, + PolkadotPrimitivesV8UpgradeRestriction, SessionKeysPrimitivesVrfVrfCryptoPublic, SpArithmeticArithmeticError, SpCoreVoid, @@ -705,12 +705,12 @@ declare module "@polkadot/types/types/registry" { PolkadotCorePrimitivesInboundHrmpMessage: PolkadotCorePrimitivesInboundHrmpMessage; PolkadotCorePrimitivesOutboundHrmpMessage: PolkadotCorePrimitivesOutboundHrmpMessage; PolkadotParachainPrimitivesPrimitivesHrmpChannelId: PolkadotParachainPrimitivesPrimitivesHrmpChannelId; - PolkadotPrimitivesV7AbridgedHostConfiguration: PolkadotPrimitivesV7AbridgedHostConfiguration; - PolkadotPrimitivesV7AbridgedHrmpChannel: PolkadotPrimitivesV7AbridgedHrmpChannel; - PolkadotPrimitivesV7AsyncBackingAsyncBackingParams: PolkadotPrimitivesV7AsyncBackingAsyncBackingParams; - PolkadotPrimitivesV7PersistedValidationData: PolkadotPrimitivesV7PersistedValidationData; - PolkadotPrimitivesV7UpgradeGoAhead: PolkadotPrimitivesV7UpgradeGoAhead; - PolkadotPrimitivesV7UpgradeRestriction: PolkadotPrimitivesV7UpgradeRestriction; + PolkadotPrimitivesV8AbridgedHostConfiguration: PolkadotPrimitivesV8AbridgedHostConfiguration; + PolkadotPrimitivesV8AbridgedHrmpChannel: PolkadotPrimitivesV8AbridgedHrmpChannel; + PolkadotPrimitivesV8AsyncBackingAsyncBackingParams: PolkadotPrimitivesV8AsyncBackingAsyncBackingParams; + PolkadotPrimitivesV8PersistedValidationData: PolkadotPrimitivesV8PersistedValidationData; + PolkadotPrimitivesV8UpgradeGoAhead: PolkadotPrimitivesV8UpgradeGoAhead; + PolkadotPrimitivesV8UpgradeRestriction: PolkadotPrimitivesV8UpgradeRestriction; SessionKeysPrimitivesVrfVrfCryptoPublic: SessionKeysPrimitivesVrfVrfCryptoPublic; SpArithmeticArithmeticError: SpArithmeticArithmeticError; SpCoreVoid: SpCoreVoid; diff --git a/typescript-api/src/moonbeam/interfaces/types-lookup.ts b/typescript-api/src/moonbeam/interfaces/types-lookup.ts index ebd0d54229..a01e05d1e6 100644 --- a/typescript-api/src/moonbeam/interfaces/types-lookup.ts +++ b/typescript-api/src/moonbeam/interfaces/types-lookup.ts @@ -1339,10 +1339,41 @@ declare module "@polkadot/types/lookup" { readonly asDelegated: ITuple<[AccountId20, AccountId20]>; readonly isUndelegated: boolean; readonly asUndelegated: AccountId20; - readonly type: "Delegated" | "Undelegated"; + readonly isVoted: boolean; + readonly asVoted: { + readonly who: AccountId20; + readonly vote: PalletConvictionVotingVoteAccountVote; + } & Struct; + readonly isVoteRemoved: boolean; + readonly asVoteRemoved: { + readonly who: AccountId20; + readonly vote: PalletConvictionVotingVoteAccountVote; + } & Struct; + readonly type: "Delegated" | "Undelegated" | "Voted" | "VoteRemoved"; + } + + /** @name PalletConvictionVotingVoteAccountVote (94) */ + interface PalletConvictionVotingVoteAccountVote extends Enum { + readonly isStandard: boolean; + readonly asStandard: { + readonly vote: Vote; + readonly balance: u128; + } & Struct; + readonly isSplit: boolean; + readonly asSplit: { + readonly aye: u128; + readonly nay: u128; + } & Struct; + readonly isSplitAbstain: boolean; + readonly asSplitAbstain: { + readonly aye: u128; + readonly nay: u128; + readonly abstain: u128; + } & Struct; + readonly type: "Standard" | "Split" | "SplitAbstain"; } - /** @name PalletReferendaEvent (94) */ + /** @name PalletReferendaEvent (96) */ interface PalletReferendaEvent extends Enum { readonly isSubmitted: boolean; readonly asSubmitted: { @@ -1446,7 +1477,7 @@ declare module "@polkadot/types/lookup" { | "MetadataCleared"; } - /** @name FrameSupportPreimagesBounded (95) */ + /** @name FrameSupportPreimagesBounded (97) */ interface FrameSupportPreimagesBounded extends Enum { readonly isLegacy: boolean; readonly asLegacy: { @@ -1462,7 +1493,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Legacy" | "Inline" | "Lookup"; } - /** @name FrameSystemCall (97) */ + /** @name FrameSystemCall (99) */ interface FrameSystemCall extends Enum { readonly isRemark: boolean; readonly asRemark: { @@ -1523,7 +1554,7 @@ declare module "@polkadot/types/lookup" { | "ApplyAuthorizedUpgrade"; } - /** @name CumulusPalletParachainSystemCall (101) */ + /** @name CumulusPalletParachainSystemCall (103) */ interface CumulusPalletParachainSystemCall extends Enum { readonly isSetValidationData: boolean; readonly asSetValidationData: { @@ -1533,56 +1564,43 @@ declare module "@polkadot/types/lookup" { readonly asSudoSendUpwardMessage: { readonly message: Bytes; } & Struct; - readonly isAuthorizeUpgrade: boolean; - readonly asAuthorizeUpgrade: { - readonly codeHash: H256; - readonly checkVersion: bool; - } & Struct; - readonly isEnactAuthorizedUpgrade: boolean; - readonly asEnactAuthorizedUpgrade: { - readonly code: Bytes; - } & Struct; - readonly type: - | "SetValidationData" - | "SudoSendUpwardMessage" - | "AuthorizeUpgrade" - | "EnactAuthorizedUpgrade"; + readonly type: "SetValidationData" | "SudoSendUpwardMessage"; } - /** @name CumulusPrimitivesParachainInherentParachainInherentData (102) */ + /** @name CumulusPrimitivesParachainInherentParachainInherentData (104) */ interface CumulusPrimitivesParachainInherentParachainInherentData extends Struct { - readonly validationData: PolkadotPrimitivesV7PersistedValidationData; + readonly validationData: PolkadotPrimitivesV8PersistedValidationData; readonly relayChainState: SpTrieStorageProof; readonly downwardMessages: Vec; readonly horizontalMessages: BTreeMap>; } - /** @name PolkadotPrimitivesV7PersistedValidationData (103) */ - interface PolkadotPrimitivesV7PersistedValidationData extends Struct { + /** @name PolkadotPrimitivesV8PersistedValidationData (105) */ + interface PolkadotPrimitivesV8PersistedValidationData extends Struct { readonly parentHead: Bytes; readonly relayParentNumber: u32; readonly relayParentStorageRoot: H256; readonly maxPovSize: u32; } - /** @name SpTrieStorageProof (105) */ + /** @name SpTrieStorageProof (107) */ interface SpTrieStorageProof extends Struct { readonly trieNodes: BTreeSet; } - /** @name PolkadotCorePrimitivesInboundDownwardMessage (108) */ + /** @name PolkadotCorePrimitivesInboundDownwardMessage (110) */ interface PolkadotCorePrimitivesInboundDownwardMessage extends Struct { readonly sentAt: u32; readonly msg: Bytes; } - /** @name PolkadotCorePrimitivesInboundHrmpMessage (112) */ + /** @name PolkadotCorePrimitivesInboundHrmpMessage (114) */ interface PolkadotCorePrimitivesInboundHrmpMessage extends Struct { readonly sentAt: u32; readonly data: Bytes; } - /** @name PalletTimestampCall (115) */ + /** @name PalletTimestampCall (117) */ interface PalletTimestampCall extends Enum { readonly isSet: boolean; readonly asSet: { @@ -1591,7 +1609,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Set"; } - /** @name PalletRootTestingCall (116) */ + /** @name PalletRootTestingCall (118) */ interface PalletRootTestingCall extends Enum { readonly isFillBlock: boolean; readonly asFillBlock: { @@ -1601,7 +1619,7 @@ declare module "@polkadot/types/lookup" { readonly type: "FillBlock" | "TriggerDefensive"; } - /** @name PalletBalancesCall (117) */ + /** @name PalletBalancesCall (119) */ interface PalletBalancesCall extends Enum { readonly isTransferAllowDeath: boolean; readonly asTransferAllowDeath: { @@ -1660,14 +1678,14 @@ declare module "@polkadot/types/lookup" { | "Burn"; } - /** @name PalletBalancesAdjustmentDirection (120) */ + /** @name PalletBalancesAdjustmentDirection (122) */ interface PalletBalancesAdjustmentDirection extends Enum { readonly isIncrease: boolean; readonly isDecrease: boolean; readonly type: "Increase" | "Decrease"; } - /** @name PalletParachainStakingCall (121) */ + /** @name PalletParachainStakingCall (123) */ interface PalletParachainStakingCall extends Enum { readonly isSetStakingExpectations: boolean; readonly asSetStakingExpectations: { @@ -1845,13 +1863,13 @@ declare module "@polkadot/types/lookup" { | "SetInflationDistributionConfig"; } - /** @name PalletAuthorInherentCall (124) */ + /** @name PalletAuthorInherentCall (126) */ interface PalletAuthorInherentCall extends Enum { readonly isKickOffAuthorshipValidation: boolean; readonly type: "KickOffAuthorshipValidation"; } - /** @name PalletAuthorSlotFilterCall (125) */ + /** @name PalletAuthorSlotFilterCall (127) */ interface PalletAuthorSlotFilterCall extends Enum { readonly isSetEligible: boolean; readonly asSetEligible: { @@ -1860,7 +1878,7 @@ declare module "@polkadot/types/lookup" { readonly type: "SetEligible"; } - /** @name PalletAuthorMappingCall (126) */ + /** @name PalletAuthorMappingCall (128) */ interface PalletAuthorMappingCall extends Enum { readonly isAddAssociation: boolean; readonly asAddAssociation: { @@ -1888,7 +1906,7 @@ declare module "@polkadot/types/lookup" { | "SetKeys"; } - /** @name PalletMoonbeamOrbitersCall (127) */ + /** @name PalletMoonbeamOrbitersCall (129) */ interface PalletMoonbeamOrbitersCall extends Enum { readonly isCollatorAddOrbiter: boolean; readonly asCollatorAddOrbiter: { @@ -1925,7 +1943,7 @@ declare module "@polkadot/types/lookup" { | "RemoveCollator"; } - /** @name PalletUtilityCall (128) */ + /** @name PalletUtilityCall (130) */ interface PalletUtilityCall extends Enum { readonly isBatch: boolean; readonly asBatch: { @@ -1963,7 +1981,7 @@ declare module "@polkadot/types/lookup" { | "WithWeight"; } - /** @name MoonbeamRuntimeOriginCaller (130) */ + /** @name MoonbeamRuntimeOriginCaller (132) */ interface MoonbeamRuntimeOriginCaller extends Enum { readonly isSystem: boolean; readonly asSystem: FrameSupportDispatchRawOrigin; @@ -1994,7 +2012,7 @@ declare module "@polkadot/types/lookup" { | "EthereumXcm"; } - /** @name FrameSupportDispatchRawOrigin (131) */ + /** @name FrameSupportDispatchRawOrigin (133) */ interface FrameSupportDispatchRawOrigin extends Enum { readonly isRoot: boolean; readonly isSigned: boolean; @@ -2003,14 +2021,14 @@ declare module "@polkadot/types/lookup" { readonly type: "Root" | "Signed" | "None"; } - /** @name PalletEthereumRawOrigin (132) */ + /** @name PalletEthereumRawOrigin (134) */ interface PalletEthereumRawOrigin extends Enum { readonly isEthereumTransaction: boolean; readonly asEthereumTransaction: H160; readonly type: "EthereumTransaction"; } - /** @name MoonbeamRuntimeGovernanceOriginsCustomOriginsOrigin (133) */ + /** @name MoonbeamRuntimeGovernanceOriginsCustomOriginsOrigin (135) */ interface MoonbeamRuntimeGovernanceOriginsCustomOriginsOrigin extends Enum { readonly isWhitelistedCaller: boolean; readonly isGeneralAdmin: boolean; @@ -2025,7 +2043,7 @@ declare module "@polkadot/types/lookup" { | "FastGeneralAdmin"; } - /** @name PalletCollectiveRawOrigin (134) */ + /** @name PalletCollectiveRawOrigin (136) */ interface PalletCollectiveRawOrigin extends Enum { readonly isMembers: boolean; readonly asMembers: ITuple<[u32, u32]>; @@ -2035,7 +2053,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Members" | "Member" | "Phantom"; } - /** @name CumulusPalletXcmOrigin (136) */ + /** @name CumulusPalletXcmOrigin (138) */ interface CumulusPalletXcmOrigin extends Enum { readonly isRelay: boolean; readonly isSiblingParachain: boolean; @@ -2043,7 +2061,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Relay" | "SiblingParachain"; } - /** @name PalletXcmOrigin (137) */ + /** @name PalletXcmOrigin (139) */ interface PalletXcmOrigin extends Enum { readonly isXcm: boolean; readonly asXcm: StagingXcmV4Location; @@ -2052,13 +2070,13 @@ declare module "@polkadot/types/lookup" { readonly type: "Xcm" | "Response"; } - /** @name StagingXcmV4Location (138) */ + /** @name StagingXcmV4Location (140) */ interface StagingXcmV4Location extends Struct { readonly parents: u8; readonly interior: StagingXcmV4Junctions; } - /** @name StagingXcmV4Junctions (139) */ + /** @name StagingXcmV4Junctions (141) */ interface StagingXcmV4Junctions extends Enum { readonly isHere: boolean; readonly isX1: boolean; @@ -2080,7 +2098,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Here" | "X1" | "X2" | "X3" | "X4" | "X5" | "X6" | "X7" | "X8"; } - /** @name StagingXcmV4Junction (141) */ + /** @name StagingXcmV4Junction (143) */ interface StagingXcmV4Junction extends Enum { readonly isParachain: boolean; readonly asParachain: Compact; @@ -2129,7 +2147,7 @@ declare module "@polkadot/types/lookup" { | "GlobalConsensus"; } - /** @name StagingXcmV4JunctionNetworkId (144) */ + /** @name StagingXcmV4JunctionNetworkId (146) */ interface StagingXcmV4JunctionNetworkId extends Enum { readonly isByGenesis: boolean; readonly asByGenesis: U8aFixed; @@ -2164,7 +2182,7 @@ declare module "@polkadot/types/lookup" { | "PolkadotBulletin"; } - /** @name XcmV3JunctionBodyId (145) */ + /** @name XcmV3JunctionBodyId (147) */ interface XcmV3JunctionBodyId extends Enum { readonly isUnit: boolean; readonly isMoniker: boolean; @@ -2191,7 +2209,7 @@ declare module "@polkadot/types/lookup" { | "Treasury"; } - /** @name XcmV3JunctionBodyPart (146) */ + /** @name XcmV3JunctionBodyPart (148) */ interface XcmV3JunctionBodyPart extends Enum { readonly isVoice: boolean; readonly isMembers: boolean; @@ -2216,17 +2234,17 @@ declare module "@polkadot/types/lookup" { readonly type: "Voice" | "Members" | "Fraction" | "AtLeastProportion" | "MoreThanProportion"; } - /** @name PalletEthereumXcmRawOrigin (154) */ + /** @name PalletEthereumXcmRawOrigin (156) */ interface PalletEthereumXcmRawOrigin extends Enum { readonly isXcmEthereumTransaction: boolean; readonly asXcmEthereumTransaction: H160; readonly type: "XcmEthereumTransaction"; } - /** @name SpCoreVoid (155) */ + /** @name SpCoreVoid (157) */ type SpCoreVoid = Null; - /** @name PalletProxyCall (156) */ + /** @name PalletProxyCall (158) */ interface PalletProxyCall extends Enum { readonly isProxy: boolean; readonly asProxy: { @@ -2296,14 +2314,14 @@ declare module "@polkadot/types/lookup" { | "ProxyAnnounced"; } - /** @name PalletMaintenanceModeCall (158) */ + /** @name PalletMaintenanceModeCall (160) */ interface PalletMaintenanceModeCall extends Enum { readonly isEnterMaintenanceMode: boolean; readonly isResumeNormalOperation: boolean; readonly type: "EnterMaintenanceMode" | "ResumeNormalOperation"; } - /** @name PalletIdentityCall (159) */ + /** @name PalletIdentityCall (161) */ interface PalletIdentityCall extends Enum { readonly isAddRegistrar: boolean; readonly asAddRegistrar: { @@ -2425,7 +2443,7 @@ declare module "@polkadot/types/lookup" { | "RemoveDanglingUsername"; } - /** @name PalletIdentityLegacyIdentityInfo (160) */ + /** @name PalletIdentityLegacyIdentityInfo (162) */ interface PalletIdentityLegacyIdentityInfo extends Struct { readonly additional: Vec>; readonly display: Data; @@ -2438,7 +2456,7 @@ declare module "@polkadot/types/lookup" { readonly twitter: Data; } - /** @name PalletIdentityJudgement (198) */ + /** @name PalletIdentityJudgement (200) */ interface PalletIdentityJudgement extends Enum { readonly isUnknown: boolean; readonly isFeePaid: boolean; @@ -2458,10 +2476,10 @@ declare module "@polkadot/types/lookup" { | "Erroneous"; } - /** @name AccountEthereumSignature (200) */ + /** @name AccountEthereumSignature (202) */ interface AccountEthereumSignature extends U8aFixed {} - /** @name PalletMultisigCall (202) */ + /** @name PalletMultisigCall (204) */ interface PalletMultisigCall extends Enum { readonly isAsMultiThreshold1: boolean; readonly asAsMultiThreshold1: { @@ -2494,7 +2512,7 @@ declare module "@polkadot/types/lookup" { readonly type: "AsMultiThreshold1" | "AsMulti" | "ApproveAsMulti" | "CancelAsMulti"; } - /** @name PalletMoonbeamLazyMigrationsCall (204) */ + /** @name PalletMoonbeamLazyMigrationsCall (206) */ interface PalletMoonbeamLazyMigrationsCall extends Enum { readonly isCreateContractMetadata: boolean; readonly asCreateContractMetadata: { @@ -2526,7 +2544,7 @@ declare module "@polkadot/types/lookup" { | "FinishForeignAssetsMigration"; } - /** @name PalletParametersCall (207) */ + /** @name PalletParametersCall (209) */ interface PalletParametersCall extends Enum { readonly isSetParameter: boolean; readonly asSetParameter: { @@ -2535,7 +2553,7 @@ declare module "@polkadot/types/lookup" { readonly type: "SetParameter"; } - /** @name MoonbeamRuntimeRuntimeParamsRuntimeParameters (208) */ + /** @name MoonbeamRuntimeRuntimeParamsRuntimeParameters (210) */ interface MoonbeamRuntimeRuntimeParamsRuntimeParameters extends Enum { readonly isRuntimeConfig: boolean; readonly asRuntimeConfig: MoonbeamRuntimeRuntimeParamsDynamicParamsRuntimeConfigParameters; @@ -2544,7 +2562,7 @@ declare module "@polkadot/types/lookup" { readonly type: "RuntimeConfig" | "PalletRandomness"; } - /** @name MoonbeamRuntimeRuntimeParamsDynamicParamsRuntimeConfigParameters (209) */ + /** @name MoonbeamRuntimeRuntimeParamsDynamicParamsRuntimeConfigParameters (211) */ interface MoonbeamRuntimeRuntimeParamsDynamicParamsRuntimeConfigParameters extends Enum { readonly isFeesTreasuryProportion: boolean; readonly asFeesTreasuryProportion: ITuple< @@ -2556,7 +2574,7 @@ declare module "@polkadot/types/lookup" { readonly type: "FeesTreasuryProportion"; } - /** @name MoonbeamRuntimeRuntimeParamsDynamicParamsPalletRandomnessParameters (211) */ + /** @name MoonbeamRuntimeRuntimeParamsDynamicParamsPalletRandomnessParameters (213) */ interface MoonbeamRuntimeRuntimeParamsDynamicParamsPalletRandomnessParameters extends Enum { readonly isDeposit: boolean; readonly asDeposit: ITuple< @@ -2565,7 +2583,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Deposit"; } - /** @name PalletEvmCall (213) */ + /** @name PalletEvmCall (215) */ interface PalletEvmCall extends Enum { readonly isWithdraw: boolean; readonly asWithdraw: { @@ -2610,7 +2628,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Withdraw" | "Call" | "Create" | "Create2"; } - /** @name PalletEthereumCall (219) */ + /** @name PalletEthereumCall (221) */ interface PalletEthereumCall extends Enum { readonly isTransact: boolean; readonly asTransact: { @@ -2619,7 +2637,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Transact"; } - /** @name EthereumTransactionTransactionV2 (220) */ + /** @name EthereumTransactionTransactionV2 (222) */ interface EthereumTransactionTransactionV2 extends Enum { readonly isLegacy: boolean; readonly asLegacy: EthereumTransactionLegacyTransaction; @@ -2630,7 +2648,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Legacy" | "Eip2930" | "Eip1559"; } - /** @name EthereumTransactionLegacyTransaction (221) */ + /** @name EthereumTransactionLegacyTransaction (223) */ interface EthereumTransactionLegacyTransaction extends Struct { readonly nonce: U256; readonly gasPrice: U256; @@ -2641,7 +2659,7 @@ declare module "@polkadot/types/lookup" { readonly signature: EthereumTransactionTransactionSignature; } - /** @name EthereumTransactionTransactionAction (222) */ + /** @name EthereumTransactionTransactionAction (224) */ interface EthereumTransactionTransactionAction extends Enum { readonly isCall: boolean; readonly asCall: H160; @@ -2649,14 +2667,14 @@ declare module "@polkadot/types/lookup" { readonly type: "Call" | "Create"; } - /** @name EthereumTransactionTransactionSignature (223) */ + /** @name EthereumTransactionTransactionSignature (225) */ interface EthereumTransactionTransactionSignature extends Struct { readonly v: u64; readonly r: H256; readonly s: H256; } - /** @name EthereumTransactionEip2930Transaction (225) */ + /** @name EthereumTransactionEip2930Transaction (227) */ interface EthereumTransactionEip2930Transaction extends Struct { readonly chainId: u64; readonly nonce: U256; @@ -2671,13 +2689,13 @@ declare module "@polkadot/types/lookup" { readonly s: H256; } - /** @name EthereumTransactionAccessListItem (227) */ + /** @name EthereumTransactionAccessListItem (229) */ interface EthereumTransactionAccessListItem extends Struct { readonly address: H160; readonly storageKeys: Vec; } - /** @name EthereumTransactionEip1559Transaction (228) */ + /** @name EthereumTransactionEip1559Transaction (230) */ interface EthereumTransactionEip1559Transaction extends Struct { readonly chainId: u64; readonly nonce: U256; @@ -2693,7 +2711,7 @@ declare module "@polkadot/types/lookup" { readonly s: H256; } - /** @name PalletSchedulerCall (229) */ + /** @name PalletSchedulerCall (231) */ interface PalletSchedulerCall extends Enum { readonly isSchedule: boolean; readonly asSchedule: { @@ -2767,7 +2785,7 @@ declare module "@polkadot/types/lookup" { | "CancelRetryNamed"; } - /** @name PalletPreimageCall (231) */ + /** @name PalletPreimageCall (233) */ interface PalletPreimageCall extends Enum { readonly isNotePreimage: boolean; readonly asNotePreimage: { @@ -2797,7 +2815,7 @@ declare module "@polkadot/types/lookup" { | "EnsureUpdated"; } - /** @name PalletConvictionVotingCall (232) */ + /** @name PalletConvictionVotingCall (234) */ interface PalletConvictionVotingCall extends Enum { readonly isVote: boolean; readonly asVote: { @@ -2834,27 +2852,6 @@ declare module "@polkadot/types/lookup" { readonly type: "Vote" | "Delegate" | "Undelegate" | "Unlock" | "RemoveVote" | "RemoveOtherVote"; } - /** @name PalletConvictionVotingVoteAccountVote (233) */ - interface PalletConvictionVotingVoteAccountVote extends Enum { - readonly isStandard: boolean; - readonly asStandard: { - readonly vote: Vote; - readonly balance: u128; - } & Struct; - readonly isSplit: boolean; - readonly asSplit: { - readonly aye: u128; - readonly nay: u128; - } & Struct; - readonly isSplitAbstain: boolean; - readonly asSplitAbstain: { - readonly aye: u128; - readonly nay: u128; - readonly abstain: u128; - } & Struct; - readonly type: "Standard" | "Split" | "SplitAbstain"; - } - /** @name PalletConvictionVotingConviction (235) */ interface PalletConvictionVotingConviction extends Enum { readonly isNone: boolean; @@ -4841,6 +4838,12 @@ declare module "@polkadot/types/lookup" { readonly id: Compact; readonly who: AccountId20; } & Struct; + readonly isTransferAll: boolean; + readonly asTransferAll: { + readonly id: Compact; + readonly dest: AccountId20; + readonly keepAlive: bool; + } & Struct; readonly type: | "Create" | "ForceCreate" @@ -4873,7 +4876,8 @@ declare module "@polkadot/types/lookup" { | "SetMinBalance" | "TouchOther" | "RefundOther" - | "Block"; + | "Block" + | "TransferAll"; } /** @name PalletAssetManagerCall (346) */ @@ -6210,7 +6214,7 @@ declare module "@polkadot/types/lookup" { interface CumulusPalletParachainSystemUnincludedSegmentAncestor extends Struct { readonly usedBandwidth: CumulusPalletParachainSystemUnincludedSegmentUsedBandwidth; readonly paraHeadHash: Option; - readonly consumedGoAheadSignal: Option; + readonly consumedGoAheadSignal: Option; } /** @name CumulusPalletParachainSystemUnincludedSegmentUsedBandwidth (420) */ @@ -6229,8 +6233,8 @@ declare module "@polkadot/types/lookup" { readonly totalBytes: u32; } - /** @name PolkadotPrimitivesV7UpgradeGoAhead (426) */ - interface PolkadotPrimitivesV7UpgradeGoAhead extends Enum { + /** @name PolkadotPrimitivesV8UpgradeGoAhead (426) */ + interface PolkadotPrimitivesV8UpgradeGoAhead extends Enum { readonly isAbort: boolean; readonly isGoAhead: boolean; readonly type: "Abort" | "GoAhead"; @@ -6240,11 +6244,11 @@ declare module "@polkadot/types/lookup" { interface CumulusPalletParachainSystemUnincludedSegmentSegmentTracker extends Struct { readonly usedBandwidth: CumulusPalletParachainSystemUnincludedSegmentUsedBandwidth; readonly hrmpWatermark: Option; - readonly consumedGoAheadSignal: Option; + readonly consumedGoAheadSignal: Option; } - /** @name PolkadotPrimitivesV7UpgradeRestriction (429) */ - interface PolkadotPrimitivesV7UpgradeRestriction extends Enum { + /** @name PolkadotPrimitivesV8UpgradeRestriction (429) */ + interface PolkadotPrimitivesV8UpgradeRestriction extends Enum { readonly isPresent: boolean; readonly type: "Present"; } @@ -6253,8 +6257,8 @@ declare module "@polkadot/types/lookup" { interface CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot extends Struct { readonly dmqMqcHead: H256; readonly relayDispatchQueueRemainingCapacity: CumulusPalletParachainSystemRelayStateSnapshotRelayDispatchQueueRemainingCapacity; - readonly ingressChannels: Vec>; - readonly egressChannels: Vec>; + readonly ingressChannels: Vec>; + readonly egressChannels: Vec>; } /** @name CumulusPalletParachainSystemRelayStateSnapshotRelayDispatchQueueRemainingCapacity (431) */ @@ -6264,8 +6268,8 @@ declare module "@polkadot/types/lookup" { readonly remainingSize: u32; } - /** @name PolkadotPrimitivesV7AbridgedHrmpChannel (434) */ - interface PolkadotPrimitivesV7AbridgedHrmpChannel extends Struct { + /** @name PolkadotPrimitivesV8AbridgedHrmpChannel (434) */ + interface PolkadotPrimitivesV8AbridgedHrmpChannel extends Struct { readonly maxCapacity: u32; readonly maxTotalSize: u32; readonly maxMessageSize: u32; @@ -6274,8 +6278,8 @@ declare module "@polkadot/types/lookup" { readonly mqcHead: Option; } - /** @name PolkadotPrimitivesV7AbridgedHostConfiguration (435) */ - interface PolkadotPrimitivesV7AbridgedHostConfiguration extends Struct { + /** @name PolkadotPrimitivesV8AbridgedHostConfiguration (435) */ + interface PolkadotPrimitivesV8AbridgedHostConfiguration extends Struct { readonly maxCodeSize: u32; readonly maxHeadDataSize: u32; readonly maxUpwardQueueCount: u32; @@ -6285,11 +6289,11 @@ declare module "@polkadot/types/lookup" { readonly hrmpMaxMessageNumPerCandidate: u32; readonly validationUpgradeCooldown: u32; readonly validationUpgradeDelay: u32; - readonly asyncBackingParams: PolkadotPrimitivesV7AsyncBackingAsyncBackingParams; + readonly asyncBackingParams: PolkadotPrimitivesV8AsyncBackingAsyncBackingParams; } - /** @name PolkadotPrimitivesV7AsyncBackingAsyncBackingParams (436) */ - interface PolkadotPrimitivesV7AsyncBackingAsyncBackingParams extends Struct { + /** @name PolkadotPrimitivesV8AsyncBackingAsyncBackingParams (436) */ + interface PolkadotPrimitivesV8AsyncBackingAsyncBackingParams extends Struct { readonly maxCandidateDepth: u32; readonly allowedAncestryLen: u32; } @@ -6929,7 +6933,6 @@ declare module "@polkadot/types/lookup" { readonly isLimitCannotBeZero: boolean; readonly isContractMetadataAlreadySet: boolean; readonly isContractNotExist: boolean; - readonly isKeyTooLong: boolean; readonly isSymbolTooLong: boolean; readonly isNameTooLong: boolean; readonly isAssetTypeNotFound: boolean; @@ -6943,7 +6946,6 @@ declare module "@polkadot/types/lookup" { | "LimitCannotBeZero" | "ContractMetadataAlreadySet" | "ContractNotExist" - | "KeyTooLong" | "SymbolTooLong" | "NameTooLong" | "AssetTypeNotFound" @@ -7134,7 +7136,6 @@ declare module "@polkadot/types/lookup" { readonly isNotRequested: boolean; readonly isTooMany: boolean; readonly isTooFew: boolean; - readonly isNoCost: boolean; readonly type: | "TooBig" | "AlreadyNoted" @@ -7143,8 +7144,7 @@ declare module "@polkadot/types/lookup" { | "Requested" | "NotRequested" | "TooMany" - | "TooFew" - | "NoCost"; + | "TooFew"; } /** @name PalletConvictionVotingVoteVoting (573) */ diff --git a/typescript-api/src/moonriver/interfaces/augment-api-errors.ts b/typescript-api/src/moonriver/interfaces/augment-api-errors.ts index 26967c2553..d9da3610f5 100644 --- a/typescript-api/src/moonriver/interfaces/augment-api-errors.ts +++ b/typescript-api/src/moonriver/interfaces/augment-api-errors.ts @@ -681,10 +681,6 @@ declare module "@polkadot/api-base/types/errors" { * Contract not exist **/ ContractNotExist: AugmentedError; - /** - * The key lengths exceeds the maximum allowed - **/ - KeyTooLong: AugmentedError; /** * The limit cannot be zero **/ @@ -1091,10 +1087,6 @@ declare module "@polkadot/api-base/types/errors" { * Preimage has already been noted on-chain. **/ AlreadyNoted: AugmentedError; - /** - * No ticket with a cost was returned by [`Config::Consideration`] to store the preimage. - **/ - NoCost: AugmentedError; /** * The user is not authorized to perform this action. **/ diff --git a/typescript-api/src/moonriver/interfaces/augment-api-events.ts b/typescript-api/src/moonriver/interfaces/augment-api-events.ts index 886883fc35..26f8f85cc1 100644 --- a/typescript-api/src/moonriver/interfaces/augment-api-events.ts +++ b/typescript-api/src/moonriver/interfaces/augment-api-events.ts @@ -37,6 +37,7 @@ import type { MoonriverRuntimeXcmConfigAssetType, NimbusPrimitivesNimbusCryptoPublic, PalletConvictionVotingTally, + PalletConvictionVotingVoteAccountVote, PalletMultisigTimepoint, PalletParachainStakingDelegationRequestsCancelledScheduledRequest, PalletParachainStakingDelegatorAdded, @@ -581,6 +582,22 @@ declare module "@polkadot/api-base/types/events" { * An \[account\] has cancelled a previous delegation operation. **/ Undelegated: AugmentedEvent; + /** + * An account that has voted + **/ + Voted: AugmentedEvent< + ApiType, + [who: AccountId20, vote: PalletConvictionVotingVoteAccountVote], + { who: AccountId20; vote: PalletConvictionVotingVoteAccountVote } + >; + /** + * A vote that been removed + **/ + VoteRemoved: AugmentedEvent< + ApiType, + [who: AccountId20, vote: PalletConvictionVotingVoteAccountVote], + { who: AccountId20; vote: PalletConvictionVotingVoteAccountVote } + >; /** * Generic event **/ diff --git a/typescript-api/src/moonriver/interfaces/augment-api-query.ts b/typescript-api/src/moonriver/interfaces/augment-api-query.ts index 08ce4d35a8..4d9811bfe1 100644 --- a/typescript-api/src/moonriver/interfaces/augment-api-query.ts +++ b/typescript-api/src/moonriver/interfaces/augment-api-query.ts @@ -110,10 +110,10 @@ import type { PalletXcmTransactorRemoteTransactInfoWithMaxWeight, PalletXcmVersionMigrationStage, PolkadotCorePrimitivesOutboundHrmpMessage, - PolkadotPrimitivesV7AbridgedHostConfiguration, - PolkadotPrimitivesV7PersistedValidationData, - PolkadotPrimitivesV7UpgradeGoAhead, - PolkadotPrimitivesV7UpgradeRestriction, + PolkadotPrimitivesV8AbridgedHostConfiguration, + PolkadotPrimitivesV8PersistedValidationData, + PolkadotPrimitivesV8UpgradeGoAhead, + PolkadotPrimitivesV8UpgradeRestriction, SpRuntimeDigest, SpTrieStorageProof, SpWeightsWeightV2Weight, @@ -1142,6 +1142,19 @@ declare module "@polkadot/api-base/types/storage" { **/ totalSelected: AugmentedQuery Observable, []> & QueryableStorageEntry; + /** + * Records collators' inactivity. + * Data persists for MaxOfflineRounds + 1 rounds before being pruned. + **/ + wasInactive: AugmentedQuery< + ApiType, + ( + arg1: u32 | AnyNumber | Uint8Array, + arg2: AccountId20 | string | Uint8Array + ) => Observable>, + [u32, AccountId20] + > & + QueryableStorageEntry; /** * Generic query **/ @@ -1187,7 +1200,7 @@ declare module "@polkadot/api-base/types/storage" { **/ hostConfiguration: AugmentedQuery< ApiType, - () => Observable>, + () => Observable>, [] > & QueryableStorageEntry; @@ -1333,7 +1346,7 @@ declare module "@polkadot/api-base/types/storage" { **/ upgradeGoAhead: AugmentedQuery< ApiType, - () => Observable>, + () => Observable>, [] > & QueryableStorageEntry; @@ -1348,7 +1361,7 @@ declare module "@polkadot/api-base/types/storage" { **/ upgradeRestrictionSignal: AugmentedQuery< ApiType, - () => Observable>, + () => Observable>, [] > & QueryableStorageEntry; @@ -1371,7 +1384,7 @@ declare module "@polkadot/api-base/types/storage" { **/ validationData: AugmentedQuery< ApiType, - () => Observable>, + () => Observable>, [] > & QueryableStorageEntry; diff --git a/typescript-api/src/moonriver/interfaces/augment-api-tx.ts b/typescript-api/src/moonriver/interfaces/augment-api-tx.ts index 8b6985f2b2..1ea130b47e 100644 --- a/typescript-api/src/moonriver/interfaces/augment-api-tx.ts +++ b/typescript-api/src/moonriver/interfaces/augment-api-tx.ts @@ -688,8 +688,6 @@ declare module "@polkadot/api-base/types/submittable" { * * - `id`: The identifier of the asset to be destroyed. This must identify an existing * asset. - * - * The asset class must be frozen before calling `start_destroy`. **/ startDestroy: AugmentedSubmittable< (id: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, @@ -791,6 +789,32 @@ declare module "@polkadot/api-base/types/submittable" { ) => SubmittableExtrinsic, [Compact, AccountId20, Compact] >; + /** + * Transfer the entire transferable balance from the caller asset account. + * + * NOTE: This function only attempts to transfer _transferable_ balances. This means that + * any held, frozen, or minimum balance (when `keep_alive` is `true`), will not be + * transferred by this function. To ensure that this function results in a killed account, + * you might need to prepare the account by removing any reference counters, storage + * deposits, etc... + * + * The dispatch origin of this call must be Signed. + * + * - `id`: The identifier of the asset for the account holding a deposit. + * - `dest`: The recipient of the transfer. + * - `keep_alive`: A boolean to determine if the `transfer_all` operation should send all + * of the funds the asset account has, causing the sender asset account to be killed + * (false), or transfer everything except at least the minimum balance, which will + * guarantee to keep the sender asset account alive (true). + **/ + transferAll: AugmentedSubmittable< + ( + id: Compact | AnyNumber | Uint8Array, + dest: AccountId20 | string | Uint8Array, + keepAlive: bool | boolean | Uint8Array + ) => SubmittableExtrinsic, + [Compact, AccountId20, bool] + >; /** * Transfer some asset balance from a previously delegated account to some third-party * account. @@ -1855,7 +1879,7 @@ declare module "@polkadot/api-base/types/submittable" { * - `max_fee`: The maximum fee that may be paid. This should just be auto-populated as: * * ```nocompile - * Self::registrars().get(reg_index).unwrap().fee + * Registrars::::get().get(reg_index).unwrap().fee * ``` * * Emits `JudgementRequested` if successful. @@ -2814,38 +2838,6 @@ declare module "@polkadot/api-base/types/submittable" { [key: string]: SubmittableExtrinsicFunction; }; parachainSystem: { - /** - * Authorize an upgrade to a given `code_hash` for the runtime. The runtime can be supplied - * later. - * - * The `check_version` parameter sets a boolean flag for whether or not the runtime's spec - * version and name should be verified on upgrade. Since the authorization only has a hash, - * it cannot actually perform the verification. - * - * This call requires Root origin. - **/ - authorizeUpgrade: AugmentedSubmittable< - ( - codeHash: H256 | string | Uint8Array, - checkVersion: bool | boolean | Uint8Array - ) => SubmittableExtrinsic, - [H256, bool] - >; - /** - * Provide the preimage (runtime binary) `code` for an upgrade that has been authorized. - * - * If the authorization required a version check, this call will ensure the spec name - * remains unchanged and that the spec version has increased. - * - * Note that this function will not apply the new `code`, but only attempt to schedule the - * upgrade with the Relay Chain. - * - * All origins are allowed. - **/ - enactAuthorizedUpgrade: AugmentedSubmittable< - (code: Bytes | string | Uint8Array) => SubmittableExtrinsic, - [Bytes] - >; /** * Set the current validation data. * diff --git a/typescript-api/src/moonriver/interfaces/lookup.ts b/typescript-api/src/moonriver/interfaces/lookup.ts index 50be4c7a41..3a855ef6e6 100644 --- a/typescript-api/src/moonriver/interfaces/lookup.ts +++ b/typescript-api/src/moonriver/interfaces/lookup.ts @@ -1088,11 +1088,39 @@ export default { PalletConvictionVotingEvent: { _enum: { Delegated: "(AccountId20,AccountId20)", - Undelegated: "AccountId20" + Undelegated: "AccountId20", + Voted: { + who: "AccountId20", + vote: "PalletConvictionVotingVoteAccountVote" + }, + VoteRemoved: { + who: "AccountId20", + vote: "PalletConvictionVotingVoteAccountVote" + } + } + }, + /** + * Lookup94: pallet_conviction_voting::vote::AccountVote + **/ + PalletConvictionVotingVoteAccountVote: { + _enum: { + Standard: { + vote: "Vote", + balance: "u128" + }, + Split: { + aye: "u128", + nay: "u128" + }, + SplitAbstain: { + aye: "u128", + nay: "u128", + abstain: "u128" + } } }, /** - * Lookup94: pallet_referenda::pallet::Event + * Lookup96: pallet_referenda::pallet::Event **/ PalletReferendaEvent: { _enum: { @@ -1172,7 +1200,7 @@ export default { } }, /** - * Lookup95: frame_support::traits::preimages::Bounded + * Lookup97: frame_support::traits::preimages::Bounded **/ FrameSupportPreimagesBounded: { _enum: { @@ -1193,7 +1221,7 @@ export default { } }, /** - * Lookup97: frame_system::pallet::Call + * Lookup99: frame_system::pallet::Call **/ FrameSystemCall: { _enum: { @@ -1238,7 +1266,7 @@ export default { } }, /** - * Lookup101: cumulus_pallet_parachain_system::pallet::Call + * Lookup103: cumulus_pallet_parachain_system::pallet::Call **/ CumulusPalletParachainSystemCall: { _enum: { @@ -1247,56 +1275,49 @@ export default { }, sudo_send_upward_message: { message: "Bytes" - }, - authorize_upgrade: { - codeHash: "H256", - checkVersion: "bool" - }, - enact_authorized_upgrade: { - code: "Bytes" } } }, /** - * Lookup102: cumulus_primitives_parachain_inherent::ParachainInherentData + * Lookup104: cumulus_primitives_parachain_inherent::ParachainInherentData **/ CumulusPrimitivesParachainInherentParachainInherentData: { - validationData: "PolkadotPrimitivesV7PersistedValidationData", + validationData: "PolkadotPrimitivesV8PersistedValidationData", relayChainState: "SpTrieStorageProof", downwardMessages: "Vec", horizontalMessages: "BTreeMap>" }, /** - * Lookup103: polkadot_primitives::v7::PersistedValidationData + * Lookup105: polkadot_primitives::v8::PersistedValidationData **/ - PolkadotPrimitivesV7PersistedValidationData: { + PolkadotPrimitivesV8PersistedValidationData: { parentHead: "Bytes", relayParentNumber: "u32", relayParentStorageRoot: "H256", maxPovSize: "u32" }, /** - * Lookup105: sp_trie::storage_proof::StorageProof + * Lookup107: sp_trie::storage_proof::StorageProof **/ SpTrieStorageProof: { trieNodes: "BTreeSet" }, /** - * Lookup108: polkadot_core_primitives::InboundDownwardMessage + * Lookup110: polkadot_core_primitives::InboundDownwardMessage **/ PolkadotCorePrimitivesInboundDownwardMessage: { sentAt: "u32", msg: "Bytes" }, /** - * Lookup112: polkadot_core_primitives::InboundHrmpMessage + * Lookup114: polkadot_core_primitives::InboundHrmpMessage **/ PolkadotCorePrimitivesInboundHrmpMessage: { sentAt: "u32", data: "Bytes" }, /** - * Lookup115: pallet_timestamp::pallet::Call + * Lookup117: pallet_timestamp::pallet::Call **/ PalletTimestampCall: { _enum: { @@ -1306,7 +1327,7 @@ export default { } }, /** - * Lookup116: pallet_root_testing::pallet::Call + * Lookup118: pallet_root_testing::pallet::Call **/ PalletRootTestingCall: { _enum: { @@ -1317,7 +1338,7 @@ export default { } }, /** - * Lookup117: pallet_balances::pallet::Call + * Lookup119: pallet_balances::pallet::Call **/ PalletBalancesCall: { _enum: { @@ -1362,13 +1383,13 @@ export default { } }, /** - * Lookup120: pallet_balances::types::AdjustmentDirection + * Lookup122: pallet_balances::types::AdjustmentDirection **/ PalletBalancesAdjustmentDirection: { _enum: ["Increase", "Decrease"] }, /** - * Lookup121: pallet_parachain_staking::pallet::Call + * Lookup123: pallet_parachain_staking::pallet::Call **/ PalletParachainStakingCall: { _enum: { @@ -1506,13 +1527,13 @@ export default { } }, /** - * Lookup124: pallet_author_inherent::pallet::Call + * Lookup126: pallet_author_inherent::pallet::Call **/ PalletAuthorInherentCall: { _enum: ["kick_off_authorship_validation"] }, /** - * Lookup125: pallet_author_slot_filter::pallet::Call + * Lookup127: pallet_author_slot_filter::pallet::Call **/ PalletAuthorSlotFilterCall: { _enum: { @@ -1525,7 +1546,7 @@ export default { } }, /** - * Lookup126: pallet_author_mapping::pallet::Call + * Lookup128: pallet_author_mapping::pallet::Call **/ PalletAuthorMappingCall: { _enum: { @@ -1549,7 +1570,7 @@ export default { } }, /** - * Lookup127: pallet_moonbeam_orbiters::pallet::Call + * Lookup129: pallet_moonbeam_orbiters::pallet::Call **/ PalletMoonbeamOrbitersCall: { _enum: { @@ -1575,7 +1596,7 @@ export default { } }, /** - * Lookup128: pallet_utility::pallet::Call + * Lookup130: pallet_utility::pallet::Call **/ PalletUtilityCall: { _enum: { @@ -1603,7 +1624,7 @@ export default { } }, /** - * Lookup130: moonriver_runtime::OriginCaller + * Lookup132: moonriver_runtime::OriginCaller **/ MoonriverRuntimeOriginCaller: { _enum: { @@ -1720,7 +1741,7 @@ export default { } }, /** - * Lookup131: frame_support::dispatch::RawOrigin + * Lookup133: frame_support::dispatch::RawOrigin **/ FrameSupportDispatchRawOrigin: { _enum: { @@ -1730,7 +1751,7 @@ export default { } }, /** - * Lookup132: pallet_ethereum::RawOrigin + * Lookup134: pallet_ethereum::RawOrigin **/ PalletEthereumRawOrigin: { _enum: { @@ -1738,7 +1759,7 @@ export default { } }, /** - * Lookup133: moonriver_runtime::governance::origins::custom_origins::Origin + * Lookup135: moonriver_runtime::governance::origins::custom_origins::Origin **/ MoonriverRuntimeGovernanceOriginsCustomOriginsOrigin: { _enum: [ @@ -1750,7 +1771,7 @@ export default { ] }, /** - * Lookup134: pallet_collective::RawOrigin + * Lookup136: pallet_collective::RawOrigin **/ PalletCollectiveRawOrigin: { _enum: { @@ -1760,7 +1781,7 @@ export default { } }, /** - * Lookup136: cumulus_pallet_xcm::pallet::Origin + * Lookup138: cumulus_pallet_xcm::pallet::Origin **/ CumulusPalletXcmOrigin: { _enum: { @@ -1769,7 +1790,7 @@ export default { } }, /** - * Lookup137: pallet_xcm::pallet::Origin + * Lookup139: pallet_xcm::pallet::Origin **/ PalletXcmOrigin: { _enum: { @@ -1778,30 +1799,30 @@ export default { } }, /** - * Lookup138: staging_xcm::v4::location::Location + * Lookup140: staging_xcm::v4::location::Location **/ StagingXcmV4Location: { parents: "u8", interior: "StagingXcmV4Junctions" }, /** - * Lookup139: staging_xcm::v4::junctions::Junctions + * Lookup141: staging_xcm::v4::junctions::Junctions **/ StagingXcmV4Junctions: { _enum: { Here: "Null", - X1: "[Lookup141;1]", - X2: "[Lookup141;2]", - X3: "[Lookup141;3]", - X4: "[Lookup141;4]", - X5: "[Lookup141;5]", - X6: "[Lookup141;6]", - X7: "[Lookup141;7]", - X8: "[Lookup141;8]" + X1: "[Lookup143;1]", + X2: "[Lookup143;2]", + X3: "[Lookup143;3]", + X4: "[Lookup143;4]", + X5: "[Lookup143;5]", + X6: "[Lookup143;6]", + X7: "[Lookup143;7]", + X8: "[Lookup143;8]" } }, /** - * Lookup141: staging_xcm::v4::junction::Junction + * Lookup143: staging_xcm::v4::junction::Junction **/ StagingXcmV4Junction: { _enum: { @@ -1833,7 +1854,7 @@ export default { } }, /** - * Lookup144: staging_xcm::v4::junction::NetworkId + * Lookup146: staging_xcm::v4::junction::NetworkId **/ StagingXcmV4JunctionNetworkId: { _enum: { @@ -1856,7 +1877,7 @@ export default { } }, /** - * Lookup145: xcm::v3::junction::BodyId + * Lookup147: xcm::v3::junction::BodyId **/ XcmV3JunctionBodyId: { _enum: { @@ -1873,7 +1894,7 @@ export default { } }, /** - * Lookup146: xcm::v3::junction::BodyPart + * Lookup148: xcm::v3::junction::BodyPart **/ XcmV3JunctionBodyPart: { _enum: { @@ -1896,7 +1917,7 @@ export default { } }, /** - * Lookup154: pallet_ethereum_xcm::RawOrigin + * Lookup156: pallet_ethereum_xcm::RawOrigin **/ PalletEthereumXcmRawOrigin: { _enum: { @@ -1904,11 +1925,11 @@ export default { } }, /** - * Lookup155: sp_core::Void + * Lookup157: sp_core::Void **/ SpCoreVoid: "Null", /** - * Lookup156: pallet_proxy::pallet::Call + * Lookup158: pallet_proxy::pallet::Call **/ PalletProxyCall: { _enum: { @@ -1961,13 +1982,13 @@ export default { } }, /** - * Lookup158: pallet_maintenance_mode::pallet::Call + * Lookup160: pallet_maintenance_mode::pallet::Call **/ PalletMaintenanceModeCall: { _enum: ["enter_maintenance_mode", "resume_normal_operation"] }, /** - * Lookup159: pallet_identity::pallet::Call + * Lookup161: pallet_identity::pallet::Call **/ PalletIdentityCall: { _enum: { @@ -2052,7 +2073,7 @@ export default { } }, /** - * Lookup160: pallet_identity::legacy::IdentityInfo + * Lookup162: pallet_identity::legacy::IdentityInfo **/ PalletIdentityLegacyIdentityInfo: { additional: "Vec<(Data,Data)>", @@ -2066,7 +2087,7 @@ export default { twitter: "Data" }, /** - * Lookup198: pallet_identity::types::Judgement + * Lookup200: pallet_identity::types::Judgement **/ PalletIdentityJudgement: { _enum: { @@ -2080,11 +2101,11 @@ export default { } }, /** - * Lookup200: account::EthereumSignature + * Lookup202: account::EthereumSignature **/ AccountEthereumSignature: "[u8;65]", /** - * Lookup202: pallet_multisig::pallet::Call + * Lookup204: pallet_multisig::pallet::Call **/ PalletMultisigCall: { _enum: { @@ -2115,7 +2136,7 @@ export default { } }, /** - * Lookup204: pallet_moonbeam_lazy_migrations::pallet::Call + * Lookup206: pallet_moonbeam_lazy_migrations::pallet::Call **/ PalletMoonbeamLazyMigrationsCall: { _enum: { @@ -2140,7 +2161,7 @@ export default { } }, /** - * Lookup207: pallet_parameters::pallet::Call + * Lookup209: pallet_parameters::pallet::Call **/ PalletParametersCall: { _enum: { @@ -2150,7 +2171,7 @@ export default { } }, /** - * Lookup208: moonriver_runtime::runtime_params::RuntimeParameters + * Lookup210: moonriver_runtime::runtime_params::RuntimeParameters **/ MoonriverRuntimeRuntimeParamsRuntimeParameters: { _enum: { @@ -2159,7 +2180,7 @@ export default { } }, /** - * Lookup209: moonriver_runtime::runtime_params::dynamic_params::runtime_config::Parameters + * Lookup211: moonriver_runtime::runtime_params::dynamic_params::runtime_config::Parameters **/ MoonriverRuntimeRuntimeParamsDynamicParamsRuntimeConfigParameters: { _enum: { @@ -2168,7 +2189,7 @@ export default { } }, /** - * Lookup211: moonriver_runtime::runtime_params::dynamic_params::pallet_randomness::Parameters + * Lookup213: moonriver_runtime::runtime_params::dynamic_params::pallet_randomness::Parameters **/ MoonriverRuntimeRuntimeParamsDynamicParamsPalletRandomnessParameters: { _enum: { @@ -2176,7 +2197,7 @@ export default { } }, /** - * Lookup213: pallet_evm::pallet::Call + * Lookup215: pallet_evm::pallet::Call **/ PalletEvmCall: { _enum: { @@ -2219,7 +2240,7 @@ export default { } }, /** - * Lookup219: pallet_ethereum::pallet::Call + * Lookup221: pallet_ethereum::pallet::Call **/ PalletEthereumCall: { _enum: { @@ -2229,7 +2250,7 @@ export default { } }, /** - * Lookup220: ethereum::transaction::TransactionV2 + * Lookup222: ethereum::transaction::TransactionV2 **/ EthereumTransactionTransactionV2: { _enum: { @@ -2239,7 +2260,7 @@ export default { } }, /** - * Lookup221: ethereum::transaction::LegacyTransaction + * Lookup223: ethereum::transaction::LegacyTransaction **/ EthereumTransactionLegacyTransaction: { nonce: "U256", @@ -2251,7 +2272,7 @@ export default { signature: "EthereumTransactionTransactionSignature" }, /** - * Lookup222: ethereum::transaction::TransactionAction + * Lookup224: ethereum::transaction::TransactionAction **/ EthereumTransactionTransactionAction: { _enum: { @@ -2260,7 +2281,7 @@ export default { } }, /** - * Lookup223: ethereum::transaction::TransactionSignature + * Lookup225: ethereum::transaction::TransactionSignature **/ EthereumTransactionTransactionSignature: { v: "u64", @@ -2268,7 +2289,7 @@ export default { s: "H256" }, /** - * Lookup225: ethereum::transaction::EIP2930Transaction + * Lookup227: ethereum::transaction::EIP2930Transaction **/ EthereumTransactionEip2930Transaction: { chainId: "u64", @@ -2284,14 +2305,14 @@ export default { s: "H256" }, /** - * Lookup227: ethereum::transaction::AccessListItem + * Lookup229: ethereum::transaction::AccessListItem **/ EthereumTransactionAccessListItem: { address: "H160", storageKeys: "Vec" }, /** - * Lookup228: ethereum::transaction::EIP1559Transaction + * Lookup230: ethereum::transaction::EIP1559Transaction **/ EthereumTransactionEip1559Transaction: { chainId: "u64", @@ -2308,7 +2329,7 @@ export default { s: "H256" }, /** - * Lookup229: pallet_scheduler::pallet::Call + * Lookup231: pallet_scheduler::pallet::Call **/ PalletSchedulerCall: { _enum: { @@ -2364,7 +2385,7 @@ export default { } }, /** - * Lookup231: pallet_preimage::pallet::Call + * Lookup233: pallet_preimage::pallet::Call **/ PalletPreimageCall: { _enum: { @@ -2395,7 +2416,7 @@ export default { } }, /** - * Lookup232: pallet_conviction_voting::pallet::Call + * Lookup234: pallet_conviction_voting::pallet::Call **/ PalletConvictionVotingCall: { _enum: { @@ -2427,26 +2448,6 @@ export default { } } }, - /** - * Lookup233: pallet_conviction_voting::vote::AccountVote - **/ - PalletConvictionVotingVoteAccountVote: { - _enum: { - Standard: { - vote: "Vote", - balance: "u128" - }, - Split: { - aye: "u128", - nay: "u128" - }, - SplitAbstain: { - aye: "u128", - nay: "u128", - abstain: "u128" - } - } - }, /** * Lookup235: pallet_conviction_voting::conviction::Conviction **/ @@ -3900,6 +3901,11 @@ export default { block: { id: "Compact", who: "AccountId20" + }, + transfer_all: { + id: "Compact", + dest: "AccountId20", + keepAlive: "bool" } } }, @@ -5015,7 +5021,7 @@ export default { CumulusPalletParachainSystemUnincludedSegmentAncestor: { usedBandwidth: "CumulusPalletParachainSystemUnincludedSegmentUsedBandwidth", paraHeadHash: "Option", - consumedGoAheadSignal: "Option" + consumedGoAheadSignal: "Option" }, /** * Lookup420: cumulus_pallet_parachain_system::unincluded_segment::UsedBandwidth @@ -5033,9 +5039,9 @@ export default { totalBytes: "u32" }, /** - * Lookup426: polkadot_primitives::v7::UpgradeGoAhead + * Lookup426: polkadot_primitives::v8::UpgradeGoAhead **/ - PolkadotPrimitivesV7UpgradeGoAhead: { + PolkadotPrimitivesV8UpgradeGoAhead: { _enum: ["Abort", "GoAhead"] }, /** @@ -5044,12 +5050,12 @@ export default { CumulusPalletParachainSystemUnincludedSegmentSegmentTracker: { usedBandwidth: "CumulusPalletParachainSystemUnincludedSegmentUsedBandwidth", hrmpWatermark: "Option", - consumedGoAheadSignal: "Option" + consumedGoAheadSignal: "Option" }, /** - * Lookup429: polkadot_primitives::v7::UpgradeRestriction + * Lookup429: polkadot_primitives::v8::UpgradeRestriction **/ - PolkadotPrimitivesV7UpgradeRestriction: { + PolkadotPrimitivesV8UpgradeRestriction: { _enum: ["Present"] }, /** @@ -5059,8 +5065,8 @@ export default { dmqMqcHead: "H256", relayDispatchQueueRemainingCapacity: "CumulusPalletParachainSystemRelayStateSnapshotRelayDispatchQueueRemainingCapacity", - ingressChannels: "Vec<(u32,PolkadotPrimitivesV7AbridgedHrmpChannel)>", - egressChannels: "Vec<(u32,PolkadotPrimitivesV7AbridgedHrmpChannel)>" + ingressChannels: "Vec<(u32,PolkadotPrimitivesV8AbridgedHrmpChannel)>", + egressChannels: "Vec<(u32,PolkadotPrimitivesV8AbridgedHrmpChannel)>" }, /** * Lookup431: cumulus_pallet_parachain_system::relay_state_snapshot::RelayDispatchQueueRemainingCapacity @@ -5070,9 +5076,9 @@ export default { remainingSize: "u32" }, /** - * Lookup434: polkadot_primitives::v7::AbridgedHrmpChannel + * Lookup434: polkadot_primitives::v8::AbridgedHrmpChannel **/ - PolkadotPrimitivesV7AbridgedHrmpChannel: { + PolkadotPrimitivesV8AbridgedHrmpChannel: { maxCapacity: "u32", maxTotalSize: "u32", maxMessageSize: "u32", @@ -5081,9 +5087,9 @@ export default { mqcHead: "Option" }, /** - * Lookup435: polkadot_primitives::v7::AbridgedHostConfiguration + * Lookup435: polkadot_primitives::v8::AbridgedHostConfiguration **/ - PolkadotPrimitivesV7AbridgedHostConfiguration: { + PolkadotPrimitivesV8AbridgedHostConfiguration: { maxCodeSize: "u32", maxHeadDataSize: "u32", maxUpwardQueueCount: "u32", @@ -5093,12 +5099,12 @@ export default { hrmpMaxMessageNumPerCandidate: "u32", validationUpgradeCooldown: "u32", validationUpgradeDelay: "u32", - asyncBackingParams: "PolkadotPrimitivesV7AsyncBackingAsyncBackingParams" + asyncBackingParams: "PolkadotPrimitivesV8AsyncBackingAsyncBackingParams" }, /** - * Lookup436: polkadot_primitives::v7::async_backing::AsyncBackingParams + * Lookup436: polkadot_primitives::v8::async_backing::AsyncBackingParams **/ - PolkadotPrimitivesV7AsyncBackingAsyncBackingParams: { + PolkadotPrimitivesV8AsyncBackingAsyncBackingParams: { maxCandidateDepth: "u32", allowedAncestryLen: "u32" }, @@ -5697,7 +5703,6 @@ export default { "LimitCannotBeZero", "ContractMetadataAlreadySet", "ContractNotExist", - "KeyTooLong", "SymbolTooLong", "NameTooLong", "AssetTypeNotFound", @@ -5887,8 +5892,7 @@ export default { "Requested", "NotRequested", "TooMany", - "TooFew", - "NoCost" + "TooFew" ] }, /** diff --git a/typescript-api/src/moonriver/interfaces/registry.ts b/typescript-api/src/moonriver/interfaces/registry.ts index 0017c0aa77..a890602fd3 100644 --- a/typescript-api/src/moonriver/interfaces/registry.ts +++ b/typescript-api/src/moonriver/interfaces/registry.ts @@ -306,12 +306,12 @@ import type { PolkadotCorePrimitivesInboundHrmpMessage, PolkadotCorePrimitivesOutboundHrmpMessage, PolkadotParachainPrimitivesPrimitivesHrmpChannelId, - PolkadotPrimitivesV7AbridgedHostConfiguration, - PolkadotPrimitivesV7AbridgedHrmpChannel, - PolkadotPrimitivesV7AsyncBackingAsyncBackingParams, - PolkadotPrimitivesV7PersistedValidationData, - PolkadotPrimitivesV7UpgradeGoAhead, - PolkadotPrimitivesV7UpgradeRestriction, + PolkadotPrimitivesV8AbridgedHostConfiguration, + PolkadotPrimitivesV8AbridgedHrmpChannel, + PolkadotPrimitivesV8AsyncBackingAsyncBackingParams, + PolkadotPrimitivesV8PersistedValidationData, + PolkadotPrimitivesV8UpgradeGoAhead, + PolkadotPrimitivesV8UpgradeRestriction, SessionKeysPrimitivesVrfVrfCryptoPublic, SpArithmeticArithmeticError, SpCoreVoid, @@ -705,12 +705,12 @@ declare module "@polkadot/types/types/registry" { PolkadotCorePrimitivesInboundHrmpMessage: PolkadotCorePrimitivesInboundHrmpMessage; PolkadotCorePrimitivesOutboundHrmpMessage: PolkadotCorePrimitivesOutboundHrmpMessage; PolkadotParachainPrimitivesPrimitivesHrmpChannelId: PolkadotParachainPrimitivesPrimitivesHrmpChannelId; - PolkadotPrimitivesV7AbridgedHostConfiguration: PolkadotPrimitivesV7AbridgedHostConfiguration; - PolkadotPrimitivesV7AbridgedHrmpChannel: PolkadotPrimitivesV7AbridgedHrmpChannel; - PolkadotPrimitivesV7AsyncBackingAsyncBackingParams: PolkadotPrimitivesV7AsyncBackingAsyncBackingParams; - PolkadotPrimitivesV7PersistedValidationData: PolkadotPrimitivesV7PersistedValidationData; - PolkadotPrimitivesV7UpgradeGoAhead: PolkadotPrimitivesV7UpgradeGoAhead; - PolkadotPrimitivesV7UpgradeRestriction: PolkadotPrimitivesV7UpgradeRestriction; + PolkadotPrimitivesV8AbridgedHostConfiguration: PolkadotPrimitivesV8AbridgedHostConfiguration; + PolkadotPrimitivesV8AbridgedHrmpChannel: PolkadotPrimitivesV8AbridgedHrmpChannel; + PolkadotPrimitivesV8AsyncBackingAsyncBackingParams: PolkadotPrimitivesV8AsyncBackingAsyncBackingParams; + PolkadotPrimitivesV8PersistedValidationData: PolkadotPrimitivesV8PersistedValidationData; + PolkadotPrimitivesV8UpgradeGoAhead: PolkadotPrimitivesV8UpgradeGoAhead; + PolkadotPrimitivesV8UpgradeRestriction: PolkadotPrimitivesV8UpgradeRestriction; SessionKeysPrimitivesVrfVrfCryptoPublic: SessionKeysPrimitivesVrfVrfCryptoPublic; SpArithmeticArithmeticError: SpArithmeticArithmeticError; SpCoreVoid: SpCoreVoid; diff --git a/typescript-api/src/moonriver/interfaces/types-lookup.ts b/typescript-api/src/moonriver/interfaces/types-lookup.ts index 08414f4828..bbe40e27ea 100644 --- a/typescript-api/src/moonriver/interfaces/types-lookup.ts +++ b/typescript-api/src/moonriver/interfaces/types-lookup.ts @@ -1339,10 +1339,41 @@ declare module "@polkadot/types/lookup" { readonly asDelegated: ITuple<[AccountId20, AccountId20]>; readonly isUndelegated: boolean; readonly asUndelegated: AccountId20; - readonly type: "Delegated" | "Undelegated"; + readonly isVoted: boolean; + readonly asVoted: { + readonly who: AccountId20; + readonly vote: PalletConvictionVotingVoteAccountVote; + } & Struct; + readonly isVoteRemoved: boolean; + readonly asVoteRemoved: { + readonly who: AccountId20; + readonly vote: PalletConvictionVotingVoteAccountVote; + } & Struct; + readonly type: "Delegated" | "Undelegated" | "Voted" | "VoteRemoved"; + } + + /** @name PalletConvictionVotingVoteAccountVote (94) */ + interface PalletConvictionVotingVoteAccountVote extends Enum { + readonly isStandard: boolean; + readonly asStandard: { + readonly vote: Vote; + readonly balance: u128; + } & Struct; + readonly isSplit: boolean; + readonly asSplit: { + readonly aye: u128; + readonly nay: u128; + } & Struct; + readonly isSplitAbstain: boolean; + readonly asSplitAbstain: { + readonly aye: u128; + readonly nay: u128; + readonly abstain: u128; + } & Struct; + readonly type: "Standard" | "Split" | "SplitAbstain"; } - /** @name PalletReferendaEvent (94) */ + /** @name PalletReferendaEvent (96) */ interface PalletReferendaEvent extends Enum { readonly isSubmitted: boolean; readonly asSubmitted: { @@ -1446,7 +1477,7 @@ declare module "@polkadot/types/lookup" { | "MetadataCleared"; } - /** @name FrameSupportPreimagesBounded (95) */ + /** @name FrameSupportPreimagesBounded (97) */ interface FrameSupportPreimagesBounded extends Enum { readonly isLegacy: boolean; readonly asLegacy: { @@ -1462,7 +1493,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Legacy" | "Inline" | "Lookup"; } - /** @name FrameSystemCall (97) */ + /** @name FrameSystemCall (99) */ interface FrameSystemCall extends Enum { readonly isRemark: boolean; readonly asRemark: { @@ -1523,7 +1554,7 @@ declare module "@polkadot/types/lookup" { | "ApplyAuthorizedUpgrade"; } - /** @name CumulusPalletParachainSystemCall (101) */ + /** @name CumulusPalletParachainSystemCall (103) */ interface CumulusPalletParachainSystemCall extends Enum { readonly isSetValidationData: boolean; readonly asSetValidationData: { @@ -1533,56 +1564,43 @@ declare module "@polkadot/types/lookup" { readonly asSudoSendUpwardMessage: { readonly message: Bytes; } & Struct; - readonly isAuthorizeUpgrade: boolean; - readonly asAuthorizeUpgrade: { - readonly codeHash: H256; - readonly checkVersion: bool; - } & Struct; - readonly isEnactAuthorizedUpgrade: boolean; - readonly asEnactAuthorizedUpgrade: { - readonly code: Bytes; - } & Struct; - readonly type: - | "SetValidationData" - | "SudoSendUpwardMessage" - | "AuthorizeUpgrade" - | "EnactAuthorizedUpgrade"; + readonly type: "SetValidationData" | "SudoSendUpwardMessage"; } - /** @name CumulusPrimitivesParachainInherentParachainInherentData (102) */ + /** @name CumulusPrimitivesParachainInherentParachainInherentData (104) */ interface CumulusPrimitivesParachainInherentParachainInherentData extends Struct { - readonly validationData: PolkadotPrimitivesV7PersistedValidationData; + readonly validationData: PolkadotPrimitivesV8PersistedValidationData; readonly relayChainState: SpTrieStorageProof; readonly downwardMessages: Vec; readonly horizontalMessages: BTreeMap>; } - /** @name PolkadotPrimitivesV7PersistedValidationData (103) */ - interface PolkadotPrimitivesV7PersistedValidationData extends Struct { + /** @name PolkadotPrimitivesV8PersistedValidationData (105) */ + interface PolkadotPrimitivesV8PersistedValidationData extends Struct { readonly parentHead: Bytes; readonly relayParentNumber: u32; readonly relayParentStorageRoot: H256; readonly maxPovSize: u32; } - /** @name SpTrieStorageProof (105) */ + /** @name SpTrieStorageProof (107) */ interface SpTrieStorageProof extends Struct { readonly trieNodes: BTreeSet; } - /** @name PolkadotCorePrimitivesInboundDownwardMessage (108) */ + /** @name PolkadotCorePrimitivesInboundDownwardMessage (110) */ interface PolkadotCorePrimitivesInboundDownwardMessage extends Struct { readonly sentAt: u32; readonly msg: Bytes; } - /** @name PolkadotCorePrimitivesInboundHrmpMessage (112) */ + /** @name PolkadotCorePrimitivesInboundHrmpMessage (114) */ interface PolkadotCorePrimitivesInboundHrmpMessage extends Struct { readonly sentAt: u32; readonly data: Bytes; } - /** @name PalletTimestampCall (115) */ + /** @name PalletTimestampCall (117) */ interface PalletTimestampCall extends Enum { readonly isSet: boolean; readonly asSet: { @@ -1591,7 +1609,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Set"; } - /** @name PalletRootTestingCall (116) */ + /** @name PalletRootTestingCall (118) */ interface PalletRootTestingCall extends Enum { readonly isFillBlock: boolean; readonly asFillBlock: { @@ -1601,7 +1619,7 @@ declare module "@polkadot/types/lookup" { readonly type: "FillBlock" | "TriggerDefensive"; } - /** @name PalletBalancesCall (117) */ + /** @name PalletBalancesCall (119) */ interface PalletBalancesCall extends Enum { readonly isTransferAllowDeath: boolean; readonly asTransferAllowDeath: { @@ -1660,14 +1678,14 @@ declare module "@polkadot/types/lookup" { | "Burn"; } - /** @name PalletBalancesAdjustmentDirection (120) */ + /** @name PalletBalancesAdjustmentDirection (122) */ interface PalletBalancesAdjustmentDirection extends Enum { readonly isIncrease: boolean; readonly isDecrease: boolean; readonly type: "Increase" | "Decrease"; } - /** @name PalletParachainStakingCall (121) */ + /** @name PalletParachainStakingCall (123) */ interface PalletParachainStakingCall extends Enum { readonly isSetStakingExpectations: boolean; readonly asSetStakingExpectations: { @@ -1845,13 +1863,13 @@ declare module "@polkadot/types/lookup" { | "SetInflationDistributionConfig"; } - /** @name PalletAuthorInherentCall (124) */ + /** @name PalletAuthorInherentCall (126) */ interface PalletAuthorInherentCall extends Enum { readonly isKickOffAuthorshipValidation: boolean; readonly type: "KickOffAuthorshipValidation"; } - /** @name PalletAuthorSlotFilterCall (125) */ + /** @name PalletAuthorSlotFilterCall (127) */ interface PalletAuthorSlotFilterCall extends Enum { readonly isSetEligible: boolean; readonly asSetEligible: { @@ -1860,7 +1878,7 @@ declare module "@polkadot/types/lookup" { readonly type: "SetEligible"; } - /** @name PalletAuthorMappingCall (126) */ + /** @name PalletAuthorMappingCall (128) */ interface PalletAuthorMappingCall extends Enum { readonly isAddAssociation: boolean; readonly asAddAssociation: { @@ -1888,7 +1906,7 @@ declare module "@polkadot/types/lookup" { | "SetKeys"; } - /** @name PalletMoonbeamOrbitersCall (127) */ + /** @name PalletMoonbeamOrbitersCall (129) */ interface PalletMoonbeamOrbitersCall extends Enum { readonly isCollatorAddOrbiter: boolean; readonly asCollatorAddOrbiter: { @@ -1925,7 +1943,7 @@ declare module "@polkadot/types/lookup" { | "RemoveCollator"; } - /** @name PalletUtilityCall (128) */ + /** @name PalletUtilityCall (130) */ interface PalletUtilityCall extends Enum { readonly isBatch: boolean; readonly asBatch: { @@ -1963,7 +1981,7 @@ declare module "@polkadot/types/lookup" { | "WithWeight"; } - /** @name MoonriverRuntimeOriginCaller (130) */ + /** @name MoonriverRuntimeOriginCaller (132) */ interface MoonriverRuntimeOriginCaller extends Enum { readonly isSystem: boolean; readonly asSystem: FrameSupportDispatchRawOrigin; @@ -1994,7 +2012,7 @@ declare module "@polkadot/types/lookup" { | "EthereumXcm"; } - /** @name FrameSupportDispatchRawOrigin (131) */ + /** @name FrameSupportDispatchRawOrigin (133) */ interface FrameSupportDispatchRawOrigin extends Enum { readonly isRoot: boolean; readonly isSigned: boolean; @@ -2003,14 +2021,14 @@ declare module "@polkadot/types/lookup" { readonly type: "Root" | "Signed" | "None"; } - /** @name PalletEthereumRawOrigin (132) */ + /** @name PalletEthereumRawOrigin (134) */ interface PalletEthereumRawOrigin extends Enum { readonly isEthereumTransaction: boolean; readonly asEthereumTransaction: H160; readonly type: "EthereumTransaction"; } - /** @name MoonriverRuntimeGovernanceOriginsCustomOriginsOrigin (133) */ + /** @name MoonriverRuntimeGovernanceOriginsCustomOriginsOrigin (135) */ interface MoonriverRuntimeGovernanceOriginsCustomOriginsOrigin extends Enum { readonly isWhitelistedCaller: boolean; readonly isGeneralAdmin: boolean; @@ -2025,7 +2043,7 @@ declare module "@polkadot/types/lookup" { | "FastGeneralAdmin"; } - /** @name PalletCollectiveRawOrigin (134) */ + /** @name PalletCollectiveRawOrigin (136) */ interface PalletCollectiveRawOrigin extends Enum { readonly isMembers: boolean; readonly asMembers: ITuple<[u32, u32]>; @@ -2035,7 +2053,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Members" | "Member" | "Phantom"; } - /** @name CumulusPalletXcmOrigin (136) */ + /** @name CumulusPalletXcmOrigin (138) */ interface CumulusPalletXcmOrigin extends Enum { readonly isRelay: boolean; readonly isSiblingParachain: boolean; @@ -2043,7 +2061,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Relay" | "SiblingParachain"; } - /** @name PalletXcmOrigin (137) */ + /** @name PalletXcmOrigin (139) */ interface PalletXcmOrigin extends Enum { readonly isXcm: boolean; readonly asXcm: StagingXcmV4Location; @@ -2052,13 +2070,13 @@ declare module "@polkadot/types/lookup" { readonly type: "Xcm" | "Response"; } - /** @name StagingXcmV4Location (138) */ + /** @name StagingXcmV4Location (140) */ interface StagingXcmV4Location extends Struct { readonly parents: u8; readonly interior: StagingXcmV4Junctions; } - /** @name StagingXcmV4Junctions (139) */ + /** @name StagingXcmV4Junctions (141) */ interface StagingXcmV4Junctions extends Enum { readonly isHere: boolean; readonly isX1: boolean; @@ -2080,7 +2098,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Here" | "X1" | "X2" | "X3" | "X4" | "X5" | "X6" | "X7" | "X8"; } - /** @name StagingXcmV4Junction (141) */ + /** @name StagingXcmV4Junction (143) */ interface StagingXcmV4Junction extends Enum { readonly isParachain: boolean; readonly asParachain: Compact; @@ -2129,7 +2147,7 @@ declare module "@polkadot/types/lookup" { | "GlobalConsensus"; } - /** @name StagingXcmV4JunctionNetworkId (144) */ + /** @name StagingXcmV4JunctionNetworkId (146) */ interface StagingXcmV4JunctionNetworkId extends Enum { readonly isByGenesis: boolean; readonly asByGenesis: U8aFixed; @@ -2164,7 +2182,7 @@ declare module "@polkadot/types/lookup" { | "PolkadotBulletin"; } - /** @name XcmV3JunctionBodyId (145) */ + /** @name XcmV3JunctionBodyId (147) */ interface XcmV3JunctionBodyId extends Enum { readonly isUnit: boolean; readonly isMoniker: boolean; @@ -2191,7 +2209,7 @@ declare module "@polkadot/types/lookup" { | "Treasury"; } - /** @name XcmV3JunctionBodyPart (146) */ + /** @name XcmV3JunctionBodyPart (148) */ interface XcmV3JunctionBodyPart extends Enum { readonly isVoice: boolean; readonly isMembers: boolean; @@ -2216,17 +2234,17 @@ declare module "@polkadot/types/lookup" { readonly type: "Voice" | "Members" | "Fraction" | "AtLeastProportion" | "MoreThanProportion"; } - /** @name PalletEthereumXcmRawOrigin (154) */ + /** @name PalletEthereumXcmRawOrigin (156) */ interface PalletEthereumXcmRawOrigin extends Enum { readonly isXcmEthereumTransaction: boolean; readonly asXcmEthereumTransaction: H160; readonly type: "XcmEthereumTransaction"; } - /** @name SpCoreVoid (155) */ + /** @name SpCoreVoid (157) */ type SpCoreVoid = Null; - /** @name PalletProxyCall (156) */ + /** @name PalletProxyCall (158) */ interface PalletProxyCall extends Enum { readonly isProxy: boolean; readonly asProxy: { @@ -2296,14 +2314,14 @@ declare module "@polkadot/types/lookup" { | "ProxyAnnounced"; } - /** @name PalletMaintenanceModeCall (158) */ + /** @name PalletMaintenanceModeCall (160) */ interface PalletMaintenanceModeCall extends Enum { readonly isEnterMaintenanceMode: boolean; readonly isResumeNormalOperation: boolean; readonly type: "EnterMaintenanceMode" | "ResumeNormalOperation"; } - /** @name PalletIdentityCall (159) */ + /** @name PalletIdentityCall (161) */ interface PalletIdentityCall extends Enum { readonly isAddRegistrar: boolean; readonly asAddRegistrar: { @@ -2425,7 +2443,7 @@ declare module "@polkadot/types/lookup" { | "RemoveDanglingUsername"; } - /** @name PalletIdentityLegacyIdentityInfo (160) */ + /** @name PalletIdentityLegacyIdentityInfo (162) */ interface PalletIdentityLegacyIdentityInfo extends Struct { readonly additional: Vec>; readonly display: Data; @@ -2438,7 +2456,7 @@ declare module "@polkadot/types/lookup" { readonly twitter: Data; } - /** @name PalletIdentityJudgement (198) */ + /** @name PalletIdentityJudgement (200) */ interface PalletIdentityJudgement extends Enum { readonly isUnknown: boolean; readonly isFeePaid: boolean; @@ -2458,10 +2476,10 @@ declare module "@polkadot/types/lookup" { | "Erroneous"; } - /** @name AccountEthereumSignature (200) */ + /** @name AccountEthereumSignature (202) */ interface AccountEthereumSignature extends U8aFixed {} - /** @name PalletMultisigCall (202) */ + /** @name PalletMultisigCall (204) */ interface PalletMultisigCall extends Enum { readonly isAsMultiThreshold1: boolean; readonly asAsMultiThreshold1: { @@ -2494,7 +2512,7 @@ declare module "@polkadot/types/lookup" { readonly type: "AsMultiThreshold1" | "AsMulti" | "ApproveAsMulti" | "CancelAsMulti"; } - /** @name PalletMoonbeamLazyMigrationsCall (204) */ + /** @name PalletMoonbeamLazyMigrationsCall (206) */ interface PalletMoonbeamLazyMigrationsCall extends Enum { readonly isCreateContractMetadata: boolean; readonly asCreateContractMetadata: { @@ -2526,7 +2544,7 @@ declare module "@polkadot/types/lookup" { | "FinishForeignAssetsMigration"; } - /** @name PalletParametersCall (207) */ + /** @name PalletParametersCall (209) */ interface PalletParametersCall extends Enum { readonly isSetParameter: boolean; readonly asSetParameter: { @@ -2535,7 +2553,7 @@ declare module "@polkadot/types/lookup" { readonly type: "SetParameter"; } - /** @name MoonriverRuntimeRuntimeParamsRuntimeParameters (208) */ + /** @name MoonriverRuntimeRuntimeParamsRuntimeParameters (210) */ interface MoonriverRuntimeRuntimeParamsRuntimeParameters extends Enum { readonly isRuntimeConfig: boolean; readonly asRuntimeConfig: MoonriverRuntimeRuntimeParamsDynamicParamsRuntimeConfigParameters; @@ -2544,7 +2562,7 @@ declare module "@polkadot/types/lookup" { readonly type: "RuntimeConfig" | "PalletRandomness"; } - /** @name MoonriverRuntimeRuntimeParamsDynamicParamsRuntimeConfigParameters (209) */ + /** @name MoonriverRuntimeRuntimeParamsDynamicParamsRuntimeConfigParameters (211) */ interface MoonriverRuntimeRuntimeParamsDynamicParamsRuntimeConfigParameters extends Enum { readonly isFeesTreasuryProportion: boolean; readonly asFeesTreasuryProportion: ITuple< @@ -2556,7 +2574,7 @@ declare module "@polkadot/types/lookup" { readonly type: "FeesTreasuryProportion"; } - /** @name MoonriverRuntimeRuntimeParamsDynamicParamsPalletRandomnessParameters (211) */ + /** @name MoonriverRuntimeRuntimeParamsDynamicParamsPalletRandomnessParameters (213) */ interface MoonriverRuntimeRuntimeParamsDynamicParamsPalletRandomnessParameters extends Enum { readonly isDeposit: boolean; readonly asDeposit: ITuple< @@ -2565,7 +2583,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Deposit"; } - /** @name PalletEvmCall (213) */ + /** @name PalletEvmCall (215) */ interface PalletEvmCall extends Enum { readonly isWithdraw: boolean; readonly asWithdraw: { @@ -2610,7 +2628,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Withdraw" | "Call" | "Create" | "Create2"; } - /** @name PalletEthereumCall (219) */ + /** @name PalletEthereumCall (221) */ interface PalletEthereumCall extends Enum { readonly isTransact: boolean; readonly asTransact: { @@ -2619,7 +2637,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Transact"; } - /** @name EthereumTransactionTransactionV2 (220) */ + /** @name EthereumTransactionTransactionV2 (222) */ interface EthereumTransactionTransactionV2 extends Enum { readonly isLegacy: boolean; readonly asLegacy: EthereumTransactionLegacyTransaction; @@ -2630,7 +2648,7 @@ declare module "@polkadot/types/lookup" { readonly type: "Legacy" | "Eip2930" | "Eip1559"; } - /** @name EthereumTransactionLegacyTransaction (221) */ + /** @name EthereumTransactionLegacyTransaction (223) */ interface EthereumTransactionLegacyTransaction extends Struct { readonly nonce: U256; readonly gasPrice: U256; @@ -2641,7 +2659,7 @@ declare module "@polkadot/types/lookup" { readonly signature: EthereumTransactionTransactionSignature; } - /** @name EthereumTransactionTransactionAction (222) */ + /** @name EthereumTransactionTransactionAction (224) */ interface EthereumTransactionTransactionAction extends Enum { readonly isCall: boolean; readonly asCall: H160; @@ -2649,14 +2667,14 @@ declare module "@polkadot/types/lookup" { readonly type: "Call" | "Create"; } - /** @name EthereumTransactionTransactionSignature (223) */ + /** @name EthereumTransactionTransactionSignature (225) */ interface EthereumTransactionTransactionSignature extends Struct { readonly v: u64; readonly r: H256; readonly s: H256; } - /** @name EthereumTransactionEip2930Transaction (225) */ + /** @name EthereumTransactionEip2930Transaction (227) */ interface EthereumTransactionEip2930Transaction extends Struct { readonly chainId: u64; readonly nonce: U256; @@ -2671,13 +2689,13 @@ declare module "@polkadot/types/lookup" { readonly s: H256; } - /** @name EthereumTransactionAccessListItem (227) */ + /** @name EthereumTransactionAccessListItem (229) */ interface EthereumTransactionAccessListItem extends Struct { readonly address: H160; readonly storageKeys: Vec; } - /** @name EthereumTransactionEip1559Transaction (228) */ + /** @name EthereumTransactionEip1559Transaction (230) */ interface EthereumTransactionEip1559Transaction extends Struct { readonly chainId: u64; readonly nonce: U256; @@ -2693,7 +2711,7 @@ declare module "@polkadot/types/lookup" { readonly s: H256; } - /** @name PalletSchedulerCall (229) */ + /** @name PalletSchedulerCall (231) */ interface PalletSchedulerCall extends Enum { readonly isSchedule: boolean; readonly asSchedule: { @@ -2767,7 +2785,7 @@ declare module "@polkadot/types/lookup" { | "CancelRetryNamed"; } - /** @name PalletPreimageCall (231) */ + /** @name PalletPreimageCall (233) */ interface PalletPreimageCall extends Enum { readonly isNotePreimage: boolean; readonly asNotePreimage: { @@ -2797,7 +2815,7 @@ declare module "@polkadot/types/lookup" { | "EnsureUpdated"; } - /** @name PalletConvictionVotingCall (232) */ + /** @name PalletConvictionVotingCall (234) */ interface PalletConvictionVotingCall extends Enum { readonly isVote: boolean; readonly asVote: { @@ -2834,27 +2852,6 @@ declare module "@polkadot/types/lookup" { readonly type: "Vote" | "Delegate" | "Undelegate" | "Unlock" | "RemoveVote" | "RemoveOtherVote"; } - /** @name PalletConvictionVotingVoteAccountVote (233) */ - interface PalletConvictionVotingVoteAccountVote extends Enum { - readonly isStandard: boolean; - readonly asStandard: { - readonly vote: Vote; - readonly balance: u128; - } & Struct; - readonly isSplit: boolean; - readonly asSplit: { - readonly aye: u128; - readonly nay: u128; - } & Struct; - readonly isSplitAbstain: boolean; - readonly asSplitAbstain: { - readonly aye: u128; - readonly nay: u128; - readonly abstain: u128; - } & Struct; - readonly type: "Standard" | "Split" | "SplitAbstain"; - } - /** @name PalletConvictionVotingConviction (235) */ interface PalletConvictionVotingConviction extends Enum { readonly isNone: boolean; @@ -4841,6 +4838,12 @@ declare module "@polkadot/types/lookup" { readonly id: Compact; readonly who: AccountId20; } & Struct; + readonly isTransferAll: boolean; + readonly asTransferAll: { + readonly id: Compact; + readonly dest: AccountId20; + readonly keepAlive: bool; + } & Struct; readonly type: | "Create" | "ForceCreate" @@ -4873,7 +4876,8 @@ declare module "@polkadot/types/lookup" { | "SetMinBalance" | "TouchOther" | "RefundOther" - | "Block"; + | "Block" + | "TransferAll"; } /** @name PalletAssetManagerCall (346) */ @@ -6210,7 +6214,7 @@ declare module "@polkadot/types/lookup" { interface CumulusPalletParachainSystemUnincludedSegmentAncestor extends Struct { readonly usedBandwidth: CumulusPalletParachainSystemUnincludedSegmentUsedBandwidth; readonly paraHeadHash: Option; - readonly consumedGoAheadSignal: Option; + readonly consumedGoAheadSignal: Option; } /** @name CumulusPalletParachainSystemUnincludedSegmentUsedBandwidth (420) */ @@ -6229,8 +6233,8 @@ declare module "@polkadot/types/lookup" { readonly totalBytes: u32; } - /** @name PolkadotPrimitivesV7UpgradeGoAhead (426) */ - interface PolkadotPrimitivesV7UpgradeGoAhead extends Enum { + /** @name PolkadotPrimitivesV8UpgradeGoAhead (426) */ + interface PolkadotPrimitivesV8UpgradeGoAhead extends Enum { readonly isAbort: boolean; readonly isGoAhead: boolean; readonly type: "Abort" | "GoAhead"; @@ -6240,11 +6244,11 @@ declare module "@polkadot/types/lookup" { interface CumulusPalletParachainSystemUnincludedSegmentSegmentTracker extends Struct { readonly usedBandwidth: CumulusPalletParachainSystemUnincludedSegmentUsedBandwidth; readonly hrmpWatermark: Option; - readonly consumedGoAheadSignal: Option; + readonly consumedGoAheadSignal: Option; } - /** @name PolkadotPrimitivesV7UpgradeRestriction (429) */ - interface PolkadotPrimitivesV7UpgradeRestriction extends Enum { + /** @name PolkadotPrimitivesV8UpgradeRestriction (429) */ + interface PolkadotPrimitivesV8UpgradeRestriction extends Enum { readonly isPresent: boolean; readonly type: "Present"; } @@ -6253,8 +6257,8 @@ declare module "@polkadot/types/lookup" { interface CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot extends Struct { readonly dmqMqcHead: H256; readonly relayDispatchQueueRemainingCapacity: CumulusPalletParachainSystemRelayStateSnapshotRelayDispatchQueueRemainingCapacity; - readonly ingressChannels: Vec>; - readonly egressChannels: Vec>; + readonly ingressChannels: Vec>; + readonly egressChannels: Vec>; } /** @name CumulusPalletParachainSystemRelayStateSnapshotRelayDispatchQueueRemainingCapacity (431) */ @@ -6264,8 +6268,8 @@ declare module "@polkadot/types/lookup" { readonly remainingSize: u32; } - /** @name PolkadotPrimitivesV7AbridgedHrmpChannel (434) */ - interface PolkadotPrimitivesV7AbridgedHrmpChannel extends Struct { + /** @name PolkadotPrimitivesV8AbridgedHrmpChannel (434) */ + interface PolkadotPrimitivesV8AbridgedHrmpChannel extends Struct { readonly maxCapacity: u32; readonly maxTotalSize: u32; readonly maxMessageSize: u32; @@ -6274,8 +6278,8 @@ declare module "@polkadot/types/lookup" { readonly mqcHead: Option; } - /** @name PolkadotPrimitivesV7AbridgedHostConfiguration (435) */ - interface PolkadotPrimitivesV7AbridgedHostConfiguration extends Struct { + /** @name PolkadotPrimitivesV8AbridgedHostConfiguration (435) */ + interface PolkadotPrimitivesV8AbridgedHostConfiguration extends Struct { readonly maxCodeSize: u32; readonly maxHeadDataSize: u32; readonly maxUpwardQueueCount: u32; @@ -6285,11 +6289,11 @@ declare module "@polkadot/types/lookup" { readonly hrmpMaxMessageNumPerCandidate: u32; readonly validationUpgradeCooldown: u32; readonly validationUpgradeDelay: u32; - readonly asyncBackingParams: PolkadotPrimitivesV7AsyncBackingAsyncBackingParams; + readonly asyncBackingParams: PolkadotPrimitivesV8AsyncBackingAsyncBackingParams; } - /** @name PolkadotPrimitivesV7AsyncBackingAsyncBackingParams (436) */ - interface PolkadotPrimitivesV7AsyncBackingAsyncBackingParams extends Struct { + /** @name PolkadotPrimitivesV8AsyncBackingAsyncBackingParams (436) */ + interface PolkadotPrimitivesV8AsyncBackingAsyncBackingParams extends Struct { readonly maxCandidateDepth: u32; readonly allowedAncestryLen: u32; } @@ -6929,7 +6933,6 @@ declare module "@polkadot/types/lookup" { readonly isLimitCannotBeZero: boolean; readonly isContractMetadataAlreadySet: boolean; readonly isContractNotExist: boolean; - readonly isKeyTooLong: boolean; readonly isSymbolTooLong: boolean; readonly isNameTooLong: boolean; readonly isAssetTypeNotFound: boolean; @@ -6943,7 +6946,6 @@ declare module "@polkadot/types/lookup" { | "LimitCannotBeZero" | "ContractMetadataAlreadySet" | "ContractNotExist" - | "KeyTooLong" | "SymbolTooLong" | "NameTooLong" | "AssetTypeNotFound" @@ -7134,7 +7136,6 @@ declare module "@polkadot/types/lookup" { readonly isNotRequested: boolean; readonly isTooMany: boolean; readonly isTooFew: boolean; - readonly isNoCost: boolean; readonly type: | "TooBig" | "AlreadyNoted" @@ -7143,8 +7144,7 @@ declare module "@polkadot/types/lookup" { | "Requested" | "NotRequested" | "TooMany" - | "TooFew" - | "NoCost"; + | "TooFew"; } /** @name PalletConvictionVotingVoteVoting (573) */ From 1a0c3d464cb9c9b6be00dff926e09b3dc93059a7 Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas <22591718+RomarQ@users.noreply.github.com> Date: Wed, 22 Jan 2025 10:32:42 +0000 Subject: [PATCH 10/10] chore(ci): enable typegen_check (#3145) * add cron workflow for updating rust/typescript bindings * install pnpm * make binary executable * finalize changes --- .github/workflows/update-typescript-api.yml | 65 +++++++++++++++++++++ typescript-api/scripts/scrapeMetadata.ts | 8 +-- 2 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/update-typescript-api.yml diff --git a/.github/workflows/update-typescript-api.yml b/.github/workflows/update-typescript-api.yml new file mode 100644 index 0000000000..e261186f7a --- /dev/null +++ b/.github/workflows/update-typescript-api.yml @@ -0,0 +1,65 @@ +name: Update Rust/TS bindings + +on: + workflow_dispatch: + schedule: + - cron: "0 5 * * *" # Runs every day at 5:00 AM UTC + +jobs: + build: + runs-on: + labels: bare-metal + permissions: + contents: read + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Local build new Node + uses: ./.github/workflow-templates/cargo-build + - name: Upload Node + uses: actions/upload-artifact@v4 + with: + name: moonbeam + path: build + + update-typescript-api: + needs: build + runs-on: moonbeam-release-medium + permissions: + contents: write + pull-requests: write + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Download Node + uses: actions/download-artifact@v4 + with: + name: moonbeam + path: target/release + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + version: 9 + run_install: false + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version-file: "test/.nvmrc" + cache: pnpm + registry-url: https://registry.npmjs.org/ + - name: Run Typegen + run: | + chmod uog+x target/release/moonbeam + pnpm i + cd test + pnpm typegen + - name: Create Pull Request + uses: peter-evans/create-pull-request@v7 + with: + base: master + branch: "update-typescript-api-${{ github.run_id }}" + commit-message: "Update Rust/TS bindings" + draft: true + title: "Update Rust/TS bindings" + reviewers: "moonsong-coredev" + labels: "B0-silent,D2-notlive" \ No newline at end of file diff --git a/typescript-api/scripts/scrapeMetadata.ts b/typescript-api/scripts/scrapeMetadata.ts index c2186ea911..7e5b6a8fce 100644 --- a/typescript-api/scripts/scrapeMetadata.ts +++ b/typescript-api/scripts/scrapeMetadata.ts @@ -7,7 +7,7 @@ const CHAINS = ["moonbase", "moonriver", "moonbeam"]; const fetchMetadata = async (port = 9933) => { const maxRetries = 60; const sleepTime = 500; - const url = `http://localhost:${port}`; + const url = `http://127.0.0.1:${port}`; const payload = { id: "1", jsonrpc: "2.0", @@ -75,7 +75,7 @@ async function main() { const metadata = await fetchMetadata(); fs.writeFileSync(`metadata-${chain}.json`, JSON.stringify(metadata, null, 2)); console.log(`✅ Metadata for ${chain} written to metadata-${chain}.json`); - nodes[chain].kill(); + nodes[chain]?.kill(); await new Promise((resolve) => setTimeout(resolve, 2000)); } catch (error) { console.error(`❌ Error getting metadata for ${chain}`); @@ -86,7 +86,7 @@ async function main() { process.on("SIGINT", () => { for (const chain of CHAINS) { - nodes[chain].kill(); + nodes[chain]?.kill(); } process.exit(); }); @@ -98,6 +98,6 @@ main() }) .finally(() => { for (const chain of CHAINS) { - nodes[chain].kill(); + nodes[chain]?.kill(); } });