QA Report #40
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 confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Gas Optimizations
Unchecked math will save on gas
The
_computeLockUntil
function inTWABDelegator.sol
can be optimized by adding theunchecked
directive as this will never overflow theuint96
type since it is limited by theMAX_LOCK
constant (which is currently assigned to 180 days() by the call to_requireLockDuration(_lockDuration);
.Unneeded Zero Address Check
In the
stake
function of theTWABDelegator.sol
file, the_requireRecipientNotZeroAddress
function is called on the_to
parameter. However, this is unnecessary since the_mint
function checks for the zero address when called. As such, it would be more gas efficient to not perform this call.More efficient order of operations in
updateDelegatee
In the
updateDelegatee
function of theTWABDelegator.sol
file the_lockUntil
variable is defined by calling the_computeLockUntil
function. However, if the_lockDuration
is 0, then this value is the same as the currentblock.timestamp
. As a result, the following code would be an optimization:Original Code:
Optimized Code:
Here are the tests with the optimizations (* indicates Optimized case):
Non-Critcal
Missing comment for the
to
parameterThere is no comment on the
to
parameter for theTransferredDelegation
event in theTWABDelegator.sol
file.Low
Incorrect Event Parameters
The
TWABDelegator.sol
'sTicketsStaked
event's first parameter should be the delegator, as such, it should bemsg.sender
not_to
as_to
is the recipient.Incorrect Comment Associated with
transferDelegationTo
The comments above the
transferDelegationTo
function are incorrect. The first line, which begins with@notice
, saysThe tickets are transferred to the caller
. However, the tickets are transfered to the_to
parameter as can be seen by the line_transfer(_delegation, _to, _amount);
In addition, the comment directly below that states
Will directly send the tickets to the delegator wallet.
This is also incorrect per the above reason.The text was updated successfully, but these errors were encountered: