Skip to main content

verify

Function verify 

Source
pub fn verify(path: &Utf8Path) -> Result<VerifyReport, LogError>
Expand description

Verify the entire log file at path.

Returns Ok(VerifyReport) regardless of whether the chain validates; callers inspect report.errors.is_empty() to determine pass/fail. Returns Err only when the file itself cannot be opened or read at the I/O level.

Behavior:

  • A missing file is treated as a clean, empty log (no tampering possible on bytes that don’t exist) and returns an empty report after a warn!.
  • Empty / blank lines are skipped — they are not data per the writer’s on-disk format (PROVENANCE_LOG.md §2).
  • On a row that fails to parse as LogRow, a ParseError is recorded and verification continues on the next line. The chain anchor does NOT advance through an unparsable row, so the next valid row’s prev_hash is checked against the last successfully parsed row (or against "GENESIS" if no valid row has been seen yet).
  • A prev_hash == "GENESIS" sentinel marks a chain restart (first row of a fresh / rotated log per §6) and resets the ts_seq monotonicity anchor — ts_seq is NOT compared to the prior row across a restart.