code-423n4 / 2021-04-vader-findings

1 stars 0 forks source link

Vader.sol secondsPerEra Is Currently Initiaalized To One Second Instead Of One Day #192

Closed code423n4 closed 3 years ago

code423n4 commented 3 years ago

Handle

jvaqa

Vulnerability details

Impact

Vader.sol secondsPerEra Is Currently Initialized To One Second Instead Of One Day

Vader comments and documentation describe an "era" as taking one calendar day, which is 86400 seconds. However, in Vader.sol, secondsPerEra is currently initialized to one second. This will cause the first call of every single block to Vader._transfer() to make the gas-intensive subcall to _checkEmission(). This will also increment the currentEra counter incredibly quickly.

Proof of Concept

Vader.sol's constructor includes this line of code: secondsPerEra = 1; //86400;

Recommended Mitigation Steps

Change this: secondsPerEra = 1; //86400;

To this: secondsPerEra = 86400;

dmvt commented 3 years ago

duplicate of #155