From fd1f3b055ab6722f2ce6ef4ef9bbf58c53bf065f Mon Sep 17 00:00:00 2001 From: Nikita Zasimuk Date: Thu, 31 Aug 2023 16:11:32 +0300 Subject: [PATCH] wip: fix rebasing conflicts --- src/tasks/local_verify.ts | 4 ++-- src/tasks/zk.ts | 1 - src/utils/proxies.ts | 12 ++++++------ test/utils/setup.ts | 2 +- yarn.lock | 0 5 files changed, 9 insertions(+), 10 deletions(-) delete mode 100644 yarn.lock diff --git a/src/tasks/local_verify.ts b/src/tasks/local_verify.ts index 50ecc7606..f525642ab 100644 --- a/src/tasks/local_verify.ts +++ b/src/tasks/local_verify.ts @@ -41,9 +41,9 @@ task("local-verify", "Verifies that the local deployment files correspond to the for (const contract of Object.keys(deployedContracts)) { const deployment = await hre.deployments.get(contract); const onChainCode = await hre.ethers.provider.getCode(deployment.address); - const onchainBytecodeHash = hre.ethers.utils.keccak256(onChainCode); + const onchainBytecodeHash = hre.ethers.keccak256(onChainCode); // TODO: compile contract in realtime and compare the compiled bytecode with onchain bytecode - const localBytecodeHash = hre.ethers.utils.keccak256(deployment.deployedBytecode!); + const localBytecodeHash = hre.ethers.keccak256(deployment.deployedBytecode!); const verifySuccess = onchainBytecodeHash === localBytecodeHash ? "\x1b[32mSUCCESS\x1b[0m" : "\x1b[31mFAILURE\x1b[0m"; console.log(`Verification status for ${contract}: ${verifySuccess}`); } diff --git a/src/tasks/zk.ts b/src/tasks/zk.ts index baaf643cc..92dc9f8cf 100644 --- a/src/tasks/zk.ts +++ b/src/tasks/zk.ts @@ -1,7 +1,6 @@ import "hardhat-deploy"; import { TASK_DEPLOY } from "hardhat-deploy"; import { TASK_VERIFY_VERIFY } from "@matterlabs/hardhat-zksync-verify/dist/src/constants"; -import "@nomiclabs/hardhat-ethers"; import { TASK_TEST_SETUP_TEST_ENVIRONMENT } from "hardhat/builtin-tasks/task-names"; import { subtask } from "hardhat/config"; diff --git a/src/utils/proxies.ts b/src/utils/proxies.ts index c0c53c86f..ec7758441 100644 --- a/src/utils/proxies.ts +++ b/src/utils/proxies.ts @@ -5,15 +5,15 @@ import { SafeProxyFactory } from "../../typechain-types"; export const calculateProxyAddress = async (factory: SafeProxyFactory, singleton: string, inititalizer: string, nonce: number | string) => { const salt = ethers.solidityPackedKeccak256(["bytes32", "uint256"], [ethers.solidityPackedKeccak256(["bytes"], [inititalizer]), nonce]); + const factoryAddress = await factory.getAddress(); if (hre.network.zksync) { const proxyCreationCode = (await hre.artifacts.readArtifact("SafeProxy")).deployedBytecode; const bytecodehash = zk.utils.hashBytecode(proxyCreationCode); - const input = new ethers.utils.AbiCoder().encode(["address"], [singleton]); - return zk.utils.create2Address(factory.address, bytecodehash, salt, input); + const input = new ethers.AbiCoder().encode(["address"], [singleton]); + return zk.utils.create2Address(factoryAddress, bytecodehash, salt, input); } - const factoryAddress = await factory.getAddress(); const deploymentCode = ethers.solidityPacked(["bytes", "uint256"], [await factory.proxyCreationCode(), singleton]); return ethers.getCreate2Address(factoryAddress, salt, ethers.keccak256(deploymentCode)); }; @@ -40,15 +40,15 @@ export const calculateChainSpecificProxyAddress = async ( ["bytes32", "uint256", "uint256"], [ethers.solidityPackedKeccak256(["bytes"], [inititalizer]), nonce, chainId], ); + const factoryAddress = await factory.getAddress(); if (hre.network.zksync) { const proxyCreationCode = (await hre.artifacts.readArtifact("SafeProxy")).deployedBytecode; const bytecodehash = zk.utils.hashBytecode(proxyCreationCode); - const input = new ethers.utils.AbiCoder().encode(["address"], [singleton]); - return zk.utils.create2Address(factory.address, bytecodehash, salt, input); + const input = new ethers.AbiCoder().encode(["address"], [singleton]); + return zk.utils.create2Address(factoryAddress, bytecodehash, salt, input); } - const factoryAddress = await factory.getAddress(); const deploymentCode = ethers.solidityPacked(["bytes", "uint256"], [await factory.proxyCreationCode(), singleton]); return ethers.getCreate2Address(factoryAddress, salt, ethers.keccak256(deploymentCode)); }; diff --git a/test/utils/setup.ts b/test/utils/setup.ts index dccdb6140..250929b5e 100644 --- a/test/utils/setup.ts +++ b/test/utils/setup.ts @@ -1,4 +1,4 @@ -import hre, { deployments, waffle } from "hardhat"; +import hre, { deployments } from "hardhat"; import { Contract, Signer, ethers } from "ethers"; import { AddressZero } from "@ethersproject/constants"; import solc from "solc"; diff --git a/yarn.lock b/yarn.lock deleted file mode 100644 index e69de29bb..000000000