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
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,9 @@ pub fn run() -> sc_cli::Result<()> {
service::new_partial(&config)?;
let db = backend.expose_db();
let storage = backend.expose_storage();
let shared_cache = backend.expose_shared_trie_cache();

cmd.run(config, client, db, storage)
cmd.run(config, client, db, storage, shared_cache)
},
BenchmarkCmd::Overhead(cmd) => {
let PartialComponents { client, .. } = service::new_partial(&config)?;
Expand Down
21 changes: 21 additions & 0 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ sp-std = { default-features = false, git = "https://github.com/paritytech/polkad
sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602" }
sp-transaction-storage-proof = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602" }
sp-version = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602" }
sp-storage = { optional = true, default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602" }

# Used for the node's RPCs
frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602" }
Expand Down Expand Up @@ -79,6 +80,12 @@ xcm = { default-features = false, git = "https://github.com/paritytech/polkadot-
xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602", package = "staging-xcm-builder" }
xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602", package = "staging-xcm-executor" }

# TODO: just to pass `--features runtime-benchmarks`
pallet-xcm = { optional = true, default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602" }
pallet-staking = { optional = true, default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602" }
sp-staking = { optional = true, default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602" }
parachains-common = { optional = true, default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602" }

[build-dependencies]
substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602", optional = true }

Expand Down Expand Up @@ -156,7 +163,12 @@ std = [
"xcm/std",

"pallet-bridge-relayers/std",
"pallet-staking?/std",
"pallet-xcm?/std",
"parachains-common?/std",
"sp-genesis-builder/std",
"sp-staking?/std",
"sp-storage?/std",
"substrate-wasm-builder",
]
runtime-benchmarks = [
Expand All @@ -168,6 +180,7 @@ runtime-benchmarks = [
"pallet-sudo/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"sp-storage",

"frame-benchmarking/runtime-benchmarks",
"frame-system-benchmarking/runtime-benchmarks",
Expand All @@ -188,6 +201,11 @@ runtime-benchmarks = [
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm/runtime-benchmarks",

"pallet-staking/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"parachains-common/runtime-benchmarks",
"sp-staking/runtime-benchmarks",
]
try-runtime = [
"frame-executive/try-runtime",
Expand All @@ -209,10 +227,13 @@ try-runtime = [

"pallet-bridge-relayers/try-runtime",
"pallet-relayer-set/try-runtime",
"pallet-staking?/try-runtime",
"pallet-transaction-payment/try-runtime",
"pallet-transaction-storage/try-runtime",
"pallet-validator-set/try-runtime",
"pallet-xcm?/try-runtime",
"pallets-common/try-runtime",
"parachains-common?/try-runtime",
"sp-runtime/try-runtime",
]
rococo = []
23 changes: 13 additions & 10 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ impl pallet_timestamp::Config for Runtime {
type WeightInfo = ();
}

// TODO: remove sudo before go live
impl pallet_sudo::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
Expand Down Expand Up @@ -592,22 +593,22 @@ pub type Executive = frame_executive::Executive<
AllPalletsWithSystem,
>;

#[cfg(feature = "runtime-benchmarks")]
#[macro_use]
extern crate frame_benchmarking;

#[cfg(feature = "runtime-benchmarks")]
mod benches {
define_benchmarks!(
frame_benchmarking::define_benchmarks!(
[frame_benchmarking, BaselineBench::<Runtime>]
[frame_system, SystemBench::<Runtime>]
[pallet_timestamp, Timestamp]
[pallet_sudo, Sudo]
[pallet_transaction_storage, TransactionStorage]
[pallet_validator_set, ValidatorSet]
[pallet_bridge_grandpa, BridgePolkadotGrandpa]
[pallet_bridge_parachains, BridgeParachainsBench::<Runtime, bridge_config::WithPolkadotBridgeParachainsInstance>]
[pallet_bridge_messages, BridgeMessagesBench::<Runtime, bridge_config::WithBridgeHubPolkadotMessagesInstance>]
// TODO: Rococo vs Polkadot https://github.com/paritytech/polkadot-bulletin-chain/issues/22
[pallet_bridge_grandpa, BridgeRococoGrandpa]
// [pallet_bridge_parachains, BridgeParachainsBench::<Runtime, bridge_config::WithRococoBridgeParachainsInstance>]
// [pallet_bridge_messages, BridgeMessagesBench::<Runtime, bridge_config::WithBridgeHubRococoMessagesInstance>]
// [pallet_bridge_grandpa, BridgePolkadotGrandpa]
// [pallet_bridge_parachains, BridgeParachainsBench::<Runtime, bridge_config::WithPolkadotBridgeParachainsInstance>]
// [pallet_bridge_messages, BridgeMessagesBench::<Runtime, bridge_config::WithBridgeHubPolkadotMessagesInstance>]
[pallet_relayer_set, RelayerSet]
);
}
Expand Down Expand Up @@ -866,10 +867,12 @@ impl_runtime_apis! {
(list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch, TrackedStorageKey};
) -> 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;
Expand Down