diff --git a/common/src/setup.rs b/common/src/setup.rs index cdfa07ca..a7f59c9f 100644 --- a/common/src/setup.rs +++ b/common/src/setup.rs @@ -2,7 +2,7 @@ use std::{os::raw::c_void, path::Path}; use log::trace; -use proofman_starks_lib_c::{const_pols_new_c, expressions_bin_new_c, expressions_ctx_new_c, setup_ctx_new_c, stark_info_new_c}; +use proofman_starks_lib_c::{const_pols_new_c, expressions_bin_new_c, setup_ctx_new_c, stark_info_new_c}; use crate::GlobalInfo; @@ -13,7 +13,6 @@ pub struct Setup { pub air_id: usize, pub p_setup: *mut c_void, pub p_stark_info: *mut c_void, - pub p_expressions: *mut c_void, } impl Setup { @@ -46,8 +45,6 @@ impl Setup { let p_setup = setup_ctx_new_c(p_stark_info, p_expressions_bin, p_const_pols); - let p_expressions = expressions_ctx_new_c(p_setup); - - Self { air_id, air_group_id, p_setup, p_expressions, p_stark_info } + Self { air_id, air_group_id, p_setup, p_stark_info } } } diff --git a/hints/src/hints.rs b/hints/src/hints.rs index a79321e5..1a1d96e2 100644 --- a/hints/src/hints.rs +++ b/hints/src/hints.rs @@ -220,8 +220,8 @@ impl HintCol { } } -pub fn get_hint_ids_by_name(p_expressions: *mut c_void, name: &str) -> Vec { - let raw_ptr = get_hint_ids_by_name_c(p_expressions, name); +pub fn get_hint_ids_by_name(p_setup: *mut c_void, name: &str) -> Vec { + let raw_ptr = get_hint_ids_by_name_c(p_setup, name); let hint_ids_result = unsafe { Box::from_raw(raw_ptr as *mut HintIdsResult) }; @@ -246,7 +246,7 @@ pub fn get_hint_field( let setup = setup_ctx.get_setup(air_instance_ctx.air_group_id, air_instance_ctx.air_id).expect("REASON"); - let raw_ptr = get_hint_field_c(setup.p_expressions, params, hint_id as u64, hint_field_name, dest, inverse, print_expression); + let raw_ptr = get_hint_field_c(setup.p_setup, params, hint_id as u64, hint_field_name, dest, inverse, print_expression); let hint_field = unsafe { Box::from_raw(raw_ptr as *mut HintFieldInfo) }; @@ -265,7 +265,7 @@ pub fn get_hint_field_constant( let setup = setup_ctx.get_setup(air_group_id, air_id).expect("REASON"); - let raw_ptr = get_hint_field_c(setup.p_expressions, std::ptr::null_mut(), hint_id as u64, hint_field_name, dest, false, print_expression); + let raw_ptr = get_hint_field_c(setup.p_setup, std::ptr::null_mut(), hint_id as u64, hint_field_name, dest, false, print_expression); let hint_field = unsafe { Box::from_raw(raw_ptr as *mut HintFieldInfo) }; @@ -290,7 +290,7 @@ pub fn set_hint_field( _ => panic!("Only column and column extended are accepted"), }; - let id = set_hint_field_c(setup.p_expressions, params, values_ptr, hint_id, hint_field_name); + let id = set_hint_field_c(setup.p_setup, params, values_ptr, hint_id, hint_field_name); air_instance_ctx.set_commit_calculated(id as usize); } @@ -321,7 +321,7 @@ pub fn set_hint_field_val( let values_ptr = value_array.as_mut_ptr() as *mut c_void; - let id = set_hint_field_c(setup.p_expressions, params, values_ptr, hint_id, hint_field_name); + let id = set_hint_field_c(setup.p_setup, params, values_ptr, hint_id, hint_field_name); air_instance_ctx.set_subproofvalue_calculated(id as usize); } @@ -337,10 +337,10 @@ pub fn print_expression( match expr { HintFieldValue::Column(vec) => { - print_expression_c(setup.p_expressions, vec.as_ptr() as *mut c_void, 1, first_print_value, last_print_value); + print_expression_c(setup.p_setup, vec.as_ptr() as *mut c_void, 1, first_print_value, last_print_value); } HintFieldValue::ColumnExtended(vec) => { - print_expression_c(setup.p_expressions, vec.as_ptr() as *mut c_void, 3, first_print_value, last_print_value); + print_expression_c(setup.p_setup, vec.as_ptr() as *mut c_void, 3, first_print_value, last_print_value); } HintFieldValue::Field(val) => { println!("Field value: {:?}", val); @@ -367,7 +367,7 @@ pub fn print_by_name( let lengths_ptr = lengths.as_ref().map(|lengths| lengths.clone().as_mut_ptr()).unwrap_or(std::ptr::null_mut()); // TODO: CHECK WHAT IS WRONG WITH RETURN VALUES - let _raw_ptr = print_by_name_c(setup.p_expressions, params, name, lengths_ptr, first_print_value, last_print_value, false); + let _raw_ptr = print_by_name_c(setup.p_setup, params, name, lengths_ptr, first_print_value, last_print_value, false); // if return_values { // let field = unsafe { Box::from_raw(raw_ptr as *mut HintFieldInfo) }; diff --git a/provers/stark/src/stark_prover.rs b/provers/stark/src/stark_prover.rs index 0d3729d4..37825782 100644 --- a/provers/stark/src/stark_prover.rs +++ b/provers/stark/src/stark_prover.rs @@ -29,7 +29,6 @@ pub struct StarkProver { air_group_id: usize, config: StarkProverSettings, p_setup: *mut c_void, - p_expressions: *mut c_void, pub p_stark: *mut c_void, p_stark_info: *mut c_void, stark_info: StarkInfo, @@ -67,10 +66,9 @@ impl StarkProver { let setup = sctx.get_setup(air_group_id, air_id).expect("REASON"); let p_setup = setup.p_setup; - let p_expressions = setup.p_expressions; let p_stark_info = setup.p_stark_info; - let p_stark = starks_new_c(p_setup, p_expressions); + let p_stark = starks_new_c(p_setup); let stark_info_path = base_filename_path.clone() + ".starkinfo.json"; let stark_info_json = std::fs::read_to_string(&stark_info_path) @@ -104,7 +102,6 @@ impl StarkProver { air_group_id, config, p_setup, - p_expressions, p_stark_info, p_stark, p_proof: None, @@ -179,7 +176,7 @@ impl Prover for StarkProver { fn verify_constraints(&self, proof_ctx: &mut ProofCtx) -> Vec { let air_instance_ctx = &mut proof_ctx.air_instances.write().unwrap()[self.prover_idx]; - let raw_ptr = verify_constraints_c(self.p_expressions, air_instance_ctx.params.unwrap()); + let raw_ptr = verify_constraints_c(self.p_setup, air_instance_ctx.params.unwrap()); let constraints_result = unsafe { Box::from_raw(raw_ptr as *mut ConstraintsResults) }; @@ -204,7 +201,7 @@ impl Prover for StarkProver { panic!("Intermediate polynomials for stage {} cannot be calculated: Witness column {} is not calculated", stage_id, cm_pol.name); } } - calculate_impols_expressions_c(self.p_expressions, air_instance_ctx.params.unwrap(), stage_id as u64); + calculate_impols_expressions_c(self.p_stark, air_instance_ctx.params.unwrap(), stage_id as u64); for i in 0..n_commits { let cm_pol = self.stark_info.cm_pols_map.as_ref().expect("REASON").get(i).unwrap(); if cm_pol.stage == stage_id as u64 && cm_pol.im_pol { @@ -216,7 +213,7 @@ impl Prover for StarkProver { fri_proof_set_subproof_values_c(p_proof, air_instance_ctx.params.unwrap()); } } else { - calculate_quotient_polynomial_c(self.p_expressions, air_instance_ctx.params.unwrap()); + calculate_quotient_polynomial_c(self.p_stark, air_instance_ctx.params.unwrap()); for i in 0..n_commits { let cm_pol: &crate::stark_info::PolMap = self.stark_info.cm_pols_map.as_ref().expect("REASON").get(i).unwrap(); if cm_pol.stage == (proof_ctx.pilout.num_stages() + 1) as u64 { @@ -394,7 +391,9 @@ impl StarkProver { debug!("{}: ··· Computing FRI Polynomial", Self::MY_NAME); - compute_fri_pol_c(p_stark, self.stark_info.n_stages as u64 + 2, air_instance_ctx.params.unwrap()); + prepare_fri_polynomial_c(p_stark, air_instance_ctx.params.unwrap()); + + calculate_fri_polynomial_c(p_stark, air_instance_ctx.params.unwrap()); } fn compute_fri_folding(&mut self, opening_id: u32, proof_ctx: &mut ProofCtx, transcript: &FFITranscript) { @@ -425,7 +424,7 @@ impl StarkProver { } else { let hash: Vec = vec![F::zero(); self.n_field_elements]; let n_hash = (1 << (steps[n_steps - 1].n_bits)) * Self::FIELD_EXTENSION as u64; - let fri_pol = get_fri_pol_c(self.p_expressions, air_instance_ctx.params.unwrap()); + let fri_pol = get_fri_pol_c(self.p_setup, air_instance_ctx.params.unwrap()); calculate_hash_c(p_stark, hash.as_ptr() as *mut c_void, fri_pol, n_hash); transcript.add_elements(hash.as_ptr() as *mut c_void, self.n_field_elements); } diff --git a/provers/starks-lib-c/bindings_starks.rs b/provers/starks-lib-c/bindings_starks.rs index 0875ba3f..96c15a88 100644 --- a/provers/starks-lib-c/bindings_starks.rs +++ b/provers/starks-lib-c/bindings_starks.rs @@ -54,6 +54,13 @@ extern "C" { p_const_pols: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } +extern "C" { + #[link_name = "\u{1}_Z20get_hint_ids_by_namePvPc"] + pub fn get_hint_ids_by_name( + pSetupCtx: *mut ::std::os::raw::c_void, + hintName: *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_void; +} extern "C" { #[link_name = "\u{1}_Z14setup_ctx_freePv"] pub fn setup_ctx_free(pSetupCtx: *mut ::std::os::raw::c_void); @@ -100,36 +107,19 @@ extern "C" { pub fn expressions_bin_free(pExpressionsBin: *mut ::std::os::raw::c_void); } extern "C" { - #[link_name = "\u{1}_Z19expressions_ctx_newPv"] - pub fn expressions_ctx_new( - pSetupCtx: *mut ::std::os::raw::c_void, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - #[link_name = "\u{1}_Z18verify_constraintsPvS_"] - pub fn verify_constraints( - pExpressionsCtx: *mut ::std::os::raw::c_void, - pParams: *mut ::std::os::raw::c_void, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - #[link_name = "\u{1}_Z11get_fri_polPvS_"] - pub fn get_fri_pol( - pExpressionsCtx: *mut ::std::os::raw::c_void, - pParams: *mut ::std::os::raw::c_void, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - #[link_name = "\u{1}_Z20get_hint_ids_by_namePvPc"] - pub fn get_hint_ids_by_name( - pExpressionsCtx: *mut ::std::os::raw::c_void, - hintName: *mut ::std::os::raw::c_char, + #[link_name = "\u{1}_Z11init_paramsPvS_S_S_S_"] + pub fn init_params( + ptr: *mut ::std::os::raw::c_void, + public_inputs: *mut ::std::os::raw::c_void, + challenges: *mut ::std::os::raw::c_void, + evals: *mut ::std::os::raw::c_void, + subproofValues: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } extern "C" { #[link_name = "\u{1}_Z14get_hint_fieldPvS_mPcbbb"] pub fn get_hint_field( - pExpressionsCtx: *mut ::std::os::raw::c_void, + pSetupCtx: *mut ::std::os::raw::c_void, pParams: *mut ::std::os::raw::c_void, hintId: u64, hintFieldName: *mut ::std::os::raw::c_char, @@ -141,7 +131,7 @@ extern "C" { extern "C" { #[link_name = "\u{1}_Z14set_hint_fieldPvS_S_mPc"] pub fn set_hint_field( - pExpressionsCtx: *mut ::std::os::raw::c_void, + pSetupCtx: *mut ::std::os::raw::c_void, pParams: *mut ::std::os::raw::c_void, values: *mut ::std::os::raw::c_void, hintId: u64, @@ -149,26 +139,27 @@ extern "C" { ) -> u64; } extern "C" { - #[link_name = "\u{1}_Z20expressions_ctx_freePv"] - pub fn expressions_ctx_free(pExpressionsCtx: *mut ::std::os::raw::c_void); -} -extern "C" { - #[link_name = "\u{1}_Z11init_paramsPvS_S_S_S_"] - pub fn init_params( - ptr: *mut ::std::os::raw::c_void, - public_inputs: *mut ::std::os::raw::c_void, - challenges: *mut ::std::os::raw::c_void, - evals: *mut ::std::os::raw::c_void, - subproofValues: *mut ::std::os::raw::c_void, + #[link_name = "\u{1}_Z11get_fri_polPvS_"] + pub fn get_fri_pol( + pSetupCtx: *mut ::std::os::raw::c_void, + pParams: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } extern "C" { - #[link_name = "\u{1}_Z10starks_newPvS_"] - pub fn starks_new( + #[link_name = "\u{1}_Z18verify_constraintsPvS_"] + pub fn verify_constraints( pSetupCtx: *mut ::std::os::raw::c_void, - pExpressionsCtx: *mut ::std::os::raw::c_void, + pParams: *mut ::std::os::raw::c_void, ) -> *mut ::std::os::raw::c_void; } +extern "C" { + #[link_name = "\u{1}_Z11params_freePv"] + pub fn params_free(pParams: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_void; +} +extern "C" { + #[link_name = "\u{1}_Z10starks_newPv"] + pub fn starks_new(pSetupCtx: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_void; +} extern "C" { #[link_name = "\u{1}_Z11starks_freePv"] pub fn starks_free(pStarks: *mut ::std::os::raw::c_void); @@ -190,17 +181,31 @@ extern "C" { root: *mut ::std::os::raw::c_void, ); } +extern "C" { + #[link_name = "\u{1}_Z15prepare_fri_polPvS_"] + pub fn prepare_fri_pol( + pStarks: *mut ::std::os::raw::c_void, + pParams: *mut ::std::os::raw::c_void, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + #[link_name = "\u{1}_Z24calculate_fri_polynomialPvS_"] + pub fn calculate_fri_polynomial( + pStarks: *mut ::std::os::raw::c_void, + pParams: *mut ::std::os::raw::c_void, + ); +} extern "C" { #[link_name = "\u{1}_Z29calculate_quotient_polynomialPvS_"] pub fn calculate_quotient_polynomial( - pExpressionsCtx: *mut ::std::os::raw::c_void, + pStarks: *mut ::std::os::raw::c_void, pParams: *mut ::std::os::raw::c_void, ); } extern "C" { #[link_name = "\u{1}_Z28calculate_impols_expressionsPvS_m"] pub fn calculate_impols_expressions( - pExpressionsCtx: *mut ::std::os::raw::c_void, + pStarks: *mut ::std::os::raw::c_void, pParams: *mut ::std::os::raw::c_void, step: u64, ); @@ -223,14 +228,6 @@ extern "C" { pProof: *mut ::std::os::raw::c_void, ); } -extern "C" { - #[link_name = "\u{1}_Z15compute_fri_polPvmS_"] - pub fn compute_fri_pol( - pStarks: *mut ::std::os::raw::c_void, - step: u64, - pParams: *mut ::std::os::raw::c_void, - ) -> *mut ::std::os::raw::c_void; -} extern "C" { #[link_name = "\u{1}_Z19compute_fri_foldingPvmS_S_S_"] pub fn compute_fri_folding( @@ -315,7 +312,7 @@ extern "C" { extern "C" { #[link_name = "\u{1}_Z13print_by_namePvS_PcPmmmb"] pub fn print_by_name( - pExpressionsCtx: *mut ::std::os::raw::c_void, + pSetupCtx: *mut ::std::os::raw::c_void, pParams: *mut ::std::os::raw::c_void, name: *mut ::std::os::raw::c_char, lengths: *mut u64, @@ -327,7 +324,7 @@ extern "C" { extern "C" { #[link_name = "\u{1}_Z16print_expressionPvS_mmm"] pub fn print_expression( - pExpressionCtx: *mut ::std::os::raw::c_void, + pSetupCtx: *mut ::std::os::raw::c_void, pol: *mut ::std::os::raw::c_void, dim: u64, first_value: u64, diff --git a/provers/starks-lib-c/src/ffi_starks.rs b/provers/starks-lib-c/src/ffi_starks.rs index 02ec9883..26069838 100644 --- a/provers/starks-lib-c/src/ffi_starks.rs +++ b/provers/starks-lib-c/src/ffi_starks.rs @@ -167,44 +167,35 @@ pub fn expressions_bin_free_c(p_expressions_bin: *mut c_void) { } } -#[cfg(not(feature = "no_lib_link"))] -pub fn expressions_ctx_new_c(p_setup_ctx: *mut c_void) -> *mut c_void { - unsafe { expressions_ctx_new(p_setup_ctx) } -} #[cfg(not(feature = "no_lib_link"))] -pub fn get_hint_ids_by_name_c(p_expressions_ctx: *mut c_void, hint_name: &str) -> *mut c_void { +pub fn get_hint_ids_by_name_c(p_setup: *mut c_void, hint_name: &str) -> *mut c_void { let name = CString::new(hint_name).unwrap(); - unsafe { get_hint_ids_by_name(p_expressions_ctx, name.as_ptr() as *mut std::os::raw::c_char) } + unsafe { get_hint_ids_by_name(p_setup, name.as_ptr() as *mut std::os::raw::c_char) } } #[cfg(not(feature = "no_lib_link"))] -pub fn get_hint_field_c(p_expressions_ctx: *mut c_void, p_params: *mut c_void, hint_id: u64, hint_field_name: &str, dest: bool, inverse:bool, print_expression: bool) -> *mut c_void { +pub fn get_hint_field_c(p_setup_ctx: *mut c_void, p_params: *mut c_void, hint_id: u64, hint_field_name: &str, dest: bool, inverse:bool, print_expression: bool) -> *mut c_void { let field_name = CString::new(hint_field_name).unwrap(); - unsafe { get_hint_field(p_expressions_ctx, p_params, hint_id, field_name.as_ptr() as *mut std::os::raw::c_char, dest, inverse, print_expression) } + unsafe { get_hint_field(p_setup_ctx, p_params, hint_id, field_name.as_ptr() as *mut std::os::raw::c_char, dest, inverse, print_expression) } } #[cfg(not(feature = "no_lib_link"))] -pub fn set_hint_field_c(p_expressions_ctx: *mut c_void, p_params: *mut c_void, values: *mut c_void, hint_id: u64, hint_field_name: &str) -> u64 { +pub fn set_hint_field_c(p_setup_ctx: *mut c_void, p_params: *mut c_void, values: *mut c_void, hint_id: u64, hint_field_name: &str) -> u64 { unsafe { let field_name = CString::new(hint_field_name).unwrap(); - set_hint_field(p_expressions_ctx, p_params, values, hint_id, field_name.as_ptr() as *mut std::os::raw::c_char) + set_hint_field(p_setup_ctx, p_params, values, hint_id, field_name.as_ptr() as *mut std::os::raw::c_char) } } -#[cfg(not(feature = "no_lib_link"))] -pub fn expressions_ctx_free_c(p_expressions_ctx: *mut c_void) { - unsafe { expressions_ctx_free(p_expressions_ctx) } -} - #[cfg(not(feature = "no_lib_link"))] pub fn init_params_c( ptr: *mut c_void, public_inputs: *mut c_void, challenges: *mut c_void, evals: *mut c_void, subproof_values: *mut c_void) -> *mut c_void { unsafe { init_params(ptr, public_inputs, challenges, evals, subproof_values) } } #[cfg(not(feature = "no_lib_link"))] -pub fn starks_new_c(p_setup_ctx: *mut c_void, p_expressions_ctx: *mut c_void) -> *mut c_void { - unsafe { starks_new(p_setup_ctx, p_expressions_ctx) } +pub fn starks_new_c(p_setup_ctx: *mut c_void) -> *mut c_void { + unsafe { starks_new(p_setup_ctx) } } #[cfg(not(feature = "no_lib_link"))] @@ -229,16 +220,23 @@ pub fn treesGL_get_root_c(pStark: *mut c_void, index: u64, root: *mut c_void) { } #[cfg(not(feature = "no_lib_link"))] -pub fn calculate_quotient_polynomial_c(p_expressions_ctx: *mut c_void, p_params: *mut c_void) { +pub fn calculate_fri_polynomial_c(p_starks: *mut c_void, p_params: *mut c_void) { unsafe { - calculate_quotient_polynomial(p_expressions_ctx, p_params); + calculate_fri_polynomial(p_starks, p_params); } } #[cfg(not(feature = "no_lib_link"))] -pub fn calculate_impols_expressions_c(p_expressions_ctx: *mut c_void, p_params: *mut c_void, id: u64) { +pub fn calculate_quotient_polynomial_c(p_starks: *mut c_void, p_params: *mut c_void) { unsafe { - calculate_impols_expressions(p_expressions_ctx, p_params, id); + calculate_quotient_polynomial(p_starks, p_params); + } +} + +#[cfg(not(feature = "no_lib_link"))] +pub fn calculate_impols_expressions_c(p_starks: *mut c_void, p_params: *mut c_void, id: u64) { + unsafe { + calculate_impols_expressions(p_starks, p_params, id); } } @@ -263,13 +261,13 @@ pub fn compute_evals_c(p_stark: *mut c_void, p_params: *mut c_void, pProof: *mut } #[cfg(not(feature = "no_lib_link"))] -pub fn compute_fri_pol_c(p_stark: *mut c_void, step: u64, p_params: *mut c_void) -> *mut c_void { - unsafe { compute_fri_pol(p_stark, step, p_params) } +pub fn prepare_fri_polynomial_c(p_stark: *mut c_void, p_params: *mut c_void) -> *mut c_void { + unsafe { prepare_fri_pol(p_stark, p_params) } } #[cfg(not(feature = "no_lib_link"))] -pub fn get_fri_pol_c(p_expressions_ctx: *mut c_void, p_params: *mut c_void) -> *mut c_void { - unsafe { get_fri_pol(p_expressions_ctx, p_params) } +pub fn get_fri_pol_c(p_setup_ctx: *mut c_void, p_params: *mut c_void) -> *mut c_void { + unsafe { get_fri_pol(p_setup_ctx, p_params) } } #[cfg(not(feature = "no_lib_link"))] @@ -340,8 +338,8 @@ pub fn get_permutations_c(p_transcript: *mut c_void, res: *mut u64, n: u64, n_bi } #[cfg(not(feature = "no_lib_link"))] -pub fn verify_constraints_c(p_expressions: *mut c_void, p_params: *mut c_void) -> *mut c_void { - unsafe { verify_constraints(p_expressions, p_params) } +pub fn verify_constraints_c(p_setup: *mut c_void, p_params: *mut c_void) -> *mut c_void { + unsafe { verify_constraints(p_setup, p_params) } } #[cfg(not(feature = "no_lib_link"))] @@ -358,18 +356,18 @@ pub fn verify_global_constraints_c( global_info_file: &str, global_constraints_b } #[cfg(not(feature = "no_lib_link"))] -pub fn print_by_name_c(p_expressions_ctx: *mut c_void, p_params: *mut c_void, name: &str, lengths: *mut u64, first_print_value: u64, last_print_value: u64, return_values: bool) -> *mut c_void { +pub fn print_by_name_c(p_setup_ctx: *mut c_void, p_params: *mut c_void, name: &str, lengths: *mut u64, first_print_value: u64, last_print_value: u64, return_values: bool) -> *mut c_void { let name_string = CString::new(name).unwrap(); let name_ptr = name_string.as_ptr() as *mut std::os::raw::c_char; unsafe { - print_by_name(p_expressions_ctx, p_params, name_ptr, lengths, first_print_value, last_print_value, return_values) + print_by_name(p_setup_ctx, p_params, name_ptr, lengths, first_print_value, last_print_value, return_values) } } #[cfg(not(feature = "no_lib_link"))] -pub fn print_expression_c(p_expressions_ctx: *mut c_void, pol: *mut c_void, dim: u64, first_print_value: u64, last_print_value: u64) { +pub fn print_expression_c(p_setup_ctx: *mut c_void, pol: *mut c_void, dim: u64, first_print_value: u64, last_print_value: u64) { unsafe { - print_expression(p_expressions_ctx, pol, dim, first_print_value, last_print_value); + print_expression(p_setup_ctx, pol, dim, first_print_value, last_print_value); } } @@ -491,34 +489,23 @@ pub fn expressions_bin_free_c(p_expressions_bin: *mut c_void) { } #[cfg(feature = "no_lib_link")] -pub fn expressions_ctx_new_c(_p_setup_ctx: *mut c_void) -> *mut c_void { - trace!("{}: ··· {}", "ffi ", "expressions_ctx_new: This is a mock call because there is no linked library"); - std::ptr::null_mut() -} - -#[cfg(feature = "no_lib_link")] -pub fn get_hint_ids_by_name_c(_p_expressions_ctx: *mut c_void, _hint_name: &str) -> *mut c_void { +pub fn get_hint_ids_by_name_c(_p_setup_ctx: *mut c_void, _hint_name: &str) -> *mut c_void { trace!("{}: ··· {}", "ffi ", "get_hint_ids_by_name: This is a mock call because there is no linked library"); std::ptr::null_mut() } #[cfg(feature = "no_lib_link")] -pub fn get_hint_field_c(_p_expressions_ctx: *mut c_void, _p_params: *mut c_void, _hint_id: u64, _hint_field_name: &str, _dest: bool, _inverse: bool, _print_expression: bool) -> *mut c_void { +pub fn get_hint_field_c(_p_setup_ctx: *mut c_void, _p_params: *mut c_void, _hint_id: u64, _hint_field_name: &str, _dest: bool, _inverse: bool, _print_expression: bool) -> *mut c_void { trace!("{}: ··· {}", "ffi ", "get_hint_field: This is a mock call because there is no linked library"); std::ptr::null_mut() } #[cfg(feature = "no_lib_link")] -pub fn set_hint_field_c(_p_expressions_ctx: *mut c_void, _p_params: *mut c_void, _values: *mut c_void, _hint_id: u64, _hint_field_name: &str) -> u64 { +pub fn set_hint_field_c(_p_setup_ctx: *mut c_void, _p_params: *mut c_void, _values: *mut c_void, _hint_id: u64, _hint_field_name: &str) -> u64 { trace!("{}: ··· {}", "ffi ", "set_hint_field_c: This is a mock call because there is no linked library"); 0 } -#[cfg(feature = "no_lib_link")] -pub fn expressions_ctx_free_c(_p_expressions_ctx: *mut c_void) { - trace!("{}: ··· {}", "ffi ", "expressions_ctx_free: This is a mock call because there is no linked library"); -} - #[cfg(feature = "no_lib_link")] pub fn init_params_c( _ptr: *mut c_void, @@ -536,17 +523,11 @@ pub fn init_params_c( } #[cfg(feature = "no_lib_link")] -pub fn starks_new_c(_p_config: *mut c_void, _p_setup_ctx: *mut c_void, _p_expressions_ctx: *mut c_void) -> *mut c_void { +pub fn starks_new_c(_p_config: *mut c_void) -> *mut c_void { trace!("{}: ··· {}", "ffi ", "starks_new: This is a mock call because there is no linked library"); std::ptr::null_mut() } -#[cfg(feature = "no_lib_link")] -pub fn starks_new_default_c(_p_setup_ctx: *mut c_void, _p_expressions_ctx: *mut c_void) -> *mut c_void { - trace!("{}: ··· {}", "ffi ", "starks_new_default: This is a mock call because there is no linked library"); - std::ptr::null_mut() -} - #[cfg(feature = "no_lib_link")] pub fn starks_free_c(_p_stark: *mut c_void) { trace!("{}: ··· {}", "ffi ", "starks_free: This is a mock call because there is no linked library"); @@ -564,12 +545,19 @@ pub fn treesGL_get_root_c(_pStark: *mut c_void, _index: u64, _root: *mut c_void) } #[cfg(feature = "no_lib_link")] -pub fn calculate_quotient_polynomial_c(_p_expressions_ctx: *mut c_void, _p_params: *mut c_void) { +pub fn calculate_fri_polynomial_c(_p_starks: *mut c_void, _p_starks: *mut c_void) { + unsafe { + trace!("mckzkevm: ··· {}", "calculate_fri_polynomial: This is a mock call because there is no linked library"); + } +} + +#[cfg(feature = "no_lib_link")] +pub fn calculate_quotient_polynomial_c(_p_starks: *mut c_void, _p_params: *mut c_void) { trace!("mckzkevm: ··· {}", "calculate_quotient_polynomial: This is a mock call because there is no linked library"); } #[cfg(feature = "no_lib_link")] -pub fn calculate_impols_expressions_c(_p_expressions_ctx: *mut c_void, _p_params: *mut c_void, _id: u64) { +pub fn calculate_impols_expressions_c(_p_starks: *mut c_void, _p_params: *mut c_void, _id: u64) { trace!( "{}: ··· {}", "mckzkevm", @@ -594,8 +582,8 @@ pub fn compute_evals_c(_p_stark: *mut c_void, _p_params: *mut c_void, _pProof: * } #[cfg(feature = "no_lib_link")] -pub fn compute_fri_pol_c(_p_stark: *mut c_void, _step: u64, _p_params: *mut c_void) -> *mut c_void { - trace!("{}: ··· {}", "ffi ", "compute_fri_pol: This is a mock call because there is no linked library"); +pub fn prepare_fri_polynomial_c(_p_stark: *mut c_void, _p_params: *mut c_void) -> *mut c_void { + trace!("{}: ··· {}", "ffi ", "prepare_fri_polynomial_c: This is a mock call because there is no linked library"); std::ptr::null_mut() } @@ -662,7 +650,7 @@ pub fn get_permutations_c(_p_transcript: *mut c_void, _res: *mut u64, _n: u64, _ } #[cfg(feature = "no_lib_link")] -pub fn verify_constraints_c(_p_expressions_ctx: *mut c_void, _p_params: *mut c_void) -> *mut c_void { +pub fn verify_constraints_c(_p_setup: *mut c_void, _p_params: *mut c_void) -> *mut c_void { trace!("{}: ··· {}", "ffi ", "verify_constraints_c: This is a mock call because there is no linked library"); true } @@ -674,12 +662,12 @@ pub fn verify_global_constraints_c( _global_info_file: &str, _global_constraints } #[cfg(feature = "no_lib_link")] -pub fn print_by_name_c(p_expressions_ctx: *mut c_void, p_params: *mut c_void, name: &str, lengths: *mut u64, first_print_value: u64, last_print_value: u64, return_values: bool) -> *mut c_void { +pub fn print_by_name_c(_p_setup_ctx: *mut c_void, p_params: *mut c_void, name: &str, lengths: *mut u64, first_print_value: u64, last_print_value: u64, return_values: bool) -> *mut c_void { trace!("{}: ··· {}", "ffi ", "print_by_name_c: This is a mock call because there is no linked library"); std::null_mut() } #[cfg(feature = "no_lib_link")] -pub fn print_expression_c(_p_expressions_ctx: *mut c_void, _pol: *mut c_void, _dim: u64, _first_print_value: u64, _last_print_value: u64) { +pub fn print_expression_c(_p_setup_ctx: *mut c_void, _pol: *mut c_void, _dim: u64, _first_print_value: u64, _last_print_value: u64) { trace!("{}: ··· {}", "ffi ", "print_expression_c: This is a mock call because there is no linked library"); }