mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 19:17:58 +00:00
Consensus Engines Implementation: Aura (#911)
* Generalize BlockImport - move ImportBlock, BlockOrigin, ImportResult into shared sr-primitives - let Consensus provide and traits again - update consensus traits to latest development - implement traits on client::Client, test_client::TestClient - update RHD to use the new import_block API * Move ImportBlock into consensus-common * Send import notification in aura tests * Integrating aura into service * Make Signatures more generic * Aura Block Production with the given key * run aura on the thread pool * start at exact step start in aura * Add needed wasm blob, in leiu of better solutions. * Make API ids consistent with traits and bring upstream for sharing. * Add decrease_free_balance to Balances module * Encode `Metadata` once instead of two times * Bitops include xor * Upgrade key module. * Default pages to somewhat bigger. * Introduce upgrade key into node * Add `Created` event
This commit is contained in:
committed by
GitHub
parent
c0f7021427
commit
50adea6220
@@ -52,6 +52,7 @@ extern crate srml_staking as staking;
|
||||
extern crate srml_system as system;
|
||||
extern crate srml_timestamp as timestamp;
|
||||
extern crate srml_treasury as treasury;
|
||||
extern crate srml_upgrade_key as upgrade_key;
|
||||
#[macro_use]
|
||||
extern crate sr_version as version;
|
||||
extern crate node_primitives;
|
||||
@@ -62,12 +63,12 @@ use node_primitives::{
|
||||
AccountId, AccountIndex, Balance, BlockNumber, Hash, Index,
|
||||
SessionKey, Signature
|
||||
};
|
||||
use runtime_api::runtime::*;
|
||||
use runtime_api::{runtime::*, id::*};
|
||||
use runtime_primitives::ApplyResult;
|
||||
use runtime_primitives::transaction_validity::TransactionValidity;
|
||||
use runtime_primitives::generic;
|
||||
use runtime_primitives::traits::{Convert, BlakeTwo256, Block as BlockT};
|
||||
use version::{RuntimeVersion, ApiId};
|
||||
use version::RuntimeVersion;
|
||||
use council::{motions as council_motions, voting as council_voting};
|
||||
#[cfg(feature = "std")]
|
||||
use council::seats as council_seats;
|
||||
@@ -86,9 +87,6 @@ pub use srml_support::{StorageValue, RuntimeMetadata};
|
||||
const TIMESTAMP_SET_POSITION: u32 = 0;
|
||||
const NOTE_OFFLINE_POSITION: u32 = 1;
|
||||
|
||||
const INHERENT: ApiId = *b"inherent";
|
||||
const VALIDATX: ApiId = *b"validatx";
|
||||
|
||||
/// Runtime version.
|
||||
pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
spec_name: ver_str!("node"),
|
||||
@@ -96,7 +94,11 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
authoring_version: 1,
|
||||
spec_version: 1,
|
||||
impl_version: 0,
|
||||
apis: apis_vec!([(INHERENT, 1), (VALIDATX, 1)]),
|
||||
apis: apis_vec!([
|
||||
(BLOCK_BUILDER, 1),
|
||||
(TAGGED_TRANSACTION_QUEUE, 1),
|
||||
(METADATA, 1)
|
||||
]),
|
||||
};
|
||||
|
||||
/// Native version.
|
||||
@@ -191,15 +193,19 @@ impl contract::Trait for Runtime {
|
||||
type Event = Event;
|
||||
}
|
||||
|
||||
impl upgrade_key::Trait for Runtime {
|
||||
type Event = Event;
|
||||
}
|
||||
|
||||
construct_runtime!(
|
||||
pub enum Runtime with Log(InternalLog: DigestItem<Hash, SessionKey>) where
|
||||
Block = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: system::{default, Log(ChangesTrieRoot)},
|
||||
Timestamp: timestamp::{Module, Call, Storage, Config<T>, Inherent},
|
||||
Consensus: consensus::{Module, Call, Storage, Config<T>, Log(AuthoritiesChange), Inherent},
|
||||
Balances: balances,
|
||||
Timestamp: timestamp::{Module, Call, Storage, Config<T>, Inherent},
|
||||
Session: session,
|
||||
Staking: staking,
|
||||
Democracy: democracy,
|
||||
@@ -209,6 +215,7 @@ construct_runtime!(
|
||||
CouncilSeats: council_seats::{Config<T>},
|
||||
Treasury: treasury,
|
||||
Contract: contract::{Module, Call, Config<T>, Event<T>},
|
||||
UpgradeKey: upgrade_key,
|
||||
}
|
||||
);
|
||||
|
||||
@@ -278,33 +285,9 @@ impl_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
impl OldTxQueue<AccountId, Index, Address, AccountId> for Runtime {
|
||||
fn account_nonce(account: AccountId) -> Index {
|
||||
System::account_nonce(&account)
|
||||
}
|
||||
|
||||
fn lookup_address(address: Address) -> Option<AccountId> {
|
||||
Balances::lookup_address(address)
|
||||
}
|
||||
}
|
||||
|
||||
impl TaggedTransactionQueue<Block, TransactionValidity> for Runtime {
|
||||
fn validate_transaction(tx: <Block as BlockT>::Extrinsic) -> TransactionValidity {
|
||||
Executive::validate_transaction(tx)
|
||||
}
|
||||
}
|
||||
|
||||
impl Miscellaneous<AccountId, u64> for Runtime {
|
||||
fn validator_count() -> u32 {
|
||||
Session::validator_count()
|
||||
}
|
||||
|
||||
fn validators() -> Vec<AccountId> {
|
||||
Session::validators()
|
||||
}
|
||||
|
||||
fn timestamp() -> u64 {
|
||||
Timestamp::get()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user