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

chore(ci): ensure that prover.toml files in protocol circuits are in sync #11141

Merged
merged 8 commits into from
Jan 10, 2025
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
8 changes: 7 additions & 1 deletion noir-projects/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ test-protocol-circuits:
# TODO(#10754): Remove --skip-brillig-constraints-check
RUN cd /usr/src/noir-projects/noir-protocol-circuits && nargo test --silence-warnings --skip-brillig-constraints-check

# Also execute circuits to ensure that `Prover.toml` files are in sync.
LET circuits = "private-kernel-init private-kernel-inner private-kernel-reset private-kernel-tail-to-public private-kernel-tail rollup-base-private rollup-base-public rollup-block-root rollup-block-merge rollup-merge rollup-root"
FOR circuit IN $circuits
RUN cd /usr/src/noir-projects/noir-protocol-circuits/crates/$circuit && nargo execute --silence-warnings --skip-brillig-constraints-check
END

test-aztec-nr:
FROM ../+bootstrap
ENV PATH="/usr/src/noir/noir-repo/target/release:${PATH}"
Expand Down Expand Up @@ -69,4 +75,4 @@ public-functions-report:

RUN cd noir-contracts && node ./scripts/publicFunctionsSizeReport.js ./target/

SAVE ARTIFACT ./noir-contracts/public_functions_report.json public_functions_report.json
SAVE ARTIFACT ./noir-contracts/public_functions_report.json public_functions_report.json
2 changes: 1 addition & 1 deletion noir-projects/noir-protocol-circuits/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ target
crates/autogenerated
/Nargo.toml
/private_kernel_reset_dimensions.json
install-state.gz
install-state.gz

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1,101 changes: 370 additions & 731 deletions noir-projects/noir-protocol-circuits/crates/rollup-base-private/Prover.toml

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

25,740 changes: 12,859 additions & 12,881 deletions noir-projects/noir-protocol-circuits/crates/rollup-block-root/Prover.toml

Large diffs are not rendered by default.

504 changes: 252 additions & 252 deletions noir-projects/noir-protocol-circuits/crates/rollup-merge/Prover.toml

Large diffs are not rendered by default.

550 changes: 275 additions & 275 deletions noir-projects/noir-protocol-circuits/crates/rollup-root/Prover.toml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions yarn-project/bb-prover/src/prover/bb_private_kernel_prover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
convertPrivateKernelTailOutputsFromWitnessMapWithAbi,
convertPrivateKernelTailToPublicInputsToWitnessMapWithAbi,
getPrivateKernelResetArtifactName,
updateResetCircuitSampleInputs,
} from '@aztec/noir-protocol-circuits-types/client';
import { type ArtifactProvider, type ClientProtocolArtifact } from '@aztec/noir-protocol-circuits-types/types';
import { ClientCircuitVks } from '@aztec/noir-protocol-circuits-types/vks';
Expand Down Expand Up @@ -98,6 +99,7 @@ export abstract class BBPrivateKernelProver implements PrivateKernelProver {
public async simulateReset(
inputs: PrivateKernelResetCircuitPrivateInputs,
): Promise<PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>> {
updateResetCircuitSampleInputs(inputs);
const variantInputs = inputs.trimToSizes();
const artifactName = getPrivateKernelResetArtifactName(inputs.dimensions);
return await this.simulateCircuitOutput(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export {
convertPrivateKernelTailToPublicInputsToWitnessMapWithAbi,
} from '../../execution/client.js';

export { getPrivateKernelResetArtifactName } from '../../utils/private_kernel_reset.js';
export { getPrivateKernelResetArtifactName, updateResetCircuitSampleInputs } from '../../utils/private_kernel_reset.js';
export {
maxPrivateKernelResetDimensions,
privateKernelResetDimensionsConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ export function convertPrivateKernelResetInputsToWitnessMapWithAbi<
),
hints: mapPrivateKernelResetHintsToNoir(privateKernelResetCircuitPrivateInputs.hints),
};
pushTestData('private-kernel-reset', mapped);
const initialWitnessMap = abiEncode(resetAbi, mapped);
return initialWitnessMap;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
import { type PrivateKernelResetDimensions, privateKernelResetDimensionNames } from '@aztec/circuits.js';
import {
type PrivateKernelResetCircuitPrivateInputs,
type PrivateKernelResetDimensions,
privateKernelResetDimensionNames,
} from '@aztec/circuits.js';
import { pushTestData } from '@aztec/foundation/testing';

import {
mapPrivateKernelCircuitPublicInputsToNoir,
mapPrivateKernelDataToNoir,
mapPrivateKernelResetHintsToNoir,
} from '../conversion/client.js';
import { PrivateKernelResetArtifactFileNames, type PrivateResetArtifact } from '../private_kernel_reset_types.js';

export function createPrivateKernelResetTag(dimensions: PrivateKernelResetDimensions) {
Expand All @@ -14,3 +24,22 @@ export function getPrivateKernelResetArtifactName(dimensions: PrivateKernelReset
}
return name;
}

/**
* TODO: This is a hack so we can write full reset inputs to a Prover.toml.
* Ideally we remove it in favour of adding a test that runs a full reset.
*/
export function updateResetCircuitSampleInputs(
privateKernelResetCircuitPrivateInputs: PrivateKernelResetCircuitPrivateInputs,
) {
/* eslint-disable camelcase */
const inputs = {
previous_kernel: mapPrivateKernelDataToNoir(privateKernelResetCircuitPrivateInputs.previousKernel),
previous_kernel_public_inputs: mapPrivateKernelCircuitPublicInputsToNoir(
privateKernelResetCircuitPrivateInputs.previousKernel.publicInputs,
),
hints: mapPrivateKernelResetHintsToNoir(privateKernelResetCircuitPrivateInputs.hints),
};

pushTestData('private-kernel-reset', inputs);
}
Loading