keeper

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: MIT Imports: 29 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) EnsureValidProof added in v0.0.5

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

EnsureValidProof validates the proof submitted by the supplier is correct with respect to an on-chain claim.

This function should be called during session settlement (i.e. EndBlocker) rather than during proof submission (i.e. SubmitProof) because:

  1. RPC requests should be quick, lightweight and only do basic validation
  2. Validators are the ones responsible for the heavy processing & validation during state transitions
  3. This creates an opportunity to slash suppliers who submit false proofs, whereas they can keep retrying if it takes place in the SubmitProof handler.

Note that some of the validation here is redundant with the validation done in SubmitProof (in the handler). The reason for this is because were are trying to find a balance between preventing sybil or DoS attacks on full nodes during proof submission, but being completely exhaustive in all the checks done here.

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 proof

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_BLOCKER(@olshansk, #419): 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

Jump to

Keyboard shortcuts

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