#59467 [SC-Low] periodattimestamp ignores input parameter
Submitted on Nov 12th 2025 at 15:12:47 UTC by @Orionn for Audit Comp | Firelight
Report ID: #59467
Report Type: Smart Contract
Report severity: Low
Target: https://github.com/firelight-protocol/firelight-core/blob/main/contracts/FirelightVault.sol
Impacts:
Contract fails to deliver promised returns, but doesn't lose value
Description
Brief/Intro
The periodAtTimestamp() view function in FirelightVault.sol completely ignores its input timestamp parameter and always returns the current period instead. This logic error makes historical period queries impossible, breaking analytics systems, off-chain indexers, and any protocol attempting to determine which period a past transaction occurred in. The function's timestamp parameter is entirely non-functional.
Vulnerability Details
Location: contracts/FirelightVault.sol - periodAtTimestamp() function (line 269) and _sinceEpoch() helper (line 916)
Root Cause:
The periodAtTimestamp() function is supposed to calculate which period a given timestamp falls into, but it incorrectly uses the CURRENT timestamp instead of the input parameter:
The Bug:
periodAtTimestamp(timestamp)receives a timestamp parameterIt calls
_sinceEpoch(pc.epoch)which should calculatetimestamp - epochBut
_sinceEpoch()usesTime.timestamp()(current time) insteadResult: The function always returns the current period, regardless of input
Impact Details
1. Historical Analytics Completely Broken
Off-chain systems cannot determine which period past transactions occurred in:
Impact:
Dashboards show incorrect period numbers for historical transactions
Charts/graphs plotting period-based data are meaningless
Reports analyzing period performance use wrong data
2. Indexer/Subgraph Integration Failures
Blockchain indexers (The Graph, etc.) rely on this function to categorize historical events:
Impact:
Event indexing assigns wrong periods to all historical events
Period-based queries return incorrect results
Time-series data is corrupted
Historical snapshots are impossible to reconstruct
3. Integration Protocol Issues
Protocols integrating with FirelightVault cannot analyze historical behavior:
Example Use Case:
Impact:
Risk analysis of period-based withdrawal patterns fails
Trend detection is impossible
Historical comparisons are meaningless
Integration testing based on historical data doesn't work
4. User-Facing Analytics Broken
Users cannot view their historical activity correctly:
Impact:
User dashboards show all historical activity in current period
Personal analytics are meaningless
Transaction history cannot be properly categorized
Tax reporting based on periods is incorrect
5. Function is Completely Useless
The function's entire purpose is defeated:
Reality: The timestamp parameter is completely ignored. This is equivalent to:
References
Affected Contract:
https://github.com/firelight-protocol/firelight-core/blob/main/contracts/FirelightVault.solAffected Function:
periodAtTimestamp()(line 269)Helper Function:
_sinceEpoch()(line 916)
Proof of Concept
Proof of Concept
Test File: test/periodAtTimestamp_poc.js
Test Details:
Run the PoC:
Expected Output:
Was this helpful?