diff --git a/.golangci.yml b/.golangci.yml index 3e093302..88032957 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -17,7 +17,6 @@ linters: - errname - copyloopvar - fatcontext - - forcetypeassert - gci - goconst - gochecksumtype diff --git a/tests/e2e/chain.go b/tests/e2e/chain.go index 1fc1ed45..065800bf 100644 --- a/tests/e2e/chain.go +++ b/tests/e2e/chain.go @@ -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" @@ -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 ( diff --git a/tests/e2e/e2e_distribution_test.go b/tests/e2e/e2e_distribution_test.go index 6322e5f6..45f713c6 100644 --- a/tests/e2e/e2e_distribution_test.go +++ b/tests/e2e/e2e_distribution_test.go @@ -5,7 +5,6 @@ import ( "time" "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/tests/e2e/e2e_exec_test.go b/tests/e2e/e2e_exec_test.go index 59e82afc..882f0d45 100644 --- a/tests/e2e/e2e_exec_test.go +++ b/tests/e2e/e2e_exec_test.go @@ -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" @@ -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 ( @@ -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, @@ -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, @@ -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)) @@ -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, @@ -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() @@ -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 @@ -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() @@ -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() @@ -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() @@ -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() diff --git a/tests/e2e/e2e_gov_test.go b/tests/e2e/e2e_gov_test.go index 816cd19b..ec88a02e 100644 --- a/tests/e2e/e2e_gov_test.go +++ b/tests/e2e/e2e_gov_test.go @@ -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" @@ -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() { @@ -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 diff --git a/tests/e2e/e2e_ibc_test.go b/tests/e2e/e2e_ibc_test.go index f9e22212..245644f2 100644 --- a/tests/e2e/e2e_ibc_test.go +++ b/tests/e2e/e2e_ibc_test.go @@ -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() @@ -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() @@ -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) @@ -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) @@ -320,7 +321,7 @@ func (s *IntegrationTestSuite) testFailedMultihopIBCTokenTransfer() { var ( beforeSenderUOmBalance sdk.Coin - err error + err error ) s.Require().Eventually( diff --git a/tests/e2e/e2e_setup_test.go b/tests/e2e/e2e_setup_test.go index 04eab991..40f19df3 100644 --- a/tests/e2e/e2e_setup_test.go +++ b/tests/e2e/e2e_setup_test.go @@ -14,21 +14,12 @@ import ( "testing" "time" - "github.com/ory/dockertest/v3" - // "github.com/cosmos/cosmos-sdk/crypto/hd" - // "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/ory/dockertest/v3/docker" - "github.com/spf13/viper" - "github.com/stretchr/testify/suite" - + "cosmossdk.io/math" + evidencetypes "cosmossdk.io/x/evidence/types" tmconfig "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/crypto/ed25519" tmjson "github.com/cometbft/cometbft/libs/json" rpchttp "github.com/cometbft/cometbft/rpc/client/http" - - "cosmossdk.io/math" - evidencetypes "cosmossdk.io/x/evidence/types" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" @@ -42,6 +33,10 @@ import ( genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/ory/dockertest/v3" + "github.com/ory/dockertest/v3/docker" + "github.com/spf13/viper" + "github.com/stretchr/testify/suite" ) const ( @@ -80,6 +75,7 @@ const ( transferPort = "transfer" transferChannel = "channel-0" + //nolint:unused govAuthority = "mantra10d07y265gmmuvt4z0w9aw880jnsr700j3fep4f" ) @@ -609,6 +605,8 @@ func noRestart(config *docker.HostConfig) { // runIBCRelayer bootstraps an IBC Hermes relayer by creating an IBC connection and // a transfer channel between chainA and chainB. +// +//nolint:unused func (s *IntegrationTestSuite) runIBCRelayer() { s.T().Log("starting Hermes relayer container") @@ -746,6 +744,7 @@ func (s *IntegrationTestSuite) writeCancelSoftwareUpgradeProposal(c *chain) { s.Require().NoError(err) } +//nolint:unused func (s *IntegrationTestSuite) writeLiquidStakingParamsUpdateProposal(c *chain, oldParams stakingtypes.Params) { template := ` { @@ -791,6 +790,8 @@ func (s *IntegrationTestSuite) writeLiquidStakingParamsUpdateProposal(c *chain, // writeGovParamChangeProposalBlocksPerEpoch writes a governance proposal JSON file to change the `BlocksPerEpoch` // parameter to the provided `blocksPerEpoch` +// +//nolint:unused func (s *IntegrationTestSuite) writeGovParamChangeProposalBlocksPerEpoch(c *chain, paramsJSON string) { template := ` { @@ -820,6 +821,8 @@ func (s *IntegrationTestSuite) writeGovParamChangeProposalBlocksPerEpoch(c *chai // writeFailingExpeditedProposal writes a governance proposal JSON file. // The proposal fails because only SoftwareUpgrade and CancelSoftwareUpgrade can be expedited. +// +//nolint:unused func (s *IntegrationTestSuite) writeFailingExpeditedProposal(c *chain, blocksPerEpoch int64) { template := ` { diff --git a/tests/e2e/e2e_staking_test.go b/tests/e2e/e2e_staking_test.go index 782a8f14..f64ae6aa 100644 --- a/tests/e2e/e2e_staking_test.go +++ b/tests/e2e/e2e_staking_test.go @@ -6,7 +6,6 @@ import ( "time" "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/staking/types" ) diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index 7f13970a..1d59201b 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -12,7 +12,7 @@ var ( runStakingAndDistributionTest = true runVestingTest = true runRestInterfacesTest = true - runRateLimitTest = false // TODO: enable after IBC is fixed + // runRateLimitTest = false // TODO: enable after IBC is fixed ) func (s *IntegrationTestSuite) TestRestInterfaces() { diff --git a/tests/e2e/e2e_vesting_test.go b/tests/e2e/e2e_vesting_test.go index 11427cb3..827e1f41 100644 --- a/tests/e2e/e2e_vesting_test.go +++ b/tests/e2e/e2e_vesting_test.go @@ -7,7 +7,6 @@ import ( "time" "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -197,8 +196,7 @@ func (s *IntegrationTestSuite) testContinuousVestingAccount(api string) { }) } -func (s *IntegrationTestSuite) testPeriodicVestingAccount(api string) { //nolint:unused - +func (s *IntegrationTestSuite) testPeriodicVestingAccount(api string) { s.Run("test periodic vesting genesis account", func() { var ( valIdx = 0 diff --git a/tests/e2e/genesis.go b/tests/e2e/genesis.go index 36a1fa01..3b52d0ce 100644 --- a/tests/e2e/genesis.go +++ b/tests/e2e/genesis.go @@ -5,10 +5,7 @@ import ( "fmt" "time" - feemarkettypes "github.com/skip-mev/feemarket/x/feemarket/types" - "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/server" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -20,6 +17,7 @@ import ( govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" govlegacytypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + feemarkettypes "github.com/skip-mev/feemarket/x/feemarket/types" ) func modifyGenesis(path, moniker, amountStr string, addrAll []sdk.AccAddress, basefee string, denom string) error { diff --git a/tests/e2e/query.go b/tests/e2e/query.go index 2addb0a3..9973ce44 100644 --- a/tests/e2e/query.go +++ b/tests/e2e/query.go @@ -7,11 +7,7 @@ import ( "net/http" "strings" - ratelimittypes "github.com/cosmos/ibc-apps/modules/rate-limiting/v8/types" - icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" - evidencetypes "cosmossdk.io/x/evidence/types" - sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" @@ -29,7 +25,7 @@ func queryTx(endpoint, txHash string) error { } defer resp.Body.Close() - if resp.StatusCode != 200 { + if resp.StatusCode != http.StatusOK { return fmt.Errorf("tx query returned non-200 status: %d", resp.StatusCode) } @@ -76,33 +72,33 @@ func queryAllBalances(endpoint, addr string) (sdk.Coins, error) { return balancesResp.Balances, nil } -func querySupplyOf(endpoint, denom string) (sdk.Coin, error) { - body, err := httpGet(fmt.Sprintf("%s/cosmos/bank/v1beta1/supply/by_denom?denom=%s", endpoint, denom)) - if err != nil { - return sdk.Coin{}, fmt.Errorf("failed to execute HTTP request: %w", err) - } +// func querySupplyOf(endpoint, denom string) (sdk.Coin, error) { +// body, err := httpGet(fmt.Sprintf("%s/cosmos/bank/v1beta1/supply/by_denom?denom=%s", endpoint, denom)) +// if err != nil { +// return sdk.Coin{}, fmt.Errorf("failed to execute HTTP request: %w", err) +// } - var supplyOfResp banktypes.QuerySupplyOfResponse - if err := cdc.UnmarshalJSON(body, &supplyOfResp); err != nil { - return sdk.Coin{}, err - } +// var supplyOfResp banktypes.QuerySupplyOfResponse +// if err := cdc.UnmarshalJSON(body, &supplyOfResp); err != nil { +// return sdk.Coin{}, err +// } - return supplyOfResp.Amount, nil -} +// return supplyOfResp.Amount, nil +// } -func queryStakingParams(endpoint string) (stakingtypes.QueryParamsResponse, error) { - body, err := httpGet(fmt.Sprintf("%s/cosmos/staking/v1beta1/params", endpoint)) - if err != nil { - return stakingtypes.QueryParamsResponse{}, fmt.Errorf("failed to execute HTTP request: %w", err) - } +// func queryStakingParams(endpoint string) (stakingtypes.QueryParamsResponse, error) { +// body, err := httpGet(fmt.Sprintf("%s/cosmos/staking/v1beta1/params", endpoint)) +// if err != nil { +// return stakingtypes.QueryParamsResponse{}, fmt.Errorf("failed to execute HTTP request: %w", err) +// } - var params stakingtypes.QueryParamsResponse - if err := cdc.UnmarshalJSON(body, ¶ms); err != nil { - return stakingtypes.QueryParamsResponse{}, err - } +// var params stakingtypes.QueryParamsResponse +// if err := cdc.UnmarshalJSON(body, ¶ms); err != nil { +// return stakingtypes.QueryParamsResponse{}, err +// } - return params, nil -} +// return params, nil +// } func queryDelegation(endpoint string, validatorAddr string, delegatorAddr string) (stakingtypes.QueryDelegationResponse, error) { var res stakingtypes.QueryDelegationResponse @@ -221,7 +217,7 @@ func queryContinuousVestingAccount(endpoint, address string) (authvesting.Contin return *acc, nil } -func queryPeriodicVestingAccount(endpoint, address string) (authvesting.PeriodicVestingAccount, error) { //nolint:unused // this is called during e2e tests +func queryPeriodicVestingAccount(endpoint, address string) (authvesting.PeriodicVestingAccount, error) { baseAcc, err := queryAccount(endpoint, address) if err != nil { return authvesting.PeriodicVestingAccount{}, err @@ -288,62 +284,62 @@ func queryAllEvidence(endpoint string) (evidencetypes.QueryAllEvidenceResponse, return res, nil } -func queryAllRateLimits(endpoint string) ([]ratelimittypes.RateLimit, error) { - var res ratelimittypes.QueryAllRateLimitsResponse +// func queryAllRateLimits(endpoint string) ([]ratelimittypes.RateLimit, error) { +// var res ratelimittypes.QueryAllRateLimitsResponse - body, err := httpGet(fmt.Sprintf("%s/Stride-Labs/ibc-rate-limiting/ratelimit/ratelimits", endpoint)) - if err != nil { - return []ratelimittypes.RateLimit{}, fmt.Errorf("failed to execute HTTP request: %w", err) - } +// body, err := httpGet(fmt.Sprintf("%s/Stride-Labs/ibc-rate-limiting/ratelimit/ratelimits", endpoint)) +// if err != nil { +// return []ratelimittypes.RateLimit{}, fmt.Errorf("failed to execute HTTP request: %w", err) +// } - if err := cdc.UnmarshalJSON(body, &res); err != nil { - return []ratelimittypes.RateLimit{}, err - } - return res.RateLimits, nil -} +// if err := cdc.UnmarshalJSON(body, &res); err != nil { +// return []ratelimittypes.RateLimit{}, err +// } +// return res.RateLimits, nil +// } -//nolint:unparam -func queryRateLimit(endpoint, channelID, denom string) (ratelimittypes.QueryRateLimitResponse, error) { - var res ratelimittypes.QueryRateLimitResponse +// //nolint:unparam +// func queryRateLimit(endpoint, channelID, denom string) (ratelimittypes.QueryRateLimitResponse, error) { +// var res ratelimittypes.QueryRateLimitResponse - body, err := httpGet(fmt.Sprintf("%s/Stride-Labs/ibc-rate-limiting/ratelimit/ratelimit/%s/by_denom?denom=%s", endpoint, channelID, denom)) - if err != nil { - return ratelimittypes.QueryRateLimitResponse{}, fmt.Errorf("failed to execute HTTP request: %w", err) - } +// body, err := httpGet(fmt.Sprintf("%s/Stride-Labs/ibc-rate-limiting/ratelimit/ratelimit/%s/by_denom?denom=%s", endpoint, channelID, denom)) +// if err != nil { +// return ratelimittypes.QueryRateLimitResponse{}, fmt.Errorf("failed to execute HTTP request: %w", err) +// } - if err := cdc.UnmarshalJSON(body, &res); err != nil { - return ratelimittypes.QueryRateLimitResponse{}, err - } - return res, nil -} +// if err := cdc.UnmarshalJSON(body, &res); err != nil { +// return ratelimittypes.QueryRateLimitResponse{}, err +// } +// return res, nil +// } -func queryRateLimitsByChainID(endpoint, channelID string) ([]ratelimittypes.RateLimit, error) { - var res ratelimittypes.QueryRateLimitsByChainIdResponse +// func queryRateLimitsByChainID(endpoint, channelID string) ([]ratelimittypes.RateLimit, error) { +// var res ratelimittypes.QueryRateLimitsByChainIdResponse - body, err := httpGet(fmt.Sprintf("%s/Stride-Labs/ibc-rate-limiting/ratelimit/ratelimits/%s", endpoint, channelID)) - if err != nil { - return []ratelimittypes.RateLimit{}, fmt.Errorf("failed to execute HTTP request: %w", err) - } +// body, err := httpGet(fmt.Sprintf("%s/Stride-Labs/ibc-rate-limiting/ratelimit/ratelimits/%s", endpoint, channelID)) +// if err != nil { +// return []ratelimittypes.RateLimit{}, fmt.Errorf("failed to execute HTTP request: %w", err) +// } - if err := cdc.UnmarshalJSON(body, &res); err != nil { - return []ratelimittypes.RateLimit{}, err - } - return res.RateLimits, nil -} +// if err := cdc.UnmarshalJSON(body, &res); err != nil { +// return []ratelimittypes.RateLimit{}, err +// } +// return res.RateLimits, nil +// } -func queryICAAccountAddress(endpoint, owner, connectionID string) (string, error) { - body, err := httpGet(fmt.Sprintf("%s/ibc/apps/interchain_accounts/controller/v1/owners/%s/connections/%s", endpoint, owner, connectionID)) - if err != nil { - return "", fmt.Errorf("failed to execute HTTP request: %w", err) - } +// func queryICAAccountAddress(endpoint, owner, connectionID string) (string, error) { +// body, err := httpGet(fmt.Sprintf("%s/ibc/apps/interchain_accounts/controller/v1/owners/%s/connections/%s", endpoint, owner, connectionID)) +// if err != nil { +// return "", fmt.Errorf("failed to execute HTTP request: %w", err) +// } - var icaAccountResp icacontrollertypes.QueryInterchainAccountResponse - if err := cdc.UnmarshalJSON(body, &icaAccountResp); err != nil { - return "", err - } +// var icaAccountResp icacontrollertypes.QueryInterchainAccountResponse +// if err := cdc.UnmarshalJSON(body, &icaAccountResp); err != nil { +// return "", err +// } - return icaAccountResp.Address, nil -} +// return icaAccountResp.Address, nil +// } // TODO: Uncomment this function when CCV module is added // func queryBlocksPerEpoch(endpoint string) (int64, error) { diff --git a/tests/e2e/validator.go b/tests/e2e/validator.go index 97628e93..5ac8dadf 100644 --- a/tests/e2e/validator.go +++ b/tests/e2e/validator.go @@ -8,13 +8,11 @@ import ( "path" "path/filepath" + "cosmossdk.io/math" tmcfg "github.com/cometbft/cometbft/config" tmos "github.com/cometbft/cometbft/libs/os" "github.com/cometbft/cometbft/p2p" "github.com/cometbft/cometbft/privval" - - "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client/tx" sdkcrypto "github.com/cosmos/cosmos-sdk/crypto" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"