Skip to content

Rewrite submit_block relay communication to support SSZ and JSON#468

Merged
JasonVranek merged 7 commits into
mainfrom
pr/ssz-submit-block
Jul 24, 2026
Merged

Rewrite submit_block relay communication to support SSZ and JSON#468
JasonVranek merged 7 commits into
mainfrom
pr/ssz-submit-block

Conversation

@JasonVranek

Copy link
Copy Markdown
Collaborator

Summary

Rewrites submit_block relay communication to support SSZ and JSON content negotiation.

What's in this PR

  • SSZ-first request encoding with automatic JSON fallback on 406/415 (per builder-spec)
  • Content-Type and Eth-Consensus-Version header handling for submit_block
  • Fork-aware SSZ decoding for relay responses
  • v2→v1 fallback now forwards the v1 payload to the beacon node instead of returning an empty 202 (prevents silent block loss)
  • V2_FALLBACK_TO_V1 metric counter for observability
  • Submit_block integration tests covering SSZ/JSON encoding, v1/v2 paths, and fallback behavior

Review notes

The v2→v1 fallback behavior is an intentional change from the previous code which silently discarded the v1 payload. The beacon node needs the unblinded execution payload to broadcast the block (returning an empty 202 on fallback would cause silent block loss).

Part 3 of 4: SSZ types → get_header → submit_block → validation bypassing

Attribution

This work builds on the SSZ builder flow originally implemented by @eserilev
in #252 and ported to the current codebase by @jclapis in #403.

Co-authored-by: Eitan Seri-Levi eserilev@ucsc.edu
Co-authored-by: Joe Clapis jclapis@outlook.com

@JasonVranek
JasonVranek force-pushed the pr/ssz-routes branch 2 times, most recently from c800921 to cbf451d Compare June 2, 2026 03:30
@JasonVranek
JasonVranek force-pushed the pr/ssz-submit-block branch from d468365 to 3740824 Compare July 10, 2026 20:23
Base automatically changed from pr/ssz-routes to main July 10, 2026 22:20
@JasonVranek
JasonVranek requested a review from a team July 10, 2026 22:20
@JasonVranek
JasonVranek force-pushed the pr/ssz-submit-block branch from 3740824 to 0d76e5c Compare July 10, 2026 22:29
Comment thread crates/pbs/src/mev_boost/submit_block.rs Outdated
Comment thread crates/pbs/src/mev_boost/submit_block.rs Outdated
Comment thread crates/pbs/src/mev_boost/submit_block.rs Outdated
Comment thread crates/pbs/src/mev_boost/submit_block.rs Outdated
Comment thread crates/pbs/src/mev_boost/submit_block.rs Outdated
Comment thread crates/pbs/src/mev_boost/submit_block.rs Outdated
Comment thread crates/pbs/src/mev_boost/submit_block.rs Outdated
@JasonVranek
JasonVranek force-pushed the pr/ssz-submit-block branch from 77f7d4f to 7e7d8b7 Compare July 14, 2026 19:20
Comment thread .github/workflows/security-audit.yml Fixed
@JasonVranek
JasonVranek force-pushed the pr/ssz-submit-block branch from 7e7d8b7 to f113898 Compare July 14, 2026 19:40
Comment thread .github/workflows/security-audit.yml Fixed
@JasonVranek
JasonVranek force-pushed the pr/ssz-submit-block branch from f113898 to 5085cdf Compare July 14, 2026 21:52
ManuelBilbao
ManuelBilbao previously approved these changes Jul 14, 2026
Comment thread crates/pbs/src/mev_boost/submit_block.rs
Comment thread crates/pbs/src/mev_boost/register_validator.rs
Comment thread crates/pbs/src/mev_boost/register_validator.rs
Comment thread crates/pbs/src/mev_boost/register_validator.rs
content negotiation. Includes:
- SSZ-first request encoding with JSON fallback on 406/415
- Content-Type and Eth-Consensus-Version header handling
- Fork-aware SSZ decoding for relay responses
- MIME parameter tolerance on relay response Content-Type
- v2 to v1 fallback forwards payload to BN (prevents silent block loss)
- V2 fallback metric counter
- Comprehensive submit_block integration tests for both encodings
- L275 pass headers by ref
- L350 / L386 use content_type_header
- L508 drop redundant to_string
- bump transitive dep versions for CI
- JsonEncode error instead of unwrap() for both submit_block and
  register_validators
- json timeout budget now accounts for prior ssz attempt
…n v1-only relays

Content negotiation (Builder API):
- Missing Accept defaults the response to JSON instead of inheriting the request
  Content-Type; request and response encodings are independent.
- v2 succeeds with an empty 202 and has no body to negotiate, so it skips Accept
  entirely -- a bad Accept no longer 406s a v2 submission before it reaches a relay.
- An unrecognized request Content-Type returns 415 instead of 400.
- Always request SSZ from the relay (JSON fallback) rather than mirroring the caller's
  format: PBS decodes and re-validates the payload and the route re-encodes to the BN's
  Accept regardless, so SSZ is the fastest wire format on the relay hop.

Fail loud on v1-only relays:
- Drop the v2->v1 fallback. It returned the relay's v1 payload as a 200 body, but a v2
  caller (Lighthouse, Prysm) requires exactly 202 and never reads the body, so the block
  was silently dropped. PBS cannot publish the payload itself, so a relay that 404s v2
  now fails loud (RELAY_V2_UNSUPPORTED) and other relays still get a chance.
@JasonVranek
JasonVranek force-pushed the pr/ssz-submit-block branch from 7939e87 to a374d82 Compare July 24, 2026 21:58
@JasonVranek
JasonVranek merged commit 1188046 into main Jul 24, 2026
6 checks passed
@JasonVranek
JasonVranek deleted the pr/ssz-submit-block branch July 24, 2026 22:07
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.

6 participants