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: add new solidity warning code #7007

Merged
Merged
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
7 changes: 7 additions & 0 deletions crates/config/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ impl Error for FoundryConfigError {
pub enum SolidityErrorCode {
/// Warning that SPDX license identifier not provided in source file
SpdxLicenseNotProvided,
/// Warning: Visibility for constructor is ignored. If you want the contract to be
/// non-deployable, making it "abstract" is sufficient
VisibilityForConstructorIsIgnored,
/// Warning that contract code size exceeds 24576 bytes (a limit introduced in Spurious
/// Dragon).
ContractExceeds24576Bytes,
Expand Down Expand Up @@ -158,6 +161,7 @@ impl SolidityErrorCode {
SolidityErrorCode::Unreachable => "unreachable",
SolidityErrorCode::PragmaSolidity => "pragma-solidity",
SolidityErrorCode::Other(code) => return Err(*code),
SolidityErrorCode::VisibilityForConstructorIsIgnored => "constructor-visibility",
};
Ok(s)
}
Expand All @@ -180,6 +184,7 @@ impl From<SolidityErrorCode> for u64 {
SolidityErrorCode::Unreachable => 5740,
SolidityErrorCode::PragmaSolidity => 3420,
SolidityErrorCode::ContractInitCodeSizeExceeds49152Bytes => 3860,
SolidityErrorCode::VisibilityForConstructorIsIgnored => 2462,
SolidityErrorCode::Other(code) => code,
}
}
Expand Down Expand Up @@ -212,6 +217,7 @@ impl FromStr for SolidityErrorCode {
"virtual-interfaces" => SolidityErrorCode::InterfacesExplicitlyVirtual,
"missing-receive-ether" => SolidityErrorCode::PayableNoReceiveEther,
"same-varname" => SolidityErrorCode::DeclarationSameNameAsAnother,
"constructor-visibility" => SolidityErrorCode::VisibilityForConstructorIsIgnored,
_ => return Err(format!("Unknown variant {s}")),
};

Expand All @@ -236,6 +242,7 @@ impl From<u64> for SolidityErrorCode {
6321 => SolidityErrorCode::UnnamedReturnVariable,
3420 => SolidityErrorCode::PragmaSolidity,
5740 => SolidityErrorCode::Unreachable,
2462 => SolidityErrorCode::VisibilityForConstructorIsIgnored,
other => SolidityErrorCode::Other(other),
}
}
Expand Down
Loading