|
@@ -29,7 +29,7 @@ mod migration;
|
|
mod roles;
|
|
mod roles;
|
|
use client::{
|
|
use client::{
|
|
block_builder::api::{self as block_builder_api, CheckInherentsResult, InherentData},
|
|
block_builder::api::{self as block_builder_api, CheckInherentsResult, InherentData},
|
|
- impl_runtime_apis, runtime_api,
|
|
|
|
|
|
+ impl_runtime_apis, runtime_api as client_api
|
|
};
|
|
};
|
|
#[cfg(feature = "std")]
|
|
#[cfg(feature = "std")]
|
|
use primitives::bytes;
|
|
use primitives::bytes;
|
|
@@ -40,7 +40,7 @@ use runtime_primitives::{
|
|
create_runtime_str, generic,
|
|
create_runtime_str, generic,
|
|
traits::{
|
|
traits::{
|
|
self as runtime_traits, BlakeTwo256, Block as BlockT, CurrencyToVoteHandler, StaticLookup,
|
|
self as runtime_traits, BlakeTwo256, Block as BlockT, CurrencyToVoteHandler, StaticLookup,
|
|
- Verify,
|
|
|
|
|
|
+ Verify, NumberFor, AuthorityIdFor
|
|
},
|
|
},
|
|
transaction_validity::TransactionValidity,
|
|
transaction_validity::TransactionValidity,
|
|
ApplyResult,
|
|
ApplyResult,
|
|
@@ -350,61 +350,73 @@ pub type Executive = executive::Executive<Runtime, Block, Context, Balances, All
|
|
|
|
|
|
// Implement our runtime API endpoints. This is just a bunch of proxying.
|
|
// Implement our runtime API endpoints. This is just a bunch of proxying.
|
|
impl_runtime_apis! {
|
|
impl_runtime_apis! {
|
|
- impl runtime_api::Core<Block> for Runtime {
|
|
|
|
- fn version() -> RuntimeVersion {
|
|
|
|
- VERSION
|
|
|
|
- }
|
|
|
|
|
|
+ impl client_api::Core<Block> for Runtime {
|
|
|
|
+ fn version() -> RuntimeVersion {
|
|
|
|
+ VERSION
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn execute_block(block: Block) {
|
|
|
|
+ Executive::execute_block(block)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn initialize_block(header: &<Block as BlockT>::Header) {
|
|
|
|
+ Executive::initialize_block(header)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fn authorities() -> Vec<AuthorityIdFor<Block>> {
|
|
|
|
+ panic!("Deprecated, please use `AuthoritiesApi`.")
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- fn authorities() -> Vec<AuthorityId> {
|
|
|
|
- Consensus::authorities()
|
|
|
|
- }
|
|
|
|
|
|
+ impl client_api::Metadata<Block> for Runtime {
|
|
|
|
+ fn metadata() -> OpaqueMetadata {
|
|
|
|
+ Runtime::metadata().into()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- fn execute_block(block: Block) {
|
|
|
|
- Executive::execute_block(block)
|
|
|
|
- }
|
|
|
|
|
|
+ impl block_builder_api::BlockBuilder<Block> for Runtime {
|
|
|
|
+ fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyResult {
|
|
|
|
+ Executive::apply_extrinsic(extrinsic)
|
|
|
|
+ }
|
|
|
|
|
|
- fn initialize_block(header: &<Block as BlockT>::Header) {
|
|
|
|
- Executive::initialize_block(header)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ fn finalize_block() -> <Block as BlockT>::Header {
|
|
|
|
+ Executive::finalize_block()
|
|
|
|
+ }
|
|
|
|
|
|
- impl runtime_api::Metadata<Block> for Runtime {
|
|
|
|
- fn metadata() -> OpaqueMetadata {
|
|
|
|
- Runtime::metadata().into()
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- impl block_builder_api::BlockBuilder<Block> for Runtime {
|
|
|
|
- fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyResult {
|
|
|
|
- Executive::apply_extrinsic(extrinsic)
|
|
|
|
- }
|
|
|
|
|
|
+ fn inherent_extrinsics(data: InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
|
|
|
|
+ data.create_extrinsics()
|
|
|
|
+ }
|
|
|
|
|
|
- fn finalize_block() -> <Block as BlockT>::Header {
|
|
|
|
- Executive::finalize_block()
|
|
|
|
- }
|
|
|
|
|
|
+ fn check_inherents(block: Block, data: InherentData) -> CheckInherentsResult {
|
|
|
|
+ data.check_extrinsics(&block)
|
|
|
|
+ }
|
|
|
|
|
|
- fn inherent_extrinsics(data: InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
|
|
|
|
- data.create_extrinsics()
|
|
|
|
- }
|
|
|
|
|
|
+ fn random_seed() -> <Block as BlockT>::Hash {
|
|
|
|
+ System::random_seed()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- fn check_inherents(block: Block, data: InherentData) -> CheckInherentsResult {
|
|
|
|
- data.check_extrinsics(&block)
|
|
|
|
- }
|
|
|
|
|
|
+ impl client_api::TaggedTransactionQueue<Block> for Runtime {
|
|
|
|
+ fn validate_transaction(tx: <Block as BlockT>::Extrinsic) -> TransactionValidity {
|
|
|
|
+ Executive::validate_transaction(tx)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- fn random_seed() -> <Block as BlockT>::Hash {
|
|
|
|
- System::random_seed()
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ impl offchain_primitives::OffchainWorkerApi<Block> for Runtime {
|
|
|
|
+ fn offchain_worker(number: NumberFor<Block>) {
|
|
|
|
+ Executive::offchain_worker(number)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- impl runtime_api::TaggedTransactionQueue<Block> for Runtime {
|
|
|
|
- fn validate_transaction(tx: <Block as BlockT>::Extrinsic) -> TransactionValidity {
|
|
|
|
- Executive::validate_transaction(tx)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ impl consensus_aura::AuraApi<Block> for Runtime {
|
|
|
|
+ fn slot_duration() -> u64 {
|
|
|
|
+ Aura::slot_duration()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- impl consensus_aura::AuraApi<Block> for Runtime {
|
|
|
|
- fn slot_duration() -> u64 {
|
|
|
|
- Aura::slot_duration()
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ impl consensus_authorities::AuthoritiesApi<Block> for Runtime {
|
|
|
|
+ fn authorities() -> Vec<AuthorityIdFor<Block>> {
|
|
|
|
+ Consensus::authorities()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|