Documentation
¶
Index ¶
- Constants
- func ChallengeIndexInvariant(k Keeper) sdk.Invariant
- func EntitlementPoolInvariant(k Keeper) sdk.Invariant
- func EpochSpentInvariant(k Keeper) sdk.Invariant
- func GasCreditConservationInvariant(k Keeper) sdk.Invariant
- func NewMsgServerImpl(k Keeper) types.MsgServer
- func OneSettlementInvariant(k Keeper) sdk.Invariant
- func OpenBudgetPoolInvariant(k Keeper) sdk.Invariant
- func OpenChallengeEscrowInvariant(k Keeper) sdk.Invariant
- func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
- func SettlementAttestationInvariant(k Keeper) sdk.Invariant
- type ChallengeIndexState
- type Keeper
- func (k Keeper) Application(goCtx context.Context, req *types.QueryApplicationRequest) (*types.QueryApplicationResponse, error)
- func (k Keeper) Applications(goCtx context.Context, req *types.QueryApplicationsRequest) (*types.QueryApplicationsResponse, error)
- func (k Keeper) Attestation(goCtx context.Context, req *types.QueryAttestationRequest) (*types.QueryAttestationResponse, error)
- func (k Keeper) Attestations(goCtx context.Context, req *types.QueryAttestationsRequest) (*types.QueryAttestationsResponse, error)
- func (k Keeper) AutoConsumeForTx(ctx sdk.Context, feePayer sdk.AccAddress, gasUsed uint64, sourceTxHash []byte) error
- func (k Keeper) BackfillChallengeIndexes(ctx sdk.Context) (int, error)
- func (k Keeper) Candidate(goCtx context.Context, req *types.QueryCandidateRequest) (*types.QueryCandidateResponse, error)
- func (k Keeper) Challenge(goCtx context.Context, req *types.QueryChallengeRequest) (*types.QueryChallengeResponse, error)
- func (k Keeper) ChallengeIndexesReady(ctx sdk.Context) bool
- func (k Keeper) ConsumeGasCredit(ctx sdk.Context, appID []byte, gasPayer string, amount string, ...) (remaining string, err error)
- func (k Keeper) DeleteGasPayerIndex(ctx sdk.Context, payer string)
- func (k Keeper) DeleteOpenChallengeIndex(ctx sdk.Context, appID []byte, epoch, challengeID uint64)
- func (k Keeper) DeleteOpenEntitlementChallenge(ctx sdk.Context, entitlementID, challenger string)
- func (k Keeper) EnsureChallengeIndexes(ctx sdk.Context) int
- func (k Keeper) Entitlement(goCtx context.Context, req *types.QueryEntitlementRequest) (*types.QueryEntitlementResponse, error)
- func (k Keeper) EntitlementChallenge(goCtx context.Context, req *types.QueryEntitlementChallengeRequest) (*types.QueryEntitlementChallengeResponse, error)
- func (k Keeper) EntitlementChallenges(goCtx context.Context, req *types.QueryEntitlementChallengesRequest) (*types.QueryEntitlementChallengesResponse, error)
- func (k Keeper) EntitlementsByApp(goCtx context.Context, req *types.QueryEntitlementsByAppRequest) (*types.QueryEntitlementsByAppResponse, error)
- func (k Keeper) EpochBudget(goCtx context.Context, req *types.QueryEpochBudgetRequest) (*types.QueryEpochBudgetResponse, error)
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) GasCredit(goCtx context.Context, req *types.QueryGasCreditRequest) (*types.QueryGasCreditResponse, error)
- func (k Keeper) GasCreditConsumptions(goCtx context.Context, req *types.QueryGasCreditConsumptionsRequest) (*types.QueryGasCreditConsumptionsResponse, error)
- func (k Keeper) GetAppIDByGasPayer(ctx sdk.Context, payer string) ([]byte, bool)
- func (k Keeper) GetApplication(ctx sdk.Context, appID []byte) (types.Application, bool)
- func (k Keeper) GetAssessmentSigner(ctx sdk.Context, keyID string) (types.AssessmentSigner, bool)
- func (k Keeper) GetAttestation(ctx sdk.Context, appID []byte, epoch uint64) (types.AttestationCommitment, bool)
- func (k Keeper) GetCandidate(ctx sdk.Context, entitlementID string) (types.Candidate, bool)
- func (k Keeper) GetChallenge(ctx sdk.Context, id uint64) (types.Challenge, bool)
- func (k Keeper) GetChallengeIndexState(ctx sdk.Context) ChallengeIndexState
- func (k Keeper) GetCredentialEntitlement(ctx sdk.Context, credentialID string) (string, bool)
- func (k Keeper) GetEntitlement(ctx sdk.Context, entitlementID string) (types.Entitlement, bool)
- func (k Keeper) GetEntitlementChallenge(ctx sdk.Context, challengeID string) (types.EntitlementChallenge, bool)
- func (k Keeper) GetEntitlementPool(ctx sdk.Context, poolID string) (types.Pool, bool)
- func (k Keeper) GetEpochBudget(ctx sdk.Context, epoch uint64) (types.EpochBudget, bool)
- func (k Keeper) GetGasCredit(ctx sdk.Context, appID []byte) (types.GasCreditAccount, bool)
- func (k Keeper) GetNextChallengeID(ctx sdk.Context) uint64
- func (k Keeper) GetOpenEntitlementChallenge(ctx sdk.Context, entitlementID, challenger string) (string, bool)
- func (k Keeper) GetOrCreateGasCredit(ctx sdk.Context, appID []byte) types.GasCreditAccount
- func (k Keeper) GetParams(ctx sdk.Context) types.Params
- func (k Keeper) GetRoleKey(ctx sdk.Context, role types.EntitlementRole, keyID string) (types.RoleKey, bool)
- func (k Keeper) GetSettlement(ctx sdk.Context, appID []byte, epoch uint64) (types.Settlement, bool)
- func (k Keeper) HasAnyEntitlementChallenge(ctx sdk.Context, entitlementID string) bool
- func (k Keeper) HasAuthNonce(ctx sdk.Context, role types.EntitlementRole, keyID, nonce string) bool
- func (k Keeper) HasCredentialID(ctx sdk.Context, credentialID string) bool
- func (k Keeper) HasGasCreditConsumption(ctx sdk.Context, appID, sourceTx []byte) bool
- func (k Keeper) HasOpenChallenge(ctx sdk.Context, appID []byte, epoch uint64) bool
- func (k Keeper) HasOpenOrUpheldEntitlementChallenge(ctx sdk.Context, entitlementID string) bool
- func (k Keeper) HasSettledEntitlementChallengeResolution(ctx sdk.Context, entitlementID, digest string) bool
- func (k Keeper) InitGenesis(ctx sdk.Context, gs types.GenesisState)
- func (k Keeper) IsEntitlementFlowEnabled(ctx sdk.Context, pool types.Pool) bool
- func (k Keeper) IterateAssessmentSigners(ctx sdk.Context, fn func(types.AssessmentSigner) bool)
- func (k Keeper) IterateAuthNonces(ctx sdk.Context, fn func(string) bool)
- func (k Keeper) IterateEntitlementChallenges(ctx sdk.Context, fn func(types.EntitlementChallenge) bool)
- func (k Keeper) IterateEntitlementChallengesByCandidate(ctx sdk.Context, candidateID string, fn func(types.EntitlementChallenge) bool)
- func (k Keeper) IterateRoleKeys(ctx sdk.Context, role types.EntitlementRole, fn func(types.RoleKey) bool)
- func (k Keeper) ListOpenChallengeIDs(ctx sdk.Context, appID []byte, epoch uint64) []uint64
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MarkChallengeIndexesReady(ctx sdk.Context)
- func (k Keeper) OpenChallenges(goCtx context.Context, req *types.QueryOpenChallengesRequest) (*types.QueryOpenChallengesResponse, error)
- func (k Keeper) Params(goCtx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) Pool(goCtx context.Context, req *types.QueryPoolRequest) (*types.QueryPoolResponse, error)
- func (k Keeper) Roles(goCtx context.Context, req *types.QueryRolesRequest) (*types.QueryRolesResponse, error)
- func (k Keeper) SetApplication(ctx sdk.Context, app types.Application)
- func (k Keeper) SetAssessmentSigner(ctx sdk.Context, s types.AssessmentSigner)
- func (k Keeper) SetAttestation(ctx sdk.Context, a types.AttestationCommitment)
- func (k Keeper) SetAuthNonce(ctx sdk.Context, role types.EntitlementRole, keyID, nonce string, ...)
- func (k Keeper) SetCandidate(ctx sdk.Context, c types.Candidate)
- func (k Keeper) SetChallenge(ctx sdk.Context, c types.Challenge)
- func (k Keeper) SetCredentialIndex(ctx sdk.Context, credentialID, entitlementID string)
- func (k Keeper) SetEntitlement(ctx sdk.Context, e types.Entitlement)
- func (k Keeper) SetEntitlementChallenge(ctx sdk.Context, c types.EntitlementChallenge)
- func (k Keeper) SetEntitlementPool(ctx sdk.Context, p types.Pool)
- func (k Keeper) SetGasCredit(ctx sdk.Context, a types.GasCreditAccount)
- func (k Keeper) SetGasCreditConsumption(ctx sdk.Context, c types.GasCreditConsumption)
- func (k Keeper) SetGasPayerIndex(ctx sdk.Context, payer string, appID []byte) error
- func (k Keeper) SetNextChallengeID(ctx sdk.Context, id uint64)
- func (k Keeper) SetOpenChallengeIndex(ctx sdk.Context, appID []byte, epoch, challengeID uint64)
- func (k Keeper) SetOpenEntitlementChallenge(ctx sdk.Context, entitlementID, challenger, challengeID string)
- func (k Keeper) SetParams(ctx sdk.Context, p types.Params) error
- func (k Keeper) SetRoleKey(ctx sdk.Context, rk types.RoleKey)
- func (k Keeper) SetSettlement(ctx sdk.Context, s types.Settlement)
- func (k Keeper) Settlement(goCtx context.Context, req *types.QuerySettlementRequest) (*types.QuerySettlementResponse, error)
- func (k Keeper) Settlements(goCtx context.Context, req *types.QuerySettlementsRequest) (*types.QuerySettlementsResponse, error)
- func (k Keeper) StoreEpochBudget(ctx sdk.Context, b types.EpochBudget)
- func (k Keeper) SweepExpiredChallenges(ctx sdk.Context) int
- type Migrator
Constants ¶
const MaxChallengeIndexBackfillPerBlock = 256
MaxChallengeIndexBackfillPerBlock bounds how many challenge records one EndBlocker pass converts into index entries. A chain whose history predates the indexes therefore converges over a few blocks instead of one slow block.
This is a wall-clock bound, not a gas bound: Begin/EndBlock run with an infinite block gas meter (baseapp sets NewInfiniteGasMeter before them), so a large chunk would not be rejected, it would only delay the round.
const MaxExpiredChallengesPerBlock = 64
MaxExpiredChallengesPerBlock bounds how many challenges a single EndBlocker pass settles. A large backlog therefore degrades into "a few more blocks" instead of one oversized block; the rest keep their (earlier) buckets and are picked up on the next block. Normal operation settles zero per block.
const SettlementTriggerAutomatic = "endblocker"
SettlementTriggerAutomatic is the submitter recorded when the EndBlocker — not a transaction — settled a challenge. Distinguishes "the window expired and the chain closed it" from "someone paid gas to close it" in events and queries, without implying any party decided the outcome.
Variables ¶
This section is empty.
Functions ¶
func ChallengeIndexInvariant ¶
ChallengeIndexInvariant checks that every V1 challenge record is reachable through the candidate index and that every OPEN record sits in the timeout bucket (and settled records do not).
Those two structures are derived state: if they drift, an OPEN challenge becomes invisible to approve (which would release funds it must block) or stops being swept. Migration 1→2 is the only writer that can legitimately leave them stale while it runs, so any break outside an upgrade is a real fault. Run with: uptickd query crisis invariant appmining challenge-index-consistent
func EntitlementPoolInvariant ¶
EntitlementPoolInvariant checks funded = available + reserved + paid per pool and, per denom, module balance >= Σ(available + reserved) across all pools sharing that denom (UGE doc15: unpaid liability must be fully backed).
func EpochSpentInvariant ¶
EpochSpentInvariant checks spent <= limit for every epoch budget.
func GasCreditConservationInvariant ¶
GasCreditConservationInvariant checks balance + total_consumed == total_issued.
func NewMsgServerImpl ¶
NewMsgServerImpl returns a MsgServer implementation.
func OneSettlementInvariant ¶
OneSettlementInvariant is a structural check: settlement keys are unique by construction.
func OpenBudgetPoolInvariant ¶
OpenBudgetPoolInvariant checks sum(limit-spent) over open budgets per denom does not exceed the reward pool balance (vector: released/commitment vs pool).
func OpenChallengeEscrowInvariant ¶
OpenChallengeEscrowInvariant checks challenge escrow balance covers sum of OPEN attestation bonds plus OPEN V1 entitlement challenge deposits per denom.
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
RegisterInvariants registers appmining ledger invariants.
func SettlementAttestationInvariant ¶
SettlementAttestationInvariant checks each settlement references a FINALIZED attestation.
Types ¶
type ChallengeIndexState ¶
type ChallengeIndexState struct {
Done bool
Cursor string // last challenge_id converted; empty when unstarted or done
}
ChallengeIndexState is the persisted progress of the one-time index rebuild. A single record is enough: the rebuild is a linear walk over the challenge table, so "done" plus "where we stopped" fully describes it.
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper of the appmining store.
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeKey storetypes.StoreKey, bank types.BankKeeper, ak types.AccountKeeper, ) Keeper
NewKeeper creates a new appmining Keeper.
func (Keeper) Application ¶
func (k Keeper) Application(goCtx context.Context, req *types.QueryApplicationRequest) (*types.QueryApplicationResponse, error)
func (Keeper) Applications ¶
func (k Keeper) Applications(goCtx context.Context, req *types.QueryApplicationsRequest) (*types.QueryApplicationsResponse, error)
func (Keeper) Attestation ¶
func (k Keeper) Attestation(goCtx context.Context, req *types.QueryAttestationRequest) (*types.QueryAttestationResponse, error)
func (Keeper) Attestations ¶
func (k Keeper) Attestations(goCtx context.Context, req *types.QueryAttestationsRequest) (*types.QueryAttestationsResponse, error)
func (Keeper) AutoConsumeForTx ¶
func (k Keeper) AutoConsumeForTx(ctx sdk.Context, feePayer sdk.AccAddress, gasUsed uint64, sourceTxHash []byte) error
AutoConsumeForTx debits gas credit for an enrolled fee payer after a Cosmos tx. Not enrolled → no-op. Insufficient/paused/inactive → skip event, no error (ledger path must not roll back an otherwise-valid Cosmos tx until fee replacement lands). Unexpected store errors are returned.
func (Keeper) BackfillChallengeIndexes ¶
BackfillChallengeIndexes rebuilds both derived structures from the record table. It is idempotent and is run once from Migrate1to2 so chains that already hold V1 challenges before this change keep correct per-candidate reads. Returns the number of records visited.
func (Keeper) Candidate ¶
func (k Keeper) Candidate(goCtx context.Context, req *types.QueryCandidateRequest) (*types.QueryCandidateResponse, error)
func (Keeper) Challenge ¶
func (k Keeper) Challenge(goCtx context.Context, req *types.QueryChallengeRequest) (*types.QueryChallengeResponse, error)
func (Keeper) ChallengeIndexesReady ¶
ChallengeIndexesReady reports whether every stored challenge record is guaranteed to be reachable through the candidate index and the timeout buckets. Until it is true, per-candidate reads must fall back to the record table: a partially rebuilt index is worse than no index, because a candidate with two legacy challenges would look "indexed" after only one of them was converted.
func (Keeper) ConsumeGasCredit ¶
func (k Keeper) ConsumeGasCredit( ctx sdk.Context, appID []byte, gasPayer string, amount string, sourceTxHash []byte, ) (remaining string, err error)
ConsumeGasCredit debits gas credit for an authorized payer. Shared by Msg server and Cosmos PostHandler auto-consume.
Storage note (P1-2): GasCreditConsumption records grow unboundedly by design and are NOT prunable. Each record is the only thing binding a source tx hash to exactly one debit; deleting one would let the same sourceTxHash be debited again (MsgConsumeGasCredit is a separate tx from the source tx, so cometbft dedup does not protect it). Growth is bounded in rate: one ~110B record per actual gas consumption, same order as the tx index itself. AuthNonce (the other append-only set) IS pruned -- see store.pruneAuthNonces -- because wire proofs carry expires_at.
func (Keeper) DeleteGasPayerIndex ¶
DeleteGasPayerIndex removes the reverse index entry.
func (Keeper) DeleteOpenChallengeIndex ¶
func (Keeper) DeleteOpenEntitlementChallenge ¶
func (Keeper) EnsureChallengeIndexes ¶
EnsureChallengeIndexes advances the index rebuild by at most MaxChallengeIndexBackfillPerBlock records and returns how many it visited.
It exists so a binary swap that does NOT run a store migration still ends up with correct per-candidate reads. Without it, challenges written by a v1 binary have neither a candidate index entry nor a timeout bucket, which makes an OPEN challenge invisible to approve (an approval could then release funds that an unresolved challenge should still block) and makes the sweeper never see it.
Properties:
- Deterministic: reads only module state and params, walks the table in key order, so every validator performs byte-identical writes.
- Idempotent and resumable: the cursor is persisted; re-running after a restart continues where it stopped, and re-processing a record rewrites the same bytes.
- Cheap in steady state: one key read per block once Done is set.
- Writes only records with an actual gap (missing index entry, or an OPEN record still missing its sealed deadline), so the cost tracks real backlog rather than total history.
func (Keeper) Entitlement ¶
func (k Keeper) Entitlement(goCtx context.Context, req *types.QueryEntitlementRequest) (*types.QueryEntitlementResponse, error)
func (Keeper) EntitlementChallenge ¶
func (k Keeper) EntitlementChallenge(goCtx context.Context, req *types.QueryEntitlementChallengeRequest) (*types.QueryEntitlementChallengeResponse, error)
func (Keeper) EntitlementChallenges ¶
func (k Keeper) EntitlementChallenges(goCtx context.Context, req *types.QueryEntitlementChallengesRequest) (*types.QueryEntitlementChallengesResponse, error)
EntitlementChallenges lists V1 challenges with optional candidate_id and status filters. Legacy attestation challenges live in a different store and are served by OpenChallenges/Challenges.
With candidate_id it walks the per-candidate index, so the cost is O(challenges of that candidate) — the same structure approve relies on. Only the unfiltered listing (operator/explorer use, no tx path) scans everything.
func (Keeper) EntitlementsByApp ¶
func (k Keeper) EntitlementsByApp(goCtx context.Context, req *types.QueryEntitlementsByAppRequest) (*types.QueryEntitlementsByAppResponse, error)
func (Keeper) EpochBudget ¶
func (k Keeper) EpochBudget(goCtx context.Context, req *types.QueryEpochBudgetRequest) (*types.QueryEpochBudgetResponse, error)
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
ExportGenesis exports full module state (BLOCK-2 fix).
func (Keeper) GasCredit ¶
func (k Keeper) GasCredit(goCtx context.Context, req *types.QueryGasCreditRequest) (*types.QueryGasCreditResponse, error)
func (Keeper) GasCreditConsumptions ¶
func (k Keeper) GasCreditConsumptions(goCtx context.Context, req *types.QueryGasCreditConsumptionsRequest) (*types.QueryGasCreditConsumptionsResponse, error)
func (Keeper) GetAppIDByGasPayer ¶
GetAppIDByGasPayer returns the app bound to this gas payer, if any.
func (Keeper) GetApplication ¶
func (Keeper) GetAssessmentSigner ¶
func (Keeper) GetAttestation ¶
func (Keeper) GetCandidate ¶
func (Keeper) GetChallenge ¶
func (Keeper) GetChallengeIndexState ¶
func (k Keeper) GetChallengeIndexState(ctx sdk.Context) ChallengeIndexState
GetChallengeIndexState reads the rebuild state. A missing record means the indexes were never built, which is exactly the pre-upgrade situation.
func (Keeper) GetCredentialEntitlement ¶
func (Keeper) GetEntitlement ¶
func (Keeper) GetEntitlementChallenge ¶
func (Keeper) GetEntitlementPool ¶
func (Keeper) GetEpochBudget ¶
func (Keeper) GetGasCredit ¶
func (Keeper) GetOpenEntitlementChallenge ¶
func (Keeper) GetOrCreateGasCredit ¶
func (Keeper) GetRoleKey ¶
func (Keeper) GetSettlement ¶
func (Keeper) HasAnyEntitlementChallenge ¶
HasAnyEntitlementChallenge reports whether the candidate has any stored challenge record (any status). Used by the no-challenge approve path (UGE DEC-01 scheme C): empty challenge_resolution_hash requires zero challenges.
It goes through the same accessor as the status predicates so it inherits the pre-backfill fallback; a direct index lookup here would report "no challenge" for legacy records and silently enable the empty-hash approval path.
func (Keeper) HasAuthNonce ¶
HasAuthNonce reports whether the wire-v1 nonce was already consumed.
func (Keeper) HasCredentialID ¶
HasCredentialID reports whether credential_id was consumed. Index entries are never deleted — including after candidate REJECTED (D-A permanent one-shot).
func (Keeper) HasGasCreditConsumption ¶
func (Keeper) HasOpenChallenge ¶
func (Keeper) HasOpenOrUpheldEntitlementChallenge ¶
HasOpenOrUpheldEntitlementChallenge reports whether any challenge for the candidate is OPEN or UPHELD (blocks approval). DISMISSED/EXPIRED do not.
func (Keeper) HasSettledEntitlementChallengeResolution ¶
func (k Keeper) HasSettledEntitlementChallengeResolution(ctx sdk.Context, entitlementID, digest string) bool
HasSettledEntitlementChallengeResolution reports whether the candidate has a settled challenge (DISMISSED by a reviewer, or EXPIRED by timeout) whose stored ResolutionDigest equals digest. Both are "no allegation proven" states that unblock approval; OPEN and UPHELD are not accepted here.
func (Keeper) InitGenesis ¶
func (k Keeper) InitGenesis(ctx sdk.Context, gs types.GenesisState)
InitGenesis imports genesis state.
func (Keeper) IsEntitlementFlowEnabled ¶
IsEntitlementFlowEnabled reports whether V1 business msgs may run for pool: per-pool pause/min-funded gates, plus denom-aggregated available+reserved <= module balance (covers multi-pool / genesis skew).
func (Keeper) IterateAssessmentSigners ¶
func (Keeper) IterateAuthNonces ¶
IterateAuthNonces walks consumed wire-v1 nonces ("role/key_id/nonce"), reconstructing the identity from the store key so the value format stays free to evolve.
func (Keeper) IterateEntitlementChallenges ¶
func (k Keeper) IterateEntitlementChallenges(ctx sdk.Context, fn func(types.EntitlementChallenge) bool)
IterateEntitlementChallenges walks every entitlement challenge record.
NOT for tx paths: use IterateEntitlementChallengesByCandidate there. This is the O(history) walk kept for ExportGenesis, the 1→2 backfill and crisis invariants.
func (Keeper) IterateEntitlementChallengesByCandidate ¶
func (k Keeper) IterateEntitlementChallengesByCandidate(ctx sdk.Context, candidateID string, fn func(types.EntitlementChallenge) bool)
IterateEntitlementChallengesByCandidate is the exported per-candidate walk.
func (Keeper) IterateRoleKeys ¶
func (k Keeper) IterateRoleKeys(ctx sdk.Context, role types.EntitlementRole, fn func(types.RoleKey) bool)
IterateRoleKeys walks every registered key of one role (key order = key_id).
func (Keeper) ListOpenChallengeIDs ¶
ListOpenChallengeIDs returns open challenge ids for (app, epoch).
func (Keeper) MarkChallengeIndexesReady ¶
MarkChallengeIndexesReady declares the indexes complete. Used by the 1→2 migration after its full backfill, so the EndBlocker rebuild becomes a no-op.
func (Keeper) OpenChallenges ¶
func (k Keeper) OpenChallenges(goCtx context.Context, req *types.QueryOpenChallengesRequest) (*types.QueryOpenChallengesResponse, error)
func (Keeper) Params ¶
func (k Keeper) Params(goCtx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
func (Keeper) Pool ¶
func (k Keeper) Pool(goCtx context.Context, req *types.QueryPoolRequest) (*types.QueryPoolResponse, error)
Pool returns the entitlement pool record, module balance and flow status.
func (Keeper) Roles ¶
func (k Keeper) Roles(goCtx context.Context, req *types.QueryRolesRequest) (*types.QueryRolesResponse, error)
Roles returns registered role keys, optionally filtered by role and status.
func (Keeper) SetApplication ¶
func (k Keeper) SetApplication(ctx sdk.Context, app types.Application)
func (Keeper) SetAssessmentSigner ¶
func (k Keeper) SetAssessmentSigner(ctx sdk.Context, s types.AssessmentSigner)
func (Keeper) SetAttestation ¶
func (k Keeper) SetAttestation(ctx sdk.Context, a types.AttestationCommitment)
func (Keeper) SetAuthNonce ¶
func (k Keeper) SetAuthNonce(ctx sdk.Context, role types.EntitlementRole, keyID, nonce string, expiresAt int64)
SetAuthNonce consumes the wire-v1 nonce. The value is the proof's expires_at as 8-byte big-endian, used only for pruning; the genesis string ("role_wire/key_id/nonce") is reconstructed from the key, which carries the full identity. Legacy entries written before the expiry format keep their old string values -- they are never pruned and export identically.
func (Keeper) SetCredentialIndex ¶
func (Keeper) SetEntitlement ¶
func (k Keeper) SetEntitlement(ctx sdk.Context, e types.Entitlement)
func (Keeper) SetEntitlementChallenge ¶
func (k Keeper) SetEntitlementChallenge(ctx sdk.Context, c types.EntitlementChallenge)
SetEntitlementChallenge is the ONLY write path for V1 challenge records. Besides the record itself it maintains two derived structures so that per-candidate reads never scan the whole history:
- candidate index: candidate_id | 0x00 | challenge_id -> challenge_id
- timeout bucket: be(resolution_deadline) | challenge_id -> challenge_id
Keeping maintenance here (rather than in each handler) means open, resolve, expire and genesis cannot drift apart. Both writes are idempotent.
func (Keeper) SetEntitlementPool ¶
func (Keeper) SetGasCredit ¶
func (k Keeper) SetGasCredit(ctx sdk.Context, a types.GasCreditAccount)
func (Keeper) SetGasCreditConsumption ¶
func (k Keeper) SetGasCreditConsumption(ctx sdk.Context, c types.GasCreditConsumption)
func (Keeper) SetGasPayerIndex ¶
SetGasPayerIndex binds payer -> app_id. Rejects cross-app rebind.
func (Keeper) SetOpenChallengeIndex ¶
func (Keeper) SetOpenEntitlementChallenge ¶
func (Keeper) SetSettlement ¶
func (k Keeper) SetSettlement(ctx sdk.Context, s types.Settlement)
func (Keeper) Settlement ¶
func (k Keeper) Settlement(goCtx context.Context, req *types.QuerySettlementRequest) (*types.QuerySettlementResponse, error)
func (Keeper) Settlements ¶
func (k Keeper) Settlements(goCtx context.Context, req *types.QuerySettlementsRequest) (*types.QuerySettlementsResponse, error)
func (Keeper) StoreEpochBudget ¶
func (k Keeper) StoreEpochBudget(ctx sdk.Context, b types.EpochBudget)
func (Keeper) SweepExpiredChallenges ¶
SweepExpiredChallenges settles every OPEN challenge whose sealed resolution deadline has elapsed. It is the automatic counterpart of MsgExpireEntitlementChallenge: same settlement helper, so the outcome (EXPIRED + full deposit refund, candidate stays PUBLISHED) is identical either way.
Design notes:
- Bucket order is big-endian deadline, so the walk stops at the first deadline still in the future. Cost is O(entries actually due), normally 0, and never scales with settled history.
- It never returns an error and never panics: an EndBlocker failure halts the chain, so per-entry problems are logged and skipped.
- Only block time and module-local state are read, so it is deterministic across validators.
- It deliberately does not gate on requireEntitlementFlow: releasing a stranded deposit must keep working while the pool is paused. No pool money moves — the deposit only returns to the challenger that paid it.
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
Migrator is a helper for in-place store migrations.
func (Migrator) Migrate1to2 ¶
Migrate1to2 pauses the legacy attestation / GasCredit / Finalize settlement flow for audit-only retention, ensures the V1 entitlement pool module account exists, and rebuilds the V1 challenge derived indexes. It does NOT convert POC settlements into Entitlements.
The index backfill is why this migration must run before any per-candidate read is trusted: Read paths (approve's OPEN/UPHELD gate, the settled-digest check, the timeout sweeper) only look at the candidate index and the deadline buckets. A challenge written by a v1 binary has neither, so skipping the backfill would make an existing OPEN challenge invisible to approve.
Source Files
¶
- assessment.go
- assessment_signer.go
- challenge_index_state.go
- challenge_sweep.go
- entitlement_events.go
- entitlement_expire.go
- entitlement_funding.go
- entitlement_p0.go
- entitlement_p1.go
- entitlement_p2.go
- entitlement_p3.go
- gas_credit.go
- genesis.go
- grpc_query.go
- invariants.go
- keeper.go
- migrations.go
- msg_server.go
- pagination.go
- store.go
- wire_auth.go