diff --git a/src/index.ts b/src/index.ts index 42c4614ef6..7678fe5dcc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -69,6 +69,7 @@ export { state, State, declareState } from './lib/mina/state.js'; export type { JsonProof } from './lib/proof-system/zkprogram.js'; export { + type ProofBase, Proof, DynamicProof, SelfProof, diff --git a/src/lib/proof-system/sideloaded.unit-test.ts b/src/lib/proof-system/sideloaded.unit-test.ts index 5f397b443d..88bb40fca8 100644 --- a/src/lib/proof-system/sideloaded.unit-test.ts +++ b/src/lib/proof-system/sideloaded.unit-test.ts @@ -5,7 +5,7 @@ import { Void, ZkProgram, } from './zkprogram.js'; -import { Field, Struct } from '../../index.js'; +import { Field, SmartContract, Struct, method } from '../../index.js'; import { it, describe, before } from 'node:test'; import { expect } from 'expect'; @@ -124,6 +124,17 @@ const sideloadedProgram2 = ZkProgram({ }, }); +export class SideloadedSmartContract extends SmartContract { + @method async setValue( + value: Field, + proof: SampleSideloadedProof, + vk: VerificationKey + ) { + proof.verify(vk); + proof.publicInput.assertEquals(value); + } +} + describe('sideloaded', async () => { let program1Vk = (await program1.compile()).verificationKey; let program2Vk = (await program2.compile()).verificationKey; @@ -211,4 +222,8 @@ describe('sideloaded', async () => { expect(tag1).not.toStrictEqual(tag2); }); + + it('should compile with SmartContracts', async () => { + await SideloadedSmartContract.compile(); + }); }); diff --git a/src/lib/proof-system/zkprogram.ts b/src/lib/proof-system/zkprogram.ts index 43857b9cb2..d834e38d82 100644 --- a/src/lib/proof-system/zkprogram.ts +++ b/src/lib/proof-system/zkprogram.ts @@ -44,6 +44,7 @@ import { prefixes } from '../../bindings/crypto/constants.js'; // public API export { + ProofBase, Proof, DynamicProof, SelfProof, diff --git a/src/lib/provable/types/struct.ts b/src/lib/provable/types/struct.ts index c251509bb5..9cce8f932e 100644 --- a/src/lib/provable/types/struct.ts +++ b/src/lib/provable/types/struct.ts @@ -13,7 +13,7 @@ import type { IsPure, } from './provable-derivers.js'; import { Provable } from '../provable.js'; -import { Proof } from '../../proof-system/zkprogram.js'; +import { DynamicProof, Proof } from '../../proof-system/zkprogram.js'; import { ProvablePure } from './provable-intf.js'; import { From, InferValue } from '../../../bindings/lib/provable-generic.js'; @@ -310,7 +310,7 @@ function cloneCircuitValue(obj: T): T { if (isPrimitive(obj)) { return obj; } - if (obj instanceof Proof) { + if (obj instanceof Proof || obj instanceof DynamicProof) { return obj; }