-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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: separate BlockExecutor metadata trait methods #6568
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.
I don't think we need to make this part of the trait.
As you pointed out this has nothing to do with execution and we should treat it that way so that the executor impl is responsible for logging the stats when the type state is consumed.
This entire trait seems a bit strange imo, but I don't have a good suggestion for how to improve yet.
|
||
/// A [BlockExecutor] that can return metadata like current in-memory changes and internal | ||
/// statistics. | ||
pub trait BlockExecutorMetadata { | ||
/// Internal statistics of execution. | ||
fn stats(&self) -> BlockExecutorStats; |
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.
it feels a bit weird to turn this into a trait just for stats reporting.
the BlockExecutor
trait seems a bit strange.
looks like we only use this here?
reth/crates/stages/src/stages/execution.rs
Lines 193 to 209 in 17eca36
let state = executor.take_output_state(); | |
let write_preparation_duration = time.elapsed(); | |
let time = Instant::now(); | |
// write output | |
state.write_to_db(provider.tx_ref(), OriginalValuesKnown::Yes)?; | |
let db_write_duration = time.elapsed(); | |
debug!( | |
target: "sync::stages::execution", | |
block_fetch = ?fetch_block_duration, | |
execution = ?execution_duration, | |
write_preperation = ?write_preparation_duration, | |
write = ?db_write_duration, | |
"Execution time" | |
); | |
executor.stats().log_info(); |
can we make the stats reporting part of the take_output_state
?
does this even have to be mutable?
fn take_output_state(&mut self) -> BundleStateWithReceipts; |
or can we consume the type and log the stats there?
c43b522
to
1dcc973
Compare
caaeab5
to
6b7ebd3
Compare
Going to close this, and roll most of these changes into #6461 |
This adds a trait called
BlockExecutorMetadata
, which separates the metadata methods from theBlockExecutor
trait, so the executor trait is only responsible for execution specific methods.