Skip to content

Commit da12a60

Browse files
authored
fix(wallet-sdk): use derived contract address in registerContract (#24482)
## Problem CI on `merge-train/fairies-v5` is red at the `yarn-project` build step ([ci.aztec-labs.com/1783026321562696](http://ci.aztec-labs.com/1783026321562696)). The `compile_all` → `yarn tsgo -b --emitDeclarationOnly` typecheck fails with: ``` wallet-sdk/src/base-wallet/base_wallet.ts(375,36): error TS2339: Property 'address' does not exist on type 'ContractInstancePreimage'. wallet-sdk/src/base-wallet/base_wallet.ts(377,113): error TS2339: Property 'address' does not exist on type 'ContractInstancePreimage'. ``` These two were the complete set of errors reported by the (non-fail-fast) tsgo pass. ## Root cause This is a train-integration break, not a defect in the commit the CI run is attributed to (#24480, which only touched a TXE registry type). On the `v5-next` base, `ContractInstancePreimage` was refactored to no longer store a derived `address` field (address is now computed from the preimage; the with-address variant is the separate `ContractInstancePreimageWithAddress`). The fairies train's rewrite of `BaseWallet.registerContract` still read `instance.address`, which no longer exists on that type. ## Fix `PXE.registerContract(instance)` already returns the derived `AztecAddress` (it computes `computeContractAddressFromInstance(instance)` internally). Capture and use that returned address for the account-mismatch assertion instead of the removed `instance.address` field. This is semantically identical — the returned value is exactly the address the field used to hold — and touches only the two failing references. ## Verification The workspace this fix was prepared in is a bare checkout with no build/test cache available (no redis/docker) and insufficient free disk for a from-scratch `bb` + `noir` + TS build, so a full local `./bootstrap.sh ci-fast` could not be run to completion. The change is verified by inspection against the type definitions and the `PXE.registerContract` return contract; CI on this PR will exercise the real build. --- *Created by [claudebox](https://claudebox.work/v2/sessions/8542372f24dbb848) · group: `slackbot`*
1 parent 4057d0b commit da12a60

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

yarn-project/wallet-sdk/src/base-wallet/base_wallet.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ export abstract class BaseWallet implements Wallet {
358358
if (artifact) {
359359
await this.pxe.registerContractClass(artifact);
360360
}
361-
await this.pxe.registerContract(instance);
361+
const contractAddress = await this.pxe.registerContract(instance);
362362

363363
if (secretKeyOrKeys) {
364364
// PXE never receives the account seed (from which the message-signing/fallback secret keys could be re-derived):
@@ -372,9 +372,9 @@ export abstract class BaseWallet implements Wallet {
372372
? await deriveKeys(secretKeyOrKeys)
373373
: await deriveKeysFromMasterSecretKeys(secretKeyOrKeys);
374374
const { address } = await this.pxe.registerAccount(derivedKeys, await computePartialAddress(instance));
375-
if (!address.equals(instance.address)) {
375+
if (!address.equals(contractAddress)) {
376376
throw new Error(
377-
`Registered account address ${address.toString()} does not match contract instance address ${instance.address.toString()}: the provided keys do not correspond to this account.`,
377+
`Registered account address ${address.toString()} does not match contract instance address ${contractAddress.toString()}: the provided keys do not correspond to this account.`,
378378
);
379379
}
380380
}

0 commit comments

Comments
 (0)