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

feat(payload): add support for multiple payload builders in BasicPayloadJobGenerator #11004

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

aroralanuk
Copy link

@aroralanuk aroralanuk commented Sep 18, 2024

Problem

We need a flexible way to combine and sequentially execute multiple payload builders of the same type, allowing for more complex and customizable payload building strategies. Fixes #10438

Solution

Implement a new PayloadBuilderStack<B> that can hold and execute multiple builders of type B in sequence.

Implementation Details

  • Create PayloadBuilderStack<B> with a single generic type parameter
  • implement the same PayloadBuilder trait methods for the stack struct
  • Implement sequential execution of builders for try_build, on_missing_payload, and build_empty_payload

Open question

  • PayloadBuilderStack is designed to be a drop-in replacement for any single PayloadBuilder implementation, where will it be actually used in reth?
  • Do you want me to propagate the error if we encounter one in a specific builder or just continue with other builders?
  • Is falling back to MissingPayloadBehaviour::AwaitInProgress ok for on_missing_payload?
  • What kind of tests should I add to test this feature?

Testing

  • None

@nkysg
Copy link
Contributor

nkysg commented Sep 18, 2024

no just something that wraps two instances of the same kind (ethereum eg)
similar to https://docs.rs/tower/latest/tower/layer/util/struct.Stack.html
the idea here is that you can use two diff payload builders
and the attributes would be an Either<A, B> where A,B are the payload attributes types of the respective payload builders

Originally posted by @mattsse. FYI @aroralanuk

Copy link
Member

@Rjected Rjected left a comment

Choose a reason for hiding this comment

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

I think the original issue requested a stack where you could use more than one type of payload builder - in this, because of the single generic, you can only do multiple of one type of payload builder. So this needs to be changed to support two different payload builders with two different types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add PayloadBuilder Implementation that supports two types of builders
3 participants