Skip to content

Commit 9556432

Browse files
committed
fixes
1 parent 23ae70a commit 9556432

4 files changed

Lines changed: 24 additions & 19 deletions

File tree

ci3/release_prep_package_json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,13 @@ for deps in dependencies devDependencies peerDependencies; do
2222
mv tmp.json package.json
2323
done
2424
done
25+
26+
# Stamp aztec_version into any published noir contract artifacts in artifacts/*.json. The build-time stamp in
27+
# noir-projects/noir-contracts/bootstrap.sh writes "dev"; $version here is the authoritative release version about to
28+
# be written to package.json. We cannot stamp real version in bootstrap because there we don't have access to it.
29+
if [ -d artifacts ]; then
30+
for f in artifacts/*.json; do
31+
[ -e "$f" ] || continue
32+
jq --arg v "$version" '.aztec_version = $v' "$f" >$tmp && mv $tmp "$f"
33+
done
34+
fi

noir-projects/noir-contracts/bootstrap.sh

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,20 +93,17 @@ function get_contract_path {
9393
}
9494
export -f get_contract_path
9595

96-
# Stamps the aztec version into a contract artifact JSON in place. Mirrors stampAztecVersion in
97-
# yarn-project/aztec/src/cli/cmds/compile.ts so monorepo-built artifacts match those produced by `aztec compile`.
98-
# On release builds (REF_NAME is valid semver) the tag without the leading "v" is used; otherwise "dev".
99-
function stamp_aztec_version {
96+
# Stamps "dev" (DEV_VERSION) as the artifact's aztec_version - that is the expected version of a locally checked out
97+
# monorepo. The real release version is applied at publish time by whichever path owns it:
98+
# ci3/release_prep_package_json for npm packages, release-image/Dockerfile for the docker image.
99+
function stamp_dev_aztec_version {
100100
local json_path=$1
101-
# "dev" here corresponds to DEV_VERSION in yarn-project/stdlib/src/update-checker/dev_version.ts.
102-
local version="dev"
103-
semver check "$REF_NAME" 2>/dev/null && version="${REF_NAME#v}"
104101
local tmp=$(mktemp)
105-
jq --arg v "$version" '.aztec_version = $v' "$json_path" > "$tmp"
102+
jq '.aztec_version = "dev"' "$json_path" > "$tmp"
106103
cat "$tmp" > "$json_path"
107104
rm "$tmp"
108105
}
109-
export -f stamp_aztec_version
106+
export -f stamp_dev_aztec_version
110107

111108
# This compiles a noir contract, transpiles public functions, strips internal prefixes,
112109
# and generates verification keys for private functions via 'bb aztec_process'.
@@ -128,9 +125,9 @@ function compile {
128125
$BB aztec_process -i $json_path
129126
cache_upload contract-$contract_hash.tar.gz $json_path
130127
fi
131-
# Stamp the current version after the cache block so the field always matches the build's version, whether
132-
# the artifact came from a fresh compile or a cache hit.
133-
stamp_aztec_version "$json_path"
128+
# Stamp the version after the cache block so the field is always present, whether the artifact came from a fresh
129+
# compile or a cache hit.
130+
stamp_dev_aztec_version "$json_path"
134131
}
135132
export -f compile
136133

release-image/Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ WORKDIR "/usr/src/yarn-project"
1919
ARG VERSION
2020
RUN echo '{".": "'$VERSION'"}' > /usr/src/.release-please-manifest.json
2121

22-
# Re-stamp aztec_version in published contract artifacts. Mirrors stamp_aztec_version() in
23-
# noir-projects/noir-contracts/bootstrap.sh and stampAztecVersion() in
24-
# yarn-project/aztec/src/cli/cmds/compile.ts. Needed because artifacts are compiled in an earlier
25-
# build stage where REF_NAME isn't set, leaving them with aztec_version: "dev".
22+
# Stamp aztec_version into the shipped contract artifacts. The build-time stamp in
23+
# noir-projects/noir-contracts/bootstrap.sh writes "dev" unconditionally; $VERSION here is the authoritative release
24+
# version for this image.
2625
RUN for dir in \
2726
/usr/src/yarn-project/accounts/artifacts \
2827
/usr/src/yarn-project/noir-contracts.js/artifacts \

yarn-project/end-to-end/src/fixtures/setup.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,8 @@ function assertContractArtifactsVersion() {
292292
);
293293
return;
294294
}
295-
// TODO(F-557): Remove once v4.3.0 drops off the compat matrix. The v4.3.0 release shipped with
296-
// aztec_version: "dev" baked into the published artifact JSONs because release-image/Dockerfile
297-
// did not re-stamp them. Fixed for future releases by the artifact restamp step in that Dockerfile.
295+
// TODO(F-557): Remove once v4.3.0 drops off the compat matrix. The v4.3.0 npm release shipped with
296+
// aztec_version: "dev" baked into the artifact JSONs because of a bug.
298297
if (expected === '4.3.0' && aztecVersion === DEV_VERSION) {
299298
createLogger('e2e:setup').warn(
300299
`Skipping artifact version check: v4.3.0 artifacts shipped with aztec_version="dev"`,

0 commit comments

Comments
 (0)