Proposals can never get created due to reaching block.gaslimit
The function
proposeBasketLicense
allows initializing proposals of with arbitrary amount of tokens.
However, createBasket stage involves the actual transfers. Since each
unique token in the list undergoes a safeApprove, which would cost at
least 22,100 gas (for zero to non-zero sstore update). Taking this
alone would mean that having a token list of size 1300 would exceed
the current block gas limit. This number would in practice be even lower
when including other calls.
Recommended Mitigation Steps
Try to measure the cost of proposeBasketLicense for n tokens and
try to estimate n that exceeds the current block gas limit.
Hardcode this value (or lower) in proposeBasketLicense with a
require(tokens.length < n).
This would more or less guarantee that each proposed basket can be
created.
Handle
hrkrshnn
Vulnerability details
Proposals can never get created due to reaching
block.gaslimit
The function proposeBasketLicense allows initializing proposals of with arbitrary amount of tokens. However,
createBasket
stage involves the actual transfers. Since each unique token in the list undergoes asafeApprove
, which would cost at least22,100
gas (for zero to non-zero sstore update). Taking this alone would mean that having a token list of size1300
would exceed the current block gas limit. This number would in practice be even lower when including other calls.Recommended Mitigation Steps
proposeBasketLicense
forn
tokens and try to estimaten
that exceeds the current block gas limit.proposeBasketLicense
with arequire(tokens.length < n)
.This would more or less guarantee that each proposed basket can be created.