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: support Bitcoin P2PKH (legacy), P2SH, P2TR address types #1842

Closed
wants to merge 14 commits into from

Conversation

brewmaster012
Copy link
Collaborator

@brewmaster012 brewmaster012 commented Mar 6, 2024

Description

Currently we only support sending to P2WPKH address.
Need to support others.

WIP:

  • backport AddressTaproot type that fulfills the btcutil.Address interface
  • add P2TR output
  • add P2PKH output
  • add P2SH output
  • add P2WSH output
  • read P2TR sender
  • read P2SH sender
  • read P2PKH sender
  • read P2WSH sender

Closes:
1626
1627
1773

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Include instructions and any relevant details so others can reproduce.

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

Checklist:

  • I have added unit tests that prove my fix feature works

Copy link

codecov bot commented Mar 6, 2024

Codecov Report

Attention: Patch coverage is 56.66667% with 39 lines in your changes are missing coverage. Please review.

Project coverage is 48.22%. Comparing base (3e7fd99) to head (b0b2d74).
Report is 2 commits behind head on develop.

❗ Current head b0b2d74 differs from pull request most recent head 31a0dfe. Consider uploading reports for the commit 31a0dfe to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1842      +/-   ##
===========================================
- Coverage    52.12%   48.22%   -3.90%     
===========================================
  Files          235      234       -1     
  Lines        13347    13412      +65     
===========================================
- Hits          6957     6468     -489     
- Misses        5953     6487     +534     
- Partials       437      457      +20     
Files Coverage Δ
common/address.go 70.73% <100.00%> (-29.27%) ⬇️
common/bitcoin/address_taproot.go 55.17% <55.17%> (ø)

... and 24 files with indirect coverage changes

@brewmaster012 brewmaster012 changed the title feat: support P2PKH (legacy), P2SH, P2TR address types feat: support Bitcoin P2PKH (legacy), P2SH, P2TR address types Mar 6, 2024
common/address.go Outdated Show resolved Hide resolved
Copy link

github-actions bot commented Mar 22, 2024

!!!WARNING!!!
nosec detected in the following files: zetaclient/bitcoin/fee.go, zetaclient/bitcoin/fee_test.go, zetaclient/bitcoin/bitcoin_client.go, zetaclient/bitcoin/bitcoin_client_test.go, zetaclient/bitcoin/bitcoin_signer.go, zetaclient/bitcoin/bitcoin_signer_test.go, zetaclient/bitcoin/inbound_tracker.go, zetaclient/bitcoin/utils.go

Be very careful about using #nosec in code. It can be a quick way to suppress security warnings and move forward with development, it should be employed with caution. Suppressing warnings with #nosec can hide potentially serious vulnerabilities. Only use #nosec when you're absolutely certain that the security issue is either a false positive or has been mitigated in another way.

Only suppress a single rule (or a specific set of rules) within a section of code, while continuing to scan for other problems. To do this, you can list the rule(s) to be suppressed within the #nosec annotation, e.g: /* #nosec G401 */ or //#nosec G201 G202 G203
Broad #nosec annotations should be avoided, as they can hide other vulnerabilities. The CI will block you from merging this PR until you remove #nosec annotations that do not target specific rules.

Pay extra attention to the way #nosec is being used in the files listed above.

@github-actions github-actions bot added the nosec label Mar 22, 2024
@ws4charlie
Copy link
Contributor

This PR is ported to v16.0.0 #1942

@ws4charlie ws4charlie closed this Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants