Skip to content

Add configurable validation bypassing for get_header and submit_block#469

Open
JasonVranek wants to merge 4 commits into
pr/ssz-submit-blockfrom
pr/validation-bypassing
Open

Add configurable validation bypassing for get_header and submit_block#469
JasonVranek wants to merge 4 commits into
pr/ssz-submit-blockfrom
pr/validation-bypassing

Conversation

@JasonVranek

Copy link
Copy Markdown
Collaborator

Summary

Adds HeaderValidationMode and BlockValidationMode configuration options, allowing operators to trade validation thoroughness for latency.

Validation modes

Header (get_header):

  • none — skip decoding and crypto checks, extract only fork + bid value, forward raw relay response bytes directly to the beacon node
  • standard — full structural validation, signature verification, and fork checks (default)
  • extra — standard + parent block validation via execution layer RPC (requires rpc_url)

Block (submit_block):

  • none — skip decoding and validation, forward raw relay response directly
  • standard — full validation including block hash and KZG commitment checks (default)

What's in this PR

  • HeaderValidationMode and BlockValidationMode enums in config
  • CompoundGetHeaderResponse / CompoundSubmitBlockResponse types handling full vs light processing
  • LightGetHeaderResponse / LightSubmitBlockResponse for the none path
  • Updated BuilderApi trait signatures to use compound response types
  • Config documentation and example updates
  • Comprehensive tests for all validation modes

Review notes

The none mode is designed for operators who fully trust their relay fleet and want minimum latency on the critical path. The response bytes are forwarded without deserialization, so any relay misbehavior (wrong fork, invalid signatures) will not be caught by the sidecar.

Part 4 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
Introduce HeaderValidationMode and BlockValidationMode to allow
operators to trade validation thoroughness for latency:

- None: skip decoding and crypto checks, forward raw relay responses
- Standard: full validation (default, existing behavior)
- Extra: additional parent block checks via RPC (get_header only)

Includes CompoundGetHeaderResponse and CompoundSubmitBlockResponse
types to handle both full and light processing paths. Updates config,
docs, and comprehensive tests for all validation modes.
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