From c978754b800c9e1ff8bc784caf1b9e6db1a75135 Mon Sep 17 00:00:00 2001 From: Raphael Panic Date: Thu, 3 Oct 2024 18:33:05 +0200 Subject: [PATCH 1/4] Added method to retrieve dummy VerificationKey --- src/lib/proof-system/zkprogram.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/proof-system/zkprogram.ts b/src/lib/proof-system/zkprogram.ts index dea019650..3d853992e 100644 --- a/src/lib/proof-system/zkprogram.ts +++ b/src/lib/proof-system/zkprogram.ts @@ -460,7 +460,14 @@ class VerificationKey extends Struct({ toJSON({ data }: { data: string }) { return data; }, -}) {} +}) { + static dummy(): VerificationKey { + const [, data, hash] = Pickles.dummyVerificationKey(); + return new VerificationKey({ + data, hash: Field(hash) + }) + } +} function sortMethodArguments( programName: string, From 6007f63155abda3bbf05674e2a8e295a3c697eb9 Mon Sep 17 00:00:00 2001 From: Florian Date: Fri, 4 Oct 2024 09:37:34 +0200 Subject: [PATCH 2/4] add changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8c149a48..6cde271da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased](https://github.com/o1-labs/o1js/compare/450943...HEAD) +### Added + +- Added `VerificationKey.dummy()` method to get the dummy value of a verification key https://github.com/o1-labs/o1js/pull/1852 [@rpanic](https://github.com/rpanic) + ## [1.8.0](https://github.com/o1-labs/o1js/compare/5006e4f...450943) - 2024-09-18 ### Added From 8ceca5ed757bb875e7b81db92d9a469d1070110f Mon Sep 17 00:00:00 2001 From: Florian Date: Fri, 4 Oct 2024 09:37:44 +0200 Subject: [PATCH 3/4] initialize bindings --- src/lib/proof-system/zkprogram.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib/proof-system/zkprogram.ts b/src/lib/proof-system/zkprogram.ts index 3d853992e..6c3165f99 100644 --- a/src/lib/proof-system/zkprogram.ts +++ b/src/lib/proof-system/zkprogram.ts @@ -461,11 +461,13 @@ class VerificationKey extends Struct({ return data; }, }) { - static dummy(): VerificationKey { + static async dummy(): Promise { + await initializeBindings(); const [, data, hash] = Pickles.dummyVerificationKey(); return new VerificationKey({ - data, hash: Field(hash) - }) + data, + hash: Field(hash), + }); } } From ca9bb8855bd3061877e61ff87ae6a51096010e16 Mon Sep 17 00:00:00 2001 From: Florian Date: Fri, 4 Oct 2024 09:41:20 +0200 Subject: [PATCH 4/4] replace occurrence of old dummy vk --- src/lib/mina/zkapp.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lib/mina/zkapp.ts b/src/lib/mina/zkapp.ts index 7c6402164..aaa444b09 100644 --- a/src/lib/mina/zkapp.ts +++ b/src/lib/mina/zkapp.ts @@ -50,6 +50,7 @@ import { methodArgumentTypesAndValues, MethodInterface, sortMethodArguments, + VerificationKey, } from '../proof-system/zkprogram.js'; import { Proof } from '../proof-system/proof.js'; import { PublicKey } from '../provable/crypto/signature.js'; @@ -711,9 +712,7 @@ class SmartContract extends SmartContractBase { ._verificationKey; if (verificationKey === undefined) { if (!Mina.getProofsEnabled()) { - await initializeBindings(); - let [, data, hash] = Pickles.dummyVerificationKey(); - verificationKey = { data, hash: Field(hash) }; + verificationKey = await VerificationKey.dummy(); } else { throw Error( `\`${this.constructor.name}.deploy()\` was called but no verification key was found.\n` +