Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposals can never get created due to reaching block.gaslimit #235

Open
code423n4 opened this issue Sep 22, 2021 · 1 comment
Open

Proposals can never get created due to reaching block.gaslimit #235

code423n4 opened this issue Sep 22, 2021 · 1 comment
Labels
1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Warden finding sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons

Comments

@code423n4
Copy link
Contributor

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 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

  1. Try to measure the cost of proposeBasketLicense for n tokens and
    try to estimate n that exceeds the current block gas limit.
  2. 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.

@code423n4 code423n4 added 1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Warden finding labels Sep 22, 2021
code423n4 added a commit that referenced this issue Sep 22, 2021
@frank-beard frank-beard added the sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons label Oct 19, 2021
@GalloDaSballo
Copy link
Collaborator

I will keep this finding as valid because it is true

That said in practice this won't happen, so I would recommend the sponsor to know the theoretical limit and not to sweat about it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Warden finding sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Projects
None yet
Development

No branches or pull requests

3 participants