mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +00:00
tests: update to https://github.com/ethereum/tests/pull/582
This commit is contained in:
parent
02af5aaa87
commit
d39b937427
4 changed files with 33 additions and 10 deletions
|
|
@ -34,7 +34,11 @@ type JSONLogger struct {
|
|||
// NewJSONLogger creates a new EVM tracer that prints execution steps as JSON objects
|
||||
// into the provided stream.
|
||||
func NewJSONLogger(cfg *LogConfig, writer io.Writer) *JSONLogger {
|
||||
return &JSONLogger{json.NewEncoder(writer), cfg}
|
||||
l := &JSONLogger{json.NewEncoder(writer), cfg}
|
||||
if l.cfg == nil {
|
||||
l.cfg = &LogConfig{}
|
||||
}
|
||||
return l
|
||||
}
|
||||
|
||||
func (l *JSONLogger) CaptureStart(from common.Address, to common.Address, create bool, input []byte, gas uint64, value *big.Int) error {
|
||||
|
|
|
|||
|
|
@ -62,6 +62,20 @@ var Forks = map[string]*params.ChainConfig{
|
|||
DAOForkBlock: big.NewInt(0),
|
||||
ByzantiumBlock: big.NewInt(0),
|
||||
ConstantinopleBlock: big.NewInt(0),
|
||||
PetersburgBlock: big.NewInt(10000000),
|
||||
|
||||
},
|
||||
"ConstantinopleFix": {
|
||||
ChainID: big.NewInt(1),
|
||||
HomesteadBlock: big.NewInt(0),
|
||||
EIP150Block: big.NewInt(0),
|
||||
EIP155Block: big.NewInt(0),
|
||||
EIP158Block: big.NewInt(0),
|
||||
DAOForkBlock: big.NewInt(0),
|
||||
ByzantiumBlock: big.NewInt(0),
|
||||
ConstantinopleBlock: big.NewInt(0),
|
||||
PetersburgBlock: big.NewInt(0),
|
||||
|
||||
},
|
||||
"FrontierToHomesteadAt5": {
|
||||
ChainID: big.NewInt(1),
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package tests
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"flag"
|
||||
"fmt"
|
||||
|
|
@ -45,9 +46,12 @@ func TestState(t *testing.T) {
|
|||
st.skipLoad(`^stTransactionTest/OverflowGasRequire\.json`) // gasLimit > 256 bits
|
||||
st.skipLoad(`^stTransactionTest/zeroSigTransa[^/]*\.json`) // EIP-86 is not supported yet
|
||||
// Expected failures:
|
||||
st.fails(`^stRevertTest/RevertPrecompiledTouch\.json/EIP158`, "bug in test")
|
||||
st.fails(`^stRevertTest/RevertPrecompiledTouch\.json/Byzantium`, "bug in test")
|
||||
st.fails(`^stRevertTest/RevertPrecompiledTouch.json/Constantinople`, "bug in test")
|
||||
st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/Byzantium/0`, "bug in test")
|
||||
st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/Byzantium/3`, "bug in test")
|
||||
st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/Constantinople/0`, "bug in test")
|
||||
st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/Constantinople/3`, "bug in test")
|
||||
st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/ConstantinopleFix/0`, "bug in test")
|
||||
st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/ConstantinopleFix/3`, "bug in test")
|
||||
|
||||
st.walk(t, stateTestDir, func(t *testing.T, name string, test *StateTest) {
|
||||
for _, subtest := range test.Subtests() {
|
||||
|
|
@ -86,18 +90,19 @@ func withTrace(t *testing.T, gasLimit uint64, test func(vm.Config) error) {
|
|||
t.Log("gas limit too high for EVM trace")
|
||||
return
|
||||
}
|
||||
tracer := vm.NewStructLogger(nil)
|
||||
buf := new(bytes.Buffer)
|
||||
w := bufio.NewWriter(buf)
|
||||
tracer := vm.NewJSONLogger(&vm.LogConfig{DisableMemory: true}, w)
|
||||
err2 := test(vm.Config{Debug: true, Tracer: tracer})
|
||||
if !reflect.DeepEqual(err, err2) {
|
||||
t.Errorf("different error for second run: %v", err2)
|
||||
}
|
||||
buf := new(bytes.Buffer)
|
||||
vm.WriteTrace(buf, tracer.StructLogs())
|
||||
w.Flush()
|
||||
if buf.Len() == 0 {
|
||||
t.Log("no EVM operation logs generated")
|
||||
} else {
|
||||
t.Log("EVM operation log:\n" + buf.String())
|
||||
}
|
||||
t.Logf("EVM output: 0x%x", tracer.Output())
|
||||
t.Logf("EVM error: %v", tracer.Error())
|
||||
//t.Logf("EVM output: 0x%x", tracer.Output())
|
||||
//t.Logf("EVM error: %v", tracer.Error())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit c02a2a17c0288a255572b37dc7ec1fcb838b9dbf
|
||||
Subproject commit 6b85703b568f4456582a00665d8a3e5c3b20b484
|
||||
Loading…
Reference in a new issue