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: use different database file names for btc signet and testnet4 #3225

Merged
merged 5 commits into from
Dec 2, 2024

Conversation

ws4charlie
Copy link
Contributor

@ws4charlie ws4charlie commented Nov 27, 2024

Description

This PR picks necessary changes in the PR: #3224

All external observer signers must have already updated their zetaclient config files by next release, so there is no need to pick the special handling fallback logic around the old/new Bitcoin config.

Closes: #3223

How Has This Been Tested?

  • Tested CCTX in localnet
  • Tested in development environment
  • Go unit tests
  • Go integration tests
  • Tested via GitHub Actions

Summary by CodeRabbit

  • New Features
    • Introduced separate database file names for Bitcoin signet and testnet4 environments.
  • Bug Fixes
    • Enhanced inbound observation by skipping unsupported transaction versions for Solana.
    • Streamlined error handling by preventing retries on failed inbound vote message validation.
  • Refactor
    • Revamped TSS package in the ZetaClient for improved functionality.
  • Tests
    • Moved Bitcoin revert address test to an advanced group to avoid upgrade test failures.

Copy link
Contributor

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

Walkthrough

The pull request introduces several modifications across multiple components, primarily focusing on the zetaclient package. Key changes include the restructuring of the TSS package, enhancements to Bitcoin database file management, and improvements in error handling for inbound vote message validation. Additionally, the handling of unsupported transaction versions for Solana has been refined. The changelog has been updated to document these changes, reflecting ongoing efforts to optimize functionality and reliability within the ZetaChain ecosystem.

Changes

File Path Change Summary
changelog.md - Added entry for separate database file names for Bitcoin signet and testnet4.
- Refactored TSS package in zetaclient.
- Fixed issue to skip unsupported transaction versions for Solana.
- Fixed zetaclient to not retry on inbound vote message validation failures.
- Moved Bitcoin revert address test to advanced group to avoid upgrade test failures.
zetaclient/orchestrator/bootstrap.go - Added function btcDatabaseFileName(chain chains.Chain) string for dynamic Bitcoin database filename assignment.
- Removed constant btcDatabaseFilename and updated database initialization logic.

Possibly related PRs

Suggested labels

no-changelog, breaking:cli, chain:bitcoin

Suggested reviewers

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

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.

@ws4charlie ws4charlie marked this pull request as ready for review November 27, 2024 00:39
Copy link

codecov bot commented Nov 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.01%. Comparing base (08ff881) to head (7b113bd).
Report is 3 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3225      +/-   ##
===========================================
+ Coverage    62.00%   62.01%   +0.01%     
===========================================
  Files          428      428              
  Lines        30469    30480      +11     
===========================================
+ Hits         18891    18902      +11     
  Misses       10738    10738              
  Partials       840      840              
Files with missing lines Coverage Δ
zetaclient/orchestrator/bootstrap.go 59.05% <100.00%> (+1.38%) ⬆️

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)
zetaclient/orchestrator/bootstrap.go (1)

481-493: Consider adding documentation for database file naming convention

The implementation correctly handles database file naming across different Bitcoin networks. Consider adding a comment explaining the naming convention for future maintainers.

 func btcDatabaseFileName(chain chains.Chain) string {
+    // btcDatabaseFileName returns the appropriate database file name for Bitcoin networks.
+    // For backward compatibility:
+    // - mainnet and testnet3 use the legacy name "btc_chain_client"
+    // - all other networks (e.g., signet, testnet4) use their chain name
+
     // btcDatabaseFilename is the Bitcoin database file name now used in mainnet and testnet3
     // so we keep using it here for backward compatibility
     const btcDatabaseFilename = "btc_chain_client"
🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 490-491: zetaclient/orchestrator/bootstrap.go#L490-L491
Added lines #L490 - L491 were not covered by tests

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 08ff881 and 92eb8ad.

📒 Files selected for processing (2)
  • changelog.md (1 hunks)
  • zetaclient/orchestrator/bootstrap.go (3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
zetaclient/orchestrator/bootstrap.go (1)

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

🪛 GitHub Check: codecov/patch
zetaclient/orchestrator/bootstrap.go

[warning] 490-491: zetaclient/orchestrator/bootstrap.go#L490-L491
Added lines #L490 - L491 were not covered by tests

🔇 Additional comments (3)
zetaclient/orchestrator/bootstrap.go (2)

14-14: LGTM: Import addition is appropriate

The new import for the chains package is correctly placed and necessary for the new functionality.


363-363: LGTM: Database initialization updated correctly

The database initialization now uses the new btcDatabaseFileName function, ensuring proper separation of database files for different Bitcoin networks.

Let's verify the database file naming across different Bitcoin networks:

✅ Verification successful

Let me gather more information about the database file naming implementation.


Database file naming implementation verified successfully

The btcDatabaseFileName function implements a robust naming strategy:

  • Maintains backward compatibility by using "btc_chain_client" for Bitcoin Mainnet and Testnet3
  • Correctly handles additional Bitcoin networks by using their respective chain names
  • Single point of control for database file naming, preventing naming conflicts
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check database file naming implementation across Bitcoin networks
# Look for any other instances where Bitcoin database files might be created

rg -A 2 "NewFromSqlite.*btc" --type go

Length of output: 343


Script:

#!/bin/bash
# Check the btcDatabaseFileName function implementation
ast-grep --pattern 'func btcDatabaseFileName($_) $_'

# Look for any other database file naming patterns for BTC
rg -B 2 -A 2 "database.*btc" --type go

Length of output: 1502

changelog.md (1)

17-17: LGTM - Changelog entry follows conventions

The new entry is properly formatted with:

zetaclient/orchestrator/bootstrap.go Outdated Show resolved Hide resolved
zetaclient/orchestrator/bootstrap.go Outdated Show resolved Hide resolved
zetaclient/orchestrator/bootstrap.go Show resolved Hide resolved
zetaclient/orchestrator/bootstrap.go Show resolved Hide resolved
@ws4charlie ws4charlie added this pull request to the merge queue Dec 2, 2024
Merged via the queue into develop with commit c7deef5 Dec 2, 2024
43 checks passed
@ws4charlie ws4charlie deleted the fix-signet-database-name branch December 2, 2024 18:22
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.

Bitcoin observer database filename is hardcoded
4 participants