-
Notifications
You must be signed in to change notification settings - Fork 10
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/secp256k1 #99
fix/secp256k1 #99
Conversation
mistermoe
commented
Oct 26, 2023
- Account for signatures less than 64 bytes
- add test
- bump version
Co-Authored-By: Tom Daffurn <[email protected]>
Co-Authored-By: Tom Daffurn <[email protected]>
Co-Authored-By: Tom Daffurn <[email protected]>
Co-Authored-By: Tom Daffurn <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #99 +/- ##
==========================================
+ Coverage 69.92% 70.10% +0.18%
==========================================
Files 21 21
Lines 1197 1201 +4
Branches 135 137 +2
==========================================
+ Hits 837 842 +5
Misses 292 292
+ Partials 68 67 -1
|
* @param size The expected fixed length of the resulting byte array. | ||
* @return A [ByteArray] of size [size], representing the [BigInteger] value. | ||
*/ | ||
private fun BigInteger.toFixedByteArray(size: Int): ByteArray { |
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.
TIL you can private
a function outside of a class in Kotlin
} | ||
|
||
@Test | ||
fun fuzz() { |
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.
fun fuzz() { | |
fun `can verify 10k random payloads`() { |
or whatevs, not sure what the intent here is
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.
point here is to generate a sufficient number of signatures (aka 2 big ints) across a large enough surface area to suss out any edge cases there may be with signature verification
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.
cool with "pressure test signature verification" as the test name?
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.
yup 👍
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.
done - 8049d78
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.
lgtm, smol suggestion
Would have been awesome to identify a test that fails before, but passes now.
good point @andresuribe87 . will keep this in mind for future PRs! less valuable now but for context: we were running into intermittent unit test failures on the tbdex side w.r.t. signature verification e.g.
@tomdaffurn and i narrowed it down to secp256k1 and wrote the test that we added to this PR to consistently reproduce the issue. we used the failing test to track down and fix the bug. is this the type of context you were suggesting might be helpful? |
Co-authored-by: Andres Uribe <[email protected]>
@mistermoe I meant more to include a test in this PR that always failed before your fix, but passes after the fix. Sounds like you kinda had it? No big deal. Context was super useful, thx! |