From 1df5a640245a7db6cf536abb7bb64033baf520aa Mon Sep 17 00:00:00 2001 From: "Demi M. Obenour" Date: Fri, 11 Sep 2020 20:26:14 -0400 Subject: [PATCH] Remove more code not needed for Ledgeracio --- src/frame/session.rs | 42 ------------------------------------------ src/frame/staking.rs | 27 +-------------------------- src/runtimes.rs | 13 ++----------- 3 files changed, 3 insertions(+), 79 deletions(-) diff --git a/src/frame/session.rs b/src/frame/session.rs index 3640355e77..f5f527b81b 100644 --- a/src/frame/session.rs +++ b/src/frame/session.rs @@ -51,9 +51,6 @@ pub trait Session: System { /// The validator account identifier type for the runtime. type ValidatorId: Parameter + Debug + Ord + Default + Send + Sync + 'static; - /// The session index identifier type for the runtime. - type SessionIndex: Parameter + Debug + Ord + Default + Send + Sync + 'static; - /// The keys. type Keys: OpaqueKeys + Member + Parameter + Default; } @@ -68,27 +65,6 @@ pub struct ValidatorsStore { default_impl!(ValidatorsStore); -/// Current index of the session. -#[derive(Encode, Store, Debug)] -pub struct CurrentIndexStore { - #[store(returns = ::SessionIndex)] - /// Marker for the runtime - pub _runtime: PhantomData, -} - -default_impl!(CurrentIndexStore); - -/// True if the underlying economic identities or weighting behind the validators -/// has changed in the queued validator set. -#[derive(Encode, Store, Debug)] -pub struct QueuedChangedStore { - #[store(returns = bool)] - /// Marker for the runtime - pub _runtime: PhantomData, -} - -default_impl!(QueuedChangedStore); - /// Set the session keys for a validator. #[derive(Encode, Call, Debug)] pub struct SetKeysCall { @@ -97,21 +73,3 @@ pub struct SetKeysCall { /// The proof. This is not currently used and can be set to an empty vector. pub proof: Vec, } - -#[cfg(test)] -mod tests { - use super::*; - use crate::tests::test_client; - - #[async_std::test] - #[ignore] - async fn test_state_read_free_balance() { - env_logger::try_init().ok(); - let (client, _) = test_client().await; - assert!(client - .fetch(&QueuedChangedStore::default(), None) - .await - .unwrap() - .unwrap()); - } -} diff --git a/src/frame/staking.rs b/src/frame/staking.rs index 5a48d9d9f1..417222e338 100644 --- a/src/frame/staking.rs +++ b/src/frame/staking.rs @@ -24,11 +24,6 @@ use codec::{ Decode, Encode, }; -use frame_support::Parameter; -use sp_runtime::traits::{ - MaybeSerialize, - Member, -}; use std::{ collections::BTreeMap, @@ -69,27 +64,7 @@ pub struct SetPayeeCall { /// The subset of the `frame::Trait` that a client must implement. #[module] -pub trait Staking: Balances { - /// Data type used to index nominators in the compact type - type NominatorIndex: Parameter - + codec::Codec - + Member - + Default - + Copy - + MaybeSerialize - + Debug; - - /// Data type used to index validators in the compact type. - type ValidatorIndex: Parameter - + codec::Codec - + Send - + Sync - + Default - + Member - + Copy - + MaybeSerialize - + Debug; -} +pub trait Staking: Balances {} /// Number of eras to keep in history. /// diff --git a/src/runtimes.rs b/src/runtimes.rs index f86096e0d5..6bbd8b7c26 100644 --- a/src/runtimes.rs +++ b/src/runtimes.rs @@ -146,10 +146,7 @@ pub trait Runtime: System + Sized + Send + Sync + 'static { #[derive(Debug, Clone, Eq, PartialEq)] pub struct DefaultNodeRuntime; -impl Staking for DefaultNodeRuntime { - type NominatorIndex = u32; - type ValidatorIndex = u16; -} +impl Staking for DefaultNodeRuntime {} impl Runtime for DefaultNodeRuntime { type Signature = MultiSignature; @@ -173,7 +170,6 @@ impl Balances for DefaultNodeRuntime { } impl Session for DefaultNodeRuntime { - type SessionIndex = u32; type ValidatorId = ::AccountId; type Keys = BasicSessionKeys; } @@ -213,7 +209,6 @@ impl Balances for NodeTemplateRuntime { } impl Session for NodeTemplateRuntime { - type SessionIndex = u32; type ValidatorId = ::AccountId; type Keys = BasicSessionKeys; } @@ -247,15 +242,11 @@ impl System for KusamaRuntime { } impl Session for KusamaRuntime { - type SessionIndex = u32; type ValidatorId = ::AccountId; type Keys = SessionKeys; } -impl Staking for KusamaRuntime { - type NominatorIndex = u32; - type ValidatorIndex = u16; -} +impl Staking for KusamaRuntime {} impl Balances for KusamaRuntime { type Balance = u128;