cosmos-sdk/x/slashing/keeper/test_common.go

41 lines
1.2 KiB
Go
Raw Normal View History

package keeper
// nolint:deadcode,unused
// DONTCOVER
// noalias
2018-05-28 14:39:57 -07:00
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/slashing/types"
2019-01-11 12:08:01 -08:00
"github.com/cosmos/cosmos-sdk/x/staking"
2020-03-03 08:21:17 -08:00
"github.com/tendermint/tendermint/crypto"
2018-05-28 14:39:57 -07:00
)
Merge PR #1119: Unbonding, Redelegation * stake/fees spec updates * staking overview.md revisions, moving files * docs reorganization * staking spec state revisions * transaction stake updates * complete staking spec update * WIP adding unbonding/redelegation commands * added msg types for unbonding, redelegation * stake sub-package reorg * working stake reorg * modify lcd tests to not use hardcoded json strings * add description update * index keys * key managment for unbonding redelegation complete * update stake errors * completed handleMsgCompleteUnbonding fn * updated to use begin/complete unbonding/redelegation * fix token shares bug * develop docs into unbonding * got non-tests compiling after merge develop * working fixing tests * PrivlegedKeeper -> PrivilegedKeeper * tests compile * fix some tests * fixing tests * remove PrivilegedKeeper * get unbonding bug * only rpc sig verification failed tests now * move percent unbonding/redelegation to the CLI and out of handler logic * remove min unbonding height * add lcd txs * add pool sanity checks, fix a buncha tests * fix ante. set lcd log to debug (#1322) * redelegation tests, adding query functionality for bonds * add self-delegations at genesis ref #1165 * PR comments (mostly) addressed * cleanup, added Query LCD functionality * test cleanup/fixes * fix governance test * SlashValidatorSet -> ValidatorSet * changelog * stake lcd fix * x/auth: fix chainID in ante * fix lcd test * fix lint, update lint make command for spelling * lowercase error string * don't expose coinkeeper in staking * remove a few duplicate lines in changelog * chain_id in stake lcd tests * added transient redelegation * 'transient' => 'transitive' * Re-add nolint instruction * Fix tiny linter error
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 (
InitTokens = sdk.TokensFromConsensusPower(200)
2018-05-28 14:39:57 -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
return params
2018-05-28 14:39:57 -07:00
}
2019-01-11 12:08:01 -08:00
func NewTestMsgCreateValidator(address sdk.ValAddress, pubKey crypto.PubKey, amt sdk.Int) staking.MsgCreateValidator {
commission := staking.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec())
2019-01-17 09:53:22 -08:00
return staking.NewMsgCreateValidator(
address, pubKey, sdk.NewCoin(sdk.DefaultBondDenom, amt),
2019-02-08 12:44:19 -08:00
staking.Description{}, commission, sdk.OneInt(),
2019-01-17 09:53:22 -08:00
)
2018-05-28 14:39:57 -07:00
}
func NewTestMsgDelegate(delAddr sdk.AccAddress, valAddr sdk.ValAddress, delAmount sdk.Int) staking.MsgDelegate {
amount := sdk.NewCoin(sdk.DefaultBondDenom, delAmount)
2019-01-17 09:53:22 -08:00
return staking.NewMsgDelegate(delAddr, valAddr, amount)
}