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

chore: upgrade cosmos-sdk to v0.47.14 #135

Merged
merged 3 commits into from
Oct 10, 2024
Merged

Conversation

gartnera
Copy link
Member

@gartnera gartnera commented Oct 8, 2024

Upgrade cosmos-sdk to match node version.

zeta-chain/node#2980

Related to #86

Summary by CodeRabbit

  • New Features

    • Added new modules for enhanced functionality, including github.com/sagikazarmark/locafero and github.com/sagikazarmark/slog-shim.
    • Introduced instrumentation modules for OpenTelemetry support.
  • Dependency Updates

    • Updated numerous dependencies to their latest versions, improving performance and security, including cloud.google.com/go, github.com/btcsuite/btcd, and google.golang.org/grpc.
  • Bug Fixes

    • Removed outdated dependencies related to OpenTelemetry to streamline functionality.

@gartnera gartnera requested a review from a team October 8, 2024 16:38
@gartnera gartnera marked this pull request as ready for review October 8, 2024 16:38
Copy link

coderabbitai bot commented Oct 8, 2024

📝 Walkthrough

Walkthrough

The changes in this pull request involve significant updates to the go.mod and gomod2nix.toml files, focusing on the modification of dependency versions. Numerous dependencies have been updated to their latest versions, some new modules have been added, and a few dependencies have been removed or downgraded. These updates reflect the ongoing maintenance of the project to ensure compatibility and potentially enhance functionality.

Changes

File Change Summary
go.mod - Updated multiple dependencies to newer versions, including github.com/btcsuite/btcd from v0.23.4 to v0.24.2, cloud.google.com/go from v0.111.0 to v0.112.0, and many others.
- Added new modules: github.com/sagikazarmark/locafero (v0.4.0), github.com/sagikazarmark/slog-shim (v0.1.0), and OpenTelemetry instrumentation modules.
- Removed several OpenTelemetry dependencies.
gomod2nix.toml - Updated module versions and hashes, including cloud.google.com/go from v0.111.0 to v0.112.0 and google.golang.org/api from v0.149.0 to v0.155.0.
- Added new modules: github.com/sagikazarmark/locafero (v0.4.0) and go.opentelemetry.io/contrib/instrumentation/... (v0.46.1).
- Downgraded golang.org/x/exp from v0.0.0-20230711153332-06a737ee72cb to v0.0.0-20230905200255-921286631fa9.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant GoModule
    participant DependencyManager

    Developer->>GoModule: Update dependencies
    GoModule->>DependencyManager: Request version updates
    DependencyManager->>GoModule: Provide latest versions
    GoModule->>GoModule: Update go.mod and gomod2nix.toml
    GoModule->>Developer: Notify completion of updates
Loading

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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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

@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: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between f34e2a4 and 19679a0.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (2)
  • go.mod (9 hunks)
  • gomod2nix.toml (15 hunks)
🧰 Additional context used
🔇 Additional comments (9)
gomod2nix.toml (4)

Line range hint 1-638: Ensure comprehensive testing for multiple dependency updates.

This update includes changes to numerous dependencies simultaneously. While keeping dependencies up-to-date is crucial for security and performance, updating multiple dependencies at once can potentially lead to compatibility issues.

Please ensure that:

  1. Comprehensive integration tests have been run to verify the compatibility between all updated modules.
  2. The project's core functionality remains intact after these updates.
  3. Any new features or changes introduced by these updates are properly utilized and documented.

For future updates, consider adopting a more gradual approach:

  • Update dependencies in smaller batches or individually.
  • Thoroughly test each update before moving on to the next.
  • Maintain a changelog documenting the reasons for each update and any required code changes.

To verify the overall health of the project after these updates, please run the following script:

#!/bin/bash
# Description: Perform a comprehensive check of the project's health after dependency updates.

# Test: Ensure all dependencies are properly vendored or downloaded
go mod tidy
go mod verify

# Test: Compile the entire project
go build ./...

# Test: Run all tests
go test ./...

# Test: Run any integration or end-to-end tests
# Uncomment and adjust the following line according to your project's setup
# go test ./... -tags=integration

# Test: Check for any new linting issues
# Assuming you're using golangci-lint; adjust if using a different linter
golangci-lint run

Line range hint 1-638: Implement a robust dependency management strategy.

The gomod2nix.toml file demonstrates a commendable practice of specifying exact versions and hashes for dependencies. To further enhance your dependency management, consider implementing the following strategies:

  1. Regular Dependency Audits:

    • Schedule periodic reviews of all dependencies.
    • Check for newer versions, especially those containing security patches.
    • Evaluate the need for each dependency and remove any that are no longer necessary.
  2. Automated Dependency Updates:

    • Implement a tool like Dependabot or Renovate to automatically create pull requests for dependency updates.
    • Configure the tool to create separate pull requests for each dependency to simplify review and reduce the risk of conflicts.
  3. Security Scanning:

    • Integrate a security scanning tool (e.g., Snyk, OWASP Dependency-Check) into your CI/CD pipeline.
    • Regularly scan dependencies for known vulnerabilities.
  4. Dependency Pinning:

    • Continue the practice of pinning dependencies to specific versions.
    • Consider using a checksum verification tool to ensure the integrity of downloaded dependencies.
  5. Documentation:

    • Maintain a changelog or document explaining the reason for each dependency and any specific version requirements.
    • Document the process for updating dependencies, including any necessary compatibility checks or code changes.

By implementing these strategies, you can maintain a more secure, up-to-date, and manageable dependency tree for your project.

To assist in implementing these strategies, consider running the following script periodically:

#!/bin/bash
# Description: Perform a basic dependency health check.

echo "Checking for outdated dependencies:"
go list -u -m all | grep '\['

echo "\nChecking for known vulnerabilities (requires govulncheck):"
govulncheck ./...

echo "\nGenerating dependency graph (requires golang-deps-graph):"
golang-deps-graph -horizontal > dependency_graph.svg

echo "\nDependency health check complete. Please review the results and update dependencies as necessary."

471-472: Justify the inclusion of new modules.

The following new modules have been added to the project:

  • github.com/sagikazarmark/locafero v0.4.0
  • github.com/sagikazarmark/slog-shim v0.1.0
  • go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1
  • go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1

Please provide justification for the inclusion of these new modules:

  1. What functionality do they add to the project?
  2. Are they replacing any existing modules or introducing new features?
  3. Have they been thoroughly vetted for security and compatibility with the existing codebase?

To verify the usage of these new modules, please run the following script:

#!/bin/bash
# Description: Check for the usage of newly added modules in the codebase.

# Test: Search for import statements of the new modules
echo "Searching for usage of new modules:"
grep -R --include="*.go" "github.com/sagikazarmark/locafero" .
grep -R --include="*.go" "github.com/sagikazarmark/slog-shim" .
grep -R --include="*.go" "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" .
grep -R --include="*.go" "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" .

Also applies to: 474-475, 558-560, 561-563


583-584: Explain the rationale for version downgrade.

The golang.org/x/exp module has been downgraded from v0.0.0-20230711153332-06a737ee72cb to v0.0.0-20230905200255-921286631fa9.

Please provide an explanation for this downgrade:

  1. What issues, if any, were encountered with the previous version?
  2. How does this downgrade affect the project's functionality?
  3. Have you thoroughly tested the codebase with this older version to ensure no regressions?

To verify the impact of this downgrade, please run the following script:

go.mod (5)

182-182: Validate File System Operations with Updated afero Library

The github.com/spf13/afero library has been updated to v1.11.0 (line 182). Verify that all file system abstractions and operations using afero are functioning correctly with the new version.

To check the usage of afero in the codebase, run:

#!/bin/bash
# Description: Identify and review `afero` usage.

# Search for `afero` function calls.
rg --type go 'afero\.\w+' -A 5

11-22: Ensure Compatibility with Updated Dependencies

The updates to multiple dependencies (lines 11-22, 32-44) may introduce breaking changes or deprecations. It is imperative to verify that the codebase remains compatible with these new versions and to update any affected code accordingly.

Please run the following script to identify potential issues arising from the updated dependencies:

Also applies to: 32-44

✅ Verification successful

Action Required: Correct and Re-execute the Verification Script

The initial script encountered a syntax error, preventing it from running successfully. Please use the corrected script below to verify compatibility with the updated dependencies:

[/run_scripts]


Verification Successful: No Deprecated or Obsolete APIs Detected

The updated dependencies do not introduce any deprecated or obsolete APIs in the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for deprecated functions or breaking changes due to updated dependencies.

# List of updated dependencies
dependencies=(
    "github.com/btcsuite/btcd"
    "github.com/cosmos/cosmos-sdk"
    "github.com/cosmos/gogoproto"
    "github.com/golang/protobuf"
    "github.com/spf13/cast"
    "github.com/spf13/cobra"
    "github.com/spf13/viper"
    "google.golang.org/grpc"
)

# Search for deprecated or changed APIs in the codebase
for dep in "${dependencies[@]}"; do
    echo "Checking for deprecated or changed APIs in $dep..."
    rg --type go --no-filename --no-heading --color never "$dep" -A 5 | grep -E 'Deprecated|deprecated|obsolete'
done

Length of output: 126


Script:

#!/bin/bash
# Description: Check for deprecated functions or breaking changes due to updated dependencies.

# List of updated dependencies
dependencies=(
    "github.com/btcsuite/btcd"
    "github.com/cosmos/cosmos-sdk"
    "github.com/cosmos/gogoproto"
    "github.com/golang/protobuf"
    "github.com/spf13/cast"
    "github.com/spf13/cobra"
    "github.com/spf13/viper"
    "google.golang.org/grpc"
)

# Search for deprecated or changed APIs in the codebase
for dep in "${dependencies[@]}"; do
    echo "Checking for deprecated or changed APIs in $dep..."
    rg --type go --no-filename --no-heading --color never "$dep" -A 5 | grep -E 'Deprecated|deprecated|obsolete'
done

Length of output: 2744


185-185: Review Changes in gotenv Version Update

The github.com/subosito/gotenv package has been updated to v1.6.0 (line 185). Ensure that any changes in the package's API or behavior are compatible with existing environment variable management in the codebase.

To verify the usage of gotenv, execute:

✅ Verification successful

Action Required: Correct and Re-execute the Verification Script

The previous script encountered a syntax error, preventing successful verification of gotenv usage. Please execute the following corrected script to ensure accurate analysis:


Action Required: Conduct Comprehensive Verification of gotenv Imports and Dependencies

To ensure all usages of github.com/subosito/gotenv are accounted for, please execute the following scripts:


Verification Successful: gotenv is an Indirect Dependency

No direct usages of github.com/subosito/gotenv were found in the codebase. The package is listed as an indirect dependency in go.mod, indicating that the version update to v1.6.0 should not adversely affect existing environment variable management.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for `gotenv` usage and possible impact due to version update.

# Find all usages of `gotenv` functions.
rg --type go 'gotenv\.\w+' -A 2

Length of output: 126


Script:

#!/bin/bash
# Description: Check for `gotenv` usage and possible impact due to version update.

# Find all usages of `gotenv` functions.
rg --type go 'gotenv\.\w+' -A 2

Length of output: 33


Script:

#!/bin/bash
# Description: Locate all import statements for `gotenv` in the codebase.

# Using ast-grep to find all import declarations of `github.com/subosito/gotenv`.
ast-grep --lang go --pattern 'import ($_ $_ $_ "github.com/subosito/gotenv")'

# Additionally, search for any aliases used during import.
rg --type go '^import\s+\(\s*(.*\ngithub\.com/subosito/gotenv.*\n)*\s*\)'

Length of output: 347


Script:

#!/bin/bash
# Description: Inspect `go.mod` for indirect dependencies related to `gotenv`.

# Check for `gotenv` in the dependencies, including indirect ones.
grep 'github.com/subosito/gotenv' go.mod

Length of output: 87


197-201: Assess the Addition of OpenTelemetry Dependencies

New OpenTelemetry dependencies have been introduced (lines 197-201). Confirm that the instrumentation for tracing and metrics is correctly implemented and that the necessary configurations for OpenTelemetry are properly set up in the system.

To locate and review OpenTelemetry usage in the codebase, please run:


146-146: Examine Impact of klauspost/compress Update

The github.com/klauspost/compress library has been upgraded to v1.17.0 (line 146). Review any compression-related functionalities to ensure compatibility with the updated library and confirm that there are no breaking changes.

Identify where klauspost/compress is utilized:

Comment on lines +5 to +6
version = "v0.112.0"
hash = "sha256-lmNLoqmLURfxu+a6V/SeoP8xVn0Wi2SD7uxxAtSjm+o="
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Deprecated functions or APIs detected.

Several instances of deprecated functions or APIs were found in the codebase:

  • ./app/ante/ante.go: Deprecated handling of Cosmos SDK transactions.
  • ./app/ante/eip712.go: Multiple deprecated annotations related to EIP-712.
  • ./app/export.go: Temporary feature marked for deprecation.
  • ./crypto/codec/amino.go: Deprecated SDK components.
  • ./x/evm/types/msg.go: Deprecated transaction size handling.
  • ./x/evm/types/params_legacy.go: Deprecated parameter management in favor of x/gov.
  • ./x/feemarket/types/keys.go: Unused deprecated prefix.

Please address these deprecated usages to ensure future compatibility and maintain code quality.

🔗 Analysis chain

Ensure compatibility with major version upgrades.

Several modules have been upgraded to newer versions, including:

  • cloud.google.com/go to v0.112.0
  • cloud.google.com/go/storage to v1.36.0
  • github.com/btcsuite/btcd to v0.24.2
  • github.com/cosmos/cosmos-sdk to v0.47.14
  • github.com/cosmos/gogoproto to v1.7.0
  • google.golang.org/api to v0.155.0
  • google.golang.org/grpc to v1.62.1
  • google.golang.org/protobuf to v1.33.0

These upgrades may introduce breaking changes or new features. Please ensure that:

  1. The codebase has been adapted to any breaking changes.
  2. New features are utilized where appropriate.
  3. Comprehensive testing has been performed to verify compatibility.

To verify the impact of these upgrades, please run the following script:

Also applies to: 17-18, 76-77, 82-83, 85-86, 131-132, 140-141, 363-364, 426-427, 486-487, 489-490, 492-493, 498-499, 504-505, 507-508, 510-511, 565-566, 568-569, 571-572, 580-581, 586-587, 589-590, 592-593, 595-596, 598-599, 607-608, 613-614, 616-617, 619-620, 622-623, 625-626

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any breaking changes or deprecation warnings in the codebase after dependency upgrades.

# Test: Compile the project and check for any new warnings or errors
go build ./... 2>&1 | grep -E "warning|error|deprecated"

# Test: Run all tests to ensure functionality is maintained
go test ./...

Length of output: 403


Script:

#!/bin/bash
# Description: List all current dependencies with their versions to confirm upgrades.

go list -m all

Length of output: 86


Script:

#!/bin/bash
# Description: Search for usage of deprecated functions or APIs in the codebase.

grep -R --include="*.go" -E "Deprecated|deprecated" .

Length of output: 1306


Script:

#!/bin/bash
# Description: Analyze the dependency tree for potential conflicts or issues.

go mod graph | sort | uniq

Length of output: 98

github.com/cosmos/cosmos-proto v1.0.0-beta.4
github.com/cosmos/cosmos-sdk v0.47.10
github.com/cosmos/cosmos-proto v1.0.0-beta.5
github.com/cosmos/cosmos-sdk v0.47.14
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Potential Deprecated API Usages Identified

Several instances suggest deprecated or altered APIs from cosmos-sdk v0.47.14:

  • x/evm/types/params_legacy.go: Usage of deprecated functions ParamKeyTable and ParamSetPairs.
  • app/ante/ante.go: Deprecated handling of EIP712 representations.
  • Multiple files in x/evm/types/ and rpc/ethereum/pubsub/ directories indicate deprecated fields and methods related to Removed.
  • testutil/network/network.go: Presence of deprecated TODO comments and legacy configurations.
  • app/ante/eip712.go: Deprecated transaction handling and signature verification mechanisms.
🔗 Analysis chain

Verify Integration with Updated cosmos-sdk Version

The github.com/cosmos/cosmos-sdk has been upgraded to v0.47.14 (line 16) as per the PR objective. This major update could affect modules and functionalities dependent on cosmos-sdk. Ensure that all references and implementations align with the new version's API and address any deprecations or breaking changes.

To identify potential issues with the cosmos-sdk upgrade, execute the following script:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Identify usage of deprecated or altered APIs from `cosmos-sdk`.

# Search for known deprecated or altered functions in `cosmos-sdk` v0.47.x.
# Replace 'OldFunction' with actual deprecated function names if available.
rg --type go 'OldFunction|DeprecatedFunction' -A 5

Length of output: 126


Script:

#!/bin/bash
# Description: Identify usage of deprecated or altered APIs from `cosmos-sdk` v0.47.14.

# Replace 'ActualDeprecatedFunction1|ActualDeprecatedFunction2' with real deprecated function names as per `cosmos-sdk` v0.47.14 documentation.
rg --type go 'ActualDeprecatedFunction1|ActualDeprecatedFunction2' -A 5

# Alternatively, if specific deprecated functions are unknown, search for deprecation comments.
rg --type go '//\s*@deprecated' -A 3

Length of output: 112


Script:

#!/bin/bash
# Description: Identify usage of deprecated or altered APIs from `cosmos-sdk` v0.47.14.

# Search for general deprecation annotations in Go files.
rg --type go '@deprecated' -A 3

# Optionally, search for common deprecation keywords or patterns.
rg --type go 'Deprecated|Obsolete|Remove' -A 3

Length of output: 9326

Copy link
Contributor

@skosito skosito left a comment

Choose a reason for hiding this comment

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

some lint issues, not sure if related somehow

@gartnera
Copy link
Member Author

some lint issues, not sure if related somehow

nope not related, the same lint issues exist on main

@gartnera gartnera merged commit 044e22b into main Oct 10, 2024
25 of 26 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Oct 15, 2024
@coderabbitai coderabbitai bot mentioned this pull request Oct 23, 2024
2 tasks
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.

3 participants