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

@@ -23,6 +23,7 @@ sp-std = { git = "https://github.com/serai-dex/substrate", default-features = fa
sp-version = { git = "https://github.com/serai-dex/substrate", default-features = false }
sp-inherents = { git = "https://github.com/serai-dex/substrate", default-features = false }
sp-offchain = { git = "https://github.com/serai-dex/substrate", default-features = false }
sp-session = { git = "https://github.com/serai-dex/substrate", default-features = false }
sp-transaction-pool = { git = "https://github.com/serai-dex/substrate", default-features = false }
sp-block-builder = { git = "https://github.com/serai-dex/substrate", default-features = false}
sp-runtime = { git = "https://github.com/serai-dex/substrate", default-features = false }
@@ -61,6 +62,7 @@ std = [
"sp-version/std",
"sp-inherents/std",
"sp-offchain/std",
"sp-session/std",
"sp-transaction-pool/std",
"sp-block-builder/std",
"sp-runtime/std",

View File

@@ -7,7 +7,7 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
use sp_core::OpaqueMetadata;
pub use sp_core::sr25519::{Public, Signature};
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
create_runtime_str, generic, impl_opaque_keys, KeyTypeId,
traits::{Convert, OpaqueKeys, IdentityLookup, BlakeTwo256, Block as BlockT},
transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult, Perbill,
@@ -349,6 +349,18 @@ sp_api::impl_runtime_apis! {
}
}
impl sp_session::SessionKeys<Block> for Runtime {
fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
opaque::SessionKeys::generate(seed)
}
fn decode_session_keys(
encoded: Vec<u8>,
) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {
opaque::SessionKeys::decode_into_raw_public_keys(&encoded)
}
}
impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {
fn account_nonce(account: AccountId) -> Index {
System::account_nonce(account)