fix CI errors
This commit is contained in:
parent
6101d7a20d
commit
92ae69a2b4
@ -144,12 +144,11 @@ var _ = BeforeSuite(func() {
|
|||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
tracingAPI, _ = eth.NewTracingAPI(backend, nil, eth.APIConfig{StateDiffTimeout: shared.DefaultStateDiffTimeout})
|
tracingAPI, _ = eth.NewTracingAPI(backend, nil, eth.APIConfig{StateDiffTimeout: shared.DefaultStateDiffTimeout})
|
||||||
|
tb.teardown()
|
||||||
})
|
})
|
||||||
|
|
||||||
var _ = AfterSuite(func() {
|
var _ = AfterSuite(func() {
|
||||||
shared.TearDownDB(db)
|
shared.TearDownDB(db)
|
||||||
tb.teardown()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -236,8 +235,8 @@ var _ = Describe("eth state reading tests", func() {
|
|||||||
},
|
},
|
||||||
expectErr: nil,
|
expectErr: nil,
|
||||||
expect: ` {"gas":53018,"failed":false,"returnValue":"","structLogs":[
|
expect: ` {"gas":53018,"failed":false,"returnValue":"","structLogs":[
|
||||||
{"pc":0,"op":"NUMBER","gas":24946984,"gasCost":2,"depth":1,"stack":[]},
|
{"pc":0,"op":"NUMBER","gas":9999946984,"gasCost":2,"depth":1,"stack":[]},
|
||||||
{"pc":1,"op":"STOP","gas":24946982,"gasCost":0,"depth":1,"stack":["0x1337"]}]}`,
|
{"pc":1,"op":"STOP","gas":9999946982,"gasCost":0,"depth":1,"stack":["0x1337"]}]}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, testspec := range testSuite {
|
for _, testspec := range testSuite {
|
||||||
@ -290,7 +289,7 @@ var _ = Describe("eth state reading tests", func() {
|
|||||||
// Trace pending block
|
// Trace pending block
|
||||||
{
|
{
|
||||||
blockNumber: rpc.PendingBlockNumber,
|
blockNumber: rpc.PendingBlockNumber,
|
||||||
want: `[{"result":{"gas":21000,"failed":false,"returnValue":"","structLogs":[]}}]`,
|
expectErr: errors.New("pending block number not supported"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tc := range testSuite {
|
for _, tc := range testSuite {
|
||||||
@ -302,7 +301,7 @@ var _ = Describe("eth state reading tests", func() {
|
|||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
have, _ := json.Marshal(result)
|
have, _ := json.Marshal(result)
|
||||||
want := tc.want
|
want := tc.want
|
||||||
Expect(have).To(Equal(want))
|
Expect(string(have)).To(Equal(want))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -236,9 +236,14 @@ type txTraceResult struct {
|
|||||||
Error string `json:"error,omitempty"` // Trace failure produced by the tracer
|
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
|
// TraceBlockByNumber returns the structured logs created during the execution of
|
||||||
// EVM and returns them as a JSON object.
|
// EVM and returns them as a JSON object.
|
||||||
func (api *TracingAPI) TraceBlockByNumber(ctx context.Context, number rpc.BlockNumber, config *TraceConfig) ([]*txTraceResult, error) {
|
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)
|
block, err := api.blockByNumber(ctx, number)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -263,6 +268,9 @@ func (api *TracingAPI) TraceBlockByHash(ctx context.Context, hash common.Hash, c
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if block.NumberU64() == 0 {
|
||||||
|
return nil, noGenesisErr
|
||||||
|
}
|
||||||
trace, err := api.traceBlock(ctx, block, config)
|
trace, err := api.traceBlock(ctx, block, config)
|
||||||
if trace != nil && err == nil {
|
if trace != nil && err == nil {
|
||||||
return trace, nil
|
return trace, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user