From a1d934a20761e00ceb0616d24bba3df11ebb10ac Mon Sep 17 00:00:00 2001 From: TUPM96 Date: Mon, 25 May 2026 14:47:32 +0700 Subject: [PATCH] Fix detector documentation typos --- docs/src/detectors/Detector-Documentation.md | 18 +++++++++--------- .../attributes/const_functions_asm.py | 2 +- .../attributes/const_functions_state.py | 2 +- slither/detectors/functions/dead_code.py | 4 ++-- slither/detectors/functions/modifier.py | 2 +- .../detectors/reentrancy/reentrancy_benign.py | 2 +- .../detectors/reentrancy/reentrancy_no_gas.py | 2 +- slither/detectors/statements/calls_in_loop.py | 2 +- .../variables/uninitialized_local_variables.py | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/src/detectors/Detector-Documentation.md b/docs/src/detectors/Detector-Documentation.md index bc3d55a372..0a103a5b9c 100644 --- a/docs/src/detectors/Detector-Documentation.md +++ b/docs/src/detectors/Detector-Documentation.md @@ -1493,7 +1493,7 @@ contract Constant{ uint counter; function get() public view returns(uint){ counter = counter +1; - return counter + return counter; } } ``` @@ -1529,7 +1529,7 @@ contract Constant{ uint counter; function get() public view returns(uint){ counter = counter +1; - return counter + return counter; } } ``` @@ -1857,7 +1857,7 @@ Uninitialized local variables. contract Uninitialized is Owner{ function withdraw() payable public onlyOwner{ address to; - to.transfer(this.balance) + to.transfer(this.balance); } } ``` @@ -1950,7 +1950,7 @@ If a modifier does not execute `_` or revert, the execution of the function will ### Exploit Scenario ```solidity - modidfier myModif(){ + modifier myModif(){ if(..){ _; } @@ -2212,7 +2212,7 @@ If one of the destinations has a fallback function that reverts, `bad` will alwa ### Recommendation -Favor [pull over push](https://github.com/ethereum/wiki/wiki/Safety#favor-pull-over-push-for-external-calls) strategy for external calls. +Favor [pull over push](https://docs.soliditylang.org/en/latest/common-patterns.html#withdrawal-from-contracts) strategy for external calls. ## Missing events access control @@ -2371,7 +2371,7 @@ Only report reentrancy that acts as a double call (see `reentrancy-eth`, `reentr if( ! (msg.sender.call()() ) ){ throw; } - counter += 1 + counter += 1; } ``` @@ -3035,11 +3035,11 @@ Functions that are not used. ```solidity contract Contract{ - function dead_code() internal() {} + function dead_code() internal {} } ``` -`dead_code` is not used in the contract, and make the code's review more difficult. +`dead_code` is not used in the contract, and makes the code's review more difficult. ### Recommendation @@ -3062,7 +3062,7 @@ Only report reentrancy that is based on `transfer` or `send`. ```solidity function callme(){ - msg.sender.transfer(balances[msg.sender]): + msg.sender.transfer(balances[msg.sender]); balances[msg.sender] = 0; } ``` diff --git a/slither/detectors/attributes/const_functions_asm.py b/slither/detectors/attributes/const_functions_asm.py index d4970f9547..12ca31395e 100644 --- a/slither/detectors/attributes/const_functions_asm.py +++ b/slither/detectors/attributes/const_functions_asm.py @@ -45,7 +45,7 @@ class ConstantFunctionsAsm(AbstractDetector): uint counter; function get() public view returns(uint){ counter = counter +1; - return counter + return counter; } } ``` diff --git a/slither/detectors/attributes/const_functions_state.py b/slither/detectors/attributes/const_functions_state.py index f80401bb3f..db3ac42cc2 100644 --- a/slither/detectors/attributes/const_functions_state.py +++ b/slither/detectors/attributes/const_functions_state.py @@ -45,7 +45,7 @@ class ConstantFunctionsState(AbstractDetector): uint counter; function get() public view returns(uint){ counter = counter +1; - return counter + return counter; } } ``` diff --git a/slither/detectors/functions/dead_code.py b/slither/detectors/functions/dead_code.py index 3cc903c1d7..6a05d0958d 100644 --- a/slither/detectors/functions/dead_code.py +++ b/slither/detectors/functions/dead_code.py @@ -30,10 +30,10 @@ class DeadCode(AbstractDetector): WIKI_EXPLOIT_SCENARIO = """ ```solidity contract Contract{ - function dead_code() internal() {} + function dead_code() internal {} } ``` -`dead_code` is not used in the contract, and make the code's review more difficult.""" +`dead_code` is not used in the contract, and makes the code's review more difficult.""" # endregion wiki_exploit_scenario WIKI_RECOMMENDATION = "Remove unused functions." diff --git a/slither/detectors/functions/modifier.py b/slither/detectors/functions/modifier.py index cfafecda43..2150146d73 100644 --- a/slither/detectors/functions/modifier.py +++ b/slither/detectors/functions/modifier.py @@ -51,7 +51,7 @@ class ModifierDefaultDetection(AbstractDetector): # region wiki_exploit_scenario WIKI_EXPLOIT_SCENARIO = """ ```solidity - modidfier myModif(){ + modifier myModif(){ if(..){ _; } diff --git a/slither/detectors/reentrancy/reentrancy_benign.py b/slither/detectors/reentrancy/reentrancy_benign.py index b526b0ae7f..06c39f7339 100644 --- a/slither/detectors/reentrancy/reentrancy_benign.py +++ b/slither/detectors/reentrancy/reentrancy_benign.py @@ -40,7 +40,7 @@ class ReentrancyBenign(Reentrancy): if( ! (msg.sender.call()() ) ){ throw; } - counter += 1 + counter += 1; } ``` diff --git a/slither/detectors/reentrancy/reentrancy_no_gas.py b/slither/detectors/reentrancy/reentrancy_no_gas.py index 2a9926d456..5662b9b3bc 100644 --- a/slither/detectors/reentrancy/reentrancy_no_gas.py +++ b/slither/detectors/reentrancy/reentrancy_no_gas.py @@ -44,7 +44,7 @@ class ReentrancyNoGas(Reentrancy): WIKI_EXPLOIT_SCENARIO = """ ```solidity function callme(){ - msg.sender.transfer(balances[msg.sender]): + msg.sender.transfer(balances[msg.sender]); balances[msg.sender] = 0; } ``` diff --git a/slither/detectors/statements/calls_in_loop.py b/slither/detectors/statements/calls_in_loop.py index af6663bb71..f46d4c6787 100644 --- a/slither/detectors/statements/calls_in_loop.py +++ b/slither/detectors/statements/calls_in_loop.py @@ -94,7 +94,7 @@ class MultipleCallsInLoop(AbstractDetector): If one of the destinations has a fallback function that reverts, `bad` will always revert.""" # endregion wiki_exploit_scenario - WIKI_RECOMMENDATION = "Favor [pull over push](https://github.com/ethereum/wiki/wiki/Safety#favor-pull-over-push-for-external-calls) strategy for external calls." + WIKI_RECOMMENDATION = "Favor [pull over push](https://docs.soliditylang.org/en/latest/common-patterns.html#withdrawal-from-contracts) strategy for external calls." def _detect(self) -> list[Output]: """""" diff --git a/slither/detectors/variables/uninitialized_local_variables.py b/slither/detectors/variables/uninitialized_local_variables.py index ab3853d0e6..85889fda3d 100644 --- a/slither/detectors/variables/uninitialized_local_variables.py +++ b/slither/detectors/variables/uninitialized_local_variables.py @@ -28,7 +28,7 @@ class UninitializedLocalVars(AbstractDetector): contract Uninitialized is Owner{ function withdraw() payable public onlyOwner{ address to; - to.transfer(this.balance) + to.transfer(this.balance); } } ```