Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
c13b500
extract repeat out of benchmark
shawntabrizi Jul 19, 2021
c309539
remove r
shawntabrizi Jul 19, 2021
e909b9d
unused
shawntabrizi Jul 19, 2021
6e70861
cargo run --quiet --release --features=runtime-benchmarks --manifest-…
Jul 19, 2021
30e9e5f
cargo run --quiet --release --features=runtime-benchmarks --manifest-…
Jul 19, 2021
66c1dbb
cargo run --quiet --release --features=runtime-benchmarks --manifest-…
Jul 19, 2021
cd01587
use linked map to keep order
shawntabrizi Jul 21, 2021
8c42f39
Merge branch 'master' of https://github.com/paritytech/substrate into…
Jul 21, 2021
d0184a0
cargo run --quiet --release --features=runtime-benchmarks --manifest-…
Jul 21, 2021
31810d9
Delete pallet_balances.rs
shawntabrizi Jul 21, 2021
1ab0066
Delete out
shawntabrizi Jul 21, 2021
257fbbb
cargo run --quiet --release --features=runtime-benchmarks --manifest-…
Jul 21, 2021
ca5cdc5
steps and repeat to tuple (current_*, total_*)
shawntabrizi Jul 22, 2021
f42d16f
idea for list command
shawntabrizi Jul 22, 2021
8a0ed37
Merge branch 'master' into shawntabrizi-refactor-benchmarks
shawntabrizi Jul 29, 2021
81a7e77
fmt
shawntabrizi Jul 29, 2021
9467179
use benchmark list in cli
shawntabrizi Jul 30, 2021
e760e3e
handle steps in cli
shawntabrizi Jul 30, 2021
4d28ebe
Move client consensus parts out of primitives and into client/consens…
gilescope Jul 30, 2021
630ab7a
move log update to cli
shawntabrizi Jul 30, 2021
d4b3f9d
fmt
shawntabrizi Jul 30, 2021
39bd8c0
remove old todo
shawntabrizi Jul 30, 2021
fb8fc17
line width
shawntabrizi Jul 30, 2021
0f713c7
Merge branch 'master' of https://github.com/paritytech/substrate into…
Jul 30, 2021
5627eba
cargo run --quiet --release --features=runtime-benchmarks --manifest-…
Jul 30, 2021
ced0514
benchmark metadata function
shawntabrizi Jul 30, 2021
1945af5
don't need this warm up
shawntabrizi Jul 30, 2021
b243b02
cargo run --quiet --release --features=runtime-benchmarks --manifest-…
Jul 30, 2021
14a4342
fix warnings
shawntabrizi Jul 30, 2021
ee3b2f7
fix node-template
shawntabrizi Jul 30, 2021
0ae6038
fix
shawntabrizi Jul 30, 2021
90c495c
Try merge shawntabrizi-refactor-benchmarks
emostov Jul 30, 2021
83289aa
save
emostov Jul 30, 2021
44875c5
cargo run --quiet --release --features=runtime-benchmarks --manifest-…
Jul 30, 2021
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
30 changes: 27 additions & 3 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion bin/node-template/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub fn new_partial(
FullClient,
FullBackend,
FullSelectChain,
sp_consensus::DefaultImportQueue<Block, FullClient>,
sc_consensus::DefaultImportQueue<Block, FullClient>,
sc_transaction_pool::FullPool<Block, FullClient>,
(
sc_finality_grandpa::GrandpaBlockImport<
Expand Down
27 changes: 19 additions & 8 deletions bin/node-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,14 +446,27 @@ impl_runtime_apis! {

#[cfg(feature = "runtime-benchmarks")]
impl frame_benchmarking::Benchmark<Block> for Runtime {
fn benchmark_metadata(extra: bool) -> (Vec<frame_benchmarking::BenchmarkList>, Vec<frame_support::traits::StorageInfo>) {
use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};
use frame_support::traits::StorageInfoTrait;
use frame_system_benchmarking::Pallet as SystemBench;

let mut list = Vec::<BenchmarkList>::new();

list_benchmark!(list, extra, frame_system, SystemBench::<Runtime>);
list_benchmark!(list, extra, pallet_balances, Balances);
list_benchmark!(list, extra, pallet_timestamp, Timestamp);
list_benchmark!(list, extra, pallet_template, TemplateModule);

let storage_info = AllPalletsWithSystem::storage_info();

return (list, storage_info)
}

fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<
(Vec<frame_benchmarking::BenchmarkBatch>, Vec<StorageInfo>),
sp_runtime::RuntimeString,
> {
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};
use frame_support::traits::StorageInfoTrait;

use frame_system_benchmarking::Pallet as SystemBench;
impl frame_system_benchmarking::Config for Runtime {}
Expand All @@ -471,8 +484,6 @@ impl_runtime_apis! {
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),
];

let storage_info = AllPalletsWithSystem::storage_info();

let mut batches = Vec::<BenchmarkBatch>::new();
let params = (&config, &whitelist);

Expand All @@ -482,7 +493,7 @@ impl_runtime_apis! {
add_benchmark!(params, batches, pallet_template, TemplateModule);

if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
Ok((batches, storage_info))
Ok(batches)
}
}
}
7 changes: 3 additions & 4 deletions bin/node/cli/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub fn new_partial(
FullClient,
FullBackend,
FullSelectChain,
sp_consensus::DefaultImportQueue<Block, FullClient>,
sc_consensus::DefaultImportQueue<Block, FullClient>,
sc_transaction_pool::FullPool<Block, FullClient>,
(
impl Fn(node_rpc::DenyUnsafe, sc_rpc::SubscriptionTaskExecutor) -> node_rpc::IoHandler,
Expand Down Expand Up @@ -595,14 +595,13 @@ mod tests {
Address, BalancesCall, Call, UncheckedExtrinsic,
};
use sc_client_api::BlockBackend;
use sc_consensus::{BlockImport, BlockImportParams, ForkChoiceStrategy};
use sc_consensus_babe::{BabeIntermediate, CompatibleDigestItem, INTERMEDIATE_KEY};
use sc_consensus_epochs::descendent_query;
use sc_keystore::LocalKeystore;
use sc_service_test::TestNetNode;
use sc_transaction_pool_api::{ChainEvent, MaintainedTransactionPool};
use sp_consensus::{
BlockImport, BlockImportParams, BlockOrigin, Environment, ForkChoiceStrategy, Proposer,
};
use sp_consensus::{BlockOrigin, Environment, Proposer};
use sp_core::{crypto::Pair as CryptoPair, Public, H256};
use sp_inherents::InherentDataProvider;
use sp_keyring::AccountKeyring;
Expand Down
60 changes: 52 additions & 8 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1542,14 +1542,60 @@ impl_runtime_apis! {

#[cfg(feature = "runtime-benchmarks")]
impl frame_benchmarking::Benchmark<Block> for Runtime {
fn benchmark_metadata(extra: bool) -> (Vec<frame_benchmarking::BenchmarkList>, Vec<frame_support::traits::StorageInfo>) {
use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};
use frame_support::traits::StorageInfoTrait;

// Trying to add benchmarks directly to the Session Pallet caused cyclic dependency
// issues. To get around that, we separated the Session benchmarks into its own crate,
// which is why we need these two lines below.
use pallet_session_benchmarking::Pallet as SessionBench;
use pallet_offences_benchmarking::Pallet as OffencesBench;
use frame_system_benchmarking::Pallet as SystemBench;

let mut list = Vec::<BenchmarkList>::new();

list_benchmark!(list, extra, pallet_assets, Assets);
list_benchmark!(list, extra, pallet_babe, Babe);
list_benchmark!(list, extra, pallet_balances, Balances);
list_benchmark!(list, extra, pallet_bounties, Bounties);
list_benchmark!(list, extra, pallet_collective, Council);
list_benchmark!(list, extra, pallet_contracts, Contracts);
list_benchmark!(list, extra, pallet_democracy, Democracy);
list_benchmark!(list, extra, pallet_election_provider_multi_phase, ElectionProviderMultiPhase);
list_benchmark!(list, extra, pallet_elections_phragmen, Elections);
list_benchmark!(list, extra, pallet_gilt, Gilt);
list_benchmark!(list, extra, pallet_grandpa, Grandpa);
list_benchmark!(list, extra, pallet_identity, Identity);
list_benchmark!(list, extra, pallet_im_online, ImOnline);
list_benchmark!(list, extra, pallet_indices, Indices);
list_benchmark!(list, extra, pallet_lottery, Lottery);
list_benchmark!(list, extra, pallet_membership, TechnicalMembership);
list_benchmark!(list, extra, pallet_mmr, Mmr);
list_benchmark!(list, extra, pallet_multisig, Multisig);
list_benchmark!(list, extra, pallet_offences, OffencesBench::<Runtime>);
list_benchmark!(list, extra, pallet_proxy, Proxy);
list_benchmark!(list, extra, pallet_scheduler, Scheduler);
list_benchmark!(list, extra, pallet_session, SessionBench::<Runtime>);
list_benchmark!(list, extra, pallet_staking, Staking);
list_benchmark!(list, extra, frame_system, SystemBench::<Runtime>);
list_benchmark!(list, extra, pallet_timestamp, Timestamp);
list_benchmark!(list, extra, pallet_tips, Tips);
list_benchmark!(list, extra, pallet_transaction_storage, TransactionStorage);
list_benchmark!(list, extra, pallet_treasury, Treasury);
list_benchmark!(list, extra, pallet_uniques, Uniques);
list_benchmark!(list, extra, pallet_utility, Utility);
list_benchmark!(list, extra, pallet_vesting, Vesting);

let storage_info = AllPalletsWithSystem::storage_info();

return (list, storage_info)
}

fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<
(Vec<frame_benchmarking::BenchmarkBatch>, Vec<frame_support::traits::StorageInfo>),
sp_runtime::RuntimeString,
> {
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};
use frame_support::traits::StorageInfoTrait;

// Trying to add benchmarks directly to the Session Pallet caused cyclic dependency
// issues. To get around that, we separated the Session benchmarks into its own crate,
Expand Down Expand Up @@ -1577,8 +1623,6 @@ impl_runtime_apis! {
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da95ecffd7b6c0f78751baa9d281e0bfa3a6d6f646c70792f74727372790000000000000000000000000000000000000000").to_vec().into(),
];

let storage_info = AllPalletsWithSystem::storage_info();

let mut batches = Vec::<BenchmarkBatch>::new();
let params = (&config, &whitelist);

Expand Down Expand Up @@ -1615,7 +1659,7 @@ impl_runtime_apis! {
add_benchmark!(params, batches, pallet_vesting, Vesting);

if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
Ok((batches, storage_info))
Ok(batches)
}
}
}
Expand Down
1 change: 0 additions & 1 deletion bin/node/test-runner-example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ sc-informant = { path = "../../../client/informant" }
sc-consensus = { path = "../../../client/consensus/common" }

sp-runtime = { path = "../../../primitives/runtime" }
sp-consensus = { path = "../../../primitives/consensus/common" }
sp-keyring = { path = "../../../primitives/keyring" }
sp-timestamp = { path = "../../../primitives/timestamp" }
sp-api = { path = "../../../primitives/api" }
Expand Down
1 change: 1 addition & 0 deletions bin/node/testing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pallet-balances = { version = "4.0.0-dev", path = "../../../frame/balances" }
sc-service = { version = "0.10.0-dev", features = ["test-helpers", "db"], path = "../../../client/service" }
sc-client-db = { version = "0.10.0-dev", path = "../../../client/db/", features = ["kvdb-rocksdb", "parity-db"] }
sc-client-api = { version = "4.0.0-dev", path = "../../../client/api/" }
sc-consensus = { version = "0.10.0-dev", path = "../../../client/consensus/common" }
codec = { package = "parity-scale-codec", version = "2.0.0" }
pallet-contracts = { version = "4.0.0-dev", path = "../../../frame/contracts" }
pallet-grandpa = { version = "4.0.0-dev", path = "../../../frame/grandpa" }
Expand Down
5 changes: 2 additions & 3 deletions bin/node/testing/src/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,11 @@ use sc_client_api::{
BlockBackend, ExecutionStrategy,
};
use sc_client_db::PruningMode;
use sc_consensus::{BlockImport, BlockImportParams, ForkChoiceStrategy, ImportResult, ImportedAux};
use sc_executor::{NativeExecutor, WasmExecutionMethod};
use sp_api::ProvideRuntimeApi;
use sp_block_builder::BlockBuilder;
use sp_consensus::{
BlockImport, BlockImportParams, BlockOrigin, ForkChoiceStrategy, ImportResult, ImportedAux,
};
use sp_consensus::BlockOrigin;
use sp_core::{blake2_256, ed25519, sr25519, traits::SpawnNamed, ExecutionContext, Pair, Public};
use sp_inherents::InherentData;
use sp_runtime::{
Expand Down
1 change: 0 additions & 1 deletion client/api/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ use std::{
sync::Arc,
};

pub use sp_consensus::ImportedState;
pub use sp_state_machine::Backend as StateBackend;
use std::marker::PhantomData;

Expand Down
1 change: 1 addition & 0 deletions client/consensus/aura/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ sc-block-builder = { version = "0.10.0-dev", path = "../../block-builder" }
sc-client-api = { version = "4.0.0-dev", path = "../../api" }
codec = { package = "parity-scale-codec", version = "2.0.0" }
sp-consensus = { version = "0.10.0-dev", path = "../../../primitives/consensus/common" }
sc-consensus = { version = "0.10.0-dev", path = "../../../client/consensus/common" }
sp-consensus-slots = { version = "0.10.0-dev", path = "../../../primitives/consensus/slots" }
derive_more = "0.99.2"
futures = "0.3.9"
Expand Down
10 changes: 5 additions & 5 deletions client/consensus/aura/src/import_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ use codec::{Codec, Decode, Encode};
use log::{debug, info, trace};
use prometheus_endpoint::Registry;
use sc_client_api::{backend::AuxStore, BlockOf, UsageProvider};
use sc_consensus::{
block_import::{BlockImport, BlockImportParams, ForkChoiceStrategy},
import_queue::{BasicQueue, BoxJustificationImport, DefaultImportQueue, Verifier},
};
use sc_consensus_slots::{check_equivocation, CheckedHeader, InherentDataProviderExt};
use sc_telemetry::{telemetry, TelemetryHandle, CONSENSUS_DEBUG, CONSENSUS_TRACE};
use sp_api::{ApiExt, ProvideRuntimeApi};
Expand All @@ -31,11 +35,7 @@ use sp_blockchain::{
well_known_cache_keys::{self, Id as CacheKeyId},
HeaderBackend, ProvideCache,
};
use sp_consensus::{
import_queue::{BasicQueue, BoxJustificationImport, DefaultImportQueue, Verifier},
BlockImport, BlockImportParams, BlockOrigin, CanAuthorWith, Error as ConsensusError,
ForkChoiceStrategy,
};
use sp_consensus::{BlockOrigin, CanAuthorWith, Error as ConsensusError};
use sp_consensus_aura::{
digests::CompatibleDigestItem, inherents::AuraInherentData, AuraApi, ConsensusLog,
AURA_ENGINE_ID,
Expand Down
Loading