style: more linting (#15618)
This commit is contained in:
parent
c1ea84d583
commit
51f3e70a12
@ -861,7 +861,7 @@ func (app *BaseApp) PrepareProposalVerifyTx(tx sdk.Tx) ([]byte, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_, _, _, _, err = app.runTx(runTxPrepareProposal, bz) //nolint:dogsled
|
||||
_, _, _, _, err = app.runTx(runTxPrepareProposal, bz)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -880,7 +880,7 @@ func (app *BaseApp) ProcessProposalVerifyTx(txBz []byte) (sdk.Tx, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_, _, _, _, err = app.runTx(runTxProcessProposal, txBz) //nolint:dogsled
|
||||
_, _, _, _, err = app.runTx(runTxProcessProposal, txBz)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -24,12 +24,12 @@ const (
|
||||
// initClientContext initiates client Context for tests
|
||||
func initClientContext(t *testing.T, envVar string) (client.Context, func()) {
|
||||
home := t.TempDir()
|
||||
chainId := "test-chain" //nolint:revive
|
||||
chainID := "test-chain"
|
||||
clientCtx := client.Context{}.
|
||||
WithHomeDir(home).
|
||||
WithViper("").
|
||||
WithCodec(codec.NewProtoCodec(codectypes.NewInterfaceRegistry())).
|
||||
WithChainID(chainId)
|
||||
WithChainID(chainID)
|
||||
|
||||
require.NoError(t, clientCtx.Viper.BindEnv(nodeEnv))
|
||||
if envVar != "" {
|
||||
@ -38,7 +38,7 @@ func initClientContext(t *testing.T, envVar string) (client.Context, func()) {
|
||||
|
||||
clientCtx, err := config.ReadFromClientConfig(clientCtx)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, clientCtx.ChainID, chainId)
|
||||
require.Equal(t, clientCtx.ChainID, chainID)
|
||||
|
||||
return clientCtx, func() { _ = os.RemoveAll(home) }
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ HbP+c6JmeJy9JXe2rbbF1QtCX1gLqGcDQPBXiCtFvP7/8wTZtVOPj8vREzhZ9ElO
|
||||
t.Cleanup(cleanupKeys(t, kb, "keyname1"))
|
||||
|
||||
keyfile := filepath.Join(kbHome, "key.asc")
|
||||
require.NoError(t, os.WriteFile(keyfile, []byte(armoredKey), 0o644)) //nolint:gosec
|
||||
require.NoError(t, os.WriteFile(keyfile, []byte(armoredKey), 0o600))
|
||||
|
||||
defer func() {
|
||||
_ = os.RemoveAll(kbHome)
|
||||
|
||||
@ -21,7 +21,7 @@ type KeyOutput struct {
|
||||
}
|
||||
|
||||
// NewKeyOutput creates a default KeyOutput instance without Mnemonic, Threshold and PubKeys
|
||||
func NewKeyOutput(name string, keyType keyring.KeyType, a sdk.Address, pk cryptotypes.PubKey) (KeyOutput, error) { //nolint:interfacer
|
||||
func NewKeyOutput(name string, keyType keyring.KeyType, a sdk.Address, pk cryptotypes.PubKey) (KeyOutput, error) {
|
||||
apk, err := codectypes.NewAnyWithValue(pk)
|
||||
if err != nil {
|
||||
return KeyOutput{}, err
|
||||
|
||||
@ -186,7 +186,7 @@ func (pc *ProtoCodec) MustUnmarshalJSON(bz []byte, ptr gogoproto.Message) {
|
||||
}
|
||||
}
|
||||
|
||||
// MarshalInterface is a convenience function for proto marshalling interfaces. It packs
|
||||
// MarshalInterface is a convenience function for proto marshaling interfaces. It packs
|
||||
// the provided value, which must be an interface, in an Any and then marshals it to bytes.
|
||||
// NOTE: to marshal a concrete type, you should use Marshal instead
|
||||
func (pc *ProtoCodec) MarshalInterface(i gogoproto.Message) ([]byte, error) {
|
||||
@ -224,7 +224,7 @@ func (pc *ProtoCodec) UnmarshalInterface(bz []byte, ptr interface{}) error {
|
||||
return pc.UnpackAny(any, ptr)
|
||||
}
|
||||
|
||||
// MarshalInterfaceJSON is a convenience function for proto marshalling interfaces. It
|
||||
// MarshalInterfaceJSON is a convenience function for proto marshaling interfaces. It
|
||||
// packs the provided value in an Any and then marshals it to bytes.
|
||||
// NOTE: to marshal a concrete type, you should use MarshalJSON instead
|
||||
func (pc *ProtoCodec) MarshalInterfaceJSON(x gogoproto.Message) ([]byte, error) {
|
||||
|
||||
@ -26,7 +26,7 @@ func RegisterCrypto(cdc *codec.LegacyAmino) {
|
||||
cdc.RegisterInterface((*cryptotypes.PrivKey)(nil), nil)
|
||||
cdc.RegisterConcrete(sr25519.PrivKey{},
|
||||
sr25519.PrivKeyName, nil)
|
||||
cdc.RegisterConcrete(&ed25519.PrivKey{}, //nolint:staticcheck
|
||||
cdc.RegisterConcrete(&ed25519.PrivKey{},
|
||||
ed25519.PrivKeyName, nil)
|
||||
cdc.RegisterConcrete(&secp256k1.PrivKey{},
|
||||
secp256k1.PrivKeyName, nil)
|
||||
|
||||
@ -94,12 +94,12 @@ func (privKey *PrivKey) Type() string {
|
||||
return keyType
|
||||
}
|
||||
|
||||
// MarshalAmino overrides Amino binary marshalling.
|
||||
// MarshalAmino overrides Amino binary marshaling.
|
||||
func (privKey PrivKey) MarshalAmino() ([]byte, error) {
|
||||
return privKey.Key, nil
|
||||
}
|
||||
|
||||
// UnmarshalAmino overrides Amino binary marshalling.
|
||||
// UnmarshalAmino overrides Amino binary marshaling.
|
||||
func (privKey *PrivKey) UnmarshalAmino(bz []byte) error {
|
||||
if len(bz) != PrivKeySize {
|
||||
return fmt.Errorf("invalid privkey size")
|
||||
@ -109,14 +109,14 @@ func (privKey *PrivKey) UnmarshalAmino(bz []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalAminoJSON overrides Amino JSON marshalling.
|
||||
// MarshalAminoJSON overrides Amino JSON marshaling.
|
||||
func (privKey PrivKey) MarshalAminoJSON() ([]byte, error) {
|
||||
// When we marshal to Amino JSON, we don't marshal the "key" field itself,
|
||||
// just its contents (i.e. the key bytes).
|
||||
return privKey.MarshalAmino()
|
||||
}
|
||||
|
||||
// UnmarshalAminoJSON overrides Amino JSON marshalling.
|
||||
// UnmarshalAminoJSON overrides Amino JSON marshaling.
|
||||
func (privKey *PrivKey) UnmarshalAminoJSON(bz []byte) error {
|
||||
return privKey.UnmarshalAmino(bz)
|
||||
}
|
||||
@ -203,12 +203,12 @@ func (pubKey *PubKey) Equals(other cryptotypes.PubKey) bool {
|
||||
return subtle.ConstantTimeCompare(pubKey.Bytes(), other.Bytes()) == 1
|
||||
}
|
||||
|
||||
// MarshalAmino overrides Amino binary marshalling.
|
||||
// MarshalAmino overrides Amino binary marshaling.
|
||||
func (pubKey PubKey) MarshalAmino() ([]byte, error) {
|
||||
return pubKey.Key, nil
|
||||
}
|
||||
|
||||
// UnmarshalAmino overrides Amino binary marshalling.
|
||||
// UnmarshalAmino overrides Amino binary marshaling.
|
||||
func (pubKey *PubKey) UnmarshalAmino(bz []byte) error {
|
||||
if len(bz) != PubKeySize {
|
||||
return errorsmod.Wrap(errors.ErrInvalidPubKey, "invalid pubkey size")
|
||||
@ -218,14 +218,14 @@ func (pubKey *PubKey) UnmarshalAmino(bz []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalAminoJSON overrides Amino JSON marshalling.
|
||||
// MarshalAminoJSON overrides Amino JSON marshaling.
|
||||
func (pubKey PubKey) MarshalAminoJSON() ([]byte, error) {
|
||||
// When we marshal to Amino JSON, we don't marshal the "key" field itself,
|
||||
// just its contents (i.e. the key bytes).
|
||||
return pubKey.MarshalAmino()
|
||||
}
|
||||
|
||||
// UnmarshalAminoJSON overrides Amino JSON marshalling.
|
||||
// UnmarshalAminoJSON overrides Amino JSON marshaling.
|
||||
func (pubKey *PubKey) UnmarshalAminoJSON(bz []byte) error {
|
||||
return pubKey.UnmarshalAmino(bz)
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ func (m *PubKey) GetKey() crypto_ed25519.PublicKey {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Deprecated: PrivKey defines a ed25519 private key.
|
||||
// PrivKey defines a ed25519 private key.
|
||||
// NOTE: ed25519 keys must not be used in SDK apps except in a tendermint validator context.
|
||||
type PrivKey struct {
|
||||
Key crypto_ed25519.PrivateKey `protobuf:"bytes,1,opt,name=key,proto3,casttype=crypto/ed25519.PrivateKey" json:"key,omitempty"`
|
||||
|
||||
@ -53,12 +53,12 @@ func (privKey *PrivKey) Type() string {
|
||||
return keyType
|
||||
}
|
||||
|
||||
// MarshalAmino overrides Amino binary marshalling.
|
||||
// MarshalAmino overrides Amino binary marshaling.
|
||||
func (privKey PrivKey) MarshalAmino() ([]byte, error) {
|
||||
return privKey.Key, nil
|
||||
}
|
||||
|
||||
// UnmarshalAmino overrides Amino binary marshalling.
|
||||
// UnmarshalAmino overrides Amino binary marshaling.
|
||||
func (privKey *PrivKey) UnmarshalAmino(bz []byte) error {
|
||||
if len(bz) != PrivKeySize {
|
||||
return fmt.Errorf("invalid privkey size")
|
||||
@ -68,14 +68,14 @@ func (privKey *PrivKey) UnmarshalAmino(bz []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalAminoJSON overrides Amino JSON marshalling.
|
||||
// MarshalAminoJSON overrides Amino JSON marshaling.
|
||||
func (privKey PrivKey) MarshalAminoJSON() ([]byte, error) {
|
||||
// When we marshal to Amino JSON, we don't marshal the "key" field itself,
|
||||
// just its contents (i.e. the key bytes).
|
||||
return privKey.MarshalAmino()
|
||||
}
|
||||
|
||||
// UnmarshalAminoJSON overrides Amino JSON marshalling.
|
||||
// UnmarshalAminoJSON overrides Amino JSON marshaling.
|
||||
func (privKey *PrivKey) UnmarshalAminoJSON(bz []byte) error {
|
||||
return privKey.UnmarshalAmino(bz)
|
||||
}
|
||||
@ -179,12 +179,12 @@ func (pubKey *PubKey) Equals(other cryptotypes.PubKey) bool {
|
||||
return pubKey.Type() == other.Type() && bytes.Equal(pubKey.Bytes(), other.Bytes())
|
||||
}
|
||||
|
||||
// MarshalAmino overrides Amino binary marshalling.
|
||||
// MarshalAmino overrides Amino binary marshaling.
|
||||
func (pubKey PubKey) MarshalAmino() ([]byte, error) {
|
||||
return pubKey.Key, nil
|
||||
}
|
||||
|
||||
// UnmarshalAmino overrides Amino binary marshalling.
|
||||
// UnmarshalAmino overrides Amino binary marshaling.
|
||||
func (pubKey *PubKey) UnmarshalAmino(bz []byte) error {
|
||||
if len(bz) != PubKeySize {
|
||||
return errorsmod.Wrap(errors.ErrInvalidPubKey, "invalid pubkey size")
|
||||
@ -194,14 +194,14 @@ func (pubKey *PubKey) UnmarshalAmino(bz []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalAminoJSON overrides Amino JSON marshalling.
|
||||
// MarshalAminoJSON overrides Amino JSON marshaling.
|
||||
func (pubKey PubKey) MarshalAminoJSON() ([]byte, error) {
|
||||
// When we marshal to Amino JSON, we don't marshal the "key" field itself,
|
||||
// just its contents (i.e. the key bytes).
|
||||
return pubKey.MarshalAmino()
|
||||
}
|
||||
|
||||
// UnmarshalAminoJSON overrides Amino JSON marshalling.
|
||||
// UnmarshalAminoJSON overrides Amino JSON marshaling.
|
||||
func (pubKey *PubKey) UnmarshalAminoJSON(bz []byte) error {
|
||||
return pubKey.UnmarshalAmino(bz)
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ message PubKey {
|
||||
bytes key = 1 [(gogoproto.casttype) = "crypto/ed25519.PublicKey"];
|
||||
}
|
||||
|
||||
// Deprecated: PrivKey defines a ed25519 private key.
|
||||
// PrivKey defines a ed25519 private key.
|
||||
// NOTE: ed25519 keys must not be used in SDK apps except in a tendermint validator context.
|
||||
message PrivKey {
|
||||
option (amino.name) = "tendermint/PrivKeyEd25519";
|
||||
|
||||
@ -290,8 +290,8 @@ func fileDescWithDependencies(fd *dpb.FileDescriptorProto, sentFileDescriptors m
|
||||
}
|
||||
|
||||
// fileDescEncodingByFilename finds the file descriptor for given filename,
|
||||
// finds all of its previously unsent transitive dependencies, does marshalling
|
||||
// on them, and returns the marshalled result.
|
||||
// finds all of its previously unsent transitive dependencies, does marshaling
|
||||
// on them, and returns the marshaled result.
|
||||
func (s *serverReflectionServer) fileDescEncodingByFilename(name string, sentFileDescriptors map[string]bool) ([][]byte, error) {
|
||||
enc := getFileDescriptor(name)
|
||||
if enc == nil {
|
||||
@ -324,7 +324,7 @@ func parseMetadata(meta interface{}) ([]byte, bool) {
|
||||
|
||||
// fileDescEncodingContainingSymbol finds the file descriptor containing the
|
||||
// given symbol, finds all of its previously unsent transitive dependencies,
|
||||
// does marshalling on them, and returns the marshalled result. The given symbol
|
||||
// does marshaling on them, and returns the marshaled result. The given symbol
|
||||
// can be a type, a service or a method.
|
||||
func (s *serverReflectionServer) fileDescEncodingContainingSymbol(name string, sentFileDescriptors map[string]bool) ([][]byte, error) {
|
||||
_, symbols := s.getSymbols()
|
||||
@ -349,7 +349,7 @@ func (s *serverReflectionServer) fileDescEncodingContainingSymbol(name string, s
|
||||
|
||||
// fileDescEncodingContainingExtension finds the file descriptor containing
|
||||
// given extension, finds all of its previously unsent transitive dependencies,
|
||||
// does marshalling on them, and returns the marshalled result.
|
||||
// does marshaling on them, and returns the marshaled result.
|
||||
func (s *serverReflectionServer) fileDescEncodingContainingExtension(typeName string, extNum int32, sentFileDescriptors map[string]bool) ([][]byte, error) {
|
||||
st, err := typeForName(typeName)
|
||||
if err != nil {
|
||||
|
||||
@ -91,7 +91,7 @@ func StartGRPCServer(ctx context.Context, logger log.Logger, cfg config.GRPCConf
|
||||
// the server failed to start properly.
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
// The calling process cancelled or closed the provided context, so we must
|
||||
// The calling process canceled or closed the provided context, so we must
|
||||
// gracefully stop the gRPC server.
|
||||
logger.Info("stopping gRPC server...", "address", cfg.Address)
|
||||
grpcSrv.GracefulStop()
|
||||
|
||||
@ -244,7 +244,7 @@ func startStandAlone(svrCtx *Context, appCreator types.AppCreator) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// Wait for the calling process to be cancelled or close the provided context,
|
||||
// Wait for the calling process to be canceled or close the provided context,
|
||||
// so we can gracefully stop the ABCI server.
|
||||
<-ctx.Done()
|
||||
svrCtx.Logger.Info("stopping the ABCI server...")
|
||||
|
||||
@ -203,7 +203,7 @@ func writeFile(name, dir string, contents []byte) error {
|
||||
return fmt.Errorf("could not create directory %q: %w", dir, err)
|
||||
}
|
||||
|
||||
if err := os.WriteFile(file, contents, 0o644); err != nil { //nolint: gosec
|
||||
if err := os.WriteFile(file, contents, 0o600); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@ -616,7 +616,6 @@ func (s *argsTestSuite) TestGetConfigFromEnv() {
|
||||
}
|
||||
assert.Equal(t, tc.expectedErrCount, errCount, "error count")
|
||||
}
|
||||
|
||||
assert.Equal(t, tc.expectedCfg, cfg, "config")
|
||||
})
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ type Collection[K, V any] interface {
|
||||
KeyCodec() collcodec.KeyCodec[K]
|
||||
}
|
||||
|
||||
// CollectionPaginate follows the same behaviour as Paginate but works on a Collection.
|
||||
// CollectionPaginate follows the same behavior as Paginate but works on a Collection.
|
||||
func CollectionPaginate[K, V any, C Collection[K, V]](
|
||||
ctx context.Context,
|
||||
coll C,
|
||||
@ -87,7 +87,7 @@ func CollectionFilteredPaginate[K, V any, C Collection[K, V]](
|
||||
} else {
|
||||
results, pageRes, err = collFilteredPaginateNoKey(ctx, coll, prefix, reverse, offset, limit, countTotal, predicateFunc)
|
||||
}
|
||||
// invalid iter error is ignored to retain Paginate behaviour
|
||||
// invalid iter error is ignored to retain Paginate behavior
|
||||
if errors.Is(err, collections.ErrInvalidIterator) {
|
||||
return results, pageRes, nil
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ func TestRecoverPanic(t *testing.T) {
|
||||
require.Equal(t, gasLimit, newCtx.GasMeter().Limit())
|
||||
|
||||
antehandler = sdk.ChainAnteDecorators(sud, PanicDecorator{})
|
||||
require.Panics(t, func() { antehandler(suite.ctx, tx, false) }, "Recovered from non-Out-of-Gas panic") //nolint:errcheck
|
||||
require.Panics(t, func() { antehandler(suite.ctx, tx, false) }, "Recovered from non-Out-of-Gas panic")
|
||||
}
|
||||
|
||||
type OutOfGasDecorator struct{}
|
||||
|
||||
@ -210,8 +210,7 @@ func ProvideAddressCodec(config *modulev1.Module) address.Codec {
|
||||
return codecaddress.NewBech32Codec(config.Bech32Prefix)
|
||||
}
|
||||
|
||||
//nolint:revive
|
||||
type AuthInputs struct {
|
||||
type ModuleInputs struct {
|
||||
depinject.In
|
||||
|
||||
Config *modulev1.Module
|
||||
@ -225,15 +224,14 @@ type AuthInputs struct {
|
||||
LegacySubspace exported.Subspace `optional:"true"`
|
||||
}
|
||||
|
||||
//nolint:revive
|
||||
type AuthOutputs struct {
|
||||
type ModuleOutputs struct {
|
||||
depinject.Out
|
||||
|
||||
AccountKeeper keeper.AccountKeeper
|
||||
Module appmodule.AppModule
|
||||
}
|
||||
|
||||
func ProvideModule(in AuthInputs) AuthOutputs {
|
||||
func ProvideModule(in ModuleInputs) ModuleOutputs {
|
||||
maccPerms := map[string][]string{}
|
||||
for _, permission := range in.Config.ModuleAccountPermissions {
|
||||
maccPerms[permission.Account] = permission.Permissions
|
||||
@ -256,5 +254,5 @@ func ProvideModule(in AuthInputs) AuthOutputs {
|
||||
k := keeper.NewAccountKeeper(in.Cdc, in.StoreService, in.AccountI, maccPerms, in.Config.Bech32Prefix, authority.String())
|
||||
m := NewAppModule(in.Cdc, k, in.RandomGenesisAccountsFn, in.LegacySubspace)
|
||||
|
||||
return AuthOutputs{AccountKeeper: k, Module: m}
|
||||
return ModuleOutputs{AccountKeeper: k, Module: m}
|
||||
}
|
||||
|
||||
@ -24,8 +24,7 @@ func init() {
|
||||
)
|
||||
}
|
||||
|
||||
//nolint:revive
|
||||
type TxInputs struct {
|
||||
type ModuleInputs struct {
|
||||
depinject.In
|
||||
|
||||
Config *txconfigv1.Config
|
||||
@ -41,15 +40,14 @@ type TxInputs struct {
|
||||
CustomSignModeHandlers func() []signing.SignModeHandler `optional:"true"`
|
||||
}
|
||||
|
||||
//nolint:revive
|
||||
type TxOutputs struct {
|
||||
type ModuleOutputs struct {
|
||||
depinject.Out
|
||||
|
||||
TxConfig client.TxConfig
|
||||
BaseAppOption runtime.BaseAppOption
|
||||
}
|
||||
|
||||
func ProvideModule(in TxInputs) TxOutputs {
|
||||
func ProvideModule(in ModuleInputs) ModuleOutputs {
|
||||
textual, err := NewTextualWithBankKeeper(in.TxBankKeeper)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@ -100,10 +98,10 @@ func ProvideModule(in TxInputs) TxOutputs {
|
||||
app.SetTxEncoder(txConfig.TxEncoder())
|
||||
}
|
||||
|
||||
return TxOutputs{TxConfig: txConfig, BaseAppOption: baseAppOption}
|
||||
return ModuleOutputs{TxConfig: txConfig, BaseAppOption: baseAppOption}
|
||||
}
|
||||
|
||||
func newAnteHandler(txConfig client.TxConfig, in TxInputs) (sdk.AnteHandler, error) {
|
||||
func newAnteHandler(txConfig client.TxConfig, in ModuleInputs) (sdk.AnteHandler, error) {
|
||||
if in.BankKeeper == nil {
|
||||
return nil, fmt.Errorf("both AccountKeeper and BankKeeper are required")
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ func (k Keeper) CalculateDelegationRewards(ctx sdk.Context, val stakingtypes.Val
|
||||
//
|
||||
// A small amount of this error is tolerated and corrected for,
|
||||
// however any greater amount should be considered a breach in expected
|
||||
// behaviour.
|
||||
// behavior.
|
||||
marginOfErr := sdk.SmallestDec().MulInt64(3)
|
||||
if stake.LTE(currentStake.Add(marginOfErr)) {
|
||||
stake = currentStake
|
||||
|
||||
@ -42,8 +42,6 @@ func TestRandomizedGenState(t *testing.T) {
|
||||
|
||||
dec1, _ := sdk.NewDecFromStr("0.210000000000000000")
|
||||
|
||||
require.Equal(t, sdk.ZeroDec(), distrGenesis.Params.BaseProposerReward) //nolint:staticcheck
|
||||
require.Equal(t, sdk.ZeroDec(), distrGenesis.Params.BonusProposerReward) //nolint:staticcheck
|
||||
require.Equal(t, dec1, distrGenesis.Params.CommunityTax)
|
||||
require.Equal(t, true, distrGenesis.Params.WithdrawAddrEnabled)
|
||||
require.Len(t, distrGenesis.DelegatorStartingInfos, 0)
|
||||
|
||||
@ -62,7 +62,7 @@ func TestAppGenesis_ValidGenesis(t *testing.T) {
|
||||
assert.NilError(t, err)
|
||||
assert.DeepEqual(t, appGenesis.Consensus.Params, genesis.Consensus.Params)
|
||||
|
||||
// validate marshalling of app genesis
|
||||
// validate marshaling of app genesis
|
||||
rawAppGenesis, err = json.Marshal(&appGenesis)
|
||||
assert.NilError(t, err)
|
||||
golden.Assert(t, string(rawAppGenesis), "app_genesis.json")
|
||||
|
||||
@ -35,7 +35,7 @@ func (p Proposer) String() string {
|
||||
|
||||
// QueryVotesByTxQuery will query for votes via a direct txs tags query. It
|
||||
// will fetch and build votes directly from the returned txs and returns a JSON
|
||||
// marshalled result or any error that occurred.
|
||||
// marshaled result or any error that occurred.
|
||||
func QueryVotesByTxQuery(clientCtx client.Context, params v1.QueryProposalVotesParams) ([]byte, error) {
|
||||
var (
|
||||
votes []*v1.Vote
|
||||
|
||||
@ -976,7 +976,7 @@ func (suite *KeeperTestSuite) TestMsgUpdateParams() {
|
||||
name: "negative quorum",
|
||||
input: func() *v1.MsgUpdateParams {
|
||||
params1 := params
|
||||
params1.Quorum = "-0.1" //nolint:goconst
|
||||
params1.Quorum = "-0.1"
|
||||
|
||||
return &v1.MsgUpdateParams{
|
||||
Authority: authority,
|
||||
|
||||
@ -37,7 +37,7 @@ import (
|
||||
|
||||
var (
|
||||
_ simtypes.WeightedProposalMsg = MockWeightedProposals{}
|
||||
_ simtypes.WeightedProposalContent = MockWeightedProposals{} //nolint:staticcheck
|
||||
_ simtypes.WeightedProposalContent = MockWeightedProposals{} //nolint:staticcheck // testing legacy code path
|
||||
)
|
||||
|
||||
type MockWeightedProposals struct {
|
||||
@ -58,8 +58,8 @@ func (m MockWeightedProposals) MsgSimulatorFn() simtypes.MsgSimulatorFn {
|
||||
}
|
||||
}
|
||||
|
||||
func (m MockWeightedProposals) ContentSimulatorFn() simtypes.ContentSimulatorFn { //nolint:staticcheck
|
||||
return func(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) simtypes.Content { //nolint:staticcheck
|
||||
func (m MockWeightedProposals) ContentSimulatorFn() simtypes.ContentSimulatorFn { //nolint:staticcheck // testing legacy code path
|
||||
return func(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) simtypes.Content { //nolint:staticcheck // testing legacy code path
|
||||
return v1beta1.NewTextProposal(
|
||||
fmt.Sprintf("title-%d: %s", m.n, simtypes.RandStringOfLength(r, 100)),
|
||||
fmt.Sprintf("description-%d: %s", m.n, simtypes.RandStringOfLength(r, 4000)),
|
||||
@ -75,8 +75,8 @@ func mockWeightedProposalMsg(n int) []simtypes.WeightedProposalMsg {
|
||||
return wpc
|
||||
}
|
||||
|
||||
func mockWeightedLegacyProposalContent(n int) []simtypes.WeightedProposalContent { //nolint:staticcheck
|
||||
wpc := make([]simtypes.WeightedProposalContent, n) //nolint:staticcheck
|
||||
func mockWeightedLegacyProposalContent(n int) []simtypes.WeightedProposalContent { //nolint:staticcheck // testing legacy code path
|
||||
wpc := make([]simtypes.WeightedProposalContent, n) //nolint:staticcheck // testing legacy code path
|
||||
for i := 0; i < n; i++ {
|
||||
wpc[i] = MockWeightedProposals{i}
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ func indirect(ptr interface{}) interface{} {
|
||||
}
|
||||
|
||||
func TestGetSubspaces(t *testing.T) {
|
||||
_, _, _, _, keeper := testComponents() //nolint:dogsled
|
||||
_, _, _, _, keeper := testComponents()
|
||||
|
||||
table := types.NewKeyTable(
|
||||
types.NewParamSetPair([]byte("string"), "", validateNoOp),
|
||||
|
||||
@ -120,8 +120,7 @@ func init() {
|
||||
))
|
||||
}
|
||||
|
||||
//nolint:revive
|
||||
type ParamsInputs struct {
|
||||
type ModuleInputs struct {
|
||||
depinject.In
|
||||
|
||||
KvStoreKey *store.KVStoreKey
|
||||
@ -130,8 +129,7 @@ type ParamsInputs struct {
|
||||
LegacyAmino *codec.LegacyAmino
|
||||
}
|
||||
|
||||
//nolint:revive
|
||||
type ParamsOutputs struct {
|
||||
type ModuleOutputs struct {
|
||||
depinject.Out
|
||||
|
||||
ParamsKeeper keeper.Keeper
|
||||
@ -139,13 +137,13 @@ type ParamsOutputs struct {
|
||||
GovHandler govv1beta1.HandlerRoute
|
||||
}
|
||||
|
||||
func ProvideModule(in ParamsInputs) ParamsOutputs {
|
||||
func ProvideModule(in ModuleInputs) ModuleOutputs {
|
||||
k := keeper.NewKeeper(in.Cdc, in.LegacyAmino, in.KvStoreKey, in.TransientStoreKey)
|
||||
|
||||
m := NewAppModule(k)
|
||||
govHandler := govv1beta1.HandlerRoute{RouteKey: proposal.RouterKey, Handler: NewParamChangeProposalHandler(k)}
|
||||
|
||||
return ParamsOutputs{ParamsKeeper: k, Module: m, GovHandler: govHandler}
|
||||
return ModuleOutputs{ParamsKeeper: k, Module: m, GovHandler: govHandler}
|
||||
}
|
||||
|
||||
type SubspaceInputs struct {
|
||||
|
||||
@ -42,7 +42,7 @@ func (s *KeeperTestSuite) TestExportAndInitGenesis() {
|
||||
newInfo1, _ := keeper.GetValidatorSigningInfo(ctx, consAddr1)
|
||||
require.NotEqual(info1, newInfo1)
|
||||
|
||||
// Initialise genesis with genesis state before tombstone
|
||||
// Initialize genesis with genesis state before tombstone
|
||||
s.stakingKeeper.EXPECT().IterateValidators(ctx, gomock.Any()).Return()
|
||||
keeper.InitGenesis(ctx, s.stakingKeeper, genesisState)
|
||||
|
||||
|
||||
@ -17,7 +17,6 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/x/slashing/types"
|
||||
)
|
||||
|
||||
//nolint:deadcode,varcheck
|
||||
var (
|
||||
delPk1 = ed25519.GenPrivKey().PubKey()
|
||||
delAddr1 = sdk.AccAddress(delPk1.Address())
|
||||
|
||||
@ -19,7 +19,7 @@ import (
|
||||
|
||||
// Simulation operation weights constants
|
||||
const (
|
||||
OpWeightMsgUnjail = "op_weight_msg_unjail" //nolint:gosec
|
||||
OpWeightMsgUnjail = "op_weight_msg_unjail"
|
||||
|
||||
DefaultWeightMsgUnjail = 100
|
||||
)
|
||||
|
||||
@ -42,7 +42,7 @@ type StakingKeeper interface {
|
||||
Validator(sdk.Context, sdk.ValAddress) stakingtypes.ValidatorI // get a particular validator by operator address
|
||||
ValidatorByConsAddr(sdk.Context, sdk.ConsAddress) stakingtypes.ValidatorI // get a particular validator by consensus address
|
||||
|
||||
// slash the validator and delegators of the validator, specifying offense height, offence power, and slash fraction
|
||||
// slash the validator and delegators of the validator, specifying offense height, offense power, and slash fraction
|
||||
Slash(sdk.Context, sdk.ConsAddress, int64, int64, sdk.Dec) math.Int
|
||||
SlashWithInfractionReason(sdk.Context, sdk.ConsAddress, int64, int64, sdk.Dec, stakingtypes.Infraction) math.Int
|
||||
Jail(sdk.Context, sdk.ConsAddress) // jail a validator
|
||||
|
||||
@ -61,7 +61,7 @@ type ValidatorSet interface {
|
||||
TotalBondedTokens(sdk.Context) math.Int // total bonded tokens within the validator set
|
||||
StakingTokenSupply(sdk.Context) math.Int // total staking token supply
|
||||
|
||||
// slash the validator and delegators of the validator, specifying offense height, offence power, and slash fraction
|
||||
// slash the validator and delegators of the validator, specifying offense height, offense power, and slash fraction
|
||||
Slash(sdk.Context, sdk.ConsAddress, int64, int64, sdk.Dec) math.Int
|
||||
SlashWithInfractionReason(sdk.Context, sdk.ConsAddress, int64, int64, sdk.Dec, Infraction) math.Int
|
||||
Jail(sdk.Context, sdk.ConsAddress) // jail a validator
|
||||
|
||||
@ -37,7 +37,7 @@ func TestHistoricalInfo(t *testing.T) {
|
||||
require.NotPanics(t, func() {
|
||||
value = legacy.Cdc.MustMarshal(&hi)
|
||||
})
|
||||
require.NotNil(t, value, "Marshalled HistoricalInfo is nil")
|
||||
require.NotNil(t, value, "Marshaled HistoricalInfo is nil")
|
||||
|
||||
recv, err := types.UnmarshalHistoricalInfo(codec.NewAminoCodec(legacy.Cdc), value)
|
||||
require.Nil(t, err, "Unmarshalling HistoricalInfo failed")
|
||||
@ -59,9 +59,7 @@ func TestValidateBasic(t *testing.T) {
|
||||
// Ensure validators are not sorted
|
||||
for sort.IsSorted(types.Validators(validators)) {
|
||||
rand.Shuffle(len(validators), func(i, j int) {
|
||||
it := validators[i] //nolint:gocritic
|
||||
validators[i] = validators[j]
|
||||
validators[j] = it
|
||||
validators[i], validators[j] = validators[j], validators[i]
|
||||
})
|
||||
}
|
||||
hi = types.HistoricalInfo{
|
||||
|
||||
@ -261,9 +261,7 @@ func TestValidatorsSortDeterminism(t *testing.T) {
|
||||
// Randomly shuffle validators, sort, and check it is equal to original sort
|
||||
for i := 0; i < 10; i++ {
|
||||
rand.Shuffle(10, func(i, j int) {
|
||||
it := vals[i] //nolint:gocritic
|
||||
vals[i] = vals[j]
|
||||
vals[j] = it
|
||||
vals[i], vals[j] = vals[j], vals[i]
|
||||
})
|
||||
|
||||
types.Validators(vals).Sort()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user