Skip to content

Commit

Permalink
Add BEEFY keys to kitchensink testing config
Browse files Browse the repository at this point in the history
  • Loading branch information
serban300 committed Jan 5, 2024
1 parent ddcb95a commit c09d365
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
12 changes: 4 additions & 8 deletions substrate/bin/node/testing/src/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use kitchensink_runtime::{
GrandpaConfig, IndicesConfig, RuntimeGenesisConfig, SessionConfig, SocietyConfig, StakerStatus,
StakingConfig, BABE_GENESIS_EPOCH_CONFIG,
};
use sp_keyring::{Ed25519Keyring, Sr25519Keyring};
use sp_keyring::Ed25519Keyring;
use sp_runtime::Perbill;

/// Create genesis runtime configuration for tests.
Expand Down Expand Up @@ -52,13 +52,9 @@ pub fn config_endowed(extra_endowed: Vec<AccountId>) -> RuntimeGenesisConfig {
balances: BalancesConfig { balances: endowed },
session: SessionConfig {
keys: vec![
(alice(), dave(), to_session_keys(&Ed25519Keyring::Alice, &Sr25519Keyring::Alice)),
(bob(), eve(), to_session_keys(&Ed25519Keyring::Bob, &Sr25519Keyring::Bob)),
(
charlie(),
ferdie(),
to_session_keys(&Ed25519Keyring::Charlie, &Sr25519Keyring::Charlie),
),
(alice(), dave(), session_keys_from_seed(Ed25519Keyring::Alice.into())),
(bob(), eve(), session_keys_from_seed(Ed25519Keyring::Bob.into())),
(charlie(), ferdie(), session_keys_from_seed(Ed25519Keyring::Charlie.into())),
],
},
staking: StakingConfig {
Expand Down
20 changes: 10 additions & 10 deletions substrate/bin/node/testing/src/keyring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@

use codec::Encode;
use kitchensink_runtime::{CheckedExtrinsic, SessionKeys, SignedExtra, UncheckedExtrinsic};
use node_cli::chain_spec::get_from_seed;
use node_primitives::{AccountId, Balance, Nonce};
use sp_keyring::{AccountKeyring, Ed25519Keyring, Sr25519Keyring};
use sp_core::{ecdsa, ed25519, sr25519};
use sp_keyring::AccountKeyring;
use sp_runtime::generic::Era;

/// Alice's account id.
Expand Down Expand Up @@ -55,16 +57,14 @@ pub fn ferdie() -> AccountId {
}

/// Convert keyrings into `SessionKeys`.
pub fn to_session_keys(
ed25519_keyring: &Ed25519Keyring,
sr25519_keyring: &Sr25519Keyring,
) -> SessionKeys {
pub fn session_keys_from_seed(seed: &str) -> SessionKeys {
SessionKeys {
grandpa: ed25519_keyring.to_owned().public().into(),
babe: sr25519_keyring.to_owned().public().into(),
im_online: sr25519_keyring.to_owned().public().into(),
authority_discovery: sr25519_keyring.to_owned().public().into(),
mixnet: sr25519_keyring.to_owned().public().into(),
grandpa: get_from_seed::<ed25519::Public>(seed).into(),
babe: get_from_seed::<sr25519::Public>(seed).into(),
im_online: get_from_seed::<sr25519::Public>(seed).into(),
authority_discovery: get_from_seed::<sr25519::Public>(seed).into(),
mixnet: get_from_seed::<sr25519::Public>(seed).into(),
beefy: get_from_seed::<ecdsa::Public>(seed).into(),
}
}

Expand Down

0 comments on commit c09d365

Please sign in to comment.