Skip to content

feat: reuse reth default_ethereum_payload for Ethereum - #99

Merged
julio4 merged 3 commits into
flashbots:mainfrom
SkandaBhat:default-ethereum-payload
Dec 13, 2025
Merged

julio4 merged 3 commits into
flashbots:mainfrom
SkandaBhat:default-ethereum-payload

Conversation

@SkandaBhat

@SkandaBhat SkandaBhat commented Dec 9, 2025 •

Copy link
Copy Markdown
Contributor

Fixes #76.

Notable changes

  • Require a state provider factory for all build_payload APIs so builders can fetch parent-scoped state correctly.
  • Added a convenience alias pub type ProviderFactory<P> = Arc<dyn traits::ProviderFactoryBounds<P>> to standardize the factory type across call sites.
  • Moved the state_by_block_hash lookup into BlockContext::new so payload construction always uses the parent block’s state.

@SkandaBhat
SkandaBhat marked this pull request as draft December 10, 2025 11:38

@julio4 julio4 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess this works but it would be better to not have to store the factory in the block context. We already have all the information we need in the base state to build the payload.

But if there's no other easy ways to do it then this is good!

@SkandaBhat

Copy link
Copy Markdown
Contributor Author

@julio4 One other approach is to wrap the base_state provider in a StateProviderFactory + ChainSpecProvider wrapper right before calling default_ethereum_payload so we don’t have to carry the factory around. The tradeoff is increased surface area inside ethereum module since we need to maintain implementations for StateProviderFactory (latest, pending etc)

@SkandaBhat
SkandaBhat marked this pull request as ready for review December 10, 2025 19:17
@julio4

julio4 commented Dec 11, 2025

Copy link
Copy Markdown
Contributor

@julio4 One other approach is to wrap the base_state provider in a StateProviderFactory + ChainSpecProvider wrapper right before calling default_ethereum_payload so we don’t have to carry the factory around. The tradeoff is increased surface area inside ethereum module since we need to maintain implementations for StateProviderFactory (latest, pending etc)

Yes agree, I tried this before but wasn't convinced. I think your solution looks nice for the time being!

Comment thread src/payload/block.rs Outdated
@SkandaBhat

Copy link
Copy Markdown
Contributor Author

Clippy fails because of latest rust version 1.92 changing the rules. Fixed it in #100

@SkandaBhat
SkandaBhat requested a review from julio4 December 13, 2025 09:31
@julio4
julio4 merged commit 4a50ae0 into flashbots:main Dec 13, 2025
4 checks passed
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.

Feat: reuse reth default_ethereum_payload for Ethereum

2 participants