From e00c6fde9a9b081ea424520bfb1579488b75426f Mon Sep 17 00:00:00 2001 From: David Salami <31099392+Wizdave97@users.noreply.github.com> Date: Thu, 17 Oct 2024 15:01:27 +0100 Subject: [PATCH] Prepare nexus runtime upgrade (#326) --- Cargo.lock | 7 +- Cargo.toml | 2 + .../asset-gateway/src/xcm_utilities.rs | 6 +- .../testsuite/src/tests/pallet_xcm_gateway.rs | 8 +- parachain/chainspec/nexus.json | 4 +- parachain/runtimes/gargantua/Cargo.toml | 2 - parachain/runtimes/gargantua/src/ismp.rs | 25 +- parachain/runtimes/gargantua/src/lib.rs | 2 +- parachain/runtimes/nexus/Cargo.toml | 19 +- parachain/runtimes/nexus/src/ismp.rs | 58 ++-- parachain/runtimes/nexus/src/lib.rs | 154 ++++++++-- parachain/runtimes/nexus/src/weights/mod.rs | 3 + .../src/weights/pallet_collator_selection.rs | 267 ++++++++++++++++++ .../nexus/src/weights/pallet_multisig.rs | 152 ++++++++++ .../nexus/src/weights/pallet_proxy.rs | 209 ++++++++++++++ 15 files changed, 856 insertions(+), 62 deletions(-) create mode 100644 parachain/runtimes/nexus/src/weights/pallet_collator_selection.rs create mode 100644 parachain/runtimes/nexus/src/weights/pallet_multisig.rs create mode 100644 parachain/runtimes/nexus/src/weights/pallet_proxy.rs diff --git a/Cargo.lock b/Cargo.lock index 4301ad1a9..b0e111ae3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6116,7 +6116,6 @@ dependencies = [ "pallet-state-coprocessor", "pallet-sudo", "pallet-timestamp", - "pallet-token-gateway", "pallet-token-gateway-inspector", "pallet-token-governor", "pallet-transaction-payment", @@ -10936,6 +10935,7 @@ dependencies = [ "hyperbridge-client-machine", "ismp", "ismp-bsc", + "ismp-grandpa", "ismp-parachain", "ismp-parachain-runtime-api", "ismp-sync-committee", @@ -10950,6 +10950,7 @@ dependencies = [ "pallet-call-decompressor", "pallet-collator-selection", "pallet-collective", + "pallet-fishermen", "pallet-ismp", "pallet-ismp-demo", "pallet-ismp-host-executive", @@ -10958,9 +10959,13 @@ dependencies = [ "pallet-message-queue", "pallet-mmr 0.1.1", "pallet-mmr-runtime-api", + "pallet-multisig", + "pallet-proxy", "pallet-session", + "pallet-state-coprocessor", "pallet-sudo", "pallet-timestamp", + "pallet-token-gateway-inspector", "pallet-token-governor", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", diff --git a/Cargo.toml b/Cargo.toml index 9bb7af7aa..81cb1f884 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -127,6 +127,8 @@ frame-try-runtime = { version = "0.43.0", default-features = false } pallet-aura = { version = "36.0.0", default-features = false } pallet-authorship = { version = "37.0.0", default-features = false } pallet-balances = { version = "38.0.0", default-features = false } +pallet-multisig = { version = "37.0.0", default-features = false } +pallet-proxy = { version = "37.0.0", default-features = false } pallet-session = { version = "37.0.0", default-features = false } pallet-sudo = { version = "37.0.0", default-features = false } pallet-utility = { version = "37.0.0", default-features = false } diff --git a/modules/ismp/pallets/asset-gateway/src/xcm_utilities.rs b/modules/ismp/pallets/asset-gateway/src/xcm_utilities.rs index 64dc89c1f..dfe5a8e06 100644 --- a/modules/ismp/pallets/asset-gateway/src/xcm_utilities.rs +++ b/modules/ismp/pallets/asset-gateway/src/xcm_utilities.rs @@ -177,7 +177,11 @@ where let pallet_account = Pallet::::account_id(); let protocol_percentage = Pallet::::protocol_fee_percentage(); - let protocol_fees = protocol_percentage * u128::from(amount); + // If destination is ETH mainnet charge a base fee of 2 DOT to cover expensive consensus + // messages + let base_fee = + if who.dest_state_machine == StateMachine::Evm(1) { 20_000_000_000u128 } else { 0 }; + let protocol_fees = protocol_percentage * u128::from(amount) + base_fee; let remainder = amount - protocol_fees.into(); // Mint protocol fees T::Assets::mint_into(asset_id.clone(), &protocol_account, protocol_fees.into()) diff --git a/modules/ismp/pallets/testsuite/src/tests/pallet_xcm_gateway.rs b/modules/ismp/pallets/testsuite/src/tests/pallet_xcm_gateway.rs index 04ae8301d..6a31cf17b 100644 --- a/modules/ismp/pallets/testsuite/src/tests/pallet_xcm_gateway.rs +++ b/modules/ismp/pallets/testsuite/src/tests/pallet_xcm_gateway.rs @@ -32,7 +32,7 @@ fn should_dispatch_ismp_request_when_assets_are_received_from_relay_chain() { let beneficiary: Location = Junctions::X3(Arc::new([ Junction::AccountId32 { network: None, id: ALICE.into() }, Junction::AccountKey20 { - network: Some(NetworkId::Ethereum { chain_id: 1 }), + network: Some(NetworkId::Ethereum { chain_id: 97 }), key: [1u8; 20], }, Junction::GeneralIndex(60 * 60), @@ -89,7 +89,7 @@ fn should_process_on_accept_module_callback_correctly() { let beneficiary: Location = Junctions::X3(Arc::new([ Junction::AccountId32 { network: None, id: ALICE.into() }, Junction::AccountKey20 { - network: Some(NetworkId::Ethereum { chain_id: 1 }), + network: Some(NetworkId::Ethereum { chain_id: 97 }), key: [1u8; 20], }, Junction::GeneralIndex(60 * 60), @@ -197,7 +197,7 @@ fn should_process_on_timeout_module_callback_correctly() { let beneficiary: Location = Junctions::X3(Arc::new([ Junction::AccountId32 { network: None, id: ALICE.into() }, Junction::AccountKey20 { - network: Some(NetworkId::Ethereum { chain_id: 1 }), + network: Some(NetworkId::Ethereum { chain_id: 97 }), key: [0u8; 20], }, Junction::GeneralIndex(60 * 60), @@ -266,7 +266,7 @@ fn should_process_on_timeout_module_callback_correctly() { }; let post = PostRequest { source: StateMachine::Kusama(100), - dest: StateMachine::Evm(1), + dest: StateMachine::Evm(97), nonce: 0, from: H160::zero().0.to_vec(), to: H160::zero().0.to_vec(), diff --git a/parachain/chainspec/nexus.json b/parachain/chainspec/nexus.json index debb841d0..06a8e63ce 100644 --- a/parachain/chainspec/nexus.json +++ b/parachain/chainspec/nexus.json @@ -9,7 +9,9 @@ "/dns4/boot.helikon.io/tcp/8610/p2p/12D3KooWNvVYuuHtV9KSpUXy7puERNvoNyAcRGizp3s2QpHQuuhq", "/dns4/boot.helikon.io/tcp/8612/wss/p2p/12D3KooWNvVYuuHtV9KSpUXy7puERNvoNyAcRGizp3s2QpHQuuhq", "/dns/hyperbridge-nexus-boot-ng.dwellir.com/tcp/30367/p2p/12D3KooWSQsd5E7SyPX184B7vPBWAiF5Wjn4DvhSt8TrRB6FQeDk", - "/dns/hyperbridge-nexus-boot-ng.dwellir.com/tcp/443/wss/p2p/12D3KooWSQsd5E7SyPX184B7vPBWAiF5Wjn4DvhSt8TrRB6FQeDk" + "/dns/hyperbridge-nexus-boot-ng.dwellir.com/tcp/443/wss/p2p/12D3KooWSQsd5E7SyPX184B7vPBWAiF5Wjn4DvhSt8TrRB6FQeDk", + "/dns/nexus-bootnode.radiumblock.com/tcp/30333/p2p/12D3KooWJ9J1a3ktfko2UBr8jyx2pQVYYyubfCcMqo3SSsQKQ81o", + "/dns/nexus-bootnode.radiumblock.com/tcp/30336/wss/p2p/12D3KooWJ9J1a3ktfko2UBr8jyx2pQVYYyubfCcMqo3SSsQKQ81o" ], "telemetryEndpoints": [ [ diff --git a/parachain/runtimes/gargantua/Cargo.toml b/parachain/runtimes/gargantua/Cargo.toml index 1ec824a0d..30941195c 100644 --- a/parachain/runtimes/gargantua/Cargo.toml +++ b/parachain/runtimes/gargantua/Cargo.toml @@ -104,7 +104,6 @@ sp-mmr-primitives = { workspace = true } simnode-runtime-api = { workspace = true } hyperbridge-client-machine = { workspace = true } pallet-token-gateway-inspector = { workspace = true } -pallet-token-gateway = { workspace = true } [features] default = [ @@ -179,7 +178,6 @@ std = [ "pallet-state-coprocessor/std", "pallet-xcm-gateway/std", "pallet-token-gateway-inspector/std", - "pallet-token-gateway/std", "pallet-token-governor/std", "pallet-assets/std", "pallet-mmr/std", diff --git a/parachain/runtimes/gargantua/src/ismp.rs b/parachain/runtimes/gargantua/src/ismp.rs index be7b36251..699c1ca21 100644 --- a/parachain/runtimes/gargantua/src/ismp.rs +++ b/parachain/runtimes/gargantua/src/ismp.rs @@ -16,8 +16,8 @@ use crate::{ alloc::{boxed::Box, string::ToString}, weights, AccountId, Assets, Balance, Balances, Ismp, IsmpParachain, Mmr, ParachainInfo, - Runtime, RuntimeEvent, Timestamp, TokenGatewayInspector, TokenGovernor, XcmGateway, - EXISTENTIAL_DEPOSIT, + Runtime, RuntimeEvent, Timestamp, TokenGatewayInspector, TokenGovernor, TreasuryPalletId, + XcmGateway, EXISTENTIAL_DEPOSIT, }; use anyhow::anyhow; use frame_support::{ @@ -106,7 +106,7 @@ impl ismp_grandpa::Config for Runtime { impl pallet_token_governor::Config for Runtime { type RuntimeEvent = RuntimeEvent; type Dispatcher = Ismp; - type TreasuryAccount = ProtocolAccount; + type TreasuryAccount = TreasuryPalletId; } impl pallet_ismp_demo::Config for Runtime { @@ -140,10 +140,8 @@ impl pallet_fishermen::Config for Runtime { type IsmpHost = Ismp; } -// todo: set corrrect parameters parameter_types! { pub const AssetPalletId: PalletId = PalletId(*b"asset-tx"); - pub const ProtocolAccount: PalletId = PalletId(*b"protocol"); pub const TransferParams: AssetGatewayParams = AssetGatewayParams::from_parts(Permill::from_parts(1_000)); // 0.1% } @@ -216,13 +214,13 @@ impl IsmpModule for ProxyModule { let pallet_id = ModuleId::from_bytes(&request.to).map_err(|err| Error::Custom(err.to_string()))?; - let token_gateway = ModuleId::Evm(XcmGateway::token_gateway_address(&request.source)); + let xcm_gateway = ModuleId::Evm(XcmGateway::token_gateway_address(&request.source)); let token_governor = ModuleId::Pallet(PalletId(pallet_token_governor::PALLET_ID)); match pallet_id { pallet_ismp_demo::PALLET_ID => pallet_ismp_demo::IsmpModuleCallback::::default().on_accept(request), - id if id == token_gateway => + id if id == xcm_gateway => pallet_xcm_gateway::Module::::default().on_accept(request), id if id == token_governor => TokenGovernor::default().on_accept(request), _ => Err(anyhow!("Destination module not found")), @@ -254,23 +252,24 @@ impl IsmpModule for ProxyModule { } fn on_timeout(&self, timeout: Timeout) -> Result<(), anyhow::Error> { - let (from, source) = match &timeout { + let (from, _source, dest) = match &timeout { Timeout::Request(Request::Post(post)) => { if post.source != HostStateMachine::get() { TokenGatewayInspector::handle_timeout(post)?; } - (&post.from, &post.source) + (&post.from, post.source.clone(), post.dest.clone()) }, - Timeout::Request(Request::Get(get)) => (&get.from, &get.source), - Timeout::Response(res) => (&res.post.to, &res.post.dest), + Timeout::Request(Request::Get(get)) => + (&get.from, get.source.clone(), get.dest.clone()), + Timeout::Response(res) => (&res.post.to, res.source_chain(), res.dest_chain()), }; let pallet_id = ModuleId::from_bytes(from).map_err(|err| Error::Custom(err.to_string()))?; - let token_gateway = ModuleId::Evm(XcmGateway::token_gateway_address(source)); + let xcm_gateway = ModuleId::Evm(XcmGateway::token_gateway_address(&dest)); match pallet_id { pallet_ismp_demo::PALLET_ID => pallet_ismp_demo::IsmpModuleCallback::::default().on_timeout(timeout), - id if id == token_gateway => + id if id == xcm_gateway => pallet_xcm_gateway::Module::::default().on_timeout(timeout), // instead of returning an error, do nothing. The timeout is for a connected chain. _ => Ok(()), diff --git a/parachain/runtimes/gargantua/src/lib.rs b/parachain/runtimes/gargantua/src/lib.rs index 6720fc660..08c4489ec 100644 --- a/parachain/runtimes/gargantua/src/lib.rs +++ b/parachain/runtimes/gargantua/src/lib.rs @@ -233,7 +233,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("gargantua"), impl_name: create_runtime_str!("gargantua"), authoring_version: 1, - spec_version: 1140, + spec_version: 1150, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, diff --git a/parachain/runtimes/nexus/Cargo.toml b/parachain/runtimes/nexus/Cargo.toml index 690c073cd..b15439eb6 100644 --- a/parachain/runtimes/nexus/Cargo.toml +++ b/parachain/runtimes/nexus/Cargo.toml @@ -48,6 +48,8 @@ pallet-utility = { workspace = true } pallet-treasury = { workspace = true} pallet-asset-rate = { workspace = true} pallet-collective = { workspace = true} +pallet-multisig = { workspace = true} +pallet-proxy = { workspace = true} sp-api = { workspace = true } sp-io = { workspace = true } @@ -96,12 +98,15 @@ ismp-parachain = { workspace = true } ismp-parachain-runtime-api = { workspace = true } ismp-sync-committee = { workspace = true } ismp-bsc = { workspace = true } +ismp-grandpa = { workspace = true } pallet-ismp-relayer = { workspace = true } pallet-ismp-host-executive = { workspace = true } pallet-call-decompressor = { workspace = true } pallet-xcm-gateway = { workspace = true } pallet-token-governor = { workspace = true } - +pallet-fishermen = { workspace = true } +pallet-state-coprocessor = { workspace = true } +pallet-token-gateway-inspector = { workspace = true } pallet-mmr = { workspace = true } pallet-mmr-runtime-api = { workspace = true } @@ -189,7 +194,13 @@ std = [ "simnode-runtime-api/std", "hyperbridge-client-machine/std", "frame-metadata-hash-extension/std", - "anyhow/std" + "anyhow/std", + "pallet-token-gateway-inspector/std", + "pallet-fishermen/std", + "pallet-state-coprocessor/std", + "ismp-grandpa/std", + "pallet-multisig/std", + "pallet-proxy/std" ] runtime-benchmarks = [ @@ -214,7 +225,9 @@ runtime-benchmarks = [ "pallet-message-queue/runtime-benchmarks", "pallet-assets/runtime-benchmarks", "pallet-sudo/runtime-benchmarks", - "parachains-common/runtime-benchmarks" + "parachains-common/runtime-benchmarks", + "pallet-multisig/runtime-benchmarks", + "pallet-proxy/runtime-benchmarks" ] try-runtime = [ diff --git a/parachain/runtimes/nexus/src/ismp.rs b/parachain/runtimes/nexus/src/ismp.rs index 31b5af88d..7c3cba80d 100644 --- a/parachain/runtimes/nexus/src/ismp.rs +++ b/parachain/runtimes/nexus/src/ismp.rs @@ -16,7 +16,8 @@ use crate::{ alloc::{boxed::Box, string::ToString}, weights, AccountId, Assets, Balance, Balances, Ismp, IsmpParachain, Mmr, ParachainInfo, - Runtime, RuntimeEvent, Timestamp, XcmGateway, EXISTENTIAL_DEPOSIT, + Runtime, RuntimeEvent, Timestamp, TokenGatewayInspector, TokenGovernor, TreasuryPalletId, + XcmGateway, EXISTENTIAL_DEPOSIT, }; use frame_support::{ pallet_prelude::{ConstU32, Get}, @@ -62,6 +63,11 @@ impl ismp_sync_committee::pallet::Config for Runtime { type IsmpHost = Ismp; } +impl pallet_state_coprocessor::Config for Runtime { + type IsmpHost = Ismp; + type Mmr = Mmr; +} + pub struct Coprocessor; impl Get> for Coprocessor { @@ -88,11 +94,17 @@ impl pallet_ismp::Config for Runtime { IsmpParachain, HyperbridgeClientMachine, >, + ismp_grandpa::consensus::GrandpaConsensusClient, ); type Mmr = Mmr; type WeightProvider = (); } +impl ismp_grandpa::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type IsmpHost = Ismp; +} + impl pallet_ismp_relayer::Config for Runtime { type RuntimeEvent = RuntimeEvent; type IsmpHost = Ismp; @@ -107,15 +119,18 @@ impl pallet_call_decompressor::Config for Runtime { type MaxCallSize = ConstU32<3>; } +impl pallet_fishermen::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type IsmpHost = Ismp; +} + impl ismp_parachain::Config for Runtime { type RuntimeEvent = RuntimeEvent; type IsmpHost = Ismp; } -// todo: set corrrect parameters parameter_types! { pub const AssetPalletId: PalletId = PalletId(*b"asset-tx"); - pub const ProtocolAccount: PalletId = PalletId(*b"protocol"); pub const TransferParams: AssetGatewayParams = AssetGatewayParams::from_parts(Permill::from_parts(1_000)); // 0.1% } @@ -130,7 +145,7 @@ impl pallet_xcm_gateway::Config for Runtime { impl pallet_token_governor::Config for Runtime { type RuntimeEvent = RuntimeEvent; type Dispatcher = Ismp; - type TreasuryAccount = ProtocolAccount; + type TreasuryAccount = TreasuryPalletId; } #[cfg(feature = "runtime-benchmarks")] @@ -175,13 +190,14 @@ impl pallet_assets::Config for Runtime { type BenchmarkHelper = XcmBenchmarkHelper; } +impl pallet_token_gateway_inspector::Config for Runtime { + type RuntimeEvent = RuntimeEvent; +} impl IsmpModule for ProxyModule { fn on_accept(&self, request: PostRequest) -> Result<(), anyhow::Error> { if request.dest != HostStateMachine::get() { - let token_gateway = XcmGateway::token_gateway_address(&request.dest); - if request.source.is_substrate() && request.from == token_gateway.0.to_vec() { - Err(Error::Custom("Illegal request!".into()))? - } + TokenGatewayInspector::inspect_request(&request)?; + Ismp::dispatch_request( Request::Post(request), FeeMetadata:: { payer: [0u8; 32].into(), fee: Default::default() }, @@ -192,10 +208,13 @@ impl IsmpModule for ProxyModule { let pallet_id = ModuleId::from_bytes(&request.to).map_err(|err| Error::Custom(err.to_string()))?; - let token_gateway = ModuleId::Evm(XcmGateway::token_gateway_address(&request.source)); + let xcm_gateway = ModuleId::Evm(XcmGateway::token_gateway_address(&request.source)); + let token_governor = ModuleId::Pallet(PalletId(pallet_token_governor::PALLET_ID)); + match pallet_id { - id if id == token_gateway => + id if id == xcm_gateway => pallet_xcm_gateway::Module::::default().on_accept(request), + id if id == token_governor => TokenGovernor::default().on_accept(request), _ => Err(anyhow!("Destination module not found")), } } @@ -213,18 +232,23 @@ impl IsmpModule for ProxyModule { } fn on_timeout(&self, timeout: Timeout) -> Result<(), anyhow::Error> { - let (from, source) = match &timeout { - Timeout::Request(Request::Post(post)) => (&post.from, &post.source), - Timeout::Request(Request::Get(get)) => (&get.from, &get.source), - Timeout::Response(res) => (&res.post.to, &res.post.dest), + let (from, _source, dest) = match &timeout { + Timeout::Request(Request::Post(post)) => { + if post.source != HostStateMachine::get() { + TokenGatewayInspector::handle_timeout(post)?; + } + (&post.from, &post.source, &post.dest) + }, + Timeout::Request(Request::Get(get)) => (&get.from, &get.source, &get.dest), + Timeout::Response(res) => (&res.post.to, &res.post.dest, &res.post.dest), }; let pallet_id = ModuleId::from_bytes(from).map_err(|err| Error::Custom(err.to_string()))?; - let token_gateway = ModuleId::Evm(XcmGateway::token_gateway_address(source)); + let xcm_gateway = ModuleId::Evm(XcmGateway::token_gateway_address(dest)); match pallet_id { - id if id == token_gateway => + id if id == xcm_gateway => pallet_xcm_gateway::Module::::default().on_timeout(timeout), - // instead of returning an error, do nothing. The timeout is for a connected chain + // instead of returning an error, do nothing. The timeout is for a connected chain. _ => Ok(()), } } diff --git a/parachain/runtimes/nexus/src/lib.rs b/parachain/runtimes/nexus/src/lib.rs index 5e3b8213d..d3a622e0e 100644 --- a/parachain/runtimes/nexus/src/lib.rs +++ b/parachain/runtimes/nexus/src/lib.rs @@ -40,7 +40,7 @@ use pallet_asset_rate::AssetKindFactory; use scale_info::TypeInfo; use smallvec::smallvec; use sp_api::impl_runtime_apis; -use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H256}; +use sp_core::{crypto::KeyTypeId, OpaqueMetadata, RuntimeDebug, H256}; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, traits::{AccountIdLookup, Block as BlockT, IdentifyAccount, Keccak256, Verify}, @@ -63,7 +63,7 @@ use frame_support::{ dispatch::DispatchClass, genesis_builder_helper::{build_state, get_preset}, parameter_types, - traits::{ConstU32, ConstU64, ConstU8, Everything}, + traits::{ConstU32, ConstU64, ConstU8, Everything, InstanceFilter}, weights::{ constants::WEIGHT_REF_TIME_PER_SECOND, ConstantMultiplier, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial, @@ -217,7 +217,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("nexus"), impl_name: create_runtime_str!("nexus"), authoring_version: 1, - spec_version: 100, + spec_version: 1000, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, @@ -558,7 +558,7 @@ impl pallet_collator_selection::Config for Runtime { type ValidatorId = ::AccountId; type ValidatorIdOf = pallet_collator_selection::IdentityCollator; type ValidatorRegistration = Session; - type WeightInfo = (); + type WeightInfo = weights::pallet_collator_selection::WeightInfo; } impl pallet_sudo::Config for Runtime { @@ -683,6 +683,114 @@ impl pallet_collective::Config for Runtime { type MaxProposalWeight = MaxCollectivesProposalWeight; } +parameter_types! { + // One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes. + pub const DepositBase: Balance = EXISTENTIAL_DEPOSIT * 5; + // Additional storage item size of 32 bytes. + pub const DepositFactor: Balance = EXISTENTIAL_DEPOSIT * 2; + pub const MaxSignatories: u32 = 100; +} + +impl pallet_multisig::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; + type Currency = Balances; + type DepositBase = DepositBase; + type DepositFactor = DepositFactor; + type MaxSignatories = MaxSignatories; + type WeightInfo = weights::pallet_multisig::WeightInfo; +} + +parameter_types! { + // One storage item; key size 32, value size 8; . + pub const ProxyDepositBase: Balance = EXISTENTIAL_DEPOSIT * 5; + // Additional storage item size of 33 bytes. + pub const ProxyDepositFactor: Balance = EXISTENTIAL_DEPOSIT * 2; + pub const MaxProxies: u16 = 32; + // One storage item; key size 32, value size 16 + pub const AnnouncementDepositBase: Balance = EXISTENTIAL_DEPOSIT * 5; + pub const AnnouncementDepositFactor: Balance = EXISTENTIAL_DEPOSIT * 2; + pub const MaxPending: u16 = 32; +} + +/// The type used to represent the kinds of proxying allowed. +#[derive( + Copy, + Clone, + Eq, + PartialEq, + Ord, + PartialOrd, + Encode, + Decode, + RuntimeDebug, + MaxEncodedLen, + scale_info::TypeInfo, +)] +pub enum ProxyType { + /// Fully permissioned proxy. Can execute any call on behalf of _proxied_. + Any, + /// Collator selection proxy. Can execute calls related to collator selection mechanism. + Collator, + /// Can execute any call that does not transfer funds or assets. + NonTransfer, + /// Proxy with the ability to reject time-delay proxy announcements. + CancelProxy, +} + +impl Default for ProxyType { + fn default() -> Self { + Self::Any + } +} + +impl InstanceFilter for ProxyType { + fn filter(&self, c: &RuntimeCall) -> bool { + match self { + ProxyType::Any => true, + ProxyType::NonTransfer => + !matches!(c, RuntimeCall::Balances { .. } | RuntimeCall::Assets { .. }), + ProxyType::CancelProxy => matches!( + c, + RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. }) | + RuntimeCall::Utility { .. } | + RuntimeCall::Multisig { .. } + ), + ProxyType::Collator => matches!( + c, + RuntimeCall::CollatorSelection { .. } | + RuntimeCall::Utility { .. } | + RuntimeCall::Multisig { .. } + ), + } + } + + fn is_superset(&self, o: &Self) -> bool { + match (self, o) { + (x, y) if x == y => true, + (ProxyType::Any, _) => true, + (_, ProxyType::Any) => false, + (ProxyType::NonTransfer, ProxyType::Collator) => true, + _ => false, + } + } +} + +impl pallet_proxy::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; + type Currency = Balances; + type ProxyType = ProxyType; + type ProxyDepositBase = ProxyDepositBase; + type ProxyDepositFactor = ProxyDepositFactor; + type MaxProxies = MaxProxies; + type WeightInfo = weights::pallet_proxy::WeightInfo; + type MaxPending = MaxPending; + type CallHasher = Keccak256; + type AnnouncementDepositBase = AnnouncementDepositBase; + type AnnouncementDepositFactor = AnnouncementDepositFactor; +} + // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( pub enum Runtime @@ -699,6 +807,8 @@ construct_runtime!( TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event} = 11, Treasury: pallet_treasury = 12, AssetRate: pallet_asset_rate = 13, + Multisig: pallet_multisig = 14, + Proxy: pallet_proxy = 15, // Collator support. The order of these 4 are important and shall not change. Authorship: pallet_authorship::{Pallet, Storage} = 20, @@ -715,21 +825,26 @@ construct_runtime!( // ISMP stuff // Xcm messages are executed in on_initialize of the message queue, pallet ismp must come before the queue so it can // setup the mmr - Mmr: pallet_mmr = 33, - Ismp: pallet_ismp = 34, - MessageQueue: pallet_message_queue = 35, - - IsmpParachain: ismp_parachain = 40, - IsmpSyncCommittee: ismp_sync_committee::pallet::{Pallet, Call} = 41, - Relayer: pallet_ismp_relayer = 42, - HostExecutive: pallet_ismp_host_executive = 43, - CallDecompressor: pallet_call_decompressor = 44, - XcmGateway: pallet_xcm_gateway = 45, - Assets: pallet_assets = 46, - TokenGovernor: pallet_token_governor = 47, + Mmr: pallet_mmr = 40, + Ismp: pallet_ismp = 41, + MessageQueue: pallet_message_queue = 42, + + IsmpParachain: ismp_parachain = 50, + IsmpSyncCommittee: ismp_sync_committee::pallet = 51, + Relayer: pallet_ismp_relayer = 52, + HostExecutive: pallet_ismp_host_executive = 53, + CallDecompressor: pallet_call_decompressor = 54, + XcmGateway: pallet_xcm_gateway = 55, + Assets: pallet_assets = 56, + TokenGovernor: pallet_token_governor = 57, + StateCoprocessor: pallet_state_coprocessor = 58, + Fishermen: pallet_fishermen = 59, + TokenGatewayInspector: pallet_token_gateway_inspector = 60, // Governance - TechnicalCollective: pallet_collective = 60 + TechnicalCollective: pallet_collective = 80, + // consensus clients + IsmpGrandpa: ismp_grandpa = 255 } ); @@ -744,8 +859,7 @@ mod benches { [pallet_balances, Balances] [pallet_session, SessionBench::] [pallet_timestamp, Timestamp] - // benchmarks are broken in v1.6.0 - // [pallet_collator_selection, CollatorSelection] + [pallet_collator_selection, CollatorSelection] // todo: benchmarking requires painful configuration steps // [pallet_xcm, pallet_xcm::benchmarking::Pallet::] [cumulus_pallet_xcmp_queue, XcmpQueue] @@ -756,6 +870,8 @@ mod benches { [pallet_treasury, Treasury] [pallet_asset_rate, AssetRate] [pallet_collective, TechnicalCollective] + [pallet_multisig, Multisig] + [pallet_proxy, Proxy] [cumulus_pallet_parachain_system, ParachainSystem] [pallet_session, SessionBench::] ); diff --git a/parachain/runtimes/nexus/src/weights/mod.rs b/parachain/runtimes/nexus/src/weights/mod.rs index 7b5e8c9a5..0529fe350 100644 --- a/parachain/runtimes/nexus/src/weights/mod.rs +++ b/parachain/runtimes/nexus/src/weights/mod.rs @@ -28,8 +28,11 @@ pub mod frame_system; pub mod pallet_asset_rate; pub mod pallet_assets; pub mod pallet_balances; +pub mod pallet_collator_selection; pub mod pallet_collective; pub mod pallet_message_queue; +pub mod pallet_multisig; +pub mod pallet_proxy; pub mod pallet_session; pub mod pallet_sudo; pub mod pallet_timestamp; diff --git a/parachain/runtimes/nexus/src/weights/pallet_collator_selection.rs b/parachain/runtimes/nexus/src/weights/pallet_collator_selection.rs new file mode 100644 index 000000000..99a45bc46 --- /dev/null +++ b/parachain/runtimes/nexus/src/weights/pallet_collator_selection.rs @@ -0,0 +1,267 @@ + +//! Autogenerated weights for `pallet_collator_selection` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 42.0.0 +//! DATE: 2024-10-17, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `polytope-labs`, CPU: `AMD Ryzen Threadripper PRO 5995WX 64-Cores` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/hyperbridge +// benchmark +// pallet +// --runtime=/home/david/open-source/hyperbridge/target/release/wbuild/nexus-runtime/nexus_runtime.wasm +// --genesis-builder=runtime +// --execution=wasm +// --wasm-execution=compiled +// --pallet +// pallet_collator_selection +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 +// --output +// parachain/runtimes/nexus/src/weights/pallet_collator_selection.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_collator_selection`. +pub struct WeightInfo(PhantomData); +impl pallet_collator_selection::WeightInfo for WeightInfo { + /// Storage: `Session::NextKeys` (r:100 w:0) + /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `CollatorSelection::Invulnerables` (r:0 w:1) + /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(3202), added: 3697, mode: `MaxEncodedLen`) + /// The range of component `b` is `[1, 100]`. + fn set_invulnerables(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `50 + b * (78 ±0)` + // Estimated: `1041 + b * (2554 ±0)` + // Minimum execution time: 9_498_000 picoseconds. + Weight::from_parts(8_732_547, 0) + .saturating_add(Weight::from_parts(0, 1041)) + // Standard Error: 2_718 + .saturating_add(Weight::from_parts(3_294_933, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into()))) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(Weight::from_parts(0, 2554).saturating_mul(b.into())) + } + /// Storage: `Session::NextKeys` (r:1 w:0) + /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `CollatorSelection::Invulnerables` (r:1 w:1) + /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(3202), added: 3697, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::CandidateList` (r:1 w:1) + /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(48002), added: 48497, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `b` is `[1, 99]`. + /// The range of component `c` is `[1, 999]`. + fn add_invulnerable(b: u32, c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1185 + b * (32 ±0) + c * (48 ±0)` + // Estimated: `49487 + b * (33 ±0) + c * (49 ±0)` + // Minimum execution time: 45_085_000 picoseconds. + Weight::from_parts(41_823_114, 0) + .saturating_add(Weight::from_parts(0, 49487)) + // Standard Error: 5_828 + .saturating_add(Weight::from_parts(6_388, 0).saturating_mul(b.into())) + // Standard Error: 572 + .saturating_add(Weight::from_parts(60_540, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(Weight::from_parts(0, 33).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 49).saturating_mul(c.into())) + } + /// Storage: `CollatorSelection::CandidateList` (r:1 w:0) + /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(48002), added: 48497, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::Invulnerables` (r:1 w:1) + /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(3202), added: 3697, mode: `MaxEncodedLen`) + /// The range of component `b` is `[6, 100]`. + fn remove_invulnerable(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `8 + b * (32 ±0)` + // Estimated: `49487` + // Minimum execution time: 8_767_000 picoseconds. + Weight::from_parts(10_336_910, 0) + .saturating_add(Weight::from_parts(0, 49487)) + // Standard Error: 539 + .saturating_add(Weight::from_parts(43_353, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `CollatorSelection::DesiredCandidates` (r:0 w:1) + /// Proof: `CollatorSelection::DesiredCandidates` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn set_desired_candidates() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 4_459_000 picoseconds. + Weight::from_parts(4_649_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `CollatorSelection::CandidacyBond` (r:1 w:1) + /// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::CandidateList` (r:1 w:1) + /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(48002), added: 48497, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1000 w:1000) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1000) + /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// The range of component `c` is `[0, 1000]`. + /// The range of component `k` is `[0, 1000]`. + fn set_candidacy_bond(c: u32, k: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + c * (184 ±0) + k * (115 ±0)` + // Estimated: `53050 + c * (906 ±29) + k * (906 ±29)` + // Minimum execution time: 8_757_000 picoseconds. + Weight::from_parts(8_967_000, 0) + .saturating_add(Weight::from_parts(0, 53050)) + // Standard Error: 182_873 + .saturating_add(Weight::from_parts(5_622_013, 0).saturating_mul(c.into())) + // Standard Error: 182_873 + .saturating_add(Weight::from_parts(5_860_435, 0).saturating_mul(k.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into()))) + .saturating_add(Weight::from_parts(0, 906).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 906).saturating_mul(k.into())) + } + /// Storage: `CollatorSelection::CandidacyBond` (r:1 w:0) + /// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::CandidateList` (r:1 w:1) + /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(48002), added: 48497, mode: `MaxEncodedLen`) + /// The range of component `c` is `[6, 1000]`. + fn update_bond(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `408 + c * (48 ±0)` + // Estimated: `49487` + // Minimum execution time: 24_376_000 picoseconds. + Weight::from_parts(24_185_265, 0) + .saturating_add(Weight::from_parts(0, 49487)) + // Standard Error: 893 + .saturating_add(Weight::from_parts(63_462, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `CollatorSelection::CandidateList` (r:1 w:1) + /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(48002), added: 48497, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::Invulnerables` (r:1 w:0) + /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(3202), added: 3697, mode: `MaxEncodedLen`) + /// Storage: `Session::NextKeys` (r:1 w:0) + /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `CollatorSelection::CandidacyBond` (r:1 w:0) + /// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1) + /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// The range of component `c` is `[1, 999]`. + fn register_as_candidate(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `900 + c * (48 ±0)` + // Estimated: `49487 + c * (49 ±0)` + // Minimum execution time: 32_992_000 picoseconds. + Weight::from_parts(34_097_910, 0) + .saturating_add(Weight::from_parts(0, 49487)) + // Standard Error: 859 + .saturating_add(Weight::from_parts(75_705, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(Weight::from_parts(0, 49).saturating_mul(c.into())) + } + /// Storage: `CollatorSelection::Invulnerables` (r:1 w:0) + /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(3202), added: 3697, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::CandidacyBond` (r:1 w:0) + /// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Session::NextKeys` (r:1 w:0) + /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `CollatorSelection::CandidateList` (r:1 w:1) + /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(48002), added: 48497, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:2) + /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// The range of component `c` is `[6, 1000]`. + fn take_candidate_slot(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1021 + c * (48 ±0)` + // Estimated: `49487 + c * (49 ±0)` + // Minimum execution time: 48_973_000 picoseconds. + Weight::from_parts(55_103_746, 0) + .saturating_add(Weight::from_parts(0, 49487)) + // Standard Error: 883 + .saturating_add(Weight::from_parts(58_398, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(Weight::from_parts(0, 49).saturating_mul(c.into())) + } + /// Storage: `CollatorSelection::CandidateList` (r:1 w:1) + /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(48002), added: 48497, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::Invulnerables` (r:1 w:0) + /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(3202), added: 3697, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1) + /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// The range of component `c` is `[6, 1000]`. + fn leave_intent(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `270 + c * (48 ±0)` + // Estimated: `49487` + // Minimum execution time: 28_423_000 picoseconds. + Weight::from_parts(27_615_858, 0) + .saturating_add(Weight::from_parts(0, 49487)) + // Standard Error: 1_035 + .saturating_add(Weight::from_parts(55_872, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1) + /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + fn note_author() -> Weight { + // Proof Size summary in bytes: + // Measured: `52` + // Estimated: `6196` + // Minimum execution time: 36_850_000 picoseconds. + Weight::from_parts(37_451_000, 0) + .saturating_add(Weight::from_parts(0, 6196)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `CollatorSelection::CandidateList` (r:1 w:0) + /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(48002), added: 48497, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::LastAuthoredBlock` (r:999 w:0) + /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::Invulnerables` (r:1 w:0) + /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(3202), added: 3697, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::DesiredCandidates` (r:1 w:0) + /// Proof: `CollatorSelection::DesiredCandidates` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:995 w:995) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `r` is `[1, 1000]`. + /// The range of component `c` is `[1, 1000]`. + fn new_session(r: u32, c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `21790 + c * (97 ±0) + r * (117 ±0)` + // Estimated: `49487 + c * (2519 ±0) + r * (2602 ±0)` + // Minimum execution time: 16_621_000 picoseconds. + Weight::from_parts(17_403_000, 0) + .saturating_add(Weight::from_parts(0, 49487)) + // Standard Error: 550_075 + .saturating_add(Weight::from_parts(23_124_180, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) + .saturating_add(Weight::from_parts(0, 2519).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 2602).saturating_mul(r.into())) + } +} diff --git a/parachain/runtimes/nexus/src/weights/pallet_multisig.rs b/parachain/runtimes/nexus/src/weights/pallet_multisig.rs new file mode 100644 index 000000000..62f9d495c --- /dev/null +++ b/parachain/runtimes/nexus/src/weights/pallet_multisig.rs @@ -0,0 +1,152 @@ + +//! Autogenerated weights for `pallet_multisig` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 42.0.0 +//! DATE: 2024-10-17, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `polytope-labs`, CPU: `AMD Ryzen Threadripper PRO 5995WX 64-Cores` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/hyperbridge +// benchmark +// pallet +// --runtime=/home/david/open-source/hyperbridge/target/release/wbuild/nexus-runtime/nexus_runtime.wasm +// --genesis-builder=runtime +// --execution=wasm +// --wasm-execution=compiled +// --pallet +// pallet_multisig +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 +// --output +// parachain/runtimes/nexus/src/weights/pallet_multisig.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_multisig`. +pub struct WeightInfo(PhantomData); +impl pallet_multisig::WeightInfo for WeightInfo { + /// The range of component `z` is `[0, 10000]`. + fn as_multi_threshold_1(z: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 11_041_000 picoseconds. + Weight::from_parts(12_455_268, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 11 + .saturating_add(Weight::from_parts(468, 0).saturating_mul(z.into())) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + /// The range of component `z` is `[0, 10000]`. + fn as_multi_create(s: u32, z: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `186 + s * (2 ±0)` + // Estimated: `6811` + // Minimum execution time: 36_720_000 picoseconds. + Weight::from_parts(33_900_925, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 3_044 + .saturating_add(Weight::from_parts(69_204, 0).saturating_mul(s.into())) + // Standard Error: 29 + .saturating_add(Weight::from_parts(1_157, 0).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[3, 100]`. + /// The range of component `z` is `[0, 10000]`. + fn as_multi_approve(s: u32, z: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `185` + // Estimated: `6811` + // Minimum execution time: 21_420_000 picoseconds. + Weight::from_parts(15_666_444, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 2_139 + .saturating_add(Weight::from_parts(76_649, 0).saturating_mul(s.into())) + // Standard Error: 20 + .saturating_add(Weight::from_parts(1_314, 0).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + /// The range of component `z` is `[0, 10000]`. + fn as_multi_complete(s: u32, z: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `289 + s * (33 ±0)` + // Estimated: `6811` + // Minimum execution time: 38_994_000 picoseconds. + Weight::from_parts(33_158_210, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 3_482 + .saturating_add(Weight::from_parts(80_122, 0).saturating_mul(s.into())) + // Standard Error: 34 + .saturating_add(Weight::from_parts(1_510, 0).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + fn approve_as_multi_create(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `187 + s * (2 ±0)` + // Estimated: `6811` + // Minimum execution time: 26_450_000 picoseconds. + Weight::from_parts(29_377_765, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 3_153 + .saturating_add(Weight::from_parts(79_897, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + fn approve_as_multi_approve(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `185` + // Estimated: `6811` + // Minimum execution time: 12_734_000 picoseconds. + Weight::from_parts(14_158_613, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 1_801 + .saturating_add(Weight::from_parts(77_239, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + fn cancel_as_multi(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `357 + s * (1 ±0)` + // Estimated: `6811` + // Minimum execution time: 25_798_000 picoseconds. + Weight::from_parts(28_470_339, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 2_904 + .saturating_add(Weight::from_parts(84_515, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/parachain/runtimes/nexus/src/weights/pallet_proxy.rs b/parachain/runtimes/nexus/src/weights/pallet_proxy.rs new file mode 100644 index 000000000..f2486b997 --- /dev/null +++ b/parachain/runtimes/nexus/src/weights/pallet_proxy.rs @@ -0,0 +1,209 @@ + +//! Autogenerated weights for `pallet_proxy` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 42.0.0 +//! DATE: 2024-10-17, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `polytope-labs`, CPU: `AMD Ryzen Threadripper PRO 5995WX 64-Cores` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/hyperbridge +// benchmark +// pallet +// --runtime=/home/david/open-source/hyperbridge/target/release/wbuild/nexus-runtime/nexus_runtime.wasm +// --genesis-builder=runtime +// --execution=wasm +// --wasm-execution=compiled +// --pallet +// pallet_proxy +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 +// --output +// parachain/runtimes/nexus/src/weights/pallet_proxy.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_proxy`. +pub struct WeightInfo(PhantomData); +impl pallet_proxy::WeightInfo for WeightInfo { + /// Storage: `Proxy::Proxies` (r:1 w:0) + /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`) + /// The range of component `p` is `[1, 31]`. + fn proxy(p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `65 + p * (37 ±0)` + // Estimated: `4706` + // Minimum execution time: 12_073_000 picoseconds. + Weight::from_parts(12_803_933, 0) + .saturating_add(Weight::from_parts(0, 4706)) + // Standard Error: 1_025 + .saturating_add(Weight::from_parts(30_393, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1)) + } + /// Storage: `Proxy::Proxies` (r:1 w:0) + /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`) + /// Storage: `Proxy::Announcements` (r:1 w:1) + /// Proof: `Proxy::Announcements` (`max_values`: None, `max_size`: Some(2233), added: 4708, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn proxy_announced(a: u32, p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `358 + a * (68 ±0) + p * (37 ±0)` + // Estimated: `5698` + // Minimum execution time: 35_126_000 picoseconds. + Weight::from_parts(34_889_760, 0) + .saturating_add(Weight::from_parts(0, 5698)) + // Standard Error: 1_819 + .saturating_add(Weight::from_parts(196_752, 0).saturating_mul(a.into())) + // Standard Error: 1_879 + .saturating_add(Weight::from_parts(29_171, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Proxy::Announcements` (r:1 w:1) + /// Proof: `Proxy::Announcements` (`max_values`: None, `max_size`: Some(2233), added: 4708, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn remove_announcement(a: u32, _p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `272 + a * (68 ±0)` + // Estimated: `5698` + // Minimum execution time: 23_264_000 picoseconds. + Weight::from_parts(24_247_628, 0) + .saturating_add(Weight::from_parts(0, 5698)) + // Standard Error: 1_103 + .saturating_add(Weight::from_parts(185_849, 0).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Proxy::Announcements` (r:1 w:1) + /// Proof: `Proxy::Announcements` (`max_values`: None, `max_size`: Some(2233), added: 4708, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn reject_announcement(a: u32, _p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `272 + a * (68 ±0)` + // Estimated: `5698` + // Minimum execution time: 23_304_000 picoseconds. + Weight::from_parts(24_131_483, 0) + .saturating_add(Weight::from_parts(0, 5698)) + // Standard Error: 1_075 + .saturating_add(Weight::from_parts(187_931, 0).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Proxy::Proxies` (r:1 w:0) + /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`) + /// Storage: `Proxy::Announcements` (r:1 w:1) + /// Proof: `Proxy::Announcements` (`max_values`: None, `max_size`: Some(2233), added: 4708, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn announce(a: u32, p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `290 + a * (68 ±0) + p * (37 ±0)` + // Estimated: `5698` + // Minimum execution time: 30_778_000 picoseconds. + Weight::from_parts(30_352_429, 0) + .saturating_add(Weight::from_parts(0, 5698)) + // Standard Error: 2_769 + .saturating_add(Weight::from_parts(219_889, 0).saturating_mul(a.into())) + // Standard Error: 2_860 + .saturating_add(Weight::from_parts(39_101, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Proxy::Proxies` (r:1 w:1) + /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`) + /// The range of component `p` is `[1, 31]`. + fn add_proxy(p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `65 + p * (37 ±0)` + // Estimated: `4706` + // Minimum execution time: 21_250_000 picoseconds. + Weight::from_parts(22_411_742, 0) + .saturating_add(Weight::from_parts(0, 4706)) + // Standard Error: 1_489 + .saturating_add(Weight::from_parts(35_374, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Proxy::Proxies` (r:1 w:1) + /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`) + /// The range of component `p` is `[1, 31]`. + fn remove_proxy(p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `65 + p * (37 ±0)` + // Estimated: `4706` + // Minimum execution time: 21_651_000 picoseconds. + Weight::from_parts(22_481_539, 0) + .saturating_add(Weight::from_parts(0, 4706)) + // Standard Error: 1_391 + .saturating_add(Weight::from_parts(47_298, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Proxy::Proxies` (r:1 w:1) + /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`) + /// The range of component `p` is `[1, 31]`. + fn remove_proxies(p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `65 + p * (37 ±0)` + // Estimated: `4706` + // Minimum execution time: 19_196_000 picoseconds. + Weight::from_parts(19_945_856, 0) + .saturating_add(Weight::from_parts(0, 4706)) + // Standard Error: 1_102 + .saturating_add(Weight::from_parts(31_351, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Proxy::Proxies` (r:1 w:1) + /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`) + /// The range of component `p` is `[1, 31]`. + fn create_pure(p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `76` + // Estimated: `4706` + // Minimum execution time: 23_104_000 picoseconds. + Weight::from_parts(23_869_912, 0) + .saturating_add(Weight::from_parts(0, 4706)) + // Standard Error: 1_187 + .saturating_add(Weight::from_parts(13_439, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Proxy::Proxies` (r:1 w:1) + /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`) + /// The range of component `p` is `[0, 30]`. + fn kill_pure(p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `102 + p * (37 ±0)` + // Estimated: `4706` + // Minimum execution time: 20_439_000 picoseconds. + Weight::from_parts(21_438_739, 0) + .saturating_add(Weight::from_parts(0, 4706)) + // Standard Error: 1_315 + .saturating_add(Weight::from_parts(29_569, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +}