Skip to content

v2.0.2 - Fix view/pure function coverage

Latest

Choose a tag to compare

@forkforkdog forkforkdog released this 10 Nov 15:07
· 2 commits to main since this release

🐛 Bug Fix

Fixed a critical bug where contracts containing only view/pure functions would incorrectly show 0% coverage.

What was wrong

  • By default, echidna-coverage filters out view/pure functions to focus on state-changing functions
  • Contracts like QuoterV1 that only contain view functions would have all functions filtered out
  • This resulted in showing 0 total functions and 0% coverage, even when the contract was fully covered

What's fixed

  • Automatically includes all functions when filtering would result in zero functions
  • Contracts with only view/pure functions now show their actual coverage metrics
  • Example: QuoterV1 now correctly shows 97.22% coverage instead of 0%

Technical Details

  • Modified parseFunctions() in src/parsing/index.ts
  • Added fallback logic when filteredFunctions.length === 0 && functions.length > 0
  • No breaking changes - all existing functionality preserved

Full Changelog: v2.0.1...v2.0.2