various linter fixes (#8666)
This commit is contained in:
parent
39b816ebb3
commit
f2ee972e31
|
@ -1,3 +1,3 @@
|
|||
package statik
|
||||
|
||||
//This just for fixing the error in importing empty github.com/cosmos/cosmos-sdk/client/docs/statik
|
||||
// This just for fixing the error in importing empty github.com/cosmos/cosmos-sdk/client/docs/statik
|
||||
|
|
|
@ -25,6 +25,7 @@ func addHTTPDeprecationHeaders(h http.Handler) http.Handler {
|
|||
// WithHTTPDeprecationHeaders returns a new *mux.Router, identical to its input
|
||||
// but with the addition of HTTP Deprecation headers. This is used to mark legacy
|
||||
// amino REST endpoints as deprecated in the REST API.
|
||||
// nolint: gocritic
|
||||
func WithHTTPDeprecationHeaders(r *mux.Router) *mux.Router {
|
||||
subRouter := r.NewRoute().Subrouter()
|
||||
subRouter.Use(addHTTPDeprecationHeaders)
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/types/rest"
|
||||
)
|
||||
|
||||
//BlockCommand returns the verified block data for a given heights
|
||||
// BlockCommand returns the verified block data for a given heights
|
||||
func BlockCommand() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "block [height]",
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
|
||||
// TODO these next two functions feel kinda hacky based on their placement
|
||||
|
||||
//ValidatorCommand returns the validator set for a given height
|
||||
// ValidatorCommand returns the validator set for a given height
|
||||
func ValidatorCommand() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "tendermint-validator-set [height]",
|
||||
|
|
|
@ -219,9 +219,9 @@ func createIncrementalAccounts(accNum int) []sdk.AccAddress {
|
|||
// start at 100 so we can make up to 999 test addresses with valid test addresses
|
||||
for i := 100; i < (accNum + 100); i++ {
|
||||
numString := strconv.Itoa(i)
|
||||
buffer.WriteString("A58856F0FD53BF058B4909A21AEC019107BA6") //base address string
|
||||
buffer.WriteString("A58856F0FD53BF058B4909A21AEC019107BA6") // base address string
|
||||
|
||||
buffer.WriteString(numString) //adding on final two digits to make addresses unique
|
||||
buffer.WriteString(numString) // adding on final two digits to make addresses unique
|
||||
res, _ := sdk.AccAddressFromHex(buffer.String())
|
||||
bech := res.String()
|
||||
addr, _ := TestAddr(buffer.String(), bech)
|
||||
|
|
|
@ -19,7 +19,6 @@ type Store struct {
|
|||
}
|
||||
|
||||
// NewStore returns a reference to a new GasKVStore.
|
||||
// nolint
|
||||
func NewStore(parent types.KVStore, gasMeter types.GasMeter, gasConfig types.GasConfig) *Store {
|
||||
kvs := &Store{
|
||||
gasMeter: gasMeter,
|
||||
|
|
|
@ -80,8 +80,6 @@ func precisionMultiplier(prec int64) *big.Int {
|
|||
return precisionMultipliers[prec]
|
||||
}
|
||||
|
||||
//______________________________________________________________________________________________
|
||||
|
||||
// create a new Dec from integer assuming whole number
|
||||
func NewDec(i int64) Dec {
|
||||
return NewDecWithPrec(i, 0)
|
||||
|
@ -195,8 +193,6 @@ func MustNewDecFromStr(s string) Dec {
|
|||
return dec
|
||||
}
|
||||
|
||||
//______________________________________________________________________________________________
|
||||
//nolint
|
||||
func (d Dec) IsNil() bool { return d.i == nil } // is decimal nil
|
||||
func (d Dec) IsZero() bool { return (d.i).Sign() == 0 } // is equal to zero
|
||||
func (d Dec) IsNegative() bool { return (d.i).Sign() == -1 } // is negative
|
||||
|
@ -215,8 +211,8 @@ func (d Dec) BigInt() *big.Int {
|
|||
return nil
|
||||
}
|
||||
|
||||
copy := new(big.Int)
|
||||
return copy.Set(d.i)
|
||||
cp := new(big.Int)
|
||||
return cp.Set(d.i)
|
||||
}
|
||||
|
||||
// addition
|
||||
|
@ -561,8 +557,6 @@ func (d Dec) RoundInt() Int {
|
|||
return NewIntFromBigInt(chopPrecisionAndRoundNonMutative(d.i))
|
||||
}
|
||||
|
||||
//___________________________________________________________________________________
|
||||
|
||||
// similar to chopPrecisionAndRound, but always rounds down
|
||||
func chopPrecisionAndTruncate(d *big.Int) *big.Int {
|
||||
return d.Quo(d, precisionReuse)
|
||||
|
@ -612,8 +606,6 @@ func (d Dec) Ceil() Dec {
|
|||
return NewDecFromBigInt(quo.Add(quo, oneInt))
|
||||
}
|
||||
|
||||
//___________________________________________________________________________________
|
||||
|
||||
// MaxSortableDec is the largest Dec that can be passed into SortableDecBytes()
|
||||
// Its negative form is the least Dec that can be passed in.
|
||||
var MaxSortableDec = OneDec().Quo(SmallestDec())
|
||||
|
@ -648,8 +640,6 @@ func SortableDecBytes(dec Dec) []byte {
|
|||
return []byte(fmt.Sprintf(fmt.Sprintf("%%0%ds", Precision*2+1), dec.String()))
|
||||
}
|
||||
|
||||
//___________________________________________________________________________________
|
||||
|
||||
// reuse nil values
|
||||
var nilJSON []byte
|
||||
|
||||
|
@ -758,7 +748,6 @@ func (dp DecProto) String() string {
|
|||
return dp.Dec.String()
|
||||
}
|
||||
|
||||
//___________________________________________________________________________________
|
||||
// helpers
|
||||
|
||||
// test if two decimal arrays are equal
|
||||
|
|
|
@ -29,8 +29,6 @@ func (s *decimalTestSuite) mustNewDecFromStr(str string) (d sdk.Dec) {
|
|||
return d
|
||||
}
|
||||
|
||||
//_______________________________________
|
||||
|
||||
func (s *decimalTestSuite) TestNewDecFromStr() {
|
||||
largeBigInt, success := new(big.Int).SetString("3144605511029693144278234343371835", 10)
|
||||
s.Require().True(success)
|
||||
|
|
|
@ -15,7 +15,6 @@ const UndefinedCodespace = "undefined"
|
|||
|
||||
var (
|
||||
// errInternal should never be exposed, but we reserve this code for non-specified errors
|
||||
//nolint
|
||||
errInternal = Register(UndefinedCodespace, 1, "internal")
|
||||
|
||||
// ErrTxDecode is returned if we cannot parse a transaction
|
||||
|
|
|
@ -43,8 +43,6 @@ import (
|
|||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
)
|
||||
|
||||
//__________________________________________________________________________________________
|
||||
|
||||
// AppModuleBasic is the standard form for basic non-dependant elements of an application module.
|
||||
type AppModuleBasic interface {
|
||||
Name() string
|
||||
|
@ -146,8 +144,6 @@ func (bm BasicManager) AddQueryCommands(rootQueryCmd *cobra.Command) {
|
|||
}
|
||||
}
|
||||
|
||||
//_________________________________________________________
|
||||
|
||||
// AppModuleGenesis is the standard form for an application module genesis functions
|
||||
type AppModuleGenesis interface {
|
||||
AppModuleBasic
|
||||
|
@ -186,8 +182,6 @@ type AppModule interface {
|
|||
EndBlock(sdk.Context, abci.RequestEndBlock) []abci.ValidatorUpdate
|
||||
}
|
||||
|
||||
//___________________________
|
||||
|
||||
// GenesisOnlyAppModule is an AppModule that only has import/export functionality
|
||||
type GenesisOnlyAppModule struct {
|
||||
AppModuleGenesis
|
||||
|
@ -226,8 +220,6 @@ func (GenesisOnlyAppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []ab
|
|||
return []abci.ValidatorUpdate{}
|
||||
}
|
||||
|
||||
//____________________________________________________________________________
|
||||
|
||||
// Manager defines a module manager that provides the high level utility for managing and executing
|
||||
// operations for a group of modules
|
||||
type Manager struct {
|
||||
|
|
|
@ -6,8 +6,8 @@ type Config struct {
|
|||
ParamsFile string // custom simulation params file which overrides any random params; cannot be used with genesis
|
||||
|
||||
ExportParamsPath string // custom file path to save the exported params JSON
|
||||
ExportParamsHeight int //height to which export the randomly generated params
|
||||
ExportStatePath string //custom file path to save the exported app state JSON
|
||||
ExportParamsHeight int // height to which export the randomly generated params
|
||||
ExportStatePath string // custom file path to save the exported app state JSON
|
||||
ExportStatsPath string // custom file path to save the exported simulation statistics JSON
|
||||
|
||||
Seed int64 // simulation random seed
|
||||
|
|
|
@ -125,8 +125,6 @@ func (om OperationMsg) LogEvent(eventLogger func(route, op, evResult string)) {
|
|||
eventLogger(om.Route, om.Name, pass)
|
||||
}
|
||||
|
||||
//________________________________________________________________________
|
||||
|
||||
// FutureOperation is an operation which will be ran at the beginning of the
|
||||
// provided BlockHeight. If both a BlockHeight and BlockTime are specified, it
|
||||
// will use the BlockHeight. In the (likely) event that multiple operations
|
||||
|
|
|
@ -207,8 +207,6 @@ func (u *Uint) Size() int {
|
|||
func (u Uint) MarshalAmino() ([]byte, error) { return u.Marshal() }
|
||||
func (u *Uint) UnmarshalAmino(bz []byte) error { return u.Unmarshal(bz) }
|
||||
|
||||
//__________________________________________________________________________
|
||||
|
||||
// UintOverflow returns true if a given unsigned integer overflows and false
|
||||
// otherwise.
|
||||
func UintOverflow(i *big.Int) error {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// DONTCOVER
|
||||
// nolint
|
||||
package v034
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// DONTCOVER
|
||||
// nolint
|
||||
package v036
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// DONTCOVER
|
||||
// nolint
|
||||
package v036
|
||||
|
||||
import v034auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v034"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package v038
|
||||
|
||||
// DONTCOVER
|
||||
// nolint
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package v039
|
||||
|
||||
// DONTCOVER
|
||||
// nolint
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
|
|
@ -67,7 +67,9 @@ func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Rout
|
|||
|
||||
// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the auth module.
|
||||
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
|
||||
types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx))
|
||||
if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// GetTxCmd returns the root tx command for the auth module.
|
||||
|
@ -85,8 +87,6 @@ func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry)
|
|||
types.RegisterInterfaces(registry)
|
||||
}
|
||||
|
||||
//____________________________________________________________________________
|
||||
|
||||
// AppModule implements an application module for the auth module.
|
||||
type AppModule struct {
|
||||
AppModuleBasic
|
||||
|
@ -159,8 +159,6 @@ func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.Validato
|
|||
return []abci.ValidatorUpdate{}
|
||||
}
|
||||
|
||||
//____________________________________________________________________________
|
||||
|
||||
// AppModuleSimulation functions
|
||||
|
||||
// GenerateGenesisState creates a randomized GenState of the auth module
|
||||
|
|
|
@ -15,8 +15,7 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/x/auth/signing"
|
||||
)
|
||||
|
||||
// TxConfigTestSuite provides a test suite that can be used to test that a TxConfig implementation is correct
|
||||
//nolint:golint // type name will be used as tx.TxConfigTestSuite by other packages, and that stutters; consider calling this GeneratorTestSuite
|
||||
// TxConfigTestSuite provides a test suite that can be used to test that a TxConfig implementation is correct.
|
||||
type TxConfigTestSuite struct {
|
||||
suite.Suite
|
||||
TxConfig client.TxConfig
|
||||
|
|
|
@ -32,7 +32,6 @@ func (ar AccountRetriever) GetAccount(clientCtx client.Context, addr sdk.AccAddr
|
|||
// GetAccountWithHeight queries for an account given an address. Returns the
|
||||
// height of the query with the account. An error is returned if the query
|
||||
// or decoding fails.
|
||||
//nolint:interfacer
|
||||
func (ar AccountRetriever) GetAccountWithHeight(clientCtx client.Context, addr sdk.AccAddress) (client.Account, int64, error) {
|
||||
var header metadata.MD
|
||||
|
||||
|
|
|
@ -48,7 +48,6 @@ func ParamKeyTable() paramtypes.KeyTable {
|
|||
|
||||
// ParamSetPairs implements the ParamSet interface and returns all the key/value pairs
|
||||
// pairs of auth module's parameters.
|
||||
// nolint
|
||||
func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
|
||||
return paramtypes.ParamSetPairs{
|
||||
paramtypes.NewParamSetPair(KeyMaxMemoCharacters, &p.MaxMemoCharacters, validateMaxMemoCharacters),
|
||||
|
|
|
@ -19,7 +19,6 @@ var (
|
|||
_ vestexported.VestingAccount = (*DelayedVestingAccount)(nil)
|
||||
)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Base Vesting Account
|
||||
|
||||
// NewBaseVestingAccount creates a new BaseVestingAccount object. It is the
|
||||
|
@ -216,7 +215,6 @@ func (bva BaseVestingAccount) MarshalYAML() (interface{}, error) {
|
|||
return string(bz), err
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Continuous Vesting Account
|
||||
|
||||
var _ vestexported.VestingAccount = (*ContinuousVestingAccount)(nil)
|
||||
|
@ -345,7 +343,6 @@ func (cva ContinuousVestingAccount) MarshalYAML() (interface{}, error) {
|
|||
return string(bz), err
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Periodic Vesting Account
|
||||
|
||||
var _ vestexported.VestingAccount = (*PeriodicVestingAccount)(nil)
|
||||
|
@ -504,7 +501,6 @@ func (pva PeriodicVestingAccount) MarshalYAML() (interface{}, error) {
|
|||
return string(bz), err
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Delayed Vesting Account
|
||||
|
||||
var _ vestexported.VestingAccount = (*DelayedVestingAccount)(nil)
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// DONTCOVER
|
||||
// nolint
|
||||
package v036
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package v038
|
||||
|
||||
// DONTCOVER
|
||||
// nolint
|
||||
|
||||
const (
|
||||
ModuleName = "bank"
|
||||
|
|
|
@ -86,8 +86,6 @@ func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry)
|
|||
types.RegisterInterfaces(registry)
|
||||
}
|
||||
|
||||
//____________________________________________________________________________
|
||||
|
||||
// AppModule implements an application module for the bank module.
|
||||
type AppModule struct {
|
||||
AppModuleBasic
|
||||
|
@ -166,8 +164,6 @@ func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.Validato
|
|||
return []abci.ValidatorUpdate{}
|
||||
}
|
||||
|
||||
//____________________________________________________________________________
|
||||
|
||||
// AppModuleSimulation functions
|
||||
|
||||
// GenerateGenesisState creates a randomized GenState of the bank module.
|
||||
|
|
|
@ -81,7 +81,6 @@ func SimulateMsgSend(ak types.AccountKeeper, bk keeper.Keeper) simtypes.Operatio
|
|||
}
|
||||
|
||||
// sendMsgSend sends a transaction with a MsgSend from a provided random account.
|
||||
// nolint: interfacer
|
||||
func sendMsgSend(
|
||||
r *rand.Rand, app *baseapp.BaseApp, bk keeper.Keeper, ak types.AccountKeeper,
|
||||
msg *types.MsgSend, ctx sdk.Context, chainID string, privkeys []cryptotypes.PrivKey,
|
||||
|
@ -223,7 +222,6 @@ func SimulateMsgMultiSend(ak types.AccountKeeper, bk keeper.Keeper) simtypes.Ope
|
|||
|
||||
// sendMsgMultiSend sends a transaction with a MsgMultiSend from a provided random
|
||||
// account.
|
||||
// nolint: interfacer
|
||||
func sendMsgMultiSend(
|
||||
r *rand.Rand, app *baseapp.BaseApp, bk keeper.Keeper, ak types.AccountKeeper,
|
||||
msg *types.MsgMultiSend, ctx sdk.Context, chainID string, privkeys []cryptotypes.PrivKey,
|
||||
|
@ -289,7 +287,6 @@ func sendMsgMultiSend(
|
|||
|
||||
// randomSendFields returns the sender and recipient simulation accounts as well
|
||||
// as the transferred amount.
|
||||
// nolint: interfacer
|
||||
func randomSendFields(
|
||||
r *rand.Rand, ctx sdk.Context, accs []simtypes.Account, bk keeper.Keeper, ak types.AccountKeeper,
|
||||
) (simtypes.Account, simtypes.Account, sdk.Coins, bool) {
|
||||
|
|
|
@ -42,8 +42,6 @@ func createTestApp() (*simapp.SimApp, sdk.Context, []sdk.AccAddress) {
|
|||
return app, ctx, addrs
|
||||
}
|
||||
|
||||
//____________________________________________________________________________
|
||||
|
||||
func TestHandleMsgVerifyInvariant(t *testing.T) {
|
||||
app, ctx, addrs := createTestApp()
|
||||
sender := addrs[0]
|
||||
|
|
|
@ -43,20 +43,8 @@ func (k Keeper) VerifyInvariant(goCtx context.Context, msg *types.MsgVerifyInvar
|
|||
}
|
||||
|
||||
if stop {
|
||||
// NOTE currently, because the chain halts here, this transaction will never be included
|
||||
// in the blockchain thus the constant fee will have never been deducted. Thus no
|
||||
// refund is required.
|
||||
|
||||
// TODO uncomment the following code block with implementation of the circuit breaker
|
||||
//// refund constant fee
|
||||
//err := k.distrKeeper.DistributeFromFeePool(ctx, constantFee, msg.Sender)
|
||||
//if err != nil {
|
||||
//// if there are insufficient coins to refund, log the error,
|
||||
//// but still halt the chain.
|
||||
//logger := ctx.Logger().With("module", "x/crisis")
|
||||
//logger.Error(fmt.Sprintf(
|
||||
//"WARNING: insufficient funds to allocate to sender from fee pool, err: %s", err))
|
||||
//}
|
||||
// Currently, because the chain halts here, this transaction will never be included in the
|
||||
// blockchain thus the constant fee will have never been deducted. Thus no refund is required.
|
||||
|
||||
// TODO replace with circuit breaker
|
||||
panic(res)
|
||||
|
|
|
@ -80,8 +80,6 @@ func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry)
|
|||
types.RegisterInterfaces(registry)
|
||||
}
|
||||
|
||||
//____________________________________________________________________________
|
||||
|
||||
// AppModule implements an application module for the crisis module.
|
||||
type AppModule struct {
|
||||
AppModuleBasic
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// DONTCOVER
|
||||
// nolint
|
||||
package v034
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// DONTCOVER
|
||||
// nolint
|
||||
package v036
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package v038
|
||||
|
||||
// DONTCOVER
|
||||
// nolint
|
||||
|
||||
import (
|
||||
v036distr "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v036"
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
)
|
||||
|
||||
// DONTCOVER
|
||||
// nolint
|
||||
|
||||
const (
|
||||
ModuleName = "distribution"
|
||||
|
|
|
@ -88,8 +88,6 @@ func (b AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry)
|
|||
types.RegisterInterfaces(registry)
|
||||
}
|
||||
|
||||
//____________________________________________________________________________
|
||||
|
||||
// AppModule implements an application module for the distribution module.
|
||||
type AppModule struct {
|
||||
AppModuleBasic
|
||||
|
@ -175,8 +173,6 @@ func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.Validato
|
|||
return []abci.ValidatorUpdate{}
|
||||
}
|
||||
|
||||
//____________________________________________________________________________
|
||||
|
||||
// AppModuleSimulation functions
|
||||
|
||||
// GenerateGenesisState creates a randomized GenState of the distribution module.
|
||||
|
|
|
@ -189,8 +189,6 @@ func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Val
|
|||
return []abci.ValidatorUpdate{}
|
||||
}
|
||||
|
||||
//____________________________________________________________________________
|
||||
|
||||
// AppModuleSimulation functions
|
||||
|
||||
// GenerateGenesisState creates a randomized GenState of the evidence module.
|
||||
|
|
|
@ -179,8 +179,6 @@ func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.Validato
|
|||
return []abci.ValidatorUpdate{}
|
||||
}
|
||||
|
||||
//____________________________________________________________________________
|
||||
|
||||
// AppModuleSimulation functions
|
||||
|
||||
// GenerateGenesisState creates a randomized GenState of the feegrant module.
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// DONTCOVER
|
||||
// nolint
|
||||
package v034
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// DONTCOVER
|
||||
// nolint
|
||||
package v036
|
||||
|
||||
import (
|
||||
|
|
|
@ -66,8 +66,6 @@ func (AppModuleBasic) GetTxCmd() *cobra.Command { return nil }
|
|||
// GetQueryCmd returns no root query command for the genutil module.
|
||||
func (AppModuleBasic) GetQueryCmd() *cobra.Command { return nil }
|
||||
|
||||
//____________________________________________________________________________
|
||||
|
||||
// AppModule implements an application module for the genutil module.
|
||||
type AppModule struct {
|
||||
AppModuleBasic
|
||||
|
|
|
@ -12,7 +12,6 @@ import (
|
|||
)
|
||||
|
||||
// REST Variable names
|
||||
// nolint
|
||||
const (
|
||||
RestParamsType = "type"
|
||||
RestProposalID = "proposal-id"
|
||||
|
|
|
@ -40,7 +40,7 @@ func NormalizeWeightedVoteOptions(options string) string {
|
|||
return strings.Join(newOptions, ",")
|
||||
}
|
||||
|
||||
//NormalizeProposalType - normalize user specified proposal type
|
||||
// NormalizeProposalType - normalize user specified proposal type.
|
||||
func NormalizeProposalType(proposalType string) string {
|
||||
switch proposalType {
|
||||
case "Text", "text":
|
||||
|
@ -51,7 +51,7 @@ func NormalizeProposalType(proposalType string) string {
|
|||
}
|
||||
}
|
||||
|
||||
//NormalizeProposalStatus - normalize user specified proposal status
|
||||
// NormalizeProposalStatus - normalize user specified proposal status.
|
||||
func NormalizeProposalStatus(status string) string {
|
||||
switch status {
|
||||
case "DepositPeriod", "deposit_period":
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// DONTCOVER
|
||||
// nolint
|
||||
package v034
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// DONTCOVER
|
||||
// nolint
|
||||
package v036
|
||||
|
||||
import (
|
||||
|
|
|
@ -109,8 +109,6 @@ func (a AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry
|
|||
types.RegisterInterfaces(registry)
|
||||
}
|
||||
|
||||
//____________________________________________________________________________
|
||||
|
||||
// AppModule implements an application module for the gov module.
|
||||
type AppModule struct {
|
||||
AppModuleBasic
|
||||
|
@ -190,8 +188,6 @@ func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Val
|
|||
return []abci.ValidatorUpdate{}
|
||||
}
|
||||
|
||||
//____________________________________________________________________________
|
||||
|
||||
// AppModuleSimulation functions
|
||||
|
||||
// GenerateGenesisState creates a randomized GenState of the gov module.
|
||||
|
|
|
@ -56,7 +56,6 @@ func (v Vote) Empty() bool {
|
|||
}
|
||||
|
||||
// NewNonSplitVoteOption creates a single option vote with weight 1
|
||||
//nolint:interfacer
|
||||
func NewNonSplitVoteOption(option VoteOption) WeightedVoteOptions {
|
||||
return WeightedVoteOptions{{option, sdk.NewDec(1)}}
|
||||
}
|
||||
|
|
|
@ -157,8 +157,6 @@ func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.V
|
|||
return []abci.ValidatorUpdate{}
|
||||
}
|
||||
|
||||
//____________________________________________________________________________
|
||||
|
||||
// AppModuleSimulation functions
|
||||
|
||||
// GenerateGenesisState creates a randomized GenState of the transfer module.
|
||||
|
@ -186,8 +184,6 @@ func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.Weig
|
|||
return nil
|
||||
}
|
||||
|
||||
//____________________________________________________________________________
|
||||
|
||||
// ValidateTransferChannelParams does validation of a newly created transfer channel. A transfer
|
||||
// channel must be UNORDERED, use the correct port (by default 'transfer'), and use the current
|
||||
// supported version. Only 2^32 channels are allowed to be created.
|
||||
|
|
|
@ -170,8 +170,6 @@ func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.V
|
|||
return []abci.ValidatorUpdate{}
|
||||
}
|
||||
|
||||
//____________________________________________________________________________
|
||||
|
||||
// AppModuleSimulation functions
|
||||
|
||||
// GenerateGenesisState creates a randomized GenState of the ibc module.
|
||||
|
|
|
@ -124,8 +124,6 @@ func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.V
|
|||
return []abci.ValidatorUpdate{}
|
||||
}
|
||||
|
||||
//____________________________________________________________________________
|
||||
|
||||
// OnChanOpenInit implements the IBCModule interface.
|
||||
func (am AppModule) OnChanOpenInit(
|
||||
ctx sdk.Context, _ channeltypes.Order, _ []string, portID string,
|
||||
|
|
|
@ -45,8 +45,6 @@ func NewKeeper(
|
|||
}
|
||||
}
|
||||
|
||||
//______________________________________________________________________
|
||||
|
||||
// Logger returns a module-specific logger.
|
||||
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
|
||||
return ctx.Logger().With("module", "x/"+types.ModuleName)
|
||||
|
@ -71,8 +69,6 @@ func (k Keeper) SetMinter(ctx sdk.Context, minter types.Minter) {
|
|||
store.Set(types.MinterKey, b)
|
||||
}
|
||||
|
||||
//______________________________________________________________________
|
||||
|
||||
// GetParams returns the total set of minting parameters.
|
||||
func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) {
|
||||
k.paramSpace.GetParamSet(ctx, ¶ms)
|
||||
|
@ -84,8 +80,6 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
|
|||
k.paramSpace.SetParamSet(ctx, ¶ms)
|
||||
}
|
||||
|
||||
//______________________________________________________________________
|
||||
|
||||
// StakingTokenSupply implements an alias call to the underlying staking keeper's
|
||||
// StakingTokenSupply to be used in BeginBlocker.
|
||||
func (k Keeper) StakingTokenSupply(ctx sdk.Context) sdk.Int {
|
||||
|
|
|
@ -83,8 +83,6 @@ func (AppModuleBasic) GetQueryCmd() *cobra.Command {
|
|||
return cli.GetQueryCmd()
|
||||
}
|
||||
|
||||
//____________________________________________________________________________
|
||||
|
||||
// AppModule implements an application module for the mint module.
|
||||
type AppModule struct {
|
||||
AppModuleBasic
|
||||
|
@ -160,8 +158,6 @@ func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.Validato
|
|||
return []abci.ValidatorUpdate{}
|
||||
}
|
||||
|
||||
//____________________________________________________________________________
|
||||
|
||||
// AppModuleSimulation functions
|
||||
|
||||
// GenerateGenesisState creates a randomized GenState of the mint module.
|
||||
|
|
|
@ -72,8 +72,6 @@ func (am AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistr
|
|||
proposal.RegisterInterfaces(registry)
|
||||
}
|
||||
|
||||
//____________________________________________________________________________
|
||||
|
||||
// AppModule implements an application module for the distribution module.
|
||||
type AppModule struct {
|
||||
AppModuleBasic
|
||||
|
|
|
@ -68,7 +68,6 @@ func createLogFile() *os.File {
|
|||
return f
|
||||
}
|
||||
|
||||
//_____________________
|
||||
// dummy log writter
|
||||
type DummyLogWriter struct{}
|
||||
|
||||
|
|
|
@ -59,8 +59,6 @@ func (vals mockValidators) getKeys() []string {
|
|||
return keys
|
||||
}
|
||||
|
||||
//_________________________________________________________________________________
|
||||
|
||||
// randomProposer picks a random proposer from the current validator set
|
||||
func (vals mockValidators) randomProposer(r *rand.Rand) tmbytes.HexBytes {
|
||||
keys := vals.getKeys()
|
||||
|
|
|
@ -64,8 +64,6 @@ func (oe OperationEntry) MustMarshal() json.RawMessage {
|
|||
return out
|
||||
}
|
||||
|
||||
//_____________________________________________________________________
|
||||
|
||||
// OperationQueue defines an object for a queue of operations
|
||||
type OperationQueue map[int][]simulation.Operation
|
||||
|
||||
|
@ -107,8 +105,6 @@ func queueOperations(queuedOps OperationQueue, queuedTimeOps []simulation.Future
|
|||
}
|
||||
}
|
||||
|
||||
//________________________________________________________________________
|
||||
|
||||
// WeightedOperation is an operation with associated weight.
|
||||
// This is used to bias the selection operation within the simulator.
|
||||
type WeightedOperation struct {
|
||||
|
|
|
@ -87,7 +87,6 @@ func RandomParams(r *rand.Rand) Params {
|
|||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Param change proposals
|
||||
|
||||
// ParamChange defines the object used for simulating parameter change proposals
|
||||
|
@ -123,7 +122,6 @@ func (spc ParamChange) ComposedKey() string {
|
|||
return fmt.Sprintf("%s/%s", spc.Subspace(), spc.Key())
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Proposal Contents
|
||||
|
||||
// WeightedProposalContent defines a common struct for proposal contents defined by
|
||||
|
@ -150,7 +148,6 @@ func (w WeightedProposalContent) ContentSimulatorFn() simulation.ContentSimulato
|
|||
return w.contentSimulatorFn
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Param change proposals
|
||||
|
||||
// randomConsensusParams returns random simulation consensus parameters, it extracts the Evidence from the Staking genesis state.
|
||||
|
|
|
@ -240,8 +240,6 @@ func SimulateFromSeed(
|
|||
return false, exportedParams, nil
|
||||
}
|
||||
|
||||
//______________________________________________________________________________
|
||||
|
||||
type blockSimFn func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context,
|
||||
accounts []simulation.Account, header tmproto.Header) (opCount int)
|
||||
|
||||
|
|
|
@ -42,8 +42,6 @@ func (k Keeper) AfterValidatorRemoved(ctx sdk.Context, address sdk.ConsAddress)
|
|||
k.deleteAddrPubkeyRelation(ctx, crypto.Address(address))
|
||||
}
|
||||
|
||||
//_________________________________________________________________________________________
|
||||
|
||||
// Hooks wrapper struct for slashing keeper
|
||||
type Hooks struct {
|
||||
k Keeper
|
||||
|
|
|
@ -91,8 +91,6 @@ func (AppModuleBasic) GetQueryCmd() *cobra.Command {
|
|||
return cli.GetQueryCmd()
|
||||
}
|
||||
|
||||
//____________________________________________________________________________
|
||||
|
||||
// AppModule implements an application module for the slashing module.
|
||||
type AppModule struct {
|
||||
AppModuleBasic
|
||||
|
@ -173,8 +171,6 @@ func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.Validato
|
|||
return []abci.ValidatorUpdate{}
|
||||
}
|
||||
|
||||
//____________________________________________________________________________
|
||||
|
||||
// AppModuleSimulation functions
|
||||
|
||||
// GenerateGenesisState creates a randomized GenState of the slashing module.
|
||||
|
|
|
@ -43,7 +43,6 @@ func WeightedOperations(
|
|||
}
|
||||
|
||||
// SimulateMsgUnjail generates a MsgUnjail with random values
|
||||
// nolint: interfacer
|
||||
func SimulateMsgUnjail(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper, sk stakingkeeper.Keeper) simtypes.Operation {
|
||||
return func(
|
||||
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context,
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
//noalias
|
||||
package types
|
||||
|
||||
// Slashing module event types
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/x/staking/types"
|
||||
)
|
||||
|
||||
//_______________________________________________________________________
|
||||
// Validator Set
|
||||
|
||||
// iterate through the validator set and perform the provided function
|
||||
|
@ -96,7 +95,6 @@ func (k Keeper) ValidatorByConsAddr(ctx sdk.Context, addr sdk.ConsAddress) types
|
|||
return val
|
||||
}
|
||||
|
||||
//_______________________________________________________________________
|
||||
// Delegation Set
|
||||
|
||||
// Returns self as it is both a validatorset and delegationset
|
||||
|
|
|
@ -444,7 +444,6 @@ func queryParameters(ctx sdk.Context, k Keeper, legacyQuerierCdc *codec.LegacyAm
|
|||
return res, nil
|
||||
}
|
||||
|
||||
//______________________________________________________
|
||||
// util
|
||||
|
||||
func DelegationToDelegationResponse(ctx sdk.Context, k Keeper, del types.Delegation) (types.DelegationResponse, error) {
|
||||
|
|
|
@ -50,8 +50,6 @@ func (k Keeper) GetDelegatorValidator(
|
|||
return validator, nil
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________________
|
||||
|
||||
// return all delegations for a delegator
|
||||
func (k Keeper) GetAllDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress) []types.Delegation {
|
||||
delegations := make([]types.Delegation, 0)
|
||||
|
@ -59,7 +57,7 @@ func (k Keeper) GetAllDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAdd
|
|||
store := ctx.KVStore(k.storeKey)
|
||||
delegatorPrefixKey := types.GetDelegationsKey(delegator)
|
||||
|
||||
iterator := sdk.KVStorePrefixIterator(store, delegatorPrefixKey) //smallest to largest
|
||||
iterator := sdk.KVStorePrefixIterator(store, delegatorPrefixKey) // smallest to largest
|
||||
defer iterator.Close()
|
||||
|
||||
i := 0
|
||||
|
|
|
@ -381,7 +381,6 @@ func TestSlashWithUnbondingDelegation(t *testing.T) {
|
|||
require.Equal(t, validator.GetStatus(), types.Unbonding)
|
||||
}
|
||||
|
||||
//_________________________________________________________________________________
|
||||
// tests Slash at a previous height with a redelegation
|
||||
func TestSlashWithRedelegation(t *testing.T) {
|
||||
app, ctx, addrDels, addrVals := bootstrapSlashTest(t, 10)
|
||||
|
|
|
@ -240,7 +240,6 @@ func (k Keeper) ValidatorsPowerStoreIterator(ctx sdk.Context) sdk.Iterator {
|
|||
return sdk.KVStoreReversePrefixIterator(store, types.ValidatorsByPowerIndexKey)
|
||||
}
|
||||
|
||||
//_______________________________________________________________________
|
||||
// Last Validator Index
|
||||
|
||||
// Load the last validator power.
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// DONTCOVER
|
||||
// nolint
|
||||
package v034
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// DONTCOVER
|
||||
// nolint
|
||||
package v036
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// DONTCOVER
|
||||
// nolint
|
||||
package v036
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// DONTCOVER
|
||||
// nolint
|
||||
package v038
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// DONTCOVER
|
||||
// nolint
|
||||
package v038
|
||||
|
||||
import (
|
||||
|
|
|
@ -171,8 +171,6 @@ func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Val
|
|||
return EndBlocker(ctx, am.keeper)
|
||||
}
|
||||
|
||||
//____________________________________________________________________________
|
||||
|
||||
// AppModuleSimulation functions
|
||||
|
||||
// GenerateGenesisState creates a randomized GenState of the staking module.
|
||||
|
|
|
@ -92,7 +92,6 @@ func WeightedOperations(
|
|||
}
|
||||
|
||||
// SimulateMsgCreateValidator generates a MsgCreateValidator with random values
|
||||
// nolint: interfacer
|
||||
func SimulateMsgCreateValidator(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simtypes.Operation {
|
||||
return func(
|
||||
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
|
||||
|
@ -178,7 +177,6 @@ func SimulateMsgCreateValidator(ak types.AccountKeeper, bk types.BankKeeper, k k
|
|||
}
|
||||
|
||||
// SimulateMsgEditValidator generates a MsgEditValidator with random values
|
||||
// nolint: interfacer
|
||||
func SimulateMsgEditValidator(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simtypes.Operation {
|
||||
return func(
|
||||
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
|
||||
|
@ -249,7 +247,6 @@ func SimulateMsgEditValidator(ak types.AccountKeeper, bk types.BankKeeper, k kee
|
|||
}
|
||||
|
||||
// SimulateMsgDelegate generates a MsgDelegate with random values
|
||||
// nolint: interfacer
|
||||
func SimulateMsgDelegate(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simtypes.Operation {
|
||||
return func(
|
||||
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
|
||||
|
@ -322,7 +319,6 @@ func SimulateMsgDelegate(ak types.AccountKeeper, bk types.BankKeeper, k keeper.K
|
|||
}
|
||||
|
||||
// SimulateMsgUndelegate generates a MsgUndelegate with random values
|
||||
// nolint: interfacer
|
||||
func SimulateMsgUndelegate(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simtypes.Operation {
|
||||
return func(
|
||||
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
|
||||
|
@ -412,7 +408,6 @@ func SimulateMsgUndelegate(ak types.AccountKeeper, bk types.BankKeeper, k keeper
|
|||
}
|
||||
|
||||
// SimulateMsgBeginRedelegate generates a MsgBeginRedelegate with random values
|
||||
// nolint: interfacer
|
||||
func SimulateMsgBeginRedelegate(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simtypes.Operation {
|
||||
return func(
|
||||
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
|
||||
|
|
|
@ -82,7 +82,6 @@ type DelegationSet interface {
|
|||
fn func(index int64, delegation DelegationI) (stop bool))
|
||||
}
|
||||
|
||||
//_______________________________________________________________________________
|
||||
// Event Hooks
|
||||
// These can be utilized to communicate between a staking keeper and another
|
||||
// keeper which must take particular actions when validators/delegators change
|
||||
|
|
Loading…
Reference in New Issue