manifoldfinance / mevETH2

mevETH LST Protocol - Repo has migrated see link
https://github.com/MEV-Protocol/meveth
27 stars 2 forks source link

Improve test coverage #12

Closed sandybradley closed 1 year ago

sandybradley commented 1 year ago

Feature request

Reach 100 % test coverage for MevEth.

Coverage summary

File % Lines % Statements % Branches % Funcs
src/MevEth.sol 93.02% (120/129) 93.48% (129/138) 76.09% (35/46) 93.10% (27/29)
src/MevEthRateProvider.sol 0.00% (0/1) 0.00% (0/2) 100.00% (0/0) 0.00% (0/1)
src/MevEthShareVault.sol 100.00% (1/1) 100.00% (1/1) 100.00% (0/0) 50.00% (1/2)
src/WagyuStaker.sol 50.00% (6/12) 50.00% (6/12) 33.33% (2/6) 50.00% (1/2)
src/libraries/Auth.sol 0.00% (0/4) 0.00% (0/4) 100.00% (0/0) 0.00% (0/4)

Coverage debug

Uncovered for src/MevEth.sol:

Uncovered for src/MevEthRateProvider.sol:

Uncovered for src/MevEthShareVault.sol:

Uncovered for src/WagyuStaker.sol:

Anchors for Contract "WagyuStaker" (solc 0.8.20+commit.a1b79de6.Linux.gcc, source ID 25):

Anchors for Contract "MevEthShareVault" (solc 0.8.20+commit.a1b79de6.Linux.gcc, source ID 24):

Anchors for Contract "MevEth" (solc 0.8.20+commit.a1b79de6.Linux.gcc, source ID 22):

Anchors for Contract "MevETHRateProvider" (solc 0.8.20+commit.a1b79de6.Linux.gcc, source ID 23):

ControlCplusControlV commented 1 year ago

Imo we should wait until we get further along in MVP before looking at coverage

sambacha commented 1 year ago

I would not trust Foundry's "coverage" at all to be honest. It has a few issues.

Vault and Admin have the highest tests so far.

What we should see is what we can accomplish and what should we ask hexens/auditors to write, this way we are not putting time and effort unnecessarily.

The testing suite currently has this listed (forge test -l)

Testing Suite:

test/Deploy.t.sol
  DeployTest
    testDeploy

test/attacks/ReentrancyAttack.sol
  ReentrancyAttackTest
    testAttack

test/unit/Admin.t.sol
  MevAdminTest
    testAddAdmin
    testAddOperator
    testCancelUpdateMevEthShareVault
    testCancelUpdateStakingModule
    testCommitUpdateMevEthShareVault
    testCommitUpdateStakingModule
    testDeleteAdmin
    testDeleteOperator
    testFinalizeUpdateMevEthShareVault
    testFinalizeUpdateStakingModule
    testInitMevEth
    testNegativeAddAdmin
    testNegativeAddOperator
    testNegativeCancelCommitUpdateMevEthShareVault
    testNegativeCancelCommitUpdateStakingModule
    testNegativeCommitUpdateMevEthShareVault
    testNegativeCommitUpdateStakingModule
    testNegativeDeleteAdmin
    testNegativeDeleteOperator
    testNegativeFinalizeCommitUpdateMevEthShareVault
    testNegativeFinalizeCommitUpdateStakingModule
    testNegativeInitMevEth
    testNegativePauseStaking
    testNegativeRecoverTokenFromMevEthShareVault
    testNegativeRecoverTokenFromStakingModule
    testNegativeUnpauseStaking
    testPauseStaking
    testRecoverTokenFromMevEthShareVault
    testRecoverTokenFromStakingModule
    testUnpauseStaking
    testUpdateToMevEthShareVault

test/unit/ERC4626.t.sol
  ERC4626Test
    testAsset
    testBasicRedemption
    testBasicWithdrawal
    testCanRedeemWithApproval
    testCanWithdrawWithApproval
    testCannotWithdrawWithoutApproval
    testDepositFailsBelowMinimum
    testFuzzMaxMint
    testFuzzMint
    testFuzzRedeem
    testFuzzSimpleDeposit
    testMaxDeposit
    testMaxRedeem
    testMaxWithdraw
    testNegativeMintBelowMinimum
    testNegativeRedeemStealWithoutApproval
    testPreviewDeposit
    testPreviewMint
    testPreviewRedeem
    testPreviewWithdraw
    testSimpleDeposit
    testSimpleMint

test/unit/LayerZero.t.sol
  LayerZeroTest
    testSendFrom

test/unit/LayerZeroPigeon.t.sol
  LayerZeroPigeonTest
    testSendFromPigeon

test/unit/Rewards.t.sol
  MevRewardsTest
    testGrantRewards
    testGrantRewardsFromMultisig

test/unit/Validator.t.sol
  ValidatorTest
    testCreateValidator
    testNegativeCreateValidator
    testUpdateToWagyuStakingModule

test/unit/ValidatorRefund.t.sol
  MevValidatorRefundTest
    testGrantValidatorWithdraw
sandybradley commented 1 year ago

Covered here: https://github.com/manifoldfinance/mevETH2/issues/1