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

Bump golang linter version #592

Merged
merged 1 commit into from
Dec 5, 2024
Merged

Bump golang linter version #592

merged 1 commit into from
Dec 5, 2024

Conversation

pablin-10
Copy link
Collaborator

@pablin-10 pablin-10 commented Dec 5, 2024

Summary

This updates the github action that runs golangci-lint and the linter to the last version

@pablin-10 pablin-10 changed the base branch from v27.x to v28.x December 5, 2024 13:48
@deividaspetraitis deividaspetraitis added the A:backport/v28.x Backport to v28.x branch label Dec 5, 2024
Copy link

sonarqubecloud bot commented Dec 5, 2024

@deividaspetraitis deividaspetraitis added A:backport/v28.x Backport to v28.x branch and removed A:backport/v28.x Backport to v28.x branch labels Dec 5, 2024
Copy link
Collaborator

@deividaspetraitis deividaspetraitis left a comment

Choose a reason for hiding this comment

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

LGTM, TYSM! 🙇

Copy link
Contributor

coderabbitai bot commented Dec 5, 2024

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 golangci-lint (1.62.2)

level=warning msg="The linter 'exportloopref' is deprecated (since v1.60.2) due to: Since Go1.22 (loopvar) this linter is no longer relevant. Replaced by copyloopvar."

Walkthrough

The pull request includes significant updates across multiple files, primarily focusing on upgrading dependencies from version 27 to version 28 of the Osmosis library. Key changes involve updating import paths, enhancing workflow configurations for linting and required labels, and adding new features to the changelog. The modifications maintain the existing functionality while ensuring compatibility with the latest library versions and improving error handling and logging mechanisms in various components.

Changes

File Path Change Summary
.github/workflows/lint.yml Updated golangci-lint-action from v3 to v5 and GolangCI Lint from v1.54 to v1.62.
.github/workflows/required-labels.yml Changed branch from "v26.x" to "v27.x" and label from "A:backport/v27.x" to "A:backport/v28.x".
CHANGELOG.md Added entry for v27.1.0, including pagination, sorting, and query filtering support for /pools.
app/main.go Updated import path from v27 to v28.
app/sidecar_query_server.go Updated import paths for app and txfees/types from v27 to v28.
chaininfo/client/chain_client.go Updated import paths for several modules from v27 to v28.
domain/cosmos/auth/types/types.go Updated import path for app from v27 to v28.
domain/cosmos/tx/msg_simulator.go Updated import path for params from v27 to v28.
domain/cosmos/tx/tx.go Updated import path for txfeestypes from v27 to v28.
domain/mocks/chain_pool_mock.go Updated import path for poolmanagertypes from v27 to v28.
domain/mocks/msg_simulator_mock.go Updated import paths for params and modified method signatures.
domain/mocks/pool_mock.go Updated import path for poolmanagertypes from v27 to v28.
domain/mocks/txfees_client.go Updated import path for txfeestypes from v27 to v28.
domain/passthrough/passthrough_grpc_client.go Updated import paths for concentratedLiquidity and lockup from v27 to v28.
domain/routable_pool.go Updated import path for poolmanagertypes from v27 to v28.
go.mod Updated Go version from 1.22.4 to 1.22.7, added toolchain version go1.23.3, and updated multiple dependencies.
ingest/usecase/ingest_usecase.go Updated import path for poolmanagertypes from v27 to v28 and refined logic in ProcessBlockData.
ingest/usecase/plugins/basefee/base_fee_end_block_update_plugin.go Updated import path for txfeestypes from v27 to v28.
ingest/usecase/plugins/orderbook/claimbot/config.go Updated import path for txfeestypes from v27 to v28.
ingest/usecase/plugins/orderbook/claimbot/tx.go Updated import paths for app and params from v27 to v28.
ingest/usecase/plugins/orderbook/fillbot/context/tx/tx_context.go Updated import path for poolmanagertypes from v27 to v28.
ingest/usecase/plugins/orderbook/fillbot/fillable_orders.go Updated import path for clmath from v27 to v28.
ingest/usecase/plugins/orderbook/fillbot/osmosis_swap.go Updated import paths for app and poolmanager/types from v27 to v28.
orderbook/usecase/orderbook_usecase.go Updated import paths for cosmwasmpool and concentrated-liquidity from v27 to v28.
pkg/api/v1beta1/pools/http.go Added IsLegacy method to GetPoolsRequest struct and updated UnmarshalHTTPRequest method.
pools/common/keepers.go Updated import paths for queryproto and poolmanagertypes from v27 to v28.
pools/delivery/http/pools_handler.go Updated GetPools method signature to include echo.Context.
pools/usecase/pools_usecase.go Updated import paths for cosmwasmpoolmodel, gamm/types, and poolmanagertypes from v27 to v28.
quotesimulator/quote_simulator.go Updated import paths for params and poolmanagertypes from v27 to v28.
router/usecase/pools/pool_factory.go Updated import paths for concentrated liquidity and pool manager types from v27 to v28.
router/usecase/pools/routable_balancer_pool.go Updated import paths for poolmanager and gamm/pool-models/balancer from v27 to v28.
router/usecase/pools/routable_concentrated_pool.go Updated import paths for concentrated liquidity and pool manager from v27 to v28.
router/usecase/pools/routable_cw_alloy_transmuter_pool.go Updated import paths for cosmwasmpool and poolmanager from v27 to v28.
router/usecase/pools/routable_cw_orderbook_pool.go Updated import paths for concentrated-liquidity/math, cosmwasmpool/model, and poolmanager/types from v27 to v28.
router/usecase/pools/routable_cw_pool.go Updated import paths for cosmwasmpool and poolmanager from v27 to v28.
router/usecase/pools/routable_cw_transmuter_pool.go Updated import paths for cosmwasmpool and poolmanager from v27 to v28.
router/usecase/pools/routable_result_pool.go Updated import paths for poolmanager and poolmanagertypes from v27 to v28.
router/usecase/pools/routable_stableswap_pool.go Updated import paths for poolmanager and gamm/pool-models/stableswap from v27 to v28.
router/usecase/router.go Updated import paths for cosmwasmpooltypes and poolmanagertypes from v27 to v28.
router/usecase/router_usecase.go Updated import path for poolmanagertypes from v27 to v28.
router/usecase/routertesting/parsing/mainnet_pools.go Updated import paths for several packages from v27 to v28.
router/usecase/routertesting/pool.go Updated import paths for balancer and poolmanagertypes from v27 to v28.
router/usecase/routertesting/quote.go Updated import path for poolmanagertypes from v27 to v28.
router/usecase/routertesting/suite.go Updated import paths for app, apptesting, and poolmanagertypes from v27 to v28.
sqsdomain/cosmwasmpool/orderbook.go Updated import path for clmath from v27 to v28.
sqsdomain/go.mod Updated Go version to 1.22.7, toolchain to go1.23.3, and various dependencies.
sqsdomain/pools.go Updated import paths for clqueryproto and poolmanagertypes from v27 to v28.

Possibly related PRs

  • BE-636 | Add pagination + sorting + query filtering support for /pools endpoint #553: This PR adds pagination, sorting, and query filtering support for the /pools endpoint, which is directly related to the changes in the main PR that updated the linting configuration, as both involve enhancements to the codebase's functionality.
  • BE-636 | Update CHANGELOG.md #590: This PR updates the CHANGELOG to include the new version entry for v27.1.0, which documents the addition of pagination, sorting, and query filtering support for the /pools endpoint, linking it to the changes made in the main PR.

Suggested labels

A:backport/v28.x

Suggested reviewers

  • PaddyMc
  • p0mvn
  • cryptomatictrader

🐰 In the garden of code so bright,
Changes bloom with pure delight.
From v27 to v28 we hop,
Upgraded paths, we’ll never stop!
With linting fresh and labels new,
Our code will shine, that much is true! 🌼✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments.

Actionable comments posted: 4

🧹 Outside diff range and nitpick comments (3)
domain/mocks/msg_simulator_mock.go (1)

Based on the evidence gathered, I can now verify the interface implementation. The PriceMsgs method in the mock has a signature mismatch with the interface:

  1. Interface (domain/cosmos/tx/msg_simulator.go):
PriceMsgs(
    ctx context.Context,
    encodingConfig cosmosclient.TxConfig,
    account *authtypes.BaseAccount,
    chainID string,
    msg ...sdk.Msg,
) domain.TxFeeInfo
  1. Mock implementation (domain/mocks/msg_simulator_mock.go):
PriceMsgs(ctx context.Context, encodingConfig client.TxConfig, account *authtypes.BaseAccount, chainID string, msg ...interface {
    ProtoMessage()
    Reset()
    String() string
}) domain.TxFeeInfo

The mock's PriceMsgs method accepts ...interface{ ProtoMessage(); Reset(); String() string } instead of ...sdk.Msg. This is a type mismatch that could lead to runtime errors.

Fix the mock's PriceMsgs method signature to match the interface.

  • Update the parameter type from ...interface{ ProtoMessage(); Reset(); String() string } to ...sdk.Msg in domain/mocks/msg_simulator_mock.go
🔗 Analysis chain

Line range hint 1-85: Verify interface implementation compatibility.

Let's ensure the mock still correctly implements the sqstx.MsgSimulator interface after the osmosis version bump.


Let me analyze the interface definition and implementation:

  1. The interface MsgSimulator in domain/cosmos/tx/msg_simulator.go requires:

    • BuildTx(ctx, keyring, encodingConfig, account, chainID, msg ...sdk.Msg)
    • SimulateMsgs(encodingConfig, account, chainID, msgs []sdk.Msg)
    • PriceMsgs(ctx, encodingConfig, account, chainID, msg ...sdk.Msg)
  2. The mock implementation has an issue in the PriceMsgs method:

    • Interface expects msg ...sdk.Msg
    • Mock implements msg ...interface{ ProtoMessage(); Reset(); String() string }

Let me verify if sdk.Msg is an interface with these methods:


Let me check the actual implementation of sdk.Msg interface:


Let me try a different approach to find the sdk.Msg interface:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the interface implementation and usage
# 1. Check the interface definition
# 2. Look for any callers of this mock

# Check the interface definition
ast-grep --pattern 'type MsgSimulator interface {
  $$$
}'

# Find usages of MsgSimulatorMock
rg "MsgSimulatorMock" -A 5

Length of output: 7916


Script:

#!/bin/bash
# Check sdk.Msg interface definition
ast-grep --pattern 'type Msg interface {
  $$$
}'

Length of output: 51


Script:

#!/bin/bash
# Let's try to find the sdk.Msg definition in vendor directory
fd -t f "types.go" -x grep -l "type Msg interface"

# Also check for any imports of sdk.Msg to understand its usage
rg "sdk \"github.com/cosmos/cosmos-sdk/types\"" -A 3

Length of output: 28951


Script:

#!/bin/bash
# Check vendor directory for sdk.Msg interface
fd -t f "types.go" -x cat {} | grep -A 10 "type Msg interface"

Length of output: 64


Script:

#!/bin/bash
# Look for sdk.Msg usage in the codebase to understand its interface
rg "implements sdk\.Msg" -B 2 -A 2

# Also check for any direct references to the interface methods
rg "ProtoMessage|Reset|String" --type go -C 2

Length of output: 69500

ingest/usecase/ingest_usecase.go (1)

Line range hint 408-413: Refactor duplicated code for obtaining pool denominations

The logic for retrieving pool denominations based on whether CosmWasmPoolModel is nil is duplicated in both filterExactMatchSearch and filterPartialMatchSearch functions. Consider abstracting this logic into a helper function to improve maintainability.

Also applies to: 442-447

pools/usecase/pools_usecase.go (1)

408-413: Refactor duplicated logic for retrieving pool denominations

The code for obtaining denoms based on the CosmWasmPoolModel check is duplicated in both filterExactMatchSearch and filterPartialMatchSearch. Refactoring this into a shared helper function can enhance code readability and maintainability.

Also applies to: 442-447

🛑 Comments failed to post (4)
.github/workflows/required-labels.yml (1)

7-7: ⚠️ Potential issue

Inconsistency between branch name and required label versions

The branch pattern has been updated to "v27.x", but the required label is "A:backport/v28.x". This version mismatch may cause confusion or enforce incorrect label requirements. Please verify that the branch patterns and required labels are consistent with the intended versioning strategy.

Also applies to: 29-29

domain/mocks/chain_pool_mock.go (1)

7-7: 💡 Codebase verification

Interface compatibility check failed after v28 update

The mock implementation is missing several required methods from the v28 PoolI interface:

  • GetPoolLiquidityCap()
  • GetUnderlyingPool()
  • GetSQSPoolModel()
  • GetTickModel()
  • GetLiquidityCap()
  • GetLiquidityCapError()
  • GetAPRData()
  • GetFeesData()
  • Incentive()
  • SetTickModel()
  • SetLiquidityCap()
  • SetLiquidityCapError()
  • SetAPRData()
  • SetFeesData()
  • Validate()

The mock needs to be updated to implement all methods from the v28 interface to maintain compatibility.

🔗 Analysis chain

LGTM! Verify interface compatibility after version bump.

The import path update from v27 to v28 is correct. The mock implementation remains unchanged and maintains the expected behavior.

Let's verify that the interface implementation is still compatible with v28:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that ChainPoolMock implements all required methods from poolmanagertypes.PoolI

# Search for the PoolI interface definition in v28
ast-grep --pattern 'type PoolI interface {
  $$$
}'

Length of output: 2976


Script:

#!/bin/bash
# Let's check the ChainPoolMock implementation to verify interface compatibility
ast-grep --pattern 'type ChainPoolMock struct {
  $$$
}

$$$'

# Also check for the interface compliance check
rg "var _ .* = &ChainPoolMock{}"

Length of output: 234


Script:

#!/bin/bash
# Let's check the ChainPoolMock implementation to verify interface compatibility
ast-grep --pattern 'type ChainPoolMock struct'

# Also check for the interface compliance check (fixing the regex)
rg "var _ \w+\.?\w*\s*=\s*&ChainPoolMock{}"

# Get the full mock implementation
rg -A 2 "func \(c \*ChainPoolMock\)"

Length of output: 2315


Script:

#!/bin/bash
# Let's check the full content of the mock file to see all implementations and the interface check
cat domain/mocks/chain_pool_mock.go

Length of output: 1732

router/usecase/pools/routable_stableswap_pool.go (1)

13-16: 💡 Codebase verification

Pool type implementation mismatch detected

The stableswap pool implementation incorrectly returns poolmanagertypes.Balancer type instead of the expected stableswap type. This appears to be a bug in the implementation as the pool type doesn't match the actual pool model being used.

  • router/usecase/pools/routable_stableswap_pool.go: The GetType() method returns poolmanagertypes.Balancer for a stableswap pool implementation.
🔗 Analysis chain

LGTM! Verify pool type constants compatibility

The import path updates from v27 to v28 are consistent across all Osmosis packages. Let's verify that the pool type constants haven't changed in v28 to ensure compatibility.


Let me try a different approach to verify the pool type constants.


Let me try one more search to find the pool type definitions and their usage.


Let me try one final search to locate the pool type definitions.


Based on the search results, I can see that pool types are defined in the interface and the changes are only import path updates. Let me verify the specific stableswap pool implementation.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any changes in pool type constants between v27 and v28
# Expected: Pool type constants should remain the same

echo "Checking pool type constants usage..."
ast-grep --pattern 'poolmanagertypes.Balancer' -l go

Length of output: 137


Script:

#!/bin/bash
# Search for pool type constant definitions and usages
echo "Searching for pool type constants in poolmanager types..."
rg -A 3 "const \(" router/usecase/pools/ x/poolmanager/types/

echo -e "\nSearching for stableswap pool type usage..."
rg "StableSwap" router/usecase/pools/routable_stableswap_pool.go

Length of output: 1888


Script:

#!/bin/bash
# Search for pool type definitions and their usage in the domain and types
echo "Searching for pool type definitions..."
rg -A 5 "type PoolType" router/domain/

echo -e "\nSearching for pool type usage in stableswap pool..."
ast-grep --pattern 'type RoutableStableSwapPool struct' router/usecase/pools/routable_stableswap_pool.go

Length of output: 408


Script:

#!/bin/bash
# Search for pool type definitions and their usage
echo "Searching for pool type definitions in the codebase..."
rg -A 5 "type Pool" --type go

echo -e "\nSearching for stableswap pool implementation..."
rg -A 10 "RoutableStableSwapPool" --type go

Length of output: 13126


Script:

#!/bin/bash
# Check the stableswap pool implementation and its dependencies
echo "Checking stableswap pool implementation..."
rg -l "stableswap" --type go

echo -e "\nChecking pool type usage in stableswap pool..."
rg -A 5 "func.*GetType\(\)" router/usecase/pools/routable_stableswap_pool.go

Length of output: 890

go.mod (1)

3-5: ⚠️ Potential issue

Verify Go version and toolchain compatibility

The Go version (1.22.7) and toolchain (1.23.3) configuration appears unusual:

  1. The toolchain version (1.23.3) is higher than the Go version (1.22.7)
  2. Go 1.23 is not yet released (as of December 2024)

Consider using a matching toolchain version or remove the toolchain directive if not needed.

@pablin-10 pablin-10 merged commit 361febf into v28.x Dec 5, 2024
10 checks passed
@pablin-10 pablin-10 deleted the bump_golang_linter_version branch December 5, 2024 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants