Giter Site home page Giter Site logo

erc4626-tests's People

Contributors

daejunpark avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

erc4626-tests's Issues

Use previewMint + mint in setUpVault

uint shares = init.share[i];
try IMockERC20(_underlying_).mint(user, shares) {} catch { vm.assume(false); }
_approve(_underlying_, user, _vault_, shares);
vm.prank(user); try IERC4626(_vault_).deposit(shares, user) {} catch { vm.assume(false); }

The tests are assuming the vault starts at 1:1 price. The following would be more general:

uint shares = init.share[i];
uint assets = IERC4626(_vault_).previewMint(shares);
try IMockERC20(_underlying_).mint(user, assets) {} catch { vm.assume(false); } 
_approve(_underlying_, user, _vault_, assets); 
vm.prank(user); try IERC4626(_vault_).mint(shares, user) {} catch { vm.assume(false); } 

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

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.