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

Trace Filter support #4799

Open
mattsse opened this issue Sep 26, 2023 · 8 comments
Open

Trace Filter support #4799

mattsse opened this issue Sep 26, 2023 · 8 comments
Labels
A-rpc Related to the RPC implementation C-enhancement New feature or request M-prevent-stale Prevents old inactive issues/PRs from being closed due to inactivity S-needs-design This issue requires design work to think about how it would best be accomplished

Comments

@mattsse
Copy link
Collaborator

mattsse commented Sep 26, 2023

Describe the feature

tracking issue for trace_fitler which is very useful for indexing

ref #3661 (comment)

trace_filter returns parity traces similar to eth_getLogs but for traces

pub struct TraceFilter {
/// From block
#[serde(with = "u64_hex_or_decimal_opt")]
pub from_block: Option<u64>,
/// To block
#[serde(with = "u64_hex_or_decimal_opt")]
pub to_block: Option<u64>,
/// From address
pub from_address: Option<Vec<Address>>,
/// To address
pub to_address: Option<Vec<Address>>,
/// Output offset
pub after: Option<u64>,
/// Output amount
pub count: Option<u64>,
}

all filter fields can be checked via Transactions alone, if I understand the filter options correctly.

Supporting the block range shouldn't be too difficult, at worst this is essentially a batch of replay_block requests.

Not sure how to support address fields without limiting blocks, because atm we don't have indices for that

@tjayrush what is a usual trace_filter request?

Additional context

No response

@mattsse mattsse added C-enhancement New feature or request S-needs-design This issue requires design work to think about how it would best be accomplished A-rpc Related to the RPC implementation labels Sep 26, 2023
@tjayrush
Copy link

Our use case is probably not all that typical (but no less useful).

We only need first_block and last_block because we scan the result ourselves for appearances.

I imagine that for others, though, the address filter is quite interesting.

Our use case is indexing all address appearances in the block range, not filtering for one (or a few) addresses.

We have a bunch of test cases for tracing that I'll run once I get my Reth node synced to mainnet. That will help with testing.

@mattsse
Copy link
Collaborator Author

mattsse commented Sep 26, 2023

what's a typical block range?

since this is quite similar to replay_block with some extra steps, I can at least add support for block filters

@tjayrush
Copy link

Again, no real typical value. We would probably adjust at whatever value is the fastest (after experimenting). We batch 5,000 blocks at a time, but I'm sure that's way too many, so I've been thinking of breaking it up into 100 50-block chunks. (Currently, we query each block separately with trace_block). But we'd adjust.

@mattsse
Copy link
Collaborator Author

mattsse commented Sep 26, 2023

sg!
I'll implement it with some limitations:
block range required
block range limited (needs some testing)

@tjayrush
Copy link

tjayrush commented Sep 26, 2023

I'll test it (once I'm synced...). Although, I have Sepolia synced, so I can test it there too.

@github-actions
Copy link
Contributor

This issue is stale because it has been open for 21 days with no activity.

@github-actions github-actions bot added the S-stale This issue/PR is stale and will close with no further activity label Oct 18, 2023
@mattsse mattsse added M-prevent-stale Prevents old inactive issues/PRs from being closed due to inactivity and removed S-stale This issue/PR is stale and will close with no further activity labels Oct 18, 2023
@sambacha
Copy link

Is this still an open issue?

@paulmillr
Copy link

This is still an issue. The merged implementation is limited to 100 blocks, which makes it useless, compared to Erigon.

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 C-enhancement New feature or request M-prevent-stale Prevents old inactive issues/PRs from being closed due to inactivity S-needs-design This issue requires design work to think about how it would best be accomplished
Projects
Status: Todo
Development

No branches or pull requests

4 participants