Skip to content
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

refactor: remove foundry overrides #42

Draft
wants to merge 3 commits into
base: zksync-v0.11.6
Choose a base branch
from

Conversation

elfedy
Copy link

@elfedy elfedy commented Nov 16, 2024

Sample of how we would remove foundry overrides using foundry-rs#224 changes.

Remaining code is a single zksync crate with artifacts and Compiler/ArtifactOutput implementations

NOTE: The PR is not meant to be actually merged with zksync-v0.11.6 but implemented when the following upstream changes are made. It is made to that branch for now for illustrative purposes.

Copy link
Collaborator

@hedgar2017 hedgar2017 left a comment

Choose a reason for hiding this comment

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

LGTM!

Would it now be possible to switch to era-solc?

@elfedy
Copy link
Author

elfedy commented Nov 19, 2024

Would it now be possible to switch to era-solc?

@hedgar2017 yes, we can give it a shot after this see how it goes.

mattsse pushed a commit to foundry-rs/compilers that referenced this pull request Dec 4, 2024
…ilerOutput (#224)

Right now the compiler abstraction has two couplings that force
foundry-zksync to implement it's [own fork of
compilers](https://github.com/Moonsong-Labs/compilers/tree/zksync-v0.11.6):
1. `Contract` is specific to `solc`/EVM contracts. Era VM contracts,
while requiring different fields, still could use most of the
functionality of the `compilers` pipeline.
2. `CompilerOutput` has `solc` specific fields. `zksolc` compilation has
relevant information that is useful to have later on, for example when
storing `BuildInfo`

This PR implements changes to address this. If implemented, it would
allow `foundry-zksync` (and potentially other non EVM implementations of
foundry) to get rid of all overrides and only maintain ZKsync specific
data structures/trait implementations. See [sample
PR](Moonsong-Labs#42). Changes
include:
1. Make `Compiler` generic over `Contract` (using `CompilerContract` as
a trait type).
2. Add `metadata` field to `CompilerOutput` in order to add arbitrary
data to compilation output.

---------

Co-authored-by: Nisheeth Barthwal <nisheeth.barthwal@gmail.com>
Co-authored-by: Arsenii Kulikov <klkvrr@gmail.com>
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.

2 participants