foundry-zksync icon indicating copy to clipboard operation
foundry-zksync copied to clipboard

Avoid compiling Test/Script toplevel contracts w/ zksolc

Open Karrq opened this issue 1 year ago • 2 comments

The bytecode size limitation is a very painful point for projects to migrate to zksync.

In many cases, this limitation is hit by test or scripts, not the actual contracts themselves.

Considering the current architecture, these contracts are never deployed on the EraVM, therefore they shouldn’t need to be compiled for EraVM

Karrq avatar Oct 28 '24 21:10 Karrq

The main challenge with this is that the compiler operates in terms of files and not contracts, so when tests/script source files also include contracts, we would need to parse the file, and remove the test contract in place, keeping the rest. The ROI is probably there though as the UX improvement would be quite big. Maybe a good first iteration of this is enabling the test/script skipping via a flag.

elfedy avatar Dec 04 '24 12:12 elfedy

I don't think a flag would be a good idea because a lot of users will still hit the compile limit and if they're referring to the OG foundry docs they're not going to see the additional flag information. It's worth baking the feature into the command here. Perhaps you can do something like a .gitignore which ignores all contract sizes within a scripts or test dir?

pegahcarter avatar Jan 15 '25 19:01 pegahcarter