sources
key in build info is no longer in order of source unit id
#178
Milestone
sources
key in build info is no longer in order of source unit id
#178
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 insources
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 downAdditionally, 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.
The text was updated successfully, but these errors were encountered: