-
Notifications
You must be signed in to change notification settings - Fork 297
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: Fixed a failing test and added a small fuzzer #1384
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.
Fuzzer stuff looks really cool, there's a bit of crypto I don't readily understand but I'll leave it to you if you feel it needs a look-over
@@ -184,6 +185,102 @@ concept InstructionWeightsEnabled = requires { | |||
typename T::InstructionWeights; | |||
T::InstructionWeights::_LIMIT; | |||
}; | |||
|
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 a function I've added for the future. I hope to create a variadic template for buffer mutations of elements so that anyone can build a fuzzer in 5 minutes with cool mutations
Thanks for reviewing. I'll ask @ledwards2225 to review the crypto part |
@@ -0,0 +1,275 @@ | |||
/** | |||
* @file goblin_translator_circuit_builder.cpp |
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.
I simply moved this code from .test.cpp and commented out all info and variables used just for info (messed with fuzzing)
ASSERT(uint256_t(limbs[NUM_BINARY_LIMBS - 1]) < (uint256_t(1) << NUM_LAST_LIMB_BITS)); | ||
} else { | ||
|
||
ASSERT(uint256_t(limbs[NUM_BINARY_LIMBS - 1]) < (SHIFT_1)); |
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 the fix
using Fr = ::curve::BN254::ScalarField; | ||
using Fq = ::curve::BN254::BaseField; | ||
|
||
extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) |
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.
Created a mini-fuzzer which explored possible values and quickly found the assert issue.
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.
Fix LGTM
Goblin translator tests were failing due to an incorrect assert (with certain probability). Added a small fuzzer that helped find the bug.
Checklist:
Remove the checklist to signal you've completed it. Enable auto-merge if the PR is ready to merge.