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

refactor(client/v2): remove gov dependency #22867

Merged
merged 2 commits into from
Dec 13, 2024
Merged

refactor(client/v2): remove gov dependency #22867

merged 2 commits into from
Dec 13, 2024

Conversation

julienrbrt
Copy link
Member

@julienrbrt julienrbrt commented Dec 13, 2024

Description

Closes: #22865


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title, you can find examples of the prefixes below:
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

Summary by CodeRabbit

  • New Features
    • Introduced a new governance module for handling governance proposals, including command flags for deposits, metadata, titles, summaries, and expedited processing.
  • Bug Fixes
    • Updated dependencies to the latest versions, which may include bug fixes and enhancements.
  • Chores
    • Removed outdated governance dependencies and streamlined the module's dependency management across various components.

@julienrbrt julienrbrt requested review from a team and JulianToledano as code owners December 13, 2024 15:44
Copy link
Contributor

coderabbitai bot commented Dec 13, 2024

📝 Walkthrough

Walkthrough

The pull request introduces significant updates to the governance handling in the Cosmos SDK by replacing the old governance client and types with a new governance module. The changes primarily affect the client/v2/autocli/msg.go file, which now utilizes the new governance module for command execution related to governance proposals. Additionally, the go.mod files across various modules have been updated to reflect the removal of the old governance dependency and the introduction of new dependencies, particularly for the governance module.

Changes

File Change Summary
client/v2/autocli/msg.go Replaced old governance client references with new governance module calls for handling proposals.
client/v2/go.mod Removed dependency on cosmossdk.io/x/gov and updated cosmossdk.io/x/tx version to v1.0.0-alpha.3.
client/v2/internal/governance/gov.go Introduced new governance module functionalities, including command flag handling and message construction.
simapp/go.mod Updated cosmossdk.io/x/tx version to v1.0.0-alpha.3.
simapp/v2/go.mod Updated cosmossdk.io/x/tx version to v1.0.0-alpha.3 and added cosmossdk.io/indexer/postgres.
tests/go.mod Updated cosmossdk.io/x/tx version to v1.0.0-alpha.3.
x/feegrant/go.mod Updated cosmossdk.io/x/tx version to v1.0.0-alpha.3.
x/gov/go.mod Updated cosmossdk.io/x/tx version to v1.0.0-alpha.3.
x/group/go.mod Updated cosmossdk.io/x/tx version to v1.0.0-alpha.3 and added new indirect dependencies.
x/params/go.mod Updated cosmossdk.io/x/tx version to v1.0.0-alpha.3.
x/upgrade/go.mod Updated cosmossdk.io/x/tx version to v1.0.0-alpha.3.

Assessment against linked issues

Objective Addressed Explanation
Remove circular dependency between client/v2 and x/gov (#22865)

Possibly related issues

Possibly related PRs

Suggested labels

C:x/accounts, C:x/tx, C:core/testing, backport/v0.52.x

Suggested reviewers

  • sontrinh16
  • kocubinski
  • hieuvubk

📜 Recent review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 957e241 and 4761a91.

⛔ Files ignored due to path filters (9)
  • client/v2/go.sum is excluded by !**/*.sum
  • simapp/go.sum is excluded by !**/*.sum
  • simapp/v2/go.sum is excluded by !**/*.sum
  • tests/go.sum is excluded by !**/*.sum
  • x/feegrant/go.sum is excluded by !**/*.sum
  • x/gov/go.sum is excluded by !**/*.sum
  • x/group/go.sum is excluded by !**/*.sum
  • x/params/go.sum is excluded by !**/*.sum
  • x/upgrade/go.sum is excluded by !**/*.sum
📒 Files selected for processing (11)
  • client/v2/autocli/msg.go (5 hunks)
  • client/v2/go.mod (1 hunks)
  • client/v2/internal/governance/gov.go (1 hunks)
  • simapp/go.mod (1 hunks)
  • simapp/v2/go.mod (1 hunks)
  • tests/go.mod (1 hunks)
  • x/feegrant/go.mod (1 hunks)
  • x/gov/go.mod (1 hunks)
  • x/group/go.mod (1 hunks)
  • x/params/go.mod (1 hunks)
  • x/upgrade/go.mod (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • tests/go.mod
  • x/params/go.mod
  • simapp/go.mod
🧰 Additional context used
📓 Path-based instructions (2)
client/v2/internal/governance/gov.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

client/v2/autocli/msg.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

🔇 Additional comments (14)
client/v2/internal/governance/gov.go (3)

28-35: Function AddGovPropFlagsToCmd is well-implemented

This function correctly adds governance proposal flags to the Cobra command, following best practices.


37-79: Function ReadGovPropCmdFlags handles flags appropriately

The function effectively reads command-line flags, initializes the MsgSubmitProposal structure properly, and includes comprehensive error handling.


81-99: Function SetGovMsgs correctly appends messages to the proposal

This function properly checks for empty message lists, wraps messages in protobuf Any types, and appends them to the proposal's messages.

client/v2/go.mod (1)

10-10: Dependency updated to cosmossdk.io/x/tx v1.0.0-alpha.3

The module dependency has been appropriately updated to the latest version, ensuring compatibility and leveraging new features.

x/gov/go.mod (1)

40-40: Updated indirect dependency to cosmossdk.io/x/tx v1.0.0-alpha.3

Consistently updating the cosmossdk.io/x/tx dependency aligns the module with the rest of the codebase.

x/feegrant/go.mod (1)

44-44: Updated indirect dependency to cosmossdk.io/x/tx v1.0.0-alpha.3

The dependency update ensures that x/feegrant is using the latest transaction module version, promoting consistency and stability.

client/v2/autocli/msg.go (4)

16-16: LGTM: Clean governance dependency removal

The addition of the internal governance package aligns with the PR objective of removing the external gov dependency.


187-189: LGTM: Governance flag handling refactored

The governance proposal flag handling has been cleanly migrated to use the internal governance package.


Line range hint 202-208: LGTM: Module address handling updated

The governance module address handling has been updated to use the new internal governance package while maintaining the same functionality.


Line range hint 215-228: LGTM: Proposal handling refactored

The governance proposal handling has been successfully migrated to use the internal governance package's functions.

x/upgrade/go.mod (1)

49-49: LGTM: Routine dependency update

The update of cosmossdk.io/x/tx to v1.0.0-alpha.3 is consistent with version updates across other modules.

simapp/v2/go.mod (2)

71-71: Verify breaking changes in tx module update

The update of cosmossdk.io/x/tx to v1.0.0-alpha.3 might introduce breaking changes. Let's verify the changelog and usage.

✅ Verification successful

Update to tx v1.0.0-alpha.3 is safe to proceed

The changelog shows this is a bug fix release that addresses placeholder descriptor resolution (PR #22852). No breaking changes are introduced in this version. The update from v1.0.0-alpha.2 to v1.0.0-alpha.3 only includes a bug fix that improves the module's functionality.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for breaking changes in tx module update

# Check for usage of potentially changed APIs
rg -A 5 "cosmossdk.io/x/tx"

# Check git history for breaking changes
gh api graphql -f query='
{
  repository(owner: "cosmos", name: "cosmos-sdk") {
    object(expression: "main") {
      ... on Commit {
        history(first: 10, path: "x/tx") {
          nodes {
            messageHeadline
            oid
          }
        }
      }
    }
  }
}'

Length of output: 66492


Script:

#!/bin/bash
# Let's check for breaking changes in tx module by looking at the changelog and commit history

# Check for CHANGELOG.md in the tx module
rg -A 10 "v1.0.0-alpha.3" x/tx/CHANGELOG.md

# Check for any breaking changes in the tx module implementation
ast-grep --pattern $'func \$_($$$) {
  $$$
}' x/tx/signing/handler.go

# Check for any API changes in the tx module
ast-grep --pattern $'type $_ interface {
  $$$
}' x/tx/signing/handler.go

Length of output: 869


Line range hint 48-48: Verify security implications of postgres indexer

The addition of cosmossdk.io/indexer/postgres dependency needs security verification.

✅ Verification successful

PostgreSQL indexer security implications verified

Based on the analysis of the codebase:

  • The PostgreSQL indexer is properly implemented using the official pgx driver with standard security practices
  • Database connections are handled through Go's standard database/sql interface with proper connection pooling
  • No raw SQL queries or unsafe query construction patterns were found
  • Configuration is done via standard connection URL format with proper parameter handling
  • The implementation follows the documented architecture design (ADR-073)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for security advisories and version information

# Check for security advisories
gh api graphql -f query='
{
  securityVulnerabilities(first: 5, ecosystem: GO, package: "cosmossdk.io/indexer/postgres") {
    nodes {
      advisory {
        summary
        severity
        publishedAt
      }
      vulnerableVersionRange
      firstPatchedVersion {
        identifier
      }
    }
  }
}'

# Check usage patterns for potential security concerns
rg -p "indexer\.New|indexer\.Connect" 

Length of output: 400


Script:

#!/bin/bash
# Let's check for any direct usage of postgres indexer and its configuration
rg -p "postgres.*indexer|indexer.*postgres" -A 3

# Check for any SQL-related patterns that might indicate security concerns
rg -p "sql\.Open|database/sql|sqlx|pgx" -A 2

# Check go.mod for the exact version being used
grep -A 3 "cosmossdk.io/indexer/postgres" simapp/v2/go.mod

# Look for any indexer configuration files or setup
fd -e yaml -e toml -e json -x grep -l "indexer|postgres"

Length of output: 102156

x/group/go.mod (1)

43-43: Verify compatibility with tx module alpha.3

The update to cosmossdk.io/x/tx v1.0.0-alpha.3 is part of a coordinated update across multiple modules. Since this is an alpha version, please ensure:

  1. All dependent modules are compatible with this version
  2. No breaking changes are introduced
✅ Verification successful

Let me analyze the usage of the tx module to verify compatibility. I'll generate additional scripts to check for any breaking changes or compatibility issues.


Based on the analysis of the tx module dependencies and versions, I can now provide a final response:

The update to tx module v1.0.0-alpha.3 is part of a coordinated upgrade

The change is compatible as part of a coordinated update across modules:

  • Several modules have already been updated to v1.0.0-alpha.3:

    • x/group
    • x/feegrant
    • x/gov
    • x/params
    • x/upgrade
    • client/v2
    • simapp
    • tests
  • Other modules are still on v1.0.0-alpha.2 and will need coordinated updates:

    • x/nft
    • x/accounts
    • x/slashing
    • x/staking
    • x/mint
    • x/bank
    • x/evidence
    • x/epochs

No breaking changes or compatibility issues were found in the codebase. The upgrade appears to be part of a planned coordinated update across modules.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for tx module usage and potential incompatibilities

# Search for tx module usage
echo "Checking for tx module usage..."
rg -l 'cosmossdk\.io/x/tx'

# Look for any TODO or FIXME comments related to tx module
echo "Checking for potential compatibility issues..."
rg -i "todo.*tx|fixme.*tx"

Length of output: 70835


Script:

#!/bin/bash
# Check for tx module version references and dependencies
echo "Checking tx module version references..."
rg -A 2 'cosmossdk\.io/x/tx.*v1\.0\.0-alpha' 

# Check for any recent changes or fixes related to tx module
echo "Checking for recent changes related to tx module..."
rg -B 2 -A 2 'tx.*breaking|tx.*compatibility|tx.*upgrade'

# Check go.mod files for tx module dependencies
echo "Checking go.mod files for tx module dependencies..."
find . -name "go.mod" -exec sh -c 'echo "=== {} ==="; grep "cosmossdk.io/x/tx" {}' \;

Length of output: 69010


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 generate docstrings to generate docstrings for this PR. (Experiment)
  • @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.

@julienrbrt julienrbrt marked this pull request as ready for review December 13, 2024 15:51
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.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (3)
client/v2/internal/governance/gov.go (3)

17-17: Typo in comment: redundant wording

The comment on line 17~ states, "ModuleName is the name of the governance module name." This wording is redundant. Consider rephrasing it to "ModuleName is the name of the governance module."


72-72: Avoid disabling linters with //nolint directive

On line 72~, the //nolint:staticcheck directive is used to set the deprecated field rv.Expedited. Disabling linters can hide potential issues. Consider refactoring the code to handle compatibility without suppressing lint warnings. If setting rv.Expedited is necessary for backward compatibility, ensure it's clearly documented and justified.


83-83: Improve error message clarity

The error message on line 83~ reads "zero messages is not supported." For better clarity, consider rephrasing it to "at least one message must be provided" or "no messages were provided; at least one message is required."

📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 957e241 and 4761a91.

⛔ Files ignored due to path filters (9)
  • client/v2/go.sum is excluded by !**/*.sum
  • simapp/go.sum is excluded by !**/*.sum
  • simapp/v2/go.sum is excluded by !**/*.sum
  • tests/go.sum is excluded by !**/*.sum
  • x/feegrant/go.sum is excluded by !**/*.sum
  • x/gov/go.sum is excluded by !**/*.sum
  • x/group/go.sum is excluded by !**/*.sum
  • x/params/go.sum is excluded by !**/*.sum
  • x/upgrade/go.sum is excluded by !**/*.sum
📒 Files selected for processing (11)
  • client/v2/autocli/msg.go (5 hunks)
  • client/v2/go.mod (1 hunks)
  • client/v2/internal/governance/gov.go (1 hunks)
  • simapp/go.mod (1 hunks)
  • simapp/v2/go.mod (1 hunks)
  • tests/go.mod (1 hunks)
  • x/feegrant/go.mod (1 hunks)
  • x/gov/go.mod (1 hunks)
  • x/group/go.mod (1 hunks)
  • x/params/go.mod (1 hunks)
  • x/upgrade/go.mod (1 hunks)
✅ Files skipped from review due to trivial changes (4)
  • tests/go.mod
  • x/upgrade/go.mod
  • x/params/go.mod
  • x/gov/go.mod
🧰 Additional context used
📓 Path-based instructions (2)
client/v2/internal/governance/gov.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

client/v2/autocli/msg.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

🔇 Additional comments (10)
client/v2/autocli/msg.go (5)

16-16: Import updated to use new governance package

The import statement on line 16~ correctly updates to the new governance package cosmossdk.io/client/v2/internal/governance, aligning with the refactoring efforts to remove the dependency on the old governance module.


187-188: Correctly adding governance proposal flags

The function governance.AddGovPropFlagsToCmd(cmd) is appropriately used on line 187~ to add governance proposal flags to the command. The addition of the --no-proposal flag enhances command flexibility.


215-217: Using updated function to read governance proposal flags

The change to use governance.ReadGovPropCmdFlags on line 215~ reflects the update to the new governance package. The implementation is correct and maintains proper error handling.


226-228: Setting messages in proposal using new governance function

On lines 226~ to 228~, governance.SetGovMsgs is correctly used to include messages in the proposal. Error handling is appropriately implemented.


Line range hint 202-206: Verify that governance.ModuleName matches the expected module name

In lines 202~ to 206~, the authority is set using governance.ModuleName. Ensure that governance.ModuleName matches the expected module name to prevent authorization issues.

Run the following script to confirm that ModuleName is consistently defined as "gov":

✅ Verification successful

Let's also check the actual import statement in the file under review:

And let's verify if there are any other governance-related constants:


Based on the search results, I can see that governance.ModuleName is consistently defined as "gov" across the codebase, particularly in the governance module itself (x/gov/types/keys.go) and in the client package being used (client/v2/internal/governance/gov.go). The usage in the code under review is correct as it matches this expected value.

The authority is correctly set using the governance module name "gov"

The code is using the correct module name constant for setting up the governance authority. This is consistent with:

  1. The core governance module definition where ModuleName = "gov"
  2. The client-side governance package where ModuleName = "gov"
  3. The widespread usage across other modules that reference governance using this same value
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that ModuleName is defined as "gov" throughout the codebase.

# Expected result: All definitions of ModuleName should assign it the value "gov".

# Search for ModuleName definitions
rg --type go 'const\s+ModuleName\s*=\s*"gov"' --ignore-file .gitignore

Length of output: 72


Script:

#!/bin/bash
# Let's try a broader search for ModuleName in governance-related files
rg --type go "ModuleName.*=.*" -A 2 -B 2

# Also search specifically for governance package declarations and imports
rg --type go "package governance|\".*governance\""

Length of output: 69989


Script:

#!/bin/bash
# Check the imports in the file under review
cat client/v2/autocli/msg.go | grep -A 20 "^import"

Length of output: 670


Script:

#!/bin/bash
# Search for governance-related constants
rg --type go "governance" -A 2 -B 2

Length of output: 69092

client/v2/go.mod (1)

10-10: Verify compatibility with updated cosmossdk.io/x/tx module

The dependency cosmossdk.io/x/tx has been updated to version v1.0.0-alpha.3. Ensure that this version is compatible with the current codebase and address any breaking changes.

x/feegrant/go.mod (1)

44-44: Verify compatibility with updated cosmossdk.io/x/tx module (indirect dependency)

The indirect dependency cosmossdk.io/x/tx has been updated to version v1.0.0-alpha.3. Confirm that this new version does not introduce incompatibilities or unexpected behaviors in the feegrant module.

x/group/go.mod (1)

43-43: Dependency version update looks good

The update of cosmossdk.io/x/tx to v1.0.0-alpha.3 is consistent across the codebase and aligns with the PR objective.

Let's verify the compatibility of this version:

✅ Verification successful

Dependency update to cosmossdk.io/x/tx v1.0.0-alpha.3 is consistent with other modules

The verification shows that multiple modules in the codebase are already using or being updated to use cosmossdk.io/x/tx v1.0.0-alpha.3. The update is part of a coordinated dependency upgrade across the codebase, and there are no reported issues for this version.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any breaking changes or issues with the new tx module version

# Check for any issues reported for this version
gh api graphql -f query='
{
  repository(owner: "cosmos", name: "cosmos-sdk") {
    issues(first: 5, filterBy: {labels: ["x/tx"], states: OPEN}) {
      nodes {
        title
        body
        createdAt
      }
    }
  }
}'

Length of output: 276


Script:

#!/bin/bash
# Let's verify if this version is consistently used across the codebase
rg "cosmossdk.io/x/tx" -A 1 -B 1 --type go

# Also check go.mod files specifically
fd "go.mod$" --exec grep -A 1 -B 1 "cosmossdk.io/x/tx" {}

Length of output: 24242

simapp/go.mod (1)

35-35: Dependency version update is consistent

The update of cosmossdk.io/x/tx to v1.0.0-alpha.3 matches the version update in other modules.

simapp/v2/go.mod (1)

71-71: Dependency version update maintains consistency

The update of cosmossdk.io/x/tx to v1.0.0-alpha.3 is consistent with other modules, maintaining version alignment across the codebase.

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.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (5)
client/v2/internal/governance/gov.go (3)

39-39: Use a more descriptive variable name instead of 'rv'

The variable name rv is not descriptive. Consider renaming it to proposal or msgSubmitProposal for better readability.


72-72: Clarify the use of //nolint:staticcheck directive

The //nolint:staticcheck comment suppresses static analysis warnings. Ensure that this suppression is necessary and consider adding more context to the comment for future maintainers.


81-99: Handle potential errors when appending messages to the proposal

The function SetGovMsgs appends messages to the proposal but does not check for potential errors during the append operation. Although unlikely, consider handling any unexpected issues that may arise.

client/v2/autocli/msg.go (2)

16-16: Organize import statements according to Go conventions

Ensure that import groups are properly separated with blank lines: standard library imports, third-party imports, and local package imports.

Apply this change:

 import (
+	"bufio"
+	"context"
+	"fmt"
+
 	"github.com/spf13/cobra"
 	"google.golang.org/protobuf/proto"
 	"google.golang.org/protobuf/reflect/protoreflect"
 	"google.golang.org/protobuf/types/dynamicpb"
+
+	autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
+	"cosmossdk.io/client/v2/autocli/flag"
+	"cosmossdk.io/client/v2/internal/flags"
+	"cosmossdk.io/client/v2/internal/governance"
+	"cosmossdk.io/client/v2/internal/print"
+	"cosmossdk.io/client/v2/internal/util"
+	v2tx "cosmossdk.io/client/v2/tx"
+	addresscodec "cosmossdk.io/core/address"
+	"cosmossdk.io/core/transaction"
+
+	authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
+
+	"github.com/cosmos/cosmos-sdk/client"
+	"github.com/cosmos/cosmos-sdk/client/input"
+	clienttx "github.com/cosmos/cosmos-sdk/client/tx"
 )

226-228: Include a colon before %w when wrapping errors

The error message should include a colon before %w to properly format the wrapped error.

Apply this change:

 if err := governance.SetGovMsgs(proposal, msg); err != nil {
-	return fmt.Errorf("failed to set msg in proposal %w", err)
+	return fmt.Errorf("failed to set msg in proposal: %w", err)
 }
📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 957e241 and 4761a91.

⛔ Files ignored due to path filters (9)
  • client/v2/go.sum is excluded by !**/*.sum
  • simapp/go.sum is excluded by !**/*.sum
  • simapp/v2/go.sum is excluded by !**/*.sum
  • tests/go.sum is excluded by !**/*.sum
  • x/feegrant/go.sum is excluded by !**/*.sum
  • x/gov/go.sum is excluded by !**/*.sum
  • x/group/go.sum is excluded by !**/*.sum
  • x/params/go.sum is excluded by !**/*.sum
  • x/upgrade/go.sum is excluded by !**/*.sum
📒 Files selected for processing (11)
  • client/v2/autocli/msg.go (5 hunks)
  • client/v2/go.mod (1 hunks)
  • client/v2/internal/governance/gov.go (1 hunks)
  • simapp/go.mod (1 hunks)
  • simapp/v2/go.mod (1 hunks)
  • tests/go.mod (1 hunks)
  • x/feegrant/go.mod (1 hunks)
  • x/gov/go.mod (1 hunks)
  • x/group/go.mod (1 hunks)
  • x/params/go.mod (1 hunks)
  • x/upgrade/go.mod (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • x/group/go.mod
  • x/feegrant/go.mod
🧰 Additional context used
📓 Path-based instructions (3)
tests/go.mod (1)

Pattern tests/**/*: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"

client/v2/internal/governance/gov.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

client/v2/autocli/msg.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

🔇 Additional comments (7)
x/params/go.mod (1)

33-33: Verify compatibility with updated dependency cosmossdk.io/x/tx v1.0.0-alpha.3

Ensure that the update to cosmossdk.io/x/tx v1.0.0-alpha.3 does not introduce any breaking changes or compatibility issues with the x/params module.

client/v2/go.mod (1)

10-10: Verify compatibility with updated dependency cosmossdk.io/x/tx v1.0.0-alpha.3

Ensure that updating to cosmossdk.io/x/tx v1.0.0-alpha.3 does not cause any compatibility issues within the client/v2 module.

x/gov/go.mod (1)

40-40: LGTM: Version update is consistent

The update of cosmossdk.io/x/tx to v1.0.0-alpha.3 aligns with the PR objectives and maintains consistency across modules.

x/upgrade/go.mod (1)

49-49: LGTM: Version update is consistent

The update of cosmossdk.io/x/tx to v1.0.0-alpha.3 maintains version consistency with other modules.

tests/go.mod (1)

18-18: LGTM: Version update is consistent

The update of cosmossdk.io/x/tx to v1.0.0-alpha.3 maintains version consistency across all modules and test dependencies.

simapp/go.mod (1)

35-35: Verify the tx module version compatibility

The addition of cosmossdk.io/x/tx v1.0.0-alpha.3 as an indirect dependency needs careful consideration since it's an alpha version.

✅ Verification successful

The tx module version is compatible and safely used

The cosmossdk.io/x/tx v1.0.0-alpha.3 dependency is appropriately used in the codebase:

  • It's used consistently across multiple core modules (auth, accounts, codec, etc.) for transaction handling and signing
  • The module is used for essential functionality like transaction decoding, signing, and textual representation
  • Other modules in the codebase are already using this version or compatible alpha versions
  • The indirect tag is correct as it's pulled in through other direct dependencies
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any breaking changes or compatibility issues with the tx module

# Check if any other modules directly depend on the tx module
rg --type go "\"cosmossdk.io/x/tx\"" -l

# Check the changelog or release notes for the tx module
gh api repos/cosmos/cosmos-sdk/releases | jq -r '.[] | select(.tag_name | contains("tx/v1.0.0-alpha")) | {tag: .tag_name, body: .body}'

Length of output: 177


Script:

#!/bin/bash
# Let's try a different approach to verify the tx module usage and dependencies

# Check for any direct imports of the tx module in Go files
rg --type go "cosmossdk.io/x/tx" -A 2

# Check go.mod for any other references to the tx module
cat simapp/go.mod

# Check if there are any other go.mod files that might reference this module
fd go.mod --exec cat {}

Length of output: 70333

simapp/v2/go.mod (1)

71-71: LGTM: Consistent tx module version

The tx module version matches the one in simapp/go.mod, maintaining consistency across both simapp versions.

@julienrbrt julienrbrt added the backport/v0.52.x PR scheduled for inclusion in the v0.52's next stable release label Dec 13, 2024
@julienrbrt julienrbrt added this pull request to the merge queue Dec 13, 2024
Merged via the queue into main with commit 256ec4f Dec 13, 2024
88 of 90 checks passed
@julienrbrt julienrbrt deleted the julien/del-gov branch December 13, 2024 16:53
mergify bot pushed a commit that referenced this pull request Dec 13, 2024
(cherry picked from commit 256ec4f)

# Conflicts:
#	client/v2/go.mod
#	client/v2/go.sum
#	simapp/go.mod
#	simapp/go.sum
#	simapp/v2/go.mod
#	simapp/v2/go.sum
#	tests/go.sum
#	x/feegrant/go.mod
#	x/feegrant/go.sum
#	x/gov/go.sum
#	x/group/go.mod
#	x/group/go.sum
#	x/params/go.mod
#	x/params/go.sum
#	x/upgrade/go.mod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/v0.52.x PR scheduled for inclusion in the v0.52's next stable release C:CLI C:x/feegrant C:x/gov C:x/group C:x/params C:x/upgrade
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove circular dep between client/v2 and x/gov
3 participants