mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 05:11:09 +00:00
Rewrite impl_runtime_apis! and decl_runtime_apis! as proc-macro (#1174)
* Rewrites `impl_runtime_apis!` macro as `proc-macro` * Adds some documentation * Require the `impl_runtime_apis` to use a path for accessing the trait * Make the runtime implement `GetNodeBlockType` * Moves first chunk of runtime api code into the `impl_runtime_apis` macro This also renames `ClientWithApi` into `RuntimeApi`. * Make `impl_runtime_apis` use `runtime` api version automatically * `decl_runtime_apis` automatically adds `Block: BlockT` as generic parameter * Remove function generic arguments in block builder api * Remove some unnused stuff from the `decl_runtime_apis` macro * Make `InherentData` working again * Make `impl_runtime_apis!` implement the `RuntimeApi` side as well * Make it compile again after rebasing with master * Split `sr-api-macros` into multiple files * Reimplement `decl_runtime_apis!` as proc_macro * Use `decl_runtime_apis!` for `Core` as well and improve error reporting * Adds documentation for `decl_runtime_apis!` and `impl_runtime_apis!` * Move some code * Adds compile fail tests * Adds a test and fixes some bugs * Make `impl_runtime_apis!` support `_` as parameter name * Fixes build errors with wasm * Wasm rebuild after master rebase * Apply suggestions from code review Co-Authored-By: bkchr <bkchr@users.noreply.github.com> * Addresses some grumbles * Adds test to ensure that method signatures need to match * New wasm files
This commit is contained in:
@@ -25,10 +25,11 @@ use std;
|
||||
use client::{self, error, Client as SubstrateClient, CallExecutor};
|
||||
use client::{block_builder::api::BlockBuilder as BlockBuilderApi, runtime_api::{id::BLOCK_BUILDER, Core}};
|
||||
use codec::{Decode, Encode};
|
||||
use consensus_common::{self, InherentData, evaluation, offline_tracker::OfflineTracker};
|
||||
use consensus_common::{self, evaluation, offline_tracker::OfflineTracker};
|
||||
use primitives::{H256, AuthorityId, ed25519, Blake2Hasher};
|
||||
use runtime_primitives::traits::{Block as BlockT, Hash as HashT, Header as HeaderT, ProvideRuntimeApi};
|
||||
use runtime_primitives::generic::BlockId;
|
||||
use runtime_primitives::InherentData;
|
||||
use transaction_pool::txpool::{self, Pool as TransactionPool};
|
||||
|
||||
use parking_lot::RwLock;
|
||||
@@ -200,10 +201,7 @@ impl<Block, C, A> consensus_common::Proposer<<C as AuthoringApi>::Block> for Pro
|
||||
)
|
||||
}
|
||||
|
||||
let inherent_data = InherentData {
|
||||
timestamp,
|
||||
offline_indices,
|
||||
};
|
||||
let inherent_data = InherentData::new(timestamp, offline_indices);
|
||||
|
||||
let block = self.client.build_block(
|
||||
&self.parent_id,
|
||||
|
||||
Reference in New Issue
Block a user