From b1d8300019915c86788b112d1abdf6baf39595dd Mon Sep 17 00:00:00 2001 From: PacificYield <173040337+PacificYield@users.noreply.github.com> Date: Fri, 6 Dec 2024 10:48:11 +0100 Subject: [PATCH] chore: updates lint errors --- tasks/mint.ts | 4 +++- test/coprocessorUtils.ts | 6 +++--- test/fhevmjsMocked.ts | 12 +++--------- test/gatewayDecrypt/testAsyncDecrypt.ts | 4 ++-- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/tasks/mint.ts b/tasks/mint.ts index 8bf16f2..41eafac 100644 --- a/tasks/mint.ts +++ b/tasks/mint.ts @@ -1,6 +1,8 @@ import { task } from "hardhat/config"; import type { TaskArguments } from "hardhat/types"; +import { MyConfidentialERC20 } from "../types"; + task("task:deployConfidentialERC20").setAction(async function (taskArguments: TaskArguments, { ethers }) { const signers = await ethers.getSigners(); const erc20Factory = await ethers.getContractFactory("MyConfidentialERC20"); @@ -17,7 +19,7 @@ task("task:mint") const signers = await ethers.getSigners(); - const erc20 = (await ethers.getContractAt("MyConfidentialERC20", ERC20.address)) as any; + const erc20 = (await ethers.getContractAt("MyConfidentialERC20", ERC20.address)) as MyConfidentialERC20; await erc20.connect(signers[0]).mint(+taskArguments.mint); diff --git a/test/coprocessorUtils.ts b/test/coprocessorUtils.ts index 6ae58b7..05a5d97 100644 --- a/test/coprocessorUtils.ts +++ b/test/coprocessorUtils.ts @@ -16,7 +16,7 @@ let counterRand = 0; //const db = new Database('./sql.db'); // on-disk db for debugging const db = new Database(":memory:"); -export function insertSQL(handle: string, clearText: BigInt, replace: boolean = false) { +export function insertSQL(handle: string, clearText: bigint, replace: boolean = false) { if (replace) { // this is useful if using snapshots while sampling different random numbers on each revert db.run("INSERT OR REPLACE INTO ciphertexts (handle, clearText) VALUES (?, ?)", [handle, clearText.toString()]); @@ -27,7 +27,7 @@ export function insertSQL(handle: string, clearText: BigInt, replace: boolean = // Decrypt any handle, bypassing ACL // WARNING : only for testing or internal use -export const getClearText = async (handle: BigInt): Promise => { +export const getClearText = async (handle: bigint): Promise => { const handleStr = "0x" + handle.toString(16).padStart(64, "0"); return new Promise((resolve, reject) => { @@ -102,7 +102,7 @@ function getRandomBigInt(numBits: number): bigint { return randomBigInt; } -function bitwiseNotUintBits(value: BigInt, numBits: number) { +function bitwiseNotUintBits(value: bigint, numBits: number) { if (typeof value !== "bigint") { throw new TypeError("The input value must be a BigInt."); } diff --git a/test/fhevmjsMocked.ts b/test/fhevmjsMocked.ts index e7be4e9..5c3f014 100644 --- a/test/fhevmjsMocked.ts +++ b/test/fhevmjsMocked.ts @@ -1,8 +1,7 @@ import { toBigIntBE, toBufferBE } from "bigint-buffer"; import crypto from "crypto"; -import dotenv from "dotenv"; import { Wallet, ethers } from "ethers"; -import * as fs from "fs"; +import hre from "hardhat"; import { Keccak } from "sha3"; import { isAddress } from "web3-validator"; @@ -16,10 +15,6 @@ import { import { insertSQL } from "./coprocessorUtils"; import { awaitCoprocessor, getClearText } from "./coprocessorUtils"; -const hre = require("hardhat"); - -const aclAdd = ACL_ADDRESS; - enum Types { ebool = 0, euint4, @@ -362,7 +357,7 @@ function uint8ArrayToHexString(uint8Array: Uint8Array) { } function numberToHex(num: number) { - let hex = num.toString(16); + const hex = num.toString(16); return hex.length % 2 ? "0" + hex : hex; } @@ -401,10 +396,9 @@ async function computeInputSignatureCopro( userAddress: string, contractAddress: string, ): Promise { - let signature: string; const privKeySigner = PRIVATE_KEY_COPROCESSOR_ACCOUNT; const coprocSigner = new Wallet(privKeySigner).connect(ethers.provider); - signature = await coprocSign(hash, handlesList, userAddress, contractAddress, coprocSigner); + const signature = await coprocSign(hash, handlesList, userAddress, contractAddress, coprocSigner); return signature; } diff --git a/test/gatewayDecrypt/testAsyncDecrypt.ts b/test/gatewayDecrypt/testAsyncDecrypt.ts index 894e36d..2bed66b 100644 --- a/test/gatewayDecrypt/testAsyncDecrypt.ts +++ b/test/gatewayDecrypt/testAsyncDecrypt.ts @@ -143,7 +143,7 @@ describe("TestAsyncDecrypt", function () { const tx2 = await this.contract.connect(this.signers.carol).requestMixed(5, 15); await tx2.wait(); await awaitAllDecryptionResults(); - let yB = await this.contract.yBool(); + const yB = await this.contract.yBool(); expect(yB).to.equal(true); let y = await this.contract.yUint4(); expect(y).to.equal(4); @@ -151,7 +151,7 @@ describe("TestAsyncDecrypt", function () { expect(y).to.equal(42); y = await this.contract.yUint16(); expect(y).to.equal(16); - let yAdd = await this.contract.yAddress(); + const yAdd = await this.contract.yAddress(); expect(yAdd).to.equal("0x8ba1f109551bD432803012645Ac136ddd64DBA72"); y = await this.contract.yUint32(); expect(y).to.equal(52); // 5+15+32