fix CI errors
Some checks failed
Test the stack. / Run integration tests (pull_request) Failing after 4m12s
Test the stack. / Run unit tests (pull_request) Successful in 10m26s

This commit is contained in:
i-norden 2023-11-08 08:19:33 -06:00
parent 877b731340
commit ec49318294
2 changed files with 13 additions and 6 deletions

View File

@ -144,12 +144,11 @@ var _ = BeforeSuite(func() {
Expect(err).ToNot(HaveOccurred())
tracingAPI, _ = eth.NewTracingAPI(backend, nil, eth.APIConfig{StateDiffTimeout: shared.DefaultStateDiffTimeout})
tb.teardown()
})
var _ = AfterSuite(func() {
shared.TearDownDB(db)
tb.teardown()
})
var (
@ -236,8 +235,8 @@ var _ = Describe("eth state reading tests", func() {
},
expectErr: nil,
expect: ` {"gas":53018,"failed":false,"returnValue":"","structLogs":[
{"pc":0,"op":"NUMBER","gas":24946984,"gasCost":2,"depth":1,"stack":[]},
{"pc":1,"op":"STOP","gas":24946982,"gasCost":0,"depth":1,"stack":["0x1337"]}]}`,
{"pc":0,"op":"NUMBER","gas":9999946984,"gasCost":2,"depth":1,"stack":[]},
{"pc":1,"op":"STOP","gas":9999946982,"gasCost":0,"depth":1,"stack":["0x1337"]}]}`,
},
}
for _, testspec := range testSuite {
@ -290,7 +289,7 @@ var _ = Describe("eth state reading tests", func() {
// Trace pending block
{
blockNumber: rpc.PendingBlockNumber,
want: `[{"result":{"gas":21000,"failed":false,"returnValue":"","structLogs":[]}}]`,
expectErr: errors.New("pending block number not supported"),
},
}
for _, tc := range testSuite {
@ -302,7 +301,7 @@ var _ = Describe("eth state reading tests", func() {
Expect(err).ToNot(HaveOccurred())
have, _ := json.Marshal(result)
want := tc.want
Expect(have).To(Equal(want))
Expect(string(have)).To(Equal(want))
}
}
})

View File

@ -236,9 +236,14 @@ type txTraceResult struct {
Error string `json:"error,omitempty"` // Trace failure produced by the tracer
}
var noGenesisErr = errors.New("genesis is not traceable")
// TraceBlockByNumber returns the structured logs created during the execution of
// EVM and returns them as a JSON object.
func (api *TracingAPI) TraceBlockByNumber(ctx context.Context, number rpc.BlockNumber, config *TraceConfig) ([]*txTraceResult, error) {
if number == 0 {
return nil, noGenesisErr
}
block, err := api.blockByNumber(ctx, number)
if err != nil {
return nil, err
@ -263,6 +268,9 @@ func (api *TracingAPI) TraceBlockByHash(ctx context.Context, hash common.Hash, c
if err != nil {
return nil, err
}
if block.NumberU64() == 0 {
return nil, noGenesisErr
}
trace, err := api.traceBlock(ctx, block, config)
if trace != nil && err == nil {
return trace, nil