Merged
Conversation
🦋 Changeset detectedLatest commit: f971a0b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Fixes a dependency-graph bug that could cause duplicate Solidity remappings by deduplicating remappings across all graph edges, and adds regression + unit coverage to prevent regressions.
Changes:
- Deduplicate remappings across edges in
DependencyGraphImplementation.getAllRemappings(). - Add regression fixture project + integration-style tests for duplicated remappings scenarios.
- Add unit tests covering remapping deduplication when merging graphs.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/hardhat/src/internal/builtin-plugins/solidity/build-system/dependency-graph.ts | Updates getAllRemappings() to cross-edge deduplicate via Set. |
| packages/hardhat/test/internal/builtin-plugins/solidity/build-system/regressions/no-duplicated-remappings.ts | Adds regression tests exercising compilation job remappings output. |
| packages/hardhat/test/internal/builtin-plugins/solidity/build-system/dependency-graph.ts | Adds unit tests for remapping deduplication behavior after graph merge. |
| packages/hardhat/test/fixture-projects/no-duplicated-remappings/** | Adds fixture project (contracts + config + remappings.txt) with duplicated remapping entries. |
| .changeset/yellow-cycles-grow.md | Patch changeset documenting the fix. |
Merged
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There was a bug in the dependency graph, which could lead to remappings being duplicated, this PR fixes it.
Remappings are stored in the edges of the dependency graph, so that we can use only the necessary remappings when building a subgraph of the entire dependency graph. They are stored as a set within each edge, so they can't be duplicated in the same edge, even when merging graphs with the same edge.
The problem was that we weren't deduplicating across edges. For example, if a graph has an edge between
AandBwith remappingr1, and an edge betweenCandDwith remappingr1,r1would be duplicated.This PR fixes it by doing a cross-edge deduplication in the
getAllRemappings()method of the graph.The way this is structured, the first commit add some regression (integration style) tests, and actual unit tests of the functionality. The second commit fixes it, which is tiny.