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 properly matches when from_addresses or to_addresses aren't set #5291

Merged
merged 3 commits into from
Nov 4, 2023
Merged

fix: trace_filter properly matches when from_addresses or to_addresses aren't set #5291

merged 3 commits into from
Nov 4, 2023

Conversation

phillipleblanc
Copy link
Contributor

@phillipleblanc phillipleblanc commented Nov 4, 2023

ref: #4799

A follow up to #5279 that fixes a couple more cases.

In the previous PR, it handled the case where both from_addresses and to_addresses were empty, but it still had a bug where one of from_addresses or to_addresses (but not the other) was empty. The logic is that if one of them isn't specified, it shouldn't be considered when filtering the transactions.

Fix the logic by specifying all 4 possible cases as a match and returning the correct value. Only if both from_addresses and to_addresses are set does the TraceFilterMode apply.

I've added test cases to cover all possible variants. I wasn't sure if I should define a sub-module to group the trace filter tests, I couldn't find any examples of that being done elsewhere in the project - so I just prefixed each test with test_filter_matcher.

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, that makes sense.

only one style suggestion

crates/rpc/rpc-types/src/eth/trace/filter.rs Outdated Show resolved Hide resolved
@mattsse mattsse added the A-rpc Related to the RPC implementation label Nov 4, 2023
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mattsse mattsse added this pull request to the merge queue Nov 4, 2023
Merged via the queue into paradigmxyz:main with commit 219b7db Nov 4, 2023
22 checks passed
mattsse pushed a commit that referenced this pull request Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rpc Related to the RPC implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants