mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
core/vm,tests: Update tests, fix SAR, enable constantinople statetests
This commit is contained in:
parent
b69476b372
commit
733088380a
5 changed files with 15 additions and 9 deletions
|
|
@ -355,7 +355,7 @@ func opSAR(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memory *
|
|||
defer interpreter.intPool.put(shift) // First operand back into the pool
|
||||
|
||||
if shift.Cmp(common.Big256) >= 0 {
|
||||
if value.Sign() > 0 {
|
||||
if value.Sign() >= 0 {
|
||||
value.SetUint64(0)
|
||||
} else {
|
||||
value.SetInt64(-1)
|
||||
|
|
|
|||
|
|
@ -30,11 +30,11 @@ func TestBlockchain(t *testing.T) {
|
|||
bt.skipLoad(`^bcForgedTest/bcForkUncle\.json`)
|
||||
bt.skipLoad(`^bcMultiChainTest/(ChainAtoChainB_blockorder|CallContractFromNotBestBlock)`)
|
||||
bt.skipLoad(`^bcTotalDifficultyTest/(lotsOfLeafs|lotsOfBranches|sideChainWithMoreTransactions)`)
|
||||
// Constantinople is not implemented yet.
|
||||
bt.skipLoad(`(?i)(constantinople)`)
|
||||
// This test is broken
|
||||
bt.skipLoad(`blockhashNonConstArg_Constantinople`)
|
||||
|
||||
// Still failing tests
|
||||
bt.skipLoad(`^bcWalletTest.*_Byzantium$`)
|
||||
// bt.skipLoad(`^bcWalletTest.*_Byzantium$`)
|
||||
|
||||
bt.walk(t, blockTestDir, func(t *testing.T, name string, test *BlockTest) {
|
||||
if err := bt.checkFailure(t, name, test.Run()); err != nil {
|
||||
|
|
|
|||
|
|
@ -44,9 +44,6 @@ func TestState(t *testing.T) {
|
|||
key := fmt.Sprintf("%s/%d", subtest.Fork, subtest.Index)
|
||||
name := name + "/" + key
|
||||
t.Run(key, func(t *testing.T) {
|
||||
if subtest.Fork == "Constantinople" {
|
||||
t.Skip("constantinople not supported yet")
|
||||
}
|
||||
withTrace(t, test.gasLimit(subtest), func(vmconfig vm.Config) error {
|
||||
_, err := test.Run(subtest, vmconfig)
|
||||
return st.checkFailure(t, name, err)
|
||||
|
|
|
|||
|
|
@ -146,7 +146,16 @@ func (t *StateTest) Run(subtest StateSubtest, vmconfig vm.Config) (*state.StateD
|
|||
if logs := rlpHash(statedb.Logs()); logs != common.Hash(post.Logs) {
|
||||
return statedb, fmt.Errorf("post state logs hash mismatch: got %x, want %x", logs, post.Logs)
|
||||
}
|
||||
root, _ := statedb.Commit(config.IsEIP158(block.Number()))
|
||||
// Commit block
|
||||
statedb.Commit(config.IsEIP158(block.Number()))
|
||||
// Add 0-value mining reward. This only makes a difference in the cases
|
||||
// where
|
||||
// - the coinbase suicided, or
|
||||
// - there are only 'bad' transactions, which aren't executed. In those cases,
|
||||
// the coinbase gets no txfee, so isn't created, and thus needs to be touched
|
||||
statedb.AddBalance(block.Coinbase(), new(big.Int))
|
||||
// And _now_ get the state root
|
||||
root := statedb.IntermediateRoot(config.IsEIP158(block.Number()))
|
||||
if root != common.Hash(post.Root) {
|
||||
return statedb, fmt.Errorf("post state root mismatch: got %x, want %x", root, post.Root)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 2bb0c3da3bbb15c528bcef2a7e5ac4bd73f81f87
|
||||
Subproject commit ad2184adca367c0b68c65b44519dba16e1d0b9e2
|
||||
Loading…
Reference in a new issue