calcMint always return poolId=0 and idx=0
The calcMint function in Zap.sol always returns poolId=0 and idx=0, contrary to its documentation which says it should return the most optimal route. This leads to suboptimal zap operations.
Submitted by gzeon
Impact
calcMint in Zap.sol always return poolId=0 and idx=0, while the docstring specified it should return the most optimal route instead. This will lead to suboptimal zap.
Proof of Concept
GalloDaSballo (BadgerDAO) commented:
Given the context that the warden has, the finding is valid, we’re missing two functions for
calcMintAs for us, we have shifted to only using pool 0 as such the code works fine for us
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the function lacks the logic to evaluate different pools and indices, so it defaults to zero.
Impact
Users may receive suboptimal zap results, but the system still functions for pool 0.
What the attacker needed
None
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A smart contract function that is supposed to pick the best way to convert tokens always picks the first option instead. This means users might get a worse deal than possible, but the code still works.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.