Add admin-toggled block_merging_enabled kill switch - #502
Open
0w3n-d wants to merge 1 commit into
Open
Conversation
This was referenced Aug 25, 2026
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>
0w3n-d
force-pushed
the
od/merged_block_sim
branch
from
August 25, 2026 12:58
ad2bd4a to
9d948ac
Compare
3 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 1 of 4)
What this PR does
Adds a
block_merging_enabled: Arc<AtomicBool>flag (seeded fromconfig.block_merging_config.is_enabled), owned alongsideBlockMergingTileand toggled via newPOST/DELETE /admin/v1/block-mergingadmin routes, mirroring the existing/admin/v1/killswitchpattern. While disabled, the tile never dials the merge builder and force-disconnects any active connection (re-disconnecting on every subsequent reconnect attempt, since the underlyingTcpConnectorauto-reconnects outbound connections and has no permanent-remove API)./admin/v1/statusnow also reportsblock_merging_enabled.What this PR deliberately does not do
No simulation wiring. This step only adds the admin-toggled kill switch and the tile's reaction to it — merged blocks still forward to the auctioneer exactly as before. Simulating merged blocks, attributing failures to the builder, and tripping this flag automatically are later steps (#500).
Tests
Written first, reviewed, then implemented against:
crates/relay/src/block_merging/tile.rs: unit tests over the extracted pure gating functionsshould_dial/should_force_disconnect, covering all four(enabled, has_token)combinations.crates/relay/src/api/admin_service.rs:test_admin_service_block_merging, mirroring the existingtest_admin_service/test_admin_service_merged_headerspattern.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, a timing-sensitive test unrelated to this change) intermittently fails under parallel test-thread contention but passes in isolation.Reviewer checklist
lint,unit-test) is green