Extend evm trace api#73
Open
tmcgroul wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Extends the EVM trace query API to support additional trace filtering use cases, specifically filtering call traces by callType and filtering traces where certain value/balance fields are non-zero.
Changes:
- Added
callTypefiltering toTraceRequest. - Added
*ValueNonZero/*BalanceNonZeroboolean flags to filter traces with non-zerocall_value,create_value,suicide_balance, andreward_value. - Added new Ethereum query fixtures covering
callTypefiltering and non-zero value/balance filtering.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/query/src/query/eth.rs | Adds new TraceRequest filters (callType, *NonZero) and applies them via predicate building. |
| crates/query/fixtures/ethereum/queries/trace_value_non_zero/query.json | New fixture query exercising non-zero value/balance filters. |
| crates/query/fixtures/ethereum/queries/trace_value_non_zero/result.json | LFS-backed expected result for the new non-zero filter fixture. |
| crates/query/fixtures/ethereum/queries/trace_call_type/query.json | New fixture query exercising callType filter. |
| crates/query/fixtures/ethereum/queries/trace_call_type/result.json | LFS-backed expected result for the new callType filter fixture. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
598
to
+600
| p.col_in_list("call_to", to_lowercase_list(&self.call_to)); | ||
| p.col_in_list("call_sighash", to_lowercase_list(&self.call_sighash)); | ||
| p.col_in_list("call_type", self.call_type.as_deref()); |
Comment on lines
569
to
+584
| request! { | ||
| pub struct TraceRequest { | ||
| pub r#type: Option<Vec<String>>, | ||
| pub create_from: Option<Vec<Bytes>>, | ||
| pub create_result_address: Option<Vec<Bytes>>, | ||
| pub create_value_non_zero: bool, | ||
| pub call_from: Option<Vec<Bytes>>, | ||
| pub call_to: Option<Vec<Bytes>>, | ||
| pub call_sighash: Option<Vec<Bytes>>, | ||
| pub call_type: Option<Vec<String>>, | ||
| pub call_value_non_zero: bool, | ||
| pub suicide_address: Option<Vec<Bytes>>, | ||
| pub suicide_refund_address: Option<Vec<Bytes>>, | ||
| pub suicide_balance_non_zero: bool, | ||
| pub reward_author: Option<Vec<Bytes>>, | ||
| pub reward_value_non_zero: bool, |
Comment on lines
+7
to
+9
| "callFrom": true, | ||
| "callType": true, | ||
| "transactionIndex": true, |
Comment on lines
+6
to
+9
| "trace": { | ||
| "callType": true, | ||
| "callSighash": true, | ||
| "callValue": true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pr targets a use case where a user wants to get all traces that have non empty and not zero value. I concluded that
col_gt_eqpredicate +0x1hex value works better than anything else but i'm a bit concerned that it doesn't allow (for example) to specify min or max number to be filtered out - potentially we could try to parse a hex number into a number and compare it to a predicate value but it comes with overhead so i didn't follow that approach