keeper

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2025 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.

Types

type Keeper

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

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeService store.KVStoreService,
	logger log.Logger,
	authority string,

	bankKeeper types.BankKeeper,
	sessionKeeper types.SessionKeeper,
	applicationKeeper types.ApplicationKeeper,
	accountKeeper types.AccountKeeper,
	sharedKeeper types.SharedKeeper,
	serviceKeeper types.ServiceKeeper,
) Keeper

func (Keeper) AllProofs

func (Keeper) EnsureValidProofSignaturesAndClosestPath added in v0.0.12

func (k Keeper) EnsureValidProofSignaturesAndClosestPath(
	ctx context.Context,
	claim *types.Claim,
	proof *types.Proof,
) error

EnsureValidProofSignaturesAndClosestPath validates:

  1. Proof signatures from the supplier
  2. Valid relay request/response signatures from the application/supplier respectively
  3. Closest path validation against onchain claim

Execution requirements:

  1. Must run in the EndBlocker of the proof submission height
  2. Cannot run during SubmitProof due to computational cost

NOTE: Full validation requires passing both:

  1. EnsureWellFormedProof
  2. EnsureValidProofSignaturesAndClosestPath (this function)

func (Keeper) EnsureWellFormedProof added in v0.0.12

func (k Keeper) EnsureWellFormedProof(ctx context.Context, proof *types.Proof) error

EnsureWellFormedProof validates a supplier's proof for:

  1. Valid session header
  2. Submission height within window
  3. Matching relay request/response headers
  4. Relay Mining difficulty above reward threshold

EnsureWellFormedProof does not validate computationally expensive operations like:

  1. Proof relay signatures
  2. ClosestMerkleProof

Additional developer context as of #1031:

  • This function is expected to be called from the SubmitProof messages handler
  • Computationally expensive operations are left to the block's EndBlocker

NOTE: Full validation requires passing both:

  1. EnsureWellFormedProof (this function)
  2. EnsureValidProofSignaturesAndClosestPath

func (Keeper) GetAllClaims

func (k Keeper) GetAllClaims(ctx context.Context) (claims []types.Claim)

GetAllClaims returns all claim

func (Keeper) GetAllProofs

func (k Keeper) GetAllProofs(ctx context.Context) (proofs []types.Proof)

GetAllProofs returns all proofs in the store

func (Keeper) GetAllProofsIterator added in v0.0.12

func (k Keeper) GetAllProofsIterator(ctx context.Context) storetypes.Iterator

GetAllProofsIterator returns an iterator for all proofs in the store

func (Keeper) GetAuthority

func (k Keeper) GetAuthority() string

GetAuthority returns the module's authority.

func (Keeper) GetClaim

func (k Keeper) GetClaim(ctx context.Context, sessionId, supplierOperatorAddr string) (_ types.Claim, isClaimFound bool)

GetClaim returns a claim from its index

func (Keeper) GetParams

func (k Keeper) GetParams(ctx context.Context) (params types.Params)

GetParams get all parameters as types.Params

func (Keeper) GetProof

func (k Keeper) GetProof(ctx context.Context, sessionId, supplierOperatorAddr string) (_ types.Proof, isProofFound bool)

GetProof returns a proof from its index

func (Keeper) Logger

func (k Keeper) Logger() log.Logger

Logger returns a module-specific logger.

func (Keeper) Params

func (Keeper) ProofRequirementForClaim added in v0.0.9

func (k Keeper) ProofRequirementForClaim(ctx context.Context, claim *types.Claim) (_ types.ProofRequirementReason, err error)

ProofRequirementForClaim checks if a proof is required for a claim. If it is not, the claim will be settled without a proof. If it is, the claim will only be settled if a valid proof is available. TODO_BETA(@olshansk): Document safety assumptions of the probabilistic proofs mechanism.

func (Keeper) RemoveClaim

func (k Keeper) RemoveClaim(ctx context.Context, sessionId, supplierOperatorAddr string)

RemoveClaim removes a claim from the store

func (Keeper) RemoveProof

func (k Keeper) RemoveProof(ctx context.Context, sessionId, supplierOperatorAddr string)

RemoveProof removes a proof from the store

func (Keeper) SetParams

func (k Keeper) SetParams(ctx context.Context, params types.Params) error

SetParams set the params

func (Keeper) UpsertClaim

func (k Keeper) UpsertClaim(ctx context.Context, claim types.Claim)

UpsertClaim set a specific claim in the store from its index

func (Keeper) UpsertProof

func (k Keeper) UpsertProof(ctx context.Context, proof types.Proof)

UpsertProof set a specific proof in the store from its index

func (Keeper) ValidateSubmittedProofs added in v0.0.12

func (k Keeper) ValidateSubmittedProofs(ctx sdk.Context) (numValidProofs, numInvalidProofs uint64, err error)

ValidateSubmittedProofs performs concurrent proof validation, updating claims' proof validation states and removing processed proofs from storage.

Jump to

Keyboard shortcuts

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