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

feat: add Bitcoin Testnet4 static chain info #2911

Merged
merged 7 commits into from
Sep 25, 2024
Merged

Conversation

ws4charlie
Copy link
Contributor

@ws4charlie ws4charlie commented Sep 23, 2024

Description

  • Add Bitcoin Testnet4 static chain information.

Note: we still need btcd to ship the support for testnet4 to be able to integrate it. They had testnet4 support tracked here and a draft patch for testnet4

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

    • Added support for Bitcoin Testnet 4, enhancing compatibility with various blockchain environments.
    • Updated OpenAPI specification to include btc_testnet4 as an accepted chain name.
    • Introduced new chain configuration for Bitcoin Testnet 4 in the default chain list.
  • Documentation

    • Changelog updated to reflect the addition of Bitcoin Testnet 4.
  • Bug Fixes

    • Enhanced configuration options for the Bitcoin client to include "testnet4".

Copy link
Contributor

coderabbitai bot commented Sep 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 changes introduced in this pull request involve the addition of static information for the Bitcoin testnet4 across multiple files. This includes updates to the changelog, OpenAPI specifications, chain configurations in Go, test cases, protocol definitions, and configuration files. The modifications ensure that the new testnet is recognized and integrated into the existing framework, facilitating broader compatibility and testing capabilities.

Changes

Files Change Summary
changelog.md Added entry for Bitcoin testnet4 static information with pull request link.
docs/openapi/openapi.swagger.yaml Added btc_testnet4 to accepted values for ChainName in OpenAPI specification.
pkg/chains/chains.go Introduced BitcoinTestnet4 variable with attributes for the new Bitcoin testnet.
pkg/chains/chains_test.go Included chains.BitcoinTestnet4 in multiple test functions for consistent testing.
proto/zetachain/zetacore/pkg/chains/chains.proto Added btc_testnet4 enumeration value to ChainName enum.
zetaclient/config/types.go Updated RPCParams comment in BTCConfig struct to include "testnet4" as an option.

Possibly related issues

Possibly related PRs

Suggested labels

chain:bitcoin, E2E

Suggested reviewers

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

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 September 23, 2024 22:27
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: 2

Outside diff range and nitpick comments (3)
zetaclient/config/types.go (1)

53-53: Approve change and suggest parameter reordering.

The addition of "testnet4" to the comment is appropriate and aligns with the PR objective. However, to enhance readability and maintainability, consider reordering the parameters in the comment alphabetically or based on a logical sequence (e.g., from most common to least common usage).

Consider applying the following change:

-	RPCParams       string // "regtest", "mainnet", "testnet3" , "signet", "testnet4"
+	RPCParams       string // "mainnet", "regtest", "signet", "testnet3", "testnet4"

This ordering places the main network first, followed by the test networks in alphabetical order, which may be more intuitive for developers.

pkg/chains/chains.go (1)

185-196: Approve the addition of BitcoinTestnet4 with a minor suggestion.

The BitcoinTestnet4 variable is correctly defined with appropriate values. To enhance documentation, consider adding a brief comment explaining the purpose of Testnet4 and how it differs from other Bitcoin testnets.

Consider adding a comment above the BitcoinTestnet4 definition:

// BitcoinTestnet4 represents Bitcoin's Testnet4, a newer testnet designed for specific testing scenarios.
// It uses chain ID 18334 to distinguish it from Testnet3 (18332) and Signet (18333).
changelog.md (1)

Line range hint 80-114: Significant breaking changes affecting queries and module structure.

This version introduces several breaking changes:

  1. Relocation of TSS and chain validation queries from crosschain to observer module.
  2. Unification of observer sets across all chains.
  3. Merging of observer params and core params into chain params.
  4. Modification of the GetTssAddress query to require Bitcoin chain ID.

These changes may require updates to dependent systems and client applications. Ensure thorough testing and communication with affected parties.

Consider providing a migration guide or deprecation notices to help users adapt to these breaking changes.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3eba701 and e819465.

Files ignored due to path filters (2)
  • pkg/chains/chains.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • typescript/zetachain/zetacore/pkg/chains/chains_pb.d.ts is excluded by !**/*_pb.d.ts
Files selected for processing (6)
  • changelog.md (1 hunks)
  • docs/openapi/openapi.swagger.yaml (1 hunks)
  • pkg/chains/chains.go (3 hunks)
  • pkg/chains/chains_test.go (5 hunks)
  • proto/zetachain/zetacore/pkg/chains/chains.proto (1 hunks)
  • zetaclient/config/types.go (1 hunks)
Additional context used
Path-based instructions (4)
pkg/chains/chains.go (1)

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

pkg/chains/chains_test.go (1)

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

proto/zetachain/zetacore/pkg/chains/chains.proto (1)

Pattern **/*.proto: Review the Protobuf definitions, point out issues relative to compatibility, and expressiveness.

zetaclient/config/types.go (1)

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

Additional comments not posted (20)
pkg/chains/chains_test.go (5)

46-46: Addition of BitcoinTestnet4 to testnet chains is appropriate.

The inclusion of chains.BitcoinTestnet4 in the list of testnet chains is consistent with the purpose of the TestChainListByNetworkType function. The placement within the list is logical, maintaining the order of Bitcoin-related chains.


99-99: BitcoinTestnet4 correctly added to Bitcoin network chains.

The addition of chains.BitcoinTestnet4 to the list of Bitcoin network chains in the TestChainListByNetwork function is appropriate. Its placement within the list maintains the logical order of Bitcoin-related chains.


149-149: BitcoinTestnet4 appropriately included in default chain list.

The inclusion of chains.BitcoinTestnet4 in the TestDefaultChainList function is correct. Its position in the list maintains the logical grouping of Bitcoin-related chains within the default chain list.


187-187: BitcoinTestnet4 correctly added to observer gateway chains.

The addition of chains.BitcoinTestnet4 to the list of observer gateway chains in the TestChainListByGateway function is appropriate. Its placement within the list maintains the logical order of Bitcoin-related chains for the observer gateway.


231-231: BitcoinTestnet4 appropriately included in external chain list.

The inclusion of chains.BitcoinTestnet4 in the TestExternalChainList function is correct. Its position in the list maintains the logical grouping of Bitcoin-related chains within the external chain list.

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

pkg/chains/chains.go (1)

377-377: Approve the inclusion of BitcoinTestnet4 in DefaultChainsList.

The addition of BitcoinTestnet4 to the DefaultChainsList function is correct and appropriately placed within the list of chains.

changelog.md (14)

Line range hint 14-31: Comprehensive fixes addressing critical issues.

The changes in this version include several important fixes:

  1. Ensuring external chain height always increases.
  2. Adjusting gas price to buffer EIP1559 increases.
  3. Modifying WhitelistERC20 authorization.
  4. Improving pending outbound transaction handling.
  5. Optimizing Bitcoin keysign scheduling and fee calculation.
  6. Addressing issues with specific transaction types on Goerli and Mumbai networks.

These fixes contribute to improved reliability and efficiency of the system.


Line range hint 33-34: Removal of standalone network and adjustment of testing requirements.

The removal of the standalone network and the adjustment to use the require testing package for the entire node folder suggests a move towards a more integrated testing approach. This change may lead to more comprehensive and consistent testing across the codebase.


Line range hint 36-39: Enhanced testing coverage with E2E tests for chain headers and admin functionality.

The addition of chain header tests in E2E tests and the fix for admin tests contribute to improved test coverage and reliability of the system.


Line range hint 41-43: Emission distribution modification for fixed block rewards.

The change to use fixed block rewards for emission distribution could lead to more predictable and stable reward mechanisms. Ensure that this change aligns with the overall tokenomics strategy.


Line range hint 45-58: Comprehensive fixes addressing various issues.

The fixes in this version address a wide range of issues, including:

  1. Preventing incorrect ballot voting.
  2. Improving chain parameter comparison logic.
  3. Optimizing gas price checks and fee deductions for system transactions.
  4. Enhancing keygen status management.
  5. Resolving zetaclient crashes and improving error handling.
  6. Optimizing chain parameter support checks.

These fixes contribute to the overall stability and reliability of the system.


Line range hint 60-62: CI pipeline improvement for release cleanup.

The fix for the release pipelines cleanup step should lead to more efficient and reliable CI processes.


Line range hint 64-67: Documentation and upgrade handler updates.

The update to release instructions and the addition of an upgrade handler for version v12.1.0 contribute to improved documentation and smoother upgrade processes.


Line range hint 69-72: New features for gas limit optimization and inbound transaction verification.

The support for lower gas limits in voting and the improved checks for inbound tracker transactions enhance the efficiency and security of the system.


Line range hint 74-78: Code refactoring and optimization.

The refactoring efforts, including code optimization, zetaclient reorganization, and improvements to EVM fee calculation, contribute to better code maintainability and performance.


Line range hint 116-124: New features enhancing monitoring, state tracking, and chain support.

The new features include:

  1. Addition of monitoring tools for localnet testing.
  2. Implementation of state variables for tracking aborted zeta amounts.
  3. Introduction of snapshots commands.
  4. Support for dynamic gas pricing on zetachain.
  5. Addition of static chain data for Sepolia testnet.
  6. New metrics for tracking hotkey burn rates.

These features contribute to improved monitoring, state management, and chain support.


Line range hint 126-140: Comprehensive fixes addressing various issues.

The fixes in this version address a wide range of issues, including:

  1. Improvements to UTXO handling and EVM chain outbound transaction processing.
  2. Enhanced security measures for outbound tracker removal.
  3. Sanity checks for various events.
  4. Optimizations for block header posting and keysign operations.
  5. Resolutions for Athens-3 related issues.

These fixes contribute to improved reliability and security of the system.


Line range hint 142-154: Significant refactoring and structural improvements.

The refactoring efforts include:

  1. Changes to header verification requirements.
  2. Reorganization of codebase structure and naming conventions.
  3. Improvements to query pagination and TSS address handling.
  4. Updates to observer params and chain params organization.

These changes should lead to improved code maintainability and performance.


Line range hint 156-163: Chores and minor improvements.

The chores include various file renaming, script additions, and build process improvements. These changes contribute to better code organization and development workflows.


Line range hint 165-167: Improved testing and CI processes.

The addition of stateful e2e testing and removal of private runners contribute to more robust testing and CI processes.

docs/openapi/openapi.swagger.yaml Show resolved Hide resolved
proto/zetachain/zetacore/pkg/chains/chains.proto Outdated Show resolved Hide resolved
Copy link

codecov bot commented Sep 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.49%. Comparing base (f6ab039) to head (7340658).
Report is 2 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #2911   +/-   ##
========================================
  Coverage    67.49%   67.49%           
========================================
  Files          380      380           
  Lines        21169    21170    +1     
========================================
+ Hits         14287    14288    +1     
  Misses        6213     6213           
  Partials       669      669           
Files with missing lines Coverage Δ
pkg/chains/chains.go 93.75% <100.00%> (+0.06%) ⬆️
zetaclient/config/types.go 50.94% <ø> (ø)

@lumtis lumtis linked an issue Sep 24, 2024 that may be closed by this pull request
@ws4charlie ws4charlie disabled auto-merge September 24, 2024 21:58
@lumtis lumtis added this pull request to the merge queue Sep 25, 2024
Merged via the queue into develop with commit 2892114 Sep 25, 2024
31 checks passed
@lumtis lumtis deleted the add-btc-testnet4-chain branch September 25, 2024 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add testnet4 static chain information
4 participants