Documentation ¶
Index ¶
- func AATGeneration(appPubKey, clientPubKey string, appPrivKey crypto.PrivateKey) (pc.AAT, sdk.Error)
- func NewQuerier(k Keeper) sdk.Querier
- func ParamKeyTable() sdk.KeyTable
- type Keeper
- func (k Keeper) AwardCoinsForRelays(ctx sdk.Ctx, chain string, relays int64, toAddr sdk.Address) sdk.BigInt
- func (k Keeper) BlockByteSize(ctx sdk.Ctx) (res int64)
- func (k Keeper) BlocksPerSession(ctx sdk.Ctx) int64
- func (k Keeper) BurnCoinsForChallenges(ctx sdk.Ctx, relays int64, toAddr sdk.Address)
- func (k Keeper) ClaimExpiration(ctx sdk.Ctx) (res int64)
- func (k Keeper) ClaimIsMature(ctx sdk.Ctx, sessionBlockHeight int64) bool
- func (k Keeper) ClaimSubmissionWindow(ctx sdk.Ctx) (res int64)
- func (Keeper) ClearSessionCache()
- func (k Keeper) Codec() *codec.Codec
- func (k Keeper) ConsensusParamUpdate(ctx sdk.Ctx) *abci.ConsensusParams
- func (k Keeper) ConvertState(ctx sdk.Ctx)
- func (k Keeper) DeleteClaim(ctx sdk.Ctx, address sdk.Address, header pc.SessionHeader, ...) error
- func (k Keeper) DeleteExpiredClaims(ctx sdk.Ctx)
- func (k Keeper) ExecuteProof(ctx sdk.Ctx, proof pc.MsgProof, claim pc.MsgClaim) (tokens sdk.BigInt, err sdk.Error)
- func (k Keeper) GetAllClaims(ctx sdk.Ctx) (claims []pc.MsgClaim)
- func (k Keeper) GetApp(ctx sdk.Ctx, address sdk.Address) (a exported.ApplicationI, found bool)
- func (k Keeper) GetAppFromPublicKey(ctx sdk.Ctx, pubKey string) (app exported.ApplicationI, found bool)
- func (k Keeper) GetAppStakedTokens(ctx sdk.Ctx) (res sdk.BigInt)
- func (k Keeper) GetBlock(height int) (*coretypes.ResultBlock, error)
- func (k Keeper) GetClaim(ctx sdk.Ctx, address sdk.Address, header pc.SessionHeader, ...) (msg pc.MsgClaim, found bool)
- func (k Keeper) GetClaims(ctx sdk.Ctx, address sdk.Address) (claims []pc.MsgClaim, err error)
- func (k Keeper) GetHostedBlockchains() *pc.HostedBlockchains
- func (k Keeper) GetLatestSessionBlockHeight(ctx sdk.Ctx) (sessionBlockHeight int64)
- func (k Keeper) GetMatureClaims(ctx sdk.Ctx, address sdk.Address) (matureProofs []pc.MsgClaim, err error)
- func (k Keeper) GetNode(ctx sdk.Ctx, address sdk.Address) (n exported.ValidatorI, found bool)
- func (k Keeper) GetNodesStakedTokens(ctx sdk.Ctx) (res sdk.BigInt)
- func (k Keeper) GetParams(ctx sdk.Ctx) types.Params
- func (k Keeper) GetTotalStakedTokens(ctx sdk.Ctx) (res sdk.BigInt)
- func (k Keeper) GetTotalTokens(ctx sdk.Ctx) (res sdk.BigInt)
- func (k Keeper) HandleChallenge(ctx sdk.Ctx, challenge pc.ChallengeProofInvalidData) (*pc.ChallengeResponse, sdk.Error)
- func (k Keeper) HandleDispatch(ctx sdk.Ctx, header types.SessionHeader) (*types.DispatchResponse, sdk.Error)
- func (k Keeper) HandleRelay(ctx sdk.Ctx, relay pc.Relay) (*pc.RelayResponse, sdk.Error)
- func (k Keeper) HandleReplayAttack(ctx sdk.Ctx, address sdk.Address, numberOfChallenges sdk.BigInt)
- func (k Keeper) IsPocketSupportedBlockchain(ctx sdk.Ctx, chain string) bool
- func (k Keeper) IsProofSessionHeightWithinTolerance(ctx sdk.Ctx, relaySessionBlockHeight int64) bool
- func (k Keeper) IsSessionBlock(ctx sdk.Ctx) bool
- func (k Keeper) MinimumNumberOfProofs(ctx sdk.Ctx) (res int64)
- func (k Keeper) ReplayAttackBurnMultiplier(ctx sdk.Ctx) (res int64)
- func (k Keeper) SendClaimTx(ctx sdk.Ctx, keeper Keeper, n client.Client, node *pc.PocketNode, ...)
- func (k Keeper) SendProofTx(ctx sdk.Ctx, n client.Client, node *pc.PocketNode, ...)
- func (k Keeper) SessionNodeCount(ctx sdk.Ctx) (res int64)
- func (k Keeper) SetClaim(ctx sdk.Ctx, msg pc.MsgClaim) error
- func (k Keeper) SetClaims(ctx sdk.Ctx, claims []pc.MsgClaim)
- func (k Keeper) SetHostedBlockchains(m map[string]pc.HostedBlockchain) *pc.HostedBlockchains
- func (k Keeper) SetParams(ctx sdk.Ctx, params types.Params)
- func (k Keeper) StakeDenom(ctx sdk.Ctx) (res string)
- func (k Keeper) SupportedBlockchains(ctx sdk.Ctx) (res []string)
- func (k Keeper) UpgradeCodec(ctx sdk.Ctx)
- func (k Keeper) ValidateClaim(ctx sdk.Ctx, claim pc.MsgClaim) (err sdk.Error)
- func (k Keeper) ValidateProof(ctx sdk.Ctx, proof pc.MsgProof) (servicerAddr sdk.Address, claim pc.MsgClaim, sdkError sdk.Error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AATGeneration ¶
func AATGeneration(appPubKey, clientPubKey string, appPrivKey crypto.PrivateKey) (pc.AAT, sdk.Error)
GenerateAAT generates an AAT to be used for relay request authentication. - appPubKey is the public key of the application that's staking for on-chain service. - clientPubKey is the public key of a client facilitating relays on behalf of the app. - appPubKey and clientPubKey may or may not be the same.
func NewQuerier ¶
"NewQuerier" - Creates an sdk.Querier for the pocket core module
func ParamKeyTable ¶
"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, chain string, relays int64, toAddr sdk.Address, ) sdk.BigInt
"AwardCoinsForRelays" - Award coins to nodes for relays completed using the nodes keeper
func (Keeper) BlockByteSize ¶
BlockByteSize - Returns the block byte size parameter from the paramstore governing the maximum size of each block
func (Keeper) BlocksPerSession ¶
"BlocksPerSession" - Returns blocksPerSession parameter from the paramstore How many blocks per session
func (Keeper) BurnCoinsForChallenges ¶
"BurnCoinsForChallenges" - Executes the burn for challenge function in the nodes module
func (Keeper) ClaimExpiration ¶
"ClaimExpiration" - Returns the claim expiration parameter from the paramstore Number of sessions pass before claim is expired
func (Keeper) ClaimIsMature ¶
"ClaimIsMature" - Returns if the claim is past its security waiting period
func (Keeper) ClaimSubmissionWindow ¶
"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) ConsensusParamUpdate ¶
func (k Keeper) ConsensusParamUpdate(ctx sdk.Ctx) *abci.ConsensusParams
func (Keeper) ConvertState ¶
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 ¶
"DeleteExpiredClaims" - Deletes the expired (claim expiration > # of session passed since claim genesis) claims
func (Keeper) ExecuteProof ¶
func (Keeper) GetAllClaims ¶
"GetAllClaims" - Gets all of the claim messages held in the state storage.
func (Keeper) GetApp ¶
"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 ¶
"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 ¶
"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 ¶
"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) GetNodesStakedTokens ¶
"GetNodeStakedTokens" - Returns the total number of staked tokens in the nodes module
func (Keeper) GetTotalStakedTokens ¶
"GetTotalStakedTokens" - Returns the summation of app staked tokens and node staked tokens
func (Keeper) GetTotalTokens ¶
"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 ¶
HandleRelay handles an api (read/write) request to a non-native (external) blockchain
func (Keeper) HandleReplayAttack ¶
func (Keeper) IsPocketSupportedBlockchain ¶
"IsPocketSupportedBlockchain" - Returns true if network identifier param is supported by pocket
func (Keeper) IsProofSessionHeightWithinTolerance ¶
func (k Keeper) IsProofSessionHeightWithinTolerance(ctx sdk.Ctx, relaySessionBlockHeight int64) bool
IsProofSessionHeightWithinTolerance checks if the relaySessionBlockHeight is bounded by (latestSessionBlockHeight - tolerance ) <= x <= latestSessionHeight
func (Keeper) IsSessionBlock ¶
"IsSessionBlock" - Returns true if current block, is a session block (beginning of a session)
func (Keeper) MinimumNumberOfProofs ¶
"MinimumNumberOfProofs" - Returns a minimun number of proofs parameter from the paramstore What blockchains are supported in pocket network (list of network identifier hashes)
func (Keeper) ReplayAttackBurnMultiplier ¶
"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, node *pc.PocketNode, 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, node *pc.PocketNode, proofTx func(cliCtx util.CLIContext, txBuilder auth.TxBuilder, merkleProof pc.MerkleProof, leafNode pc.Proof, evidenceType pc.EvidenceType) (*sdk.TxResponse, error))
SendProofTx auto sends a proof transaction for the claim
func (Keeper) SessionNodeCount ¶
"SessionNodeCount" - Returns the session node count parameter from the paramstore Number of nodes dispatched in a single session
func (Keeper) SetClaims ¶
"SetClaims" - Sets all the claim messages in the state storage. (Needed for genesis initializing)
func (Keeper) SetHostedBlockchains ¶
func (k Keeper) SetHostedBlockchains(m map[string]pc.HostedBlockchain) *pc.HostedBlockchains
func (Keeper) SetParams ¶
"SetParams" - Sets all of the parameters in the paramstore using the params structure
func (Keeper) StakeDenom ¶
"StakeDenom" - Returns the stake coin denomination from the node module
func (Keeper) SupportedBlockchains ¶
"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 (Keeper) ValidateClaim ¶
"ValidateClaim" - Validates a claim message and returns an sdk error if invalid