59034 sc insight islogassets parameter of the logtrace function will always be set to true and can be removed

Submitted on Nov 7th 2025 at 22:58:40 UTC by @Tadev for Audit Comp | Firelight

  • Report ID: #59034

  • Report Type: Smart Contract

  • Report severity: Insight

  • Target: https://github.com/firelight-protocol/firelight-core/blob/main/contracts/FirelightVault.sol

  • Impacts:

Description

Brief/Intro

The internal _logTrace function is called whenever total supply and/or total assets are modified:

  • in _depositFunds function, called by deposit and mint functions

  • in redeem and withdraw functions

The _logTrace function is defined as follows:

    function _logTrace(
        address owner,
        uint256 balance,
        uint256 _totalSupply,
        uint256 _totalAssets,
        // @audit INSIGHT parameter not needed
        bool isLogAssets
    ) private {
        uint48 ts = Time.timestamp();
        _traceBalanceOf[owner].push(ts, balance);
        _traceTotalSupply.push(ts, _totalSupply);

        if (isLogAssets) _traceTotalAssets.push(ts, _totalAssets);
    }

The last parameter, isLogAssets, is actually not needed as it will always be set to true during deposits and withdrawals.

Vulnerability Details

All functions that call _logTrace pass true for the last parameter:

in _depositFunds:

in redeem:

in withdraw:

Hence, this parameter should be removed and _logTrace` could be simplified:

Impact Details

This is an insight highlighting a small logical error with an unneeded parameter.

Proof of Concept

Proof of Concept

Please create a poc.js file in the test folder and copy paste the following code:

This tests shows a user that deposits a few times, and then redeems and withdraw. Between each step, totalAssetsAt is called to see if _traceTotalAssets has been updated. No matter what action the user does, _traceTotalAssets is updated, because the bool isLogAssets is always true.

Was this helpful?