Skip to content

npx hardhat coverage fails - stack too deep #190

@mreitschuster

Description

@mreitschuster
npx hardhat coverage --show-stack-traces

Version
=======
> solidity-coverage: v0.8.12

Instrumenting for coverage...
=============================

> APIConsumer.sol
> AutomationCounter.sol
> PriceConsumerV3.sol
> RandomNumberConsumerV2Plus.sol
> RandomNumberDirectFundingConsumerV2Plus.sol
> test/VRFCoordinatorV2_5Mock.sol
> VRFV2PlusWrapper.sol

Coverage skipped for:
=====================

> test/fuzzing/AutomationCounterEchidnaTest.sol
> test/MockLinkToken.sol
> test/MockOracle.sol
> test/MockV3Aggregator.sol

Compilation:
============

CompilerError: Stack too deep. Try compiling with `--via-ir` (cli) or the equivalent `viaIR: true` (standard JSON) while enabling the optimizer. Otherwise, try removing local variables. When compiling inline assembly: Variable headStart is 1 slot(s) too deep inside the stack. Stack too deep. Try compiling with `--via-ir` (cli) or the equivalent `viaIR: true` (standard JSON) while enabling the optimizer. Otherwise, try removing local variables.

after checking out, npm install, npx hardhat compile, npx hardhat test, I am trying to get the code coverage.
It fails with stack too deep. In order to solve the above issue, I tinkered around with

  • enabling the via-ir flag
  • excluding more/all of the .sol files in .solcover.js
  • adding a @skip-on-coverage to the test definitions ( it("testname [ @skip-on-coverage ]", async () => {}))

but with none of those i was able to get code coverage running

Any hint is appreciated to help me understand how to get code coverage for the code to run.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions