|
1 | | -use kimchi::{circuits::wires::COLUMNS, mina_curves::pasta::Pallas, poly_commitment::PolyComm}; |
| 1 | +use kimchi::{ |
| 2 | + circuits::wires::{COLUMNS, PERMUTS}, |
| 3 | + mina_curves::pasta::{Fq, Pallas}, |
| 4 | + poly_commitment::PolyComm, |
| 5 | + proof::PointEvaluations, |
| 6 | +}; |
2 | 7 |
|
3 | 8 | use crate::pickles_preproc::{ |
4 | | - state_proof::{Bulletproof, Commitments}, |
5 | | - type_aliases::{WrapECPoint, WrapOpeningProof, WrapProverCommitments, WrapScalar}, |
| 9 | + state_proof::{Bulletproof, Commitments, Evaluations}, |
| 10 | + type_aliases::{ |
| 11 | + WrapECPoint, WrapOpeningProof, WrapPointEvaluations, WrapProofEvaluations, |
| 12 | + WrapProverCommitments, WrapScalar, |
| 13 | + }, |
6 | 14 | }; |
7 | 15 |
|
8 | 16 | use super::{ |
@@ -75,6 +83,85 @@ pub fn deserialize_state_proof( |
75 | 83 | z2, |
76 | 84 | }; |
77 | 85 |
|
| 86 | + let Evaluations { |
| 87 | + coefficients: hex_coefficients, |
| 88 | + complete_add_selector: hex_complete_add_selector, |
| 89 | + emul_selector: hex_emul_selector, |
| 90 | + endomul_scalar_selector: hex_endomul_scalar_selector, |
| 91 | + generic_selector: hex_generic_selector, |
| 92 | + mul_selector: hex_mul_selector, |
| 93 | + poseidon_selector: hex_poseidon_selector, |
| 94 | + s: hex_s, |
| 95 | + w: hex_w, |
| 96 | + z: hex_z, |
| 97 | + } = state_proof.proof.evaluations; |
| 98 | + |
| 99 | + let mut w: [PointEvaluations<Vec<Fq>>; COLUMNS] = std::array::from_fn(|_| PointEvaluations { |
| 100 | + zeta: Vec::with_capacity(1), |
| 101 | + zeta_omega: Vec::with_capacity(1), |
| 102 | + }); |
| 103 | + for (hex_eval, eval) in hex_w.into_iter().zip(w.iter_mut()) { |
| 104 | + *eval = WrapPointEvaluations::try_from(hex_eval)?.0; |
| 105 | + } |
| 106 | + |
| 107 | + let z = WrapPointEvaluations::try_from(hex_z)?.0; |
| 108 | + |
| 109 | + let mut s: [PointEvaluations<Vec<Fq>>; PERMUTS - 1] = |
| 110 | + std::array::from_fn(|_| PointEvaluations { |
| 111 | + zeta: Vec::with_capacity(1), |
| 112 | + zeta_omega: Vec::with_capacity(1), |
| 113 | + }); |
| 114 | + for (hex_eval, eval) in hex_s.into_iter().zip(s.iter_mut()) { |
| 115 | + *eval = WrapPointEvaluations::try_from(hex_eval)?.0; |
| 116 | + } |
| 117 | + |
| 118 | + let mut coefficients: [PointEvaluations<Vec<Fq>>; COLUMNS] = |
| 119 | + std::array::from_fn(|_| PointEvaluations { |
| 120 | + zeta: Vec::with_capacity(1), |
| 121 | + zeta_omega: Vec::with_capacity(1), |
| 122 | + }); |
| 123 | + for (hex_eval, eval) in hex_coefficients.into_iter().zip(coefficients.iter_mut()) { |
| 124 | + *eval = WrapPointEvaluations::try_from(hex_eval)?.0; |
| 125 | + } |
| 126 | + |
| 127 | + let generic_selector = WrapPointEvaluations::try_from(hex_generic_selector)?.0; |
| 128 | + let poseidon_selector = WrapPointEvaluations::try_from(hex_poseidon_selector)?.0; |
| 129 | + let complete_add_selector = WrapPointEvaluations::try_from(hex_complete_add_selector)?.0; |
| 130 | + let mul_selector = WrapPointEvaluations::try_from(hex_mul_selector)?.0; |
| 131 | + let emul_selector = WrapPointEvaluations::try_from(hex_emul_selector)?.0; |
| 132 | + let endomul_scalar_selector = WrapPointEvaluations::try_from(hex_endomul_scalar_selector)?.0; |
| 133 | + |
| 134 | + let public = None; // TODO: Calculate public poly evaluations |
| 135 | + |
| 136 | + let _evals = WrapProofEvaluations { |
| 137 | + public, |
| 138 | + w, |
| 139 | + z, |
| 140 | + s, |
| 141 | + coefficients, |
| 142 | + generic_selector, |
| 143 | + poseidon_selector, |
| 144 | + complete_add_selector, |
| 145 | + mul_selector, |
| 146 | + emul_selector, |
| 147 | + endomul_scalar_selector, |
| 148 | + range_check0_selector: None, |
| 149 | + range_check1_selector: None, |
| 150 | + foreign_field_add_selector: None, |
| 151 | + foreign_field_mul_selector: None, |
| 152 | + xor_selector: None, |
| 153 | + rot_selector: None, |
| 154 | + lookup_aggregation: None, |
| 155 | + lookup_table: None, |
| 156 | + lookup_sorted: std::array::from_fn(|_| None), |
| 157 | + runtime_lookup_table: None, |
| 158 | + runtime_lookup_table_selector: None, |
| 159 | + xor_lookup_selector: None, |
| 160 | + lookup_gate_lookup_selector: None, |
| 161 | + range_check_lookup_selector: None, |
| 162 | + foreign_field_mul_lookup_selector: None, |
| 163 | + }; |
| 164 | + |
78 | 165 | /* |
79 | 166 | let prover_proof = WrapProverProof { |
80 | 167 | commitments, |
|
0 commit comments