Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
The function
is_foundry_zksyncdoes not recognise if the system hasFoundry Base InstallationorFoundry zkSyncinstalled. It will always returnSteps to reproduce the issue
From Course : Foundry Fundamentals > Lesson 25 - Zksync Devops
Project: foundry-fund-me-cu
Test File: test/unit/ZkSyncDevOps.t.sol
Note: Have
ffi = truein thefoundry.tomlRun first
and then
Root Cause
The command
that it's being run in these lines of code
in the Foundry Base installation it returns
and in Foundry zkSync installation it returns
With the following checks in that function, only the first part of the returned string is checked which is the version (
forge Version: 1.) and it is the same in both cases (Foundry Base Installation and Foundry zkSync Installation).So when the code arrives at this check, it only checks for the version of the installation hence this
ifstatement will be fulfilled and the code will go in the corresponding statements which is the followingSuggested Solution
After running the command
check if the returned string contains the substring
zksync. If yes, return the corresponding msg and boolean value.Notes
Note 1
I am not sure if the checks of specific versions are necessary. If we just add 2 more checks after the suggested solution, e.g.
we could remove all the rest of the checks.
Note 2
I do not understand why
skipZkSyncmodifier uses another functionisZkSyncChainand then another functionisOnZkSyncChainIdto again determine if we are on zkSync or not. We could use the same function.Additional changes
Change 1
Replaced
which results in
with
which results in
which looks more like what I would expect to see in the forge version.
Change 2
Replaced the natspec of the function
is_foundry_zksyncsince it does not return the current version of foundry. It returns if the Foundry installation is the base one or the zksync one.Testing
unti/test/ZkSyncDevOps.t.solfile and change the import ofFoundryZkSyncCheckerto point to the cloned repo (previous step) of foundry-devops (use the absolute path)ffi = truein yourfoundry.tomlIn your
foundry-fund-me-cufolder:Foundry-zkSyncfoundryup-zksyncforge --version, it should return something similar toforge Version: 1.3.0-foundry-zksync-v0.0.26testZkSyncFoundryFailsand runforge test --mt testZkSyncFoundryFails -vvvvkeyExistsJson) and returnsThis is Foundry ZkSyncFoundryfoundryupforge --version, it should return something similar toforge Version: 1.3.2-stableforge test --mt testZkSyncFoundryFails -vvvvThis is Vanilla Foundry