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

Expose dummy VerificationKey #1852

Merged
merged 4 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading