lambda_ethereum_consensus
lambda_ethereum_consensus copied to clipboard
[Snappy] Support stream decoding with decoded size limit
The spec says about ssz_snappy
's header:
Encoding-dependent header: Req/Resp protocols using the
ssz_snappy
encoding strategy MUST encode the length of the raw SSZ bytes, encoded as an unsigned protobuf varint.
A block request's response is basically:
[status] [edh] [encoded chunk] [status] [edh] [encoded chunk] [status] ...
edh = encoding-dependent-header
Limiting the size when decoding data that follows the edh would enable us to differentiate chunk ends from stream errors.