prevent zero networkID (#9763)
* prevent zero networkID, closes #8345 Signed-off-by: Seun LanLege <seunlanlege@gmail.com> * updated networkID of olymic chain spec Signed-off-by: Seun LanLege <seunlanlege@gmail.com>
This commit is contained in:
parent
ed34d1fee7
commit
73f08b376f
@ -17,7 +17,7 @@
|
|||||||
"accountStartNonce": "0x00",
|
"accountStartNonce": "0x00",
|
||||||
"maximumExtraDataSize": "0x0400",
|
"maximumExtraDataSize": "0x0400",
|
||||||
"minGasLimit": "125000",
|
"minGasLimit": "125000",
|
||||||
"networkID" : "0x0",
|
"networkID" : "0xf0",
|
||||||
"eip150Transition": "0x7fffffffffffffff",
|
"eip150Transition": "0x7fffffffffffffff",
|
||||||
"eip160Transition": "0x7fffffffffffffff",
|
"eip160Transition": "0x7fffffffffffffff",
|
||||||
"eip161abcTransition": "0x7fffffffffffffff",
|
"eip161abcTransition": "0x7fffffffffffffff",
|
||||||
|
@ -35,6 +35,7 @@ pub struct Params {
|
|||||||
|
|
||||||
/// Network id.
|
/// Network id.
|
||||||
#[serde(rename="networkID")]
|
#[serde(rename="networkID")]
|
||||||
|
#[serde(deserialize_with="uint::validate_non_zero")]
|
||||||
pub network_id: Uint,
|
pub network_id: Uint,
|
||||||
/// Chain id.
|
/// Chain id.
|
||||||
#[serde(rename="chainID")]
|
#[serde(rename="chainID")]
|
||||||
@ -208,4 +209,20 @@ mod tests {
|
|||||||
|
|
||||||
let _deserialized: Params = serde_json::from_str(s).unwrap();
|
let _deserialized: Params = serde_json::from_str(s).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[should_panic(expected = "a non-zero value")]
|
||||||
|
fn test_non_zero_network_id() {
|
||||||
|
let s = r#"{
|
||||||
|
"maximumExtraDataSize": "0x20",
|
||||||
|
"networkID" : "0x0",
|
||||||
|
"subprotocolName" : "exp",
|
||||||
|
"minGasLimit": "0x1388",
|
||||||
|
"accountStartNonce": "0x01",
|
||||||
|
"gasLimitBoundDivisor": "0x20",
|
||||||
|
"maxCodeSize": "0x1000"
|
||||||
|
}"#;
|
||||||
|
|
||||||
|
let _deserialized: Params = serde_json::from_str(s).unwrap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user