Skip to content

Commit

Permalink
tests, core: update tests and make STATICCALL cause touch-delete (eth…
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman authored and karalabe committed Nov 29, 2018
1 parent 3d21d45 commit 7c657fc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions core/vm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,12 @@ func (evm *EVM) StaticCall(caller ContractRef, addr common.Address, input []byte
contract := NewContract(caller, to, new(big.Int), gas)
contract.SetCallCode(&addr, evm.StateDB.GetCodeHash(addr), evm.StateDB.GetCode(addr))

// We do an AddBalance of zero here, just in order to trigger a touch.
// This doesn't matter on Mainnet, where all empties are gone at the time of Byzantium,
// but is the correct thing to do and matters on other networks, in tests, and potential
// future scenarios
evm.StateDB.AddBalance(addr, bigZero)

// When an error was returned by the EVM or when setting the creation code
// above we revert to the snapshot and consume any gas remaining. Additionally
// when we're in Homestead this also counts for code storage gas errors.
Expand Down
9 changes: 9 additions & 0 deletions tests/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ var Forks = map[string]*params.ChainConfig{
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(5),
},
"ByzantiumToConstantinopleAt5": {
ChainID: big.NewInt(1),
HomesteadBlock: big.NewInt(0),
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(5),
},
}

// UnsupportedForkError is returned when a test requests a fork that isn't implemented.
Expand Down
2 changes: 1 addition & 1 deletion tests/testdata
Submodule testdata updated 11491 files

0 comments on commit 7c657fc

Please sign in to comment.