Skip to content

Commit

Permalink
linked issues + fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Jan 29, 2024
1 parent 2e43cf0 commit 485611b
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ Destroys the backend
generateFinalProof(decompressedWitness): Promise<ProofData>
```

Generate a final proof. This is the proof for the circuit which will verify
intermediate proofs and or can be seen as the proof created for regular circuits.

#### Parameters

| Parameter | Type |
Expand All @@ -65,10 +68,6 @@ generateFinalProof(decompressedWitness): Promise<ProofData>

[`Backend`](../interfaces/Backend.md).[`generateFinalProof`](../interfaces/Backend.md#generatefinalproof)

#### Description

Generates a final proof (not meant to be verified in another circuit)

***

### generateIntermediateProof()
Expand All @@ -77,6 +76,14 @@ Generates a final proof (not meant to be verified in another circuit)
generateIntermediateProof(witness): Promise<ProofData>
```

Generates an intermediate proof. This is the proof that can be verified
in another circuit.

This is sometimes referred to as a recursive proof.
We avoid this terminology as the only property of this proof
that matters is the fact that it is easy to verify in another circuit.
We _could_ choose to verify this proof outside of a circuit just as easily.

#### Parameters

| Parameter | Type |
Expand Down Expand Up @@ -105,6 +112,16 @@ const intermediateProof = await backend.generateIntermediateProof(witness);
generateIntermediateProofArtifacts(proofData, numOfPublicInputs): Promise<object>
```

Generates artifacts that will be passed to a circuit that will verify this proof.

Instead of passing the proof and verification key as a byte array, we pass them
as fields which makes it cheaper to verify in a circuit.

The proof that is passed here will have been created using the `generateIntermediateProof`
method.

The number of public inputs denotes how many public inputs are in the inner proof.

#### Parameters

| Parameter | Type | Default value |
Expand Down
1 change: 1 addition & 0 deletions yarn-project/circuits.js/src/structs/tx_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export class TxContext {
* Contract deployment data.
*/
public contractDeploymentData: ContractDeploymentData,
// TODO(#4256): The following two fields are most likely redundant now and should be removed.
/**
* Chain ID of the transaction. Here for replay protection.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,8 @@ global HEADER_LENGTH: Field = 18; // 2 for last_archive, 2 for body hash, 10 for
global FUNCTION_DATA_LENGTH: Field = 4;
global CONTRACT_DEPLOYMENT_DATA_LENGTH: Field = 6;
// Change this ONLY if you have changed the PrivateCircuitPublicInputs structure.
// In other words, if the structure/size of the public inputs of a function call changes then we
// should change this constant as well as the offsets in private_call_stack_item.nr
// TODO(benesjan): Didn't find any offsets in call_stack_item.nr is this ^ still relevant
// In other words, if the structure/size of the public inputs of a function call changes then we should change this
// constant as well CALL_PRIVATE_FUNCTION_RETURN_SIZE and PRIVATE_CIRCUIT_PUBLIC_INPUTS_HASH_INPUT_LENGTH
global PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH: Field = 200;
global CONTRACT_STORAGE_UPDATE_REQUEST_LENGTH: Field = 3;
global CONTRACT_STORAGE_READ_LENGTH: Field = 2;
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/pxe/src/database/pxe_database_test_suite.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { INITIAL_L2_BLOCK_NUM, NoteFilter, randomTxHash } from '@aztec/circuit-types';
import { AztecAddress, CompleteAddress } from '@aztec/circuits.js';
import { makeGlobalVariables, makeHeader } from '@aztec/circuits.js/factories';
import { makeHeader } from '@aztec/circuits.js/factories';
import { Fr, Point } from '@aztec/foundation/fields';
import { BenchmarkingContractArtifact } from '@aztec/noir-contracts/Benchmarking';
import { SerializableContractInstance } from '@aztec/types/contracts';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export async function makeProcessedTx(
export function makeEmptyProcessedTx(header: Header, chainId: Fr, version: Fr): Promise<ProcessedTx> {
const emptyKernelOutput = PublicKernelPublicInputs.empty();
emptyKernelOutput.constants.header = header;
// TODO(benesjan): These values are now redundant. Should we remove them from TxContext?
// TODO(#4256): The following two fields are most likely redundant now and should be removed.
emptyKernelOutput.constants.txContext.chainId = chainId;
emptyKernelOutput.constants.txContext.version = version;
const emptyProof = makeEmptyProof();
Expand Down

0 comments on commit 485611b

Please sign in to comment.