Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VEN-2744]: IL configurations on Zksync #377

Merged
merged 11 commits into from
Sep 16, 2024
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
DEPLOYER_PRIVATE_KEY=""

ZKSYNC_ERA_LOCAL_TEST_NODE=http://localhost:8011

## Archive nodes
ARCHIVE_NODE_bsctestnet=https://bsc-testnet.nodereal.io/v1/<YOUR_KEY_HERE>
ARCHIVE_NODE_bscmainnet=https://bsc-mainnet.nodereal.io/v1/<YOUR_KEY_HERE>
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ gnosisTXBuilder.json

.DS_Store
**/.DS_Store

.cache
40 changes: 36 additions & 4 deletions hardhat.config.zksync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,37 @@ task("test", "Update fork config")
.addOptionalParam("fork", "Network to fork")
.setAction(async function (taskArguments, hre, runSuper) {
const { fork } = taskArguments;

if (hre.network.name === "zkSyncTestNode") {
if (!process.env["ZKSYNC_ERA_LOCAL_TEST_NODE"]) {
throw new Error("ZKSYNC_ERA_LOCAL_TEST_NODE env variable is not set");
}

try {
const provider = new hre.ethers.providers.JsonRpcProvider(process.env["ZKSYNC_ERA_LOCAL_TEST_NODE"]);
await provider.send("eth_chainId", []);
console.log("Local zksync era test node is running");
} catch (e) {
throw new Error(
`Local zksync era test node is not running. Please run it with "yarn run local-test-node:${fork} --fork-block-number \`<fork block number of the vip>\`"`,
);
}
}

const hardhatConfig = fork
? {
allowUnlimitedContractSize: false,
loggingEnabled: false,
forking: {
enabled: true,
url: process.env[`ARCHIVE_NODE_${fork}`] as string,
},
forking:
hre.network.name === "zkSyncTestNode"
? {
enabled: false,
url: process.env["ZKSYNC_ERA_LOCAL_TEST_NODE"] as string,
}
: {
enabled: true,
url: process.env[`ARCHIVE_NODE_${fork}`] as string,
},
gas: "auto" as const,
blockGasLimit: BLOCK_GAS_LIMIT_PER_NETWORK[fork as keyof typeof BLOCK_GAS_LIMIT_PER_NETWORK],
}
Expand All @@ -55,6 +78,7 @@ task("test", "Update fork config")
loggingEnabled: false,
};
hre.config.networks.hardhat = { ...hre.config.networks.hardhat, ...hardhatConfig };

hre.FORKED_NETWORK = fork;

await runSuper(taskArguments);
Expand Down Expand Up @@ -113,6 +137,14 @@ const config: HardhatUserConfig = {
blockGasLimit: BLOCK_GAS_LIMIT_PER_NETWORK.zksyncmainnet,
zksync: true,
},
zkSyncTestNode: {
url: process.env.ZKSYNC_ERA_LOCAL_TEST_NODE || "http://localhost:8011",
chainId: 260,
accounts: DEPLOYER_PRIVATE_KEY ? [`0x${DEPLOYER_PRIVATE_KEY}`] : [],
blockGasLimit: BLOCK_GAS_LIMIT_PER_NETWORK.zksyncsepolia,
timeout: 2000000000,
zksync: true,
},
},
paths: {
tests: "./tests",
Expand Down
Loading
Loading