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: use cometbft-db #2536

Merged
merged 1 commit into from
Jul 31, 2024
Merged

chore: use cometbft-db #2536

merged 1 commit into from
Jul 31, 2024

Conversation

gartnera
Copy link
Member

@gartnera gartnera commented Jul 23, 2024

Description

pebbledb is now upstreamed, we can stop using the fork.

CHANGELOG

Update: there seems to be some concern about the panic during an upgrade that we need to think about.

Update: I think failures are unrelated, see #2544
Update: test failures still seem unrelated, see #2596

Summary by CodeRabbit

  • New Features

    • Updated the Go version from 1.22 to 1.22.2, enhancing performance and security.
    • Upgraded several key dependencies for improved functionality, including major updates to popular libraries.
  • Bug Fixes

    • Addressed potential security vulnerabilities by maintaining current dependency versions.
  • Chores

    • Routine maintenance performed to ensure dependencies are up-to-date for better stability and compatibility.

@gartnera gartnera added no-changelog Skip changelog CI check UPGRADE_TESTS Run make start-upgrade-tests labels Jul 23, 2024
Copy link
Contributor

coderabbitai bot commented Jul 23, 2024

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Walkthrough

The recent updates to the go.mod file for the github.com/zeta-chain/zetacore module involve significant version upgrades for both the Go toolchain and various dependencies. The Go version has been updated to 1.22.2, alongside enhancements in key libraries, such as github.com/spf13/cobra and github.com/stretchr/testify. These changes reflect a commitment to maintaining the project’s dependency health, enhancing security, and ensuring compatibility with the latest improvements in the Go ecosystem.

Changes

File/Dependency Change Summary
go.mod Go version updated from 1.22 to 1.22.2; toolchain version updated to go1.22.5.
github.com/spf13/cobra Version upgraded from v1.7.0 to v1.8.0.
github.com/stretchr/testify Version upgraded from v1.8.4 to v1.9.0.
github.com/cockroachdb/errors Version upgraded from v1.10.0 to v1.11.1.
github.com/cometbft/cometbft-db Version upgraded from v0.8.0 to v0.12.0.
github.com/dgraph-io/badger Major version change from v2.2007.4 to v4.2.0.
go.etcd.io/bbolt Updated from v1.3.7 to v1.4.0-alpha.0.0.20240404170359-43604f3112c5.
github.com/stretchr/objx Version upgraded from v0.5.1 to v0.5.2.
golang.org/x/sync Version upgraded from v0.5.0 to v0.6.0.
golang.org/x/sys Version upgraded from v0.16.0 to v0.18.0.
Various indirect dependencies Added or updated, including github.com/google/flatbuffers to v1.12.1 and github.com/linxGnu/grocksdb to v1.8.14.
replace directives Modified to ensure compatibility with specific dependency versions, notably for github.com/cometbft/cometbft-db.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GoModule
    participant Dependencies

    User->>GoModule: Initiate Update
    GoModule->>Dependencies: Check for Latest Versions
    Dependencies->>GoModule: Return Updated Versions
    GoModule->>User: Update Complete
Loading

This sequence diagram illustrates the interaction between the user, the Go module, and its dependencies during the update process, showcasing the flow of initiating an update and receiving the latest versions.


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

go.mod Show resolved Hide resolved
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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8ebae66 and 12672b6.

Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
Files selected for processing (1)
  • go.mod (10 hunks)
Additional comments not posted (10)
go.mod (10)

3-3: Approved: Go version update.

The update from go 1.22 to go 1.22.2 is a minor version upgrade that includes important bug fixes and performance improvements.


5-5: Approved: Toolchain version update.

The update from toolchain go1.22 to toolchain go1.22.5 is a minor version upgrade that includes important bug fixes and performance improvements.


21-21: Approved: Dependency update for github.com/spf13/cobra.

The update from v1.7.0 to v1.8.0 likely includes new features, bug fixes, and performance improvements.


23-23: Approved: Dependency update for github.com/stretchr/testify.

The update from v1.8.4 to v1.9.0 likely includes new features, bug fixes, and performance improvements.


63-63: Approved: Dependency update for github.com/cockroachdb/errors.

The update from v1.10.0 to v1.11.1 likely includes new features, bug fixes, and performance improvements.


314-314: Approved: Dependency update for github.com/stretchr/objx.

The update from v0.5.1 to v0.5.2 likely includes bug fixes and performance improvements.


334-335: Approved: Dependency updates for golang.org/x/sync and golang.org/x/sys.

The updates from v0.5.0 to v0.6.0 for golang.org/x/sync and from v0.16.0 to v0.18.0 for golang.org/x/sys likely include bug fixes and performance improvements.


94-94: Approved: Major version update for github.com/dgraph-io/badger.

The update from v2.2007.4 to v4.2.0 is a significant version upgrade. Ensure thorough testing to verify compatibility and stability.

Verification successful

Approved: Major version update for github.com/dgraph-io/badger.

The update from v2.2007.4 to v4.2.0 is a significant version upgrade. The badger package is not directly used in the codebase, suggesting it is an indirect dependency. Ensure thorough testing to verify compatibility and stability with dependencies that might use badger indirectly.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all usages of `github.com/dgraph-io/badger` to ensure compatibility with the major version upgrade.

# Test: Search for the dependency usage. Expect: No breaking changes.
rg --type go 'badger'

Length of output: 21


Script:

#!/bin/bash
# Description: Verify all usages of `github.com/dgraph-io/badger` to ensure compatibility with the major version upgrade.

# Search for any import statements of the badger package.
rg --type go 'import.*badger' -A 5

# Search for any usage of the badger package in the codebase.
rg --type go 'badger\.' -A 5

Length of output: 67


65-65: Approved: Major version update for github.com/cometbft/cometbft-db.

The update from v0.8.0 to v0.12.0 is a significant version upgrade. Ensure thorough testing to verify compatibility and stability.

Verification successful

Approved: Major version update for github.com/cometbft/cometbft-db.

The update from v0.8.0 to v0.12.0 is a significant version upgrade. The extracted usages of cometbft-db across various files primarily involve initializing databases and memory stores. These usages appear consistent with typical patterns for database interactions and do not immediately indicate breaking changes.

However, due to the extent of the version upgrade, it is crucial to conduct thorough testing to ensure compatibility and stability.

  • Files to verify:
    • x/observer/client/querytests/cli_test.go
    • x/crosschain/client/querytests/cli_test.go
    • testutil/simapp/simapp.go
    • testutil/keeper/fungible.go
    • testutil/keeper/observer.go
    • testutil/keeper/ibccrosschain.go
    • testutil/keeper/keeper.go
    • testutil/keeper/lightclient.go
    • testutil/keeper/emissions.go
    • testutil/keeper/crosschain.go
    • testutil/keeper/authority.go
    • server/start.go
    • rpc/backend/tracing_test.go
    • rpc/backend/tx_info_test.go
    • rpc/backend/backend_suite_test.go
    • cmd/zetacored/root.go
    • app/app.go

Ensure thorough testing to verify compatibility and stability.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all usages of `github.com/cometbft/cometbft-db` to ensure compatibility with the major version upgrade.

# Test: Search for the dependency usage. Expect: No breaking changes.
rg --type go 'cometbft-db'

Length of output: 1183


Script:

#!/bin/bash
# Description: Extract and review usages of `github.com/cometbft/cometbft-db` in the identified files to ensure compatibility with the new version.

# Define the files to be checked
files=(
  "x/observer/client/querytests/cli_test.go"
  "x/crosschain/client/querytests/cli_test.go"
  "testutil/simapp/simapp.go"
  "testutil/keeper/fungible.go"
  "testutil/keeper/observer.go"
  "testutil/keeper/ibccrosschain.go"
  "testutil/keeper/keeper.go"
  "testutil/keeper/lightclient.go"
  "testutil/keeper/emissions.go"
  "testutil/keeper/crosschain.go"
  "testutil/keeper/authority.go"
  "server/start.go"
  "rpc/backend/tracing_test.go"
  "rpc/backend/tx_info_test.go"
  "rpc/backend/backend_suite_test.go"
  "cmd/zetacored/root.go"
  "app/app.go"
)

# Loop through each file and extract the lines where `cometbft-db` is used
for file in "${files[@]}"; do
  echo "File: $file"
  rg 'cometbft-db' "$file" -A 5 -B 5
  echo "-----------------------------------"
done

Length of output: 10094


Script:

#!/bin/bash
# Description: Extract specific usages of `github.com/cometbft/cometbft-db` within the identified files to identify potential compatibility issues.

# Define the files to be checked
files=(
  "x/observer/client/querytests/cli_test.go"
  "x/crosschain/client/querytests/cli_test.go"
  "testutil/simapp/simapp.go"
  "testutil/keeper/fungible.go"
  "testutil/keeper/observer.go"
  "testutil/keeper/ibccrosschain.go"
  "testutil/keeper/keeper.go"
  "testutil/keeper/lightclient.go"
  "testutil/keeper/emissions.go"
  "testutil/keeper/crosschain.go"
  "testutil/keeper/authority.go"
  "server/start.go"
  "rpc/backend/tracing_test.go"
  "rpc/backend/tx_info_test.go"
  "rpc/backend/backend_suite_test.go"
  "cmd/zetacored/root.go"
  "app/app.go"
)

# Loop through each file and extract the lines where `cometbft-db` is used
for file in "${files[@]}"; do
  echo "File: $file"
  rg 'tmdb|dbm' "$file" -A 5 -B 5
  echo "-----------------------------------"
done

Length of output: 24319


132-132: Approved: Alpha version update for go.etcd.io/bbolt.

The update from v1.3.7 to v1.4.0-alpha.0.0.20240404170359-43604f3112c5 includes an alpha version. Ensure thorough testing to verify compatibility and stability.

Copy link
Member

@lumtis lumtis left a comment

Choose a reason for hiding this comment

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

LGTM

Might make sense to get review from another DevOps before merging?

Copy link
Contributor

@swift1337 swift1337 left a comment

Choose a reason for hiding this comment

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

  • Is it okay that in cosmos repo it's still marked as experimental?
  • Can you somehow ensure that it would run as usual with some db state from current main? (e.g. run a localnet, then checkout to this branch)
// PebbleDBDBBackend represents pebble (uses github.com/cockroachdb/pebble)
//   - EXPERIMENTAL
//   - use pebbledb build tag (go build -tags pebbledb)
PebbleDBBackend BackendType = "pebbledb"

Pre-approved.

@gartnera
Copy link
Member Author

gartnera commented Jul 24, 2024

  • Is it okay that in cosmos repo it's still marked as experimental?

It's approximately the same code we're using today. It's just upstreamed.

  • Can you somehow ensure that it would run as usual with some db state from current main? (e.g. run a localnet, then checkout to this branch)

That's what the UPGRADE_TESTS does. I will also test with a state import.

@gartnera gartnera added the UPGRADE_IMPORT_MAINNET_TESTS Run make start-upgrade-import-mainnet-test label Jul 24, 2024
@lumtis lumtis enabled auto-merge July 25, 2024 10:21
@lumtis lumtis disabled auto-merge July 25, 2024 10:21
@lumtis lumtis enabled auto-merge July 29, 2024 07:29
@lumtis lumtis disabled auto-merge July 29, 2024 07:29
@gartnera gartnera enabled auto-merge July 30, 2024 20:30
@gartnera gartnera added this pull request to the merge queue Jul 31, 2024
Merged via the queue into develop with commit cd1869c Jul 31, 2024
28 checks passed
@gartnera gartnera deleted the use-cometbft-db branch July 31, 2024 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Skip changelog CI check UPGRADE_IMPORT_MAINNET_TESTS Run make start-upgrade-import-mainnet-test UPGRADE_TESTS Run make start-upgrade-tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants