Skip to content

Add SimRequest::ValidateMerged and dispatch merged blocks through the simulator - #506

Open
0w3n-d wants to merge 1 commit into
od/merged_block_simfrom
od/merged_block_sim_step2
Open

Add SimRequest::ValidateMerged and dispatch merged blocks through the simulator#506
0w3n-d wants to merge 1 commit into
od/merged_block_simfrom
od/merged_block_sim_step2

Conversation

@0w3n-d

@0w3n-d 0w3n-d commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Issue: #500 (step 2 of 4)

Base branch: od/merged_block_sim (step 1, #502) -- stacked per CONTRIBUTING.md, not yet merged. Diff will shrink once #502 merges and this retargets to develop.

What this PR does

Adds SimRequest::ValidateMerged/SimResult::ValidateMerged so a merged block from the merge builder can be simulated through the existing SimulatorTile machinery. A merged block is converted into a synthetic SignedBidSubmission (BidTrace.block_hash/parent_hash/gas_limit/gas_used derived from the execution payload, value from proposer_value, proposer_fee_recipient from the request, builder_pubkey/proposer_pubkey/signature zeroed -- the simulator never checks the BLS signature and these fields are otherwise cosmetic), so it reuses the same SSZ/JSON dispatch already used for ordinary bid submissions. A new PendingMergeRequests queue (keyed by base_block_hash, since there's exactly one merge builder connection rather than many builder pubkeys) gives merged-block requests the same load-shedding behavior under simulator capacity pressure as ordinary submissions get from PendingRequests.

SimulatorTile gains read access to merged_blocks (main.rs reordered so it's constructed before SimulatorTile::create instead of after). The auctioneer's FromSimMsg consumer, which previously did an irrefutable let SimResult::Validate(..) = .., now ignores SimResult::ValidateMerged results with an else { return } -- it doesn't act on them in this step.

What this PR deliberately does not do

Nothing sends a ValidateMerged request yet, and nothing consumes SimResult::ValidateMerged. BlockMergingTile isn't wired up to dispatch requests or read results back, and there's no builder-attribution/disable-switch/Discord-alert logic. That's step 3.

Tests

Written first, reviewed, then implemented against. A live end-to-end HTTP dispatch test isn't feasible here: spawn_sim/spawn_merge_sim dispatch via spawn_tracked!, which panics unless a process-global RUNTIME was already set up via init_runtime(&RelayConfig) -- a one-time, real-core-pinning init meant for actual process startup, and spawn_sim itself has no existing test either. So tests target the new, genuinely error-prone synchronous logic:

  • merged_block_to_submission_derives_bid_trace_from_payload_and_context / merged_block_to_submission_converts_appended_blobs_to_blobs_bundle: the merged-block -> synthetic-submission conversion.
  • pending_merge_requests_evicts_older_same_base_block / pending_merge_requests_keeps_existing_if_new_is_older / pending_merge_requests_next_req_returns_and_removes / pending_merge_requests_clear_empties_queue: the new queue's eviction/ordering.

just fmt-check, cargo clippy --all-features --no-deps -- -D warnings, and just test (full workspace) all pass.

Reviewer checklist

  • CI (lint, unit-test) is green
  • Matches the linked issue/step
  • No unexplained scope creep or unrelated files touched

… simulator

Merged blocks from the merge builder now get a SimRequest::ValidateMerged
path through SimulatorTile, tagged separately in SimResult so a future
consumer can distinguish it from ordinary submission validation. The
merged block is converted to a synthetic SignedBidSubmission (real
block_hash/parent_hash/gas_limit/gas_used/value/fee_recipient, zeroed
signature and builder/proposer pubkeys) so it reuses the existing
SSZ/JSON simulator dispatch. A new PendingMergeRequests queue, keyed by
base_block_hash rather than builder pubkey, gives merged-block requests
the same load-shedding behavior as ordinary submissions.

Nothing consumes SimResult::ValidateMerged yet -- BlockMergingTile isn't
wired up to send requests or read results. That's the next step.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@0w3n-d
0w3n-d force-pushed the od/merged_block_sim_step2 branch from f5ecb03 to 38d7f87 Compare August 25, 2026 12:58
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.

1 participant