lambda_ethereum_consensus icon indicating copy to clipboard operation
lambda_ethereum_consensus copied to clipboard

[Snappy] Support stream decoding with decoded size limit

Open MegaRedHand opened this issue 1 year ago • 0 comments

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.

MegaRedHand avatar Oct 19 '23 14:10 MegaRedHand