Incorrect number of seconds in ONE_YEAR variable
The ONE_YEAR constant in a smart contract was set to 31,557,600 seconds instead of the correct 31,536,000, making it slightly too long. This incorrect value was used in vote-related functions, which could negatively affect users.
Submitted by jayjonah8
In HolyPaladinToken.sol the ONE_YEAR variable claims that there are 31557600 seconds in a year when this is incorrect. The ONE_YEAR variable is used in the getCurrentVotes() function as well as the getPastVotes() function so it is vital that the correct time in seconds be used as it can effect users negatively.
Proof of Concept
86,400 seconds in a day x 365 = 31_536_000
Recommended Mitigation Steps
The correct number of seconds in a year is 31_536_000 so the ONE_YEAR variable should be changed to ONE_YEAR = 31_536_000
Kogaroshi (Paladin) confirmed, resolved, and commented:
An incorrect value for MONTH was used, leading to all temporal constants (YEAR, max lock time, etc …) to be incorrect. All values were fixed in: PaladinFinance/Paladin-Tokenomics#3.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely a typo or miscalculation when defining the ONE_YEAR constant, which then propagated to other time-based constants.
Impact
The incorrect duration could negatively affect users of the vote functions, though the text does not specify the exact harm.
What the attacker needed
None
The fix
The constant was fixed to the correct value of 31,536,000 seconds, and all related temporal constants were corrected.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A smart contract is a program that runs on a blockchain. It used a wrong number for how many seconds are in a year, so any timing based on that number was slightly off. This could affect when votes are counted or how long users must wait.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.