mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 07:31:02 +00:00
Merge branch 'master' into rh-grandpa-dynamic2
This commit is contained in:
@@ -26,7 +26,7 @@ extern crate parity_codec;
|
||||
extern crate parity_codec_derive;
|
||||
|
||||
#[macro_use]
|
||||
extern crate sr_api;
|
||||
extern crate substrate_client as client;
|
||||
|
||||
use substrate_primitives::AuthorityId;
|
||||
use sr_primitives::traits::{Block as BlockT, DigestFor, NumberFor};
|
||||
@@ -48,34 +48,33 @@ pub const AUTHORITIES_CALL: &str = "grandpa_authorities";
|
||||
|
||||
/// The ApiIds for GRANDPA API.
|
||||
pub mod id {
|
||||
use sr_api::ApiId;
|
||||
use client::runtime_api::ApiId;
|
||||
|
||||
/// ApiId for the GrandpaApi trait.
|
||||
pub const GRANDPA_API: ApiId = *b"fgrandpa";
|
||||
}
|
||||
|
||||
decl_apis! {
|
||||
/// APIs for integrating the GRANDPA finality gadget into runtimes.
|
||||
/// APIs for integrating the GRANDPA finality gadget into runtimes.
|
||||
/// This should be implemented on the runtime side.
|
||||
///
|
||||
/// This is primarily used for negotiating authority-set changes for the
|
||||
/// gadget. GRANDPA uses a signalling model of changing authority sets:
|
||||
/// changes should be signalled with a delay of N blocks, and then automatically
|
||||
/// applied in the runtime after those N blocks have passed.
|
||||
///
|
||||
/// The consensus protocol will coordinate the handoff externally.
|
||||
pub trait GrandpaApi<B: BlockT> {
|
||||
/// Check a digest for pending changes.
|
||||
/// Return `None` if there are no pending changes.
|
||||
///
|
||||
/// This is primarily used for negotiating authority-set changes for the
|
||||
/// gadget. GRANDPA uses a signalling model of changing authority sets:
|
||||
/// changes should be signalled with a delay of N blocks, and then automatically
|
||||
/// applied in the runtime after those N blocks have passed.
|
||||
/// Precedence towards earlier or later digest items can be given
|
||||
/// based on the rules of the chain.
|
||||
///
|
||||
/// The consensus protocol will coordinate the handoff externally.
|
||||
pub trait GrandpaApi<B: BlockT> {
|
||||
/// Check a digest for pending changes.
|
||||
/// Return `None` if there are no pending changes.
|
||||
///
|
||||
/// Precedence towards earlier or later digest items can be given
|
||||
/// based on the rules of the chain.
|
||||
///
|
||||
/// No change should be scheduled if one is already and the delay has not
|
||||
/// passed completely.
|
||||
fn grandpa_pending_change(digest: DigestFor<B>) -> Option<ScheduledChange<NumberFor<B>>>;
|
||||
/// No change should be scheduled if one is already and the delay has not
|
||||
/// passed completely.
|
||||
fn grandpa_pending_change(digest: DigestFor<B>) -> Option<ScheduledChange<NumberFor<B>>>;
|
||||
|
||||
/// Get the current GRANDPA authorities and weights. This should not change except
|
||||
/// for when changes are scheduled and the corresponding delay has passed.
|
||||
fn grandpa_authorities() -> Vec<(AuthorityId, u64)>;
|
||||
}
|
||||
/// Get the current GRANDPA authorities and weights. This should not change except
|
||||
/// for when changes are scheduled and the corresponding delay has passed.
|
||||
fn grandpa_authorities() -> Vec<(AuthorityId, u64)>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user