feat: inline config parsing using Slang v2 - #1530
Conversation
🦋 Changeset detectedLatest commit: 16b3abd 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 |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1530 +/- ##
==========================================
+ Coverage 79.85% 79.99% +0.13%
==========================================
Files 452 462 +10
Lines 78600 79627 +1027
Branches 78600 79627 +1027
==========================================
+ Hits 62767 63697 +930
- Misses 13668 13738 +70
- Partials 2165 2192 +27 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
/bench hardhat-ref=popescuoctavian/remove-inline-config |
|
⏳ EDR CI for this commit hasn't passed yet, so the regression benchmark was not started. Comment |
|
/bench hardhat-ref=popescuoctavian/remove-inline-config |
|
🚀 Starting regression benchmark for |
|
/bench hardhat-ref=popescuoctavian/remove-inline-config |
|
🚀 Starting regression benchmark for |
|
❌ Regression benchmark failed for |
df1daf2 to
a5d8668
Compare
|
/bench hardhat-ref=popescuoctavian/remove-inline-config |
|
🚀 Starting regression benchmark for |
|
❌ Regression benchmark failed for |
|
✅ Regression benchmark passed for |
6c5fd3a to
03119c4
Compare
|
/bench hardhat-ref=popescuoctavian/remove-inline-config benchmarks="test solidity" |
|
🚀 Starting regression benchmark for |
|
✅ Regression benchmark passed for |
|
/bench hardhat-ref=popescuoctavian/remove-inline-config |
|
🚀 Starting regression benchmark for |
Wodann
left a comment
There was a problem hiding this comment.
Thanks for addressing the feedback.
Looks good to merge when the Hardhat team is also ready to merge their part of this change.
|
✅ Regression benchmark passed for |
This PR adds native inline config parsing to EDR using Slang v2 API.
Note: Contract-level inline config support will be covered by a subsequent PR.
Note for reviewer: I believe the code should be reviewed as a whole, rather than per-commit, since the last 2 commits introduce a lot of changes.
Claude Summary
Summary
Add Solidity test inline-configuration parsing (
forge-config:/hardhat-config:NatSpec directives, e.g.
/// forge-config: default.fuzz.runs = 100), parsing test sourcesdirectly with Slang v2. EDR now derives the per-test overrides itself instead of receiving
them pre-built over NAPI.
Behavior
Hardhat/Foundry), rather than silently dropping config or failing a single suite.
One problem is reported per affected test function.
runSolidityTestspromise carries the structured, located problems asan
inlineConfigErrorsarray on the thrown error (source name, contract, function,line, message).
NAPI API changes (breaking)
testFunctionOverridesargument ofSolidityTestRunnerConfigArgsand its associated types:
TestFunctionOverride,TestFunctionIdentifier,TestFunctionConfigOverride,FuzzConfigOverride,InvariantConfigOverride,TimeoutConfig.testSourcePaths(solc source name → absolute path) andimportMappings(non-relative import path → absolute path) so EDR can read each test source and
resolve its imports from disk.
Implementation
edr_solidity_tests::inline_configmodule: Slang v2CompilationBuilderparseseach test source with imports resolved from disk; per-function overrides are extracted
from the leading NatSpec and cached by source name.
TryFrom<TestRunnerConfig>and carried onSolidityTestRunnerConfig;MultiContractRunner::newruns collection (off the asyncruntime) and aborts the run on any malformed directive.
Testing
itintegration tests (override behavior + malformed-config abort).