Skip to content

Rewrite submit_block relay communication to support SSZ and JSON#468

Open
JasonVranek wants to merge 3 commits into
pr/ssz-routesfrom
pr/ssz-submit-block
Open

Rewrite submit_block relay communication to support SSZ and JSON#468
JasonVranek wants to merge 3 commits into
pr/ssz-routesfrom
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

Introduce EncodingType, AcceptedEncodings, and content negotiation
primitives for SSZ support in the PBS pipeline. Includes:

- EncodingType enum with FromStr/Display and MIME param tolerance
- AcceptedEncodings with q-value aware Accept header parsing
- SSZ bid value extraction from SignedBuilderBid by fork
- deserialize_body and parse_response_encoding_and_fork helpers
- Per-fork type aliases for BuilderBid and ExecutionPayloadHeader
- SszValueError, PbsError::GeneralRequest, PbsClientError variants
- Comprehensive unit tests for all new types and helpers
- New deps: headers-accept, mediatype
content negotiation. Includes:

- SSZ and JSON encoding/decoding for relay get_header responses
- Content-Type and Eth-Consensus-Version header parsing
- Accept header forwarding to relays with q-value ordering
- MIME parameter tolerance on relay response Content-Type
- Fork-aware SSZ bid value extraction for all supported forks
- Mock relay and validator SSZ support in test infrastructure
- get_header integration tests for both encodings
- Dynamic port allocation in tests via get_free_listener
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
@JasonVranek JasonVranek force-pushed the pr/ssz-routes branch 2 times, most recently from c800921 to cbf451d Compare June 2, 2026 03:30
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