add abi support for hardhat compilation artifacts#1530
Merged
Conversation
c14b15d to
379cd39
Compare
Member
|
@ZePedroResende looks good overall, but I'd prefer if we also rename things here. both the crate itself (maybe to |
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request adds support for detecting and loading ABIs from Hardhat projects in addition to the existing Foundry project support.
Changes:
- Renamed references from "foundry_roots" to "project_roots" to reflect support for both Foundry and Hardhat projects
- Added detection for Hardhat config files (hardhat.config.ts, hardhat.config.js) alongside foundry.toml
- Updated artifact directory detection to check for Hardhat's "artifacts/contracts" in addition to Foundry's "out"
- Enhanced ABI parsing to handle Hardhat's bytecode format
- Updated tests to verify both Foundry and Hardhat project detection
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| crates/forge/src/actor/mod.rs | Main logic changes including project detection, directory blacklist constants, and test updates for Hardhat support |
| crates/forge/src/actor/ext.rs | Renamed poll_foundry_roots to poll_project_roots for consistency |
| crates/forge/src/abi.rs | Added fallback for parsing Hardhat's deployedBytecode format |
Comments suppressed due to low confidence (1)
crates/forge/src/actor/mod.rs:358
- The
self.project_rootsfield is never updated after discovering new project roots. After calculatingto_addandto_removeand performing the necessary operations, you need to add:
self.project_roots = roots;
at the end of this function (before the Ok(()) return) to keep the field synchronized with the discovered project roots.
async fn update_project_roots(&mut self) -> Result<()> {
let roots = self.find_project_roots().await?;
trace!(roots = ?roots);
let to_remove: Vec<_> = self
.roots
.iter()
.filter(|p| !self.roots.contains(*p))
.cloned()
.collect();
let to_add: Vec<_> = roots
.iter()
.filter(|p| !self.project_roots.contains(*p))
.cloned()
.collect();
for path in to_add.iter() {
self.scan_project(path).await?;
}
match self.watcher.as_mut() {
Some(watcher) => {
for path in to_remove {
watcher.unwatch(path.join("out"))?;
}
for path in to_add {
watcher.watch(path.join("out"), RecursiveMode::Recursive)?;
}
}
None => {
warn!("forge watcher not initialized");
}
}
Ok(())
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
naps62
approved these changes
Jan 28, 2026
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.
No description provided.