Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
fix: add comments, remove unnecessary bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
seerscode committed May 14, 2019
1 parent d975e01 commit a821f9e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 3 additions & 5 deletions core/consensus/aura/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ use slots::{CheckedHeader, SlotWorker, SlotInfo, SlotCompatible, slot_now, check
pub use aura_primitives::*;
pub use consensus_common::{SyncOracle, ExtraVerification};


type AuthorityId<P> = <P as Pair>::Public;
type Signature<P> = <P as Pair>::Signature;

Expand Down Expand Up @@ -468,7 +467,7 @@ fn check_header<C, B: Block, P: Pair>(
where DigestItemFor<B>: CompatibleDigestItem<P>,
P::Signature: Decode,
C: client::backend::AuxStore,
<P as Pair>::Public: AsRef<<P as Pair>::Public> + Encode + Decode + PartialEq,
P::Public: AsRef<P::Public> + Encode + Decode + PartialEq,
{
let digest_item = match header.digest_mut().pop() {
Some(x) => x,
Expand Down Expand Up @@ -506,12 +505,11 @@ fn check_header<C, B: Block, P: Pair>(
slot_now,
slot_num,
header.clone(),
public.clone()
public.clone(),
) {
Ok(Some(equivocation_proof)) => {
let log_str = format!(
"Slot author {:?} is equivocating at slot {} with headers {:?} and {:?}",
public,
"Slot author is equivocating at slot {} with headers {:?} and {:?}",
slot_num,
equivocation_proof.fst_header().hash(),
equivocation_proof.snd_header().hash(),
Expand Down
2 changes: 0 additions & 2 deletions core/consensus/babe/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,6 @@ mod tests {
use runtime_primitives::testing::{Header as HeaderTest, Digest as DigestTest, Block as RawBlock, ExtrinsicWrapper};
use slots::{MAX_SLOT_CAPACITY, PRUNING_BOUND};


type Error = client::error::Error;

type TestClient = client::Client<
Expand Down Expand Up @@ -1164,7 +1163,6 @@ mod tests {
]);
}


#[test]
fn check_header_works_with_equivocation() {
let client = test_client::new();
Expand Down
6 changes: 5 additions & 1 deletion core/consensus/slots/src/aux_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ fn load_decode<C, T>(backend: Arc<C>, key: &[u8]) -> ClientResult<Option<T>>
}
}

/// Represents an equivocation proof.
#[derive(Debug, Clone)]
pub struct EquivocationProof<H> {
slot: u64,
Expand All @@ -51,14 +52,17 @@ pub struct EquivocationProof<H> {
}

impl<H> EquivocationProof<H> {
/// Get the slot number where the equivocation happened.
pub fn slot(&self) -> u64 {
self.slot
}

/// Get the first header involved in the equivocation.
pub fn fst_header(&self) -> &H {
&self.fst_header
}

/// Get the second header involved in the equivocation.
pub fn snd_header(&self) -> &H {
&self.snd_header
}
Expand All @@ -77,7 +81,7 @@ pub fn check_equivocation<C, H, P>(
where
H: Header,
C: AuxStore,
P: Encode + Decode + PartialEq + std::fmt::Debug,
P: Encode + Decode + PartialEq,
{
if slot_now - slot > MAX_SLOT_CAPACITY {
return Ok(None)
Expand Down
2 changes: 1 addition & 1 deletion core/primitives/src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ impl<T: AsMut<[u8]> + AsRef<[u8]> + Default + Derive> Ss58Codec for T {
#[cfg(feature = "std")]
pub trait Pair: Sized + 'static {
/// TThe type which is used to encode a public key.
type Public: Clone + std::fmt::Debug;
type Public: Clone;

/// The type used to (minimally) encode the data required to securely create
/// a new key pair.
Expand Down

0 comments on commit a821f9e

Please sign in to comment.