Skip to content

Commit

Permalink
Revert "Detector: Uninitialized local variables" (#658)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexroan authored Aug 6, 2024
1 parent a83bbd6 commit 61295db
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 1,934 deletions.
4 changes: 0 additions & 4 deletions aderyn_core/src/context/meta_workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,6 @@ impl WorkspaceContext {
self.yul_identifiers_context.keys().collect()
}

pub fn yul_assignments(&self) -> Vec<&YulAssignment> {
self.yul_assignments_context.keys().collect()
}

pub fn yul_literals(&self) -> Vec<&YulLiteral> {
self.yul_literals_context.keys().collect()
}
Expand Down
1 change: 0 additions & 1 deletion aderyn_core/src/context/workspace_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ pub struct WorkspaceContext {
pub(crate) yul_function_calls_context: HashMap<YulFunctionCall, NodeContext>,
pub(crate) yul_identifiers_context: HashMap<YulIdentifier, NodeContext>,
pub(crate) yul_literals_context: HashMap<YulLiteral, NodeContext>,
pub(crate) yul_assignments_context: HashMap<YulAssignment, NodeContext>,
}

impl WorkspaceContext {
Expand Down
5 changes: 0 additions & 5 deletions aderyn_core/src/detect/detector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ pub fn get_all_issue_detectors() -> Vec<Box<dyn IssueDetector>> {
Box::<TxOriginUsedForAuthDetector>::default(),
Box::<MsgValueUsedInLoopDetector>::default(),
Box::<ContractLocksEtherDetector>::default(),
Box::<UninitializedLocalVariableDetector>::default(),
Box::<ReturnBombDetector>::default(),
]
}
Expand Down Expand Up @@ -158,7 +157,6 @@ pub(crate) enum IssueDetectorNamePool {
TxOriginUsedForAuth,
MsgValueInLoop,
ContractLocksEther,
UninitializedLocalVariable,
ReturnBomb,
// NOTE: `Undecided` will be the default name (for new bots).
// If it's accepted, a new variant will be added to this enum before normalizing it in aderyn
Expand All @@ -169,9 +167,6 @@ pub fn request_issue_detector_by_name(detector_name: &str) -> Option<Box<dyn Iss
// Expects a valid detector_name
let detector_name = IssueDetectorNamePool::from_str(detector_name).ok()?;
match detector_name {
IssueDetectorNamePool::UninitializedLocalVariable => {
Some(Box::<UninitializedLocalVariableDetector>::default())
}
IssueDetectorNamePool::ReturnBomb => Some(Box::<ReturnBombDetector>::default()),
IssueDetectorNamePool::UnusedStateVariable => {
Some(Box::<UnusedStateVariablesDetector>::default())
Expand Down
2 changes: 0 additions & 2 deletions aderyn_core/src/detect/low/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ pub(crate) mod return_bomb;
pub(crate) mod reverts_and_requries_in_loops;
pub(crate) mod solmate_safe_transfer_lib;
pub(crate) mod unindexed_events;
pub(crate) mod uninitialized_local_variables;
pub(crate) mod unsafe_erc20_functions;
pub(crate) mod unsafe_oz_erc721_mint;
pub(crate) mod unspecific_solidity_pragma;
Expand Down Expand Up @@ -49,7 +48,6 @@ pub use return_bomb::ReturnBombDetector;
pub use reverts_and_requries_in_loops::RevertsAndRequiresInLoopsDetector;
pub use solmate_safe_transfer_lib::SolmateSafeTransferLibDetector;
pub use unindexed_events::UnindexedEventsDetector;
pub use uninitialized_local_variables::UninitializedLocalVariableDetector;
pub use unsafe_erc20_functions::UnsafeERC20FunctionsDetector;
pub use unsafe_oz_erc721_mint::UnsafeERC721MintDetector;
pub use unspecific_solidity_pragma::UnspecificSolidityPragmaDetector;
Expand Down
142 changes: 0 additions & 142 deletions aderyn_core/src/detect/low/uninitialized_local_variables.rs

This file was deleted.

13 changes: 0 additions & 13 deletions aderyn_core/src/visitor/workspace_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,6 @@ impl ASTConstVisitor for WorkspaceContext {
Ok(true)
}

fn visit_yul_assignment(&mut self, node: &YulAssignment) -> Result<bool> {
self.yul_assignments_context.insert(
node.clone(),
NodeContext {
source_unit_id: self.last_source_unit_id,
contract_definition_id: self.last_contract_definition_id,
function_definition_id: self.last_function_definition_id,
modifier_definition_id: self.last_modifier_definition_id,
},
);
Ok(true)
}

// Read the following like follows -
generate_visit_methods_for_workspace_context_with_insert_node! {
// Explanation for the 1st one : Create a method called `visit_assignment` that takes in `Assignment` as parameter and puts it inside `assignments_context`
Expand Down
Loading

0 comments on commit 61295db

Please sign in to comment.