mirror of
https://github.com/luxfi/chains.git
synced 2026-07-27 03:39:41 +00:00
TestConsciousBlocks + cmd/conscious drive the REAL aivm ChainVM: block 1 (perception) imports a committed C-intent -> binds a staked operator committee under consensus; block 2 (cognition) commits the quorum-settled canonical AI decision (Proof-of-Thought) + receipt_root. Heights chain 0->1->2, canonical decision + receipt_root deterministic across runs. Added VM.FundLedger (node-internal genesis seam, fail-closed on non-MemLedger), MemLedger.Credit, Engine.TaskForIntent. 69 aivm tests green, -race clean.
62 lines
3.6 KiB
Go
62 lines
3.6 KiB
Go
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package aivm
|
|
|
|
import "errors"
|
|
|
|
// Engine errors. Every one is a hard failure that leaves state unchanged
|
|
// (fail-closed): a rejected operation makes NO write. Grouped by phase so the
|
|
// surface is auditable in one place.
|
|
var (
|
|
// registry / stake
|
|
ErrEmptyModelSpec = errors.New("aivm/quorum: empty model spec hash")
|
|
ErrStakeBelowMin = errors.New("aivm/quorum: stake below MinProviderBond")
|
|
ErrOperatorExists = errors.New("aivm/quorum: operator already registered")
|
|
ErrOperatorUnknown = errors.New("aivm/quorum: operator not registered")
|
|
ErrOperatorUnbonding = errors.New("aivm/quorum: operator is unbonding")
|
|
ErrCooldownActive = errors.New("aivm/quorum: unbond cooldown not elapsed")
|
|
|
|
// custody / conservation
|
|
ErrInsufficientFunds = errors.New("aivm/quorum: insufficient balance")
|
|
ErrLedgerNotFundable = errors.New("aivm/quorum: ledger does not support genesis funding")
|
|
ErrEscrowUnderflow = errors.New("aivm/quorum: escrow underflow (invariant broken)")
|
|
ErrStakeOverflow = errors.New("aivm/quorum: stake overflow")
|
|
ErrCreditOverflow = errors.New("aivm/quorum: credit overflow")
|
|
ErrRewardOverflow = errors.New("aivm/quorum: reward escrow overflow")
|
|
ErrFeeOverflow = errors.New("aivm/quorum: request fee overflow")
|
|
ErrNoCredit = errors.New("aivm/quorum: no credit to withdraw")
|
|
|
|
// task params / selection
|
|
ErrEmptyPromptHash = errors.New("aivm/quorum: empty prompt hash")
|
|
ErrBadN = errors.New("aivm/quorum: N out of range [minN, maxN]")
|
|
ErrBadThreshold = errors.New("aivm/quorum: threshold must satisfy floor(N/2)+1 <= threshold <= N")
|
|
ErrNotEnoughEligible = errors.New("aivm/quorum: fewer eligible operators than N")
|
|
ErrEligibleBelowMargin = errors.New("aivm/quorum: eligible operator set below N + required margin")
|
|
|
|
// task lifecycle
|
|
ErrTaskUnknown = errors.New("aivm/quorum: task not found")
|
|
ErrTaskNotCommitting = errors.New("aivm/quorum: task not in committing state")
|
|
ErrTaskAlreadySettled = errors.New("aivm/quorum: task already settled")
|
|
ErrNotSelected = errors.New("aivm/quorum: operator not selected for task")
|
|
ErrCommitClosed = errors.New("aivm/quorum: commit window closed")
|
|
ErrAlreadyCommitted = errors.New("aivm/quorum: operator already committed")
|
|
ErrNotCommitted = errors.New("aivm/quorum: operator did not commit")
|
|
ErrRevealNotOpen = errors.New("aivm/quorum: reveal window not open")
|
|
ErrRevealClosed = errors.New("aivm/quorum: reveal window closed")
|
|
ErrAlreadyRevealed = errors.New("aivm/quorum: operator already revealed")
|
|
ErrCommitMismatch = errors.New("aivm/quorum: reveal does not match commit")
|
|
ErrEmptyCommit = errors.New("aivm/quorum: empty commit hash")
|
|
ErrEmptyOutputHash = errors.New("aivm/quorum: empty output hash")
|
|
ErrSettleTooEarly = errors.New("aivm/quorum: reveal window not closed")
|
|
|
|
// cross-chain seam
|
|
ErrIntentNilAmount = errors.New("aivm/quorum: C-chain intent has a nil fee or reward amount")
|
|
ErrIntentIDMismatch = errors.New("aivm/quorum: recomputed intent_id does not match delivered id (forged/tampered intent)")
|
|
ErrIntentNotCommitted = errors.New("aivm/quorum: C-chain intent is not committed (proof rejected)")
|
|
ErrIntentAlreadyUsed = errors.New("aivm/quorum: C-chain intent already consumed (replay)")
|
|
ErrReceiptNotFound = errors.New("aivm/quorum: no settled receipt for intent")
|
|
ErrProofOutOfRange = errors.New("aivm/quorum: receipt index out of range")
|
|
ErrReceiptRootMismatch = errors.New("aivm/quorum: block receipt_root does not match re-derived engine state")
|
|
)
|