Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
freeelancer committed Jan 3, 2025
1 parent 75a00b2 commit bbf0b9e
Show file tree
Hide file tree
Showing 13 changed files with 175 additions and 184 deletions.
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ linters:
- errname
- copyloopvar
- fatcontext
- forcetypeassert
- gci
- goconst
- gochecksumtype
Expand Down
14 changes: 5 additions & 9 deletions tests/e2e/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@ import (
"fmt"
"os"

tmrand "github.com/cometbft/cometbft/libs/rand"

dbm "github.com/cosmos/cosmos-db"
ratelimittypes "github.com/cosmos/ibc-apps/modules/rate-limiting/v8/types"

"cosmossdk.io/log"
evidencetypes "cosmossdk.io/x/evidence/types"
upgradetypes "cosmossdk.io/x/upgrade/types"

wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
"github.com/MANTRA-Chain/mantrachain/app"
"github.com/MANTRA-Chain/mantrachain/app/params"
tmrand "github.com/cometbft/cometbft/libs/rand"
dbm "github.com/cosmos/cosmos-db"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
Expand All @@ -26,9 +24,7 @@ import (
govv1beta1types "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
paramsproptypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

"github.com/MANTRA-Chain/mantrachain/app"
"github.com/MANTRA-Chain/mantrachain/app/params"
ratelimittypes "github.com/cosmos/ibc-apps/modules/rate-limiting/v8/types"
)

const (
Expand Down
1 change: 0 additions & 1 deletion tests/e2e/e2e_distribution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"time"

"cosmossdk.io/math"

sdk "github.com/cosmos/cosmos-sdk/types"
)

Expand Down
150 changes: 77 additions & 73 deletions tests/e2e/e2e_exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ import (
"strings"
"time"

"github.com/ory/dockertest/v3/docker"

"cosmossdk.io/x/feegrant"

"github.com/cosmos/cosmos-sdk/client/flags"
sdk "github.com/cosmos/cosmos-sdk/types"
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
Expand All @@ -23,6 +20,7 @@ import (
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/ory/dockertest/v3/docker"
)

const (
Expand Down Expand Up @@ -132,8 +130,7 @@ func (s *IntegrationTestSuite) execDecode(
return decoded
}

func (s *IntegrationTestSuite) execVestingTx( //nolint:unused

func (s *IntegrationTestSuite) execVestingTx(
c *chain,
method string,
args []string,
Expand Down Expand Up @@ -161,8 +158,7 @@ func (s *IntegrationTestSuite) execVestingTx( //nolint:unused
s.T().Logf("successfully %s with %v", method, args)
}

func (s *IntegrationTestSuite) execCreatePeriodicVestingAccount( //nolint:unused

func (s *IntegrationTestSuite) execCreatePeriodicVestingAccount(
c *chain,
address,
jsonPath string,
Expand Down Expand Up @@ -198,6 +194,7 @@ func (s *IntegrationTestSuite) execUnjail(
s.T().Logf("successfully unjail with options %v", opt)
}

//nolint:unused
func (s *IntegrationTestSuite) execFeeGrant(c *chain, valIdx int, granter, grantee, spendLimit string, opt ...flagOption) {
opt = append(opt, withKeyValue(flagFrom, granter))
opt = append(opt, withKeyValue(flagSpendLimit, spendLimit))
Expand Down Expand Up @@ -229,31 +226,32 @@ func (s *IntegrationTestSuite) execFeeGrant(c *chain, valIdx int, granter, grant
s.executeTxCommand(ctx, c, mantraCommand, valIdx, s.defaultExecValidation(c, valIdx))
}

func (s *IntegrationTestSuite) execFeeGrantRevoke(c *chain, valIdx int, granter, grantee string, opt ...flagOption) {
opt = append(opt, withKeyValue(flagFrom, granter))
opts := applyOptions(c.id, opt)
// func (s *IntegrationTestSuite) execFeeGrantRevoke(c *chain, valIdx int, granter, grantee string, opt ...flagOption) {
// opt = append(opt, withKeyValue(flagFrom, granter))
// opts := applyOptions(c.id, opt)

ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
// ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
// defer cancel()

s.T().Logf("revoking %s fee grant from %s on chain %s", grantee, granter, c.id)
// s.T().Logf("revoking %s fee grant from %s on chain %s", grantee, granter, c.id)

mantraCommand := []string{
mantrachaindBinary,
txCommand,
feegrant.ModuleName,
"revoke",
granter,
grantee,
"-y",
}
for flag, value := range opts {
mantraCommand = append(mantraCommand, fmt.Sprintf("--%s=%v", flag, value))
}
// mantraCommand := []string{
// mantrachaindBinary,
// txCommand,
// feegrant.ModuleName,
// "revoke",
// granter,
// grantee,
// "-y",
// }
// for flag, value := range opts {
// mantraCommand = append(mantraCommand, fmt.Sprintf("--%s=%v", flag, value))
// }

s.executeTxCommand(ctx, c, mantraCommand, valIdx, s.defaultExecValidation(c, valIdx))
}
// s.executeTxCommand(ctx, c, mantraCommand, valIdx, s.defaultExecValidation(c, valIdx))
// }

//nolint:unparam
func (s *IntegrationTestSuite) execBankSend(
c *chain,
valIdx int,
Expand Down Expand Up @@ -430,7 +428,6 @@ func (s *IntegrationTestSuite) runGovExec(c *chain, valIdx int, submitterAddr, g
// }

func (s *IntegrationTestSuite) execDelegate(c *chain, valIdx int, amount, valOperAddress, delegatorAddr, home, delegateFees string) { //nolint:unparam

ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()

Expand Down Expand Up @@ -767,6 +764,7 @@ func (s *IntegrationTestSuite) defaultExecValidation(chain *chain, valIdx int) f
}
}

//nolint:unused
func (s *IntegrationTestSuite) expectTxSubmitError(expectErrString string) func([]byte, []byte) bool {
return func(stdOut []byte, stdErr []byte) bool {
var txResp sdk.TxResponse
Expand All @@ -780,59 +778,60 @@ func (s *IntegrationTestSuite) expectTxSubmitError(expectErrString string) func(
}
}

func (s *IntegrationTestSuite) executeValidatorBond(c *chain, valIdx int, valOperAddress, delegatorAddr, home, delegateFees string) {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
// func (s *IntegrationTestSuite) executeValidatorBond(c *chain, valIdx int, valOperAddress, delegatorAddr, home, delegateFees string) {
// ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
// defer cancel()

s.T().Logf("Executing mantrachaind tx staking validator-bond %s", c.id)
// s.T().Logf("Executing mantrachaind tx staking validator-bond %s", c.id)

mantraCommand := []string{
mantrachaindBinary,
txCommand,
stakingtypes.ModuleName,
"validator-bond",
valOperAddress,
fmt.Sprintf("--%s=%s", flags.FlagFrom, delegatorAddr),
fmt.Sprintf("--%s=%s", flags.FlagChainID, c.id),
fmt.Sprintf("--%s=%s", flags.FlagGasPrices, delegateFees),
"--keyring-backend=test",
fmt.Sprintf("--%s=%s", flags.FlagHome, home),
"--output=json",
"-y",
}
// mantraCommand := []string{
// mantrachaindBinary,
// txCommand,
// stakingtypes.ModuleName,
// "validator-bond",
// valOperAddress,
// fmt.Sprintf("--%s=%s", flags.FlagFrom, delegatorAddr),
// fmt.Sprintf("--%s=%s", flags.FlagChainID, c.id),
// fmt.Sprintf("--%s=%s", flags.FlagGasPrices, delegateFees),
// "--keyring-backend=test",
// fmt.Sprintf("--%s=%s", flags.FlagHome, home),
// "--output=json",
// "-y",
// }

s.executeTxCommand(ctx, c, mantraCommand, valIdx, s.defaultExecValidation(c, valIdx))
s.T().Logf("%s successfully executed validator bond tx to %s", delegatorAddr, valOperAddress)
}
// s.executeTxCommand(ctx, c, mantraCommand, valIdx, s.defaultExecValidation(c, valIdx))
// s.T().Logf("%s successfully executed validator bond tx to %s", delegatorAddr, valOperAddress)
// }

func (s *IntegrationTestSuite) executeTokenizeShares(c *chain, valIdx int, amount, valOperAddress, delegatorAddr, home, delegateFees string) {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
// func (s *IntegrationTestSuite) executeTokenizeShares(c *chain, valIdx int, amount, valOperAddress, delegatorAddr, home, delegateFees string) {
// ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
// defer cancel()

s.T().Logf("Executing mantrachaind tx staking tokenize-share %s", c.id)
// s.T().Logf("Executing mantrachaind tx staking tokenize-share %s", c.id)

mantraCommand := []string{
mantrachaindBinary,
txCommand,
stakingtypes.ModuleName,
"tokenize-share",
valOperAddress,
amount,
delegatorAddr,
fmt.Sprintf("--%s=%s", flags.FlagFrom, delegatorAddr),
fmt.Sprintf("--%s=%s", flags.FlagChainID, c.id),
fmt.Sprintf("--%s=%s", flags.FlagGasPrices, delegateFees),
fmt.Sprintf("--%s=%d", flags.FlagGas, 1000000),
"--keyring-backend=test",
fmt.Sprintf("--%s=%s", flags.FlagHome, home),
"--output=json",
"-y",
}
// mantraCommand := []string{
// mantrachaindBinary,
// txCommand,
// stakingtypes.ModuleName,
// "tokenize-share",
// valOperAddress,
// amount,
// delegatorAddr,
// fmt.Sprintf("--%s=%s", flags.FlagFrom, delegatorAddr),
// fmt.Sprintf("--%s=%s", flags.FlagChainID, c.id),
// fmt.Sprintf("--%s=%s", flags.FlagGasPrices, delegateFees),
// fmt.Sprintf("--%s=%d", flags.FlagGas, 1000000),
// "--keyring-backend=test",
// fmt.Sprintf("--%s=%s", flags.FlagHome, home),
// "--output=json",
// "-y",
// }

s.executeTxCommand(ctx, c, mantraCommand, valIdx, s.defaultExecValidation(c, valIdx))
s.T().Logf("%s successfully executed tokenize share tx from %s", delegatorAddr, valOperAddress)
}
// s.executeTxCommand(ctx, c, mantraCommand, valIdx, s.defaultExecValidation(c, valIdx))
// s.T().Logf("%s successfully executed tokenize share tx from %s", delegatorAddr, valOperAddress)
// }

//nolint:unused
func (s *IntegrationTestSuite) executeRedeemShares(c *chain, valIdx int, amount, delegatorAddr, home, delegateFees string) {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
Expand All @@ -859,6 +858,7 @@ func (s *IntegrationTestSuite) executeRedeemShares(c *chain, valIdx int, amount,
s.T().Logf("%s successfully executed redeem share tx for %s", delegatorAddr, amount)
}

//nolint:unused
func (s *IntegrationTestSuite) executeTransferTokenizeShareRecord(c *chain, valIdx int, recordID, owner, newOwner, home, txFees string) {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
Expand Down Expand Up @@ -888,6 +888,8 @@ func (s *IntegrationTestSuite) executeTransferTokenizeShareRecord(c *chain, valI
// signTxFileOnline signs a transaction file using the mantracli tx sign command
// the from flag is used to specify the keyring account to sign the transaction
// the from account must be registered in the keyring and exist on chain (have a balance or be a genesis account)
//
//nolint:unused
func (s *IntegrationTestSuite) signTxFileOnline(chain *chain, valIdx int, from string, txFilePath string) ([]byte, error) {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
Expand Down Expand Up @@ -923,6 +925,8 @@ func (s *IntegrationTestSuite) signTxFileOnline(chain *chain, valIdx int, from s
// broadcastTxFile broadcasts a signed transaction file using the mantracli tx broadcast command
// the from flag is used to specify the keyring account to sign the transaction
// the from account must be registered in the keyring and exist on chain (have a balance or be a genesis account)
//
//nolint:unused
func (s *IntegrationTestSuite) broadcastTxFile(chain *chain, valIdx int, from string, txFilePath string) ([]byte, error) {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/e2e_gov_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

"cosmossdk.io/math"
upgradetypes "cosmossdk.io/x/upgrade/types"

sdk "github.com/cosmos/cosmos-sdk/types"
govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
govtypesv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
Expand Down Expand Up @@ -98,7 +97,7 @@ func (s *IntegrationTestSuite) GovCancelSoftwareUpgrade() {
GovCommunityPoolSpend tests passing a community spend proposal.
Test Benchmarks:
1. Fund Community Pool
2. Submission, deposit and vote of proposal to spend from the community pool to send oms to a recipient
2. Submission, deposit and vote of proposal to spend from the community pool to send atoms to a recipient
3. Validation that the recipient balance has increased by proposal amount
*/
func (s *IntegrationTestSuite) GovCommunityPoolSpend() {
Expand Down Expand Up @@ -204,6 +203,7 @@ func (s *IntegrationTestSuite) submitGovCommand(chainAAPIEndpoint, sender string
})
}

//nolint:unused
func (s *IntegrationTestSuite) submitGovCommandExpectingFailure(sender string, govCommand string, proposalFlags []string) {
s.Run(fmt.Sprintf("Running failing expedited tx gov %s -- expecting error", govCommand), func() {
// should return an error -- the Tx fails at the ante handler
Expand Down
7 changes: 4 additions & 3 deletions tests/e2e/e2e_ibc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ type PacketMetadata struct {
Forward *ForwardMetadata `json:"forward"`
}

//nolint:unparam
func (s *IntegrationTestSuite) sendIBC(c *chain, valIdx int, sender, recipient, token, fees, note string, expErr bool) {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
Expand Down Expand Up @@ -60,7 +59,7 @@ func (s *IntegrationTestSuite) sendIBC(c *chain, valIdx int, sender, recipient,
}
}

func (s *IntegrationTestSuite) hermesClearPacket(configPath, chainID, portID, channelID string) (success bool) { //nolint:unparam
func (s *IntegrationTestSuite) hermesClearPacket(configPath, chainID, portID, channelID string) (success bool) {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()

Expand Down Expand Up @@ -95,6 +94,7 @@ type RelayerPacketsOutput struct {
Status string `json:"status"`
}

//nolint:unused
func (s *IntegrationTestSuite) createConnection() {
s.T().Logf("connecting %s and %s chains via IBC", s.chainA.id, s.chainB.id)

Expand All @@ -118,6 +118,7 @@ func (s *IntegrationTestSuite) createConnection() {
s.T().Logf("connected %s and %s chains via IBC", s.chainA.id, s.chainB.id)
}

//nolint:unused
func (s *IntegrationTestSuite) createChannel() {
s.T().Logf("creating IBC transfer channel created between chains %s and %s", s.chainA.id, s.chainB.id)

Expand Down Expand Up @@ -320,7 +321,7 @@ func (s *IntegrationTestSuite) testFailedMultihopIBCTokenTransfer() {

var (
beforeSenderUOmBalance sdk.Coin
err error
err error
)

s.Require().Eventually(
Expand Down
Loading

0 comments on commit bbf0b9e

Please sign in to comment.