Contract fails to deliver promised returns, but doesn't lose value
Description
Description
Summary
maxMint() is intended to return the maximum number of shares mintable via mint() without exceeding depositLimit. However, maxMint() converts the full depositLimit into shares and then subtracts the existing totalSupply, instead of deriving the maximum shares from the remaining asset capacity. Once totalAssets > totalSupply, this can cause maxMint() to return more shares than the vault can actually accept, causing mint(maxMint(receiver), receiver) to revert with DepositLimitExceeded().
mint() later converts the returned share amount back into assets using Math.Rounding.Ceil, then checks the result against depositLimit:
Solidity
if (_totalAssets > depositLimit) revert DepositLimitExceeded();
Root cause.maxMint() computes its share limit from the entire depositLimit, converted at the vault's current share price, and only then subtracts totalSupply. This is not equivalent to computing the share limit directly from the remaining capacity (depositLimit - totalAssets) due to the vault's conversion formula and rounding. This can cause the floored result to exceed the number of shares the vault can actually accept, which the subsequent ceil-rounded mint() then exposes as a revert.
Impact
This violates the EIP-4626 requirement that maxMint() return a share amount mint() can accept without reverting in the same transaction (EIP-4626). Impact is limited to a reverted mint() call and inaccurate deposit-capacity reporting for integrators.
Recommendation
Derive maxMint() directly from the remaining asset capacity:
L-03 PoC — maxMint() can return more shares than the vault can actually accept
--- Deterministic reproduction ---
totalSupply = 900000
totalAssets = 990000
depositLimit = 1000000
remainingCapacity = 10000
--- maxMint() result ---
maxMint() = 9091 shares
assets required = 10001 assets
remaining capacity = 10000 assets
overshoot = 1 assets
--- Calling mint(maxMint()) ---
mint(maxMint()) = reverted with DepositLimitExceeded
--- Randomized fuzz validation ---
tested states = 60
mint(maxMint()) reverts = 20/60 = 33.33%
largest overshoot = 1 asset units
1:1 control group = 0/6 hits
Note: The randomized fuzzing results may vary between runs because the test uses randomly generated states. The deterministic reproduction should produce the same result.
The original report as published on Immunefi, by TrynX. Images and videos are our own copies; raw HTML is shown as text. View it on Immunefi.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Generating the AI write-up for this report.
This usually takes about 50 seconds. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
What is known
A low-severity business logic bug in https://github.com/immunefi-team/audit-comp-firelight/blob/v1\\_audit\\_ready/contracts/core/FirelightVault.sol. Immunefi made it public on 24 August 2026.
About Business logic
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Generating the AI write-up for this report.
This usually takes about 50 seconds. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
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.