Skip to content
Audit finding Intermediate

Potential reedem rate rounding to zero

The redeem rate calculation for leverage tokens divides before multiplying by precision, causing rounding to zero when TVL is low or bond supply is high. This makes the redeem amount zero and the transaction reverts, preventing users from redeeming.

056Security Follow with 0x23r0, 0x52 and 23 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-12-plaza-finance-judging/issues/864

Found by

056Security, 0x23r0, 0x52, 0xAadi, 0xadrii, Abhan1041, Harry_cryptodev, KiroBrejka, Matin, Negin, OrangeSantra, Ryonen, X0sauce, Z3R0, ZoA, almurhasan, bretzel, carlitox477, denys_sosnovskyi, future, fuzzysquirrel, globalace, robertauditor, solidityenj0yer, stuart_the_minion, super_jack

Summary

Due to bad order of operations, redeem rate can be be rounded down to zero causing transactions reverting in otherwise normal conditions, especially in causes of low TVL value or high bond supply.

Root Cause

Pool::getRedeemAmount() is used to calculate the redeem rate in leverage token types:

Solidity
  function getRedeemAmount(
    ...
  ) public pure returns(uint256) {
    ...
    } else if (tokenType == TokenType.LEVERAGE) {
      redeemRate = ((tvl - (bondSupply * BOND_TARGET_PRICE)) / assetSupply) * PRECISION;
    ...
  }

In cases of low TVL or scenarios where bondSupply makes up a large part of the TVL, the redeemRate in this case will be rounded to zero as the assetSupply will undoubtedly be much larger. This leads to a loss of precision which wrongly calculates the redeem amount as zero, thus leading to the transaction reverting in the _redeem() function:

Solidity
  function _redeem(
   ...
   ) private returns(uint256) {
    // Get amount to mint
    uint256 reserveAmount = simulateRedeem(tokenType, depositAmount);

    // Check whether reserve contains enough funds
    if (reserveAmount < minAmount) {
      revert MinAmount();
    }

    // Reserve amount should be higher than zero
    if (reserveAmount == 0) {
      revert ZeroAmount();
    }

   ...
  }

Internal Pre-conditions

No response

External Pre-conditions

No response

Attack Path

No response

Impact

Inability for users to redeem in low TVL or mostly bonded markets

PoC

No response

Mitigation

Change the order:

Solidity
      redeemRate = ((tvl - (bondSupply * BOND_TARGET_PRICE)) * PRECISION) / assetSupply;

Discussion

sherlock-admin2

The protocol team fixed this issue in the following PRs/commits: https://github.com/Convexity-Research/plaza-evm/pull/159

The original report as published on Sherlock, by 056Security. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

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

The redeem rate calculation performs division before multiplication by PRECISION, causing precision loss that rounds the rate to zero.

Impact

Users cannot redeem their leverage tokens when TVL is low or bond supply is high, as the transaction reverts with a zero amount error.

What the attacker needed

Low TVL or high bond supply

The fix

The order of operations should be changed to multiply by PRECISION before dividing by assetSupply.

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.

When you redeem a token, the system calculates how much you get back using a formula. If the formula divides too early, the result can become zero because of how computers handle decimals. Then the system thinks you are redeeming nothing and refuses the transaction.

More by 056Security

View all

13 more disclosed reports, best first.

More from Plaza Finance

View all

The newest disclosed reports for this program.

Similar reports

Same bug class and techniques, clearest first.