diff --git a/aderyn_core/src/context/callgraph/investigator.rs b/aderyn_core/src/context/callgraph/callgraph.rs similarity index 89% rename from aderyn_core/src/context/callgraph/investigator.rs rename to aderyn_core/src/context/callgraph/callgraph.rs index e458496a..b19b4eff 100644 --- a/aderyn_core/src/context/callgraph/investigator.rs +++ b/aderyn_core/src/context/callgraph/callgraph.rs @@ -7,8 +7,8 @@ use crate::{ use super::WorkspaceCallGraph; -/// Use with [`super::CallGraphInvestigator`] -pub trait CallGraphInvestigatorVisitor { +/// Use with [`super::CallGraph`] +pub trait CallGraphVisitor { /// Shift all logic to tracker otherwise, you would track state at 2 different places /// One at the tracker level, and other at the application level. Instead, we must /// contain all of the tracking logic in the tracker. Therefore, visit entry point @@ -33,7 +33,7 @@ pub trait CallGraphInvestigatorVisitor { } } -pub struct CallGraphInvestigator { +pub struct CallGraph { /// Ad-hoc Nodes that we would like to explore from. pub entry_points: Vec, @@ -43,12 +43,12 @@ pub struct CallGraphInvestigator { pub surface_points: Vec, } -impl CallGraphInvestigator { - /// Creates a [`CallGraphInvestigator`] by exploring paths from given nodes. This is the starting point. +impl CallGraph { + /// Creates a [`CallGraph`] by exploring paths from given nodes. This is the starting point. pub fn for_specific_nodes( context: &WorkspaceContext, nodes: &[&ASTNode], - ) -> super::Result { + ) -> super::Result { let mut entry_points = vec![]; let mut surface_points = vec![]; @@ -77,26 +77,23 @@ impl CallGraphInvestigator { } } - Ok(CallGraphInvestigator { + Ok(CallGraph { entry_points, surface_points, }) } - pub fn new( - context: &WorkspaceContext, - nodes: &[&ASTNode], - ) -> super::Result { + pub fn new(context: &WorkspaceContext, nodes: &[&ASTNode]) -> super::Result { Self::for_specific_nodes(context, nodes) } /// Visit the entry points and all the plausible function definitions and modifier definitions that /// EVM may encounter during execution. - pub fn investigate(&self, context: &WorkspaceContext, visitor: &mut T) -> super::Result<()> + pub fn accept(&self, context: &WorkspaceContext, visitor: &mut T) -> super::Result<()> where - T: CallGraphInvestigatorVisitor, + T: CallGraphVisitor, { - self._investigate( + self._accept( context, context .callgraph @@ -110,14 +107,14 @@ impl CallGraphInvestigator { /// First, we visit the entry points. Then, we derive the subgraph from the [`WorkspaceCallGraph`] /// which consists of all the nodes that can be reached by traversing the edges starting /// from the surface points. - fn _investigate( + fn _accept( &self, context: &WorkspaceContext, callgraph: &WorkspaceCallGraph, visitor: &mut T, ) -> super::Result<()> where - T: CallGraphInvestigatorVisitor, + T: CallGraphVisitor, { // Visit entry point nodes (so that trackers can track the state across all code regions in 1 place) for entry_point_id in &self.entry_points { @@ -159,7 +156,7 @@ impl CallGraphInvestigator { blacklist: Option<&HashSet>, ) -> super::Result<()> where - T: CallGraphInvestigatorVisitor, + T: CallGraphVisitor, { if visited.contains(&node_id) { return Ok(()); @@ -175,7 +172,7 @@ impl CallGraphInvestigator { self.make_relevant_visit_call(context, node_id, visitor)?; } - if let Some(pointing_to) = callgraph.graph.get(&node_id) { + if let Some(pointing_to) = callgraph.raw_callgraph.get(&node_id) { for destination in pointing_to { self.dfs_and_visit_subgraph( *destination, @@ -197,7 +194,7 @@ impl CallGraphInvestigator { visitor: &mut T, ) -> super::Result<()> where - T: CallGraphInvestigatorVisitor, + T: CallGraphVisitor, { if let Some(node) = context.nodes.get(&node_id) { if node.node_type() != NodeType::FunctionDefinition @@ -228,7 +225,7 @@ impl CallGraphInvestigator { visitor: &mut T, ) -> super::Result<()> where - T: CallGraphInvestigatorVisitor, + T: CallGraphVisitor, { let node = context .nodes diff --git a/aderyn_core/src/context/callgraph/callgraph_tests.rs b/aderyn_core/src/context/callgraph/callgraph_tests.rs index e060a9d8..bfc0dd24 100644 --- a/aderyn_core/src/context/callgraph/callgraph_tests.rs +++ b/aderyn_core/src/context/callgraph/callgraph_tests.rs @@ -3,7 +3,7 @@ #[cfg(test)] mod callgraph_tests { use crate::context::{ - investigator::{CallGraphInvestigator, CallGraphInvestigatorVisitor}, + callgraph::callgraph::{CallGraph, CallGraphVisitor}, workspace_context::{ASTNode, WorkspaceContext}, }; @@ -47,10 +47,10 @@ mod callgraph_tests { let visit_eighth_floor1 = get_function_by_name(&context, "visitEighthFloor1"); - let investigator = CallGraphInvestigator::new(&context, &[&visit_eighth_floor1]).unwrap(); + let investigator = CallGraph::new(&context, &[&visit_eighth_floor1]).unwrap(); let mut tracker = Tracker::new(&context); - investigator.investigate(&context, &mut tracker).unwrap(); + investigator.accept(&context, &mut tracker).unwrap(); assert!(tracker.func_definitions_names.is_empty()); assert!(tracker.modifier_definitions_names.is_empty()); @@ -66,11 +66,10 @@ mod callgraph_tests { let pass_through_ninth_floor2 = get_modifier_definition_by_name(&context, "passThroughNinthFloor2"); - let investigator = - CallGraphInvestigator::new(&context, &[&pass_through_ninth_floor2]).unwrap(); + let investigator = CallGraph::new(&context, &[&pass_through_ninth_floor2]).unwrap(); let mut tracker = Tracker::new(&context); - investigator.investigate(&context, &mut tracker).unwrap(); + investigator.accept(&context, &mut tracker).unwrap(); assert!(tracker.has_found_functions_with_names(&["visitEighthFloor2"])); } @@ -85,11 +84,10 @@ mod callgraph_tests { let pass_through_ninth_floor3 = get_modifier_definition_by_name(&context, "passThroughNinthFloor3"); - let investigator = - CallGraphInvestigator::new(&context, &[&pass_through_ninth_floor3]).unwrap(); + let investigator = CallGraph::new(&context, &[&pass_through_ninth_floor3]).unwrap(); let mut tracker = Tracker::new(&context); - investigator.investigate(&context, &mut tracker).unwrap(); + investigator.accept(&context, &mut tracker).unwrap(); assert!(tracker.has_found_functions_with_names(&["visitEighthFloor3"])); } @@ -103,10 +101,10 @@ mod callgraph_tests { let recurse = get_function_by_name(&context, "recurse"); - let investigator = CallGraphInvestigator::new(&context, &[&recurse]).unwrap(); + let investigator = CallGraph::new(&context, &[&recurse]).unwrap(); let mut tracker = Tracker::new(&context); - investigator.investigate(&context, &mut tracker).unwrap(); + investigator.accept(&context, &mut tracker).unwrap(); assert!(tracker.has_found_functions_with_names(&["recurse"])); } @@ -135,7 +133,7 @@ mod callgraph_tests { } } - impl CallGraphInvestigatorVisitor for Tracker<'_> { + impl CallGraphVisitor for Tracker<'_> { fn visit_entry_point(&mut self, node: &ASTNode) -> eyre::Result<()> { self.entry_points .push(self.context.get_node_sort_key_pure(node)); diff --git a/aderyn_core/src/context/callgraph/mod.rs b/aderyn_core/src/context/callgraph/mod.rs index 62c49f98..3ef9dde0 100644 --- a/aderyn_core/src/context/callgraph/mod.rs +++ b/aderyn_core/src/context/callgraph/mod.rs @@ -1,4 +1,5 @@ -pub mod investigator; +mod callgraph_tests; +pub mod callgraph; mod workspace_callgraph; pub use workspace_callgraph::*; diff --git a/aderyn_core/src/context/callgraph/workspace_callgraph.rs b/aderyn_core/src/context/callgraph/workspace_callgraph.rs index 30997ea6..1a219a68 100644 --- a/aderyn_core/src/context/callgraph/workspace_callgraph.rs +++ b/aderyn_core/src/context/callgraph/workspace_callgraph.rs @@ -10,18 +10,18 @@ use crate::{ #[derive(Debug)] pub struct WorkspaceCallGraph { - pub graph: CallGraph, + pub raw_callgraph: RawCallGraph, } /** -* Every NodeID in CallGraph should corresponds to [`crate::ast::FunctionDefinition`] or [`crate::ast::ModifierDefinition`] +* Every NodeID in RawCallGraph should corresponds to [`crate::ast::FunctionDefinition`] or [`crate::ast::ModifierDefinition`] */ -pub type CallGraph = HashMap>; +pub type RawCallGraph = HashMap>; impl WorkspaceCallGraph { /// Formula to create [`WorkspaceCallGraph`] for global preprocessing . pub fn from_context(context: &WorkspaceContext) -> super::Result { - let mut graph: CallGraph = HashMap::new(); + let mut raw_callgraph: RawCallGraph = HashMap::new(); let mut visited: HashSet = HashSet::new(); let funcs = context @@ -33,16 +33,16 @@ impl WorkspaceCallGraph { let modifier_definitions = context.modifier_definitions(); for func in funcs { - dfs_to_create_graph(func.id, &mut graph, &mut visited, context) + dfs_to_create_graph(func.id, &mut raw_callgraph, &mut visited, context) .map_err(|_| super::Error::WorkspaceCallGraphDFSError)?; } for modifier in modifier_definitions { - dfs_to_create_graph(modifier.id, &mut graph, &mut visited, context) + dfs_to_create_graph(modifier.id, &mut raw_callgraph, &mut visited, context) .map_err(|_| super::Error::WorkspaceCallGraphDFSError)?; } - Ok(WorkspaceCallGraph { graph }) + Ok(WorkspaceCallGraph { raw_callgraph }) } } @@ -50,7 +50,7 @@ impl WorkspaceCallGraph { /// with their connected counterparts. fn dfs_to_create_graph( id: NodeID, - graph: &mut CallGraph, + graph: &mut RawCallGraph, visited: &mut HashSet, context: &WorkspaceContext, ) -> super::Result<()> { @@ -105,7 +105,7 @@ fn dfs_to_create_graph( Ok(()) } -fn create_connection_if_not_exsits(from_id: NodeID, to_id: NodeID, graph: &mut CallGraph) { +fn create_connection_if_not_exsits(from_id: NodeID, to_id: NodeID, graph: &mut RawCallGraph) { match graph.entry(from_id) { hash_map::Entry::Occupied(mut o) => { // Performance Tip: Maybe later use binary search (it requires keeping ascending order while inserting tho) diff --git a/aderyn_core/src/detect/high/contract_locks_ether.rs b/aderyn_core/src/detect/high/contract_locks_ether.rs index 0d04f63c..dafeeafa 100644 --- a/aderyn_core/src/detect/high/contract_locks_ether.rs +++ b/aderyn_core/src/detect/high/contract_locks_ether.rs @@ -67,7 +67,7 @@ mod contract_eth_helper { ast::{ASTNode, ContractDefinition, StateMutability, Visibility}, context::{ browser::ExtractFunctionDefinitions, - callgraph::investigator::{CallGraphInvestigator, CallGraphInvestigatorVisitor}, + callgraph::callgraph::{CallGraph, CallGraphVisitor}, workspace_context::WorkspaceContext, }, detect::helpers, @@ -112,13 +112,11 @@ mod contract_eth_helper { let mut tracker = EthWithdrawalAllowerTracker::default(); - let investigator = CallGraphInvestigator::new( - context, - funcs.iter().collect::>().as_slice(), - ) - .ok()?; + let investigator = + CallGraph::new(context, funcs.iter().collect::>().as_slice()) + .ok()?; - investigator.investigate(context, &mut tracker).ok()?; + investigator.accept(context, &mut tracker).ok()?; if tracker.has_calls_that_sends_native_eth { return Some(true); @@ -137,7 +135,7 @@ mod contract_eth_helper { has_calls_that_sends_native_eth: bool, } - impl CallGraphInvestigatorVisitor for EthWithdrawalAllowerTracker { + impl CallGraphVisitor for EthWithdrawalAllowerTracker { fn visit_any(&mut self, ast_node: &ASTNode) -> eyre::Result<()> { if !self.has_calls_that_sends_native_eth && helpers::has_calls_that_sends_native_eth(ast_node) diff --git a/aderyn_core/src/detect/high/delegate_call_no_address_check.rs b/aderyn_core/src/detect/high/delegate_call_no_address_check.rs index add36e46..d8baefaf 100644 --- a/aderyn_core/src/detect/high/delegate_call_no_address_check.rs +++ b/aderyn_core/src/detect/high/delegate_call_no_address_check.rs @@ -4,9 +4,7 @@ use std::error::Error; use crate::ast::NodeID; use crate::capture; -use crate::context::callgraph::investigator::{ - CallGraphInvestigator, CallGraphInvestigatorVisitor, -}; +use crate::context::callgraph::callgraph::{CallGraph, CallGraphVisitor}; use crate::detect::detector::IssueDetectorNamePool; use crate::detect::helpers; use crate::{ @@ -30,8 +28,8 @@ impl IssueDetector for DelegateCallOnUncheckedAddressDetector { has_delegate_call_on_non_state_variable_address: false, context, }; - let investigator = CallGraphInvestigator::new(context, &[&(func.into())])?; - investigator.investigate(context, &mut tracker)?; + let investigator = CallGraph::new(context, &[&(func.into())])?; + investigator.accept(context, &mut tracker)?; if tracker.has_delegate_call_on_non_state_variable_address && !tracker.has_address_checks @@ -70,7 +68,7 @@ struct DelegateCallNoAddressChecksTracker<'a> { context: &'a WorkspaceContext, } -impl<'a> CallGraphInvestigatorVisitor for DelegateCallNoAddressChecksTracker<'a> { +impl<'a> CallGraphVisitor for DelegateCallNoAddressChecksTracker<'a> { fn visit_any(&mut self, node: &crate::context::workspace_context::ASTNode) -> eyre::Result<()> { if !self.has_address_checks && helpers::has_binary_checks_on_some_address(node) { self.has_address_checks = true; diff --git a/aderyn_core/src/detect/high/msg_value_in_loops.rs b/aderyn_core/src/detect/high/msg_value_in_loops.rs index 9fd0a0a3..1ba250cc 100644 --- a/aderyn_core/src/detect/high/msg_value_in_loops.rs +++ b/aderyn_core/src/detect/high/msg_value_in_loops.rs @@ -6,8 +6,8 @@ use crate::ast::{ASTNode, Expression, NodeID}; use crate::capture; use crate::context::browser::ExtractMemberAccesses; -use crate::context::callgraph::investigator::{ - CallGraphInvestigator, CallGraphInvestigatorVisitor, +use crate::context::callgraph::callgraph::{ + CallGraph, CallGraphVisitor, }; use crate::detect::detector::IssueDetectorNamePool; use crate::{ @@ -72,9 +72,9 @@ impl IssueDetector for MsgValueUsedInLoopDetector { fn uses_msg_value(context: &WorkspaceContext, ast_node: &ASTNode) -> Option { let mut tracker = MsgValueTracker::default(); - let investigator = CallGraphInvestigator::new(context, &[ast_node]).ok()?; + let investigator = CallGraph::new(context, &[ast_node]).ok()?; - investigator.investigate(context, &mut tracker).ok()?; + investigator.accept(context, &mut tracker).ok()?; Some(tracker.has_msg_value) } @@ -83,7 +83,7 @@ struct MsgValueTracker { has_msg_value: bool, } -impl CallGraphInvestigatorVisitor for MsgValueTracker { +impl CallGraphVisitor for MsgValueTracker { fn visit_any(&mut self, node: &crate::ast::ASTNode) -> eyre::Result<()> { if !self.has_msg_value && ExtractMemberAccesses::from(node) diff --git a/aderyn_core/src/detect/high/out_of_order_retryable.rs b/aderyn_core/src/detect/high/out_of_order_retryable.rs index 1a132b03..150de31e 100644 --- a/aderyn_core/src/detect/high/out_of_order_retryable.rs +++ b/aderyn_core/src/detect/high/out_of_order_retryable.rs @@ -5,9 +5,7 @@ use crate::ast::{Expression, MemberAccess, NodeID}; use crate::capture; use crate::context::browser::ExtractFunctionCalls; -use crate::context::callgraph::investigator::{ - CallGraphInvestigator, CallGraphInvestigatorVisitor, -}; +use crate::context::callgraph::callgraph::{CallGraph, CallGraphVisitor}; use crate::detect::detector::IssueDetectorNamePool; use crate::detect::helpers; use crate::{ @@ -29,8 +27,8 @@ impl IssueDetector for OutOfOrderRetryableDetector { let mut tracker = OutOfOrderRetryableTracker { number_of_retry_calls: 0, }; - let investigator = CallGraphInvestigator::new(context, &[&(func.into())])?; - investigator.investigate(context, &mut tracker)?; + let investigator = CallGraph::new(context, &[&(func.into())])?; + investigator.accept(context, &mut tracker)?; if tracker.number_of_retry_calls >= 2 { capture!(self, context, func); } @@ -73,7 +71,7 @@ const SEQUENCER_FUNCTIONS: [&str; 3] = [ "unsafeCreateRetryableTicket", ]; -impl CallGraphInvestigatorVisitor for OutOfOrderRetryableTracker { +impl CallGraphVisitor for OutOfOrderRetryableTracker { fn visit_any(&mut self, node: &crate::ast::ASTNode) -> eyre::Result<()> { if self.number_of_retry_calls >= 2 { return Ok(()); diff --git a/aderyn_core/src/detect/high/send_ether_no_checks.rs b/aderyn_core/src/detect/high/send_ether_no_checks.rs index ae03dfc0..c92d32bf 100644 --- a/aderyn_core/src/detect/high/send_ether_no_checks.rs +++ b/aderyn_core/src/detect/high/send_ether_no_checks.rs @@ -4,9 +4,7 @@ use std::error::Error; use crate::ast::NodeID; use crate::capture; -use crate::context::callgraph::investigator::{ - CallGraphInvestigator, CallGraphInvestigatorVisitor, -}; +use crate::context::callgraph::callgraph::{CallGraph, CallGraphVisitor}; use crate::context::workspace_context::ASTNode; use crate::detect::detector::IssueDetectorNamePool; use crate::detect::helpers; @@ -27,8 +25,8 @@ impl IssueDetector for SendEtherNoChecksDetector { fn detect(&mut self, context: &WorkspaceContext) -> Result> { for func in helpers::get_implemented_external_and_public_functions(context) { let mut tracker = MsgSenderAndCallWithValueTracker::default(); - let investigator = CallGraphInvestigator::new(context, &[&(func.into())])?; - investigator.investigate(context, &mut tracker)?; + let investigator = CallGraph::new(context, &[&(func.into())])?; + investigator.accept(context, &mut tracker)?; if tracker.sends_native_eth && !tracker.has_msg_sender_checks { capture!(self, context, func); @@ -104,7 +102,7 @@ pub struct MsgSenderAndCallWithValueTracker { pub sends_native_eth: bool, } -impl CallGraphInvestigatorVisitor for MsgSenderAndCallWithValueTracker { +impl CallGraphVisitor for MsgSenderAndCallWithValueTracker { fn visit_any(&mut self, node: &ASTNode) -> eyre::Result<()> { if !self.has_msg_sender_checks && helpers::has_msg_sender_binary_operation(node) { self.has_msg_sender_checks = true; diff --git a/aderyn_core/src/detect/high/tx_origin_used_for_auth.rs b/aderyn_core/src/detect/high/tx_origin_used_for_auth.rs index 9ee004c9..cc00d622 100644 --- a/aderyn_core/src/detect/high/tx_origin_used_for_auth.rs +++ b/aderyn_core/src/detect/high/tx_origin_used_for_auth.rs @@ -5,9 +5,7 @@ use crate::ast::{ASTNode, Expression, Identifier, NodeID}; use crate::capture; use crate::context::browser::ExtractMemberAccesses; -use crate::context::callgraph::investigator::{ - CallGraphInvestigator, CallGraphInvestigatorVisitor, -}; +use crate::context::callgraph::callgraph::{CallGraph, CallGraphVisitor}; use crate::detect::detector::IssueDetectorNamePool; use crate::{ context::workspace_context::WorkspaceContext, @@ -85,8 +83,8 @@ impl TxOriginUsedForAuthDetector { ) -> Result<(), Box> { // Boilerplate let mut tracker = MsgSenderAndTxOriginTracker::default(); - let investigator = CallGraphInvestigator::new(context, check_nodes)?; - investigator.investigate(context, &mut tracker)?; + let investigator = CallGraph::new(context, check_nodes)?; + investigator.accept(context, &mut tracker)?; if tracker.satisifed() { capture!(self, context, capture_node); @@ -109,7 +107,7 @@ impl MsgSenderAndTxOriginTracker { } } -impl CallGraphInvestigatorVisitor for MsgSenderAndTxOriginTracker { +impl CallGraphVisitor for MsgSenderAndTxOriginTracker { fn visit_any(&mut self, node: &crate::ast::ASTNode) -> eyre::Result<()> { let member_accesses = ExtractMemberAccesses::from(node).extracted; diff --git a/aderyn_core/src/detect/low/constant_funcs_assembly.rs b/aderyn_core/src/detect/low/constant_funcs_assembly.rs index 01b0688f..0390ef5e 100644 --- a/aderyn_core/src/detect/low/constant_funcs_assembly.rs +++ b/aderyn_core/src/detect/low/constant_funcs_assembly.rs @@ -8,9 +8,7 @@ use crate::capture; use crate::context::browser::{ ExtractInlineAssemblys, ExtractPragmaDirectives, GetClosestAncestorOfTypeX, }; -use crate::context::callgraph::investigator::{ - CallGraphInvestigator, CallGraphInvestigatorVisitor, -}; +use crate::context::callgraph::callgraph::{CallGraph, CallGraphVisitor}; use crate::detect::detector::IssueDetectorNamePool; use crate::detect::helpers::{self, pragma_directive_to_semver}; use crate::{ @@ -51,8 +49,8 @@ impl IssueDetector for ConstantFunctionContainsAssemblyDetector { has_assembly: false, }; let investigator = - CallGraphInvestigator::new(context, &[&(function.into())])?; - investigator.investigate(context, &mut tracker)?; + CallGraph::new(context, &[&(function.into())])?; + investigator.accept(context, &mut tracker)?; if tracker.has_assembly { capture!(self, context, function); @@ -107,7 +105,7 @@ struct AssemblyTracker { has_assembly: bool, } -impl CallGraphInvestigatorVisitor for AssemblyTracker { +impl CallGraphVisitor for AssemblyTracker { fn visit_any(&mut self, node: &crate::ast::ASTNode) -> eyre::Result<()> { // If we are already satisifed, do not bother checking if self.has_assembly { diff --git a/aderyn_core/src/detect/low/function_init_state_vars.rs b/aderyn_core/src/detect/low/function_init_state_vars.rs index 007d2166..ac666be2 100644 --- a/aderyn_core/src/detect/low/function_init_state_vars.rs +++ b/aderyn_core/src/detect/low/function_init_state_vars.rs @@ -5,8 +5,8 @@ use crate::ast::{ASTNode, Expression, FunctionCall, Identifier, NodeID}; use crate::capture; use crate::context::browser::ExtractReferencedDeclarations; -use crate::context::callgraph::investigator::{ - CallGraphInvestigator, CallGraphInvestigatorVisitor, +use crate::context::callgraph::callgraph::{ + CallGraph, CallGraphVisitor, }; use crate::detect::detector::IssueDetectorNamePool; use crate::{ @@ -46,9 +46,9 @@ impl IssueDetector for FunctionInitializingStateDetector { let mut tracker = NonConstantStateVariableReferenceDeclarationTracker::new(context); - let investigator = CallGraphInvestigator::new(context, &[&(func.into())])?; + let investigator = CallGraph::new(context, &[&(func.into())])?; - investigator.investigate(context, &mut tracker)?; + investigator.accept(context, &mut tracker)?; if tracker.makes_a_reference { capture!(self, context, variable_declaration); @@ -98,7 +98,7 @@ impl<'a> NonConstantStateVariableReferenceDeclarationTracker<'a> { } } -impl<'a> CallGraphInvestigatorVisitor for NonConstantStateVariableReferenceDeclarationTracker<'a> { +impl<'a> CallGraphVisitor for NonConstantStateVariableReferenceDeclarationTracker<'a> { fn visit_any(&mut self, node: &ASTNode) -> eyre::Result<()> { // We already know the condition is satisifed if self.makes_a_reference { diff --git a/aderyn_core/src/detect/low/return_bomb.rs b/aderyn_core/src/detect/low/return_bomb.rs index f9d8bf83..91c968f9 100644 --- a/aderyn_core/src/detect/low/return_bomb.rs +++ b/aderyn_core/src/detect/low/return_bomb.rs @@ -6,8 +6,8 @@ use crate::ast::{ASTNode, MemberAccess, NodeID}; use crate::ast::NodeType; use crate::capture; use crate::context::browser::GetClosestAncestorOfTypeX; -use crate::context::callgraph::investigator::{ - CallGraphInvestigator, CallGraphInvestigatorVisitor, +use crate::context::callgraph::callgraph::{ + CallGraph, CallGraphVisitor, }; use crate::detect::detector::IssueDetectorNamePool; use crate::detect::helpers; @@ -39,8 +39,8 @@ impl IssueDetector for ReturnBombDetector { calls_on_non_state_variable_addresses: vec![], // collection of all `address.call` Member Accesses where address is not a state variable context, }; - let investigator = CallGraphInvestigator::new(context, &[&(func.into())])?; - investigator.investigate(context, &mut tracker)?; + let investigator = CallGraph::new(context, &[&(func.into())])?; + investigator.accept(context, &mut tracker)?; if !tracker.has_address_checks { // Now we assume that in this region all addresses are unprotected (because they are not involved in any binary ops/checks) @@ -121,7 +121,7 @@ struct CallNoAddressChecksTracker<'a> { context: &'a WorkspaceContext, } -impl<'a> CallGraphInvestigatorVisitor for CallNoAddressChecksTracker<'a> { +impl<'a> CallGraphVisitor for CallNoAddressChecksTracker<'a> { fn visit_any(&mut self, node: &crate::context::workspace_context::ASTNode) -> eyre::Result<()> { if !self.has_address_checks && helpers::has_binary_checks_on_some_address(node) { self.has_address_checks = true;