From 38febb6646601b626f554e3e6db6742464e9303b Mon Sep 17 00:00:00 2001 From: Facundo Lerena Date: Wed, 16 Aug 2023 13:49:16 -0300 Subject: [PATCH] Update lib.rs --- detectors/lazy-delegate/src/lib.rs | 52 ------------------------------ 1 file changed, 52 deletions(-) diff --git a/detectors/lazy-delegate/src/lib.rs b/detectors/lazy-delegate/src/lib.rs index 86da95e3..f1c26baf 100644 --- a/detectors/lazy-delegate/src/lib.rs +++ b/detectors/lazy-delegate/src/lib.rs @@ -14,58 +14,6 @@ use rustc_ast::{ use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_span::Span; -/* -dylint_linting::impl_late_lint! { - /// ### What it does - /// Checks for delegated calls to contracts passed as arguments. - /// ### Why is this bad? - ///Delegated calls to contracts passed as arguments can be used to change the expected behavior of the contract. If you need to change the target of a delegated call, you should use a storage variable, and make a function with proper access control to change it. - /// ### Known problems - /// Remove if none. - /// - /// ### Example - /// ```rust - ///pub fn delegateCall(&mut self, target: Hash, argument: Balance) { - /// let selector_bytes = [0x0, 0x0, 0x0, 0x0]; - /// let result: T = build_call::() - /// .delegate(target) - /// .exec_input( - /// ExecutionInput::new(Selector::new(selector_bytes)) - /// .push_arg(argument) - /// ) - /// .returns::() - /// .invoke(); - ///} - /// ``` - /// Use instead: - ///```rust - ///pub fn delegate_call(&mut self, argument: Balance) { - /// let selector_bytes = [0x0, 0x0, 0x0, 0x0]; - /// let result: T = build_call::() - /// .delegate(self.target) - /// .exec_input( - /// ExecutionInput::new(Selector::new(selector_bytes)) - /// .push_arg(argument) - /// ) - /// .returns::() - /// .invoke(); - ///} - /// - ///pub fn set_target(&mut self, new_target: Hash) -> Result<(), &'static str> { - /// if self.admin != self.env().caller() { - /// Err("Only admin can set target") - /// } else { - /// self.target = new_target; - /// Ok(()) - /// } - ///} - - pub DELEGATE_CALL, - Warn, - "Passing arguments to the target of a delegate call is not safe, as it allows the caller to set a malicious hash as the target.", - DelegateCall::default() -} - */ dylint_linting::impl_pre_expansion_lint! { /// ### What it does /// Checks for non-lazy storage when using delegate calls.