Submitted by Kalogerone, also found by samuraii77, anonymousjoe, Decap, sl1, Shahil_Hussain, and yotov721
https://github.com/code-423n4/2024-07-traitforge/blob/main/contracts/EntropyGenerator/EntropyGenerator.sol#L206
https://github.com/code-423n4/2024-07-traitforge/blob/main/contracts/TraitForgeNft/TraitForgeNft.sol#L345
https://github.com/code-423n4/2024-07-traitforge/blob/main/contracts/EntropyGenerator/EntropyGenerator.sol#L10
The location of the Golden God NFT with entropy of 999999 is calculated by the initializeAlphaIndices function in the EntropyGenerator contract.
It is confirmed by the devs/sponsors that TraitForgeNft contract is the only allowed caller of the initializeAlphaIndices. As we can see, the function is protected by a modifier and when the generation is getting incremented, TraitForgeNft is the caller.
Each generation is supposed to contain 1 Golden God NFT. According to the TraitForge docs:
Entropies are stored in the following array:
We have 770 slots with 13 entropies each, which means 770 * 13 = 10,010 total entropies generated.
The last 10 entropies are skipped when the generation ends, since there is a max mint value of 10,000 NFTs per generation and when it is reached, it increments to the next generation. There is a chance that the 999999 entropy is placed in the last entropy slot, in the last 10 entropies of that slot and is lost and not mintable. Since the generation has incremented by the TraitForgeNft contract, the action is not recoverable.
There is a chance that the Golden God NFT is completely lost and not mintable for a generation. This goes against the docs and the expectations of the game.
Implement a check that ensures that the 999999 entropy is not set out of bounds.
Math
Kalogerone (warden) commented:
Koolex (judge) commented:
Kalogerone (warden) commented:
For this audit, 18 reports were submitted by wardens detailing low risk and non-critical issues. The report highlighted below by jesjupyter received the top score from the judge.
The following wardens also submitted reports: Agontuk, K42, Bauchibred, Udsen, lrivo, TECHFUND-inc, _karanel, ZanyBonzy, atoko, Trooper, Saurabh_Singh, 0xlemon, kutugu, KupiaSec, hl_, 4rdiii, and dimulski.
