# `recipientsCounter` should start from 1 in `DonationVotingMerkleDistributionBaseStrategy`

recipientsCounter starting at 0 makes every new recipient read the first recipient's status, so only the first application is ever recorded in the pool.

- Payout: Contest reward
- Severity: high
- Program: Gitcoin
- Credited: 0xkaden
- Disclosed: 2023-09-01
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2023-09-Gitcoin-judging/issues/199
- Library page: https://bugbountylibrary.com/r/sherlock%3A2023-09-Gitcoin%3AH-2
- Tags: domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high tech:solidity technique:source-review vuln:accounting-error vuln:business-logic

**Target:** DonationVotingMerkleDistributionBaseStrategy.registerRecipient
**Root cause:** recipientsCounter initializes to 0, so the first recipient's status index is 0, which is also the default index for any unregistered recipient; _getUintRecipientStatus then returns the first recipient's status instead of Status.None.
**Steps:**
1. Alice (first recipient) calls `registerRecipient`: `recipientToStatusIndexes[Alice] = recipientsCounter = 0`, status set to Pending, counter incremented to 1.
2. Bob calls `registerRecipient`: `_getStatusRowColumn(Bob)` reads `recipientToStatusIndexes[Bob] = 0`, returning Alice's Pending status.
3. `currentStatus != Status.None`, so Bob's new application is never recorded; only an UpdatedRegistration path is taken.
4. Repeat for every subsequent recipient: all read index 0 and never register.
**How found:** Code reading of _registerRecipient/_getStatusRowColumn/_getUintRecipientStatus, noticing the default mapping value 0 collides with the first assigned index because the counter starts at 0.
**Escalation:** Pool manager trusting on-chain statuses may distribute the full poolAmount to the first recipient; otherwise pool is unusable and must be redeployed, wasting gas.
**Insight:** When a mapping's default value (0) is also a valid assigned index, the first entry becomes indistinguishable from 'unset' — check counter/index initialization against default-value semantics in bitmap/status storage.
