Skip to content

Commit

Permalink
remove unnecessary zk utils file
Browse files Browse the repository at this point in the history
  • Loading branch information
mmv08 committed Aug 23, 2024
1 parent 2215356 commit 84b9af3
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 81 deletions.
4 changes: 2 additions & 2 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ SAFE_CONTRACT_UNDER_TEST="Safe"
SOLIDITY_VERSION= # Example: '0.8.19'
# For running coverage tests, `details` section of solidity settings are required, else could be removed.
SOLIDITY_SETTINGS= # Example: '{"viaIR":true,"optimizer":{"enabled":true, "details": {"yul": true, "yulDetails": { "optimizerSteps": ""}}}}'
# Set to 1 to run local zksync node as a hardhat network. Used in tests.
HARDHAT_RUN_ZKSYNC_NODE=
# Set to 1 to run hardhat in zksync mode. This will enable the ZK compiler and run the hardhat node in zksync mode.
HARDHAT_ENABLE_ZKSYNC=0
# Sets hardhat chain id. In general, you don't need this, it's only used for testing the SafeToL2Setup contract.
HARDHAT_CHAIN_ID=31337
# (Optional) Hardhat-deploy only supports zksync deployment if the private key for the account is provided. Specify the private key here.
Expand Down
13 changes: 2 additions & 11 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import "hardhat-deploy";
import dotenv from "dotenv";
import yargs from "yargs";
import { getSingletonFactoryInfo } from "@safe-global/safe-singleton-factory";
import { LOCAL_NODE_RICH_WALLETS } from "./src/zk-utils/constants";

const argv = yargs
.option("network", {
Expand All @@ -30,7 +29,7 @@ const {
PK,
SOLIDITY_VERSION,
SOLIDITY_SETTINGS,
HARDHAT_RUN_ZKSYNC_NODE = "",
HARDHAT_ENABLE_ZKSYNC = "0",
HARDHAT_CHAIN_ID = 31337,
} = process.env;

Expand Down Expand Up @@ -99,7 +98,7 @@ const userConfig: HardhatUserConfig = {
allowUnlimitedContractSize: true,
blockGasLimit: 100000000,
gas: 100000000,
zksync: Boolean(HARDHAT_RUN_ZKSYNC_NODE),
zksync: HARDHAT_ENABLE_ZKSYNC === "1",
chainId: typeof HARDHAT_CHAIN_ID === "string" && !Number.isNaN(parseInt(HARDHAT_CHAIN_ID)) ? parseInt(HARDHAT_CHAIN_ID) : 31337,
},
mainnet: {
Expand Down Expand Up @@ -152,14 +151,6 @@ const userConfig: HardhatUserConfig = {
zksync: true,
verifyURL: "https://zksync2-testnet-explorer.zksync.dev/contract_verification",
},
zkSyncLocal: {
chainId: 270,
url: "http://localhost:3050",
ethNetwork: "http://localhost:8545",
accounts: LOCAL_NODE_RICH_WALLETS.map((w) => w.privateKey),
zksync: true,
saveDeployments: false,
},
},
deterministicDeployment,
namedAccounts: {
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
],
"scripts": {
"build": "hardhat compile",
"build:zk": "hardhat compile --network zkSyncLocal",
"build:zk": "HARDHAT_ENABLE_ZKSYNC=1 hardhat compile",
"build:ts": "rimraf dist && tsc -p tsconfig.prod.json",
"build:ts:dev": "rimraf dist && tsc -p tsconfig.json",
"test:zk": "HARDHAT_RUN_ZKSYNC_NODE=1 hardhat test",
"test": "hardhat test --network hardhat && npm run test:L1 && npm run test:L2",
"test:zk": "HARDHAT_ENABLE_ZKSYNC=1 hardhat test",
"test": "hardhat test --network hardhat && npm run test:L1 && npm run test:L2 && npm run test:zk",
"test:parallel": "hardhat test --parallel",
"test:L1": "HARDHAT_CHAIN_ID=1 hardhat test --grep '@L1'",
"test:L2": "SAFE_CONTRACT_UNDER_TEST=SafeL2 hardhat test --network hardhat",
Expand Down
6 changes: 4 additions & 2 deletions src/utils/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import assert from "assert";
import { HardhatRuntimeEnvironment } from "hardhat/types";

export const getDeployerAccount = async (hre: HardhatRuntimeEnvironment) => {
const { deployer } = await hre.getNamedAccounts();

let deployerAccount = deployer;
if (hre.network.zksync) {
assert(process.env.ZKSYNC_DEPLOYER_PK, "ZKSYNC_DEPLOYER_PK is not set");
if (!process.env.ZKSYNC_DEPLOYER_PK) {
console.warn("Using default ZkSync deployer private key");
process.env.ZKSYNC_DEPLOYER_PK = "0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110";
}
deployerAccount = process.env.ZKSYNC_DEPLOYER_PK;
}
return deployerAccount;
Expand Down
62 changes: 0 additions & 62 deletions src/zk-utils/constants.ts

This file was deleted.

2 changes: 1 addition & 1 deletion test/libraries/SignMessageLib.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describe("SignMessageLib", () => {
expect(await safe.signedMessages(safeInternalMsgHash)).to.be.eq(0);
expect(msgStorageSlotBeforeSigning).to.be.eq(`0x${"0".padStart(64, "0")}`);

await (await executeContractCallWithSigners(safe, lib, "signMessage", [eip191MessageHash], [user1, user2], true)).wait();
await executeContractCallWithSigners(safe, lib, "signMessage", [eip191MessageHash], [user1, user2], true);

const masterCopyAddressAfterSigning = await hre.ethers.provider.getStorage(await safe.getAddress(), 0);
const ownerCountAfterSigning = await hre.ethers.provider.getStorage(await safe.getAddress(), 3);
Expand Down

0 comments on commit 84b9af3

Please sign in to comment.