Skip to content

Commit

Permalink
fix trace_filter error
Browse files Browse the repository at this point in the history
  • Loading branch information
blxdyx committed Jun 1, 2023
1 parent f0ac7c5 commit 35bf202
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions cmd/rpcdaemon/commands/call_traces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func TestCallTraceOneByOne(t *testing.T) {
ToBlock: (*hexutil.Uint64)(&toBlock),
ToAddress: []*common.Address{&toAddress1},
}
if err = api.Filter(context.Background(), traceReq1, stream, new(bool)); err != nil {
if err = api.Filter(context.Background(), traceReq1, new(bool), stream); err != nil {
t.Fatalf("trace_filter failed: %v", err)
}
assert.Equal(t, []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, blockNumbersFromTraces(t, stream.Buffer()))
Expand Down Expand Up @@ -120,7 +120,7 @@ func TestCallTraceUnwind(t *testing.T) {
ToBlock: (*hexutil.Uint64)(&toBlock),
ToAddress: []*common.Address{&toAddress1},
}
if err = api.Filter(context.Background(), traceReq1, stream, new(bool)); err != nil {
if err = api.Filter(context.Background(), traceReq1, new(bool), stream); err != nil {
t.Fatalf("trace_filter failed: %v", err)
}
assert.Equal(t, []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, blockNumbersFromTraces(t, stream.Buffer()))
Expand All @@ -135,7 +135,7 @@ func TestCallTraceUnwind(t *testing.T) {
ToBlock: (*hexutil.Uint64)(&toBlock),
ToAddress: []*common.Address{&toAddress1},
}
if err = api.Filter(context.Background(), traceReq2, stream, new(bool)); err != nil {
if err = api.Filter(context.Background(), traceReq2, new(bool), stream); err != nil {
t.Fatalf("trace_filter failed: %v", err)
}
assert.Equal(t, []int{1, 2, 3, 4, 5, 11, 12}, blockNumbersFromTraces(t, stream.Buffer()))
Expand All @@ -151,7 +151,7 @@ func TestCallTraceUnwind(t *testing.T) {
ToBlock: (*hexutil.Uint64)(&toBlock),
ToAddress: []*common.Address{&toAddress1},
}
if err = api.Filter(context.Background(), traceReq3, stream, new(bool)); err != nil {
if err = api.Filter(context.Background(), traceReq3, new(bool), stream); err != nil {
t.Fatalf("trace_filter failed: %v", err)
}
assert.Equal(t, []int{12, 13, 14, 15, 16, 17, 18, 19, 20}, blockNumbersFromTraces(t, stream.Buffer()))
Expand Down Expand Up @@ -183,7 +183,7 @@ func TestFilterNoAddresses(t *testing.T) {
FromBlock: (*hexutil.Uint64)(&fromBlock),
ToBlock: (*hexutil.Uint64)(&toBlock),
}
if err = api.Filter(context.Background(), traceReq1, stream, new(bool)); err != nil {
if err = api.Filter(context.Background(), traceReq1, new(bool), stream); err != nil {
t.Fatalf("trace_filter failed: %v", err)
}
assert.Equal(t, []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, blockNumbersFromTraces(t, stream.Buffer()))
Expand Down Expand Up @@ -234,7 +234,7 @@ func TestFilterAddressIntersection(t *testing.T) {
ToAddress: []*common.Address{&m.Address, &toAddress2},
Mode: TraceFilterModeIntersection,
}
if err = api.Filter(context.Background(), traceReq1, stream, new(bool)); err != nil {
if err = api.Filter(context.Background(), traceReq1, new(bool), stream); err != nil {
t.Fatalf("trace_filter failed: %v", err)
}
assert.Equal(t, []int{6, 7, 8, 9, 10}, blockNumbersFromTraces(t, stream.Buffer()))
Expand All @@ -250,7 +250,7 @@ func TestFilterAddressIntersection(t *testing.T) {
ToAddress: []*common.Address{&toAddress1, &m.Address},
Mode: TraceFilterModeIntersection,
}
if err = api.Filter(context.Background(), traceReq1, stream, new(bool)); err != nil {
if err = api.Filter(context.Background(), traceReq1, new(bool), stream); err != nil {
t.Fatalf("trace_filter failed: %v", err)
}
assert.Equal(t, []int{1, 2, 3, 4, 5}, blockNumbersFromTraces(t, stream.Buffer()))
Expand All @@ -266,7 +266,7 @@ func TestFilterAddressIntersection(t *testing.T) {
FromAddress: []*common.Address{&toAddress2, &toAddress1, &other},
Mode: TraceFilterModeIntersection,
}
if err = api.Filter(context.Background(), traceReq1, stream, new(bool)); err != nil {
if err = api.Filter(context.Background(), traceReq1, new(bool), stream); err != nil {
t.Fatalf("trace_filter failed: %v", err)
}
require.Empty(t, blockNumbersFromTraces(t, stream.Buffer()))
Expand Down
2 changes: 1 addition & 1 deletion cmd/rpcdaemon/commands/trace_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type TraceAPI interface {
Transaction(ctx context.Context, txHash libcommon.Hash, gasBailOut *bool) (ParityTraces, error)
Get(ctx context.Context, txHash libcommon.Hash, txIndicies []hexutil.Uint64, gasBailOut *bool) (*ParityTrace, error)
Block(ctx context.Context, blockNr rpc.BlockNumber, gasBailOut *bool) (ParityTraces, error)
Filter(ctx context.Context, req TraceFilterRequest, stream *jsoniter.Stream, gasBailOut *bool) error
Filter(ctx context.Context, req TraceFilterRequest, gasBailOut *bool, stream *jsoniter.Stream) error
}

// TraceAPIImpl is implementation of the TraceAPI interface based on remote Db access
Expand Down
2 changes: 1 addition & 1 deletion cmd/rpcdaemon/commands/trace_filtering.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ func traceFilterBitmapsV3(tx kv.TemporalTx, req TraceFilterRequest, from, to uin
// Filter implements trace_filter
// NOTE: We do not store full traces - we just store index for each address
// Pull blocks which have txs with matching address
func (api *TraceAPIImpl) Filter(ctx context.Context, req TraceFilterRequest, stream *jsoniter.Stream, gasBailOut *bool) error {
func (api *TraceAPIImpl) Filter(ctx context.Context, req TraceFilterRequest, gasBailOut *bool, stream *jsoniter.Stream) error {
if gasBailOut == nil {
gasBailOut = new(bool) // false by default
}
Expand Down

0 comments on commit 35bf202

Please sign in to comment.