From 3d5b6d79065ae767710231ede01f336f0a570bbc Mon Sep 17 00:00:00 2001 From: benesjan Date: Fri, 6 Mar 2026 13:30:18 +0000 Subject: [PATCH] refactor(pxe): narrow tryGetPublicKeysAndPartialAddress return type Return only `{ publicKeys, partialAddress }` instead of the full `CompleteAddress` from the oracle interface, since callers never use the `address` field from the result. Co-Authored-By: Claude Opus 4.6 --- .../oracle/interfaces.ts | 7 +++++-- .../oracle/utility_execution_oracle.ts | 18 ++++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/yarn-project/pxe/src/contract_function_simulator/oracle/interfaces.ts b/yarn-project/pxe/src/contract_function_simulator/oracle/interfaces.ts index 5d1e5a656cfb..9e9a14805f57 100644 --- a/yarn-project/pxe/src/contract_function_simulator/oracle/interfaces.ts +++ b/yarn-project/pxe/src/contract_function_simulator/oracle/interfaces.ts @@ -6,8 +6,9 @@ import { MembershipWitness } from '@aztec/foundation/trees'; import type { FunctionSelector, NoteSelector } from '@aztec/stdlib/abi'; import type { AztecAddress } from '@aztec/stdlib/aztec-address'; import { BlockHash } from '@aztec/stdlib/block'; -import type { CompleteAddress, ContractInstance } from '@aztec/stdlib/contract'; +import type { ContractInstance, PartialAddress } from '@aztec/stdlib/contract'; import type { KeyValidationRequest } from '@aztec/stdlib/kernel'; +import type { PublicKeys } from '@aztec/stdlib/keys'; import type { ContractClassLog, Tag } from '@aztec/stdlib/logs'; import type { Note, NoteStatus } from '@aztec/stdlib/note'; import { type NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees'; @@ -85,7 +86,9 @@ export interface IUtilityExecutionOracle { nullifier: Fr, ): Promise; utilityGetBlockHeader(blockNumber: BlockNumber): Promise; - utilityTryGetPublicKeysAndPartialAddress(account: AztecAddress): Promise; + utilityTryGetPublicKeysAndPartialAddress( + account: AztecAddress, + ): Promise<{ publicKeys: PublicKeys; partialAddress: PartialAddress } | undefined>; utilityGetAuthWitness(messageHash: Fr): Promise; utilityGetNotes( owner: AztecAddress | undefined, diff --git a/yarn-project/pxe/src/contract_function_simulator/oracle/utility_execution_oracle.ts b/yarn-project/pxe/src/contract_function_simulator/oracle/utility_execution_oracle.ts index f957d44326a8..9e0d38befcba 100644 --- a/yarn-project/pxe/src/contract_function_simulator/oracle/utility_execution_oracle.ts +++ b/yarn-project/pxe/src/contract_function_simulator/oracle/utility_execution_oracle.ts @@ -9,11 +9,11 @@ import type { KeyStore } from '@aztec/key-store'; import type { AuthWitness } from '@aztec/stdlib/auth-witness'; import { AztecAddress } from '@aztec/stdlib/aztec-address'; import { BlockHash } from '@aztec/stdlib/block'; -import type { CompleteAddress, ContractInstance } from '@aztec/stdlib/contract'; +import type { CompleteAddress, ContractInstance, PartialAddress } from '@aztec/stdlib/contract'; import { siloNullifier } from '@aztec/stdlib/hash'; import type { AztecNode } from '@aztec/stdlib/interfaces/server'; import type { KeyValidationRequest } from '@aztec/stdlib/kernel'; -import { computeAddressSecret } from '@aztec/stdlib/keys'; +import { type PublicKeys, computeAddressSecret } from '@aztec/stdlib/keys'; import { deriveEcdhSharedSecret } from '@aztec/stdlib/logs'; import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging'; import type { NoteStatus } from '@aztec/stdlib/note'; @@ -232,12 +232,18 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra } /** - * Retrieve the complete address associated to a given address. + * Retrieve the public keys and partial address associated to a given address. * @param account - The account address. - * @returns A complete address associated with the input address, or `undefined` if not registered. + * @returns The public keys and partial address, or `undefined` if the account is not registered. */ - public utilityTryGetPublicKeysAndPartialAddress(account: AztecAddress): Promise { - return this.addressStore.getCompleteAddress(account); + public async utilityTryGetPublicKeysAndPartialAddress( + account: AztecAddress, + ): Promise<{ publicKeys: PublicKeys; partialAddress: PartialAddress } | undefined> { + const completeAddress = await this.addressStore.getCompleteAddress(account); + if (!completeAddress) { + return undefined; + } + return { publicKeys: completeAddress.publicKeys, partialAddress: completeAddress.partialAddress }; } protected async getCompleteAddressOrFail(account: AztecAddress): Promise {