Skip to content

Extend evm trace api#73

Open
tmcgroul wants to merge 2 commits into
masterfrom
extend-trace-request
Open

Extend evm trace api#73
tmcgroul wants to merge 2 commits into
masterfrom
extend-trace-request

Conversation

@tmcgroul

@tmcgroul tmcgroul commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

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_eq predicate + 0x1 hex 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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 callType filtering to TraceRequest.
  • Added *ValueNonZero / *BalanceNonZero boolean flags to filter traces with non-zero call_value, create_value, suicide_balance, and reward_value.
  • Added new Ethereum query fixtures covering callType filtering 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,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants