This repository has been archived by the owner on Oct 1, 2023. It is now read-only.
ElKu - User's request for a second rollover will be ignored if his first request is already minted by mintRollover function #402
Labels
Non-Reward
This issue will not receive a payout
ElKu
medium
User's request for a second rollover will be ignored if his first request is already minted by mintRollover function
Summary
The Carousel contract keeps tracks of minted rollovers for each epoch by using a state variable called rolloverAccounting. And
enlistInRollover
function keeps track of each user's rollover details with state variable called rolloverQueue. If there is an entry that already exists for the user, then the new rollover details will be overwritten into the oldrolloverQueue
. This means that the second request for rollover will be ignored, if the minting is already done on the first request. As, as perrolloverAccounting
, that index inrolloverQueue
is already processed.Vulnerability Detail
enlistInRollover
function. Since he is calling this function for the first time, a new entry will be pushed into therolloverQueue
array.mintRollovers
function.rolloverAccounting
array is updated with the latest index processed by themintRollovers
function.mintRollovers
is called, for this specific epochId, the indices less than this saved index will be ignored by this function for minting. This is done here.enlistInRollover
again. This time, since there is an entry already in the name of the user, therolloverQueue
array is updated without pushing a new element into it.mintRollovers
function. But this time, the starting index is past the user'srolloverQueue
index. So his rollover request gets ignored.Impact
Users request for a second rollover will be ignored if his first request is already minted by mintRollover function.
Code Snippet
The following poc was written,
The printed verbose output was:
Tool used
Manual Review, VSCode, Foundry
Recommendation
This needs much deeper changes, as there are many problems with the current logic of the code, as I mentioned in my other submissions.
The text was updated successfully, but these errors were encountered: