This repository has been archived by the owner on Oct 27, 2024. It is now read-only.
SilverChariot - Time calculation issues with exponential decay #282
Labels
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
Medium
A valid Medium severity issue
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Won't Fix
The sponsor confirmed this issue will not be fixed
SilverChariot
medium
Time calculation issues with exponential decay
Summary
OCE_ZVE is a locker that distributes rewards based on a exponential decay model. When a distribution starts, the whole balance of the contract should be unclaimable. As time moves forward, more and more of it should be unlocked for distributing. The calculations are made using the
lastDistribution
variable which is initially set in the constructor and then changed on each distribution. This is problematic because the "idle" periods where no distribution is happening will be considered as passed time when a real distribution starts.Vulnerability Detail
In the constructor, the lastDistribution variable is set to
block.timestamp
.When forwardEmissions() gets called, the calculation
block.timestamp - lastDistribution
will return a large value because the timer has started at the time of deployment.As we can see in the Figma file, the OCE locker will be deployed at
Phase One
and funding will start after ITO ends, which is at least 30 days.This results in a wrong calculation and instead of decaying, a big amount of the rewards can be forwarded as soon as the distribution starts.
The issue persists for further distributions also. If distribution 1 ends on 1 January and the Zivoe team decides to start distribution 2 on 1 July, the rewards for 6 months will be claimable from the very beginning. Clearing the timestamp before a distribution starts is not an option because it requires at least
100e18
assets to be forwarded.Impact
Instead of decaying, a big part of the rewards is claimable from the beginning.
Code Snippet
PoC for Test_OCE_ZVE
Tool used
Foundry
Recommendation
Add a guarded function that start the distribution by updating the timestamp.
The text was updated successfully, but these errors were encountered: