diff --git a/README.md b/README.md index b3ab28f9..2ef9282a 100644 --- a/README.md +++ b/README.md @@ -4,28 +4,28 @@ The Bulletin chain consists of a customized node implementation and a single run ## Node implementation -The Bulletin chain node implements IPFS support on top of a regualar Substrate node. Only work with `litep2p` network backend is supported (enabled by default), and in order to use IPFS functionality `--ipfs-server` flag must be passed to the node binary. +The Bulletin chain node implements IPFS support on top of a regular Substrate node. Only work with `litep2p` network backend is supported (enabled by default), and in order to use IPFS functionality `--ipfs-server` flag must be passed to the node binary. IPFS support comes in two parts: 1. Bitswap protocol implementation. Wire protocol for transferring chunks stored in transaction storage to IPFS clients. This is implemented in `litep2p` networking library and `litep2p` network backend in `sc-network` crate. -2. IPFS Kademlia DHT support. We publish content provider records for our node for CIDs (content identifiers) of transactions stored in transaction storage. Content provider records are only kept for transactions included in the chain during last two weeks, what should agree with block pruning period of the Bulletin nodes. DHT support is provided by `litep2p` networking library and `sc-network` crate. The implementation in the Bulletin node ensures we register as content providers for transactions during last two weeks. +2. IPFS Kademlia DHT support. We publish content provider records for our node for CIDs (content identifiers) of transactions stored in transaction storage. Content provider records are only kept for transactions included in the chain during last two weeks, what should agree with block pruning period of the Bulletin nodes. DHT support is provided by `litep2p` networking library and `sc-network` crate. The implementation in the Bulletin node ensures we register as content providers for transactions during the last two weeks. -Bulletin node also has idle connection timeout set to 1 hour instead of default 10 seconds to allow manually adding the node to the swarm of an IPFS client and ensuring we don't disconnect the IPFS client. This is done to allow IPFS clients to query data over Bitswap protocol before IPFS Kademlia DHT support is implemented (DHT support is planned to be ready by the end of August 2025). +Bulletin node also has an idle connection timeout set to 1 hour instead of the default 10 seconds to allow manually adding the node to the swarm of an IPFS client and ensuring we don't disconnect the IPFS client. This is done to allow IPFS clients to query data over Bitswap protocol before IPFS Kademlia DHT support is implemented (DHT support is planned to be ready by the end of August 2025). -TODO: clarify if we need to store transactiond for two weeks or other period. +TODO: clarify if we need to store transactions for two weeks or another period. ## Runtime functionality The Bulletin chain runtime is a standard BaBE + GRANDPA chain with a custom validator set pallet which is (currently) controlled by root call (TODO: clarify whether this should be sudo, governance, etc). -It functions to store transactions for a given period of time (currently set at 2 weeks) and provide proofs of storage. +It functions to store transactions for a given period of time (currently set at 2 weeks) and provide proof of storage. ### Core functionality The main purpose of the Bulletin chain is to provide storage for the People Chain over the bridge. #### Storage -The core functionality of the bulletin chain is in the transaction-storage pallet, which indexes transcations and manages storage proofs for arbitrary data. +The core functionality of the bulletin chain is in the transaction-storage pallet, which indexes transactions and manages storage proofs for arbitrary data. Data is added via the `transactionStorage.store` extrinsic, provided the storage of the data is authorized by root call. Authorization is granted either for a specific account via authorize_account or for data with a specific preimage via authorize_preimage. Once data is stored, it can be retrieved from IPFS with the Blake2B hash of the data. diff --git a/pallets/transaction-storage/src/lib.rs b/pallets/transaction-storage/src/lib.rs index 6712e448..f282e908 100644 --- a/pallets/transaction-storage/src/lib.rs +++ b/pallets/transaction-storage/src/lib.rs @@ -367,8 +367,8 @@ pub mod pallet { Ok(().into()) } - /// Check storage proof for block number `block_number() - StoragePeriod`. If such block - /// does not exist the proof is expected to be `None`. + /// Check storage proof for block number `block_number() - StoragePeriod`. If such a block + /// does not exist, the proof is expected to be `None`. /// /// ## Complexity /// diff --git a/runtimes/bulletin-polkadot/src/lib.rs b/runtimes/bulletin-polkadot/src/lib.rs index 39b654c1..269dbfa5 100644 --- a/runtimes/bulletin-polkadot/src/lib.rs +++ b/runtimes/bulletin-polkadot/src/lib.rs @@ -642,20 +642,110 @@ mod benches { [pallet_relayer_set, RelayerSet] [pallet_bridge_grandpa, BridgePolkadotGrandpa] - // [pallet_bridge_parachains, BridgeParachainsBench::] - // [pallet_bridge_messages, BridgeMessagesBench::] + [pallet_bridge_parachains, PolkadotParachains] + [pallet_bridge_messages, PolkadotMessages] ); pub use frame_benchmarking::{baseline::Pallet as Baseline, BenchmarkBatch, BenchmarkList}; pub use frame_system_benchmarking::Pallet as SystemBench; pub use frame_support::traits::{StorageInfoTrait, WhitelistedStorageKeys}; - pub use pallet_bridge_messages::benchmarking::Pallet as BridgeMessagesBench; - pub use pallet_bridge_parachains::benchmarking::Pallet as BridgeParachainsBench; pub use sp_storage::TrackedStorageKey; impl frame_system_benchmarking::Config for Runtime {} impl frame_benchmarking::baseline::Config for Runtime {} + + use bridge_runtime_common::parachains_benchmarking::prepare_parachain_heads_proof; + use pallet_bridge_parachains::benchmarking::Config as BridgeParachainsConfig; + + impl BridgeParachainsConfig for Runtime { + fn parachains() -> Vec { + use bp_runtime::Parachain; + vec![bp_polkadot_core::parachains::ParaId( + bridge_config::bp_people_polkadot::PeoplePolkadot::PARACHAIN_ID, + )] + } + + fn prepare_parachain_heads_proof( + parachains: &[bp_polkadot_core::parachains::ParaId], + parachain_head_size: u32, + proof_params: bp_runtime::UnverifiedStorageProofParams, + ) -> ( + bp_parachains::RelayBlockNumber, + bp_parachains::RelayBlockHash, + bp_polkadot_core::parachains::ParaHeadsProof, + Vec<(bp_polkadot_core::parachains::ParaId, bp_polkadot_core::parachains::ParaHash)>, + ) { + prepare_parachain_heads_proof::< + Runtime, + bridge_config::WithPolkadotBridgeParachainsInstance, + >(parachains, parachain_head_size, proof_params) + } + } + + use bridge_runtime_common::messages_benchmarking::{ + generate_xcm_builder_bridge_message_sample, prepare_message_delivery_proof_from_parachain, + prepare_message_proof_from_parachain, + }; + use pallet_bridge_messages::{ + benchmarking::{ + Config as BridgeMessagesConfig, MessageDeliveryProofParams, MessageProofParams, + }, + LaneIdOf, + }; + + impl BridgeMessagesConfig for Runtime { + fn is_relayer_rewarded(_relayer: &Self::AccountId) -> bool { + // TODO: + // no rewards, so we don't care + true + } + + fn prepare_message_proof( + params: MessageProofParams< + LaneIdOf, + >, + ) -> (bridge_config::benchmarking::FromPeoplePolkadotMessagesProof, Weight) { + prepare_message_proof_from_parachain::< + Runtime, + bridge_config::WithPolkadotBridgeGrandpaInstance, + bridge_config::WithPeoplePolkadotMessagesInstance, + >( + params, + generate_xcm_builder_bridge_message_sample( + bridge_config::PeoplePolkadotLocation::get().interior().clone(), + ), + ) + } + + fn prepare_message_delivery_proof( + params: MessageDeliveryProofParams< + AccountId, + LaneIdOf, + >, + ) -> bridge_config::benchmarking::ToPeoplePolkadotMessagesDeliveryProof { + prepare_message_delivery_proof_from_parachain::< + Runtime, + bridge_config::WithPolkadotBridgeGrandpaInstance, + bridge_config::WithPeoplePolkadotMessagesInstance, + >(params) + } + + fn is_message_successfully_dispatched(_nonce: bp_messages::MessageNonce) -> bool { + // TODO: + // currently we have no means to detect that + true + } + } + + pub type PolkadotParachains = pallet_bridge_parachains::benchmarking::Pallet< + Runtime, + bridge_config::WithPolkadotBridgeParachainsInstance, + >; + pub type PolkadotMessages = pallet_bridge_messages::benchmarking::Pallet< + Runtime, + bridge_config::WithPeoplePolkadotMessagesInstance, + >; } #[cfg(feature = "runtime-benchmarks")] diff --git a/runtimes/bulletin-polkadot/src/polkadot_bridge_config.rs b/runtimes/bulletin-polkadot/src/polkadot_bridge_config.rs index 958a0b79..7b34cc42 100644 --- a/runtimes/bulletin-polkadot/src/polkadot_bridge_config.rs +++ b/runtimes/bulletin-polkadot/src/polkadot_bridge_config.rs @@ -157,6 +157,11 @@ parameter_types! { 1, [GlobalConsensus(PolkadotGlobalConsensusNetwork::get())] ); + /// Location of the PeoplePolkadot parachain, relative to this runtime. + pub PeoplePolkadotLocation: Location = Location::new(1, [ + GlobalConsensus(BridgedNetwork::get()), + Parachain(bp_people_polkadot::PEOPLE_POLKADOT_PARACHAIN_ID), + ]); /// A number of Polkadot mandatory headers that are accepted for free at every /// **this chain** block. @@ -213,7 +218,7 @@ impl pallet_bridge_grandpa::Config for Runtim pub type WithPolkadotBridgeParachainsInstance = (); impl pallet_bridge_parachains::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = crate::weights::bridge_polkadot_parachains::WeightInfo; + type WeightInfo = crate::weights::pallet_bridge_parachains::WeightInfo; type BridgesGrandpaPalletInstance = WithPolkadotBridgeGrandpaInstance; type ParasPalletName = AtPolkadotParasPalletName; @@ -319,7 +324,7 @@ impl for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = crate::weights::bridge_polkadot_messages::WeightInfo; + type WeightInfo = crate::weights::pallet_bridge_messages::WeightInfo; type ThisChain = bp_polkadot_bulletin::PolkadotBulletin; type BridgedChain = bp_people_polkadot::PeoplePolkadot; @@ -430,97 +435,28 @@ where pub type ToBridgeHaulBlobExporter = HaulBlobExporter< XcmBlobHauler, PolkadotGlobalConsensusNetworkLocation, - AlwaysV4, + AlwaysV5, (), >; -// #[cfg(feature = "runtime-benchmarks")] -// pub mod benchmarking { -// use super::*; -// -// /// Proof of messages, coming from BridgeHubPolkadot. -// pub type FromBridgeHubPolkadotMessagesProof = -// bridge_runtime_common::messages::target::FromBridgedChainMessagesProof< -// bp_people_polkadot::Hash, -// >; -// -// /// Message delivery proof for `BridgeHubPolkadot` messages. -// pub type ToBridgeHubPolkadotMessagesDeliveryProof = -// bridge_runtime_common::messages::source::FromBridgedChainMessagesDeliveryProof< -// bp_people_polkadot::Hash, -// >; -// -// use bridge_runtime_common::messages_benchmarking::{ -// generate_xcm_builder_bridge_message_sample, prepare_message_delivery_proof_from_parachain, -// prepare_message_proof_from_parachain, -// }; -// use pallet_bridge_messages::benchmarking::{ -// Config as BridgeMessagesConfig, MessageDeliveryProofParams, MessageProofParams, -// }; -// -// impl BridgeMessagesConfig for Runtime { -// fn is_relayer_rewarded(_relayer: &Self::AccountId) -> bool { -// // no rewards, so we don't care -// true -// } -// -// fn prepare_message_proof( -// params: MessageProofParams, -// ) -> (FromBridgeHubPolkadotMessagesProof, Weight) { -// prepare_message_proof_from_parachain::< -// Runtime, -// WithPolkadotBridgeGrandpaInstance, -// WithBridgeHubPolkadotMessageBridge, -// >( -// params, -// generate_xcm_builder_bridge_message_sample( -// *crate::xcm_config::KawabungaLocation::get().interior(), -// ), -// ) -// } -// -// fn prepare_message_delivery_proof( -// params: MessageDeliveryProofParams, -// ) -> ToBridgeHubPolkadotMessagesDeliveryProof { -// prepare_message_delivery_proof_from_parachain::< -// Runtime, -// WithPolkadotBridgeGrandpaInstance, -// WithBridgeHubPolkadotMessageBridge, -// >(params) -// } -// -// fn is_message_successfully_dispatched(_nonce: bp_messages::MessageNonce) -> bool { -// // currently we have no means to detect that -// true -// } -// } -// -// use bridge_runtime_common::parachains_benchmarking::prepare_parachain_heads_proof; -// use pallet_bridge_parachains::benchmarking::Config as BridgeParachainsConfig; -// impl BridgeParachainsConfig for Runtime { -// fn parachains() -> Vec { -// use bp_runtime::Parachain; -// vec![bp_polkadot::parachains::ParaId(BridgeHubPolkadotOrPolkadot::PARACHAIN_ID)] -// } -// -// fn prepare_parachain_heads_proof( -// parachains: &[bp_polkadot::parachains::ParaId], -// parachain_head_size: u32, -// proof_size: bp_runtime::StorageProofSize, -// ) -> ( -// pallet_bridge_parachains::RelayBlockNumber, -// pallet_bridge_parachains::RelayBlockHash, -// bp_polkadot::parachains::ParaHeadsProof, -// Vec<(bp_polkadot::parachains::ParaId, bp_polkadot::parachains::ParaHash)>, -// ) { -// prepare_parachain_heads_proof::( -// parachains, -// parachain_head_size, -// proof_size, -// ) -// } -// } -// } +#[cfg(feature = "runtime-benchmarks")] +pub mod benchmarking { + use super::*; + + /// Proof of messages, coming from PeoplePolkadot. + pub type FromPeoplePolkadotMessagesProof = + bp_messages::target_chain::FromBridgedChainMessagesProof< + bp_people_polkadot::Hash, + pallet_bridge_messages::LaneIdOf, + >; + + /// Message delivery proof for `PeoplePolkadot` messages. + pub type ToPeoplePolkadotMessagesDeliveryProof = + bp_messages::source_chain::FromBridgedChainMessagesDeliveryProof< + bp_people_polkadot::Hash, + pallet_bridge_messages::LaneIdOf, + >; +} // // #[cfg(test)] // pub(crate) mod tests { diff --git a/runtimes/bulletin-polkadot/src/weights/bridge_polkadot_messages.rs b/runtimes/bulletin-polkadot/src/weights/bridge_polkadot_messages.rs deleted file mode 100644 index 01d18f11..00000000 --- a/runtimes/bulletin-polkadot/src/weights/bridge_polkadot_messages.rs +++ /dev/null @@ -1,236 +0,0 @@ - -//! Autogenerated weights for `pallet_bridge_messages` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-09-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `MusXroom`, CPU: `13th Gen Intel(R) Core(TM) i7-13650HX` -//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: 1024 - -// Executed Command: -// target/release/polkadot-bulletin-chain -// benchmark -// pallet -// --chain=dev -// --steps=50 -// --repeat=20 -// --pallet=pallet_bridge_messages -// --extrinsic=* -// --wasm-execution=Compiled -// --heap-pages=4096 -// --output=./runtime/src/weights/bridge_polkadot_messages.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_bridge_messages`. -pub struct WeightInfo(PhantomData); -impl pallet_bridge_messages::WeightInfo for WeightInfo { - /// Storage: `BridgePolkadotBulletinMessages::PalletOperatingMode` (r:1 w:0) - /// Proof: `BridgePolkadotBulletinMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) - /// Storage: `BridgePolkadotBulletinGrandpa::ImportedHeaders` (r:1 w:0) - /// Proof: `BridgePolkadotBulletinGrandpa::ImportedHeaders` (`max_values`: Some(1024), `max_size`: Some(68), added: 1553, mode: `MaxEncodedLen`) - /// Storage: `BridgePolkadotBulletinMessages::InboundLanes` (r:1 w:1) - /// Proof: `BridgePolkadotBulletinMessages::InboundLanes` (`max_values`: None, `max_size`: Some(49209), added: 51684, mode: `MaxEncodedLen`) - /// Storage: `XcmOverPolkadotBulletin::LaneToBridge` (r:1 w:0) - /// Proof: `XcmOverPolkadotBulletin::LaneToBridge` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`) - /// Storage: `XcmOverPolkadotBulletin::Bridges` (r:1 w:0) - /// Proof: `XcmOverPolkadotBulletin::Bridges` (`max_values`: None, `max_size`: Some(1918), added: 4393, mode: `MaxEncodedLen`) - /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) - /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - fn receive_single_message_proof() -> Weight { - // Proof Size summary in bytes: - // Measured: `933` - // Estimated: `52674` - // Minimum execution time: 61_893_000 picoseconds. - Weight::from_parts(63_358_000, 0) - .saturating_add(Weight::from_parts(0, 52674)) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `BridgePolkadotBulletinMessages::PalletOperatingMode` (r:1 w:0) - /// Proof: `BridgePolkadotBulletinMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) - /// Storage: `BridgePolkadotBulletinGrandpa::ImportedHeaders` (r:1 w:0) - /// Proof: `BridgePolkadotBulletinGrandpa::ImportedHeaders` (`max_values`: Some(1024), `max_size`: Some(68), added: 1553, mode: `MaxEncodedLen`) - /// Storage: `BridgePolkadotBulletinMessages::InboundLanes` (r:1 w:1) - /// Proof: `BridgePolkadotBulletinMessages::InboundLanes` (`max_values`: None, `max_size`: Some(49209), added: 51684, mode: `MaxEncodedLen`) - /// Storage: `XcmOverPolkadotBulletin::LaneToBridge` (r:1 w:0) - /// Proof: `XcmOverPolkadotBulletin::LaneToBridge` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`) - /// Storage: `XcmOverPolkadotBulletin::Bridges` (r:1 w:0) - /// Proof: `XcmOverPolkadotBulletin::Bridges` (`max_values`: None, `max_size`: Some(1918), added: 4393, mode: `MaxEncodedLen`) - /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) - /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// The range of component `n` is `[1, 4076]`. - /// The range of component `n` is `[1, 4076]`. - fn receive_n_messages_proof(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `933` - // Estimated: `52674` - // Minimum execution time: 61_612_000 picoseconds. - Weight::from_parts(62_758_000, 0) - .saturating_add(Weight::from_parts(0, 52674)) - // Standard Error: 13_521 - .saturating_add(Weight::from_parts(14_530_846, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `BridgePolkadotBulletinMessages::PalletOperatingMode` (r:1 w:0) - /// Proof: `BridgePolkadotBulletinMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) - /// Storage: `BridgePolkadotBulletinGrandpa::ImportedHeaders` (r:1 w:0) - /// Proof: `BridgePolkadotBulletinGrandpa::ImportedHeaders` (`max_values`: Some(1024), `max_size`: Some(68), added: 1553, mode: `MaxEncodedLen`) - /// Storage: `BridgePolkadotBulletinMessages::InboundLanes` (r:1 w:1) - /// Proof: `BridgePolkadotBulletinMessages::InboundLanes` (`max_values`: None, `max_size`: Some(49209), added: 51684, mode: `MaxEncodedLen`) - /// Storage: `XcmOverPolkadotBulletin::LaneToBridge` (r:1 w:0) - /// Proof: `XcmOverPolkadotBulletin::LaneToBridge` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`) - /// Storage: `XcmOverPolkadotBulletin::Bridges` (r:1 w:0) - /// Proof: `XcmOverPolkadotBulletin::Bridges` (`max_values`: None, `max_size`: Some(1918), added: 4393, mode: `MaxEncodedLen`) - /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) - /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - fn receive_single_message_proof_with_outbound_lane_state() -> Weight { - // Proof Size summary in bytes: - // Measured: `933` - // Estimated: `52674` - // Minimum execution time: 66_862_000 picoseconds. - Weight::from_parts(69_531_000, 0) - .saturating_add(Weight::from_parts(0, 52674)) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `BridgePolkadotBulletinMessages::PalletOperatingMode` (r:1 w:0) - /// Proof: `BridgePolkadotBulletinMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) - /// Storage: `BridgePolkadotBulletinGrandpa::ImportedHeaders` (r:1 w:0) - /// Proof: `BridgePolkadotBulletinGrandpa::ImportedHeaders` (`max_values`: Some(1024), `max_size`: Some(68), added: 1553, mode: `MaxEncodedLen`) - /// Storage: `BridgePolkadotBulletinMessages::InboundLanes` (r:1 w:1) - /// Proof: `BridgePolkadotBulletinMessages::InboundLanes` (`max_values`: None, `max_size`: Some(49209), added: 51684, mode: `MaxEncodedLen`) - /// Storage: `XcmOverPolkadotBulletin::LaneToBridge` (r:1 w:0) - /// Proof: `XcmOverPolkadotBulletin::LaneToBridge` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`) - /// Storage: `XcmOverPolkadotBulletin::Bridges` (r:1 w:0) - /// Proof: `XcmOverPolkadotBulletin::Bridges` (`max_values`: None, `max_size`: Some(1918), added: 4393, mode: `MaxEncodedLen`) - /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) - /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// The range of component `n` is `[1, 16384]`. - /// The range of component `n` is `[1, 16384]`. - fn receive_single_n_bytes_message_proof(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `933` - // Estimated: `52674` - // Minimum execution time: 58_971_000 picoseconds. - Weight::from_parts(62_999_984, 0) - .saturating_add(Weight::from_parts(0, 52674)) - // Standard Error: 7 - .saturating_add(Weight::from_parts(2_050, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `BridgePolkadotBulletinMessages::PalletOperatingMode` (r:1 w:0) - /// Proof: `BridgePolkadotBulletinMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) - /// Storage: `BridgePolkadotBulletinGrandpa::ImportedHeaders` (r:1 w:0) - /// Proof: `BridgePolkadotBulletinGrandpa::ImportedHeaders` (`max_values`: Some(1024), `max_size`: Some(68), added: 1553, mode: `MaxEncodedLen`) - /// Storage: `BridgePolkadotBulletinMessages::OutboundLanes` (r:1 w:1) - /// Proof: `BridgePolkadotBulletinMessages::OutboundLanes` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`) - /// Storage: `XcmOverPolkadotBulletin::LaneToBridge` (r:1 w:0) - /// Proof: `XcmOverPolkadotBulletin::LaneToBridge` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`) - /// Storage: `XcmOverPolkadotBulletin::Bridges` (r:1 w:0) - /// Proof: `XcmOverPolkadotBulletin::Bridges` (`max_values`: None, `max_size`: Some(1918), added: 4393, mode: `MaxEncodedLen`) - /// Storage: `BridgePolkadotBulletinMessages::OutboundMessages` (r:0 w:1) - /// Proof: `BridgePolkadotBulletinMessages::OutboundMessages` (`max_values`: None, `max_size`: Some(65597), added: 68072, mode: `MaxEncodedLen`) - fn receive_delivery_proof_for_single_message() -> Weight { - // Proof Size summary in bytes: - // Measured: `900` - // Estimated: `5383` - // Minimum execution time: 43_066_000 picoseconds. - Weight::from_parts(43_878_000, 0) - .saturating_add(Weight::from_parts(0, 5383)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `BridgePolkadotBulletinMessages::PalletOperatingMode` (r:1 w:0) - /// Proof: `BridgePolkadotBulletinMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) - /// Storage: `BridgePolkadotBulletinGrandpa::ImportedHeaders` (r:1 w:0) - /// Proof: `BridgePolkadotBulletinGrandpa::ImportedHeaders` (`max_values`: Some(1024), `max_size`: Some(68), added: 1553, mode: `MaxEncodedLen`) - /// Storage: `BridgePolkadotBulletinMessages::OutboundLanes` (r:1 w:1) - /// Proof: `BridgePolkadotBulletinMessages::OutboundLanes` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`) - /// Storage: `XcmOverPolkadotBulletin::LaneToBridge` (r:1 w:0) - /// Proof: `XcmOverPolkadotBulletin::LaneToBridge` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`) - /// Storage: `XcmOverPolkadotBulletin::Bridges` (r:1 w:0) - /// Proof: `XcmOverPolkadotBulletin::Bridges` (`max_values`: None, `max_size`: Some(1918), added: 4393, mode: `MaxEncodedLen`) - /// Storage: `BridgePolkadotBulletinMessages::OutboundMessages` (r:0 w:2) - /// Proof: `BridgePolkadotBulletinMessages::OutboundMessages` (`max_values`: None, `max_size`: Some(65597), added: 68072, mode: `MaxEncodedLen`) - fn receive_delivery_proof_for_two_messages_by_single_relayer() -> Weight { - // Proof Size summary in bytes: - // Measured: `900` - // Estimated: `5383` - // Minimum execution time: 44_120_000 picoseconds. - Weight::from_parts(45_914_000, 0) - .saturating_add(Weight::from_parts(0, 5383)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: `BridgePolkadotBulletinMessages::PalletOperatingMode` (r:1 w:0) - /// Proof: `BridgePolkadotBulletinMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) - /// Storage: `BridgePolkadotBulletinGrandpa::ImportedHeaders` (r:1 w:0) - /// Proof: `BridgePolkadotBulletinGrandpa::ImportedHeaders` (`max_values`: Some(1024), `max_size`: Some(68), added: 1553, mode: `MaxEncodedLen`) - /// Storage: `BridgePolkadotBulletinMessages::OutboundLanes` (r:1 w:1) - /// Proof: `BridgePolkadotBulletinMessages::OutboundLanes` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`) - /// Storage: `XcmOverPolkadotBulletin::LaneToBridge` (r:1 w:0) - /// Proof: `XcmOverPolkadotBulletin::LaneToBridge` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`) - /// Storage: `XcmOverPolkadotBulletin::Bridges` (r:1 w:0) - /// Proof: `XcmOverPolkadotBulletin::Bridges` (`max_values`: None, `max_size`: Some(1918), added: 4393, mode: `MaxEncodedLen`) - /// Storage: `BridgePolkadotBulletinMessages::OutboundMessages` (r:0 w:2) - /// Proof: `BridgePolkadotBulletinMessages::OutboundMessages` (`max_values`: None, `max_size`: Some(65597), added: 68072, mode: `MaxEncodedLen`) - fn receive_delivery_proof_for_two_messages_by_two_relayers() -> Weight { - // Proof Size summary in bytes: - // Measured: `900` - // Estimated: `5383` - // Minimum execution time: 44_930_000 picoseconds. - Weight::from_parts(46_111_000, 0) - .saturating_add(Weight::from_parts(0, 5383)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: `BridgePolkadotBulletinMessages::PalletOperatingMode` (r:1 w:0) - /// Proof: `BridgePolkadotBulletinMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) - /// Storage: `BridgePolkadotBulletinGrandpa::ImportedHeaders` (r:1 w:0) - /// Proof: `BridgePolkadotBulletinGrandpa::ImportedHeaders` (`max_values`: Some(1024), `max_size`: Some(68), added: 1553, mode: `MaxEncodedLen`) - /// Storage: `BridgePolkadotBulletinMessages::InboundLanes` (r:1 w:1) - /// Proof: `BridgePolkadotBulletinMessages::InboundLanes` (`max_values`: None, `max_size`: Some(49209), added: 51684, mode: `MaxEncodedLen`) - /// Storage: `XcmOverPolkadotBulletin::LaneToBridge` (r:1 w:0) - /// Proof: `XcmOverPolkadotBulletin::LaneToBridge` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`) - /// Storage: `XcmOverPolkadotBulletin::Bridges` (r:1 w:0) - /// Proof: `XcmOverPolkadotBulletin::Bridges` (`max_values`: None, `max_size`: Some(1918), added: 4393, mode: `MaxEncodedLen`) - /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) - /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// Storage: `XcmpQueue::DeliveryFeeFactor` (r:1 w:0) - /// Proof: `XcmpQueue::DeliveryFeeFactor` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) - /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) - /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1) - /// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0) - /// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `ParachainSystem::RelevantMessagingState` (r:1 w:0) - /// Proof: `ParachainSystem::RelevantMessagingState` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) - /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) - /// Storage: `XcmpQueue::OutboundXcmpMessages` (r:0 w:1) - /// Proof: `XcmpQueue::OutboundXcmpMessages` (`max_values`: None, `max_size`: Some(105506), added: 107981, mode: `MaxEncodedLen`) - /// The range of component `n` is `[1, 16384]`. - /// The range of component `n` is `[1, 16384]`. - fn receive_single_n_bytes_message_proof_with_dispatch(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `1092` - // Estimated: `52674` - // Minimum execution time: 81_911_000 picoseconds. - Weight::from_parts(88_170_136, 0) - .saturating_add(Weight::from_parts(0, 52674)) - // Standard Error: 9 - .saturating_add(Weight::from_parts(7_233, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(12)) - .saturating_add(T::DbWeight::get().writes(4)) - } -} diff --git a/runtimes/bulletin-polkadot/src/weights/mod.rs b/runtimes/bulletin-polkadot/src/weights/mod.rs index 953fcc56..7d38f221 100644 --- a/runtimes/bulletin-polkadot/src/weights/mod.rs +++ b/runtimes/bulletin-polkadot/src/weights/mod.rs @@ -6,10 +6,10 @@ use ::pallet_bridge_parachains::WeightInfoExt as ParachainsWeightInfoExt; use ::pallet_bridge_relayers::WeightInfo as _; use frame_support::weights::Weight; -pub mod bridge_polkadot_messages; -pub mod bridge_polkadot_parachains; pub mod bridge_polkadot_relayers; pub mod pallet_bridge_grandpa; +pub mod pallet_bridge_messages; +pub mod pallet_bridge_parachains; pub mod pallet_relayer_set; pub mod pallet_timestamp; pub mod pallet_transaction_storage; @@ -25,7 +25,7 @@ impl GrandpaWeightInfoExt for pallet_bridge_grandpa::WeightInfo } } -impl ParachainsWeightInfoExt for bridge_polkadot_parachains::WeightInfo { +impl ParachainsWeightInfoExt for pallet_bridge_parachains::WeightInfo { fn expected_extra_storage_proof_size() -> u32 { crate::bp_people_polkadot::EXTRA_STORAGE_PROOF_SIZE } @@ -39,7 +39,7 @@ impl ParachainsWeightInfoExt for bridge_polkadot_parachains::WeightInfo { +impl MessagesWeightInfoExt for pallet_bridge_messages::WeightInfo { fn expected_extra_storage_proof_size() -> u32 { crate::bp_people_polkadot::EXTRA_STORAGE_PROOF_SIZE } diff --git a/runtimes/bulletin-polkadot/src/weights/pallet_bridge_messages.rs b/runtimes/bulletin-polkadot/src/weights/pallet_bridge_messages.rs new file mode 100644 index 00000000..8f0ae7e0 --- /dev/null +++ b/runtimes/bulletin-polkadot/src/weights/pallet_bridge_messages.rs @@ -0,0 +1,188 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Autogenerated weights for `pallet_bridge_messages` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2025-09-01, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `toaster1`, CPU: `AMD Ryzen Threadripper 7980X 64-Cores` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/production/wbuild/bulletin-polkadot-runtime/bulletin_polkadot_runtime.wasm +// --pallet=pallet_bridge_messages +// --header=/home/bkontur/cargo-remote-builds-bulletin/9907520327012243881/scripts/cmd/file_header.txt +// --output=./runtimes/bulletin-polkadot/src/weights +// --wasm-execution=compiled +// --steps=2 +// --repeat=1 +// --heap-pages=4096 + +#![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_bridge_messages`. +pub struct WeightInfo(PhantomData); +impl pallet_bridge_messages::WeightInfo for WeightInfo { + /// Storage: `BridgePolkadotMessages::PalletOperatingMode` (r:1 w:0) + /// Proof: `BridgePolkadotMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) + /// Storage: `BridgePolkadotParachains::ImportedParaHeads` (r:1 w:0) + /// Proof: `BridgePolkadotParachains::ImportedParaHeads` (`max_values`: Some(600), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) + /// Storage: `BridgePolkadotMessages::InboundLanes` (r:1 w:1) + /// Proof: `BridgePolkadotMessages::InboundLanes` (`max_values`: None, `max_size`: Some(49180), added: 51655, mode: `MaxEncodedLen`) + fn receive_single_message_proof() -> Weight { + // Proof Size summary in bytes: + // Measured: `531` + // Estimated: `52645` + // Minimum execution time: 29_825_000 picoseconds. + Weight::from_parts(29_825_000, 0) + .saturating_add(Weight::from_parts(0, 52645)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `BridgePolkadotMessages::PalletOperatingMode` (r:1 w:0) + /// Proof: `BridgePolkadotMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) + /// Storage: `BridgePolkadotParachains::ImportedParaHeads` (r:1 w:0) + /// Proof: `BridgePolkadotParachains::ImportedParaHeads` (`max_values`: Some(600), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) + /// Storage: `BridgePolkadotMessages::InboundLanes` (r:1 w:1) + /// Proof: `BridgePolkadotMessages::InboundLanes` (`max_values`: None, `max_size`: Some(49180), added: 51655, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 2004]`. + fn receive_n_messages_proof(_n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `531` + // Estimated: `52645` + // Minimum execution time: 29_304_000 picoseconds. + Weight::from_parts(539_435_248_000, 0) + .saturating_add(Weight::from_parts(0, 52645)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `BridgePolkadotMessages::PalletOperatingMode` (r:1 w:0) + /// Proof: `BridgePolkadotMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) + /// Storage: `BridgePolkadotParachains::ImportedParaHeads` (r:1 w:0) + /// Proof: `BridgePolkadotParachains::ImportedParaHeads` (`max_values`: Some(600), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) + /// Storage: `BridgePolkadotMessages::InboundLanes` (r:1 w:1) + /// Proof: `BridgePolkadotMessages::InboundLanes` (`max_values`: None, `max_size`: Some(49180), added: 51655, mode: `MaxEncodedLen`) + fn receive_single_message_proof_with_outbound_lane_state() -> Weight { + // Proof Size summary in bytes: + // Measured: `531` + // Estimated: `52645` + // Minimum execution time: 33_451_000 picoseconds. + Weight::from_parts(33_451_000, 0) + .saturating_add(Weight::from_parts(0, 52645)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `BridgePolkadotMessages::PalletOperatingMode` (r:1 w:0) + /// Proof: `BridgePolkadotMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) + /// Storage: `BridgePolkadotParachains::ImportedParaHeads` (r:1 w:0) + /// Proof: `BridgePolkadotParachains::ImportedParaHeads` (`max_values`: Some(600), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) + /// Storage: `BridgePolkadotMessages::InboundLanes` (r:1 w:1) + /// Proof: `BridgePolkadotMessages::InboundLanes` (`max_values`: None, `max_size`: Some(49180), added: 51655, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 16384]`. + fn receive_single_n_bytes_message_proof(_n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `531` + // Estimated: `52645` + // Minimum execution time: 31_488_000 picoseconds. + Weight::from_parts(50_957_000, 0) + .saturating_add(Weight::from_parts(0, 52645)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `BridgePolkadotMessages::PalletOperatingMode` (r:1 w:0) + /// Proof: `BridgePolkadotMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) + /// Storage: `BridgePolkadotParachains::ImportedParaHeads` (r:1 w:0) + /// Proof: `BridgePolkadotParachains::ImportedParaHeads` (`max_values`: Some(600), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) + /// Storage: `BridgePolkadotMessages::OutboundLanes` (r:1 w:1) + /// Proof: `BridgePolkadotMessages::OutboundLanes` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `BridgePolkadotMessages::OutboundMessages` (r:0 w:1) + /// Proof: `BridgePolkadotMessages::OutboundMessages` (`max_values`: None, `max_size`: Some(65568), added: 68043, mode: `MaxEncodedLen`) + fn receive_delivery_proof_for_single_message() -> Weight { + // Proof Size summary in bytes: + // Measured: `530` + // Estimated: `3510` + // Minimum execution time: 20_181_000 picoseconds. + Weight::from_parts(20_181_000, 0) + .saturating_add(Weight::from_parts(0, 3510)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `BridgePolkadotMessages::PalletOperatingMode` (r:1 w:0) + /// Proof: `BridgePolkadotMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) + /// Storage: `BridgePolkadotParachains::ImportedParaHeads` (r:1 w:0) + /// Proof: `BridgePolkadotParachains::ImportedParaHeads` (`max_values`: Some(600), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) + /// Storage: `BridgePolkadotMessages::OutboundLanes` (r:1 w:1) + /// Proof: `BridgePolkadotMessages::OutboundLanes` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `BridgePolkadotMessages::OutboundMessages` (r:0 w:2) + /// Proof: `BridgePolkadotMessages::OutboundMessages` (`max_values`: None, `max_size`: Some(65568), added: 68043, mode: `MaxEncodedLen`) + fn receive_delivery_proof_for_two_messages_by_single_relayer() -> Weight { + // Proof Size summary in bytes: + // Measured: `530` + // Estimated: `3510` + // Minimum execution time: 20_922_000 picoseconds. + Weight::from_parts(20_922_000, 0) + .saturating_add(Weight::from_parts(0, 3510)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `BridgePolkadotMessages::PalletOperatingMode` (r:1 w:0) + /// Proof: `BridgePolkadotMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) + /// Storage: `BridgePolkadotParachains::ImportedParaHeads` (r:1 w:0) + /// Proof: `BridgePolkadotParachains::ImportedParaHeads` (`max_values`: Some(600), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) + /// Storage: `BridgePolkadotMessages::OutboundLanes` (r:1 w:1) + /// Proof: `BridgePolkadotMessages::OutboundLanes` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `BridgePolkadotMessages::OutboundMessages` (r:0 w:2) + /// Proof: `BridgePolkadotMessages::OutboundMessages` (`max_values`: None, `max_size`: Some(65568), added: 68043, mode: `MaxEncodedLen`) + fn receive_delivery_proof_for_two_messages_by_two_relayers() -> Weight { + // Proof Size summary in bytes: + // Measured: `530` + // Estimated: `3510` + // Minimum execution time: 21_072_000 picoseconds. + Weight::from_parts(21_072_000, 0) + .saturating_add(Weight::from_parts(0, 3510)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `BridgePolkadotMessages::PalletOperatingMode` (r:1 w:0) + /// Proof: `BridgePolkadotMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`) + /// Storage: `BridgePolkadotParachains::ImportedParaHeads` (r:1 w:0) + /// Proof: `BridgePolkadotParachains::ImportedParaHeads` (`max_values`: Some(600), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) + /// Storage: `BridgePolkadotMessages::InboundLanes` (r:1 w:1) + /// Proof: `BridgePolkadotMessages::InboundLanes` (`max_values`: None, `max_size`: Some(49180), added: 51655, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 16384]`. + fn receive_single_n_bytes_message_proof_with_dispatch(_n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `531` + // Estimated: `52645` + // Minimum execution time: 36_145_000 picoseconds. + Weight::from_parts(61_162_000, 0) + .saturating_add(Weight::from_parts(0, 52645)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/runtimes/bulletin-polkadot/src/weights/bridge_polkadot_parachains.rs b/runtimes/bulletin-polkadot/src/weights/pallet_bridge_parachains.rs similarity index 63% rename from runtimes/bulletin-polkadot/src/weights/bridge_polkadot_parachains.rs rename to runtimes/bulletin-polkadot/src/weights/pallet_bridge_parachains.rs index b9c4e3b7..e064b52b 100644 --- a/runtimes/bulletin-polkadot/src/weights/bridge_polkadot_parachains.rs +++ b/runtimes/bulletin-polkadot/src/weights/pallet_bridge_parachains.rs @@ -1,24 +1,41 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. //! Autogenerated weights for `pallet_bridge_parachains` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-09-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2025-09-01, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `MusXroom`, CPU: `13th Gen Intel(R) Core(TM) i7-13650HX` -//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: 1024 +//! HOSTNAME: `toaster1`, CPU: `AMD Ryzen Threadripper 7980X 64-Cores` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// target/release/polkadot-bulletin-chain +// frame-omni-bencher +// v1 // benchmark // pallet -// --chain=dev -// --steps=50 -// --repeat=20 -// --pallet=pallet_bridge_parachains // --extrinsic=* -// --wasm-execution=Compiled +// --runtime=target/production/wbuild/bulletin-polkadot-runtime/bulletin_polkadot_runtime.wasm +// --pallet=pallet_bridge_parachains +// --header=/home/bkontur/cargo-remote-builds-bulletin/9907520327012243881/scripts/cmd/file_header.txt +// --output=./runtimes/bulletin-polkadot/src/weights +// --wasm-execution=compiled +// --steps=2 +// --repeat=1 // --heap-pages=4096 -// --output=./runtime/src/weights/bridge_polkadot_parachains.rs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -34,20 +51,20 @@ impl pallet_bridge_parachains::WeightInfo for WeightInf /// Storage: `BridgePolkadotParachains::PalletOperatingMode` (r:1 w:0) /// Proof: `BridgePolkadotParachains::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotGrandpa::ImportedHeaders` (r:1 w:0) - /// Proof: `BridgePolkadotGrandpa::ImportedHeaders` (`max_values`: Some(1024), `max_size`: Some(68), added: 1553, mode: `MaxEncodedLen`) + /// Proof: `BridgePolkadotGrandpa::ImportedHeaders` (`max_values`: Some(1200), `max_size`: Some(68), added: 1553, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotParachains::ParasInfo` (r:1 w:1) /// Proof: `BridgePolkadotParachains::ParasInfo` (`max_values`: Some(1), `max_size`: Some(60), added: 555, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotParachains::ImportedParaHashes` (r:1 w:1) - /// Proof: `BridgePolkadotParachains::ImportedParaHashes` (`max_values`: Some(1024), `max_size`: Some(64), added: 1549, mode: `MaxEncodedLen`) + /// Proof: `BridgePolkadotParachains::ImportedParaHashes` (`max_values`: Some(600), `max_size`: Some(64), added: 1549, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotParachains::ImportedParaHeads` (r:0 w:1) - /// Proof: `BridgePolkadotParachains::ImportedParaHeads` (`max_values`: Some(1024), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) + /// Proof: `BridgePolkadotParachains::ImportedParaHeads` (`max_values`: Some(600), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) /// The range of component `p` is `[1, 2]`. fn submit_parachain_heads_with_n_parachains(_p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `195` + // Measured: `156` // Estimated: `2543` - // Minimum execution time: 27_407_000 picoseconds. - Weight::from_parts(29_060_391, 0) + // Minimum execution time: 26_050_000 picoseconds. + Weight::from_parts(26_511_000, 0) .saturating_add(Weight::from_parts(0, 2543)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -55,19 +72,19 @@ impl pallet_bridge_parachains::WeightInfo for WeightInf /// Storage: `BridgePolkadotParachains::PalletOperatingMode` (r:1 w:0) /// Proof: `BridgePolkadotParachains::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotGrandpa::ImportedHeaders` (r:1 w:0) - /// Proof: `BridgePolkadotGrandpa::ImportedHeaders` (`max_values`: Some(1024), `max_size`: Some(68), added: 1553, mode: `MaxEncodedLen`) + /// Proof: `BridgePolkadotGrandpa::ImportedHeaders` (`max_values`: Some(1200), `max_size`: Some(68), added: 1553, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotParachains::ParasInfo` (r:1 w:1) /// Proof: `BridgePolkadotParachains::ParasInfo` (`max_values`: Some(1), `max_size`: Some(60), added: 555, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotParachains::ImportedParaHashes` (r:1 w:1) - /// Proof: `BridgePolkadotParachains::ImportedParaHashes` (`max_values`: Some(1024), `max_size`: Some(64), added: 1549, mode: `MaxEncodedLen`) + /// Proof: `BridgePolkadotParachains::ImportedParaHashes` (`max_values`: Some(600), `max_size`: Some(64), added: 1549, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotParachains::ImportedParaHeads` (r:0 w:1) - /// Proof: `BridgePolkadotParachains::ImportedParaHeads` (`max_values`: Some(1024), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) + /// Proof: `BridgePolkadotParachains::ImportedParaHeads` (`max_values`: Some(600), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) fn submit_parachain_heads_with_1kb_proof() -> Weight { // Proof Size summary in bytes: - // Measured: `195` + // Measured: `156` // Estimated: `2543` - // Minimum execution time: 28_325_000 picoseconds. - Weight::from_parts(28_916_000, 0) + // Minimum execution time: 26_470_000 picoseconds. + Weight::from_parts(26_470_000, 0) .saturating_add(Weight::from_parts(0, 2543)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -75,19 +92,19 @@ impl pallet_bridge_parachains::WeightInfo for WeightInf /// Storage: `BridgePolkadotParachains::PalletOperatingMode` (r:1 w:0) /// Proof: `BridgePolkadotParachains::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotGrandpa::ImportedHeaders` (r:1 w:0) - /// Proof: `BridgePolkadotGrandpa::ImportedHeaders` (`max_values`: Some(1024), `max_size`: Some(68), added: 1553, mode: `MaxEncodedLen`) + /// Proof: `BridgePolkadotGrandpa::ImportedHeaders` (`max_values`: Some(1200), `max_size`: Some(68), added: 1553, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotParachains::ParasInfo` (r:1 w:1) /// Proof: `BridgePolkadotParachains::ParasInfo` (`max_values`: Some(1), `max_size`: Some(60), added: 555, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotParachains::ImportedParaHashes` (r:1 w:1) - /// Proof: `BridgePolkadotParachains::ImportedParaHashes` (`max_values`: Some(1024), `max_size`: Some(64), added: 1549, mode: `MaxEncodedLen`) + /// Proof: `BridgePolkadotParachains::ImportedParaHashes` (`max_values`: Some(600), `max_size`: Some(64), added: 1549, mode: `MaxEncodedLen`) /// Storage: `BridgePolkadotParachains::ImportedParaHeads` (r:0 w:1) - /// Proof: `BridgePolkadotParachains::ImportedParaHeads` (`max_values`: Some(1024), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) + /// Proof: `BridgePolkadotParachains::ImportedParaHeads` (`max_values`: Some(600), `max_size`: Some(196), added: 1681, mode: `MaxEncodedLen`) fn submit_parachain_heads_with_16kb_proof() -> Weight { // Proof Size summary in bytes: - // Measured: `195` + // Measured: `156` // Estimated: `2543` - // Minimum execution time: 46_507_000 picoseconds. - Weight::from_parts(47_533_000, 0) + // Minimum execution time: 115_745_000 picoseconds. + Weight::from_parts(115_745_000, 0) .saturating_add(Weight::from_parts(0, 2543)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) diff --git a/runtimes/bulletin-polkadot/src/xcm_config.rs b/runtimes/bulletin-polkadot/src/xcm_config.rs index ada6164a..3f82de1a 100644 --- a/runtimes/bulletin-polkadot/src/xcm_config.rs +++ b/runtimes/bulletin-polkadot/src/xcm_config.rs @@ -17,14 +17,17 @@ //! XCM configuration for Polkadot Bulletin chain. use crate::{ - bridge_config::{BridgedNetwork, ToBridgeHaulBlobExporter}, + bridge_config::{ + bp_people_polkadot::PEOPLE_POLKADOT_PARACHAIN_ID, BridgedNetwork, PeoplePolkadotLocation, + ToBridgeHaulBlobExporter, + }, AllPalletsWithSystem, RuntimeCall, RuntimeOrigin, }; use codec::{Decode, DecodeLimit, Encode}; use frame_support::{ ensure, parameter_types, - traits::{Contains, Everything, Nothing, ProcessMessageError}, + traits::{Contains, Equals, Everything, Nothing, ProcessMessageError}, weights::Weight, }; use pallet_xcm_bridge_hub::XcmAsPlainPayload; @@ -33,32 +36,19 @@ use sp_io::hashing::blake2_256; use xcm::{latest::prelude::*, VersionedInteriorLocation, VersionedXcm, MAX_XCM_DECODE_DEPTH}; use xcm_builder::{ DispatchBlob, DispatchBlobError, FixedWeightBounds, FrameTransactionalProcessor, LocalExporter, - TrailingSetTopicAsId, WithComputedOrigin, + LocationAsSuperuser, TrailingSetTopicAsId, WithComputedOrigin, }; use xcm_executor::{ - traits::{ConvertOrigin, ShouldExecute, WeightTrader, WithOriginFilter}, + traits::{ShouldExecute, WeightTrader, WithOriginFilter}, AssetsInHolding, XcmExecutor, }; -// TODO [bridge]: change to actual value here + everywhere where Kawabunga is mentioned -/// Id of the Polkadot parachain that we are going to bridge with. -const KAWABUNGA_PARACHAIN_ID: u32 = 1004; - parameter_types! { - // TODO [bridge]: how we are supposed to set it? Named? ByGenesis - if so, when? - // After generating chain spec? /// The Polkadot Bulletin Chain network ID. pub const ThisNetwork: NetworkId = NetworkId::PolkadotBulletin; /// Our location in the universe of consensus systems. pub UniversalLocation: InteriorLocation = ThisNetwork::get().into(); - /// TODO: (Kawabunga = People Chain) - rename somehow :) - /// Location of the Kawabunga parachain, relative to this runtime. - pub KawabungaLocation: Location = Location::new(1, [ - GlobalConsensus(BridgedNetwork::get()), - Parachain(KAWABUNGA_PARACHAIN_ID), - ]); - /// The amount of weight an XCM operation takes. This is a safe overestimate. pub const BaseXcmWeight: Weight = Weight::from_parts(1_000_000_000, 0); /// Maximum number of instructions in a single XCM fragment. A sanity check against weight @@ -66,19 +56,17 @@ parameter_types! { pub const MaxInstructions: u32 = 100; } -pub struct OnlyKawabungaLocation; - -impl Contains for OnlyKawabungaLocation { +pub struct OnlyPeoplePolkadotLocation; +impl Contains for OnlyPeoplePolkadotLocation { fn contains(l: &Location) -> bool { matches!(l.unpack(), (1, [ GlobalConsensus(bridged_network), - Parachain(KAWABUNGA_PARACHAIN_ID), + Parachain(PEOPLE_POLKADOT_PARACHAIN_ID), ]) if bridged_network == &BridgedNetwork::get()) } } pub struct UniversalAliases; - impl Contains<(Location, Junction)> for UniversalAliases { fn contains(l: &(Location, Junction)) -> bool { matches!( @@ -86,31 +74,7 @@ impl Contains<(Location, Junction)> for UniversalAliases { ( origin_location, GlobalConsensus(bridged_network), - ) if origin_location == &KawabungaLocation::get() && bridged_network == &BridgedNetwork::get()) - } -} - -/// Kawabunga location converter to local root. -pub struct KawabungaParachainAsRoot; - -impl ConvertOrigin for KawabungaParachainAsRoot { - fn convert_origin( - origin: impl Into, - kind: OriginKind, - ) -> Result { - let origin = origin.into(); - log::trace!( - target: "xcm::origin_conversion", - "KawabungaParachainAsRoot origin: {:?}, kind: {:?}", - origin, kind, - ); - match (kind, origin.unpack()) { - ( - OriginKind::Superuser, - (1, [GlobalConsensus(bridged_network), Parachain(KAWABUNGA_PARACHAIN_ID)]), - ) if bridged_network == &BridgedNetwork::get() => Ok(RuntimeOrigin::root()), - _ => Err(origin), - } + ) if origin_location == &PeoplePolkadotLocation::get() && bridged_network == &BridgedNetwork::get()) } } @@ -162,14 +126,11 @@ impl> ShouldExecute } } -/// The means that we convert an XCM origin `MultiLocation` into the runtime's `Origin` type for +/// The means that we convert an XCM origin `Location` into the runtime's `Origin` type for /// local dispatch. This is a conversion function from an `OriginKind` type along with the -/// `MultiLocation` value and returns an `Origin` value or an error. -type LocalOriginConverter = ( - // Currently we only accept XCM messages from Kawabunga and the origin for such messages - // is local root. - KawabungaParachainAsRoot, -); +/// `Location` value and returns an `Origin` value or an error. +type XcmOriginToTransactDispatchOrigin = + (LocationAsSuperuser, RuntimeOrigin>,); /// Only bridged destination is supported. pub type XcmRouter = LocalExporter; @@ -178,7 +139,7 @@ pub type XcmRouter = LocalExporter; pub type Barrier = TrailingSetTopicAsId< WithComputedOrigin< // We only allow unpaid execution from the Kawabunga parachain. - AllowUnpaidTransactsFrom, + AllowUnpaidTransactsFrom, UniversalLocation, ConstU32<2>, >, @@ -191,7 +152,7 @@ impl xcm_executor::Config for XcmConfig { type RuntimeCall = RuntimeCall; type XcmSender = XcmRouter; type AssetTransactor = (); - type OriginConverter = LocalOriginConverter; + type OriginConverter = XcmOriginToTransactDispatchOrigin; type IsReserve = (); type IsTeleporter = (); type UniversalLocation = UniversalLocation; @@ -219,6 +180,7 @@ impl xcm_executor::Config for XcmConfig { type HrmpChannelAcceptedHandler = (); type HrmpChannelClosingHandler = (); type XcmRecorder = (); + // TODO: add here some impl? type XcmEventEmitter = (); } @@ -251,7 +213,7 @@ impl DispatchBlob for ImmediateXcmDispatcher { log::trace!( target: "runtime::xcm", "Going to dispatch XCM message from {:?}: {:?}", - KawabungaLocation::get(), + PeoplePolkadotLocation::get(), message, ); @@ -263,7 +225,7 @@ impl DispatchBlob for ImmediateXcmDispatcher { // execute the XCM program let mut message_hash = message.using_encoded(blake2_256); XcmExecutor::::prepare_and_execute( - KawabungaLocation::get(), + PeoplePolkadotLocation::get(), message, &mut message_hash, weight_limit, @@ -274,7 +236,7 @@ impl DispatchBlob for ImmediateXcmDispatcher { log::trace!( target: "runtime::xcm", "XCM message from {:?} was dispatched with an error: {:?}", - KawabungaLocation::get(), + PeoplePolkadotLocation::get(), e, );