sc-forks / solidity-coverage

Code coverage for Solidity smart-contracts
MIT License
975 stars 263 forks source link

Enable coverage when `viaIR` compiler flag is true #854

Closed cgewecke closed 7 months ago

cgewecke commented 7 months ago

PUBLISHED at the viaIR tag

npm install --save-dev solidity-coverage@viaIR

853, #848, #790, #715, #417

Uses solidity built-in ignored by the yul optimizer to preserve instrumentation when viaIR is set to true. This should address all the insane optimizer config problems.

Coverage in the plugin's own tests is missing for an edge case where the optimizer has:

... we hit the first two conditions in the integration tests but the hash is a duplicate.

TODO

codecov-commenter commented 7 months ago

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (d3a5b37) 95.92% compared to head (62408ea) 95.77%.

Files Patch % Lines
lib/collector.js 88.88% 2 Missing :warning:
plugins/resources/nomiclabs.utils.js 90.00% 1 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #854 +/- ## ========================================== - Coverage 95.92% 95.77% -0.16% ========================================== Files 19 19 Lines 981 1017 +36 ========================================== + Hits 941 974 +33 - Misses 40 43 +3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

cgewecke commented 7 months ago

E2E tested against 1inch solidity-utils and got the output below. Compare with / identical to: https://github.com/1inch/solidity-utils/actions/runs/7756078740/job/21152695486 Screen Shot 2024-02-08 at 6 44 16 PM

NB: there was a failing test that looked at gas specific values - to be expected because the instrumentation mechanism changed and there's some consumption variance.

Screen Shot 2024-02-08 at 6 50 31 PM