Skip to content

Commit

Permalink
delegate call detector -> high to low, message changes
Browse files Browse the repository at this point in the history
  • Loading branch information
TilakMaddy committed Oct 18, 2024
1 parent f0c14b5 commit 7310d5d
Show file tree
Hide file tree
Showing 9 changed files with 348 additions and 372 deletions.
2 changes: 0 additions & 2 deletions aderyn_core/src/detect/high/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pub(crate) mod const_func_change_state;
pub(crate) mod contract_locks_ether;
pub(crate) mod dangerous_strict_equality_balance;
pub(crate) mod dangerous_unary_operator;
pub(crate) mod delegate_call_in_loop;
pub(crate) mod delegate_call_no_address_check;
pub(crate) mod deletion_nested_mapping;
pub(crate) mod dynamic_array_length_assignment;
Expand Down Expand Up @@ -44,7 +43,6 @@ pub use const_func_change_state::ConstantFunctionChangingStateDetector;
pub use contract_locks_ether::ContractLocksEtherDetector;
pub use dangerous_strict_equality_balance::DangerousStrictEqualityOnBalanceDetector;
pub use dangerous_unary_operator::DangerousUnaryOperatorDetector;
pub use delegate_call_in_loop::DelegateCallInLoopDetector;
pub use delegate_call_no_address_check::DelegateCallOnUncheckedAddressDetector;
pub use deletion_nested_mapping::DeletionNestedMappingDetector;
pub use dynamic_array_length_assignment::DynamicArrayLengthAssignmentDetector;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ impl IssueDetector for DelegateCallInLoopDetector {
}

fn severity(&self) -> IssueSeverity {
IssueSeverity::High
IssueSeverity::Low
}

fn title(&self) -> String {
String::from("Using `delegatecall` in loop")
String::from("Using `delegatecall` in loop may consume excessive gas")
}

fn description(&self) -> String {
String::from("When calling `delegatecall` the same `msg.value` amount will be accredited multiple times.")
String::from("Using `delegatecall` in loop may consume excessive gas")
}

fn instances(&self) -> BTreeMap<(String, usize, String), NodeID> {
Expand Down Expand Up @@ -97,9 +97,8 @@ impl CallGraphVisitor for DelegateCallTracker {
mod delegate_call_in_loop_detector_tests {
use serial_test::serial;

use crate::detect::detector::IssueDetector;

use super::DelegateCallInLoopDetector;
use crate::detect::detector::IssueDetector;

#[test]
#[serial]
Expand All @@ -115,15 +114,6 @@ mod delegate_call_in_loop_detector_tests {
// assert that the detector found the correct number of instances (1)
assert_eq!(detector.instances().len(), 1);
// assert the severity is high
assert_eq!(detector.severity(), crate::detect::detector::IssueSeverity::High);
// assert the title is correct
assert_eq!(detector.title(), String::from("Using `delegatecall` in loop"));
// assert the description is correct
assert_eq!(
detector.description(),
String::from(
"When calling `delegatecall` the same `msg.value` amount will be accredited multiple times."
)
);
assert_eq!(detector.severity(), crate::detect::detector::IssueSeverity::Low);
}
}
2 changes: 2 additions & 0 deletions aderyn_core/src/detect/low/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pub(crate) mod constant_funcs_assembly;
pub(crate) mod contracts_with_todos;
pub(crate) mod costly_operations_inside_loops;
pub(crate) mod dead_code;
pub(crate) mod delegate_call_in_loop;
pub(crate) mod deprecated_oz_functions;
pub(crate) mod division_before_multiplication;
pub(crate) mod ecrecover;
Expand Down Expand Up @@ -56,6 +57,7 @@ pub use constant_funcs_assembly::ConstantFunctionContainsAssemblyDetector;
pub use contracts_with_todos::ContractsWithTodosDetector;
pub use costly_operations_inside_loops::CostlyOperationsInsideLoopsDetector;
pub use dead_code::DeadCodeDetector;
pub use delegate_call_in_loop::DelegateCallInLoopDetector;
pub use deprecated_oz_functions::DeprecatedOZFunctionsDetector;
pub use division_before_multiplication::DivisionBeforeMultiplicationDetector;
pub use ecrecover::EcrecoverDetector;
Expand Down
16 changes: 1 addition & 15 deletions reports/adhoc-sol-files-highs-only-report.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7310d5d

Please sign in to comment.