Bläddra i källkod

tests, core: update tests and make STATICCALL cause touch-delete (#18187)

Martin Holst Swende 7 år sedan
förälder
incheckning
7c657fc789
3 ändrade filer med 16 tillägg och 1 borttagningar
  1. 6 0
      core/vm/evm.go
  2. 9 0
      tests/init.go
  3. 1 1
      tests/testdata

+ 6 - 0
core/vm/evm.go

@@ -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.

+ 9 - 0
tests/init.go

@@ -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.

+ 1 - 1
tests/testdata

@@ -1 +1 @@
-Subproject commit 95a309203890e6244c6d4353ca411671973c13b5
+Subproject commit c02a2a17c0288a255572b37dc7ec1fcb838b9dbf