Skip to content

maxDeposit() implements a upper bound: test fails with "The vm.assume cheatcode rejected too many inputs" #3

@bmarcot

Description

@bmarcot

We are integrating the property test suite as part of the verification of our vault contracts. Unfortunately all tests are failing with the following error:

Test result: FAILED. 0 passed; 1 failed; finished in 15.18s

Failing tests:
Encountered 1 failing test in contracts/test/ERC4626StdTest.sol:ERC4626StdTest
[FAIL. Reason: The `vm.assume` cheatcode rejected too many inputs (65536 allowed)] test_maxDeposit((address[4],uint256[4],uint256[4],int256)) (runs: 22, μ: 447892, ~: 465089)

Encountered a total of 1 failing tests, 0 tests succeeded

I figured that the problem might be related to the fixed upper boud in the maxDeposit() of the function. The function is implemented to limit the number of assets in the vault. Removing the bound let the test pass, but it does not make sense w.r.t to the contract's logic.

function maxDeposit(address) public view override returns (uint256) {
    if (totalAssets() > MAX_TOTAL_ASSETS) {
        return 0;
    }
    return MAX_TOTAL_ASSETS - IERC20(asset()).balanceOf(address(this));
}

Is it possible to bound the "assets" value in fuzzer? For example, an input of 4888566203988820057829237745407778857278425300380918631855130364758515 does not make sense in our case.

[470198] ERC4626StdTest::test_maxDeposit(([0xabAde514b7e828bD42Cb5272b26F2ebBbDa794F0, 0x5D32577cCD88F4c9D850dAD9D4A28ec7F23D963e, 0x683eF4386bbec40e87bF86e2181193Cf91c495AD, 0xbE411Fe80fd84Fe87F69b5356Bd74f8Ce5276EEf], [22698694737177962168034904413051506502332361420, 4888566203988820057829237745407778857278425300380918631855130364758515, 56852593677044934, 32556299], [2692848953710946714442091, 0, 17461643070425363004, 5566649], 0))

Thanks!

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