Skip to content
Draft
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
1,548 changes: 803 additions & 745 deletions Cargo.lock

Large diffs are not rendered by default.

260 changes: 130 additions & 130 deletions Cargo.toml

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,9 @@ pub fn run() -> sc_cli::Result<()> {
BenchmarkCmd::Storage(cmd) => {
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 ext_builder = RemarkBuilder::new(client.clone());
Expand Down Expand Up @@ -345,6 +346,7 @@ fn override_default_heap_pages(config: Configuration, pages: u64) -> Configurati
keystore: config.keystore,
database: config.database,
trie_cache_maximum_size: config.trie_cache_maximum_size,
warm_up_trie_cache: config.warm_up_trie_cache,
state_pruning: config.state_pruning,
blocks_pruning: config.blocks_pruning,
chain_spec: config.chain_spec,
Expand Down
3 changes: 0 additions & 3 deletions pallets/admin-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ pub mod pallet {
+ pallet_subtensor::pallet::Config
+ pallet_evm_chain_id::pallet::Config
{
/// Because this pallet emits events, it depends on the runtime's definition of an event.
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;

/// Implementation of the AuraInterface
type Aura: crate::AuraInterface<<Self as Config>::AuthorityId, Self::MaxAuthorities>;

Expand Down
7 changes: 1 addition & 6 deletions pallets/admin-utils/src/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ parameter_types! {
}

impl pallet_subtensor::Config for Test {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type Currency = Balances;
type InitialIssuance = InitialIssuance;
Expand Down Expand Up @@ -253,7 +252,6 @@ impl pallet_crowdloan::Config for Test {
type PalletId = CrowdloanPalletId;
type Currency = Balances;
type RuntimeCall = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = pallet_crowdloan::weights::SubstrateWeight<Test>;
type Preimages = Preimage;
type MinimumDeposit = MinimumDeposit;
Expand Down Expand Up @@ -330,7 +328,6 @@ parameter_types! {
}

impl pallet_subtensor_swap::Config for Test {
type RuntimeEvent = RuntimeEvent;
type SubnetInfo = SubtensorModule;
type BalanceOps = SubtensorModule;
type ProtocolId = SwapProtocolId;
Expand Down Expand Up @@ -361,7 +358,6 @@ impl crate::GrandpaInterface<Test> for GrandpaInterfaceImpl {
}

impl crate::Config for Test {
type RuntimeEvent = RuntimeEvent;
type AuthorityId = AuraId;
type MaxAuthorities = ConstU32<32>;
type Aura = ();
Expand Down Expand Up @@ -392,7 +388,6 @@ impl pallet_scheduler::Config for Test {

impl pallet_evm_chain_id::Config for Test {}
impl pallet_drand::Config for Test {
type RuntimeEvent = RuntimeEvent;
type AuthorityId = TestAuthId;
type Verifier = pallet_drand::verifier::QuicknetVerifier;
type UnsignedPriority = ConstU64<{ 1 << 20 }>;
Expand Down Expand Up @@ -448,7 +443,7 @@ impl<LocalCall> frame_system::offchain::CreateInherent<LocalCall> for Test
where
RuntimeCall: From<LocalCall>,
{
fn create_inherent(call: Self::RuntimeCall) -> Self::Extrinsic {
fn create_bare(call: Self::RuntimeCall) -> Self::Extrinsic {
UncheckedExtrinsic::new_inherent(call)
}
}
Expand Down
18 changes: 10 additions & 8 deletions pallets/collective/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ const SEED: u32 = 0;

const MAX_BYTES: u32 = 1_024;

fn assert_last_event<T: Config<I>, I: 'static>(generic_event: <T as Config<I>>::RuntimeEvent) {
fn assert_last_event<T: frame_system::pallet::Config>(
generic_event: <T as frame_system::pallet::Config>::RuntimeEvent,
) {
frame_system::Pallet::<T>::assert_last_event(generic_event.into());
}

Expand Down Expand Up @@ -131,7 +133,7 @@ benchmarks_instance_pallet! {
verify {
let proposal_hash = T::Hashing::hash_of(&proposal);
// Note that execution fails due to mis-matched origin
assert_last_event::<T, I>(
assert_last_event::<T>(
Event::MemberExecuted { proposal_hash, result: Ok(()) }.into()
);
}
Expand Down Expand Up @@ -176,7 +178,7 @@ benchmarks_instance_pallet! {
// New proposal is recorded
assert_eq!(Collective::<T, I>::proposals().len(), p as usize);
let proposal_hash = T::Hashing::hash_of(&proposal);
assert_last_event::<T, I>(Event::Proposed { account: caller, proposal_index: p - 1, proposal_hash, threshold }.into());
assert_last_event::<T>(Event::Proposed { account: caller, proposal_index: p - 1, proposal_hash, threshold }.into());
}

vote {
Expand Down Expand Up @@ -319,7 +321,7 @@ benchmarks_instance_pallet! {
verify {
// The last proposal is removed.
assert_eq!(Collective::<T, I>::proposals().len(), (p - 1) as usize);
assert_last_event::<T, I>(Event::Disapproved { proposal_hash: last_hash }.into());
assert_last_event::<T>(Event::Disapproved { proposal_hash: last_hash }.into());
}

close_early_approved {
Expand Down Expand Up @@ -397,7 +399,7 @@ benchmarks_instance_pallet! {
verify {
// The last proposal is removed.
assert_eq!(Collective::<T, I>::proposals().len(), (p - 1) as usize);
assert_last_event::<T, I>(Event::Executed { proposal_hash: last_hash, result: Ok(()) }.into());
assert_last_event::<T>(Event::Executed { proposal_hash: last_hash, result: Ok(()) }.into());
}

close_disapproved {
Expand Down Expand Up @@ -476,7 +478,7 @@ benchmarks_instance_pallet! {
}: close(SystemOrigin::Root, last_hash, index, Weight::MAX, bytes_in_storage)
verify {
assert_eq!(Collective::<T, I>::proposals().len(), (p - 1) as usize);
assert_last_event::<T, I>(Event::Disapproved { proposal_hash: last_hash }.into());
assert_last_event::<T>(Event::Disapproved { proposal_hash: last_hash }.into());
}

close_approved {
Expand Down Expand Up @@ -545,7 +547,7 @@ benchmarks_instance_pallet! {
}: close(SystemOrigin::Root, last_hash, p - 1, Weight::MAX, bytes_in_storage)
verify {
assert_eq!(Collective::<T, I>::proposals().len(), (p - 1) as usize);
assert_last_event::<T, I>(Event::Executed { proposal_hash: last_hash, result: Ok(()) }.into());
assert_last_event::<T>(Event::Executed { proposal_hash: last_hash, result: Ok(()) }.into());
}

disapprove_proposal {
Expand Down Expand Up @@ -593,7 +595,7 @@ benchmarks_instance_pallet! {
}: _(SystemOrigin::Root, last_hash)
verify {
assert_eq!(Collective::<T, I>::proposals().len(), (p - 1) as usize);
assert_last_event::<T, I>(Event::Disapproved { proposal_hash: last_hash }.into());
assert_last_event::<T>(Event::Disapproved { proposal_hash: last_hash }.into());
}

impl_benchmark_test_suite!(Collective, crate::tests::new_test_ext(), crate::tests::Test);
Expand Down
4 changes: 0 additions & 4 deletions pallets/collective/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,6 @@ pub mod pallet {
> + From<frame_system::Call<Self>>
+ GetDispatchInfo;

/// The runtime event type.
type RuntimeEvent: From<Event<Self, I>>
+ IsType<<Self as frame_system::Config>::RuntimeEvent>;

/// The time-out for council motions.
type MotionDuration: Get<BlockNumberFor<Self>>;

Expand Down
6 changes: 0 additions & 6 deletions pallets/collective/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ mod mock_democracy {

#[pallet::config]
pub trait Config: frame_system::Config + Sized {
type RuntimeEvent: From<Event<Self>>
+ IsType<<Self as frame_system::Config>::RuntimeEvent>;
type ExternalMajorityOrigin: EnsureOrigin<Self::RuntimeOrigin>;
}

Expand Down Expand Up @@ -141,7 +139,6 @@ impl Get<MemberCount> for GetCollectiveCount {
impl Config<Instance1> for Test {
type RuntimeOrigin = RuntimeOrigin;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type MotionDuration = ConstU64<3>;
type MaxProposals = MaxProposals;
type MaxMembers = MaxMembers;
Expand Down Expand Up @@ -182,7 +179,6 @@ impl Get<MemberCount> for GetCollectiveMajorityCount {
impl Config<Instance2> for Test {
type RuntimeOrigin = RuntimeOrigin;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type MotionDuration = ConstU64<3>;
type MaxProposals = MaxProposals;
type MaxMembers = MaxMembers;
Expand All @@ -194,7 +190,6 @@ impl Config<Instance2> for Test {
type GetVotingMembers = GetCollectiveMajorityCount;
}
impl mock_democracy::Config for Test {
type RuntimeEvent = RuntimeEvent;
type ExternalMajorityOrigin = EnsureProportionAtLeast<u64, Instance1, 3, 4>;
}

Expand Down Expand Up @@ -227,7 +222,6 @@ impl Get<MemberCount> for GetDefaultCollectiveCount {
impl Config for Test {
type RuntimeOrigin = RuntimeOrigin;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type MotionDuration = ConstU64<3>;
type MaxProposals = MaxProposals;
type MaxMembers = MaxMembers;
Expand Down
4 changes: 3 additions & 1 deletion pallets/commitments/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ use sp_std::vec;

use sp_runtime::traits::Bounded;

fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
fn assert_last_event<T: frame_system::pallet::Config>(
generic_event: <T as frame_system::pallet::Config>::RuntimeEvent,
) {
frame_system::Pallet::<T>::assert_last_event(generic_event.into());
}

Expand Down
3 changes: 0 additions & 3 deletions pallets/commitments/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ pub mod pallet {
// Configure the pallet by specifying the parameters and types on which it depends.
#[pallet::config]
pub trait Config: frame_system::Config + pallet_drand::Config {
/// Because this pallet emits events, it depends on the runtime's definition of an event.
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;

///Currency type that will be used to reserve deposits for commitments
type Currency: ReservableCurrency<Self::AccountId> + Send + Sync;

Expand Down
4 changes: 1 addition & 3 deletions pallets/commitments/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ impl pallet_commitments::CanCommit<u64> for TestCanCommit {
}

impl pallet_commitments::Config for Test {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type WeightInfo = ();
type MaxFields = TestMaxFields;
Expand All @@ -118,7 +117,6 @@ impl pallet_commitments::GetTempoInterface for MockTempoInterface {
}

impl pallet_drand::Config for Test {
type RuntimeEvent = RuntimeEvent;
type AuthorityId = test_crypto::TestAuthId;
type Verifier = pallet_drand::verifier::QuicknetVerifier;
type UnsignedPriority = ConstU64<{ 1 << 20 }>;
Expand Down Expand Up @@ -172,7 +170,7 @@ impl<LocalCall> frame_system::offchain::CreateInherent<LocalCall> for Test
where
RuntimeCall: From<LocalCall>,
{
fn create_inherent(call: Self::RuntimeCall) -> Self::Extrinsic {
fn create_bare(call: Self::RuntimeCall) -> Self::Extrinsic {
UncheckedExtrinsic::new_inherent(call)
}
}
Expand Down
6 changes: 4 additions & 2 deletions pallets/crowdloan/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ const SEED: u32 = 0;

use alloc::{boxed::Box, vec};

fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
fn assert_last_event<T: frame_system::pallet::Config>(
generic_event: <T as frame_system::pallet::Config>::RuntimeEvent,
) {
let events = frame_system::Pallet::<T>::events();
let system_event: <T as frame_system::Config>::RuntimeEvent = generic_event.into();
let system_event: <T as frame_system::pallet::Config>::RuntimeEvent = generic_event.into();
// compare to the last event record
let frame_system::EventRecord { event, .. } = &events[events.len() - 1];
assert_eq!(event, &system_event);
Expand Down
3 changes: 0 additions & 3 deletions pallets/crowdloan/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@ pub mod pallet {
/// Configuration trait.
#[pallet::config]
pub trait Config: frame_system::Config {
/// The overarching event type.
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;

/// The overarching call type.
type RuntimeCall: Parameter
+ Dispatchable<RuntimeOrigin = Self::RuntimeOrigin>
Expand Down
1 change: 0 additions & 1 deletion pallets/crowdloan/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ impl pallet_crowdloan::Config for Test {
type PalletId = CrowdloanPalletId;
type Currency = Balances;
type RuntimeCall = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = TestWeightInfo;
type Preimages = Preimage;
type MinimumDeposit = MinimumDeposit;
Expand Down
2 changes: 0 additions & 2 deletions pallets/drand/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ pub mod pallet {
{
/// The identifier type for an offchain worker.
type AuthorityId: AppCrypto<Self::Public, Self::Signature>;
/// The overarching runtime event type.
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// something that knows how to verify beacon pulses
type Verifier: Verifier;
/// A configuration for base priority of unsigned transactions.
Expand Down
3 changes: 1 addition & 2 deletions pallets/drand/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl<LocalCall> frame_system::offchain::CreateInherent<LocalCall> for Test
where
RuntimeCall: From<LocalCall>,
{
fn create_inherent(call: RuntimeCall) -> Self::Extrinsic {
fn create_bare(call: RuntimeCall) -> Self::Extrinsic {
Extrinsic::new_inherent(call)
}
}
Expand All @@ -98,7 +98,6 @@ parameter_types! {

impl pallet_drand_bridge::Config for Test {
type AuthorityId = crypto::TestAuthId;
type RuntimeEvent = RuntimeEvent;
type Verifier = QuicknetVerifier;
type UnsignedPriority = UnsignedPriority;
type HttpFetchTimeout = ConstU64<1_000>;
Expand Down
4 changes: 3 additions & 1 deletion pallets/proxy/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ use sp_runtime::traits::{Bounded, CheckedDiv};

const SEED: u32 = 0;

fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
fn assert_last_event<T: frame_system::pallet::Config>(
generic_event: <T as frame_system::pallet::Config>::RuntimeEvent,
) {
frame_system::Pallet::<T>::assert_last_event(generic_event.into());
}

Expand Down
3 changes: 0 additions & 3 deletions pallets/proxy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@ pub mod pallet {
/// Configuration trait.
#[pallet::config]
pub trait Config: frame_system::Config {
/// The overarching event type.
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;

/// The overarching call type.
type RuntimeCall: Parameter
+ Dispatchable<RuntimeOrigin = Self::RuntimeOrigin>
Expand Down
2 changes: 0 additions & 2 deletions pallets/proxy/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ impl pallet_balances::Config for Test {
}

impl pallet_utility::Config for Test {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type PalletsOrigin = OriginCaller;
type WeightInfo = ();
Expand Down Expand Up @@ -116,7 +115,6 @@ impl Contains<RuntimeCall> for BaseFilter {
}
}
impl Config for Test {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type Currency = Balances;
type ProxyType = ProxyType;
Expand Down
4 changes: 3 additions & 1 deletion pallets/registry/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ use sp_std::vec;

use sp_runtime::traits::Bounded;

fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
fn assert_last_event<T: frame_system::pallet::Config>(
generic_event: <T as frame_system::pallet::Config>::RuntimeEvent,
) {
frame_system::Pallet::<T>::assert_last_event(generic_event.into());
}

Expand Down
3 changes: 0 additions & 3 deletions pallets/registry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ pub mod pallet {
// Configure the pallet by specifying the parameters and types on which it depends.
#[pallet::config]
pub trait Config: frame_system::Config {
/// Because this pallet emits events, it depends on the runtime's definition of an event.
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;

/// Currency type that will be used to place deposits on neurons
type Currency: fungible::Mutate<Self::AccountId>
+ fungible::MutateHold<Self::AccountId, Reason = Self::RuntimeHoldReason>;
Expand Down
1 change: 0 additions & 1 deletion pallets/subtensor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ pallet-subtensor-swap.workspace = true
sp-version.workspace = true
# Substrate
sp-tracing.workspace = true
parity-util-mem = { workspace = true, features = ["primitive-types"] }
rand.workspace = true
sp-core.workspace = true
sp-std.workspace = true
Expand Down
3 changes: 0 additions & 3 deletions pallets/subtensor/src/macros/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ mod config {
+ IsType<<Self as frame_system::Config>::RuntimeCall>
+ From<frame_system::Call<Self>>;

/// Because this pallet emits events, it depends on the runtime's definition of an event.
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;

/// A sudo-able call.
type SudoRuntimeCall: Parameter
+ UnfilteredDispatchable<RuntimeOrigin = Self::RuntimeOrigin>
Expand Down
Loading
Loading