Skip to content

Commit

Permalink
fisher log for equivocation header
Browse files Browse the repository at this point in the history
  • Loading branch information
atenjin committed Jun 12, 2019
1 parent 68f4365 commit 1d65d56
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions core/consensus/aura/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ tokio = "0.1.7"
parking_lot = "0.7.1"
error-chain = "0.12"
log = "0.4"
hex = "0.3"

[dev-dependencies]
keyring = { package = "substrate-keyring", path = "../../keyring" }
Expand Down
10 changes: 10 additions & 0 deletions core/consensus/aura/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ fn check_header<C, B: Block, P: Pair>(
C: client::backend::AuxStore,
P::Public: AsRef<P::Public> + Encode + Decode + PartialEq + Clone,
{
let header_src = header.clone();
let digest_item = match header.digest_mut().pop() {
Some(x) => x,
None => return Err(format!("Header {:?} is unsealed", hash)),
Expand All @@ -487,6 +488,9 @@ fn check_header<C, B: Block, P: Pair>(
format!("Header {:?} is unsealed", hash)
})?;

trace!(target: "fisher", "[fisher]|header|num:{:}|hash:{:}|pre_hash:{:}|encoded:{:}",
header_src.number(), header_src.hash(), header.hash(), hex::encode(header_src.encode()));

if slot_num > slot_now {
header.digest_mut().push(digest_item);
Ok(CheckedHeader::Deferred(header, slot_num))
Expand Down Expand Up @@ -518,6 +522,12 @@ fn check_header<C, B: Block, P: Pair>(
equivocation_proof.snd_header().hash(),
);
info!("{}", log_str);

debug!(target: "fisher", "[fisher]|equivocation|fst_pre_hash:{:}|snd_pre_hash:{:}",
equivocation_proof.fst_header().hash(),
equivocation_proof.snd_header().hash(),
);

Err(log_str)
},
Ok(None) => Ok(CheckedHeader::Checked(header, digest_item)),
Expand Down

0 comments on commit 1d65d56

Please sign in to comment.