Add Transaction Fee RPC to Statemint/Statemine (#559)

* add payment rpc to parachains

* connect payment rpc to parachains clients

* fix the rumtime_api bound/ add separate start node implementation for shell

* use cumulus/parachain specific primitives

* Update polkadot-parachains/src/rpc.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* rename txpool dependency

* fix the package name

* move parachain primitives to separate module

* Refactor Shared Primitves for Payment Info (#577)

* rename to parachains-common

* refactor shared opaque

* remove primitives

* Update service.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
hamidra
2021-08-17 09:55:56 -07:00
committed by GitHub
parent 2a519e01cb
commit 0436b76f93
18 changed files with 560 additions and 261 deletions
+4 -1
View File
@@ -28,7 +28,7 @@ shell-runtime = { path = "shell" }
statemint-runtime = { path = "statemint" }
statemine-runtime = { path = "statemine" }
westmint-runtime = { path = "westmint" }
statemint-common = { path = "statemint-common" }
parachains-common = { path = "parachains-common" }
# Substrate dependencies
frame-benchmarking = { git = 'https://github.com/paritytech/substrate', branch = "master" }
@@ -64,6 +64,9 @@ substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate
# RPC related dependencies
jsonrpc-core = "15.1.0"
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
frame-rpc-system = { package = "substrate-frame-rpc-system", git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
# Cumulus dependencies
cumulus-client-cli = { path = "../client/cli" }
@@ -1,9 +1,9 @@
[package]
name = "statemint-common"
name = "parachains-common"
version = "1.0.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
description = "Logic which is common to all Statemint variant runtimes"
description = "Logic which is common to all parachain runtimes"
[package.metadata.docs.rs]
targets = ['x86_64-unknown-linux-gnu']
@@ -13,12 +13,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//! Auxillary struct/enums for Statemint runtime.
//! Taken from polkadot/runtime/common (at a21cd64) and adapted for Statemint.
//! Auxillary struct/enums for parachain runtimes.
//! Taken from polkadot/runtime/common (at a21cd64) and adapted for parachains.
use frame_support::traits::{Currency, Imbalance, OnUnbalanced};
pub type NegativeImbalance<T> = <pallet_balances::Pallet<T> as Currency<<T as frame_system::Config>::AccountId>>::NegativeImbalance;
pub type NegativeImbalance<T> = <pallet_balances::Pallet<T> as Currency<
<T as frame_system::Config>::AccountId,
>>::NegativeImbalance;
/// Logic for the author to get a portion of fees.
pub struct ToStakingPot<R>(sp_std::marker::PhantomData<R>);
@@ -32,10 +34,7 @@ where
fn on_nonzero_unbalanced(amount: NegativeImbalance<R>) {
let numeric_amount = amount.peek();
let staking_pot = <pallet_collator_selection::Pallet<R>>::account_id();
<pallet_balances::Pallet<R>>::resolve_creating(
&staking_pot,
amount,
);
<pallet_balances::Pallet<R>>::resolve_creating(&staking_pot, amount);
<frame_system::Pallet<R>>::deposit_event(pallet_balances::Event::Deposit(
staking_pot,
numeric_amount,
@@ -64,9 +63,13 @@ where
#[cfg(test)]
mod tests {
use super::*;
use frame_support::traits::FindAuthor;
use frame_support::{parameter_types, PalletId, traits::ValidatorRegistration};
use frame_support::{
parameter_types,
traits::{FindAuthor, ValidatorRegistration},
PalletId,
};
use frame_system::{limits, EnsureRoot};
use pallet_collator_selection::IdentityCollator;
use polkadot_primitives::v1::AccountId;
use sp_core::H256;
use sp_runtime::{
@@ -74,7 +77,6 @@ mod tests {
traits::{BlakeTwo256, IdentityLookup},
Perbill,
};
use pallet_collator_selection::IdentityCollator;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
type Block = frame_system::mocking::MockBlock<Test>;
@@ -16,12 +16,12 @@
#![cfg_attr(not(feature = "std"), no_std)]
pub mod impls;
pub use types::*;
pub use constants::*;
/// Common types of statemint and statemine.
pub use opaque::*;
pub use types::*;
/// Common types of parachains.
mod types {
use sp_runtime::traits::{Verify, IdentifyAccount, BlakeTwo256};
use sp_runtime::traits::{IdentifyAccount, Verify};
/// An index to a block.
pub type BlockNumber = u32;
@@ -46,21 +46,18 @@ mod types {
/// A hash of some data used by the chain.
pub type Hash = sp_core::H256;
/// Block header type as expected by this runtime.
pub type Header = sp_runtime::generic::Header<BlockNumber, BlakeTwo256>;
/// Digest item type.
pub type DigestItem = sp_runtime::generic::DigestItem<Hash>;
// Aura consensus authority.
pub type AuraId = sp_consensus_aura::sr25519::AuthorityId;
}
/// Common constants of statemint and statemine
/// Common constants of parachains.
mod constants {
use super::types::BlockNumber;
use frame_support::weights::{constants::WEIGHT_PER_SECOND, Weight};
use sp_runtime::Perbill;
use frame_support::weights::{Weight, constants::WEIGHT_PER_SECOND};
/// This determines the average expected block time that we are targeting. Blocks will be
/// produced at a minimum duration defined by `SLOT_DURATION`. `SLOT_DURATION` is picked up by
/// `pallet_timestamp` which is in turn picked up by `pallet_aura` to implement `fn
@@ -85,3 +82,20 @@ mod constants {
/// We allow for 0.5 seconds of compute with a 6 second average block time.
pub const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND / 2;
}
/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
/// the specifics of the runtime. They can then be made to be agnostic over specific formats
/// of data like extrinsics, allowing for them to continue syncing the network through upgrades
/// to even the core data structures.
pub mod opaque {
use super::*;
use sp_runtime::{generic, traits::BlakeTwo256};
pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic;
/// Opaque block header type.
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
/// Opaque block type.
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
/// Opaque block identifier type.
pub type BlockId = generic::BlockId<Block>;
}
@@ -28,6 +28,7 @@ sp-consensus-aura = { git = "https://github.com/paritytech/substrate", default-f
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
pallet-assets = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
@@ -35,6 +36,7 @@ pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-fe
pallet-sudo = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
pallet-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
# Cumulus dependencies
cumulus-pallet-aura-ext = { path = "../../pallets/aura-ext", default-features = false }
@@ -590,6 +590,27 @@ impl_runtime_apis! {
}
}
impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {
fn account_nonce(account: AccountId) -> Index {
System::account_nonce(account)
}
}
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {
fn query_info(
uxt: <Block as BlockT>::Extrinsic,
len: u32,
) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo<Balance> {
TransactionPayment::query_info(uxt, len)
}
fn query_fee_details(
uxt: <Block as BlockT>::Extrinsic,
len: u32,
) -> pallet_transaction_payment::FeeDetails<Balance> {
TransactionPayment::query_fee_details(uxt, len)
}
}
impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
fn collect_collation_info() -> cumulus_primitives_core::CollationInfo {
ParachainSystem::collect_collation_info()
+139 -101
View File
@@ -24,7 +24,8 @@ use sp_core::{crypto::UncheckedInto, sr25519, Pair, Public};
use sp_runtime::traits::{IdentifyAccount, Verify};
/// Specialized `ChainSpec` for the normal parachain runtime.
pub type ChainSpec = sc_service::GenericChainSpec<rococo_parachain_runtime::GenesisConfig, Extensions>;
pub type ChainSpec =
sc_service::GenericChainSpec<rococo_parachain_runtime::GenesisConfig, Extensions>;
/// Specialized `ChainSpec` for the shell parachain runtime.
pub type ShellChainSpec = sc_service::GenericChainSpec<shell_runtime::GenesisConfig, Extensions>;
@@ -56,7 +57,8 @@ impl Extensions {
type AccountPublic = <Signature as Verify>::Signer;
/// Helper function to generate an account ID from seed
pub fn get_account_id_from_seed<TPublic: Public>(seed: &str) -> AccountId where
pub fn get_account_id_from_seed<TPublic: Public>(seed: &str) -> AccountId
where
AccountPublic: From<<TPublic::Pair as Pair>::Public>,
{
AccountPublic::from(get_from_seed::<TPublic>(seed)).into_account()
@@ -195,12 +197,15 @@ fn shell_testnet_genesis(parachain_id: ParaId) -> shell_runtime::GenesisConfig {
}
}
use statemint_common::Balance as StatemintBalance;
use parachains_common::Balance as StatemintBalance;
/// Specialized `ChainSpec` for the normal parachain runtime.
pub type StatemintChainSpec = sc_service::GenericChainSpec<statemint_runtime::GenesisConfig, Extensions>;
pub type StatemineChainSpec = sc_service::GenericChainSpec<statemine_runtime::GenesisConfig, Extensions>;
pub type WestmintChainSpec = sc_service::GenericChainSpec<westmint_runtime::GenesisConfig, Extensions>;
pub type StatemintChainSpec =
sc_service::GenericChainSpec<statemint_runtime::GenesisConfig, Extensions>;
pub type StatemineChainSpec =
sc_service::GenericChainSpec<statemine_runtime::GenesisConfig, Extensions>;
pub type WestmintChainSpec =
sc_service::GenericChainSpec<westmint_runtime::GenesisConfig, Extensions>;
const STATEMINT_ED: StatemintBalance = statemint_runtime::constants::currency::EXISTENTIAL_DEPOSIT;
const STATEMINE_ED: StatemintBalance = statemine_runtime::constants::currency::EXISTENTIAL_DEPOSIT;
@@ -223,22 +228,22 @@ pub fn get_collator_keys_from_seed(seed: &str) -> AuraId {
/// Generate the session keys from individual elements.
///
/// The input must be a tuple of individual keys (a single arg for now since we have just one key).
pub fn statemint_session_keys(keys: AuraId) -> statemint_runtime::opaque::SessionKeys {
statemint_runtime::opaque::SessionKeys { aura: keys }
pub fn statemint_session_keys(keys: AuraId) -> statemint_runtime::SessionKeys {
statemint_runtime::SessionKeys { aura: keys }
}
/// Generate the session keys from individual elements.
///
/// The input must be a tuple of individual keys (a single arg for now since we have just one key).
pub fn statemine_session_keys(keys: AuraId) -> statemine_runtime::opaque::SessionKeys {
statemine_runtime::opaque::SessionKeys { aura: keys }
pub fn statemine_session_keys(keys: AuraId) -> statemine_runtime::SessionKeys {
statemine_runtime::SessionKeys { aura: keys }
}
/// Generate the session keys from individual elements.
///
/// The input must be a tuple of individual keys (a single arg for now since we have just one key).
pub fn westmint_session_keys(keys: AuraId) -> westmint_runtime::opaque::SessionKeys {
westmint_runtime::opaque::SessionKeys { aura: keys }
pub fn westmint_session_keys(keys: AuraId) -> westmint_runtime::SessionKeys {
westmint_runtime::SessionKeys { aura: keys }
}
pub fn statemint_development_config(id: ParaId) -> StatemintChainSpec {
@@ -255,12 +260,10 @@ pub fn statemint_development_config(id: ParaId) -> StatemintChainSpec {
move || {
statemint_genesis(
// initial collators.
vec![
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_collator_keys_from_seed("Alice"),
)
],
vec![(
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_collator_keys_from_seed("Alice"),
)],
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
@@ -295,14 +298,15 @@ pub fn statemint_local_config(id: ParaId) -> StatemintChainSpec {
move || {
statemint_genesis(
// initial collators.
vec![(
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_collator_keys_from_seed("Alice")
),
(
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_collator_keys_from_seed("Bob")
),
vec![
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_collator_keys_from_seed("Alice"),
),
(
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_collator_keys_from_seed("Bob"),
),
],
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
@@ -358,11 +362,17 @@ fn statemint_genesis(
..Default::default()
},
session: statemint_runtime::SessionConfig {
keys: invulnerables.iter().cloned().map(|(acc, aura)| (
acc.clone(), // account id
acc.clone(), // validator id
statemint_session_keys(aura), // session keys
)).collect()
keys: invulnerables
.iter()
.cloned()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc.clone(), // validator id
statemint_session_keys(aura), // session keys
)
})
.collect(),
},
// no need to pass anything to aura, in fact it will panic if we do. Session will take care
// of this.
@@ -386,12 +396,10 @@ pub fn statemine_development_config(id: ParaId) -> StatemineChainSpec {
move || {
statemine_genesis(
// initial collators.
vec![
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_collator_keys_from_seed("Alice"),
)
],
vec![(
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_collator_keys_from_seed("Alice"),
)],
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
@@ -426,14 +434,15 @@ pub fn statemine_local_config(id: ParaId) -> StatemineChainSpec {
move || {
statemine_genesis(
// initial collators.
vec![(
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_collator_keys_from_seed("Alice")
),
(
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_collator_keys_from_seed("Bob")
),
vec![
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_collator_keys_from_seed("Alice"),
),
(
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_collator_keys_from_seed("Bob"),
),
],
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
@@ -477,22 +486,31 @@ pub fn statemine_config(id: ParaId) -> StatemineChainSpec {
move || {
statemine_genesis(
// initial collators.
vec![(
hex!("50673d59020488a4ffc9d8c6de3062a65977046e6990915617f85fef6d349730").into(),
hex!("50673d59020488a4ffc9d8c6de3062a65977046e6990915617f85fef6d349730").unchecked_into()
),
(
hex!("fe8102dbc244e7ea2babd9f53236d67403b046154370da5c3ea99def0bd0747a").into(),
hex!("fe8102dbc244e7ea2babd9f53236d67403b046154370da5c3ea99def0bd0747a").unchecked_into()
),
(
hex!("38144b5398e5d0da5ec936a3af23f5a96e782f676ab19d45f29075ee92eca76a").into(),
hex!("38144b5398e5d0da5ec936a3af23f5a96e782f676ab19d45f29075ee92eca76a").unchecked_into()
),
(
hex!("3253947640e309120ae70fa458dcacb915e2ddd78f930f52bd3679ec63fc4415").into(),
hex!("3253947640e309120ae70fa458dcacb915e2ddd78f930f52bd3679ec63fc4415").unchecked_into()
),
vec![
(
hex!("50673d59020488a4ffc9d8c6de3062a65977046e6990915617f85fef6d349730")
.into(),
hex!("50673d59020488a4ffc9d8c6de3062a65977046e6990915617f85fef6d349730")
.unchecked_into(),
),
(
hex!("fe8102dbc244e7ea2babd9f53236d67403b046154370da5c3ea99def0bd0747a")
.into(),
hex!("fe8102dbc244e7ea2babd9f53236d67403b046154370da5c3ea99def0bd0747a")
.unchecked_into(),
),
(
hex!("38144b5398e5d0da5ec936a3af23f5a96e782f676ab19d45f29075ee92eca76a")
.into(),
hex!("38144b5398e5d0da5ec936a3af23f5a96e782f676ab19d45f29075ee92eca76a")
.unchecked_into(),
),
(
hex!("3253947640e309120ae70fa458dcacb915e2ddd78f930f52bd3679ec63fc4415")
.into(),
hex!("3253947640e309120ae70fa458dcacb915e2ddd78f930f52bd3679ec63fc4415")
.unchecked_into(),
),
],
vec![],
id,
@@ -535,11 +553,17 @@ fn statemine_genesis(
..Default::default()
},
session: statemine_runtime::SessionConfig {
keys: invulnerables.iter().cloned().map(|(acc, aura)| (
acc.clone(), // account id
acc.clone(), // validator id
statemine_session_keys(aura), // session keys
)).collect()
keys: invulnerables
.iter()
.cloned()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc.clone(), // validator id
statemine_session_keys(aura), // session keys
)
})
.collect(),
},
aura: Default::default(),
aura_ext: Default::default(),
@@ -561,12 +585,10 @@ pub fn westmint_development_config(id: ParaId) -> WestmintChainSpec {
move || {
westmint_genesis(
// initial collators.
vec![
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_collator_keys_from_seed("Alice"),
)
],
vec![(
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_collator_keys_from_seed("Alice"),
)],
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
@@ -602,14 +624,15 @@ pub fn westmint_local_config(id: ParaId) -> WestmintChainSpec {
move || {
westmint_genesis(
// initial collators.
vec![(
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_collator_keys_from_seed("Alice")
),
(
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_collator_keys_from_seed("Bob")
),
vec![
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_collator_keys_from_seed("Alice"),
),
(
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_collator_keys_from_seed("Bob"),
),
],
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
@@ -654,22 +677,31 @@ pub fn westmint_config(id: ParaId) -> WestmintChainSpec {
move || {
westmint_genesis(
// initial collators.
vec![(
hex!("9cfd429fa002114f33c1d3e211501d62830c9868228eb3b4b8ae15a83de04325").into(),
hex!("9cfd429fa002114f33c1d3e211501d62830c9868228eb3b4b8ae15a83de04325").unchecked_into()
),
(
hex!("12a03fb4e7bda6c9a07ec0a11d03c24746943e054ff0bb04938970104c783876").into(),
hex!("12a03fb4e7bda6c9a07ec0a11d03c24746943e054ff0bb04938970104c783876").unchecked_into()
),
(
hex!("1256436307dfde969324e95b8c62cb9101f520a39435e6af0f7ac07b34e1931f").into(),
hex!("1256436307dfde969324e95b8c62cb9101f520a39435e6af0f7ac07b34e1931f").unchecked_into()
),
(
hex!("98102b7bca3f070f9aa19f58feed2c0a4e107d203396028ec17a47e1ed80e322").into(),
hex!("98102b7bca3f070f9aa19f58feed2c0a4e107d203396028ec17a47e1ed80e322").unchecked_into()
),
vec![
(
hex!("9cfd429fa002114f33c1d3e211501d62830c9868228eb3b4b8ae15a83de04325")
.into(),
hex!("9cfd429fa002114f33c1d3e211501d62830c9868228eb3b4b8ae15a83de04325")
.unchecked_into(),
),
(
hex!("12a03fb4e7bda6c9a07ec0a11d03c24746943e054ff0bb04938970104c783876")
.into(),
hex!("12a03fb4e7bda6c9a07ec0a11d03c24746943e054ff0bb04938970104c783876")
.unchecked_into(),
),
(
hex!("1256436307dfde969324e95b8c62cb9101f520a39435e6af0f7ac07b34e1931f")
.into(),
hex!("1256436307dfde969324e95b8c62cb9101f520a39435e6af0f7ac07b34e1931f")
.unchecked_into(),
),
(
hex!("98102b7bca3f070f9aa19f58feed2c0a4e107d203396028ec17a47e1ed80e322")
.into(),
hex!("98102b7bca3f070f9aa19f58feed2c0a4e107d203396028ec17a47e1ed80e322")
.unchecked_into(),
),
],
vec![],
// re-use the Westend sudo key
@@ -716,11 +748,17 @@ fn westmint_genesis(
..Default::default()
},
session: westmint_runtime::SessionConfig {
keys: invulnerables.iter().cloned().map(|(acc, aura)| (
acc.clone(), // account id
acc.clone(), // validator id
westmint_session_keys(aura), // session keys
)).collect()
keys: invulnerables
.iter()
.cloned()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc.clone(), // validator id
westmint_session_keys(aura), // session keys
)
})
.collect(),
},
// no need to pass anything to aura, in fact it will panic if we do. Session will take care
// of this.
+1
View File
@@ -24,6 +24,7 @@ mod chain_spec;
mod service;
mod cli;
mod command;
mod rpc;
fn main() -> sc_cli::Result<()> {
command::run()
+80
View File
@@ -0,0 +1,80 @@
// Copyright 2021 Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! Parachain-specific RPCs implementation.
#![warn(missing_docs)]
use std::sync::Arc;
use sc_client_api::AuxStore;
pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor};
use sc_transaction_pool_api::TransactionPool;
use sp_api::ProvideRuntimeApi;
use sp_block_builder::BlockBuilder;
use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
use parachains_common::{AccountId, Balance, Block, Index as Nonce};
/// A type representing all RPC extensions.
pub type RpcExtension = jsonrpc_core::IoHandler<sc_rpc::Metadata>;
/// Full client dependencies
pub struct FullDeps<C, P> {
/// The client instance to use.
pub client: Arc<C>,
/// Transaction pool instance.
pub pool: Arc<P>,
/// Whether to deny unsafe calls
pub deny_unsafe: DenyUnsafe,
}
/// Instantiate all RPC extensions.
pub fn create_full<C, P>(deps: FullDeps<C, P>) -> RpcExtension
where
C: ProvideRuntimeApi<Block>
+ HeaderBackend<Block>
+ AuxStore
+ HeaderMetadata<Block, Error = BlockChainError>
+ Send
+ Sync
+ 'static,
C::Api: frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
C::Api: BlockBuilder<Block>,
P: TransactionPool + Sync + Send + 'static,
{
use frame_rpc_system::{FullSystem, SystemApi};
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
let mut io = jsonrpc_core::IoHandler::default();
let FullDeps {
client,
pool,
deny_unsafe,
} = deps;
io.extend_with(SystemApi::to_delegate(FullSystem::new(
client.clone(),
pool,
deny_unsafe,
)));
io.extend_with(TransactionPaymentApi::to_delegate(TransactionPayment::new(
client.clone(),
)));
io
}
+190 -13
View File
@@ -13,7 +13,6 @@
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
use cumulus_client_consensus_aura::{
build_aura_consensus, BuildAuraConsensusParams, SlotProportion,
};
@@ -29,6 +28,9 @@ use cumulus_primitives_core::{
ParaId,
};
use crate::rpc;
pub use parachains_common::{AccountId, Balance, Block, Hash, Header, Index as Nonce};
use cumulus_client_consensus_relay_chain::Verifier as RelayChainVerifier;
use futures::lock::Mutex;
use sc_client_api::ExecutorProvider;
@@ -37,6 +39,7 @@ use sc_consensus::{
BlockImportParams,
};
use sc_executor::native_executor_instance;
pub use sc_executor::NativeExecutor;
use sc_network::NetworkService;
use sc_service::{Configuration, PartialComponents, Role, TFullBackend, TFullClient, TaskManager};
use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};
@@ -51,13 +54,6 @@ use sp_runtime::{
use std::sync::Arc;
use substrate_prometheus_endpoint::Registry;
pub use sc_executor::NativeExecutor;
type BlockNumber = u32;
type Header = sp_runtime::generic::Header<BlockNumber, sp_runtime::traits::BlakeTwo256>;
pub type Block = sp_runtime::generic::Block<Header, sp_runtime::OpaqueExtrinsic>;
type Hash = sp_core::H256;
// Native executor instance.
native_executor_instance!(
pub RococoParachainRuntimeExecutor,
@@ -193,11 +189,11 @@ where
Ok(params)
}
/// Start a node with the given parachain `Configuration` and relay chain `Configuration`.
/// Start a shell node with the given parachain `Configuration` and relay chain `Configuration`.
///
/// This is the actual implementation that is abstract over the executor and the runtime api.
/// This is the actual implementation that is abstract over the executor and the runtime api for shell nodes.
#[sc_tracing::logging::prefix_logs_with("Parachain")]
async fn start_node_impl<RuntimeApi, Executor, RB, BIQ, BIC>(
async fn start_shell_node_impl<RuntimeApi, Executor, RB, BIQ, BIC>(
parachain_config: Configuration,
polkadot_config: Configuration,
id: ParaId,
@@ -358,6 +354,185 @@ where
Ok((task_manager, client))
}
/// Start a node with the given parachain `Configuration` and relay chain `Configuration`.
///
/// This is the actual implementation that is abstract over the executor and the runtime api.
#[sc_tracing::logging::prefix_logs_with("Parachain")]
async fn start_node_impl<RuntimeApi, Executor, RB, BIQ, BIC>(
parachain_config: Configuration,
polkadot_config: Configuration,
id: ParaId,
_rpc_ext_builder: RB,
build_import_queue: BIQ,
build_consensus: BIC,
) -> sc_service::error::Result<(TaskManager, Arc<TFullClient<Block, RuntimeApi, Executor>>)>
where
RuntimeApi: ConstructRuntimeApi<Block, TFullClient<Block, RuntimeApi, Executor>>
+ Send
+ Sync
+ 'static,
RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
+ sp_api::Metadata<Block>
+ sp_session::SessionKeys<Block>
+ sp_api::ApiExt<
Block,
StateBackend = sc_client_api::StateBackendFor<TFullBackend<Block>, Block>,
> + sp_offchain::OffchainWorkerApi<Block>
+ sp_block_builder::BlockBuilder<Block>
+ cumulus_primitives_core::CollectCollationInfo<Block>
+ pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>
+ frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
sc_client_api::StateBackendFor<TFullBackend<Block>, Block>: sp_api::StateBackend<BlakeTwo256>,
Executor: sc_executor::NativeExecutionDispatch + 'static,
RB: Fn(
Arc<TFullClient<Block, RuntimeApi, Executor>>,
) -> Result<jsonrpc_core::IoHandler<sc_rpc::Metadata>, sc_service::Error>
+ Send
+ 'static,
BIQ: FnOnce(
Arc<TFullClient<Block, RuntimeApi, Executor>>,
&Configuration,
Option<TelemetryHandle>,
&TaskManager,
) -> Result<
sc_consensus::DefaultImportQueue<Block, TFullClient<Block, RuntimeApi, Executor>>,
sc_service::Error,
> + 'static,
BIC: FnOnce(
Arc<TFullClient<Block, RuntimeApi, Executor>>,
Option<&Registry>,
Option<TelemetryHandle>,
&TaskManager,
&polkadot_service::NewFull<polkadot_service::Client>,
Arc<sc_transaction_pool::FullPool<Block, TFullClient<Block, RuntimeApi, Executor>>>,
Arc<NetworkService<Block, Hash>>,
SyncCryptoStorePtr,
bool,
) -> Result<Box<dyn ParachainConsensus<Block>>, sc_service::Error>,
{
if matches!(parachain_config.role, Role::Light) {
return Err("Light client not supported!".into());
}
let parachain_config = prepare_node_config(parachain_config);
let params = new_partial::<RuntimeApi, Executor, BIQ>(&parachain_config, build_import_queue)?;
let (mut telemetry, telemetry_worker_handle) = params.other;
let relay_chain_full_node =
cumulus_client_service::build_polkadot_full_node(polkadot_config, telemetry_worker_handle)
.map_err(|e| match e {
polkadot_service::Error::Sub(x) => x,
s => format!("{}", s).into(),
})?;
let client = params.client.clone();
let backend = params.backend.clone();
let block_announce_validator = build_block_announce_validator(
relay_chain_full_node.client.clone(),
id,
Box::new(relay_chain_full_node.network.clone()),
relay_chain_full_node.backend.clone(),
);
let force_authoring = parachain_config.force_authoring;
let validator = parachain_config.role.is_authority();
let prometheus_registry = parachain_config.prometheus_registry().cloned();
let transaction_pool = params.transaction_pool.clone();
let mut task_manager = params.task_manager;
let import_queue = cumulus_client_service::SharedImportQueue::new(params.import_queue);
let (network, system_rpc_tx, start_network) =
sc_service::build_network(sc_service::BuildNetworkParams {
config: &parachain_config,
client: client.clone(),
transaction_pool: transaction_pool.clone(),
spawn_handle: task_manager.spawn_handle(),
import_queue: import_queue.clone(),
on_demand: None,
block_announce_validator_builder: Some(Box::new(|_| block_announce_validator)),
warp_sync: None,
})?;
let rpc_extensions_builder = {
let client = client.clone();
let transaction_pool = transaction_pool.clone();
Box::new(move |deny_unsafe, _| {
let deps = rpc::FullDeps {
client: client.clone(),
pool: transaction_pool.clone(),
deny_unsafe,
};
Ok(rpc::create_full(deps))
})
};
sc_service::spawn_tasks(sc_service::SpawnTasksParams {
on_demand: None,
remote_blockchain: None,
rpc_extensions_builder,
client: client.clone(),
transaction_pool: transaction_pool.clone(),
task_manager: &mut task_manager,
config: parachain_config,
keystore: params.keystore_container.sync_keystore(),
backend: backend.clone(),
network: network.clone(),
system_rpc_tx,
telemetry: telemetry.as_mut(),
})?;
let announce_block = {
let network = network.clone();
Arc::new(move |hash, data| network.announce_block(hash, data))
};
if validator {
let parachain_consensus = build_consensus(
client.clone(),
prometheus_registry.as_ref(),
telemetry.as_ref().map(|t| t.handle()),
&task_manager,
&relay_chain_full_node,
transaction_pool,
network,
params.keystore_container.sync_keystore(),
force_authoring,
)?;
let spawner = task_manager.spawn_handle();
let params = StartCollatorParams {
para_id: id,
block_status: client.clone(),
announce_block,
client: client.clone(),
task_manager: &mut task_manager,
relay_chain_full_node,
spawner,
parachain_consensus,
import_queue,
};
start_collator(params).await?;
} else {
let params = StartFullNodeParams {
client: client.clone(),
announce_block,
task_manager: &mut task_manager,
para_id: id,
relay_chain_full_node,
};
start_full_node(params)?;
}
start_network.start_network();
Ok((task_manager, client))
}
/// Build the import queue for the rococo parachain runtime.
pub fn rococo_parachain_build_import_queue(
client: Arc<
@@ -532,7 +707,7 @@ pub async fn start_shell_node(
TaskManager,
Arc<TFullClient<Block, shell_runtime::RuntimeApi, ShellRuntimeExecutor>>,
)> {
start_node_impl::<shell_runtime::RuntimeApi, ShellRuntimeExecutor, _, _, _>(
start_shell_node_impl::<shell_runtime::RuntimeApi, ShellRuntimeExecutor, _, _, _>(
parachain_config,
polkadot_config,
id,
@@ -801,7 +976,9 @@ where
> + sp_offchain::OffchainWorkerApi<Block>
+ sp_block_builder::BlockBuilder<Block>
+ cumulus_primitives_core::CollectCollationInfo<Block>
+ sp_consensus_aura::AuraApi<Block, AuraId>,
+ sp_consensus_aura::AuraApi<Block, AuraId>
+ pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>
+ frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
sc_client_api::StateBackendFor<TFullBackend<Block>, Block>: sp_api::StateBackend<BlakeTwo256>,
Executor: sc_executor::NativeExecutionDispatch + 'static,
{
@@ -62,7 +62,7 @@ cumulus-pallet-xcm = { path = "../../pallets/xcm", default-features = false }
cumulus-pallet-session-benchmarking = {path = "../../pallets/session-benchmarking", default-features = false, version = "3.0.0"}
cumulus-ping = { path = "../pallets/ping", default-features = false }
pallet-collator-selection = { path = "../../pallets/collator-selection", default-features = false }
statemint-common = { path = "../statemint-common", default-features = false }
parachains-common = { path = "../parachains-common", default-features = false }
# Polkadot dependencies
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
@@ -149,5 +149,5 @@ std = [
"xcm-executor/std",
"sp-consensus-aura/std",
"node-primitives/std",
"statemint-common/std",
"parachains-common/std",
]
@@ -54,12 +54,13 @@ use frame_system::{
limits::{BlockLength, BlockWeights},
EnsureOneOf, EnsureRoot,
};
use sp_runtime::Perbill;
pub use statemint_common as common;
use statemint_common::{
impls::DealWithFees, AccountId, AuraId, Balance, BlockNumber, Hash, Header, Index, Signature,
AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
pub use parachains_common as common;
use parachains_common::{
impls::DealWithFees, opaque, AccountId, AuraId, Balance, BlockNumber, Hash, Header, Index,
Signature, AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO,
SLOT_DURATION,
};
use sp_runtime::Perbill;
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
@@ -78,23 +79,9 @@ use xcm_builder::{
};
use xcm_executor::{Config, XcmExecutor};
/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
/// the specifics of the runtime. They can then be made to be agnostic over specific formats
/// of data like extrinsics, allowing for them to continue syncing the network through upgrades
/// to even the core data structures.
pub mod opaque {
use super::*;
pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic;
/// Opaque block header type.
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
/// Opaque block type.
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
/// Opaque block identifier type.
pub type BlockId = generic::BlockId<Block>;
impl_opaque_keys! {
pub struct SessionKeys {
pub aura: Aura,
}
impl_opaque_keys! {
pub struct SessionKeys {
pub aura: Aura,
}
}
@@ -619,9 +606,8 @@ impl pallet_session::Config for Runtime {
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
type SessionManager = CollatorSelection;
// Essentially just Aura, but lets be pedantic.
type SessionHandler =
<opaque::SessionKeys as sp_runtime::traits::OpaqueKeys>::KeyTypeIdProviders;
type Keys = opaque::SessionKeys;
type SessionHandler = <SessionKeys as sp_runtime::traits::OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys;
type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
}
@@ -817,13 +803,13 @@ impl_runtime_apis! {
impl sp_session::SessionKeys<Block> for Runtime {
fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
opaque::SessionKeys::generate(seed)
SessionKeys::generate(seed)
}
fn decode_session_keys(
encoded: Vec<u8>,
) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {
opaque::SessionKeys::decode_into_raw_public_keys(&encoded)
SessionKeys::decode_into_raw_public_keys(&encoded)
}
}
@@ -62,7 +62,7 @@ cumulus-pallet-xcm = { path = "../../pallets/xcm", default-features = false }
cumulus-pallet-session-benchmarking = { path = "../../pallets/session-benchmarking", default-features = false, version = "3.0.0" }
cumulus-ping = { path = "../pallets/ping", default-features = false }
pallet-collator-selection = { path = "../../pallets/collator-selection", default-features = false }
statemint-common = { path = "../statemint-common", default-features = false }
parachains-common = { path = "../parachains-common", default-features = false }
# Polkadot dependencies
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
@@ -149,5 +149,5 @@ std = [
"xcm-executor/std",
"sp-consensus-aura/std",
"node-primitives/std",
"statemint-common/std",
"parachains-common/std",
]
@@ -54,12 +54,13 @@ use frame_system::{
limits::{BlockLength, BlockWeights},
EnsureOneOf, EnsureRoot,
};
use sp_runtime::Perbill;
pub use statemint_common as common;
use statemint_common::{
impls::DealWithFees, AccountId, AuraId, Balance, BlockNumber, Hash, Header, Index, Signature,
AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
pub use parachains_common as common;
use parachains_common::{
impls::DealWithFees, opaque, AccountId, AuraId, Balance, BlockNumber, Hash, Header, Index,
Signature, AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO,
SLOT_DURATION,
};
use sp_runtime::Perbill;
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
@@ -78,23 +79,9 @@ use xcm_builder::{
};
use xcm_executor::{Config, XcmExecutor};
/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
/// the specifics of the runtime. They can then be made to be agnostic over specific formats
/// of data like extrinsics, allowing for them to continue syncing the network through upgrades
/// to even the core data structures.
pub mod opaque {
use super::*;
pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic;
/// Opaque block header type.
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
/// Opaque block type.
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
/// Opaque block identifier type.
pub type BlockId = generic::BlockId<Block>;
impl_opaque_keys! {
pub struct SessionKeys {
pub aura: Aura,
}
impl_opaque_keys! {
pub struct SessionKeys {
pub aura: Aura,
}
}
@@ -327,10 +314,9 @@ impl InstanceFilter<Call> for ProxyType {
fn filter(&self, c: &Call) -> bool {
match self {
ProxyType::Any => true,
ProxyType::NonTransfer => !matches!(
c,
Call::Balances(..) | Call::Assets(..) | Call::Uniques(..)
),
ProxyType::NonTransfer => {
!matches!(c, Call::Balances(..) | Call::Assets(..) | Call::Uniques(..))
}
ProxyType::CancelProxy => matches!(
c,
Call::Proxy(pallet_proxy::Call::reject_announcement(..))
@@ -585,9 +571,8 @@ impl pallet_session::Config for Runtime {
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
type SessionManager = CollatorSelection;
// Essentially just Aura, but lets be pedantic.
type SessionHandler =
<opaque::SessionKeys as sp_runtime::traits::OpaqueKeys>::KeyTypeIdProviders;
type Keys = opaque::SessionKeys;
type SessionHandler = <SessionKeys as sp_runtime::traits::OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys;
type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
}
@@ -801,13 +786,13 @@ impl_runtime_apis! {
impl sp_session::SessionKeys<Block> for Runtime {
fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
opaque::SessionKeys::generate(seed)
SessionKeys::generate(seed)
}
fn decode_session_keys(
encoded: Vec<u8>,
) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {
opaque::SessionKeys::decode_into_raw_public_keys(&encoded)
SessionKeys::decode_into_raw_public_keys(&encoded)
}
}
@@ -62,7 +62,7 @@ cumulus-pallet-xcm = { path = "../../pallets/xcm", default-features = false }
cumulus-pallet-session-benchmarking = {path = "../../pallets/session-benchmarking", default-features = false, version = "3.0.0"}
cumulus-ping = { path = "../pallets/ping", default-features = false }
pallet-collator-selection = { path = "../../pallets/collator-selection", default-features = false }
statemint-common = { path = "../statemint-common", default-features = false }
parachains-common = { path = "../parachains-common", default-features = false }
# Polkadot dependencies
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
@@ -149,5 +149,5 @@ std = [
"xcm-executor/std",
"sp-consensus-aura/std",
"node-primitives/std",
"statemint-common/std",
"parachains-common/std",
]
+17 -32
View File
@@ -54,12 +54,13 @@ use frame_system::{
limits::{BlockLength, BlockWeights},
EnsureRoot,
};
use sp_runtime::Perbill;
pub use statemint_common as common;
use statemint_common::{
impls::DealWithFees, AccountId, AuraId, Balance, BlockNumber, Hash, Header, Index, Signature,
AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
pub use parachains_common as common;
use parachains_common::{
impls::DealWithFees, opaque, AccountId, AuraId, Balance, BlockNumber, Hash, Header, Index,
Signature, AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO,
SLOT_DURATION,
};
use sp_runtime::Perbill;
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
@@ -78,23 +79,9 @@ use xcm_builder::{
};
use xcm_executor::{Config, XcmExecutor};
/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
/// the specifics of the runtime. They can then be made to be agnostic over specific formats
/// of data like extrinsics, allowing for them to continue syncing the network through upgrades
/// to even the core data structures.
pub mod opaque {
use super::*;
pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic;
/// Opaque block type.
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
pub type SessionHandlers = ();
impl_opaque_keys! {
pub struct SessionKeys {
pub aura: Aura,
}
impl_opaque_keys! {
pub struct SessionKeys {
pub aura: Aura,
}
}
@@ -233,7 +220,7 @@ impl pallet_sudo::Config for Runtime {
type Call = Call;
}
pub type AssetsForceOrigin = EnsureRoot<AccountId>;
pub type AssetsForceOrigin = EnsureRoot<AccountId>;
parameter_types! {
pub const AssetDeposit: Balance = 100 * UNITS; // 100 WND deposit to create asset
@@ -326,10 +313,9 @@ impl InstanceFilter<Call> for ProxyType {
fn filter(&self, c: &Call) -> bool {
match self {
ProxyType::Any => true,
ProxyType::NonTransfer => !matches!(
c,
Call::Balances(..) | Call::Assets(..) | Call::Uniques(..)
),
ProxyType::NonTransfer => {
!matches!(c, Call::Balances(..) | Call::Assets(..) | Call::Uniques(..))
}
ProxyType::CancelProxy => matches!(
c,
Call::Proxy(pallet_proxy::Call::reject_announcement(..))
@@ -583,9 +569,8 @@ impl pallet_session::Config for Runtime {
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
type SessionManager = CollatorSelection;
// Essentially just Aura, but lets be pedantic.
type SessionHandler =
<opaque::SessionKeys as sp_runtime::traits::OpaqueKeys>::KeyTypeIdProviders;
type Keys = opaque::SessionKeys;
type SessionHandler = <SessionKeys as sp_runtime::traits::OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys;
type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
}
@@ -803,13 +788,13 @@ impl_runtime_apis! {
impl sp_session::SessionKeys<Block> for Runtime {
fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
opaque::SessionKeys::generate(seed)
SessionKeys::generate(seed)
}
fn decode_session_keys(
encoded: Vec<u8>,
) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {
opaque::SessionKeys::decode_into_raw_public_keys(&encoded)
SessionKeys::decode_into_raw_public_keys(&encoded)
}
}