reth icon indicating copy to clipboard operation
reth copied to clipboard

cache recent flashblock sequences

Open mattsse opened this issue 2 months ago • 3 comments
trafficstars

Describe the feature

currently we clear the tracked flashblock:

https://github.com/paradigmxyz/reth/blob/424974ca370d41969e3161230faa5f0dfd16c77a/crates/optimism/flashblocks/src/sequence.rs#L43-L45

what we should be doing is also take the local height into account and try caching like 3 blocks, e.g. head is N, and flashblocks are already ticking and N + X then we should cache the flashblocks if distance X - N is within, let's do 3 blocks for now.

and then pick the proper block when we execute:

https://github.com/paradigmxyz/reth/blob/424974ca370d41969e3161230faa5f0dfd16c77a/crates/optimism/flashblocks/src/service.rs#L107-L126

this requires a smol redesign because then the local header guides flashblock selection in case local N + 1 is X - 2 for example.

TODO

  • introduce basic cache (like a vecqueue)
  • change selection logic so that local head is used when selecting the flashblock for building

Additional context

No response

mattsse avatar Sep 10 '25 19:09 mattsse