@@ -172,18 +172,16 @@ impl<'a, T: FieldElement> Machine<'a, T> for BlockMachine<'a, T> {
172172 known_arguments : & BitVec ,
173173 range_constraints : Vec < RangeConstraint < T > > ,
174174 ) -> ( 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+ } ;
182180 match self . function_cache . compile_cached (
183181 can_process,
184182 identity_id,
185183 known_arguments,
186- operation_id ,
184+ fixed_first_input ,
187185 ) {
188186 Some ( entry) => ( true , entry. range_constraints . clone ( ) ) ,
189187 None => ( false , range_constraints) ,
@@ -200,12 +198,10 @@ impl<'a, T: FieldElement> Machine<'a, T> for BlockMachine<'a, T> {
200198 return Err ( EvalError :: RowsExhausted ( self . name . clone ( ) ) ) ;
201199 }
202200
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+ } ;
209205
210206 self . data . finalize_all ( ) ;
211207 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> {
215211 identity_id,
216212 values,
217213 data,
218- operation_id ,
214+ fixed_first_input ,
219215 ) ?;
220216 assert ! ( success) ;
221217 self . block_count_jit += 1 ;
@@ -452,13 +448,12 @@ impl<'a, T: FieldElement> BlockMachine<'a, T> {
452448 }
453449
454450 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) ) ) ;
459454 if self
460455 . 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 )
462457 . is_some ( )
463458 {
464459 let caller_data = CallerData :: new ( arguments, range_constraints) ;
@@ -537,12 +532,10 @@ impl<'a, T: FieldElement> BlockMachine<'a, T> {
537532 self . data . finalize_all ( ) ;
538533
539534 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+ } ;
546539 let data = self . data . append_new_finalized_rows ( self . block_size ) ;
547540
548541 let success = self . function_cache . process_lookup_direct (
@@ -557,13 +550,6 @@ impl<'a, T: FieldElement> BlockMachine<'a, T> {
557550 caller_data. into ( )
558551 }
559552
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-
567553 fn process < ' b , Q : QueryCallback < T > > (
568554 & self ,
569555 mutable_state : & MutableState < ' a , T , Q > ,
0 commit comments