livepeer / protocol

Livepeer protocol
MIT License
152 stars 45 forks source link

Rb/truffle to foundry #595

Closed RiccardoBiosas closed 2 years ago

RiccardoBiosas commented 2 years ago

What does this pull request do? Explain your changes. (required) Since the protocol repo has been gradually adopting Foundry to run Solidity-based tests - which provides a better alternative to Truffle-, the PR refactors the current truffle-based Solidity tests so that they can be run as part of the Foundry codebase.

Specific updates (required)

How did you test each of these updates (required) Successfully run yarn test and forge test -v --match-contract Test to test all the new foundry-based unit tests

Does this pull request close any open issues? https://github.com/livepeer/protocol/issues/576

Checklist:

coveralls commented 2 years ago

Pull Request Test Coverage Report for Build 2663238582


Files with Coverage Reduction New Missed Lines %
contracts/libraries/MathUtils.sol 2 50.0%
contracts/libraries/PreciseMathUtils.sol 2 50.0%
contracts/libraries/SortedDoublyLL.sol 6 87.14%
<!-- Total: 10 -->
Totals Coverage Status
Change from base Build 2556706908: -2.0%
Covered Lines: 768
Relevant Lines: 781

💛 - Coveralls
RiccardoBiosas commented 2 years ago

Ah actually it would be great to add additional tests for the reduced coverage - https://coveralls.io/builds/50828602 Should be small only

The only reason why the coverage dropped is because the package solidity-coverage is not currently taking into account the foundry tests - unlike the previous truffle-based tests run via runSolidityTest.js. Foundry has recently added a coverage feature in one of its latest 2.x releases but we cannot upgrade to it right away due to this issue in the way foundry 2.x handles L2 networks: once the issue will be addressed I think we can fix the 'fake' coverage drop.