DeFiHardhat
35,000 USDC
View results
Submission Details
Severity: low
Invalid

Transaction reversion in LibWellBdv::bdv when deltaLPTokenSupply is zero

Summary

Here, _bdv is a calculated value based on amount (the input amount of tokens) and deltaLPTokenSupply (the change in the supply of liquidity pool tokens, derived from other contract interactions).
// Initial LP Token Supply
uint lpTokenSupplyBefore = 1000;

// After some operations, let's assume it stays the same
uint lpTokenSupplyAfter = 1000;

// Therefore, delta is zero
uint deltaLPTokenSupply = lpTokenSupplyBefore - lpTokenSupplyAfter; // 0

uint amount = 500;
uint _bdv = amount.mul(BEAN_UNIT).div(deltaLPTokenSupply); // division by zero

Vulnerability Details

Here, _bdv is a calculated value based on amount (the input amount of tokens) and deltaLPTokenSupply (the change in the supply of liquidity pool tokens, derived from other contract interactions).

// Initial LP Token Supply
uint lpTokenSupplyBefore = 1000;

// After some operations, let's assume it stays the same
uint lpTokenSupplyAfter = 1000;

// Therefore, delta is zero
uint deltaLPTokenSupply = lpTokenSupplyBefore - lpTokenSupplyAfter; // 0

uint amount = 500;
uint _bdv = amount.mul(BEAN_UNIT).div(deltaLPTokenSupply); // division by zero

Impact

Transaction Reversion

Tools Used

Manual Review

Recommendations

+ require(deltaLPTokenSupply > 0, "No change in LP token supply");

Updates

Lead Judging Commences

giovannidisiena Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Other
Assigned finding tags:

Informational/Invalid

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.