Update node to use pallet sessions

This commit is contained in:
Luke Parker
2022-10-27 05:23:53 -04:00
parent 49ab26209d
commit fa7a03bf60
6 changed files with 94 additions and 16 deletions

View File

@@ -16,6 +16,7 @@ clap = { version = "4", features = ["derive"] }
jsonrpsee = { version = "0.15", features = ["server"] }
sp-core = { git = "https://github.com/serai-dex/substrate" }
sp-application-crypto = { git = "https://github.com/serai-dex/substrate" }
sp-runtime = { git = "https://github.com/serai-dex/substrate" }
sp-timestamp = { git = "https://github.com/serai-dex/substrate" }
sp-inherents = { git = "https://github.com/serai-dex/substrate" }
@@ -46,6 +47,7 @@ sc-rpc-api = { git = "https://github.com/serai-dex/substrate" }
substrate-frame-rpc-system = { git = "https://github.com/serai-dex/substrate" }
pallet-transaction-payment-rpc = { git = "https://github.com/serai-dex/substrate" }
pallet-tendermint = { path = "../pallet-tendermint", default-features = false }
serai-runtime = { path = "../runtime" }
serai-consensus = { path = "../consensus" }

View File

@@ -1,8 +1,12 @@
use sc_service::ChainType;
use sp_core::{Pair as PairTrait, sr25519::Pair};
use pallet_tendermint::crypto::Public;
use serai_runtime::{WASM_BINARY, AccountId, GenesisConfig, SystemConfig, BalancesConfig};
use serai_runtime::{
WASM_BINARY, AccountId, opaque::SessionKeys, GenesisConfig, SystemConfig, BalancesConfig,
SessionConfig,
};
pub type ChainSpec = sc_service::GenericChainSpec<GenesisConfig>;
@@ -15,12 +19,16 @@ fn account_id_from_name(name: &'static str) -> AccountId {
}
fn testnet_genesis(wasm_binary: &[u8], endowed_accounts: Vec<AccountId>) -> GenesisConfig {
let alice = account_id_from_name("Alice");
GenesisConfig {
system: SystemConfig { code: wasm_binary.to_vec() },
balances: BalancesConfig {
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(),
},
transaction_payment: Default::default(),
session: SessionConfig {
keys: vec![(alice, alice, SessionKeys { tendermint: Public::from(alice) })],
},
}
}