Skip to content

Commit

Permalink
improve: further styles
Browse files Browse the repository at this point in the history
  • Loading branch information
james-a-morris committed Sep 7, 2023
1 parent 12d2e90 commit b597ae2
Show file tree
Hide file tree
Showing 19 changed files with 29 additions and 34 deletions.
4 changes: 2 additions & 2 deletions scripts/unwrapWeth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ export async function run(): Promise<void> {

if (require.main === module) {
run()
.then(async () => {
.then(() => {
// eslint-disable-next-line no-process-exit
process.exit(0);
})
.catch(async (error) => {
.catch((error) => {
console.error("Process exited with", error);
// eslint-disable-next-line no-process-exit
process.exit(1);
Expand Down
2 changes: 1 addition & 1 deletion scripts/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import readline from "readline";

async function askQuestion(query: string) {
function askQuestion(query: string) {
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });

return new Promise((resolve) =>
Expand Down
4 changes: 2 additions & 2 deletions scripts/zkSyncDemo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ export async function run(): Promise<void> {

if (require.main === module) {
run()
.then(async () => {
.then(() => {
// eslint-disable-next-line no-process-exit
process.exit(0);
})
.catch(async (error) => {
.catch((error) => {
console.error("Process exited with", error);
// eslint-disable-next-line no-process-exit
process.exit(1);
Expand Down
7 changes: 1 addition & 6 deletions src/clients/BalanceAllocator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,7 @@ export class BalanceAllocator {
return true;
}

async requestBalanceAllocation(
chainId: number,
tokens: string[],
holder: string,
amount: BigNumber
): Promise<boolean> {
requestBalanceAllocation(chainId: number, tokens: string[], holder: string, amount: BigNumber): Promise<boolean> {
return this.requestBalanceAllocations([{ chainId, tokens, holder, amount }]);
}

Expand Down
4 changes: 2 additions & 2 deletions src/clients/BundleDataClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export class BundleDataClient {
// Common data re-formatting logic shared across all data worker public functions.
// User must pass in spoke pool to search event data against. This allows the user to refund relays and fill deposits
// on deprecated spoke pools.
async loadData(
loadData(
blockRangesForChains: number[][],
spokePoolClients: { [chainId: number]: SpokePoolClient },
logData = true
Expand Down Expand Up @@ -391,7 +391,7 @@ export class BundleDataClient {
this.chainIdListForBundleEvaluationBlockNumbers
);
const refundRequests = originClient.getRefundRequests(blockRangeForChain[0], blockRangeForChain[1]);
await Promise.all(refundRequests.map(async (refundRequest) => validateRefundRequestAndSaveData(refundRequest)));
await Promise.all(refundRequests.map((refundRequest) => validateRefundRequestAndSaveData(refundRequest)));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/clients/TransactionClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class TransactionClient {
return Promise.all(txns.map((txn: AugmentedTransaction) => this._simulate(txn)));
}

protected async _submit(txn: AugmentedTransaction, nonce: number | null = null): Promise<TransactionResponse> {
protected _submit(txn: AugmentedTransaction, nonce: number | null = null): Promise<TransactionResponse> {
const { contract, method, args, value, gasLimit } = txn;
return runTransaction(this.logger, contract, method, args, value, gasLimit, nonce);
}
Expand Down
2 changes: 1 addition & 1 deletion src/clients/bridges/ArbitrumAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export class ArbitrumAdapter extends BaseAdapter {
);
}

async wrapEthIfAboveThreshold(): Promise<TransactionResponse | null> {
wrapEthIfAboveThreshold(): Promise<TransactionResponse | null> {
throw new Error("Unnecessary to wrap ETH on Arbitrum");
}

Expand Down
2 changes: 1 addition & 1 deletion src/clients/bridges/PolygonAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ export class PolygonAdapter extends BaseAdapter {
);
}

async wrapEthIfAboveThreshold(): Promise<TransactionResponse | null> {
wrapEthIfAboveThreshold(): Promise<TransactionResponse | null> {
throw new Error("Unneccessary to wrap ETH on Polygon");
}
}
2 changes: 1 addition & 1 deletion src/dataworker/Dataworker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1873,7 +1873,7 @@ export class Dataworker {
});
}

async _updateExchangeRates(l1Tokens: string[], submitExecution: boolean): Promise<void> {
_updateExchangeRates(l1Tokens: string[], submitExecution: boolean): void {
const syncedL1Tokens: string[] = [];
l1Tokens.forEach((l1Token) => {
// Exit early if we already synced this l1 token on this loop
Expand Down
2 changes: 1 addition & 1 deletion src/finalizer/utils/zkSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ async function prepareFinalizations(
const l1ERC20Bridge = getL1ERC20Bridge(l1ChainId);
const ethAddr = getEthAddressForChain(l2ChainId);

return await sdkUtils.mapAsync(withdrawalParams, async (withdrawal) =>
return await sdkUtils.mapAsync(withdrawalParams, (withdrawal) =>
prepareFinalization(withdrawal, ethAddr, l1Mailbox, l1ERC20Bridge)
);
}
Expand Down
6 changes: 3 additions & 3 deletions src/monitor/Monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export class Monitor {
}
}

async checkUnknownRootBundleCallers(): Promise<void> {
checkUnknownRootBundleCallers(): void {
this.logger.debug({ at: "Monitor#RootBundleCallers", message: "Checking for unknown root bundle callers" });

const proposedBundles = this.clients.hubPoolClient.getProposedRootBundlesInBlockRange(
Expand All @@ -169,7 +169,7 @@ export class Monitor {
}
}

async checkUnknownRelayers(): Promise<void> {
checkUnknownRelayers(): void {
const chainIds = this.monitorChains;
this.logger.debug({ at: "Monitor#checkUnknownRelayers", message: "Checking for unknown relayers", chainIds });
for (const chainId of chainIds) {
Expand Down Expand Up @@ -509,7 +509,7 @@ export class Monitor {
// transfers stuck for longer than 1 bundle and the current time is within the last bundle execution + grace period.
// But this should be okay as we should address any stuck transactions immediately so realistically no transfers
// should stay unstuck for longer than one bundle.
async checkStuckRebalances(): Promise<void> {
checkStuckRebalances(): void {
const hubPoolClient = this.clients.hubPoolClient;
const lastFullyExecutedBundle = hubPoolClient.getLatestFullyExecutedRootBundle(hubPoolClient.latestBlockNumber);
// This case shouldn't happen outside of tests as Across V2 has already launched.
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/testUBAClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,4 @@ export async function run(_logger: winston.Logger): Promise<void> {
}

// eslint-disable-next-line no-process-exit
void run(Logger).then(async () => process.exit(0));
void run(Logger).then(() => process.exit(0));
2 changes: 1 addition & 1 deletion src/scripts/validateRootBundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,4 +207,4 @@ export async function run(_logger: winston.Logger): Promise<void> {
}

// eslint-disable-next-line no-process-exit
void run(Logger).then(async () => process.exit(0));
void run(Logger).then(() => process.exit(0));
2 changes: 1 addition & 1 deletion src/scripts/validateRunningBalances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ export async function runScript(_logger: winston.Logger, baseSigner: Wallet): Pr
* @dev Clients are only created for chains not on disabled chain list.
* @returns A dictionary of chain ID to SpokePoolClient.
*/
async function _createSpokePoolClients(fromBlocks: { [chainId: number]: number }) {
function _createSpokePoolClients(fromBlocks: { [chainId: number]: number }) {
return constructSpokePoolClientsWithStartBlocks(logger, clients.hubPoolClient, config, baseSigner, fromBlocks, {});
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/utils/ProviderUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class RateLimitedProvider extends ethers.providers.StaticJsonRpcProvider {
}, maxConcurrency);
}

override async send(method: string, params: Array<any>): Promise<any> {
override send(method: string, params: Array<any>): Promise<any> {
// This simply creates a promise and adds the arguments and resolve and reject handlers to the task.
return new Promise<any>((resolve, reject) => {
const task: RateLimitTask = {
Expand Down Expand Up @@ -200,7 +200,7 @@ class CacheProvider extends RateLimitedProvider {
throw new Error("CacheProvider::shouldCache toBlock cannot be smaller than fromBlock.");
}

return this.canCacheInformationFromBlock(toBlock);
return await this.canCacheInformationFromBlock(toBlock);
} else if ("eth_call" === method || "eth_getBlockByNumber" === method) {
// Pull out the block tag from params. Its position in params is dependent on the method.
// We are only interested in numeric block tags, which would be hex-encoded strings.
Expand All @@ -213,7 +213,7 @@ class CacheProvider extends RateLimitedProvider {
}

// If the block is old enough to cache, cache the call.
return this.canCacheInformationFromBlock(blockNumber);
return await this.canCacheInformationFromBlock(blockNumber);
} else {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion test/AdapterManager.SendTokensCrossChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const addAttrib = (obj: unknown) =>
transactionSubmissionData: number;
};

describe("AdapterManager: Send tokens cross-chain", async function () {
describe("AdapterManager: Send tokens cross-chain", function () {
beforeEach(async function () {
[relayer, owner] = await ethers.getSigners();
({ spyLogger } = createSpyLogger());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class TestAdapter extends BaseAdapter {
}

let adapter: TestAdapter;
describe("AdapterManager: Get outstanding cross chain token transfer amounts", async function () {
beforeEach(async function () {
describe("AdapterManager: Get outstanding cross chain token transfer amounts", function () {
beforeEach(function () {
adapter = new TestAdapter();
});

Expand Down
6 changes: 3 additions & 3 deletions test/BalanceAllocator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ class TestBalanceAllocator extends BalanceAllocator {
}
}

describe("BalanceAllocator", async function () {
describe("BalanceAllocator", function () {
let balanceAllocator: TestBalanceAllocator;
const testToken1 = randomAddress();
const testToken2 = randomAddress();

const testAccount1 = randomAddress();

beforeEach(async function () {
beforeEach(function () {
balanceAllocator = new TestBalanceAllocator();
});

Expand All @@ -49,7 +49,7 @@ describe("BalanceAllocator", async function () {
expect(balanceAllocator.getUsed(1, testToken1, testAccount1)).to.equal(BigNumber.from(0));
});

it("Add used", async function () {
it("Add used", function () {
balanceAllocator.addUsed(1, testToken1, testAccount1, BigNumber.from(100));
expect(balanceAllocator.getUsed(1, testToken1, testAccount1)).to.equal(BigNumber.from(100));
});
Expand Down
2 changes: 1 addition & 1 deletion test/BaseClass.isUpdated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe("BaseAbstractClient.isUpdated", () => {
await ubaClient.update();
expect(ubaClient.isUpdated).to.be.true;
});
it("should return false if the client is not updated", async () => {
it("should return false if the client is not updated", () => {
expect(ubaClient.isUpdated).to.be.false;
});
});
Expand Down

0 comments on commit b597ae2

Please sign in to comment.