Skip to content
This repository was archived by the owner on Dec 7, 2023. It is now read-only.

Commit 64dca1a

Browse files
Merge pull request #110 from beehive-innovation/2021-10-01-slither
slither sweep
2 parents 5f2ee18 + c5b2055 commit 64dca1a

File tree

10 files changed

+43
-16
lines changed

10 files changed

+43
-16
lines changed

contracts/claim/TierByConstructionClaim.sol

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ contract TierByConstructionClaim is TierByConstruction {
118118
}
119119

120120
/// Implementing contracts need to define what is claimed.
121+
// Slither false positive. This is intended to overridden.
122+
// https://github.com/crytic/slither/issues/929
123+
// slither-disable-next-line dead-code
121124
function _afterClaim(
122125
address account_,
123126
uint256 report_,

contracts/factory/Factory.sol

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ abstract contract Factory is IFactory, ReentrancyGuard {
2525
/// arguments and pass them to this function directly.
2626
///
2727
/// @param data_ ABI encoded data to pass to child contract constructor.
28+
// Slither false positive. This is intended to overridden.
29+
// https://github.com/crytic/slither/issues/929
30+
// slither-disable-next-line dead-code
2831
function _createChild(bytes calldata data_)
2932
internal
3033
virtual

contracts/pool/RedeemableERC20Pool.sol

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ contract RedeemableERC20Pool is Ownable, Phased {
143143
uint256 public immutable finalValuation;
144144

145145
/// @param config_ All configuration for the `RedeemableERC20Pool`.
146+
// Slither false positive. Constructors cannot be reentrant.
147+
// https://github.com/crytic/slither/issues/887
148+
// slither-disable-next-line reentrancy-benign
146149
constructor (RedeemableERC20PoolConfig memory config_) public {
147150
require(
148151
config_.reserveInit >= MIN_RESERVE_INIT,

contracts/redeemableERC20/RedeemableERC20.sol

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@ contract RedeemableERC20 is
233233
/// clear bounds on gas etc.
234234
/// @return Dynamic `redeemables` mapped to a fixed size array.
235235
function getRedeemables() external view returns (address[8] memory) {
236+
// Slither false positive here due to a bug in slither.
237+
// https://github.com/crytic/slither/issues/884
238+
// slither-disable-next-line uninitialized-local
236239
address[8] memory redeemablesArray_;
237240
for(uint256 i_ = 0;i_<redeemables.length;i_++) {
238241
redeemablesArray_[i_] = address(redeemables[i_]);
@@ -312,6 +315,9 @@ contract RedeemableERC20 is
312315

313316
/// Sanity check to ensure `Phase.ONE` is the final phase.
314317
/// @inheritdoc Phased
318+
// Slither false positive. This is overriding an Open Zeppelin hook.
319+
// https://github.com/crytic/slither/issues/929
320+
// slither-disable-next-line dead-code
315321
function _beforeScheduleNextPhase(uint32 nextPhaseBlock_)
316322
internal
317323
override
@@ -327,6 +333,9 @@ contract RedeemableERC20 is
327333
/// If a transfer involves either a sender or receiver with the relevant
328334
/// `unfreezables` state it will ignore these restrictions.
329335
/// @inheritdoc ERC20
336+
// Slither false positive. This is overriding an Open Zeppelin hook.
337+
// https://github.com/crytic/slither/issues/929
338+
// slither-disable-next-line dead-code
330339
function _beforeTokenTransfer(
331340
address sender_,
332341
address receiver_,

contracts/test/BalancerCoreImports.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// SPDX-License-Identifier: CAL
2+
// Slither false positive. Can't do anything about old Balancer code.
3+
// slither-disable-next-line solc-version
24
pragma solidity 0.5.12;
35

46
/// Imports to make artifacts available to test scripts.

contracts/tier/ReadWriteTier.sol

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ contract ReadWriteTier is ITier {
9090
/// @param startTier_ The tier the account had before this update.
9191
/// @param endTier_ The tier the account will have after this update.
9292
/// @param data_ Additional arbitrary data to inform update requirements.
93+
// Slither false positive. This is intended to overridden.
94+
// https://github.com/crytic/slither/issues/929
95+
// slither-disable-next-line dead-code
9396
function _afterSetTier(
9497
address account_,
9598
Tier startTier_,

contracts/tier/VerifyTier.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ contract VerifyTier is ReadOnlyTier {
2727
function report(address account_) public override view returns (uint256) {
2828
State memory state_ = verify.state(account_);
2929
if (
30+
// This is comparing an enum variant so it must be equal.
31+
// slither-disable-next-line incorrect-equality
3032
verify.statusAtBlock(
3133
state_,
3234
uint32(block.number)

contracts/trust/Trust.sol

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,9 @@ contract Trust is ReentrancyGuard {
353353
/// https://github.com/crytic/slither/issues/887
354354
///
355355
/// @param config_ Config for the Trust.
356+
// Slither false positive. Constructors cannot be reentrant.
357+
// https://github.com/crytic/slither/issues/887
358+
// slither-disable-next-line reentrancy-benign
356359
constructor (
357360
TrustConfig memory config_,
358361
TrustRedeemableERC20Config memory trustRedeemableERC20Config_,

contracts/verify/Verify.sol

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,10 @@ contract Verify is AccessControl {
239239
// A mistaken add requires an appeal to a REMOVER to restart the
240240
// process OR a new `msg.sender` (i.e. different wallet address).
241241
require(id_ != 0, "0_ID");
242-
require(states[msg.sender].addedSince == 0, "PRIOR_ADD");
242+
// The awkward < 1 here is to silence slither complaining about
243+
// equality checks against `0`. The intent is to ensure that
244+
// `addedSince` is not already set before we set it.
245+
require(states[msg.sender].addedSince < 1, "PRIOR_ADD");
243246
states[msg.sender] = State(
244247
id_,
245248
uint32(block.number),

shell.nix

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
let
2-
pkgs = import <nixpkgs> { };
2+
pkgs = import (builtins.fetchTarball {
3+
name = "nixos-unstable-2021-10-01";
4+
url = "https://github.com/nixos/nixpkgs/archive/82155ff501c7622cb2336646bb62f7624261f6d7.tar.gz";
5+
sha256 = "0xv47cpgaxb4j46ggjx9gkg299m9cdfzar27xw5h5k2lg5d3dljg";
6+
}) { };
37

48
local-node = pkgs.writeShellScriptBin "local-node" ''
59
hardhat node
@@ -31,24 +35,16 @@ let
3135
'';
3236

3337
security-check = pkgs.writeShellScriptBin "security-check" ''
34-
# Workaround a slither bug due to stale compiled artifacts.
35-
# https://github.com/crytic/slither/issues/860
3638
rm -rf artifacts
37-
rm -rf typechain
3839
rm -rf cache
39-
40-
# Install slither to a fresh tmp dir to workaround nix-shell immutability.
41-
export td=$(mktemp -d)
42-
python3 -m venv ''${td}/venv
43-
source ''${td}/venv/bin/activate
44-
pip install slither-analyzer
40+
rm -rf node_modules
41+
rm -rf typechain
42+
rm -rf bin
43+
npm install
4544
4645
# Run slither against all our contracts.
4746
# Disable npx as nix-shell already handles availability of what we need.
48-
# Some contracts are explicitly out of scope for slither:
49-
# - configurable-rights-pool contracts
50-
# - The test contracts that only exist so the test harness can drive unit tests and will never be deployed
51-
# - Open Zeppelin contracts
47+
# Dependencies and tests are out of scope.
5248
slither . --npx-disable --filter-paths="contracts/test" --exclude-dependencies
5349
'';
5450

@@ -146,7 +142,7 @@ pkgs.stdenv.mkDerivation {
146142
buildInputs = [
147143
pkgs.nixpkgs-fmt
148144
pkgs.nodejs-14_x
149-
pkgs.python3
145+
pkgs.slither-analyzer
150146
local-node
151147
local-fork
152148
local-test

0 commit comments

Comments
 (0)