Skip to content
Business logic Audit finding Beginner

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.

jayjonah8 Follow

Originally disclosed on Code4rena

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

HolyPaladinToken.sol#L25

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.


The original report as published on Code4rena, by jayjonah8. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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.

More by jayjonah8

View all

18 more disclosed reports, best first.

More from Paladin - Warden Pledges contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.