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

Contract size warning missing a crucial bit of information required in order to fix it #12171

Closed
barakman opened this issue Oct 21, 2021 · 5 comments · Fixed by #12177
Closed

Comments

@barakman
Copy link

Abstract

When a contract exceeds the maximum size (24K), it would be very helpful to know the actual size of that specific contract.

Motivation

Allowing the developer to perform a more efficient process of reducing the "rogue" contract.

Specification

In https://github.com/ethereum/solidity/blob/develop/libsolidity/interface/CompilerStack.cpp#L1241-L1255, change this:

"Contract code size exceeds 24576 bytes (a limit introduced in Spurious Dragon). "
"This contract may not be deployable on mainnet. "
"Consider enabling the optimizer (with a low \"runs\" value!), "
"turning off revert strings, or using libraries."

To I guess something like this:

(
    string("Contract code size = ") +
    std:to_string(compiledContract.runtimeObject.bytecode.size()) +
    " > 24576 bytes (a limit introduced in Spurious Dragon). "
    "This contract may not be deployable on mainnet. "
    "Consider enabling the optimizer (with a low \"runs\" value!), "
    "turning off revert strings, or using libraries."
).c_str()

Thanks :)

@cameel
Copy link
Member

cameel commented Oct 21, 2021

True, the message would be more informative with the size included.

@cameel cameel added this to New issues in Solidity via automation Oct 21, 2021
@cameel cameel moved this from New issues to Implementation Backlog in Solidity Oct 21, 2021
@barakman
Copy link
Author

Thank you @cameel... Why 'good first issue' though? I've been posting issues here since v0.4 :)

@cameel
Copy link
Member

cameel commented Oct 21, 2021

Haha, it's not saying that it's first issue reported by you but that it's a good candidate to be picked as a first issue by a contributor :) With this label it will appear under https://github.com/ethereum/solidity/contribute and we have Hacktoberfest now so there's a high change that someone will pick it up soon. That's generally a good thing because these easy issues do not usually have a high priority (there are just too many of them).

@BoyanP
Copy link

BoyanP commented Oct 22, 2021

Could i pick this one up? @cameel

@cameel
Copy link
Member

cameel commented Oct 22, 2021

Looks like we already have a PR for this (#12177).

Solidity automation moved this from Implementation Backlog to Done Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Solidity
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants