-
-
Notifications
You must be signed in to change notification settings - Fork 252
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(networks): Adding deployment on zkSync #13078
Conversation
To test things locally, please do the following:
You should then see the following error: TypeError: Class extends value undefined is not a constructor or null
at Object.<anonymous> (/Users/julien/tmp/unlock/node_modules/zksync2-js/build/src/types.js:46:51)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Function.Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at require (node:internal/modules/cjs/helpers:110:18)
at Object.<anonymous> (/Users/julien/tmp/unlock/node_modules/zksync2-js/build/src/utils.js:19:17)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1310:10) |
the issue is with the |
@julien51 It looks like you're using the plugins built for Ethers v6. Please update {
"name": "@unlock-protocol/governance",
"description": "Scripts for the management of the Unlock Protocol",
"private": true,
"dependencies": {
"@nomicfoundation/hardhat-network-helpers": "1.0.9",
"@nomiclabs/hardhat-ethers": "2.2.3",
"@nomiclabs/hardhat-etherscan": "3.1.7",
"@openzeppelin/test-helpers": "0.5.16",
"@safe-global/safe-core-sdk": "3.3.5",
"@safe-global/safe-ethers-lib": "1.9.3",
"@safe-global/safe-service-client": "2.0.3",
"@unlock-protocol/contracts": "workspace:./packages/contracts",
"@unlock-protocol/eslint-config": "workspace:./packages/eslint-config",
"@unlock-protocol/hardhat-helpers": "workspace:^",
"@unlock-protocol/hardhat-plugin": "workspace:^",
"@unlock-protocol/networks": "workspace:./packages/networks",
"eslint": "8.54.0",
"fs-extra": "11.1.1",
"hardhat": "2.19.2",
"solhint": "4.0.0",
"zksync-web3": "^0.14.3"
},
"scripts": {
"test": "hardhat test",
"ci": "yarn lint && yarn test",
"lint:contracts": "solhint 'contracts/**/*.sol'",
"lint:code": "eslint --resolve-plugins-relative-to ../packages/eslint-config .",
"lint": "yarn lint:contracts && yarn lint:code"
},
"devDependencies": {
"@matterlabs/hardhat-zksync-deploy": "^0.6.5",
"@matterlabs/hardhat-zksync-solc": "^0.4.2"
}
}
|
Hi, alternatively you can avoid this error and proceed with contract compilation by adding Ethers 6 ( {
"name": "@unlock-protocol/governance",
"description": "Scripts for the management of the Unlock Protocol",
"private": true,
"dependencies": {
"@nomicfoundation/hardhat-network-helpers": "1.0.9",
"@nomiclabs/hardhat-ethers": "2.2.3",
"@nomiclabs/hardhat-etherscan": "3.1.7",
"@nomiclabs/hardhat-waffle": "^2.0.6",
"@openzeppelin/hardhat-upgrades": "^2.5.0",
"@openzeppelin/test-helpers": "0.5.16",
"@safe-global/safe-core-sdk": "3.3.5",
"@safe-global/safe-ethers-lib": "1.9.3",
"@safe-global/safe-service-client": "2.0.3",
"@unlock-protocol/contracts": "workspace:./packages/contracts",
"@unlock-protocol/eslint-config": "workspace:./packages/eslint-config",
"@unlock-protocol/hardhat-helpers": "workspace:^",
"@unlock-protocol/hardhat-plugin": "workspace:^",
"@unlock-protocol/networks": "workspace:./packages/networks",
"eslint": "8.54.0",
"ethers": "^6.9.0",
"fs-extra": "11.1.1",
"hardhat": "2.19.2",
"solhint": "4.0.0",
"zksync2-js": "0.4.0"
},
"scripts": {
"test": "hardhat test",
"ci": "yarn lint && yarn test",
"lint:contracts": "solhint 'contracts/**/*.sol'",
"lint:code": "eslint --resolve-plugins-relative-to ../packages/eslint-config .",
"lint": "yarn lint:contracts && yarn lint:code"
},
"devDependencies": {
"@matterlabs/hardhat-zksync-deploy": "1.0.1",
"@matterlabs/hardhat-zksync-solc": "1.0.3",
"@nomicfoundation/hardhat-ethers": "^3.0.0",
"@nomicfoundation/hardhat-verify": "^1.1.0"
}
} Here's an issue explaining this subject a little further: matter-labs/hardhat-zksync#547 |
Thanks @idea404 and @MexicanAce ! I will try both. |
yeah, as worried using @idea404 's approach creates issues :(
Because of this: const defaultParams = {
expirationDuration: ethers.BigNumber.from(60 * 60 * 24 * 30), // 30 days
keyPrice: ethers.utils.parseEther('0.01'), // in wei
maxNumberOfKeys: 100,
lockName: 'Unlock-Protocol Lock',
} |
With @MexicanAce 's approach I am able to go what looks like a bit further! More soon! |
We have a bunch of warnings when compiling:
But more worrying is that I am getting an error:
and |
maybe try
This syntax should work await run('compile', { network: 'zksync'}) Also you need to rebuild the helper lib afterwards with |
@clemsos I tried both things (clean and recompile), but also "forcing" the network when compiling... with no luck and I still have the same error. |
@julien51 I'm unsure about the cache issue, as I can't replicate that locally. I will suggest updating the following files to support NPM packages with Ethers v5: package.json "dependencies": {
"zksync-ethers": "^5.0.0"
},
"devDependencies": {
"@matterlabs/hardhat-zksync-deploy": "^0.6.5",
"@matterlabs/hardhat-zksync-solc": "^0.4.2",
"@matterlabs/hardhat-zksync-upgradable": "^0.1.3",
"@matterlabs/hardhat-zksync-verify": "^0.1.8"
} hardhat.config.js require('@matterlabs/hardhat-zksync-deploy')
require('@matterlabs/hardhat-zksync-solc')
require('@matterlabs/hardhat-zksync-upgradable')
require('@matterlabs/hardhat-zksync-verify') After this, you will probably start running into the next problem of incompatibility of using the You might also run into an issue where the |
@MexicanAce In the meantime, we have upgraded to ethers6 in the right part of our monorepo. That said, unfortunately I still have the caching issue.
To reproduce, you can checkout the branch from this PR |
e4d1999
to
1d0029f
Compare
contracts deployed on Zksync Sepolia using the very useful reference here #13217 PublicLock : https://sepolia.explorer.zksync.io/address/0x020d8F48E56F12C9213007186E2bbdD81Be45034#transactions Unlock |
Hello ! I am getting this
|
I have a second issue similar to this one zkSync-Community-Hub/zksync-developers#164 While importing
That happens NB: I added a workaround in 3b08b5a but its hacky :P |
The upgradeable plugin is now working but I am running into the following Looking at the error is seems that the data is sent to the zero address. Maybe it relates to matter-labs/hardhat-zksync#696 ?
|
hooooo! Are we getting there? |
…to zksync-support
last issue is the verification of the template here https://explorer.zksync.io/address/0x73a6EC7A82303A569415e070AD64b23AF8FF098e#contract Seems some metadata issue (relates to matter-labs/hardhat-zksync#285 ) |
@@ -0,0 +1,289 @@ | |||
{ |
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.
Maybe we can skip that one since we don't want to have too many tests nets?
@@ -12,6 +12,13 @@ const { | |||
parseForkUrl, | |||
} = require('@unlock-protocol/hardhat-helpers') | |||
|
|||
// zksync | |||
if (process.env.ZK_SYNC) { |
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.
did you find another trick to avoid using that env var?
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.
not really for the hardhat config. We can not access hardhat run time or --network
flag during initialization of the hardhat runtime environment so we'll have to stick with this workaround for now.
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.
Can you please add a comment so we know why in the future?
@@ -15,3 +15,5 @@ export * from './linea' | |||
export * from './sepolia' | |||
export * from './zkevm' | |||
export * from './scroll' | |||
export * from './zksync' | |||
export * from './zksyncSepolia' |
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.
Let's not add it 🙏
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.
A few changes/cleanup bvut then it should be good!
id: 324, | ||
isTestNetwork: false, | ||
maxFreeClaimCost: 1, | ||
multisig: 'TK', |
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.
Pleaase update :)
publicLockVersionToDeploy: 13, | ||
publicProvider: 'https://mainnet.era.zksync.io', | ||
startBlock: 0, | ||
subgraph: { |
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.
please update
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.
deploying on graph studio with new ARB safe #12867
@@ -0,0 +1,84 @@ | |||
import { NetworkConfig } from '@unlock-protocol/types' |
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.
skip!
@@ -3,1637 +3,1618 @@ | |||
// do not modify directly! |
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 really need to fix this so it does not pollute every PR
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.
yes thats annoying
ok subgraph added ! |
@@ -64,3 +72,12 @@ module.exports = { | |||
enabled: true, | |||
}, | |||
} | |||
|
|||
if (process.env.ZK_SYNC) { |
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.
Possible to do a single if (process.env.ZK_SYNC)
with the includes above, for cleanliness?
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.
yes done
Description
This is work in progress to add support for zkSync!
Since zksync is not perfectly EVM compatible, we have to follow the steps shown there https://era.zksync.io/docs/tools/hardhat/migrating-to-zksync.html
replaces #13217
Checklist:
Release Note Draft Snippet