-
Notifications
You must be signed in to change notification settings - Fork 49
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
Add Fuzzing #27
Add Fuzzing #27
Conversation
👍 Thanks for working on this. |
1989bc0
to
716471e
Compare
Some invariants weren't enforced consistently.
Since it's better to have some fuzzing than no fuzzing I'd like to get this merged without the core cross-fuzzing. At some point I will probably revisit this to implement cross-implementation fuzzing. This PR also includes fixes for #28 which change the API. So if this is merged the version should be bumped. Depending on your preferences I could just add one commit doing that to this PR. |
Please add a commit to bump version. I will dig in and review. |
/// * **InvalidLength**: if the HRP is outside 1..83 characters long | ||
/// | ||
/// # Deviations from standard | ||
/// * No length limits are enforced for the data 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 was much simpler to not enforce this invariant because lightning uses much longer than standard bech32 invoices. But because we need to enforce the same invariants when parsing and constructing (which the fuzzer found to be not the case currently) that would require two structs Bech32
and LenientBech32
. I think it's not worth the added complexity.
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.
Agreed.
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.
Tested locally, and it works. Thanks!
Add fuzz tests to rust-bech32, fixes #21, fixes #28 . Not ready for review yet.
decode random encoded data from bitcoin core implementationencode random data and test if core can parse it