cosmos-sdk/x/slashing/keeper/test_common.go
Aaron Craelius 2e11c81668
Make sdk.Msg implement proto.Message (#6327)
* Make sdk.Msg implement proto.Message

* Cleaning up

* Cleaning up

* Update CHANGELOG.md

* Lint fixes

* Lint fixes

* fix tests

Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
2020-06-03 19:52:05 +00:00

42 lines
1.2 KiB
Go

package keeper
// DONTCOVER
import (
"github.com/tendermint/tendermint/crypto"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/slashing/types"
"github.com/cosmos/cosmos-sdk/x/staking"
)
// TODO remove dependencies on staking (should only refer to validator set type from sdk)
var (
InitTokens = sdk.TokensFromConsensusPower(200)
)
// Have to change these parameters for tests
// lest the tests take forever
func TestParams() types.Params {
params := types.DefaultParams()
params.SignedBlocksWindow = 1000
params.DowntimeJailDuration = 60 * 60
return params
}
func NewTestMsgCreateValidator(address sdk.ValAddress, pubKey crypto.PubKey, amt sdk.Int) *staking.MsgCreateValidator {
commission := staking.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec())
return staking.NewMsgCreateValidator(
address, pubKey, sdk.NewCoin(sdk.DefaultBondDenom, amt),
staking.Description{}, commission, sdk.OneInt(),
)
}
func NewTestMsgDelegate(delAddr sdk.AccAddress, valAddr sdk.ValAddress, delAmount sdk.Int) *staking.MsgDelegate {
amount := sdk.NewCoin(sdk.DefaultBondDenom, delAmount)
return staking.NewMsgDelegate(delAddr, valAddr, amount)
}