mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 01:13:45 +00:00
eth/tracers: use tracerTestEnv
Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
parent
ec07e09c22
commit
4394205c36
4 changed files with 18 additions and 18 deletions
|
|
@ -65,11 +65,8 @@ type callTrace struct {
|
||||||
|
|
||||||
// callTracerTest defines a single test to check the call tracer against.
|
// callTracerTest defines a single test to check the call tracer against.
|
||||||
type callTracerTest struct {
|
type callTracerTest struct {
|
||||||
Genesis *core.Genesis `json:"genesis"`
|
tracerTestEnv
|
||||||
Context *traceContext `json:"context"`
|
Result *callTrace `json:"result"`
|
||||||
Input string `json:"input"`
|
|
||||||
TracerConfig json.RawMessage `json:"tracerConfig"`
|
|
||||||
Result *callTrace `json:"result"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Iterates over all the input-output datasets in the tracer test harness and
|
// Iterates over all the input-output datasets in the tracer test harness and
|
||||||
|
|
|
||||||
|
|
@ -77,11 +77,8 @@ type flatCallTraceResult struct {
|
||||||
|
|
||||||
// flatCallTracerTest defines a single test to check the call tracer against.
|
// flatCallTracerTest defines a single test to check the call tracer against.
|
||||||
type flatCallTracerTest struct {
|
type flatCallTracerTest struct {
|
||||||
Genesis *core.Genesis `json:"genesis"`
|
tracerTestEnv
|
||||||
Context *traceContext `json:"context"`
|
Result []flatCallTrace `json:"result"`
|
||||||
Input string `json:"input"`
|
|
||||||
TracerConfig json.RawMessage `json:"tracerConfig"`
|
|
||||||
Result []flatCallTrace `json:"result"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func flatCallTracerTestRunner(tracerName string, filename string, dirPath string, t testing.TB) error {
|
func flatCallTracerTestRunner(tracerName string, filename string, dirPath string, t testing.TB) error {
|
||||||
|
|
|
||||||
|
|
@ -43,13 +43,10 @@ type account struct {
|
||||||
Storage map[common.Hash]common.Hash `json:"storage"`
|
Storage map[common.Hash]common.Hash `json:"storage"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// testcase defines a single test to check the stateDiff tracer against.
|
// prestateTracerTest defines a single test to check the stateDiff tracer against.
|
||||||
type testcase struct {
|
type prestateTracerTest struct {
|
||||||
Genesis *core.Genesis `json:"genesis"`
|
tracerTestEnv
|
||||||
Context *traceContext `json:"context"`
|
Result interface{} `json:"result"`
|
||||||
Input string `json:"input"`
|
|
||||||
TracerConfig json.RawMessage `json:"tracerConfig"`
|
|
||||||
Result interface{} `json:"result"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPrestateTracerLegacy(t *testing.T) {
|
func TestPrestateTracerLegacy(t *testing.T) {
|
||||||
|
|
@ -77,7 +74,7 @@ func testPrestateDiffTracer(tracerName string, dirPath string, t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
var (
|
var (
|
||||||
test = new(testcase)
|
test = new(prestateTracerTest)
|
||||||
tx = new(types.Transaction)
|
tx = new(types.Transaction)
|
||||||
)
|
)
|
||||||
// Call tracer test found, read if from disk
|
// Call tracer test found, read if from disk
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
package tracetest
|
package tracetest
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"math/big"
|
"math/big"
|
||||||
"strings"
|
"strings"
|
||||||
"unicode"
|
"unicode"
|
||||||
|
|
@ -78,3 +79,11 @@ func (c *traceContext) toBlockContext(genesis *core.Genesis) vm.BlockContext {
|
||||||
}
|
}
|
||||||
return context
|
return context
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// tracerTestEnv defines a tracer test required fields
|
||||||
|
type tracerTestEnv struct {
|
||||||
|
Genesis *core.Genesis `json:"genesis"`
|
||||||
|
Context *traceContext `json:"context"`
|
||||||
|
Input string `json:"input"`
|
||||||
|
TracerConfig json.RawMessage `json:"tracerConfig"`
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue