Fixed kovan chain validation (#6758)

* Fixed kovan chain validation

* Fork detection

* Fixed typo
This commit is contained in:
Arkadiy Paronyan 2017-10-14 21:59:26 +02:00 committed by GitHub
parent 190c1dcede
commit b0c15497e1
4 changed files with 15 additions and 4 deletions

View File

@ -30,11 +30,14 @@
"params": {
"gasLimitBoundDivisor": "0x400",
"registrar" : "0xfAb104398BBefbd47752E7702D9fE23047E1Bca3",
"maximumExtraDataSize": "0x20",
"maximumExtraDataSize": "0x20",
"minGasLimit": "0x1388",
"networkID" : "0x2A",
"forkBlock": 4297256,
"forkCanonHash": "0x0a66d93c2f727dca618fabaf70c39b37018c73d78b939d8b11efbbd09034778f",
"validateReceiptsTransition" : 1000000,
"eip155Transition": 1000000
"eip155Transition": 1000000,
"validateChainIdTransition": 1000000
},
"genesis": {
"seal": {

View File

@ -351,7 +351,9 @@ impl EthereumMachine {
None => true,
};
let chain_id = if header.number() >= self.params().eip155_transition {
let chain_id = if header.number() < self.params().validate_chain_id_transition {
t.chain_id()
} else if header.number() >= self.params().eip155_transition {
Some(self.params().chain_id)
} else {
None

View File

@ -85,6 +85,8 @@ pub struct CommonParams {
pub eip155_transition: BlockNumber,
/// Validate block receipts root.
pub validate_receipts_transition: BlockNumber,
/// Validate transaction chain id.
pub validate_chain_id_transition: BlockNumber,
/// Number of first block where EIP-86 (Metropolis) rules begin.
pub eip86_transition: BlockNumber,
/// Number of first block where EIP-140 (Metropolis: REVERT opcode) rules begin.
@ -153,7 +155,7 @@ impl CommonParams {
self.validate_receipts_transition != 0 && self.eip86_transition != 0 &&
self.eip140_transition != 0 && self.eip210_transition != 0 &&
self.eip211_transition != 0 && self.eip214_transition != 0 &&
self.dust_protection_transition != 0
self.validate_chain_id_transition != 0 && self.dust_protection_transition != 0
}
}
@ -178,6 +180,7 @@ impl From<ethjson::spec::Params> for CommonParams {
eip98_transition: p.eip98_transition.map_or(0, Into::into),
eip155_transition: p.eip155_transition.map_or(0, Into::into),
validate_receipts_transition: p.validate_receipts_transition.map_or(0, Into::into),
validate_chain_id_transition: p.validate_chain_id_transition.map_or(0, Into::into),
eip86_transition: p.eip86_transition.map_or(
BlockNumber::max_value(),
Into::into,

View File

@ -58,6 +58,9 @@ pub struct Params {
#[serde(rename="eip155Transition")]
pub eip155_transition: Option<Uint>,
/// See `CommonParams` docs.
#[serde(rename="validateChainIdTransition")]
pub validate_chain_id_transition: Option<Uint>,
/// See `CommonParams` docs.
#[serde(rename="validateReceiptsTransition")]
pub validate_receipts_transition: Option<Uint>,
/// See `CommonParams` docs.