Skip to content

Commit 1c2378b

Browse files
authored
tests: update to upstream commit 2bb0c3da3b (#15806)
Also raise traceLimit once again and print the VM error and output on failure.
1 parent ae71da1 commit 1c2378b

3 files changed

Lines changed: 18 additions & 17 deletions

File tree

‎core/vm/logger.go‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ type StructLogger struct {
100100

101101
logs []StructLog
102102
changedValues map[common.Address]Storage
103+
output []byte
104+
err error
103105
}
104106

105107
// NewStructLogger returns a new logger
@@ -172,17 +174,19 @@ func (l *StructLogger) CaptureFault(env *EVM, pc uint64, op OpCode, gas, cost ui
172174
}
173175

174176
func (l *StructLogger) CaptureEnd(output []byte, gasUsed uint64, t time.Duration, err error) error {
175-
fmt.Printf("0x%x", output)
176-
if err != nil {
177-
fmt.Printf(" error: %v\n", err)
178-
}
177+
l.output = output
178+
l.err = err
179179
return nil
180180
}
181181

182-
// StructLogs returns a list of captured log entries
183-
func (l *StructLogger) StructLogs() []StructLog {
184-
return l.logs
185-
}
182+
// StructLogs returns the captured log entries.
183+
func (l *StructLogger) StructLogs() []StructLog { return l.logs }
184+
185+
// Error returns the VM error captured by the trace.
186+
func (l *StructLogger) Error() error { return l.err }
187+
188+
// Output returns the VM return value captured by the trace.
189+
func (l *StructLogger) Output() []byte { return l.output }
186190

187191
// WriteTrace writes a formatted trace to the given writer
188192
func WriteTrace(writer io.Writer, logs []StructLog) {

‎tests/state_test.go‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,12 @@ func TestState(t *testing.T) {
3939
st.fails(`^stRevertTest/RevertPrefoundEmptyOOG\.json/EIP158`, "bug in test")
4040
st.fails(`^stRevertTest/RevertPrecompiledTouch\.json/Byzantium`, "bug in test")
4141
st.fails(`^stRevertTest/RevertPrefoundEmptyOOG\.json/Byzantium`, "bug in test")
42-
st.fails(`^stRandom/randomStatetest645\.json/EIP150/.*`, "known bug #15119")
43-
st.fails(`^stRandom/randomStatetest645\.json/Frontier/.*`, "known bug #15119")
44-
st.fails(`^stRandom/randomStatetest645\.json/Homestead/.*`, "known bug #15119")
45-
st.fails(`^stRandom/randomStatetest644\.json/EIP150/.*`, "known bug #15119")
46-
st.fails(`^stRandom/randomStatetest644\.json/Frontier/.*`, "known bug #15119")
47-
st.fails(`^stRandom/randomStatetest644\.json/Homestead/.*`, "known bug #15119")
42+
st.fails(`^stRandom2/randomStatetest64[45]\.json/(EIP150|Frontier|Homestead)/.*`, "known bug #15119")
4843
st.fails(`^stCreateTest/TransactionCollisionToEmpty\.json/EIP158/2`, "known bug ")
4944
st.fails(`^stCreateTest/TransactionCollisionToEmpty\.json/EIP158/3`, "known bug ")
5045
st.fails(`^stCreateTest/TransactionCollisionToEmpty\.json/Byzantium/2`, "known bug ")
5146
st.fails(`^stCreateTest/TransactionCollisionToEmpty\.json/Byzantium/3`, "known bug ")
47+
5248
st.walk(t, stateTestDir, func(t *testing.T, name string, test *StateTest) {
5349
for _, subtest := range test.Subtests() {
5450
subtest := subtest
@@ -68,8 +64,7 @@ func TestState(t *testing.T) {
6864
}
6965

7066
// Transactions with gasLimit above this value will not get a VM trace on failure.
71-
//const traceErrorLimit = 400000
72-
const traceErrorLimit = 0
67+
const traceErrorLimit = 400000
7368

7469
func withTrace(t *testing.T, gasLimit uint64, test func(vm.Config) error) {
7570
err := test(vm.Config{})
@@ -93,4 +88,6 @@ func withTrace(t *testing.T, gasLimit uint64, test func(vm.Config) error) {
9388
} else {
9489
t.Log("EVM operation log:\n" + buf.String())
9590
}
91+
t.Logf("EVM output: 0x%x", tracer.Output())
92+
t.Logf("EVM error: %v", tracer.Error())
9693
}

‎tests/testdata‎

Submodule testdata updated 15109 files

0 commit comments

Comments
 (0)