From ffd4a2c8e6a38264c5c69fcdc85b2f32dffe552c Mon Sep 17 00:00:00 2001 From: Alejo Amiras Date: Wed, 12 Aug 2026 15:41:41 +0000 Subject: [PATCH] chore: fix deploy script for 5.x and stop shipping stale deployments.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The recorded deployments.json addresses were generated under the pre-5.0 address-derivation formula (4.1.0-rc.4 era) and cannot match current derivation — stop copying the file into the published npm package until it is regenerated on a live network. The deploy script itself turned out to be broken since 4.2.0: account self-deployment still passed from: AztecAddress.ZERO, which the NO_FROM sentinel replaced. Fixed, plus hygiene from the modernization audit: - skipClassPublication when the contract class is already registered on-chain (engages on re-runs; within a single fast run the prior class registration may not be mined yet since we wait for PROPOSED) - wait timeouts on sends so a stuck network cannot hang the script - match TX_ERROR_EXISTING_NULLIFIER from @aztec/stdlib/tx instead of a hardcoded string - drop dead 'already registered' catches (registerContract is an idempotent upsert) Validated end-to-end against a local network: account + Dripper + WETH/DAI/USDC all deploy successfully (first verified run of this script on 5.x). Co-Authored-By: Claude Fable 5 --- scripts/build-package.sh | 9 ++---- scripts/deploy.ts | 61 ++++++++++++++++------------------------ 2 files changed, 27 insertions(+), 43 deletions(-) diff --git a/scripts/build-package.sh b/scripts/build-package.sh index b6030231..ed7fba50 100755 --- a/scripts/build-package.sh +++ b/scripts/build-package.sh @@ -29,12 +29,9 @@ cp -r dist/artifacts/* "${EXPORT_DIR}/dist/" cp -r target "${EXPORT_DIR}/" find "${EXPORT_DIR}/target" -name '*.bak' -delete -# Copy deployments.json if it exists -if [ -f "src/deployments.json" ]; then - cp src/deployments.json "${EXPORT_DIR}/" -else - echo "src/deployments.json not found, skipping" -fi +# deployments.json is intentionally NOT shipped: the recorded addresses were generated under a +# pre-5.0 address-derivation formula and are stale. Re-add only after regenerating via +# `yarn deploy` on a current network (and regenerate on every address-affecting @aztec/* bump). # Copy documentation cp README.md "${EXPORT_DIR}/" diff --git a/scripts/deploy.ts b/scripts/deploy.ts index eba9d9c5..1bee9ea7 100644 --- a/scripts/deploy.ts +++ b/scripts/deploy.ts @@ -3,15 +3,18 @@ import { Command, Option } from 'commander'; import { PublicKeys } from '@aztec/aztec.js/keys'; import { getContractInstanceFromInstantiationParams, + getContractClassFromArtifact, Contract, type InteractionFeeOptions, DeployOptions, } from '@aztec/aztec.js/contracts'; import { TxStatus } from '@aztec/aztec.js/tx'; +import { TX_ERROR_EXISTING_NULLIFIER } from '@aztec/stdlib/tx'; import { AztecAddress } from '@aztec/aztec.js/addresses'; import { Fr, GrumpkinScalar } from '@aztec/aztec.js/fields'; import { SponsoredFeePaymentMethod } from '@aztec/aztec.js/fee'; import { AccountManager, type Wallet } from '@aztec/aztec.js/wallet'; +import { NO_FROM } from '@aztec/aztec.js/account'; import { createAztecNodeClient, type AztecNode } from '@aztec/aztec.js/node'; import { createLogger } from '@aztec/foundation/log'; @@ -162,17 +165,9 @@ export async function createSponsoredFeeOptions(wallet: Wallet): Promise