-
Notifications
You must be signed in to change notification settings - Fork 94
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
[r2r] hotfix: disallow withdraw to taproot addresses #1503
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fast fix! I have one note.
if payload.is_empty() { | ||
return Err(Error::EmptyBech32Payload); | ||
} | ||
if variant == bech32::Variant::Bech32m { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the new variant is added, it will pass this check and the address will be parsed incorrectly. Please add an explicit match statement here without _
placeholder. We should get a compiler error when a new variant appears.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great hotfix!
The only one question.
@artemii235 @caglaryucekaya @sergeyboyko0791 this is ready for another review round. |
Unstable ETH tests have been fixed in |
@sergeyboyko0791, yes, I think it's worth doing it. @shamardy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more note.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
… bip-0173 but invalidated by bip-0350
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
|
||
#[test] | ||
// https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#test-vectors | ||
fn test_invalid_segwit_addresses() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You skipped the first test, Invalid human-readable part
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's covered here https://github.com/KomodoPlatform/atomicDEX-API/blob/d950555d2d78a42e40c3e59a4deb3963894dd91d/mm2src/mm2_main/src/mm2_tests.rs#L1688 We check the hrp against the hrp from coin config outside the from_str
function since the hrp from config can't be passed to from_str
So this address tc1qw508d6qejxtdg4y5r3zarvary0c5xw7kg3g4ty
from the test vectors when converted to SegwitAddress
using from_str
will be valid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where the comparison happens https://github.com/KomodoPlatform/atomicDEX-API/blob/d950555d2d78a42e40c3e59a4deb3963894dd91d/mm2src/coins/utxo/utxo_common.rs#L3815-L3822
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thought you forgot it
No description provided.