Submitted by deth, also found by rokinot, gkrastenov, merlin, Testerbot, 0xDetermination, 3agle, aycozynfada, Flora, KrisApostolov, berlin-101, santipu_, twicek, sl1, 0xpiken, Brenzee, rvierdiiev, tapir, HChang26, Satyam_Sharma, mahdirostami, and said
Whenever a new Prime token is created, the users stakedAt is reset to 0. This happens when the user claim a revocable token and when he is issue a revocable token, but it does not happen when a user is issue an irrevocable token.
This is issue()
We can see that when a revocable token is issued and minted the users stakedAt is reset to 0. Whenever a users token is upgraded, his stakedAt has already been reset to 0 inside claim.
The only one time when we dont reset the users stakedAt and its when he is issued an irrevocable token.
Lets see an example and see why this is a problem:
Her tx goes through, since her stakedAt wasnt reset to 0 when she got issued her irrevocable token.
This way, Alice claimed a revocable token without having any XVS staked in the contract.
Add the following line at the top of tests/hardhat/Prime/Prime.ts. Well use this to simulate time passing
Paste the following inside tests/hardhat/Prime/Prime.ts and run npx hardhat test tests/hardhat/Prime/Prime.ts.
If you are having trouble running the test, this change might fix it. Inside Prime.sol, burn() remove the access control from the function. This doesnt change the attack and the test outcome.
Hardhat
Reset the users stakedAt whenever he is issued an irrevocable token.
chechu (Venus) confirmed and commented:
0xDjango (Judge) commented:
