-
Notifications
You must be signed in to change notification settings - Fork 75
feat(Foundry): zkSync support #1097
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
Conversation
617116f to
730bee5
Compare
|
No dependency changes detected. Learn more about Socket for GitHub. 👍 No dependency changes detected in pull request |
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 have a question about how a manual test mistake can still sidestep this new check.
| // 4. Deploy with: | ||
| // forge script script/059DeployLensSpokePool.s.sol:DeployLensSpokePool --rpc-url \ | ||
| // $NODE_URL_1 --broadcast --verify --verifier blockscout --verifier-url https://verify.lens.xyz/contract_verification | ||
| // yarn forge-script-zksync script/059DeployLensSpokePool.s.sol:DeployLensSpokePool --rpc-url lens \ |
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.
So what would happen if you ran this script without the zksync suffix? Would an error throw somewhere?
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.
you dont need the zksync suffix, as long as FOUNDRY_PROFILE=zksync is there, it will compile with zksolc
And if you dont have that env var for lens and zksync then the check will fail
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.
this flag is the same as adding the --zksync flag
| function checkZkSyncChain(uint256 chainId) internal view { | ||
| bool isZkSyncChain = chainId == getChainId("ZK_SYNC") || | ||
| chainId == getChainId("ZK_SYNC_SEPOLIA") || | ||
| chainId == getChainId("LENS") || | ||
| chainId == getChainId("LENS_TESTNET"); | ||
|
|
||
| string memory foundryProfile = vm.envOr("FOUNDRY_PROFILE", string("default")); | ||
|
|
||
| if (isZkSyncChain) { | ||
| vm.assertEq( | ||
| foundryProfile, | ||
| string("zksync"), | ||
| "Chain is a ZkSync chain but FOUNDRY_PROFILE is not zksync. Use yarn forge-script-zksync to deploy" | ||
| ); | ||
| } | ||
| } |
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.
@fusmanii We have the family attribute in the networks definitions in constants - wdyt about just evaluating on that?
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.
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.
All good, though that PR is now closed - is there something to replace it? Just want to make sure we circle back to 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.
yup, recreating that pr since it got very messy, will include in that
341c84b to
a2d6999
Compare
e289de3 to
71d4a3c
Compare
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
71d4a3c to
812d0f1
Compare
| export FOUNDRY_PROFILE=zksync | ||
|
|
||
| forge script script/016DeployZkSyncSpokePool.s.sol:DeployZkSyncSpokePool --rpc-url zksync --broadcast --verify -vvvv |
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.
Using export in the example will make FOUNDRY_PROFILE persist beyond the deployment; it might be better to set it at runtime so it's not persistent:
| export FOUNDRY_PROFILE=zksync | |
| forge script script/016DeployZkSyncSpokePool.s.sol:DeployZkSyncSpokePool --rpc-url zksync --broadcast --verify -vvvv | |
| FOUNDRY_PROFILE=zksync forge script script/016DeployZkSyncSpokePool.s.sol:DeployZkSyncSpokePool --rpc-url zksync --broadcast --verify -vvvv |
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.
good point, merging this and will add this change to a follow up pr
The
checkZkSyncChainfunction inDeploymentUtilswill ensure that zksync chains are compiled and deployed with zksolc