From e0dd42d4de85465ab21996c8bfce71e8969f1949 Mon Sep 17 00:00:00 2001 From: Charles Ferrell Date: Thu, 15 Feb 2024 21:51:04 -0500 Subject: [PATCH] [no ci] runtime benchmarks now compiles Signed-off-by: Charles Ferrell --- runtime/calamari/src/lib.rs | 23 +++++++++++++----- .../src/xcm_mock/parachain.rs | 2 -- .../src/xcm_mock/relay_chain.rs | 2 -- runtime/manta/src/lib.rs | 24 ++++++++++++++----- 4 files changed, 35 insertions(+), 16 deletions(-) diff --git a/runtime/calamari/src/lib.rs b/runtime/calamari/src/lib.rs index eee56dc65..c0fe111be 100644 --- a/runtime/calamari/src/lib.rs +++ b/runtime/calamari/src/lib.rs @@ -706,6 +706,8 @@ impl pallet_treasury::Config for Runtime { type BalanceConverter = UnityAssetBalanceConversion; type PayoutPeriod = PayoutSpendPeriod; type AssetKind = (); + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = (); } impl pallet_aura_style_filter::Config for Runtime { @@ -1098,10 +1100,6 @@ pub type Executive = frame_executive::Executive< OnRuntimeUpgradeHooks, >; -#[cfg(feature = "runtime-benchmarks")] -#[macro_use] -extern crate frame_benchmarking; - #[cfg(feature = "runtime-benchmarks")] mod benches { frame_benchmarking::define_benchmarks!( @@ -1137,8 +1135,6 @@ mod benches { // we disable zenlink in this release, and will fix it in next release // [zenlink_protocol, ZenlinkProtocol] [pallet_farming, Farming] - // XCM - [pallet_xcm, PolkadotXcm] [cumulus_pallet_xcmp_queue, XcmpQueue] // always get this error(Unimplemented) while benchmarking pallet_xcm_benchmarks::fungible::initiate_teleport // so this time we will use statemint's fungible weights @@ -1500,11 +1496,20 @@ impl_runtime_apis! { pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; pub const KsmLocation: MultiLocation = MultiLocation::parent(); pub KmaLocation: MultiLocation = MultiLocation::new(1, X1(Parachain(ParachainInfo::parachain_id().into()))); + pub ExistentialDepositAsset: Option = Some(MultiAsset { + id: Concrete(MultiLocation::parent()), + fun: Fungible(NativeTokenExistentialDeposit::get()) + }).into(); } impl pallet_xcm_benchmarks::Config for Runtime { type XcmConfig = XcmExecutorConfig; type AccountIdConverter = LocationToAccountId; + type DeliveryHelper = cumulus_primitives_utility::ToParentDeliveryHelper< + XcmExecutorConfig, + ExistentialDepositAsset, + (), + >; fn valid_destination() -> Result { Ok(KsmLocation::get()) @@ -1542,6 +1547,7 @@ impl_runtime_apis! { type CheckedAccount = CheckedAccount; type TrustedTeleporter = TrustedTeleporter; + type TrustedReserve = TrustedReserve; fn get_multi_asset() -> MultiAsset { MultiAsset { @@ -1553,6 +1559,7 @@ impl_runtime_apis! { impl pallet_xcm_benchmarks::generic::Config for Runtime { type RuntimeCall = RuntimeCall; + type TransactAsset = Balances; fn worst_case_response() -> (u64, Response) { (0u64, Response::Version(Default::default())) @@ -1589,6 +1596,10 @@ impl_runtime_apis! { ) -> Result<(MultiLocation, NetworkId, InteriorMultiLocation), BenchmarkError> { Err(BenchmarkError::Skip) } + + fn alias_origin() -> Result<(MultiLocation, MultiLocation), BenchmarkError> { + Err(BenchmarkError::Skip) + } } let whitelist: Vec = vec![ diff --git a/runtime/integration-tests/src/xcm_mock/parachain.rs b/runtime/integration-tests/src/xcm_mock/parachain.rs index 3dc2bfbbe..b6dd6bf79 100644 --- a/runtime/integration-tests/src/xcm_mock/parachain.rs +++ b/runtime/integration-tests/src/xcm_mock/parachain.rs @@ -559,8 +559,6 @@ impl pallet_xcm::Config for Runtime { type MaxLockers = ConstU32<8>; type RemoteLockConsumerIdentifier = (); type WeightInfo = PalletXcmWeightInfo; - #[cfg(feature = "runtime-benchmarks")] - type ReachableDest = ReachableDest; } parameter_types! { diff --git a/runtime/integration-tests/src/xcm_mock/relay_chain.rs b/runtime/integration-tests/src/xcm_mock/relay_chain.rs index 15d2cbcbf..b1f02306d 100644 --- a/runtime/integration-tests/src/xcm_mock/relay_chain.rs +++ b/runtime/integration-tests/src/xcm_mock/relay_chain.rs @@ -223,8 +223,6 @@ impl pallet_xcm::Config for Runtime { type MaxLockers = ConstU32<8>; type RemoteLockConsumerIdentifier = (); type WeightInfo = PalletXcmWeightInfo; - #[cfg(feature = "runtime-benchmarks")] - type ReachableDest = ReachableDest; } parameter_types! { diff --git a/runtime/manta/src/lib.rs b/runtime/manta/src/lib.rs index 95cea8177..12159a389 100644 --- a/runtime/manta/src/lib.rs +++ b/runtime/manta/src/lib.rs @@ -877,6 +877,8 @@ impl pallet_treasury::Config for Runtime { type BalanceConverter = UnityAssetBalanceConversion; type PayoutPeriod = PayoutSpendPeriod; type AssetKind = (); + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = (); } parameter_types! { @@ -1048,10 +1050,6 @@ pub type Executive = frame_executive::Executive< OnRuntimeUpgradeHooks, >; -#[cfg(feature = "runtime-benchmarks")] -#[macro_use] -extern crate frame_benchmarking; - #[cfg(feature = "runtime-benchmarks")] mod benches { frame_benchmarking::define_benchmarks!( @@ -1074,7 +1072,6 @@ mod benches { [pallet_sudo, Sudo] // XCM [cumulus_pallet_xcmp_queue, XcmpQueue] - [pallet_xcm, PolkadotXcm] // always get this error(Unimplemented) while benchmarking pallet_xcm_benchmarks::fungible::initiate_teleport // so this time we will use statemint's fungible weights // [pallet_xcm_benchmarks::fungible, XcmBalances] @@ -1444,11 +1441,21 @@ impl_runtime_apis! { pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; pub const DotLocation: MultiLocation = MultiLocation::parent(); pub MantaLocation: MultiLocation = MultiLocation::new(1, X1(Parachain(ParachainInfo::parachain_id().into()))); + pub ExistentialDepositAsset: Option = Some(MultiAsset { + id: Concrete(MultiLocation::parent()), + fun: Fungible(NativeTokenExistentialDeposit::get()) + }).into(); + } impl pallet_xcm_benchmarks::Config for Runtime { type XcmConfig = XcmExecutorConfig; type AccountIdConverter = LocationToAccountId; + type DeliveryHelper = cumulus_primitives_utility::ToParentDeliveryHelper< + XcmExecutorConfig, + ExistentialDepositAsset, + (), + >; fn valid_destination() -> Result { Ok(DotLocation::get()) @@ -1483,9 +1490,9 @@ impl_runtime_apis! { impl pallet_xcm_benchmarks::fungible::Config for Runtime { type TransactAsset = Balances; - type CheckedAccount = CheckedAccount; type TrustedTeleporter = TrustedTeleporter; + type TrustedReserve = TrustedReserve; fn get_multi_asset() -> MultiAsset { MultiAsset { @@ -1497,6 +1504,7 @@ impl_runtime_apis! { impl pallet_xcm_benchmarks::generic::Config for Runtime { type RuntimeCall = RuntimeCall; + type TransactAsset = Balances; fn worst_case_response() -> (u64, Response) { (0u64, Response::Version(Default::default())) @@ -1533,6 +1541,10 @@ impl_runtime_apis! { ) -> Result<(MultiLocation, NetworkId, InteriorMultiLocation), BenchmarkError> { Err(BenchmarkError::Skip) } + + fn alias_origin() -> Result<(MultiLocation, MultiLocation), BenchmarkError> { + Err(BenchmarkError::Skip) + } } // type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::;