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

Problem: no compatible pebble db supported #1606

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

mmsqe
Copy link
Collaborator

@mmsqe mmsqe commented Sep 25, 2024

👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻

PR Checklist:

  • Have you read the CONTRIBUTING.md?
  • Does your PR follow the C4 patch requirements?
  • Have you rebased your work on top of the latest master?
  • Have you checked your code compiles? (make)
  • Have you included tests for any non-trivial functionality?
  • Have you checked your code passes the unit tests? (make test)
  • Have you checked your code formatting is correct? (go fmt)
  • Have you checked your basic code style is fine? (golangci-lint run)
  • If you added any dependencies, have you checked they do not contain any known vulnerabilities? (go list -json -m all | nancy sleuth)
  • If your changes affect the client infrastructure, have you run the integration test?
  • If your changes affect public APIs, does your PR follow the C4 evolution of public contracts?
  • If your code changes public APIs, have you incremented the crate version numbers and documented your changes in the CHANGELOG.md?
  • If you are contributing for the first time, please read the agreement in CONTRIBUTING.md now and add a comment to this pull request stating that your PR is in accordance with the Developer's Certificate of Origin.

Thank you for your code, it's appreciated! :)

Summary by CodeRabbit

  • New Features

    • Updated changelog to document the fix for PebbleDB support.
    • Added new configuration entries to use PebbleDB as the database backend.
  • Dependency Updates

    • Updated various dependencies, including github.com/cockroachdb/pebble to version v1.1.2 and github.com/dgraph-io/badger to version v4.2.0.
  • Build Configuration

    • Modified build tags to include pebbledb.

Copy link
Contributor

coderabbitai bot commented Sep 25, 2024

Walkthrough

The pull request introduces several updates across multiple files, primarily focusing on enhancing support for PebbleDB. Key changes include modifications to the Makefile to include pebbledb in the build tags, updates to dependency versions in go.mod and gomod2nix.toml, and adjustments to configuration files to set pebbledb as the database backend. The changelog has also been updated to document these changes, emphasizing the integration of PebbleDB support.

Changes

File Change Summary
CHANGELOG.md Updated to include a new entry for PebbleDB support and related changes to block-stm and Ethermint.
Makefile Modified build_tags to include pebbledb, changing from netgo objstore to netgo objstore pebbledb.
default.nix Updated tags list for cronosd package, replacing "grocksdb_no_link" with "pebbledb".
go.mod Updated various dependencies, including github.com/cockroachdb/pebble to v1.1.2 and added indirect dependencies.
gomod2nix.toml Updated module versions and hashes, including github.com/cockroachdb/pebble to v1.1.2 and added new modules.
integration_tests/configs/default.jsonnet Added new configuration entries for db_backend and app-db-backend, both set to pebbledb.

Possibly related PRs

Suggested reviewers

  • mmsqe
  • calvinaco

Poem

In the garden where bunnies hop,
PebbleDB joins the build, oh what a stop!
With tags that grow and configs anew,
Our code's a dance, fresh as the dew.
Hops of joy, let the changes ring,
For every line, a new song to sing! 🐇✨


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

codecov bot commented Sep 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.12%. Comparing base (c0f7560) to head (bd0f2b1).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1606   +/-   ##
=======================================
  Coverage   36.12%   36.12%           
=======================================
  Files          97       97           
  Lines        7725     7725           
=======================================
  Hits         2791     2791           
  Misses       4585     4585           
  Partials      349      349           

@yihuang yihuang marked this pull request as ready for review September 26, 2024 02:52
@yihuang yihuang requested a review from a team as a code owner September 26, 2024 02:52
@yihuang yihuang requested review from yihuang and calvinaco and removed request for a team September 26, 2024 02:52
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: 1

🧹 Outside diff range and nitpick comments (1)
CHANGELOG.md (1)

9-9: Consider adding more details to the unreleased entry.

The unreleased entry currently only contains one item. It would be helpful to provide more context or details about this fix for PebbleDB support. Consider adding information about the nature of the fix and its impact.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between c0f7560 and bd0f2b1.

🔇 Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (6)
  • CHANGELOG.md (1 hunks)
  • Makefile (1 hunks)
  • default.nix (1 hunks)
  • go.mod (4 hunks)
  • gomod2nix.toml (4 hunks)
  • integration_tests/configs/default.jsonnet (1 hunks)
🔇 Additional comments not posted (17)
default.nix (1)

16-16: LGTM! Verify consistency across the codebase.

The change from "grocksdb_no_link" to "pebbledb" in the tags list aligns with the PR objective of addressing Pebble database compatibility. This modification suggests a shift from RocksDB to PebbleDB, which is a significant change in the underlying database technology.

To ensure consistency across the codebase, please run the following verification script:

Additionally, please ensure that any relevant documentation (e.g., README, configuration guides) is updated to reflect this change from RocksDB to PebbleDB.

Consider adding a comment in the Nix file explaining the reason for this change, such as:

# Switched from RocksDB to PebbleDB for improved compatibility and performance
tags = [ "ledger" "netgo" network "rocksdb" "pebbledb" "objstore" ] ++ lib.optionals nativeByteOrder [ "nativebyteorder" ];

This will help future maintainers understand the rationale behind this change.

integration_tests/configs/default.jsonnet (2)

65-67: LGTM! Clarify 'app-db-backend' usage.

The addition of 'pebbledb' as the 'app-db-backend' for the second validator further aligns with the PR objective. This setting appears to be specific to the application layer.

To ensure consistency and clarify the usage of 'app-db-backend', please run the following verification:

#!/bin/bash
# Description: Verify the app-db-backend configuration and its relationship with db_backend

# Test: Check for all occurrences of 'app-db-backend' in the configuration
rg --type json 'app-db-backend' integration_tests/configs/default.jsonnet

# Test: Look for any documentation or comments explaining the relationship between 'db_backend' and 'app-db-backend'
rg --type json -i 'db.?backend' -C 10 integration_tests/configs/default.jsonnet

# Test: Check if there are any other files in the project that might explain the usage of these settings
fd -t f | xargs rg -i 'app.?db.?backend'

Could you please clarify:

  1. The relationship between 'db_backend' and 'app-db-backend'?
  2. Why the first validator doesn't have an explicit 'app-db-backend' setting?
  3. Are there any implications of using different backends for 'db_backend' and 'app-db-backend'?

62-64: LGTM! Verify mixed database backend setup.

The addition of 'pebbledb' as the database backend for the second validator aligns with the PR objective. This change introduces a mixed database backend setup, with the first validator using 'rocksdb' and the second using 'pebbledb'.

To ensure this mixed setup is intentional and properly handled, please run the following verification:

✅ Verification successful

Verified Mixed Database Backend Configuration

The configuration correctly includes both rocksdb and pebbledb for different validators. Test scripts appropriately enforce rocksdb where necessary, ensuring the mixed setup is intentional and properly managed.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the database backend configuration for validators

# Test: Check if both 'rocksdb' and 'pebbledb' are used in the configuration
rg --type json 'db_backend.*rocksdb' integration_tests/configs/default.jsonnet
rg --type json 'db_backend.*pebbledb' integration_tests/configs/default.jsonnet

# Test: Look for any conditional logic or comments related to mixed database backends
rg --type json -i 'db.?backend' -C 5 integration_tests/configs/default.jsonnet

Length of output: 2577

Makefile (2)

18-18: LGTM: Addition of Pebble DB support

The addition of 'pebbledb' to the build tags is a good step towards addressing the compatibility issue with Pebble DB, as mentioned in the PR objectives.

To ensure this change is sufficient, please verify if any other files need modification to fully support Pebble DB. You can use the following script to check for any references to Pebble DB in the codebase:

#!/bin/bash
# Description: Search for Pebble DB references in the codebase

# Search for Pebble DB related imports or usage
echo "Searching for Pebble DB references in Go files:"
rg --type go "pebble"

# Search for Pebble DB related configuration
echo "Searching for Pebble DB configuration:"
rg "pebble" --type yaml --type toml --type json

# Search for Pebble DB in documentation
echo "Searching for Pebble DB mentions in documentation:"
rg "pebble" --type md --type txt

This will help ensure that all necessary changes for Pebble DB support have been made across the project.


18-18: Verify impact on build process

The addition of 'pebbledb' to build_tags will affect various parts of the build process. Please ensure that:

  1. This change doesn't conflict with other database options (e.g., cleveldb, badgerdb, rocksdb, boltdb).
  2. All relevant build targets and configurations work as expected with this new tag.
  3. The change doesn't introduce any unexpected behavior in the build process.

You can use the following script to check how the 'pebbledb' tag is used throughout the Makefile:

This will help ensure that the 'pebbledb' tag is correctly propagated and doesn't cause any issues in the build process.

go.mod (4)

Line range hint 1-285: Summary of go.mod changes

The changes in this file primarily involve updating dependencies and managing custom forks. Here's a summary of the key points:

  1. Several dependencies have been updated, including a major version update for github.com/dgraph-io/badger.
  2. New indirect dependencies have been added, likely due to the update of github.com/cockroachdb/pebble.
  3. Custom forks are being used for some dependencies, particularly github.com/ethereum/go-ethereum.

These changes are generally acceptable but require careful consideration:

  1. Ensure thorough testing of the updated dependencies, especially github.com/dgraph-io/badger due to the major version change.
  2. Verify that the new indirect dependencies don't introduce security vulnerabilities or licensing issues.
  3. Regularly sync and review differences between forked dependencies and their upstream repositories.

Maintaining these practices will help ensure the stability and security of your project while benefiting from the latest improvements in your dependencies.


276-277: Using forked version of go-ethereum

The github.com/ethereum/go-ethereum dependency is being replaced with a forked version:

github.com/ethereum/go-ethereum => github.com/crypto-org-chain/go-ethereum v1.10.20-0.20240926023215-d2275b4afb9a

While this allows for custom modifications, it may lead to divergence from the upstream repository.

To ensure you're not missing important updates or security patches:

  1. Regularly sync your fork with the upstream repository.
  2. Review the differences between your fork and the upstream version:
#!/bin/bash
# Clone both repositories
git clone https://github.com/ethereum/go-ethereum.git upstream-ethereum
git clone https://github.com/crypto-org-chain/go-ethereum.git forked-ethereum

# Navigate to the forked repository
cd forked-ethereum

# Add upstream remote
git remote add upstream https://github.com/ethereum/go-ethereum.git

# Fetch upstream changes
git fetch upstream

# Show differences
git diff upstream/master...master

# Return to the original directory
cd ..
  1. Consider creating a plan to periodically merge upstream changes into your fork.

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

The github.com/dgraph-io/badger dependency has been updated from v2.2007.4 to v4.2.0, which is a major version update. This may introduce breaking changes in the API.

Please ensure that all uses of this library have been updated to be compatible with the new version. Run the following script to check for potential incompatibilities:

After reviewing the results, make sure to thoroughly test the affected parts of the codebase to ensure compatibility with the new version.


84-88: New indirect dependencies added

New indirect dependencies have been introduced:

  • github.com/cockroachdb/fifo
  • github.com/cockroachdb/tokenbucket

These are likely required by the updated github.com/cockroachdb/pebble dependency.

Please verify that these new dependencies:

  1. Don't introduce any security vulnerabilities
  2. Have compatible licenses with your project

Run the following command to check for known vulnerabilities:

Also, review the licenses of these new dependencies to ensure compatibility with your project.

gomod2nix.toml (7)

143-145: New dependency added: github.com/cockroachdb/fifo

The addition of this new dependency appears to be related to the Pebble database compatibility update. Can you please provide more context on how this FIFO package is used in relation to Pebble?


150-151: Pebble database updated to stable version v1.1.2

This update is crucial for addressing the PR's main objective of Pebble database compatibility. Moving from a development version to a stable release (v1.1.2) is a significant improvement. Great job on this update!


155-157: New dependency added: github.com/cockroachdb/tokenbucket

This new dependency appears to be related to the Pebble database update. Could you explain how the tokenbucket package is utilized in the context of the Pebble implementation? Is it used for rate limiting or another specific purpose?


165-166: CometBFT DB updated to stable version v0.12.0

This update to a stable version of cometbft-db is a good improvement. While not directly related to the Pebble compatibility issue, it enhances the overall database functionality of the project. Have you tested the compatibility of this version with the other database changes?


Line range hint 1-724: Summary of dependency changes

Overall, the changes in this file align well with the PR objective of addressing Pebble database compatibility. Here's a summary of the key points:

  1. Pebble DB has been updated to a stable version (v1.1.2), which is crucial for the project's objectives.
  2. New dependencies (github.com/cockroachdb/fifo and github.com/cockroachdb/tokenbucket) have been added, likely to support the Pebble implementation.
  3. Other database-related dependencies (CometBFT DB and Badger DB) have received significant updates.
  4. The Ethereum dependency has been updated and replaced with a custom fork.

These changes appear to be well-considered, but please address the questions raised in the individual comments, particularly regarding:

  • The purpose and usage of the new FIFO and tokenbucket packages.
  • The impact and migration process for the major Badger DB update.
  • The reasons for using a custom Ethereum fork and its maintenance strategy.

Once these points are clarified, the dependency updates look good to proceed.


262-264: Updated Ethereum dependency and custom fork

The Ethereum dependency has been updated to a newer commit while maintaining the base version v1.10.20. Additionally, it's being replaced with a custom fork at github.com/crypto-org-chain/go-ethereum.

  1. Can you explain the reasons for using a custom fork instead of the official Ethereum repository?
  2. What specific modifications or features does this fork provide that are necessary for the project?
  3. How do you plan to keep this fork in sync with upstream changes?

Please provide some context on the decision to use a custom fork and the update process.


237-239: Major version update: Badger DB v2.2007.4 to v4.2.0

This is a significant version jump for the Badger database, moving from version 2 to version 4. Such a major update likely introduces breaking changes and may require code modifications.

  1. Have you reviewed the changelog for any breaking changes?
  2. Were any code modifications necessary to accommodate this update?
  3. Have you thoroughly tested the application with this new version to ensure compatibility?

Please provide details on the migration process and any challenges encountered.

CHANGELOG.md (1)

Line range hint 11-24: Good job on documenting improvements and bug fixes in v1.0.7.

The changelog entry for v1.0.7 is well-structured and informative. It clearly outlines the improvements and bug fixes, providing links to the relevant pull requests. This helps users and developers understand the changes in this version.

🧰 Tools
Markdownlint

11-11: null
Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)

integration_tests/configs/default.jsonnet Show resolved Hide resolved
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