Skip to content

Commit

Permalink
chore: fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
tbruyelle committed Aug 20, 2024
1 parent 161b5c7 commit c8b4d2c
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 109 deletions.
13 changes: 0 additions & 13 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (

autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1"
errorsmod "cosmossdk.io/errors"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
Expand All @@ -38,7 +37,6 @@ import (
servertypes "github.com/cosmos/cosmos-sdk/server/types"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
Expand Down Expand Up @@ -429,14 +427,3 @@ type EmptyAppOptions struct{}
func (ao EmptyAppOptions) Get(_ string) interface{} {
return nil
}

// noOpTxFeeChecker is an ante TxFeeChecker for the DeductFeeDecorator, see x/auth/ante/fee.go,
// it performs a no-op by not checking tx fees and always returns a zero tx priority
func noOpTxFeeChecker(_ sdk.Context, tx sdk.Tx) (sdk.Coins, int64, error) {
feeTx, ok := tx.(sdk.FeeTx)
if !ok {
return nil, 0, errorsmod.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx")
}

return feeTx.GetFee(), 0, nil
}
12 changes: 6 additions & 6 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,12 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
//nolint: staticcheck // SA1019: moduletypes.ParamKeyTable is deprecated
paramsKeeper.Subspace(authtypes.ModuleName).WithKeyTable(authtypes.ParamKeyTable())
paramsKeeper.Subspace(stakingtypes.ModuleName).WithKeyTable(stakingtypes.ParamKeyTable())
paramsKeeper.Subspace(banktypes.ModuleName).WithKeyTable(banktypes.ParamKeyTable()) //nolint: staticcheck // SA1019
paramsKeeper.Subspace(minttypes.ModuleName).WithKeyTable(minttypes.ParamKeyTable()) //nolint: staticcheck // SA1019
paramsKeeper.Subspace(distrtypes.ModuleName).WithKeyTable(distrtypes.ParamKeyTable()) //nolint: staticcheck // SA1019
paramsKeeper.Subspace(slashingtypes.ModuleName).WithKeyTable(slashingtypes.ParamKeyTable()) //nolint: staticcheck // SA1019
paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable()) //nolint: staticcheck // SA1019
paramsKeeper.Subspace(crisistypes.ModuleName).WithKeyTable(crisistypes.ParamKeyTable()) //nolint: staticcheck // SA1019
paramsKeeper.Subspace(banktypes.ModuleName).WithKeyTable(banktypes.ParamKeyTable()) //nolint:staticcheck // SA1019
paramsKeeper.Subspace(minttypes.ModuleName).WithKeyTable(minttypes.ParamKeyTable()) //nolint:staticcheck // SA1019
paramsKeeper.Subspace(distrtypes.ModuleName).WithKeyTable(distrtypes.ParamKeyTable()) //nolint:staticcheck // SA1019
paramsKeeper.Subspace(slashingtypes.ModuleName).WithKeyTable(slashingtypes.ParamKeyTable()) //nolint:staticcheck // SA1019
paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable()) //nolint:staticcheck // SA1019
paramsKeeper.Subspace(crisistypes.ModuleName).WithKeyTable(crisistypes.ParamKeyTable()) //nolint:staticcheck // SA1019

return paramsKeeper
}
90 changes: 5 additions & 85 deletions tests/e2e/e2e_exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ func (s *IntegrationTestSuite) execBankMultiSend(
s.executeAtomoneTxCommand(ctx, c, atomoneCommand, valIdx, s.expectErrExecValidation(c, valIdx, expectErr))
}

type txBankSend struct {
type txBankSend struct { //nolint:unused
from string
to string
amt string
Expand All @@ -331,9 +331,9 @@ type txBankSend struct {
expectErr bool
}

func (s *IntegrationTestSuite) execBankSendBatch(
func (s *IntegrationTestSuite) execBankSendBatch( //nolint:unused
c *chain,
valIdx int, //nolint:unparam
valIdx int,
txs ...txBankSend,
) int {
sucessBankSendCount := 0
Expand All @@ -352,7 +352,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:unused
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()

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

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

Expand All @@ -785,86 +785,6 @@ func (s *IntegrationTestSuite) executeValidatorBond(c *chain, valIdx int, valOpe
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()

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

atomoneCommand := []string{
atomonedBinary,
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.executeAtomoneTxCommand(ctx, c, atomoneCommand, valIdx, s.defaultExecValidation(c, valIdx))
s.T().Logf("%s successfully executed tokenize share tx from %s", delegatorAddr, valOperAddress)
}

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

s.T().Logf("Executing atomoned tx staking redeem-tokens %s", c.id)

atomoneCommand := []string{
atomonedBinary,
txCommand,
stakingtypes.ModuleName,
"redeem-tokens",
amount,
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.executeAtomoneTxCommand(ctx, c, atomoneCommand, valIdx, s.defaultExecValidation(c, valIdx))
s.T().Logf("%s successfully executed redeem share tx for %s", delegatorAddr, amount)
}

func (s *IntegrationTestSuite) executeTransferTokenizeShareRecord(c *chain, valIdx int, recordID, owner, newOwner, home, txFees string) {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()

s.T().Logf("Executing atomoned tx staking transfer-tokenize-share-record %s", c.id)

atomoneCommand := []string{
atomonedBinary,
txCommand,
stakingtypes.ModuleName,
"transfer-tokenize-share-record",
recordID,
newOwner,
fmt.Sprintf("--%s=%s", flags.FlagFrom, owner),
fmt.Sprintf("--%s=%s", flags.FlagChainID, c.id),
fmt.Sprintf("--%s=%s", flags.FlagGasPrices, txFees),
"--keyring-backend=test",
fmt.Sprintf("--%s=%s", flags.FlagHome, home),
"--output=json",
"-y",
}

s.executeAtomoneTxCommand(ctx, c, atomoneCommand, valIdx, s.defaultExecValidation(c, valIdx))
s.T().Logf("%s successfully executed transfer tokenize share record for %s", owner, recordID)
}

// signTxFileOnline signs a transaction file using the atomoned 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)
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/e2e_setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ func (s *IntegrationTestSuite) writeGovLegProposal(c *chain, height int64, name
s.Require().NoError(err)
}

func (s *IntegrationTestSuite) writeLiquidStakingParamsUpdateProposal(c *chain, oldParams stakingtypes.Params) {
func (s *IntegrationTestSuite) writeLiquidStakingParamsUpdateProposal(c *chain, oldParams stakingtypes.Params) { //nolint:unused
template := `
{
"messages": [
Expand Down
1 change: 0 additions & 1 deletion tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import "fmt"

var (
runBankTest = true
runBypassMinFeeTest = true
runEncodeTest = true
runEvidenceTest = true
runFeeGrantTest = true
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

// copyFile copy file from src to dst
func copyFile(src, dst string) (int64, error) { //nolint:unparam
func copyFile(src, dst string) (int64, error) {
sourceFileStat, err := os.Stat(src)
if err != nil {
return 0, err
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func queryAtomOneAllBalances(endpoint, addr string) (sdk.Coins, error) {
return balancesResp.Balances, nil
}

func queryStakingParams(endpoint string) (stakingtypes.QueryParamsResponse, error) {
func queryStakingParams(endpoint string) (stakingtypes.QueryParamsResponse, error) { //nolint:unused
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)
Expand Down Expand Up @@ -126,7 +126,7 @@ func queryDelegatorWithdrawalAddress(endpoint string, delegatorAddr string) (dis
return res, nil
}

func queryDelegatorTotalRewards(endpoint, delegatorAddr string) (disttypes.QueryDelegationTotalRewardsResponse, error) {
func queryDelegatorTotalRewards(endpoint, delegatorAddr string) (disttypes.QueryDelegationTotalRewardsResponse, error) { //nolint:unused
var res disttypes.QueryDelegationTotalRewardsResponse

body, err := httpGet(fmt.Sprintf("%s/cosmos/distribution/v1beta1/delegators/%s/rewards", endpoint, delegatorAddr))
Expand Down

0 comments on commit c8b4d2c

Please sign in to comment.