Skip to content

Commit

Permalink
Detector: Tautology or contradiction (#623)
Browse files Browse the repository at this point in the history
Co-authored-by: Alex Roan <alex@cyfrin.io>
  • Loading branch information
TilakMaddy and alexroan authored Aug 2, 2024
1 parent ee2f464 commit b0c2ed7
Show file tree
Hide file tree
Showing 10 changed files with 1,099 additions and 235 deletions.
452 changes: 240 additions & 212 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions aderyn_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ license = "MIT"
crossbeam-channel = "0.5.9"
eyre = "0.6.12"
ignore = "0.4.21"
phf = {version = "0.11.2", features = ["macros"]}
phf = { version = "0.11.2", features = ["macros"] }
prettytable = "0.10.0"
rayon = "1.8.0"
semver = "1.0.20"
Expand All @@ -22,7 +22,11 @@ serde-sarif = "0.4.2"
serde_repr = "0.1.12"
strum = { version = "0.26", features = ["derive"] }
toml = "0.8.2"
cyfrin-foundry-compilers = { version = "0.3.20-aderyn", features = ["svm-solc"] }
cyfrin-foundry-compilers = { version = "0.3.20-aderyn", features = [
"svm-solc",
] }
num-bigint = "0.4"
num-traits = "0.2"
lazy-regex = "3.2.0"
derive_more = "0.99.18"

Expand Down
5 changes: 5 additions & 0 deletions aderyn_core/src/detect/detector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ pub fn get_all_issue_detectors() -> Vec<Box<dyn IssueDetector>> {
Box::<RTLODetector>::default(),
Box::<UncheckedReturnDetector>::default(),
Box::<DangerousUnaryOperatorDetector>::default(),
Box::<TautologyOrContraditionDetector>::default(),
Box::<DangerousStrictEqualityOnBalanceDetector>::default(),
Box::<StorageSignedIntegerArrayDetector>::default(),
Box::<RedundantStatementsDetector>::default(),
Expand Down Expand Up @@ -135,6 +136,7 @@ pub(crate) enum IssueDetectorNamePool {
RTLO,
UncheckedReturn,
DangerousUnaryOperator,
TautologyOrContradiction,
DangerousStrictEquailtyOnContractBalance,
SignedStorageArray,
RedundantStatements,
Expand Down Expand Up @@ -278,6 +280,9 @@ pub fn request_issue_detector_by_name(detector_name: &str) -> Option<Box<dyn Iss
IssueDetectorNamePool::DangerousUnaryOperator => {
Some(Box::<DangerousUnaryOperatorDetector>::default())
}
IssueDetectorNamePool::TautologyOrContradiction => {
Some(Box::<TautologyOrContraditionDetector>::default())
}
IssueDetectorNamePool::DangerousStrictEquailtyOnContractBalance => {
Some(Box::<DangerousStrictEqualityOnBalanceDetector>::default())
}
Expand Down
2 changes: 2 additions & 0 deletions aderyn_core/src/detect/high/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub(crate) mod state_variable_shadowing;
pub(crate) mod storage_array_edit_with_memory;
pub(crate) mod storage_signed_integer_array;
pub(crate) mod tautological_compare;
pub(crate) mod tautology_or_contradiction;
pub(crate) mod unchecked_return;
pub(crate) mod unchecked_send;
pub(crate) mod uninitialized_state_variable;
Expand Down Expand Up @@ -56,6 +57,7 @@ pub use state_variable_shadowing::StateVariableShadowingDetector;
pub use storage_array_edit_with_memory::StorageArrayEditWithMemoryDetector;
pub use storage_signed_integer_array::StorageSignedIntegerArrayDetector;
pub use tautological_compare::TautologicalCompareDetector;
pub use tautology_or_contradiction::TautologyOrContraditionDetector;
pub use unchecked_return::UncheckedReturnDetector;
pub use unchecked_send::UncheckedSendDetector;
pub use uninitialized_state_variable::UninitializedStateVariableDetector;
Expand Down
Loading

0 comments on commit b0c2ed7

Please sign in to comment.