Skip to content

Stop the prefix privacy ratio from overflowing for long prefixes - #183

Merged
illuzen merged 2 commits into
Quantus-Network:mainfrom
Iamsohungrynow:fix/prefix-ratio-overflow
Oct 19, 2026
Merged

illuzen merged 2 commits into
Quantus-Network:mainfrom
Iamsohungrynow:fix/prefix-ratio-overflow

Conversation

@Iamsohungrynow

Copy link
Copy Markdown
Contributor

1u64 << (prefix_len * 4) overflows once prefix_len is 16 or more, so transfers hash-address --prefix-len 64 panics in a debug build and query shows a wrong ratio in release. it now prints 2^N past u64, shorter prefixes print the same as before

@Iamsohungrynow

Copy link
Copy Markdown
Contributor Author

hi @n13, friendly ping on this one when you have a moment, ci is still waiting for approval. happy to rebase or change anything

@illuzen
illuzen requested a review from n13 October 19, 2026 10:17
@illuzen illuzen added the bot-review Request automated review from review-bot label Oct 19, 2026

@n13 n13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer model: GPT-6.1 Sol

APPROVE — no blocking findings.

Reviewed head a91abfb59a8aa3fcabaf7e6e65b84931f61fdbef against base a74fd735fdb7cae2381b66dbaaa513630c0d58d9.

Both transfers query and transfers hash-address now share the overflow-safe formatter. Decimal output is preserved for prefixes below 16 hex characters, and longer prefixes correctly use powers of two, including 2^256 for length 64. The regression tests cover the 15/16 boundary and full-length command handling.

Validation:

  • cargo test --locked --lib cli::transfers::tests: 4 passed.
  • cargo +nightly-2026-08-31 fmt --all -- --check: passed.
  • git diff --check against the recorded base: passed.
  • GitHub format, Clippy/docs, security audit, and dependency cooldown checks passed. Build/test matrix and examples jobs were still running at review time.

@n13 n13 removed the bot-review Request automated review from review-bot label Oct 19, 2026
@n13

n13 commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Looks good thank you for contributing!

@illuzen

illuzen commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Hi @Iamsohungrynow this is a nice contribution, thank you. If you'd like to connect, please join our telegram and message @yuvilightman

@illuzen
illuzen merged commit 1b0aaf9 into Quantus-Network:main Oct 19, 2026
9 checks passed
@Iamsohungrynow

Copy link
Copy Markdown
Contributor Author

thanks! will message yuvi on telegram

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.

3 participants