-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: support custom stages #18977
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
base: main
Are you sure you want to change the base?
feat: support custom stages #18977
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,8 @@ use reth_network_api::FullNetwork; | |
use reth_node_core::node_config::NodeConfig; | ||
use reth_node_types::{NodeTypes, NodeTypesWithDBAdapter, TxTy}; | ||
use reth_payload_builder::PayloadBuilderHandle; | ||
use reth_provider::FullProvider; | ||
use reth_provider::{DatabaseProviderFactory, FullProvider}; | ||
use reth_stages_api::BoxedStage; | ||
use reth_tasks::TaskExecutor; | ||
use reth_tokio_util::EventSender; | ||
use reth_transaction_pool::{PoolTransaction, TransactionPool}; | ||
|
@@ -203,6 +204,13 @@ pub trait NodeAddOns<N: FullNodeComponents>: Send { | |
self, | ||
ctx: AddOnsContext<'_, N>, | ||
) -> impl Future<Output = eyre::Result<Self::Handle>> + Send; | ||
|
||
/// Returns additional stages to be added to the pipeline. | ||
fn extra_stages( | ||
&self, | ||
) -> Vec<BoxedStage<<N::Provider as DatabaseProviderFactory>::ProviderRW>> { | ||
Vec::new() | ||
} | ||
Comment on lines
+208
to
+213
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this makes sense here I believe |
||
} | ||
|
||
impl<N: FullNodeComponents> NodeAddOns<N> for () { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,11 +16,11 @@ use reth_network_p2p::{ | |
bodies::downloader::BodyDownloader, headers::downloader::HeaderDownloader, BlockClient, | ||
}; | ||
use reth_node_api::HeaderTy; | ||
use reth_provider::{providers::ProviderNodeTypes, ProviderFactory}; | ||
use reth_provider::{providers::ProviderNodeTypes, DatabaseProviderFactory, ProviderFactory}; | ||
use reth_stages::{ | ||
prelude::DefaultStages, | ||
stages::{EraImportSource, ExecutionStage}, | ||
Pipeline, StageSet, | ||
BoxedStage, Pipeline, StageId, StageSet, | ||
}; | ||
use reth_static_file::StaticFileProducer; | ||
use reth_tasks::TaskExecutor; | ||
|
@@ -42,6 +42,7 @@ pub fn build_networked_pipeline<N, Client, Evm>( | |
evm_config: Evm, | ||
exex_manager_handle: ExExManagerHandle<N::Primitives>, | ||
era_import_source: Option<EraImportSource>, | ||
extra_stages: Vec<BoxedStage<<ProviderFactory<N> as DatabaseProviderFactory>::ProviderRW>>, | ||
) -> eyre::Result<Pipeline<N>> | ||
where | ||
N: ProviderNodeTypes, | ||
|
@@ -70,6 +71,7 @@ where | |
evm_config, | ||
exex_manager_handle, | ||
era_import_source, | ||
extra_stages, | ||
)?; | ||
|
||
Ok(pipeline) | ||
|
@@ -90,6 +92,7 @@ pub fn build_pipeline<N, H, B, Evm>( | |
evm_config: Evm, | ||
exex_manager_handle: ExExManagerHandle<N::Primitives>, | ||
era_import_source: Option<EraImportSource>, | ||
extra_stages: Vec<BoxedStage<<ProviderFactory<N> as DatabaseProviderFactory>::ProviderRW>>, | ||
) -> eyre::Result<Pipeline<N>> | ||
where | ||
N: ProviderNodeTypes, | ||
|
@@ -129,7 +132,8 @@ where | |
stage_config.execution.into(), | ||
stage_config.execution_external_clean_threshold(), | ||
exex_manager_handle, | ||
)), | ||
)) | ||
.add_stages_before(extra_stages, StageId::Finish), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we're fine if these are put before finish stage |
||
) | ||
.build(provider_factory, static_file_producer); | ||
|
||
|
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.
can we document here that we need invoke those after we save the blocks, because we want them to run last