mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 23:21:02 +00:00
Overhaul crypto (Schnorr/Ristretto, HDKD, BIP39) (#1795)
* Rijig to Ristretto * Rebuild wasm * adds compatibility test with the wasm module * Add Ed25519-BIP39 support * Bump subkey version * Update CLI output * New keys. * Standard phrase/password/path keys. * Subkey uses S-URI for secrets * Move everything to use new HDKD crypto. * Test fixes * Ignore old test vector. * fix the ^^ old test vector. * Fix tests * Test fixes * Cleanups * Fix broken key conversion logic in grandpa CC @rphmeier * Remove legacy Keyring usage * Traitify `Pair` * Replace Ed25519AuthorityId with ed25519::Public * Expunge Ed25519AuthorityId type! * Replace Sr25519AuthorityId with sr25519::Public * Remove dodgy crypto type-punning conversions * Fix some tests * Avoid trait * Deduplicate DeriveJunction string decode * Remove cruft code * Fix test * Minor removals * Build fix * Subkey supports sign and verify * Inspect works for public key URIs * Remove more crypto type-punning * Fix typo * Fix tests
This commit is contained in:
@@ -23,17 +23,19 @@
|
||||
extern crate alloc;
|
||||
|
||||
use parity_codec::{Encode, Decode};
|
||||
use substrate_primitives::Ed25519AuthorityId;
|
||||
use substrate_primitives::ed25519;
|
||||
use sr_primitives::traits::{DigestFor, NumberFor};
|
||||
use client::decl_runtime_apis;
|
||||
use rstd::vec::Vec;
|
||||
|
||||
use ed25519::Public as AuthorityId;
|
||||
|
||||
/// A scheduled change of authority set.
|
||||
#[cfg_attr(feature = "std", derive(Debug, PartialEq))]
|
||||
#[derive(Clone, Encode, Decode)]
|
||||
pub struct ScheduledChange<N> {
|
||||
/// The new authorities after the change, along with their respective weights.
|
||||
pub next_authorities: Vec<(Ed25519AuthorityId, u64)>,
|
||||
pub next_authorities: Vec<(AuthorityId, u64)>,
|
||||
/// The number of blocks to delay.
|
||||
pub delay: N,
|
||||
}
|
||||
@@ -106,6 +108,6 @@ decl_runtime_apis! {
|
||||
/// When called at block B, it will return the set of authorities that should be
|
||||
/// used to finalize descendants of this block (B+1, B+2, ...). The block B itself
|
||||
/// is finalized by the authorities from block B-1.
|
||||
fn grandpa_authorities() -> Vec<(Ed25519AuthorityId, u64)>;
|
||||
fn grandpa_authorities() -> Vec<(AuthorityId, u64)>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
use fork_tree::ForkTree;
|
||||
use parking_lot::RwLock;
|
||||
use substrate_primitives::Ed25519AuthorityId;
|
||||
use substrate_primitives::ed25519;
|
||||
use grandpa::VoterSet;
|
||||
use parity_codec::{Encode, Decode};
|
||||
use log::{debug, info};
|
||||
@@ -28,6 +28,8 @@ use std::fmt::Debug;
|
||||
use std::ops::Add;
|
||||
use std::sync::Arc;
|
||||
|
||||
use ed25519::Public as AuthorityId;
|
||||
|
||||
/// A shared authority set.
|
||||
pub(crate) struct SharedAuthoritySet<H, N> {
|
||||
inner: Arc<RwLock<AuthoritySet<H, N>>>,
|
||||
@@ -61,7 +63,7 @@ where N: Add<Output=N> + Ord + Clone + Debug,
|
||||
}
|
||||
|
||||
/// Get the current authorities and their weights (for the current set ID).
|
||||
pub(crate) fn current_authorities(&self) -> VoterSet<Ed25519AuthorityId> {
|
||||
pub(crate) fn current_authorities(&self) -> VoterSet<AuthorityId> {
|
||||
self.inner.read().current_authorities.iter().cloned().collect()
|
||||
}
|
||||
}
|
||||
@@ -85,7 +87,7 @@ pub(crate) struct Status<H, N> {
|
||||
/// A set of authorities.
|
||||
#[derive(Debug, Clone, Encode, Decode, PartialEq)]
|
||||
pub(crate) struct AuthoritySet<H, N> {
|
||||
pub(crate) current_authorities: Vec<(Ed25519AuthorityId, u64)>,
|
||||
pub(crate) current_authorities: Vec<(AuthorityId, u64)>,
|
||||
pub(crate) set_id: u64,
|
||||
// Tree of pending standard changes across forks. Standard changes are
|
||||
// enacted on finality and must be enacted (i.e. finalized) in-order across
|
||||
@@ -102,7 +104,7 @@ where H: PartialEq,
|
||||
N: Ord,
|
||||
{
|
||||
/// Get a genesis set with given authorities.
|
||||
pub(crate) fn genesis(initial: Vec<(Ed25519AuthorityId, u64)>) -> Self {
|
||||
pub(crate) fn genesis(initial: Vec<(AuthorityId, u64)>) -> Self {
|
||||
AuthoritySet {
|
||||
current_authorities: initial,
|
||||
set_id: 0,
|
||||
@@ -112,7 +114,7 @@ where H: PartialEq,
|
||||
}
|
||||
|
||||
/// Get the current set id and a reference to the current authority set.
|
||||
pub(crate) fn current(&self) -> (u64, &[(Ed25519AuthorityId, u64)]) {
|
||||
pub(crate) fn current(&self) -> (u64, &[(AuthorityId, u64)]) {
|
||||
(self.set_id, &self.current_authorities[..])
|
||||
}
|
||||
}
|
||||
@@ -379,7 +381,7 @@ pub(crate) enum DelayKind<N> {
|
||||
#[derive(Debug, Clone, Encode, PartialEq)]
|
||||
pub(crate) struct PendingChange<H, N> {
|
||||
/// The new authorities and weights to apply.
|
||||
pub(crate) next_authorities: Vec<(Ed25519AuthorityId, u64)>,
|
||||
pub(crate) next_authorities: Vec<(AuthorityId, u64)>,
|
||||
/// How deep in the chain the announcing block must be
|
||||
/// before the change is applied.
|
||||
pub(crate) delay: N,
|
||||
@@ -509,8 +511,8 @@ mod tests {
|
||||
pending_forced_changes: Vec::new(),
|
||||
};
|
||||
|
||||
let set_a = vec![([1; 32].into(), 5)];
|
||||
let set_b = vec![([2; 32].into(), 5)];
|
||||
let set_a = vec![(AuthorityId([1; 32]), 5)];
|
||||
let set_b = vec![(AuthorityId([2; 32]), 5)];
|
||||
|
||||
// two competing changes at the same height on different forks
|
||||
let change_a = PendingChange {
|
||||
@@ -574,8 +576,8 @@ mod tests {
|
||||
pending_forced_changes: Vec::new(),
|
||||
};
|
||||
|
||||
let set_a = vec![([1; 32].into(), 5)];
|
||||
let set_c = vec![([2; 32].into(), 5)];
|
||||
let set_a = vec![(AuthorityId([1; 32]), 5)];
|
||||
let set_c = vec![(AuthorityId([2; 32]), 5)];
|
||||
|
||||
// two competing changes at the same height on different forks
|
||||
let change_a = PendingChange {
|
||||
@@ -640,7 +642,7 @@ mod tests {
|
||||
pending_forced_changes: Vec::new(),
|
||||
};
|
||||
|
||||
let set_a = vec![([1; 32].into(), 5)];
|
||||
let set_a = vec![(AuthorityId([1; 32]), 5)];
|
||||
|
||||
let change_a = PendingChange {
|
||||
next_authorities: set_a.clone(),
|
||||
@@ -676,8 +678,8 @@ mod tests {
|
||||
pending_forced_changes: Vec::new(),
|
||||
};
|
||||
|
||||
let set_a = vec![([1; 32].into(), 5)];
|
||||
let set_b = vec![([2; 32].into(), 5)];
|
||||
let set_a = vec![(AuthorityId([1; 32]), 5)];
|
||||
let set_b = vec![(AuthorityId([2; 32]), 5)];
|
||||
|
||||
let change_a = PendingChange {
|
||||
next_authorities: set_a.clone(),
|
||||
|
||||
@@ -16,20 +16,20 @@
|
||||
|
||||
//! Schema for stuff in the aux-db.
|
||||
|
||||
use std::fmt::Debug;
|
||||
use std::sync::Arc;
|
||||
use parity_codec::{Encode, Decode};
|
||||
use client::backend::AuxStore;
|
||||
use client::error::{Result as ClientResult, Error as ClientError, ErrorKind as ClientErrorKind};
|
||||
use fork_tree::ForkTree;
|
||||
use grandpa::round::State as RoundState;
|
||||
use substrate_primitives::Ed25519AuthorityId;
|
||||
use log::{info, warn};
|
||||
|
||||
use crate::authorities::{AuthoritySet, SharedAuthoritySet, PendingChange, DelayKind};
|
||||
use crate::consensus_changes::{SharedConsensusChanges, ConsensusChanges};
|
||||
use crate::NewAuthoritySet;
|
||||
|
||||
use std::fmt::Debug;
|
||||
use std::sync::Arc;
|
||||
use substrate_primitives::ed25519::Public as AuthorityId;
|
||||
|
||||
const VERSION_KEY: &[u8] = b"grandpa_schema_version";
|
||||
const SET_STATE_KEY: &[u8] = b"grandpa_completed_round";
|
||||
@@ -61,7 +61,7 @@ type V0VoterSetState<H, N> = (u64, RoundState<H, N>);
|
||||
|
||||
#[derive(Debug, Clone, Encode, Decode, PartialEq)]
|
||||
struct V0PendingChange<H, N> {
|
||||
next_authorities: Vec<(Ed25519AuthorityId, u64)>,
|
||||
next_authorities: Vec<(AuthorityId, u64)>,
|
||||
delay: N,
|
||||
canon_height: N,
|
||||
canon_hash: H,
|
||||
@@ -69,7 +69,7 @@ struct V0PendingChange<H, N> {
|
||||
|
||||
#[derive(Debug, Clone, Encode, Decode, PartialEq)]
|
||||
struct V0AuthoritySet<H, N> {
|
||||
current_authorities: Vec<(Ed25519AuthorityId, u64)>,
|
||||
current_authorities: Vec<(AuthorityId, u64)>,
|
||||
set_id: u64,
|
||||
pending_changes: Vec<V0PendingChange<H, N>>,
|
||||
}
|
||||
@@ -141,7 +141,7 @@ pub(crate) fn load_persistent<B, H, N, G>(
|
||||
B: AuxStore,
|
||||
H: Debug + Decode + Encode + Clone + PartialEq,
|
||||
N: Debug + Decode + Encode + Clone + Ord,
|
||||
G: FnOnce() -> ClientResult<Vec<(Ed25519AuthorityId, u64)>>
|
||||
G: FnOnce() -> ClientResult<Vec<(AuthorityId, u64)>>
|
||||
{
|
||||
let version: Option<u32> = load_decode(backend, VERSION_KEY)?;
|
||||
let consensus_changes = load_decode(backend, CONSENSUS_CHANGES_KEY)?
|
||||
|
||||
@@ -25,11 +25,12 @@ use futures::prelude::*;
|
||||
use futures::sync::mpsc;
|
||||
use log::{debug, trace};
|
||||
use parity_codec::{Encode, Decode};
|
||||
use substrate_primitives::{ed25519, Ed25519AuthorityId};
|
||||
use substrate_primitives::{ed25519, Pair};
|
||||
use runtime_primitives::traits::Block as BlockT;
|
||||
use tokio::timer::Interval;
|
||||
use crate::{Error, Network, Message, SignedMessage, Commit,
|
||||
CompactCommit, GossipMessage, FullCommitMessage, VoteOrPrecommitMessage};
|
||||
use ed25519::{Public as AuthorityId, Signature as AuthoritySignature};
|
||||
|
||||
fn localized_payload<E: Encode>(round: u64, set_id: u64, message: &E) -> Vec<u8> {
|
||||
(message, round, set_id).encode()
|
||||
@@ -242,14 +243,14 @@ impl<B: BlockT, N: Network<B>> Network<B> for BroadcastHandle<B, N> {
|
||||
// check a message.
|
||||
pub(crate) fn check_message_sig<Block: BlockT>(
|
||||
message: &Message<Block>,
|
||||
id: &Ed25519AuthorityId,
|
||||
signature: &ed25519::Signature,
|
||||
id: &AuthorityId,
|
||||
signature: &AuthoritySignature,
|
||||
round: u64,
|
||||
set_id: u64,
|
||||
) -> Result<(), ()> {
|
||||
let as_public = ed25519::Public::from_raw(id.0);
|
||||
let as_public = AuthorityId::from_raw(id.0);
|
||||
let encoded_raw = localized_payload(round, set_id, message);
|
||||
if ed25519::verify_strong(signature, &encoded_raw, as_public) {
|
||||
if ed25519::Pair::verify(signature, &encoded_raw, as_public) {
|
||||
Ok(())
|
||||
} else {
|
||||
debug!(target: "afg", "Bad signature on message from {:?}", id);
|
||||
@@ -261,7 +262,7 @@ pub(crate) fn check_message_sig<Block: BlockT>(
|
||||
/// the output stream checks signatures also.
|
||||
pub(crate) fn checked_message_stream<Block: BlockT, S>(
|
||||
inner: S,
|
||||
voters: Arc<VoterSet<Ed25519AuthorityId>>,
|
||||
voters: Arc<VoterSet<AuthorityId>>,
|
||||
)
|
||||
-> impl Stream<Item=SignedMessage<Block>,Error=Error> where
|
||||
S: Stream<Item=Vec<u8>,Error=()>
|
||||
@@ -297,7 +298,7 @@ pub(crate) fn checked_message_stream<Block: BlockT, S>(
|
||||
pub(crate) struct OutgoingMessages<Block: BlockT, N: Network<Block>> {
|
||||
round: u64,
|
||||
set_id: u64,
|
||||
locals: Option<(Arc<ed25519::Pair>, Ed25519AuthorityId)>,
|
||||
locals: Option<(Arc<ed25519::Pair>, AuthorityId)>,
|
||||
sender: mpsc::UnboundedSender<SignedMessage<Block>>,
|
||||
network: N,
|
||||
}
|
||||
@@ -309,7 +310,7 @@ impl<Block: BlockT, N: Network<Block>> Sink for OutgoingMessages<Block, N>
|
||||
|
||||
fn start_send(&mut self, msg: Message<Block>) -> StartSend<Message<Block>, Error> {
|
||||
// when locals exist, sign messages on import
|
||||
if let Some((ref pair, local_id)) = self.locals {
|
||||
if let Some((ref pair, ref local_id)) = self.locals {
|
||||
let encoded = localized_payload(self.round, self.set_id, &msg);
|
||||
let signature = pair.sign(&encoded[..]);
|
||||
|
||||
@@ -317,7 +318,7 @@ impl<Block: BlockT, N: Network<Block>> Sink for OutgoingMessages<Block, N>
|
||||
let signed = SignedMessage::<Block> {
|
||||
message: msg,
|
||||
signature,
|
||||
id: local_id,
|
||||
id: local_id.clone(),
|
||||
};
|
||||
|
||||
let message = GossipMessage::VoteOrPrecommit(VoteOrPrecommitMessage::<Block> {
|
||||
@@ -361,7 +362,7 @@ pub(crate) fn outgoing_messages<Block: BlockT, N: Network<Block>>(
|
||||
round: u64,
|
||||
set_id: u64,
|
||||
local_key: Option<Arc<ed25519::Pair>>,
|
||||
voters: Arc<VoterSet<Ed25519AuthorityId>>,
|
||||
voters: Arc<VoterSet<AuthorityId>>,
|
||||
network: N,
|
||||
) -> (
|
||||
impl Stream<Item=SignedMessage<Block>,Error=Error>,
|
||||
@@ -369,7 +370,7 @@ pub(crate) fn outgoing_messages<Block: BlockT, N: Network<Block>>(
|
||||
) {
|
||||
let locals = local_key.and_then(|pair| {
|
||||
let public = pair.public();
|
||||
let id = Ed25519AuthorityId(public.0);
|
||||
let id = AuthorityId(public.0);
|
||||
if voters.contains_key(&id) {
|
||||
Some((pair, id))
|
||||
} else {
|
||||
@@ -395,7 +396,7 @@ pub(crate) fn outgoing_messages<Block: BlockT, N: Network<Block>>(
|
||||
|
||||
fn check_compact_commit<Block: BlockT>(
|
||||
msg: CompactCommit<Block>,
|
||||
voters: &VoterSet<Ed25519AuthorityId>,
|
||||
voters: &VoterSet<AuthorityId>,
|
||||
) -> Option<CompactCommit<Block>> {
|
||||
if msg.precommits.len() != msg.auth_data.len() || msg.precommits.is_empty() {
|
||||
debug!(target: "afg", "Skipping malformed compact commit");
|
||||
@@ -417,7 +418,7 @@ fn check_compact_commit<Block: BlockT>(
|
||||
/// messages.
|
||||
pub(crate) fn checked_commit_stream<Block: BlockT, S>(
|
||||
inner: S,
|
||||
voters: Arc<VoterSet<Ed25519AuthorityId>>,
|
||||
voters: Arc<VoterSet<AuthorityId>>,
|
||||
)
|
||||
-> impl Stream<Item=(u64, CompactCommit<Block>),Error=Error> where
|
||||
S: Stream<Item=Vec<u8>,Error=()>
|
||||
|
||||
@@ -33,7 +33,7 @@ use runtime_primitives::generic::BlockId;
|
||||
use runtime_primitives::traits::{
|
||||
As, Block as BlockT, Header as HeaderT, NumberFor, One, Zero,
|
||||
};
|
||||
use substrate_primitives::{Blake2Hasher, ed25519,Ed25519AuthorityId, H256};
|
||||
use substrate_primitives::{Blake2Hasher, ed25519, H256, Pair};
|
||||
|
||||
use crate::{
|
||||
Commit, Config, Error, Network, Precommit, Prevote,
|
||||
@@ -45,6 +45,8 @@ use crate::consensus_changes::SharedConsensusChanges;
|
||||
use crate::justification::GrandpaJustification;
|
||||
use crate::until_imported::UntilVoteTargetImported;
|
||||
|
||||
use ed25519::Public as AuthorityId;
|
||||
|
||||
/// Data about a completed round.
|
||||
pub(crate) type CompletedRound<H, N> = (u64, RoundState<H, N>);
|
||||
|
||||
@@ -75,7 +77,7 @@ impl<H: Clone, N: Clone> LastCompletedRound<H, N> {
|
||||
/// The environment we run GRANDPA in.
|
||||
pub(crate) struct Environment<B, E, Block: BlockT, N: Network<Block>, RA> {
|
||||
pub(crate) inner: Arc<Client<B, E, Block, RA>>,
|
||||
pub(crate) voters: Arc<VoterSet<Ed25519AuthorityId>>,
|
||||
pub(crate) voters: Arc<VoterSet<AuthorityId>>,
|
||||
pub(crate) config: Config,
|
||||
pub(crate) authority_set: SharedAuthoritySet<Block::Hash, NumberFor<Block>>,
|
||||
pub(crate) consensus_changes: SharedConsensusChanges<Block::Hash, NumberFor<Block>>,
|
||||
@@ -205,7 +207,7 @@ impl<B, E, Block: BlockT<Hash=H256>, N, RA> voter::Environment<Block::Hash, Numb
|
||||
NumberFor<Block>: BlockNumberOps,
|
||||
{
|
||||
type Timer = Box<dyn Future<Item = (), Error = Self::Error> + Send>;
|
||||
type Id = Ed25519AuthorityId;
|
||||
type Id = AuthorityId;
|
||||
type Signature = ed25519::Signature;
|
||||
|
||||
// regular round message streams
|
||||
|
||||
@@ -42,7 +42,8 @@ use runtime_primitives::generic::BlockId;
|
||||
use runtime_primitives::traits::{
|
||||
NumberFor, Block as BlockT, Header as HeaderT, One,
|
||||
};
|
||||
use substrate_primitives::{Ed25519AuthorityId, H256};
|
||||
use substrate_primitives::{ed25519, H256};
|
||||
use ed25519::Public as AuthorityId;
|
||||
|
||||
use crate::justification::GrandpaJustification;
|
||||
|
||||
@@ -189,7 +190,7 @@ fn do_check_finality_proof<Block: BlockT<Hash=H256>, C, J>(
|
||||
call_data: vec![],
|
||||
retry_count: None,
|
||||
})?;
|
||||
let grandpa_authorities: Vec<(Ed25519AuthorityId, u64)> = Decode::decode(&mut &grandpa_authorities[..])
|
||||
let grandpa_authorities: Vec<(AuthorityId, u64)> = Decode::decode(&mut &grandpa_authorities[..])
|
||||
.ok_or_else(|| ClientErrorKind::BadJustification("failed to decode GRANDPA authorities set proof".into()))?;
|
||||
|
||||
// and now check justification
|
||||
@@ -222,7 +223,7 @@ trait ProvableJustification<Header: HeaderT>: Encode + Decode {
|
||||
fn target_block(&self) -> (Header::Number, Header::Hash);
|
||||
|
||||
/// Verify justification with respect to authorities set and authorities set id.
|
||||
fn verify(&self, set_id: u64, authorities: &VoterSet<Ed25519AuthorityId>) -> ClientResult<()>;
|
||||
fn verify(&self, set_id: u64, authorities: &VoterSet<AuthorityId>) -> ClientResult<()>;
|
||||
}
|
||||
|
||||
impl<Block: BlockT<Hash=H256>> ProvableJustification<Block::Header> for GrandpaJustification<Block>
|
||||
@@ -233,7 +234,7 @@ impl<Block: BlockT<Hash=H256>> ProvableJustification<Block::Header> for GrandpaJ
|
||||
(self.commit.target_number, self.commit.target_hash)
|
||||
}
|
||||
|
||||
fn verify(&self, set_id: u64, authorities: &VoterSet<Ed25519AuthorityId>) -> ClientResult<()> {
|
||||
fn verify(&self, set_id: u64, authorities: &VoterSet<AuthorityId>) -> ClientResult<()> {
|
||||
GrandpaJustification::verify(self, set_id, authorities)
|
||||
}
|
||||
}
|
||||
@@ -253,12 +254,12 @@ mod tests {
|
||||
impl ProvableJustification<Header> for ValidFinalityProof {
|
||||
fn target_block(&self) -> (u64, H256) { (3, header(3).hash()) }
|
||||
|
||||
fn verify(&self, set_id: u64, authorities: &VoterSet<Ed25519AuthorityId>) -> ClientResult<()> {
|
||||
fn verify(&self, set_id: u64, authorities: &VoterSet<AuthorityId>) -> ClientResult<()> {
|
||||
assert_eq!(set_id, 1);
|
||||
assert_eq!(authorities, &vec![
|
||||
(Ed25519AuthorityId([1u8; 32]), 1),
|
||||
(Ed25519AuthorityId([2u8; 32]), 2),
|
||||
(Ed25519AuthorityId([3u8; 32]), 3),
|
||||
(AuthorityId([1u8; 32]), 1),
|
||||
(AuthorityId([2u8; 32]), 2),
|
||||
(AuthorityId([3u8; 32]), 3),
|
||||
].into_iter().collect());
|
||||
Ok(())
|
||||
}
|
||||
@@ -387,7 +388,7 @@ mod tests {
|
||||
impl ProvableJustification<Header> for InvalidFinalityProof {
|
||||
fn target_block(&self) -> (u64, H256) { (3, header(3).hash()) }
|
||||
|
||||
fn verify(&self, _set_id: u64, _authorities: &VoterSet<Ed25519AuthorityId>) -> ClientResult<()> {
|
||||
fn verify(&self, _set_id: u64, _authorities: &VoterSet<AuthorityId>) -> ClientResult<()> {
|
||||
Err(ClientErrorKind::Backend("test error".into()).into())
|
||||
}
|
||||
}
|
||||
@@ -415,9 +416,9 @@ mod tests {
|
||||
.unwrap().unwrap();
|
||||
assert_eq!(do_check_finality_proof::<Block, _, ValidFinalityProof>(
|
||||
|_| Ok(vec![
|
||||
(Ed25519AuthorityId([1u8; 32]), 1u64),
|
||||
(Ed25519AuthorityId([2u8; 32]), 2u64),
|
||||
(Ed25519AuthorityId([3u8; 32]), 3u64),
|
||||
(AuthorityId([1u8; 32]), 1u64),
|
||||
(AuthorityId([2u8; 32]), 2u64),
|
||||
(AuthorityId([3u8; 32]), 3u64),
|
||||
].encode()),
|
||||
header(1),
|
||||
(2, header(2).hash()),
|
||||
|
||||
@@ -36,7 +36,7 @@ use runtime_primitives::traits::{
|
||||
Block as BlockT, DigestFor, DigestItemFor, DigestItem,
|
||||
Header as HeaderT, NumberFor, ProvideRuntimeApi,
|
||||
};
|
||||
use substrate_primitives::{H256, Ed25519AuthorityId, Blake2Hasher};
|
||||
use substrate_primitives::{H256, ed25519, Blake2Hasher};
|
||||
|
||||
use crate::{Error, CommandOrError, NewAuthoritySet, VoterCommand};
|
||||
use crate::authorities::{AuthoritySet, SharedAuthoritySet, DelayKind, PendingChange};
|
||||
@@ -44,6 +44,8 @@ use crate::consensus_changes::SharedConsensusChanges;
|
||||
use crate::environment::{finalize_block, is_descendent_of};
|
||||
use crate::justification::GrandpaJustification;
|
||||
|
||||
use ed25519::Public as AuthorityId;
|
||||
|
||||
/// A block-import handler for GRANDPA.
|
||||
///
|
||||
/// This scans each imported block for signals of changing authority set.
|
||||
@@ -67,7 +69,7 @@ impl<B, E, Block: BlockT<Hash=H256>, RA, PRA> JustificationImport<Block>
|
||||
B: Backend<Block, Blake2Hasher> + 'static,
|
||||
E: CallExecutor<Block, Blake2Hasher> + 'static + Clone + Send + Sync,
|
||||
DigestFor<Block>: Encode,
|
||||
DigestItemFor<Block>: DigestItem<AuthorityId=Ed25519AuthorityId>,
|
||||
DigestItemFor<Block>: DigestItem<AuthorityId=AuthorityId>,
|
||||
RA: Send + Sync,
|
||||
PRA: ProvideRuntimeApi,
|
||||
PRA::Api: GrandpaApi<Block>,
|
||||
@@ -161,7 +163,7 @@ impl<B, E, Block: BlockT<Hash=H256>, RA, PRA> GrandpaBlockImport<B, E, Block, RA
|
||||
B: Backend<Block, Blake2Hasher> + 'static,
|
||||
E: CallExecutor<Block, Blake2Hasher> + 'static + Clone + Send + Sync,
|
||||
DigestFor<Block>: Encode,
|
||||
DigestItemFor<Block>: DigestItem<AuthorityId=Ed25519AuthorityId>,
|
||||
DigestItemFor<Block>: DigestItem<AuthorityId=AuthorityId>,
|
||||
RA: Send + Sync,
|
||||
PRA: ProvideRuntimeApi,
|
||||
PRA::Api: GrandpaApi<Block>,
|
||||
@@ -379,14 +381,14 @@ impl<B, E, Block: BlockT<Hash=H256>, RA, PRA> BlockImport<Block>
|
||||
B: Backend<Block, Blake2Hasher> + 'static,
|
||||
E: CallExecutor<Block, Blake2Hasher> + 'static + Clone + Send + Sync,
|
||||
DigestFor<Block>: Encode,
|
||||
DigestItemFor<Block>: DigestItem<AuthorityId=Ed25519AuthorityId>,
|
||||
DigestItemFor<Block>: DigestItem<AuthorityId=AuthorityId>,
|
||||
RA: Send + Sync,
|
||||
PRA: ProvideRuntimeApi,
|
||||
PRA::Api: GrandpaApi<Block>,
|
||||
{
|
||||
type Error = ConsensusError;
|
||||
|
||||
fn import_block(&self, mut block: ImportBlock<Block>, new_authorities: Option<Vec<Ed25519AuthorityId>>)
|
||||
fn import_block(&self, mut block: ImportBlock<Block>, new_authorities: Option<Vec<AuthorityId>>)
|
||||
-> Result<ImportResult, Self::Error>
|
||||
{
|
||||
let hash = block.post_header().hash();
|
||||
|
||||
@@ -25,11 +25,13 @@ use grandpa::VoterSet;
|
||||
use grandpa::{Error as GrandpaError};
|
||||
use runtime_primitives::generic::BlockId;
|
||||
use runtime_primitives::traits::{NumberFor, Block as BlockT, Header as HeaderT};
|
||||
use substrate_primitives::{H256, Ed25519AuthorityId, Blake2Hasher};
|
||||
use substrate_primitives::{H256, ed25519, Blake2Hasher};
|
||||
|
||||
use crate::{Commit, Error};
|
||||
use crate::communication;
|
||||
|
||||
use ed25519::Public as AuthorityId;
|
||||
|
||||
/// A GRANDPA justification for block finality, it includes a commit message and
|
||||
/// an ancestry proof including all headers routing all precommit target blocks
|
||||
/// to the commit target block. Due to the current voting strategy the precommit
|
||||
@@ -95,7 +97,7 @@ impl<Block: BlockT<Hash=H256>> GrandpaJustification<Block> {
|
||||
pub(crate) fn decode_and_verify(
|
||||
encoded: Vec<u8>,
|
||||
set_id: u64,
|
||||
voters: &VoterSet<Ed25519AuthorityId>,
|
||||
voters: &VoterSet<AuthorityId>,
|
||||
) -> Result<GrandpaJustification<Block>, ClientError> where
|
||||
NumberFor<Block>: grandpa::BlockNumberOps,
|
||||
{
|
||||
@@ -106,7 +108,7 @@ impl<Block: BlockT<Hash=H256>> GrandpaJustification<Block> {
|
||||
}
|
||||
|
||||
/// Validate the commit and the votes' ancestry proofs.
|
||||
pub(crate) fn verify(&self, set_id: u64, voters: &VoterSet<Ed25519AuthorityId>) -> Result<(), ClientError>
|
||||
pub(crate) fn verify(&self, set_id: u64, voters: &VoterSet<AuthorityId>) -> Result<(), ClientError>
|
||||
where
|
||||
NumberFor<Block>: grandpa::BlockNumberOps,
|
||||
{
|
||||
|
||||
@@ -68,7 +68,7 @@ use runtime_primitives::traits::{
|
||||
use fg_primitives::GrandpaApi;
|
||||
use inherents::InherentDataProviders;
|
||||
use runtime_primitives::generic::BlockId;
|
||||
use substrate_primitives::{ed25519, H256, Ed25519AuthorityId, Blake2Hasher};
|
||||
use substrate_primitives::{ed25519, H256, Blake2Hasher, Pair};
|
||||
use substrate_telemetry::{telemetry, CONSENSUS_TRACE, CONSENSUS_DEBUG, CONSENSUS_WARN};
|
||||
|
||||
use srml_finality_tracker;
|
||||
@@ -106,6 +106,8 @@ pub use finality_proof::{prove_finality, check_finality_proof};
|
||||
use import::GrandpaBlockImport;
|
||||
use until_imported::UntilCommitBlocksImported;
|
||||
|
||||
use ed25519::{Public as AuthorityId, Signature as AuthoritySignature};
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
@@ -118,8 +120,8 @@ pub type Message<Block> = grandpa::Message<<Block as BlockT>::Hash, NumberFor<Bl
|
||||
pub type SignedMessage<Block> = grandpa::SignedMessage<
|
||||
<Block as BlockT>::Hash,
|
||||
NumberFor<Block>,
|
||||
ed25519::Signature,
|
||||
Ed25519AuthorityId,
|
||||
AuthoritySignature,
|
||||
AuthorityId,
|
||||
>;
|
||||
|
||||
/// Grandpa gossip message type.
|
||||
@@ -148,15 +150,15 @@ pub type Precommit<Block> = grandpa::Precommit<<Block as BlockT>::Hash, NumberFo
|
||||
pub type Commit<Block> = grandpa::Commit<
|
||||
<Block as BlockT>::Hash,
|
||||
NumberFor<Block>,
|
||||
ed25519::Signature,
|
||||
Ed25519AuthorityId
|
||||
AuthoritySignature,
|
||||
AuthorityId
|
||||
>;
|
||||
/// A compact commit message for this chain's block type.
|
||||
pub type CompactCommit<Block> = grandpa::CompactCommit<
|
||||
<Block as BlockT>::Hash,
|
||||
NumberFor<Block>,
|
||||
ed25519::Signature,
|
||||
Ed25519AuthorityId
|
||||
AuthoritySignature,
|
||||
AuthorityId
|
||||
>;
|
||||
|
||||
/// Network level commit message with topic information.
|
||||
@@ -560,7 +562,7 @@ pub(crate) struct NewAuthoritySet<H, N> {
|
||||
pub(crate) canon_number: N,
|
||||
pub(crate) canon_hash: H,
|
||||
pub(crate) set_id: u64,
|
||||
pub(crate) authorities: Vec<(Ed25519AuthorityId, u64)>,
|
||||
pub(crate) authorities: Vec<(AuthorityId, u64)>,
|
||||
}
|
||||
|
||||
/// Commands issued to the voter.
|
||||
@@ -684,16 +686,16 @@ pub fn block_import<B, E, Block: BlockT<Hash=H256>, RA, PRA>(
|
||||
fn committer_communication<Block: BlockT<Hash=H256>, B, E, N, RA>(
|
||||
local_key: Option<Arc<ed25519::Pair>>,
|
||||
set_id: u64,
|
||||
voters: &Arc<VoterSet<Ed25519AuthorityId>>,
|
||||
voters: &Arc<VoterSet<AuthorityId>>,
|
||||
client: &Arc<Client<B, E, Block, RA>>,
|
||||
network: &N,
|
||||
) -> (
|
||||
impl Stream<
|
||||
Item = (u64, ::grandpa::CompactCommit<H256, NumberFor<Block>, ed25519::Signature, Ed25519AuthorityId>),
|
||||
Item = (u64, ::grandpa::CompactCommit<H256, NumberFor<Block>, AuthoritySignature, AuthorityId>),
|
||||
Error = CommandOrError<H256, NumberFor<Block>>,
|
||||
>,
|
||||
impl Sink<
|
||||
SinkItem = (u64, ::grandpa::Commit<H256, NumberFor<Block>, ed25519::Signature, Ed25519AuthorityId>),
|
||||
SinkItem = (u64, ::grandpa::Commit<H256, NumberFor<Block>, AuthoritySignature, AuthorityId>),
|
||||
SinkError = CommandOrError<H256, NumberFor<Block>>,
|
||||
>,
|
||||
) where
|
||||
@@ -702,7 +704,7 @@ fn committer_communication<Block: BlockT<Hash=H256>, B, E, N, RA>(
|
||||
N: Network<Block>,
|
||||
RA: Send + Sync,
|
||||
NumberFor<Block>: BlockNumberOps,
|
||||
DigestItemFor<Block>: DigestItem<AuthorityId=Ed25519AuthorityId>,
|
||||
DigestItemFor<Block>: DigestItem<AuthorityId=AuthorityId>,
|
||||
{
|
||||
// verification stream
|
||||
let commit_in = crate::communication::checked_commit_stream::<Block, _>(
|
||||
@@ -773,7 +775,7 @@ pub fn run_grandpa<B, E, Block: BlockT<Hash=H256>, N, RA>(
|
||||
N::In: Send + 'static,
|
||||
NumberFor<Block>: BlockNumberOps,
|
||||
DigestFor<Block>: Encode,
|
||||
DigestItemFor<Block>: DigestItem<AuthorityId=Ed25519AuthorityId>,
|
||||
DigestItemFor<Block>: DigestItem<AuthorityId=AuthorityId>,
|
||||
RA: Send + Sync + 'static,
|
||||
{
|
||||
use futures::future::{self, Loop as FutureLoop};
|
||||
|
||||
@@ -22,7 +22,7 @@ use network::test::{PassThroughVerifier};
|
||||
use network::config::{ProtocolConfig, Roles};
|
||||
use parking_lot::Mutex;
|
||||
use tokio::runtime::current_thread;
|
||||
use keyring::Keyring;
|
||||
use keyring::AuthorityKeyring;
|
||||
use client::{
|
||||
BlockchainEvents, error::Result,
|
||||
blockchain::Backend as BlockchainBackend,
|
||||
@@ -238,13 +238,13 @@ impl Network<Block> for MessageRouting {
|
||||
|
||||
#[derive(Default, Clone)]
|
||||
struct TestApi {
|
||||
genesis_authorities: Vec<(Ed25519AuthorityId, u64)>,
|
||||
genesis_authorities: Vec<(AuthorityId, u64)>,
|
||||
scheduled_changes: Arc<Mutex<HashMap<Hash, ScheduledChange<BlockNumber>>>>,
|
||||
forced_changes: Arc<Mutex<HashMap<Hash, (BlockNumber, ScheduledChange<BlockNumber>)>>>,
|
||||
}
|
||||
|
||||
impl TestApi {
|
||||
fn new(genesis_authorities: Vec<(Ed25519AuthorityId, u64)>) -> Self {
|
||||
fn new(genesis_authorities: Vec<(AuthorityId, u64)>) -> Self {
|
||||
TestApi {
|
||||
genesis_authorities,
|
||||
scheduled_changes: Arc::new(Mutex::new(HashMap::new())),
|
||||
@@ -282,7 +282,7 @@ impl Core<Block> for RuntimeApi {
|
||||
_: ExecutionContext,
|
||||
_: Option<()>,
|
||||
_: Vec<u8>,
|
||||
) -> Result<NativeOrEncoded<Vec<Ed25519AuthorityId>>> {
|
||||
) -> Result<NativeOrEncoded<Vec<AuthorityId>>> {
|
||||
unimplemented!("Not required for testing!")
|
||||
}
|
||||
|
||||
@@ -327,7 +327,7 @@ impl GrandpaApi<Block> for RuntimeApi {
|
||||
_: ExecutionContext,
|
||||
_: Option<()>,
|
||||
_: Vec<u8>,
|
||||
) -> Result<NativeOrEncoded<Vec<(Ed25519AuthorityId, u64)>>> {
|
||||
) -> Result<NativeOrEncoded<Vec<(AuthorityId, u64)>>> {
|
||||
if at == &BlockId::Number(0) {
|
||||
Ok(self.inner.genesis_authorities.clone()).map(NativeOrEncoded::Native)
|
||||
} else {
|
||||
@@ -374,9 +374,9 @@ impl GrandpaApi<Block> for RuntimeApi {
|
||||
const TEST_GOSSIP_DURATION: Duration = Duration::from_millis(500);
|
||||
const TEST_ROUTING_INTERVAL: Duration = Duration::from_millis(50);
|
||||
|
||||
fn make_ids(keys: &[Keyring]) -> Vec<(Ed25519AuthorityId, u64)> {
|
||||
fn make_ids(keys: &[AuthorityKeyring]) -> Vec<(AuthorityId, u64)> {
|
||||
keys.iter()
|
||||
.map(|key| Ed25519AuthorityId(key.to_raw_public()))
|
||||
.map(|key| AuthorityId(key.to_raw_public()))
|
||||
.map(|id| (id, 1))
|
||||
.collect()
|
||||
}
|
||||
@@ -386,7 +386,7 @@ fn make_ids(keys: &[Keyring]) -> Vec<(Ed25519AuthorityId, u64)> {
|
||||
fn run_to_completion_with<F: FnOnce()>(
|
||||
blocks: u64,
|
||||
net: Arc<Mutex<GrandpaTestNet>>,
|
||||
peers: &[Keyring],
|
||||
peers: &[AuthorityKeyring],
|
||||
before_waiting: F,
|
||||
) -> u64 {
|
||||
use parking_lot::RwLock;
|
||||
@@ -462,14 +462,14 @@ fn run_to_completion_with<F: FnOnce()>(
|
||||
highest_finalized
|
||||
}
|
||||
|
||||
fn run_to_completion(blocks: u64, net: Arc<Mutex<GrandpaTestNet>>, peers: &[Keyring]) -> u64 {
|
||||
fn run_to_completion(blocks: u64, net: Arc<Mutex<GrandpaTestNet>>, peers: &[AuthorityKeyring]) -> u64 {
|
||||
run_to_completion_with(blocks, net, peers, || {})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn finalize_3_voters_no_observers() {
|
||||
let _ = env_logger::try_init();
|
||||
let peers = &[Keyring::Alice, Keyring::Bob, Keyring::Charlie];
|
||||
let peers = &[AuthorityKeyring::Alice, AuthorityKeyring::Bob, AuthorityKeyring::Charlie];
|
||||
let voters = make_ids(peers);
|
||||
|
||||
let mut net = GrandpaTestNet::new(TestApi::new(voters), 3);
|
||||
@@ -491,7 +491,7 @@ fn finalize_3_voters_no_observers() {
|
||||
|
||||
#[test]
|
||||
fn finalize_3_voters_1_observer() {
|
||||
let peers = &[Keyring::Alice, Keyring::Bob, Keyring::Charlie];
|
||||
let peers = &[AuthorityKeyring::Alice, AuthorityKeyring::Bob, AuthorityKeyring::Charlie];
|
||||
let voters = make_ids(peers);
|
||||
|
||||
let mut net = GrandpaTestNet::new(TestApi::new(voters), 4);
|
||||
@@ -554,24 +554,24 @@ fn finalize_3_voters_1_observer() {
|
||||
fn transition_3_voters_twice_1_observer() {
|
||||
let _ = env_logger::try_init();
|
||||
let peers_a = &[
|
||||
Keyring::Alice,
|
||||
Keyring::Bob,
|
||||
Keyring::Charlie,
|
||||
AuthorityKeyring::Alice,
|
||||
AuthorityKeyring::Bob,
|
||||
AuthorityKeyring::Charlie,
|
||||
];
|
||||
|
||||
let peers_b = &[
|
||||
Keyring::Dave,
|
||||
Keyring::Eve,
|
||||
Keyring::Ferdie,
|
||||
AuthorityKeyring::Dave,
|
||||
AuthorityKeyring::Eve,
|
||||
AuthorityKeyring::Ferdie,
|
||||
];
|
||||
|
||||
let peers_c = &[
|
||||
Keyring::Alice,
|
||||
Keyring::Eve,
|
||||
Keyring::Two,
|
||||
AuthorityKeyring::Alice,
|
||||
AuthorityKeyring::Eve,
|
||||
AuthorityKeyring::Two,
|
||||
];
|
||||
|
||||
let observer = &[Keyring::One];
|
||||
let observer = &[AuthorityKeyring::One];
|
||||
|
||||
let genesis_voters = make_ids(peers_a);
|
||||
|
||||
@@ -719,11 +719,11 @@ fn transition_3_voters_twice_1_observer() {
|
||||
|
||||
#[test]
|
||||
fn justification_is_emitted_when_consensus_data_changes() {
|
||||
let peers = &[Keyring::Alice, Keyring::Bob, Keyring::Charlie];
|
||||
let peers = &[AuthorityKeyring::Alice, AuthorityKeyring::Bob, AuthorityKeyring::Charlie];
|
||||
let mut net = GrandpaTestNet::new(TestApi::new(make_ids(peers)), 3);
|
||||
|
||||
// import block#1 WITH consensus data change
|
||||
let new_authorities = vec![Ed25519AuthorityId::from([42; 32])];
|
||||
let new_authorities = vec![AuthorityId::from_raw([42; 32])];
|
||||
net.peer(0).push_authorities_change_block(new_authorities);
|
||||
net.sync();
|
||||
let net = Arc::new(Mutex::new(net));
|
||||
@@ -736,7 +736,7 @@ fn justification_is_emitted_when_consensus_data_changes() {
|
||||
|
||||
#[test]
|
||||
fn justification_is_generated_periodically() {
|
||||
let peers = &[Keyring::Alice, Keyring::Bob, Keyring::Charlie];
|
||||
let peers = &[AuthorityKeyring::Alice, AuthorityKeyring::Bob, AuthorityKeyring::Charlie];
|
||||
let voters = make_ids(peers);
|
||||
|
||||
let mut net = GrandpaTestNet::new(TestApi::new(voters), 3);
|
||||
@@ -775,8 +775,8 @@ fn consensus_changes_works() {
|
||||
|
||||
#[test]
|
||||
fn sync_justifications_on_change_blocks() {
|
||||
let peers_a = &[Keyring::Alice, Keyring::Bob, Keyring::Charlie];
|
||||
let peers_b = &[Keyring::Alice, Keyring::Bob];
|
||||
let peers_a = &[AuthorityKeyring::Alice, AuthorityKeyring::Bob, AuthorityKeyring::Charlie];
|
||||
let peers_b = &[AuthorityKeyring::Alice, AuthorityKeyring::Bob];
|
||||
let voters = make_ids(peers_b);
|
||||
|
||||
// 4 peers, 3 of them are authorities and participate in grandpa
|
||||
@@ -825,13 +825,13 @@ fn sync_justifications_on_change_blocks() {
|
||||
fn finalizes_multiple_pending_changes_in_order() {
|
||||
let _ = env_logger::try_init();
|
||||
|
||||
let peers_a = &[Keyring::Alice, Keyring::Bob, Keyring::Charlie];
|
||||
let peers_b = &[Keyring::Dave, Keyring::Eve, Keyring::Ferdie];
|
||||
let peers_c = &[Keyring::Dave, Keyring::Alice, Keyring::Bob];
|
||||
let peers_a = &[AuthorityKeyring::Alice, AuthorityKeyring::Bob, AuthorityKeyring::Charlie];
|
||||
let peers_b = &[AuthorityKeyring::Dave, AuthorityKeyring::Eve, AuthorityKeyring::Ferdie];
|
||||
let peers_c = &[AuthorityKeyring::Dave, AuthorityKeyring::Alice, AuthorityKeyring::Bob];
|
||||
|
||||
let all_peers = &[
|
||||
Keyring::Alice, Keyring::Bob, Keyring::Charlie,
|
||||
Keyring::Dave, Keyring::Eve, Keyring::Ferdie,
|
||||
AuthorityKeyring::Alice, AuthorityKeyring::Bob, AuthorityKeyring::Charlie,
|
||||
AuthorityKeyring::Dave, AuthorityKeyring::Eve, AuthorityKeyring::Ferdie,
|
||||
];
|
||||
let genesis_voters = make_ids(peers_a);
|
||||
|
||||
@@ -883,7 +883,7 @@ fn finalizes_multiple_pending_changes_in_order() {
|
||||
|
||||
#[test]
|
||||
fn doesnt_vote_on_the_tip_of_the_chain() {
|
||||
let peers_a = &[Keyring::Alice, Keyring::Bob, Keyring::Charlie];
|
||||
let peers_a = &[AuthorityKeyring::Alice, AuthorityKeyring::Bob, AuthorityKeyring::Charlie];
|
||||
let voters = make_ids(peers_a);
|
||||
let api = TestApi::new(voters);
|
||||
let mut net = GrandpaTestNet::new(api, 3);
|
||||
@@ -907,8 +907,8 @@ fn doesnt_vote_on_the_tip_of_the_chain() {
|
||||
#[test]
|
||||
fn force_change_to_new_set() {
|
||||
// two of these guys are offline.
|
||||
let genesis_authorities = &[Keyring::Alice, Keyring::Bob, Keyring::Charlie, Keyring::One, Keyring::Two];
|
||||
let peers_a = &[Keyring::Alice, Keyring::Bob, Keyring::Charlie];
|
||||
let genesis_authorities = &[AuthorityKeyring::Alice, AuthorityKeyring::Bob, AuthorityKeyring::Charlie, AuthorityKeyring::One, AuthorityKeyring::Two];
|
||||
let peers_a = &[AuthorityKeyring::Alice, AuthorityKeyring::Bob, AuthorityKeyring::Charlie];
|
||||
let api = TestApi::new(make_ids(genesis_authorities));
|
||||
|
||||
let voters = make_ids(peers_a);
|
||||
@@ -960,8 +960,8 @@ fn force_change_to_new_set() {
|
||||
|
||||
#[test]
|
||||
fn allows_reimporting_change_blocks() {
|
||||
let peers_a = &[Keyring::Alice, Keyring::Bob, Keyring::Charlie];
|
||||
let peers_b = &[Keyring::Alice, Keyring::Bob];
|
||||
let peers_a = &[AuthorityKeyring::Alice, AuthorityKeyring::Bob, AuthorityKeyring::Charlie];
|
||||
let peers_b = &[AuthorityKeyring::Alice, AuthorityKeyring::Bob];
|
||||
let voters = make_ids(peers_a);
|
||||
let api = TestApi::new(voters);
|
||||
let net = GrandpaTestNet::new(api.clone(), 3);
|
||||
|
||||
@@ -28,7 +28,7 @@ use futures::prelude::*;
|
||||
use futures::stream::Fuse;
|
||||
use parking_lot::Mutex;
|
||||
use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor};
|
||||
use substrate_primitives::Ed25519AuthorityId;
|
||||
use substrate_primitives::ed25519::Public as AuthorityId;
|
||||
use tokio::timer::Interval;
|
||||
|
||||
use std::collections::{HashMap, VecDeque};
|
||||
@@ -199,7 +199,7 @@ impl<Block: BlockT, Status, I, M> Stream for UntilImported<Block, Status, I, M>
|
||||
}
|
||||
}
|
||||
|
||||
fn warn_authority_wrong_target<H: ::std::fmt::Display>(hash: H, id: Ed25519AuthorityId) {
|
||||
fn warn_authority_wrong_target<H: ::std::fmt::Display>(hash: H, id: AuthorityId) {
|
||||
warn!(
|
||||
target: "afg",
|
||||
"Authority {:?} signed GRANDPA message with \
|
||||
|
||||
Reference in New Issue
Block a user