Redundant Slippage Check in compound Function
The compound function in the MoneyBrinter contract contains a slippage check on islandTokensMinted that duplicates a check already performed by the Kodiak router. This redundancy adds unnecessary code complexity and gas overhead, but does not create a security vulnerability.
Originally disclosed on Immunefi
- Disclosed after under an hour
#42487 [SC-Insight] Redundant Slippage Check in `compound` Function
Submitted on Mar 24th 2025 at 09:14:50 UTC by @Bluedragon for Audit Comp | Yeet
- Report ID: #42487
- Report Type: Smart Contract
- Report severity: Insight
- Target: https://github.com/immunefi-team/audit-comp-yeet/blob/main/src/contracts/MoneyBrinter.sol
- Impacts:
Description
Summary:
The compound function in the MoneyBrinter contract includes a redundant slippage check for islandTokensMinted. This check is already performed in the Kodiak router during the swap process, making it redundant check and useless gas consumption. Removing this check will simplify the code without affecting functionality and gas optimized.
Vulnerability Details:
In the compound function, the following check is performed:
require(islandTokensMinted >= stakingParams.amountSharesMin, "MoneyBrinter: not enough island tokens minted");
- Issue: This check ensures that the amount of
islandTokensMintedmeets the minimum required amount (amountSharesMin) to prevent slippage. However, this check is redundant because the Kodiak router already performs the same slippage check during the swap process. - Root Cause: The slippage check is duplicated in both the
MoneyBrintercontract and the Kodiak router, leading to unnecessary code complexity.
Impact:
- Code Complexity: The redundant check adds unnecessary code complexity to the
compoundfunction. - Gas Overhead: The redundant check incurs a extra gas consumption.
Proof of Concept
Proof of Concept:
- Review the
compoundfunction in theMoneyBrintercontract. - Observe the redundant slippage check for
islandTokensMinted. - As you as see the Kodiak router._addLiquidity already performs the same slippage check during the swap process.
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 developer added a slippage check without realising the external router already enforces the same condition.
Impact
The redundant check adds unnecessary code complexity and extra gas consumption, but does not create a security vulnerability.
What the attacker needed
None
The fix
The redundant slippage check should be removed to simplify the code and save gas.
How it was found
- Review the compound function in the MoneyBrinter contract.
- Observe the redundant slippage check for islandTokensMinted.
- Check the Kodiak router's _addLiquidity function, which already performs the same slippage check.
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.
This report points out that a smart contract function repeats a safety check that another part of the system already does. The repeated check wastes a little gas and makes the code longer, but it does not let an attacker do anything harmful. It is more of a code quality note than a security bug.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.