teststaking

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTmConsPubKey

func GetTmConsPubKey(v types.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) types.Validator

NewValidator is a testing helper method to create validators in tests

func ToTmValidator

func ToTmValidator(v types.Validator) (*tmtypes.Validator, error)

ToTmValidator casts an SDK validator to a augusteum type Validator.

func ToTmValidators

func ToTmValidators(v types.Validators) ([]*tmtypes.Validator, error)

ToTmValidators casts all validators to the corresponding augusteum type.

func ZeroCommission

func ZeroCommission() stakingtypes.CommissionRates

ZeroCommission constructs a commission rates with all zeros.

Types

type Helper

type Helper struct {
	Ctx        sdk.Context
	Commission stakingtypes.CommissionRates
	// Coin Denomination
	Denom string
	// contains filtered or unexported fields
}

Helper is a structure which wraps the staking handler and provides methods useful in tests

func NewHelper

func NewHelper(t *testing.T, ctx sdk.Context, k keeper.Keeper) *Helper

NewHelper creates staking Handler wrapper for tests

func (*Helper) CheckDelegator

func (sh *Helper) CheckDelegator(delegator sdk.AccAddress, val sdk.ValAddress, found bool)

CheckDelegator asserts that a delegator exists

func (*Helper) CheckValidator

func (sh *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) CreateValidator

func (sh *Helper) CreateValidator(addr sdk.ValAddress, pk cryptotypes.PubKey, fctaAmount sdk.Int, ok bool)

CreateValidator calls handler to create a new staking validator

func (*Helper) CreateValidatorMsg

func (sh *Helper) CreateValidatorMsg(addr sdk.ValAddress, pk cryptotypes.PubKey, fctaAmount sdk.Int) *stakingtypes.MsgCreateValidator

CreateValidatorMsg returns a message used to create validator in this service.

func (*Helper) CreateValidatorWithValPower

func (sh *Helper) CreateValidatorWithValPower(addr sdk.ValAddress, pk cryptotypes.PubKey, valPower int64, ok bool) sdk.Int

CreateValidatorWithValPower calls handler to create a new staking validator with zero commission

func (*Helper) Delegate

func (sh *Helper) Delegate(delegator sdk.AccAddress, val sdk.ValAddress, amount sdk.Int)

Delegate calls handler to delegate ucta for a validator

func (*Helper) DelegateWithPower

func (sh *Helper) DelegateWithPower(delegator sdk.AccAddress, val sdk.ValAddress, power int64)

DelegateWithPower calls handler to delegate ucta for a validator

func (*Helper) Handle

func (sh *Helper) Handle(msg sdk.Msg, ok bool) *sdk.Result

Handle calls staking handler on a given message

func (*Helper) TurnBlock

func (sh *Helper) TurnBlock(newTime time.Time) sdk.Context

TurnBlock calls EndBlocker and updates the block time

func (*Helper) TurnBlockTimeDiff

func (sh *Helper) TurnBlockTimeDiff(diff time.Duration) sdk.Context

TurnBlockTimeDiff calls EndBlocker and updates the block time by adding the duration to the current block time

func (*Helper) Undelegate

func (sh *Helper) Undelegate(delegator sdk.AccAddress, val sdk.ValAddress, amount sdk.Int, ok bool) *sdk.Result

Undelegate calls handler to unbound some ucta from a validator.

Jump to

Keyboard shortcuts

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