keeper

package
v0.0.0-...-4955b9a Latest Latest
Warning

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

Go to latest
Published: May 31, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AATGeneration

func AATGeneration(appPubKey string, clientPubKey string, key crypto.PrivateKey) (pc.AAT, sdk.Error)

"AATGeneration" - Generates an application authentication token with an application public key hex string a client public key hex string, a passphrase and a keybase. The contract is that the keybase contains the app pub key and the passphrase corresponds to the app public key keypair.

func NewQuerier

func NewQuerier(k Keeper) sdk.Querier

"NewQuerier" - Creates an sdk.Querier for the pocket core module

func ParamKeyTable

func ParamKeyTable() sdk.KeyTable

"ParamKeyTable" - Registers the paramset types in a keytable and returns the table

Types

type Keeper

type Keeper struct {
	TmNode client.Client

	Paramstore sdk.Subspace

	Cdc *codec.Codec // The wire codec for binary encoding/decoding.
	// contains filtered or unexported fields
}

Keeper maintains the link to storage and exposes getter/setter methods for the various parts of the state machine

func NewKeeper

func NewKeeper(storeKey sdk.StoreKey, cdc *codec.Codec, authKeeper types.AuthKeeper, posKeeper types.PosKeeper, appKeeper types.AppsKeeper, hostedChains *types.HostedBlockchains, paramstore sdk.Subspace) Keeper

NewKeeper creates new instances of the pocketcore module Keeper

func (Keeper) AwardCoinsForRelays

func (k Keeper) AwardCoinsForRelays(ctx sdk.Ctx, relays int64, toAddr sdk.Address) sdk.BigInt

"AwardCoinsForRelays" - Award coins to nodes for relays completed using the nodes keeper

func (Keeper) BlocksPerSession

func (k Keeper) BlocksPerSession(ctx sdk.Ctx) int64

"BlocksPerSession" - Returns blocksPerSession parameter from the paramstore How many blocks per session

func (Keeper) BurnCoinsForChallenges

func (k Keeper) BurnCoinsForChallenges(ctx sdk.Ctx, relays int64, toAddr sdk.Address)

"BurnCoinsForChallenges" - Executes the burn for challenge function in the nodes module

func (Keeper) ClaimExpiration

func (k Keeper) ClaimExpiration(ctx sdk.Ctx) (res int64)

"ClaimExpiration" - Returns the claim expiration parameter from the paramstore Number of sessions pass before claim is expired

func (Keeper) ClaimIsMature

func (k Keeper) ClaimIsMature(ctx sdk.Ctx, sessionBlockHeight int64) bool

"ClaimIsMature" - Returns if the claim is past its security waiting period

func (Keeper) ClaimSubmissionWindow

func (k Keeper) ClaimSubmissionWindow(ctx sdk.Ctx) (res int64)

"ClaimSubmissionWindow" - Returns claimSubmissionWindow parameter from the paramstore How long do you have to submit a claim before the secret is revealed and it's invalid

func (Keeper) ClearSessionCache

func (Keeper) ClearSessionCache()

func (Keeper) ConvertState

func (k Keeper) ConvertState(ctx sdk.Ctx)

func (Keeper) DeleteClaim

func (k Keeper) DeleteClaim(ctx sdk.Ctx, address sdk.Address, header pc.SessionHeader, evidenceType pc.EvidenceType) error

"DeleteClaim" - Removes a claim object for a certain key

func (Keeper) DeleteExpiredClaims

func (k Keeper) DeleteExpiredClaims(ctx sdk.Ctx)

"DeleteExpiredClaims" - Deletes the expired (claim expiration > # of session passed since claim genesis) claims

func (Keeper) ExecuteProof

func (k Keeper) ExecuteProof(ctx sdk.Ctx, proof pc.MsgProof, claim pc.MsgClaim) (tokens sdk.BigInt, err sdk.Error)

func (Keeper) GetAllClaims

func (k Keeper) GetAllClaims(ctx sdk.Ctx) (claims []pc.MsgClaim)

"GetAllClaims" - Gets all of the claim messages held in the state storage.

func (Keeper) GetApp

func (k Keeper) GetApp(ctx sdk.Ctx, address sdk.Address) (a exported.ApplicationI, found bool)

"GetApp" - Retrieves an application from the app store, using the appKeeper (a link to the apps module)

func (Keeper) GetAppFromPublicKey

func (k Keeper) GetAppFromPublicKey(ctx sdk.Ctx, pubKey string) (app exported.ApplicationI, found bool)

"GetAppFromPublicKey" - Retrieves an application from the app store, using the appKeeper (a link to the apps module) using a hex string public key

func (Keeper) GetAppStakedTokens

func (k Keeper) GetAppStakedTokens(ctx sdk.Ctx) (res sdk.BigInt)

"GetAppStakedTokens" - Returns the total number of staked tokens in the apps module

func (Keeper) GetBlock

func (k Keeper) GetBlock(height int) (*coretypes.ResultBlock, error)

"GetBlock" returns the block from the tendermint node at a certain height

func (Keeper) GetClaim

func (k Keeper) GetClaim(ctx sdk.Ctx, address sdk.Address, header pc.SessionHeader, evidenceType pc.EvidenceType) (msg pc.MsgClaim, found bool)

"GetClaim" - Retrieves the claim message from the store, requires the evidence type and header to return the proper claim message

func (Keeper) GetClaims

func (k Keeper) GetClaims(ctx sdk.Ctx, address sdk.Address) (claims []pc.MsgClaim, err error)

"GetClaims" - Gets all of the claim messages in the state storage for an address

func (Keeper) GetHostedBlockchains

func (k Keeper) GetHostedBlockchains() *pc.HostedBlockchains

"GetHostedBlockchains" returns the non native chains hosted locally on this node

func (Keeper) GetLatestSessionBlockHeight

func (k Keeper) GetLatestSessionBlockHeight(ctx sdk.Ctx) (sessionBlockHeight int64)

"GetLatestSessionBlockHeight" - Returns the latest session block height (first block of the session, (see blocksPerSession))

func (Keeper) GetMatureClaims

func (k Keeper) GetMatureClaims(ctx sdk.Ctx, address sdk.Address) (matureProofs []pc.MsgClaim, err error)

"GetMatureClaims" - Returns the mature (ready to be proved, past its security waiting period)

func (Keeper) GetNode

func (k Keeper) GetNode(ctx sdk.Ctx, address sdk.Address) (n exported.ValidatorI, found bool)

"GetNode" - Gets a node from the state storage

func (Keeper) GetNodesStakedTokens

func (k Keeper) GetNodesStakedTokens(ctx sdk.Ctx) (res sdk.BigInt)

"GetNodeStakedTokens" - Returns the total number of staked tokens in the nodes module

func (Keeper) GetPKFromFile

func (k Keeper) GetPKFromFile(ctx sdk.Ctx) (crypto.PrivateKey, error)

"GetPKFromFile" - Returns the private key object from a file

func (Keeper) GetParams

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

"GetParams" - Returns all module parameters in a `Params` struct

func (Keeper) GetSelfAddress

func (k Keeper) GetSelfAddress(ctx sdk.Ctx) sdk.Address

func (Keeper) GetSelfNode

func (k Keeper) GetSelfNode(ctx sdk.Ctx) (node exported.ValidatorI, er sdk.Error)

"GetSelfNode" - Gets self node (private val key) from the world state

func (Keeper) GetSelfPrivKey

func (k Keeper) GetSelfPrivKey(ctx sdk.Ctx) (crypto.PrivateKey, sdk.Error)

func (Keeper) GetTotalStakedTokens

func (k Keeper) GetTotalStakedTokens(ctx sdk.Ctx) (res sdk.BigInt)

"GetTotalStakedTokens" - Returns the summation of app staked tokens and node staked tokens

func (Keeper) GetTotalTokens

func (k Keeper) GetTotalTokens(ctx sdk.Ctx) (res sdk.BigInt)

"GetTotalTokens" - Returns the total number of tokens kept in any/all modules

func (Keeper) HandleChallenge

func (k Keeper) HandleChallenge(ctx sdk.Ctx, challenge pc.ChallengeProofInvalidData) (*pc.ChallengeResponse, sdk.Error)

"HandleChallenge" - Handles a client relay response challenge request

func (Keeper) HandleDispatch

func (k Keeper) HandleDispatch(ctx sdk.Ctx, header types.SessionHeader) (*types.DispatchResponse, sdk.Error)

"HandleDispatch" - Handles a client request for their session information

func (Keeper) HandleRelay

func (k Keeper) HandleRelay(ctx sdk.Ctx, relay pc.Relay) (*pc.RelayResponse, sdk.Error)

"HandleRelay" - Handles an api (read/write) request to a non-native (external) blockchain

func (Keeper) HandleReplayAttack

func (k Keeper) HandleReplayAttack(ctx sdk.Ctx, address sdk.Address, numberOfChallenges sdk.BigInt)

func (Keeper) IsPocketSupportedBlockchain

func (k Keeper) IsPocketSupportedBlockchain(ctx sdk.Ctx, chain string) bool

"IsPocketSupportedBlockchain" - Returns true if network identifier param is supported by pocket

func (Keeper) IsSessionBlock

func (k Keeper) IsSessionBlock(ctx sdk.Ctx) bool

"IsSessionBlock" - Returns true if current block, is a session block (beginning of a session)

func (Keeper) MinimumNumberOfProofs

func (k Keeper) MinimumNumberOfProofs(ctx sdk.Ctx) (res int64)

"SupportedBlockchains" - Returns a supported blockchain parameter from the paramstore What blockchains are supported in pocket network (list of network identifier hashes)

func (Keeper) ReplayAttackBurnMultiplier

func (k Keeper) ReplayAttackBurnMultiplier(ctx sdk.Ctx) (res int64)

"ReplayAttackBurn" - Returns the replay attack burn parameter from the paramstore The multiplier for how heavily nodes are burned for replay attacks

func (Keeper) SendClaimTx

func (k Keeper) SendClaimTx(ctx sdk.Ctx, keeper Keeper, n client.Client, claimTx func(pk crypto.PrivateKey, cliCtx util.CLIContext, txBuilder auth.TxBuilder, header pc.SessionHeader, totalProofs int64, root pc.HashRange, evidenceType pc.EvidenceType) (*sdk.TxResponse, error))

"SendClaimTx" - Automatically sends a claim of work/challenge based on relays or challenges stored.

func (Keeper) SendProofTx

func (k Keeper) SendProofTx(ctx sdk.Ctx, n client.Client, proofTx func(cliCtx util.CLIContext, txBuilder auth.TxBuilder, merkleProof pc.MerkleProof, leafNode pc.Proof, evidenceType pc.EvidenceType) (*sdk.TxResponse, error))

auto sends a proof transaction for the claim

func (Keeper) SessionNodeCount

func (k Keeper) SessionNodeCount(ctx sdk.Ctx) (res int64)

"SessionNodeCount" - Returns the session node count parameter from the paramstore Number of nodes dispatched in a single session

func (Keeper) SetClaim

func (k Keeper) SetClaim(ctx sdk.Ctx, msg pc.MsgClaim) error

"SetClaim" - Sets the claim message in the state storage

func (Keeper) SetClaims

func (k Keeper) SetClaims(ctx sdk.Ctx, claims []pc.MsgClaim)

"SetClaims" - Sets all the claim messages in the state storage. (Needed for genesis initializing)

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Ctx, params types.Params)

"SetParams" - Sets all of the parameters in the paramstore using the params structure

func (Keeper) StakeDenom

func (k Keeper) StakeDenom(ctx sdk.Ctx) (res string)

"StakeDenom" - Returns the stake coin denomination from the node module

func (Keeper) SupportedBlockchains

func (k Keeper) SupportedBlockchains(ctx sdk.Ctx) (res []string)

"SupportedBlockchains" - Returns a supported blockchain parameter from the paramstore What blockchains are supported in pocket network (list of network identifier hashes)

func (Keeper) UpgradeCodec

func (k Keeper) UpgradeCodec(ctx sdk.Ctx)

func (Keeper) ValidateClaim

func (k Keeper) ValidateClaim(ctx sdk.Ctx, claim pc.MsgClaim) (err sdk.Error)

"ValidateClaim" - Validates a claim message and returns an sdk error if invalid

func (Keeper) ValidateProof

func (k Keeper) ValidateProof(ctx sdk.Ctx, proof pc.MsgProof) (servicerAddr sdk.Address, claim pc.MsgClaim, sdkError sdk.Error)

Jump to

Keyboard shortcuts

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