Skip to content
Draft
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
1 change: 1 addition & 0 deletions yarn-project/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ noir-contracts.js/**/*.json
noir-contracts.js/src
noir-test-contracts.js/**/*.json
noir-test-contracts.js/src
standard-contracts/src/**/pinned/*.json
noir-protocol-circuits-types/src/target/*
*.md
end-to-end/src/fixtures/dumps/*.json
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Release-branch reproducibility gate for the auth_registry contract.
//
// Symmetric to the freshness gate in `derive_auth_registry.test.ts`: that test asserts the
// committed `.nr` stamp / TS twin stay aligned with the freshly-built artifact. This test goes
// one level further and pins the *full artifact JSON* so a release branch can detect any
// unintended bytecode drift between the pinned release artifact and the current build output.
//
// TODO: enable on release branches. Run manually with:
// yarn workspace @aztec/standard-contracts test src/auth-registry/reproducibility.test.ts
// and then drop the `it.skip` once the release branch is cut.
import { createHash } from 'node:crypto';
import { promises as fs } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';

const __dirname = path.dirname(fileURLToPath(import.meta.url));
const ARTIFACT_PATH = path.join(
__dirname,
'../../../../noir-projects/noir-contracts/target/auth_registry_contract-AuthRegistry.json',
);
const PINNED_ARTIFACT_PATH = path.join(__dirname, 'pinned/AuthRegistry.artifact.json');

const REGEN_HINT =
'auth_registry pinned artifact is stale; if this drift is intentional on a release branch, copy ' +
`${ARTIFACT_PATH} over ${PINNED_ARTIFACT_PATH} and commit the result.`;

describe('auth_registry artifact reproducibility', () => {
it.skip('committed pinned artifact matches the freshly-built artifact byte-for-byte', async () => {
const [pinned, fresh] = await Promise.all([fs.readFile(PINNED_ARTIFACT_PATH), fs.readFile(ARTIFACT_PATH)]);
const pinnedHash = createHash('sha256').update(pinned).digest('hex');
const freshHash = createHash('sha256').update(fresh).digest('hex');
if (pinnedHash !== freshHash) {
throw new Error(`${REGEN_HINT}\n pinned sha256 = ${pinnedHash}\n fresh sha256 = ${freshHash}`);
}
});
});

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Release-branch reproducibility gate for the multi_call_entrypoint contract.
//
// Symmetric to the freshness gate in `derive_multi_call_entrypoint.test.ts`: that test asserts
// the committed TS twin stays aligned with the freshly-built artifact. This test goes one level
// further and pins the *full artifact JSON* so a release branch can detect any unintended
// bytecode drift between the pinned release artifact and the current build output.
//
// TODO: enable on release branches. Run manually with:
// yarn workspace @aztec/standard-contracts test src/multi-call-entrypoint/reproducibility.test.ts
// and then drop the `it.skip` once the release branch is cut.
import { createHash } from 'node:crypto';
import { promises as fs } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';

const __dirname = path.dirname(fileURLToPath(import.meta.url));
const ARTIFACT_PATH = path.join(
__dirname,
'../../../../noir-projects/noir-contracts/target/multi_call_entrypoint_contract-MultiCallEntrypoint.json',
);
const PINNED_ARTIFACT_PATH = path.join(__dirname, 'pinned/MultiCallEntrypoint.artifact.json');

const REGEN_HINT =
'multi_call_entrypoint pinned artifact is stale; if this drift is intentional on a release branch, copy ' +
`${ARTIFACT_PATH} over ${PINNED_ARTIFACT_PATH} and commit the result.`;

describe('multi_call_entrypoint artifact reproducibility', () => {
it.skip('committed pinned artifact matches the freshly-built artifact byte-for-byte', async () => {
const [pinned, fresh] = await Promise.all([fs.readFile(PINNED_ARTIFACT_PATH), fs.readFile(ARTIFACT_PATH)]);
const pinnedHash = createHash('sha256').update(pinned).digest('hex');
const freshHash = createHash('sha256').update(fresh).digest('hex');
if (pinnedHash !== freshHash) {
throw new Error(`${REGEN_HINT}\n pinned sha256 = ${pinnedHash}\n fresh sha256 = ${freshHash}`);
}
});
});

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Release-branch reproducibility gate for the public_checks contract.
//
// Symmetric to the freshness gate in `derive_public_checks.test.ts`: that test asserts the
// committed `.nr` stamp / TS twin stay aligned with the freshly-built artifact. This test goes
// one level further and pins the *full artifact JSON* so a release branch can detect any
// unintended bytecode drift between the pinned release artifact and the current build output.
//
// TODO: enable on release branches. Run manually with:
// yarn workspace @aztec/standard-contracts test src/public-checks/reproducibility.test.ts
// and then drop the `it.skip` once the release branch is cut.
import { createHash } from 'node:crypto';
import { promises as fs } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';

const __dirname = path.dirname(fileURLToPath(import.meta.url));
const ARTIFACT_PATH = path.join(
__dirname,
'../../../../noir-projects/noir-contracts/target/public_checks_contract-PublicChecks.json',
);
const PINNED_ARTIFACT_PATH = path.join(__dirname, 'pinned/PublicChecks.artifact.json');

const REGEN_HINT =
'public_checks pinned artifact is stale; if this drift is intentional on a release branch, copy ' +
`${ARTIFACT_PATH} over ${PINNED_ARTIFACT_PATH} and commit the result.`;

describe('public_checks artifact reproducibility', () => {
it.skip('committed pinned artifact matches the freshly-built artifact byte-for-byte', async () => {
const [pinned, fresh] = await Promise.all([fs.readFile(PINNED_ARTIFACT_PATH), fs.readFile(ARTIFACT_PATH)]);
const pinnedHash = createHash('sha256').update(pinned).digest('hex');
const freshHash = createHash('sha256').update(fresh).digest('hex');
if (pinnedHash !== freshHash) {
throw new Error(`${REGEN_HINT}\n pinned sha256 = ${pinnedHash}\n fresh sha256 = ${freshHash}`);
}
});
});
Loading