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

Add an example for a Node with custom Header and transaction type #13953

Open
Tracked by #13951
mattsse opened this issue Jan 23, 2025 · 5 comments
Open
Tracked by #13951

Add an example for a Node with custom Header and transaction type #13953

mattsse opened this issue Jan 23, 2025 · 5 comments
Assignees
Labels
A-sdk Related to reth's use as a library C-enhancement New feature or request D-complex Quite challenging from either a design or technical perspective Ask for help! D-good-first-issue Nice and easy! A great choice to get started
Milestone

Comments

@mattsse
Copy link
Collaborator

mattsse commented Jan 23, 2025

we now support configuring the the NodePrimitives, e.g.:

https://github.com/paradigmxyz/reth/blob/main/crates/primitives/src/lib.rs#L83-L89

we want to showcase and find blockers in the current design by adding a more elaborate SDK example that:

  • uses a custom header type, (configured in the block type)

TODO

  • add a new examples crate that introduces all custom types and components necessary for modifying something like this

this header type could be a simple wrapper struct CustomHeader {eth_header: Header, extra: ...}
this requires a bunch of custom components, those can be simple noops at first (e.g. consensus)

this likely highlights a few blockers and bad DX so this can be done incrementally and ideally flags issues and resolves them via separate PRs.

@mattsse mattsse changed the title example with custom header/tx types Add an example for a Node with custom Header and transaction type Jan 23, 2025
@mattsse mattsse added C-enhancement New feature or request D-good-first-issue Nice and easy! A great choice to get started D-complex Quite challenging from either a design or technical perspective Ask for help! A-sdk Related to reth's use as a library P-high This is particularly urgent, and deserves immediate attention labels Jan 23, 2025
@mattsse mattsse added this to the Release 1.2.0 milestone Jan 23, 2025
@PelleKrab
Copy link
Contributor

I'd be happy to start working on this, but I am a little confused on the scope of custom components. Would this look some what like custom-dev-node?

@mattsse
Copy link
Collaborator Author

mattsse commented Jan 23, 2025

yeah, very similar

this task is a bit larger, so we can take this step by step,

the goal should be something similar to:

impl<N> Node<N> for OpNode
where
N: FullNodeTypes<
Types: NodeTypesWithEngine<
Engine = OpEngineTypes,
ChainSpec = OpChainSpec,
Primitives = OpPrimitives,
Storage = OpStorage,
>,
>,
{
type ComponentsBuilder = ComponentsBuilder<
N,
OpPoolBuilder,
OpPayloadBuilder,
OpNetworkBuilder,
OpExecutorBuilder,
OpConsensusBuilder,
>;
type AddOns =
OpAddOns<NodeAdapter<N, <Self::ComponentsBuilder as NodeComponentsBuilder<N>>::Components>>;
fn components_builder(&self) -> Self::ComponentsBuilder {

but let's how far we come with custom header type draft first and then, a consensus impl, etc and keep stacking up custom components.

will provide more instructions once there's a draft pr (can be small in scope)

this issue is intended as an exercise and should give us some DX feedback and flag blockers

@Elite-tch
Copy link

Can I start working on this?

@PelleKrab
Copy link
Contributor

I'm a little stuck. I am trying to implement the CustomHeader into the a custom NodePrimitives. Since the Block<> takes a TransactionSigned, do I need to make a custom signed tx for a basic custom header type draft? Or am I over complicating things and there is an easier way test CustomHeader implementation? @mattsse

@loocapro
Copy link
Contributor

I'm a little stuck. I am trying to implement the CustomHeader into the a custom NodePrimitives. Since the Block<> takes a TransactionSigned, do I need to make a custom signed tx for a basic custom header type draft? Or am I over complicating things and there is an easier way test CustomHeader implementation? @mattsse

Hi @PelleKrab, pardon my intrusion! 🙂

I think you can simply make your CustomHeader a wrapper type around alloy_consensus::Block and implement the reth_primitives_traits::block::Block trait. For this exercise, we just want to demonstrate that all types and components can be seamlessly integrated.

Also, if you open a draft PR, it’ll be easier to follow your progress and in case help you out.

@mattsse mattsse removed the P-high This is particularly urgent, and deserves immediate attention label Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sdk Related to reth's use as a library C-enhancement New feature or request D-complex Quite challenging from either a design or technical perspective Ask for help! D-good-first-issue Nice and easy! A great choice to get started
Projects
Status: Todo
Development

No branches or pull requests

4 participants