Possible out of gas error during claiming #428
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate-552
satisfactory
satisfies C4 submission criteria; eligible for awards
Lines of code
https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/Quest.sol#L94-L118
https://github.com/rabbitholegg/quest-protocol/blob/8c4c1f71221570b14a0479c216583342bd652d8d/contracts/RabbitHoleReceipt.sol#L106-L135
Vulnerability details
Impact
User might buy huge amount of tokens and executing
claim()
function will be cost a lot of gas and it will be too expensive and possible to get out of gas error.Or even the transaction may not fit in the block.
Proof of Concept
Let's consider function
claim
andQuest
contract.rabbitHoleReceiptContract
In point 3 and point 4 we may iterates over unbounding amount of tokens. Which might lead to out of gas error.
Tools Used
Manual audit
Recommended Mitigation Steps
add
threshold
parameter toclaim
function, and togetOwnedTokenIdsOfQuest
function.If processed tokens reach threshold parameter interrupt iteration and process fetched tokens.
The text was updated successfully, but these errors were encountered: