Skip to content

Commit

Permalink
Merge pull request #1852 from rpanic/rpanic/expose-dummy-vk
Browse files Browse the repository at this point in the history
Expose dummy VerificationKey
  • Loading branch information
Trivo25 authored Oct 4, 2024
2 parents 5277324 + ca9bb88 commit 0cd022d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions src/lib/mina/zkapp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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` +
Expand Down
11 changes: 10 additions & 1 deletion src/lib/proof-system/zkprogram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,16 @@ class VerificationKey extends Struct({
toJSON({ data }: { data: string }) {
return data;
},
}) {}
}) {
static async dummy(): Promise<VerificationKey> {
await initializeBindings();
const [, data, hash] = Pickles.dummyVerificationKey();
return new VerificationKey({
data,
hash: Field(hash),
});
}
}

function sortMethodArguments(
programName: string,
Expand Down

0 comments on commit 0cd022d

Please sign in to comment.