Skip to content

Conversation

klkvr
Copy link
Member

@klkvr klkvr commented Oct 13, 2025

Based on #18955

Allows defining custom stages on NodeAddOns. Those stages are added to pipeline and advanced in PersistenceService.

Open questions:

  • Is there a better place for the custom_stages getter? Maybe Node trait?
  • How appropriate is it to advance stages directly in the PersistenceService? This should work fine for most of the cases, especially for custom indexes. Another approach would be allowing to define custom hooks invoked when persisting but it feels like this might just lead to redundancy in custom stage impls

@github-project-automation github-project-automation bot moved this to Backlog in Reth Tracker Oct 13, 2025
@klkvr klkvr force-pushed the klkvr/custom-stages branch 3 times, most recently from e208eff to 4efc99a Compare October 13, 2025 18:20
Base automatically changed from klkvr/check-consistency-custom-stages to main October 14, 2025 16:36
@klkvr klkvr requested review from joshieDo and rakita as code owners October 14, 2025 16:36
@klkvr klkvr force-pushed the klkvr/custom-stages branch from f16a014 to e4e3150 Compare October 14, 2025 19:41
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

makes sense

I think invoking the stages after saving blocks make sense, I guess we could also introduce another trait for this that extend stage so that we can directly provide the new blocks but for now this seems easier

Comment on lines +208 to +213
/// Returns additional stages to be added to the pipeline.
fn extra_stages(
&self,
) -> Vec<BoxedStage<<N::Provider as DatabaseProviderFactory>::ProviderRW>> {
Vec::new()
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

this makes sense here I believe

exex_manager_handle,
)),
))
.add_stages_before(extra_stages, StageId::Finish),
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we're fine if these are put before finish stage


provider_rw.save_blocks(blocks)?;

for stage in &mut self.custom_stages {
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we document here that we need invoke those after we save the blocks, because we want them to run last

@github-project-automation github-project-automation bot moved this from Backlog to In Progress in Reth Tracker Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants