diff --git a/.golangci.yml b/.golangci.yml index 700e0d41ce2..b7bc83240ac 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,5 +1,5 @@ run: - tests: false + tests: true # timeout for analysis, e.g. 30s, 5m, default is 1m timeout: 5m @@ -8,6 +8,7 @@ linters: enable: - depguard - dogsled + - errcheck - exportloopref - goconst - gocritic diff --git a/app/upgrades/v8/upgrades_test.go b/app/upgrades/v8/upgrades_test.go index 3b37c718a05..460c4909527 100644 --- a/app/upgrades/v8/upgrades_test.go +++ b/app/upgrades/v8/upgrades_test.go @@ -61,5 +61,4 @@ func TestFixBankMetadata(t *testing.T) { malformedDenom := "uatomu" _, foundMalformed := app.AppKeepers.BankKeeper.GetDenomMetaData(ctx, malformedDenom) require.False(t, foundMalformed) - } diff --git a/tests/e2e/chain.go b/tests/e2e/chain.go index bc603cb672b..3702da3e396 100644 --- a/tests/e2e/chain.go +++ b/tests/e2e/chain.go @@ -23,8 +23,8 @@ const ( var ( encodingConfig params.EncodingConfig - cdc codec.Codec //nolint:unused // this is called during e2e tests - txConfig client.TxConfig //nolint:unused // this is called during e2e tests + cdc codec.Codec + txConfig client.TxConfig ) func init() { @@ -36,17 +36,17 @@ func init() { txConfig = encodingConfig.TxConfig } -type chain struct { //nolint:unused // this is called during e2e tests +type chain struct { dataDir string id string validators []*validator - accounts []*account + accounts []*account //nolint:unused // initial accounts in genesis genesisAccounts []*account genesisVestingAccounts map[string]sdk.AccAddress } -func newChain() (*chain, error) { //nolint:unused // this is called during e2e tests +func newChain() (*chain, error) { tmpDir, err := os.MkdirTemp("", "gaia-e2e-testnet-") if err != nil { return nil, err @@ -58,11 +58,11 @@ func newChain() (*chain, error) { //nolint:unused // this is called during e2e t }, nil } -func (c *chain) configDir() string { //nolint:unused // this is called during e2e tests +func (c *chain) configDir() string { return fmt.Sprintf("%s/%s", c.dataDir, c.id) } -func (c *chain) createAndInitValidators(count int) error { //nolint:unused // this is called during e2e tests +func (c *chain) createAndInitValidators(count int) error { for i := 0; i < count; i++ { node := c.createValidator(i) @@ -115,7 +115,7 @@ func (c *chain) createAndInitValidatorsWithMnemonics(count int, mnemonics []stri return nil } -func (c *chain) createValidator(index int) *validator { //nolint:unused // this is called during e2e tests +func (c *chain) createValidator(index int) *validator { return &validator{ chain: c, index: index, diff --git a/tests/e2e/e2e_distribution_test.go b/tests/e2e/e2e_distribution_test.go index 99d98e27cf1..7f7f41da8df 100644 --- a/tests/e2e/e2e_distribution_test.go +++ b/tests/e2e/e2e_distribution_test.go @@ -8,7 +8,6 @@ import ( ) func (s *IntegrationTestSuite) testDistribution() { - chainEndpoint := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp")) validatorB := s.chainA.validators[1] diff --git a/tests/e2e/e2e_exec_test.go b/tests/e2e/e2e_exec_test.go index fb2fd5cf473..3ba4e07b9b3 100644 --- a/tests/e2e/e2e_exec_test.go +++ b/tests/e2e/e2e_exec_test.go @@ -1,3 +1,4 @@ +//nolint:unused package e2e import ( @@ -290,7 +291,7 @@ type txBankSend struct { func (s *IntegrationTestSuite) execBankSendBatch( c *chain, - valIdx int, + valIdx int, //nolint:unparam txs ...txBankSend, ) int { sucessBankSendCount := 0 @@ -309,7 +310,7 @@ func (s *IntegrationTestSuite) execBankSendBatch( return sucessBankSendCount } -func (s *IntegrationTestSuite) execWithdrawAllRewards(c *chain, valIdx int, payee, fees string, expectErr bool) { +func (s *IntegrationTestSuite) execWithdrawAllRewards(c *chain, valIdx int, payee, fees string, expectErr bool) { //nolint:unparam ctx, cancel := context.WithTimeout(context.Background(), time.Minute) defer cancel() @@ -423,7 +424,7 @@ func (s *IntegrationTestSuite) executeKeysList(c *chain, valIdx int, home string }) } -func (s *IntegrationTestSuite) executeDelegate(c *chain, valIdx int, amount, valOperAddress, delegatorAddr, home, delegateFees string) { +func (s *IntegrationTestSuite) executeDelegate(c *chain, valIdx int, amount, valOperAddress, delegatorAddr, home, delegateFees string) { //nolint:unparam ctx, cancel := context.WithTimeout(context.Background(), time.Minute) defer cancel() diff --git a/tests/e2e/e2e_globalfee_proposal_test.go b/tests/e2e/e2e_globalfee_proposal_test.go index b4d9e49cd65..de780b4af68 100644 --- a/tests/e2e/e2e_globalfee_proposal_test.go +++ b/tests/e2e/e2e_globalfee_proposal_test.go @@ -10,7 +10,7 @@ import ( paramtypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal" ) -func (s *IntegrationTestSuite) govProposeNewGlobalfee(newGlobalfee sdk.DecCoins, proposalCounter int, submitter string, fees string) { +func (s *IntegrationTestSuite) govProposeNewGlobalfee(newGlobalfee sdk.DecCoins, proposalCounter int, submitter string, fees string) { //nolint:unparam s.writeGovParamChangeProposalGlobalFees(s.chainA, newGlobalfee) chainAAPIEndpoint := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp")) submitGovFlags := []string{"param-change", configFile(proposalGlobalFeeFilename)} diff --git a/tests/e2e/e2e_gov_test.go b/tests/e2e/e2e_gov_test.go index 1daa573887a..7e9aca7fb16 100644 --- a/tests/e2e/e2e_gov_test.go +++ b/tests/e2e/e2e_gov_test.go @@ -2,10 +2,11 @@ package e2e import ( "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" "strconv" "time" + sdk "github.com/cosmos/cosmos-sdk/types" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" @@ -123,13 +124,13 @@ func (s *IntegrationTestSuite) GovCommunityPoolSpend() { ) } -func (s *IntegrationTestSuite) runGovProcess(chainAAPIEndpoint, sender string, proposalId int, proposalType string, submitFlags []string, depositFlags []string, voteFlags []string, voteCommand string) { +func (s *IntegrationTestSuite) runGovProcess(chainAAPIEndpoint, sender string, proposalID int, proposalType string, submitFlags []string, depositFlags []string, voteFlags []string, voteCommand string) { s.T().Logf("Submitting Gov Proposal: %s", proposalType) - s.submitGovCommand(chainAAPIEndpoint, sender, proposalId, "submit-proposal", submitFlags, govtypes.StatusDepositPeriod) + s.submitGovCommand(chainAAPIEndpoint, sender, proposalID, "submit-proposal", submitFlags, govtypes.StatusDepositPeriod) s.T().Logf("Depositing Gov Proposal: %s", proposalType) - s.submitGovCommand(chainAAPIEndpoint, sender, proposalId, "deposit", depositFlags, govtypes.StatusVotingPeriod) + s.submitGovCommand(chainAAPIEndpoint, sender, proposalID, "deposit", depositFlags, govtypes.StatusVotingPeriod) s.T().Logf("Voting Gov Proposal: %s", proposalType) - s.submitGovCommand(chainAAPIEndpoint, sender, proposalId, voteCommand, voteFlags, govtypes.StatusPassed) + s.submitGovCommand(chainAAPIEndpoint, sender, proposalID, voteCommand, voteFlags, govtypes.StatusPassed) } func (s *IntegrationTestSuite) verifyChainHaltedAtUpgradeHeight(c *chain, valIdx, upgradeHeight int) { @@ -173,13 +174,13 @@ func (s *IntegrationTestSuite) verifyChainPassesUpgradeHeight(c *chain, valIdx, ) } -func (s *IntegrationTestSuite) submitGovCommand(chainAAPIEndpoint, sender string, proposalId int, govCommand string, proposalFlags []string, expectedSuccessStatus govtypes.ProposalStatus) { +func (s *IntegrationTestSuite) submitGovCommand(chainAAPIEndpoint, sender string, proposalID int, govCommand string, proposalFlags []string, expectedSuccessStatus govtypes.ProposalStatus) { s.Run(fmt.Sprintf("Running tx gov %s", govCommand), func() { s.runGovExec(s.chainA, 0, sender, govCommand, proposalFlags, standardFees.String()) s.Require().Eventually( func() bool { - proposal, err := queryGovProposal(chainAAPIEndpoint, proposalId) + proposal, err := queryGovProposal(chainAAPIEndpoint, proposalID) s.Require().NoError(err) return proposal.GetProposal().Status == expectedSuccessStatus diff --git a/tests/e2e/e2e_ibc_test.go b/tests/e2e/e2e_ibc_test.go index 060838980a5..4c9d3c7454a 100644 --- a/tests/e2e/e2e_ibc_test.go +++ b/tests/e2e/e2e_ibc_test.go @@ -91,7 +91,7 @@ func (s *IntegrationTestSuite) runIBCRelayer() { endpoint := fmt.Sprintf("http://%s/state", s.hermesResource.GetHostPort("3031/tcp")) s.Require().Eventually( func() bool { - resp, err := http.Get(endpoint) + resp, err := http.Get(endpoint) //nolint:gosec // this is a test if err != nil { return false } diff --git a/tests/e2e/e2e_setup_test.go b/tests/e2e/e2e_setup_test.go index bd409451864..11f2d230d9d 100644 --- a/tests/e2e/e2e_setup_test.go +++ b/tests/e2e/e2e_setup_test.go @@ -542,7 +542,7 @@ func (s *IntegrationTestSuite) runValidators(c *chain, portOffset int) { Repository: "cosmos/gaiad-e2e", } - s.Require().NoError(exec.Command("chmod", "-R", "0777", val.configDir()).Run()) + s.Require().NoError(exec.Command("chmod", "-R", "0777", val.configDir()).Run()) //nolint:gosec // this is a test // expose the first validator for debugging and communication if val.index == 0 { diff --git a/tests/e2e/e2e_vesting_test.go b/tests/e2e/e2e_vesting_test.go index e23cb4f77ac..43ce9e7c4a3 100644 --- a/tests/e2e/e2e_vesting_test.go +++ b/tests/e2e/e2e_vesting_test.go @@ -196,7 +196,7 @@ func (s *IntegrationTestSuite) testContinuousVestingAccount(api string) { }) } -func (s *IntegrationTestSuite) testPeriodicVestingAccount(api string) { +func (s *IntegrationTestSuite) testPeriodicVestingAccount(api string) { //nolint:unused s.Run("test periodic vesting genesis account", func() { var ( valIdx = 0 diff --git a/tests/e2e/genesis.go b/tests/e2e/genesis.go index 104dbca7fd4..e2c07fe8efc 100644 --- a/tests/e2e/genesis.go +++ b/tests/e2e/genesis.go @@ -19,7 +19,7 @@ import ( tmtypes "github.com/tendermint/tendermint/types" ) -func getGenDoc(path string) (*tmtypes.GenesisDoc, error) { //nolint:unused // this is called during e2e tests +func getGenDoc(path string) (*tmtypes.GenesisDoc, error) { serverCtx := server.NewDefaultContext() config := serverCtx.Config config.SetRoot(path) @@ -43,7 +43,7 @@ func getGenDoc(path string) (*tmtypes.GenesisDoc, error) { //nolint:unused // th return doc, nil } -func modifyGenesis(path, moniker, amountStr string, addrAll []sdk.AccAddress, globfees string, denom string) error { //nolint:unused // this is called during e2e tests +func modifyGenesis(path, moniker, amountStr string, addrAll []sdk.AccAddress, globfees string, denom string) error { serverCtx := server.NewDefaultContext() config := serverCtx.Config config.SetRoot(path) diff --git a/tests/e2e/http_util.go b/tests/e2e/http_util.go index acf6021ab33..cbd2b2a10cc 100644 --- a/tests/e2e/http_util.go +++ b/tests/e2e/http_util.go @@ -6,7 +6,7 @@ import ( "net/http" ) -func httpGet(endpoint string) ([]byte, error) { //nolint:unused // this is called during e2e tests +func httpGet(endpoint string) ([]byte, error) { resp, err := http.Get(endpoint) //nolint:gosec // this is only used during tests if err != nil { return nil, fmt.Errorf("failed to execute HTTP request: %w", err) diff --git a/tests/e2e/io.go b/tests/e2e/io.go index e3bcd9d63f0..40b316bec48 100644 --- a/tests/e2e/io.go +++ b/tests/e2e/io.go @@ -7,7 +7,7 @@ import ( ) // copyFile copy file from src to dst -func copyFile(src, dst string) (int64, error) { //nolint:unused // this is called during e2e tests +func copyFile(src, dst string) (int64, error) { //nolint:unparam sourceFileStat, err := os.Stat(src) if err != nil { return 0, err @@ -34,7 +34,7 @@ func copyFile(src, dst string) (int64, error) { //nolint:unused // this is calle } // writeFile write a byte slice into a file path -func writeFile(path string, body []byte) error { //nolint:unused // this is called during e2e tests +func writeFile(path string, body []byte) error { _, err := os.Create(path) if err != nil { return err diff --git a/tests/e2e/keys.go b/tests/e2e/keys.go index 9f4e058a5c7..d47a7ce59d0 100644 --- a/tests/e2e/keys.go +++ b/tests/e2e/keys.go @@ -5,7 +5,7 @@ import ( ) // createMnemonic creates a random string mnemonic -func createMnemonic() (string, error) { //nolint:unused // this is called during e2e tests +func createMnemonic() (string, error) { entropySeed, err := bip39.NewEntropy(256) if err != nil { return "", err diff --git a/tests/e2e/query.go b/tests/e2e/query.go index e392ca4a5eb..6717a9e1249 100644 --- a/tests/e2e/query.go +++ b/tests/e2e/query.go @@ -20,7 +20,7 @@ import ( globalfee "github.com/cosmos/gaia/v8/x/globalfee/types" ) -func queryGaiaTx(endpoint, txHash string) error { //nolint:unused // this is called during e2e tests +func queryGaiaTx(endpoint, txHash string) error { resp, err := http.Get(fmt.Sprintf("%s/cosmos/tx/v1beta1/txs/%s", endpoint, txHash)) if err != nil { return fmt.Errorf("failed to execute HTTP request: %w", err) @@ -46,7 +46,7 @@ func queryGaiaTx(endpoint, txHash string) error { //nolint:unused // this is cal } // if coin is zero, return empty coin. -func getSpecificBalance(endpoint, addr, denom string) (amt sdk.Coin, err error) { //nolint:unused // this is called during e2e tests +func getSpecificBalance(endpoint, addr, denom string) (amt sdk.Coin, err error) { balances, err := queryGaiaAllBalances(endpoint, addr) if err != nil { return amt, err @@ -60,7 +60,7 @@ func getSpecificBalance(endpoint, addr, denom string) (amt sdk.Coin, err error) return amt, nil } -func queryGaiaAllBalances(endpoint, addr string) (sdk.Coins, error) { //nolint:unused // this is called during e2e tests +func queryGaiaAllBalances(endpoint, addr string) (sdk.Coins, error) { body, err := httpGet(fmt.Sprintf("%s/cosmos/bank/v1beta1/balances/%s", endpoint, addr)) if err != nil { return nil, fmt.Errorf("failed to execute HTTP request: %w", err) @@ -74,7 +74,7 @@ func queryGaiaAllBalances(endpoint, addr string) (sdk.Coins, error) { //nolint:u return balancesResp.Balances, nil } -func queryGlobalFees(endpoint string) (amt sdk.DecCoins, err error) { //nolint:unused // this is called during e2e tests +func queryGlobalFees(endpoint string) (amt sdk.DecCoins, err error) { body, err := httpGet(fmt.Sprintf("%s/gaia/globalfee/v1beta1/minimum_gas_prices", endpoint)) if err != nil { return nil, fmt.Errorf("failed to execute HTTP request: %w", err) @@ -88,7 +88,7 @@ func queryGlobalFees(endpoint string) (amt sdk.DecCoins, err error) { //nolint:u return fees.MinimumGasPrices, nil } -func queryDelegation(endpoint string, validatorAddr string, delegatorAddr string) (stakingtypes.QueryDelegationResponse, error) { //nolint:unused // this is called during e2e tests +func queryDelegation(endpoint string, validatorAddr string, delegatorAddr string) (stakingtypes.QueryDelegationResponse, error) { var res stakingtypes.QueryDelegationResponse body, err := httpGet(fmt.Sprintf("%s/cosmos/staking/v1beta1/validators/%s/delegations/%s", endpoint, validatorAddr, delegatorAddr)) @@ -102,7 +102,7 @@ func queryDelegation(endpoint string, validatorAddr string, delegatorAddr string return res, nil } -func queryDelegatorWithdrawalAddress(endpoint string, delegatorAddr string) (disttypes.QueryDelegatorWithdrawAddressResponse, error) { //nolint:unused // this is called during e2e tests +func queryDelegatorWithdrawalAddress(endpoint string, delegatorAddr string) (disttypes.QueryDelegatorWithdrawAddressResponse, error) { var res disttypes.QueryDelegatorWithdrawAddressResponse body, err := httpGet(fmt.Sprintf("%s/cosmos/distribution/v1beta1/delegators/%s/withdraw_address", endpoint, delegatorAddr)) @@ -116,7 +116,7 @@ func queryDelegatorWithdrawalAddress(endpoint string, delegatorAddr string) (dis return res, nil } -func queryGovProposal(endpoint string, proposalID int) (govtypes.QueryProposalResponse, error) { //nolint:unused // this is called during e2e tests +func queryGovProposal(endpoint string, proposalID int) (govtypes.QueryProposalResponse, error) { var govProposalResp govtypes.QueryProposalResponse path := fmt.Sprintf("%s/cosmos/gov/v1beta1/proposals/%d", endpoint, proposalID) @@ -132,7 +132,7 @@ func queryGovProposal(endpoint string, proposalID int) (govtypes.QueryProposalRe return govProposalResp, nil } -func queryAccount(endpoint, address string) (acc authtypes.AccountI, err error) { //nolint:unused // this is called during e2e tests +func queryAccount(endpoint, address string) (acc authtypes.AccountI, err error) { var res authtypes.QueryAccountResponse resp, err := http.Get(fmt.Sprintf("%s/cosmos/auth/v1beta1/accounts/%s", endpoint, address)) if err != nil { @@ -150,7 +150,7 @@ func queryAccount(endpoint, address string) (acc authtypes.AccountI, err error) return acc, cdc.UnpackAny(res.Account, &acc) } -func queryDelayedVestingAccount(endpoint, address string) (authvesting.DelayedVestingAccount, error) { //nolint:unused // this is called during e2e tests +func queryDelayedVestingAccount(endpoint, address string) (authvesting.DelayedVestingAccount, error) { baseAcc, err := queryAccount(endpoint, address) if err != nil { return authvesting.DelayedVestingAccount{}, err @@ -163,7 +163,7 @@ func queryDelayedVestingAccount(endpoint, address string) (authvesting.DelayedVe return *acc, nil } -func queryContinuousVestingAccount(endpoint, address string) (authvesting.ContinuousVestingAccount, error) { //nolint:unused // this is called during e2e tests +func queryContinuousVestingAccount(endpoint, address string) (authvesting.ContinuousVestingAccount, error) { baseAcc, err := queryAccount(endpoint, address) if err != nil { return authvesting.ContinuousVestingAccount{}, err @@ -202,7 +202,7 @@ func queryPeriodicVestingAccount(endpoint, address string) (authvesting.Periodic return *acc, nil } -func queryValidator(endpoint, address string) (stakingtypes.Validator, error) { //nolint:unused // this is called during e2e tests +func queryValidator(endpoint, address string) (stakingtypes.Validator, error) { var res stakingtypes.QueryValidatorResponse body, err := httpGet(fmt.Sprintf("%s/cosmos/staking/v1beta1/validators/%s", endpoint, address)) @@ -216,7 +216,7 @@ func queryValidator(endpoint, address string) (stakingtypes.Validator, error) { return res.Validator, nil } -func queryValidators(endpoint string) (stakingtypes.Validators, error) { //nolint:unused // this is called during e2e tests +func queryValidators(endpoint string) (stakingtypes.Validators, error) { var res stakingtypes.QueryValidatorsResponse body, err := httpGet(fmt.Sprintf("%s/cosmos/staking/v1beta1/validators", endpoint)) if err != nil { @@ -242,7 +242,7 @@ func queryEvidence(endpoint, hash string) (evidencetypes.QueryEvidenceResponse, return res, nil } -func queryAllEvidence(endpoint string) (evidencetypes.QueryAllEvidenceResponse, error) { //nolint:unused // this is called during e2e tests +func queryAllEvidence(endpoint string) (evidencetypes.QueryAllEvidenceResponse, error) { var res evidencetypes.QueryAllEvidenceResponse body, err := httpGet(fmt.Sprintf("%s/cosmos/evidence/v1beta1/evidence", endpoint)) if err != nil { diff --git a/tests/e2e/util.go b/tests/e2e/util.go index d690e67a2c6..ae136313e3c 100644 --- a/tests/e2e/util.go +++ b/tests/e2e/util.go @@ -7,7 +7,6 @@ import ( sdktx "github.com/cosmos/cosmos-sdk/types/tx" ) -//nolint:unused // this is called during e2e tests func decodeTx(txBytes []byte) (*sdktx.Tx, error) { var raw sdktx.TxRaw @@ -45,7 +44,6 @@ func decodeTx(txBytes []byte) (*sdktx.Tx, error) { }, nil } -//nolint:unused // this is called during e2e tests func concatFlags(originalCollection []string, commandFlags []string, generalFlags []string) []string { originalCollection = append(originalCollection, commandFlags...) originalCollection = append(originalCollection, generalFlags...) diff --git a/tests/e2e/validator.go b/tests/e2e/validator.go index c635dedae89..9766f6bdb7c 100644 --- a/tests/e2e/validator.go +++ b/tests/e2e/validator.go @@ -39,30 +39,26 @@ type validator struct { nodeKey p2p.NodeKey } -type account struct { //nolint:unused // this is called during e2e tests - moniker string +type account struct { + moniker string //nolint:unused mnemonic string keyInfo keyring.Info privateKey cryptotypes.PrivKey } -//nolint:unused // this is called during e2e tests func (v *validator) instanceName() string { return fmt.Sprintf("%s%d", v.moniker, v.index) } -//nolint:unused // this is called during e2e tests func (v *validator) configDir() string { return fmt.Sprintf("%s/%s", v.chain.configDir(), v.instanceName()) } -//nolint:unused // this is called during e2e tests func (v *validator) createConfig() error { p := path.Join(v.configDir(), "config") return os.MkdirAll(p, 0o755) } -//nolint:unused // this is called during e2e tests func (v *validator) init() error { if err := v.createConfig(); err != nil { return err @@ -96,7 +92,7 @@ func (v *validator) init() error { return nil } -func (v *validator) createNodeKey() error { //nolint:unused // this is called during e2e tests +func (v *validator) createNodeKey() error { serverCtx := server.NewDefaultContext() config := serverCtx.Config @@ -112,7 +108,6 @@ func (v *validator) createNodeKey() error { //nolint:unused // this is called du return nil } -//nolint:unused // this is called during e2e tests func (v *validator) createConsensusKey() error { serverCtx := server.NewDefaultContext() config := serverCtx.Config @@ -136,7 +131,6 @@ func (v *validator) createConsensusKey() error { return nil } -//nolint:unused // this is called during e2e tests func (v *validator) createKeyFromMnemonic(name, mnemonic string) error { dir := v.configDir() kb, err := keyring.New(keyringAppName, keyring.BackendTest, dir, nil) @@ -172,7 +166,7 @@ func (v *validator) createKeyFromMnemonic(name, mnemonic string) error { return nil } -func (c *chain) addAccountFromMnemonic(counts int) error { //nolint:unused // this is called during e2e tests +func (c *chain) addAccountFromMnemonic(counts int) error { val0ConfigDir := c.validators[0].configDir() kb, err := keyring.New(keyringAppName, keyring.BackendTest, val0ConfigDir, nil) if err != nil { @@ -215,7 +209,7 @@ func (c *chain) addAccountFromMnemonic(counts int) error { //nolint:unused // th return nil } -func (v *validator) createKey(name string) error { //nolint:unused // this is called during e2e tests +func (v *validator) createKey(name string) error { mnemonic, err := createMnemonic() if err != nil { return err @@ -224,7 +218,7 @@ func (v *validator) createKey(name string) error { //nolint:unused // this is ca return v.createKeyFromMnemonic(name, mnemonic) } -func (v *validator) buildCreateValidatorMsg(amount sdk.Coin) (sdk.Msg, error) { //nolint:unused // this is called during e2e tests +func (v *validator) buildCreateValidatorMsg(amount sdk.Coin) (sdk.Msg, error) { description := stakingtypes.NewDescription(v.moniker, "", "", "", "") commissionRates := stakingtypes.CommissionRates{ Rate: sdk.MustNewDecFromStr("0.1"), @@ -250,7 +244,7 @@ func (v *validator) buildCreateValidatorMsg(amount sdk.Coin) (sdk.Msg, error) { ) } -func (v *validator) signMsg(msgs ...sdk.Msg) (*sdktx.Tx, error) { //nolint:unused // this is called during e2e tests +func (v *validator) signMsg(msgs ...sdk.Msg) (*sdktx.Tx, error) { txBuilder := encodingConfig.TxConfig.NewTxBuilder() if err := txBuilder.SetMsgs(msgs...); err != nil { diff --git a/x/globalfee/genesis_test.go b/x/globalfee/genesis_test.go index a22489cd771..9399a476e4c 100644 --- a/x/globalfee/genesis_test.go +++ b/x/globalfee/genesis_test.go @@ -22,8 +22,8 @@ import ( func TestDefaultGenesis(t *testing.T) { encCfg := simapp.MakeTestEncodingConfig() - gotJson := AppModuleBasic{}.DefaultGenesis(encCfg.Marshaler) - assert.JSONEq(t, `{"params":{"minimum_gas_prices":[]}}`, string(gotJson), string(gotJson)) + gotJSON := AppModuleBasic{}.DefaultGenesis(encCfg.Marshaler) + assert.JSONEq(t, `{"params":{"minimum_gas_prices":[]}}`, string(gotJSON), string(gotJSON)) } func TestValidateGenesis(t *testing.T) { @@ -81,16 +81,16 @@ func TestInitExportGenesis(t *testing.T) { }{ "single fee": { src: `{"params":{"minimum_gas_prices":[{"denom":"ALX", "amount":"1"}]}}`, - exp: types.GenesisState{types.Params{MinimumGasPrices: sdk.NewDecCoins(sdk.NewDecCoin("ALX", sdk.NewInt(1)))}}, + exp: types.GenesisState{Params: types.Params{MinimumGasPrices: sdk.NewDecCoins(sdk.NewDecCoin("ALX", sdk.NewInt(1)))}}, }, "multiple fee options": { src: `{"params":{"minimum_gas_prices":[{"denom":"ALX", "amount":"1"}, {"denom":"BLX", "amount":"0.001"}]}}`, - exp: types.GenesisState{types.Params{MinimumGasPrices: sdk.NewDecCoins(sdk.NewDecCoin("ALX", sdk.NewInt(1)), + exp: types.GenesisState{Params: types.Params{MinimumGasPrices: sdk.NewDecCoins(sdk.NewDecCoin("ALX", sdk.NewInt(1)), sdk.NewDecCoinFromDec("BLX", sdk.NewDecWithPrec(1, 3)))}}, }, "no fee set": { src: `{"params":{}}`, - exp: types.GenesisState{types.Params{MinimumGasPrices: sdk.DecCoins{}}}, + exp: types.GenesisState{Params: types.Params{MinimumGasPrices: sdk.DecCoins{}}}, }, } for name, spec := range specs { @@ -98,10 +98,10 @@ func TestInitExportGenesis(t *testing.T) { ctx, encCfg, subspace := setupTestStore(t) m := NewAppModule(subspace) m.InitGenesis(ctx, encCfg.Marshaler, []byte(spec.src)) - gotJson := m.ExportGenesis(ctx, encCfg.Marshaler) + gotJSON := m.ExportGenesis(ctx, encCfg.Marshaler) var got types.GenesisState - require.NoError(t, encCfg.Marshaler.UnmarshalJSON(gotJson, &got)) - assert.Equal(t, spec.exp, got, string(gotJson)) + require.NoError(t, encCfg.Marshaler.UnmarshalJSON(gotJSON, &got)) + assert.Equal(t, spec.exp, got, string(gotJSON)) }) } }