aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/init.go12
-rw-r--r--tests/rlp_test_util.go15
-rw-r--r--tests/state_test.go21
m---------tests/testdata0
4 files changed, 39 insertions, 9 deletions
diff --git a/tests/init.go b/tests/init.go
index db0457b6d..188cdffe9 100644
--- a/tests/init.go
+++ b/tests/init.go
@@ -62,6 +62,18 @@ 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),
diff --git a/tests/rlp_test_util.go b/tests/rlp_test_util.go
index 58ef8a642..9069ec55a 100644
--- a/tests/rlp_test_util.go
+++ b/tests/rlp_test_util.go
@@ -42,9 +42,22 @@ type RLPTest struct {
Out string
}
+// FromHex returns the bytes represented by the hexadecimal string s.
+// s may be prefixed with "0x".
+// This is copy-pasted from bytes.go, which does not return the error
+func FromHex(s string) ([]byte, error) {
+ if len(s) > 1 && (s[0:2] == "0x" || s[0:2] == "0X") {
+ s = s[2:]
+ }
+ if len(s)%2 == 1 {
+ s = "0" + s
+ }
+ return hex.DecodeString(s)
+}
+
// Run executes the test.
func (t *RLPTest) Run() error {
- outb, err := hex.DecodeString(t.Out)
+ outb, err := FromHex(t.Out)
if err != nil {
return fmt.Errorf("invalid hex in Out")
}
diff --git a/tests/state_test.go b/tests/state_test.go
index 964405382..8b69da91f 100644
--- a/tests/state_test.go
+++ b/tests/state_test.go
@@ -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())
}
diff --git a/tests/testdata b/tests/testdata
-Subproject c02a2a17c0288a255572b37dc7ec1fcb838b9db
+Subproject 6b85703b568f4456582a00665d8a3e5c3b20b48