Skip to content
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

Add test config in zero bin #742

Merged
merged 22 commits into from
Nov 4, 2024
Merged

Conversation

sai-deng
Copy link
Contributor

@sai-deng sai-deng commented Oct 22, 2024

#676 Now, with the --use-test-config flag, you should see a significant speed gain when running tests with Zero Bin. In the example below, execution time was reduced by around 48% when proving blocks on the testnet.

Before

 Performance counter stats for './target/release/leader --runtime in-memory -b 10 -m 19 -n 12 rpc --rpc-url http://35.242.167.249:18545 --block-interval 448 --checkpoint-block-number 447':

       21864778.01 msec task-clock                       #   19.499 CPUs utilized          
          13790664      context-switches                 #  630.725 /sec                   
            820894      cpu-migrations                   #   37.544 /sec                   
          17892006      page-faults                      #  818.303 /sec                   
   <not supported>      cycles                                                      
   <not supported>      instructions                                                
   <not supported>      branches                                                    
   <not supported>      branch-misses                                               

    1121.328607001 seconds time elapsed

   21344.317469000 seconds user
     538.293330000 seconds sys

After

Performance counter stats for './target/release/leader --use-test-config --persistence none --runtime in-memory -b 10 -m 19 -n 12 rpc --rpc-url http://35.242.167.249:18545 --block-interval 448 --checkpoint-block-number 447':

       13871088.09 msec task-clock                       #   23.721 CPUs utilized          
           9171155      context-switches                 #  661.171 /sec                   
            497524      cpu-migrations                   #   35.868 /sec                   
          10917169      page-faults                      #  787.045 /sec                   
   <not supported>      cycles                                                      
   <not supported>      instructions                                                
   <not supported>      branches                                                    
   <not supported>      branch-misses                                               

     584.763748797 seconds time elapsed

   13490.322378000 seconds user
     392.407730000 seconds sys

@sai-deng sai-deng changed the base branch from develop to sai/faster_config October 22, 2024 16:33
@github-actions github-actions bot added crate: evm_arithmetization Anything related to the evm_arithmetization crate. crate: zero_bin Anything related to the zero-bin subcrates. labels Oct 22, 2024
@sai-deng sai-deng changed the title Sai/add test config in zero bin Add test config in zero bin Oct 22, 2024
@sai-deng sai-deng marked this pull request as ready for review October 22, 2024 22:58
@@ -62,6 +62,9 @@ macro_rules! gen_prover_state_config {
pub persistence: CircuitPersistence,
#[clap(long, help_heading = HEADING, default_value_t = TableLoadStrategy::OnDemand)]
pub load_strategy: TableLoadStrategy,
/// Run in an unsafe but fast configuration for testing
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain what unsafe means here? What's the tradeoff to the user? What does it mean if it passes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

unsafe may not be the appropriate term here. I've updated the comments to reflect that. Passing tests with use_test_config confirms the logic and correctness of the code, but it doesn't guarantee the security of the proofs generated, as this configuration sacrifices security for speed.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't really understand what security means in this context, but I'm happy with the change

Copy link
Contributor Author

@sai-deng sai-deng Oct 23, 2024

Choose a reason for hiding this comment

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

Our current STARK configuration targets a 100-bit security level, meaning an attacker would need to make 2^100 attempts to create a fraudulent proof that the verifier would accept. However, we can lower this security level (allowing an attacker to require significantly fewer attempts to create a fraudulent proof) in exchange for faster performance during testing.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@0xaatif are you good with this part, or should Sai reword the one-liner?

@sai-deng sai-deng self-assigned this Oct 23, 2024
Copy link
Contributor

@LindaGuiga LindaGuiga left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@Nashtare Nashtare left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@Nashtare Nashtare added this to the Testing and Validation milestone Nov 4, 2024
Base automatically changed from sai/faster_config to develop November 4, 2024 19:33
@sai-deng sai-deng merged commit 4a747b2 into develop Nov 4, 2024
22 checks passed
@sai-deng sai-deng deleted the sai/add_test_config_in_zero_bin branch November 4, 2024 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crate: evm_arithmetization Anything related to the evm_arithmetization crate. crate: zero_bin Anything related to the zero-bin subcrates.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants