Skip to content

refactor: move block merging logic into simulator#440

Open
tosynthegeek wants to merge 1 commit into
gattaca-com:developfrom
tosynthegeek:develop
Open

refactor: move block merging logic into simulator#440
tosynthegeek wants to merge 1 commit into
gattaca-com:developfrom
tosynthegeek:develop

Conversation

@tosynthegeek

Copy link
Copy Markdown
Contributor

Move block merging from auctioneer to simulator tile

Closes #438

Summary

Eliminates the merge round-trip through the auctioneer. Previously, the auctioneer tracked merge state, sent SimRequest::Merge to the simulator, received the response as Event::MergeResult, and assembled the merged payload. Now the simulator tile owns the entire merge lifecycle and delivers a finished PayloadEntry directly to the auctioneer.

Changes

spine/

  • messages.rs: Added TopBidForSim (auctioneer → sim tile, base block tracking) and MergedBlockSubmission (sim tile → auctioneer, merged payload ready). Added NO_IL_IX sentinel for slots without an inclusion list.
  • mod.rs: Added top_bid_for_sim and merged_block queues to HelixSpine.

simulator/

  • block_merger.rs (new): SimBlockMerger owns order pool, appendable block tracking, merge request building, and payload assembly (assemble_payload). Takes RelayConfig so inclusion_list config is accessible. take_base_info provides blobs bundle and builder pubkey for assembly. add_inclusion_list correctly reads from relay_config.inclusion_list.
  • mod.rs: Removed SimRequest::Merge. SimResult replaces Merge with MergedPayload(Box<PayloadEntry>).
  • tile.rs: SimulatorTile now has SimBlockMerger, sim_il, merging_enabled. After validation succeeds, ValidatedMergeCandidate is built from pre-captured fields (before the async spawn) and sent back via ValidationDone. handle_merge_done assembles the payload synchronously on the tile thread. on_new_slot seeds the IL from sim_il using NO_IL_IX sentinel. Consumes TopBidForSim to update the base block.

auctioneer/

  • merged_bid_cache.rs (renamed from block_merger.rs): Stripped to MergedBidCache for get_header tracking plus get_mergeable_orders. All order pooling and request building removed.
  • context.rs: BlockMerger removed from SlotContext, replaced by MergedBidCache. Added sim_il: Arc<SharedVector<InclusionListWithMetadata>>. on_new_slot pushes IL into sim_il and passes the index in ToSimMsg::ix. handle_merged_payload replaces handle_merge_response.
  • submit_block.rs: MergeData construction removed. Produces TopBidForSim when is_top_bid is true (both optimistic and post-simulation paths). block_merger.update_base_block calls removed.
  • mod.rs: Event::MergeResult replaced by Event::MergedPayload(Box<PayloadEntry>). process_slot_data no longer calls block_merger.add_inclusion_list. Three on_new_slot call sites pass il.clone(). MergedBlockSubmission consumed separately from FromSimMsg.

main.rs

  • sim_il shared vector created and passed to both SimulatorTile::create and Auctioneer::new.

- Move full `BlockMerger` responsibility from auctioneer to simulator
- Simplify auctioneer to bid ranking + payload storage only
- Trigger merges internally after validation instead of external RPC
- Eliminate auctioneer → simulator ExecutionPayload roundtrip for merges
- Rename auctioneer `BlockMerger` → `MergedBidCache` (cache-only)
- Subscribe simulator to `TopBidForSim` spine queue for base block tracking
- `ValidatedMergeCandidate` now carries full payload from validation success path

Fixes gattaca-com#438
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.

Move block merging into simulator

1 participant