diff --git a/crates/starknet-os/src/hints/unimplemented.rs b/crates/starknet-os/src/hints/unimplemented.rs index a55861d5..b131a56d 100644 --- a/crates/starknet-os/src/hints/unimplemented.rs +++ b/crates/starknet-os/src/hints/unimplemented.rs @@ -1,4 +1,36 @@ use indoc::indoc; #[allow(unused)] -pub const HINT_4: &str = indoc! {r#"exit_syscall(selector=ids.SHA256_PROCESS_BLOCK_SELECTOR)"#}; +const LOG2_CEIL: &str = indoc! {r#" + from starkware.python.math_utils import log2_ceil + ids.res = log2_ceil(ids.value)"# +}; + +#[allow(unused)] +const COMPRESS: &str = indoc! {r#" + from starkware.starknet.core.os.data_availability.compression import compress + data = memory.get_range_as_ints(addr=ids.data_start, size=ids.data_end - ids.data_start) + segments.write_arg(ids.compressed_dst, compress(data))"# +}; + +#[allow(unused)] +pub const DICTIONARY_FROM_BUCKET: &str = + indoc! {r#"initial_dict = {bucket_index: 0 for bucket_index in range(ids.TOTAL_N_BUCKETS)}"#}; + +#[allow(unused)] +const GET_PREV_OFFSET: &str = indoc! {r#" + dict_tracker = __dict_manager.get_tracker(ids.dict_ptr) + ids.prev_offset = dict_tracker.data[ids.bucket_index]"# +}; +#[allow(unused)] +pub const ADD_DA_SEGMENT: &str = indoc! {r#"# `use_kzg_da` is used in a hint in `process_data_availability`. + use_kzg_da = ids.use_kzg_da + if use_kzg_da or ids.compress_state_updates: + ids.state_updates_start = segments.add() + else: + # Assign a temporary segment, to be relocated into the output segment. + ids.state_updates_start = segments.add_temp_segment()"#}; + +#[allow(unused)] +pub const WRITE_N_UPDATES_SMALL: &str = + indoc! {r#"ids.is_n_updates_small = ids.n_actual_updates < ids.N_UPDATES_SMALL_PACKING_BOUND"#};