keeper

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: Apache-2.0 Imports: 29 Imported by: 2

Documentation

Index

Constants

View Source
const DefaultLimit = 100
View Source
const (
	DefaultParamspace = types.ModuleName
)

Default parameter namespace

Variables

This section is empty.

Functions

func ABCIValidatorUpdate

func ABCIValidatorUpdate(pubkey crypto.PubKey, power int64) abci.ValidatorUpdate

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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

func NewQuerier

func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier

creates a querier for validator REST endpoints

func ParamKeyTable

func ParamKeyTable() paramtypes.KeyTable

ParamTable for node module

Types

type Keeper

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

keeper of the node store

func NewKeeper

func NewKeeper(cdc codec.Codec, storeKey sdk.StoreKey, ps paramtypes.Subspace) Keeper

func (Keeper) AddNode

func (k Keeper) AddNode(ctx sdk.Context, name string, cert string) (id tmbytes.HexBytes, err error)

AddNode adds a node

func (Keeper) AfterDelegationModified

func (k Keeper) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

AfterDelegationModified - call hook if registered

func (Keeper) AfterValidatorBeginUnbonding

func (k Keeper) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

AfterValidatorBeginUnbonding - call hook if registered

func (Keeper) AfterValidatorBonded

func (k Keeper) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

AfterValidatorBonded - call hook if registered

func (Keeper) AfterValidatorCreated

func (k Keeper) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress)

AfterValidatorCreated - call hook if registered

func (Keeper) AfterValidatorRemoved

func (k Keeper) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

AfterValidatorRemoved - call hook if registered

func (Keeper) ApplyAndReturnValidatorSetUpdates

func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) (updates []abci.ValidatorUpdate, err error)

func (Keeper) BeforeDelegationCreated

func (k Keeper) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

BeforeDelegationCreated - call hook if registered

func (Keeper) BeforeDelegationRemoved

func (k Keeper) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

BeforeDelegationRemoved - call hook if registered

func (Keeper) BeforeDelegationSharesModified

func (k Keeper) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

BeforeDelegationSharesModified - call hook if registered

func (Keeper) BeforeValidatorModified

func (k Keeper) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress)

BeforeValidatorModified - call hook if registered

func (Keeper) BeforeValidatorSlashed

func (k Keeper) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec)

BeforeValidatorSlashed - call hook if registered

func (Keeper) CreateValidator

func (k Keeper) CreateValidator(ctx sdk.Context,
	id tmbytes.HexBytes,
	name string,
	certificate string,
	pubKey cryptotypes.PubKey,
	power int64,
	description string,
	operator string,
) error

CreateValidator create a new validator

func (Keeper) Delegation

func (k Keeper) Delegation(context sdk.Context, accAddr sdk.AccAddress, consAddr sdk.ValAddress) staking.DelegationI

func (Keeper) DeleteHistoricalInfo

func (k Keeper) DeleteHistoricalInfo(ctx sdk.Context, height int64)

DeleteHistoricalInfo deletes the historical info at a given height

func (Keeper) DeleteNode

func (k Keeper) DeleteNode(ctx sdk.Context, id tmbytes.HexBytes)

DeleteNode deletes the given node

func (Keeper) DeleteValidator

func (k Keeper) DeleteValidator(ctx sdk.Context, validator types.Validator)

DeleteValidator deletes the validator with id

func (Keeper) DeleteValidatorConsAddrIndex

func (k Keeper) DeleteValidatorConsAddrIndex(ctx sdk.Context, addr sdk.ConsAddress)

DeleteValidatorConsAddrIndex deletes the validator index with pubkey

func (Keeper) DequeueValidatorsUpdate

func (k Keeper) DequeueValidatorsUpdate(ctx sdk.Context, pubkey string)

DequeueValidatorsUpdate dequeue from the validators update queue

func (Keeper) EnqueueValidatorsUpdate

func (k Keeper) EnqueueValidatorsUpdate(ctx sdk.Context, validator types.Validator, power int64)

EnqueueValidatorsUpdate enqueue to the validators update queue

func (Keeper) FilterNodeByID

func (k Keeper) FilterNodeByID(ctx sdk.Context, nodeID string) abci.ResponseQuery

FilterNodeByID implements sdk.PeerFilter

func (Keeper) GetAllHistoricalInfo

func (k Keeper) GetAllHistoricalInfo(ctx sdk.Context) []types.HistoricalInfo

GetAllHistoricalInfo returns all stored HistoricalInfo objects.

func (Keeper) GetAllValidators

func (k Keeper) GetAllValidators(ctx sdk.Context) (validators []types.Validator)

GetAllValidators gets the set of all validators with no limits, used during genesis dump

func (Keeper) GetHistoricalInfo

func (k Keeper) GetHistoricalInfo(ctx sdk.Context, height int64) (stakingtypes.HistoricalInfo, bool)

GetHistoricalInfo gets the historical info at a given height

func (Keeper) GetLastValidators

func (k Keeper) GetLastValidators(ctx sdk.Context) (validators []types.Validator)

get the group of the bonded validators

func (Keeper) GetNode

func (k Keeper) GetNode(ctx sdk.Context, id tmbytes.HexBytes) (node types.Node, found bool)

GetNode retrieves the node of the specified ID

func (Keeper) GetNodes

func (k Keeper) GetNodes(ctx sdk.Context) []types.Node

GetNodes gets all nodes

func (Keeper) GetParams

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

Get all parameteras as types.Params

func (*Keeper) GetRootCert

func (k *Keeper) GetRootCert(ctx sdk.Context) (cert string, found bool)

func (Keeper) GetValidator

func (k Keeper) GetValidator(ctx sdk.Context, id tmbytes.HexBytes) (validator types.Validator, found bool)

GetValidator returns validator with id

func (Keeper) GetValidatorByConsAddr

func (k Keeper) GetValidatorByConsAddr(ctx sdk.Context, addr sdk.ConsAddress) (validator types.Validator, found bool)

GetValidatorByConsAddr returns validator with pubkey

func (Keeper) HasNode

func (k Keeper) HasNode(ctx sdk.Context, id tmbytes.HexBytes) bool

HasNode returns true if the specified node exists, false otherwise

func (Keeper) HasValidatorName

func (k Keeper) HasValidatorName(ctx sdk.Context, name string) bool

HasValidatorName returns true or false with name

func (Keeper) HistoricalEntries

func (k Keeper) HistoricalEntries(ctx sdk.Context) (res uint32)

HistoricalEntries = number of historical info entries to persist in store

func (*Keeper) IterateBondedValidatorsByPower

func (k *Keeper) IterateBondedValidatorsByPower(ctx sdk.Context, fn func(index int64, validator staking.ValidatorI) (stop bool))

func (*Keeper) IterateDelegations

func (k *Keeper) IterateDelegations(
	ctx sdk.Context, delegator sdk.AccAddress,
	fn func(index int64, delegation staking.DelegationI) (stop bool),
)

func (Keeper) IterateHistoricalInfo

func (k Keeper) IterateHistoricalInfo(ctx sdk.Context, cb func(types.HistoricalInfo) bool)

IterateHistoricalInfo provides an interator over all stored HistoricalInfo

objects. For each HistoricalInfo object, cb will be called. If the cb returns

true, the iterator will close and stop.

func (Keeper) IterateUpdateValidators

func (k Keeper) IterateUpdateValidators(ctx sdk.Context, fn func(index int64, pubkey string, power int64) (stop bool))

IterateUpdateValidators iterates through the validators update queue

func (Keeper) IterateValidators

func (k Keeper) IterateValidators(ctx sdk.Context, fn func(index int64, validator staking.ValidatorI) (stop bool))

IterateValidators iterates through the validator set and perform the provided function

func (Keeper) Jail

func (k Keeper) Jail(ctx sdk.Context, consAddr sdk.ConsAddress)

Jail disable the validator

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) MaxValidators

func (k Keeper) MaxValidators(context sdk.Context) uint32

func (Keeper) RemoveNode

func (k Keeper) RemoveNode(ctx sdk.Context, id tmbytes.HexBytes) error

RemoveNode removes the specified node

func (Keeper) RemoveValidator

func (k Keeper) RemoveValidator(ctx sdk.Context,
	id tmbytes.HexBytes,
	operator string,
) error

RemoveValidator deletes an existing validator record

func (Keeper) SetHistoricalInfo

func (k Keeper) SetHistoricalInfo(ctx sdk.Context, height int64, hi types.HistoricalInfo)

SetHistoricalInfo sets the historical info at a given height

func (*Keeper) SetHooks

func (k *Keeper) SetHooks(sh staking.StakingHooks) *Keeper

SetHooks sets the validator hooks

func (Keeper) SetNode

func (k Keeper) SetNode(ctx sdk.Context, id tmbytes.HexBytes, node types.Node)

SetNode sets the given node

func (Keeper) SetParams

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

set the params

func (*Keeper) SetRootCert

func (k *Keeper) SetRootCert(ctx sdk.Context, cert string)

func (Keeper) SetValidator

func (k Keeper) SetValidator(ctx sdk.Context, validator types.Validator)

SetValidator sets the main record holding validator details

func (Keeper) SetValidatorConsAddrIndex

func (k Keeper) SetValidatorConsAddrIndex(ctx sdk.Context, id tmbytes.HexBytes, addr sdk.ConsAddress)

SetValidatorConsAddrIndex sets the validator index by pubkey

func (Keeper) Slash

func (k Keeper) Slash(ctx sdk.Context, consAddr sdk.ConsAddress, i int64, i2 int64, dec sdk.Dec)

Slash not implement

func (*Keeper) TotalBondedTokens

func (k *Keeper) TotalBondedTokens(ctx sdk.Context) sdk.Int

func (Keeper) TrackHistoricalInfo

func (k Keeper) TrackHistoricalInfo(ctx sdk.Context)

TrackHistoricalInfo saves the latest historical-info and deletes the oldest heights that are below pruning height

func (Keeper) UnbondingTime

func (k Keeper) UnbondingTime(ctx sdk.Context) (res time.Duration)

UnbondingTime

func (Keeper) Unjail

func (k Keeper) Unjail(ctx sdk.Context, consAddr sdk.ConsAddress)

Unjail enable the validator

func (Keeper) UpdateValidator

func (k Keeper) UpdateValidator(ctx sdk.Context,
	id tmbytes.HexBytes,
	name string,
	certificate string,
	power int64,
	description string,
	operator string,
) error

UpdateValidator updates an existing validator record

func (Keeper) Validator

func (k Keeper) Validator(ctx sdk.Context, valAddr sdk.ValAddress) staking.ValidatorI

Validator return the validator imformation by valAddr

func (Keeper) ValidatorByConsAddr

func (k Keeper) ValidatorByConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress) staking.ValidatorI

ValidatorByConsAddr return the validator imformation by consAddr

func (Keeper) ValidatorByID

func (k Keeper) ValidatorByID(ctx sdk.Context, id tmbytes.HexBytes) staking.ValidatorI

ValidatorByID return the validator imformation by id

func (*Keeper) VerifyCert

func (k *Keeper) VerifyCert(ctx sdk.Context, certStr string) (cert cautil.Cert, err error)

func (Keeper) VerifyCertificate

func (k Keeper) VerifyCertificate(ctx sdk.Context, certificate string) (crypto.PubKey, error)

VerifyCertificate verifies the given certificate against the root certificate Ensure that the given certificate is a valid X.509 format

type Querier

type Querier struct {
	Keeper
}

Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper

func (Querier) Node

Node queries a node by id

func (Querier) Nodes

Nodes queries all nodes

func (Querier) Params

Params queries the parameters of the node module

func (Querier) Validator

Validator queries the validator by the given id

func (Querier) Validators

Validators queries the validators

Jump to

Keyboard shortcuts

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