diff --git a/crates/sdk/tests/integration_test.rs b/crates/sdk/tests/integration_test.rs index ef4489a63..7fa7cd768 100644 --- a/crates/sdk/tests/integration_test.rs +++ b/crates/sdk/tests/integration_test.rs @@ -307,7 +307,7 @@ fn test_static_verifier_custom_pv_handler() { // Test setup println!("test setup"); - let app_log_blowup = 2; + let app_log_blowup = 1; let app_config = small_test_app_config(app_log_blowup); let app_pk = Sdk.app_keygen(app_config.clone()).unwrap(); let app_committed_exe = app_committed_exe_for_test(app_log_blowup); @@ -358,7 +358,7 @@ fn test_static_verifier_custom_pv_handler() { #[test] fn test_e2e_proof_generation_and_verification() { - let app_log_blowup = 2; + let app_log_blowup = 1; let app_config = small_test_app_config(app_log_blowup); let app_pk = Sdk.app_keygen(app_config).unwrap(); let params_reader = CacheHalo2ParamsReader::new_with_default_params_dir(); diff --git a/crates/vm/src/arch/config.rs b/crates/vm/src/arch/config.rs index bc690b3fb..2aa24a89c 100644 --- a/crates/vm/src/arch/config.rs +++ b/crates/vm/src/arch/config.rs @@ -19,8 +19,9 @@ use super::{ use crate::system::memory::BOUNDARY_AIR_OFFSET; const DEFAULT_MAX_SEGMENT_LEN: usize = (1 << 22) - 100; -// FRI Reduced Opening Chip has degree = 4. -const DEFAULT_MAX_CONSTRAINT_DEGREE: usize = 4; +// sbox is decomposed to have this max degree for Poseidon2. We set to 3 so quotient_degree = 2 +// allows log_blowup = 1 +const DEFAULT_POSEIDON2_MAX_CONSTRAINT_DEGREE: usize = 3; /// Width of Poseidon2 VM uses. pub const POSEIDON2_WIDTH: usize = 16; /// Returns a Poseidon2 config for the VM. @@ -167,7 +168,7 @@ impl SystemConfig { impl Default for SystemConfig { fn default() -> Self { Self::new( - DEFAULT_MAX_CONSTRAINT_DEGREE, + DEFAULT_POSEIDON2_MAX_CONSTRAINT_DEGREE, Default::default(), DEFAULT_MAX_NUM_PUBLIC_VALUES, ) diff --git a/crates/vm/tests/integration_test.rs b/crates/vm/tests/integration_test.rs index ca3f40c03..0468806ba 100644 --- a/crates/vm/tests/integration_test.rs +++ b/crates/vm/tests/integration_test.rs @@ -124,7 +124,7 @@ fn test_vm_override_executor_height() { )); // Test getting heights. - let vm_config = NativeConfig::aggregation(8, 5); + let vm_config = NativeConfig::aggregation(8, 3); let executor = SingleSegmentVmExecutor::new(vm_config.clone()); let res = executor @@ -211,7 +211,7 @@ fn test_vm_override_executor_height() { fn test_vm_1_optional_air() { // Aggregation VmConfig has Core/Poseidon2/FieldArithmetic/FieldExtension chips. The program only // uses Core and FieldArithmetic. All other chips should not have AIR proof inputs. - let config = NativeConfig::aggregation(4, 5); + let config = NativeConfig::aggregation(4, 3); let engine = BabyBearPoseidon2Engine::new(standard_fri_params_with_100_bits_conjectured_security(3)); let vm = VirtualMachine::new(engine, config); @@ -319,7 +319,7 @@ fn test_vm_initial_memory() { .into_iter() .collect(); - let config = NativeConfig::aggregation(0, 5).with_continuations(); + let config = NativeConfig::aggregation(0, 3).with_continuations(); let exe = VmExe { program, pc_start: 0, @@ -331,11 +331,9 @@ fn test_vm_initial_memory() { #[test] fn test_vm_1_persistent() { - let engine = BabyBearPoseidon2Engine::new( - FriParameters::standard_with_100_bits_conjectured_security(2), - ); + let engine = BabyBearPoseidon2Engine::new(FriParameters::standard_fast()); let config = NativeConfig { - system: SystemConfig::new(5, MemoryConfig::new(1, 1, 16, 10, 6, 64, 1024), 0), + system: SystemConfig::new(3, MemoryConfig::new(1, 1, 16, 10, 6, 64, 1024), 0), native: Default::default(), } .with_continuations(); @@ -445,7 +443,7 @@ fn test_vm_continuations() { let n = 200000; let program = gen_continuation_test_program(n); let config = NativeConfig { - system: SystemConfig::new(5, MemoryConfig::default(), 0).with_max_segment_len(200000), + system: SystemConfig::new(3, MemoryConfig::default(), 0).with_max_segment_len(200000), native: Default::default(), } .with_continuations(); @@ -475,13 +473,11 @@ fn test_vm_continuations_recover_state() { let n = 2000; let program = gen_continuation_test_program(n); let config = NativeConfig { - system: SystemConfig::new(5, MemoryConfig::default(), 0).with_max_segment_len(500), + system: SystemConfig::new(3, MemoryConfig::default(), 0).with_max_segment_len(500), native: Default::default(), } .with_continuations(); - let engine = BabyBearPoseidon2Engine::new( - FriParameters::standard_with_100_bits_conjectured_security(2), - ); + let engine = BabyBearPoseidon2Engine::new(FriParameters::standard_fast()); let vm = VirtualMachine::new(engine, config.clone()); let pk = vm.keygen(); let segments = vm @@ -733,7 +729,7 @@ fn test_vm_field_extension_arithmetic_persistent() { let program = Program::from_instructions(&instructions); let config = NativeConfig { - system: SystemConfig::new(5, MemoryConfig::new(1, 1, 16, 10, 6, 64, 1024), 0) + system: SystemConfig::new(3, MemoryConfig::new(1, 1, 16, 10, 6, 64, 1024), 0) .with_continuations(), native: Default::default(), }; diff --git a/extensions/native/circuit/src/extension.rs b/extensions/native/circuit/src/extension.rs index fee30c886..91a91cd8a 100644 --- a/extensions/native/circuit/src/extension.rs +++ b/extensions/native/circuit/src/extension.rs @@ -58,10 +58,10 @@ impl NativeConfig { self } - pub fn aggregation(num_public_values: usize, max_constraint_degree: usize) -> Self { + pub fn aggregation(num_public_values: usize, poseidon2_max_constraint_degree: usize) -> Self { Self { system: SystemConfig::new( - max_constraint_degree, + poseidon2_max_constraint_degree, MemoryConfig { max_access_adapter_n: 8, ..Default::default() diff --git a/extensions/native/circuit/src/fri/tests.rs b/extensions/native/circuit/src/fri/tests.rs index ae757d3e8..41395855f 100644 --- a/extensions/native/circuit/src/fri/tests.rs +++ b/extensions/native/circuit/src/fri/tests.rs @@ -7,12 +7,7 @@ use openvm_stark_backend::{ utils::disable_debug_builder, verifier::VerificationError, }; -use openvm_stark_sdk::{ - config::{baby_bear_poseidon2::BabyBearPoseidon2Engine, FriParameters}, - engine::StarkFriEngine, - p3_baby_bear::BabyBear, - utils::create_seeded_rng, -}; +use openvm_stark_sdk::{engine::StarkFriEngine, p3_baby_bear::BabyBear, utils::create_seeded_rng}; use rand::Rng; use super::{super::field_extension::FieldExtension, elem_to_ext, FriReducedOpeningChip, EXT_DEG}; @@ -123,15 +118,8 @@ fn fri_mat_opening_air_test() { assert_eq!(result, tester.read(address_space, result_pointer)); } - let mut tester = tester.build_babybear_poseidon2().load(chip).finalize(); - // Degree needs >= 4 - tester - .test::(|| { - BabyBearPoseidon2Engine::new( - FriParameters::standard_with_100_bits_conjectured_security(2), - ) - }) - .expect("Verification failed"); + let mut tester = tester.build().load(chip).finalize(); + tester.simple_test().expect("Verification failed"); disable_debug_builder(); // negative test pranking each value @@ -148,13 +136,7 @@ fn fri_mat_opening_air_test() { // Run a test after pranking each row assert_eq!( - tester - .test::(|| { - BabyBearPoseidon2Engine::new( - FriParameters::standard_with_100_bits_conjectured_security(2), - ) - }) - .err(), + tester.simple_test().err(), Some(VerificationError::OodEvaluationMismatch), "Expected constraint to fail" ); diff --git a/extensions/native/recursion/src/testing_utils.rs b/extensions/native/recursion/src/testing_utils.rs index 4d6e48430..bbdbde05a 100644 --- a/extensions/native/recursion/src/testing_utils.rs +++ b/extensions/native/recursion/src/testing_utils.rs @@ -66,9 +66,7 @@ pub mod inner { fri_params: FriParameters, ) { let vparams = test_proof_input - .run_test(&BabyBearPoseidon2Engine::new( - FriParameters::standard_with_100_bits_conjectured_security(2), - )) + .run_test(&BabyBearPoseidon2Engine::new(FriParameters::standard_fast())) .unwrap(); recursive_stark_test(