Skip to content

Commit

Permalink
Add transient storage warning to default ignored_error_codes (#7299)
Browse files Browse the repository at this point in the history
* add transient-storage error code and add to default ignored

* add reverse lookups
  • Loading branch information
emo-eth authored Mar 4, 2024
1 parent 3df3e0c commit c24933d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/config/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ pub enum SolidityErrorCode {
Unreachable,
/// Missing pragma solidity
PragmaSolidity,
/// Uses transient opcodes
TransientStorageUsed,
/// All other error codes
Other(u64),
}
Expand Down Expand Up @@ -162,6 +164,7 @@ impl SolidityErrorCode {
SolidityErrorCode::PragmaSolidity => "pragma-solidity",
SolidityErrorCode::Other(code) => return Err(*code),
SolidityErrorCode::VisibilityForConstructorIsIgnored => "constructor-visibility",
SolidityErrorCode::TransientStorageUsed => "transient-storage",
};
Ok(s)
}
Expand All @@ -185,6 +188,7 @@ impl From<SolidityErrorCode> for u64 {
SolidityErrorCode::PragmaSolidity => 3420,
SolidityErrorCode::ContractInitCodeSizeExceeds49152Bytes => 3860,
SolidityErrorCode::VisibilityForConstructorIsIgnored => 2462,
SolidityErrorCode::TransientStorageUsed => 2394,
SolidityErrorCode::Other(code) => code,
}
}
Expand Down Expand Up @@ -218,6 +222,7 @@ impl FromStr for SolidityErrorCode {
"missing-receive-ether" => SolidityErrorCode::PayableNoReceiveEther,
"same-varname" => SolidityErrorCode::DeclarationSameNameAsAnother,
"constructor-visibility" => SolidityErrorCode::VisibilityForConstructorIsIgnored,
"transient-storage" => SolidityErrorCode::TransientStorageUsed,
_ => return Err(format!("Unknown variant {s}")),
};

Expand All @@ -243,6 +248,7 @@ impl From<u64> for SolidityErrorCode {
3420 => SolidityErrorCode::PragmaSolidity,
5740 => SolidityErrorCode::Unreachable,
2462 => SolidityErrorCode::VisibilityForConstructorIsIgnored,
2394 => SolidityErrorCode::TransientStorageUsed,
other => SolidityErrorCode::Other(other),
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1901,6 +1901,7 @@ impl Default for Config {
SolidityErrorCode::SpdxLicenseNotProvided,
SolidityErrorCode::ContractExceeds24576Bytes,
SolidityErrorCode::ContractInitCodeSizeExceeds49152Bytes,
SolidityErrorCode::TransientStorageUsed,
],
ignored_file_paths: vec![],
deny_warnings: false,
Expand Down

0 comments on commit c24933d

Please sign in to comment.