Skip to content

chore: backport feat: deploy method refactor 2 (#23033) to v4-next#23103

Merged
Thunkar merged 3 commits into
backport-to-v4-next-stagingfrom
claudebox/backport-23033-deploy-method-2
May 8, 2026
Merged

chore: backport feat: deploy method refactor 2 (#23033) to v4-next#23103
Thunkar merged 3 commits into
backport-to-v4-next-stagingfrom
claudebox/backport-23033-deploy-method-2

Conversation

@AztecBot

@AztecBot AztecBot commented May 8, 2026

Copy link
Copy Markdown
Collaborator

Backport of #23033 (feat: deploy method refactor 2) onto backport-to-v4-next-staging.

The automatic cherry-pick conflicted on yarn-project/aztec.js/src/contract/deploy_method.ts (3 hunks) and yarn-project/aztec.js/src/wallet/deploy_account_method.ts (1 hunk).

Conflicts

A prior backport had introduced DeployInteractionWaitOptions and renamed the runtime helper to lockDeployerFromSendOptions on this branch — but #23033 was authored against next (which still used InteractionWaitOptions and the old lockDeployer), so every line mentioning either name conflicted. The new bundled-options shape of DeployMethod.with() also conflicted with the old new DeployMethod(...) call.

Resolution

  • Kept DeployInteractionWaitOptions (already in use everywhere on this branch).
  • Accepted feat: deploy method refactor 2 #23033's lockDeployer — it's now the abstract method on DeployMethod with per-subclass implementations, replacing the old lockDeployerFromSendOptions helper.
  • Accepted feat: deploy method refactor 2 #23033's new with() signature and body verbatim (returns DeployMethod<TContract>, routes through DeployMethod.create(...) with bundled options).
  • Dropped the DeployMethod import in deploy_account_method.ts — it now extends UniversalDeployMethod. Kept DeployInteractionWaitOptions (still used by DeployAccountOptions and the convertDeployOptionsToSendOptions override).
  • Restored the extraHashedArgs = [] default in the with() destructuring (lost during the merge — would have caused concat(undefined) to push an undefined entry).

Commits (per repo backport convention)

  1. feat: deploy method refactor 2 (#23033) — original cherry-pick recorded with conflict markers.
  2. fix: resolve cherry-pick conflicts — only the conflict-marker hunks edited.
  3. fix: restore extraHashedArgs default in DeployMethod.with() — behavior-parity fix.

Build verification

Local yarn build was 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

Thunkar and others added 3 commits May 8, 2026 16:36
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.
@AztecBot AztecBot added ci-draft Run CI on draft PRs. claudebox Owned by claudebox. it can push to this PR. labels May 8, 2026
@Thunkar Thunkar marked this pull request as ready for review May 8, 2026 18:05
@Thunkar Thunkar merged commit 5da24a2 into backport-to-v4-next-staging May 8, 2026
22 of 27 checks passed
@Thunkar Thunkar deleted the claudebox/backport-23033-deploy-method-2 branch May 8, 2026 18:05
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-draft Run CI on draft PRs. claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants