-
Notifications
You must be signed in to change notification settings - Fork 953
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
Feature: add zksync support to v1.5.0 #742
Conversation
@mmv08 sorry, for delay 😞 |
e9e3213
to
cca1b20
Compare
Pull Request Test Coverage Report for Build 10726230198Details
💛 - Coveralls |
This is put on pause again because of a bug with @nlordell and I are also tried a few workarounds:
|
I feel like the invocation count not updating is something we are doing wrong (as other storage updates were working as expected), and I am super curious and will likely try to debug at some point :P |
testing with the "full" local node was also not possible matter-labs/local-setup#19 |
83873da
to
823d0c6
Compare
0107628
to
84b9af3
Compare
"build:ts": "rimraf dist && tsc -p tsconfig.prod.json", | ||
"build:ts:dev": "rimraf dist && tsc -p tsconfig.json", | ||
"test": "hardhat test && npm run test:L1", | ||
"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", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We previously didn't have a command for testing the SafeL2 contract
@@ -6,7 +6,7 @@ import { buildContractCall } from "../../src/utils/execution"; | |||
describe("SimulateTxAccessor", () => { | |||
const setupTests = deployments.createFixture(async ({ deployments }) => { | |||
await deployments.fixture(); | |||
const signers = await ethers.getSigners(); | |||
const signers = await hre.ethers.getSigners(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the change here (and a similar change in other files) is unrelated to zksync: it was in the original PR and I decided to keep it because this way the invocation is more specific and less likely to cause a conflict with a global import like this import { ethers } from 'ethers'
src/utils/deploy.ts
Outdated
* @returns The deployer account address or private key. | ||
*/ | ||
export const getDeployerAccount = async (hre: HardhatRuntimeEnvironment) => { | ||
const { deployer } = await hre.getNamedAccounts(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ubernit: it feels weird to get the deployer
named account if we discard it right after. Why not if (!hre.network.zksync) { ... } else { ... }
pattern here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed a small change to the code. I moved the happy path outside of the branching code because the branching will only execute rarely (there are only few networks with the zksync environment)
const bytecodeHash = getZkSyncBytecodeHashFromDeployerCallHeader(proxyCreationCode); | ||
const input = new ethers.AbiCoder().encode(["address"], [singleton]); | ||
return zk.utils.create2Address(factoryAddress, bytecodeHash, salt, input); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤯
// await expect(await executeTx(safe, tx, [await safeApproveHash(user1, safe, tx, true)], { gasLimit: 5500000 })).to.emit( | ||
// nativeTokenReceiver, | ||
// "BreadReceived", | ||
// ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: left-in commented out code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left it on purpose because I was looking for a way to make it work in ZkSync, this test should be considered unfinished
); | ||
|
||
// Reverted reason seems not properly returned by zkSync local node, though it is in fact GS010 when using debug_traceTransaction | ||
if (hre.network.zksync) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird that only this case doens't properly find the revert reason, but in other cases it does. Do we know why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the comment
before(function () { | ||
/** | ||
* ## Migration tests are not working yet for zkSync: this test depends on the EVM bytecode | ||
* which is not supported on zkSync. Tests will be adjusted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we create a GH issue to track this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's covered by #767
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - just some small comments, but approving to reduce back-and-forth.
test/core/Safe.Execution.spec.ts
Outdated
@@ -1,5 +1,5 @@ | |||
import { expect } from "chai"; | |||
import hre, { deployments, ethers } from "hardhat"; | |||
import hre, { ethers } from "hardhat"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also get rid if the { ethers }
here?
This PR:
Importants changes
hre.ethers.getContractAt
would always return a contract instance connected to the first account returned fromhre.ethers.getSigners
. This didn't hold in zksync environment as they use the 9th accountNotes
Proof of deployment: