Documentation
¶
Overview ¶
Package commitment defines cryptographic commitment interfaces. Primitive backends in this package are restart-safe and do not rely on RAM-only state for correctness.
Package commitment defines abstract interfaces for cryptographic commitment schemes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidProof is returned when a cryptographic proof fails verification. ErrInvalidProof = errors.New("invalid proof") // ErrInvalidCommitment is returned when a commitment value is malformed or invalid. ErrInvalidCommitment = errors.New("invalid commitment") // ErrArcSetTooSmall is returned when the arc set has insufficient entries for the operation. ErrArcSetTooSmall = errors.New("arc set too small") )
Sentinel errors for commitment operations.
Functions ¶
Types ¶
type Cell ¶
type Cell []byte
Cell is the opaque, canonically encoded value authenticated at one index. Semantic layers decide how to encode their state into cells; primitive backends only authenticate the resulting bytes.
func CellFromCID ¶
CellFromCID encodes a CID-valued slot as a commitment cell.
func ExtractSortedPathsCells ¶
ExtractSortedPathsCells extracts sorted paths and cell-encoded values from an arc set. CID-valued arcs are encoded as CID bytes.
type IndexCommitment ¶
type IndexCommitment interface {
// MaxValues returns the maximum number of authenticated values per root.
MaxValues() int
// Commit generates a commitment to a stable indexed cell vector.
Commit(values []Cell) (cid.Cid, error)
// Prove generates a proof for one index and returns the proved cell.
Prove(values []Cell, index uint64) (root cid.Cid, value Cell, proof []byte, err error)
// BatchProve generates one proof payload for an ordered index list and
// returns the proved cells in the same order as indices.
BatchProve(values []Cell, indices []uint64) (root cid.Cid, proved []Cell, proof []byte, err error)
// VerifyIndex verifies a proof for one index against the expected cell.
VerifyIndex(root cid.Cid, index uint64, value Cell, proof []byte) (bool, error)
// BatchVerify verifies a proof payload for an ordered index list against
// the expected cells in the same order as indices.
BatchVerify(root cid.Cid, indices []uint64, values []Cell, proof []byte) (bool, error)
// VerifyProof verifies a proof that already carries its own index metadata.
VerifyProof(root cid.Cid, value Cell, proof []byte) (bool, error)
// Replace performs an index-stable replacement and returns the new root.
Replace(values []Cell, index uint64, oldValue, newValue Cell) (cid.Cid, error)
}
IndexCommitment is the semantic-neutral primitive interface for index-addressed authenticated values.