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 btcd (and tss deps) #2750

Merged
merged 3 commits into from
Sep 19, 2024
Merged

chore: upgrade btcd (and tss deps) #2750

merged 3 commits into from
Sep 19, 2024

Conversation

gartnera
Copy link
Member

@gartnera gartnera commented Aug 19, 2024

Upgrade github.com/btcsuite/btcd. Use tss-lib fork which upgrades btcd.

TODO:

Deferred items:

  • simplify key conversion logic
  • improve BIP 341/342 compliance by removing txscript.NewCannedPrevOutputFetcher([]byte{}, 0)

Should probably merge #2767 rapidly after this to get on the latest tss-lib. Update: this work was merged into this change.

Closes #2728

Summary by CodeRabbit

  • New Features

    • Updated key generation process with a new import for the keygen package, enhancing functionality.
    • Simplified the transaction signing process by modifying the SignTx method.
  • Bug Fixes

    • Improved error messaging in test functions for better clarity.
  • Chores

    • Updated import paths for various packages to ensure compatibility and maintainability.
    • Updated version numbers of dependencies to their latest releases for improved performance and security.

@gartnera gartnera added no-changelog Skip changelog CI check UPGRADE_LIGHT_TESTS Run make start-upgrade-test-light PERFORMANCE_TESTS Run make start-e2e-performance-test labels Aug 19, 2024
Copy link
Contributor

coderabbitai bot commented Aug 19, 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 recent code changes primarily focus on upgrading the btcsuite library across the project to streamline dependencies and enable support for Taproot scripts. This update involves modifying import paths for several packages, particularly shifting to versioned imports of btcd, thereby enhancing the codebase's clarity and maintainability without altering the core functionality.

Changes

Files Change Summary
cmd/zetaclientd/gen_pre_params.go, cmd/zetaclientd/keygen_tss.go, cmd/zetaclientd/main.go Updated import paths for keygen and ecdsakeygen from gitlab.com/thorchain to github.com/bnb-chain.
e2e/e2etests/helpers.go, e2e/e2etests/test_* Reorganized or updated btcutil import paths, indicating a shift in source without functional changes.
e2e/runner/.go, zetaclient/chains/bitcoin/.go Reordered btcutil imports and updated btcec to version 2, improving structure and supporting new features.
go.mod Updated various dependencies, including btcsuite/btcd to v0.24.2, and introduced bnb-chain/tss-lib.
pkg/chains/.go, pkg/crypto/.go Adjusted btcutil imports and refined existing code for better organization and clarity.
x/crosschain/types/tx_body_verification.go Updated btcec import path and simplified verifyOutboundBodyBTC function.
zetaclient/tss/tss_signer.go Added keygen import from bnb-chain, enhancing key generation capabilities.
zetaclient/zetacore/broadcast.go Simplified SignTx method by removing conditional checks, streamlining the process.

Assessment against linked issues

Objective Addressed Explanation
Upgrade btcsuite project-wise (2728)

This assessment confirms that the primary objective of upgrading the btcsuite library to improve dependency management and support for Taproot scripts has been effectively addressed through the recent code changes.


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 generate interesting stats about this repository and render them as a table.
    -- @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

codecov bot commented Aug 19, 2024

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.

Please upload report for BASE (develop@17f26e6). Learn more about missing BASE report.
Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
zetaclient/chains/bitcoin/signer/signer.go 0.00% 6 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             develop    #2750   +/-   ##
==========================================
  Coverage           ?   67.12%           
==========================================
  Files              ?      378           
  Lines              ?    21121           
  Branches           ?        0           
==========================================
  Hits               ?    14178           
  Misses             ?     6276           
  Partials           ?      667           
Files with missing lines Coverage Δ
pkg/chains/address.go 86.79% <ø> (ø)
pkg/chains/address_taproot.go 58.42% <ø> (ø)
pkg/crypto/tss.go 82.60% <ø> (ø)
pkg/proofs/bitcoin/proof.go 100.00% <ø> (ø)
pkg/proofs/headers.go 71.76% <ø> (ø)
pkg/proofs/proof.go 76.47% <ø> (ø)
x/lightclient/keeper/grpc_query_prove.go 71.79% <ø> (ø)
zetaclient/chains/bitcoin/fee.go 37.98% <ø> (ø)
zetaclient/chains/bitcoin/observer/observer.go 38.31% <ø> (ø)
zetaclient/chains/bitcoin/rpc/rpc.go 0.00% <ø> (ø)
... and 4 more

@gartnera gartnera marked this pull request as ready for review August 20, 2024 15:25
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, codebase verification and nitpick comments (2)
zetaclient/chains/bitcoin/signer/signer_test.go (1)

122-122: Update NewEngine Usages in Tests

The NewEngine function usages in signer_test.go do not include the new parameter txscript.NewMultiPrevOutFetcher(nil). Please update these instances to ensure the changes are correctly integrated and tested.

  • zetaclient/chains/bitcoin/signer/signer_test.go: Update all usages of NewEngine to include the new parameter.
Analysis chain

Verify NewEngine parameter updates.

The NewEngine function now includes txscript.NewMultiPrevOutFetcher(nil). Ensure this change is correctly integrated and tested.

Run the following script to verify the usage of NewEngine across the codebase:

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all usages of `NewEngine` to ensure correct parameter integration.

# Test: Search for the function usage. Expect: Only occurrences with the new parameter.
rg --type go $'NewEngine'

Length of output: 386

zetaclient/tss/tss_signer.go (1)

17-18: Re-evaluate btcutil Removal and Address Integration Concerns

The btcutil package is still widely used across the codebase, indicating that its removal from zetaclient/tss/tss_signer.go is likely incorrect and could lead to functionality issues. Additionally, while the keygen package integration appears extensive, ensure that all relevant TODOs and FIXMEs are addressed to solidify its implementation.

  • btcutil Usage: Review the necessity of btcutil in zetaclient/tss/tss_signer.go and other files to prevent potential issues.
  • keygen Integration: Address any pending TODOs or FIXMEs related to keygen to ensure complete and correct integration.

Please verify these aspects to maintain code integrity and functionality.

Analysis chain

Import changes approved, verify new usage.

The addition of the keygen package and removal of btcutil are appropriate. Ensure that the new keygen usage aligns with the intended functionality and that the removal of btcutil does not affect existing functionality.

Verify the usage of keygen to ensure it is correctly integrated.

Run the following script to verify the usage of keygen:


Verify the impact of btcutil removal and ensure keygen integration is complete.

The keygen package has been integrated across multiple files for TSS key generation. Ensure that its usage aligns with the intended functionality. Additionally, verify that the removal of btcutil does not affect other parts of the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `keygen` in the codebase.

# Test: Search for the usage of `keygen`. Expect: Correct integration and usage.
rg --type go -A 5 $'keygen'

Length of output: 86398


Script:

#!/bin/bash
# Check for any remaining usage of `btcutil` in the codebase to ensure its removal does not affect functionality.
rg --type go 'btcutil'

Length of output: 17314


Script:

#!/bin/bash
# Verify the integration of `keygen` by checking for any related TODOs or FIXMEs that might indicate incomplete implementation.
rg --type go 'TODO|FIXME' -A 3

Length of output: 58531

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 53883f5 and a5324c5.

Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
Files selected for processing (43)
  • cmd/zetaclientd/gen_pre_params.go (1 hunks)
  • cmd/zetaclientd/keygen_tss.go (1 hunks)
  • cmd/zetaclientd/main.go (1 hunks)
  • e2e/e2etests/helpers.go (1 hunks)
  • e2e/e2etests/test_bitcoin_withdraw_legacy.go (1 hunks)
  • e2e/e2etests/test_bitcoin_withdraw_p2sh.go (1 hunks)
  • e2e/e2etests/test_bitcoin_withdraw_p2wsh.go (1 hunks)
  • e2e/e2etests/test_bitcoin_withdraw_segwit.go (1 hunks)
  • e2e/e2etests/test_migrate_tss.go (1 hunks)
  • e2e/e2etests/test_stress_btc_withdraw.go (1 hunks)
  • e2e/runner/balances.go (1 hunks)
  • e2e/runner/bitcoin.go (1 hunks)
  • e2e/runner/runner.go (1 hunks)
  • e2e/runner/setup_bitcoin.go (3 hunks)
  • e2e/runner/setup_zeta.go (1 hunks)
  • e2e/utils/utils.go (1 hunks)
  • go.mod (7 hunks)
  • pkg/chains/address.go (1 hunks)
  • pkg/chains/address_taproot.go (1 hunks)
  • pkg/chains/address_test.go (2 hunks)
  • pkg/crypto/tss.go (1 hunks)
  • pkg/crypto/tss_test.go (1 hunks)
  • pkg/proofs/bitcoin/proof.go (1 hunks)
  • pkg/proofs/bitcoin/proof_test.go (1 hunks)
  • pkg/proofs/headers.go (1 hunks)
  • pkg/proofs/proof.go (1 hunks)
  • pkg/proofs/proof_test.go (1 hunks)
  • x/crosschain/types/tx_body_verification.go (2 hunks)
  • x/lightclient/keeper/grpc_query_prove.go (1 hunks)
  • zetaclient/chains/bitcoin/fee.go (1 hunks)
  • zetaclient/chains/bitcoin/fee_test.go (3 hunks)
  • zetaclient/chains/bitcoin/observer/inbound_test.go (1 hunks)
  • zetaclient/chains/bitcoin/observer/observer.go (1 hunks)
  • zetaclient/chains/bitcoin/signer/signer.go (3 hunks)
  • zetaclient/chains/bitcoin/signer/signer_keysign_test.go (3 hunks)
  • zetaclient/chains/bitcoin/signer/signer_test.go (7 hunks)
  • zetaclient/chains/bitcoin/tx_script.go (1 hunks)
  • zetaclient/chains/bitcoin/utils.go (1 hunks)
  • zetaclient/chains/interfaces/interfaces.go (1 hunks)
  • zetaclient/testutils/mocks/btc_rpc.go (1 hunks)
  • zetaclient/testutils/mocks/tss_signer.go (1 hunks)
  • zetaclient/tss/tss_signer.go (2 hunks)
  • zetaclient/zetacore/broadcast.go (2 hunks)
Files skipped from review due to trivial changes (26)
  • e2e/e2etests/helpers.go
  • e2e/e2etests/test_bitcoin_withdraw_p2wsh.go
  • e2e/e2etests/test_bitcoin_withdraw_segwit.go
  • e2e/e2etests/test_migrate_tss.go
  • e2e/e2etests/test_stress_btc_withdraw.go
  • e2e/runner/bitcoin.go
  • e2e/runner/runner.go
  • e2e/utils/utils.go
  • pkg/chains/address.go
  • pkg/chains/address_taproot.go
  • pkg/crypto/tss.go
  • pkg/crypto/tss_test.go
  • pkg/proofs/bitcoin/proof.go
  • pkg/proofs/bitcoin/proof_test.go
  • pkg/proofs/headers.go
  • pkg/proofs/proof.go
  • pkg/proofs/proof_test.go
  • x/lightclient/keeper/grpc_query_prove.go
  • zetaclient/chains/bitcoin/fee.go
  • zetaclient/chains/bitcoin/observer/inbound_test.go
  • zetaclient/chains/bitcoin/observer/observer.go
  • zetaclient/chains/bitcoin/tx_script.go
  • zetaclient/chains/bitcoin/utils.go
  • zetaclient/chains/interfaces/interfaces.go
  • zetaclient/testutils/mocks/btc_rpc.go
  • zetaclient/testutils/mocks/tss_signer.go
Additional context used
Path-based instructions (16)
e2e/e2etests/test_bitcoin_withdraw_legacy.go (1)

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

e2e/e2etests/test_bitcoin_withdraw_p2sh.go (1)

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

cmd/zetaclientd/gen_pre_params.go (1)

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

cmd/zetaclientd/main.go (1)

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

e2e/runner/setup_bitcoin.go (1)

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

zetaclient/chains/bitcoin/signer/signer_keysign_test.go (1)

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

zetaclient/zetacore/broadcast.go (1)

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

x/crosschain/types/tx_body_verification.go (1)

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

e2e/runner/balances.go (1)

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

e2e/runner/setup_zeta.go (1)

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

cmd/zetaclientd/keygen_tss.go (1)

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

zetaclient/chains/bitcoin/signer/signer_test.go (1)

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

pkg/chains/address_test.go (1)

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

zetaclient/chains/bitcoin/signer/signer.go (1)

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

zetaclient/chains/bitcoin/fee_test.go (1)

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

zetaclient/tss/tss_signer.go (1)

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

Learnings (1)
zetaclient/chains/bitcoin/signer/signer_keysign_test.go (2)
Learnt from: ws4charlie
PR: zeta-chain/node#2411
File: zetaclient/orchestrator/chain_activate.go:184-247
Timestamp: 2024-07-05T00:02:31.446Z
Learning: The `CreateSignerObserverBTC` function in `zetaclient/orchestrator/chain_activate.go` is covered by unit tests in `zetaclient/orchestrator/chain_activate_test.go`.
Learnt from: ws4charlie
PR: zeta-chain/node#2411
File: zetaclient/orchestrator/orchestrator.go:192-217
Timestamp: 2024-07-04T23:46:38.428Z
Learning: The `GetUpdatedSigner` method in `zetaclient/orchestrator/orchestrator.go` is covered by unit tests in `zetaclient/orchestrator/chain_activate_test.go` and `zetaclient/orchestrator/orchestrator_test.go`.
GitHub Check: codecov/patch
x/crosschain/types/tx_body_verification.go

[warning] 139-139: x/crosschain/types/tx_body_verification.go#L139
Added line #L139 was not covered by tests

zetaclient/chains/bitcoin/signer/signer.go

[warning] 273-273: zetaclient/chains/bitcoin/signer/signer.go#L273
Added line #L273 was not covered by tests


[warning] 297-301: zetaclient/chains/bitcoin/signer/signer.go#L297-L301
Added lines #L297 - L301 were not covered by tests

Additional comments not posted (28)
e2e/e2etests/test_bitcoin_withdraw_legacy.go (1)

4-4: Import Path Update: Verify Compatibility with New Package Structure

The import path for btcutil has been updated to "github.com/btcsuite/btcd/btcutil". Ensure that the new package structure is compatible with the existing code and that any changes in functionality are accounted for in the tests.

e2e/e2etests/test_bitcoin_withdraw_p2sh.go (1)

4-4: Import Path Update: Verify Compatibility with New Package Structure

The import path for btcutil has been updated to "github.com/btcsuite/btcd/btcutil". Ensure that the new package structure is compatible with the existing code and that any changes in functionality are accounted for in the tests.

cmd/zetaclientd/gen_pre_params.go (1)

9-9: Import Path Update: Verify Key Generation Functionality

The import path for keygen has been updated to "github.com/bnb-chain/tss-lib/ecdsa/keygen". Ensure that the new repository provides the same or improved functionality for key generation and that any changes in the API are reflected in the code.

cmd/zetaclientd/main.go (1)

8-8: Import Path Update: Verify Key Generation Functionality

The import path for ecdsakeygen has been updated to "github.com/bnb-chain/tss-lib/ecdsa/keygen". Ensure that the new repository provides the same or improved functionality for key generation and that any changes in the API are reflected in the code.

e2e/runner/setup_bitcoin.go (2)

7-7: Import Path Update: Verify Compatibility with New btcec Version

The import path for btcec has been updated to "github.com/btcsuite/btcd/btcec/v2". Ensure that the new version is compatible with the existing code and that any changes in functionality are accounted for.


64-64: API Usage Update: Verify PrivKeyFromBytes Changes

The PrivKeyFromBytes function calls have been modified to remove the explicit btcec.S256() parameter. Verify that this change aligns with the updated API and does not affect the expected behavior of the code.

Also applies to: 87-87

zetaclient/chains/bitcoin/signer/signer_keysign_test.go (3)

10-11: Update import paths for btcec library.

The import paths have been updated to use version 2 of the btcec library. Ensure that all dependencies in the project are compatible with this version.


104-104: Ensure correct usage of NewCannedPrevOutputFetcher.

The NewCannedPrevOutputFetcher is used here with empty data and zero value. Verify that this is intentional and that it aligns with the expected transaction context.


151-155: Improve signature handling with ModNScalar.

The use of ModNScalar for R and S values in the signature construction is a robust approach. Ensure that this change is tested thoroughly to confirm it enhances security and correctness.

x/crosschain/types/tx_body_verification.go (2)

7-7: Update import path for btcec library.

The import path has been updated to use version 2 of the btcec library. Ensure that this change is compatible with other parts of the codebase.


139-139: Simplify ParsePubKey usage.

The ParsePubKey function now omits the second argument, btcec.S256(). Verify that this change leverages the default behavior correctly and does not introduce any issues.

Tools
GitHub Check: codecov/patch

[warning] 139-139: x/crosschain/types/tx_body_verification.go#L139
Added line #L139 was not covered by tests

e2e/runner/balances.go (1)

8-8: Update import path for btcutil.

The import path has been changed to "github.com/btcsuite/btcd/btcutil". Verify that this change does not affect any existing functionalities and aligns with the project's dependency management strategy.

e2e/runner/setup_zeta.go (1)

7-7: Update import path for btcutil.

The import path has been updated to "github.com/btcsuite/btcd/btcutil". Confirm that this update is consistent with the project's overall upgrade strategy and does not disrupt any existing code.

cmd/zetaclientd/keygen_tss.go (1)

136-136: Ensure compatibility with ECDSA changes.

The addition of tsscommon.ECDSA in the keygen.NewRequest call enhances the key generation process. Verify that all components interacting with this function are compatible with ECDSA.

Run the following script to verify the usage of keygen.NewRequest across the codebase:

zetaclient/chains/bitcoin/signer/signer_test.go (4)

67-67: Update test for PrivKeyFromBytes usage.

The PrivKeyFromBytes function now requires a single argument. Ensure that this change is reflected in all relevant tests.


171-171: Ensure robust handling of NewTxSigHashes.

The NewTxSigHashes function now uses txscript.NewCannedPrevOutputFetcher. Verify that the test logic correctly handles this change.


211-211: Confirm signature creation logic.

The signature creation now uses btcecdsa.Sign. Ensure that this logic is correctly tested and aligns with the updated API.


219-219: Verify NewEngine parameter updates in P2WPH test.

Ensure the NewEngine function's new parameter is correctly integrated in the P2WPH test.

pkg/chains/address_test.go (2)

7-7: Update import path for btcutil.

The import path has been updated to github.com/btcsuite/btcd/btcutil. Ensure all usages of btcutil are consistent with this change.


48-48: Refine error message for invalid address.

The error message for decoding an invalid Bitcoin address has been improved for clarity. Ensure this change is reflected in all relevant test cases.

zetaclient/chains/bitcoin/signer/signer.go (2)

12-13: Update imports for btcec and btcecdsa.

The import paths have been updated to reflect the new version of the btcec package. Ensure all related code is compatible with these changes.


297-301: Ensure correctness of signature creation logic.

The signature creation now uses btcecdsa.NewSignature. Verify that this logic is correctly implemented and aligns with the updated API.

Tools
GitHub Check: codecov/patch

[warning] 297-301: zetaclient/chains/bitcoin/signer/signer.go#L297-L301
Added lines #L297 - L301 were not covered by tests

go.mod (3)

35-35: Upgrade btcsuite/btcd to v0.24.2.

The btcsuite/btcd package has been upgraded. Ensure all code interacting with this package is compatible with the new version.


365-367: Replace thorchain/tss with zeta-chain/go-tss.

The thorchain/tss dependency has been replaced. Ensure that all references to this package have been updated.


59-59: Add bnb-chain/tss-lib dependency.

The new dependency bnb-chain/tss-lib has been added. Verify its integration and usage within the codebase.

Run the following script to verify the usage of bnb-chain/tss-lib across the codebase:

Verification successful

Integration of bnb-chain/tss-lib Verified

The bnb-chain/tss-lib library is properly integrated and actively used in the codebase for key generation and pre-parameter handling. The usage is confirmed in the following files:

  • zetaclient/tss/tss_signer.go
  • cmd/zetaclientd/gen_pre_params.go
  • cmd/zetaclientd/main.go

The integration appears correct and functional.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all usages of `bnb-chain/tss-lib` to ensure correct integration.

# Test: Search for the package usage. Expect: Proper integration and usage.
rg --type go $'bnb-chain/tss-lib'

Length of output: 266


Script:

#!/bin/bash
# Check the usage of `bnb-chain/tss-lib/ecdsa/keygen` in the identified files.

# Extract lines around the import in zetaclient/tss/tss_signer.go
rg --type go --context 5 'github.com/bnb-chain/tss-lib/ecdsa/keygen' zetaclient/tss/tss_signer.go

# Extract lines around the import in cmd/zetaclientd/gen_pre_params.go
rg --type go --context 5 'github.com/bnb-chain/tss-lib/ecdsa/keygen' cmd/zetaclientd/gen_pre_params.go

# Extract lines around the import in cmd/zetaclientd/main.go
rg --type go --context 5 'github.com/bnb-chain/tss-lib/ecdsa/keygen' cmd/zetaclientd/main.go

Length of output: 1031


Script:

#!/bin/bash
# Search for usages of the `keygen` package in the identified files to verify integration.

# Look for function calls or operations involving `keygen` in zetaclient/tss/tss_signer.go
rg --type go 'keygen' zetaclient/tss/tss_signer.go

# Look for function calls or operations involving `keygen` in cmd/zetaclientd/gen_pre_params.go
rg --type go 'keygen' cmd/zetaclientd/gen_pre_params.go

# Look for function calls or operations involving `keygen` in cmd/zetaclientd/main.go
rg --type go 'keygen' cmd/zetaclientd/main.go

Length of output: 641

zetaclient/chains/bitcoin/fee_test.go (3)

8-9: Import changes approved.

The update to use version 2 of the btcec package and the inclusion of the ecdsa subpackage are appropriate and align with the library's new version.


63-63: Key generation simplification approved.

The removal of the explicit curve parameter in the NewPrivateKey call simplifies the process and is appropriate if the default curve is intended.


158-163: Signature process enhancements approved.

The use of txscript.NewTxSigHashes with NewCannedPrevOutputFetcher and btcecdsa.Sign enhances the signature hashing and signing processes, likely improving security and accuracy.

Ensure that the new signature process is thoroughly tested to confirm its correctness and compatibility with existing systems.

Run the following script to verify the usage of signTx and ensure all tests pass:

zetaclient/chains/bitcoin/signer/signer.go Show resolved Hide resolved
Copy link
Contributor

@skosito skosito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, just couple qs

cmd/zetaclientd/hsm.go Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
Copy link
Member

@lumtis lumtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are TODOs not checked in PR description, is it beyond the scope of this PR? If so can we create issues for those if there are none?

Copy link
Collaborator

@brewmaster012 brewmaster012 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking:cli no-changelog Skip changelog CI check PERFORMANCE_TESTS Run make start-e2e-performance-test UPGRADE_LIGHT_TESTS Run make start-upgrade-test-light UPGRADE_TESTS Run make start-upgrade-tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade btcsuite project-wise
4 participants