mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 04:01:02 +00:00
Implement Substrate Pallet Runtime APIs (#389)
* Implement public helpers for querying header info * Update `best_header` when importing headers * Add BestHeader to GenesisConfig * Define extra types for Millau primitives * Start implementing runtime APIs in Millau runtime * Add helper for getting headers which require a justification * Add runtime API for getting headers requiring a justification * Reword `expect()` proof for valid authority sets * Fix typo * Clean up Hasher comment * Add the Call Dispatch Pallet back to the Millau runtime * Use types from Rialto in bridge pallet config * Use the Rialto runtime APIS in the Millau runtime * Include Millau bridge instance in Rialto runtime * Add missing doc comment * Use one storage function for setting and clearing `RequiresJustification` * Remove TODO comments
This commit is contained in:
committed by
Bastian Köcher
parent
cfe1e43473
commit
86834e2fd6
@@ -20,13 +20,21 @@
|
||||
// Runtime-generated DecodeLimit::decode_all_With_depth_limit
|
||||
#![allow(clippy::unnecessary_mut_passed)]
|
||||
|
||||
use sp_core::Hasher as HasherT;
|
||||
use sp_runtime::traits::BlakeTwo256;
|
||||
use sp_std::prelude::*;
|
||||
|
||||
/// Block number type used in Millau.
|
||||
pub type BlockNumber = u32;
|
||||
|
||||
/// Hash type used in Millau.
|
||||
pub type Hash = sp_core::H256;
|
||||
pub type Hash = <BlakeTwo256 as HasherT>::Out;
|
||||
|
||||
/// The type of an object that can produce hashes on Millau.
|
||||
pub type Hasher = BlakeTwo256;
|
||||
|
||||
/// The header type used by Millau.
|
||||
pub type Header = sp_runtime::generic::Header<BlockNumber, Hasher>;
|
||||
|
||||
sp_api::decl_runtime_apis! {
|
||||
/// API for querying information about Millau headers from the Bridge Pallet instance.
|
||||
@@ -42,8 +50,13 @@ sp_api::decl_runtime_apis! {
|
||||
/// Returns number and hash of the best finalized block known to the bridge module.
|
||||
fn finalized_block() -> (BlockNumber, Hash);
|
||||
/// Returns numbers and hashes of headers that require finality proofs.
|
||||
///
|
||||
/// An empty response means that there are no headers which currently require a
|
||||
/// finality proof.
|
||||
fn incomplete_headers() -> Vec<(BlockNumber, Hash)>;
|
||||
/// Returns true if header is known to the runtime.
|
||||
/// Returns true if the header is known to the runtime.
|
||||
fn is_known_block(hash: Hash) -> bool;
|
||||
/// Returns true if the header is considered finalized by the runtime.
|
||||
fn is_finalized_block(hash: Hash) -> bool;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user