From 0d8d779fb32cbdf64f844f103c5a65f1be9eb5a2 Mon Sep 17 00:00:00 2001 From: LHerskind Date: Fri, 4 Aug 2023 17:21:29 +0000 Subject: [PATCH] chore: address some comments --- yarn-project/acir-simulator/src/client/simulator.ts | 2 +- .../acir-simulator/src/client/unconstrained_execution.ts | 4 ++-- yarn-project/end-to-end/src/e2e_lending_contract.test.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/yarn-project/acir-simulator/src/client/simulator.ts b/yarn-project/acir-simulator/src/client/simulator.ts index 234b7d17f33f..6359e6b5a64e 100644 --- a/yarn-project/acir-simulator/src/client/simulator.ts +++ b/yarn-project/acir-simulator/src/client/simulator.ts @@ -102,7 +102,7 @@ export class AcirSimulator { contractAddress: AztecAddress, portalContractAddress: EthAddress, historicRoots: PrivateHistoricTreeRoots, - aztecNode: AztecNode | undefined = undefined, + aztecNode?: AztecNode, ) { if (entryPointABI.functionType !== FunctionType.UNCONSTRAINED) { throw new Error(`Cannot run ${entryPointABI.functionType} function as constrained`); diff --git a/yarn-project/acir-simulator/src/client/unconstrained_execution.ts b/yarn-project/acir-simulator/src/client/unconstrained_execution.ts index e673ab3175e0..6f61dc4053d6 100644 --- a/yarn-project/acir-simulator/src/client/unconstrained_execution.ts +++ b/yarn-project/acir-simulator/src/client/unconstrained_execution.ts @@ -30,7 +30,7 @@ export class UnconstrainedFunctionExecution { * @param aztecNode - The aztec node. * @returns The return values of the executed function. */ - public async run(aztecNode: AztecNode | undefined = undefined): Promise { + public async run(aztecNode?: AztecNode): Promise { this.log( `Executing unconstrained function ${this.contractAddress.toShortString()}:${this.functionData.functionSelectorBuffer.toString( 'hex', @@ -57,7 +57,7 @@ export class UnconstrainedFunctionExecution { getL1ToL2Message: ([msgKey]) => this.context.getL1ToL2Message(fromACVMField(msgKey)), getCommitment: ([commitment]) => this.context.getCommitment(this.contractAddress, commitment), storageRead: async ([slot], [numberOfElements]) => { - if (aztecNode === undefined) { + if (!aztecNode) { this.log(`Aztec node is undefined, cannot read public storage`); throw new Error(`Aztec node is undefined, cannot read public storage`); } diff --git a/yarn-project/end-to-end/src/e2e_lending_contract.test.ts b/yarn-project/end-to-end/src/e2e_lending_contract.test.ts index 6df28c81577f..14123b40ddf6 100644 --- a/yarn-project/end-to-end/src/e2e_lending_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_lending_contract.test.ts @@ -46,7 +46,7 @@ describe('e2e_lending_contract', () => { const getStorageSnapshot = async (contract: LendingContract, aztecNode: AztecRPC, account: Account) => { const storageValues: { [key: string]: Fr } = {}; const accountKey = await account.key(); - const toFields = (res: any) => res[0].map((v: number | bigint | Fr) => new Fr(v)); + const toFields = (res: any[]) => res[0].map((v: number | bigint | Fr) => new Fr(v)); [storageValues['interestAccumulator'], storageValues['last_updated_ts']] = toFields( await contract.methods.getTot(0).view(),