Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
parent
e9aece088d
commit
2ad5ab913d
@ -13,7 +13,7 @@ linters:
|
||||
- dogsled
|
||||
- errcheck
|
||||
- errorlint
|
||||
- exportloopref
|
||||
- copyloopvar
|
||||
- gci
|
||||
- goconst
|
||||
- gocritic
|
||||
@ -45,15 +45,15 @@ issues:
|
||||
- crypto/keys/secp256k1/internal/*
|
||||
- types/coin_regex.go
|
||||
exclude-rules:
|
||||
- text: "ST1003:"
|
||||
- text: "ST1003:" # We are fine with our current naming
|
||||
linters:
|
||||
- stylecheck
|
||||
# FIXME: Disabled until golangci-lint updates stylecheck with this fix:
|
||||
# https://github.com/dominikh/go-tools/issues/389
|
||||
- text: "ST1016:"
|
||||
- text: "ST1016:" # Ok with inconsistent receiver names
|
||||
linters:
|
||||
- stylecheck
|
||||
- path: "migrations"
|
||||
- path: "migrations" # migraitions always use deprecated code
|
||||
text: "SA1019:"
|
||||
linters:
|
||||
- staticcheck
|
||||
@ -72,6 +72,9 @@ issues:
|
||||
- text: "SA1019: params.SendEnabled is deprecated" # TODO remove once ready to remove from the sdk
|
||||
linters:
|
||||
- staticcheck
|
||||
- text: "G115: integer overflow conversion" # We are doing this everywhere.
|
||||
linters:
|
||||
- gosec
|
||||
- text: "leading space"
|
||||
linters:
|
||||
- nolintlint
|
||||
|
||||
@ -1343,7 +1343,6 @@ func TestABCI_GetBlockRetentionHeight(t *testing.T) {
|
||||
}
|
||||
|
||||
for name, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
tc.bapp.SetParamStore(¶mStore{db: coretesting.NewMemDB()})
|
||||
_, err := tc.bapp.InitChain(&abci.InitChainRequest{
|
||||
@ -1835,7 +1834,7 @@ func TestABCI_PrepareProposal_VoteExtensions(t *testing.T) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cp := ctx.ConsensusParams() // nolint:staticcheck // ignore linting error
|
||||
cp := ctx.ConsensusParams() //nolint:staticcheck // ignore linting error
|
||||
extsEnabled := cp.Feature.VoteExtensionsEnableHeight != nil && req.Height >= cp.Feature.VoteExtensionsEnableHeight.Value && cp.Feature.VoteExtensionsEnableHeight.Value != 0
|
||||
if !extsEnabled {
|
||||
// check abci params
|
||||
|
||||
@ -47,7 +47,7 @@ func ValidateVoteExtensions(
|
||||
extCommit abci.ExtendedCommitInfo,
|
||||
) error {
|
||||
// Get values from context
|
||||
cp := ctx.ConsensusParams() // nolint:staticcheck // ignore linting error
|
||||
cp := ctx.ConsensusParams() //nolint:staticcheck // ignore linting error
|
||||
currentHeight := ctx.HeaderInfo().Height
|
||||
chainID := ctx.HeaderInfo().ChainID
|
||||
commitInfo := ctx.CometInfo().LastCommit
|
||||
@ -258,7 +258,7 @@ func (h *DefaultProposalHandler) SetTxSelector(ts TxSelector) {
|
||||
func (h *DefaultProposalHandler) PrepareProposalHandler() sdk.PrepareProposalHandler {
|
||||
return func(ctx sdk.Context, req *abci.PrepareProposalRequest) (*abci.PrepareProposalResponse, error) {
|
||||
var maxBlockGas uint64
|
||||
if b := ctx.ConsensusParams().Block; b != nil { // nolint:staticcheck // ignore linting error
|
||||
if b := ctx.ConsensusParams().Block; b != nil { //nolint:staticcheck // ignore linting error
|
||||
maxBlockGas = uint64(b.MaxGas)
|
||||
}
|
||||
|
||||
@ -405,7 +405,7 @@ func (h *DefaultProposalHandler) ProcessProposalHandler() sdk.ProcessProposalHan
|
||||
var totalTxGas uint64
|
||||
|
||||
var maxBlockGas int64
|
||||
if b := ctx.ConsensusParams().Block; b != nil { // nolint:staticcheck // ignore linting error
|
||||
if b := ctx.ConsensusParams().Block; b != nil { //nolint:staticcheck // ignore linting error
|
||||
maxBlockGas = b.MaxGas
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ import (
|
||||
"reflect"
|
||||
|
||||
gogoproto "github.com/cosmos/gogoproto/proto"
|
||||
"github.com/golang/protobuf/proto" // nolint: staticcheck // needed because gogoproto.Merge does not work consistently. See NOTE: comments.
|
||||
"github.com/golang/protobuf/proto" //nolint: staticcheck // needed because gogoproto.Merge does not work consistently. See NOTE: comments.
|
||||
"google.golang.org/grpc"
|
||||
proto2 "google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
|
||||
@ -245,7 +245,6 @@ func TestABCI_OfferSnapshot_Errors(t *testing.T) {
|
||||
}, abci.OFFER_SNAPSHOT_RESULT_REJECT},
|
||||
}
|
||||
for name, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(name, func(t *testing.T) {
|
||||
resp, err := suite.baseApp.OfferSnapshot(&abci.OfferSnapshotRequest{Snapshot: tc.snapshot})
|
||||
require.NoError(t, err)
|
||||
|
||||
@ -125,8 +125,6 @@ func TestSetCmdClientContextHandler(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
cmd := newCmd()
|
||||
_ = testutil.ApplyMockIODiscardOutErr(cmd)
|
||||
|
||||
@ -145,7 +145,6 @@ func TestConfigCmdEnvFlag(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range tt {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
testCmd := &cobra.Command{
|
||||
Use: "test",
|
||||
|
||||
@ -22,8 +22,6 @@ func TestParseGasSetting(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
gs, err := flags.ParseGasSetting(tc.input)
|
||||
|
||||
|
||||
@ -172,7 +172,6 @@ func Test_runAddCmdLedgerDryRun(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tt := range testData {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
cmd := AddKeyCommand()
|
||||
cmd.Flags().AddFlagSet(Commands().PersistentFlags())
|
||||
|
||||
@ -297,7 +297,6 @@ func Test_runAddCmdDryRun(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, tt := range testData {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
cmd := AddKeyCommand()
|
||||
cmd.Flags().AddFlagSet(Commands().PersistentFlags())
|
||||
|
||||
@ -67,7 +67,6 @@ func Test_runListCmd(t *testing.T) {
|
||||
{"keybase: w/key", kbHome2, false},
|
||||
}
|
||||
for _, tt := range testData {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
cmd.SetArgs([]string{
|
||||
fmt.Sprintf("--%s=%s", flags.FlagKeyringDir, tt.kbDir),
|
||||
|
||||
@ -21,7 +21,6 @@ func TestParseKey(t *testing.T) {
|
||||
{"hex", []string{hexstr}, false},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
require.Equal(t, tt.wantErr, doParseKey(ParseKeyStringCommand(), "cosmos", tt.args) != nil)
|
||||
})
|
||||
|
||||
@ -237,7 +237,6 @@ func Test_validateMultisigThreshold(t *testing.T) {
|
||||
{"1-2", args{2, 1}, true},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if err := validateMultisigThreshold(tt.args.k, tt.args.nKeys); (err != nil) != tt.wantErr {
|
||||
t.Errorf("validateMultisigThreshold() error = %v, wantErr %v", err, tt.wantErr)
|
||||
@ -272,7 +271,6 @@ func Test_getBechKeyOut(t *testing.T) {
|
||||
{"cons", args{sdk.PrefixConsensus}, MkConsKeyOutput, false},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
output, err := getKeyOutput(ctx, tt.args.bechPrefix, k)
|
||||
if tt.wantErr {
|
||||
|
||||
@ -214,7 +214,6 @@ func TestAuxTxBuilder(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testcases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
b = tx.NewAuxTxBuilder()
|
||||
err := tc.malleate()
|
||||
|
||||
@ -80,7 +80,6 @@ func TestCalculateGas(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
stc := tc
|
||||
txCfg, _ := newTestTxConfig()
|
||||
defaultSignMode, err := signing.APISignModeToInternal(txCfg.SignModeHandler().DefaultMode())
|
||||
require.NoError(t, err)
|
||||
@ -89,16 +88,16 @@ func TestCalculateGas(t *testing.T) {
|
||||
WithChainID("test-chain").
|
||||
WithTxConfig(txCfg).WithSignMode(defaultSignMode)
|
||||
|
||||
t.Run(stc.name, func(t *testing.T) {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
mockClientCtx := mockContext{
|
||||
gasUsed: tc.args.mockGasUsed,
|
||||
wantErr: tc.args.mockWantErr,
|
||||
}
|
||||
simRes, gotAdjusted, err := CalculateGas(mockClientCtx, txf.WithGasAdjustment(stc.args.adjustment))
|
||||
if stc.expPass {
|
||||
simRes, gotAdjusted, err := CalculateGas(mockClientCtx, txf.WithGasAdjustment(tc.args.adjustment))
|
||||
if tc.expPass {
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, simRes.GasInfo.GasUsed, stc.wantEstimate)
|
||||
require.Equal(t, gotAdjusted, stc.wantAdjusted)
|
||||
require.Equal(t, simRes.GasInfo.GasUsed, tc.wantEstimate)
|
||||
require.Equal(t, gotAdjusted, tc.wantAdjusted)
|
||||
require.NotNil(t, simRes.Result)
|
||||
} else {
|
||||
require.Error(t, err)
|
||||
|
||||
@ -67,7 +67,6 @@ func TestPaginate(t *testing.T) {
|
||||
}
|
||||
|
||||
for i, tc := range testCases {
|
||||
i, tc := i, tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
start, end := client.Paginate(tc.numObjs, tc.page, tc.limit, tc.defLimit)
|
||||
require.Equal(t, tc.expectedStart, start, "invalid result; test case #%d", i)
|
||||
|
||||
@ -71,8 +71,6 @@ func TestAminoCodecMarshalJSONIndent(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
cdc := codec.NewAminoCodec(createTestCodec())
|
||||
bz, err := cdc.MarshalJSONIndent(tc.input, "", " ")
|
||||
|
||||
@ -122,7 +122,7 @@ func testMarshaling(t *testing.T, cdc interface {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
m1 := mustMarshaler{cdc.Marshal, cdc.MustMarshal, cdc.Unmarshal, cdc.MustUnmarshal}
|
||||
m2 := mustMarshaler{cdc.MarshalLengthPrefixed, cdc.MustMarshalLengthPrefixed, cdc.UnmarshalLengthPrefixed, cdc.MustUnmarshalLengthPrefixed}
|
||||
m3 := mustMarshaler{
|
||||
|
||||
@ -22,7 +22,6 @@ func TestWireTypeToString(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(fmt.Sprintf("wireType=%d", tt.typ), func(t *testing.T) {
|
||||
if g, w := wireTypeToString(tt.typ), tt.want; g != w {
|
||||
t.Fatalf("Mismatch:\nGot: %q\nWant: %q\n", g, w)
|
||||
|
||||
@ -223,7 +223,6 @@ func TestRejectUnknownFieldsRepeated(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
protoBlob, err := proto.Marshal(tt.in)
|
||||
if err != nil {
|
||||
@ -280,7 +279,6 @@ func TestRejectUnknownFields_allowUnknownNonCriticals(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
blob, err := proto.Marshal(tt.in)
|
||||
if err != nil {
|
||||
@ -483,7 +481,6 @@ func TestRejectUnknownFieldsNested(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
protoBlob, err := proto.Marshal(tt.in)
|
||||
if err != nil {
|
||||
@ -634,7 +631,6 @@ func TestRejectUnknownFieldsFlat(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
blob, err := proto.Marshal(tt.in)
|
||||
if err != nil {
|
||||
|
||||
@ -107,9 +107,7 @@ func TestCreateHDPath(t *testing.T) {
|
||||
{"m/44'/114'/1'/1/0", args{114, 1, 1}, hd.BIP44Params{Purpose: 44, CoinType: 114, Account: 1, AddressIndex: 1}},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
tt := tt
|
||||
require.Equal(t, tt.want, *hd.CreateHDPath(tt.args.coinType, tt.args.account, tt.args.index))
|
||||
})
|
||||
}
|
||||
@ -170,7 +168,6 @@ func TestDeriveHDPathRange(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.path, func(t *testing.T) {
|
||||
master, ch := hd.ComputeMastersFromSeed(seed)
|
||||
_, err := hd.DerivePrivateKeyForPath(master, ch, tt.path)
|
||||
@ -297,7 +294,6 @@ func TestDerivePrivateKeyForPathDoNotCrash(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, path := range paths {
|
||||
path := path
|
||||
t.Run(path, func(t *testing.T) {
|
||||
_, _ = hd.DerivePrivateKeyForPath([32]byte{}, [32]byte{}, path)
|
||||
})
|
||||
|
||||
@ -2003,7 +2003,7 @@ func TestRenameKey(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
kr := newKeyring(t, "testKeyring")
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
tc.run(kr)
|
||||
|
||||
@ -36,7 +36,6 @@ func TestNewSigningAlgoByString(t *testing.T) {
|
||||
|
||||
list := SigningAlgoList{hd.Secp256k1}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
algorithm, err := NewSigningAlgoFromString(tt.algoStr, list)
|
||||
if tt.isSupported {
|
||||
|
||||
@ -12,7 +12,7 @@ import (
|
||||
"github.com/cometbft/cometbft/crypto"
|
||||
secp256k1dcrd "github.com/decred/dcrd/dcrec/secp256k1/v4"
|
||||
"gitlab.com/yawning/secp256k1-voi/secec"
|
||||
"golang.org/x/crypto/ripemd160" //nolint: staticcheck // keep around for backwards compatibility
|
||||
"golang.org/x/crypto/ripemd160" //nolint:staticcheck,gosec // keep around for backwards compatibility
|
||||
|
||||
errorsmod "cosmossdk.io/errors"
|
||||
|
||||
@ -173,8 +173,8 @@ func (pubKey *PubKey) Address() crypto.Address {
|
||||
}
|
||||
|
||||
sha := sha256.Sum256(pubKey.Key)
|
||||
hasherRIPEMD160 := ripemd160.New()
|
||||
hasherRIPEMD160.Write(sha[:]) // does not error
|
||||
hasherRIPEMD160 := ripemd160.New() //nolint:gosec // keep around for backwards compatibility
|
||||
hasherRIPEMD160.Write(sha[:]) // does not error
|
||||
return crypto.Address(hasherRIPEMD160.Sum(nil))
|
||||
}
|
||||
|
||||
|
||||
@ -27,7 +27,6 @@ func Test_genPrivKey(t *testing.T) {
|
||||
{"valid because 0 < 1 < N", validOne, false},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if tt.shouldPanic {
|
||||
require.Panics(t, func() {
|
||||
|
||||
@ -255,7 +255,6 @@ func TestGenPrivKeyFromSecret(t *testing.T) {
|
||||
{"another seed used in cosmos tests #3", []byte("")},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
gotPrivKey := secp256k1.GenPrivKeyFromSecret(tt.secret)
|
||||
require.NotNil(t, gotPrivKey)
|
||||
|
||||
@ -58,7 +58,6 @@ func TestBitArrayEqual(t *testing.T) {
|
||||
{name: "different should not be equal", b1: big1, b2: big2, eq: false},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
eq := tc.b1.Equal(tc.b2)
|
||||
require.Equal(t, tc.eq, eq)
|
||||
@ -102,7 +101,6 @@ func TestJSONMarshalUnmarshal(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.bA.String(), func(t *testing.T) {
|
||||
bz, err := json.Marshal(tc.bA)
|
||||
require.NoError(t, err)
|
||||
@ -162,7 +160,6 @@ func TestCompactMarshalUnmarshal(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.bA.String(), func(t *testing.T) {
|
||||
bz := tc.bA.CompactMarshal()
|
||||
|
||||
@ -209,8 +206,6 @@ func TestCompactBitArrayNumOfTrueBitsBefore(t *testing.T) {
|
||||
{`"______________xx"`, []int{14, 15}, []int{0, 1}},
|
||||
}
|
||||
for tcIndex, tc := range testCases {
|
||||
tc := tc
|
||||
tcIndex := tcIndex
|
||||
t.Run(tc.marshalledBA, func(t *testing.T) {
|
||||
var bA *CompactBitArray
|
||||
err := json.Unmarshal([]byte(tc.marshalledBA), &bA)
|
||||
@ -283,7 +278,6 @@ func TestNewCompactBitArrayCrashWithLimits(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(fmt.Sprintf("%d", tt.in), func(t *testing.T) {
|
||||
got := NewCompactBitArray(tt.in)
|
||||
if g := got != nil; g != tt.mustPass {
|
||||
|
||||
@ -45,7 +45,7 @@ type App struct {
|
||||
ModuleManager *module.Manager
|
||||
UnorderedTxManager *unorderedtx.Manager
|
||||
|
||||
configurator module.Configurator // nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1.
|
||||
configurator module.Configurator //nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1.
|
||||
config *runtimev1alpha1.Module
|
||||
storeKeys []storetypes.StoreKey
|
||||
interfaceRegistry codectypes.InterfaceRegistry
|
||||
@ -251,7 +251,7 @@ func (a *App) RegisterNodeService(clientCtx client.Context, cfg config.Config) {
|
||||
}
|
||||
|
||||
// Configurator returns the app's configurator.
|
||||
func (a *App) Configurator() module.Configurator { // nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1.
|
||||
func (a *App) Configurator() module.Configurator { //nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1.
|
||||
return a.configurator
|
||||
}
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ type appModule struct {
|
||||
func (m appModule) IsOnePerModuleType() {}
|
||||
func (m appModule) IsAppModule() {}
|
||||
|
||||
func (m appModule) RegisterServices(configurator module.Configurator) { // nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1.
|
||||
func (m appModule) RegisterServices(configurator module.Configurator) { //nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1.
|
||||
err := m.app.registerRuntimeServices(configurator)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
||||
@ -8,7 +8,7 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
)
|
||||
|
||||
func (a *App) registerRuntimeServices(cfg module.Configurator) error { // nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1.
|
||||
func (a *App) registerRuntimeServices(cfg module.Configurator) error { //nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1.
|
||||
autocliv1.RegisterQueryServer(cfg.QueryServer(), services.NewAutoCLIQueryService(a.ModuleManager.Modules))
|
||||
|
||||
reflectionSvc, err := services.NewReflectionService()
|
||||
|
||||
@ -105,7 +105,7 @@ type autocliConfigurator struct {
|
||||
err error
|
||||
}
|
||||
|
||||
var _ module.Configurator = &autocliConfigurator{} // nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1.
|
||||
var _ module.Configurator = &autocliConfigurator{} //nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1.
|
||||
|
||||
func (a *autocliConfigurator) MsgServer() gogogrpc.Server { return &a.msgServer }
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
golangci_version=v1.60.1
|
||||
golangci_version=v1.61.0
|
||||
golangci_installed_version=$(shell golangci-lint version --format short 2>/dev/null)
|
||||
|
||||
#? setup-pre-commit: Set pre-commit git hook
|
||||
|
||||
@ -3,10 +3,9 @@ package gogoreflection
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
_ "github.com/cosmos/cosmos-proto" // look above
|
||||
_ "github.com/cosmos/gogoproto/gogoproto" // required so it does register the gogoproto file descriptor
|
||||
gogoproto "github.com/cosmos/gogoproto/proto"
|
||||
|
||||
_ "github.com/cosmos/cosmos-proto" // look above
|
||||
"github.com/golang/protobuf/proto" //nolint:staticcheck // migrate in a future pr
|
||||
)
|
||||
|
||||
@ -42,12 +41,12 @@ func getExtension(extID int32, m proto.Message) *gogoproto.ExtensionDesc {
|
||||
for id, desc := range proto.RegisteredExtensions(m) { //nolint:staticcheck // keep for backward compatibility
|
||||
if id == extID {
|
||||
return &gogoproto.ExtensionDesc{
|
||||
ExtendedType: desc.ExtendedType, //nolint:staticcheck // keep for backward compatibility
|
||||
ExtensionType: desc.ExtensionType, //nolint:staticcheck // keep for backward compatibility
|
||||
Field: desc.Field, //nolint:staticcheck // keep for backward compatibility
|
||||
Name: desc.Name, //nolint:staticcheck // keep for backward compatibility
|
||||
Tag: desc.Tag, //nolint:staticcheck // keep for backward compatibility
|
||||
Filename: desc.Filename, //nolint:staticcheck // keep for backward compatibility
|
||||
ExtendedType: desc.ExtendedType,
|
||||
ExtensionType: desc.ExtensionType,
|
||||
Field: desc.Field,
|
||||
Name: desc.Name,
|
||||
Tag: desc.Tag,
|
||||
Filename: desc.Filename,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -184,7 +184,7 @@ func fqn(prefix, name string) string {
|
||||
// fileDescForType gets the file descriptor for the given type.
|
||||
// The given type should be a proto message.
|
||||
func (s *serverReflectionServer) fileDescForType(st reflect.Type) (*dpb.FileDescriptorProto, error) {
|
||||
m, ok := reflect.Zero(reflect.PtrTo(st)).Interface().(protoMessage)
|
||||
m, ok := reflect.Zero(reflect.PointerTo(st)).Interface().(protoMessage)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("failed to create message from type: %v", st)
|
||||
}
|
||||
@ -232,7 +232,7 @@ func typeForName(name string) (reflect.Type, error) {
|
||||
}
|
||||
|
||||
func fileDescContainingExtension(st reflect.Type, ext int32) (*dpb.FileDescriptorProto, error) {
|
||||
m, ok := reflect.Zero(reflect.PtrTo(st)).Interface().(proto.Message)
|
||||
m, ok := reflect.Zero(reflect.PointerTo(st)).Interface().(proto.Message)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("failed to create message from type: %v", st)
|
||||
}
|
||||
@ -247,7 +247,7 @@ func fileDescContainingExtension(st reflect.Type, ext int32) (*dpb.FileDescripto
|
||||
}
|
||||
|
||||
func (s *serverReflectionServer) allExtensionNumbersForType(st reflect.Type) ([]int32, error) {
|
||||
m, ok := reflect.Zero(reflect.PtrTo(st)).Interface().(proto.Message)
|
||||
m, ok := reflect.Zero(reflect.PointerTo(st)).Interface().(proto.Message)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("failed to create message from type: %v", st)
|
||||
}
|
||||
|
||||
@ -49,8 +49,6 @@ func TestGetPruningOptionsFromFlags(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
|
||||
t.Run(tt.name, func(j *testing.T) {
|
||||
viper.Reset()
|
||||
viper.SetDefault(FlagPruning, pruningtypes.PruningOptionDefault)
|
||||
|
||||
@ -832,7 +832,7 @@ func testnetify[T types.Application](ctx *Context, testnetAppCreator types.AppCr
|
||||
_, context := getCtx(ctx, true)
|
||||
clientCreator := proxy.NewLocalClientCreator(cmtApp)
|
||||
metrics := node.DefaultMetricsProvider(cmtcfg.DefaultConfig().Instrumentation)
|
||||
_, _, _, _, _, proxyMetrics, _, _ := metrics(genDoc.ChainID) // nolint: dogsled // function from comet
|
||||
_, _, _, _, _, proxyMetrics, _, _ := metrics(genDoc.ChainID) //nolint: dogsled // function from comet
|
||||
proxyApp := proxy.NewAppConns(clientCreator, proxyMetrics)
|
||||
if err := proxyApp.Start(); err != nil {
|
||||
return nil, fmt.Errorf("error starting proxy app connections: %w", err)
|
||||
|
||||
@ -334,9 +334,6 @@ func TestConsensus_ExtendVote(t *testing.T) {
|
||||
Block: &v1.BlockParams{
|
||||
MaxGas: 5000000,
|
||||
},
|
||||
Abci: &v1.ABCIParams{
|
||||
VoteExtensionsEnableHeight: 2,
|
||||
},
|
||||
Feature: &v1.FeatureParams{
|
||||
VoteExtensionsEnableHeight: &gogotypes.Int64Value{Value: 2},
|
||||
},
|
||||
@ -376,9 +373,6 @@ func TestConsensus_VerifyVoteExtension(t *testing.T) {
|
||||
Block: &v1.BlockParams{
|
||||
MaxGas: 5000000,
|
||||
},
|
||||
Abci: &v1.ABCIParams{
|
||||
VoteExtensionsEnableHeight: 2,
|
||||
},
|
||||
Feature: &v1.FeatureParams{
|
||||
VoteExtensionsEnableHeight: &gogotypes.Int64Value{Value: 2},
|
||||
},
|
||||
@ -537,6 +531,7 @@ func TestConsensus_ProcessProposal_With_Handler(t *testing.T) {
|
||||
Height: 1,
|
||||
Txs: [][]byte{mockTx.Bytes(), append(mockTx.Bytes(), []byte("bad")...), mockTx.Bytes(), mockTx.Bytes()},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, res.Status, abciproto.PROCESS_PROPOSAL_STATUS_REJECT)
|
||||
}
|
||||
|
||||
@ -642,9 +637,6 @@ func setUpConsensus(t *testing.T, gasLimit uint64, mempool mempool.Mempool[mock.
|
||||
Block: &v1.BlockParams{
|
||||
MaxGas: 300000,
|
||||
},
|
||||
Abci: &v1.ABCIParams{
|
||||
VoteExtensionsEnableHeight: 2,
|
||||
},
|
||||
Feature: &v1.FeatureParams{
|
||||
VoteExtensionsEnableHeight: &gogotypes.Int64Value{Value: 2},
|
||||
},
|
||||
|
||||
@ -182,7 +182,7 @@ type SimApp struct {
|
||||
sm *module.SimulationManager
|
||||
|
||||
// module configurator
|
||||
configurator module.Configurator // nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1.
|
||||
configurator module.Configurator //nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1.
|
||||
}
|
||||
|
||||
func init() {
|
||||
@ -703,7 +703,7 @@ func (app *SimApp) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error) {
|
||||
return app.ModuleManager.EndBlock(ctx)
|
||||
}
|
||||
|
||||
func (a *SimApp) Configurator() module.Configurator { // nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1.
|
||||
func (a *SimApp) Configurator() module.Configurator { //nolint:staticcheck // SA1019: Configurator is deprecated but still used in runtime v1.
|
||||
return a.configurator
|
||||
}
|
||||
|
||||
|
||||
@ -81,7 +81,6 @@ func TestSimGenesisAccountValidate(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
require.Equal(t, tc.wantErr, tc.sga.Validate() != nil)
|
||||
})
|
||||
|
||||
@ -81,7 +81,6 @@ func TestSimGenesisAccountValidate(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
require.Equal(t, tc.wantErr, tc.sga.Validate() != nil)
|
||||
})
|
||||
|
||||
@ -357,7 +357,6 @@ func (s *E2ETestSuite) TestCLIQueryTxCmdByHash() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
cmd := authcli.QueryTxCmd()
|
||||
clientCtx := val.GetClientCtx()
|
||||
@ -490,7 +489,6 @@ func (s *E2ETestSuite) TestCLIQueryTxCmdByEvents() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
cmd := authcli.QueryTxCmd()
|
||||
clientCtx := val.GetClientCtx()
|
||||
@ -570,7 +568,6 @@ func (s *E2ETestSuite) TestCLIQueryTxsCmdByEvents() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
cmd := authcli.QueryTxsByEventsCmd()
|
||||
clientCtx := val.GetClientCtx()
|
||||
@ -1503,7 +1500,6 @@ func (s *E2ETestSuite) TestAuxSigner() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
_, err := govtestutil.MsgSubmitLegacyProposal(
|
||||
val.GetClientCtx(),
|
||||
@ -1730,7 +1726,6 @@ func (s *E2ETestSuite) TestAuxToFeeWithTips() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
res, err := govtestutil.MsgSubmitLegacyProposal(
|
||||
val.GetClientCtx(),
|
||||
|
||||
@ -63,7 +63,6 @@ func (s *E2ETestSuite) TestQueryGrantGRPC() {
|
||||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
resp, _ := testutil.GetRequest(tc.url)
|
||||
require := s.Require()
|
||||
@ -151,7 +150,6 @@ func (s *E2ETestSuite) TestQueryGrantsGRPC() {
|
||||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
tc.preRun()
|
||||
resp, err := testutil.GetRequest(tc.url)
|
||||
|
||||
@ -305,7 +305,6 @@ func (s *E2ETestSuite) TestNewExecGenericAuthorized() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
cmd := cli.NewCmdExecAuthorization()
|
||||
clientCtx := val.GetClientCtx()
|
||||
@ -415,7 +414,6 @@ func (s *E2ETestSuite) TestNewExecGrantAuthorized() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
cmd := cli.NewCmdExecAuthorization()
|
||||
clientCtx := val.GetClientCtx()
|
||||
@ -619,7 +617,6 @@ func (s *E2ETestSuite) TestExecDelegateAuthorization() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
cmd := cli.NewCmdExecAuthorization()
|
||||
clientCtx := val.GetClientCtx()
|
||||
@ -686,7 +683,6 @@ func (s *E2ETestSuite) TestExecDelegateAuthorization() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
cmd := cli.NewCmdExecAuthorization()
|
||||
clientCtx := val.GetClientCtx()
|
||||
@ -841,7 +837,6 @@ func (s *E2ETestSuite) TestExecUndelegateAuthorization() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
cmd := cli.NewCmdExecAuthorization()
|
||||
clientCtx := val.GetClientCtx()
|
||||
@ -909,7 +904,6 @@ func (s *E2ETestSuite) TestExecUndelegateAuthorization() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
cmd := cli.NewCmdExecAuthorization()
|
||||
clientCtx := val.GetClientCtx()
|
||||
|
||||
@ -154,7 +154,6 @@ func (s *E2ETestSuite) TestLatestValidatorSet_GRPC() {
|
||||
{"with pagination", &cmtservice.GetLatestValidatorSetRequest{Pagination: &qtypes.PageRequest{Offset: 0, Limit: uint64(len(vals))}}, false, ""},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
grpcRes, err := s.queryClient.GetLatestValidatorSet(context.Background(), tc.req)
|
||||
if tc.expErr {
|
||||
@ -185,7 +184,6 @@ func (s *E2ETestSuite) TestLatestValidatorSet_GRPCGateway() {
|
||||
{"with pagination", fmt.Sprintf("%s/cosmos/base/tendermint/v1beta1/validatorsets/latest?pagination.offset=0&pagination.limit=2", vals[0].GetAPIAddress()), false, ""},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
res, err := testutil.GetRequest(tc.url)
|
||||
s.Require().NoError(err)
|
||||
@ -218,7 +216,6 @@ func (s *E2ETestSuite) TestValidatorSetByHeight_GRPC() {
|
||||
{"with pagination", &cmtservice.GetValidatorSetByHeightRequest{Height: 1, Pagination: &qtypes.PageRequest{Offset: 0, Limit: 1}}, false, ""},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
grpcRes, err := s.queryClient.GetValidatorSetByHeight(context.Background(), tc.req)
|
||||
if tc.expErr {
|
||||
@ -247,7 +244,6 @@ func (s *E2ETestSuite) TestValidatorSetByHeight_GRPCGateway() {
|
||||
{"with pagination", fmt.Sprintf("%s/cosmos/base/tendermint/v1beta1/validatorsets/%d?pagination.offset=0&pagination.limit=2", vals[0].GetAPIAddress(), 1), false, ""},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
res, err := testutil.GetRequest(tc.url)
|
||||
s.Require().NoError(err)
|
||||
@ -326,8 +322,6 @@ func (s *E2ETestSuite) TestABCIQuery() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
s.Run(tc.name, func() {
|
||||
res, err := s.queryClient.ABCIQuery(context.Background(), tc.req)
|
||||
if tc.expectErr {
|
||||
|
||||
@ -64,7 +64,7 @@ func (s *GRPCQueryTestSuite) TestQueryParamsGRPC() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
resp, err := sdktestutil.GetRequest(tc.url)
|
||||
s.Run(tc.name, func() {
|
||||
s.Require().NoError(err)
|
||||
@ -99,7 +99,7 @@ func (s *GRPCQueryTestSuite) TestQueryValidatorDistributionInfoGRPC() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
resp, err := sdktestutil.GetRequest(tc.url)
|
||||
s.Run(tc.name, func() {
|
||||
if tc.expErr {
|
||||
@ -152,7 +152,7 @@ func (s *GRPCQueryTestSuite) TestQueryOutstandingRewardsGRPC() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
resp, err := sdktestutil.GetRequestWithHeaders(tc.url, tc.headers)
|
||||
s.Run(tc.name, func() {
|
||||
if tc.expErr {
|
||||
@ -206,7 +206,7 @@ func (s *GRPCQueryTestSuite) TestQueryValidatorCommissionGRPC() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
resp, err := sdktestutil.GetRequestWithHeaders(tc.url, tc.headers)
|
||||
s.Run(tc.name, func() {
|
||||
if tc.expErr {
|
||||
@ -264,7 +264,7 @@ func (s *GRPCQueryTestSuite) TestQuerySlashesGRPC() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
resp, err := sdktestutil.GetRequest(tc.url)
|
||||
|
||||
s.Run(tc.name, func() {
|
||||
@ -340,7 +340,7 @@ func (s *GRPCQueryTestSuite) TestQueryDelegatorRewardsGRPC() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
resp, err := sdktestutil.GetRequestWithHeaders(tc.url, tc.headers)
|
||||
|
||||
s.Run(tc.name, func() {
|
||||
@ -392,7 +392,7 @@ func (s *GRPCQueryTestSuite) TestQueryDelegatorValidatorsGRPC() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
resp, err := sdktestutil.GetRequest(tc.url)
|
||||
|
||||
s.Run(tc.name, func() {
|
||||
@ -444,7 +444,7 @@ func (s *GRPCQueryTestSuite) TestQueryWithdrawAddressGRPC() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
resp, err := sdktestutil.GetRequest(tc.url)
|
||||
|
||||
s.Run(tc.name, func() {
|
||||
|
||||
@ -164,8 +164,6 @@ func (s *E2ETestSuite) TestNewCmdSubmitProposal() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
s.Run(tc.name, func() {
|
||||
cmd := cli.NewCmdSubmitProposal()
|
||||
clientCtx := val.GetClientCtx()
|
||||
@ -260,8 +258,6 @@ func (s *E2ETestSuite) TestNewCmdSubmitLegacyProposal() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
s.Run(tc.name, func() {
|
||||
cmd := cli.NewCmdSubmitLegacyProposal()
|
||||
clientCtx := val.GetClientCtx()
|
||||
@ -357,7 +353,6 @@ func (s *E2ETestSuite) TestNewCmdWeightedVote() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
cmd := cli.NewCmdWeightedVote()
|
||||
clientCtx := val.GetClientCtx()
|
||||
|
||||
@ -175,7 +175,6 @@ func (s *E2ETestSuite) TestSimulateTx_GRPC() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
// Broadcast the tx via gRPC via the validator's clientCtx (which goes
|
||||
// through Tendermint).
|
||||
@ -506,7 +505,6 @@ func (s *E2ETestSuite) TestBroadcastTx_GRPC() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
// Broadcast the tx via gRPC via the validator's clientCtx (which goes
|
||||
// through Tendermint).
|
||||
@ -772,7 +770,6 @@ func (s *E2ETestSuite) TestTxEncode_GRPC() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
res, err := s.queryClient.TxEncode(context.Background(), tc.req)
|
||||
if tc.expErr {
|
||||
@ -852,7 +849,6 @@ func (s *E2ETestSuite) TestTxDecode_GRPC() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
res, err := s.queryClient.TxDecode(context.Background(), tc.req)
|
||||
if tc.expErr {
|
||||
@ -963,7 +959,6 @@ func (s *E2ETestSuite) TestTxEncodeAmino_GRPC() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
res, err := s.queryClient.TxEncodeAmino(context.Background(), tc.req)
|
||||
if tc.expErr {
|
||||
@ -1049,7 +1044,6 @@ func (s *E2ETestSuite) TestTxDecodeAmino_GRPC() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
res, err := s.queryClient.TxDecodeAmino(context.Background(), tc.req)
|
||||
if tc.expErr {
|
||||
|
||||
@ -274,7 +274,6 @@ func (s *CLITestSuite) TestCLIQueryTxCmdByHash() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
cmd := authcli.QueryTxCmd()
|
||||
cmd.SetArgs(tc.args)
|
||||
@ -340,7 +339,6 @@ func (s *CLITestSuite) TestCLIQueryTxCmdByEvents() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
cmd := authcli.QueryTxCmd()
|
||||
cmd.SetArgs(tc.args)
|
||||
@ -383,7 +381,6 @@ func (s *CLITestSuite) TestCLIQueryTxsCmdByEvents() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
cmd := authcli.QueryTxsByEventsCmd()
|
||||
|
||||
@ -1019,7 +1016,6 @@ func (s *CLITestSuite) TestAuxSigner() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
_, err := govtestutil.MsgSubmitLegacyProposal(
|
||||
s.clientCtx,
|
||||
@ -1238,7 +1234,6 @@ func (s *CLITestSuite) TestAuxToFeeWithTips() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
res, err := govtestutil.MsgSubmitLegacyProposal(
|
||||
s.clientCtx,
|
||||
|
||||
@ -250,7 +250,6 @@ func TestAsyncExec(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
res, err := f.app.RunMsg(
|
||||
tc.req,
|
||||
|
||||
@ -111,8 +111,6 @@ func (s *CLITestSuite) TestTxWithdrawAllRewardsCmd() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
s.Run(tc.name, func() {
|
||||
cmd := cli.NewWithdrawAllRewardsCmd()
|
||||
|
||||
|
||||
@ -331,7 +331,6 @@ func TestMsgWithdrawDelegatorReward(t *testing.T) {
|
||||
height := f.app.LastBlockHeight()
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
res, err := f.app.RunMsg(
|
||||
tc.msg,
|
||||
@ -469,7 +468,6 @@ func TestMsgSetWithdrawAddress(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
tc.preRun()
|
||||
res, err := f.app.RunMsg(
|
||||
@ -566,7 +564,6 @@ func TestMsgWithdrawValidatorCommission(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
res, err := f.app.RunMsg(
|
||||
tc.msg,
|
||||
@ -600,7 +597,6 @@ func TestMsgWithdrawValidatorCommission(t *testing.T) {
|
||||
}, remainder.Commission)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -666,7 +662,6 @@ func TestMsgFundCommunityPool(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
res, err := f.app.RunMsg(
|
||||
tc.msg,
|
||||
@ -808,7 +803,6 @@ func TestMsgUpdateParams(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
res, err := f.app.RunMsg(
|
||||
tc.msg,
|
||||
@ -891,7 +885,6 @@ func TestMsgCommunityPoolSpend(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
res, err := f.app.RunMsg(
|
||||
tc.msg,
|
||||
@ -992,7 +985,6 @@ func TestMsgDepositValidatorRewardsPool(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
res, err := f.app.RunMsg(
|
||||
tc.msg,
|
||||
|
||||
@ -72,7 +72,6 @@ func TestAddGenesisAccountCmd(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
home := t.TempDir()
|
||||
logger := log.NewNopLogger()
|
||||
@ -217,7 +216,6 @@ func TestBulkAddGenesisAccountCmd(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
home := t.TempDir()
|
||||
logger := log.NewNopLogger()
|
||||
|
||||
@ -61,7 +61,6 @@ func TestInitCmd(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
home := t.TempDir()
|
||||
logger := log.NewNopLogger()
|
||||
|
||||
@ -163,8 +163,6 @@ func TestCancelUnbondingDelegation(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
_, err := msgServer.CancelUnbondingDelegation(ctx, &tc.req)
|
||||
if tc.exceptErr {
|
||||
|
||||
@ -51,7 +51,6 @@ func TestGetSimulationLog(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.store, func(t *testing.T) {
|
||||
require.Equal(t, tt.expectedLog, GetSimulationLog(tt.store, decoders, tt.kvPairs, tt.kvPairs), tt.store)
|
||||
})
|
||||
|
||||
@ -74,7 +74,6 @@ func PlanBuilder(from *tomledit.Document, to, planType string, loadFn loadDestCo
|
||||
|
||||
diffs := DiffKeys(from, target)
|
||||
for _, diff := range diffs {
|
||||
diff := diff
|
||||
kv := diff.KV
|
||||
|
||||
var step transform.Step
|
||||
|
||||
@ -422,7 +422,6 @@ func (s *addressTestSuite) TestBech32ifyAddressBytes() {
|
||||
{"20-byte address", args{"prefixb", addr20byte}, "prefixb1qqqsyqcyq5rqwzqfpg9scrgwpugpzysnrujsuw", false},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
s.T().Run(tt.name, func(t *testing.T) {
|
||||
got, err := types.Bech32ifyAddressBytes(tt.args.prefix, tt.args.bs)
|
||||
if (err != nil) != tt.wantErr {
|
||||
@ -453,7 +452,6 @@ func (s *addressTestSuite) TestMustBech32ifyAddressBytes() {
|
||||
{"20-byte address", args{"prefixb", addr20byte}, "prefixb1qqqsyqcyq5rqwzqfpg9scrgwpugpzysnrujsuw", false},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
s.T().Run(tt.name, func(t *testing.T) {
|
||||
if tt.wantPanic {
|
||||
require.Panics(t, func() { types.MustBech32ifyAddressBytes(tt.args.prefix, tt.args.bs) })
|
||||
|
||||
@ -432,7 +432,6 @@ func (coins Coins) SafeMulInt(x math.Int) (Coins, bool) {
|
||||
|
||||
res := make(Coins, len(coins))
|
||||
for i, coin := range coins {
|
||||
coin := coin
|
||||
res[i] = NewCoin(coin.Denom, coin.Amount.Mul(x))
|
||||
}
|
||||
|
||||
@ -466,7 +465,6 @@ func (coins Coins) SafeQuoInt(x math.Int) (Coins, bool) {
|
||||
|
||||
var res Coins
|
||||
for _, coin := range coins {
|
||||
coin := coin
|
||||
res = append(res, NewCoin(coin.Denom, coin.Amount.Quo(x)))
|
||||
}
|
||||
|
||||
|
||||
@ -178,7 +178,6 @@ func (s *coinTestSuite) TestAddCoin() {
|
||||
}
|
||||
|
||||
for tcIndex, tc := range cases {
|
||||
tc := tc
|
||||
if tc.shouldPanic {
|
||||
s.Require().Panics(func() { tc.inputOne.Add(tc.inputTwo) })
|
||||
} else {
|
||||
@ -218,7 +217,6 @@ func (s *coinTestSuite) TestSubCoin() {
|
||||
}
|
||||
|
||||
for tcIndex, tc := range cases {
|
||||
tc := tc
|
||||
if tc.shouldPanic {
|
||||
s.Require().Panics(func() { tc.inputOne.Sub(tc.inputTwo) })
|
||||
} else {
|
||||
@ -274,7 +272,6 @@ func (s *coinTestSuite) TestMulIntCoins() {
|
||||
|
||||
assert := s.Assert()
|
||||
for i, tc := range testCases {
|
||||
tc := tc
|
||||
if tc.shouldPanic {
|
||||
assert.Panics(func() { tc.input.MulInt(tc.multiplier) })
|
||||
} else {
|
||||
@ -301,7 +298,6 @@ func (s *coinTestSuite) TestQuoIntCoins() {
|
||||
|
||||
assert := s.Assert()
|
||||
for i, tc := range testCases {
|
||||
tc := tc
|
||||
if tc.shouldPanic {
|
||||
assert.Panics(func() { tc.input.QuoInt(tc.divisor) })
|
||||
} else {
|
||||
@ -326,7 +322,6 @@ func (s *coinTestSuite) TestIsGTCoin() {
|
||||
}
|
||||
|
||||
for tcIndex, tc := range cases {
|
||||
tc := tc
|
||||
if tc.panics {
|
||||
s.Require().Panics(func() { tc.inputOne.IsGT(tc.inputTwo) })
|
||||
} else {
|
||||
@ -350,7 +345,6 @@ func (s *coinTestSuite) TestIsGTECoin() {
|
||||
}
|
||||
|
||||
for tcIndex, tc := range cases {
|
||||
tc := tc
|
||||
if tc.panics {
|
||||
s.Require().Panics(func() { tc.inputOne.IsGTE(tc.inputTwo) })
|
||||
} else {
|
||||
@ -374,7 +368,6 @@ func (s *coinTestSuite) TestIsLTECoin() {
|
||||
}
|
||||
|
||||
for tcIndex, tc := range cases {
|
||||
tc := tc
|
||||
if tc.panics {
|
||||
s.Require().Panics(func() { tc.inputOne.IsLTE(tc.inputTwo) })
|
||||
} else {
|
||||
@ -400,7 +393,6 @@ func (s *coinTestSuite) TestIsLTCoin() {
|
||||
}
|
||||
|
||||
for tcIndex, tc := range cases {
|
||||
tc := tc
|
||||
if tc.panics {
|
||||
s.Require().Panics(func() { tc.inputOne.IsLT(tc.inputTwo) })
|
||||
} else {
|
||||
@ -683,7 +675,6 @@ func (s *coinTestSuite) TestSubCoins() {
|
||||
|
||||
assert := s.Assert()
|
||||
for i, tc := range testCases {
|
||||
tc := tc
|
||||
if tc.shouldPanic {
|
||||
assert.Panics(func() { tc.inputOne.Sub(tc.inputTwo...) })
|
||||
} else {
|
||||
@ -708,7 +699,7 @@ func (s *coinTestSuite) TestSafeSubCoin() {
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
tc := tc
|
||||
|
||||
res, err := tc.inputOne.SafeSub(tc.inputTwo)
|
||||
if err != nil {
|
||||
s.Require().Contains(err.Error(), tc.expErrMsg)
|
||||
@ -1373,7 +1364,7 @@ func (s *coinTestSuite) TestCoinValidate() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
t := s.T()
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
err := tc.coin.Validate()
|
||||
|
||||
@ -203,7 +203,6 @@ func (s *contextTestSuite) TestContextHeaderClone() {
|
||||
}
|
||||
|
||||
for name, tc := range cases {
|
||||
tc := tc
|
||||
s.T().Run(name, func(t *testing.T) {
|
||||
ctx := types.NewContext(nil, false, nil).WithBlockHeader(tc.h)
|
||||
s.Require().Equal(tc.h.Height, ctx.BlockHeight())
|
||||
|
||||
@ -211,7 +211,6 @@ func (s *decCoinTestSuite) TestIsValid() {
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
if tc.expectPass {
|
||||
s.Require().True(tc.coin.IsValid(), tc.msg)
|
||||
} else {
|
||||
@ -246,7 +245,6 @@ func (s *decCoinTestSuite) TestSubDecCoin() {
|
||||
decCoin := sdk.NewDecCoin("mytoken", math.NewInt(10))
|
||||
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
if tc.expectPass {
|
||||
equal := tc.coin.Sub(decCoin)
|
||||
s.Require().Equal(equal, decCoin, tc.msg)
|
||||
@ -282,7 +280,6 @@ func (s *decCoinTestSuite) TestSubDecCoins() {
|
||||
decCoins := sdk.NewDecCoinsFromCoins(sdk.NewCoin("btc", math.NewInt(10)), sdk.NewCoin("eth", math.NewInt(15)), sdk.NewCoin("mytoken", math.NewInt(5)))
|
||||
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
if tc.expectPass {
|
||||
equal := tc.coins.Sub(decCoins)
|
||||
s.Require().Equal(equal, decCoins, tc.msg)
|
||||
@ -527,7 +524,6 @@ func (s *decCoinTestSuite) TestDecCoinsQuoDecTruncate() {
|
||||
}
|
||||
|
||||
for i, tc := range testCases {
|
||||
tc := tc
|
||||
if tc.panics {
|
||||
s.Require().Panics(func() { tc.coins.QuoDecTruncate(tc.input) })
|
||||
} else {
|
||||
@ -564,7 +560,6 @@ func (s *decCoinTestSuite) TestNewDecCoinsWithIsValid() {
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
if tc.expectPass {
|
||||
s.Require().True(tc.coin.IsValid(), tc.msg)
|
||||
} else {
|
||||
@ -591,7 +586,6 @@ func (s *decCoinTestSuite) TestNewDecCoinsWithZeroCoins() {
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
s.Require().Equal(sdk.NewDecCoinsFromCoins(tc.coins...).Len(), tc.expectLength)
|
||||
}
|
||||
}
|
||||
@ -623,7 +617,6 @@ func (s *decCoinTestSuite) TestDecCoins_AddDecCoinWithIsValid() {
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
if tc.expectPass {
|
||||
s.Require().True(tc.coin.IsValid(), tc.msg)
|
||||
} else {
|
||||
@ -679,7 +672,6 @@ func (s *decCoinTestSuite) TestDecCoins_GetDenomByIndex() {
|
||||
}
|
||||
|
||||
for i, tc := range testCases {
|
||||
tc := tc
|
||||
s.T().Run(tc.name, func(t *testing.T) {
|
||||
if tc.expectedErr {
|
||||
s.Require().Panics(func() { tc.input.GetDenomByIndex(tc.index) }, "Test should have panicked")
|
||||
@ -721,7 +713,6 @@ func (s *decCoinTestSuite) TestDecCoins_IsAllPositive() {
|
||||
}
|
||||
|
||||
for i, tc := range testCases {
|
||||
tc := tc
|
||||
s.T().Run(tc.name, func(t *testing.T) {
|
||||
if tc.expectedResult {
|
||||
s.Require().True(tc.input.IsAllPositive(), "Test case #%d: %s", i, tc.name)
|
||||
@ -791,7 +782,6 @@ func (s *decCoinTestSuite) TestDecCoin_IsGTE() {
|
||||
}
|
||||
|
||||
for i, tc := range testCases {
|
||||
tc := tc
|
||||
s.T().Run(tc.name, func(t *testing.T) {
|
||||
if tc.expectedPanic {
|
||||
s.Require().Panics(func() { tc.coin.IsGTE(tc.otherCoin) }, "Test case #%d: %s", i, tc.name)
|
||||
@ -835,7 +825,6 @@ func (s *decCoinTestSuite) TestDecCoins_IsZero() {
|
||||
}
|
||||
|
||||
for i, tc := range testCases {
|
||||
tc := tc
|
||||
s.T().Run(tc.name, func(t *testing.T) {
|
||||
if tc.expectedResult {
|
||||
s.Require().True(tc.coins.IsZero(), "Test case #%d: %s", i, tc.name)
|
||||
@ -890,7 +879,6 @@ func (s *decCoinTestSuite) TestDecCoins_MulDec() {
|
||||
}
|
||||
|
||||
for i, tc := range testCases {
|
||||
tc := tc
|
||||
s.T().Run(tc.name, func(t *testing.T) {
|
||||
res := tc.coins.MulDec(tc.multiplier)
|
||||
s.Require().Equal(tc.expectedResult, res, "Test case #%d: %s", i, tc.name)
|
||||
@ -939,7 +927,6 @@ func (s *decCoinTestSuite) TestDecCoins_MulDecTruncate() {
|
||||
}
|
||||
|
||||
for i, tc := range testCases {
|
||||
tc := tc
|
||||
s.T().Run(tc.name, func(t *testing.T) {
|
||||
if tc.expectedPanic {
|
||||
s.Require().Panics(func() { tc.coins.MulDecTruncate(tc.multiplier) }, "Test case #%d: %s", i, tc.name)
|
||||
@ -992,7 +979,6 @@ func (s *decCoinTestSuite) TestDecCoins_QuoDec() {
|
||||
}
|
||||
|
||||
for i, tc := range testCases {
|
||||
tc := tc
|
||||
s.T().Run(tc.name, func(t *testing.T) {
|
||||
if tc.panics {
|
||||
s.Require().Panics(func() { tc.coins.QuoDec(tc.input) }, "Test case #%d: %s", i, tc.name)
|
||||
|
||||
@ -268,7 +268,6 @@ func (s *eventsTestSuite) TestMarkEventsToIndex() {
|
||||
}
|
||||
|
||||
for name, tc := range testCases {
|
||||
tc := tc
|
||||
s.T().Run(name, func(_ *testing.T) {
|
||||
s.Require().Equal(tc.expected, sdk.MarkEventsToIndex(tc.events, tc.indexSet))
|
||||
})
|
||||
|
||||
@ -594,7 +594,6 @@ func (m *Manager) assertNoForgottenModules(setOrderFnName string, moduleNames []
|
||||
}
|
||||
var missing []string
|
||||
for m := range m.Modules {
|
||||
m := m
|
||||
if pass != nil && pass(m) {
|
||||
continue
|
||||
}
|
||||
@ -834,7 +833,6 @@ func (m *Manager) GetVersionMap() appmodule.VersionMap {
|
||||
if v, ok := v.(appmodule.HasConsensusVersion); ok {
|
||||
version = v.ConsensusVersion()
|
||||
}
|
||||
name := name
|
||||
vermap[name] = version
|
||||
}
|
||||
|
||||
|
||||
@ -140,7 +140,6 @@ func TestCollectionPagination(t *testing.T) {
|
||||
}
|
||||
|
||||
for name, tc := range tcs {
|
||||
tc := tc
|
||||
t.Run(name, func(t *testing.T) {
|
||||
gotResults, gotResponse, err := CollectionFilteredPaginate(
|
||||
ctx,
|
||||
|
||||
@ -24,7 +24,6 @@ func TestRandomAccounts(t *testing.T) {
|
||||
{"100-accounts", 100, 100},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got := simulation.RandomAccounts(r, tt.n)
|
||||
require.Equal(t, tt.want, len(got))
|
||||
@ -66,8 +65,6 @@ func TestRandomFees(t *testing.T) {
|
||||
{"1 coin with 0 amount", sdk.Coins{sdk.NewInt64Coin("ccc", 0)}, true, true},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got, err := simulation.RandomFees(r, tt.spendableCoins)
|
||||
if (err != nil) != tt.wantErr {
|
||||
|
||||
@ -28,7 +28,6 @@ func TestRandSubsetCoins(t *testing.T) {
|
||||
{"too small amount", rand.New(rand.NewSource(99)), sdk.Coins{sdk.Coin{Denom: "aaa", Amount: math.NewInt(0)}}},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got := simulation.RandSubsetCoins(tt.r, tt.coins)
|
||||
gotStringRep := got.String()
|
||||
|
||||
@ -33,7 +33,6 @@ func TestSignDocDirectAux(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testcases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
err := tc.sd.ValidateBasic()
|
||||
|
||||
@ -68,7 +67,6 @@ func TestAuxSignerData(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testcases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
err := tc.sd.ValidateBasic()
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ func (s *utilsTestSuite) TestTimeFormatAndParse() {
|
||||
{"2011-01-10T23:10:05.758230235Z", "2011-01-10T23:10:05.758230235", true},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
tc := tc
|
||||
|
||||
timeFromRFC, err := time.Parse(time.RFC3339Nano, tc.RFC3339NanoStr)
|
||||
s.Require().Nil(err)
|
||||
timeFromSDKFormat, err := time.Parse(sdk.SortableTimeFormat, tc.SDKSortableTimeStr)
|
||||
@ -116,8 +116,6 @@ func (s *utilsTestSuite) TestParseTime() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
s.Run(tc.name, func() {
|
||||
tm, err := sdk.ParseTime(tc.input)
|
||||
if tc.expectErr {
|
||||
|
||||
@ -119,7 +119,6 @@ func (s *CLITestSuite) TestTxInitCmd() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
ctx := svrcmd.CreateExecuteContext(context.Background())
|
||||
|
||||
|
||||
@ -53,7 +53,6 @@ func TestInitLockupAccount(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, test := range testcases {
|
||||
test := test
|
||||
_, err := baseLockup.Init(ctx, &test.msg)
|
||||
if test.expErr != nil {
|
||||
require.Equal(t, test.expErr, err)
|
||||
|
||||
@ -339,7 +339,7 @@ func (k Keeper) makeAccountContext(ctx context.Context, accountNumber uint64, ac
|
||||
|
||||
// sendAnyMessages it a helper function that executes untyped codectypes.Any messages
|
||||
// The messages must all belong to a module.
|
||||
// nolint: unused // TODO: remove nolint when we bring back bundler payments
|
||||
//nolint: unused // TODO: remove nolint when we bring back bundler payments
|
||||
func (k Keeper) sendAnyMessages(ctx context.Context, sender []byte, anyMessages []*implementation.Any) ([]*implementation.Any, error) {
|
||||
anyResponses := make([]*implementation.Any, len(anyMessages))
|
||||
for i := range anyMessages {
|
||||
|
||||
@ -221,8 +221,6 @@ func TestTxHeightTimeoutDecorator(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
suite.txBuilder = suite.clientCtx.TxConfig.NewTxBuilder()
|
||||
|
||||
|
||||
@ -172,7 +172,6 @@ func TestBatchScanner_Scan(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
scanner, i := authclient.NewBatchScanner(clientCtx.TxConfig, strings.NewReader(tt.batch)), 0
|
||||
for scanner.Scan() {
|
||||
|
||||
@ -120,7 +120,6 @@ func (s *KeeperTestSuite) TestUpdateParams() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
_, err := s.msgServer.UpdateParams(s.ctx, tc.req)
|
||||
if tc.expectErr {
|
||||
@ -190,7 +189,6 @@ func (s *KeeperTestSuite) TestNonAtomicExec() {
|
||||
}).AnyTimes()
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
_, err := s.msgServer.NonAtomicExec(s.ctx, tc.req)
|
||||
if tc.expectErr {
|
||||
|
||||
@ -90,7 +90,6 @@ func TestStdSignBytes(t *testing.T) {
|
||||
FileResolver: proto.HybridResolver,
|
||||
})
|
||||
for i, tc := range tests {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
anyMsgs := make([]*anypb.Any, len(tc.args.msgs))
|
||||
for j, msg := range tc.args.msgs {
|
||||
|
||||
@ -100,7 +100,6 @@ func TestBuilderWithAux(t *testing.T) {
|
||||
{"happy case", func() {}, false},
|
||||
}
|
||||
for _, tc := range testcases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
txBuilder, txSig = makeTxBuilder(t)
|
||||
|
||||
|
||||
@ -114,8 +114,6 @@ func getBlocksForTxResults(clientCtx client.Context, resTxs []*coretypes.ResultT
|
||||
resBlocks := make(map[int64]*coretypes.ResultBlock)
|
||||
|
||||
for _, resTx := range resTxs {
|
||||
resTx := resTx
|
||||
|
||||
if _, ok := resBlocks[resTx.Height]; !ok {
|
||||
resBlock, err := node.Block(context.Background(), &resTx.Height)
|
||||
if err != nil {
|
||||
|
||||
@ -84,8 +84,6 @@ func TestGenesisAccountValidate(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
require.Equal(t, tt.expErr, tt.acc.Validate() != nil)
|
||||
})
|
||||
@ -151,7 +149,6 @@ func TestValidate(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
err := tt.acc.Validate()
|
||||
require.Equal(t, tt.expErr, err)
|
||||
|
||||
@ -37,7 +37,6 @@ func TestParams_Validate(t *testing.T) {
|
||||
types.DefaultSigVerifyCostED25519, types.DefaultSigVerifyCostSecp256k1), errors.New("invalid tx size cost per byte: 0")},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got := tt.params.Validate()
|
||||
if tt.wantErr == nil {
|
||||
|
||||
@ -41,7 +41,6 @@ func TestValidatePermissions(t *testing.T) {
|
||||
}
|
||||
|
||||
for i, tc := range cases {
|
||||
i, tc := i, tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
err := validatePermissions(tc.permissions...)
|
||||
if tc.expectPass {
|
||||
|
||||
@ -917,8 +917,6 @@ func TestGenesisAccountValidate(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
require.Equal(t, tt.expErr, tt.acc.Validate() != nil)
|
||||
})
|
||||
|
||||
@ -35,7 +35,6 @@ func TestNewGrant(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range tcs {
|
||||
tc := tc
|
||||
t.Run(tc.title, func(t *testing.T) {
|
||||
_, err := NewGrant(tc.blockTime, tc.a, tc.expire)
|
||||
expecError(require.New(t), tc.err, err)
|
||||
@ -59,7 +58,6 @@ func TestValidateBasic(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range tcs {
|
||||
tc := tc
|
||||
t.Run(tc.title, func(t *testing.T) {
|
||||
grant := Grant{
|
||||
Authorization: tc.authorization,
|
||||
|
||||
@ -192,7 +192,6 @@ func (suite *TestSuite) TestGRPCQueryGranterGrants() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
suite.Run(fmt.Sprintf("Case %s", tc.msg), func() {
|
||||
tc.preRun()
|
||||
result, err := queryClient.GranterGrants(gocontext.Background(), &tc.request)
|
||||
@ -275,8 +274,6 @@ func (suite *TestSuite) TestGRPCQueryGranteeGrants() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
suite.Run(fmt.Sprintf("Case %s", tc.msg), func() {
|
||||
tc.preRun()
|
||||
result, err := queryClient.GranteeGrants(gocontext.Background(), &tc.request)
|
||||
|
||||
@ -48,7 +48,6 @@ func TestDecodeStore(t *testing.T) {
|
||||
}
|
||||
|
||||
for i, tt := range tests {
|
||||
i, tt := i, tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if tt.expectErr {
|
||||
require.Panics(t, func() { dec(kvPairs.Pairs[i], kvPairs.Pairs[i]) }, tt.name)
|
||||
|
||||
@ -148,7 +148,6 @@ func (s *CLITestSuite) TestMultiSendTxCmd() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
ctx := svrcmd.CreateExecuteContext(context.Background())
|
||||
|
||||
|
||||
@ -109,7 +109,6 @@ func (suite *KeeperTestSuite) TestTotalSupply() {
|
||||
}
|
||||
|
||||
for _, tc := range testcases {
|
||||
tc := tc
|
||||
suite.Run(tc.name, func() {
|
||||
if tc.expErrMsg != "" {
|
||||
suite.Require().ErrorContains(suite.bankKeeper.InitGenesis(suite.ctx, tc.genesis), tc.expErrMsg)
|
||||
|
||||
@ -83,8 +83,6 @@ func (suite *KeeperTestSuite) TestQueryBalance() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
suite.Run(tc.name, func() {
|
||||
res, err := queryClient.Balance(gocontext.Background(), tc.req)
|
||||
if tc.expectErrMsg == "" {
|
||||
|
||||
@ -52,7 +52,6 @@ func (suite *KeeperTestSuite) TestMsgUpdateParams() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
suite.Run(tc.name, func() {
|
||||
_, err := suite.msgServer.UpdateParams(suite.ctx, tc.input)
|
||||
|
||||
@ -145,7 +144,6 @@ func (suite *KeeperTestSuite) TestMsgSend() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
suite.Run(tc.name, func() {
|
||||
suite.mockMintCoins(minterAcc)
|
||||
err := suite.bankKeeper.MintCoins(suite.ctx, minterAcc.Name, origCoins)
|
||||
@ -252,7 +250,6 @@ func (suite *KeeperTestSuite) TestMsgMultiSend() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
suite.Run(tc.name, func() {
|
||||
suite.mockMintCoins(minterAcc)
|
||||
err := suite.bankKeeper.MintCoins(suite.ctx, minterAcc.Name, origCoins)
|
||||
@ -422,7 +419,6 @@ func (suite *KeeperTestSuite) TestMsgBurn() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
suite.Run(tc.name, func() {
|
||||
suite.mockMintCoins(multiPermAcc)
|
||||
err := suite.bankKeeper.MintCoins(suite.ctx, multiPermAcc.Name, sdk.Coins{}.Add(origCoins))
|
||||
|
||||
@ -83,8 +83,6 @@ func TestRandomizedGenState1(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
|
||||
require.Panicsf(t, func() { simulation.RandomizedGenState(&tt.simState) }, tt.panicMsg)
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,7 +105,6 @@ func TestBalanceValidate(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
err := tc.balance.Validate()
|
||||
|
||||
@ -129,7 +128,6 @@ func TestBalance_GetAddress(t *testing.T) {
|
||||
{"valid address", "cosmos1vy0ga0klndqy92ceqehfkvgmn4t94eteq4hmqv", false},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
b := bank.Balance{Address: tt.Address}
|
||||
if !tt.err {
|
||||
|
||||
@ -146,7 +146,6 @@ func TestGenesisStateValidate(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(tt *testing.T) {
|
||||
err := tc.genesisState.Validate()
|
||||
|
||||
|
||||
@ -217,7 +217,6 @@ func TestMetadataValidate(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
err := tc.metadata.Validate()
|
||||
|
||||
@ -259,7 +258,6 @@ func TestMarshalJSONMetaData(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
bz, err := cdc.MarshalJSON(tc.input)
|
||||
require.NoError(t, err)
|
||||
|
||||
@ -35,7 +35,6 @@ func TestQueryDelegationRewardsAddrValidation(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
_, _, err := QueryDelegationRewards(clientCtx, tt.args.delAddr, tt.args.valAddr)
|
||||
require.True(t, err != nil, tt.wantErr)
|
||||
|
||||
@ -38,7 +38,6 @@ func TestQueryParams(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
out, err := queryServer.Params(ctx, tc.req)
|
||||
if tc.errMsg == "" {
|
||||
@ -94,7 +93,6 @@ func TestQueryValidatorDistributionInfo(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
out, err := queryServer.ValidatorDistributionInfo(ctx, tc.req)
|
||||
if tc.errMsg == "" {
|
||||
@ -173,7 +171,6 @@ func TestQueryCommunityPool(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
out, err := queryServer.CommunityPool(ctx, tc.req)
|
||||
if tc.errMsg == "" {
|
||||
|
||||
@ -56,7 +56,6 @@ func TestMsgSetWithdrawAddress(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
_, err := msgServer.SetWithdrawAddress(ctx, tc.msg)
|
||||
if tc.errMsg == "" {
|
||||
@ -112,7 +111,6 @@ func TestMsgWithdrawDelegatorReward(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
if tc.preRun != nil {
|
||||
tc.preRun()
|
||||
@ -158,7 +156,6 @@ func TestMsgWithdrawValidatorCommission(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
if tc.preRun != nil {
|
||||
tc.preRun()
|
||||
@ -206,7 +203,6 @@ func TestMsgFundCommunityPool(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
_, err := msgServer.FundCommunityPool(ctx, tc.msg) //nolint:staticcheck // Testing deprecated method
|
||||
if tc.errMsg == "" {
|
||||
@ -267,7 +263,6 @@ func TestMsgUpdateParams(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
_, err := msgServer.UpdateParams(ctx, tc.msg)
|
||||
if tc.errMsg == "" {
|
||||
@ -340,7 +335,6 @@ func TestMsgCommunityPoolSpend(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
_, err := msgServer.CommunityPoolSpend(ctx, tc.msg) //nolint:staticcheck // Testing deprecated method
|
||||
if tc.errMsg == "" {
|
||||
@ -373,7 +367,6 @@ func TestMsgDepositValidatorRewardsPool(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
_, err := msgServer.DepositValidatorRewardsPool(ctx, tc.msg)
|
||||
if tc.errMsg == "" {
|
||||
|
||||
@ -51,7 +51,6 @@ func TestDecodeDistributionStore(t *testing.T) {
|
||||
{"other", ""},
|
||||
}
|
||||
for i, tt := range tests {
|
||||
i, tt := i, tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
switch i {
|
||||
case len(tests) - 1:
|
||||
|
||||
@ -77,8 +77,6 @@ func TestRandomizedGenState1(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
|
||||
require.Panicsf(t, func() { simulation.RandomizedGenState(&tt.simState) }, tt.panicMsg)
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,7 +24,6 @@ func Test_validateAuxFuncs(t *testing.T) {
|
||||
{"two dec", args{math.LegacyNewDec(2)}, true},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
require.Equal(t, tt.wantErr, validateCommunityTax(tt.args.i) != nil)
|
||||
})
|
||||
|
||||
@ -70,7 +70,6 @@ func (s *KeeperTestSuite) TestSubmitEvidence() {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
s.Run(tc.name, func() {
|
||||
_, err := s.msgServer.SubmitEvidence(s.ctx, tc.req)
|
||||
if tc.expErr {
|
||||
|
||||
@ -70,7 +70,6 @@ func TestEquivocationValidateBasic(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
require.Equal(t, tc.expectErr, tc.e.ValidateBasic() != nil)
|
||||
})
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user