From 516dd7bb5ac36744e23070d97760c7811274518c Mon Sep 17 00:00:00 2001 From: Santiago Palladino Date: Tue, 16 Apr 2024 14:48:25 -0300 Subject: [PATCH] chore: No implicit overrides --- .../account_manager/deploy_account_method.ts | 2 +- .../account_manager/deploy_account_sent_tx.ts | 2 +- .../aztec.js/src/contract/deploy_method.ts | 4 +-- .../aztec.js/src/contract/deploy_sent_tx.ts | 2 +- .../aztec.js/src/wallet/account_wallet.ts | 2 +- .../src/logs/l1_note_payload/note.ts | 2 +- yarn-project/end-to-end/src/e2e_fees.test.ts | 4 +-- .../foundation/src/abi/function_selector.ts | 8 ++--- .../foundation/src/aztec-address/index.ts | 12 +++---- .../src/snapshots/indexed_tree_snapshot.ts | 6 ++-- .../standard_indexed_tree.ts | 10 +++--- .../test/standard_indexed_tree_with_append.ts | 2 +- .../src/standard_tree/standard_tree.ts | 2 +- .../src/test/utils/pedersen_with_counter.ts | 2 +- .../src/contract-interface-gen/typescript.ts | 2 +- .../pxe/src/synchronizer/synchronizer.test.ts | 6 ++-- .../src/sequencer/sequencer.test.ts | 4 +-- .../simulator/src/avm/opcodes/arithmetic.ts | 4 +-- .../src/avm/opcodes/external_calls.ts | 2 +- .../simulator/src/avm/opcodes/memory.ts | 6 ++-- .../simulator/src/avm/opcodes/storage.ts | 2 +- .../src/client/client_execution_context.ts | 36 +++++++++++-------- .../simulator/src/client/view_data_oracle.ts | 35 +++++++++--------- .../src/public/app_logic_phase_manager.ts | 12 +++---- .../src/public/public_execution_context.ts | 22 ++++++------ .../src/public/setup_phase_manager.test.ts | 2 +- .../src/public/setup_phase_manager.ts | 12 +++---- .../src/public/tail_phase_manager.ts | 12 +++---- .../src/public/teardown_phase_manager.ts | 12 +++---- yarn-project/tsconfig.json | 3 +- 30 files changed, 121 insertions(+), 111 deletions(-) diff --git a/yarn-project/aztec.js/src/account_manager/deploy_account_method.ts b/yarn-project/aztec.js/src/account_manager/deploy_account_method.ts index 0534790e935a..d9ea44b96d8d 100644 --- a/yarn-project/aztec.js/src/account_manager/deploy_account_method.ts +++ b/yarn-project/aztec.js/src/account_manager/deploy_account_method.ts @@ -46,7 +46,7 @@ export class DeployAccountMethod extends DeployMethod { : feePaymentNameOrArtifact; } - protected async getInitializeFunctionCalls(options: DeployOptions): Promise { + protected override async getInitializeFunctionCalls(options: DeployOptions): Promise { const exec = await super.getInitializeFunctionCalls(options); if (options.fee && this.#feePaymentArtifact) { diff --git a/yarn-project/aztec.js/src/account_manager/deploy_account_sent_tx.ts b/yarn-project/aztec.js/src/account_manager/deploy_account_sent_tx.ts index ad299a68b5b8..e205286e9925 100644 --- a/yarn-project/aztec.js/src/account_manager/deploy_account_sent_tx.ts +++ b/yarn-project/aztec.js/src/account_manager/deploy_account_sent_tx.ts @@ -34,7 +34,7 @@ export class DeployAccountSentTx extends SentTx { * @param opts - Options for configuring the waiting for the tx to be mined. * @returns The transaction receipt with the wallet for the deployed account contract. */ - public async wait(opts: WaitOpts = DefaultWaitOpts): Promise { + public override async wait(opts: WaitOpts = DefaultWaitOpts): Promise { const receipt = await super.wait(opts); const wallet = await this.getWalletPromise; await waitForAccountSynch(this.pxe, wallet.getCompleteAddress(), opts); diff --git a/yarn-project/aztec.js/src/contract/deploy_method.ts b/yarn-project/aztec.js/src/contract/deploy_method.ts index 32007df8945d..54ef3025e2b1 100644 --- a/yarn-project/aztec.js/src/contract/deploy_method.ts +++ b/yarn-project/aztec.js/src/contract/deploy_method.ts @@ -189,7 +189,7 @@ export class DeployMethod extends Bas * @param options - An object containing various deployment options such as portalContract, contractAddressSalt, and from. * @returns A SentTx object that returns the receipt and the deployed contract instance. */ - public send(options: DeployOptions = {}): DeploySentTx { + public override send(options: DeployOptions = {}): DeploySentTx { const txHashPromise = super.send(options).getTxHash(); const instance = this.getInstance(options); this.log.debug( @@ -223,7 +223,7 @@ export class DeployMethod extends Bas * @param options - Deployment options. * @returns The proven tx. */ - public prove(options: DeployOptions): Promise { + public override prove(options: DeployOptions): Promise { return super.prove(options); } diff --git a/yarn-project/aztec.js/src/contract/deploy_sent_tx.ts b/yarn-project/aztec.js/src/contract/deploy_sent_tx.ts index d77150fbe7c2..b645d3dc6d24 100644 --- a/yarn-project/aztec.js/src/contract/deploy_sent_tx.ts +++ b/yarn-project/aztec.js/src/contract/deploy_sent_tx.ts @@ -53,7 +53,7 @@ export class DeploySentTx extends SentTx * @param opts - Options for configuring the waiting for the tx to be mined. * @returns The transaction receipt with the deployed contract instance. */ - public async wait(opts?: DeployedWaitOpts): Promise> { + public override async wait(opts?: DeployedWaitOpts): Promise> { const receipt = await super.wait(opts); const contract = await this.getContractObject(opts?.wallet); return { ...receipt, contract }; diff --git a/yarn-project/aztec.js/src/wallet/account_wallet.ts b/yarn-project/aztec.js/src/wallet/account_wallet.ts index 40ac99864775..803d07010eba 100644 --- a/yarn-project/aztec.js/src/wallet/account_wallet.ts +++ b/yarn-project/aztec.js/src/wallet/account_wallet.ts @@ -196,7 +196,7 @@ export class AccountWallet extends BaseWallet { } /** Returns the address of the account that implements this wallet. */ - public getAddress() { + public override getAddress() { return this.getCompleteAddress().address; } diff --git a/yarn-project/circuit-types/src/logs/l1_note_payload/note.ts b/yarn-project/circuit-types/src/logs/l1_note_payload/note.ts index 9a56b9047781..9562a277e488 100644 --- a/yarn-project/circuit-types/src/logs/l1_note_payload/note.ts +++ b/yarn-project/circuit-types/src/logs/l1_note_payload/note.ts @@ -39,7 +39,7 @@ export class Note extends Vector { * Returns a hex representation of the note. * @returns A hex string with the vector length as first element. */ - toString() { + override toString() { return '0x' + this.toBuffer().toString('hex'); } diff --git a/yarn-project/end-to-end/src/e2e_fees.test.ts b/yarn-project/end-to-end/src/e2e_fees.test.ts index 5367463c6c70..a13b7830b909 100644 --- a/yarn-project/end-to-end/src/e2e_fees.test.ts +++ b/yarn-project/end-to-end/src/e2e_fees.test.ts @@ -676,7 +676,7 @@ describe('e2e_fees', () => { }); class BuggedSetupFeePaymentMethod extends PublicFeePaymentMethod { - getFunctionCalls(gasSettings: GasSettings): Promise { + override getFunctionCalls(gasSettings: GasSettings): Promise { const maxFee = gasSettings.getFeeLimit(); const nonce = Fr.random(); const messageHash = computeAuthWitMessageHash( @@ -710,7 +710,7 @@ class BuggedSetupFeePaymentMethod extends PublicFeePaymentMethod { } class BuggedTeardownFeePaymentMethod extends PublicFeePaymentMethod { - async getFunctionCalls(gasSettings: GasSettings): Promise { + override async getFunctionCalls(gasSettings: GasSettings): Promise { // authorize the FPC to take the max fee from Alice const nonce = Fr.random(); const maxFee = gasSettings.getFeeLimit(); diff --git a/yarn-project/foundation/src/abi/function_selector.ts b/yarn-project/foundation/src/abi/function_selector.ts index 2002be8f5963..d09669d7ce30 100644 --- a/yarn-project/foundation/src/abi/function_selector.ts +++ b/yarn-project/foundation/src/abi/function_selector.ts @@ -21,10 +21,10 @@ export class FunctionSelector extends Selector { * Checks if this function selector is equal to another. * @returns True if the function selectors are equal. */ - equals(fn: { name: string; parameters: ABIParameter[] }): boolean; - equals(otherName: string, otherParams: ABIParameter[]): boolean; - equals(other: FunctionSelector): boolean; - equals( + override equals(fn: { name: string; parameters: ABIParameter[] }): boolean; + override equals(otherName: string, otherParams: ABIParameter[]): boolean; + override equals(other: FunctionSelector): boolean; + override equals( other: FunctionSelector | string | { name: string; parameters: ABIParameter[] }, otherParams?: ABIParameter[], ): boolean { diff --git a/yarn-project/foundation/src/aztec-address/index.ts b/yarn-project/foundation/src/aztec-address/index.ts index e97fb1f17946..53229d1fda7a 100644 --- a/yarn-project/foundation/src/aztec-address/index.ts +++ b/yarn-project/foundation/src/aztec-address/index.ts @@ -23,13 +23,13 @@ export class AztecAddress extends Fr { return `AztecAddress<${this.toString()}>`; } - static ZERO = new AztecAddress(Buffer.alloc(32)); + static override ZERO = new AztecAddress(Buffer.alloc(32)); - static zero(): AztecAddress { + static override zero(): AztecAddress { return AztecAddress.ZERO; } - static fromBuffer(buffer: Buffer | BufferReader) { + static override fromBuffer(buffer: Buffer | BufferReader) { return fromBuffer(buffer, AztecAddress); } @@ -46,16 +46,16 @@ export class AztecAddress extends Fr { return AztecAddress.fromField(new Fr(value)); } - static fromString(buf: string) { + static override fromString(buf: string) { const buffer = Buffer.from(buf.replace(/^0x/i, ''), 'hex'); return new AztecAddress(buffer); } - static random() { + static override random() { return new AztecAddress(super.random().toBuffer()); } - toJSON() { + override toJSON() { return { type: 'AztecAddress', value: this.toString(), diff --git a/yarn-project/merkle-tree/src/snapshots/indexed_tree_snapshot.ts b/yarn-project/merkle-tree/src/snapshots/indexed_tree_snapshot.ts index c39108239d9e..1d70549450da 100644 --- a/yarn-project/merkle-tree/src/snapshots/indexed_tree_snapshot.ts +++ b/yarn-project/merkle-tree/src/snapshots/indexed_tree_snapshot.ts @@ -23,7 +23,7 @@ export class IndexedTreeSnapshotBuilder return new IndexedTreeSnapshotImpl(this.nodes, this.leaves, root, numLeaves, this.tree, this.leafPreimageBuilder); } - protected handleLeaf(index: bigint, node: Buffer) { + protected override handleLeaf(index: bigint, node: Buffer) { const leafPreimage = this.tree.getLatestLeafPreimageCopy(index, false); if (leafPreimage) { void this.leaves.set(snapshotLeafValue(node, index), leafPreimage.toBuffer()); @@ -44,7 +44,7 @@ class IndexedTreeSnapshotImpl extends BaseFullTreeSnapshot implements In super(db, historicRoot, numLeaves, tree, { fromBuffer: buf => buf }); } - getLeafValue(index: bigint): Buffer | undefined { + override getLeafValue(index: bigint): Buffer | undefined { const leafPreimage = this.getLatestLeafPreimageCopy(index); return leafPreimage?.toBuffer(); } @@ -99,7 +99,7 @@ class IndexedTreeSnapshotImpl extends BaseFullTreeSnapshot implements In return { index: BigInt(minIndex), alreadyPresent: false }; } - findLeafIndex(value: Buffer): bigint | undefined { + override findLeafIndex(value: Buffer): bigint | undefined { const index = this.tree.findLeafIndex(value, false); if (index !== undefined && index < this.getNumLeaves()) { return index; diff --git a/yarn-project/merkle-tree/src/standard_indexed_tree/standard_indexed_tree.ts b/yarn-project/merkle-tree/src/standard_indexed_tree/standard_indexed_tree.ts index 75fb3a14a635..06d6d91f6c87 100644 --- a/yarn-project/merkle-tree/src/standard_indexed_tree/standard_indexed_tree.ts +++ b/yarn-project/merkle-tree/src/standard_indexed_tree/standard_indexed_tree.ts @@ -92,7 +92,7 @@ export class StandardIndexedTree extends TreeBase implements IndexedTree * @returns Empty promise. * @remarks Use batchInsert method instead. */ - appendLeaves(_leaves: Buffer[]): Promise { + override appendLeaves(_leaves: Buffer[]): Promise { throw new Error('Not implemented'); } @@ -100,7 +100,7 @@ export class StandardIndexedTree extends TreeBase implements IndexedTree * Commits the changes to the database. * @returns Empty promise. */ - public async commit(): Promise { + public override async commit(): Promise { await super.commit(); await this.commitLeaves(); } @@ -109,7 +109,7 @@ export class StandardIndexedTree extends TreeBase implements IndexedTree * Rolls back the not-yet-committed changes. * @returns Empty promise. */ - public async rollback(): Promise { + public override async rollback(): Promise { await super.rollback(); this.clearCachedLeaves(); } @@ -120,7 +120,7 @@ export class StandardIndexedTree extends TreeBase implements IndexedTree * @param includeUncommitted - Indicates whether to include uncommitted leaves in the computation. * @returns The value of the leaf at the given index or undefined if the leaf is empty. */ - public getLeafValue(index: bigint, includeUncommitted: boolean): Buffer | undefined { + public override getLeafValue(index: bigint, includeUncommitted: boolean): Buffer | undefined { const preimage = this.getLatestLeafPreimageCopy(index, includeUncommitted); return preimage && preimage.toBuffer(); } @@ -262,7 +262,7 @@ export class StandardIndexedTree extends TreeBase implements IndexedTree * 1024 leaves for the first block, because there's only neat space for 1023 leaves after 0. By padding with 1023 * more leaves, we can then insert the first block of 1024 leaves into indices 1024:2047. */ - public async init(prefilledSize: number): Promise { + public override async init(prefilledSize: number): Promise { if (prefilledSize < 1) { throw new Error(`Prefilled size must be at least 1!`); } diff --git a/yarn-project/merkle-tree/src/standard_indexed_tree/test/standard_indexed_tree_with_append.ts b/yarn-project/merkle-tree/src/standard_indexed_tree/test/standard_indexed_tree_with_append.ts index a772f1fc5fb3..0816f59edc5f 100644 --- a/yarn-project/merkle-tree/src/standard_indexed_tree/test/standard_indexed_tree_with_append.ts +++ b/yarn-project/merkle-tree/src/standard_indexed_tree/test/standard_indexed_tree_with_append.ts @@ -12,7 +12,7 @@ export class StandardIndexedTreeWithAppend extends StandardIndexedTree { * @returns Empty promise. * @remarks This method is inefficient and is here mostly for testing. Use batchInsert instead. */ - public appendLeaves(leaves: Buffer[]): Promise { + public override appendLeaves(leaves: Buffer[]): Promise { for (const leaf of leaves) { this.appendLeaf(leaf); } diff --git a/yarn-project/merkle-tree/src/standard_tree/standard_tree.ts b/yarn-project/merkle-tree/src/standard_tree/standard_tree.ts index ceb210e70948..27ce349a4844 100644 --- a/yarn-project/merkle-tree/src/standard_tree/standard_tree.ts +++ b/yarn-project/merkle-tree/src/standard_tree/standard_tree.ts @@ -18,7 +18,7 @@ export class StandardTree extends TreeBase imp * @param leaves - The leaves to append. * @returns Empty promise. */ - public appendLeaves(leaves: T[]): Promise { + public override appendLeaves(leaves: T[]): Promise { this.hasher.reset(); const timer = new Timer(); super.appendLeaves(leaves); diff --git a/yarn-project/merkle-tree/src/test/utils/pedersen_with_counter.ts b/yarn-project/merkle-tree/src/test/utils/pedersen_with_counter.ts index ff87702c8179..f5ab9af885a2 100644 --- a/yarn-project/merkle-tree/src/test/utils/pedersen_with_counter.ts +++ b/yarn-project/merkle-tree/src/test/utils/pedersen_with_counter.ts @@ -19,7 +19,7 @@ export class PedersenWithCounter extends Pedersen { * @deprecated Don't call pedersen directly in production code. Instead, create suitably-named functions for specific * purposes. */ - public hash(lhs: Uint8Array, rhs: Uint8Array): Buffer { + public override hash(lhs: Uint8Array, rhs: Uint8Array): Buffer { this.hashCounter++; return super.hash(lhs, rhs); } diff --git a/yarn-project/noir-compiler/src/contract-interface-gen/typescript.ts b/yarn-project/noir-compiler/src/contract-interface-gen/typescript.ts index da5e9cd6e8fe..0ade1726ec8f 100644 --- a/yarn-project/noir-compiler/src/contract-interface-gen/typescript.ts +++ b/yarn-project/noir-compiler/src/contract-interface-gen/typescript.ts @@ -312,7 +312,7 @@ export class ${input.name}Contract extends ContractBase { ${notesGetter} /** Type-safe wrappers for the public methods exposed by the contract. */ - public methods!: { + public override methods!: { ${methods.join('\n')} }; } diff --git a/yarn-project/pxe/src/synchronizer/synchronizer.test.ts b/yarn-project/pxe/src/synchronizer/synchronizer.test.ts index 81f079c6b7e8..79fa9b9bd199 100644 --- a/yarn-project/pxe/src/synchronizer/synchronizer.test.ts +++ b/yarn-project/pxe/src/synchronizer/synchronizer.test.ts @@ -158,15 +158,15 @@ describe('Synchronizer', () => { }); class TestSynchronizer extends Synchronizer { - public work(limit = 1) { + public override work(limit = 1) { return super.work(limit); } - public initialSync(): Promise { + public override initialSync(): Promise { return super.initialSync(); } - public workNoteProcessorCatchUp(limit = 1): Promise { + public override workNoteProcessorCatchUp(limit = 1): Promise { return super.workNoteProcessorCatchUp(limit); } } diff --git a/yarn-project/sequencer-client/src/sequencer/sequencer.test.ts b/yarn-project/sequencer-client/src/sequencer/sequencer.test.ts index 72af68c53fc4..38e0379fbab2 100644 --- a/yarn-project/sequencer-client/src/sequencer/sequencer.test.ts +++ b/yarn-project/sequencer-client/src/sequencer/sequencer.test.ts @@ -270,11 +270,11 @@ describe('sequencer', () => { }); class TestSubject extends Sequencer { - public work() { + public override work() { return super.work(); } - public initialSync(): Promise { + public override initialSync(): Promise { return super.initialSync(); } } diff --git a/yarn-project/simulator/src/avm/opcodes/arithmetic.ts b/yarn-project/simulator/src/avm/opcodes/arithmetic.ts index 137b92ab878a..e55ba9fb1e53 100644 --- a/yarn-project/simulator/src/avm/opcodes/arithmetic.ts +++ b/yarn-project/simulator/src/avm/opcodes/arithmetic.ts @@ -23,7 +23,7 @@ export abstract class ThreeOperandArithmeticInstruction extends ThreeOperandInst context.machineState.incrementPc(); } - protected gasCost(memoryOps: Partial) { + protected override gasCost(memoryOps: Partial) { const baseGasCost = getGasCostForTypeTag(this.inTag, getBaseGasCost(this.opcode)); const memoryGasCost = getMemoryGasCost(memoryOps); return sumGas(baseGasCost, memoryGasCost); @@ -102,7 +102,7 @@ export class FieldDiv extends Instruction { context.machineState.incrementPc(); } - protected gasCost(memoryOps: Partial) { + protected override gasCost(memoryOps: Partial) { const baseGasCost = getGasCostForTypeTag(TypeTag.FIELD, getBaseGasCost(this.opcode)); const memoryGasCost = getMemoryGasCost(memoryOps); return sumGas(baseGasCost, memoryGasCost); diff --git a/yarn-project/simulator/src/avm/opcodes/external_calls.ts b/yarn-project/simulator/src/avm/opcodes/external_calls.ts index fd54c6dbfe6e..f3f982f792f5 100644 --- a/yarn-project/simulator/src/avm/opcodes/external_calls.ts +++ b/yarn-project/simulator/src/avm/opcodes/external_calls.ts @@ -122,7 +122,7 @@ abstract class ExternalCall extends Instruction { context.machineState.incrementPc(); } - public abstract get type(): 'CALL' | 'STATICCALL'; + public abstract override get type(): 'CALL' | 'STATICCALL'; } export class Call extends ExternalCall { diff --git a/yarn-project/simulator/src/avm/opcodes/memory.ts b/yarn-project/simulator/src/avm/opcodes/memory.ts index 81eb5fd8ea7e..770f4da5b3ab 100644 --- a/yarn-project/simulator/src/avm/opcodes/memory.ts +++ b/yarn-project/simulator/src/avm/opcodes/memory.ts @@ -46,7 +46,7 @@ export class Set extends Instruction { } /** We need to use a custom serialize function because of the variable length of the value. */ - public serialize(): Buffer { + public override serialize(): Buffer { const format: OperandType[] = [ ...Set.wireFormatBeforeConst, getOperandTypeFromInTag(this.inTag), @@ -56,7 +56,7 @@ export class Set extends Instruction { } /** We need to use a custom deserialize function because of the variable length of the value. */ - public static deserialize(this: typeof Set, buf: BufferCursor | Buffer): Set { + public static override deserialize(this: typeof Set, buf: BufferCursor | Buffer): Set { if (buf instanceof Buffer) { buf = new BufferCursor(buf); } @@ -217,7 +217,7 @@ export class CalldataCopy extends Instruction { context.machineState.incrementPc(); } - protected gasCost(memoryOps: Partial = {}) { + protected override gasCost(memoryOps: Partial = {}) { const baseGasCost = mulGas(getBaseGasCost(this.opcode), this.copySize); const memoryGasCost = getMemoryGasCost(memoryOps); return sumGas(baseGasCost, memoryGasCost); diff --git a/yarn-project/simulator/src/avm/opcodes/storage.ts b/yarn-project/simulator/src/avm/opcodes/storage.ts index c72541c0572e..62c3d180b0f4 100644 --- a/yarn-project/simulator/src/avm/opcodes/storage.ts +++ b/yarn-project/simulator/src/avm/opcodes/storage.ts @@ -27,7 +27,7 @@ abstract class BaseStorageInstruction extends Instruction { super(); } - protected gasCost(memoryOps: Partial): Gas { + protected override gasCost(memoryOps: Partial): Gas { const baseGasCost = mulGas(getBaseGasCost(this.opcode), this.size); const memoryGasCost = getMemoryGasCost(memoryOps); return sumGas(baseGasCost, memoryGasCost); diff --git a/yarn-project/simulator/src/client/client_execution_context.ts b/yarn-project/simulator/src/client/client_execution_context.ts index 56141cf9c7ec..0c0452474078 100644 --- a/yarn-project/simulator/src/client/client_execution_context.ts +++ b/yarn-project/simulator/src/client/client_execution_context.ts @@ -64,21 +64,21 @@ export class ClientExecutionContext extends ViewDataOracle { private enqueuedPublicFunctionCalls: PublicCallRequest[] = []; constructor( - protected readonly contractAddress: AztecAddress, + contractAddress: AztecAddress, private readonly argsHash: Fr, private readonly txContext: TxContext, private readonly callContext: CallContext, /** Header of a block whose state is used during private execution (not the block the transaction is included in). */ protected readonly historicalHeader: Header, /** List of transient auth witnesses to be used during this simulation */ - protected readonly authWitnesses: AuthWitness[], + authWitnesses: AuthWitness[], private readonly packedValuesCache: PackedValuesCache, private readonly noteCache: ExecutionNoteCache, - protected readonly db: DBOracle, + db: DBOracle, private readonly curve: Grumpkin, private node: AztecNode, protected sideEffectCounter: number = 0, - protected log = createDebugLogger('aztec:simulator:client_execution_context'), + log = createDebugLogger('aztec:simulator:client_execution_context'), ) { super(contractAddress, authWitnesses, db, node, log); } @@ -174,7 +174,7 @@ export class ClientExecutionContext extends ViewDataOracle { * Pack the given arguments. * @param args - Arguments to pack */ - public packArguments(args: Fr[]): Promise { + public override packArguments(args: Fr[]): Promise { return Promise.resolve(this.packedValuesCache.pack(args)); } @@ -182,7 +182,7 @@ export class ClientExecutionContext extends ViewDataOracle { * Pack the given returns. * @param returns - Returns to pack */ - public packReturns(returns: Fr[]): Promise { + public override packReturns(returns: Fr[]): Promise { return Promise.resolve(this.packedValuesCache.pack(returns)); } @@ -190,7 +190,7 @@ export class ClientExecutionContext extends ViewDataOracle { * Unpack the given returns. * @param returnsHash - Returns hash to unpack */ - public unpackReturns(returnsHash: Fr): Promise { + public override unpackReturns(returnsHash: Fr): Promise { return Promise.resolve(this.packedValuesCache.unpack(returnsHash)); } @@ -214,7 +214,7 @@ export class ClientExecutionContext extends ViewDataOracle { * @param status - The status of notes to fetch. * @returns Array of note data. */ - public async getNotes( + public override async getNotes( storageSlot: Fr, numSelects: number, selectByIndexes: number[], @@ -281,7 +281,7 @@ export class ClientExecutionContext extends ViewDataOracle { * @param innerNoteHash - The inner note hash of the new note. * @returns */ - public notifyCreatedNote(storageSlot: Fr, noteTypeId: Fr, noteItems: Fr[], innerNoteHash: Fr) { + public override notifyCreatedNote(storageSlot: Fr, noteTypeId: Fr, noteItems: Fr[], innerNoteHash: Fr) { const note = new Note(noteItems); this.noteCache.addNewNote({ contractAddress: this.callContext.storageContractAddress, @@ -304,7 +304,7 @@ export class ClientExecutionContext extends ViewDataOracle { * @param innerNullifier - The pending nullifier to add in the list (not yet siloed by contract address). * @param innerNoteHash - The inner note hash of the new note. */ - public notifyNullifiedNote(innerNullifier: Fr, innerNoteHash: Fr) { + public override notifyNullifiedNote(innerNullifier: Fr, innerNoteHash: Fr) { this.noteCache.nullifyNote(this.callContext.storageContractAddress, innerNullifier, innerNoteHash); return Promise.resolve(); } @@ -317,7 +317,13 @@ export class ClientExecutionContext extends ViewDataOracle { * @param publicKey - The public key of the account that can decrypt the log. * @param log - The log contents. */ - public emitEncryptedLog(contractAddress: AztecAddress, storageSlot: Fr, noteTypeId: Fr, publicKey: Point, log: Fr[]) { + public override emitEncryptedLog( + contractAddress: AztecAddress, + storageSlot: Fr, + noteTypeId: Fr, + publicKey: Point, + log: Fr[], + ) { const note = new Note(log); const l1NotePayload = new L1NotePayload(note, contractAddress, storageSlot, noteTypeId); const taggedNote = new TaggedNote(l1NotePayload); @@ -329,7 +335,7 @@ export class ClientExecutionContext extends ViewDataOracle { * Emit an unencrypted log. * @param log - The unencrypted log to be emitted. */ - public emitUnencryptedLog(log: UnencryptedL2Log) { + public override emitUnencryptedLog(log: UnencryptedL2Log) { this.unencryptedLogs.push(log); const text = log.toHumanReadable(); this.log.verbose(`Emitted unencrypted log: "${text.length > 100 ? text.slice(0, 100) + '...' : text}"`); @@ -357,7 +363,7 @@ export class ClientExecutionContext extends ViewDataOracle { * @param isStaticCall - Whether the call is a delegate call. * @returns The execution result. */ - async callPrivateFunction( + override async callPrivateFunction( targetContractAddress: AztecAddress, functionSelector: FunctionSelector, argsHash: Fr, @@ -426,7 +432,7 @@ export class ClientExecutionContext extends ViewDataOracle { * @param isStaticCall - Whether the call is a static call. * @returns The public call stack item with the request information. */ - public async enqueuePublicFunctionCall( + public override async enqueuePublicFunctionCall( targetContractAddress: AztecAddress, functionSelector: FunctionSelector, argsHash: Fr, @@ -502,7 +508,7 @@ export class ClientExecutionContext extends ViewDataOracle { * @param startStorageSlot - The starting storage slot. * @param numberOfElements - Number of elements to read from the starting storage slot. */ - public async storageRead(startStorageSlot: Fr, numberOfElements: number): Promise { + public override async storageRead(startStorageSlot: Fr, numberOfElements: number): Promise { // TODO(#4320): This is a hack to work around not having directly access to the public data tree but // still having access to the witnesses const bn = await this.db.getBlockNumber(); diff --git a/yarn-project/simulator/src/client/view_data_oracle.ts b/yarn-project/simulator/src/client/view_data_oracle.ts index 13f0f929cb30..2a76c3464745 100644 --- a/yarn-project/simulator/src/client/view_data_oracle.ts +++ b/yarn-project/simulator/src/client/view_data_oracle.ts @@ -38,7 +38,7 @@ export class ViewDataOracle extends TypedOracle { * Return the nullifier key pair of an account to use in a specific contract. * @param account - The account address of the nullifier key. */ - public getNullifierKeyPair(account: AztecAddress) { + public override getNullifierKeyPair(account: AztecAddress) { return this.db.getNullifierKeyPair(account, this.contractAddress); } @@ -49,7 +49,7 @@ export class ViewDataOracle extends TypedOracle { * @param leafValue - The leaf value * @returns The index and sibling path concatenated [index, sibling_path] */ - public async getMembershipWitness(blockNumber: number, treeId: MerkleTreeId, leafValue: Fr): Promise { + public override async getMembershipWitness(blockNumber: number, treeId: MerkleTreeId, leafValue: Fr): Promise { const index = await this.db.findLeafIndex(blockNumber, treeId, leafValue); if (!index) { throw new Error(`Leaf value: ${leafValue} not found in ${MerkleTreeId[treeId]}`); @@ -65,7 +65,7 @@ export class ViewDataOracle extends TypedOracle { * @param leafIndex - Index of the leaf to get sibling path for * @returns The sibling path. */ - public getSiblingPath(blockNumber: number, treeId: MerkleTreeId, leafIndex: Fr): Promise { + public override getSiblingPath(blockNumber: number, treeId: MerkleTreeId, leafIndex: Fr): Promise { return this.db.getSiblingPath(blockNumber, treeId, leafIndex.toBigInt()); } @@ -75,7 +75,7 @@ export class ViewDataOracle extends TypedOracle { * @param nullifier - Nullifier we try to find witness for. * @returns The nullifier membership witness (if found). */ - public async getNullifierMembershipWitness( + public override async getNullifierMembershipWitness( blockNumber: number, nullifier: Fr, ): Promise { @@ -91,7 +91,7 @@ export class ViewDataOracle extends TypedOracle { * list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier * we are trying to prove non-inclusion for. */ - public async getLowNullifierMembershipWitness( + public override async getLowNullifierMembershipWitness( blockNumber: number, nullifier: Fr, ): Promise { @@ -104,7 +104,10 @@ export class ViewDataOracle extends TypedOracle { * @param leafSlot - The slot of the public data tree to get the witness for. * @returns - The witness */ - public async getPublicDataTreeWitness(blockNumber: number, leafSlot: Fr): Promise { + public override async getPublicDataTreeWitness( + blockNumber: number, + leafSlot: Fr, + ): Promise { return await this.db.getPublicDataTreeWitness(blockNumber, leafSlot); } @@ -113,7 +116,7 @@ export class ViewDataOracle extends TypedOracle { * @param blockNumber - The number of a block of which to get the block header. * @returns Block extracted from a block with block number `blockNumber`. */ - public async getHeader(blockNumber: number): Promise
{ + public override async getHeader(blockNumber: number): Promise
{ const block = await this.db.getBlock(blockNumber); if (!block) { return undefined; @@ -126,7 +129,7 @@ export class ViewDataOracle extends TypedOracle { * @param address - Address to fetch the complete address for. * @returns A complete address associated with the input address. */ - public getCompleteAddress(address: AztecAddress): Promise { + public override getCompleteAddress(address: AztecAddress): Promise { return this.db.getCompleteAddress(address); } @@ -135,7 +138,7 @@ export class ViewDataOracle extends TypedOracle { * @param address - Address. * @returns A contract instance. */ - public getContractInstance(address: AztecAddress): Promise { + public override getContractInstance(address: AztecAddress): Promise { return this.db.getContractInstance(address); } @@ -145,7 +148,7 @@ export class ViewDataOracle extends TypedOracle { * @param messageHash - Hash of the message to authenticate. * @returns Authentication witness for the requested message hash. */ - public getAuthWitness(messageHash: Fr): Promise { + public override getAuthWitness(messageHash: Fr): Promise { return Promise.resolve( this.authWitnesses.find(w => w.requestHash.equals(messageHash))?.witness ?? this.db.getAuthWitness(messageHash), ); @@ -156,7 +159,7 @@ export class ViewDataOracle extends TypedOracle { * @returns The capsule values * @remarks A capsule is a "blob" of data that is passed to the contract through an oracle. */ - public popCapsule(): Promise { + public override popCapsule(): Promise { return this.db.popCapsule(); } @@ -181,7 +184,7 @@ export class ViewDataOracle extends TypedOracle { * @param status - The status of notes to fetch. * @returns Array of note data. */ - public async getNotes( + public override async getNotes( storageSlot: Fr, numSelects: number, selectByIndexes: number[], @@ -218,7 +221,7 @@ export class ViewDataOracle extends TypedOracle { * @param innerNullifier - The inner nullifier. * @returns A boolean indicating whether the nullifier exists in the tree or not. */ - public async checkNullifierExists(innerNullifier: Fr) { + public override async checkNullifierExists(innerNullifier: Fr) { const nullifier = siloNullifier(this.contractAddress, innerNullifier!); const index = await this.db.getNullifierIndex(nullifier); return index !== undefined; @@ -232,7 +235,7 @@ export class ViewDataOracle extends TypedOracle { * @dev Contract address and secret are only used to compute the nullifier to get non-nullified messages * @returns The l1 to l2 membership witness (index of message in the tree and sibling path). */ - public async getL1ToL2MembershipWitness(contractAddress: AztecAddress, messageHash: Fr, secret: Fr) { + public override async getL1ToL2MembershipWitness(contractAddress: AztecAddress, messageHash: Fr, secret: Fr) { return await this.db.getL1ToL2MembershipWitness(contractAddress, messageHash, secret); } @@ -242,7 +245,7 @@ export class ViewDataOracle extends TypedOracle { * @param contractAddress - The address of the contract whose portal address is to be fetched. * @returns The portal contract address. */ - public getPortalContractAddress(contractAddress: AztecAddress) { + public override getPortalContractAddress(contractAddress: AztecAddress) { return this.db.getPortalContractAddress(contractAddress); } @@ -251,7 +254,7 @@ export class ViewDataOracle extends TypedOracle { * @param startStorageSlot - The starting storage slot. * @param numberOfElements - Number of elements to read from the starting storage slot. */ - public async storageRead(startStorageSlot: Fr, numberOfElements: number) { + public override async storageRead(startStorageSlot: Fr, numberOfElements: number) { const values = []; for (let i = 0n; i < numberOfElements; i++) { const storageSlot = new Fr(startStorageSlot.value + i); diff --git a/yarn-project/simulator/src/public/app_logic_phase_manager.ts b/yarn-project/simulator/src/public/app_logic_phase_manager.ts index b3253260b837..d55c439a83c7 100644 --- a/yarn-project/simulator/src/public/app_logic_phase_manager.ts +++ b/yarn-project/simulator/src/public/app_logic_phase_manager.ts @@ -17,14 +17,14 @@ import { type PublicKernelCircuitSimulator } from './public_kernel_circuit_simul */ export class AppLogicPhaseManager extends AbstractPhaseManager { constructor( - protected db: MerkleTreeOperations, - protected publicExecutor: PublicExecutor, - protected publicKernel: PublicKernelCircuitSimulator, - protected globalVariables: GlobalVariables, - protected historicalHeader: Header, + db: MerkleTreeOperations, + publicExecutor: PublicExecutor, + publicKernel: PublicKernelCircuitSimulator, + globalVariables: GlobalVariables, + historicalHeader: Header, protected publicContractsDB: ContractsDataSourcePublicDB, protected publicStateDB: PublicStateDB, - public phase: PublicKernelPhase = PublicKernelPhase.APP_LOGIC, + phase: PublicKernelPhase = PublicKernelPhase.APP_LOGIC, ) { super(db, publicExecutor, publicKernel, globalVariables, historicalHeader, phase); } diff --git a/yarn-project/simulator/src/public/public_execution_context.ts b/yarn-project/simulator/src/public/public_execution_context.ts index bd37f1547aeb..e0b0922c934a 100644 --- a/yarn-project/simulator/src/public/public_execution_context.ts +++ b/yarn-project/simulator/src/public/public_execution_context.ts @@ -93,7 +93,7 @@ export class PublicExecutionContext extends TypedOracle { * Pack the given arguments. * @param args - Arguments to pack */ - public packArguments(args: Fr[]): Promise { + public override packArguments(args: Fr[]): Promise { return Promise.resolve(this.packedValuesCache.pack(args)); } @@ -101,7 +101,7 @@ export class PublicExecutionContext extends TypedOracle { * Pack the given returns. * @param returns - Returns to pack */ - public packReturns(returns: Fr[]): Promise { + public override packReturns(returns: Fr[]): Promise { return Promise.resolve(this.packedValuesCache.pack(returns)); } @@ -109,7 +109,7 @@ export class PublicExecutionContext extends TypedOracle { * Unpack the given returns. * @param returnsHash - Returns hash to unpack */ - public unpackReturns(returnsHash: Fr): Promise { + public override unpackReturns(returnsHash: Fr): Promise { return Promise.resolve(this.packedValuesCache.unpack(returnsHash)); } @@ -121,7 +121,7 @@ export class PublicExecutionContext extends TypedOracle { * @dev Contract address and secret are only used to compute the nullifier to get non-nullified messages * @returns The l1 to l2 membership witness (index of message in the tree and sibling path). */ - public async getL1ToL2MembershipWitness(contractAddress: AztecAddress, messageHash: Fr, secret: Fr) { + public override async getL1ToL2MembershipWitness(contractAddress: AztecAddress, messageHash: Fr, secret: Fr) { return await this.commitmentsDb.getL1ToL2MembershipWitness(contractAddress, messageHash, secret); } @@ -129,7 +129,7 @@ export class PublicExecutionContext extends TypedOracle { * Emit an unencrypted log. * @param log - The unencrypted log to be emitted. */ - public emitUnencryptedLog(log: UnencryptedL2Log) { + public override emitUnencryptedLog(log: UnencryptedL2Log) { // TODO(https://github.com/AztecProtocol/aztec-packages/issues/885) this.unencryptedLogs.push(log); this.log.verbose(`Emitted unencrypted log: "${log.toHumanReadable()}"`); @@ -141,7 +141,7 @@ export class PublicExecutionContext extends TypedOracle { * @param contractAddress - The address of the contract whose portal address is to be fetched. * @returns The portal contract address. */ - public async getPortalContractAddress(contractAddress: AztecAddress) { + public override async getPortalContractAddress(contractAddress: AztecAddress) { return (await this.contractsDb.getPortalContractAddress(contractAddress)) ?? EthAddress.ZERO; } @@ -150,7 +150,7 @@ export class PublicExecutionContext extends TypedOracle { * @param startStorageSlot - The starting storage slot. * @param numberOfElements - Number of elements to read from the starting storage slot. */ - public async storageRead(startStorageSlot: Fr, numberOfElements: number) { + public override async storageRead(startStorageSlot: Fr, numberOfElements: number) { const values = []; for (let i = 0; i < Number(numberOfElements); i++) { const storageSlot = new Fr(startStorageSlot.value + BigInt(i)); @@ -167,7 +167,7 @@ export class PublicExecutionContext extends TypedOracle { * @param startStorageSlot - The starting storage slot. * @param values - The values to be written. */ - public async storageWrite(startStorageSlot: Fr, values: Fr[]) { + public override async storageWrite(startStorageSlot: Fr, values: Fr[]) { const newValues = []; for (let i = 0; i < values.length; i++) { const storageSlot = new Fr(startStorageSlot.toBigInt() + BigInt(i)); @@ -188,7 +188,7 @@ export class PublicExecutionContext extends TypedOracle { * @param argsHash - The packed arguments to pass to the function. * @returns The return values of the public function. */ - public async callPublicFunction( + public override async callPublicFunction( targetContractAddress: AztecAddress, functionSelector: FunctionSelector, argsHash: Fr, @@ -256,12 +256,12 @@ export class PublicExecutionContext extends TypedOracle { return childExecutionResult.returnValues; } - public async checkNullifierExists(nullifier: Fr): Promise { + public override async checkNullifierExists(nullifier: Fr): Promise { const witness = await this.commitmentsDb.getNullifierMembershipWitnessAtLatestBlock(nullifier); return !!witness; } - public async getContractInstance(address: AztecAddress): Promise { + public override async getContractInstance(address: AztecAddress): Promise { // Note to AVM implementor: The wrapper of the oracle call get_contract_instance in aztec-nr // automatically checks that the returned instance is correct, by hashing it together back // into the address. However, in the AVM, we also need to prove the negative, otherwise a malicious diff --git a/yarn-project/simulator/src/public/setup_phase_manager.test.ts b/yarn-project/simulator/src/public/setup_phase_manager.test.ts index b90c2a0147de..c8be4e8a64c1 100644 --- a/yarn-project/simulator/src/public/setup_phase_manager.test.ts +++ b/yarn-project/simulator/src/public/setup_phase_manager.test.ts @@ -12,7 +12,7 @@ import { type PublicKernelCircuitSimulator } from './public_kernel_circuit_simul import { SetupPhaseManager } from './setup_phase_manager.js'; class TestSetupPhaseManager extends SetupPhaseManager { - extractEnqueuedPublicCalls(tx: any) { + override extractEnqueuedPublicCalls(tx: any) { return super.extractEnqueuedPublicCalls(tx); } } diff --git a/yarn-project/simulator/src/public/setup_phase_manager.ts b/yarn-project/simulator/src/public/setup_phase_manager.ts index 591cc5814e2e..9c21f610a16a 100644 --- a/yarn-project/simulator/src/public/setup_phase_manager.ts +++ b/yarn-project/simulator/src/public/setup_phase_manager.ts @@ -17,14 +17,14 @@ import { type PublicKernelCircuitSimulator } from './public_kernel_circuit_simul */ export class SetupPhaseManager extends AbstractPhaseManager { constructor( - protected db: MerkleTreeOperations, - protected publicExecutor: PublicExecutor, - protected publicKernel: PublicKernelCircuitSimulator, - protected globalVariables: GlobalVariables, - protected historicalHeader: Header, + db: MerkleTreeOperations, + publicExecutor: PublicExecutor, + publicKernel: PublicKernelCircuitSimulator, + globalVariables: GlobalVariables, + historicalHeader: Header, protected publicContractsDB: ContractsDataSourcePublicDB, protected publicStateDB: PublicStateDB, - public phase: PublicKernelPhase = PublicKernelPhase.SETUP, + phase: PublicKernelPhase = PublicKernelPhase.SETUP, ) { super(db, publicExecutor, publicKernel, globalVariables, historicalHeader, phase); } diff --git a/yarn-project/simulator/src/public/tail_phase_manager.ts b/yarn-project/simulator/src/public/tail_phase_manager.ts index 44ebe1dd2d38..c1899ae2d729 100644 --- a/yarn-project/simulator/src/public/tail_phase_manager.ts +++ b/yarn-project/simulator/src/public/tail_phase_manager.ts @@ -23,14 +23,14 @@ import { type PublicKernelCircuitSimulator } from './public_kernel_circuit_simul export class TailPhaseManager extends AbstractPhaseManager { constructor( - protected db: MerkleTreeOperations, - protected publicExecutor: PublicExecutor, - protected publicKernel: PublicKernelCircuitSimulator, - protected globalVariables: GlobalVariables, - protected historicalHeader: Header, + db: MerkleTreeOperations, + publicExecutor: PublicExecutor, + publicKernel: PublicKernelCircuitSimulator, + globalVariables: GlobalVariables, + historicalHeader: Header, protected publicContractsDB: ContractsDataSourcePublicDB, protected publicStateDB: PublicStateDB, - public readonly phase: PublicKernelPhase = PublicKernelPhase.TAIL, + phase: PublicKernelPhase = PublicKernelPhase.TAIL, ) { super(db, publicExecutor, publicKernel, globalVariables, historicalHeader, phase); } diff --git a/yarn-project/simulator/src/public/teardown_phase_manager.ts b/yarn-project/simulator/src/public/teardown_phase_manager.ts index 5d6cff3a3bd0..c5e84807227c 100644 --- a/yarn-project/simulator/src/public/teardown_phase_manager.ts +++ b/yarn-project/simulator/src/public/teardown_phase_manager.ts @@ -17,14 +17,14 @@ import { type PublicKernelCircuitSimulator } from './public_kernel_circuit_simul */ export class TeardownPhaseManager extends AbstractPhaseManager { constructor( - protected db: MerkleTreeOperations, - protected publicExecutor: PublicExecutor, - protected publicKernel: PublicKernelCircuitSimulator, - protected globalVariables: GlobalVariables, - protected historicalHeader: Header, + db: MerkleTreeOperations, + publicExecutor: PublicExecutor, + publicKernel: PublicKernelCircuitSimulator, + globalVariables: GlobalVariables, + historicalHeader: Header, protected publicContractsDB: ContractsDataSourcePublicDB, protected publicStateDB: PublicStateDB, - public phase: PublicKernelPhase = PublicKernelPhase.TEARDOWN, + phase: PublicKernelPhase = PublicKernelPhase.TEARDOWN, ) { super(db, publicExecutor, publicKernel, globalVariables, historicalHeader, phase); } diff --git a/yarn-project/tsconfig.json b/yarn-project/tsconfig.json index 887a5e3c4ebc..95f7ccc5cee0 100644 --- a/yarn-project/tsconfig.json +++ b/yarn-project/tsconfig.json @@ -15,7 +15,8 @@ "importHelpers": true, "resolveJsonModule": true, "composite": true, - "skipLibCheck": true + "skipLibCheck": true, + "noImplicitOverride": true, }, "references": [ { "path": "accounts/tsconfig.json" },