keeper

package
v0.0.0-...-cbd54f3 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

View Source
const (
	SamplePubKey  = "b7a3c12dc0c8c748ab07525b701122b88bd78f600c76342d27f25e5f92444cde"
	SamplePubKey2 = "b7a3c12dc0c8c748ab07525b701122b88bd78f600c76342d27f25e5f92444cdf"
)
View Source
const (
	DefaultParamspace = types.ModuleName
)

Variables

This section is empty.

Functions

func MakeTestPubKey

func MakeTestPubKey(pk string) crypto.PubKey

Types

type Keeper

type Keeper struct {
	CoinKeeper bank.Keeper
	// contains filtered or unexported fields
}

Keeper of the poa store

func MakeTestCtxAndKeeper

func MakeTestCtxAndKeeper(t *testing.T) (sdk.Context, Keeper)

func NewKeeper

func NewKeeper(coinKeeper bank.Keeper, cdc *codec.Codec, key sdk.StoreKey, paramspace params.Subspace) Keeper

NewKeeper creates a poa keeper

func (Keeper) ApplyAndReturnValidatorSetUpdates

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

ApplyAndReturnValidatorSetUpdates at the end of every block we update and return the validator set

func (Keeper) CalculateValidatorVotes

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

CalculateValidatorVote happens at the start of every block to ensure no malacious actors

func (Keeper) Delete

func (k Keeper) Delete(ctx sdk.Context, key []byte, prefix []byte)

func (Keeper) DeleteAllVotesByValidator

func (k Keeper) DeleteAllVotesByValidator(ctx sdk.Context, voter sdk.ValAddress) bool

func (Keeper) DeleteVote

func (k Keeper) DeleteVote(ctx sdk.Context, key []byte)

func (Keeper) Get

func (k Keeper) Get(ctx sdk.Context, key []byte, prefix []byte, unmarshal UnmarshalFn) (i interface{}, found bool)

Get gets an item from the store by bytes

func (Keeper) GetAll

func (k Keeper) GetAll(ctx sdk.Context, prefix []byte, unmarshal UnmarshalFn) (i []interface{})

GetAll values from with a prefix from the store

func (Keeper) GetAllAcceptedValidators

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

func (Keeper) GetAllValidators

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

func (Keeper) GetAllValidatorsAcceptedAndInSet

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

func (Keeper) GetAllValidatorsWithCondition

func (k Keeper) GetAllValidatorsWithCondition(ctx sdk.Context, validatorSelector ValidatorSelectorFn) (validators []types.Validator)

func (Keeper) GetAllVotes

func (k Keeper) GetAllVotes(ctx sdk.Context) (votes []types.Vote)

func (Keeper) GetAllVotesForValidator

func (k Keeper) GetAllVotesForValidator(ctx sdk.Context, name string) (votes []types.Vote)

func (Keeper) GetAllVotesWithCondition

func (k Keeper) GetAllVotesWithCondition(ctx sdk.Context, key []byte, voteSelector VoteSelectorFn) (votes []types.Vote)

func (Keeper) GetParams

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

GetParams returns the total set of poa parameters.

func (Keeper) GetValidator

func (k Keeper) GetValidator(ctx sdk.Context, key string) (types.Validator, bool)

func (Keeper) GetValidatorByAddress

func (k Keeper) GetValidatorByAddress(ctx sdk.Context, valAddress sdk.ValAddress) (types.Validator, bool)

func (Keeper) GetVote

func (k Keeper) GetVote(ctx sdk.Context, key []byte) (types.Vote, bool)

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) Set

func (k Keeper) Set(ctx sdk.Context, key []byte, prefix []byte, i interface{})

Set sets a value in the db with a prefixed key

func (Keeper) SetParams

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

SetParams sets the poa parameters to the param space.

func (Keeper) SetValidator

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

func (Keeper) SetValidatorIsAccepted

func (k Keeper) SetValidatorIsAccepted(ctx sdk.Context, key string, validator types.Validator, isAccepted bool)

SetValidatorIsAccepted when the validator is accepeted into the consensus accepted is set to true

func (Keeper) SetValidatorIsAcceptedAndInSet

func (k Keeper) SetValidatorIsAcceptedAndInSet(ctx sdk.Context, key string, validator types.Validator, isAccepted bool, isInSet bool)

SetValidatorIsAccepted when the validator is accepeted into the consensus accepted is set to true and is in the validator set

func (Keeper) SetValidatorIsInSet

func (k Keeper) SetValidatorIsInSet(ctx sdk.Context, key string, validator types.Validator, isInSet bool)

SetValidatorIsInSet after a validator has been accepted and not added to the set we need this function

func (Keeper) SetVote

func (k Keeper) SetVote(ctx sdk.Context, vote types.Vote)

SetVote sets a vote with key as votee and voter combined in a byte array

func (Keeper) UnmarshalValidator

func (k Keeper) UnmarshalValidator(value []byte) (interface{}, bool)

func (Keeper) UnmarshalVote

func (k Keeper) UnmarshalVote(value []byte) (interface{}, bool)

type SelectorFn

type SelectorFn func(interface{}) bool

SelectorFn allows an entity to be selected by certain conditions

type UnmarshalFn

type UnmarshalFn func(value []byte) (interface{}, bool)

UnmarshalFn is a generic function to unmarshal bytes

type ValidatorSelectorFn

type ValidatorSelectorFn func(validator types.Validator) bool

ValidatorSelectorFn allows validators to be selected by certain conditions

type VoteSelectorFn

type VoteSelectorFn func(vote types.Vote) bool

VoteSelectorFn allows validators to be selected by certain conditions

Jump to

Keyboard shortcuts

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