- 
                Notifications
    You must be signed in to change notification settings 
- Fork 36
          Golf 512-bit sqrt some more
          #406
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Open
      
      
            duncancmt
  wants to merge
  74
  commits into
  dcmt/sqrt512
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
dcmt/sqrt512-golf
  
      
      
   
  
    
  
  
  
 
  
      
    base: dcmt/sqrt512
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
                
     Open
            
            
          Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    | 🛡️ Immunefi PR ReviewsWe 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: Once submitted, we'll take care of assigning a reviewer and follow up here. | 
a13a6b4    to
    d1ae4f7      
    Compare
  
    - 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.
2e7c88b    to
    db2fb2b      
    Compare
  
    
              
                    e1Ru1o
  
              
              approved these changes
              
                  
                    Oct 7, 2025 
                  
              
              
            
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
No description provided.