-
Notifications
You must be signed in to change notification settings - Fork 420
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
feat: [PLONK_AUDIT_4-4] fixes #741 #742
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.
See my comment about a missing and
against mload(add(state, state_success)
.
backend/plonk/bn254/solidity.go
Outdated
// l_success := true | ||
mstore(add(state, state_success), and(l_success,mload(add(state, state_success)))) | ||
let res_pairing := mload(0x00) | ||
mstore(add(state, state_success), and(l_success,eq(res_pairing,0x1))) |
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.
Hmmm, this doesn't seem equivalent. If state_success
is false
at this point (e.g. because say the quotient check failed) then you're ignoring that information? Seems to me like you need to and
against mload(add(state, state_success)
and res_pairing
.
Also, do you really need the eq(...,0x1)
. The yellow paper seems to me to say that the SNARKV precompiled contract either returns 0
or 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.
yep you're right, somehow I manage to make mistakes at each commits^^
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.
All good, that's what the process is for.
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.
Great, looks good to me now!
Also, you might want to think about adding some tests at some point (because the CI pipeline didn't fail with an error for an incorrect pairing check)
added pairing check result: fixes #741