-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
base: main
Are you sure you want to change the base?
feat: make trace_filter block range configurable #14939
Conversation
There was a problem hiding this 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
crates/rpc/rpc/src/trace.rs
Outdated
@@ -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 { |
There was a problem hiding this comment.
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
There was a problem hiding this 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
crates/rpc/rpc/src/trace.rs
Outdated
let eth_config = EthConfig::default(); | ||
let max_blocks_per_filter = eth_config.max_trace_filter_blocks; |
There was a problem hiding this comment.
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
reth/crates/rpc/rpc/src/eth/filter.rs
Lines 370 to 371 in 57bb9ba
/// Maximum number of blocks that could be scanned per filter | |
max_blocks_per_filter: u64, |
and make it accessible in the rpc method here
reth/crates/rpc/rpc/src/eth/filter.rs
Line 495 in 57bb9ba
if to_block - from_block > self.max_blocks_per_filter { |
🔥 |
There was a problem hiding this 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!
crates/rpc/rpc/src/trace.rs
Outdated
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() } |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops I missed this
crates/rpc/rpc/src/trace.rs
Outdated
@@ -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, |
There was a problem hiding this comment.
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
should close #14930