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

chore: silence contract init code size error by default #5094

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions config/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ pub enum SolidityErrorCode {
/// Warning that contract code size exceeds 24576 bytes (a limit introduced in Spurious
/// Dragon).
ContractExceeds24576Bytes,
/// Warning after shanghai if init code size exceeds 49152 bytes
ContractInitCodeSizeExceeds49152Bytes,
/// Warning that Function state mutability can be restricted to [view,pure]
FunctionStateMutabilityCanBeRestricted,
/// Warning: Unused local variable
Expand Down Expand Up @@ -143,6 +145,7 @@ impl SolidityErrorCode {
let s = match self {
SolidityErrorCode::SpdxLicenseNotProvided => "license",
SolidityErrorCode::ContractExceeds24576Bytes => "code-size",
SolidityErrorCode::ContractInitCodeSizeExceeds49152Bytes => "init-code-size",
SolidityErrorCode::FunctionStateMutabilityCanBeRestricted => "func-mutability",
SolidityErrorCode::UnusedLocalVariable => "unused-var",
SolidityErrorCode::UnusedFunctionParameter => "unused-param",
Expand Down Expand Up @@ -176,6 +179,7 @@ impl From<SolidityErrorCode> for u64 {
SolidityErrorCode::UnnamedReturnVariable => 6321,
SolidityErrorCode::Unreachable => 5740,
SolidityErrorCode::PragmaSolidity => 3420,
SolidityErrorCode::ContractInitCodeSizeExceeds49152Bytes => 3860,
SolidityErrorCode::Other(code) => code,
}
}
Expand All @@ -200,6 +204,7 @@ impl FromStr for SolidityErrorCode {
"unused-param" => SolidityErrorCode::UnusedFunctionParameter,
"unused-var" => SolidityErrorCode::UnusedLocalVariable,
"code-size" => SolidityErrorCode::ContractExceeds24576Bytes,
"init-code-size" => SolidityErrorCode::ContractInitCodeSizeExceeds49152Bytes,
"shadowing" => SolidityErrorCode::ShadowsExistingDeclaration,
"func-mutability" => SolidityErrorCode::FunctionStateMutabilityCanBeRestricted,
"license" => SolidityErrorCode::SpdxLicenseNotProvided,
Expand All @@ -219,6 +224,7 @@ impl From<u64> for SolidityErrorCode {
match code {
1878 => SolidityErrorCode::SpdxLicenseNotProvided,
5574 => SolidityErrorCode::ContractExceeds24576Bytes,
3860 => SolidityErrorCode::ContractInitCodeSizeExceeds49152Bytes,
2018 => SolidityErrorCode::FunctionStateMutabilityCanBeRestricted,
2072 => SolidityErrorCode::UnusedLocalVariable,
5667 => SolidityErrorCode::UnusedFunctionParameter,
Expand Down
1 change: 1 addition & 0 deletions config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1771,6 +1771,7 @@ impl Default for Config {
ignored_error_codes: vec![
SolidityErrorCode::SpdxLicenseNotProvided,
SolidityErrorCode::ContractExceeds24576Bytes,
SolidityErrorCode::ContractInitCodeSizeExceeds49152Bytes,
],
deny_warnings: false,
via_ir: false,
Expand Down