chore(noir-projects): include constants.nr in protocol-circuits compile cache key#23015
Closed
AztecBot wants to merge 1 commit into
Closed
chore(noir-projects): include constants.nr in protocol-circuits compile cache key#23015AztecBot wants to merge 1 commit into
AztecBot wants to merge 1 commit into
Conversation
Collaborator
Author
|
Automatically closing this stale claudebox draft PR (no updates for 5+ days). Re-open if still needed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Most recent merge-train/barretenberg CI run failed on a single test out of ~8000:
Run: https://github.com/AztecProtocol/aztec-packages/actions/runs/25474428940
Log: http://ci.aztec-labs.com/1778123397019978
The branch's source code is internally consistent at length 127:
constants.nr:616—MEGA_VK_LENGTH_IN_FIELDS: u32 = 127verification_key.nr:24-26—ChonkVerificationKey = VerificationKey<MEGA_VK_LENGTH_IN_FIELDS>private-kernel-init/Prover.toml— exactly 127vk.keyfield entriesto_field_elements()—3 (metadata) + 31 × 4 (commitments) = 127MEGA_VK_LENGTH_IN_FIELDShas been 127 throughout git history —git log -G "MEGA_VK_LENGTH_IN_FIELDS"shows no commit at 139.A freshly-built
nargo(release, noir submodule atd52888d57c= nightly-2026-05-05, the version pinned by this branch) compilesprivate_kernel_initand producestarget/private_kernel_init.jsonwithvk.key.type.length = 127.nargo executethen printsCircuit witness successfully solved. The failure does not reproduce locally.Diagnosis
For nargo to type-check the input as
Array { length: 139 }while source agrees on 127, thetarget/<name>.jsonartifact in CI must have come from a cache populated when the compile produced 139.compile()innoir-projects/noir-protocol-circuits/bootstrap.shkeys cached artifacts as:Locally I verified that toggling
MEGA_VK_LENGTH_IN_FIELDSbetween 127 and 139 does changeprogram_hash(87b6db9679f8ef13vsb2aa470d6ac30748), so in principle the formula should bust the cache when the constant changes. In practice this CI failure proves it isn't sufficient — most likely a 64-bitprogram_hashcollision across noir versions or a pipeline path where the hash is taken before full monomorphization.The same hazard is exactly what
barretenberg/cpp/CLAUDE.mddocuments in #23014 (the commit on top of this branch when CI ran), but framed aroundChonkProofData/proof length.ChonkVerificationKeylength sits on the same axis.Fix
Add
crates/types/src/constants.nrto thecache_content_hashregex insidecompile(). That file holds all the proof/VK length globals that propagate into ABI array sizes (CHONK_PROOF_LENGTH,MEGA_VK_LENGTH_IN_FIELDS, etc.). Including it makes any change to those constants deterministically bust cachedcircuit-*.tar.gzartifacts, independent ofnargo check --show-program-hash. It also busts the currently-poisoned cache entry, letting the next CI run recompile cleanly.The pre-existing comment about deliberately excluding
circuits_hash(so unrelated test/comment edits don't force global rebuilds) is preserved — this change only adds the one constants file.Verification
bash -n noir-projects/noir-protocol-circuits/bootstrap.sh— syntax OK.nargo execute --program-dir noir-projects/noir-protocol-circuits/crates/<crate>printsCircuit witness successfully solvedforprivate-kernel-init,private-kernel-inner,private-kernel-reset,rollup-tx-base-private.Detailed analysis: https://gist.github.com/AztecBot/bcfd1fa804e1df126df0d6d9d5e4a59f
ClaudeBox log: https://claudebox.work/s/dcab673e828476ab?run=1