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

fix(tx_search): Set cometbft-db to v0.12 to fix tx_search issue (Long-term fix needed) #2699

Merged
merged 3 commits into from
Jan 23, 2025

Conversation

teddyding
Copy link
Contributor

@teddyding teddyding commented Jan 23, 2025

Changelist

Context

Test Plan

[Describe how this PR was tested (if applicable)]

Author/Reviewer Checklist

  • If this PR has changes that result in a different app state given the same prior state and transaction list, manually add the state-breaking label.
  • If the PR has breaking postgres changes to the indexer add the indexer-postgres-breaking label.
  • If this PR isn't state-breaking but has changes that modify behavior in PrepareProposal or ProcessProposal, manually add the label proposal-breaking.
  • If this PR is one of many that implement a specific feature, manually label them all feature:[feature-name].
  • If you wish to for mergify-bot to automatically create a PR to backport your change to a release branch, manually add the label backport/[branch-name].
  • Manually add any of the following labels: refactor, chore, bug.

Summary by CodeRabbit

  • Dependency Updates
    • Updated cometbft-db to version v0.12.0
    • Replaced several core dependencies with dYdX-specific forks of Cosmos SDK and CometBFT libraries
    • Refined dependency management to improve compatibility and stability

@teddyding teddyding marked this pull request as ready for review January 23, 2025 15:56
@teddyding teddyding requested a review from a team as a code owner January 23, 2025 15:56
Copy link
Contributor

coderabbitai bot commented Jan 23, 2025

Walkthrough

The pull request focuses on updating and replacing dependencies in the protocol/go.mod file. The changes primarily involve updating versions of key Cosmos ecosystem libraries, including CometBFT, Cosmos SDK, and IAVL. The modifications replace standard library versions with dYdX-specific forks, specifically targeting version v0.12.0 for cometbft-db and addressing potential interface compatibility issues.

Changes

File Change Summary
protocol/go.mod - Updated github.com/cometbft/cometbft-db to v0.12.0
- Replaced multiple dependencies with dYdX-specific forks:
* cometbftdydxprotocol/cometbft v0.38.6-0.20241126215519-69cdde955fd0
* cosmos-sdkdydxprotocol/cosmos-sdk v0.50.6-0.20250113155252-f00c500eaff3
* cosmossdk.io/storedydxprotocol/cosmos-sdk/store v1.0.3-0.20240326192503-dd116391188d
* github.com/cosmos/iavldydxprotocol/iavl v1.1.1-0.20240509161911-1c8b8e787e85

Possibly related PRs

Suggested labels

non-breaking

Suggested reviewers

  • vincentwschau

Poem

🐰 Hop, hop, through the mod file we go,
Updating dependencies with a magical glow
dYdX forks dancing, versions so bright
Cosmos libraries taking a quantum-like flight!
Dependencies aligned, code's harmony sings 🌟


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fc10335 and fc2ea94.

📒 Files selected for processing (1)
  • protocol/go.mod (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • protocol/go.mod
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: test-sim-import-export
  • GitHub Check: test-sim-after-import
  • GitHub Check: test-sim-multi-seed-short
  • GitHub Check: unit-end-to-end-and-integration
  • GitHub Check: test-race
  • GitHub Check: test-coverage-upload
  • GitHub Check: liveness-test
  • GitHub Check: container-tests
  • GitHub Check: Summary

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. (Beta)
  • @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.

@teddyding teddyding force-pushed the td/downgrade-cometbft-db branch from d86a362 to 4845491 Compare January 23, 2025 15:56
@roy-dydx
Copy link
Contributor

Can you update the comment to be more specific that all tx search resolves to a single entry? And reference cometbft/cometbft#4295

@teddyding
Copy link
Contributor Author

@Mergifyio backport release/protocol/v8.x

Copy link
Contributor

mergify bot commented Jan 23, 2025

backport release/protocol/v8.x

🟠 Waiting for conditions to match

  • merged [📌 backport requirement]

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

🧹 Nitpick comments (2)
protocol/go.mod (2)

476-476: Track the TODO for proper fix.

The comment indicates this is a temporary solution. Consider creating a tracking issue if one doesn't exist.

Would you like me to help create a tracking issue for implementing the proper fix by backporting the upstream changes?


474-475: Document the specific interface change.

Consider adding more details about which interface change in v0.13.0+ caused the tx_search issue. This will help with implementing the proper fix later.

Add a comment explaining the specific interface change that caused the issue:

 // Fixes the issue that `tx_search` resolves to a single entry, due to an cometbft-db interface 
-// change in v0.13.0+.
+// change in v0.13.0+. Specifically, the change in <interface_name> that affects <specific_component>.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 518a769 and fc10335.

⛔ Files ignored due to path filters (1)
  • protocol/go.sum is excluded by !**/*.sum
📒 Files selected for processing (1)
  • protocol/go.mod (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: test-sim-import-export
  • GitHub Check: test-sim-after-import
  • GitHub Check: test-sim-multi-seed-short
  • GitHub Check: test-coverage-upload
  • GitHub Check: container-tests
  • GitHub Check: Summary
🔇 Additional comments (1)
protocol/go.mod (1)

474-477: Verify the impact of downgrading cometbft-db.

While this fixes the tx_search issue, downgrading a dependency could potentially introduce other compatibility issues or miss security fixes from newer versions.

Run the following script to check for any security advisories or breaking changes between v0.12.0 and v0.13.0:

✅ Verification successful

Downgrade to cometbft-db v0.12.0 is appropriate and safe.

The downgrade is a valid temporary fix for the tx_search issue caused by breaking iterator API changes in v0.13.0+. No security vulnerabilities were found in v0.12.0, and the issue is being tracked for a proper fix via backporting (CT-1343).

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for security advisories and breaking changes in cometbft-db

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

# Check for breaking changes in commit history between v0.12.0 and v0.13.0
rg -A 5 "BREAKING CHANGE" 

Length of output: 390


Script:

#!/bin/bash
# Check for changes between v0.12.0 and v0.13.0 in cometbft-db

# Clone the repository to a temporary directory
git clone https://github.com/cometbft/cometbft-db /tmp/cometbft-db
cd /tmp/cometbft-db

# Check changelog entries
git log --oneline v0.12.0..v0.13.0

# Search for tx_search related changes
git log -p v0.12.0..v0.13.0 | grep -B 5 -A 5 "tx_search"

# Check for issues mentioning tx_search
gh search issues "tx_search repo:cometbft/cometbft-db" --json title,url,state,body

# Check the diff between versions
git diff v0.12.0..v0.13.0

Length of output: 51396


Script:

#!/bin/bash
# Search for tx_search usage and iterator patterns

# Search for tx_search usage
rg -A 5 -B 5 "tx_search" 

# Search for Iterator usage patterns
ast-grep --pattern 'iter.$$$Key()' 

# Search for issues mentioning tx_search
gh search issues "tx_search repo:cometbft/cometbft" --json title,url,state,body

# Check commit messages mentioning tx_search
git log --grep="tx_search"

Length of output: 42777


Script:

#!/bin/bash
# Check for related fixes or PRs

# Search for CT-1343 related commits
git log --all --grep="CT-1343"

# Search for tx_search related fixes in recent commits
git log --since="2024-01-01" --grep="tx_search"

# Check open PRs related to tx_search
gh search prs "tx_search repo:cometbft/cometbft is:open" --json title,url,body

# Check open PRs related to cometbft-db
gh search prs "cometbft-db repo:cometbft/cometbft is:open" --json title,url,body

Length of output: 597

@teddyding teddyding merged commit c73c6c4 into main Jan 23, 2025
21 checks passed
@teddyding teddyding deleted the td/downgrade-cometbft-db branch January 23, 2025 17:41
@teddyding
Copy link
Contributor Author

@Mergifyio backport release/protocol/v8.x

Copy link
Contributor

mergify bot commented Jan 23, 2025

backport release/protocol/v8.x

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Jan 23, 2025
…Long-term fix needed) (#2699)

(cherry picked from commit c73c6c4)
teddyding added a commit that referenced this pull request Jan 23, 2025
…Long-term fix needed) (backport #2699) (#2701)

Co-authored-by: Teddy Ding <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants