Documentation
¶
Overview ¶
Package cert provides the QuasarCertLane registration and certificate-subject binding logic shared by M-Chain and F-Chain.
The lane registry is **not** a global. Each chain constructs its own LaneRegistry at boot, registers only the verifiers it owns (M-Chain registers lanes 5..7, F-Chain registers lanes 8..9), and the substrate refuses cross-registration at runtime — a misrouted verifier fails fast.
Index ¶
- func BindSubject(r Roots) [32]byte
- func VerifySubject(claimed [32]byte, r Roots) error
- type LaneRegistry
- func (r *LaneRegistry) ClearAliases()
- func (r *LaneRegistry) Owner() Owner
- func (r *LaneRegistry) Register(v LaneVerifier) error
- func (r *LaneRegistry) RegisterLegacyAlias(legacy, modern types.CertLane) error
- func (r *LaneRegistry) Verifier(lane types.CertLane) (LaneVerifier, error)
- func (r *LaneRegistry) Verify(subject [32]byte, share types.Share, arena []byte, set *types.ParticipantSet) error
- type LaneVerifier
- type Owner
- type Roots
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BindSubject ¶
BindSubject computes certificate_subject = H(... all roots ...). The hash domain is sha256 with a 1-byte version tag (0x01 for LP-134 v3.1) so future descriptor extensions can change the input set without colliding.
func VerifySubject ¶
VerifySubject re-computes the subject from its inputs and checks it matches the value carried on the wire. Used by both M-Chain and F-Chain at certificate-ingress time.
Types ¶
type LaneRegistry ¶
type LaneRegistry struct {
// contains filtered or unexported fields
}
LaneRegistry holds the verifier dispatch table for one chain.
One registry per chain process. Constructed at boot, written during boot, read-only thereafter. No locks needed: registrations happen serially before the chain starts accepting blocks.
func NewRegistry ¶
func NewRegistry(owner Owner) *LaneRegistry
NewRegistry constructs a registry owned by the given chain.
func (*LaneRegistry) ClearAliases ¶
func (r *LaneRegistry) ClearAliases()
ClearAliases removes all legacy aliases. Called by the host at the end of the grace epoch.
func (*LaneRegistry) Owner ¶
func (r *LaneRegistry) Owner() Owner
Owner reports which chain owns this registry. Used by tests and boot-time sanity checks.
func (*LaneRegistry) Register ¶
func (r *LaneRegistry) Register(v LaneVerifier) error
Register adds a verifier to the registry. Returns an error if the lane does not belong to the registry's owner — this enforces M/F orthogonality at the type level.
func (*LaneRegistry) RegisterLegacyAlias ¶
func (r *LaneRegistry) RegisterLegacyAlias(legacy, modern types.CertLane) error
RegisterLegacyAlias maps a legacy LP-5013 T-Chain lane to the modern M/F lane during the grace window. After the window closes, the host calls ClearAliases() and any legacy share is rejected.
func (*LaneRegistry) Verifier ¶
func (r *LaneRegistry) Verifier(lane types.CertLane) (LaneVerifier, error)
Verifier resolves a lane (including grace-window aliases) to its verifier. Returns an error if no verifier is registered.
func (*LaneRegistry) Verify ¶
func (r *LaneRegistry) Verify(subject [32]byte, share types.Share, arena []byte, set *types.ParticipantSet) error
Verify dispatches a share to its lane verifier. Convenience wrapper for the chain runtime — validates the share envelope, extracts the payload window, and calls the verifier.
type LaneVerifier ¶
type LaneVerifier interface {
// Lane returns the lane identifier this verifier handles.
Lane() types.CertLane
// Verify validates a share's payload against the certificate
// subject. The payload was extracted via Share.PayloadFrom on
// the ceremony's PayloadArena.
Verify(subject [32]byte, share types.Share, payload []byte) error
}
LaneVerifier is the contract a chain implements to validate shares on a given cert lane. Verifiers are stateless with respect to the substrate; any mutable state lives in the chain's own runtime.
type Owner ¶
type Owner uint8
Owner identifies which operational chain owns a lane registry. The substrate uses Owner to enforce orthogonality: an M-Chain registry refuses F-Chain lanes and vice versa.
type Roots ¶
type Roots struct {
ParentBlock [32]byte
StateRoot [32]byte
ExecRoot [32]byte
PChainValidator [32]byte
QChainCeremony [32]byte
ZChainVK [32]byte
AChainAttestation [32]byte
BChainBridge [32]byte
MChainCeremony [32]byte
FChainFHE [32]byte
}
Roots is the set of upstream roots a Quasar 3.0 certificate_subject binds, mirroring the QuasarRoundDescriptor in LP-134.
All seven roots are required, including both MChain and FChain — this is the structural property that makes cross-chain replay impossible. The substrate does not let a caller skip a root: a zero value is still a value, and the chain that owns the root is expected to provide its current root on every round.
func (Roots) RequireBothChains ¶
RequireBothChains reports an error if either MChainCeremony or FChainFHE is zero — the LP-134 invariant that every round binds **both** chain roots, even on rounds where one chain does not finalize a ceremony (the unchanged root from the previous round satisfies the binding).