Skip to content

fix(rpc): reject nullifier prefixes that exceed 16 bits - #2589

Open
devorun wants to merge 1 commit into
0xMiden:nextfrom
devorun:fix/sync-nullifiers-prefix-range
Open

fix(rpc): reject nullifier prefixes that exceed 16 bits#2589
devorun wants to merge 1 commit into
0xMiden:nextfrom
devorun:fix/sync-nullifiers-prefix-range

Conversation

@devorun

@devorun devorun commented Sep 7, 2026

Copy link
Copy Markdown

Summary

Fixes #2543.

SyncNullifiers validates that prefix_len == 16 but does not validate that each requested prefix fits in 16 bits. The store then narrows prefixes with prefix as u16, which silently truncates an out-of-range value (e.g. 65536 -> 0) and queries a different prefix than the client requested.

  • reject any prefix greater than u16::MAX with InvalidArgument, right after the existing prefix_len check, so the request fails before reaching the narrowing cast
  • add a regression test asserting that a prefix of 65536 is rejected with InvalidArgument

SyncNullifiers accepts prefixes as u32, but the store narrows them with `prefix as u16`, silently truncating an out-of-range value (e.g. 65536 -> 0) and querying a different prefix than the client requested. Reject any prefix greater than u16::MAX with InvalidArgument, alongside the existing prefix_len validation.
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.

sync_nullifiers silently truncates out-of-range 16-bit prefixes instead of rejecting them

1 participant