sp1_hypercube/verifier/
config.rs1use serde::{Deserialize, Serialize};
2use slop_algebra::AbstractField;
3use slop_challenger::VariableLengthChallenger;
4use slop_challenger::{CanObserve, IopCtx};
5
6use crate::septic_digest::SepticDigest;
7
8#[allow(clippy::disallowed_types)]
9use slop_basefold::Poseidon2KoalaBear16BasefoldConfig;
10
11#[allow(clippy::disallowed_types)]
12pub type SP1BasefoldConfig = Poseidon2KoalaBear16BasefoldConfig;
15
16#[allow(clippy::disallowed_types)]
17pub use slop_koala_bear::Poseidon2KoalaBearConfig;
18
19#[allow(clippy::disallowed_types)]
20pub type SP1MerkleTreeConfig = Poseidon2KoalaBearConfig;
22
23#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
25pub struct ChipDimensions<T> {
26 pub height: T,
28 pub num_polynomials: T,
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34pub struct MachineVerifyingKey<C: IopCtx> {
35 pub pc_start: [C::F; 3],
37 pub initial_global_cumulative_sum: SepticDigest<C::F>,
39 pub preprocessed_commit: C::Digest,
41 pub enable_untrusted_programs: C::F,
43}
44
45impl<C: IopCtx> PartialEq for MachineVerifyingKey<C> {
46 fn eq(&self, other: &Self) -> bool {
47 self.pc_start == other.pc_start
48 && self.initial_global_cumulative_sum == other.initial_global_cumulative_sum
49 && self.preprocessed_commit == other.preprocessed_commit
50 && self.enable_untrusted_programs == other.enable_untrusted_programs
51 }
52}
53
54impl<C: IopCtx> Eq for MachineVerifyingKey<C> {}
55
56impl<C: IopCtx> MachineVerifyingKey<C> {
57 pub fn observe_into(&self, challenger: &mut C::Challenger) {
59 challenger.observe(self.preprocessed_commit);
60 challenger.observe_constant_length_slice(&self.pc_start);
61 challenger.observe_constant_length_slice(&self.initial_global_cumulative_sum.0.x.0);
62 challenger.observe_constant_length_slice(&self.initial_global_cumulative_sum.0.y.0);
63 challenger.observe(self.enable_untrusted_programs);
64 challenger.observe_constant_length_slice(&[C::F::zero(); 6]);
66 }
67}