Skip to content

Commit fac9e2d

Browse files
starknet_os: move commitment info
1 parent 39dc73c commit fac9e2d

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

crates/starknet_os/src/io/os_input.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ pub struct CommitmentInfo {
4343
pub commitment_facts: HashMap<HashOutput, Vec<Felt>>,
4444
}
4545

46+
// TODO(Aviv): Use this struct in `OsBlockInput`
47+
/// Contains all commitment information for a block's state trees.
48+
pub struct StateCommitmentInfos {
49+
pub contracts_trie_commitment_info: CommitmentInfo,
50+
pub classes_trie_commitment_info: CommitmentInfo,
51+
pub storage_tries_commitment_infos: HashMap<ContractAddress, CommitmentInfo>,
52+
}
53+
4654
#[cfg(any(feature = "testing", test))]
4755
impl Default for CommitmentInfo {
4856
fn default() -> CommitmentInfo {

crates/starknet_os_flow_tests/src/utils.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ use starknet_committer::patricia_merkle_tree::types::{
5858
};
5959
use starknet_os::hints::hint_implementation::deprecated_compiled_class::class_hash::compute_deprecated_class_hash;
6060
use starknet_os::hints::vars::Const;
61-
use starknet_os::io::os_input::CommitmentInfo;
61+
use starknet_os::io::os_input::{CommitmentInfo, StateCommitmentInfos};
6262
use starknet_patricia::patricia_merkle_tree::node_data::inner_node::flatten_preimages;
6363
use starknet_patricia::patricia_merkle_tree::types::{NodeIndex, SortedLeafIndices, SubTreeHeight};
6464
use starknet_patricia_storage::db_object::EmptyKeyContext;
@@ -217,19 +217,13 @@ pub(crate) fn create_declare_tx(
217217
AccountTransaction::Declare(tx)
218218
}
219219

220-
pub(crate) struct CommitmentInfos {
221-
pub(crate) contracts_trie_commitment_info: CommitmentInfo,
222-
pub(crate) classes_trie_commitment_info: CommitmentInfo,
223-
pub(crate) storage_tries_commitment_infos: HashMap<ContractAddress, CommitmentInfo>,
224-
}
225-
226220
/// Creates the commitment infos and the cached state input for the OS.
227221
pub(crate) async fn create_cached_state_input_and_commitment_infos(
228222
previous_state_roots: &StateRoots,
229223
new_state_roots: &StateRoots,
230224
commitments: &mut MapStorage,
231225
extended_state_diff: &StateMaps,
232-
) -> (StateMaps, CommitmentInfos) {
226+
) -> (StateMaps, StateCommitmentInfos) {
233227
// TODO(Nimrod): Gather the keys from the state selector similarly to python.
234228
let (previous_contract_states, new_storage_roots) = get_previous_states_and_new_storage_roots(
235229
extended_state_diff.get_contract_addresses().into_iter(),
@@ -358,7 +352,7 @@ pub(crate) async fn create_cached_state_input_and_commitment_infos(
358352

359353
(
360354
state_maps,
361-
CommitmentInfos {
355+
StateCommitmentInfos {
362356
contracts_trie_commitment_info,
363357
classes_trie_commitment_info,
364358
storage_tries_commitment_infos,

0 commit comments

Comments
 (0)