chore: backport feat: deploy method refactor 2 (#23033) to v4-next#23103
Merged
Thunkar merged 3 commits intoMay 8, 2026
Merged
Conversation
Splits `DeployMethod` into an abstract umbrella type plus three concrete
flavors that encode the deployer-lock state at the type level instead of
branching on a nullable field.
- `DeployMethod<T>` — abstract base, the type consumers use generically
(`let d: DeployMethod<MyContract> = ...`).
- `BoundDeployMethod` — locked to a concrete `deployer`.
- `UniversalDeployMethod` — locked to `AztecAddress.ZERO` (any sender).
- `PendingDeployMethod` — promotes into a `Bound`/`Universal` sibling on
the first `send` / `simulate` / `profile` call.
The three flavor-specific decisions (`getDeployerAddress`,
`lockOrAssertDeployer`, `cloneInstantiation`) are now abstract methods
rather than `if (this.deployer === undefined / equals(ZERO) / else)`
branches in the base.
Each subclass takes a narrowed instantiation type:
- `BoundInstantiationOptions` — `deployer` required, `universalDeploy:
never`.
- `UniversalInstantiationOptions` — `universalDeploy: true` required,
`deployer: never`.
- `PendingInstantiationOptions` — both `never`.
`new BoundDeployMethod(..., { universalDeploy: true })` is now a
TypeScript error. The runtime mutual-exclusion checks in subclass
constructors are gone; the only runtime guard left is
`BoundDeployMethod` rejecting `AztecAddress.ZERO` (a value-level
invariant the type system can't model).
Subclass constructors take named bundles instead of 9 positionals:
```ts
new BoundDeployMethod(wallet, contract, instantiation, payload?)
// ^ ^ ^
// { artifact, postDeployCtor, args, constructorNameOrArtifact }
// { salt, publicKeys, deployer }
// { authWitnesses, capsules, extraHashedArgs }
```
`DeployMethod.create` follows the same shape. `Contract.deploy(wallet,
artifact, args, constructorName, instantiation)` and
`MyContract.deploy(wallet, ...args, instantiation?)` (codegen) are
**unchanged** — the bundle reshape stops at the `create` boundary.
- `DeployAccountMethod` now extends `UniversalDeployMethod` (account
contracts are always universal).
The conflict resolution in the previous commit accidentally dropped the `extraHashedArgs = []` default in the destructuring of `with()`'s options argument, which would otherwise cause `concat(undefined)` to push an undefined entry.
Thunkar
approved these changes
May 8, 2026
AztecBot
added a commit
that referenced
this pull request
May 9, 2026
BEGIN_COMMIT_OVERRIDE fix(aztec-up): Aztec installer does not shadow user installed binaries on PATH (#22902) fix: include sqlite binary in its npm package (#23039) chore: backport #23041 (add sendMessagesAs to wallet api schemas) to v4-next (#23081) chore: backport DeployMethod refactor (#22985) to v4-next (#23029) refactor(pxe): deduplicate tx hash lookups in MessageContextService (#23075) refactor(pxe): batch tagged private log queries across all secrets (#23048) refactor(pxe): batch log RPC calls in LogService.fetchLogsByTag (#23088) feat(aztec-nr): Initial handshake registry contract with non interactive handshake function (#22854) fix: add Tag.random() helper required by backported #23088 tests (#23094) chore: backport: fix(aztec-up): installer does not shadow user binaries on PATH (#22902) (#23060) chore: backport handshake registry contract (#22854) to v4-next (#23063) feat: deploy method refactor 2 (#23033) refactor(pxe): skip redundant getBlock RPC when querying at anchor block (#23100) port(v4-next): feat(docs): autogenerate node JSON-RPC API reference (#22543) (#23046) chore: backport feat: deploy method refactor 2 (#23033) to v4-next (#23103) port(v4-next): feat(ci): Snapshots for aztec-nr contract compilation failures and nargo expand (#23061) (#23104) feat(txe): allow authorizing cross-contract utility calls in nr tests (#23064) END_COMMIT_OVERRIDE
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.
Backport of #23033 (
feat: deploy method refactor 2) ontobackport-to-v4-next-staging.The automatic cherry-pick conflicted on
yarn-project/aztec.js/src/contract/deploy_method.ts(3 hunks) andyarn-project/aztec.js/src/wallet/deploy_account_method.ts(1 hunk).Conflicts
A prior backport had introduced
DeployInteractionWaitOptionsand renamed the runtime helper tolockDeployerFromSendOptionson this branch — but #23033 was authored againstnext(which still usedInteractionWaitOptionsand the oldlockDeployer), so every line mentioning either name conflicted. The new bundled-options shape ofDeployMethod.with()also conflicted with the oldnew DeployMethod(...)call.Resolution
DeployInteractionWaitOptions(already in use everywhere on this branch).lockDeployer— it's now the abstract method onDeployMethodwith per-subclass implementations, replacing the oldlockDeployerFromSendOptionshelper.with()signature and body verbatim (returnsDeployMethod<TContract>, routes throughDeployMethod.create(...)with bundled options).DeployMethodimport indeploy_account_method.ts— it now extendsUniversalDeployMethod. KeptDeployInteractionWaitOptions(still used byDeployAccountOptionsand theconvertDeployOptionsToSendOptionsoverride).extraHashedArgs = []default in thewith()destructuring (lost during the merge — would have causedconcat(undefined)to push an undefined entry).Commits (per repo backport convention)
feat: deploy method refactor 2 (#23033)— original cherry-pick recorded with conflict markers.fix: resolve cherry-pick conflicts— only the conflict-marker hunks edited.fix: restore extraHashedArgs default in DeployMethod.with()— behavior-parity fix.Build verification
Local
yarn buildwas blocked by container-permission issues (cargo-binstall / corepack both need writable home directories not available here, and the noir submodule's JS packages couldn't be built locally). Relying on CI to verify the build.Detailed analysis: https://gist.github.com/AztecBot/90777c90cf1d6d75c9755f9aeabf514d
ClaudeBox log: https://claudebox.work/s/115d4037a28ea1ad?run=2