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

sources key in build info is no longer in order of source unit id #178

Open
0xalpharush opened this issue Jul 28, 2024 · 0 comments
Open
Milestone

Comments

@0xalpharush
Copy link

0xalpharush commented Jul 28, 2024

The build-info file used to have the same ordering as the solc JSON output and the index of a source path in the sources key would be the same as it's source unit id e.g. the 152nd index in sources list would be the source path of the source unit with an id of 152. Having the exact output of the compiler is important to avoid having to special case build frameworks. I think one of the changes having to do with caching or incremental compilation has broken this, but I haven't been able to track this down

Additionally, it is unclear what is the expected behavior in Foundry build artifacts and whether source id's will be duplicated or internally consistent e.g. in source maps, source offsets, etc. How does this work when cached artifacts are used? Can I rely on the source unit ID to be as if solc had compiled the entire source list from scratch when caching is used or how does Foundry's internal record keeping account for this? It would be great to have this behavior documented and maybe have more discussion on whether caching strategies already do or, in the future, could provide fidelity to solc and Hardhat's build format.

As an aside, it would be nice to have more testing for the build-info as it used to be equivalent to Hardhat and has had subtle breaking changes in the last couple months. When I look at PR's touching this code, the changes are not consistently tested nor do fixes consistently have regression tests.

@zerosnacks zerosnacks added this to the v1.0.0 milestone Aug 7, 2024
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

No branches or pull requests

2 participants