From b450653e4d91da3d0ef58fbb1e01a7cdc87efee9 Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Fri, 8 Dec 2017 16:22:32 +0100 Subject: [PATCH 1/2] detect different node, same-key signing in aura --- ethcore/src/engines/authority_round/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ethcore/src/engines/authority_round/mod.rs b/ethcore/src/engines/authority_round/mod.rs index 1f322692095..ea292e72b88 100644 --- a/ethcore/src/engines/authority_round/mod.rs +++ b/ethcore/src/engines/authority_round/mod.rs @@ -485,6 +485,14 @@ impl Engine for AuthorityRound { .expect("Header has been verified; qed").into(); let step = self.step.load(); + + // this is guarded against by `can_propose` unless the block was signed + // on the same step (implies same key) and on a different node. + if parent_step == step.into() { + warn!("Attempted to seal block on the same step as parent. Is this authority sealing with more than one node?"); + return Seal::None; + } + let expected_diff = calculate_score(parent_step, step.into()); if header.difficulty() != &expected_diff { From 583d76408638cd49763b19f9e9c9bb221e16132b Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Mon, 11 Dec 2017 10:37:09 +0100 Subject: [PATCH 2/2] reduce scope of warning --- ethcore/src/engines/authority_round/mod.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ethcore/src/engines/authority_round/mod.rs b/ethcore/src/engines/authority_round/mod.rs index ea292e72b88..48638eda249 100644 --- a/ethcore/src/engines/authority_round/mod.rs +++ b/ethcore/src/engines/authority_round/mod.rs @@ -486,13 +486,6 @@ impl Engine for AuthorityRound { let step = self.step.load(); - // this is guarded against by `can_propose` unless the block was signed - // on the same step (implies same key) and on a different node. - if parent_step == step.into() { - warn!("Attempted to seal block on the same step as parent. Is this authority sealing with more than one node?"); - return Seal::None; - } - let expected_diff = calculate_score(parent_step, step.into()); if header.difficulty() != &expected_diff { @@ -525,6 +518,13 @@ impl Engine for AuthorityRound { }; if is_step_proposer(validators, header.parent_hash(), step, header.author()) { + // this is guarded against by `can_propose` unless the block was signed + // on the same step (implies same key) and on a different node. + if parent_step == step.into() { + warn!("Attempted to seal block on the same step as parent. Is this authority sealing with more than one node?"); + return Seal::None; + } + if let Ok(signature) = self.sign(header.bare_hash()) { trace!(target: "engine", "generate_seal: Issuing a block for step {}.", step);