Contract fails to deliver promised returns, but doesn't lose value
Description
Brief/Intro
The vault’s periodAtTimestamp(timestamp) ignores its input timestamp argument and computes using the current block time. This yields incorrect period numbers for historicalqueries, can mis-schedule accounting tied to periods, and enables unfairness between users whose actions are recorded in different periods than intended.
Vulnerability Details
Concrete math with the PoC’s numbers:
Initial config: epoch = 100, duration = 10
Later config: at epoch = 160, duration becomes 20 (unrelated to the bug but present in the PoC)
Now = current time: 150
Query: periodAtTimestamp( t = 115)
Returned (buggy): starting + (now − epoch)/duration = 0 + (150 − 100)/10 = 5 period