Sub-optimal calls should be allowed instead of reverted as resending the transaction will cost more gas #116
Labels
bug
Something isn't working
G (Gas Optimization)
resolved
Finding has been patched by sponsor (sponsor pls link to PR containing fix)
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Handle
WatchPug
Vulnerability details
In the current implementation, when
_unlockBatch()
is called withtokenIds_.length == 1
, the transaction will be reverted with an errorUSE_UNLOCK
.Even though it's sub-optimal to use
relockBatch()
andunlockBatch()
for only 1 tokenId, reverting and requiring the user to resend the transaction to another method still costs more gas than allowing it.Therefore, we sugguest not to revert in
_unlockBatch()
whentokenIds_.length == 1
.https://github.com/XDeFi-tech/xdefi-distribution/blob/3856a42df295183b40c6eee89307308f196612fe/contracts/XDEFIDistribution.sol#L320-L328
Recommendation
Change to:
The text was updated successfully, but these errors were encountered: