openvm_stark_backend/soundness/mod.rs
1//! Soundness analysis for the SWIRL proof system.
2
3use p3_field::PrimeField64;
4
5use crate::StarkProtocolConfig;
6
7mod calculator;
8mod vk;
9
10pub use calculator::*;
11
12/// Order `p` of the configured base field.
13///
14/// Not part of the public API: exposed only so concrete configs (e.g. in the SDK) can specialize
15/// it without restating the formula.
16#[doc(hidden)]
17pub fn base_field_order<SC: StarkProtocolConfig>() -> f64 {
18 SC::F::ORDER_U64 as f64
19}
20
21/// Number of bits in the challenge (extension) field: `D_EF * log2(|F|)`.
22///
23/// Derived from the configured extension degree (`StarkProtocolConfig::D_EF`), so it tracks
24/// automatically if the extension field changes.
25///
26/// Not part of the public API: exposed only so concrete configs (e.g. in the SDK) can specialize
27/// it without restating the formula.
28#[doc(hidden)]
29pub fn challenge_field_bits<SC: StarkProtocolConfig>() -> f64 {
30 SC::D_EF as f64 * base_field_order::<SC>().log2()
31}