Documentation ¶
Index ¶
- func CalculateValHash(valSet []stakingtypes.Validator) []byte
- func GenTmValidatorSet(numVals int) (*tmtypes.ValidatorSet, error)
- func GetTmConsPubKey(v stakingtypes.Validator) (tmcrypto.PubKey, error)
- func Min(a, b uint64) uint64
- func NewValidator(t testing.TB, operator sdk.ValAddress, pubKey cryptotypes.PubKey) stakingtypes.Validator
- func ToTmValidator(v stakingtypes.Validator, r math.Int) (*tmtypes.Validator, error)
- func ToTmValidators(v stakingtypes.Validators, r math.Int) ([]*tmtypes.Validator, error)
- func ZeroCommission() stakingtypes.CommissionRates
- type Helper
- func (h *Helper) BeginBlock(r *rand.Rand) sdk.Context
- func (h *Helper) CheckDelegator(delegator sdk.AccAddress, val sdk.ValAddress, found bool)
- func (h *Helper) CheckValidator(addr sdk.ValAddress, status stakingtypes.BondStatus, jailed bool) stakingtypes.Validator
- func (h *Helper) EndBlock() sdk.Context
- func (h *Helper) GenAndApplyEmptyBlock(r *rand.Rand) sdk.Context
- func (h *Helper) Handle(action func(sdk.Context) (proto.Message, error)) *sdk.Result
- func (h *Helper) WrappedBeginRedelegate(delegator sdk.AccAddress, srcVal sdk.ValAddress, dstVal sdk.ValAddress, ...) *sdk.Result
- func (h *Helper) WrappedDelegate(delegator sdk.AccAddress, val sdk.ValAddress, amount math.Int) *sdk.Result
- func (h *Helper) WrappedDelegateWithPower(delegator sdk.AccAddress, val sdk.ValAddress, power int64) *sdk.Result
- func (h *Helper) WrappedUndelegate(delegator sdk.AccAddress, val sdk.ValAddress, amount math.Int) *sdk.Result
- type ValidatorInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateValHash ¶
func CalculateValHash(valSet []stakingtypes.Validator) []byte
calculate validator hash and new header (adapted from https://github.com/cosmos/cosmos-sdk/blob/v0.45.5/simapp/test_helpers.go#L156-L163)
func GenTmValidatorSet ¶
func GenTmValidatorSet(numVals int) (*tmtypes.ValidatorSet, error)
GenTmValidatorSet generates a set with `numVals` Tendermint validators
func GetTmConsPubKey ¶
func GetTmConsPubKey(v stakingtypes.Validator) (tmcrypto.PubKey, error)
GetTmConsPubKey gets the validator's public key as a tmcrypto.PubKey.
func NewValidator ¶
func NewValidator(t testing.TB, operator sdk.ValAddress, pubKey cryptotypes.PubKey) stakingtypes.Validator
NewValidator is a testing helper method to create validators in tests
func ToTmValidator ¶
ToTmValidator casts an SDK validator to a tendermint type Validator.
func ToTmValidators ¶
func ToTmValidators(v stakingtypes.Validators, r math.Int) ([]*tmtypes.Validator, error)
ToTmValidators casts all validators to the corresponding tendermint type.
func ZeroCommission ¶
func ZeroCommission() stakingtypes.CommissionRates
ZeroCommission constructs a commission rates with all zeros.
Types ¶
type Helper ¶
type Helper struct { Ctx sdk.Context App *app.BabylonApp EpochingKeeper *keeper.Keeper MsgSrvr types.MsgServer QueryClient types.QueryClient StakingKeeper *stakingkeeper.Keeper GenAccs []authtypes.GenesisAccount ValBlsPrivKeys []ValidatorInfo // contains filtered or unexported fields }
Helper is a structure which wraps the entire app and exposes functionalities for testing the epoching module
func NewHelperWithValSet ¶
NewHelperWithValSet is same as NewHelper, except that it creates a set of validators
func (*Helper) CheckDelegator ¶
func (h *Helper) CheckDelegator(delegator sdk.AccAddress, val sdk.ValAddress, found bool)
CheckDelegator asserts that a delegator exists
func (*Helper) CheckValidator ¶
func (h *Helper) CheckValidator(addr sdk.ValAddress, status stakingtypes.BondStatus, jailed bool) stakingtypes.Validator
CheckValidator asserts that a validor exists and has a given status (if status!="") and if has a right jailed flag.
func (*Helper) GenAndApplyEmptyBlock ¶
GenAndApplyEmptyBlock generates a new empty block and appends it to the current blockchain
func (*Helper) Handle ¶
Handle executes an action function with the Helper's context, wraps the result into an SDK service result, and performs two assertions before returning it
func (*Helper) WrappedBeginRedelegate ¶
func (h *Helper) WrappedBeginRedelegate(delegator sdk.AccAddress, srcVal sdk.ValAddress, dstVal sdk.ValAddress, amount math.Int) *sdk.Result
WrappedBeginRedelegate calls handler to redelegate some stake from a validator to another
func (*Helper) WrappedDelegate ¶
func (h *Helper) WrappedDelegate(delegator sdk.AccAddress, val sdk.ValAddress, amount math.Int) *sdk.Result
WrappedDelegate calls handler to delegate stake for a validator
func (*Helper) WrappedDelegateWithPower ¶
func (h *Helper) WrappedDelegateWithPower(delegator sdk.AccAddress, val sdk.ValAddress, power int64) *sdk.Result
WrappedDelegateWithPower calls handler to delegate stake for a validator
func (*Helper) WrappedUndelegate ¶
func (h *Helper) WrappedUndelegate(delegator sdk.AccAddress, val sdk.ValAddress, amount math.Int) *sdk.Result
WrappedUndelegate calls handler to unbound some stake from a validator.
type ValidatorInfo ¶
type ValidatorInfo struct { BlsKey bls12381.PrivateKey Address sdk.ValAddress }