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

feat: make trace_filter block range configurable #14939

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

stevencartavia
Copy link
Contributor

should close #14930

Copy link
Member

@Rjected Rjected left a comment

Choose a reason for hiding this comment

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

cool, we just need to use the new cli setting now

@@ -257,7 +258,7 @@ where

// ensure that the range is not too large, since we need to fetch all blocks in the range
let distance = end.saturating_sub(start);
if distance > 100 {
if distance > DEFAULT_MAX_TRACE_FILTER_BLOCKS {
Copy link
Member

Choose a reason for hiding this comment

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

this should use the configured max blocks right? instead of the const

Copy link
Member

@Rjected Rjected left a comment

Choose a reason for hiding this comment

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

The only thing needed now is to pass down the argument to the inner trace api

Comment on lines 260 to 261
let eth_config = EthConfig::default();
let max_blocks_per_filter = eth_config.max_trace_filter_blocks;
Copy link
Member

Choose a reason for hiding this comment

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

we can't use default() here, we need to actually pass down the config into the trace api

see how we do it similarly in EthFilterInner here

/// Maximum number of blocks that could be scanned per filter
max_blocks_per_filter: u64,

and make it accessible in the rpc method here

if to_block - from_block > self.max_blocks_per_filter {

@paulmillr
Copy link

🔥

Copy link
Member

@Rjected Rjected left a comment

Choose a reason for hiding this comment

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

this looks good to me, thanks!

Comment on lines 48 to 50
pub fn new(eth_api: Eth, blocking_task_guard: BlockingTaskGuard) -> Self {
let inner = Arc::new(TraceApiInner { eth_api, blocking_task_guard });
Self { inner }
Self { inner, eth_config: EthConfig::default() }
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this works just yet, but nothing is being configured here and this will always use the default

Copy link
Collaborator

Choose a reason for hiding this comment

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

so what we need to do here is provide the ethconfig as arg, or just the max_trace_filter_blocks

Copy link
Member

Choose a reason for hiding this comment

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

oops I missed this

@@ -38,6 +38,7 @@ use tokio::sync::{AcquireError, OwnedSemaphorePermit};
/// This type provides the functionality for handling `trace` related requests.
pub struct TraceApi<Eth> {
inner: Arc<TraceApiInner<Eth>>,
eth_config: EthConfig,
Copy link
Collaborator

Choose a reason for hiding this comment

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

we also want the settings in the inner type, that's what the inner type is for that that cloning TraceApi per request is as cheap as possible

@emhane emhane added the A-rpc Related to the RPC implementation label Mar 12, 2025
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
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Make trace_filter block range configurable
5 participants