@@ -103,8 +103,37 @@ pub struct KeccakInOutCols<T> {
103
103
pub input32 : [ T ; KECCAK_INPUT32_SIZE ] ,
104
104
}
105
105
106
+ #[ derive( Clone , Debug ) ]
107
+ #[ repr( C ) ]
108
+ pub struct KeccakNonZeroOutEval < T > {
109
+ pub state_in : T ,
110
+ pub state_out : T ,
111
+ pub ecall_id_read_record : T ,
112
+ pub ecall_id_write_record : T ,
113
+ pub state_ptr_read_record : T ,
114
+ pub state_ptr_write_record : T ,
115
+ pub mem_read_record : [ T ; KECCAK_INPUT32_SIZE ] ,
116
+ pub mem_write_record : [ T ; KECCAK_OUTPUT32_SIZE ] ,
117
+ }
118
+
119
+ impl < T : Default + Copy > Default for KeccakNonZeroOutEval < T > {
120
+ fn default ( ) -> Self {
121
+ Self {
122
+ state_in : Default :: default ( ) ,
123
+ state_out : Default :: default ( ) ,
124
+ ecall_id_read_record : Default :: default ( ) ,
125
+ ecall_id_write_record : Default :: default ( ) ,
126
+ state_ptr_read_record : Default :: default ( ) ,
127
+ state_ptr_write_record : Default :: default ( ) ,
128
+ mem_read_record : [ T :: default ( ) ; KECCAK_INPUT32_SIZE ] ,
129
+ mem_write_record : [ T :: default ( ) ; KECCAK_OUTPUT32_SIZE ] ,
130
+ }
131
+ }
132
+ }
133
+
106
134
#[ derive( Clone , Debug ) ]
107
135
pub struct KeccakParams < T > {
136
+ pub non_zero_out_eval : KeccakNonZeroOutEval < usize > ,
108
137
pub io : KeccakInOutCols < T > ,
109
138
}
110
139
@@ -185,12 +214,12 @@ impl<E: ExtensionField> KeccakLayout<E> {
185
214
) : ( KeccakWitCols < WitIn > , KeccakFixedCols < Fixed > , [ WitIn ; 6 ] ) = unsafe {
186
215
(
187
216
transmute :: < [ WitIn ; KECCAK_WIT_SIZE ] , KeccakWitCols < WitIn > > ( array:: from_fn ( |id| {
188
- cb. create_witin ( || format ! ( "lookup /witin_{}" , id) )
217
+ cb. create_witin ( || format ! ( "keccak /witin_{}" , id) )
189
218
} ) ) ,
190
219
transmute :: < [ Fixed ; 8 ] , KeccakFixedCols < Fixed > > ( array:: from_fn ( |id| {
191
- cb. create_fixed ( || format ! ( "lookup /fixed_{}" , id) )
220
+ cb. create_fixed ( || format ! ( "keccak /fixed_{}" , id) )
192
221
} ) ) ,
193
- array:: from_fn ( |id| cb. create_witin ( || format ! ( "lookup /eq_{}" , id) ) ) ,
222
+ array:: from_fn ( |id| cb. create_witin ( || format ! ( "keccak /eq_{}" , id) ) ) ,
194
223
)
195
224
} ;
196
225
@@ -221,16 +250,8 @@ impl<E: ExtensionField> ProtocolBuilder<E> for KeccakLayout<E> {
221
250
Self :: new ( cb, params)
222
251
}
223
252
224
- fn build_gkr_chip ( & self , _cb : & mut CircuitBuilder < E > ) -> Result < Chip < E > , CircuitBuilderError > {
225
- // let mut system = LayerConstraintSystem::new(
226
- // KECCAK_WIT_SIZE,
227
- // 0,
228
- // KECCAK_WIT_SIZE,
229
- // Some(self.layer_exprs.eq_zero.expr()),
230
- // self.alpha.clone(),
231
- // self.beta.clone(),
232
- // );
233
- let system = _cb;
253
+ fn build_gkr_chip ( & self , cb : & mut CircuitBuilder < E > ) -> Result < Chip < E > , CircuitBuilderError > {
254
+ let system = cb;
234
255
235
256
let KeccakInOutCols {
236
257
output32 : output32_expr,
@@ -856,6 +877,7 @@ pub fn setup_gkr_circuit<E: ExtensionField>()
856
877
let output_value: [ WitIn ; KECCAK_OUTPUT32_SIZE ] =
857
878
array:: from_fn ( |i| circuit_builder. create_witin ( || format ! ( "output_value/{i}" ) ) ) ;
858
879
let params = KeccakParams {
880
+ non_zero_out_eval : Default :: default ( ) ,
859
881
io : KeccakInOutCols {
860
882
input32 : input_value. map ( |e| e. expr ( ) ) ,
861
883
output32 : output_value. map ( |e| e. expr ( ) ) ,
0 commit comments