Skip to content

Commit 9963ac7

Browse files
committed
Integrate pallet-fixed-validators-set into humanode-runtime
1 parent 86f5c20 commit 9963ac7

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/humanode-runtime/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ pallet-ethereum-chain-id = { path = "../pallet-ethereum-chain-id", default-featu
3030
pallet-evm-accounts-mapping = { path = "../pallet-evm-accounts-mapping", default-features = false }
3131
pallet-evm-balances = { path = "../pallet-evm-balances", default-features = false }
3232
pallet-evm-system = { path = "../pallet-evm-system", default-features = false }
33+
pallet-fixed-validators-set = { path = "../pallet-fixed-validators-set", default-features = false }
3334
pallet-humanode-offences = { path = "../pallet-humanode-offences", default-features = false }
3435
pallet-humanode-session = { path = "../pallet-humanode-session", default-features = false }
3536
pallet-native-to-evm-swap = { path = "../pallet-native-to-evm-swap", default-features = false }
@@ -128,6 +129,7 @@ runtime-benchmarks = [
128129
"pallet-ethereum/runtime-benchmarks",
129130
"pallet-evm-accounts-mapping/runtime-benchmarks",
130131
"pallet-evm/runtime-benchmarks",
132+
"pallet-fixed-validators-set/runtime-benchmarks",
131133
"pallet-grandpa/runtime-benchmarks",
132134
"pallet-humanode-session/runtime-benchmarks",
133135
"pallet-im-online/runtime-benchmarks",
@@ -187,6 +189,7 @@ std = [
187189
"pallet-evm/std",
188190
"pallet-evm-balances/std",
189191
"pallet-evm-system/std",
192+
"pallet-fixed-validators-set/std",
190193
"pallet-grandpa/std",
191194
"pallet-humanode-offences/std",
192195
"pallet-humanode-session/std",
@@ -259,6 +262,7 @@ try-runtime = [
259262
"pallet-evm/try-runtime",
260263
"pallet-evm-balances/try-runtime",
261264
"pallet-evm-system/try-runtime",
265+
"pallet-fixed-validators-set/try-runtime",
262266
"pallet-grandpa/try-runtime",
263267
"pallet-humanode-offences/try-runtime",
264268
"pallet-humanode-session/try-runtime",

crates/humanode-runtime/src/benchmarking.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,15 @@ impl pallet_vesting::benchmarking::SchedulingDriver for vesting::SchedulingDrive
205205
}
206206
}
207207

208+
impl pallet_fixed_validators_set::benchmarking::Interface for Runtime {
209+
fn provide_validator_id(
210+
account_index: u32,
211+
) -> <Self as pallet_fixed_validators_set::Config>::ValidatorId {
212+
let account_index_bytes = account_index.to_le_bytes();
213+
AccountId::new(keccak_256(&account_index_bytes))
214+
}
215+
}
216+
208217
impl pallet_humanode_session::benchmarking::Interface for Runtime {
209218
fn provide_account_id(account_index: u32) -> <Self as frame_system::Config>::AccountId {
210219
let account_index_bytes = account_index.to_le_bytes();

crates/humanode-runtime/src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,11 +563,21 @@ impl pallet_bootnodes::Config for Runtime {
563563
type MaxBootnodes = ConstU32<16>;
564564
}
565565

566+
impl pallet_fixed_validators_set::Config for Runtime {
567+
type RuntimeEvent = RuntimeEvent;
568+
type ValidatorId = AccountId;
569+
type MaxValidators = ConstU32<MAX_AUTHENTICATIONS>; /* same amount in theory */
570+
type WeightInfo = weights::pallet_fixed_validators_set::WeightInfo<Runtime>;
571+
}
572+
566573
impl pallet_humanode_session::Config for Runtime {
567574
type ValidatorPublicKeyOf = IdentityValidatorIdOf;
568575
type BootnodeIdOf = sp_runtime::traits::Identity;
576+
type FixedValidatorsSetIdOf = sp_runtime::traits::Identity;
569577
type MaxBootnodeValidators = <Runtime as pallet_bootnodes::Config>::MaxBootnodes;
570578
type MaxBioauthValidators = <Runtime as pallet_bioauth::Config>::MaxAuthentications;
579+
type MaxFixedValidatorsSetValidators =
580+
<Runtime as pallet_fixed_validators_set::Config>::MaxValidators;
571581
type MaxBannedAccounts = <Runtime as pallet_bioauth::Config>::MaxAuthentications;
572582
type WeightInfo = weights::pallet_humanode_session::WeightInfo<Runtime>;
573583
}
@@ -855,6 +865,7 @@ construct_runtime!(
855865
DummyPrecompilesCode: pallet_dummy_precompiles_code = 38,
856866
HumanodeOffences: pallet_humanode_offences = 39,
857867
NativeToEvmSwap: pallet_native_to_evm_swap = 40,
868+
FixedValidatorsSet: pallet_fixed_validators_set = 41,
858869
}
859870
);
860871

0 commit comments

Comments
 (0)