Skip to content

Conversation

@fusmanii
Copy link
Contributor

@fusmanii fusmanii commented Sep 4, 2025

The checkZkSyncChain function in DeploymentUtils will ensure that zksync chains are compiled and deployed with zksolc

@fusmanii fusmanii force-pushed the faisal/foundry-zksync branch from 617116f to 730bee5 Compare September 4, 2025 02:40
@socket-security
Copy link

socket-security bot commented Sep 4, 2025

No dependency changes detected. Learn more about Socket for GitHub.

👍 No dependency changes detected in pull request

@fusmanii fusmanii marked this pull request as ready for review September 4, 2025 18:57
nicholaspai
nicholaspai previously approved these changes Sep 4, 2025
Copy link
Member

@nicholaspai nicholaspai left a 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 \
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

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

nicholaspai
nicholaspai previously approved these changes Sep 8, 2025
Comment on lines +203 to +218
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"
);
}
}
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pxrl I can make the change in my constants.json pr since I don't have the family attribute exposed yet

Copy link
Contributor

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.

Copy link
Contributor Author

@fusmanii fusmanii Sep 17, 2025

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

@fusmanii fusmanii force-pushed the faisal/foundry-zksync branch from 341c84b to a2d6999 Compare September 9, 2025 14:09
@fusmanii fusmanii requested a review from pxrl September 9, 2025 14:13
@fusmanii fusmanii force-pushed the faisal/foundry-zksync branch 2 times, most recently from e289de3 to 71d4a3c Compare September 16, 2025 15:40
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>
@fusmanii fusmanii force-pushed the faisal/foundry-zksync branch from 71d4a3c to 812d0f1 Compare September 16, 2025 19:13
Comment on lines +87 to +89
export FOUNDRY_PROFILE=zksync

forge script script/016DeployZkSyncSpokePool.s.sol:DeployZkSyncSpokePool --rpc-url zksync --broadcast --verify -vvvv
Copy link
Contributor

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:

Suggested change
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

Copy link
Contributor Author

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

@fusmanii fusmanii merged commit f722857 into master Sep 17, 2025
10 checks passed
@fusmanii fusmanii deleted the faisal/foundry-zksync branch September 17, 2025 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants