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 }}
Repository navigation
SemaphoreViem.getGroupMembers skips events with zero member indexes #1095
Describe the bug SemaphoreViem.getGroupMembers() uses truthiness checks for MemberUpdated.args.index, MemberRemoved.args.index, and MembersAdded.args.startIndex. Since 0n is falsy, it skips updates/removals for the first leaf and the initial batch addition to an empty group. This returns missing or stale members.
To Reproduce
Create an empty Semaphore group.
Add two valid identity commitments using addMembers. The contract emits MembersAdded with startIndex = 0.
Call SemaphoreViem.getGroupMembers(groupId). It returns [] instead of the two commitments.
Separately, add a member using addMember, then update or remove the member at index zero. getGroupMembers() returns the original commitment instead of the updated commitment or "0".
Expected behavior
Process zero-valued indexes: return all batch-added commitments, apply updates to the first leaf, and represent a removed leaf as "0".
Screenshots
Not applicable; covered by automated regression tests.
Technologies (please complete the following information):
Node.js version: v25.8.1 (local test environment)
NPM version: 11.11.0 (project uses Yarn 4.1.0)
Solidity version: Not applicable to the mocked TypeScript reproduction
Additional context
Open PR #1036 already changes these guards, but does not include regression tests. This report tracks the concrete zero-index failure and its test coverage; please coordinate with #1036 before submitting overlapping implementation changes. PR #985 is merged, but the truthiness checks remain in upstream main at the time of inspection.
Local regression verification: five zero-index cases fail against the original implementation and pass with explicit presence checks. All 99 data-package tests pass with the fix.
Activity
fix(data): fix(data): handle zero member indexes in SemaphoreViem