Skip to content

Commit 47514f7

Browse files
committed
starknet_committer: reorganize facts db files
1 parent 3c5c095 commit 47514f7

File tree

11 files changed

+16
-14
lines changed

11 files changed

+16
-14
lines changed
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
pub mod create_facts_tree;
21
#[cfg(any(feature = "testing", test))]
32
pub mod external_test_utils;
43
pub mod facts_db;
54
pub mod forest_trait;
6-
pub mod traversal;

crates/starknet_committer/src/db/external_test_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use starknet_patricia::patricia_merkle_tree::updated_skeleton_tree::tree::{
1717
};
1818
use starknet_patricia_storage::map_storage::MapStorage;
1919

20-
use crate::db::create_facts_tree::create_original_skeleton_tree;
20+
use crate::db::facts_db::create_facts_tree::create_original_skeleton_tree;
2121

2222
pub async fn tree_computation_flow<L, TH>(
2323
leaf_modifications: LeafModifications<L>,

crates/starknet_committer/src/db/create_facts_tree.rs renamed to crates/starknet_committer/src/db/facts_db/create_facts_tree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use starknet_patricia::patricia_merkle_tree::types::{NodeIndex, SortedLeafIndice
2323
use starknet_patricia_storage::storage_trait::Storage;
2424
use tracing::warn;
2525

26-
use crate::db::traversal::calculate_subtrees_roots;
26+
use crate::db::facts_db::traversal::calculate_subtrees_roots;
2727

2828
#[cfg(test)]
2929
#[path = "create_facts_tree_test.rs"]

crates/starknet_committer/src/db/create_facts_tree_test.rs renamed to crates/starknet_committer/src/db/facts_db/create_facts_tree_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use starknet_patricia_storage::map_storage::MapStorage;
2323
use starknet_patricia_storage::storage_trait::{DbHashMap, DbKey, DbValue};
2424
use starknet_types_core::felt::Felt;
2525

26-
use crate::db::create_facts_tree::create_original_skeleton_tree;
26+
use crate::db::facts_db::create_facts_tree::create_original_skeleton_tree;
2727

2828
#[tokio::test]
2929
#[rstest]

crates/starknet_committer/src/db/facts_db.rs renamed to crates/starknet_committer/src/db/facts_db/db.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::block_committer::input::{
1414
ConfigImpl,
1515
StarknetStorageValue,
1616
};
17-
use crate::db::create_facts_tree::{
17+
use crate::db::facts_db::create_facts_tree::{
1818
create_original_skeleton_tree,
1919
create_original_skeleton_tree_and_get_previous_leaves,
2020
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pub mod create_facts_tree;
2+
// TODO(Ariel): Move db.rs to this module and avoid db::fact_db::db path..
3+
pub mod db;
4+
pub mod traversal;
File renamed without changes.

crates/starknet_committer/src/db/traversal_test.rs renamed to crates/starknet_committer/src/db/facts_db/traversal_test.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use starknet_patricia_storage::storage_trait::{DbHashMap, DbKey, DbValue};
3232
use starknet_types_core::felt::Felt;
3333
use starknet_types_core::hash::Pedersen;
3434

35-
use super::fetch_patricia_paths_inner;
35+
use crate::db::facts_db::traversal::fetch_patricia_paths_inner;
3636

3737
fn to_preimage_map(raw_preimages: HashMap<u32, Vec<u32>>) -> PreimageMap {
3838
raw_preimages
@@ -514,10 +514,10 @@ struct TestPatriciaPathsInput {
514514
/// The files names indicate the tree height, number of initial leaves and number of modified
515515
/// leaves. The hash function used in the python tests is Pedersen.
516516
/// The leaves values are their NodeIndices.
517-
#[case(include_str!("../../resources/fetch_patricia_paths_test_10_200_50.json"))]
518-
#[case(include_str!("../../resources/fetch_patricia_paths_test_10_5_2.json"))]
519-
#[case(include_str!("../../resources/fetch_patricia_paths_test_10_100_30.json"))]
520-
#[case(include_str!("../../resources/fetch_patricia_paths_test_8_120_70.json"))]
517+
#[case(include_str!("../../../resources/fetch_patricia_paths_test_10_200_50.json"))]
518+
#[case(include_str!("../../../resources/fetch_patricia_paths_test_10_5_2.json"))]
519+
#[case(include_str!("../../../resources/fetch_patricia_paths_test_10_100_30.json"))]
520+
#[case(include_str!("../../../resources/fetch_patricia_paths_test_8_120_70.json"))]
521521
async fn test_fetch_patricia_paths_inner_from_json(#[case] input_data: &str) {
522522
let input: TestPatriciaPathsInput = serde_json::from_str(input_data)
523523
.unwrap_or_else(|error| panic!("JSON was not well-formatted: {error:?}"));

crates/starknet_committer/src/forest/skeleton_forest_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use crate::block_committer::input::{
3232
StarknetStorageValue,
3333
StateDiff,
3434
};
35-
use crate::db::facts_db::FactsDb;
35+
use crate::db::facts_db::db::FactsDb;
3636
use crate::db::forest_trait::ForestReader;
3737
use crate::forest::original_skeleton_forest::{ForestSortedIndices, OriginalSkeletonForest};
3838
use crate::patricia_merkle_tree::leaf::leaf_impl::ContractState;

crates/starknet_committer/src/patricia_merkle_tree/tree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::block_committer::input::{
1414
StarknetStorageKey,
1515
StarknetStorageValue,
1616
};
17-
use crate::db::traversal::fetch_patricia_paths;
17+
use crate::db::facts_db::traversal::fetch_patricia_paths;
1818
use crate::patricia_merkle_tree::leaf::leaf_impl::ContractState;
1919
use crate::patricia_merkle_tree::types::{
2020
class_hash_into_node_index,

0 commit comments

Comments
 (0)