Documentation
¶
Overview ¶
Package runtime defines the adapter contracts the host chains (M-Chain and F-Chain) implement to plug into the ThresholdVM substrate.
The substrate calls into adapters; adapters never call into the substrate. This is the orthogonality boundary at the type level: MChainAdapter exposes only MPC hooks, FChainAdapter exposes only FHE hooks. A chain that implements both interfaces is a configuration error.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FChainAdapter ¶
type FChainAdapter interface {
// Selector returns the F-Chain participant selector. Stake-weighted
// over P-Chain stake delegated to F-Chain. GPU operators
// self-select by delegating here rather than to M-Chain.
Selector() types.Selector
// Registry returns the F-Chain LaneRegistry. Must be owned by
// OwnerFChain and have verifiers for LaneFChainTFHE,
// LaneFChainBootstrap registered.
Registry() *cert.LaneRegistry
// FHERoot returns fchain_fhe_root at the current epoch. Bound
// into certificate_subject alongside mchain_ceremony_root.
FHERoot(ctx context.Context, epoch uint64) ([32]byte, error)
// OnBootstrapHandoff is called by the substrate when M-Chain
// finalizes a KindTFHEKeygen ceremony and hands off the bootstrap
// key. F-Chain re-verifies under the M-Chain ceremony root and
// installs the key.
OnBootstrapHandoff(ctx context.Context, mchainSubject [32]byte, proof types.Proof) error
// OnEval is called for a TFHE compute ceremony. The participant
// set is the F-Chain GPU operators selected by VRF.
OnEval(ctx context.Context, ceremony types.Ceremony, set *types.ParticipantSet) error
// OnFinalize emits the finalized cert artifact onto Quasar 3.0's
// CertLane and advances fchain_fhe_root.
OnFinalize(ctx context.Context, ceremony types.Ceremony, proof types.Proof) error
}
FChainAdapter is the contract F-Chain implements. Same state machine as M-Chain, different hooks: F-Chain consumes upstream MPC outputs and emits FHE compute attestations.
type MChainAdapter ¶
type MChainAdapter interface {
// Selector returns the M-Chain participant selector. Stake-weighted
// VRF over P-Chain stake delegated to M-Chain.
Selector() types.Selector
// Registry returns the M-Chain LaneRegistry. Must be owned by
// OwnerMChain and have verifiers for LaneMChainCGGMP21,
// LaneMChainFROST, LaneMChainCoronaGen registered.
Registry() *cert.LaneRegistry
// CeremonyRoot returns mchain_ceremony_root at the current epoch.
// Bound into certificate_subject by Quasar 3.0.
CeremonyRoot(ctx context.Context, epoch uint64) ([32]byte, error)
// OnDKG is called by the substrate when a new DKG ceremony enters
// StateRegistered. M-Chain persists the participant set and
// allocates the payload arena.
OnDKG(ctx context.Context, ceremony types.Ceremony, set *types.ParticipantSet) error
// OnSign is called for a signing ceremony. Same shape as OnDKG;
// distinguished only by Ceremony.Kind.
OnSign(ctx context.Context, ceremony types.Ceremony, set *types.ParticipantSet) error
// new participant set replaces the old one atomically at
// finalize.
OnReshare(ctx context.Context, ceremony types.Ceremony, oldSet, newSet *types.ParticipantSet) error
// OnFinalize emits the finalized cert artifact onto Quasar 3.0's
// CertLane and advances mchain_ceremony_root. If the ceremony's
// kind is KindTFHEKeygen, the proof is also handed off to F-Chain
// via the cross-chain envelope.
OnFinalize(ctx context.Context, ceremony types.Ceremony, proof types.Proof) error
}
MChainAdapter is the contract M-Chain implements. The substrate drives ceremonies by calling these hooks; M-Chain provides the validator-set selection, persistence, and cert-emission.