Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: No implicit overrides #5792

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class DeployAccountMethod extends DeployMethod {
: feePaymentNameOrArtifact;
}

protected async getInitializeFunctionCalls(options: DeployOptions): Promise<ExecutionRequestInit> {
protected override async getInitializeFunctionCalls(options: DeployOptions): Promise<ExecutionRequestInit> {
const exec = await super.getInitializeFunctionCalls(options);

if (options.fee && this.#feePaymentArtifact) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<DeployAccountTxReceipt> {
public override async wait(opts: WaitOpts = DefaultWaitOpts): Promise<DeployAccountTxReceipt> {
const receipt = await super.wait(opts);
const wallet = await this.getWalletPromise;
await waitForAccountSynch(this.pxe, wallet.getCompleteAddress(), opts);
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/aztec.js/src/contract/deploy_method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export class DeployMethod<TContract extends ContractBase = Contract> 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<TContract> {
public override send(options: DeployOptions = {}): DeploySentTx<TContract> {
const txHashPromise = super.send(options).getTxHash();
const instance = this.getInstance(options);
this.log.debug(
Expand Down Expand Up @@ -223,7 +223,7 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
* @param options - Deployment options.
* @returns The proven tx.
*/
public prove(options: DeployOptions): Promise<Tx> {
public override prove(options: DeployOptions): Promise<Tx> {
return super.prove(options);
}

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec.js/src/contract/deploy_sent_tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class DeploySentTx<TContract extends Contract = Contract> 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<DeployTxReceipt<TContract>> {
public override async wait(opts?: DeployedWaitOpts): Promise<DeployTxReceipt<TContract>> {
const receipt = await super.wait(opts);
const contract = await this.getContractObject(opts?.wallet);
return { ...receipt, contract };
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec.js/src/wallet/account_wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class Note extends Vector<Fr> {
* 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');
}

Expand Down
4 changes: 2 additions & 2 deletions yarn-project/end-to-end/src/e2e_fees.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ describe('e2e_fees', () => {
});

class BuggedSetupFeePaymentMethod extends PublicFeePaymentMethod {
getFunctionCalls(gasSettings: GasSettings): Promise<FunctionCall[]> {
override getFunctionCalls(gasSettings: GasSettings): Promise<FunctionCall[]> {
const maxFee = gasSettings.getFeeLimit();
const nonce = Fr.random();
const messageHash = computeAuthWitMessageHash(
Expand Down Expand Up @@ -710,7 +710,7 @@ class BuggedSetupFeePaymentMethod extends PublicFeePaymentMethod {
}

class BuggedTeardownFeePaymentMethod extends PublicFeePaymentMethod {
async getFunctionCalls(gasSettings: GasSettings): Promise<FunctionCall[]> {
override async getFunctionCalls(gasSettings: GasSettings): Promise<FunctionCall[]> {
// authorize the FPC to take the max fee from Alice
const nonce = Fr.random();
const maxFee = gasSettings.getFeeLimit();
Expand Down
8 changes: 4 additions & 4 deletions yarn-project/foundation/src/abi/function_selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 6 additions & 6 deletions yarn-project/foundation/src/aztec-address/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -44,7 +44,7 @@ class IndexedTreeSnapshotImpl extends BaseFullTreeSnapshot<Buffer> 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();
}
Expand Down Expand Up @@ -99,7 +99,7 @@ class IndexedTreeSnapshotImpl extends BaseFullTreeSnapshot<Buffer> 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ export class StandardIndexedTree extends TreeBase<Buffer> implements IndexedTree
* @returns Empty promise.
* @remarks Use batchInsert method instead.
*/
appendLeaves(_leaves: Buffer[]): Promise<void> {
override appendLeaves(_leaves: Buffer[]): Promise<void> {
throw new Error('Not implemented');
}

/**
* Commits the changes to the database.
* @returns Empty promise.
*/
public async commit(): Promise<void> {
public override async commit(): Promise<void> {
await super.commit();
await this.commitLeaves();
}
Expand All @@ -109,7 +109,7 @@ export class StandardIndexedTree extends TreeBase<Buffer> implements IndexedTree
* Rolls back the not-yet-committed changes.
* @returns Empty promise.
*/
public async rollback(): Promise<void> {
public override async rollback(): Promise<void> {
await super.rollback();
this.clearCachedLeaves();
}
Expand All @@ -120,7 +120,7 @@ export class StandardIndexedTree extends TreeBase<Buffer> 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();
}
Expand Down Expand Up @@ -262,7 +262,7 @@ export class StandardIndexedTree extends TreeBase<Buffer> 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<void> {
public override async init(prefilledSize: number): Promise<void> {
if (prefilledSize < 1) {
throw new Error(`Prefilled size must be at least 1!`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
public override appendLeaves(leaves: Buffer[]): Promise<void> {
for (const leaf of leaves) {
this.appendLeaf(leaf);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class StandardTree<T extends Bufferable = Buffer> extends TreeBase<T> imp
* @param leaves - The leaves to append.
* @returns Empty promise.
*/
public appendLeaves(leaves: T[]): Promise<void> {
public override appendLeaves(leaves: T[]): Promise<void> {
this.hasher.reset();
const timer = new Timer();
super.appendLeaves(leaves);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')}
};
}
Expand Down
6 changes: 3 additions & 3 deletions yarn-project/pxe/src/synchronizer/synchronizer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
public override initialSync(): Promise<void> {
return super.initialSync();
}

public workNoteProcessorCatchUp(limit = 1): Promise<boolean> {
public override workNoteProcessorCatchUp(limit = 1): Promise<boolean> {
return super.workNoteProcessorCatchUp(limit);
}
}
4 changes: 2 additions & 2 deletions yarn-project/sequencer-client/src/sequencer/sequencer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,11 @@ describe('sequencer', () => {
});

class TestSubject extends Sequencer {
public work() {
public override work() {
return super.work();
}

public initialSync(): Promise<void> {
public override initialSync(): Promise<void> {
return super.initialSync();
}
}
4 changes: 2 additions & 2 deletions yarn-project/simulator/src/avm/opcodes/arithmetic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export abstract class ThreeOperandArithmeticInstruction extends ThreeOperandInst
context.machineState.incrementPc();
}

protected gasCost(memoryOps: Partial<MemoryOperations & { indirect: number }>) {
protected override gasCost(memoryOps: Partial<MemoryOperations & { indirect: number }>) {
const baseGasCost = getGasCostForTypeTag(this.inTag, getBaseGasCost(this.opcode));
const memoryGasCost = getMemoryGasCost(memoryOps);
return sumGas(baseGasCost, memoryGasCost);
Expand Down Expand Up @@ -102,7 +102,7 @@ export class FieldDiv extends Instruction {
context.machineState.incrementPc();
}

protected gasCost(memoryOps: Partial<MemoryOperations & { indirect: number }>) {
protected override gasCost(memoryOps: Partial<MemoryOperations & { indirect: number }>) {
const baseGasCost = getGasCostForTypeTag(TypeTag.FIELD, getBaseGasCost(this.opcode));
const memoryGasCost = getMemoryGasCost(memoryOps);
return sumGas(baseGasCost, memoryGasCost);
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/simulator/src/avm/opcodes/external_calls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions yarn-project/simulator/src/avm/opcodes/memory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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);
}
Expand Down Expand Up @@ -217,7 +217,7 @@ export class CalldataCopy extends Instruction {
context.machineState.incrementPc();
}

protected gasCost(memoryOps: Partial<MemoryOperations & { indirect: number }> = {}) {
protected override gasCost(memoryOps: Partial<MemoryOperations & { indirect: number }> = {}) {
const baseGasCost = mulGas(getBaseGasCost(this.opcode), this.copySize);
const memoryGasCost = getMemoryGasCost(memoryOps);
return sumGas(baseGasCost, memoryGasCost);
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/simulator/src/avm/opcodes/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ abstract class BaseStorageInstruction extends Instruction {
super();
}

protected gasCost(memoryOps: Partial<MemoryOperations & { indirect: number }>): Gas {
protected override gasCost(memoryOps: Partial<MemoryOperations & { indirect: number }>): Gas {
const baseGasCost = mulGas(getBaseGasCost(this.opcode), this.size);
const memoryGasCost = getMemoryGasCost(memoryOps);
return sumGas(baseGasCost, memoryGasCost);
Expand Down
Loading
Loading