2020-02-18 04:50:13 -08:00
|
|
|
package keeper
|
|
|
|
|
2019-07-19 06:43:38 -07:00
|
|
|
// DONTCOVER
|
2018-05-28 14:39:57 -07:00
|
|
|
|
|
|
|
import (
|
2020-03-20 10:14:14 -07:00
|
|
|
"github.com/tendermint/tendermint/crypto"
|
|
|
|
|
2018-05-28 14:39:57 -07:00
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
2020-02-19 16:04:13 -08:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/slashing/types"
|
2020-06-12 07:54:37 -07:00
|
|
|
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
2018-05-28 14:39:57 -07:00
|
|
|
)
|
|
|
|
|
2018-06-26 19:00:12 -07:00
|
|
|
// TODO remove dependencies on staking (should only refer to validator set type from sdk)
|
|
|
|
|
2018-05-28 14:39:57 -07:00
|
|
|
var (
|
2019-07-19 06:43:38 -07:00
|
|
|
InitTokens = sdk.TokensFromConsensusPower(200)
|
2018-05-28 14:39:57 -07:00
|
|
|
)
|
|
|
|
|
2019-07-19 06:43:38 -07:00
|
|
|
// 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
|
2020-05-02 12:26:59 -07:00
|
|
|
|
2019-07-19 06:43:38 -07:00
|
|
|
return params
|
2018-05-28 14:39:57 -07:00
|
|
|
}
|
|
|
|
|
2020-06-12 07:54:37 -07:00
|
|
|
func NewTestMsgCreateValidator(address sdk.ValAddress, pubKey crypto.PubKey, amt sdk.Int) *stakingtypes.MsgCreateValidator {
|
|
|
|
commission := stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec())
|
2020-05-02 12:26:59 -07:00
|
|
|
|
2020-06-12 07:54:37 -07:00
|
|
|
return stakingtypes.NewMsgCreateValidator(
|
2019-02-13 15:01:50 -08:00
|
|
|
address, pubKey, sdk.NewCoin(sdk.DefaultBondDenom, amt),
|
2020-06-12 07:54:37 -07:00
|
|
|
stakingtypes.Description{}, commission, sdk.OneInt(),
|
2019-01-17 09:53:22 -08:00
|
|
|
)
|
2018-05-28 14:39:57 -07:00
|
|
|
}
|
2018-08-31 12:21:12 -07:00
|
|
|
|
2020-06-12 07:54:37 -07:00
|
|
|
func NewTestMsgDelegate(delAddr sdk.AccAddress, valAddr sdk.ValAddress, delAmount sdk.Int) *stakingtypes.MsgDelegate {
|
2019-02-13 15:01:50 -08:00
|
|
|
amount := sdk.NewCoin(sdk.DefaultBondDenom, delAmount)
|
2020-06-12 07:54:37 -07:00
|
|
|
return stakingtypes.NewMsgDelegate(delAddr, valAddr, amount)
|
2018-08-31 12:21:12 -07:00
|
|
|
}
|