Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix trace_filter regression due to gasBailout argument (#7539) #7540

Merged
merged 1 commit into from
May 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -348,7 +348,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