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
@@ -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)
}
}