Skip to content
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

Merged
merged 2 commits into from
Jul 5, 2023
Merged

Conversation

ThomasPiellard
Copy link
Collaborator

added pairing check result: fixes #741

Copy link

@DavePearce DavePearce left a 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).

// 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)))

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.

Copy link
Collaborator Author

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^^

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.

@ThomasPiellard ThomasPiellard requested review from ivokub and removed request for gbotrel July 4, 2023 20:21
Copy link

@DavePearce DavePearce left a 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)

@ThomasPiellard ThomasPiellard merged commit 81eb568 into develop Jul 5, 2023
4 checks passed
@ThomasPiellard ThomasPiellard deleted the fix/plonk_audit_4-4 branch July 5, 2023 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants