Skip to content

feat: inline config parsing using Slang v2 - #1530

Open
popescuoctavian wants to merge 17 commits into
mainfrom
popescuoctavian/inline-config-with-Slang
Open

feat: inline config parsing using Slang v2#1530
popescuoctavian wants to merge 17 commits into
mainfrom
popescuoctavian/inline-config-with-Slang

Conversation

@popescuoctavian

@popescuoctavian popescuoctavian commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

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 sources
directly with Slang v2. EDR now derives the per-test overrides itself instead of receiving
them pre-built over NAPI.

Behavior

  • Inline config is collected once, up front, before any test runs.
  • Ill-formed inline configuration fails the whole run up front (matching
    Hardhat/Foundry), rather than silently dropping config or failing a single suite.
    One problem is reported per affected test function.
  • The rejected runSolidityTests promise carries the structured, located problems as
    an inlineConfigErrors array on the thrown error (source name, contract, function,
    line, message).

NAPI API changes (breaking)

  • Removed the testFunctionOverrides argument of SolidityTestRunnerConfigArgs
    and its associated types: TestFunctionOverride, TestFunctionIdentifier,
    TestFunctionConfigOverride, FuzzConfigOverride, InvariantConfigOverride,
    TimeoutConfig.
  • Added testSourcePaths (solc source name → absolute path) and importMappings
    (non-relative import path → absolute path) so EDR can read each test source and
    resolve its imports from disk.

Implementation

  • New edr_solidity_tests::inline_config module: Slang v2 CompilationBuilder parses
    each test source with imports resolved from disk; per-function overrides are extracted
    from the leading NatSpec and cached by source name.
  • The import resolver is built in TryFrom<TestRunnerConfig> and carried on
    SolidityTestRunnerConfig; MultiContractRunner::new runs collection (off the async
    runtime) and aborts the run on any malformed directive.

Testing

  • Rust unit + it integration tests (override behavior + malformed-config abort).
  • JS integration tests and the NAPI mocha suite.

@popescuoctavian popescuoctavian self-assigned this Jul 2, 2026
@popescuoctavian
popescuoctavian temporarily deployed to github-action-benchmark July 2, 2026 09:21 — with GitHub Actions Inactive
@changeset-bot

changeset-bot Bot commented Jul 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 16b3abd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@nomicfoundation/edr Minor

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

@socket-security

socket-security Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedcargo/​sha3@​0.12.010010093100100

View full report

@popescuoctavian
popescuoctavian temporarily deployed to github-action-benchmark July 2, 2026 09:25 — with GitHub Actions Inactive
@popescuoctavian
popescuoctavian had a problem deploying to github-action-benchmark July 2, 2026 09:25 — with GitHub Actions Error
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.30249% with 109 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.99%. Comparing base (a05aedf) to head (03119c4).

Files with missing lines Patch % Lines
...rates/edr_napi/src/solidity_tests/inline_config.rs 51.47% 30 Missing and 3 partials ⚠️
...edr_solidity_tests/src/inline_config/directives.rs 93.66% 4 Missing and 20 partials ⚠️
.../edr_solidity_tests/src/inline_config/overrides.rs 85.88% 12 Missing ⚠️
...ates/edr_solidity_tests/src/inline_config/error.rs 67.64% 5 Missing and 6 partials ⚠️
crates/edr_napi/src/solidity_tests/config.rs 62.50% 5 Missing and 1 partial ⚠️
crates/edr_napi/src/solidity_tests/op.rs 16.66% 4 Missing and 1 partial ⚠️
crates/edr_napi/src/context.rs 88.23% 3 Missing and 1 partial ⚠️
crates/edr_napi_core/src/solidity/factory.rs 0.00% 3 Missing ⚠️
...es/edr_solidity_tests/src/inline_config/natspec.rs 97.22% 3 Missing ⚠️
crates/edr_napi/src/solidity_tests/l1.rs 66.66% 2 Missing ⚠️
... and 4 more
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@popescuoctavian
popescuoctavian temporarily deployed to github-action-benchmark July 2, 2026 09:52 — with GitHub Actions Inactive
@popescuoctavian
popescuoctavian had a problem deploying to github-action-benchmark July 2, 2026 09:56 — with GitHub Actions Failure
@popescuoctavian
popescuoctavian temporarily deployed to github-action-benchmark July 2, 2026 09:56 — with GitHub Actions Inactive
@popescuoctavian
popescuoctavian temporarily deployed to github-action-benchmark July 2, 2026 11:18 — with GitHub Actions Inactive
@popescuoctavian

Copy link
Copy Markdown
Contributor Author

/bench hardhat-ref=popescuoctavian/remove-inline-config

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

⏳ EDR CI for this commit hasn't passed yet, so the regression benchmark was not started. Comment /bench again once CI is green.

@popescuoctavian

Copy link
Copy Markdown
Contributor Author

/bench hardhat-ref=popescuoctavian/remove-inline-config

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

🚀 Starting regression benchmark for a24445ffc73f against Hardhat popescuoctavian/remove-inline-config.

@popescuoctavian

Copy link
Copy Markdown
Contributor Author

/bench hardhat-ref=popescuoctavian/remove-inline-config

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

🚀 Starting regression benchmark for a24445ffc73f against Hardhat popescuoctavian/remove-inline-config.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

❌ Regression benchmark failed for a24445ffc73f against Hardhat popescuoctavian/remove-inline-config. This is either a detected performance regression or an infrastructure failure — see the run for details.

View workflow run

@popescuoctavian
popescuoctavian temporarily deployed to github-action-benchmark July 3, 2026 08:25 — with GitHub Actions Inactive
@popescuoctavian
popescuoctavian temporarily deployed to github-action-benchmark July 3, 2026 08:28 — with GitHub Actions Inactive
@popescuoctavian
popescuoctavian temporarily deployed to github-action-benchmark July 3, 2026 08:28 — with GitHub Actions Inactive
@popescuoctavian
popescuoctavian force-pushed the popescuoctavian/inline-config-with-Slang branch from df1daf2 to a5d8668 Compare July 6, 2026 17:11
@popescuoctavian
popescuoctavian temporarily deployed to github-action-benchmark July 6, 2026 17:11 — with GitHub Actions Inactive
@popescuoctavian
popescuoctavian had a problem deploying to github-action-benchmark July 6, 2026 17:27 — with GitHub Actions Failure
@popescuoctavian
popescuoctavian temporarily deployed to github-action-benchmark July 6, 2026 17:27 — with GitHub Actions Inactive
@popescuoctavian
popescuoctavian temporarily deployed to github-action-benchmark July 6, 2026 18:41 — with GitHub Actions Inactive
@popescuoctavian

Copy link
Copy Markdown
Contributor Author

/bench hardhat-ref=popescuoctavian/remove-inline-config

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

🚀 Starting regression benchmark for a5d86686b95d against Hardhat popescuoctavian/remove-inline-config.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

❌ Regression benchmark failed for a5d86686b95d against Hardhat popescuoctavian/remove-inline-config. This is either a detected performance regression or an infrastructure failure — see the run for details.

View workflow run

@popescuoctavian
popescuoctavian temporarily deployed to github-action-benchmark July 7, 2026 09:17 — with GitHub Actions Inactive
@github-actions

Copy link
Copy Markdown
Contributor

✅ Regression benchmark passed for 6c5fd3a030d6 against Hardhat popescuoctavian/remove-inline-config.

View workflow run

@popescuoctavian
popescuoctavian force-pushed the popescuoctavian/inline-config-with-Slang branch from 6c5fd3a to 03119c4 Compare July 21, 2026 11:54
@popescuoctavian
popescuoctavian temporarily deployed to github-action-benchmark July 21, 2026 11:54 — with GitHub Actions Inactive
@popescuoctavian
popescuoctavian temporarily deployed to github-action-benchmark July 21, 2026 11:57 — with GitHub Actions Inactive
@popescuoctavian
popescuoctavian temporarily deployed to github-action-benchmark July 21, 2026 11:57 — with GitHub Actions Inactive
@popescuoctavian
popescuoctavian had a problem deploying to github-action-benchmark July 22, 2026 12:15 — with GitHub Actions Failure
@popescuoctavian
popescuoctavian temporarily deployed to github-action-benchmark July 22, 2026 12:36 — with GitHub Actions Inactive
@popescuoctavian
popescuoctavian temporarily deployed to github-action-benchmark July 22, 2026 12:39 — with GitHub Actions Inactive
@popescuoctavian
popescuoctavian temporarily deployed to github-action-benchmark July 22, 2026 13:04 — with GitHub Actions Inactive
@popescuoctavian
popescuoctavian temporarily deployed to github-action-benchmark July 22, 2026 13:07 — with GitHub Actions Inactive
@popescuoctavian
popescuoctavian temporarily deployed to github-action-benchmark July 22, 2026 13:07 — with GitHub Actions Inactive
@popescuoctavian

Copy link
Copy Markdown
Contributor Author

/bench hardhat-ref=popescuoctavian/remove-inline-config benchmarks="test solidity"

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Starting regression benchmark for 16b3abdfabfe against Hardhat popescuoctavian/remove-inline-config (benchmarks matching test solidity).

@popescuoctavian
popescuoctavian requested a review from Wodann July 22, 2026 14:35
@github-actions

Copy link
Copy Markdown
Contributor

✅ Regression benchmark passed for 16b3abdfabfe against Hardhat popescuoctavian/remove-inline-config.

View workflow run

@popescuoctavian

Copy link
Copy Markdown
Contributor Author

/bench hardhat-ref=popescuoctavian/remove-inline-config

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Starting regression benchmark for 16b3abdfabfe against Hardhat popescuoctavian/remove-inline-config (benchmarks matching test solidity,mocha test).

@Wodann Wodann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the feedback.

Looks good to merge when the Hardhat team is also ready to merge their part of this change.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Regression benchmark passed for 16b3abdfabfe against Hardhat popescuoctavian/remove-inline-config.

View workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants