#59559 [SC-Low] period calculation does not use provided timestamp in periodattimestamp
Submitted on Nov 13th 2025 at 14:42:17 UTC by @sahuang for Audit Comp | Firelight
Report ID: #59559
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
Summary
The periodAtTimestamp() function contains a logic error where it uses the current block timestamp instead of the provided timestamp parameter when calculating period numbers. This causes two potential failure modes:
Underflow Reverts: When querying future timestamps before the epoch is reached, the function reverts with an arithmetic underflow
Silent Incorrect Returns: When querying future timestamps after the epoch is reached, the function returns an incorrect period number based on current time instead of the requested timestamp
Both failures break the contract's ability to provide accurate period information, and this falls in the "Contract fails to deliver promised returns, but doesn't lose value" low-severity impact.
Finding Description
The vulnerability exists in the interaction between two functions:
periodAtTimestamp(uint48 timestamp):
_sinceEpoch(uint48 epoch):
The _sinceEpoch() function ignores the caller-supplied timestamp parameter and always uses Time.timestamp() (current block time). This creates an incorrect calculation path.
Impact
As discussed above, the function returns incorrect value and satisfies the low severity criteria.
Recommendation
Modify _sinceEpoch() to accept and use the actual timestamp parameter:
Then update respective callers.
Proof of Concept
Proof of Concept
We update period_update.js and add another test under describe('Period update test', function() section:
Running the test would fail. This demonstrates a different return value is from expected value.
Was this helpful?