Skip to content

perf(pbs): always request SSZ from relays on get_header#481

Open
JasonVranek wants to merge 8 commits into
mainfrom
pr/get-header-always-ssz
Open

perf(pbs): always request SSZ from relays on get_header#481
JasonVranek wants to merge 8 commits into
mainfrom
pr/get-header-always-ssz

Conversation

@JasonVranek

Copy link
Copy Markdown
Collaborator

PBS decodes and validates every relay bid and the route re-encodes the winning bid to the beacon node's Accept regardless, so the relay->PBS wire format never changes what the BN receives. Always request SSZ (JSON fallback) instead of mirroring the caller's format: SSZ is smaller on the wire and faster to decode, which matters across N relay bids on the proposal critical path. Mirrors the same change already made to submit_block.

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.
PBS decodes and validates every relay bid and the route re-encodes the winning
bid to the beacon node's Accept regardless, so the relay->PBS wire format never
changes what the BN receives. Always request SSZ (JSON fallback) instead of
mirroring the caller's format: SSZ is smaller on the wire and faster to decode,
which matters across N relay bids on the proposal critical path. Mirrors the
same change already made to submit_block.

Adds a test asserting the relay receives an SSZ-first Accept regardless of the
BN's preference (the mock relay now records the Accept it was sent), and updates
the now-stale build_outbound_accept doc comment.
@JasonVranek
JasonVranek force-pushed the pr/ssz-submit-block branch from 7939e87 to a374d82 Compare July 24, 2026 21:58
Base automatically changed from pr/ssz-submit-block to main July 24, 2026 22:07
@JasonVranek
JasonVranek requested a review from a team 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.

1 participant