keeper

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 22 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EntitlementPoolInvariant

func EntitlementPoolInvariant(k Keeper) sdk.Invariant

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

func EpochSpentInvariant(k Keeper) sdk.Invariant

EpochSpentInvariant checks spent <= limit for every epoch budget.

func GasCreditConservationInvariant

func GasCreditConservationInvariant(k Keeper) sdk.Invariant

GasCreditConservationInvariant checks balance + total_consumed == total_issued.

func NewMsgServerImpl

func NewMsgServerImpl(k Keeper) types.MsgServer

NewMsgServerImpl returns a MsgServer implementation.

func OneSettlementInvariant

func OneSettlementInvariant(k Keeper) sdk.Invariant

OneSettlementInvariant is a structural check: settlement keys are unique by construction.

func OpenBudgetPoolInvariant

func OpenBudgetPoolInvariant(k Keeper) sdk.Invariant

OpenBudgetPoolInvariant checks sum(limit-spent) over open budgets per denom does not exceed the reward pool balance (vector: released/commitment vs pool).

func OpenChallengeEscrowInvariant

func OpenChallengeEscrowInvariant(k Keeper) sdk.Invariant

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

func SettlementAttestationInvariant(k Keeper) sdk.Invariant

SettlementAttestationInvariant checks each settlement references a FINALIZED attestation.

Types

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) 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) Candidate

func (Keeper) Challenge

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

func (k Keeper) DeleteGasPayerIndex(ctx sdk.Context, payer string)

DeleteGasPayerIndex removes the reverse index entry.

func (Keeper) DeleteOpenChallengeIndex

func (k Keeper) DeleteOpenChallengeIndex(ctx sdk.Context, appID []byte, epoch, challengeID uint64)

func (Keeper) DeleteOpenEntitlementChallenge

func (k Keeper) DeleteOpenEntitlementChallenge(ctx sdk.Context, entitlementID, challenger string)

func (Keeper) ExportGenesis

func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState

ExportGenesis exports full module state (BLOCK-2 fix).

func (Keeper) GasCredit

func (Keeper) GetAppIDByGasPayer

func (k Keeper) GetAppIDByGasPayer(ctx sdk.Context, payer string) ([]byte, bool)

GetAppIDByGasPayer returns the app bound to this gas payer, if any.

func (Keeper) GetApplication

func (k Keeper) GetApplication(ctx sdk.Context, appID []byte) (types.Application, bool)

func (Keeper) GetAssessmentSigner

func (k Keeper) GetAssessmentSigner(ctx sdk.Context, keyID string) (types.AssessmentSigner, bool)

func (Keeper) GetAttestation

func (k Keeper) GetAttestation(ctx sdk.Context, appID []byte, epoch uint64) (types.AttestationCommitment, bool)

func (Keeper) GetCandidate

func (k Keeper) GetCandidate(ctx sdk.Context, entitlementID string) (types.Candidate, bool)

func (Keeper) GetChallenge

func (k Keeper) GetChallenge(ctx sdk.Context, id uint64) (types.Challenge, bool)

func (Keeper) GetCredentialEntitlement

func (k Keeper) GetCredentialEntitlement(ctx sdk.Context, credentialID string) (string, bool)

func (Keeper) GetEntitlement

func (k Keeper) GetEntitlement(ctx sdk.Context, entitlementID string) (types.Entitlement, bool)

func (Keeper) GetEntitlementChallenge

func (k Keeper) GetEntitlementChallenge(ctx sdk.Context, challengeID string) (types.EntitlementChallenge, bool)

func (Keeper) GetEntitlementPool

func (k Keeper) GetEntitlementPool(ctx sdk.Context, poolID string) (types.Pool, bool)

func (Keeper) GetEpochBudget

func (k Keeper) GetEpochBudget(ctx sdk.Context, epoch uint64) (types.EpochBudget, bool)

func (Keeper) GetGasCredit

func (k Keeper) GetGasCredit(ctx sdk.Context, appID []byte) (types.GasCreditAccount, bool)

func (Keeper) GetNextChallengeID

func (k Keeper) GetNextChallengeID(ctx sdk.Context) uint64

func (Keeper) GetOpenEntitlementChallenge

func (k Keeper) GetOpenEntitlementChallenge(ctx sdk.Context, entitlementID, challenger string) (string, bool)

func (Keeper) GetOrCreateGasCredit

func (k Keeper) GetOrCreateGasCredit(ctx sdk.Context, appID []byte) types.GasCreditAccount

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) types.Params

func (Keeper) GetRoleKey

func (k Keeper) GetRoleKey(ctx sdk.Context, role types.EntitlementRole, keyID string) (types.RoleKey, bool)

func (Keeper) GetSettlement

func (k Keeper) GetSettlement(ctx sdk.Context, appID []byte, epoch uint64) (types.Settlement, bool)

func (Keeper) HasAnyEntitlementChallenge

func (k Keeper) HasAnyEntitlementChallenge(ctx sdk.Context, entitlementID string) bool

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.

func (Keeper) HasAuthNonce

func (k Keeper) HasAuthNonce(ctx sdk.Context, role types.EntitlementRole, keyID, nonce string) bool

HasAuthNonce reports whether the wire-v1 nonce was already consumed.

func (Keeper) HasCredentialID

func (k Keeper) HasCredentialID(ctx sdk.Context, credentialID string) bool

HasCredentialID reports whether credential_id was consumed. Index entries are never deleted — including after candidate REJECTED (D-A permanent one-shot).

func (Keeper) HasDismissedEntitlementChallengeResolution

func (k Keeper) HasDismissedEntitlementChallengeResolution(ctx sdk.Context, entitlementID, digest string) bool

HasDismissedEntitlementChallengeResolution reports whether the candidate has a DISMISSED challenge whose stored ResolutionDigest equals digest.

func (Keeper) HasGasCreditConsumption

func (k Keeper) HasGasCreditConsumption(ctx sdk.Context, appID, sourceTx []byte) bool

func (Keeper) HasOpenChallenge

func (k Keeper) HasOpenChallenge(ctx sdk.Context, appID []byte, epoch uint64) bool

func (Keeper) HasOpenOrUpheldEntitlementChallenge

func (k Keeper) HasOpenOrUpheldEntitlementChallenge(ctx sdk.Context, entitlementID string) bool

HasOpenOrUpheldEntitlementChallenge reports whether any challenge for the candidate is OPEN or UPHELD (blocks approval). DISMISSED does not block.

func (Keeper) InitGenesis

func (k Keeper) InitGenesis(ctx sdk.Context, gs types.GenesisState)

InitGenesis imports genesis state.

func (Keeper) IsEntitlementFlowEnabled

func (k Keeper) IsEntitlementFlowEnabled(ctx sdk.Context, pool types.Pool) bool

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 (k Keeper) IterateAssessmentSigners(ctx sdk.Context, fn func(types.AssessmentSigner) bool)

func (Keeper) IterateAuthNonces

func (k Keeper) IterateAuthNonces(ctx sdk.Context, fn func(string) bool)

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.

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

func (k Keeper) ListOpenChallengeIDs(ctx sdk.Context, appID []byte, epoch uint64) []uint64

ListOpenChallengeIDs returns open challenge ids for (app, epoch).

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) Params

func (Keeper) Pool

Pool returns the entitlement pool record, module balance and flow status.

func (Keeper) Roles

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) SetCandidate

func (k Keeper) SetCandidate(ctx sdk.Context, c types.Candidate)

func (Keeper) SetChallenge

func (k Keeper) SetChallenge(ctx sdk.Context, c types.Challenge)

func (Keeper) SetCredentialIndex

func (k Keeper) SetCredentialIndex(ctx sdk.Context, credentialID, entitlementID string)

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)

func (Keeper) SetEntitlementPool

func (k Keeper) SetEntitlementPool(ctx sdk.Context, p types.Pool)

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

func (k Keeper) SetGasPayerIndex(ctx sdk.Context, payer string, appID []byte) error

SetGasPayerIndex binds payer -> app_id. Rejects cross-app rebind.

func (Keeper) SetNextChallengeID

func (k Keeper) SetNextChallengeID(ctx sdk.Context, id uint64)

func (Keeper) SetOpenChallengeIndex

func (k Keeper) SetOpenChallengeIndex(ctx sdk.Context, appID []byte, epoch, challengeID uint64)

func (Keeper) SetOpenEntitlementChallenge

func (k Keeper) SetOpenEntitlementChallenge(ctx sdk.Context, entitlementID, challenger, challengeID string)

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, p types.Params) error

func (Keeper) SetRoleKey

func (k Keeper) SetRoleKey(ctx sdk.Context, rk types.RoleKey)

func (Keeper) SetSettlement

func (k Keeper) SetSettlement(ctx sdk.Context, s types.Settlement)

func (Keeper) Settlement

func (Keeper) StoreEpochBudget

func (k Keeper) StoreEpochBudget(ctx sdk.Context, b types.EpochBudget)

type Migrator

type Migrator struct {
	// contains filtered or unexported fields
}

Migrator is a helper for in-place store migrations.

func NewMigrator

func NewMigrator(k Keeper) Migrator

NewMigrator returns a new Migrator.

func (Migrator) Migrate1to2

func (m Migrator) Migrate1to2(ctx sdk.Context) error

Migrate1to2 pauses the legacy attestation / GasCredit / Finalize settlement flow for audit-only retention and ensures the V1 entitlement pool module account exists. It does NOT convert POC settlements into Entitlements.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL