Skip to content

fix(data): fix(data): handle zero member indexes in SemaphoreViem - #1096

Open
somasoil wants to merge 1 commit into
semaphore-protocol:mainfrom
somasoil:main
Open

somasoil wants to merge 1 commit into
semaphore-protocol:mainfrom
somasoil:main

Conversation

@somasoil

@somasoil somasoil commented Oct 3, 2026

Copy link
Copy Markdown

Description

SemaphoreViem.getGroupMembers() skips valid events when index or startIndex is 0n, because its guards use truthiness checks. This loses the initial batch of members and leaves the first member stale after an update or removal.

Replace those guards with explicit undefined checks and exclude null/undefined block numbers. Add regression coverage for batch additions starting at zero and updates/removals at index zero, including block number zero. Removed members retain the existing "0" representation. No breaking changes.

Related Issue(s)

Fixes #1095

Overlaps with open PR #1036, which changes the same event guards without regression tests. Please coordinate whether to incorporate these tests into #1036 or use this PR as the complete fix.

Other information

Validation:

  • All 99 tests across the five data-package test suites pass.
  • All five new zero-index test cases fail against the original implementation.
  • yarn format and yarn lint exit successfully. Solhint reports 27 existing contract warnings.
  • Built @semaphore-protocol/utils before running tests to provide its TypeScript declarations.

Checklist

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have run yarn format and yarn lint without getting any errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

`SemaphoreViem.getGroupMembers()` skips valid events when `index` or `startIndex` is `0n`, because
its guards use truthiness checks. This loses the initial batch of members and leaves the first
member stale after an update or removal.

re semaphore-protocol#1095
@somasoil
somasoil requested a review from a team as a code owner October 3, 2026 12:48
@somasoil

somasoil commented Oct 9, 2026

Copy link
Copy Markdown
Author

@vplasencia Could you please take a look when you have a chance? Thanks!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SemaphoreViem.getGroupMembers skips events with zero member indexes

1 participant