Skip to content

Upgraded Q -> 2 from #18 [1677668571999] #36

Description

@c4-judge

Judge has assessed an item in Issue #18 as 2 risk. The relevant finding follows:

[L-01] changePayees can result in broken share count
Description
for (uint256 i; i < newPayees.length; i++) {
if (newPayees[i] == address(0)) {
revert Errors.CANNOT_SET_TO_ADDRESS_ZERO();
}
if (newShares[i] == 0) {
revert Errors.SHARE_CANNOT_BE_ZERO();
}

    address payee = newPayees[i];
    _payees.add(payee);
    _shares[payee] = newShares[i];
    _totalShares += newShares[i];

    emit PayeeAdded(payee, newShares[i]);
}

When adding the newPayees to the payees set the contract fails to validate that each address in newPayees is unique. The results is that _totalShares will be incorrect if there is a repeat in newPayees.

Example:
Assume newPayees = [Bob,Bob] and newShares = [5,5]. Since _payees.add(payee) is a non-reverting add, if the address already exists in the set it won't revert. The end result is that _totalShares == 10 but _shares[Bob] == 5. This mismatch causes incorrect distribution of rewards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    2 (Med Risk)Assets not at direct risk, but function/availability of the protocol could be impacted or leak valueduplicate-13satisfactorysatisfies C4 submission criteria; eligible for awards

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions