Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
lint: lint:fix with new rules
Browse files Browse the repository at this point in the history
  • Loading branch information
benceharomi committed Oct 30, 2023
1 parent ceb8a44 commit d37e1a5
Show file tree
Hide file tree
Showing 18 changed files with 52 additions and 60 deletions.
11 changes: 6 additions & 5 deletions scripts/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { BigNumberish, BytesLike, constants, ethers } from "ethers";
import type { BigNumberish, BytesLike } from "ethers";
import { constants, ethers } from "ethers";

export const BOOTLOADER_FORMAL_ADDRESS = "0x0000000000000000000000000000000000008001";
export const ETH_ADDRESS = constants.AddressZero;
Expand Down Expand Up @@ -281,9 +282,9 @@ function getBytesLengthGetterName(fieldName: string): string {
function getBytesLengthGetter(fieldName: string, type: DynamicType) {
let lengthToBytes: string;
if (type == "bytes") {
lengthToBytes = `lengthToWords(mload(ptr))`;
lengthToBytes = "lengthToWords(mload(ptr))";
} else if (type == "bytes32[]") {
lengthToBytes = `mul(mload(ptr),32)`;
lengthToBytes = "mul(mload(ptr),32)";
} else {
throw new Error(`Type ${type} is not supported`);
}
Expand Down Expand Up @@ -320,7 +321,7 @@ function getDataLength(baseLength: number, dynamicFields: [string, DynamicType][
function validateFixedSizeField(fieldName: string, type: FixedType): string {
if (type == "uint256") {
// There is no validation for uint256
return ``;
return "";
}
const assertionErrorStr = getEncodingError(fieldName);
const fieldValue = `${fieldName}Value`;
Expand Down Expand Up @@ -382,7 +383,7 @@ export function getTransactionUtils(): string {
///\n`;

let innerOffsetBytes = 0;
let checksStr = ``;
let checksStr = "";

const dynamicFields: [string, DynamicType][] = [];
for (const [key, value] of Object.entries(TransactionFields)) {
Expand Down
16 changes: 6 additions & 10 deletions scripts/deploy-preimages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,18 @@ import * as hre from "hardhat";

import { Deployer } from "@matterlabs/hardhat-zksync-deploy";
import { Command } from "commander";
import { BigNumber, ethers } from "ethers";
import type { BigNumber } from "ethers";
import { ethers } from "ethers";
import { formatUnits, parseUnits } from "ethers/lib/utils";
import * as fs from "fs";
import * as path from "path";
import { Provider, Wallet } from "zksync-web3";
import { hashBytecode } from "zksync-web3/build/src/utils";
import { Language, SYSTEM_CONTRACTS } from "./constants";
import {
Dependency,
DeployedDependency,
filterPublishedFactoryDeps,
publishFactoryDeps,
readYulBytecode,
} from "./utils";

const testConfigPath = path.join(process.env.ZKSYNC_HOME as string, `etc/test_config/constant`);
import type { Dependency, DeployedDependency } from "./utils";
import { filterPublishedFactoryDeps, publishFactoryDeps, readYulBytecode } from "./utils";

const testConfigPath = path.join(process.env.ZKSYNC_HOME as string, "etc/test_config/constant");
const ethTestConfig = JSON.parse(fs.readFileSync(`${testConfigPath}/eth.json`, { encoding: "utf-8" }));

// Maximum length of the combined length of dependencies
Expand Down
2 changes: 1 addition & 1 deletion scripts/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { existsSync, mkdirSync, writeFileSync } from "fs";
import { renderFile } from "template-file";
import { utils } from "zksync-web3";
import { SYSTEM_CONTRACTS, getRevertSelector, getTransactionUtils } from "./constants";
import { ForceDeployment } from "./utils";
import type { ForceDeployment } from "./utils";

/* eslint-disable @typescript-eslint/no-var-requires */
const preprocess = require("preprocess");
Expand Down
8 changes: 5 additions & 3 deletions scripts/utils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import * as hre from "hardhat";

import { Deployer } from "@matterlabs/hardhat-zksync-deploy";
import { BigNumber, BigNumberish, BytesLike, ethers } from "ethers";
import type { Deployer } from "@matterlabs/hardhat-zksync-deploy";
import type { BigNumberish, BytesLike } from "ethers";
import { BigNumber, ethers } from "ethers";
import * as fs from "fs";
import { hashBytecode } from "zksync-web3/build/src/utils";
import { Language, SYSTEM_CONTRACTS, YulContractDescrption } from "./constants";
import type { YulContractDescrption } from "./constants";
import { Language, SYSTEM_CONTRACTS } from "./constants";

export interface Dependency {
name: string;
Expand Down
4 changes: 2 additions & 2 deletions test/AccountCodeStorage.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from "chai";
import { ethers, network } from "hardhat";
import { Wallet } from "zksync-web3";
import { AccountCodeStorage } from "../typechain-types";
import type { Wallet } from "zksync-web3";
import type { AccountCodeStorage } from "../typechain-types";
import { DEPLOYER_SYSTEM_CONTRACT_ADDRESS, EMPTY_STRING_KECCAK } from "./shared/constants";
import { deployContract, getWallets } from "./shared/utils";

Expand Down
4 changes: 2 additions & 2 deletions test/BootloaderUtilities.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { expect } from "chai";
import { ethers } from "hardhat";
import * as zksync from "zksync-web3";
import { Wallet } from "zksync-web3";
import type { Wallet } from "zksync-web3";
import { serialize } from "zksync-web3/build/src/utils";
import { BootloaderUtilities } from "../typechain-types";
import type { BootloaderUtilities } from "../typechain-types";
import { signedTxToTransactionData } from "./shared/transactions";
import { deployContract, getWallets } from "./shared/utils";

Expand Down
2 changes: 1 addition & 1 deletion test/ComplexUpgrader.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from "chai";
import { ethers, network } from "hardhat";
import { ComplexUpgrader, DummyUpgrade } from "../typechain-types";
import type { ComplexUpgrader, DummyUpgrade } from "../typechain-types";
import { FORCE_DEPLOYER_ADDRESS } from "./shared/constants";
import { deployContract } from "./shared/utils";

Expand Down
8 changes: 5 additions & 3 deletions test/Compressor.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { expect } from "chai";
import { BigNumber, BytesLike } from "ethers";
import type { BytesLike } from "ethers";
import { BigNumber } from "ethers";
import { ethers, network } from "hardhat";
import * as zksync from "zksync-web3";
import { Wallet } from "zksync-web3";
import { Compressor, MockKnownCodesStorage__factory } from "../typechain-types";
import type { Wallet } from "zksync-web3";
import type { Compressor } from "../typechain-types";
import { MockKnownCodesStorage__factory } from "../typechain-types";
import {
BOOTLOADER_FORMAL_ADDRESS,
KNOWN_CODE_STORAGE_CONTRACT_ADDRESS,
Expand Down
14 changes: 5 additions & 9 deletions test/ContractDeployer.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import { ZkSyncArtifact } from "@matterlabs/hardhat-zksync-deploy/dist/types";
import type { ZkSyncArtifact } from "@matterlabs/hardhat-zksync-deploy/dist/types";
import { expect } from "chai";
import { ethers, network } from "hardhat";
import { Contract, Wallet, utils } from "zksync-web3";
import {
ContractDeployer,
ContractDeployer__factory,
Deployable__factory,
NonceHolder,
NonceHolder__factory,
} from "../typechain-types";
import type { Wallet } from "zksync-web3";
import { Contract, utils } from "zksync-web3";
import type { ContractDeployer, NonceHolder } from "../typechain-types";
import { ContractDeployer__factory, Deployable__factory, NonceHolder__factory } from "../typechain-types";
import {
DEPLOYER_SYSTEM_CONTRACT_ADDRESS,
FORCE_DEPLOYER_ADDRESS,
Expand Down
14 changes: 3 additions & 11 deletions test/DefaultAccount.spec.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
import { expect } from "chai";
import { ethers, network } from "hardhat";
import * as zksync from "zksync-web3";
import { Wallet } from "zksync-web3";
import type { Wallet } from "zksync-web3";
import { serialize } from "zksync-web3/build/src/utils";
import {
Callable,
DefaultAccount,
DefaultAccount__factory,
L2EthToken,
L2EthToken__factory,
MockERC20Approve,
NonceHolder,
NonceHolder__factory,
} from "../typechain-types";
import type { Callable, DefaultAccount, L2EthToken, MockERC20Approve, NonceHolder } from "../typechain-types";
import { DefaultAccount__factory, L2EthToken__factory, NonceHolder__factory } from "../typechain-types";
import {
BOOTLOADER_FORMAL_ADDRESS,
ETH_TOKEN_SYSTEM_CONTRACT_ADDRESS,
Expand Down
2 changes: 1 addition & 1 deletion test/EcAdd.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from "chai";
import { Contract } from "zksync-web3";
import type { Contract } from "zksync-web3";
import { callFallback, deployContractYul } from "./shared/utils";

describe("EcAdd tests", function () {
Expand Down
2 changes: 1 addition & 1 deletion test/EcMul.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from "chai";
import { Contract } from "zksync-web3";
import type { Contract } from "zksync-web3";
import { callFallback, deployContractYul } from "./shared/utils";

describe("EcMul tests", function () {
Expand Down
4 changes: 2 additions & 2 deletions test/EmptyContract.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from "chai";
import { ethers } from "hardhat";
import { Wallet } from "zksync-web3";
import { EmptyContract } from "../typechain-types";
import type { Wallet } from "zksync-web3";
import type { EmptyContract } from "../typechain-types";
import { deployContract, getWallets, provider } from "./shared/utils";

describe("EmptyContract tests", function () {
Expand Down
5 changes: 3 additions & 2 deletions test/EventWriter.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { expect } from "chai";
import { Contract, Wallet } from "zksync-web3";
import type { Wallet } from "zksync-web3";
import { Contract } from "zksync-web3";
import { Language } from "../scripts/constants";
import { readYulBytecode } from "../scripts/utils";
import { EventWriterTest } from "../typechain-types";
import type { EventWriterTest } from "../typechain-types";
import { EVENT_WRITER_CONTRACT_ADDRESS } from "./shared/constants";
import { deployContract, getCode, getWallets, setCode } from "./shared/utils";

Expand Down
2 changes: 1 addition & 1 deletion test/ImmutableSimulator.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from "chai";
import { ethers, network } from "hardhat";
import { ImmutableSimulator } from "../typechain-types";
import type { ImmutableSimulator } from "../typechain-types";
import { DEPLOYER_SYSTEM_CONTRACT_ADDRESS } from "./shared/constants";
import { deployContract } from "./shared/utils";

Expand Down
5 changes: 3 additions & 2 deletions test/KnownCodesStorage.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { expect } from "chai";
import { ethers, network } from "hardhat";
import { Wallet } from "zksync-web3";
import { KnownCodesStorage, MockL1Messenger, MockL1Messenger__factory } from "../typechain-types";
import type { Wallet } from "zksync-web3";
import type { KnownCodesStorage, MockL1Messenger } from "../typechain-types";
import { MockL1Messenger__factory } from "../typechain-types";
import {
BOOTLOADER_FORMAL_ADDRESS,
COMPRESSOR_CONTRACT_ADDRESS,
Expand Down
2 changes: 1 addition & 1 deletion test/shared/transactions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BigNumberish, BytesLike, Transaction } from "ethers";
import type { BigNumberish, BytesLike, Transaction } from "ethers";
import * as zksync from "zksync-web3";

// Interface encoding the transaction struct used for AA protocol
Expand Down
7 changes: 4 additions & 3 deletions test/shared/utils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Deployer } from "@matterlabs/hardhat-zksync-deploy";
import { ZkSyncArtifact } from "@matterlabs/hardhat-zksync-deploy/dist/types";
import { BytesLike } from "ethers";
import type { ZkSyncArtifact } from "@matterlabs/hardhat-zksync-deploy/dist/types";
import type { BytesLike } from "ethers";
import * as hre from "hardhat";
import { ethers, network } from "hardhat";
import * as zksync from "zksync-web3";
import { Contract, Provider, Wallet } from "zksync-web3";
import type { Contract } from "zksync-web3";
import { Provider, Wallet } from "zksync-web3";
import { Language } from "../../scripts/constants";
import { readYulBytecode } from "../../scripts/utils";
import { ContractDeployer__factory } from "../../typechain-types";
Expand Down

0 comments on commit d37e1a5

Please sign in to comment.