The protocol implements a bit-packing mechanism to generate unique tokenIDs for memorabilia NFTs through the FestivalPass.encodeTokenId function. This mechanism divides the capacity of a uint256 (256-bit) variable slot into two equal parts: the left 128-bits for collectionId (via a left shift << 128 operation) and the right 128-bits for itemId.
However, the data types of the parameter variables accepted by the encodeTokenId and decodeTokenId functions, as well as the state of their constituent variables (nextCollectionId and currentItemId), are declared using uint256.
If collectionId or itemId grows beyond its maximum bit space (2^128 - 1 or 0xffffffffffffffffffffffffffffffffff), it will either undergo silent truncation when shifted, or cause data corruption in the tokenId structure. For example, if collectionId reaches 2^128, the operation collectionId << 128 will drop the 129th bit and return a value of 0. As a result, the resulting tokenId will collide with data from collection ID 0 or other original collections.
Impact Medium
Token ID Collision: Collections with very large ID values will have token IDs overlapping with collections with small values. This can disrupt view functions like FestivalPass.uri and FestivalPass.getMemorabiliaDetails.
While this is potentially fatal to NFT data integrity, the actual severity on mainnet is categorized as Medium, as it would require a massive 2^128$ collection creation to exceed this threshold.
Likelyhood Low
-The maximum limit of uint128 (2^128 - 1$) is a very large number (+- 3.4 * 10^38). In practice, this limit is almost impossible to reach through normal execution on the blockchain within the project's lifetime, unless there is an ID manipulation function or a drastic counter jump.
Use OpenZeppelin's SafeCast library to explicitly ensure that the input collectionId and itemId are below the maximum range of uint128 before performing the shift operation. If it exceeds the limit, the transaction will automatically revert.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.