You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelHighA valid High severity issueRewardA payout will be made for this issue
The first founder will lose 1% ownership if reservedUntilTokenId >= 100.
Summary
The first founder will lose 1% ownership if reservedUntilTokenId >= 100.
Vulnerability Detail
While adding founders in _addFounders(), baseTokenId starts from reservedUntilTokenId.
File: nouns-protocol\src\token\Token.sol
161: uint256 baseTokenId = reservedUntilTokenId; //@audit doesn't work when >= 100162:
163: // For each token to vest:164: for (uint256 j; j < founderPct; ++j) {
165: // Get the available token id166: baseTokenId =_getNextTokenId(baseTokenId);
167:
168: // Store the founder as the recipient169: tokenRecipient[baseTokenId] = newFounder;
170:
171: emitMintScheduled(baseTokenId, founderId, newFounder);
172:
173: // Update the base token id174: baseTokenId = (baseTokenId + schedule) %100;
175: }
So if reservedUntilTokenId is equal to or greater than 100, the first founder will be a recipient of baseTokenId which is greater than 99.
But tokenRecipient is useful only for [0, 99] and it means the first founder loses 1% ownership.
Here is a coded POC which can be added to Token.t.sol.
function testLoseOwnershipWithBigReserveId() public {
uint256 reservedUntilTokenId =100;
deployAltMock(reservedUntilTokenId);
uint256 expectedTotalOwnership = token.totalFounderOwnership();
Founder memory thisFounder;
uint actualTotalOwnership;
for (uint256 i; i <=99; ++i) {
thisFounder = token.getScheduledRecipient(i);
actualTotalOwnership += thisFounder.wallet !=address(0) ?1: 0;
}
assertEq(expectedTotalOwnership, actualTotalOwnership +1);
}
As we can see from the test, actualTotalOwnership is less than the expected value.
Impact
The first founder will lose 1% ownership if reservedUntilTokenId >= 100.
sherlock-admin
changed the title
Plain Caramel Porcupine - The first founder will lose 1% ownership if reservedUntilTokenId >= 100.
KupiaSec - The first founder will lose 1% ownership if reservedUntilTokenId >= 100.
Dec 13, 2023
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelHighA valid High severity issueRewardA payout will be made for this issue
KupiaSec
high
The first founder will lose 1% ownership if
reservedUntilTokenId >= 100
.Summary
The first founder will lose 1% ownership if
reservedUntilTokenId >= 100
.Vulnerability Detail
While adding founders in
_addFounders()
, baseTokenId starts fromreservedUntilTokenId
.So if
reservedUntilTokenId
is equal to or greater than 100, the first founder will be a recipient ofbaseTokenId
which is greater than 99.But
tokenRecipient
is useful only for [0, 99] and it means the first founder loses 1% ownership.Here is a coded POC which can be added to
Token.t.sol
.As we can see from the test,
actualTotalOwnership
is less than the expected value.Impact
The first founder will lose 1% ownership if
reservedUntilTokenId >= 100
.Code Snippet
https://github.com/sherlock-audit/2023-09-nounsbuilder/tree/main/nouns-protocol/src/token/Token.sol#L166
Tool used
Manual Review
Recommendation
baseTokenId should be set like this.
Duplicate of #42
The text was updated successfully, but these errors were encountered: