NatSpec Mismatch in CoreVault Redemption Logic
The NatSpec comment for the redeemFromCoreVault function says the number of lots must be larger than the minimum setting, but the code uses a greater-than-or-equal comparison. This mismatch could confuse developers and lead to unnecessary code changes, but it does not create a security vulnerability.
Originally disclosed on Immunefi
- Disclosed after under an hour
#45772 [SC-Insight] NatSpec Mismatch in CoreVault Redemption Logic
Submitted on May 20th 2025 at 10:05:51 UTC by @MyssTeeQue for Audit Comp | Flare | FAssets
- Report ID: #45772
- Report Type: Smart Contract
- Report severity: Insight
- Target: https://github.com/flare-foundation/fassets/blob/main/contracts/assetManager/facets/CoreVaultFacet.sol
- Impacts:
Description
Brief/Intro
In CoreVaultFacet.sol, there is a mismatch between the NatSpec comment and the actual code implementation for the redeemFromCoreVault function. The NatSpec comment states that "the number of lots, must be larger than coreVaultMinimumRedeemLots setting", but the code uses a greater than or equal to (>=) comparison:
Vulnerability Details
//@audit-info natspec says "the number of lots, must be larger than `coreVaultMinimumRedeemLots` setting"
// but the code is using `_lots >= minimumRedeemLots`
require(_lots >= minimumRedeemLots, "requested amount too small");
The code's implementation is actually safer as it:
- Allows redemption at exactly the minimum threshold
- Avoids potential precision issues with strict inequalities
Impact Details
The code is actually more permissive than documented, not less
- Could cause confusion for developers reading the documentation
- Might lead to unnecessary code changes if someone tries to "fix" the code to match docs
Proof of Concept
Proof of Concept
Update the NatSpec comment to accurately reflect the code's behavior and its rationale:
// The number of lots must be greater than or equal to the minimum required lots.
// This allows redemption of exactly the minimum amount while avoiding strict inequality precision issues.
No code changes are needed as the current implementation using >= is the safer approach.
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 NatSpec comment was not updated to match the code's use of a greater-than-or-equal comparison instead of a strict greater-than comparison.
Impact
The mismatch could cause confusion for developers and might lead to unnecessary code changes, but it does not have a security impact.
What the attacker needed
None
The fix
The NatSpec comment should be updated to accurately reflect the code's behaviour and its rationale.
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 is a documentation error in a smart contract. The written description of a function says one thing, but the actual code does something slightly different. No attacker can exploit this; it is just a note that the comment should be corrected.