Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

golangci: enable unused parameters linter #6018

Merged
merged 6 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ linters:
- unconvert
- unused
- whitespace
- unparam

issues:
exclude-rules:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* [#6014](https://github.com/osmosis-labs/osmosis/pull/6014) refactor: reduce the number of returns in superfluid migration
* [#5983](https://github.com/osmosis-labs/osmosis/pull/5983) refactor(CL): 6 return values in CL CreatePosition with a struct
* [#6004](https://github.com/osmosis-labs/osmosis/pull/6004) reduce number of returns for creating full range position
* [#6018](https://github.com/osmosis-labs/osmosis/pull/6018) golangci: add unused parameters linter

### Features

Expand Down
4 changes: 2 additions & 2 deletions app/upgrades/v15/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ func SetICQParams(ctx sdk.Context, icqKeeper *icqkeeper.Keeper) {
setICQParams(ctx, icqKeeper)
}

func MigrateBalancerPoolToSolidlyStable(ctx sdk.Context, gammKeeper *gammkeeper.Keeper, poolmanager *poolmanager.Keeper, bankKeeper bankkeeper.Keeper, poolId uint64) {
migrateBalancerPoolToSolidlyStable(ctx, gammKeeper, poolmanager, bankKeeper, poolId)
func MigrateBalancerPoolToSolidlyStable(ctx sdk.Context, gammKeeper *gammkeeper.Keeper, bankKeeper bankkeeper.Keeper, poolId uint64) {
migrateBalancerPoolToSolidlyStable(ctx, gammKeeper, bankKeeper, poolId)
}

func SetRateLimits(ctx sdk.Context, accountKeeper *authkeeper.AccountKeeper, rateLimitingICS4Wrapper *ibcratelimit.ICS4Wrapper, wasmKeeper *wasmkeeper.Keeper) {
Expand Down
3 changes: 1 addition & 2 deletions app/upgrades/v15/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ func (suite *UpgradeTestSuite) TestMigrateBalancerToStablePools() {

ctx := suite.Ctx
gammKeeper := suite.App.GAMMKeeper
poolmanagerKeeper := suite.App.PoolManagerKeeper
// bankKeeper := suite.App.BankKeeper
testAccount := suite.TestAccs[0]

Expand Down Expand Up @@ -138,7 +137,7 @@ func (suite *UpgradeTestSuite) TestMigrateBalancerToStablePools() {
balancerBalances := suite.App.BankKeeper.GetAllBalances(ctx, balancerPool.GetAddress())

// test migrating the balancer pool to a stable pool
v15.MigrateBalancerPoolToSolidlyStable(ctx, gammKeeper, poolmanagerKeeper, suite.App.BankKeeper, poolID)
v15.MigrateBalancerPoolToSolidlyStable(ctx, gammKeeper, suite.App.BankKeeper, poolID)

// check that the pool is now a stable pool
stablepool, err := gammKeeper.GetCFMMPool(ctx, poolID)
Expand Down
8 changes: 4 additions & 4 deletions app/upgrades/v15/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func CreateUpgradeHandler(

// Stride stXXX/XXX pools are being migrated from the standard balancer curve to the
// solidly stable curve.
migrateBalancerPoolsToSolidlyStable(ctx, keepers.GAMMKeeper, keepers.PoolManagerKeeper, keepers.BankKeeper)
migrateBalancerPoolsToSolidlyStable(ctx, keepers.GAMMKeeper, keepers.BankKeeper)

setRateLimits(ctx, keepers.AccountKeeper, keepers.RateLimitingICS4Wrapper, keepers.WasmKeeper)

Expand All @@ -79,15 +79,15 @@ func setICQParams(ctx sdk.Context, icqKeeper *icqkeeper.Keeper) {
icqKeeper.SetParams(ctx, icqparams)
}

func migrateBalancerPoolsToSolidlyStable(ctx sdk.Context, gammKeeper *gammkeeper.Keeper, poolmanagerKeeper *poolmanager.Keeper, bankKeeper bankkeeper.Keeper) {
func migrateBalancerPoolsToSolidlyStable(ctx sdk.Context, gammKeeper *gammkeeper.Keeper, bankKeeper bankkeeper.Keeper) {
// migrate stOSMO_OSMOPoolId, stJUNO_JUNOPoolId, stSTARS_STARSPoolId
pools := []uint64{stOSMO_OSMOPoolId, stJUNO_JUNOPoolId, stSTARS_STARSPoolId}
for _, poolId := range pools {
migrateBalancerPoolToSolidlyStable(ctx, gammKeeper, poolmanagerKeeper, bankKeeper, poolId)
migrateBalancerPoolToSolidlyStable(ctx, gammKeeper, bankKeeper, poolId)
}
}

func migrateBalancerPoolToSolidlyStable(ctx sdk.Context, gammKeeper *gammkeeper.Keeper, poolmanagerKeeper *poolmanager.Keeper, bankKeeper bankkeeper.Keeper, poolId uint64) {
func migrateBalancerPoolToSolidlyStable(ctx sdk.Context, gammKeeper *gammkeeper.Keeper, bankKeeper bankkeeper.Keeper, poolId uint64) {
// fetch the pool with the given poolId
balancerPool, err := gammKeeper.GetCFMMPool(ctx, poolId)
if err != nil {
Expand Down
5 changes: 2 additions & 3 deletions simulation/executor/mock_tendermint.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func RandomRequestBeginBlock(r *rand.Rand, params Params,
}

voteInfos := randomVoteInfos(r, params, validators)
evidence := randomDoubleSignEvidence(r, params, validators, pastTimes, pastVoteInfos, event, header, voteInfos)
evidence := randomDoubleSignEvidence(r, params, pastTimes, pastVoteInfos, event, header, voteInfos)

return abci.RequestBeginBlock{
Header: header,
Expand Down Expand Up @@ -230,8 +230,7 @@ func randomVoteInfos(r *rand.Rand, simParams Params, validators mockValidators,
return voteInfos
}

func randomDoubleSignEvidence(r *rand.Rand, params Params,
validators mockValidators, pastTimes []time.Time,
func randomDoubleSignEvidence(r *rand.Rand, params Params, pastTimes []time.Time,
pastVoteInfos [][]abci.VoteInfo,
event func(route, op, evResult string), header tmproto.Header, voteInfos []abci.VoteInfo,
) []abci.Evidence {
Expand Down
1 change: 1 addition & 0 deletions simulation/executor/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/osmosis-labs/osmosis/v17/simulation/simtypes"
)

//nolint:unparam
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note to reviewer: nolint because t might be used in the future

func getTestingMode(tb testing.TB) (testingMode bool, t *testing.T, b *testing.B) {
tb.Helper()
testingMode = false
Expand Down
4 changes: 2 additions & 2 deletions simulation/simtypes/txbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ func (sim *SimCtx) deliverTx(tx sdk.Tx, msg sdk.Msg, msgName string) (simulation
txConfig := params.MakeEncodingConfig().TxConfig // TODO: unhardcode
gasInfo, results, err := sim.BaseApp().Deliver(txConfig.TxEncoder(), tx)
if err != nil {
return simulation.NoOpMsg(msgName, msgName, fmt.Sprintf("unable to deliver tx. \nreason: %v\n results: %v\n msg: %s\n tx: %s", err, results, msg, tx)), nil, nil, err
return simulation.NoOpMsg(msgName, msgName, fmt.Sprintf("unable to deliver tx. \nreason: %v\n results: %v\n msg: %s\n tx: %s", err, results, msg, tx)), []simulation.FutureOperation{}, nil, err
}

opMsg := simulation.NewOperationMsg(msg, true, "", gasInfo.GasWanted, gasInfo.GasUsed, nil)
opMsg.Route = msgName
opMsg.Name = msgName

return opMsg, nil, results.Data, nil
return opMsg, []simulation.FutureOperation{}, results.Data, nil
}

// GenTx generates a signed mock transaction.
Expand Down
5 changes: 2 additions & 3 deletions tests/e2e/configurer/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ func (uc *UpgradeConfigurer) RunSetup() error {
func (uc *UpgradeConfigurer) RunUpgrade() error {
var err error
if uc.forkHeight > 0 {
err = uc.runForkUpgrade()
uc.runForkUpgrade()
} else {
err = uc.runProposalUpgrade()
}
Expand Down Expand Up @@ -413,13 +413,12 @@ func (uc *UpgradeConfigurer) runProposalUpgrade() error {
return nil
}

func (uc *UpgradeConfigurer) runForkUpgrade() error {
func (uc *UpgradeConfigurer) runForkUpgrade() {
for _, chainConfig := range uc.chainConfigs {
uc.t.Logf("waiting to reach fork height on chain %s", chainConfig.Id)
chainConfig.WaitUntilHeight(uc.forkHeight)
uc.t.Logf("fork height reached on chain %s", chainConfig.Id)
}
return nil
}

func (uc *UpgradeConfigurer) upgradeContainers(chainConfig *chain.Config, propHeight int64) error {
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/initialization/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ type internalChain struct {
nodes []*internalNode
}

func new(id, dataDir string) (*internalChain, error) {
func new(id, dataDir string) *internalChain {
chainMeta := ChainMeta{
Id: id,
DataDir: dataDir,
}
return &internalChain{
chainMeta: chainMeta,
}, nil
}
}

func (c *internalChain) export() *Chain {
Expand Down
11 changes: 2 additions & 9 deletions tests/e2e/initialization/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ import (
)

func InitChain(id, dataDir string, nodeConfigs []*NodeConfig, votingPeriod, expeditedVotingPeriod time.Duration, forkHeight int) (*Chain, error) {
chain, err := new(id, dataDir)
if err != nil {
return nil, err
}
chain := new(id, dataDir)

for _, nodeConfig := range nodeConfigs {
newNode, err := newNode(chain, nodeConfig)
Expand Down Expand Up @@ -49,11 +46,7 @@ func InitSingleNode(chainId, dataDir string, existingGenesisDir string, nodeConf
return nil, errors.New("creating individual validator nodes after starting up chain is not currently supported")
}

chain, err := new(chainId, dataDir)
if err != nil {
return nil, err
}

chain := new(chainId, dataDir)
newNode, err := newNode(chain, nodeConfig)
if err != nil {
return nil, err
Expand Down
1 change: 0 additions & 1 deletion x/concentrated-liquidity/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ func parsePoolRecords(cmd *cobra.Command) ([]types.PoolRecord, error) {

if len(poolRecords)%4 != 0 {
return nil, fmt.Errorf("poolRecords must be a list of denom0, denom1, tickSpacing, and spreadFactor")

}

finalPoolRecords := []types.PoolRecord{}
Expand Down
10 changes: 5 additions & 5 deletions x/concentrated-liquidity/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,15 @@ func AsConcentrated(poolI poolmanagertypes.PoolI) (types.ConcentratedPoolExtensi
}

func (k Keeper) ValidateSpreadFactor(ctx sdk.Context, params types.Params, spreadFactor sdk.Dec) bool {
return k.validateSpreadFactor(ctx, params, spreadFactor)
return k.validateSpreadFactor(params, spreadFactor)
}

func (k Keeper) ValidateTickSpacing(ctx sdk.Context, params types.Params, tickSpacing uint64) bool {
return k.validateTickSpacing(ctx, params, tickSpacing)
return k.validateTickSpacing(params, tickSpacing)
}

func (k Keeper) ValidateTickSpacingUpdate(ctx sdk.Context, pool types.ConcentratedPoolExtension, params types.Params, newTickSpacing uint64) bool {
return k.validateTickSpacingUpdate(ctx, pool, params, newTickSpacing)
return k.validateTickSpacingUpdate(pool, params, newTickSpacing)
}

func (k Keeper) FungifyChargedPosition(ctx sdk.Context, owner sdk.AccAddress, positionIds []uint64) (uint64, error) {
Expand Down Expand Up @@ -319,7 +319,7 @@ func (k Keeper) GetListenersUnsafe() types.ConcentratedLiquidityListeners {
}

func ValidateAuthorizedQuoteDenoms(ctx sdk.Context, denom1 string, authorizedQuoteDenoms []string) bool {
return validateAuthorizedQuoteDenoms(ctx, denom1, authorizedQuoteDenoms)
return validateAuthorizedQuoteDenoms(denom1, authorizedQuoteDenoms)
}

func (k Keeper) ValidatePositionUpdateById(ctx sdk.Context, positionId uint64, updateInitiator sdk.AccAddress, lowerTickGiven int64, upperTickGiven int64, liquidityDeltaGiven sdk.Dec, joinTimeGiven time.Time, poolIdGiven uint64) error {
Expand All @@ -331,7 +331,7 @@ func (k Keeper) GetLargestAuthorizedUptimeDuration(ctx sdk.Context) time.Duratio
}

func (k Keeper) GetLargestSupportedUptimeDuration(ctx sdk.Context) time.Duration {
return k.getLargestSupportedUptimeDuration(ctx)
return k.getLargestSupportedUptimeDuration()
}

func (k Keeper) SetupSwapStrategy(ctx sdk.Context, p types.ConcentratedPoolExtension,
Expand Down
2 changes: 1 addition & 1 deletion x/concentrated-liquidity/incentives.go
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,6 @@ func (k Keeper) getLargestAuthorizedUptimeDuration(ctx sdk.Context) time.Duratio

// nolint: unused
// getLargestSupportedUptimeDuration retrieves the largest supported uptime duration from the preset constant slice.
func (k Keeper) getLargestSupportedUptimeDuration(ctx sdk.Context) time.Duration {
func (k Keeper) getLargestSupportedUptimeDuration() time.Duration {
return getLargestDuration(types.SupportedUptimes)
}
16 changes: 8 additions & 8 deletions x/concentrated-liquidity/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ func (k Keeper) InitializePool(ctx sdk.Context, poolI poolmanagertypes.PoolI, cr
poolId := concentratedPool.GetId()
quoteAsset := concentratedPool.GetToken1()

if !k.validateTickSpacing(ctx, params, tickSpacing) {
if !k.validateTickSpacing(params, tickSpacing) {
return types.UnauthorizedTickSpacingError{ProvidedTickSpacing: tickSpacing, AuthorizedTickSpacings: params.AuthorizedTickSpacing}
}

if !k.validateSpreadFactor(ctx, params, spreadFactor) {
if !k.validateSpreadFactor(params, spreadFactor) {
return types.UnauthorizedSpreadFactorError{ProvidedSpreadFactor: spreadFactor, AuthorizedSpreadFactors: params.AuthorizedSpreadFactors}
}

if !validateAuthorizedQuoteDenoms(ctx, quoteAsset, params.AuthorizedQuoteDenoms) {
if !validateAuthorizedQuoteDenoms(quoteAsset, params.AuthorizedQuoteDenoms) {
return types.UnauthorizedQuoteDenomError{ProvidedQuoteDenom: quoteAsset, AuthorizedQuoteDenoms: params.AuthorizedQuoteDenoms}
}

Expand Down Expand Up @@ -270,7 +270,7 @@ func (k Keeper) DecreaseConcentratedPoolTickSpacing(ctx sdk.Context, poolIdToTic
}
params := k.GetParams(ctx)

if !k.validateTickSpacingUpdate(ctx, pool, params, poolIdToTickSpacingRecord.NewTickSpacing) {
if !k.validateTickSpacingUpdate(pool, params, poolIdToTickSpacingRecord.NewTickSpacing) {
return fmt.Errorf("tick spacing %d is not valid", poolIdToTickSpacingRecord.NewTickSpacing)
}

Expand All @@ -285,7 +285,7 @@ func (k Keeper) DecreaseConcentratedPoolTickSpacing(ctx sdk.Context, poolIdToTic

// validateTickSpacing returns true if the given tick spacing is one of the authorized tick spacings set in the
// params. False otherwise.
func (k Keeper) validateTickSpacing(ctx sdk.Context, params types.Params, tickSpacing uint64) bool {
func (k Keeper) validateTickSpacing(params types.Params, tickSpacing uint64) bool {
for _, authorizedTick := range params.AuthorizedTickSpacing {
if tickSpacing == authorizedTick {
return true
Expand All @@ -296,7 +296,7 @@ func (k Keeper) validateTickSpacing(ctx sdk.Context, params types.Params, tickSp

// validateTickSpacingUpdate returns true if the given tick spacing is one of the authorized tick spacings set in the
// params and is less than the current tick spacing. False otherwise.
func (k Keeper) validateTickSpacingUpdate(ctx sdk.Context, pool types.ConcentratedPoolExtension, params types.Params, newTickSpacing uint64) bool {
func (k Keeper) validateTickSpacingUpdate(pool types.ConcentratedPoolExtension, params types.Params, newTickSpacing uint64) bool {
currentTickSpacing := pool.GetTickSpacing()
for _, authorizedTick := range params.AuthorizedTickSpacing {
// New tick spacing must be one of the authorized tick spacings and must be less than the current tick spacing
Expand All @@ -309,7 +309,7 @@ func (k Keeper) validateTickSpacingUpdate(ctx sdk.Context, pool types.Concentrat

// validateSpreadFactor returns true if the given spread factor is one of the authorized spread factors set in the
// params. False otherwise.
func (k Keeper) validateSpreadFactor(ctx sdk.Context, params types.Params, spreadFactor sdk.Dec) bool {
func (k Keeper) validateSpreadFactor(params types.Params, spreadFactor sdk.Dec) bool {
for _, authorizedSpreadFactor := range params.AuthorizedSpreadFactors {
if spreadFactor.Equal(authorizedSpreadFactor) {
return true
Expand All @@ -328,7 +328,7 @@ func (k Keeper) validateSpreadFactor(ctx sdk.Context, params types.Params, sprea
//
// Returns:
// - bool: A boolean indicating if the denom1 is authorized or not.
func validateAuthorizedQuoteDenoms(ctx sdk.Context, denom1 string, authorizedQuoteDenoms []string) bool {
func validateAuthorizedQuoteDenoms(denom1 string, authorizedQuoteDenoms []string) bool {
for _, authorizedQuoteDenom := range authorizedQuoteDenoms {
if denom1 == authorizedQuoteDenom {
return true
Expand Down
4 changes: 2 additions & 2 deletions x/concentrated-liquidity/simulation/sim_msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func RandMsgCollectIncentives(k clkeeper.Keeper, sim *osmosimtypes.SimCtx, ctx s
}

// createPoolRestriction creates specific restriction for the creation of a pool.
func createPoolRestriction(k clkeeper.Keeper, sim *osmosimtypes.SimCtx, ctx sdk.Context) osmosimtypes.SimAccountConstraint {
func createPoolRestriction(sim *osmosimtypes.SimCtx, ctx sdk.Context) osmosimtypes.SimAccountConstraint {
return func(acc legacysimulationtype.Account) bool {
accCoins := sim.BankKeeper().SpendableCoins(ctx, acc.Address)
hasTwoCoins := len(accCoins) >= 3
Expand Down Expand Up @@ -329,7 +329,7 @@ func RandomPreparePoolFunc(sim *osmosimtypes.SimCtx, ctx sdk.Context, k clkeeper
authorizedSpreadFactor := cltypes.AuthorizedSpreadFactors

// find an address with two or more distinct denoms in their wallet
sender, senderExists := sim.RandomSimAccountWithConstraint(createPoolRestriction(k, sim, ctx))
sender, senderExists := sim.RandomSimAccountWithConstraint(createPoolRestriction(sim, ctx))
if !senderExists {
return nil, sdk.Coin{}, sdk.Coin{}, 0, sdk.Dec{}, fmt.Errorf("no sender with two different denoms & pool creation fee exists")
}
Expand Down
1 change: 1 addition & 0 deletions x/downtime-detector/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ downtime-duration is a duration, but is restricted to a smaller set. Heres a few
}, &queryproto.RecoveredSinceDowntimeOfLengthRequest{}
}

//nolint:unparam
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note to reviewers: nolint due to design of osmocli

func parseDowntimeDuration(arg string, _ *pflag.FlagSet) (any, osmocli.FieldReadLocation, error) {
dur, err := time.ParseDuration(arg)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions x/gamm/simulation/sim_msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func RandomExitPoolMsg(k keeper.Keeper, sim *simtypes.SimCtx, ctx sdk.Context) (
func RandomCreateUniV2Msg(k keeper.Keeper, sim *simtypes.SimCtx, ctx sdk.Context) (*balancertypes.MsgCreateBalancerPool, error) {
var poolAssets []balancertypes.PoolAsset
// find an address with two or more distinct denoms in their wallet
sender, senderExists := sim.RandomSimAccountWithConstraint(createPoolRestriction(k, sim, ctx))
sender, senderExists := sim.RandomSimAccountWithConstraint(createPoolRestriction(sim, ctx))
if !senderExists {
return nil, errors.New("no sender with two different denoms & pool creation fee exists")
}
Expand Down Expand Up @@ -405,7 +405,7 @@ func deriveRealMinShareOutAmt(ctx sdk.Context, tokenIn sdk.Coins, pool types.CFM
return minShareOutAmt, nil
}

func createPoolRestriction(k keeper.Keeper, sim *simtypes.SimCtx, ctx sdk.Context) simtypes.SimAccountConstraint {
func createPoolRestriction(sim *simtypes.SimCtx, ctx sdk.Context) simtypes.SimAccountConstraint {
return func(acc legacysimulationtype.Account) bool {
accCoins := sim.BankKeeper().SpendableCoins(ctx, acc.Address)
hasTwoCoins := len(accCoins) >= 2
Expand Down
4 changes: 2 additions & 2 deletions x/incentives/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ func NewCreateGaugeCmd() *cobra.Command {
}

var distributeTo lockuptypes.QueryCondition
// if poolId is 0 it is a guranteed lock gauge
// if poolId is > 0 it is a guranteed no-lock gauge
// if poolId is 0 it is a guaranteed lock gauge
// if poolId is > 0 it is a guaranteed no-lock gauge
if poolId == 0 {
distributeTo = lockuptypes.QueryCondition{
LockQueryType: lockuptypes.ByDuration,
Expand Down
4 changes: 2 additions & 2 deletions x/poolmanager/create_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

// validateCreatedPool checks that the pool was created with the correct pool ID and address.
func (k Keeper) validateCreatedPool(ctx sdk.Context, poolId uint64, pool types.PoolI) error {
func (k Keeper) validateCreatedPool(poolId uint64, pool types.PoolI) error {
if pool.GetId() != poolId {
return types.IncorrectPoolIdError{ExpectedPoolId: poolId, ActualPoolId: pool.GetId()}
}
Expand Down Expand Up @@ -115,7 +115,7 @@ func (k Keeper) createPoolZeroLiquidityNoCreationFee(ctx sdk.Context, msg types.
k.SetPoolRoute(ctx, poolId, msg.GetPoolType())

// Validates the pool address and pool ID stored match what was expected.
if err := k.validateCreatedPool(ctx, poolId, pool); err != nil {
if err := k.validateCreatedPool(poolId, pool); err != nil {
return nil, err
}

Expand Down
2 changes: 1 addition & 1 deletion x/poolmanager/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (k Keeper) GetAllPoolRoutes(ctx sdk.Context) []types.ModuleRoute {
}

func (k Keeper) ValidateCreatedPool(ctx sdk.Context, poolId uint64, pool types.PoolI) error {
return k.validateCreatedPool(ctx, poolId, pool)
return k.validateCreatedPool(poolId, pool)
}

func (k Keeper) IsOsmoRoutedMultihop(ctx sdk.Context, route types.MultihopRoute, inDenom, outDenom string) (isRouted bool) {
Expand Down
2 changes: 2 additions & 0 deletions x/protorev/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ func NewQueryPoolCmd() (*osmocli.QueryDescriptor, *types.QueryGetProtoRevPoolReq
}

// convert a string array "[1,2,3]" to []uint64
//
//nolint:unparam
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note to reviewers: nolint due to design of osmocli

func parseRoute(arg string, _ *pflag.FlagSet) (any, osmocli.FieldReadLocation, error) {
var route []uint64
err := json.Unmarshal([]byte(arg), &route)
Expand Down
Loading