Skip to main content

matches_commitment

Function matches_commitment 

Source
pub(crate) fn matches_commitment(
    view: ViewNumber,
    param: &AvidmGf2Param,
    ns_table: &[u8],
    payload: &[u8],
    payload_commitment: &VidCommitment2,
) -> bool
Expand description

Whether payload is what payload_commitment commits to, sliced by the header’s namespace table ns_table.

The commitment covers each namespace’s bytes but not the table, and parse_ns_table substitutes one namespace spanning the payload for a table sized for another payload. For a one-namespace block that substitute is the honest table, so a header claiming a shorter or longer payload would recommit to the same bytes and decide with a table that misdescribes them. Refuse such a table instead: it must be sized for payload, or be no table at all, which the disperser also reads as one namespace.