|
|
|
|
@@ -58,6 +58,8 @@ pub struct AuthorityRoundParams {
|
|
|
|
|
pub validate_score_transition: u64,
|
|
|
|
|
/// Number of first block where EIP-155 rules are validated.
|
|
|
|
|
pub eip155_transition: u64,
|
|
|
|
|
/// Monotonic step validation transition block.
|
|
|
|
|
pub validate_step_transition: u64,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl From<ethjson::spec::AuthorityRoundParams> for AuthorityRoundParams {
|
|
|
|
|
@@ -71,6 +73,7 @@ impl From<ethjson::spec::AuthorityRoundParams> for AuthorityRoundParams {
|
|
|
|
|
start_step: p.start_step.map(Into::into),
|
|
|
|
|
validate_score_transition: p.validate_score_transition.map_or(0, Into::into),
|
|
|
|
|
eip155_transition: p.eip155_transition.map_or(0, Into::into),
|
|
|
|
|
validate_step_transition: p.validate_step_transition.map_or(0, Into::into),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -94,6 +97,7 @@ pub struct AuthorityRound {
|
|
|
|
|
calibrate_step: bool,
|
|
|
|
|
validate_score_transition: u64,
|
|
|
|
|
eip155_transition: u64,
|
|
|
|
|
validate_step_transition: u64,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn header_step(header: &Header) -> Result<usize, ::rlp::DecoderError> {
|
|
|
|
|
@@ -136,6 +140,7 @@ impl AuthorityRound {
|
|
|
|
|
calibrate_step: our_params.start_step.is_none(),
|
|
|
|
|
validate_score_transition: our_params.validate_score_transition,
|
|
|
|
|
eip155_transition: our_params.eip155_transition,
|
|
|
|
|
validate_step_transition: our_params.validate_step_transition,
|
|
|
|
|
});
|
|
|
|
|
// Do not initialize timeouts for tests.
|
|
|
|
|
if should_timeout {
|
|
|
|
|
@@ -343,9 +348,10 @@ impl Engine for AuthorityRound {
|
|
|
|
|
|
|
|
|
|
// Check if parent is from a previous step.
|
|
|
|
|
let parent_step = header_step(parent)?;
|
|
|
|
|
if step == parent_step {
|
|
|
|
|
trace!(target: "engine", "Multiple blocks proposed for step {}.", step);
|
|
|
|
|
self.validators.report_malicious(header.author());
|
|
|
|
|
if step == parent_step
|
|
|
|
|
|| (header.number() >= self.validate_step_transition && step <= parent_step) {
|
|
|
|
|
trace!(target: "engine", "Multiple blocks proposed for step {}.", parent_step);
|
|
|
|
|
self.validators.report_malicious(header.author(), header.number(), Default::default());
|
|
|
|
|
Err(EngineError::DoubleVote(header.author().clone()))?;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|