@@ -100,26 +100,26 @@ runs:
100100 echo "$HOME/.aztec/versions/${{ steps.aztec-version.outputs.version }}/node_modules/.bin" >> $GITHUB_PATH
101101 echo "$HOME/.foundry/bin" >> $GITHUB_PATH
102102
103- # Cache compiled contract artifacts. Keyed on the noir source + Nargo.toml
104- # so any contract change busts the cache cleanly.
105- - name : Cache contract artifacts
106- id : contracts-cache
107- uses : actions/cache@v4
108- with :
109- path : |
110- packages/contracts/aztec/noir/target
111- packages/ contracts/aztec/noir/artifacts
112- key : contracts-${{ runner.os }}-${{ steps.aztec-version.outputs.version }}-${{ hashFiles('packages/contracts/aztec/noir/**/*.nr', 'packages/contracts/aztec/noir/**/Nargo.toml') }}
113-
114- - name : Compile contracts
115- if : steps.contracts-cache.outputs.cache-hit != 'true'
116- shell : bash
117- run : yarn workspace @aztec-kit/contracts-aztec build
118-
119- # Turbo's local cache + build outputs. Not suffixed with `cache-suffix`:
120- # emitted artifacts are platform-independent, so any job can read what
121- # another wrote under the same SHA. `restore-keys` fallback lets a first
122- # run on a new branch pick up the most recent main-branch cache .
103+ # Turbo's local cache + build outputs. Single source of truth for ALL
104+ # compiled artifacts in any given run: `dist/`, `noir/target/`,
105+ # `noir/artifacts/`, the ethereum codegen, etc. — every output `turbo.json`
106+ # lists for the `build` task lives here.
107+ #
108+ # An earlier version had a second cache that stored just `noir/target` +
109+ # `noir/artifacts` keyed on the noir-source hash, and a conditional
110+ # pre-build compile step that primed it. That created two independent
111+ # writers for the same files: when the contracts cache hit but the turbo
112+ # cache fell back to a different (older) `restore-keys` prefix entry,
113+ # the e2e job ended up with `noir/target/*.json` from one compile and
114+ # `dist/noir/target/*.json` from a different compile. Class-id mismatch
115+ # at signup time (PXE rejects the artifact). Folding everything into
116+ # turbo's per-SHA cache keeps the two paths in lockstep.
117+ #
118+ # Not suffixed with `cache-suffix`: emitted artifacts are platform-
119+ # independent, so any job can read what another wrote under the same SHA.
120+ # The aztec-version is part of the key prefix so that on a version bump
121+ # the `restore-keys` fallback doesn't drag in the previous version's
122+ # `dist/` while `noir/target/` recompiles to the new version's output .
123123 - name : Cache turbo outputs
124124 uses : actions/cache@v4
125125 with :
@@ -132,8 +132,10 @@ runs:
132132 apps/*/dist
133133 packages/*/dist
134134 packages/contracts/*/dist
135+ packages/contracts/aztec/noir/target
136+ packages/contracts/aztec/noir/artifacts
135137 packages/contracts/ethereum/generated
136138 packages/contracts/ethereum/solidity/out
137- key : turbo-${{ runner.os }}-${{ github.sha }}
139+ key : turbo-${{ runner.os }}-${{ steps.aztec-version.outputs.version }}-${{ github.sha }}
138140 restore-keys : |
139- turbo-${{ runner.os }}-
141+ turbo-${{ runner.os }}-${{ steps.aztec-version.outputs.version }}-
0 commit comments