# TraitForgeNft: Generations without a golden god are possible

Forging NFTs increments generationMintCounts, consuming generation slots without advancing entropy, so the golden god entropy can be skipped and never minted in a generation.

- Payout: Audit contest
- Severity: medium
- Program: TraitForge
- Found by: Trooper
- Disclosed: 2024-09-13
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2024-07-traitforge-findings/issues/656
- Library page: https://bugbountylibrary.com/r/c4%3A2024-07-traitforge%3AM-06
- Tags: area:web3 domain:web3 impact:integrity kind:contest platform:code4rena sev:medium tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:business-logic

**Target:** TraitForgeNft / EntropyGenerator NFT minting and forging contracts
**Root cause:** Forging increments generationMintCounts (capped at 10,000 per generation) but does not consume entropy slots, so the entropy pointer can jump past slotIndexSelectionPoint/numberIndexSelectionPoint (golden god) before the generation fills.
**Steps:**
1. Mint all 10,000 gen-1 NFTs via `mintToken`, tracking forger NFTs (listed via `listForForging`) and merger NFTs.
2. Mint one more NFT to increment generation to 2 (`getGeneration()==2`).
3. Forge all tracked gen-1 pairs via `forgeWithListed{value:0.01 ether}(listedId, mergeId)`, raising gen-2 `generationMintCounts` to 2909 without consuming entropy.
4. Mint remaining gen-2 NFTs until `generationMintCounts(2)==10000`.
5. Observe `currentSlotIndex/currentNumberIndex` (544,10) passed `slotIndexSelectionPoint/numberIndexSelectionPoint` (717,2) without ever minting the golden god entropy 999,999.
**How found:** Reading EntropyGenerator selection points and noticing forging increments generationMintCounts without advancing the entropy index; hypothesized the pointer could skip the golden god slot before the 10,000 cap is reached, then built a Foundry PoC minting/forging full generations to confirm.
**Exploitation:** Any user can forge NFTs to inflate generationMintCounts and burn generation capacity, causing the golden god NFT of that generation to be unreachable; repeated forging across generations denies the special entropy mint entirely.
**Insight:** When a capped supply counter is incremented by a second code path (forging) that doesn't consume the shared randomness index, the special/rare outcome tied to that index can be permanently skipped; check every writer of a supply counter against the entropy/randomness cursor.

