Skip to content

Commit 7b5e270

Browse files
authored
fix: benchmark configuration runtime (#850)
1 parent d980556 commit 7b5e270

File tree

2 files changed

+37
-13
lines changed
  • runtimes

2 files changed

+37
-13
lines changed

runtimes/peregrine/src/kilt/did/mod.rs

+18-6
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,14 @@ use did::{
2323
};
2424
use frame_system::EnsureRoot;
2525
use runtime_common::{
26-
constants,
27-
dot_names::{AllowedDotNameClaimer, AllowedUniqueLinkingAssociator},
28-
AccountId, DidIdentifier, EnsureNoLinkedAccountDeletionHook, EnsureNoLinkedWeb3NameDeletionHook,
26+
constants, AccountId, DidIdentifier, EnsureNoLinkedAccountDeletionHook, EnsureNoLinkedWeb3NameDeletionHook,
2927
SendDustAndFeesToTreasury,
3028
};
3129
use sp_core::ConstBool;
3230

3331
use crate::{
3432
weights::{self, rocksdb_weights::constants::RocksDbWeight},
35-
Balances, DotNames, Migration, Runtime, RuntimeCall, RuntimeEvent, RuntimeHoldReason, RuntimeOrigin, UniqueLinking,
33+
Balances, Migration, Runtime, RuntimeCall, RuntimeEvent, RuntimeHoldReason, RuntimeOrigin,
3634
};
3735

3836
#[cfg(test)]
@@ -198,7 +196,15 @@ impl pallet_did_lookup::Config for Runtime {
198196

199197
pub(crate) type UniqueLinkingDeployment = pallet_did_lookup::Instance2;
200198
impl pallet_did_lookup::Config<UniqueLinkingDeployment> for Runtime {
201-
type AssociateOrigin = EnsureDidOrigin<DidIdentifier, AccountId, AllowedUniqueLinkingAssociator<UniqueLinking>>;
199+
#[cfg(not(feature = "runtime-benchmarks"))]
200+
type AssociateOrigin = EnsureDidOrigin<
201+
DidIdentifier,
202+
AccountId,
203+
runtime_common::dot_names::AllowedUniqueLinkingAssociator<crate::UniqueLinking>,
204+
>;
205+
#[cfg(feature = "runtime-benchmarks")]
206+
type AssociateOrigin = EnsureDidOrigin<DidIdentifier, AccountId, did::origin::Everyone>;
207+
202208
type BalanceMigrationManager = ();
203209
type Currency = Balances;
204210
type Deposit = constants::did_lookup::DidLookupDeposit;
@@ -238,7 +244,13 @@ pub(crate) type DotNamesDeployment = pallet_web3_names::Instance2;
238244
impl pallet_web3_names::Config<DotNamesDeployment> for Runtime {
239245
type BalanceMigrationManager = ();
240246
type BanOrigin = EnsureRoot<AccountId>;
241-
type ClaimOrigin = EnsureDidOrigin<DidIdentifier, AccountId, AllowedDotNameClaimer<DotNames>>;
247+
248+
#[cfg(not(feature = "runtime-benchmarks"))]
249+
type ClaimOrigin =
250+
EnsureDidOrigin<DidIdentifier, AccountId, runtime_common::dot_names::AllowedDotNameClaimer<crate::DotNames>>;
251+
#[cfg(feature = "runtime-benchmarks")]
252+
type ClaimOrigin = EnsureDidOrigin<DidIdentifier, AccountId, did::origin::Everyone>;
253+
242254
type Currency = Balances;
243255
type Deposit = constants::dot_names::Web3NameDeposit;
244256
type MaxNameLength = constants::dot_names::MaxNameLength;

runtimes/spiritnet/src/kilt/did/mod.rs

+19-7
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,14 @@ use did::{
2323
};
2424
use frame_system::EnsureRoot;
2525
use runtime_common::{
26-
constants,
27-
did::EnsureNoLinkedAccountDeletionHook,
28-
dot_names::{AllowedDotNameClaimer, AllowedUniqueLinkingAssociator},
29-
AccountId, DidIdentifier, EnsureNoLinkedWeb3NameDeletionHook, SendDustAndFeesToTreasury,
26+
constants, did::EnsureNoLinkedAccountDeletionHook, AccountId, DidIdentifier, EnsureNoLinkedWeb3NameDeletionHook,
27+
SendDustAndFeesToTreasury,
3028
};
3129
use sp_core::ConstBool;
3230

3331
use crate::{
3432
weights::{self, rocksdb_weights::constants::RocksDbWeight},
35-
Balances, DotNames, Migration, Runtime, RuntimeCall, RuntimeEvent, RuntimeHoldReason, RuntimeOrigin, UniqueLinking,
33+
Balances, Migration, Runtime, RuntimeCall, RuntimeEvent, RuntimeHoldReason, RuntimeOrigin,
3634
};
3735

3836
#[cfg(test)]
@@ -198,7 +196,15 @@ impl pallet_did_lookup::Config for Runtime {
198196

199197
pub(crate) type UniqueLinkingDeployment = pallet_did_lookup::Instance2;
200198
impl pallet_did_lookup::Config<UniqueLinkingDeployment> for Runtime {
201-
type AssociateOrigin = EnsureDidOrigin<DidIdentifier, AccountId, AllowedUniqueLinkingAssociator<UniqueLinking>>;
199+
#[cfg(not(feature = "runtime-benchmarks"))]
200+
type AssociateOrigin = EnsureDidOrigin<
201+
DidIdentifier,
202+
AccountId,
203+
runtime_common::dot_names::AllowedUniqueLinkingAssociator<crate::UniqueLinking>,
204+
>;
205+
#[cfg(feature = "runtime-benchmarks")]
206+
type AssociateOrigin = EnsureDidOrigin<DidIdentifier, AccountId, did::origin::Everyone>;
207+
202208
type BalanceMigrationManager = ();
203209
type Currency = Balances;
204210
type Deposit = constants::did_lookup::DidLookupDeposit;
@@ -238,7 +244,13 @@ pub(crate) type DotNamesDeployment = pallet_web3_names::Instance2;
238244
impl pallet_web3_names::Config<DotNamesDeployment> for Runtime {
239245
type BalanceMigrationManager = ();
240246
type BanOrigin = EnsureRoot<AccountId>;
241-
type ClaimOrigin = EnsureDidOrigin<DidIdentifier, AccountId, AllowedDotNameClaimer<DotNames>>;
247+
248+
#[cfg(not(feature = "runtime-benchmarks"))]
249+
type ClaimOrigin =
250+
EnsureDidOrigin<DidIdentifier, AccountId, runtime_common::dot_names::AllowedDotNameClaimer<crate::DotNames>>;
251+
#[cfg(feature = "runtime-benchmarks")]
252+
type ClaimOrigin = EnsureDidOrigin<DidIdentifier, AccountId, did::origin::Everyone>;
253+
242254
type Currency = Balances;
243255
type Deposit = constants::dot_names::Web3NameDeposit;
244256
type MaxNameLength = constants::dot_names::MaxNameLength;

0 commit comments

Comments
 (0)