-
Notifications
You must be signed in to change notification settings - Fork 137
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 revertibleRandom
with module test
#3025
Fix revertibleRandom
with module test
#3025
Conversation
Cadence Benchstat comparisonThis branch with compared with the base branch onflow:master commit 3843c42 Collapsed results for better readability
|
// build a big Int from the modulo buffer, with the required `ty` size | ||
// big.Int are used as they cover all the tested types including the small ones (UInt8 ..) | ||
modulo := new(big.Int).SetBytes(moduloBuffer[:typeToBytes(t, ty)]) | ||
modulo := new(big.Int).SetBytes(moduloBuffer[:byteSize]) |
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.
Nit: we could use this big.Int
to check for zero (using Cmp
) instead of the buffer byte check (no need to open a new PR but it can be added in future changes).
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.
Good idea, could you please open a PR?
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.
yep, will clean it up in a few days.
Description
Ensure random modulo argument is non-zero.
This fixes the flaky tests we're encountering
master
branchFiles changed
in the Github PR explorer