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

Improve address decoding errors #26514

Merged

Conversation

aureleoules
Copy link
Member

Attempt to fix #21741.

@sipa
Copy link
Member

sipa commented Nov 16, 2022

Concept ACK

Copy link
Member

@luke-jr luke-jr left a comment

Choose a reason for hiding this comment

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

NACK on talking about "different networks". While this could in theory be Lightning or sidechains, it's more likely to lead users toward scamcoins.

src/key_io.cpp Outdated Show resolved Hide resolved
src/key_io.cpp Outdated Show resolved Hide resolved
src/key_io.cpp Outdated Show resolved Hide resolved
@DrahtBot
Copy link
Contributor

DrahtBot commented Nov 19, 2022

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK 1440000bytes, MarcoFalke, davidgumberg
Concept ACK sipa, willcl-ark
Ignored review luke-jr

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

No conflicts as of last run.

@aureleoules aureleoules force-pushed the 2022-11-improve-address-decode-errors branch 2 times, most recently from 5304de4 to 43e47ad Compare November 24, 2022 07:32
@aureleoules
Copy link
Member Author

aureleoules commented Nov 24, 2022

Thanks @luke-jr I addressed your suggestions.

@aureleoules aureleoules force-pushed the 2022-11-improve-address-decode-errors branch from 43e47ad to 962a093 Compare January 17, 2023 17:34
@willcl-ark
Copy link
Member

Concept ACK

@davidgumberg
Copy link
Contributor

Maybe add a message for not-yet-understood witness versions and a test case?

  if (version == 1 && data.size() == WITNESS_V1_TAPROOT_SIZE) {
      static_assert(WITNESS_V1_TAPROOT_SIZE == WitnessV1Taproot::size());
      WitnessV1Taproot tap;
      std::copy(data.begin(), data.end(), tap.begin());
      return tap;
  }
+
+ if (version > 1 && version <= 16) {
+     error_str =  "Invalid or unsupported Bech32 address witness version."
+     return CNoDestination();
+ }
+
  if (version > 16) {
      error_str = "Invalid Bech32 address witness version";
      return CNoDestination();
  }

@sipa
Copy link
Member

sipa commented Mar 11, 2023

@davidgumberg That would be incorrect; sending to future witness versions is perfectly legal. It might make sense in the UI to give a warning, but we can't outlaw it (as it'd break future upgradability).

@davidgumberg
Copy link
Contributor

@sipa Thanks! I misunderstood.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

utACK 962a093


NACK on talking about "different networks". While this could in theory be Lightning or sidechains, it's more likely to lead users toward scamcoins.

Ideally it should have been 'chain' instead of network as networks are ipv4, ipv6, tor, i2p etc. although we should not be concerned about scammers if they ever use this software but use correct technical terms in errors IMO.

The comment is anyways addressed by author and I think PR improves error messages.

@maflcko
Copy link
Member

maflcko commented Mar 13, 2023

lgtm ACK 962a093

@davidgumberg
Copy link
Contributor

ACK 962a093

@glozow glozow merged commit 73a9892 into bitcoin:master Mar 13, 2023
@aureleoules aureleoules deleted the 2022-11-improve-address-decode-errors branch March 13, 2023 19:06
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Mar 14, 2023
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Mar 15, 2023
@bitcoin bitcoin locked and limited conversation to collaborators Mar 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error messages for invalid address
8 participants