-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
feat: add support for binary_mappings and network_family configs #9505
base: master
Are you sure you want to change the base?
Conversation
would love this feature to be able to manage both foundry-zksync and foundry in same project without extra scripting will this be added to foundry? or should foundry-zksync rename the binaries? |
This PR is being discussed with the Foundry team. The current status is that the team is not against these changes, but expects a bit more safety guards to be in place:
We have already prepared attestations for foundry-zksync, and just waiting for the next stable release. After that I will update the PR and hopefully we will see progress here. |
Oh, I guess I need to rebase. Will do now. |
be4cc65
to
82d5ed6
Compare
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.
@popzxc please fix failing test test_default_config
. Overall I think this makes sense and addresses the security concerns I had, would be a good compromise for v1.0 (that is until we provide proper way for developers to use Foundry as a library, planned post v1.0). @zerosnacks @DaniPopes @mattsse @yash-atreya wdyt about moving forward with?
82d5ed6
to
d92ef7d
Compare
Just pushed the fix for the test! Sorry for not fixing it right away -- unfortunately, running tests locally is a bit troublesome. |
I would prefer to hold off from merging this until after the Beyond a minor convenience of being able to use I'm more in favor of the larger and deeper integration proposed in #9651 over binary mappings. It is good to see the security issues have been largely addressed, that is something I was also concerned about. |
@zerosnacks I would also prefer the deeper integration, but realistically I think it would take months, while this PR is enough to improve the life of developers right now. I don't think that the convenience here is minor -- it's not only about running I've tried my best for this PR to leave the smallest footprint in the codebase possible, and will be happy to introduce and other requested changes, but I think it's really important to get this merged; especially given that it's not only about ZKsync Era -- with Abstract launched and having 1.5mil transactions already, Sophon launched with 25m transactions, and many more chains coming, the amount of foundry-zksync users is rapidly growing. Once we have a more "native" integration ready, we can deprecate the binary remapping approach. |
Fair point and wanting to reduce that friction for developers makes sense. I was under the impression that developers were still developing codebases specifically for ZKSync due to compatibility issues and getting specific audits for it: https://docs.zksync.io/zksync-protocol/differences/evm-instructions
That makes sense, I wasn't familiar with the effort to generalize into a ZK Stack offering as shared in https://x.com/gluk64/status/1884360327829000593
Agreed. I'm OK with the proposed approach given the additional context |
d92ef7d
to
2d712c2
Compare
Motivation
Fixes #9227
This PR makes it possible to use foundry profiles to redirect execution to alternative foundry implementations (e.g.
forge
toforge-zksync
oranvil
toanvil-zksync
) in an extendible way.Demo
foundry_zksync_demo.mp4
Solution
Note
Update: Now changes are made to be strict opt-in. User must set
allow_alternative_binaries
config variable totrue
, otherwise they'll be prompted to allow execution manually. Strict opt-out by setting it tofalse
is also possible.We introduce two new configuration options:
binary_mappings
: this setting allows you to specify where the execution should be redirected to. In essense, it's a map from enum with keys["anvil", "cast", "chisel", "forge"]
to arbitrary paths.network_family
: an enum which currently has two options (ethereum
andzksync
) that allows overriding default configuration. Right now the only thing it does is overridebinary_mappings
to ZKsync-specific values.In combination, it makes it possible to define a profile for zksync, e.g.:
and it would redirect commands to the foundry-zksync.
This way there is no need for foundry-zksync to override foundry binaries, as well as there is no need for users to change their scripts if they work with both upstream foundry and zksync foundry (which they would have to if we named binaries differently).