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

Out-of-SNARK, use dummy vk hash when verification key is omitted #13394

Merged
merged 7 commits into from
Jun 22, 2023

Conversation

psteckler
Copy link
Member

@psteckler psteckler commented Jun 12, 2023

In the zkApp transaction logic when running in-SNARK, there was a mismatch between the account update verification key hash and the account verification key hash when the vk was omitted (because the authorization was not Proof). Use dummy_vk_hash in both cases.

@psteckler psteckler requested a review from a team as a code owner June 12, 2023 21:34
@psteckler
Copy link
Member Author

!ci-build-me

@@ -1003,8 +1003,12 @@ module Make_str (A : Wire_types.Concrete) = struct
}

let verification_key_hash (a : t) : Verification_key_hash.t =
verification_key a |> Zkapp_basic.Flagged_option.data
|> Data_as_hash.hash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default hash is set here when converting between in-snark and outside-snark values.

The other side of the mismatch is here, the default is set to Field.zero in account updates.

It seems like we should update in either of these two places and not add a separate check as done in the PR. I'm leaning more towards updating the default value in account updates and have it be consistent across rest of the code base (use dummy vk hash) everywhere else.
Was that something you explored but found not to be suitable/working?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the dummy vk hash is a better idea, thanks.

I'll update this PR.

@psteckler psteckler changed the title In-SNARK, return Field.zero hash when verification key is omitted Out-of-SNARK, use dummy vk hash when verification key is omitted Jun 13, 2023
@psteckler
Copy link
Member Author

!ci-build-me

@psteckler
Copy link
Member Author

!ci-build-me

@psteckler
Copy link
Member Author

!ci-build-me

@mrmr1993
Copy link
Member

!approved-for-mainnet

@psteckler psteckler merged commit f9e54a2 into berkeley Jun 22, 2023
44 checks passed
@psteckler psteckler deleted the fix/vk-hashes-in-snark branch June 22, 2023 19:13
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.

None yet

3 participants