Move more params to the common section. (#6134)
* move common forks and parameters to common params * port specs over to new format * fix RPC tests
This commit is contained in:
parent
9c5ef1f776
commit
003eef982b
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -777,7 +777,7 @@ name = "ethjson"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethcore-util 1.8.0",
|
"ethcore-bigint 0.1.3",
|
||||||
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_derive 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_derive 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"engine": {
|
"engine": {
|
||||||
"authorityRound": {
|
"authorityRound": {
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"stepDuration": 1,
|
"stepDuration": 1,
|
||||||
"startStep": 2,
|
"startStep": 2,
|
||||||
"validators": {
|
"validators": {
|
||||||
@ -17,6 +16,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
"accountStartNonce": "0x0",
|
"accountStartNonce": "0x0",
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"engine": {
|
"engine": {
|
||||||
"basicAuthority": {
|
"basicAuthority": {
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"durationLimit": "0x0d",
|
"durationLimit": "0x0d",
|
||||||
"validators": {
|
"validators": {
|
||||||
"list": ["0x9cce34f7ab185c7aba1b7c8140d620b4bda941d6"]
|
"list": ["0x9cce34f7ab185c7aba1b7c8140d620b4bda941d6"]
|
||||||
@ -12,6 +11,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
"accountStartNonce": "0x0100000",
|
"accountStartNonce": "0x0100000",
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
|
@ -4,12 +4,14 @@
|
|||||||
"null": null
|
"null": null
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
"accountStartNonce": "0x0",
|
"accountStartNonce": "0x0",
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
"networkID" : "0x2"
|
"networkID" : "0x2"
|
||||||
},
|
},
|
||||||
"genesis": {
|
"genesis": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
"seal": {
|
"seal": {
|
||||||
"generic": "0x"
|
"generic": "0x"
|
||||||
},
|
},
|
||||||
|
@ -4,15 +4,11 @@
|
|||||||
"engine": {
|
"engine": {
|
||||||
"Ethash": {
|
"Ethash": {
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"minimumDifficulty": "0x020000",
|
"minimumDifficulty": "0x020000",
|
||||||
"difficultyBoundDivisor": "0x0800",
|
"difficultyBoundDivisor": "0x0800",
|
||||||
"durationLimit": "0x0d",
|
"durationLimit": "0x0d",
|
||||||
"blockReward": "0x4563918244F40000",
|
|
||||||
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
|
||||||
"homesteadTransition": 1150000,
|
"homesteadTransition": 1150000,
|
||||||
"eip150Transition": 2500000,
|
"eip150Transition": 2500000,
|
||||||
"eip155Transition": 3000000,
|
|
||||||
"eip160Transition": 3000000,
|
"eip160Transition": 3000000,
|
||||||
"ecip1010PauseTransition": 3000000,
|
"ecip1010PauseTransition": 3000000,
|
||||||
"ecip1010ContinueTransition": 5000000,
|
"ecip1010ContinueTransition": 5000000,
|
||||||
@ -24,6 +20,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
|
"blockReward": "0x4563918244F40000",
|
||||||
|
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
||||||
"accountStartNonce": "0x00",
|
"accountStartNonce": "0x00",
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
@ -31,6 +30,8 @@
|
|||||||
"chainID": "0x3d",
|
"chainID": "0x3d",
|
||||||
"forkBlock": "0x1d4c00",
|
"forkBlock": "0x1d4c00",
|
||||||
"forkCanonHash": "0x94365e3a8c0b35089c1d1195081fe7489b528a84b22199c916180db8b28ade7f",
|
"forkCanonHash": "0x94365e3a8c0b35089c1d1195081fe7489b528a84b22199c916180db8b28ade7f",
|
||||||
|
"eip155Transition": 3000000,
|
||||||
|
|
||||||
"eip98Transition": "0x7fffffffffffff",
|
"eip98Transition": "0x7fffffffffffff",
|
||||||
"eip86Transition": "0x7fffffffffffff"
|
"eip86Transition": "0x7fffffffffffff"
|
||||||
},
|
},
|
||||||
|
@ -3,15 +3,11 @@
|
|||||||
"engine": {
|
"engine": {
|
||||||
"Ethash": {
|
"Ethash": {
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"minimumDifficulty": "0x020000",
|
"minimumDifficulty": "0x020000",
|
||||||
"difficultyBoundDivisor": "0x0800",
|
"difficultyBoundDivisor": "0x0800",
|
||||||
"durationLimit": "0x0d",
|
"durationLimit": "0x0d",
|
||||||
"blockReward": "0x4563918244F40000",
|
|
||||||
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
|
||||||
"homesteadTransition": "0x0",
|
"homesteadTransition": "0x0",
|
||||||
"eip150Transition": "0x0",
|
"eip150Transition": "0x0",
|
||||||
"eip155Transition": "0x7fffffffffffffff",
|
|
||||||
"eip160Transition": "0x7fffffffffffffff",
|
"eip160Transition": "0x7fffffffffffffff",
|
||||||
"eip161abcTransition": "0x7fffffffffffffff",
|
"eip161abcTransition": "0x7fffffffffffffff",
|
||||||
"eip161dTransition": "0x7fffffffffffffff",
|
"eip161dTransition": "0x7fffffffffffffff",
|
||||||
@ -20,12 +16,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
|
"blockReward": "0x4563918244F40000",
|
||||||
|
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
||||||
"accountStartNonce": "0x00",
|
"accountStartNonce": "0x00",
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
"networkID" : "0x1",
|
"networkID" : "0x1",
|
||||||
"eip98Transition": "0x7fffffffffffffff",
|
"eip98Transition": "0x7fffffffffffffff",
|
||||||
"eip86Transition": "0x7fffffffffffffff"
|
"eip86Transition": "0x7fffffffffffffff",
|
||||||
|
"eip155Transition": "0x7fffffffffffffff"
|
||||||
},
|
},
|
||||||
"genesis": {
|
"genesis": {
|
||||||
"seal": {
|
"seal": {
|
||||||
|
@ -3,15 +3,11 @@
|
|||||||
"engine": {
|
"engine": {
|
||||||
"Ethash": {
|
"Ethash": {
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"minimumDifficulty": "0x020000",
|
"minimumDifficulty": "0x020000",
|
||||||
"difficultyBoundDivisor": "0x0800",
|
"difficultyBoundDivisor": "0x0800",
|
||||||
"durationLimit": "0x0d",
|
"durationLimit": "0x0d",
|
||||||
"blockReward": "0x4563918244F40000",
|
|
||||||
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
|
||||||
"homesteadTransition": "0x0",
|
"homesteadTransition": "0x0",
|
||||||
"eip150Transition": "0x0",
|
"eip150Transition": "0x0",
|
||||||
"eip155Transition": "0x7fffffffffffffff",
|
|
||||||
"eip160Transition": "0x0",
|
"eip160Transition": "0x0",
|
||||||
"eip161abcTransition": "0x0",
|
"eip161abcTransition": "0x0",
|
||||||
"eip161dTransition": "0x0",
|
"eip161dTransition": "0x0",
|
||||||
@ -20,12 +16,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
|
"blockReward": "0x4563918244F40000",
|
||||||
|
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
||||||
"accountStartNonce": "0x00",
|
"accountStartNonce": "0x00",
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
"networkID" : "0x1",
|
"networkID" : "0x1",
|
||||||
"eip98Transition": "0x7fffffffffffffff",
|
"eip98Transition": "0x7fffffffffffffff",
|
||||||
"eip86Transition": "0x7fffffffffffffff"
|
"eip86Transition": "0x7fffffffffffffff",
|
||||||
|
"eip155Transition": "0x7fffffffffffffff"
|
||||||
},
|
},
|
||||||
"genesis": {
|
"genesis": {
|
||||||
"seal": {
|
"seal": {
|
||||||
|
@ -4,19 +4,15 @@
|
|||||||
"engine": {
|
"engine": {
|
||||||
"Ethash": {
|
"Ethash": {
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"minimumDifficulty": "0x020000",
|
"minimumDifficulty": "0x020000",
|
||||||
"difficultyBoundDivisor": "0x0800",
|
"difficultyBoundDivisor": "0x0800",
|
||||||
"difficultyIncrementDivisor": "60",
|
"difficultyIncrementDivisor": "60",
|
||||||
"durationLimit": "0x3C",
|
"durationLimit": "0x3C",
|
||||||
"blockReward": "0x6f05b59d3b200000",
|
|
||||||
"registrar" : "0x6c221ca53705f3497ec90ca7b84c59ae7382fc21",
|
|
||||||
"homesteadTransition": "0x30d40",
|
"homesteadTransition": "0x30d40",
|
||||||
"difficultyHardforkTransition": "0x59d9",
|
"difficultyHardforkTransition": "0x59d9",
|
||||||
"difficultyHardforkBoundDivisor": "0x0200",
|
"difficultyHardforkBoundDivisor": "0x0200",
|
||||||
"bombDefuseTransition": "0x30d40",
|
"bombDefuseTransition": "0x30d40",
|
||||||
"eip150Transition": "0x927C0",
|
"eip150Transition": "0x927C0",
|
||||||
"eip155Transition": "0x927C0",
|
|
||||||
"eip160Transition": "0x927C0",
|
"eip160Transition": "0x927C0",
|
||||||
"eip161abcTransition": "0x927C0",
|
"eip161abcTransition": "0x927C0",
|
||||||
"eip161dTransition": "0x927C0"
|
"eip161dTransition": "0x927C0"
|
||||||
@ -24,6 +20,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
|
"blockReward": "0x6f05b59d3b200000",
|
||||||
|
"registrar" : "0x6c221ca53705f3497ec90ca7b84c59ae7382fc21",
|
||||||
"accountStartNonce": "0x00",
|
"accountStartNonce": "0x00",
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
@ -31,7 +30,8 @@
|
|||||||
"chainID": "0x2",
|
"chainID": "0x2",
|
||||||
"subprotocolName": "exp",
|
"subprotocolName": "exp",
|
||||||
"eip98Transition": "0x7fffffffffffff",
|
"eip98Transition": "0x7fffffffffffff",
|
||||||
"eip86Transition": "0x7fffffffffffff"
|
"eip86Transition": "0x7fffffffffffff",
|
||||||
|
"eip155Transition": "0x927C0"
|
||||||
},
|
},
|
||||||
"genesis": {
|
"genesis": {
|
||||||
"seal": {
|
"seal": {
|
||||||
|
@ -4,12 +4,9 @@
|
|||||||
"engine": {
|
"engine": {
|
||||||
"Ethash": {
|
"Ethash": {
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"minimumDifficulty": "0x020000",
|
"minimumDifficulty": "0x020000",
|
||||||
"difficultyBoundDivisor": "0x0800",
|
"difficultyBoundDivisor": "0x0800",
|
||||||
"durationLimit": "0x0d",
|
"durationLimit": "0x0d",
|
||||||
"blockReward": "0x4563918244F40000",
|
|
||||||
"registrar" : "0xe3389675d0338462dC76C6f9A3e432550c36A142",
|
|
||||||
"homesteadTransition": "0x118c30",
|
"homesteadTransition": "0x118c30",
|
||||||
"daoHardforkTransition": "0x1d4c00",
|
"daoHardforkTransition": "0x1d4c00",
|
||||||
"daoHardforkBeneficiary": "0xbf4ed7b27f1d666546e30d74d50d173d20bca754",
|
"daoHardforkBeneficiary": "0xbf4ed7b27f1d666546e30d74d50d173d20bca754",
|
||||||
@ -132,7 +129,6 @@
|
|||||||
"0x807640a13483f8ac783c557fcdf27be11ea4ac7a"
|
"0x807640a13483f8ac783c557fcdf27be11ea4ac7a"
|
||||||
],
|
],
|
||||||
"eip150Transition": "0x259518",
|
"eip150Transition": "0x259518",
|
||||||
"eip155Transition": 2675000,
|
|
||||||
"eip160Transition": 2675000,
|
"eip160Transition": 2675000,
|
||||||
"eip161abcTransition": 2675000,
|
"eip161abcTransition": 2675000,
|
||||||
"eip161dTransition": 2675000,
|
"eip161dTransition": 2675000,
|
||||||
@ -141,12 +137,17 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
|
"blockReward": "0x4563918244F40000",
|
||||||
|
"registrar" : "0xe3389675d0338462dC76C6f9A3e432550c36A142",
|
||||||
"accountStartNonce": "0x00",
|
"accountStartNonce": "0x00",
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
"networkID" : "0x1",
|
"networkID" : "0x1",
|
||||||
"forkBlock": "0x1d4c00",
|
"forkBlock": "0x1d4c00",
|
||||||
"forkCanonHash": "0x4985f5ca3d2afbec36529aa96f74de3cc10a2a4a6c44f2157a57d2c6059a11bb",
|
"forkCanonHash": "0x4985f5ca3d2afbec36529aa96f74de3cc10a2a4a6c44f2157a57d2c6059a11bb",
|
||||||
|
"eip155Transition": 2675000,
|
||||||
|
|
||||||
"eip98Transition": "0x7fffffffffffff",
|
"eip98Transition": "0x7fffffffffffff",
|
||||||
"eip86Transition": "0x7fffffffffffff"
|
"eip86Transition": "0x7fffffffffffff"
|
||||||
},
|
},
|
||||||
|
@ -3,12 +3,9 @@
|
|||||||
"engine": {
|
"engine": {
|
||||||
"Ethash": {
|
"Ethash": {
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"minimumDifficulty": "0x020000",
|
"minimumDifficulty": "0x020000",
|
||||||
"difficultyBoundDivisor": "0x0800",
|
"difficultyBoundDivisor": "0x0800",
|
||||||
"durationLimit": "0x0d",
|
"durationLimit": "0x0d",
|
||||||
"blockReward": "0x4563918244F40000",
|
|
||||||
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
|
||||||
"homesteadTransition": "0x118c30",
|
"homesteadTransition": "0x118c30",
|
||||||
"daoHardforkTransition": "0x1d4c00",
|
"daoHardforkTransition": "0x1d4c00",
|
||||||
"daoHardforkBeneficiary": "0xbf4ed7b27f1d666546e30d74d50d173d20bca754",
|
"daoHardforkBeneficiary": "0xbf4ed7b27f1d666546e30d74d50d173d20bca754",
|
||||||
@ -131,7 +128,6 @@
|
|||||||
"0x807640a13483f8ac783c557fcdf27be11ea4ac7a"
|
"0x807640a13483f8ac783c557fcdf27be11ea4ac7a"
|
||||||
],
|
],
|
||||||
"eip150Transition": "0x7fffffffffffffff",
|
"eip150Transition": "0x7fffffffffffffff",
|
||||||
"eip155Transition": "0x7fffffffffffffff",
|
|
||||||
"eip160Transition": "0x7fffffffffffffff",
|
"eip160Transition": "0x7fffffffffffffff",
|
||||||
"eip161abcTransition": "0x7fffffffffffffff",
|
"eip161abcTransition": "0x7fffffffffffffff",
|
||||||
"eip161dTransition": "0x7fffffffffffffff"
|
"eip161dTransition": "0x7fffffffffffffff"
|
||||||
@ -139,12 +135,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
|
"blockReward": "0x4563918244F40000",
|
||||||
|
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
||||||
"accountStartNonce": "0x00",
|
"accountStartNonce": "0x00",
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
"networkID" : "0x1",
|
"networkID" : "0x1",
|
||||||
"eip98Transition": "0x7fffffffffffff",
|
"eip98Transition": "0x7fffffffffffff",
|
||||||
"eip86Transition": "0x7fffffffffffff"
|
"eip86Transition": "0x7fffffffffffff",
|
||||||
|
"eip155Transition": "0x7fffffffffffffff"
|
||||||
},
|
},
|
||||||
"genesis": {
|
"genesis": {
|
||||||
"seal": {
|
"seal": {
|
||||||
|
@ -3,15 +3,11 @@
|
|||||||
"engine": {
|
"engine": {
|
||||||
"Ethash": {
|
"Ethash": {
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"minimumDifficulty": "0x020000",
|
"minimumDifficulty": "0x020000",
|
||||||
"difficultyBoundDivisor": "0x0800",
|
"difficultyBoundDivisor": "0x0800",
|
||||||
"durationLimit": "0x0d",
|
"durationLimit": "0x0d",
|
||||||
"blockReward": "0x4563918244F40000",
|
|
||||||
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
|
||||||
"homesteadTransition": "0x7fffffffffffffff",
|
"homesteadTransition": "0x7fffffffffffffff",
|
||||||
"eip150Transition": "0x7fffffffffffffff",
|
"eip150Transition": "0x7fffffffffffffff",
|
||||||
"eip155Transition": "0x7fffffffffffffff",
|
|
||||||
"eip160Transition": "0x7fffffffffffffff",
|
"eip160Transition": "0x7fffffffffffffff",
|
||||||
"eip161abcTransition": "0x7fffffffffffffff",
|
"eip161abcTransition": "0x7fffffffffffffff",
|
||||||
"eip161dTransition": "0x7fffffffffffffff"
|
"eip161dTransition": "0x7fffffffffffffff"
|
||||||
@ -19,12 +15,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
|
"blockReward": "0x4563918244F40000",
|
||||||
|
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
||||||
"accountStartNonce": "0x00",
|
"accountStartNonce": "0x00",
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
"networkID" : "0x1",
|
"networkID" : "0x1",
|
||||||
"eip98Transition": "0x7fffffffffffff",
|
"eip98Transition": "0x7fffffffffffff",
|
||||||
"eip86Transition": "0x7fffffffffffff"
|
"eip86Transition": "0x7fffffffffffff",
|
||||||
|
"eip155Transition": "0x7fffffffffffffff"
|
||||||
},
|
},
|
||||||
"genesis": {
|
"genesis": {
|
||||||
"seal": {
|
"seal": {
|
||||||
|
@ -3,15 +3,11 @@
|
|||||||
"engine": {
|
"engine": {
|
||||||
"Ethash": {
|
"Ethash": {
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"minimumDifficulty": "0x020000",
|
"minimumDifficulty": "0x020000",
|
||||||
"difficultyBoundDivisor": "0x0800",
|
"difficultyBoundDivisor": "0x0800",
|
||||||
"durationLimit": "0x0d",
|
"durationLimit": "0x0d",
|
||||||
"blockReward": "0x4563918244F40000",
|
|
||||||
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
|
||||||
"homesteadTransition": "0x0",
|
"homesteadTransition": "0x0",
|
||||||
"eip150Transition": "0x7fffffffffffffff",
|
"eip150Transition": "0x7fffffffffffffff",
|
||||||
"eip155Transition": "0x7fffffffffffffff",
|
|
||||||
"eip160Transition": "0x7fffffffffffffff",
|
"eip160Transition": "0x7fffffffffffffff",
|
||||||
"eip161abcTransition": "0x7fffffffffffffff",
|
"eip161abcTransition": "0x7fffffffffffffff",
|
||||||
"eip161dTransition": "0x7fffffffffffffff"
|
"eip161dTransition": "0x7fffffffffffffff"
|
||||||
@ -19,12 +15,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
|
"blockReward": "0x4563918244F40000",
|
||||||
|
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
||||||
"accountStartNonce": "0x00",
|
"accountStartNonce": "0x00",
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
"networkID" : "0x1",
|
"networkID" : "0x1",
|
||||||
"eip98Transition": "0x7fffffffffffff",
|
"eip98Transition": "0x7fffffffffffff",
|
||||||
"eip86Transition": "0x7fffffffffffff"
|
"eip86Transition": "0x7fffffffffffff",
|
||||||
|
"eip155Transition": "0x7fffffffffffffff"
|
||||||
},
|
},
|
||||||
"genesis": {
|
"genesis": {
|
||||||
"seal": {
|
"seal": {
|
||||||
|
@ -4,10 +4,7 @@
|
|||||||
"engine": {
|
"engine": {
|
||||||
"authorityRound": {
|
"authorityRound": {
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x400",
|
|
||||||
"registrar" : "0xfAb104398BBefbd47752E7702D9fE23047E1Bca3",
|
|
||||||
"stepDuration": "4",
|
"stepDuration": "4",
|
||||||
"blockReward": "0x4563918244F40000",
|
|
||||||
"validators" : {
|
"validators" : {
|
||||||
"list": [
|
"list": [
|
||||||
"0x00D6Cc1BA9cf89BD2e58009741f4F7325BAdc0ED",
|
"0x00D6Cc1BA9cf89BD2e58009741f4F7325BAdc0ED",
|
||||||
@ -25,16 +22,19 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"validateScoreTransition": 1000000,
|
"validateScoreTransition": 1000000,
|
||||||
"eip155Transition": 1000000,
|
|
||||||
"validateStepTransition": 1500000
|
"validateStepTransition": 1500000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"maximumExtraDataSize": "0x20",
|
"gasLimitBoundDivisor": "0x400",
|
||||||
|
"registrar" : "0xfAb104398BBefbd47752E7702D9fE23047E1Bca3",
|
||||||
|
"blockReward": "0x4563918244F40000",
|
||||||
|
"maximumExtraDataSize": "0x20",
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
"networkID" : "0x2A",
|
"networkID" : "0x2A",
|
||||||
"validateReceiptsTransition" : 1000000
|
"validateReceiptsTransition" : 1000000,
|
||||||
|
"eip155Transition": 1000000
|
||||||
},
|
},
|
||||||
"genesis": {
|
"genesis": {
|
||||||
"seal": {
|
"seal": {
|
||||||
|
@ -3,15 +3,12 @@
|
|||||||
"engine": {
|
"engine": {
|
||||||
"Ethash": {
|
"Ethash": {
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"minimumDifficulty": "0x020000",
|
"minimumDifficulty": "0x020000",
|
||||||
"difficultyBoundDivisor": "0x0800",
|
"difficultyBoundDivisor": "0x0800",
|
||||||
"durationLimit": "0x0d",
|
"durationLimit": "0x0d",
|
||||||
"blockReward": "0x4563918244F40000",
|
|
||||||
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
|
||||||
"homesteadTransition": "0x0",
|
"homesteadTransition": "0x0",
|
||||||
"eip150Transition": "0x0",
|
"eip150Transition": "0x0",
|
||||||
"eip155Transition": "0x0",
|
|
||||||
"eip160Transition": "0x0",
|
"eip160Transition": "0x0",
|
||||||
"eip161abcTransition": "0x0",
|
"eip161abcTransition": "0x0",
|
||||||
"eip161dTransition": "0x0",
|
"eip161dTransition": "0x0",
|
||||||
@ -20,6 +17,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
|
"blockReward": "0x4563918244F40000",
|
||||||
|
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
||||||
"accountStartNonce": "0x00",
|
"accountStartNonce": "0x00",
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
@ -27,7 +27,8 @@
|
|||||||
"eip98Transition": "0x0",
|
"eip98Transition": "0x0",
|
||||||
"eip86Transition": "0x0",
|
"eip86Transition": "0x0",
|
||||||
"eip140Transition": "0x0",
|
"eip140Transition": "0x0",
|
||||||
"eip210Transition": "0x0"
|
"eip210Transition": "0x0",
|
||||||
|
"eip155Transition": "0x0"
|
||||||
},
|
},
|
||||||
"genesis": {
|
"genesis": {
|
||||||
"seal": {
|
"seal": {
|
||||||
|
@ -4,15 +4,11 @@
|
|||||||
"engine": {
|
"engine": {
|
||||||
"Ethash": {
|
"Ethash": {
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"minimumDifficulty": "0x020000",
|
"minimumDifficulty": "0x020000",
|
||||||
"difficultyBoundDivisor": "0x0800",
|
"difficultyBoundDivisor": "0x0800",
|
||||||
"durationLimit": "0x0d",
|
"durationLimit": "0x0d",
|
||||||
"blockReward": "0x4563918244F40000",
|
|
||||||
"registrar": "0x52dff57a8a1532e6afb3dc07e2af58bb9eb05b3d",
|
|
||||||
"homesteadTransition": 494000,
|
"homesteadTransition": 494000,
|
||||||
"eip150Transition": 1783000,
|
"eip150Transition": 1783000,
|
||||||
"eip155Transition": 1915000,
|
|
||||||
"eip160Transition": 1915000,
|
"eip160Transition": 1915000,
|
||||||
"ecip1010PauseTransition": 1915000,
|
"ecip1010PauseTransition": 1915000,
|
||||||
"ecip1010ContinueTransition": 3415000,
|
"ecip1010ContinueTransition": 3415000,
|
||||||
@ -23,6 +19,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
|
"blockReward": "0x4563918244F40000",
|
||||||
|
"registrar": "0x52dff57a8a1532e6afb3dc07e2af58bb9eb05b3d",
|
||||||
"accountStartNonce": "0x0100000",
|
"accountStartNonce": "0x0100000",
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
@ -30,6 +29,8 @@
|
|||||||
"chainID": "0x3e",
|
"chainID": "0x3e",
|
||||||
"forkBlock": "0x1b34d8",
|
"forkBlock": "0x1b34d8",
|
||||||
"forkCanonHash": "0xf376243aeff1f256d970714c3de9fd78fa4e63cf63e32a51fe1169e375d98145",
|
"forkCanonHash": "0xf376243aeff1f256d970714c3de9fd78fa4e63cf63e32a51fe1169e375d98145",
|
||||||
|
"eip155Transition": 1915000,
|
||||||
|
|
||||||
"eip98Transition": "0x7fffffffffffff",
|
"eip98Transition": "0x7fffffffffffff",
|
||||||
"eip86Transition": "0x7fffffffffffff"
|
"eip86Transition": "0x7fffffffffffff"
|
||||||
},
|
},
|
||||||
|
@ -3,15 +3,11 @@
|
|||||||
"engine": {
|
"engine": {
|
||||||
"Ethash": {
|
"Ethash": {
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"minimumDifficulty": "0x020000",
|
"minimumDifficulty": "0x020000",
|
||||||
"difficultyBoundDivisor": "0x0800",
|
"difficultyBoundDivisor": "0x0800",
|
||||||
"durationLimit": "0x08",
|
"durationLimit": "0x08",
|
||||||
"blockReward": "0x14D1120D7B160000",
|
|
||||||
"registrar": "5e70c0bbcd5636e0f9f9316e9f8633feb64d4050",
|
|
||||||
"homesteadTransition": "0x7fffffffffffffff",
|
"homesteadTransition": "0x7fffffffffffffff",
|
||||||
"eip150Transition": "0x7fffffffffffffff",
|
"eip150Transition": "0x7fffffffffffffff",
|
||||||
"eip155Transition": "0x7fffffffffffffff",
|
|
||||||
"eip160Transition": "0x7fffffffffffffff",
|
"eip160Transition": "0x7fffffffffffffff",
|
||||||
"eip161abcTransition": "0x7fffffffffffffff",
|
"eip161abcTransition": "0x7fffffffffffffff",
|
||||||
"eip161dTransition": "0x7fffffffffffffff"
|
"eip161dTransition": "0x7fffffffffffffff"
|
||||||
@ -19,12 +15,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
|
"blockReward": "0x14D1120D7B160000",
|
||||||
|
"registrar": "5e70c0bbcd5636e0f9f9316e9f8633feb64d4050",
|
||||||
"accountStartNonce": "0x00",
|
"accountStartNonce": "0x00",
|
||||||
"maximumExtraDataSize": "0x0400",
|
"maximumExtraDataSize": "0x0400",
|
||||||
"minGasLimit": "125000",
|
"minGasLimit": "125000",
|
||||||
"networkID" : "0x0",
|
"networkID" : "0x0",
|
||||||
"eip98Transition": "0x7fffffffffffff",
|
"eip98Transition": "0x7fffffffffffff",
|
||||||
"eip86Transition": "0x7fffffffffffff"
|
"eip86Transition": "0x7fffffffffffff",
|
||||||
|
"eip155Transition": "0x7fffffffffffffff"
|
||||||
},
|
},
|
||||||
"genesis": {
|
"genesis": {
|
||||||
"seal": {
|
"seal": {
|
||||||
|
@ -4,15 +4,11 @@
|
|||||||
"engine": {
|
"engine": {
|
||||||
"Ethash": {
|
"Ethash": {
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"minimumDifficulty": "0x020000",
|
"minimumDifficulty": "0x020000",
|
||||||
"difficultyBoundDivisor": "0x0800",
|
"difficultyBoundDivisor": "0x0800",
|
||||||
"durationLimit": "0x0d",
|
"durationLimit": "0x0d",
|
||||||
"blockReward": "0x4563918244F40000",
|
|
||||||
"registrar": "0x81a4b044831c4f12ba601adb9274516939e9b8a2",
|
|
||||||
"homesteadTransition": 0,
|
"homesteadTransition": 0,
|
||||||
"eip150Transition": 0,
|
"eip150Transition": 0,
|
||||||
"eip155Transition": 10,
|
|
||||||
"eip160Transition": 10,
|
"eip160Transition": 10,
|
||||||
"eip161abcTransition": 10,
|
"eip161abcTransition": 10,
|
||||||
"eip161dTransition": 10,
|
"eip161dTransition": 10,
|
||||||
@ -21,12 +17,17 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
|
"blockReward": "0x4563918244F40000",
|
||||||
|
"registrar": "0x81a4b044831c4f12ba601adb9274516939e9b8a2",
|
||||||
"accountStartNonce": "0x0",
|
"accountStartNonce": "0x0",
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
"networkID" : "0x3",
|
"networkID" : "0x3",
|
||||||
"forkBlock": 641350,
|
"forkBlock": 641350,
|
||||||
"forkCanonHash": "0x8033403e9fe5811a7b6d6b469905915de1c59207ce2172cbcf5d6ff14fa6a2eb",
|
"forkCanonHash": "0x8033403e9fe5811a7b6d6b469905915de1c59207ce2172cbcf5d6ff14fa6a2eb",
|
||||||
|
"eip155Transition": 10,
|
||||||
|
|
||||||
"eip98Transition": "0x7fffffffffffff",
|
"eip98Transition": "0x7fffffffffffff",
|
||||||
"eip86Transition": "0x7fffffffffffff"
|
"eip86Transition": "0x7fffffffffffff"
|
||||||
},
|
},
|
||||||
|
@ -3,12 +3,9 @@
|
|||||||
"engine": {
|
"engine": {
|
||||||
"Ethash": {
|
"Ethash": {
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"minimumDifficulty": "0x020000",
|
"minimumDifficulty": "0x020000",
|
||||||
"difficultyBoundDivisor": "0x0800",
|
"difficultyBoundDivisor": "0x0800",
|
||||||
"durationLimit": "0x0d",
|
"durationLimit": "0x0d",
|
||||||
"blockReward": "0x4563918244F40000",
|
|
||||||
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
|
||||||
"homesteadTransition": "0x5",
|
"homesteadTransition": "0x5",
|
||||||
"daoHardforkTransition": "0x8",
|
"daoHardforkTransition": "0x8",
|
||||||
"daoHardforkBeneficiary": "0xbf4ed7b27f1d666546e30d74d50d173d20bca754",
|
"daoHardforkBeneficiary": "0xbf4ed7b27f1d666546e30d74d50d173d20bca754",
|
||||||
@ -131,7 +128,6 @@
|
|||||||
"0x807640a13483f8ac783c557fcdf27be11ea4ac7a"
|
"0x807640a13483f8ac783c557fcdf27be11ea4ac7a"
|
||||||
],
|
],
|
||||||
"eip150Transition": "0xa",
|
"eip150Transition": "0xa",
|
||||||
"eip155Transition": "0x7fffffffffffffff",
|
|
||||||
"eip160Transition": "0x7fffffffffffffff",
|
"eip160Transition": "0x7fffffffffffffff",
|
||||||
"eip161abcTransition": "0x7fffffffffffffff",
|
"eip161abcTransition": "0x7fffffffffffffff",
|
||||||
"eip161dTransition": "0x7fffffffffffffff"
|
"eip161dTransition": "0x7fffffffffffffff"
|
||||||
@ -139,12 +135,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
|
"blockReward": "0x4563918244F40000",
|
||||||
|
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
||||||
"accountStartNonce": "0x00",
|
"accountStartNonce": "0x00",
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
"networkID" : "0x1",
|
"networkID" : "0x1",
|
||||||
"eip98Transition": "0x7fffffffffffff",
|
"eip98Transition": "0x7fffffffffffff",
|
||||||
"eip86Transition": "0x7fffffffffffff"
|
"eip86Transition": "0x7fffffffffffff",
|
||||||
|
"eip155Transition": "0x7fffffffffffffff"
|
||||||
},
|
},
|
||||||
"genesis": {
|
"genesis": {
|
||||||
"seal": {
|
"seal": {
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "DevelopmentChain",
|
"name": "DevelopmentChain",
|
||||||
"engine": {
|
"engine": {
|
||||||
"instantSeal": {
|
"instantSeal": null
|
||||||
"params": {
|
|
||||||
"registrar": "0x0000000000000000000000000000000000000005"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
"accountStartNonce": "0x0",
|
"accountStartNonce": "0x0",
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
"null": null
|
"null": null
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
"accountStartNonce": "0x0",
|
"accountStartNonce": "0x0",
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
"null": null
|
"null": null
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
"accountStartNonce": "0x0",
|
"accountStartNonce": "0x0",
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"engine": {
|
"engine": {
|
||||||
"tendermint": {
|
"tendermint": {
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"validators" : {
|
"validators" : {
|
||||||
"list": [
|
"list": [
|
||||||
"0x82a978b3f5962a5b0957d9ee9eef472ee55b42f1",
|
"0x82a978b3f5962a5b0957d9ee9eef472ee55b42f1",
|
||||||
@ -18,6 +17,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
"accountStartNonce": "0x0",
|
"accountStartNonce": "0x0",
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"engine": {
|
"engine": {
|
||||||
"authorityRound": {
|
"authorityRound": {
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"stepDuration": 1,
|
"stepDuration": 1,
|
||||||
"startStep": 2,
|
"startStep": 2,
|
||||||
"validators": {
|
"validators": {
|
||||||
@ -14,6 +13,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
"accountStartNonce": "0x0",
|
"accountStartNonce": "0x0",
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"engine": {
|
"engine": {
|
||||||
"basicAuthority": {
|
"basicAuthority": {
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"durationLimit": "0x0d",
|
"durationLimit": "0x0d",
|
||||||
"validators": {
|
"validators": {
|
||||||
"multi": {
|
"multi": {
|
||||||
@ -15,6 +14,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
"accountStartNonce": "0x0",
|
"accountStartNonce": "0x0",
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
"accountStartNonce": "0x0",
|
"accountStartNonce": "0x0",
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
|
@ -47,22 +47,14 @@ mod finality;
|
|||||||
|
|
||||||
/// `AuthorityRound` params.
|
/// `AuthorityRound` params.
|
||||||
pub struct AuthorityRoundParams {
|
pub struct AuthorityRoundParams {
|
||||||
/// Gas limit divisor.
|
|
||||||
pub gas_limit_bound_divisor: U256,
|
|
||||||
/// Time to wait before next block or authority switching.
|
/// Time to wait before next block or authority switching.
|
||||||
pub step_duration: Duration,
|
pub step_duration: Duration,
|
||||||
/// Block reward.
|
|
||||||
pub block_reward: U256,
|
|
||||||
/// Namereg contract address.
|
|
||||||
pub registrar: Address,
|
|
||||||
/// Starting step,
|
/// Starting step,
|
||||||
pub start_step: Option<u64>,
|
pub start_step: Option<u64>,
|
||||||
/// Valid validators.
|
/// Valid validators.
|
||||||
pub validators: Box<ValidatorSet>,
|
pub validators: Box<ValidatorSet>,
|
||||||
/// Chain score validation transition block.
|
/// Chain score validation transition block.
|
||||||
pub validate_score_transition: u64,
|
pub validate_score_transition: u64,
|
||||||
/// Number of first block where EIP-155 rules are validated.
|
|
||||||
pub eip155_transition: u64,
|
|
||||||
/// Monotonic step validation transition block.
|
/// Monotonic step validation transition block.
|
||||||
pub validate_step_transition: u64,
|
pub validate_step_transition: u64,
|
||||||
/// Immediate transitions.
|
/// Immediate transitions.
|
||||||
@ -72,14 +64,10 @@ pub struct AuthorityRoundParams {
|
|||||||
impl From<ethjson::spec::AuthorityRoundParams> for AuthorityRoundParams {
|
impl From<ethjson::spec::AuthorityRoundParams> for AuthorityRoundParams {
|
||||||
fn from(p: ethjson::spec::AuthorityRoundParams) -> Self {
|
fn from(p: ethjson::spec::AuthorityRoundParams) -> Self {
|
||||||
AuthorityRoundParams {
|
AuthorityRoundParams {
|
||||||
gas_limit_bound_divisor: p.gas_limit_bound_divisor.into(),
|
|
||||||
step_duration: Duration::from_secs(p.step_duration.into()),
|
step_duration: Duration::from_secs(p.step_duration.into()),
|
||||||
validators: new_validator_set(p.validators),
|
validators: new_validator_set(p.validators),
|
||||||
block_reward: p.block_reward.map_or_else(U256::zero, Into::into),
|
|
||||||
registrar: p.registrar.map_or_else(Address::new, Into::into),
|
|
||||||
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),
|
|
||||||
validate_step_transition: p.validate_step_transition.map_or(0, Into::into),
|
validate_step_transition: p.validate_step_transition.map_or(0, Into::into),
|
||||||
immediate_transitions: p.immediate_transitions.unwrap_or(false),
|
immediate_transitions: p.immediate_transitions.unwrap_or(false),
|
||||||
}
|
}
|
||||||
@ -214,9 +202,6 @@ impl EpochManager {
|
|||||||
/// Engine using `AuthorityRound` proof-of-authority BFT consensus.
|
/// Engine using `AuthorityRound` proof-of-authority BFT consensus.
|
||||||
pub struct AuthorityRound {
|
pub struct AuthorityRound {
|
||||||
params: CommonParams,
|
params: CommonParams,
|
||||||
gas_limit_bound_divisor: U256,
|
|
||||||
block_reward: U256,
|
|
||||||
registrar: Address,
|
|
||||||
builtins: BTreeMap<Address, Builtin>,
|
builtins: BTreeMap<Address, Builtin>,
|
||||||
transition_service: IoService<()>,
|
transition_service: IoService<()>,
|
||||||
step: Arc<Step>,
|
step: Arc<Step>,
|
||||||
@ -225,7 +210,6 @@ pub struct AuthorityRound {
|
|||||||
signer: RwLock<EngineSigner>,
|
signer: RwLock<EngineSigner>,
|
||||||
validators: Box<ValidatorSet>,
|
validators: Box<ValidatorSet>,
|
||||||
validate_score_transition: u64,
|
validate_score_transition: u64,
|
||||||
eip155_transition: u64,
|
|
||||||
validate_step_transition: u64,
|
validate_step_transition: u64,
|
||||||
epoch_manager: Mutex<EpochManager>,
|
epoch_manager: Mutex<EpochManager>,
|
||||||
immediate_transitions: bool,
|
immediate_transitions: bool,
|
||||||
@ -362,9 +346,6 @@ impl AuthorityRound {
|
|||||||
let engine = Arc::new(
|
let engine = Arc::new(
|
||||||
AuthorityRound {
|
AuthorityRound {
|
||||||
params: params,
|
params: params,
|
||||||
gas_limit_bound_divisor: our_params.gas_limit_bound_divisor,
|
|
||||||
block_reward: our_params.block_reward,
|
|
||||||
registrar: our_params.registrar,
|
|
||||||
builtins: builtins,
|
builtins: builtins,
|
||||||
transition_service: IoService::<()>::start()?,
|
transition_service: IoService::<()>::start()?,
|
||||||
step: Arc::new(Step {
|
step: Arc::new(Step {
|
||||||
@ -377,7 +358,6 @@ impl AuthorityRound {
|
|||||||
signer: Default::default(),
|
signer: Default::default(),
|
||||||
validators: our_params.validators,
|
validators: 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,
|
|
||||||
validate_step_transition: our_params.validate_step_transition,
|
validate_step_transition: our_params.validate_step_transition,
|
||||||
epoch_manager: Mutex::new(EpochManager::blank()),
|
epoch_manager: Mutex::new(EpochManager::blank()),
|
||||||
immediate_transitions: our_params.immediate_transitions,
|
immediate_transitions: our_params.immediate_transitions,
|
||||||
@ -433,7 +413,9 @@ impl Engine for AuthorityRound {
|
|||||||
|
|
||||||
fn params(&self) -> &CommonParams { &self.params }
|
fn params(&self) -> &CommonParams { &self.params }
|
||||||
|
|
||||||
fn additional_params(&self) -> HashMap<String, String> { hash_map!["registrar".to_owned() => self.registrar.hex()] }
|
fn additional_params(&self) -> HashMap<String, String> {
|
||||||
|
hash_map!["registrar".to_owned() => self.params().registrar.hex()]
|
||||||
|
}
|
||||||
|
|
||||||
fn builtins(&self) -> &BTreeMap<Address, Builtin> { &self.builtins }
|
fn builtins(&self) -> &BTreeMap<Address, Builtin> { &self.builtins }
|
||||||
|
|
||||||
@ -461,7 +443,7 @@ impl Engine for AuthorityRound {
|
|||||||
header.set_difficulty(new_difficulty);
|
header.set_difficulty(new_difficulty);
|
||||||
header.set_gas_limit({
|
header.set_gas_limit({
|
||||||
let gas_limit = parent.gas_limit().clone();
|
let gas_limit = parent.gas_limit().clone();
|
||||||
let bound_divisor = self.gas_limit_bound_divisor;
|
let bound_divisor = self.params().gas_limit_bound_divisor;
|
||||||
if gas_limit < gas_floor_target {
|
if gas_limit < gas_floor_target {
|
||||||
min(gas_floor_target, gas_limit + gas_limit / bound_divisor - 1.into())
|
min(gas_floor_target, gas_limit + gas_limit / bound_divisor - 1.into())
|
||||||
} else {
|
} else {
|
||||||
@ -564,7 +546,8 @@ impl Engine for AuthorityRound {
|
|||||||
fn on_close_block(&self, block: &mut ExecutedBlock) -> Result<(), Error> {
|
fn on_close_block(&self, block: &mut ExecutedBlock) -> Result<(), Error> {
|
||||||
let fields = block.fields_mut();
|
let fields = block.fields_mut();
|
||||||
// Bestow block reward
|
// Bestow block reward
|
||||||
let res = fields.state.add_balance(fields.header.author(), &self.block_reward, CleanupMode::NoEmpty)
|
let reward = self.params().block_reward;
|
||||||
|
let res = fields.state.add_balance(fields.header.author(), &reward, CleanupMode::NoEmpty)
|
||||||
.map_err(::error::Error::from)
|
.map_err(::error::Error::from)
|
||||||
.and_then(|_| fields.state.commit());
|
.and_then(|_| fields.state.commit());
|
||||||
// Commit state so that we can actually figure out the state root.
|
// Commit state so that we can actually figure out the state root.
|
||||||
@ -629,7 +612,7 @@ impl Engine for AuthorityRound {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let gas_limit_divisor = self.gas_limit_bound_divisor;
|
let gas_limit_divisor = self.params().gas_limit_bound_divisor;
|
||||||
let min_gas = parent.gas_limit().clone() - parent.gas_limit().clone() / gas_limit_divisor;
|
let min_gas = parent.gas_limit().clone() - parent.gas_limit().clone() / gas_limit_divisor;
|
||||||
let max_gas = parent.gas_limit().clone() + parent.gas_limit().clone() / gas_limit_divisor;
|
let max_gas = parent.gas_limit().clone() + parent.gas_limit().clone() / gas_limit_divisor;
|
||||||
if header.gas_limit() <= &min_gas || header.gas_limit() >= &max_gas {
|
if header.gas_limit() <= &min_gas || header.gas_limit() >= &max_gas {
|
||||||
@ -819,7 +802,7 @@ impl Engine for AuthorityRound {
|
|||||||
t.check_low_s()?;
|
t.check_low_s()?;
|
||||||
|
|
||||||
if let Some(n) = t.network_id() {
|
if let Some(n) = t.network_id() {
|
||||||
if header.number() >= self.eip155_transition && n != self.params().chain_id {
|
if header.number() >= self.params().eip155_transition && n != self.params().chain_id {
|
||||||
return Err(TransactionError::InvalidNetworkId.into());
|
return Err(TransactionError::InvalidNetworkId.into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1014,18 +997,19 @@ mod tests {
|
|||||||
fn reports_skipped() {
|
fn reports_skipped() {
|
||||||
let last_benign = Arc::new(AtomicUsize::new(0));
|
let last_benign = Arc::new(AtomicUsize::new(0));
|
||||||
let params = AuthorityRoundParams {
|
let params = AuthorityRoundParams {
|
||||||
gas_limit_bound_divisor: U256::from_str("400").unwrap(),
|
|
||||||
step_duration: Default::default(),
|
step_duration: Default::default(),
|
||||||
block_reward: Default::default(),
|
|
||||||
registrar: Default::default(),
|
|
||||||
start_step: Some(1),
|
start_step: Some(1),
|
||||||
validators: Box::new(TestSet::new(Default::default(), last_benign.clone())),
|
validators: Box::new(TestSet::new(Default::default(), last_benign.clone())),
|
||||||
validate_score_transition: 0,
|
validate_score_transition: 0,
|
||||||
validate_step_transition: 0,
|
validate_step_transition: 0,
|
||||||
eip155_transition: 0,
|
|
||||||
immediate_transitions: true,
|
immediate_transitions: true,
|
||||||
};
|
};
|
||||||
let aura = AuthorityRound::new(Default::default(), params, Default::default()).unwrap();
|
|
||||||
|
let aura = {
|
||||||
|
let mut c_params = ::spec::CommonParams::default();
|
||||||
|
c_params.gas_limit_bound_divisor = 5.into();
|
||||||
|
AuthorityRound::new(c_params, params, Default::default()).unwrap()
|
||||||
|
};
|
||||||
|
|
||||||
let mut parent_header: Header = Header::default();
|
let mut parent_header: Header = Header::default();
|
||||||
parent_header.set_seal(vec![encode(&1usize).into_vec()]);
|
parent_header.set_seal(vec![encode(&1usize).into_vec()]);
|
||||||
|
@ -35,8 +35,6 @@ use super::validator_set::{ValidatorSet, SimpleList, new_validator_set};
|
|||||||
/// `BasicAuthority` params.
|
/// `BasicAuthority` params.
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct BasicAuthorityParams {
|
pub struct BasicAuthorityParams {
|
||||||
/// Gas limit divisor.
|
|
||||||
pub gas_limit_bound_divisor: U256,
|
|
||||||
/// Valid signatories.
|
/// Valid signatories.
|
||||||
pub validators: ethjson::spec::ValidatorSet,
|
pub validators: ethjson::spec::ValidatorSet,
|
||||||
}
|
}
|
||||||
@ -44,7 +42,6 @@ pub struct BasicAuthorityParams {
|
|||||||
impl From<ethjson::spec::BasicAuthorityParams> for BasicAuthorityParams {
|
impl From<ethjson::spec::BasicAuthorityParams> for BasicAuthorityParams {
|
||||||
fn from(p: ethjson::spec::BasicAuthorityParams) -> Self {
|
fn from(p: ethjson::spec::BasicAuthorityParams) -> Self {
|
||||||
BasicAuthorityParams {
|
BasicAuthorityParams {
|
||||||
gas_limit_bound_divisor: p.gas_limit_bound_divisor.into(),
|
|
||||||
validators: p.validators,
|
validators: p.validators,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -80,7 +77,6 @@ fn verify_external(header: &Header, validators: &ValidatorSet) -> Result<(), Err
|
|||||||
/// Engine using `BasicAuthority`, trivial proof-of-authority consensus.
|
/// Engine using `BasicAuthority`, trivial proof-of-authority consensus.
|
||||||
pub struct BasicAuthority {
|
pub struct BasicAuthority {
|
||||||
params: CommonParams,
|
params: CommonParams,
|
||||||
gas_limit_bound_divisor: U256,
|
|
||||||
builtins: BTreeMap<Address, Builtin>,
|
builtins: BTreeMap<Address, Builtin>,
|
||||||
signer: RwLock<EngineSigner>,
|
signer: RwLock<EngineSigner>,
|
||||||
validators: Box<ValidatorSet>,
|
validators: Box<ValidatorSet>,
|
||||||
@ -91,7 +87,6 @@ impl BasicAuthority {
|
|||||||
pub fn new(params: CommonParams, our_params: BasicAuthorityParams, builtins: BTreeMap<Address, Builtin>) -> Self {
|
pub fn new(params: CommonParams, our_params: BasicAuthorityParams, builtins: BTreeMap<Address, Builtin>) -> Self {
|
||||||
BasicAuthority {
|
BasicAuthority {
|
||||||
params: params,
|
params: params,
|
||||||
gas_limit_bound_divisor: our_params.gas_limit_bound_divisor,
|
|
||||||
builtins: builtins,
|
builtins: builtins,
|
||||||
validators: new_validator_set(our_params.validators),
|
validators: new_validator_set(our_params.validators),
|
||||||
signer: Default::default(),
|
signer: Default::default(),
|
||||||
@ -119,7 +114,7 @@ impl Engine for BasicAuthority {
|
|||||||
header.set_difficulty(parent.difficulty().clone());
|
header.set_difficulty(parent.difficulty().clone());
|
||||||
header.set_gas_limit({
|
header.set_gas_limit({
|
||||||
let gas_limit = parent.gas_limit().clone();
|
let gas_limit = parent.gas_limit().clone();
|
||||||
let bound_divisor = self.gas_limit_bound_divisor;
|
let bound_divisor = self.params().gas_limit_bound_divisor;
|
||||||
if gas_limit < gas_floor_target {
|
if gas_limit < gas_floor_target {
|
||||||
min(gas_floor_target, gas_limit + gas_limit / bound_divisor - 1.into())
|
min(gas_floor_target, gas_limit + gas_limit / bound_divisor - 1.into())
|
||||||
} else {
|
} else {
|
||||||
@ -172,7 +167,7 @@ impl Engine for BasicAuthority {
|
|||||||
if header.difficulty() != parent.difficulty() {
|
if header.difficulty() != parent.difficulty() {
|
||||||
return Err(From::from(BlockError::InvalidDifficulty(Mismatch { expected: *parent.difficulty(), found: *header.difficulty() })))
|
return Err(From::from(BlockError::InvalidDifficulty(Mismatch { expected: *parent.difficulty(), found: *header.difficulty() })))
|
||||||
}
|
}
|
||||||
let gas_limit_divisor = self.gas_limit_bound_divisor;
|
let gas_limit_divisor = self.params().gas_limit_bound_divisor;
|
||||||
let min_gas = parent.gas_limit().clone() - parent.gas_limit().clone() / gas_limit_divisor;
|
let min_gas = parent.gas_limit().clone() - parent.gas_limit().clone() / gas_limit_divisor;
|
||||||
let max_gas = parent.gas_limit().clone() + parent.gas_limit().clone() / gas_limit_divisor;
|
let max_gas = parent.gas_limit().clone() + parent.gas_limit().clone() / gas_limit_divisor;
|
||||||
if header.gas_limit() <= &min_gas || header.gas_limit() >= &max_gas {
|
if header.gas_limit() <= &min_gas || header.gas_limit() >= &max_gas {
|
||||||
|
@ -24,16 +24,14 @@ use block::ExecutedBlock;
|
|||||||
/// An engine which does not provide any consensus mechanism, just seals blocks internally.
|
/// An engine which does not provide any consensus mechanism, just seals blocks internally.
|
||||||
pub struct InstantSeal {
|
pub struct InstantSeal {
|
||||||
params: CommonParams,
|
params: CommonParams,
|
||||||
registrar: Address,
|
|
||||||
builtins: BTreeMap<Address, Builtin>,
|
builtins: BTreeMap<Address, Builtin>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl InstantSeal {
|
impl InstantSeal {
|
||||||
/// Returns new instance of InstantSeal with default VM Factory
|
/// Returns new instance of InstantSeal with default VM Factory
|
||||||
pub fn new(params: CommonParams, registrar: Address, builtins: BTreeMap<Address, Builtin>) -> Self {
|
pub fn new(params: CommonParams, builtins: BTreeMap<Address, Builtin>) -> Self {
|
||||||
InstantSeal {
|
InstantSeal {
|
||||||
params: params,
|
params: params,
|
||||||
registrar: registrar,
|
|
||||||
builtins: builtins,
|
builtins: builtins,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -49,7 +47,7 @@ impl Engine for InstantSeal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn additional_params(&self) -> HashMap<String, String> {
|
fn additional_params(&self) -> HashMap<String, String> {
|
||||||
hash_map!["registrar".to_owned() => self.registrar.hex()]
|
hash_map!["registrar".to_owned() => self.params().registrar.hex()]
|
||||||
}
|
}
|
||||||
|
|
||||||
fn builtins(&self) -> &BTreeMap<Address, Builtin> {
|
fn builtins(&self) -> &BTreeMap<Address, Builtin> {
|
||||||
|
@ -71,12 +71,9 @@ pub type BlockHash = H256;
|
|||||||
/// Engine using `Tendermint` consensus algorithm, suitable for EVM chain.
|
/// Engine using `Tendermint` consensus algorithm, suitable for EVM chain.
|
||||||
pub struct Tendermint {
|
pub struct Tendermint {
|
||||||
params: CommonParams,
|
params: CommonParams,
|
||||||
gas_limit_bound_divisor: U256,
|
|
||||||
builtins: BTreeMap<Address, Builtin>,
|
builtins: BTreeMap<Address, Builtin>,
|
||||||
step_service: IoService<Step>,
|
step_service: IoService<Step>,
|
||||||
client: RwLock<Option<Weak<EngineClient>>>,
|
client: RwLock<Option<Weak<EngineClient>>>,
|
||||||
block_reward: U256,
|
|
||||||
registrar: Address,
|
|
||||||
/// Blockchain height.
|
/// Blockchain height.
|
||||||
height: AtomicUsize,
|
height: AtomicUsize,
|
||||||
/// Consensus view.
|
/// Consensus view.
|
||||||
@ -166,12 +163,9 @@ impl Tendermint {
|
|||||||
let engine = Arc::new(
|
let engine = Arc::new(
|
||||||
Tendermint {
|
Tendermint {
|
||||||
params: params,
|
params: params,
|
||||||
gas_limit_bound_divisor: our_params.gas_limit_bound_divisor,
|
|
||||||
builtins: builtins,
|
builtins: builtins,
|
||||||
client: RwLock::new(None),
|
client: RwLock::new(None),
|
||||||
step_service: IoService::<Step>::start()?,
|
step_service: IoService::<Step>::start()?,
|
||||||
block_reward: our_params.block_reward,
|
|
||||||
registrar: our_params.registrar,
|
|
||||||
height: AtomicUsize::new(1),
|
height: AtomicUsize::new(1),
|
||||||
view: AtomicUsize::new(0),
|
view: AtomicUsize::new(0),
|
||||||
step: RwLock::new(Step::Propose),
|
step: RwLock::new(Step::Propose),
|
||||||
@ -446,7 +440,9 @@ impl Engine for Tendermint {
|
|||||||
|
|
||||||
fn params(&self) -> &CommonParams { &self.params }
|
fn params(&self) -> &CommonParams { &self.params }
|
||||||
|
|
||||||
fn additional_params(&self) -> HashMap<String, String> { hash_map!["registrar".to_owned() => self.registrar.hex()] }
|
fn additional_params(&self) -> HashMap<String, String> {
|
||||||
|
hash_map!["registrar".to_owned() => self.params().registrar.hex()]
|
||||||
|
}
|
||||||
|
|
||||||
fn builtins(&self) -> &BTreeMap<Address, Builtin> { &self.builtins }
|
fn builtins(&self) -> &BTreeMap<Address, Builtin> { &self.builtins }
|
||||||
|
|
||||||
@ -471,7 +467,7 @@ impl Engine for Tendermint {
|
|||||||
header.set_difficulty(new_difficulty);
|
header.set_difficulty(new_difficulty);
|
||||||
header.set_gas_limit({
|
header.set_gas_limit({
|
||||||
let gas_limit = parent.gas_limit().clone();
|
let gas_limit = parent.gas_limit().clone();
|
||||||
let bound_divisor = self.gas_limit_bound_divisor;
|
let bound_divisor = self.params().gas_limit_bound_divisor;
|
||||||
if gas_limit < gas_floor_target {
|
if gas_limit < gas_floor_target {
|
||||||
min(gas_floor_target, gas_limit + gas_limit / bound_divisor - 1.into())
|
min(gas_floor_target, gas_limit + gas_limit / bound_divisor - 1.into())
|
||||||
} else {
|
} else {
|
||||||
@ -545,7 +541,8 @@ impl Engine for Tendermint {
|
|||||||
fn on_close_block(&self, block: &mut ExecutedBlock) -> Result<(), Error>{
|
fn on_close_block(&self, block: &mut ExecutedBlock) -> Result<(), Error>{
|
||||||
let fields = block.fields_mut();
|
let fields = block.fields_mut();
|
||||||
// Bestow block reward
|
// Bestow block reward
|
||||||
let res = fields.state.add_balance(fields.header.author(), &self.block_reward, CleanupMode::NoEmpty)
|
let reward = self.params().block_reward;
|
||||||
|
let res = fields.state.add_balance(fields.header.author(), &reward, CleanupMode::NoEmpty)
|
||||||
.map_err(::error::Error::from)
|
.map_err(::error::Error::from)
|
||||||
.and_then(|_| fields.state.commit());
|
.and_then(|_| fields.state.commit());
|
||||||
// Commit state so that we can actually figure out the state root.
|
// Commit state so that we can actually figure out the state root.
|
||||||
@ -617,7 +614,7 @@ impl Engine for Tendermint {
|
|||||||
self.check_above_threshold(origins.len())?
|
self.check_above_threshold(origins.len())?
|
||||||
}
|
}
|
||||||
|
|
||||||
let gas_limit_divisor = self.gas_limit_bound_divisor;
|
let gas_limit_divisor = self.params().gas_limit_bound_divisor;
|
||||||
let min_gas = parent.gas_limit().clone() - parent.gas_limit().clone() / gas_limit_divisor;
|
let min_gas = parent.gas_limit().clone() - parent.gas_limit().clone() / gas_limit_divisor;
|
||||||
let max_gas = parent.gas_limit().clone() + parent.gas_limit().clone() / gas_limit_divisor;
|
let max_gas = parent.gas_limit().clone() + parent.gas_limit().clone() / gas_limit_divisor;
|
||||||
if header.gas_limit() <= &min_gas || header.gas_limit() >= &max_gas {
|
if header.gas_limit() <= &min_gas || header.gas_limit() >= &max_gas {
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
//! Tendermint specific parameters.
|
//! Tendermint specific parameters.
|
||||||
|
|
||||||
use ethjson;
|
use ethjson;
|
||||||
use util::{U256, Address};
|
|
||||||
use time::Duration;
|
use time::Duration;
|
||||||
use super::super::validator_set::{ValidatorSet, new_validator_set};
|
use super::super::validator_set::{ValidatorSet, new_validator_set};
|
||||||
use super::super::transition::Timeouts;
|
use super::super::transition::Timeouts;
|
||||||
@ -25,16 +24,10 @@ use super::Step;
|
|||||||
|
|
||||||
/// `Tendermint` params.
|
/// `Tendermint` params.
|
||||||
pub struct TendermintParams {
|
pub struct TendermintParams {
|
||||||
/// Gas limit divisor.
|
|
||||||
pub gas_limit_bound_divisor: U256,
|
|
||||||
/// List of validators.
|
/// List of validators.
|
||||||
pub validators: Box<ValidatorSet>,
|
pub validators: Box<ValidatorSet>,
|
||||||
/// Timeout durations for different steps.
|
/// Timeout durations for different steps.
|
||||||
pub timeouts: TendermintTimeouts,
|
pub timeouts: TendermintTimeouts,
|
||||||
/// Block reward.
|
|
||||||
pub block_reward: U256,
|
|
||||||
/// Namereg contract address.
|
|
||||||
pub registrar: Address,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Base timeout of each step in ms.
|
/// Base timeout of each step in ms.
|
||||||
@ -81,7 +74,6 @@ impl From<ethjson::spec::TendermintParams> for TendermintParams {
|
|||||||
fn from(p: ethjson::spec::TendermintParams) -> Self {
|
fn from(p: ethjson::spec::TendermintParams) -> Self {
|
||||||
let dt = TendermintTimeouts::default();
|
let dt = TendermintTimeouts::default();
|
||||||
TendermintParams {
|
TendermintParams {
|
||||||
gas_limit_bound_divisor: p.gas_limit_bound_divisor.into(),
|
|
||||||
validators: new_validator_set(p.validators),
|
validators: new_validator_set(p.validators),
|
||||||
timeouts: TendermintTimeouts {
|
timeouts: TendermintTimeouts {
|
||||||
propose: p.timeout_propose.map_or(dt.propose, to_duration),
|
propose: p.timeout_propose.map_or(dt.propose, to_duration),
|
||||||
@ -89,8 +81,6 @@ impl From<ethjson::spec::TendermintParams> for TendermintParams {
|
|||||||
precommit: p.timeout_precommit.map_or(dt.precommit, to_duration),
|
precommit: p.timeout_precommit.map_or(dt.precommit, to_duration),
|
||||||
commit: p.timeout_commit.map_or(dt.commit, to_duration),
|
commit: p.timeout_commit.map_or(dt.commit, to_duration),
|
||||||
},
|
},
|
||||||
block_reward: p.block_reward.map_or_else(U256::zero, Into::into),
|
|
||||||
registrar: p.registrar.map_or_else(Address::new, Into::into),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,8 +41,6 @@ const SNAPSHOT_BLOCKS: u64 = 30000;
|
|||||||
/// Ethash params.
|
/// Ethash params.
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct EthashParams {
|
pub struct EthashParams {
|
||||||
/// Gas limit divisor.
|
|
||||||
pub gas_limit_bound_divisor: U256,
|
|
||||||
/// Minimum difficulty.
|
/// Minimum difficulty.
|
||||||
pub minimum_difficulty: U256,
|
pub minimum_difficulty: U256,
|
||||||
/// Difficulty bound divisor.
|
/// Difficulty bound divisor.
|
||||||
@ -53,10 +51,6 @@ pub struct EthashParams {
|
|||||||
pub metropolis_difficulty_increment_divisor: u64,
|
pub metropolis_difficulty_increment_divisor: u64,
|
||||||
/// Block duration.
|
/// Block duration.
|
||||||
pub duration_limit: u64,
|
pub duration_limit: u64,
|
||||||
/// Block reward.
|
|
||||||
pub block_reward: U256,
|
|
||||||
/// Namereg contract address.
|
|
||||||
pub registrar: Address,
|
|
||||||
/// Homestead transition block number.
|
/// Homestead transition block number.
|
||||||
pub homestead_transition: u64,
|
pub homestead_transition: u64,
|
||||||
/// DAO hard-fork transition block (X).
|
/// DAO hard-fork transition block (X).
|
||||||
@ -75,8 +69,6 @@ pub struct EthashParams {
|
|||||||
pub eip100b_transition: u64,
|
pub eip100b_transition: u64,
|
||||||
/// Number of first block where EIP-150 rules begin.
|
/// Number of first block where EIP-150 rules begin.
|
||||||
pub eip150_transition: u64,
|
pub eip150_transition: u64,
|
||||||
/// Number of first block where EIP-155 rules begin.
|
|
||||||
pub eip155_transition: u64,
|
|
||||||
/// Number of first block where EIP-160 rules begin.
|
/// Number of first block where EIP-160 rules begin.
|
||||||
pub eip160_transition: u64,
|
pub eip160_transition: u64,
|
||||||
/// Number of first block where EIP-161.abc begin.
|
/// Number of first block where EIP-161.abc begin.
|
||||||
@ -104,14 +96,11 @@ pub struct EthashParams {
|
|||||||
impl From<ethjson::spec::EthashParams> for EthashParams {
|
impl From<ethjson::spec::EthashParams> for EthashParams {
|
||||||
fn from(p: ethjson::spec::EthashParams) -> Self {
|
fn from(p: ethjson::spec::EthashParams) -> Self {
|
||||||
EthashParams {
|
EthashParams {
|
||||||
gas_limit_bound_divisor: p.gas_limit_bound_divisor.into(),
|
|
||||||
minimum_difficulty: p.minimum_difficulty.into(),
|
minimum_difficulty: p.minimum_difficulty.into(),
|
||||||
difficulty_bound_divisor: p.difficulty_bound_divisor.into(),
|
difficulty_bound_divisor: p.difficulty_bound_divisor.into(),
|
||||||
difficulty_increment_divisor: p.difficulty_increment_divisor.map_or(10, Into::into),
|
difficulty_increment_divisor: p.difficulty_increment_divisor.map_or(10, Into::into),
|
||||||
metropolis_difficulty_increment_divisor: p.metropolis_difficulty_increment_divisor.map_or(9, Into::into),
|
metropolis_difficulty_increment_divisor: p.metropolis_difficulty_increment_divisor.map_or(9, Into::into),
|
||||||
duration_limit: p.duration_limit.map_or(0, Into::into),
|
duration_limit: p.duration_limit.map_or(0, Into::into),
|
||||||
block_reward: p.block_reward.into(),
|
|
||||||
registrar: p.registrar.map_or_else(Address::new, Into::into),
|
|
||||||
homestead_transition: p.homestead_transition.map_or(0, Into::into),
|
homestead_transition: p.homestead_transition.map_or(0, Into::into),
|
||||||
dao_hardfork_transition: p.dao_hardfork_transition.map_or(u64::max_value(), Into::into),
|
dao_hardfork_transition: p.dao_hardfork_transition.map_or(u64::max_value(), Into::into),
|
||||||
dao_hardfork_beneficiary: p.dao_hardfork_beneficiary.map_or_else(Address::new, Into::into),
|
dao_hardfork_beneficiary: p.dao_hardfork_beneficiary.map_or_else(Address::new, Into::into),
|
||||||
@ -121,7 +110,6 @@ impl From<ethjson::spec::EthashParams> for EthashParams {
|
|||||||
bomb_defuse_transition: p.bomb_defuse_transition.map_or(u64::max_value(), Into::into),
|
bomb_defuse_transition: p.bomb_defuse_transition.map_or(u64::max_value(), Into::into),
|
||||||
eip100b_transition: p.eip100b_transition.map_or(u64::max_value(), Into::into),
|
eip100b_transition: p.eip100b_transition.map_or(u64::max_value(), Into::into),
|
||||||
eip150_transition: p.eip150_transition.map_or(0, Into::into),
|
eip150_transition: p.eip150_transition.map_or(0, Into::into),
|
||||||
eip155_transition: p.eip155_transition.map_or(0, Into::into),
|
|
||||||
eip160_transition: p.eip160_transition.map_or(0, Into::into),
|
eip160_transition: p.eip160_transition.map_or(0, Into::into),
|
||||||
eip161abc_transition: p.eip161abc_transition.map_or(0, Into::into),
|
eip161abc_transition: p.eip161abc_transition.map_or(0, Into::into),
|
||||||
eip161d_transition: p.eip161d_transition.map_or(u64::max_value(), Into::into),
|
eip161d_transition: p.eip161d_transition.map_or(u64::max_value(), Into::into),
|
||||||
@ -185,7 +173,7 @@ impl Engine for Arc<Ethash> {
|
|||||||
fn seal_fields(&self) -> usize { 2 }
|
fn seal_fields(&self) -> usize { 2 }
|
||||||
|
|
||||||
fn params(&self) -> &CommonParams { &self.params }
|
fn params(&self) -> &CommonParams { &self.params }
|
||||||
fn additional_params(&self) -> HashMap<String, String> { hash_map!["registrar".to_owned() => self.ethash_params.registrar.hex()] }
|
fn additional_params(&self) -> HashMap<String, String> { hash_map!["registrar".to_owned() => self.params().registrar.hex()] }
|
||||||
|
|
||||||
fn builtins(&self) -> &BTreeMap<Address, Builtin> {
|
fn builtins(&self) -> &BTreeMap<Address, Builtin> {
|
||||||
&self.builtins
|
&self.builtins
|
||||||
@ -216,7 +204,7 @@ impl Engine for Arc<Ethash> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn signing_network_id(&self, env_info: &EnvInfo) -> Option<u64> {
|
fn signing_network_id(&self, env_info: &EnvInfo) -> Option<u64> {
|
||||||
if env_info.number >= self.ethash_params.eip155_transition {
|
if env_info.number >= self.params().eip155_transition {
|
||||||
Some(self.params().chain_id)
|
Some(self.params().chain_id)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
@ -231,7 +219,7 @@ impl Engine for Arc<Ethash> {
|
|||||||
}
|
}
|
||||||
let gas_limit = {
|
let gas_limit = {
|
||||||
let gas_limit = parent.gas_limit().clone();
|
let gas_limit = parent.gas_limit().clone();
|
||||||
let bound_divisor = self.ethash_params.gas_limit_bound_divisor;
|
let bound_divisor = self.params().gas_limit_bound_divisor;
|
||||||
let lower_limit = gas_limit - gas_limit / bound_divisor + 1.into();
|
let lower_limit = gas_limit - gas_limit / bound_divisor + 1.into();
|
||||||
let upper_limit = gas_limit + gas_limit / bound_divisor - 1.into();
|
let upper_limit = gas_limit + gas_limit / bound_divisor - 1.into();
|
||||||
let gas_limit = if gas_limit < gas_floor_target {
|
let gas_limit = if gas_limit < gas_floor_target {
|
||||||
@ -284,7 +272,7 @@ impl Engine for Arc<Ethash> {
|
|||||||
/// Apply the block reward on finalisation of the block.
|
/// Apply the block reward on finalisation of the block.
|
||||||
/// This assumes that all uncles are valid uncles (i.e. of at least one generation before the current).
|
/// This assumes that all uncles are valid uncles (i.e. of at least one generation before the current).
|
||||||
fn on_close_block(&self, block: &mut ExecutedBlock) -> Result<(), Error> {
|
fn on_close_block(&self, block: &mut ExecutedBlock) -> Result<(), Error> {
|
||||||
let reward = self.ethash_params.block_reward;
|
let reward = self.params().block_reward;
|
||||||
let fields = block.fields_mut();
|
let fields = block.fields_mut();
|
||||||
let eras_rounds = self.ethash_params.ecip1017_era_rounds;
|
let eras_rounds = self.ethash_params.ecip1017_era_rounds;
|
||||||
let (eras, reward) = ecip1017_eras_block_reward(eras_rounds, reward, fields.header.number());
|
let (eras, reward) = ecip1017_eras_block_reward(eras_rounds, reward, fields.header.number());
|
||||||
@ -387,7 +375,7 @@ impl Engine for Arc<Ethash> {
|
|||||||
if header.difficulty() != &expected_difficulty {
|
if header.difficulty() != &expected_difficulty {
|
||||||
return Err(From::from(BlockError::InvalidDifficulty(Mismatch { expected: expected_difficulty, found: header.difficulty().clone() })))
|
return Err(From::from(BlockError::InvalidDifficulty(Mismatch { expected: expected_difficulty, found: header.difficulty().clone() })))
|
||||||
}
|
}
|
||||||
let gas_limit_divisor = self.ethash_params.gas_limit_bound_divisor;
|
let gas_limit_divisor = self.params().gas_limit_bound_divisor;
|
||||||
let parent_gas_limit = *parent.gas_limit();
|
let parent_gas_limit = *parent.gas_limit();
|
||||||
let min_gas = parent_gas_limit - parent_gas_limit / gas_limit_divisor;
|
let min_gas = parent_gas_limit - parent_gas_limit / gas_limit_divisor;
|
||||||
let max_gas = parent_gas_limit + parent_gas_limit / gas_limit_divisor;
|
let max_gas = parent_gas_limit + parent_gas_limit / gas_limit_divisor;
|
||||||
@ -406,7 +394,7 @@ impl Engine for Arc<Ethash> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let check_low_s = header.number() >= self.ethash_params.homestead_transition;
|
let check_low_s = header.number() >= self.ethash_params.homestead_transition;
|
||||||
let network_id = if header.number() >= self.ethash_params.eip155_transition { Some(self.params().chain_id) } else { None };
|
let network_id = if header.number() >= self.params().eip155_transition { Some(self.params().chain_id) } else { None };
|
||||||
t.verify_basic(check_low_s, network_id, false)?;
|
t.verify_basic(check_low_s, network_id, false)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -809,36 +797,32 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn has_valid_ecip1017_eras_block_reward() {
|
fn has_valid_ecip1017_eras_block_reward() {
|
||||||
let ethparams = EthashParams {
|
let eras_rounds = 5000000;
|
||||||
// see ethcore/res/ethereum/classic.json
|
|
||||||
ecip1017_era_rounds: 5000000,
|
let start_reward: U256 = "4563918244F40000".parse().unwrap();
|
||||||
block_reward: U256::from_str("4563918244F40000").unwrap(),
|
|
||||||
..get_default_ethash_params()
|
|
||||||
};
|
|
||||||
let eras_rounds = ethparams.ecip1017_era_rounds;
|
|
||||||
let reward = ethparams.block_reward;
|
|
||||||
let block_number = 0;
|
let block_number = 0;
|
||||||
let (eras, reward) = ecip1017_eras_block_reward(eras_rounds, reward, block_number);
|
let (eras, reward) = ecip1017_eras_block_reward(eras_rounds, start_reward, block_number);
|
||||||
assert_eq!(0, eras);
|
assert_eq!(0, eras);
|
||||||
assert_eq!(U256::from_str("4563918244F40000").unwrap(), reward);
|
assert_eq!(U256::from_str("4563918244F40000").unwrap(), reward);
|
||||||
let reward = ethparams.block_reward;
|
|
||||||
let block_number = 5000000;
|
let block_number = 5000000;
|
||||||
let (eras, reward) = ecip1017_eras_block_reward(eras_rounds, reward, block_number);
|
let (eras, reward) = ecip1017_eras_block_reward(eras_rounds, start_reward, block_number);
|
||||||
assert_eq!(0, eras);
|
assert_eq!(0, eras);
|
||||||
assert_eq!(U256::from_str("4563918244F40000").unwrap(), reward);
|
assert_eq!(U256::from_str("4563918244F40000").unwrap(), reward);
|
||||||
let reward = ethparams.block_reward;
|
|
||||||
let block_number = 10000000;
|
let block_number = 10000000;
|
||||||
let (eras, reward) = ecip1017_eras_block_reward(eras_rounds, reward, block_number);
|
let (eras, reward) = ecip1017_eras_block_reward(eras_rounds, start_reward, block_number);
|
||||||
assert_eq!(1, eras);
|
assert_eq!(1, eras);
|
||||||
assert_eq!(U256::from_str("3782DACE9D900000").unwrap(), reward);
|
assert_eq!(U256::from_str("3782DACE9D900000").unwrap(), reward);
|
||||||
let reward = ethparams.block_reward;
|
|
||||||
let block_number = 20000000;
|
let block_number = 20000000;
|
||||||
let (eras, reward) = ecip1017_eras_block_reward(eras_rounds, reward, block_number);
|
let (eras, reward) = ecip1017_eras_block_reward(eras_rounds, start_reward, block_number);
|
||||||
assert_eq!(3, eras);
|
assert_eq!(3, eras);
|
||||||
assert_eq!(U256::from_str("2386F26FC1000000").unwrap(), reward);
|
assert_eq!(U256::from_str("2386F26FC1000000").unwrap(), reward);
|
||||||
let reward = ethparams.block_reward;
|
|
||||||
let block_number = 80000000;
|
let block_number = 80000000;
|
||||||
let (eras, reward) = ecip1017_eras_block_reward(eras_rounds, reward, block_number);
|
let (eras, reward) = ecip1017_eras_block_reward(eras_rounds, start_reward, block_number);
|
||||||
assert_eq!(15, eras);
|
assert_eq!(15, eras);
|
||||||
assert_eq!(U256::from_str("271000000000000").unwrap(), reward);
|
assert_eq!(U256::from_str("271000000000000").unwrap(), reward);
|
||||||
}
|
}
|
||||||
|
@ -1112,6 +1112,8 @@ impl MinerService for Miner {
|
|||||||
/// Prepare the block and work if the Engine does not seal internally.
|
/// Prepare the block and work if the Engine does not seal internally.
|
||||||
fn update_sealing(&self, chain: &MiningBlockChainClient) {
|
fn update_sealing(&self, chain: &MiningBlockChainClient) {
|
||||||
trace!(target: "miner", "update_sealing");
|
trace!(target: "miner", "update_sealing");
|
||||||
|
const NO_NEW_CHAIN_WITH_FORKS: &str = "Your chain specification contains one or more hard forks which are required to be \
|
||||||
|
on by default. Please remove these forks and start your chain again.";
|
||||||
|
|
||||||
if self.requires_reseal(chain.chain_info().best_block_number) {
|
if self.requires_reseal(chain.chain_info().best_block_number) {
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@ -1120,6 +1122,14 @@ impl MinerService for Miner {
|
|||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
trace!(target: "miner", "update_sealing: preparing a block");
|
trace!(target: "miner", "update_sealing: preparing a block");
|
||||||
let (block, original_work_hash) = self.prepare_block(chain);
|
let (block, original_work_hash) = self.prepare_block(chain);
|
||||||
|
|
||||||
|
// refuse to seal the first block of the chain if it contains hard forks
|
||||||
|
// which should be on by default.
|
||||||
|
if block.block().fields().header.number() == 1 && self.engine.params().contains_bugfix_hard_fork() {
|
||||||
|
warn!("{}", NO_NEW_CHAIN_WITH_FORKS);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
match self.engine.seals_internally() {
|
match self.engine.seals_internally() {
|
||||||
Some(true) => {
|
Some(true) => {
|
||||||
trace!(target: "miner", "update_sealing: engine indicates internal sealing");
|
trace!(target: "miner", "update_sealing: engine indicates internal sealing");
|
||||||
@ -1127,11 +1137,11 @@ impl MinerService for Miner {
|
|||||||
trace!(target: "miner", "update_sealing: imported internally sealed block");
|
trace!(target: "miner", "update_sealing: imported internally sealed block");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Some(false) => trace!(target: "miner", "update_sealing: engine is not keen to seal internally right now"),
|
||||||
None => {
|
None => {
|
||||||
trace!(target: "miner", "update_sealing: engine does not seal internally, preparing work");
|
trace!(target: "miner", "update_sealing: engine does not seal internally, preparing work");
|
||||||
self.prepare_work(block, original_work_hash)
|
self.prepare_work(block, original_work_hash)
|
||||||
},
|
},
|
||||||
_ => trace!(target: "miner", "update_sealing: engine is not keen to seal internally right now")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"engine": {
|
"engine": {
|
||||||
"authorityRound": {
|
"authorityRound": {
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"stepDuration": 1,
|
"stepDuration": 1,
|
||||||
"startStep": 0,
|
"startStep": 0,
|
||||||
"validators": {
|
"validators": {
|
||||||
@ -17,6 +16,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
"accountStartNonce": "0x0",
|
"accountStartNonce": "0x0",
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
|
@ -39,7 +39,12 @@ use trace::{NoopTracer, NoopVMTracer};
|
|||||||
use evm::CallType;
|
use evm::CallType;
|
||||||
use util::*;
|
use util::*;
|
||||||
|
|
||||||
/// Parameters common to all engines.
|
/// Parameters common to ethereum-like blockchains.
|
||||||
|
/// NOTE: when adding bugfix hard-fork parameters,
|
||||||
|
/// add to `contains_bugfix_hard_fork`
|
||||||
|
///
|
||||||
|
/// we define a "bugfix" hard fork as any hard fork which
|
||||||
|
/// you would put on-by-default in a new chain.
|
||||||
#[derive(Debug, PartialEq, Default)]
|
#[derive(Debug, PartialEq, Default)]
|
||||||
#[cfg_attr(test, derive(Clone))]
|
#[cfg_attr(test, derive(Clone))]
|
||||||
pub struct CommonParams {
|
pub struct CommonParams {
|
||||||
@ -59,8 +64,10 @@ pub struct CommonParams {
|
|||||||
pub fork_block: Option<(BlockNumber, H256)>,
|
pub fork_block: Option<(BlockNumber, H256)>,
|
||||||
/// Number of first block where EIP-98 rules begin.
|
/// Number of first block where EIP-98 rules begin.
|
||||||
pub eip98_transition: BlockNumber,
|
pub eip98_transition: BlockNumber,
|
||||||
|
/// Number of first block where EIP-155 rules begin.
|
||||||
|
pub eip155_transition: BlockNumber,
|
||||||
/// Validate block receipts root.
|
/// Validate block receipts root.
|
||||||
pub validate_receipts_transition: u64,
|
pub validate_receipts_transition: BlockNumber,
|
||||||
/// Number of first block where EIP-86 (Metropolis) rules begin.
|
/// Number of first block where EIP-86 (Metropolis) rules begin.
|
||||||
pub eip86_transition: BlockNumber,
|
pub eip86_transition: BlockNumber,
|
||||||
/// Number of first block where EIP-140 (Metropolis: REVERT opcode) rules begin.
|
/// Number of first block where EIP-140 (Metropolis: REVERT opcode) rules begin.
|
||||||
@ -85,6 +92,12 @@ pub struct CommonParams {
|
|||||||
pub remove_dust_contracts: bool,
|
pub remove_dust_contracts: bool,
|
||||||
/// Wasm support
|
/// Wasm support
|
||||||
pub wasm: bool,
|
pub wasm: bool,
|
||||||
|
/// Gas limit bound divisor (how much gas limit can change per block)
|
||||||
|
pub gas_limit_bound_divisor: U256,
|
||||||
|
/// Block reward in wei.
|
||||||
|
pub block_reward: U256,
|
||||||
|
/// Registrar contract address.
|
||||||
|
pub registrar: Address,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CommonParams {
|
impl CommonParams {
|
||||||
@ -111,6 +124,19 @@ impl CommonParams {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Whether these params contain any bug-fix hard forks.
|
||||||
|
pub fn contains_bugfix_hard_fork(&self) -> bool {
|
||||||
|
self.eip98_transition != 0 &&
|
||||||
|
self.eip155_transition != 0 &&
|
||||||
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ethjson::spec::Params> for CommonParams {
|
impl From<ethjson::spec::Params> for CommonParams {
|
||||||
@ -124,6 +150,7 @@ impl From<ethjson::spec::Params> for CommonParams {
|
|||||||
min_gas_limit: p.min_gas_limit.into(),
|
min_gas_limit: p.min_gas_limit.into(),
|
||||||
fork_block: if let (Some(n), Some(h)) = (p.fork_block, p.fork_hash) { Some((n.into(), h.into())) } else { None },
|
fork_block: if let (Some(n), Some(h)) = (p.fork_block, p.fork_hash) { Some((n.into(), h.into())) } else { None },
|
||||||
eip98_transition: p.eip98_transition.map_or(0, Into::into),
|
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_receipts_transition: p.validate_receipts_transition.map_or(0, Into::into),
|
||||||
eip86_transition: p.eip86_transition.map_or(BlockNumber::max_value(), Into::into),
|
eip86_transition: p.eip86_transition.map_or(BlockNumber::max_value(), Into::into),
|
||||||
eip140_transition: p.eip140_transition.map_or(BlockNumber::max_value(), Into::into),
|
eip140_transition: p.eip140_transition.map_or(BlockNumber::max_value(), Into::into),
|
||||||
@ -139,6 +166,9 @@ impl From<ethjson::spec::Params> for CommonParams {
|
|||||||
nonce_cap_increment: p.nonce_cap_increment.map_or(64, Into::into),
|
nonce_cap_increment: p.nonce_cap_increment.map_or(64, Into::into),
|
||||||
remove_dust_contracts: p.remove_dust_contracts.unwrap_or(false),
|
remove_dust_contracts: p.remove_dust_contracts.unwrap_or(false),
|
||||||
wasm: p.wasm.unwrap_or(false),
|
wasm: p.wasm.unwrap_or(false),
|
||||||
|
gas_limit_bound_divisor: p.gas_limit_bound_divisor.into(),
|
||||||
|
block_reward: p.block_reward.map_or_else(U256::zero, Into::into),
|
||||||
|
registrar: p.registrar.map_or_else(Address::new, Into::into),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -242,7 +272,7 @@ impl Spec {
|
|||||||
) -> Arc<Engine> {
|
) -> Arc<Engine> {
|
||||||
match engine_spec {
|
match engine_spec {
|
||||||
ethjson::spec::Engine::Null => Arc::new(NullEngine::new(params, builtins)),
|
ethjson::spec::Engine::Null => Arc::new(NullEngine::new(params, builtins)),
|
||||||
ethjson::spec::Engine::InstantSeal(instant) => Arc::new(InstantSeal::new(params, instant.params.registrar.map_or_else(Address::new, Into::into), builtins)),
|
ethjson::spec::Engine::InstantSeal => Arc::new(InstantSeal::new(params, builtins)),
|
||||||
ethjson::spec::Engine::Ethash(ethash) => Arc::new(ethereum::Ethash::new(cache_dir, params, From::from(ethash.params), builtins)),
|
ethjson::spec::Engine::Ethash(ethash) => Arc::new(ethereum::Ethash::new(cache_dir, params, From::from(ethash.params), builtins)),
|
||||||
ethjson::spec::Engine::BasicAuthority(basic_authority) => Arc::new(BasicAuthority::new(params, From::from(basic_authority.params), builtins)),
|
ethjson::spec::Engine::BasicAuthority(basic_authority) => Arc::new(BasicAuthority::new(params, From::from(basic_authority.params), builtins)),
|
||||||
ethjson::spec::Engine::AuthorityRound(authority_round) => AuthorityRound::new(params, From::from(authority_round.params), builtins).expect("Failed to start AuthorityRound consensus engine."),
|
ethjson::spec::Engine::AuthorityRound(authority_round) => AuthorityRound::new(params, From::from(authority_round.params), builtins).expect("Failed to start AuthorityRound consensus engine."),
|
||||||
|
@ -394,16 +394,13 @@ pub fn get_bad_state_dummy_block() -> Bytes {
|
|||||||
create_test_block(&block_header)
|
create_test_block(&block_header)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_default_ethash_params() -> EthashParams{
|
pub fn get_default_ethash_params() -> EthashParams {
|
||||||
EthashParams {
|
EthashParams {
|
||||||
gas_limit_bound_divisor: U256::from(1024),
|
|
||||||
minimum_difficulty: U256::from(131072),
|
minimum_difficulty: U256::from(131072),
|
||||||
difficulty_bound_divisor: U256::from(2048),
|
difficulty_bound_divisor: U256::from(2048),
|
||||||
difficulty_increment_divisor: 10,
|
difficulty_increment_divisor: 10,
|
||||||
metropolis_difficulty_increment_divisor: 9,
|
metropolis_difficulty_increment_divisor: 9,
|
||||||
duration_limit: 13,
|
duration_limit: 13,
|
||||||
block_reward: U256::from(0),
|
|
||||||
registrar: "0000000000000000000000000000000000000001".into(),
|
|
||||||
homestead_transition: 1150000,
|
homestead_transition: 1150000,
|
||||||
dao_hardfork_transition: u64::max_value(),
|
dao_hardfork_transition: u64::max_value(),
|
||||||
dao_hardfork_beneficiary: "0000000000000000000000000000000000000001".into(),
|
dao_hardfork_beneficiary: "0000000000000000000000000000000000000001".into(),
|
||||||
@ -413,7 +410,6 @@ pub fn get_default_ethash_params() -> EthashParams{
|
|||||||
bomb_defuse_transition: u64::max_value(),
|
bomb_defuse_transition: u64::max_value(),
|
||||||
eip100b_transition: u64::max_value(),
|
eip100b_transition: u64::max_value(),
|
||||||
eip150_transition: u64::max_value(),
|
eip150_transition: u64::max_value(),
|
||||||
eip155_transition: u64::max_value(),
|
|
||||||
eip160_transition: u64::max_value(),
|
eip160_transition: u64::max_value(),
|
||||||
eip161abc_transition: u64::max_value(),
|
eip161abc_transition: u64::max_value(),
|
||||||
eip161d_transition: u64::max_value(),
|
eip161d_transition: u64::max_value(),
|
||||||
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
|||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ethcore-util = { path = "../util" }
|
ethcore-bigint = { path = "../util/bigint" }
|
||||||
rustc-hex = "1.0"
|
rustc-hex = "1.0"
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
|
@ -21,7 +21,7 @@ use std::fmt;
|
|||||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||||
use serde::de::{Error, Visitor};
|
use serde::de::{Error, Visitor};
|
||||||
use rustc_hex::ToHex;
|
use rustc_hex::ToHex;
|
||||||
use util::hash::{H64 as Hash64, H160 as Hash160, H256 as Hash256, H520 as Hash520, H2048 as Hash2048};
|
use bigint::hash::{H64 as Hash64, H160 as Hash160, H256 as Hash256, H520 as Hash520, H2048 as Hash2048};
|
||||||
|
|
||||||
|
|
||||||
macro_rules! impl_hash {
|
macro_rules! impl_hash {
|
||||||
@ -99,7 +99,7 @@ impl_hash!(Bloom, Hash2048);
|
|||||||
mod test {
|
mod test {
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use serde_json;
|
use serde_json;
|
||||||
use util::hash;
|
use bigint::hash;
|
||||||
use hash::H256;
|
use hash::H256;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
extern crate rustc_hex;
|
extern crate rustc_hex;
|
||||||
extern crate serde;
|
extern crate serde;
|
||||||
extern crate serde_json;
|
extern crate serde_json;
|
||||||
extern crate ethcore_util as util;
|
extern crate ethcore_bigint as bigint;
|
||||||
#[macro_use] extern crate serde_derive;
|
#[macro_use] extern crate serde_derive;
|
||||||
|
|
||||||
pub mod hash;
|
pub mod hash;
|
||||||
|
@ -68,7 +68,7 @@ impl<T> Into<Option<T>> for MaybeEmpty<T> {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use serde_json;
|
use serde_json;
|
||||||
use util::hash;
|
use bigint::hash;
|
||||||
use hash::H256;
|
use hash::H256;
|
||||||
use maybe::MaybeEmpty;
|
use maybe::MaybeEmpty;
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ mod tests {
|
|||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use serde_json;
|
use serde_json;
|
||||||
use spec::account::Account;
|
use spec::account::Account;
|
||||||
use util::U256;
|
use bigint::prelude::U256;
|
||||||
use uint::Uint;
|
use uint::Uint;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
|
|
||||||
|
@ -17,25 +17,16 @@
|
|||||||
//! Authority params deserialization.
|
//! Authority params deserialization.
|
||||||
|
|
||||||
use uint::Uint;
|
use uint::Uint;
|
||||||
use hash::Address;
|
|
||||||
use super::ValidatorSet;
|
use super::ValidatorSet;
|
||||||
|
|
||||||
/// Authority params deserialization.
|
/// Authority params deserialization.
|
||||||
#[derive(Debug, PartialEq, Deserialize)]
|
#[derive(Debug, PartialEq, Deserialize)]
|
||||||
pub struct AuthorityRoundParams {
|
pub struct AuthorityRoundParams {
|
||||||
/// Gas limit divisor.
|
|
||||||
#[serde(rename="gasLimitBoundDivisor")]
|
|
||||||
pub gas_limit_bound_divisor: Uint,
|
|
||||||
/// Block duration.
|
/// Block duration.
|
||||||
#[serde(rename="stepDuration")]
|
#[serde(rename="stepDuration")]
|
||||||
pub step_duration: Uint,
|
pub step_duration: Uint,
|
||||||
/// Valid authorities
|
/// Valid authorities
|
||||||
pub validators: ValidatorSet,
|
pub validators: ValidatorSet,
|
||||||
/// Block reward.
|
|
||||||
#[serde(rename="blockReward")]
|
|
||||||
pub block_reward: Option<Uint>,
|
|
||||||
/// Address of the registrar contract.
|
|
||||||
pub registrar: Option<Address>,
|
|
||||||
/// Starting step. Determined automatically if not specified.
|
/// Starting step. Determined automatically if not specified.
|
||||||
/// To be used for testing only.
|
/// To be used for testing only.
|
||||||
#[serde(rename="startStep")]
|
#[serde(rename="startStep")]
|
||||||
@ -43,9 +34,6 @@ pub struct AuthorityRoundParams {
|
|||||||
/// Block at which score validation should start.
|
/// Block at which score validation should start.
|
||||||
#[serde(rename="validateScoreTransition")]
|
#[serde(rename="validateScoreTransition")]
|
||||||
pub validate_score_transition: Option<Uint>,
|
pub validate_score_transition: Option<Uint>,
|
||||||
/// See main AuthorityRoundParams docs.
|
|
||||||
#[serde(rename="eip155Transition")]
|
|
||||||
pub eip155_transition: Option<Uint>,
|
|
||||||
/// Block from which monotonic steps start.
|
/// Block from which monotonic steps start.
|
||||||
#[serde(rename="validateStepTransition")]
|
#[serde(rename="validateStepTransition")]
|
||||||
pub validate_step_transition: Option<Uint>,
|
pub validate_step_transition: Option<Uint>,
|
||||||
@ -63,9 +51,8 @@ pub struct AuthorityRound {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
use bigint::prelude::{U256, H160};
|
||||||
use uint::Uint;
|
use uint::Uint;
|
||||||
use util::U256;
|
|
||||||
use util::H160;
|
|
||||||
use serde_json;
|
use serde_json;
|
||||||
use hash::Address;
|
use hash::Address;
|
||||||
use spec::validator_set::ValidatorSet;
|
use spec::validator_set::ValidatorSet;
|
||||||
@ -75,26 +62,19 @@ mod tests {
|
|||||||
fn authority_round_deserialization() {
|
fn authority_round_deserialization() {
|
||||||
let s = r#"{
|
let s = r#"{
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"stepDuration": "0x02",
|
"stepDuration": "0x02",
|
||||||
"validators": {
|
"validators": {
|
||||||
"list" : ["0xc6d9d2cd449a754c494264e1809c50e34d64562b"]
|
"list" : ["0xc6d9d2cd449a754c494264e1809c50e34d64562b"]
|
||||||
},
|
},
|
||||||
"blockReward": "0x50",
|
|
||||||
"startStep" : 24,
|
"startStep" : 24,
|
||||||
"eip155Transition": "0x42",
|
|
||||||
"validateStepTransition": 150
|
"validateStepTransition": 150
|
||||||
}
|
}
|
||||||
}"#;
|
}"#;
|
||||||
|
|
||||||
let deserialized: AuthorityRound = serde_json::from_str(s).unwrap();
|
let deserialized: AuthorityRound = serde_json::from_str(s).unwrap();
|
||||||
assert_eq!(deserialized.params.gas_limit_bound_divisor, Uint(U256::from(0x0400)));
|
|
||||||
assert_eq!(deserialized.params.step_duration, Uint(U256::from(0x02)));
|
assert_eq!(deserialized.params.step_duration, Uint(U256::from(0x02)));
|
||||||
assert_eq!(deserialized.params.validators, ValidatorSet::List(vec![Address(H160::from("0xc6d9d2cd449a754c494264e1809c50e34d64562b"))]));
|
assert_eq!(deserialized.params.validators, ValidatorSet::List(vec![Address(H160::from("0xc6d9d2cd449a754c494264e1809c50e34d64562b"))]));
|
||||||
assert_eq!(deserialized.params.block_reward, Some(Uint(U256::from(0x50))));
|
|
||||||
assert!(deserialized.params.registrar.is_none());
|
|
||||||
assert_eq!(deserialized.params.start_step, Some(Uint(U256::from(24))));
|
assert_eq!(deserialized.params.start_step, Some(Uint(U256::from(24))));
|
||||||
assert_eq!(deserialized.params.eip155_transition, Some(Uint(U256::from(0x42))));
|
|
||||||
assert_eq!(deserialized.params.immediate_transitions, None);
|
assert_eq!(deserialized.params.immediate_transitions, None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,9 +22,6 @@ use super::ValidatorSet;
|
|||||||
/// Authority params deserialization.
|
/// Authority params deserialization.
|
||||||
#[derive(Debug, PartialEq, Deserialize)]
|
#[derive(Debug, PartialEq, Deserialize)]
|
||||||
pub struct BasicAuthorityParams {
|
pub struct BasicAuthorityParams {
|
||||||
/// Gas limit divisor.
|
|
||||||
#[serde(rename="gasLimitBoundDivisor")]
|
|
||||||
pub gas_limit_bound_divisor: Uint,
|
|
||||||
/// Block duration.
|
/// Block duration.
|
||||||
#[serde(rename="durationLimit")]
|
#[serde(rename="durationLimit")]
|
||||||
pub duration_limit: Uint,
|
pub duration_limit: Uint,
|
||||||
@ -43,9 +40,8 @@ pub struct BasicAuthority {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use serde_json;
|
use serde_json;
|
||||||
use uint::Uint;
|
use uint::Uint;
|
||||||
use util::U256;
|
use bigint::prelude::{U256, H160};
|
||||||
use hash::Address;
|
use hash::Address;
|
||||||
use util::hash::H160;
|
|
||||||
use spec::basic_authority::BasicAuthority;
|
use spec::basic_authority::BasicAuthority;
|
||||||
use spec::validator_set::ValidatorSet;
|
use spec::validator_set::ValidatorSet;
|
||||||
|
|
||||||
@ -53,7 +49,6 @@ mod tests {
|
|||||||
fn basic_authority_deserialization() {
|
fn basic_authority_deserialization() {
|
||||||
let s = r#"{
|
let s = r#"{
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"durationLimit": "0x0d",
|
"durationLimit": "0x0d",
|
||||||
"validators" : {
|
"validators" : {
|
||||||
"list": ["0xc6d9d2cd449a754c494264e1809c50e34d64562b"]
|
"list": ["0xc6d9d2cd449a754c494264e1809c50e34d64562b"]
|
||||||
@ -63,7 +58,6 @@ mod tests {
|
|||||||
|
|
||||||
let deserialized: BasicAuthority = serde_json::from_str(s).unwrap();
|
let deserialized: BasicAuthority = serde_json::from_str(s).unwrap();
|
||||||
|
|
||||||
assert_eq!(deserialized.params.gas_limit_bound_divisor, Uint(U256::from(0x0400)));
|
|
||||||
assert_eq!(deserialized.params.duration_limit, Uint(U256::from(0x0d)));
|
assert_eq!(deserialized.params.duration_limit, Uint(U256::from(0x0d)));
|
||||||
let vs = ValidatorSet::List(vec![Address(H160::from("0xc6d9d2cd449a754c494264e1809c50e34d64562b"))]);
|
let vs = ValidatorSet::List(vec![Address(H160::from("0xc6d9d2cd449a754c494264e1809c50e34d64562b"))]);
|
||||||
assert_eq!(deserialized.params.validators, vs);
|
assert_eq!(deserialized.params.validators, vs);
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
//! Engine deserialization.
|
//! Engine deserialization.
|
||||||
|
|
||||||
use super::{Ethash, InstantSeal, BasicAuthority, AuthorityRound, Tendermint};
|
use super::{Ethash, BasicAuthority, AuthorityRound, Tendermint};
|
||||||
|
|
||||||
/// Engine deserialization.
|
/// Engine deserialization.
|
||||||
#[derive(Debug, PartialEq, Deserialize)]
|
#[derive(Debug, PartialEq, Deserialize)]
|
||||||
@ -26,7 +26,7 @@ pub enum Engine {
|
|||||||
Null,
|
Null,
|
||||||
/// Instantly sealing engine.
|
/// Instantly sealing engine.
|
||||||
#[serde(rename="instantSeal")]
|
#[serde(rename="instantSeal")]
|
||||||
InstantSeal(InstantSeal),
|
InstantSeal,
|
||||||
/// Ethash engine.
|
/// Ethash engine.
|
||||||
Ethash(Ethash),
|
Ethash(Ethash),
|
||||||
/// BasicAuthority engine.
|
/// BasicAuthority engine.
|
||||||
@ -55,23 +55,21 @@ mod tests {
|
|||||||
assert_eq!(Engine::Null, deserialized);
|
assert_eq!(Engine::Null, deserialized);
|
||||||
|
|
||||||
let s = r#"{
|
let s = r#"{
|
||||||
"instantSeal": { "params": {} }
|
"instantSeal": null
|
||||||
}"#;
|
}"#;
|
||||||
|
|
||||||
let deserialized: Engine = serde_json::from_str(s).unwrap();
|
let deserialized: Engine = serde_json::from_str(s).unwrap();
|
||||||
match deserialized {
|
match deserialized {
|
||||||
Engine::InstantSeal(_) => {}, // instant seal is unit tested in its own file.
|
Engine::InstantSeal => {}, // instant seal is unit tested in its own file.
|
||||||
_ => assert!(false),
|
_ => assert!(false),
|
||||||
};
|
};
|
||||||
|
|
||||||
let s = r#"{
|
let s = r#"{
|
||||||
"Ethash": {
|
"Ethash": {
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"minimumDifficulty": "0x020000",
|
"minimumDifficulty": "0x020000",
|
||||||
"difficultyBoundDivisor": "0x0800",
|
"difficultyBoundDivisor": "0x0800",
|
||||||
"durationLimit": "0x0d",
|
"durationLimit": "0x0d",
|
||||||
"blockReward": "0x4563918244F40000",
|
|
||||||
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
||||||
"homesteadTransition" : "0x",
|
"homesteadTransition" : "0x",
|
||||||
"daoHardforkTransition": "0xffffffffffffffff",
|
"daoHardforkTransition": "0xffffffffffffffff",
|
||||||
@ -90,7 +88,6 @@ mod tests {
|
|||||||
let s = r#"{
|
let s = r#"{
|
||||||
"basicAuthority": {
|
"basicAuthority": {
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"durationLimit": "0x0d",
|
"durationLimit": "0x0d",
|
||||||
"validators" : {
|
"validators" : {
|
||||||
"list": ["0xc6d9d2cd449a754c494264e1809c50e34d64562b"]
|
"list": ["0xc6d9d2cd449a754c494264e1809c50e34d64562b"]
|
||||||
@ -107,14 +104,11 @@ mod tests {
|
|||||||
let s = r#"{
|
let s = r#"{
|
||||||
"authorityRound": {
|
"authorityRound": {
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"stepDuration": "0x02",
|
"stepDuration": "0x02",
|
||||||
"validators": {
|
"validators": {
|
||||||
"list" : ["0xc6d9d2cd449a754c494264e1809c50e34d64562b"]
|
"list" : ["0xc6d9d2cd449a754c494264e1809c50e34d64562b"]
|
||||||
},
|
},
|
||||||
"blockReward": "0x50",
|
|
||||||
"startStep" : 24,
|
"startStep" : 24,
|
||||||
"eip155Transition": "0x42",
|
|
||||||
"validateStepTransition": 150
|
"validateStepTransition": 150
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -128,11 +122,9 @@ mod tests {
|
|||||||
let s = r#"{
|
let s = r#"{
|
||||||
"tendermint": {
|
"tendermint": {
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"validators": {
|
"validators": {
|
||||||
"list": ["0xc6d9d2cd449a754c494264e1809c50e34d64562b"]
|
"list": ["0xc6d9d2cd449a754c494264e1809c50e34d64562b"]
|
||||||
},
|
}
|
||||||
"blockReward": "0x50"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}"#;
|
}"#;
|
||||||
|
@ -22,9 +22,6 @@ use hash::Address;
|
|||||||
/// Deserializable doppelganger of EthashParams.
|
/// Deserializable doppelganger of EthashParams.
|
||||||
#[derive(Debug, PartialEq, Deserialize)]
|
#[derive(Debug, PartialEq, Deserialize)]
|
||||||
pub struct EthashParams {
|
pub struct EthashParams {
|
||||||
/// See main EthashParams docs.
|
|
||||||
#[serde(rename="gasLimitBoundDivisor")]
|
|
||||||
pub gas_limit_bound_divisor: Uint,
|
|
||||||
/// See main EthashParams docs.
|
/// See main EthashParams docs.
|
||||||
#[serde(rename="minimumDifficulty")]
|
#[serde(rename="minimumDifficulty")]
|
||||||
pub minimum_difficulty: Uint,
|
pub minimum_difficulty: Uint,
|
||||||
@ -40,11 +37,6 @@ pub struct EthashParams {
|
|||||||
/// See main EthashParams docs.
|
/// See main EthashParams docs.
|
||||||
#[serde(rename="durationLimit")]
|
#[serde(rename="durationLimit")]
|
||||||
pub duration_limit: Option<Uint>,
|
pub duration_limit: Option<Uint>,
|
||||||
/// See main EthashParams docs.
|
|
||||||
#[serde(rename="blockReward")]
|
|
||||||
pub block_reward: Uint,
|
|
||||||
/// See main EthashParams docs.
|
|
||||||
pub registrar: Option<Address>,
|
|
||||||
|
|
||||||
/// See main EthashParams docs.
|
/// See main EthashParams docs.
|
||||||
#[serde(rename="homesteadTransition")]
|
#[serde(rename="homesteadTransition")]
|
||||||
@ -78,10 +70,6 @@ pub struct EthashParams {
|
|||||||
#[serde(rename="eip150Transition")]
|
#[serde(rename="eip150Transition")]
|
||||||
pub eip150_transition: Option<Uint>,
|
pub eip150_transition: Option<Uint>,
|
||||||
|
|
||||||
/// See main EthashParams docs.
|
|
||||||
#[serde(rename="eip155Transition")]
|
|
||||||
pub eip155_transition: Option<Uint>,
|
|
||||||
|
|
||||||
/// See main EthashParams docs.
|
/// See main EthashParams docs.
|
||||||
#[serde(rename="eip160Transition")]
|
#[serde(rename="eip160Transition")]
|
||||||
pub eip160_transition: Option<Uint>,
|
pub eip160_transition: Option<Uint>,
|
||||||
@ -136,21 +124,17 @@ pub struct Ethash {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use serde_json;
|
use serde_json;
|
||||||
use uint::Uint;
|
use uint::Uint;
|
||||||
use util::U256;
|
use bigint::prelude::{H160, U256};
|
||||||
use hash::Address;
|
use hash::Address;
|
||||||
use util::hash::H160;
|
|
||||||
use spec::ethash::{Ethash, EthashParams};
|
use spec::ethash::{Ethash, EthashParams};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn ethash_deserialization() {
|
fn ethash_deserialization() {
|
||||||
let s = r#"{
|
let s = r#"{
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"minimumDifficulty": "0x020000",
|
"minimumDifficulty": "0x020000",
|
||||||
"difficultyBoundDivisor": "0x0800",
|
"difficultyBoundDivisor": "0x0800",
|
||||||
"durationLimit": "0x0d",
|
"durationLimit": "0x0d",
|
||||||
"blockReward": "0x4563918244F40000",
|
|
||||||
"registrar": "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
|
||||||
"homesteadTransition": "0x42",
|
"homesteadTransition": "0x42",
|
||||||
"daoHardforkTransition": "0x08",
|
"daoHardforkTransition": "0x08",
|
||||||
"daoHardforkBeneficiary": "0xabcabcabcabcabcabcabcabcabcabcabcabcabca",
|
"daoHardforkBeneficiary": "0xabcabcabcabcabcabcabcabcabcabcabcabcabca",
|
||||||
@ -181,7 +165,6 @@ mod tests {
|
|||||||
"bombDefuseTransition": "0x41",
|
"bombDefuseTransition": "0x41",
|
||||||
"eip100bTransition": "0x42",
|
"eip100bTransition": "0x42",
|
||||||
"eip150Transition": "0x43",
|
"eip150Transition": "0x43",
|
||||||
"eip155Transition": "0x44",
|
|
||||||
"eip160Transition": "0x45",
|
"eip160Transition": "0x45",
|
||||||
"eip161abcTransition": "0x46",
|
"eip161abcTransition": "0x46",
|
||||||
"eip161dTransition": "0x47"
|
"eip161dTransition": "0x47"
|
||||||
@ -190,16 +173,13 @@ mod tests {
|
|||||||
|
|
||||||
let deserialized: Ethash = serde_json::from_str(s).unwrap();
|
let deserialized: Ethash = serde_json::from_str(s).unwrap();
|
||||||
|
|
||||||
assert_eq!(deserialized, Ethash{
|
assert_eq!(deserialized, Ethash {
|
||||||
params: EthashParams{
|
params: EthashParams{
|
||||||
gas_limit_bound_divisor: Uint(U256::from(0x0400)),
|
|
||||||
minimum_difficulty: Uint(U256::from(0x020000)),
|
minimum_difficulty: Uint(U256::from(0x020000)),
|
||||||
difficulty_bound_divisor: Uint(U256::from(0x0800)),
|
difficulty_bound_divisor: Uint(U256::from(0x0800)),
|
||||||
difficulty_increment_divisor: None,
|
difficulty_increment_divisor: None,
|
||||||
metropolis_difficulty_increment_divisor: None,
|
metropolis_difficulty_increment_divisor: None,
|
||||||
duration_limit: Some(Uint(U256::from(0x0d))),
|
duration_limit: Some(Uint(U256::from(0x0d))),
|
||||||
block_reward: Uint(U256::from(0x4563918244F40000u64)),
|
|
||||||
registrar: Some(Address(H160::from("0xc6d9d2cd449a754c494264e1809c50e34d64562b"))),
|
|
||||||
homestead_transition: Some(Uint(U256::from(0x42))),
|
homestead_transition: Some(Uint(U256::from(0x42))),
|
||||||
dao_hardfork_transition: Some(Uint(U256::from(0x08))),
|
dao_hardfork_transition: Some(Uint(U256::from(0x08))),
|
||||||
dao_hardfork_beneficiary: Some(Address(H160::from("0xabcabcabcabcabcabcabcabcabcabcabcabcabca"))),
|
dao_hardfork_beneficiary: Some(Address(H160::from("0xabcabcabcabcabcabcabcabcabcabcabcabcabca"))),
|
||||||
@ -230,7 +210,6 @@ mod tests {
|
|||||||
bomb_defuse_transition: Some(Uint(U256::from(0x41))),
|
bomb_defuse_transition: Some(Uint(U256::from(0x41))),
|
||||||
eip100b_transition: Some(Uint(U256::from(0x42))),
|
eip100b_transition: Some(Uint(U256::from(0x42))),
|
||||||
eip150_transition: Some(Uint(U256::from(0x43))),
|
eip150_transition: Some(Uint(U256::from(0x43))),
|
||||||
eip155_transition: Some(Uint(U256::from(0x44))),
|
|
||||||
eip160_transition: Some(Uint(U256::from(0x45))),
|
eip160_transition: Some(Uint(U256::from(0x45))),
|
||||||
eip161abc_transition: Some(Uint(U256::from(0x46))),
|
eip161abc_transition: Some(Uint(U256::from(0x46))),
|
||||||
eip161d_transition: Some(Uint(U256::from(0x47))),
|
eip161d_transition: Some(Uint(U256::from(0x47))),
|
||||||
@ -250,24 +229,19 @@ mod tests {
|
|||||||
fn ethash_deserialization_missing_optionals() {
|
fn ethash_deserialization_missing_optionals() {
|
||||||
let s = r#"{
|
let s = r#"{
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"minimumDifficulty": "0x020000",
|
|
||||||
"difficultyBoundDivisor": "0x0800",
|
"difficultyBoundDivisor": "0x0800",
|
||||||
"blockReward": "0x4563918244F40000"
|
"minimumDifficulty": "0x020000"
|
||||||
}
|
}
|
||||||
}"#;
|
}"#;
|
||||||
|
|
||||||
let deserialized: Ethash = serde_json::from_str(s).unwrap();
|
let deserialized: Ethash = serde_json::from_str(s).unwrap();
|
||||||
assert_eq!(deserialized, Ethash{
|
assert_eq!(deserialized, Ethash {
|
||||||
params: EthashParams{
|
params: EthashParams {
|
||||||
gas_limit_bound_divisor: Uint(U256::from(0x0400)),
|
|
||||||
minimum_difficulty: Uint(U256::from(0x020000)),
|
minimum_difficulty: Uint(U256::from(0x020000)),
|
||||||
difficulty_bound_divisor: Uint(U256::from(0x0800)),
|
difficulty_bound_divisor: Uint(U256::from(0x0800)),
|
||||||
difficulty_increment_divisor: None,
|
difficulty_increment_divisor: None,
|
||||||
metropolis_difficulty_increment_divisor: None,
|
metropolis_difficulty_increment_divisor: None,
|
||||||
duration_limit: None,
|
duration_limit: None,
|
||||||
block_reward: Uint(U256::from(0x4563918244F40000u64)),
|
|
||||||
registrar: None,
|
|
||||||
homestead_transition: None,
|
homestead_transition: None,
|
||||||
dao_hardfork_transition: None,
|
dao_hardfork_transition: None,
|
||||||
dao_hardfork_beneficiary: None,
|
dao_hardfork_beneficiary: None,
|
||||||
@ -277,7 +251,6 @@ mod tests {
|
|||||||
bomb_defuse_transition: None,
|
bomb_defuse_transition: None,
|
||||||
eip100b_transition: None,
|
eip100b_transition: None,
|
||||||
eip150_transition: None,
|
eip150_transition: None,
|
||||||
eip155_transition: None,
|
|
||||||
eip160_transition: None,
|
eip160_transition: None,
|
||||||
eip161abc_transition: None,
|
eip161abc_transition: None,
|
||||||
eip161d_transition: None,
|
eip161d_transition: None,
|
||||||
|
@ -60,10 +60,8 @@ mod tests {
|
|||||||
use serde_json;
|
use serde_json;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use uint::Uint;
|
use uint::Uint;
|
||||||
use util::U256;
|
use bigint::prelude::{U256, H160, H64 as Eth64, H256 as Eth256};
|
||||||
use hash::{H64, H256, Address};
|
use hash::{H64, H256, Address};
|
||||||
use util::hash::H160;
|
|
||||||
use util::{H64 as Eth64, H256 as Eth256};
|
|
||||||
use spec::genesis::Genesis;
|
use spec::genesis::Genesis;
|
||||||
use spec::{Ethereum, Seal};
|
use spec::{Ethereum, Seal};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
@ -1,53 +0,0 @@
|
|||||||
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
|
|
||||||
// This file is part of Parity.
|
|
||||||
|
|
||||||
// Parity is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
|
|
||||||
// Parity is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
//! Instant params deserialization.
|
|
||||||
|
|
||||||
use hash::Address;
|
|
||||||
|
|
||||||
/// Instant params deserialization.
|
|
||||||
#[derive(Debug, PartialEq, Deserialize)]
|
|
||||||
pub struct InstantSealParams {
|
|
||||||
/// Address of the registrar contract.
|
|
||||||
pub registrar: Option<Address>,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Instant engine deserialization.
|
|
||||||
#[derive(Debug, PartialEq, Deserialize)]
|
|
||||||
pub struct InstantSeal {
|
|
||||||
/// Instant Seal params.
|
|
||||||
pub params: InstantSealParams,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use serde_json;
|
|
||||||
use hash::Address;
|
|
||||||
use util::hash::H160;
|
|
||||||
use spec::instant_seal::InstantSeal;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn instant_seal_deserialization() {
|
|
||||||
let s = r#"{
|
|
||||||
"params": {
|
|
||||||
"registrar": "0xc6d9d2cd449a754c494264e1809c50e34d64562b"
|
|
||||||
}
|
|
||||||
}"#;
|
|
||||||
|
|
||||||
let deserialized: InstantSeal = serde_json::from_str(s).unwrap();
|
|
||||||
assert_eq!(deserialized.params.registrar, Some(Address(H160::from("0xc6d9d2cd449a754c494264e1809c50e34d64562b"))));
|
|
||||||
}
|
|
||||||
}
|
|
@ -26,7 +26,6 @@ pub mod engine;
|
|||||||
pub mod state;
|
pub mod state;
|
||||||
pub mod ethash;
|
pub mod ethash;
|
||||||
pub mod validator_set;
|
pub mod validator_set;
|
||||||
pub mod instant_seal;
|
|
||||||
pub mod basic_authority;
|
pub mod basic_authority;
|
||||||
pub mod authority_round;
|
pub mod authority_round;
|
||||||
pub mod tendermint;
|
pub mod tendermint;
|
||||||
@ -41,7 +40,6 @@ pub use self::engine::Engine;
|
|||||||
pub use self::state::State;
|
pub use self::state::State;
|
||||||
pub use self::ethash::{Ethash, EthashParams};
|
pub use self::ethash::{Ethash, EthashParams};
|
||||||
pub use self::validator_set::ValidatorSet;
|
pub use self::validator_set::ValidatorSet;
|
||||||
pub use self::instant_seal::{InstantSeal, InstantSealParams};
|
|
||||||
pub use self::basic_authority::{BasicAuthority, BasicAuthorityParams};
|
pub use self::basic_authority::{BasicAuthority, BasicAuthorityParams};
|
||||||
pub use self::authority_round::{AuthorityRound, AuthorityRoundParams};
|
pub use self::authority_round::{AuthorityRound, AuthorityRoundParams};
|
||||||
pub use self::tendermint::{Tendermint, TendermintParams};
|
pub use self::tendermint::{Tendermint, TendermintParams};
|
||||||
|
@ -55,6 +55,9 @@ pub struct Params {
|
|||||||
#[serde(rename="eip98Transition")]
|
#[serde(rename="eip98Transition")]
|
||||||
pub eip98_transition: Option<Uint>,
|
pub eip98_transition: Option<Uint>,
|
||||||
/// See `CommonParams` docs.
|
/// See `CommonParams` docs.
|
||||||
|
#[serde(rename="eip155Transition")]
|
||||||
|
pub eip155_transition: Option<Uint>,
|
||||||
|
/// See `CommonParams` docs.
|
||||||
#[serde(rename="validateReceiptsTransition")]
|
#[serde(rename="validateReceiptsTransition")]
|
||||||
pub validate_receipts_transition: Option<Uint>,
|
pub validate_receipts_transition: Option<Uint>,
|
||||||
/// See `CommonParams` docs.
|
/// See `CommonParams` docs.
|
||||||
@ -91,13 +94,21 @@ pub struct Params {
|
|||||||
pub remove_dust_contracts : Option<bool>,
|
pub remove_dust_contracts : Option<bool>,
|
||||||
/// Wasm support flag
|
/// Wasm support flag
|
||||||
pub wasm: Option<bool>,
|
pub wasm: Option<bool>,
|
||||||
|
/// See `CommonParams` docs.
|
||||||
|
#[serde(rename="gasLimitBoundDivisor")]
|
||||||
|
pub gas_limit_bound_divisor: Uint,
|
||||||
|
/// See `CommonParams` docs.
|
||||||
|
#[serde(rename="blockReward")]
|
||||||
|
pub block_reward: Option<Uint>,
|
||||||
|
/// See `CommonParams` docs.
|
||||||
|
pub registrar: Option<Address>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use serde_json;
|
use serde_json;
|
||||||
use uint::Uint;
|
use uint::Uint;
|
||||||
use util::U256;
|
use bigint::prelude::U256;
|
||||||
use spec::params::Params;
|
use spec::params::Params;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -108,7 +119,8 @@ mod tests {
|
|||||||
"chainID" : "0x15",
|
"chainID" : "0x15",
|
||||||
"subprotocolName" : "exp",
|
"subprotocolName" : "exp",
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
"accountStartNonce": "0x01"
|
"accountStartNonce": "0x01",
|
||||||
|
"gasLimitBoundDivisor": "0x20"
|
||||||
}"#;
|
}"#;
|
||||||
|
|
||||||
let deserialized: Params = serde_json::from_str(s).unwrap();
|
let deserialized: Params = serde_json::from_str(s).unwrap();
|
||||||
@ -118,5 +130,6 @@ mod tests {
|
|||||||
assert_eq!(deserialized.subprotocol_name, Some("exp".to_owned()));
|
assert_eq!(deserialized.subprotocol_name, Some("exp".to_owned()));
|
||||||
assert_eq!(deserialized.min_gas_limit, Uint(U256::from(0x1388)));
|
assert_eq!(deserialized.min_gas_limit, Uint(U256::from(0x1388)));
|
||||||
assert_eq!(deserialized.account_start_nonce, Some(Uint(U256::from(0x01))));
|
assert_eq!(deserialized.account_start_nonce, Some(Uint(U256::from(0x01))));
|
||||||
|
assert_eq!(deserialized.gas_limit_bound_divisor, Uint(U256::from(0x20)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,8 +73,7 @@ mod tests {
|
|||||||
use hash::*;
|
use hash::*;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use uint::Uint;
|
use uint::Uint;
|
||||||
use util::U256;
|
use bigint::prelude::{U256, H64 as Eth64, H256 as Eth256, H520 as Eth520};
|
||||||
use util::{H64 as Eth64, H256 as Eth256, H520 as Eth520};
|
|
||||||
use spec::{Ethereum, AuthorityRoundSeal, TendermintSeal, Seal};
|
use spec::{Ethereum, AuthorityRoundSeal, TendermintSeal, Seal};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -61,12 +61,9 @@ mod tests {
|
|||||||
"engine": {
|
"engine": {
|
||||||
"Ethash": {
|
"Ethash": {
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"minimumDifficulty": "0x020000",
|
"minimumDifficulty": "0x020000",
|
||||||
"difficultyBoundDivisor": "0x0800",
|
"difficultyBoundDivisor": "0x0800",
|
||||||
"durationLimit": "0x0d",
|
"durationLimit": "0x0d",
|
||||||
"blockReward": "0x4563918244F40000",
|
|
||||||
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
|
||||||
"homesteadTransition" : "0x",
|
"homesteadTransition" : "0x",
|
||||||
"daoHardforkTransition": "0xffffffffffffffff",
|
"daoHardforkTransition": "0xffffffffffffffff",
|
||||||
"daoHardforkBeneficiary": "0x0000000000000000000000000000000000000000",
|
"daoHardforkBeneficiary": "0x0000000000000000000000000000000000000000",
|
||||||
@ -81,7 +78,8 @@ mod tests {
|
|||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
"networkID" : "0x2",
|
"networkID" : "0x2",
|
||||||
"forkBlock": "0xffffffffffffffff",
|
"forkBlock": "0xffffffffffffffff",
|
||||||
"forkCanonHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
|
"forkCanonHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"gasLimitBoundDivisor": "0x20"
|
||||||
},
|
},
|
||||||
"genesis": {
|
"genesis": {
|
||||||
"seal": {
|
"seal": {
|
||||||
|
@ -17,15 +17,11 @@
|
|||||||
//! Tendermint params deserialization.
|
//! Tendermint params deserialization.
|
||||||
|
|
||||||
use uint::Uint;
|
use uint::Uint;
|
||||||
use hash::Address;
|
|
||||||
use super::ValidatorSet;
|
use super::ValidatorSet;
|
||||||
|
|
||||||
/// Tendermint params deserialization.
|
/// Tendermint params deserialization.
|
||||||
#[derive(Debug, PartialEq, Deserialize)]
|
#[derive(Debug, PartialEq, Deserialize)]
|
||||||
pub struct TendermintParams {
|
pub struct TendermintParams {
|
||||||
/// Gas limit divisor.
|
|
||||||
#[serde(rename="gasLimitBoundDivisor")]
|
|
||||||
pub gas_limit_bound_divisor: Uint,
|
|
||||||
/// Valid validators.
|
/// Valid validators.
|
||||||
pub validators: ValidatorSet,
|
pub validators: ValidatorSet,
|
||||||
/// Propose step timeout in milliseconds.
|
/// Propose step timeout in milliseconds.
|
||||||
@ -40,11 +36,6 @@ pub struct TendermintParams {
|
|||||||
/// Commit step timeout in milliseconds.
|
/// Commit step timeout in milliseconds.
|
||||||
#[serde(rename="timeoutCommit")]
|
#[serde(rename="timeoutCommit")]
|
||||||
pub timeout_commit: Option<Uint>,
|
pub timeout_commit: Option<Uint>,
|
||||||
/// Block reward.
|
|
||||||
#[serde(rename="blockReward")]
|
|
||||||
pub block_reward: Option<Uint>,
|
|
||||||
/// Address of the registrar contract.
|
|
||||||
pub registrar: Option<Address>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Tendermint engine deserialization.
|
/// Tendermint engine deserialization.
|
||||||
@ -57,10 +48,7 @@ pub struct Tendermint {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use serde_json;
|
use serde_json;
|
||||||
use uint::Uint;
|
use bigint::prelude::H160;
|
||||||
use util::U256;
|
|
||||||
use hash::Address;
|
|
||||||
use util::hash::H160;
|
|
||||||
use spec::tendermint::Tendermint;
|
use spec::tendermint::Tendermint;
|
||||||
use spec::validator_set::ValidatorSet;
|
use spec::validator_set::ValidatorSet;
|
||||||
|
|
||||||
@ -68,18 +56,14 @@ mod tests {
|
|||||||
fn tendermint_deserialization() {
|
fn tendermint_deserialization() {
|
||||||
let s = r#"{
|
let s = r#"{
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"validators": {
|
"validators": {
|
||||||
"list": ["0xc6d9d2cd449a754c494264e1809c50e34d64562b"]
|
"list": ["0xc6d9d2cd449a754c494264e1809c50e34d64562b"]
|
||||||
},
|
}
|
||||||
"blockReward": "0x50"
|
|
||||||
}
|
}
|
||||||
}"#;
|
}"#;
|
||||||
|
|
||||||
let deserialized: Tendermint = serde_json::from_str(s).unwrap();
|
let deserialized: Tendermint = serde_json::from_str(s).unwrap();
|
||||||
assert_eq!(deserialized.params.gas_limit_bound_divisor, Uint(U256::from(0x0400)));
|
|
||||||
let vs = ValidatorSet::List(vec![Address(H160::from("0xc6d9d2cd449a754c494264e1809c50e34d64562b"))]);
|
let vs = ValidatorSet::List(vec![Address(H160::from("0xc6d9d2cd449a754c494264e1809c50e34d64562b"))]);
|
||||||
assert_eq!(deserialized.params.validators, vs);
|
assert_eq!(deserialized.params.validators, vs);
|
||||||
assert_eq!(deserialized.params.block_reward, Some(Uint(U256::from(0x50))));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,9 +41,8 @@ pub enum ValidatorSet {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use serde_json;
|
use serde_json;
|
||||||
use uint::Uint;
|
use uint::Uint;
|
||||||
use util::U256;
|
use bigint::prelude::{H160, U256};
|
||||||
use hash::Address;
|
use hash::Address;
|
||||||
use util::hash::H160;
|
|
||||||
use spec::validator_set::ValidatorSet;
|
use spec::validator_set::ValidatorSet;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -20,7 +20,7 @@ use std::fmt;
|
|||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use serde::{Deserialize, Deserializer};
|
use serde::{Deserialize, Deserializer};
|
||||||
use serde::de::{Error, Visitor};
|
use serde::de::{Error, Visitor};
|
||||||
use util::U256;
|
use bigint::prelude::U256;
|
||||||
|
|
||||||
/// Lenient uint json deserialization for test json files.
|
/// Lenient uint json deserialization for test json files.
|
||||||
#[derive(Default, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
|
#[derive(Default, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
|
||||||
@ -93,7 +93,7 @@ impl<'a> Visitor<'a> for UintVisitor {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use serde_json;
|
use serde_json;
|
||||||
use util::U256;
|
use bigint::prelude::U256;
|
||||||
use uint::Uint;
|
use uint::Uint;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -39,7 +39,7 @@ pub struct Call {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use serde_json;
|
use serde_json;
|
||||||
use vm::Call;
|
use vm::Call;
|
||||||
use util::{U256, H160 as Hash160};
|
use bigint::prelude::{U256, H160 as Hash160};
|
||||||
use uint::Uint;
|
use uint::Uint;
|
||||||
use hash::Address;
|
use hash::Address;
|
||||||
use maybe::MaybeEmpty;
|
use maybe::MaybeEmpty;
|
||||||
|
@ -227,12 +227,9 @@ const TRANSACTION_COUNT_SPEC: &'static [u8] = br#"{
|
|||||||
"engine": {
|
"engine": {
|
||||||
"Ethash": {
|
"Ethash": {
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"minimumDifficulty": "0x020000",
|
"minimumDifficulty": "0x020000",
|
||||||
"difficultyBoundDivisor": "0x0800",
|
"difficultyBoundDivisor": "0x0800",
|
||||||
"durationLimit": "0x0d",
|
"durationLimit": "0x0d",
|
||||||
"blockReward": "0x4563918244F40000",
|
|
||||||
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
|
||||||
"homesteadTransition": "0xffffffffffffffff",
|
"homesteadTransition": "0xffffffffffffffff",
|
||||||
"daoHardforkTransition": "0xffffffffffffffff",
|
"daoHardforkTransition": "0xffffffffffffffff",
|
||||||
"daoHardforkBeneficiary": "0x0000000000000000000000000000000000000000",
|
"daoHardforkBeneficiary": "0x0000000000000000000000000000000000000000",
|
||||||
@ -241,6 +238,9 @@ const TRANSACTION_COUNT_SPEC: &'static [u8] = br#"{
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
|
"blockReward": "0x4563918244F40000",
|
||||||
|
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
||||||
"accountStartNonce": "0x00",
|
"accountStartNonce": "0x00",
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"minGasLimit": "0x50000",
|
"minGasLimit": "0x50000",
|
||||||
@ -275,12 +275,9 @@ const POSITIVE_NONCE_SPEC: &'static [u8] = br#"{
|
|||||||
"engine": {
|
"engine": {
|
||||||
"Ethash": {
|
"Ethash": {
|
||||||
"params": {
|
"params": {
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"minimumDifficulty": "0x020000",
|
"minimumDifficulty": "0x020000",
|
||||||
"difficultyBoundDivisor": "0x0800",
|
"difficultyBoundDivisor": "0x0800",
|
||||||
"durationLimit": "0x0d",
|
"durationLimit": "0x0d",
|
||||||
"blockReward": "0x4563918244F40000",
|
|
||||||
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
|
||||||
"homesteadTransition": "0xffffffffffffffff",
|
"homesteadTransition": "0xffffffffffffffff",
|
||||||
"daoHardforkTransition": "0xffffffffffffffff",
|
"daoHardforkTransition": "0xffffffffffffffff",
|
||||||
"daoHardforkBeneficiary": "0x0000000000000000000000000000000000000000",
|
"daoHardforkBeneficiary": "0x0000000000000000000000000000000000000000",
|
||||||
@ -289,6 +286,9 @@ const POSITIVE_NONCE_SPEC: &'static [u8] = br#"{
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
|
"blockReward": "0x4563918244F40000",
|
||||||
|
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
||||||
"accountStartNonce": "0x0100",
|
"accountStartNonce": "0x0100",
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"minGasLimit": "0x50000",
|
"minGasLimit": "0x50000",
|
||||||
|
Loading…
Reference in New Issue
Block a user