This repository has been archived by the owner on Jan 9, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Function ScaledPool._threshold_price(uint256,uint256,uint256) (src/base/ScaledPool.sol#388-391) is not in mixedCase Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions * Fix slither reentrancy warnings Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#reentrancy-vulnerabilities-3 * Change rate calculation, perform multiply before divide: ScaledPool._pendingInterestFactor(uint256) (src/base/ScaledPool.sol#386-389) performs a multiplication on the result of a division: -rate = (interestRate / SECONDS_PER_YEAR) * elapsed_ (src/base/ScaledPool.sol#387) Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#divide-before-multiply Fix tests * Fix Variable ScaledPool.RATE_DECREASE_COEFFICIENT (src/base/ScaledPool.sol#29) is too similar to ScaledPool.RATE_INCREASE_COEFFICIENT (src/base/ScaledPool.sol#28) Variable IERC20Pool.borrowerInfo(address).pendingDebt_ (src/erc20/interfaces/IERC20Pool.sol#189) is too similar to ERC20Pool.borrowerInfo(address).pending_debt (src/erc20/ERC20Pool.sol#286) Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#variable-names-are-too-similar IERC20Pool.borrowers(address).inflatorSnapshot (src/erc20/interfaces/IERC20Pool.sol#73) shadows: - IScaledPool.inflatorSnapshot() (src/base/interfaces/IScaledPool.sol#94) (function) Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#local-variable-shadowing * Remove slither timestamp detector as we're not using it for randomness but storing and using for calculating interest rates See https://github.com/crytic/slither/wiki/Detector-Documentation#block-timestamp * Fix Reentrancy in ERC20PoolFactory.deployPool(address,address,uint256) (src/erc20/ERC20PoolFactory.sol#25-36): External calls: - pool.initialize(interestRate_) (src/erc20/ERC20PoolFactory.sol#31) State variables written after the call(s): - deployedPools[ERC20_NON_SUBSET_HASH][collateral_][quote_] = pool_ (src/erc20/ERC20PoolFactory.sol#34) Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#reentrancy-vulnerabilities-1 FenwickTree Fix FenwickTree._findSum(uint256).ss (src/base/FenwickTree.sol#135) is a local variable never initialized FenwickTree._add(uint256,uint256).ii (src/base/FenwickTree.sol#65) is a local variable never initialized FenwickTree._prefixSum(uint256).ii (src/base/FenwickTree.sol#108) is a local variable never initialized FenwickTree._mult(uint256,uint256).sum (src/base/FenwickTree.sol#38) is a local variable never initialized FenwickTree._remove(uint256,uint256).ii (src/base/FenwickTree.sol#87) is a local variable never initialized Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#uninitialized-local-variables FenwickTree improvements - minimize calculations of indexes, LSB before commit ╭──────────────────────────────────────────────────────────┬─────────────────┬───────┬────────┬────────┬─────────╮ │ src/_test/FenwickTree.t.sol:FenwickTreeInstance contract ┆ ┆ ┆ ┆ ┆ │ ╞══════════════════════════════════════════════════════════╪═════════════════╪═══════╪════════╪════════╪═════════╡ │ Deployment Cost ┆ Deployment Size ┆ ┆ ┆ ┆ │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤ │ 516149 ┆ 2610 ┆ ┆ ┆ ┆ │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤ │ Function Name ┆ min ┆ avg ┆ median ┆ max ┆ # calls │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤ │ add ┆ 13051 ┆ 97343 ┆ 37808 ┆ 300708 ┆ 4 │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤ │ findSum ┆ 14183 ┆ 21813 ┆ 14714 ┆ 68961 ┆ 8 │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤ │ mult ┆ 58722 ┆ 69520 ┆ 69520 ┆ 80318 ┆ 2 │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤ │ prefixSum ┆ 1592 ┆ 11216 ┆ 11934 ┆ 15783 ┆ 8 │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤ │ remove ┆ 13018 ┆ 13018 ┆ 13018 ┆ 13018 ┆ 1 │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤ │ treeSum ┆ 341 ┆ 341 ┆ 341 ┆ 341 ┆ 1 │ ╰──────────────────────────────────────────────────────────┴─────────────────┴───────┴────────┴────────┴─────────╯ after commit ╭──────────────────────────────────────────────────────────┬─────────────────┬───────┬────────┬────────┬─────────╮ │ src/_test/FenwickTree.t.sol:FenwickTreeInstance contract ┆ ┆ ┆ ┆ ┆ │ ╞══════════════════════════════════════════════════════════╪═════════════════╪═══════╪════════╪════════╪═════════╡ │ Deployment Cost ┆ Deployment Size ┆ ┆ ┆ ┆ │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤ │ 576206 ┆ 2910 ┆ ┆ ┆ ┆ │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤ │ Function Name ┆ min ┆ avg ┆ median ┆ max ┆ # calls │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤ │ add ┆ 12579 ┆ 96771 ┆ 37202 ┆ 300102 ┆ 4 │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤ │ findSum ┆ 13434 ┆ 18162 ┆ 13965 ┆ 68212 ┆ 16 │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤ │ mult ┆ 56841 ┆ 67577 ┆ 67577 ┆ 78314 ┆ 2 │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤ │ prefixSum ┆ 1427 ┆ 10366 ┆ 10997 ┆ 14730 ┆ 8 │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤ │ remove ┆ 12613 ┆ 12613 ┆ 12613 ┆ 12613 ┆ 1 │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤ │ treeSum ┆ 341 ┆ 341 ┆ 341 ┆ 341 ┆ 2 │ ╰──────────────────────────────────────────────────────────┴─────────────────┴───────┴────────┴────────┴─────────╯ * Fix Variable ScaledPool._poolInitializations (src/base/ScaledPool.sol#69) is not in mixedCase Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions * Disable inline as we're not using strict equality to determine if an account has enough Ether or tokens FenwickTree._mult(uint256,uint256) (src/base/FenwickTree.sol#33-61) uses a dangerous strict equality: - (lsbJ < _lsb(i_)) || (i_ == 0 && j <= SIZE) (src/base/FenwickTree.sol#53) Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#dangerous-strict-equalities
- Loading branch information