Skip to content

Commit 838ef5c

Browse files
cmd/evm: remove superflous result struct
1 parent 94b4de0 commit 838ef5c

File tree

1 file changed

+5
-40
lines changed

1 file changed

+5
-40
lines changed

cmd/evm/blockrunner.go

Lines changed: 5 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -81,42 +81,6 @@ func blockTestCmd(ctx *cli.Context) error {
8181
return nil
8282
}
8383

84-
// blocktestEndMarker represents the final status of a blocktest execution.
85-
// It is written as the last line of trace output in JSONL format (single-line JSON).
86-
type blocktestEndMarker struct {
87-
TestEnd blocktestEndDetails `json:"testEnd"`
88-
}
89-
90-
type blocktestEndDetails struct {
91-
Name string `json:"name"`
92-
Pass bool `json:"pass"`
93-
Fork string `json:"fork,omitempty"`
94-
Root string `json:"root,omitempty"`
95-
Error string `json:"error,omitempty"`
96-
V int `json:"v"` // Version: 1
97-
}
98-
99-
// writeEndMarker writes the blocktest end marker to stderr in JSONL format.
100-
// This marker indicates the final outcome of the test as a single-line JSON object.
101-
func writeEndMarker(result *testResult, fork string, root *common.Hash) {
102-
details := blocktestEndDetails{
103-
Name: result.Name,
104-
Pass: result.Pass,
105-
Fork: fork,
106-
V: 1,
107-
}
108-
if !result.Pass && result.Error != "" {
109-
details.Error = result.Error
110-
}
111-
if root != nil {
112-
details.Root = root.Hex()
113-
}
114-
marker := blocktestEndMarker{TestEnd: details}
115-
if data, err := json.Marshal(marker); err == nil {
116-
fmt.Fprintf(os.Stderr, "%s\n", data)
117-
}
118-
}
119-
12084
func runBlockTest(ctx *cli.Context, fname string) ([]testResult, error) {
12185
src, err := os.ReadFile(fname)
12286
if err != nil {
@@ -163,13 +127,14 @@ func runBlockTest(ctx *cli.Context, fname string) ([]testResult, error) {
163127
}); err != nil {
164128
result.Pass, result.Error = false, err.Error()
165129
}
166-
results = append(results, *result)
167130

168-
// Write end marker when tracing is enabled
131+
// Write result between transactions when tracing is enabled
169132
if tracer != nil {
170-
fork := test.Network()
171-
writeEndMarker(result, fork, finalRoot)
133+
result.Fork = test.Network()
134+
result.Root = finalRoot
135+
report(ctx, []testResult{*result})
172136
}
137+
results = append(results, *result)
173138
}
174139
return results, nil
175140
}

0 commit comments

Comments
 (0)