Skip to main content

Module commitment_chain

Module commitment_chain 

Source
Expand description

Commitment Chain Verification

Walks a chain of commitments from present back to genesis, verifying that each commitment’s previous_commitment field matches the hash of the prior commitment.

§Overview

Each commitment in a contract’s history references the previous commitment via its previous_commitment field. This forms a hash chain:

Genesis Commitment (previous_commitment = 0)
  ↓ hash
Commitment 1 (previous_commitment = hash(genesis))
  ↓ hash
Commitment 2 (previous_commitment = hash(commitment_1))
  ↓ hash
Latest Commitment

The commitment chain walker verifies:

  1. Each commitment’s previous_commitment matches the hash of the prior commitment
  2. The chain traces back to a genesis commitment (previous_commitment = zero hash)
  3. No commitments are missing in the sequence
  4. All commitments belong to the same contract (contract_id consistency)

Structs§

ChainVerificationResult
Result of commitment chain verification.

Enums§

ChainError
Errors that can occur during commitment chain verification.

Functions§

verify_commitment_chain
Verifies a commitment chain from a collection of commitments.
verify_commitment_link
Computes the expected hash of the previous commitment given a commitment.
verify_ordered_commitment_chain
Verifies a pre-ordered commitment chain.