Uh oh!
There was an error while loading. Please reload this page.
Update rust-bitcoin and add secp256k1 context randomization - #802
Conversation
TheBlueMatt
commented
Feb 19, 2021
Also added a wasm32-wasi bindings build for good measure (since we need the update to do it). |
5a166a1 to
e81fab9CompareCodecov Report
@@ Coverage Diff @@## main #802 +/- ##
==========================================
- Coverage 91.04% 91.02% -0.02%
==========================================
Files 48 48 Lines 25480 25492 +12 ==========================================
+ Hits 23199 23205 +6 - Misses 2281 2287 +6
Continue to review full report at Codecov.
|
a5cb963 to
85dcb52CompareUh oh!
There was an error while loading. Please reload this page.
| use bitcoin::secp256k1::Signature; | ||
| msgs::ChannelUpdate { | ||
| signature: Signature::from(FFISignature::new()), | ||
| signature: Signature::from(unsafe { FFISignature::new() }), |
There was a problem hiding this comment.
OOC, do you know why secp256k1:;Signature was suddenly made unsafe?
There was a problem hiding this comment.
I'm not 100% sure, but it does allow you to create an obviously-bogus Signature object which generally you're not supposed to be able to do (once its in a Signature its supposed to be a valid object, even if not a valid signature for a given message, I think).
Uh oh!
There was an error while loading. Please reload this page.
TheBlueMatt
commented
Feb 19, 2021
Yea, sorry, I got too excited with this. I think I also need to pull in rust-bitcoin/bitcoin_hashes#111 for fuzzing and then re-redo the full_stack_target test. |
85dcb52 to
3dd72e5CompareTheBlueMatt
commented
Feb 19, 2021
OK, should be resolve now, also address your comments. |
386ccf3 to
49718cfCompareUh oh!
There was an error while loading. Please reload this page.
49718cf to
a7863d4CompareTheBlueMatt
commented
Feb 22, 2021
Rebased. |
jkczyz
left a comment
There was a problem hiding this comment.
Given the dependencies on open PRs, should we wait at least on some concept ACKs on those? I'm not sure if I have suitable knowledge to do so on my own.
Uh oh!
There was an error while loading. Please reload this page.
| // Writing new code generating transactions and see a new failure ? Don't forget to add input for the FuzzEstimator ! | ||
| // 0000000000000000000000000000000000000000000000000000000000000000 - our network key | ||
| // 0100000000000000000000000000000000000000000000000000000000000000 - our network key |
There was a problem hiding this comment.
To confirm my understanding, do these diffs extend from the fact that the use of get_secure_random_bytes to seed Secp256k1 causes an increment to a rand_bytes_child_index?
There was a problem hiding this comment.
They extend from a few things (which is why there's so many of them). This particular one extends from the fact that secp256k1's fuzzing mode now requires the private key not be all-0s (in fact it enforces the regular non-fuzzing rules around private key validity). Other changes are required because, as a result of that, we now have sha256 only return hashes with one byte set to 1-0xff instead of 0-0xff as we did previously.
Uh oh!
There was an error while loading. Please reload this page.
a7863d4 to
4e2bdf2CompareTheBlueMatt
commented
Feb 24, 2021
Yea, to merge that probably makes sense. |
TheBlueMatt
commented
Feb 26, 2021
Relevant IRC discussion: |
1543730 to
b328fcfCompareTheBlueMatt
commented
Feb 26, 2021
Squashed. I'd ideally like to take this for 0.0.13, unless someone has objections to the PR dependencies, which would be reasonable. |
valentinewallace
commented
Feb 26, 2021
fix build? |
Note that rust-fuzz wrappers (including honggfuzz) already apply this for us.
b328fcf to
bd48726CompareTheBlueMatt
commented
Feb 26, 2021
Oops, rebase introduced errors. I droped the bindings updates cause its gonna require some minor changes in the generator, though likely not too bad. |
This is useful when rebuilding the full_stack_target test vector
bd48726 to
ea48a5aCompareTheBlueMatt
commented
Feb 27, 2021
Bumped to latest version of the rust-secp pull to fix (most of) the performance degredation. |
TheBlueMatt
commented
Feb 27, 2021
Note that, sadly, this still decreases the performance of, especially, chanmon_consistency, taking the CI fuzz runs from 18/91 minutes to 22/23 minutes for the fuzzing section. |
jkczyz
commented
Feb 28, 2021
I'm seeing this failure at ea48a5a: |
Right, you now need to set |
jkczyz
left a comment
There was a problem hiding this comment.
Right, you now need to set
RUSTFLAGS="--cfg fuzzing"in order to run the fuzzing tests.
Yeah, that should have been obvious. :P
LGTM
This updates our rust-bitcoin dependency and adds secp256k1 context randomization. Note that it relies on an open PR upstream in
lightning-c-bindingsand a separate open PR upstream for fuzzing. That's probably fine for fuzzing, but for bindings it kinda sucks. Hopefully we can get those merged soon.