-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Labels
A-op-rethRelated to Optimism and op-rethRelated to Optimism and op-rethA-rpcRelated to the RPC implementationRelated to the RPC implementationC-enhancementNew feature or requestNew feature or requestD-good-first-issueNice and easy! A great choice to get startedNice and easy! A great choice to get started
Milestone
Description
Describe the feature
currently we clear the tracked flashblock:
reth/crates/optimism/flashblocks/src/sequence.rs
Lines 43 to 45 in 424974c
| // Clears the state and broadcasts the blocks produced to subscribers. | |
| fn clear_and_broadcast_blocks(&mut self) { | |
| let flashblocks = mem::take(&mut self.inner); |
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:
reth/crates/optimism/flashblocks/src/service.rs
Lines 107 to 126 in 424974c
| fn build_args( | |
| &mut self, | |
| ) -> Option<BuildArgs<impl IntoIterator<Item = WithEncoded<Recovered<N::SignedTx>>>>> { | |
| let Some(base) = self.blocks.payload_base() else { | |
| trace!( | |
| flashblock_number = ?self.blocks.block_number(), | |
| count = %self.blocks.count(), | |
| "Missing flashblock payload base" | |
| ); | |
| return None | |
| }; | |
| // attempt an initial consecutive check | |
| if let Some(latest) = self.builder.provider().latest_header().ok().flatten() { | |
| if latest.hash() != base.parent_hash { | |
| trace!(flashblock_parent=?base.parent_hash, flashblock_number=base.block_number, local_latest=?latest.num_hash(), "Skipping non consecutive build attempt"); | |
| return None; | |
| } | |
| } |
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
Metadata
Metadata
Assignees
Labels
A-op-rethRelated to Optimism and op-rethRelated to Optimism and op-rethA-rpcRelated to the RPC implementationRelated to the RPC implementationC-enhancementNew feature or requestNew feature or requestD-good-first-issueNice and easy! A great choice to get startedNice and easy! A great choice to get started
Type
Projects
Status
Backlog