Wire block-merging re-enable into the admin portal - #513
Open
0w3n-d wants to merge 4 commits into
Open
Conversation
Gates BlockMergingTile's dial/reconnect on a new admin-toggled flag, mirroring the existing killswitch pattern. While disabled, the tile never dials and force-disconnects any active merge builder connection. No simulation wiring yet — that's a later step. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… 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>
…ble failures BlockMergingTile now sends every accepted merged block to the simulator via SimRequest::ValidateMerged, in addition to (not instead of) its existing immediate forward to the auctioneer -- the serving path is unchanged. The tile becomes a consumer of from_sim (already MPMC per spine-derive's defaults, confirmed no queue-declaration change needed) and filters for its own tagged SimResult::ValidateMerged results, ignoring the auctioneer's ordinary submission-validation results on the same queue. On a builder-attributable failure, block merging is disabled -- which alone triggers the existing force-disconnect gating from the previous step, so no separate disconnect call is needed -- and a critical Discord alert fires with the block hash, merge builder endpoint, and reason. "Builder-attributable" reuses BlockSimError::is_demotable() (the same logic used for bid-submission builder demotion) but additionally excludes internal channel/queue failures (SendError, SimulationDropped, HydrationMiss), which are relay/simulator-side infra hiccups rather than anything the merge builder did wrong. Temporary/infra errors and successes take no action. Nothing except the admin endpoint from the first step ever re-enables merging. SlotState gains registered_gas_limit/apply_blacklist/inclusion_list, captured from the same validator-registration and slot-event data that already feeds fee_recipient, to build each merged block's simulation request context. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds a block_merging_enabled toggle to the admin portal, mirroring the existing kill-switch pattern end to end: RelayAdminClient gains set_block_merging()/a block_merging_enabled status field, a proxied /api/v1/actions/block-merging route, and a Settings page toggle with confirmation dialogs plus an Overview status tile. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue: #500 (step 4 of 4 -- last step)
Base branch:
od/merged_block_sim_step3(step 3, #508) -- stacked per CONTRIBUTING.md, not yet merged. Diff will shrink as earlier steps merge and this retargets down towarddevelop.What this PR does
Wires the relay's
/admin/v1/block-mergingroute (added in #502) into the admin portal, end to end, mirroring the existing kill-switch pattern exactly (this crate had zero bespoke proxy wrapping for it before -- confirmed no generic admin-route proxy exists incrates/admin, so this needed the same bespoke client method + handler + route as every other admin action here):RelayAdminClientgainsblock_merging_enabledonRelayAdminStatusand aset_block_merging(enabled)method.handlers.rsgainsenable_block_merging/disable_block_merging(proxying to the relay) andoverview()/OverviewResponsegainblock_merging_enabled: Option<bool>(Nonewhen the relay admin API is unreachable, same convention askill_switch_enabled).service.rsgains the/api/v1/actions/block-mergingroute.ConfirmDialogs, mirroring the kill-switch block) and a status tile on the Overview page.What this PR deliberately does not do
Nothing else changes in the disable/re-enable logic itself (#508 already covers when/why merging gets disabled) -- this is purely portal wiring so an admin doesn't have to hit the relay's raw HTTP API by hand to re-enable it.
Tests
Written first, reviewed, then implemented against. This crate (
helix-admin) has no test coverage today --enable_kill_switch/disable_kill_switchand siblings are all untested. Rather than add a new dependency (e.g. httpmock) to testRelayAdminClient, a small in-process axum server standing in for the relay's admin API (axum is already a dependency) is spun up on an OS-assigned ephemeral port:set_block_merging_toggles_and_status_reflects_it: exercises the client's URL/method construction and status-field parsing end to end against the fake relay.The handler/route wiring itself is a one-line proxy call, same as its untested siblings, so no new test pattern was introduced there -- consistent with existing precedent in this crate.
Frontend:
tsc --noEmitandvite buildboth pass; this crate has no eslint config to run.just fmt-check,cargo clippy --all-features --no-deps -- -D warnings, andjust test(full workspace) all pass. One unrelated pre-existing flaky test (helix-types::clock::test_duration_into_slot) intermittently fails under parallel test-thread contention but passes in isolation.Reviewer checklist
lint,unit-test) is green