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 bitcoin-core to 28.0 #3191

Merged
merged 2 commits into from
Nov 22, 2024
Merged

chore: upgrade bitcoin-core to 28.0 #3191

merged 2 commits into from
Nov 22, 2024

Conversation

gartnera
Copy link
Member

@gartnera gartnera commented Nov 20, 2024

Upgrade to bitcoin-core 28.0

This requires four things:

We need to upgrade to bitcoin-core 28.0 for testnet4 support. Related to #2242

Summary by CodeRabbit

  • New Features

    • Introduced new eth2, upgrade-host, and upgrade-orchestrator services for enhanced functionality.
    • Added command option for the bitcoin service to support deprecated RPC.
  • Improvements

    • Updated the bitcoin service image for better performance.
    • Simplified the wallet setup process by modifying method signatures and enhancing error handling.
  • Bug Fixes

    • Improved error handling during wallet creation to address existing database issues.

@gartnera gartnera added the no-changelog Skip changelog CI check label Nov 20, 2024
@gartnera gartnera requested a review from a team November 20, 2024 19:18
Copy link
Contributor

coderabbitai bot commented Nov 20, 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

Walkthrough

The pull request introduces significant modifications to the docker-compose.yml file, including updates to the bitcoin service image and the addition of new services such as eth2, upgrade-host, and upgrade-orchestrator. The orchestrator service now has a dependency on the eth service. Additionally, the setup_bitcoin.go file has been updated to simplify the SetupBtcAddress method by removing an unnecessary parameter and enhancing error handling during wallet creation.

Changes

File Path Change Summary
contrib/localnet/docker-compose.yml - Updated bitcoin service image from ghcr.io/zeta-chain/ruimarinho-bitcoin-core:22 to ghcr.io/zeta-chain/bitcoin-core-docker:27.2
- Added command -deprecatedrpc=create_bdb to bitcoin service
- Introduced eth2 service with build context ./anvil
- Added upgrade-host and upgrade-orchestrator services with profiles
- Updated orchestrator service to depend on eth service
e2e/runner/setup_bitcoin.go - Modified SetupBtcAddress method signature by removing name parameter
- Added JSON request construction for wallet creation with error handling
- Other methods largely unchanged but maintain existing logic and logging

Possibly related PRs

Suggested labels

UPGRADE_TESTS, UPGRADE_IMPORT_MAINNET_TESTS

Suggested reviewers

  • fbac
  • kingpinXD
  • swift1337
  • skosito
  • ws4charlie
  • lumtis
  • brewmaster012

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.

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
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 (2)
e2e/runner/setup_bitcoin.go (2)

73-78: Add documentation about bitcoin-core version requirements.

The implementation correctly handles the wallet creation for bitcoin-core 27.2, but would benefit from documentation explaining the version-specific requirements.

Add a comment block explaining the version requirements:

 // SetupBtcAddress setups the deployer Bitcoin address
+// Note: This implementation is specific to bitcoin-core >= 27.2 and requires
+// the -deprecatedrpc=create_bdb configuration option to support wallet
+// creation with descriptors=false.
 func (r *E2ERunner) SetupBtcAddress(createWallet bool) {

101-104: Enhance error handling specificity.

The current error handling checks for a generic "Database already exists" message. Consider making this more specific to avoid catching unrelated errors.

Consider this more specific approach:

-		if err != nil {
-			require.ErrorContains(r, err, "Database already exists")
-		}
+		if err != nil {
+			// Ignore only if the wallet already exists, fail for other errors
+			if !strings.Contains(err.Error(), "Database already exists") {
+				require.NoError(r, err, "failed to create wallet")
+			}
+		}
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between f5e5adb and be25b65.

📒 Files selected for processing (2)
  • contrib/localnet/docker-compose.yml (2 hunks)
  • e2e/runner/setup_bitcoin.go (3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
e2e/runner/setup_bitcoin.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

📓 Learnings (1)
e2e/runner/setup_bitcoin.go (1)
Learnt from: gartnera
PR: zeta-chain/node#3105
File: e2e/runner/setup_bitcoin.go:51-69
Timestamp: 2024-11-12T13:20:12.658Z
Learning: In test code (`e2e/runner/setup_bitcoin.go`), adding security measures for private key handling in the `GetBtcAddress` method is not required.
🔇 Additional comments (4)
e2e/runner/setup_bitcoin.go (3)

5-5: LGTM: Import addition aligns with new JSON handling requirements.

The addition of the encoding/json import is necessary for constructing the raw JSON RPC request in the SetupBtcAddress method.


38-38: LGTM: Method call updated to match new signature.

The simplified method call aligns with the updated SetupBtcAddress signature, maintaining functionality while reducing parameter complexity.


86-94: Verify alignment with bitcoin-core 27.2 requirements.

The implementation correctly sets descriptors=false and includes all required parameters for wallet creation in bitcoin-core 27.2.

Let's verify the bitcoin-core version and configuration in the docker setup:

✅ Verification successful

Implementation aligns with bitcoin-core 27.2 requirements

The verification confirms that:

  • Docker image uses bitcoin-core 27.2 (ghcr.io/zeta-chain/bitcoin-core-docker:27.2)
  • Wallet creation parameters are correctly implemented with descriptors=false as required
  • Implementation includes proper error handling for existing wallets
  • All required parameters for bitcoin-core 27.2 wallet creation are present and correctly ordered
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify bitcoin-core version and configuration in docker-compose.yml

# Check bitcoin service configuration
rg -A 5 'bitcoin:' | rg -A 5 'image:|command:'

Length of output: 888


Script:

#!/bin/bash
# Let's verify the bitcoin configuration and wallet creation parameters in the codebase

# Check bitcoin configuration files
fd -e conf bitcoin
fd -e conf -x cat {} \;

# Check other bitcoin setup related files
rg -l "createwallet|bitcoin.*27" --type go

Length of output: 155


Script:

#!/bin/bash
# Let's examine the bitcoin setup implementation in detail

# Check the bitcoin setup implementation
rg -A 10 "createwallet" e2e/runner/setup_bitcoin.go

# Check for any bitcoin version references
rg "bitcoin.*27" e2e/runner/setup_bitcoin.go

# Check the entire setup_bitcoin.go file for context
cat e2e/runner/setup_bitcoin.go

Length of output: 4287

contrib/localnet/docker-compose.yml (1)

Line range hint 198-213: LGTM: Bitcoin-core upgrade changes are properly configured

The changes align well with the PR objectives:

  1. Updated to bitcoin-core v27.2 using the custom Docker image
  2. Added -deprecatedrpc=create_bdb command to support createwallet with descriptors=false

Let's verify the Docker image exists and contains the expected version:

✅ Verification successful

Bitcoin Core upgrade changes are properly configured

The verification confirms that:

  1. The Bitcoin Core image upgrade to v27.2 is properly integrated into the test environment
  2. The -deprecatedrpc=create_bdb flag is correctly configured for backward compatibility
  3. The setup is well-integrated with the e2e testing framework, including proper Bitcoin deposit/withdrawal test accounts and configurations
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the Docker image exists and contains bitcoin-core v27.2

# Check if the image exists in the registry
gh api \
  -H "Accept: application/vnd.oci.image.index.v1+json" \
  /v2/zeta-chain/bitcoin-core-docker/manifests/27.2 \
  --jq '.schemaVersion'

# Note: We can't verify the actual bitcoin-core version inside the image
# as we don't have access to the running container

Length of output: 437


Script:

#!/bin/bash
# Let's try a different approach to verify the Docker image
# 1. Check if the image is referenced in other configuration files
# 2. Look for any documentation about the image

# Search for references to the Docker image
rg -l "ghcr.io/zeta-chain/bitcoin-core-docker" --type yaml

# Check for documentation about Bitcoin setup
fd "README|CONTRIBUTING|SETUP" --extension md --exec grep -l "bitcoin" {} \;

# Look for any scripts that might be using this image
fd ".*\.(sh|bash)" --exec grep -l "bitcoin-core-docker" {} \;

Length of output: 308


Script:

#!/bin/bash
# Let's check the documentation in the localnet directory for Bitcoin setup details
cat contrib/localnet/README.md

# Also check the e2e documentation as it might contain relevant information
cat e2e/README.md

# Look for any Bitcoin-related configuration or setup scripts in the localnet directory
fd . contrib/localnet --type f --exec grep -l "bitcoin" {} \;

Length of output: 6211


Script:

#!/bin/bash
# Let's check the orchestrator and zetacored scripts for Bitcoin setup details
cat contrib/localnet/scripts/start-zetacored.sh
cat contrib/localnet/orchestrator/start-zetae2e.sh

# Also check if there are any Bitcoin-related environment variables or configuration
rg "bitcoin" contrib/localnet/ --type sh -A 5 -B 5

Length of output: 33548

@gartnera gartnera changed the title chore: upgrade bitcoin-core to 27.2 chore: upgrade bitcoin-core to 28.0 Nov 20, 2024
@gartnera gartnera added this pull request to the merge queue Nov 22, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 22, 2024
@gartnera gartnera added this pull request to the merge queue Nov 22, 2024
Merged via the queue into develop with commit cda3398 Nov 22, 2024
49 checks passed
@gartnera gartnera deleted the upgrade-bitcoin-core branch November 22, 2024 17:32
swift1337 pushed a commit that referenced this pull request Dec 2, 2024
* chore: upgrade bitcoin-core to 27.2

* Upgrade to 28.0
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants