QA Report #452
Labels
bug
Something isn't working
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
QA Report
Summary
address(0)
checksFindings
1- Missing zero address
address(0)
checks :Constructors should check the address written in an immutable address variable is not the zero address
Impact - Low Risk
Proof of Concept
Instances include:
File: src/Kernel.sol
kernel = kernel_;
File: src/modules/MINTR.sol
ohm = OHM(ohm_);
File: src/modules/RANGE.sol
ohm = tokens_[0];
reserve = tokens_[1];
File: src/policies/Operator.sol
ohm = tokens_[0];
reserve = tokens_[1];
Mitigation
Add non-zero address checks in the constructors for the instances aforementioned.
2- Setters should check the input value and revert if it's the zero address or zero :
Setters should check the input values and revert if it's the zero address or zero.
Impact - Low Risk
Proof of Concept
Instances include:
File: src/Kernel.sol
function changeKernel(Kernel newKernel_)
File: src/policies/Heart.sol
function setRewardTokenAndAmount(ERC20 token_, uint256 reward_)
Mitigation
Add non-zero checks - address or uint - to the setters aforementioned.
3- Event should be emitted in setters :
Setters should emit an event so that Dapps can detect important changes to storage.
Impact - Low Risk
Proof of Concept
Instances include:
File: src/Kernel.sol
function changeKernel(Kernel newKernel_)
function setActiveStatus(bool activate_)
File: src/policies/BondCallback.sol
function setOperator(Operator operator_)
File: src/policies/Operator.sol
function setBondContracts(IBondAuctioneer auctioneer_, IBondCallback callback_)
File: src/policies/VoterRegistration.sol
function issueVotesTo(address wallet_, uint256 amount_)
function revokeVotesFrom(address wallet_, uint256 amount_)
Mitigation
Emit an event in the functions aforementioned.
4- Named return variables not used anywhere in the function :
Named return variable should be used inside the function or if not they should be removed to avoid confusion.
Impact - NON CRITICAL
Proof of Concept
Instances include:
File: src/policies/BondCallback.sol
returns (uint256 in_, uint256 out_)
Mitigation
Either use the named return variables or remove them.
5- Related data should be grouped in a struct :
When there are mappings that use the same key value, having separate fields is error prone, for instance in case of deletion or with future new fields.
Impact - NON CRITICAL
Proof of Concept
Instances include:
Mitigation
Group the related data in a struct and use one mapping:
And it would be used as a state variable :
The text was updated successfully, but these errors were encountered: