Skip to content

Commit

Permalink
feat(starknet_os): integrate transaction_hash hints
Browse files Browse the repository at this point in the history
  • Loading branch information
dorimedini-starkware committed Jan 28, 2025
1 parent 3fbf9de commit dce34f4
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/starknet_os/src/hints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ pub mod secp;
pub mod state;
pub mod stateless_compression;
pub mod syscalls;
pub mod transaction_hash;
pub mod types;
15 changes: 15 additions & 0 deletions crates/starknet_os/src/hints/enum_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ use crate::hints::syscalls::{
storage_read,
storage_write,
};
use crate::hints::transaction_hash::{additional_data_new_segment, data_to_hash_new_segment};
use crate::hints::types::{HintEnum, HintExtensionImplementation, HintImplementation};
use crate::{define_hint_enum, define_hint_extension_enum};

Expand Down Expand Up @@ -1614,6 +1615,20 @@ memory[ap] = 1 if case != 'both' else 0"#
exit_storage_write_syscall,
"exit_syscall(selector=ids.STORAGE_WRITE_SELECTOR)"
),
(
AdditionalDataNewSegment,
additional_data_new_segment,
indoc! {r#"
ids.additional_data = segments.add()"#
}
),
(
DataToHashNewSegment,
data_to_hash_new_segment,
indoc! {r#"
ids.data_to_hash = segments.add()"#
}
)
);

define_hint_extension_enum!(
Expand Down
29 changes: 29 additions & 0 deletions crates/starknet_os/src/hints/transaction_hash.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
use std::collections::HashMap;

use cairo_vm::hint_processor::hint_processor_definition::HintReference;
use cairo_vm::serde::deserialize_program::ApTracking;
use cairo_vm::types::exec_scope::ExecutionScopes;
use cairo_vm::vm::vm_core::VirtualMachine;
use starknet_types_core::felt::Felt;

use crate::hints::error::HintResult;

pub fn additional_data_new_segment(
_vm: &mut VirtualMachine,
_exec_scopes: &mut ExecutionScopes,
_ids_data: &HashMap<String, HintReference>,
_ap_tracking: &ApTracking,
_constants: &HashMap<String, Felt>,
) -> HintResult {
todo!()
}

pub fn data_to_hash_new_segment(
_vm: &mut VirtualMachine,
_exec_scopes: &mut ExecutionScopes,
_ids_data: &HashMap<String, HintReference>,
_ap_tracking: &ApTracking,
_constants: &HashMap<String, Felt>,
) -> HintResult {
todo!()
}

0 comments on commit dce34f4

Please sign in to comment.