mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
tests: added new EIP158 tests
This commit is contained in:
parent
22797f1521
commit
dcf4da598f
6 changed files with 4801 additions and 2 deletions
1281
tests/files/StateTests/EIP158/stCreateTest.json
Normal file
1281
tests/files/StateTests/EIP158/stCreateTest.json
Normal file
File diff suppressed because it is too large
Load diff
219
tests/files/StateTests/EIP158/stEIP158SpecificTest.json
Normal file
219
tests/files/StateTests/EIP158/stEIP158SpecificTest.json
Normal file
|
|
@ -0,0 +1,219 @@
|
|||
{
|
||||
"CALL_OneVCallSuicide" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "0x02b8feb0",
|
||||
"currentGasLimit" : "0x989680",
|
||||
"currentNumber" : "0x3567e0",
|
||||
"currentTimestamp" : "0x01",
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"logs" : [
|
||||
],
|
||||
"out" : "0x",
|
||||
"post" : {
|
||||
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
|
||||
"balance" : "0xc11c",
|
||||
"code" : "0x",
|
||||
"nonce" : "0x00",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xe8d4a44ee4",
|
||||
"code" : "0x",
|
||||
"nonce" : "0x01",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"b94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0x64",
|
||||
"code" : "0x5a6000556000600060006000600173c94f5374fce5edbc8e2a8697c15331677e6ebf0b61ea60f1505a606455",
|
||||
"nonce" : "0x00",
|
||||
"storage" : {
|
||||
"0x00" : "0x08d5b6",
|
||||
"0x64" : "0x085707"
|
||||
}
|
||||
}
|
||||
},
|
||||
"postStateRoot" : "9d6a0f433324877903fd7824e33158c62752deed863a8d2fdf3a1df012ba0f72",
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xe8d4a51000",
|
||||
"code" : "0x",
|
||||
"nonce" : "0x00",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"b94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0x64",
|
||||
"code" : "0x5a6000556000600060006000600173c94f5374fce5edbc8e2a8697c15331677e6ebf0b61ea60f1505a606455",
|
||||
"nonce" : "0x00",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"c94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0x00",
|
||||
"code" : "0x73b94f5374fce5edbc8e2a8697c15331677e6ebf0bff",
|
||||
"nonce" : "0x00",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"data" : "",
|
||||
"gasLimit" : "0x0927c0",
|
||||
"gasPrice" : "0x01",
|
||||
"nonce" : "0x00",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "0x00"
|
||||
}
|
||||
},
|
||||
"CALL_ZeroVCallSuicide" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "0x02b8feb0",
|
||||
"currentGasLimit" : "0x989680",
|
||||
"currentNumber" : "0x3567e0",
|
||||
"currentTimestamp" : "0x01",
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"logs" : [
|
||||
],
|
||||
"out" : "0x",
|
||||
"post" : {
|
||||
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
|
||||
"balance" : "0xa6f0",
|
||||
"code" : "0x",
|
||||
"nonce" : "0x00",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xe8d4a46910",
|
||||
"code" : "0x",
|
||||
"nonce" : "0x01",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"b94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0x00",
|
||||
"code" : "0x5a6000556000600060006000600073c94f5374fce5edbc8e2a8697c15331677e6ebf0b61ea60f1505a606455",
|
||||
"nonce" : "0x00",
|
||||
"storage" : {
|
||||
"0x00" : "0x08d5b6",
|
||||
"0x64" : "0x087133"
|
||||
}
|
||||
}
|
||||
},
|
||||
"postStateRoot" : "e76553703206c2cc61d5ed4e89229b1ef08f4a2769fa7a9851eaacdc60cd1b14",
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xe8d4a51000",
|
||||
"code" : "0x",
|
||||
"nonce" : "0x00",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"b94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0x00",
|
||||
"code" : "0x5a6000556000600060006000600073c94f5374fce5edbc8e2a8697c15331677e6ebf0b61ea60f1505a606455",
|
||||
"nonce" : "0x00",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"c94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0x00",
|
||||
"code" : "0x73b94f5374fce5edbc8e2a8697c15331677e6ebf0bff",
|
||||
"nonce" : "0x00",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"data" : "",
|
||||
"gasLimit" : "0x0927c0",
|
||||
"gasPrice" : "0x01",
|
||||
"nonce" : "0x00",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "0x00"
|
||||
}
|
||||
},
|
||||
"EXP_Empty" : {
|
||||
"env" : {
|
||||
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "0x02b8feb0",
|
||||
"currentGasLimit" : "0x989680",
|
||||
"currentNumber" : "0x3567e0",
|
||||
"currentTimestamp" : "0x01",
|
||||
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
|
||||
},
|
||||
"logs" : [
|
||||
],
|
||||
"out" : "0x",
|
||||
"post" : {
|
||||
"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
|
||||
"balance" : "0x049828",
|
||||
"code" : "0x",
|
||||
"nonce" : "0x00",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xe8d4a077d8",
|
||||
"code" : "0x",
|
||||
"nonce" : "0x01",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"b94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0x00",
|
||||
"code" : "0x5a60009081556001555a60025560016003555a60045560006005555a60065560006007555a60085560006009555a600a556001600b555a600c556001600d555a600e556001600f555a606455",
|
||||
"nonce" : "0x00",
|
||||
"storage" : {
|
||||
"0x00" : "0x08d5b6",
|
||||
"0x02" : "0x087400",
|
||||
"0x03" : "0x01",
|
||||
"0x04" : "0x07d7b5",
|
||||
"0x06" : "0x077602",
|
||||
"0x08" : "0x07144f",
|
||||
"0x0a" : "0x06b29c",
|
||||
"0x0b" : "0x01",
|
||||
"0x0c" : "0x061651",
|
||||
"0x0d" : "0x01",
|
||||
"0x0e" : "0x057a06",
|
||||
"0x0f" : "0x01",
|
||||
"0x64" : "0x04ddbb"
|
||||
}
|
||||
}
|
||||
},
|
||||
"postStateRoot" : "1dea95f333439502364264b26efad62f0487c099c77dc5ea8858418c173f0e38",
|
||||
"pre" : {
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0xe8d4a51000",
|
||||
"code" : "0x",
|
||||
"nonce" : "0x00",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"b94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0x00",
|
||||
"code" : "0x5a60009081556001555a60025560016003555a60045560006005555a60065560006007555a60085560006009555a600a556001600b555a600c556001600d555a600e556001600f555a606455",
|
||||
"nonce" : "0x00",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
},
|
||||
"transaction" : {
|
||||
"data" : "",
|
||||
"gasLimit" : "0x0927c0",
|
||||
"gasPrice" : "0x01",
|
||||
"nonce" : "0x00",
|
||||
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
|
||||
"to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"value" : "0x00"
|
||||
}
|
||||
}
|
||||
}
|
||||
1677
tests/files/StateTests/EIP158/stNonZeroCallsTest.json
Normal file
1677
tests/files/StateTests/EIP158/stNonZeroCallsTest.json
Normal file
File diff suppressed because it is too large
Load diff
1591
tests/files/StateTests/EIP158/stZeroCallsTest.json
Normal file
1591
tests/files/StateTests/EIP158/stZeroCallsTest.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -704,3 +704,29 @@ func TestEIP158Specific(t *testing.T) {
|
|||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEIP158NonZeroCalls(t *testing.T) {
|
||||
chainConfig := ¶ms.ChainConfig{
|
||||
HomesteadBlock: new(big.Int),
|
||||
EIP150Block: big.NewInt(2457000),
|
||||
EIP158Block: big.NewInt(3500000),
|
||||
}
|
||||
|
||||
fn := filepath.Join(stateTestDir, "EIP158", "stNonZeroCallsTest.json")
|
||||
if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEIP158ZeroCalls(t *testing.T) {
|
||||
chainConfig := ¶ms.ChainConfig{
|
||||
HomesteadBlock: new(big.Int),
|
||||
EIP150Block: big.NewInt(2457000),
|
||||
EIP158Block: big.NewInt(3500000),
|
||||
}
|
||||
|
||||
fn := filepath.Join(stateTestDir, "EIP158", "stZeroCallsTest.json")
|
||||
if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ func runStateTests(chainConfig *params.ChainConfig, tests map[string]VmTest, ski
|
|||
}
|
||||
|
||||
for name, test := range tests {
|
||||
if skipTest[name] /*|| name != "callcodecallcode_11" */ {
|
||||
if skipTest[name] /*|| name != "NonZeroValue_CALL_ToEmpty"*/ {
|
||||
glog.Infoln("Skipping state test", name)
|
||||
continue
|
||||
}
|
||||
|
|
@ -221,7 +221,6 @@ func RunState(chainConfig *params.ChainConfig, statedb *state.StateDB, env, tx m
|
|||
}
|
||||
// Set pre compiled contracts
|
||||
vm.Precompiled = vm.PrecompiledContracts()
|
||||
snapshot := statedb.Snapshot()
|
||||
gaspool := new(core.GasPool).AddGas(common.Big(env["currentGasLimit"]))
|
||||
|
||||
key, _ := hex.DecodeString(tx["secretKey"])
|
||||
|
|
@ -229,6 +228,12 @@ func RunState(chainConfig *params.ChainConfig, statedb *state.StateDB, env, tx m
|
|||
message := NewMessage(addr, to, data, value, gas, price, nonce)
|
||||
vmenv := NewEnvFromMap(chainConfig, statedb, env, tx)
|
||||
vmenv.origin = addr
|
||||
|
||||
root, _ := statedb.Commit(false)
|
||||
statedb.Reset(root)
|
||||
|
||||
snapshot := statedb.Snapshot()
|
||||
|
||||
ret, _, err := core.ApplyMessage(vmenv, message, gaspool)
|
||||
if core.IsNonceErr(err) || core.IsInvalidTxErr(err) || core.IsGasLimitErr(err) {
|
||||
statedb.RevertToSnapshot(snapshot)
|
||||
|
|
|
|||
Loading…
Reference in a new issue