Skip to content

Balancer withdrawal fuzzing test #1791

@sparrowDom

Description

@sparrowDom

This is the main PR for creating a Balancer Metapool strategy. And when withdrawing from the strategy, the strategy contract withdraws funds from the Balancer Pool. We've identified an issue where the Balancer pool would under-deliver the funds requested by the exit pool request.

For that reason we leave the exit pool's request for min amount of tokens empty and only specify min amounts of tokens in the encoded user data request. As described in the linked issue above, if min expected token arrays on withdrawal are populated in both places the transaction reverts in some cases.

To mitigate the issue further, we also overshoot the required withdrawal amounts by 2 wei so that 1 WEI rounding error from Balancer doesn't revert the strategy's withdrawal transaction.

We would like to confirm that withdrawing rETH and stETH with different values don't cause the withdraw transaction to reverts. Withdrawing stETH could potentially be another source of problems since we are withdrawing wstETH from the pool and unwrapping it. Multiple rounding errors (Balancer pool + unwrapping) could cause larger than 2 WEI rounding error and revert the transaction.

We have some fork tests for withdrawing from wstETH pool and rETH pool. These are tests with hand-picked values, and if we could convert those to proper fuzzing tests we'd gain a lot greater amount of certainty that no combination of values would cause our transactions to revert.

Metadata

Metadata

Assignees

No one assigned

    Labels

    OETHOETH related thingscontractsWorks related to contracts

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions