PR #28 adds the trailing-bytes drain only on the SSZ-decode arm of upgrade_inbound. The five zero-payload arms (MetaDataV1/V2/V3, LightClientOptimisticUpdateV1, LightClientFinalityUpdateV1) return early, so a peer can still send arbitrary bytes after the protocol prefix on those streams and we accept the request.
Fix: same drain as PR #28, hoisted into a helper around all six arms. Test: a MetaDataV2-with-trailing-bytes variant of test_framed_read_yields_extra_chunk_when_trailing_bytes.
Deferred from #28 to keep that PR small.
PR #28 adds the trailing-bytes drain only on the SSZ-decode arm of
upgrade_inbound. The five zero-payload arms (MetaDataV1/V2/V3,LightClientOptimisticUpdateV1,LightClientFinalityUpdateV1) return early, so a peer can still send arbitrary bytes after the protocol prefix on those streams and we accept the request.Fix: same drain as PR #28, hoisted into a helper around all six arms. Test: a
MetaDataV2-with-trailing-bytes variant oftest_framed_read_yields_extra_chunk_when_trailing_bytes.Deferred from #28 to keep that PR small.