You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Both are exiting rETH/WETH pool in BPT_IN_FOR_EXACT_TOKENS_OUT mode with the same minAmountsOut in the exitPoolRequest as well amountsOut encoded in the user encoded data of the BPT_IN_FOR_EXACT_TOKENS_OUT mode. (format: [BPT_IN_FOR_EXACT_TOKENS_OUT, amountsOut, maxBPTAmountIn] )
First one succeeds because it is withdrawing 1.0 rETH and the second one fails because it is withdrawing 0.8123 rETH. Both have been given sufficient BPT in the encoded request so that is not the issue. This require in the code is the one that triggers the exception. Using Tenderly Evaluate to see the value of variables in the execution:
from the above debugger it is evident that the actual change is off by 1 WEI from the limit number that has been passed in the request. And because it is smaller than the minAmountsOut the transaction fails.
The text was updated successfully, but these errors were encountered:
Rounding in pool's favor is on purpose; at some point the math inside the pools is not perfectly accurate (e.g. when upscaling and downscaling), and that means that the calculated amounts might be off with respect to a scenario with no precision loss.
To prevent the txs from failing, I'd suggest being more permissive with the minimum amounts in or out in general. Some wei won't make any economic difference in practice, but will help the txs go through when the rounding happens. You can query the swaps before executing them too.
Problem:
When exiting the pool using BPT_IN_FOR_EXACT_TOKENS_OUT I've encountered accuracy issues that seem like a rounding error.
Reproduction
See these 2 tenderly transactions where 1st one succeeds and 2nd one fails.
Both are exiting rETH/WETH pool in BPT_IN_FOR_EXACT_TOKENS_OUT mode with the same
minAmountsOut
in the exitPoolRequest as wellamountsOut
encoded in the user encoded data of theBPT_IN_FOR_EXACT_TOKENS_OUT
mode. (format: [BPT_IN_FOR_EXACT_TOKENS_OUT, amountsOut, maxBPTAmountIn] )First one succeeds because it is withdrawing 1.0 rETH and the second one fails because it is withdrawing 0.8123 rETH. Both have been given sufficient BPT in the encoded request so that is not the issue. This require in the code is the one that triggers the exception. Using Tenderly Evaluate to see the value of variables in the execution:
from the above debugger it is evident that the actual change is off by 1 WEI from the limit number that has been passed in the request. And because it is smaller than the
minAmountsOut
the transaction fails.The text was updated successfully, but these errors were encountered: