|
@@ -29,10 +29,10 @@ use roles::actors;
|
|
|
use rstd::prelude::*;
|
|
|
#[cfg(feature = "std")]
|
|
|
use primitives::bytes;
|
|
|
-use primitives::{Ed25519AuthorityId, OpaqueMetadata};
|
|
|
+use primitives::{ed25519, OpaqueMetadata};
|
|
|
use runtime_primitives::{
|
|
|
- ApplyResult, transaction_validity::TransactionValidity, Ed25519Signature, generic,
|
|
|
- traits::{self as runtime_traits, Convert, BlakeTwo256, Block as BlockT, StaticLookup}, create_runtime_str
|
|
|
+ ApplyResult, transaction_validity::TransactionValidity, generic, create_runtime_str,
|
|
|
+ traits::{self as runtime_traits, Convert, BlakeTwo256, Block as BlockT, StaticLookup, Verify},
|
|
|
};
|
|
|
use client::{
|
|
|
block_builder::api::{CheckInherentsResult, InherentData, self as block_builder_api},
|
|
@@ -52,8 +52,17 @@ pub use runtime_primitives::{Permill, Perbill};
|
|
|
pub use timestamp::BlockPeriod;
|
|
|
pub use srml_support::{StorageValue, construct_runtime};
|
|
|
|
|
|
-/// Alias to Ed25519 pubkey that identifies an account on the chain.
|
|
|
-pub type AccountId = primitives::H256;
|
|
|
+/// The type that is used for identifying authorities.
|
|
|
+pub type AuthorityId = <AuthoritySignature as Verify>::Signer;
|
|
|
+
|
|
|
+/// The type used by authorities to prove their ID.
|
|
|
+pub type AuthoritySignature = ed25519::Signature;
|
|
|
+
|
|
|
+/// Alias to pubkey that identifies an account on the chain.
|
|
|
+pub type AccountId = <AccountSignature as Verify>::Signer;
|
|
|
+
|
|
|
+/// The type used by accounts to prove their ID.
|
|
|
+pub type AccountSignature = ed25519::Signature;
|
|
|
|
|
|
/// A hash of some data used by the chain.
|
|
|
pub type Hash = primitives::H256;
|
|
@@ -81,13 +90,13 @@ pub mod opaque {
|
|
|
}
|
|
|
}
|
|
|
/// Opaque block header type.
|
|
|
- pub type Header = generic::Header<BlockNumber, BlakeTwo256, generic::DigestItem<Hash, Ed25519AuthorityId>>;
|
|
|
+ pub type Header = generic::Header<BlockNumber, BlakeTwo256, generic::DigestItem<Hash, AuthorityId, AuthoritySignature>>;
|
|
|
/// Opaque block type.
|
|
|
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
|
|
/// Opaque block identifier type.
|
|
|
pub type BlockId = generic::BlockId<Block>;
|
|
|
/// Opaque session key type.
|
|
|
- pub type SessionKey = Ed25519AuthorityId;
|
|
|
+ pub type SessionKey = AuthorityId;
|
|
|
}
|
|
|
|
|
|
/// This runtime version.
|
|
@@ -140,7 +149,7 @@ impl aura::Trait for Runtime {
|
|
|
|
|
|
impl consensus::Trait for Runtime {
|
|
|
/// The identifier we use to refer to authorities.
|
|
|
- type SessionKey = Ed25519AuthorityId;
|
|
|
+ type SessionKey = AuthorityId;
|
|
|
// The aura module handles offline-reports internally
|
|
|
// rather than using an explicit report system.
|
|
|
type InherentOfflineReport = ();
|
|
@@ -148,16 +157,8 @@ impl consensus::Trait for Runtime {
|
|
|
type Log = Log;
|
|
|
}
|
|
|
|
|
|
-/// Session key conversion.
|
|
|
-pub struct SessionKeyConversion;
|
|
|
-impl Convert<AccountId, Ed25519AuthorityId> for SessionKeyConversion {
|
|
|
- fn convert(a: AccountId) -> Ed25519AuthorityId {
|
|
|
- a.to_fixed_bytes().into()
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
impl session::Trait for Runtime {
|
|
|
- type ConvertAccountIdToSessionKey = SessionKeyConversion;
|
|
|
+ type ConvertAccountIdToSessionKey = ();
|
|
|
type OnSessionChange = (Staking, );
|
|
|
type Event = Event;
|
|
|
}
|
|
@@ -184,18 +185,15 @@ impl balances::Trait for Runtime {
|
|
|
/// The type for recording an account's balance.
|
|
|
type Balance = u128;
|
|
|
/// What to do if an account's free balance gets zeroed.
|
|
|
- type OnFreeBalanceZero = Staking;
|
|
|
+ type OnFreeBalanceZero = (Staking, Session);
|
|
|
/// What to do if a new account is created.
|
|
|
type OnNewAccount = Indices;
|
|
|
- /// Restrict whether an account can transfer funds. We don't place any further restrictions.
|
|
|
- type EnsureAccountLiquid = (Staking, Actors);
|
|
|
/// The uniquitous event type.
|
|
|
type Event = Event;
|
|
|
-}
|
|
|
|
|
|
-impl fees::Trait for Runtime {
|
|
|
- type TransferAsset = Balances;
|
|
|
- type Event = Event;
|
|
|
+ type TransactionPayment = ();
|
|
|
+ type DustRemoval = ();
|
|
|
+ type TransferPayment = ();
|
|
|
}
|
|
|
|
|
|
impl sudo::Trait for Runtime {
|
|
@@ -206,8 +204,11 @@ impl sudo::Trait for Runtime {
|
|
|
|
|
|
impl staking::Trait for Runtime {
|
|
|
type Currency = balances::Module<Self>;
|
|
|
+ //type CurrencyToVote = CurrencyToVoteHandler;
|
|
|
type OnRewardMinted = ();
|
|
|
type Event = Event;
|
|
|
+ type Slash = ();
|
|
|
+ type Reward = ();
|
|
|
}
|
|
|
|
|
|
impl governance::GovernanceCurrency for Runtime {
|
|
@@ -257,7 +258,7 @@ impl actors::Trait for Runtime {
|
|
|
}
|
|
|
|
|
|
construct_runtime!(
|
|
|
- pub enum Runtime with Log(InternalLog: DigestItem<Hash, Ed25519AuthorityId>) where
|
|
|
+ pub enum Runtime with Log(InternalLog: DigestItem<Hash, AuthorityId, AuthoritySignature>) where
|
|
|
Block = Block,
|
|
|
NodeBlock = opaque::Block,
|
|
|
UncheckedExtrinsic = UncheckedExtrinsic
|
|
@@ -270,7 +271,6 @@ construct_runtime!(
|
|
|
Balances: balances,
|
|
|
Session: session,
|
|
|
Staking: staking::{default, OfflineWorker},
|
|
|
- Fees: fees::{Module, Storage, Config<T>, Event<T>},
|
|
|
Sudo: sudo,
|
|
|
Proposals: proposals::{Module, Call, Storage, Event<T>, Config<T>},
|
|
|
CouncilElection: election::{Module, Call, Storage, Event<T>, Config<T>},
|
|
@@ -294,11 +294,11 @@ pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
|
|
/// BlockId type as expected by this runtime.
|
|
|
pub type BlockId = generic::BlockId<Block>;
|
|
|
/// Unchecked extrinsic type as expected by this runtime.
|
|
|
-pub type UncheckedExtrinsic = generic::UncheckedMortalCompactExtrinsic<Address, Nonce, Call, Ed25519Signature>;
|
|
|
+pub type UncheckedExtrinsic = generic::UncheckedMortalCompactExtrinsic<Address, Nonce, Call, AccountSignature>;
|
|
|
/// Extrinsic type that has already been checked.
|
|
|
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Nonce, Call>;
|
|
|
/// Executive: handles dispatch to the various modules.
|
|
|
-pub type Executive = executive::Executive<Runtime, Block, Context, Fees, AllModules>;
|
|
|
+pub type Executive = executive::Executive<Runtime, Block, Context, Balances, AllModules>;
|
|
|
|
|
|
// Implement our runtime API endpoints. This is just a bunch of proxying.
|
|
|
impl_runtime_apis! {
|
|
@@ -307,7 +307,7 @@ impl_runtime_apis! {
|
|
|
VERSION
|
|
|
}
|
|
|
|
|
|
- fn authorities() -> Vec<Ed25519AuthorityId> {
|
|
|
+ fn authorities() -> Vec<AuthorityId> {
|
|
|
Consensus::authorities()
|
|
|
}
|
|
|
|