Skip to main content

encode_verified_range

Function encode_verified_range 

Source
pub fn encode_verified_range(
    root: [u8; 32],
    aligned: &AlignedRange,
    range_data: &[u8],
    outboard: Bytes,
) -> Result<Bytes, RangeVerifyError>
Expand description

Verify range_data (covering aligned.fetch_start..aligned.fetch_end) and the supplied pre-order outboard against the wanted root root, returning the bao interleaved encoding for aligned.chunk_ranges — ready for Blobs::import_bao_bytes(root, aligned.chunk_ranges, _).

The outboard is untrusted: verification anchors every chunk group to root, so a tampered range, a foreign/tampered outboard, or a wrong root all fail with RangeVerifyError::Verification — there is no trusted-origin path.

§Errors