@@ -3,17 +3,15 @@ use cairo_vm::hint_processor::builtin_hint_processor::hint_utils::{
33 insert_value_from_var_name,
44 insert_value_into_ap,
55} ;
6- use cairo_vm:: hint_processor:: hint_processor_utils:: felt_to_usize;
76use starknet_types_core:: felt:: Felt ;
87
98use crate :: hint_processor:: aggregator_hint_processor:: { AggregatorHintProcessor , DataAvailability } ;
109use crate :: hint_processor:: common_hint_processor:: CommonHintProcessor ;
1110use crate :: hints:: error:: { OsHintError , OsHintResult } ;
12- use crate :: hints:: hint_implementation:: aggregator:: utils:: FullOsOutputs ;
11+ use crate :: hints:: hint_implementation:: aggregator:: utils:: FullOsOutputsData ;
1312use crate :: hints:: hint_implementation:: output:: load_public_keys_into_memory;
1413use crate :: hints:: types:: HintArgs ;
1514use crate :: hints:: vars:: Ids ;
16- use crate :: io:: os_output:: { wrap_missing, FullOsOutput , OsOutput } ;
1715use crate :: io:: os_output_types:: TryFromOutputIter ;
1816use crate :: vm_utils:: LoadIntoVmMemory ;
1917
@@ -51,32 +49,13 @@ pub(crate) fn get_os_output_for_inner_blocks(
5149 . take ( )
5250 . ok_or ( OsHintError :: AggregatorBootloaderInputAlreadyConsumed ) ?
5351 . into_iter ( ) ;
54- let n_outputs = wrap_missing ( bootloader_iter. next ( ) , "n_output" ) ?;
55- let n_outputs_usize = felt_to_usize ( & n_outputs) ?;
56- assert ! ( n_outputs_usize > 0 , "No tasks found in the bootloader output." ) ;
57-
58- let mut program_hash: Option < Felt > = None ;
59- let mut outputs = FullOsOutputs ( Vec :: < FullOsOutput > :: with_capacity ( n_outputs_usize) ) ;
60- for _ in 0 ..n_outputs_usize {
61- wrap_missing ( bootloader_iter. next ( ) , "output_size" ) ?;
62- let current_output_program_hash = wrap_missing ( bootloader_iter. next ( ) , "program_hash" ) ?;
63- assert_eq ! (
64- program_hash. get_or_insert( current_output_program_hash) ,
65- & current_output_program_hash
66- ) ;
67- // Regardless of encryption mode: OS outputs that reach the aggregator are never encrypted.
68- // No need to pass any decryption data here.
69- outputs. 0 . push ( OsOutput :: try_from_output_iter ( & mut bootloader_iter, None ) ?. try_into ( ) ?) ;
70- }
7152
72- insert_value_from_var_name (
73- Ids :: OsProgramHash . into ( ) ,
74- program_hash. expect ( "n_outputs > 0 but program hash wasn't initialized." ) ,
75- vm,
76- ids_data,
77- ap_tracking,
78- ) ?;
53+ // Regardless of encryption mode: OS outputs that reach the aggregator are never
54+ // encrypted. No need to pass any decryption data here.
55+ let FullOsOutputsData { outputs, n_outputs, program_hash } =
56+ FullOsOutputsData :: try_from_output_iter ( & mut bootloader_iter, None ) ?;
7957
58+ insert_value_from_var_name ( Ids :: OsProgramHash . into ( ) , program_hash, vm, ids_data, ap_tracking) ?;
8059 insert_value_from_var_name ( Ids :: NTasks . into ( ) , n_outputs, vm, ids_data, ap_tracking) ?;
8160
8261 let os_output_ptr = get_ptr_from_var_name ( Ids :: OsOutputs . into ( ) , vm, ids_data, ap_tracking) ?;
0 commit comments