QA Report #218
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
Low
Missing approval reset
Booster#deposit
callssafeApprove
without first ensuring that the approval balance is zero. However,safeApprove
will revert if the approval amount is not zero. If the reward contract has an existing approval amount, this may cause deposits to revert.Booster#deposit
Recommendation: set approval to zero before setting the new amount:
Noncritical
Prefer two step authorization changes
Several contracts set a privileged owner/operator address in a single step. If this operator address is set to zero or an incorrect value, ownership of these contracts may be permanently lost.
Suggestion: handle ownership changes with two steps and two transactions. First, allow the current owner/operator to propose a new owner address. Second, allow the proposed address (and only the proposed address) to accept ownership, and update the contract owner internally.
VeToken#setOperator
Ve3Token#setOperator
VoterProxy#setOwner
VoterProxy#setoperator
VoterProxy#setDepositor
Emit events from permissioned functions
Consider adding events to protected functions that change contract state, especially when updating privileged user addresses. This enables you to monitor these events off chain for suspicious activity, and in the case of protocol parameter changes, allows end users to observe and trust changes made to these parameters.
VoterProxy#setOwner
VoterProxy#setoperator
VoterProxy#setDepositor
VeTokenMinter#addOperator
VeTokenMinter#removeOperator
VeTokenMinter#updateveAssetWeight
VE3DRewardPool#addOperator
VE3DRewardPool#removeOperator
VE3DRewardPool#addOperator
TokenFactory#addOperator
TokenFactory#removeOperator
RewardFactory#removeActiveReward
RewardFactory#addActiveReward
RewardFactory#removeOperator
RewardFactory#removeOperator
RewardFactory#addOperator
VeToken#setOperator
Ve3Token#setOperator
QA
Calculate APY off chain
BaseRewardPool
uses a rough estimate ofBLOCKS_PER_YEAR
to calculate APY. However, blocktimes are currently variable and using this fixed value may over- or under-estimate the APY. Consider calculating this value offchain usingrewardRate
andtotalSupply
rather than using a hardcoded blocks per day estimate.BaseRewardPool#getAPY
Omit
SafeMath
librarySolidity versions >= 0.8.x perform checked arithmetic by default, so the
SafeMath
library is unnecessary in most cases. (However, it may be convenient to include it in some cases to maintain compatibility with forked contracts, like SynthetixBaseRewardPool
).Usages of
SafeMath
:Omit unused libraries
There are several places throughout the codebase where the
SafeERC20
,Address
, andSafeMath
libraries are imported and attached, but unused.For example, see
Ve3Token.sol
:Since none of this contract's functions make use of
SafeERC20
,Address
, orSafeMath
library functions, they may all be safely omitted.Log previous values in events
Consider logging the previous value in events that log parameter state changes. This makes it easier to identify the impact of these changes when monitoring off-chain.
Booster#setOwner
Unused imports
EnumerableSet.sol
inPoolManager
Incorrect comment
A comment in
Booster#setFees
suggests that fee values must be limited to certain ranges, but the range validation from the upstream Convex booster contract has been removed in the veToken booster.Typos
platform
inBooster
Exceed
inVeToken#mint
The text was updated successfully, but these errors were encountered: