diff --git a/Cargo.lock b/Cargo.lock index 079ab93771f..ddd65384f98 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13870,6 +13870,7 @@ dependencies = [ "sp-session", "sp-staking", "sp-std 8.0.0 (git+https://github.com/gear-tech/polkadot-sdk.git?branch=gear-release-polkadot-v1.1.0)", + "sp-storage", "sp-transaction-pool", "sp-version", "substrate-build-script-utils", diff --git a/pallets/gear-voucher/src/benchmarking.rs b/pallets/gear-voucher/src/benchmarking.rs index d549cb52607..ab558537ae1 100644 --- a/pallets/gear-voucher/src/benchmarking.rs +++ b/pallets/gear-voucher/src/benchmarking.rs @@ -20,10 +20,10 @@ use crate::*; use common::{benchmarking, Origin}; -use frame_benchmarking::{benchmarks, Zero}; +use frame_benchmarking::benchmarks; use frame_support::traits::Currency; use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin}; -use sp_runtime::traits::{One, UniqueSaturatedInto}; +use sp_runtime::traits::{One, UniqueSaturatedInto, Zero}; pub(crate) type CurrencyOf = ::Currency; diff --git a/pallets/gear/src/benchmarking/mod.rs b/pallets/gear/src/benchmarking/mod.rs index e1d3e3d86e7..e99c406ef0b 100644 --- a/pallets/gear/src/benchmarking/mod.rs +++ b/pallets/gear/src/benchmarking/mod.rs @@ -75,11 +75,11 @@ use core_processor::{ configs::{BlockConfig, PageCosts, TESTS_MAX_PAGES_NUMBER}, Ext, ProcessExecutionContext, ProcessorContext, ProcessorExternalities, }; + +use parity_scale_codec::Encode; + use frame_benchmarking::{benchmarks, whitelisted_caller}; -use frame_support::{ - codec::Encode, - traits::{Currency, Get, Hooks}, -}; +use frame_support::traits::{Currency, Get, Hooks}; use frame_system::{Pallet as SystemPallet, RawOrigin}; use gear_core::{ code::{Code, CodeAndId}, diff --git a/pallets/gear/src/benchmarking/tests/lazy_pages.rs b/pallets/gear/src/benchmarking/tests/lazy_pages.rs index ecb908809da..5d54c645e57 100644 --- a/pallets/gear/src/benchmarking/tests/lazy_pages.rs +++ b/pallets/gear/src/benchmarking/tests/lazy_pages.rs @@ -23,7 +23,7 @@ use core::mem::size_of; use ::alloc::{collections::BTreeSet, format}; use common::ProgramStorage; use core_processor::Ext; -use frame_support::codec::MaxEncodedLen; +use parity_scale_codec::MaxEncodedLen; use gear_core::{ memory::MemoryInterval, pages::{PageNumber, PageU32Size}, diff --git a/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs b/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs index fcacca18f6d..56f18e696f2 100644 --- a/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs +++ b/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs @@ -36,7 +36,7 @@ use gear_core::ids::{CodeId, ReservationId}; use gear_core_errors::{ReplyCode, SuccessReplyReason}; use gear_wasm_instrument::syscalls::SyscallName; use pallet_timestamp::Pallet as TimestampPallet; -use parity_scale_codec::Decode; +use parity_scale_codec::{Encode, Decode}; use test_syscalls::{Kind, WASM_BINARY as SYSCALLS_TEST_WASM_BINARY}; pub fn read_big_state() diff --git a/runtime/common/src/apis.rs b/runtime/common/src/apis.rs index 03e6d6cbed3..4f5d437d37e 100644 --- a/runtime/common/src/apis.rs +++ b/runtime/common/src/apis.rs @@ -229,31 +229,21 @@ macro_rules! impl_runtime_apis_plus_common { fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig ) -> Result, sp_runtime::RuntimeString> { - use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch, TrackedStorageKey}; - + use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch}; + use sp_storage::TrackedStorageKey; use frame_system_benchmarking::Pallet as SystemBench; use baseline::Pallet as BaselineBench; - + impl frame_system_benchmarking::Config for Runtime {} impl baseline::Config for Runtime {} - - let whitelist: Vec = vec![ - // Block Number - hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(), - // Total Issuance - hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(), - // Execution Phase - hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(), - // Event Count - hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(), - // System Events - hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(), - ]; - + + use frame_support::traits::WhitelistedStorageKeys; + let whitelist: Vec = AllPalletsWithSystem::whitelisted_storage_keys(); + let mut batches = Vec::::new(); let params = (&config, &whitelist); add_benchmarks!(params, batches); - + Ok(batches) } } diff --git a/runtime/vara/Cargo.toml b/runtime/vara/Cargo.toml index 5bd58a98f17..59982570338 100644 --- a/runtime/vara/Cargo.toml +++ b/runtime/vara/Cargo.toml @@ -71,6 +71,7 @@ sp-runtime.workspace = true sp-session.workspace = true sp-staking.workspace = true sp-std.workspace = true +sp-storage.workspace = true sp-transaction-pool.workspace = true sp-version.workspace = true @@ -188,6 +189,7 @@ std = [ "sp-session/std", "sp-staking/std", "sp-std/std", + "sp-storage/std", "sp-transaction-pool/std", "sp-version/std", "substrate-wasm-builder", diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index 7ceb7a1cca3..041dc49f958 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -1336,14 +1336,15 @@ impl_runtime_apis_plus_common! { // slot duration and expected target block time, for safely // resisting network delays of maximum two seconds. // - sp_consensus_babe::BabeConfiguration { - slot_duration: Babe::slot_duration(), - epoch_length: EpochDuration::get(), - c: BABE_GENESIS_EPOCH_CONFIG.c, - authorities: Babe::authorities().to_vec(), - randomness: Babe::randomness(), - allowed_slots: BABE_GENESIS_EPOCH_CONFIG.allowed_slots, - } + let epoch_config = Babe::epoch_config().unwrap_or(BABE_GENESIS_EPOCH_CONFIG); + sp_consensus_babe::BabeConfiguration { + slot_duration: Babe::slot_duration(), + epoch_length: EpochDuration::get(), + c: epoch_config.c, + authorities: Babe::authorities().to_vec(), + randomness: Babe::randomness(), + allowed_slots: epoch_config.allowed_slots, + } } fn current_epoch_start() -> sp_consensus_babe::Slot {