Serve the SSZ validation routes from the simulation role - #543
Open
0w3n-d wants to merge 1 commit into
Open
Conversation
/validate and /validate_merged decode the relay's SSZ requests, run the validator on a blocking thread under a semaphore, and answer 200 or 400 with the reason. A dehydrated submission answers 424 so the relay retries with full bytes. The disallow list refreshes from the configured endpoint. main now builds the validator and spawns both, so the module no longer needs allow(dead_code). Drops rpc_addr: no JSON-RPC is served, and an unused config field is a trap. The relay reaches this role through its simulator ssz_url. Step 9 of #527. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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: #527 (step 9 of 10)
Base branch:
od/builder-sim-blobs-step8(#536, step 8). Retarget as the stackmerges.
What this PR does
The simulation role now serves traffic.
/validateand/validate_mergedaccept the relay's
SszValidationRequestandSszMergedValidationRequestunchanged, decode the submission through
helix-common's decoder, and answer:200when the block validates;400with the reason, which is what the relay classifies on;424for a dehydrated submission, so the relay retries with full SSZ bytesrather than treating it as a validation failure;
500if a validation task panics.Validation is synchronous CPU work, so it runs on a blocking thread under a
semaphore sized by
max_concurrent_validations. The disallow list refreshesfrom
blacklist_endpointevery five minutes.mainbuilds theBlockValidatorand spawns both, so the module no longercarries
allow(dead_code).What this PR deliberately does not do
No JSON-RPC. Only the SSZ routes are served, so the relay must have
ssz_urlset for this simulator. The JSON path would need a second conversionfrom
JsonValidationRequest's helix-types payload, and SSZ is the path therelay actually prefers.
rpc_addris therefore removed fromSimulationConfig— an unused config field is worse than an absent one.Serving JSON-RPC can be a follow-up if a deployment needs it.
The 424 path is untested.
DehydratedBidSubmissionFuluhas private fieldsand no test constructor, so a dehydrated submission cannot be built from this
crate. The arm is two lines and mirrors the reth simulator; testing it needs a
test-only constructor in
helix-types, which I left out of this step.Things worth knowing
not elided and tokio's 2 MiB worker stack overflows; release passes. The blob
wire-format test therefore runs on a 32 MiB thread, and
eblobsfills itsvector in place rather than collecting through an iterator. Production runs
release, so this is not a runtime concern, but a
debug_assertionsbuild ofthis role would need a larger stack.
blacklist_endpointis unreachable at boot, regional-filtering proposers getunfiltered blocks until a fetch succeeds. The reth simulator behaves the same
way, so this is not a regression, but it is worth knowing operationally.
Tests
Written first and signed off before implementation. 9 new, 89 in the crate:
relay can read.
base_payment_tx_indexandthe last transaction.
apply_blacklistdecides the answer: the same block is rejectedwith it set and accepted without, which pins the flag's plumbing end to end.
unchanged list reports nothing.
Smoke-tested on the binary: it binds
0.0.0.0:8552, logsValidation server listening, and the refresh task runs on the first tick.just fmt-check,just testandcargo clippy --all-features --no-deps -- -D warningsare clean.
Reviewer checklist
lint,unit-test) is green