|
|
@ -43,28 +43,25 @@ 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 *callContext `json:"context"` |
|
|
|
|
|
|
|
Input string `json:"input"` |
|
|
|
|
|
|
|
TracerConfig json.RawMessage `json:"tracerConfig"` |
|
|
|
|
|
|
|
Result interface{} `json:"result"` |
|
|
|
Result interface{} `json:"result"` |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func TestPrestateTracerLegacy(t *testing.T) { |
|
|
|
func TestPrestateTracerLegacy(t *testing.T) { |
|
|
|
testPrestateDiffTracer("prestateTracerLegacy", "prestate_tracer_legacy", t) |
|
|
|
testPrestateTracer("prestateTracerLegacy", "prestate_tracer_legacy", t) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func TestPrestateTracer(t *testing.T) { |
|
|
|
func TestPrestateTracer(t *testing.T) { |
|
|
|
testPrestateDiffTracer("prestateTracer", "prestate_tracer", t) |
|
|
|
testPrestateTracer("prestateTracer", "prestate_tracer", t) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func TestPrestateWithDiffModeTracer(t *testing.T) { |
|
|
|
func TestPrestateWithDiffModeTracer(t *testing.T) { |
|
|
|
testPrestateDiffTracer("prestateTracer", "prestate_tracer_with_diff_mode", t) |
|
|
|
testPrestateTracer("prestateTracer", "prestate_tracer_with_diff_mode", t) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func testPrestateDiffTracer(tracerName string, dirPath string, t *testing.T) { |
|
|
|
func testPrestateTracer(tracerName string, dirPath string, t *testing.T) { |
|
|
|
files, err := os.ReadDir(filepath.Join("testdata", dirPath)) |
|
|
|
files, err := os.ReadDir(filepath.Join("testdata", dirPath)) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
t.Fatalf("failed to retrieve tracer test suite: %v", err) |
|
|
|
t.Fatalf("failed to retrieve tracer test suite: %v", err) |
|
|
@ -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
|
|
|
|