-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: track and cache context of each compiler invocation (#140)
ref foundry-rs/foundry#7379 ref foundry-rs/foundry#4981 ref foundry-rs/foundry#2704 The way Solidity assigns `source_id`s is simply by order in which sources are passed in compiler input. Thus, if we have two sources `A.sol` and `B.sol`, then on the first (non-cached) compiler run, `A.sol` will get assigned ID 1 and `B.sol` will have ID 2. Then, if we change `B.sol` slightly and recompile, it will be the only source in the input, so it will have ID 1. The same ID collisions are more often appearing on multi-version and multi-compiler builds. After many cached runs such discrepancies result in debugger basically displaying random sources. This PR adds a way to link an artifact to the build info for input that produced it, thus allowing us to track correct `source_id -> source` mapping for cached artifacts. I've added `BuildContext` which is the foundry context we are tracking for each compiler invocation. It is getting inlined into `BuildInfo`, and read along with cached artifacts. `BuildContext`s are indexed by the same IDs `BuildInfo`s are, and each `ArtifactId` now has a reference to `build_id` which produced it. Build info now produced on every compiler run, however, it does not include complete input and output unless `project.build_info` is true, to avoid overhead while keeping our internal logic working correctly.
- Loading branch information
Showing
19 changed files
with
431 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.