Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
534 changes: 267 additions & 267 deletions Cargo.lock

Large diffs are not rendered by default.

158 changes: 79 additions & 79 deletions Cargo.toml

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,10 @@ Controls the validator set. Currently set in genesis and validators can be added

#### polkadot-bulletin-chain/pallets/transaction-storage
Stores arbitrary data on IPFS via the `store` extrinsic, provided that either the signer or the preimage of the data are pre-authorized. Stored data can be retrieved from IPFS or directly from the node via the transaction index or hash.

### Fresh benchmarks

Run on the dedicated machine from the root directory:
```
python3 scripts/cmd/cmd.py bench bulletin-polkadot
```
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
extern crate alloc;

// TODO: move here the stuff from
// bp-polkadot-bulletin = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602", default-features = false }
// bp-polkadot-bulletin = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "a64eb1fb02d4012948cba024fca2f27d94732e52", default-features = false }
55 changes: 24 additions & 31 deletions runtimes/bulletin-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ impl frame_system::Config for Runtime {

impl pallet_validator_set::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = pallet_validator_set::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_validator_set::WeightInfo<Runtime>;
type AddRemoveOrigin = EnsureRoot<AccountId>;
type MaxAuthorities = MaxAuthorities;
type SetKeysCooldownBlocks = SetKeysCooldownBlocks;
Expand Down Expand Up @@ -289,7 +289,7 @@ impl pallet_babe::Config for Runtime {
type ExpectedBlockTime = ConstU64<MILLISECS_PER_BLOCK>;
type EpochChangeTrigger = pallet_babe::ExternalTrigger;
type DisabledValidators = Session;
// TODO: weights

type WeightInfo = ();
type MaxAuthorities = MaxAuthorities;
type MaxNominators = ConstU32<0>;
Expand All @@ -305,7 +305,7 @@ impl pallet_babe::Config for Runtime {

impl pallet_grandpa::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
// TODO: weights

type WeightInfo = ();
type MaxAuthorities = MaxAuthorities;
type MaxNominators = ConstU32<0>;
Expand Down Expand Up @@ -336,14 +336,14 @@ impl pallet_timestamp::Config for Runtime {
type Moment = u64;
type OnTimestampSet = Babe;
type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>;
// TODO: weights
type WeightInfo = ();
type WeightInfo = weights::pallet_timestamp::WeightInfo<Runtime>;
}

impl pallet_transaction_storage::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = pallet_transaction_storage::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_transaction_storage::WeightInfo<Runtime>;
type MaxBlockTransactions = ConstU32<512>;
// TODO: add here comment
type MaxTransactionSize = ConstU32<{ 8 * 1024 * 1024 }>;
type StoragePeriod = StoragePeriod;
type AuthorizationPeriod = AuthorizationPeriod;
Expand All @@ -356,7 +356,7 @@ impl pallet_transaction_storage::Config for Runtime {

impl pallet_relayer_set::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = pallet_relayer_set::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_relayer_set::WeightInfo<Runtime>;
type AddRemoveOrigin = EnsureRoot<AccountId>;
type BridgeTxFailCooldownBlocks = BridgeTxFailCooldownBlocks;
}
Expand Down Expand Up @@ -631,8 +631,10 @@ pub type Executive = frame_executive::Executive<

#[cfg(feature = "runtime-benchmarks")]
mod benches {
use super::*;

frame_benchmarking::define_benchmarks!(
[frame_benchmarking, BaselineBench::<Runtime>]
[frame_benchmarking::baseline, Baseline::<Runtime>]
[frame_system, SystemBench::<Runtime>]
[pallet_timestamp, Timestamp]
[pallet_transaction_storage, TransactionStorage]
Expand All @@ -643,8 +645,22 @@ mod benches {
// [pallet_bridge_parachains, BridgeParachainsBench::<Runtime, bridge_config::WithPolkadotBridgeParachainsInstance>]
// [pallet_bridge_messages, BridgeMessagesBench::<Runtime, bridge_config::WithPeoplePolkadotMessagesInstance>]
);

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 {}
}

#[cfg(feature = "runtime-benchmarks")]
use benches::*;

impl_runtime_apis! {
impl sp_api::Core<Block> for Runtime {
fn version() -> RuntimeVersion {
Expand Down Expand Up @@ -883,41 +899,18 @@ impl_runtime_apis! {
Vec<frame_benchmarking::BenchmarkList>,
Vec<frame_support::traits::StorageInfo>,
) {
use frame_benchmarking::{baseline, Benchmarking, BenchmarkList};
use frame_support::traits::StorageInfoTrait;
use frame_system_benchmarking::Pallet as SystemBench;
use baseline::Pallet as BaselineBench;

use pallet_bridge_parachains::benchmarking::Pallet as BridgeParachainsBench;
use pallet_bridge_messages::benchmarking::Pallet as BridgeMessagesBench;

let mut list = Vec::<BenchmarkList>::new();
list_benchmarks!(list, extra);

let storage_info = AllPalletsWithSystem::storage_info();

(list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
use sp_storage::TrackedStorageKey;
use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch};

use frame_system_benchmarking::Pallet as SystemBench;
use baseline::Pallet as BaselineBench;

use pallet_bridge_parachains::benchmarking::Pallet as BridgeParachainsBench;
use pallet_bridge_messages::benchmarking::Pallet as BridgeMessagesBench;

impl frame_system_benchmarking::Config for Runtime {}
impl baseline::Config for Runtime {}

use frame_support::traits::WhitelistedStorageKeys;
let whitelist: Vec<TrackedStorageKey> = AllPalletsWithSystem::whitelisted_storage_keys();

let mut batches = Vec::<BenchmarkBatch>::new();
let params = (&config, &whitelist);
add_benchmarks!(params, batches);
Expand Down
2 changes: 1 addition & 1 deletion runtimes/bulletin-polkadot/src/polkadot_bridge_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ parameter_types! {
pub type WithPolkadotBridgeGrandpaInstance = ();
impl pallet_bridge_grandpa::Config<WithPolkadotBridgeGrandpaInstance> for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = crate::weights::bridge_polkadot_grandpa::WeightInfo<Runtime>;
type WeightInfo = crate::weights::pallet_bridge_grandpa::WeightInfo<Runtime>;

type BridgedChain = bp_polkadot::Polkadot;
type MaxFreeHeadersPerBlock = MaxFreePolkadotHeadersPerBlock;
Expand Down
84 changes: 0 additions & 84 deletions runtimes/bulletin-polkadot/src/weights/bridge_polkadot_grandpa.rs

This file was deleted.

21 changes: 12 additions & 9 deletions runtimes/bulletin-polkadot/src/weights/mod.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
//! Expose the auto generated weight files.

use ::pallet_bridge_grandpa::WeightInfoExt as GrandpaWeightInfoExt;
use ::pallet_bridge_messages::WeightInfoExt as MessagesWeightInfoExt;
use ::pallet_bridge_parachains::WeightInfoExt as ParachainsWeightInfoExt;
use ::pallet_bridge_relayers::WeightInfo as _;
use frame_support::weights::Weight;
use pallet_bridge_relayers::WeightInfo;

pub mod bridge_polkadot_grandpa;
pub mod bridge_polkadot_messages;
pub mod bridge_polkadot_parachains;
pub mod bridge_polkadot_relayers;
pub mod pallet_bridge_grandpa;
pub mod pallet_relayer_set;
pub mod pallet_timestamp;
pub mod pallet_transaction_storage;
pub mod pallet_validator_set;

impl pallet_bridge_grandpa::WeightInfoExt for bridge_polkadot_grandpa::WeightInfo<crate::Runtime> {
impl GrandpaWeightInfoExt for pallet_bridge_grandpa::WeightInfo<crate::Runtime> {
fn submit_finality_proof_overhead_from_runtime() -> Weight {
// our signed extension:
// 1) checks whether relayer registration is active from validate/pre_dispatch;
Expand All @@ -18,9 +25,7 @@ impl pallet_bridge_grandpa::WeightInfoExt for bridge_polkadot_grandpa::WeightInf
}
}

impl pallet_bridge_parachains::WeightInfoExt
for bridge_polkadot_parachains::WeightInfo<crate::Runtime>
{
impl ParachainsWeightInfoExt for bridge_polkadot_parachains::WeightInfo<crate::Runtime> {
fn expected_extra_storage_proof_size() -> u32 {
crate::bp_people_polkadot::EXTRA_STORAGE_PROOF_SIZE
}
Expand All @@ -34,9 +39,7 @@ impl pallet_bridge_parachains::WeightInfoExt
}
}

impl pallet_bridge_messages::WeightInfoExt
for bridge_polkadot_messages::WeightInfo<crate::Runtime>
{
impl MessagesWeightInfoExt for bridge_polkadot_messages::WeightInfo<crate::Runtime> {
fn expected_extra_storage_proof_size() -> u32 {
crate::bp_people_polkadot::EXTRA_STORAGE_PROOF_SIZE
}
Expand Down
99 changes: 99 additions & 0 deletions runtimes/bulletin-polkadot/src/weights/pallet_bridge_grandpa.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
// 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_grandpa`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-08-28, 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_grandpa
// --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_grandpa`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_bridge_grandpa::WeightInfo for WeightInfo<T> {
/// Storage: `BridgePolkadotGrandpa::CurrentAuthoritySet` (r:1 w:0)
/// Proof: `BridgePolkadotGrandpa::CurrentAuthoritySet` (`max_values`: Some(1), `max_size`: Some(50250), added: 50745, mode: `MaxEncodedLen`)
/// Storage: `BridgePolkadotGrandpa::PalletOperatingMode` (r:1 w:0)
/// Proof: `BridgePolkadotGrandpa::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`)
/// Storage: `BridgePolkadotGrandpa::BestFinalized` (r:1 w:1)
/// Proof: `BridgePolkadotGrandpa::BestFinalized` (`max_values`: Some(1), `max_size`: Some(36), added: 531, mode: `MaxEncodedLen`)
/// Storage: `BridgePolkadotGrandpa::ImportedHashesPointer` (r:1 w:1)
/// Proof: `BridgePolkadotGrandpa::ImportedHashesPointer` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `BridgePolkadotGrandpa::ImportedHashes` (r:1 w:1)
/// Proof: `BridgePolkadotGrandpa::ImportedHashes` (`max_values`: Some(1200), `max_size`: Some(36), added: 1521, mode: `MaxEncodedLen`)
/// Storage: `BridgePolkadotGrandpa::ImportedHeaders` (r:0 w:2)
/// Proof: `BridgePolkadotGrandpa::ImportedHeaders` (`max_values`: Some(1200), `max_size`: Some(68), added: 1553, mode: `MaxEncodedLen`)
/// The range of component `p` is `[1, 168]`.
/// The range of component `v` is `[50, 100]`.
fn submit_finality_proof(p: u32, v: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `49 + p * (59 ±0)`
// Estimated: `51735`
// Minimum execution time: 258_153_000 picoseconds.
Weight::from_parts(40_939_721, 0)
.saturating_add(Weight::from_parts(0, 51735))
// Standard Error: 148_691
.saturating_add(Weight::from_parts(25_170_278, 0).saturating_mul(p.into()))
// Standard Error: 496_630
.saturating_add(Weight::from_parts(1_920_430, 0).saturating_mul(v.into()))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(5))
}
/// Storage: `BridgePolkadotGrandpa::CurrentAuthoritySet` (r:1 w:1)
/// Proof: `BridgePolkadotGrandpa::CurrentAuthoritySet` (`max_values`: Some(1), `max_size`: Some(50250), added: 50745, mode: `MaxEncodedLen`)
/// Storage: `BridgePolkadotGrandpa::ImportedHashesPointer` (r:1 w:1)
/// Proof: `BridgePolkadotGrandpa::ImportedHashesPointer` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `BridgePolkadotGrandpa::ImportedHashes` (r:1 w:1)
/// Proof: `BridgePolkadotGrandpa::ImportedHashes` (`max_values`: Some(1200), `max_size`: Some(36), added: 1521, mode: `MaxEncodedLen`)
/// Storage: `BridgePolkadotGrandpa::BestFinalized` (r:0 w:1)
/// Proof: `BridgePolkadotGrandpa::BestFinalized` (`max_values`: Some(1), `max_size`: Some(36), added: 531, mode: `MaxEncodedLen`)
/// Storage: `BridgePolkadotGrandpa::ImportedHeaders` (r:0 w:2)
/// Proof: `BridgePolkadotGrandpa::ImportedHeaders` (`max_values`: Some(1200), `max_size`: Some(68), added: 1553, mode: `MaxEncodedLen`)
fn force_set_pallet_state() -> Weight {
// Proof Size summary in bytes:
// Measured: `84`
// Estimated: `51735`
// Minimum execution time: 92_470_000 picoseconds.
Weight::from_parts(92_470_000, 0)
.saturating_add(Weight::from_parts(0, 51735))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(6))
}
}
Loading