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(common)!: bitcoin address validation to verify networks #1364

Merged
merged 2 commits into from
Nov 3, 2023

Conversation

brewmaster012
Copy link
Collaborator

Description

Problem: currently when user withdraws assets from ZRC20, the withdraw event hooks validates
the to address that the user inputs. However it failed to distinguish between bitcoin mainnet
and testnet3 addresses.

This PR fixes that validation logic so that a user cannot specify a wrong address on bitcoin network
without revering that withdraw transaction.

Closes:

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
Contributor

@ws4charlie ws4charlie 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

@brewmaster012 brewmaster012 changed the title fix(common):bitcoin address validation to verify networks fix(common)!: bitcoin address validation to verify networks Nov 2, 2023
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.

This looks good to me.

FYI the error happening in the smoketest seems to be something that started to occur recently. Adding a sleep command in the CI should fix it: e2b42f6

@brewmaster012 brewmaster012 merged commit 5403c8e into develop Nov 3, 2023
13 checks passed
@brewmaster012 brewmaster012 deleted the fix-bitcoin-address-validation branch November 3, 2023 15:04
@brewmaster012 brewmaster012 restored the fix-bitcoin-address-validation branch November 3, 2023 15:04
@brewmaster012 brewmaster012 deleted the fix-bitcoin-address-validation branch November 3, 2023 15:05
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.

3 participants