Skip to content
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
4 changes: 2 additions & 2 deletions yarn-project/archiver/src/archiver/archiver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,11 @@ describe('Archiver', () => {
expect(publicLogs.length).toEqual(expectedTotalNumPublicLogs);
}

blockNumbers.forEach(async x => {
for (const x of blockNumbers) {
const expectedTotalNumContractClassLogs = 4;
const contractClassLogs = await archiver.getContractClassLogs({ fromBlock: x, toBlock: x + 1 });
expect(contractClassLogs.logs.length).toEqual(expectedTotalNumContractClassLogs);
});
}

// Check last proven block number
const provenBlockNumber = await archiver.getProvenBlockNumber();
Expand Down
1 change: 1 addition & 0 deletions yarn-project/aztec-faucet/src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export function createFaucetHttpServer(faucet: Faucet, apiPrefix = '', logger =
app.use(router.routes());
app.use(router.allowedMethods());

// eslint-disable-next-line @typescript-eslint/no-misused-promises
return createServer(app.callback());
}

Expand Down
3 changes: 3 additions & 0 deletions yarn-project/aztec-node/src/bin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@ async function main() {
process.exit(0);
};

// eslint-disable-next-line @typescript-eslint/no-misused-promises
process.once('SIGINT', shutdown);
// eslint-disable-next-line @typescript-eslint/no-misused-promises
process.once('SIGTERM', shutdown);

const rpcServer = createAztecNodeRpcServer(aztecNode);
const app = rpcServer.getApp(API_PREFIX);

// eslint-disable-next-line @typescript-eslint/no-misused-promises
const httpServer = http.createServer(app.callback());
httpServer.listen(+AZTEC_NODE_PORT);
logger.info(`Aztec Node JSON-RPC Server listening on port ${AZTEC_NODE_PORT}`);
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec.js/src/account_manager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export class AccountManager {
* @returns A DeployMethod instance that deploys this account contract.
*/
public async getDeployMethod() {
if (!this.isDeployable()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😮

if (!(await this.isDeployable())) {
throw new Error(
`Account contract ${this.accountContract.getContractArtifact().name} does not require deployment.`,
);
Expand Down
8 changes: 7 additions & 1 deletion yarn-project/aztec.js/src/utils/chain_monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class ChainMonitor {
if (this.handle) {
throw new Error('Chain monitor already started');
}
this.handle = setInterval(() => this.run(), this.intervalMs);
this.handle = setInterval(this.safeRun.bind(this), this.intervalMs);
}

stop() {
Expand All @@ -37,6 +37,12 @@ export class ChainMonitor {
}
}

private safeRun() {
void this.run().catch(error => {
this.logger.error('Error in chain monitor loop', error);
});
}

async run() {
const newL1BlockNumber = Number(await this.l1Client.getBlockNumber({ cacheTime: 0 }));
if (this.l1BlockNumber === newL1BlockNumber) {
Expand Down
2 changes: 2 additions & 0 deletions yarn-project/aztec/src/cli/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ export const installSignalHandlers = (logFn: LogFn, cb?: Array<() => Promise<voi
};
process.removeAllListeners('SIGINT');
process.removeAllListeners('SIGTERM');
// eslint-disable-next-line @typescript-eslint/no-misused-promises
process.once('SIGINT', shutdown);
// eslint-disable-next-line @typescript-eslint/no-misused-promises
process.once('SIGTERM', shutdown);
};

Expand Down
10 changes: 5 additions & 5 deletions yarn-project/bb-prover/src/bb/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ export async function generateTubeProof(
}

try {
if (!filePresent(vkPath) || !filePresent(proofPath)) {
if (!(await filePresent(vkPath)) || !(await filePresent(proofPath))) {
return { status: BB_RESULT.FAILURE, reason: `Client IVC input files not present in ${workingDirectory}` };
}
const args = ['-o', outputPath, '-v'];
Expand Down Expand Up @@ -436,7 +436,7 @@ export async function generateAvmProofV2(
// Write the inputs to the working directory.
const avmInputsPath = join(workingDirectory, 'avm_inputs.bin');
await fs.writeFile(avmInputsPath, inputsBuffer);
if (!filePresent(avmInputsPath)) {
if (!(await filePresent(avmInputsPath))) {
return { status: BB_RESULT.FAILURE, reason: `Could not write avm inputs to ${avmInputsPath}` };
}

Expand Down Expand Up @@ -519,12 +519,12 @@ export async function generateAvmProof(
// Write the inputs to the working directory.

await fs.writeFile(publicInputsPath, input.publicInputs.toBuffer());
if (!filePresent(publicInputsPath)) {
if (!(await filePresent(publicInputsPath))) {
return { status: BB_RESULT.FAILURE, reason: `Could not write publicInputs at ${publicInputsPath}` };
}

await fs.writeFile(avmHintsPath, input.avmHints.toBuffer());
if (!filePresent(avmHintsPath)) {
if (!(await filePresent(avmHintsPath))) {
return { status: BB_RESULT.FAILURE, reason: `Could not write avmHints at ${avmHintsPath}` };
}

Expand Down Expand Up @@ -619,7 +619,7 @@ export async function verifyAvmProofV2(
.catch(_ => false);
const avmInputsPath = join(workingDirectory, 'avm_public_inputs.bin');
await fs.writeFile(avmInputsPath, inputsBuffer);
if (!filePresent(avmInputsPath)) {
if (!(await filePresent(avmInputsPath))) {
return { status: BB_RESULT.FAILURE, reason: `Could not write avm inputs to ${avmInputsPath}` };
}

Expand Down
2 changes: 2 additions & 0 deletions yarn-project/blob-sink/src/server/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ async function main() {
logger.info('Node stopped');
process.exit(0);
};
// eslint-disable-next-line @typescript-eslint/no-misused-promises
process.on('SIGTERM', stop);
// eslint-disable-next-line @typescript-eslint/no-misused-promises
process.on('SIGINT', stop);
}

Expand Down
2 changes: 2 additions & 0 deletions yarn-project/blob-sink/src/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ export class BlobSinkServer {
private setupRoutes() {
// TODO(md): needed?
this.app.get('/eth/v1/beacon/headers/:block_id', this.handleGetBlockHeader.bind(this));
// eslint-disable-next-line @typescript-eslint/no-misused-promises
this.app.get('/eth/v1/beacon/blob_sidecars/:block_id', this.handleGetBlobSidecar.bind(this));
// eslint-disable-next-line @typescript-eslint/no-misused-promises
this.app.post('/blob_sidecar', this.handlePostBlobSidecar.bind(this));
}

Expand Down
14 changes: 6 additions & 8 deletions yarn-project/cli-wallet/src/cmds/bridge_fee_juice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,12 @@ export async function bridgeL1FeeJuice(

if (wait) {
const delayedCheck = (delay: number) => {
return new Promise(resolve => {
setTimeout(async () => {
const witness = await pxe.getL1ToL2MembershipWitness(
feeJuiceAddress,
Fr.fromHexString(messageHash),
claimSecret,
);
resolve(witness);
return new Promise((resolve, reject) => {
setTimeout(() => {
void pxe
.getL1ToL2MembershipWitness(feeJuiceAddress, Fr.fromHexString(messageHash), claimSecret)
.then(witness => resolve(witness))
.catch(err => reject(err));
}, delay);
});
};
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/cli-wallet/src/cmds/create_account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export async function createAccount(
} else {
const wallet = await account.getWallet();
const sendOpts: DeployAccountOptions = {
...feeOpts.toSendOpts(wallet),
...(await feeOpts.toSendOpts(wallet)),
skipClassRegistration: !publicDeploy,
skipPublicDeployment: !publicDeploy,
skipInitialization: skipInitialization,
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/cli-wallet/src/cmds/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export async function deploy(

const deploy = deployer.deploy(...args);
const deployOpts: Parameters<DeployMethod['send']>[0] = {
...feeOpts.toSendOpts(wallet),
...(await feeOpts.toSendOpts(wallet)),
contractAddressSalt: salt,
universalDeploy,
skipClassRegistration,
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/cli-wallet/src/cmds/deploy_account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export async function deployAccount(
let txReceipt;

const sendOpts: DeployAccountOptions = {
...feeOpts.toSendOpts(wallet),
...(await feeOpts.toSendOpts(wallet)),
skipInitialization: false,
};
if (feeOpts.estimateOnly) {
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/cli/src/cmds/contracts/inspect_contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export async function inspectContract(contractArtifactFile: string, debugLogger:
const externalFunctions = contractFns.filter(f => !f.isInternal);
if (externalFunctions.length > 0) {
log(`\nExternal functions:`);
externalFunctions.forEach(f => logFunction(f, log));
await Promise.all(externalFunctions.map(f => logFunction(f, log)));
}

const internalFunctions = contractFns.filter(f => f.isInternal);
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/end-to-end/src/e2e_p2p/p2p_network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ export class P2PNetworkTest {
* Start a loop to sync the mock system time with the L1 block time
*/
public startSyncMockSystemTimeInterval() {
this.cleanupInterval = setInterval(async () => {
await this.syncMockSystemTime();
this.cleanupInterval = setInterval(() => {
void this.syncMockSystemTime().catch(err => this.logger.error('Error syncing mock system time', err));
}, l1ContractsConfig.aztecSlotDuration * 1000);
}

Expand Down
4 changes: 2 additions & 2 deletions yarn-project/end-to-end/src/e2e_synching.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -530,10 +530,10 @@ describe('e2e_synching', () => {
const txHash = blockTip.body.txEffects[0].txHash;

const contractClassIds = await archiver.getContractClassIds();
contracts.forEach(async c => {
for (const c of contracts) {
expect(contractClassIds.includes(c.instance.contractClassId)).toBeTrue;
expect(await archiver.getContract(c.address)).not.toBeUndefined;
});
}

expect(await archiver.getTxEffect(txHash)).not.toBeUndefined;
expect(await archiver.getPrivateLogs(blockTip.number, 1)).not.toEqual([]);
Expand Down
8 changes: 4 additions & 4 deletions yarn-project/end-to-end/src/spartan/4epochs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ describe('token transfer test', () => {
const recipient = testWallets.recipientWallet.getAddress();
const transferAmount = 1n;

testWallets.wallets.forEach(async w => {
for (const w of testWallets.wallets) {
expect(MINT_AMOUNT).toBe(await testWallets.tokenAdminWallet.methods.balance_of_public(w.getAddress()).simulate());
});
}

expect(0n).toBe(await testWallets.tokenAdminWallet.methods.balance_of_public(recipient).simulate());

Expand Down Expand Up @@ -98,11 +98,11 @@ describe('token transfer test', () => {
);
}

testWallets.wallets.forEach(async w => {
for (const w of testWallets.wallets) {
expect(MINT_AMOUNT - ROUNDS * transferAmount).toBe(
await testWallets.tokenAdminWallet.methods.balance_of_public(w.getAddress()).simulate(),
);
});
}

expect(ROUNDS * transferAmount * BigInt(testWallets.wallets.length)).toBe(
await testWallets.tokenAdminWallet.methods.balance_of_public(recipient).simulate(),
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/end-to-end/src/spartan/reorg.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ const { NAMESPACE, HOST_PXE_PORT, HOST_ETHEREUM_PORT, CONTAINER_PXE_PORT, CONTAI
const debugLogger = createLogger('e2e:spartan-test:reorg');

async function checkBalances(testWallets: TestWallets, mintAmount: bigint, totalAmountTransferred: bigint) {
testWallets.wallets.forEach(async w => {
for (const w of testWallets.wallets) {
expect(await testWallets.tokenAdminWallet.methods.balance_of_public(w.getAddress()).simulate()).toBe(
mintAmount - totalAmountTransferred,
);
});
}

expect(
await testWallets.tokenAdminWallet.methods.balance_of_public(testWallets.recipientWallet.getAddress()).simulate(),
Expand Down
8 changes: 4 additions & 4 deletions yarn-project/end-to-end/src/spartan/transfer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ describe('token transfer test', () => {
const recipient = testWallets.recipientWallet.getAddress();
const transferAmount = 1n;

testWallets.wallets.forEach(async w => {
for (const w of testWallets.wallets) {
expect(MINT_AMOUNT).toBe(await testWallets.tokenAdminWallet.methods.balance_of_public(w.getAddress()).simulate());
});
}

expect(0n).toBe(await testWallets.tokenAdminWallet.methods.balance_of_public(recipient).simulate());

Expand All @@ -66,11 +66,11 @@ describe('token transfer test', () => {
await Promise.all(txs.map(t => t.send().wait({ timeout: 600 })));
}

testWallets.wallets.forEach(async w => {
for (const w of testWallets.wallets) {
expect(MINT_AMOUNT - ROUNDS * transferAmount).toBe(
await testWallets.tokenAdminWallet.methods.balance_of_public(w.getAddress()).simulate(),
);
});
}

expect(ROUNDS * transferAmount * BigInt(testWallets.wallets.length)).toBe(
await testWallets.tokenAdminWallet.methods.balance_of_public(recipient).simulate(),
Expand Down
1 change: 1 addition & 0 deletions yarn-project/foundation/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module.exports = {
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/no-floating-promises': 2,
'@typescript-eslint/no-misused-promises': 2,
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
'@typescript-eslint/consistent-type-imports': ['error', { fixStyle: 'inline-type-imports' }],
'require-await': 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ export class SafeJsonRpcServer {
throw new Error('Server is already listening');
}

// eslint-disable-next-line @typescript-eslint/no-misused-promises
this.httpServer = http.createServer(this.getApp(prefix).callback());
this.httpServer.listen(port);
}
Expand Down Expand Up @@ -355,6 +356,7 @@ export async function startHttpRpcServer(
const statusRouter = createStatusRouter(rpcServer.isHealthy.bind(rpcServer), options.apiPrefix);
app.use(statusRouter.routes()).use(statusRouter.allowedMethods());

// eslint-disable-next-line @typescript-eslint/no-misused-promises
const httpServer = http.createServer(app.callback());
if (options.timeoutMs) {
httpServer.timeout = options.timeoutMs;
Expand Down
9 changes: 5 additions & 4 deletions yarn-project/foundation/src/mutex/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,13 @@ export class Mutex {
*
* @param id - The id of the current lock instance.
*/
private async ping(id: number) {
private ping(id: number) {
if (id !== this.id) {
return;
}

await this.db.extendLock(this.name, this.timeout);
this.pingTimeout = setTimeout(() => this.ping(id), this.pingInterval);
void (async () => {
await this.db.extendLock(this.name, this.timeout);
this.pingTimeout = setTimeout(() => this.ping(id), this.pingInterval);
})();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export function startWebModule(module: WasmModule) {
};
const transportListener = new WorkerListener(self);
const transportServer = new TransportServer<DispatchMsg>(transportListener, dispatch);
// eslint-disable-next-line @typescript-eslint/no-misused-promises
module.addLogger((...args: any[]) => transportServer.broadcast({ fn: 'emit', args: ['log', ...args] }));
transportServer.start();
}
1 change: 1 addition & 0 deletions yarn-project/foundation/src/worker/browser/web_worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export async function createWebWorker(url: string, initialMem?: number, maxMem?:
const transportClient = new TransportClient<DispatchMsg>(transportConnect);
await transportClient.open();
const remoteModule = createDispatchProxy(WasmModule, transportClient) as WasmWorker;
// eslint-disable-next-line @typescript-eslint/no-misused-promises
remoteModule.destroyWorker = async () => {
await transportClient.request({ fn: '__destroyWorker__', args: [] });
transportClient.close();
Expand Down
1 change: 1 addition & 0 deletions yarn-project/foundation/src/worker/node/node_worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export async function createNodeWorker(filepath: string, initialMem?: number, ma
const transportClient = new TransportClient<DispatchMsg>(transportConnect);
await transportClient.open();
const remoteModule = createDispatchProxy(WasmModule, transportClient) as WasmWorker;
// eslint-disable-next-line @typescript-eslint/no-misused-promises
remoteModule.destroyWorker = async () => {
await transportClient.request({ fn: '__destroyWorker__', args: [] });
transportClient.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export function startNodeModule(module: WasmModule) {
};
const transportListener = new NodeListener();
const transportServer = new TransportServer<DispatchMsg>(transportListener, dispatch);
// eslint-disable-next-line @typescript-eslint/no-misused-promises
module.addLogger((...args: any[]) => transportServer.broadcast({ fn: 'emit', args: ['log', ...args] }));
transportServer.start();
}
1 change: 1 addition & 0 deletions yarn-project/ivc-integration/src/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ document.addEventListener('DOMContentLoaded', function () {

const button = document.createElement('button');
button.innerText = 'Run Test';
// eslint-disable-next-line @typescript-eslint/no-misused-promises
button.addEventListener('click', async () => {
logger(`generating circuit and witness...`);
const [bytecodes, witnessStack] = await generate3FunctionTestingIVCStack();
Expand Down
4 changes: 1 addition & 3 deletions yarn-project/noir-bb-bench/src/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ document.addEventListener('DOMContentLoaded', function () {

const button = document.createElement('button');
button.innerText = 'Run Test';
button.addEventListener('click', async () => {
const _ = await proveThenVerifyStack();
});
button.addEventListener('click', () => void proveThenVerifyStack());
document.body.appendChild(button);
});
2 changes: 2 additions & 0 deletions yarn-project/p2p-bootstrap/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ async function main(
logger.info('Node stopped');
process.exit(0);
};
// eslint-disable-next-line @typescript-eslint/no-misused-promises
process.on('SIGTERM', stop);
// eslint-disable-next-line @typescript-eslint/no-misused-promises
process.on('SIGINT', stop);
}

Expand Down
Loading