From 11298f8d46829302156289b038896427686aebcf Mon Sep 17 00:00:00 2001 From: benesjan Date: Tue, 24 Oct 2023 16:51:07 +0200 Subject: [PATCH 1/2] WIP --- yarn-project/key-store/src/test_key_store.ts | 2 +- yarn-project/pxe/src/pxe_service/pxe_service.ts | 2 +- yarn-project/pxe/src/simulator_oracle/index.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn-project/key-store/src/test_key_store.ts b/yarn-project/key-store/src/test_key_store.ts index 680f5b98833..2ea303ad324 100644 --- a/yarn-project/key-store/src/test_key_store.ts +++ b/yarn-project/key-store/src/test_key_store.ts @@ -51,7 +51,7 @@ export class TestKeyStore implements KeyStore { private getAccount(pubKey: PublicKey) { const account = this.accounts.find(a => a.getPublicKey().equals(pubKey)); if (!account) { - throw new Error('Unknown account.'); + throw new Error('Unknown account.\nSee docs for context: https://docs.aztec.network/dev_docs/contracts/common_errors#unknown-contract-error'); } return account; } diff --git a/yarn-project/pxe/src/pxe_service/pxe_service.ts b/yarn-project/pxe/src/pxe_service/pxe_service.ts index e9afcf62394..aa1a0b6cdc0 100644 --- a/yarn-project/pxe/src/pxe_service/pxe_service.ts +++ b/yarn-project/pxe/src/pxe_service/pxe_service.ts @@ -395,7 +395,7 @@ export class PXEService implements PXE { async #getFunctionCall(functionName: string, args: any[], to: AztecAddress): Promise { const contract = await this.db.getContract(to); if (!contract) { - throw new Error(`Unknown contract ${to}: add it to PXE Service by calling server.addContracts(...)`); + throw new Error(`Unknown contract ${to}: add it to PXE Service by calling server.addContracts(...).\nSee docs for context: https://docs.aztec.network/dev_docs/contracts/common_errors#unknown-contract-error`); } const functionDao = contract.functions.find(f => f.name === functionName); diff --git a/yarn-project/pxe/src/simulator_oracle/index.ts b/yarn-project/pxe/src/simulator_oracle/index.ts index ed164766e9f..720df507636 100644 --- a/yarn-project/pxe/src/simulator_oracle/index.ts +++ b/yarn-project/pxe/src/simulator_oracle/index.ts @@ -33,7 +33,7 @@ export class SimulatorOracle implements DBOracle { const completeAddress = await this.db.getCompleteAddress(address); if (!completeAddress) throw new Error( - `No public key registered for address ${address.toString()}. Register it by calling pxe.registerRecipient(...) or pxe.registerAccount(...)`, + `No public key registered for address ${address.toString()}. Register it by calling pxe.registerRecipient(...) or pxe.registerAccount(...).\nSee docs for context: https://docs.aztec.network/dev_docs/contracts/common_errors#no-public-key-registered-error`, ); return completeAddress; } From 5c77c310b07aba8926338cae88419452c3d449de Mon Sep 17 00:00:00 2001 From: benesjan Date: Tue, 24 Oct 2023 17:07:34 +0200 Subject: [PATCH 2/2] formatting --- yarn-project/key-store/src/test_key_store.ts | 4 +++- yarn-project/pxe/src/pxe_service/pxe_service.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/yarn-project/key-store/src/test_key_store.ts b/yarn-project/key-store/src/test_key_store.ts index 2ea303ad324..cf1b1a957a5 100644 --- a/yarn-project/key-store/src/test_key_store.ts +++ b/yarn-project/key-store/src/test_key_store.ts @@ -51,7 +51,9 @@ export class TestKeyStore implements KeyStore { private getAccount(pubKey: PublicKey) { const account = this.accounts.find(a => a.getPublicKey().equals(pubKey)); if (!account) { - throw new Error('Unknown account.\nSee docs for context: https://docs.aztec.network/dev_docs/contracts/common_errors#unknown-contract-error'); + throw new Error( + 'Unknown account.\nSee docs for context: https://docs.aztec.network/dev_docs/contracts/common_errors#unknown-contract-error', + ); } return account; } diff --git a/yarn-project/pxe/src/pxe_service/pxe_service.ts b/yarn-project/pxe/src/pxe_service/pxe_service.ts index aa1a0b6cdc0..ec375cbad3d 100644 --- a/yarn-project/pxe/src/pxe_service/pxe_service.ts +++ b/yarn-project/pxe/src/pxe_service/pxe_service.ts @@ -395,7 +395,9 @@ export class PXEService implements PXE { async #getFunctionCall(functionName: string, args: any[], to: AztecAddress): Promise { const contract = await this.db.getContract(to); if (!contract) { - throw new Error(`Unknown contract ${to}: add it to PXE Service by calling server.addContracts(...).\nSee docs for context: https://docs.aztec.network/dev_docs/contracts/common_errors#unknown-contract-error`); + throw new Error( + `Unknown contract ${to}: add it to PXE Service by calling server.addContracts(...).\nSee docs for context: https://docs.aztec.network/dev_docs/contracts/common_errors#unknown-contract-error`, + ); } const functionDao = contract.functions.find(f => f.name === functionName);