@@ -172,18 +172,16 @@ impl<'a, T: FieldElement> Machine<'a, T> for BlockMachine<'a, T> {
172
172
known_arguments : & BitVec ,
173
173
range_constraints : Vec < RangeConstraint < T > > ,
174
174
) -> ( bool , Vec < RangeConstraint < T > > ) {
175
- // We use the input range constraints to see if there is a column
176
- // containing the substring "operation_id" which is constrained to a
177
- // single value and use that value as part of the cache key.
178
- let operation_id = self . find_operation_id ( identity_id) . and_then ( |index| {
179
- let v = range_constraints[ index] . try_to_single_value ( ) ?;
180
- Some ( ( index, v) )
181
- } ) ;
175
+ let fixed_first_input = if !known_arguments. is_empty ( ) && known_arguments[ 0 ] {
176
+ range_constraints[ 0 ] . try_to_single_value ( ) . map ( |v| ( 0 , v) )
177
+ } else {
178
+ None
179
+ } ;
182
180
match self . function_cache . compile_cached (
183
181
can_process,
184
182
identity_id,
185
183
known_arguments,
186
- operation_id ,
184
+ fixed_first_input ,
187
185
) {
188
186
Some ( entry) => ( true , entry. range_constraints . clone ( ) ) ,
189
187
None => ( false , range_constraints) ,
@@ -200,12 +198,10 @@ impl<'a, T: FieldElement> Machine<'a, T> for BlockMachine<'a, T> {
200
198
return Err ( EvalError :: RowsExhausted ( self . name . clone ( ) ) ) ;
201
199
}
202
200
203
- let operation_id =
204
- self . find_operation_id ( identity_id)
205
- . and_then ( |index| match & values[ index] {
206
- LookupCell :: Input ( v) => Some ( ( index, * * v) ) ,
207
- LookupCell :: Output ( _) => None ,
208
- } ) ;
201
+ let fixed_first_input = match & values. first ( ) {
202
+ Some ( LookupCell :: Input ( v) ) => Some ( ( 0 , * * v) ) ,
203
+ None | Some ( LookupCell :: Output ( _) ) => None ,
204
+ } ;
209
205
210
206
self . data . finalize_all ( ) ;
211
207
let data = self . data . append_new_finalized_rows ( self . block_size ) ;
@@ -215,7 +211,7 @@ impl<'a, T: FieldElement> Machine<'a, T> for BlockMachine<'a, T> {
215
211
identity_id,
216
212
values,
217
213
data,
218
- operation_id ,
214
+ fixed_first_input ,
219
215
) ?;
220
216
assert ! ( success) ;
221
217
self . block_count_jit += 1 ;
@@ -452,13 +448,12 @@ impl<'a, T: FieldElement> BlockMachine<'a, T> {
452
448
}
453
449
454
450
let known_inputs = arguments. iter ( ) . map ( |e| e. is_constant ( ) ) . collect ( ) ;
455
- let operation_id = self . find_operation_id ( identity_id) . and_then ( |index| {
456
- let v = arguments[ index] . constant_value ( ) ?;
457
- Some ( ( index, v) )
458
- } ) ;
451
+ let fixed_first_input = arguments
452
+ . first ( )
453
+ . and_then ( |a| a. constant_value ( ) . map ( |v| ( 0 , v) ) ) ;
459
454
if self
460
455
. function_cache
461
- . compile_cached ( mutable_state, identity_id, & known_inputs, operation_id )
456
+ . compile_cached ( mutable_state, identity_id, & known_inputs, fixed_first_input )
462
457
. is_some ( )
463
458
{
464
459
let caller_data = CallerData :: new ( arguments, range_constraints) ;
@@ -537,12 +532,10 @@ impl<'a, T: FieldElement> BlockMachine<'a, T> {
537
532
self . data . finalize_all ( ) ;
538
533
539
534
let mut lookup_cells = caller_data. as_lookup_cells ( ) ;
540
- let operation_id =
541
- self . find_operation_id ( identity_id)
542
- . and_then ( |index| match & lookup_cells[ index] {
543
- LookupCell :: Input ( v) => Some ( ( index, * * v) ) ,
544
- LookupCell :: Output ( _) => None ,
545
- } ) ;
535
+ let operation_id = match & lookup_cells. first ( ) {
536
+ Some ( LookupCell :: Input ( v) ) => Some ( ( 0 , * * v) ) ,
537
+ None | Some ( LookupCell :: Output ( _) ) => None ,
538
+ } ;
546
539
let data = self . data . append_new_finalized_rows ( self . block_size ) ;
547
540
548
541
let success = self . function_cache . process_lookup_direct (
@@ -557,13 +550,6 @@ impl<'a, T: FieldElement> BlockMachine<'a, T> {
557
550
caller_data. into ( )
558
551
}
559
552
560
- fn find_operation_id ( & self , identity_id : u64 ) -> Option < usize > {
561
- let right = & self . parts . connections [ & identity_id] . right . expressions ;
562
- right. iter ( ) . position ( |r| {
563
- try_to_simple_poly ( r) . is_some_and ( |poly| poly. name . contains ( "operation_id" ) )
564
- } )
565
- }
566
-
567
553
fn process < ' b , Q : QueryCallback < T > > (
568
554
& self ,
569
555
mutable_state : & MutableState < ' a , T , Q > ,
0 commit comments