add monotonic transition to kovan (#5587)

This commit is contained in:
keorn 2017-05-15 22:34:01 +02:00 committed by Gav Wood
parent 879195397e
commit 945c1a9478
3 changed files with 14 additions and 3 deletions

View File

@ -25,7 +25,8 @@
] ]
}, },
"validateScoreTransition": 1000000, "validateScoreTransition": 1000000,
"eip155Transition": 1000000 "eip155Transition": 1000000,
"validateStepTransition": 1500000
} }
} }
}, },

View File

@ -57,6 +57,8 @@ pub struct AuthorityRoundParams {
pub validate_score_transition: u64, pub validate_score_transition: u64,
/// Number of first block where EIP-155 rules are validated. /// Number of first block where EIP-155 rules are validated.
pub eip155_transition: u64, pub eip155_transition: u64,
/// Monotonic step validation transition block.
pub validate_step_transition: u64,
} }
impl From<ethjson::spec::AuthorityRoundParams> for AuthorityRoundParams { impl From<ethjson::spec::AuthorityRoundParams> for AuthorityRoundParams {
@ -70,6 +72,7 @@ impl From<ethjson::spec::AuthorityRoundParams> for AuthorityRoundParams {
start_step: p.start_step.map(Into::into), start_step: p.start_step.map(Into::into),
validate_score_transition: p.validate_score_transition.map_or(0, Into::into), validate_score_transition: p.validate_score_transition.map_or(0, Into::into),
eip155_transition: p.eip155_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),
} }
} }
} }
@ -128,6 +131,7 @@ pub struct AuthorityRound {
validators: Box<ValidatorSet>, validators: Box<ValidatorSet>,
validate_score_transition: u64, validate_score_transition: u64,
eip155_transition: u64, eip155_transition: u64,
validate_step_transition: u64,
} }
// header-chain validator. // header-chain validator.
@ -208,6 +212,7 @@ impl AuthorityRound {
validators: new_validator_set(our_params.validators), validators: new_validator_set(our_params.validators),
validate_score_transition: our_params.validate_score_transition, validate_score_transition: our_params.validate_score_transition,
eip155_transition: our_params.eip155_transition, eip155_transition: our_params.eip155_transition,
validate_step_transition: our_params.validate_step_transition,
}); });
// Do not initialize timeouts for tests. // Do not initialize timeouts for tests.
if should_timeout { if should_timeout {
@ -379,7 +384,8 @@ impl Engine for AuthorityRound {
// Ensure header is from the step after parent. // Ensure header is from the step after parent.
let parent_step = header_step(parent)?; let parent_step = header_step(parent)?;
if step <= parent_step { if step == parent_step
|| (header.number() >= self.validate_step_transition && step <= parent_step) {
trace!(target: "engine", "Multiple blocks proposed for step {}.", parent_step); trace!(target: "engine", "Multiple blocks proposed for step {}.", parent_step);
self.validators.report_malicious(header.author(), header.number(), Default::default()); self.validators.report_malicious(header.author(), header.number(), Default::default());
Err(EngineError::DoubleVote(header.author().clone()))?; Err(EngineError::DoubleVote(header.author().clone()))?;

View File

@ -46,6 +46,9 @@ pub struct AuthorityRoundParams {
/// See main AuthorityRoundParams docs. /// See main AuthorityRoundParams docs.
#[serde(rename="eip155Transition")] #[serde(rename="eip155Transition")]
pub eip155_transition: Option<Uint>, pub eip155_transition: Option<Uint>,
/// Block from which monotonic steps start.
#[serde(rename="validateStepTransition")]
pub validate_step_transition: Option<Uint>,
} }
/// Authority engine deserialization. /// Authority engine deserialization.
@ -71,7 +74,8 @@ mod tests {
}, },
"blockReward": "0x50", "blockReward": "0x50",
"startStep" : 24, "startStep" : 24,
"eip155Transition": "0x42" "eip155Transition": "0x42",
"validateStepTransition": 150
} }
}"#; }"#;