Skip to content

Conversation

@duncancmt
Copy link
Collaborator

No description provided.

@duncancmt duncancmt requested review from abls and e1Ru1o September 18, 2025 09:26
@duncancmt duncancmt self-assigned this Sep 18, 2025
@immunefi-magnus
Copy link

🛡️ Immunefi PR Reviews

We noticed that your project isn't set up for automatic code reviews. If you'd like this PR reviewed by the Immunefi team, you can request it manually using the link below:

🔗 Send this PR in for review

Once submitted, we'll take care of assigning a reviewer and follow up here.

duncancmt and others added 25 commits September 23, 2025 08:30
- Distinguish between timeout and actual test failure in optimize_sqrt_seeds.py
- Return tri-state result (PASS/FAIL/TIMEOUT) instead of boolean
- Increase timeout calculation to prevent false failures (150s per million fuzz runs)
- Update find_minimum_threshold.py to handle timeout status separately
- Display timeout as "insufficient time" rather than test failure
- Track timeout status in JSON results

This fixes the bug where high fuzz run counts would timeout and be incorrectly
recorded as test failures when they were actually just taking longer to complete.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Add test results for buckets 33-40 with 2M fuzz runs
- Fix format string bug in find_minimum_threshold.py (convert int to str)
- Show test timestamps for all buckets, not just multi-test ones
- Update JSON with new minimum thresholds discovered:
  * Buckets 37-40: min threshold 45
  * Bucket 34: min threshold 47
  * Bucket 35: min threshold 46
  * Bucket 36: min threshold 48
  * Bucket 33: min threshold 52

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Added test results with 2000000 fuzz runs:
- Bucket 37: min_threshold=42, seed=473
- Bucket 38: min_threshold=44, seed=467
- Bucket 39: min_threshold=42, seed=461

These results were recovered from a crashed test run and properly
formatted into the JSON results file. Bucket 40 data was excluded
due to errors during collection.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
The previous commit accidentally swapped table_hi and table_lo values
when updating the seed lookup tables from optimization results. This
caused incorrect seeds to be used for each bucket range:
- Buckets 16-39 were using seeds meant for 40-63
- Buckets 40-63 were using seeds meant for 16-39

This commit:
1. Swaps the hex values back to their correct variables
2. Updates the table selection logic to match the swap

All 48 bucket seeds now correctly match the optimized values from
threshold_optimization_results.json.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Remove temporary sqrt-optimization scripts/tests but keep the collected threshold data for reference.

Inline the quadratic bucket helper into the sole sqrt overload so we retain the gas win without extra overrides.
Pack per-bucket invE thresholds into two 240-bit words so the core sqrt logic can decode them alongside the seed, eliminating the polynomial helper.

Drop the intermediate optimization scripts/data now that the lookup table is encoded on-chain; fuzzing (100k runs) shows ~3 gas mean, ~2 gas median improvements.
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