Skip to content

Commit 94e4942

Browse files
committed
Merge remote-tracking branch 'origin/main' into brian/remove-bindings-submodule
2 parents a2caec6 + 4ca3d17 commit 94e4942

File tree

4 files changed

+34
-4
lines changed

4 files changed

+34
-4
lines changed

flake.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/proof-system/proof.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,22 @@ class ProofBase<Input = any, Output = any> {
123123
}
124124

125125
class Proof<Input, Output> extends ProofBase<Input, Output> {
126+
/**
127+
* Sets the `shouldVerify` flag to `true`
128+
* The downstream effect of this is that the proof will be verified when the circuit is run
129+
*
130+
* @note This method is meant to be called in a circuit. Executing it outside of a circuit will have no effect.
131+
*/
126132
verify() {
127133
this.shouldVerify = Bool(true);
128134
}
135+
/**
136+
* Sets the `shouldVerify` flag to the given condition param
137+
* If set to `Bool(true)`, the proof will be verified when the circuit is run
138+
* If set to `Bool(false)`, the proof will not be verified when the circuit is run
139+
*
140+
* @note This method is meant to be called in a circuit. Executing it outside of a circuit will have no effect.
141+
*/
129142
verifyIf(condition: Bool) {
130143
this.shouldVerify = condition;
131144
}
@@ -254,13 +267,29 @@ class DynamicProof<Input, Output> extends ProofBase<Input, Output> {
254267
usedVerificationKey?: VerificationKey;
255268

256269
/**
257-
* Verifies this DynamicProof using a given verification key
270+
* Sets the `shouldVerify` flag to `true`
271+
* The downstream effect of this is that the proof will be verified when the circuit is run
272+
*
258273
* @param vk The verification key this proof will be verified against
274+
*
275+
* @note This method is meant to be called in a circuit. Executing it outside of a circuit will have no effect.
276+
* @note The vk parameter will have its auxiliary data checked in the circuit, so the hash must match the data, or else the proof will fail
259277
*/
260278
verify(vk: VerificationKey) {
261279
this.shouldVerify = Bool(true);
262280
this.usedVerificationKey = vk;
263281
}
282+
/**
283+
* Sets the `shouldVerify` flag to the given condition param
284+
* If set to `Bool(true)`, the proof will be verified when the circuit is run
285+
* If set to `Bool(false)`, the proof will not be verified when the circuit is run
286+
*
287+
* @param vk The verification key this proof will be verified against
288+
* @param condition The condition to set the shouldVerify flag to
289+
*
290+
* @note This method is meant to be called in a circuit. Executing it outside of a circuit will have no effect.
291+
* @note The vk parameter will have its auxiliary data checked in the circuit, so the hash must match the data, or else the proof will fail
292+
*/
264293
verifyIf(vk: VerificationKey, condition: Bool) {
265294
this.shouldVerify = condition;
266295
this.usedVerificationKey = vk;

src/lib/proof-system/zkprogram.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ function createProgramState() {
101101
/**
102102
* Initializes Pickles bindings, serializes the input proof and verification key for use in OCaml, then calls into the Pickles verify function and returns the result.
103103
*
104+
* @note This function is meant to be called in JavaScript, not for use in a circuit. The verification key data and hash are not confirmed to match.
104105
* @param proof Either a `Proof` instance or a serialized JSON proof
105106
* @param verificationKey Either a base64 serialized verification key or a `VerificationKey` instance which will be base64 serialized for use in the bindings.
106107
* @returns A promise that resolves to a boolean indicating whether the proof is valid.

src/mina

Submodule mina updated 48 files

0 commit comments

Comments
 (0)