Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

EIP150.1c #2591

Merged
merged 34 commits into from
Oct 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
0bda8ef
Merge remote-tracking branch 'origin/master' into gas-fix-hf
gavofyork Oct 8, 2016
e2a94c1
EIP150.1b first part.
gavofyork Oct 9, 2016
6364a47
Add documentation.
gavofyork Oct 9, 2016
f612828
Tweak comment
gavofyork Oct 9, 2016
a761739
Fix some tests.
gavofyork Oct 10, 2016
bfc3a88
Fix create
gavofyork Oct 11, 2016
3023c9c
Add the new EIP150 test. (#2563)
Oct 11, 2016
8c1d187
Fix create some more.
gavofyork Oct 11, 2016
b45db21
Merge branch 'gas-fix-hf' of github.com:ethcore/parity into gas-fix-hf
gavofyork Oct 11, 2016
d6b8e53
Another fix for create.
gavofyork Oct 11, 2016
fa3c730
Final fixes.
gavofyork Oct 11, 2016
31269ec
Enable EIP150 test.
gavofyork Oct 11, 2016
e516b4a
Revert the costly suicides to respect EIP150.1b.
gavofyork Oct 11, 2016
68fdf5e
Fixups for EIP150.1c
gavofyork Oct 12, 2016
5571757
Merge remote-tracking branch 'origin/master' into eip150.1c
gavofyork Oct 12, 2016
7569654
Update tests.
gavofyork Oct 12, 2016
2d9484f
Updating tests
Oct 13, 2016
2cdaa31
Adding state tests
Oct 13, 2016
d178b41
Updating tests
Oct 14, 2016
958cc89
Updating HF block
Oct 14, 2016
802296b
Merge branch 'master' into eip150.1c
Oct 14, 2016
2364148
Removing flushln [ci:skip]
Oct 14, 2016
b59a3cb
Commenting out suicide test
Oct 14, 2016
29ff391
New tests.
gavofyork Oct 14, 2016
56b1006
Merge branch 'eip150.1c' of github.com:ethcore/parity into eip150.1c
gavofyork Oct 14, 2016
7d2dc37
Switch to EIP tests.
gavofyork Oct 14, 2016
28c6011
Rename some stuff, combine transition tests.
gavofyork Oct 14, 2016
0c6a7f6
Fix U256 overflows.
gavofyork Oct 14, 2016
02ad1a0
Name cleanups and an effort to fix tests.
gavofyork Oct 14, 2016
c678865
Rename back for clarity.
gavofyork Oct 14, 2016
18a9d7a
Fix non-EIP-150 OOG CALLs
gavofyork Oct 14, 2016
3c86b91
New transition block number & additional EIP150 tests
arkpar Oct 15, 2016
45fc895
Morden transition block set; Tests updated
arkpar Oct 15, 2016
79be0ad
Added missing test
arkpar Oct 15, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ethcore/res/ethereum/classic.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"durationLimit": "0x0d",
"blockReward": "0x4563918244F40000",
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
"frontierCompatibilityModeLimit": "0x118c30"
"homesteadTransition": "0x118c30",
"eip150Transition": "0x7fffffffffffffff"
}
}
},
Expand Down
43 changes: 43 additions & 0 deletions ethcore/res/ethereum/eip150_test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"name": "Homestead (Test)",
"engine": {
"Ethash": {
"params": {
"gasLimitBoundDivisor": "0x0400",
"minimumDifficulty": "0x020000",
"difficultyBoundDivisor": "0x0800",
"durationLimit": "0x0d",
"blockReward": "0x4563918244F40000",
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
"homesteadTransition": "0x0",
"eip150Transition": "0x0"
}
}
},
"params": {
"accountStartNonce": "0x00",
"maximumExtraDataSize": "0x20",
"minGasLimit": "0x1388",
"networkID" : "0x1"
},
"genesis": {
"seal": {
"ethereum": {
"nonce": "0x0000000000000042",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
},
"difficulty": "0x400000000",
"author": "0x0000000000000000000000000000000000000000",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",
"gasLimit": "0x1388"
},
"accounts": {
"0000000000000000000000000000000000000001": { "balance": "1", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
"0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
"0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
"0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } }
}
}
5 changes: 3 additions & 2 deletions ethcore/res/ethereum/expanse.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
"durationLimit": "0x3C",
"blockReward": "0x6f05b59d3b200000",
"registrar" : "0x6c221ca53705f3497ec90ca7b84c59ae7382fc21",
"frontierCompatibilityModeLimit": "0x30d40",
"homesteadTransition": "0x30d40",
"difficultyHardforkTransition": "0x59d9",
"difficultyHardforkBoundDivisor": "0x0200",
"bombDefuseTransition": "0x30d40"
"bombDefuseTransition": "0x30d40",
"eip150Transition": "0x7fffffffffffffff"
}
}
},
Expand Down
7 changes: 4 additions & 3 deletions ethcore/res/ethereum/frontier.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"durationLimit": "0x0d",
"blockReward": "0x4563918244F40000",
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
"frontierCompatibilityModeLimit": "0x118c30",
"homesteadTransition": "0x118c30",
"daoHardforkTransition": "0x1d4c00",
"daoHardforkBeneficiary": "0xbf4ed7b27f1d666546e30d74d50d173d20bca754",
"daoHardforkAccounts": [
"daoHardforkAccounts": [
"0xd4fe7bc31cedb7bfb8a345f31e668033056b2728",
"0xb3fb0e5aba0e20e5c49d252dfd30e102b171a425",
"0x2c19c7f9ae8b751e37aeb2d93a699722395ae18f",
Expand Down Expand Up @@ -129,7 +129,8 @@
"0x7602b46df5390e432ef1c307d4f2c9ff6d65cc97",
"0xbb9bc244d798123fde783fcc1c72d3bb8c189413",
"0x807640a13483f8ac783c557fcdf27be11ea4ac7a"
]
],
"eip150Transition": "0x259518"
}
}
},
Expand Down
5 changes: 3 additions & 2 deletions ethcore/res/ethereum/frontier_like_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"durationLimit": "0x0d",
"blockReward": "0x4563918244F40000",
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
"frontierCompatibilityModeLimit": "0x118c30",
"homesteadTransition": "0x118c30",
"daoHardforkTransition": "0x1d4c00",
"daoHardforkBeneficiary": "0xbf4ed7b27f1d666546e30d74d50d173d20bca754",
"daoHardforkAccounts": [
Expand Down Expand Up @@ -129,7 +129,8 @@
"0x7602b46df5390e432ef1c307d4f2c9ff6d65cc97",
"0xbb9bc244d798123fde783fcc1c72d3bb8c189413",
"0x807640a13483f8ac783c557fcdf27be11ea4ac7a"
]
],
"eip150Transition": "0x7fffffffffffffff"
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion ethcore/res/ethereum/frontier_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"durationLimit": "0x0d",
"blockReward": "0x4563918244F40000",
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
"frontierCompatibilityModeLimit": "0xffffffffffffffff"
"homesteadTransition": "0x7fffffffffffffff",
"eip150Transition": "0x7fffffffffffffff"
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion ethcore/res/ethereum/homestead_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"durationLimit": "0x0d",
"blockReward": "0x4563918244F40000",
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
"frontierCompatibilityModeLimit": "0x0"
"homesteadTransition": "0x0",
"eip150Transition": "0x7fffffffffffffff"
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion ethcore/res/ethereum/morden.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"durationLimit": "0x0d",
"blockReward": "0x4563918244F40000",
"registrar": "0x52dff57a8a1532e6afb3dc07e2af58bb9eb05b3d",
"frontierCompatibilityModeLimit": "0x789b0"
"homesteadTransition": "0x789b0",
"eip150Transition": "0x1b34d8"
}
}
},
Expand Down
4 changes: 3 additions & 1 deletion ethcore/res/ethereum/olympic.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"difficultyBoundDivisor": "0x0800",
"durationLimit": "0x08",
"blockReward": "0x14D1120D7B160000",
"registrar": "5e70c0bbcd5636e0f9f9316e9f8633feb64d4050"
"registrar": "5e70c0bbcd5636e0f9f9316e9f8633feb64d4050",
"homesteadTransition": "0x7fffffffffffffff",
"eip150Transition": "0x7fffffffffffffff"
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion ethcore/res/ethereum/tests
Submodule tests updated 43 files
+424 −0 BlockchainTests/EIP150/bcBlockGasLimitTest.json
+11,690 −0 BlockchainTests/EIP150/bcForkStressTest.json
+1,117 −0 BlockchainTests/EIP150/bcGasPricerTest.json
+1,241 −0 BlockchainTests/EIP150/bcInvalidHeaderTest.json
+6,076 −0 BlockchainTests/EIP150/bcInvalidRLPTest.json
+3,528 −0 BlockchainTests/EIP150/bcMultiChainTest.json
+980 −0 BlockchainTests/EIP150/bcRPC_API_Test.json
+1,145 −0 BlockchainTests/EIP150/bcStateTest.json
+5,468 −0 BlockchainTests/EIP150/bcTotalDifficultyTest.json
+2,771 −0 BlockchainTests/EIP150/bcUncleHeaderValiditiy.json
+4,514 −0 BlockchainTests/EIP150/bcUncleTest.json
+1,902 −0 BlockchainTests/EIP150/bcValidBlockTest.json
+10,915 −0 BlockchainTests/EIP150/bcWalletTest.json
+56,604 −548 BlockchainTests/Homestead/bcSuicideIssue.json
+2,577 −0 BlockchainTests/TestNetwork/bcEIP150Test.json
+3,310 −0 StateTests/EIP150/Homestead/stBoundsTest.json
+7,159 −0 StateTests/EIP150/Homestead/stCallCodes.json
+2,649 −0 StateTests/EIP150/Homestead/stCallCreateCallCodeTest.json
+5,861 −0 StateTests/EIP150/Homestead/stCallDelegateCodes.json
+5,842 −0 StateTests/EIP150/Homestead/stCallDelegateCodesCallCode.json
+2,561 −0 StateTests/EIP150/Homestead/stDelegatecallTest.json
+320 −0 StateTests/EIP150/Homestead/stHomeSteadSpecific.json
+1,093 −0 StateTests/EIP150/Homestead/stInitCodeTest.json
+3,855 −0 StateTests/EIP150/Homestead/stLogTests.json
+4,091 −0 StateTests/EIP150/Homestead/stMemoryTest.json
+5,928 −0 StateTests/EIP150/Homestead/stPreCompiledContracts.json
+8,066 −0 StateTests/EIP150/Homestead/stQuadraticComplexityTest.json
+3,100 −0 StateTests/EIP150/Homestead/stRecursiveCreate.json
+1,307 −0 StateTests/EIP150/Homestead/stRefundTest.json
+541 −0 StateTests/EIP150/Homestead/stSpecialTest.json
+8,694 −0 StateTests/EIP150/Homestead/stSystemOperationsTest.json
+2,618 −0 StateTests/EIP150/Homestead/stTransactionTest.json
+3,319 −0 StateTests/EIP150/Homestead/stWalletTest.json
+2,974 −0 StateTests/EIP150/stChangedTests.json
+842 −0 StateTests/EIP150/stEIPSpecificTest.json
+2,228 −0 StateTests/EIP150/stEIPsingleCodeGasPrices.json
+695 −0 StateTests/EIP150/stMemExpandingEIPCalls.json
+5 −5 StateTests/Homestead/stSystemOperationsTest.json
+70 −0 StateTests/Homestead/stTransactionTest.json
+1 −1 StateTests/stSystemOperationsTest.json
+0 −0 ansible/ec2.py
+0 −0 ansible/test-files/create-docker-images.sh
+0 −0 ansible/test-files/testrunner.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "DAO hard-fork consensus test",
"name": "EIP150.1b hard-fork consensus test",
"engine": {
"Ethash": {
"params": {
Expand All @@ -9,7 +9,7 @@
"durationLimit": "0x0d",
"blockReward": "0x4563918244F40000",
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
"frontierCompatibilityModeLimit": "0x5",
"homesteadTransition": "0x5",
"daoHardforkTransition": "0x8",
"daoHardforkBeneficiary": "0xbf4ed7b27f1d666546e30d74d50d173d20bca754",
"daoHardforkAccounts": [
Expand Down Expand Up @@ -129,7 +129,8 @@
"0x7602b46df5390e432ef1c307d4f2c9ff6d65cc97",
"0xbb9bc244d798123fde783fcc1c72d3bb8c189413",
"0x807640a13483f8ac783c557fcdf27be11ea4ac7a"
]
],
"eip150Transition": "0xa"
}
}
},
Expand Down
5 changes: 4 additions & 1 deletion ethcore/src/blockchain/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,10 @@ impl BlockProvider for BlockChain {
.filter_map(|(number, hash)| self.block_receipts(&hash).map(|r| (number, hash, r.receipts)))
.filter_map(|(number, hash, receipts)| self.block_body(&hash).map(|ref b| (number, hash, receipts, BodyView::new(b).transaction_hashes())))
.flat_map(|(number, hash, mut receipts, mut hashes)| {
assert_eq!(receipts.len(), hashes.len());
if receipts.len() != hashes.len() {
warn!("Block {} ({}) has different number of receipts ({}) to transactions ({}). Database corrupt?", number, hash, receipts.len(), hashes.len());
assert!(false);
}
log_index = receipts.iter().fold(0, |sum, receipt| sum + receipt.logs.len());

let receipts_len = receipts.len();
Expand Down
19 changes: 12 additions & 7 deletions ethcore/src/ethereum/ethash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub struct EthashParams {
/// Namereg contract address.
pub registrar: Address,
/// Homestead transition block number.
pub frontier_compatibility_mode_limit: u64,
pub homestead_transition: u64,
/// DAO hard-fork transition block (X).
pub dao_hardfork_transition: u64,
/// DAO hard-fork refund contract address (C).
Expand All @@ -54,6 +54,8 @@ pub struct EthashParams {
pub difficulty_hardfork_bound_divisor: U256,
/// Block on which there is no additional difficulty from the exponential bomb.
pub bomb_defuse_transition: u64,
/// Bad gas transition block number.
pub eip150_transition: u64,
}

impl From<ethjson::spec::EthashParams> for EthashParams {
Expand All @@ -66,13 +68,14 @@ impl From<ethjson::spec::EthashParams> for EthashParams {
duration_limit: p.duration_limit.into(),
block_reward: p.block_reward.into(),
registrar: p.registrar.map_or_else(Address::new, Into::into),
frontier_compatibility_mode_limit: p.frontier_compatibility_mode_limit.map_or(0, Into::into),
homestead_transition: p.homestead_transition.map_or(0, Into::into),
dao_hardfork_transition: p.dao_hardfork_transition.map_or(0x7fffffffffffffff, Into::into),
dao_hardfork_beneficiary: p.dao_hardfork_beneficiary.map_or_else(Address::new, Into::into),
dao_hardfork_accounts: p.dao_hardfork_accounts.unwrap_or_else(Vec::new).into_iter().map(Into::into).collect(),
difficulty_hardfork_transition: p.difficulty_hardfork_transition.map_or(0x7fffffffffffffff, Into::into),
difficulty_hardfork_bound_divisor: p.difficulty_hardfork_bound_divisor.map_or(p.difficulty_bound_divisor.into(), Into::into),
bomb_defuse_transition: p.bomb_defuse_transition.map_or(0x7fffffffffffffff, Into::into),
eip150_transition: p.eip150_transition.map_or(0, Into::into),
}
}
}
Expand Down Expand Up @@ -117,12 +120,14 @@ impl Engine for Ethash {
}

fn schedule(&self, env_info: &EnvInfo) -> Schedule {
trace!(target: "client", "Creating schedule. fCML={}", self.ethash_params.frontier_compatibility_mode_limit);
trace!(target: "client", "Creating schedule. fCML={}, bGCML={}", self.ethash_params.homestead_transition, self.ethash_params.eip150_transition);

if env_info.number < self.ethash_params.frontier_compatibility_mode_limit {
if env_info.number < self.ethash_params.homestead_transition {
Schedule::new_frontier()
} else {
} else if env_info.number < self.ethash_params.eip150_transition {
Schedule::new_homestead()
} else {
Schedule::new_homestead_gas_fix()
}
}

Expand Down Expand Up @@ -264,7 +269,7 @@ impl Engine for Ethash {
}

fn verify_transaction_basic(&self, t: &SignedTransaction, header: &Header) -> result::Result<(), Error> {
if header.number() >= self.ethash_params.frontier_compatibility_mode_limit {
if header.number() >= self.ethash_params.homestead_transition {
try!(t.check_low_s());
}
Ok(())
Expand All @@ -290,7 +295,7 @@ impl Ethash {
false => self.ethash_params.difficulty_bound_divisor,
};
let duration_limit = self.ethash_params.duration_limit;
let frontier_limit = self.ethash_params.frontier_compatibility_mode_limit;
let frontier_limit = self.ethash_params.homestead_transition;

let mut target = if header.number() < frontier_limit {
if header.timestamp() >= parent.timestamp() + duration_limit {
Expand Down
5 changes: 4 additions & 1 deletion ethcore/src/ethereum/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ pub fn new_frontier_test() -> Spec { load(include_bytes!("../../res/ethereum/fro
/// Create a new Homestead chain spec as though it never changed from Frontier.
pub fn new_homestead_test() -> Spec { load(include_bytes!("../../res/ethereum/homestead_test.json")) }

/// Create a new Homestead-EIP150 chain spec as though it never changed from Homestead/Frontier.
pub fn new_eip150_test() -> Spec { load(include_bytes!("../../res/ethereum/eip150_test.json")) }

/// Create a new Frontier/Homestead/DAO chain spec with transition points at #5 and #8.
pub fn new_daohardfork_test() -> Spec { load(include_bytes!("../../res/ethereum/daohardfork_test.json")) }
pub fn new_transition_test() -> Spec { load(include_bytes!("../../res/ethereum/transition_test.json")) }

/// Create a new Frontier main net chain spec without genesis accounts.
pub fn new_mainnet_like() -> Spec { load(include_bytes!("../../res/ethereum/frontier_like_test.json")) }
Expand Down
Loading