Skip to content

Commit 02e0bb0

Browse files
authored
starknet_committer: rename to reader config (#10782)
1 parent ece2fd3 commit 02e0bb0

File tree

11 files changed

+28
-28
lines changed

11 files changed

+28
-28
lines changed

crates/starknet_committer/src/block_committer/commit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ use crate::block_committer::errors::BlockCommitmentError;
88
use crate::block_committer::input::{
99
contract_address_into_node_index,
1010
Config,
11-
ConfigImpl,
1211
Input,
1312
InputContext,
13+
ReaderConfig,
1414
StateDiff,
1515
};
1616
use crate::block_committer::timing_util::{Action, TimeMeasurement};
@@ -26,7 +26,7 @@ type BlockCommitmentResult<T> = Result<T, BlockCommitmentError>;
2626

2727
// TODO(Yoav): Include InputContext and ForestReader as arguments of the Layer, when it's ready.
2828
pub async fn commit_block<I: InputContext, Reader: ForestReader<I>>(
29-
input: Input<ConfigImpl, I>,
29+
input: Input<ReaderConfig, I>,
3030
trie_reader: &mut Reader,
3131
mut time_measurement: Option<&mut TimeMeasurement>,
3232
) -> BlockCommitmentResult<FilledForest> {

crates/starknet_committer/src/block_committer/input.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,12 @@ pub trait Config: Debug + Eq + PartialEq {
130130
}
131131

132132
#[derive(Clone, Debug, Eq, PartialEq)]
133-
pub struct ConfigImpl {
133+
pub struct ReaderConfig {
134134
warn_on_trivial_modifications: bool,
135135
log_level: LevelFilter,
136136
}
137137

138-
impl Config for ConfigImpl {
138+
impl Config for ReaderConfig {
139139
fn warn_on_trivial_modifications(&self) -> bool {
140140
self.warn_on_trivial_modifications
141141
}
@@ -145,13 +145,13 @@ impl Config for ConfigImpl {
145145
}
146146
}
147147

148-
impl ConfigImpl {
148+
impl ReaderConfig {
149149
pub fn new(warn_on_trivial_modifications: bool, log_level: LevelFilter) -> Self {
150150
Self { warn_on_trivial_modifications, log_level }
151151
}
152152
}
153153

154-
impl Default for ConfigImpl {
154+
impl Default for ReaderConfig {
155155
fn default() -> Self {
156156
Self { warn_on_trivial_modifications: false, log_level: LevelFilter::INFO }
157157
}

crates/starknet_committer/src/block_committer/timing_util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ use starknet_api::hash::HashOutput;
77
use starknet_types_core::felt::Felt;
88
use tracing::info;
99

10-
use crate::block_committer::input::{ConfigImpl, FactsDbInitialRead, Input};
10+
use crate::block_committer::input::{FactsDbInitialRead, Input, ReaderConfig};
1111

12-
pub type FactsDbInputImpl = Input<ConfigImpl, FactsDbInitialRead>;
12+
pub type FactsDbInputImpl = Input<ReaderConfig, FactsDbInitialRead>;
1313

1414
#[derive(Debug, PartialEq, Eq)]
1515
pub enum Action {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ use starknet_patricia_storage::storage_trait::{
2020
use crate::block_committer::input::{
2121
contract_address_into_node_index,
2222
Config,
23-
ConfigImpl,
2423
FactsDbInitialRead,
24+
ReaderConfig,
2525
StarknetStorageValue,
2626
};
2727
use crate::db::facts_db::create_facts_tree::{
@@ -142,7 +142,7 @@ impl<S: Storage> ForestReader<FactsDbInitialRead> for FactsDb<S> {
142142
storage_updates: &'a HashMap<ContractAddress, LeafModifications<StarknetStorageValue>>,
143143
classes_updates: &'a LeafModifications<CompiledClassHash>,
144144
forest_sorted_indices: &'a ForestSortedIndices<'a>,
145-
config: ConfigImpl,
145+
config: ReaderConfig,
146146
) -> ForestResult<(OriginalSkeletonForest<'a>, HashMap<NodeIndex, ContractState>)> {
147147
let (contracts_trie, original_contracts_trie_leaves) = self
148148
.create_contracts_trie(

crates/starknet_committer/src/db/forest_trait.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use starknet_patricia::patricia_merkle_tree::node_data::leaf::LeafModifications;
77
use starknet_patricia::patricia_merkle_tree::types::NodeIndex;
88
use starknet_patricia_storage::storage_trait::{DbHashMap, DbKey, DbValue, Storage};
99

10-
use crate::block_committer::input::{ConfigImpl, InputContext, StarknetStorageValue};
10+
use crate::block_committer::input::{InputContext, ReaderConfig, StarknetStorageValue};
1111
use crate::forest::filled_forest::FilledForest;
1212
use crate::forest::forest_errors::ForestResult;
1313
use crate::forest::original_skeleton_forest::{ForestSortedIndices, OriginalSkeletonForest};
@@ -56,7 +56,7 @@ pub trait ForestReader<I: InputContext> {
5656
classes_updates: &'a LeafModifications<CompiledClassHash>,
5757
forest_sorted_indices: &'a ForestSortedIndices<'a>,
5858
// TODO(Yoav): Change to 'impl Config' or delete this trait
59-
config: ConfigImpl,
59+
config: ReaderConfig,
6060
) -> ForestResult<(OriginalSkeletonForest<'a>, HashMap<NodeIndex, ContractState>)>;
6161
}
6262

crates/starknet_committer/src/forest/skeleton_forest_test.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ use tracing::level_filters::LevelFilter;
2626
use crate::block_committer::commit::get_all_modified_indices;
2727
use crate::block_committer::input::{
2828
contract_address_into_node_index,
29-
ConfigImpl,
3029
FactsDbInitialRead,
3130
Input,
31+
ReaderConfig,
3232
StarknetStorageKey,
3333
StarknetStorageValue,
3434
StateDiff,
@@ -148,7 +148,7 @@ pub(crate) fn create_contract_state_leaf_entry(val: u128) -> (DbKey, DbValue) {
148148
contracts_trie_root_hash: HashOutput(Felt::from(861_u128 + 248_u128)),
149149
classes_trie_root_hash: HashOutput(Felt::from(155_u128 + 248_u128)),
150150
}),
151-
config: ConfigImpl::new(true, LevelFilter::DEBUG),
151+
config: ReaderConfig::new(true, LevelFilter::DEBUG),
152152
},
153153
MapStorage(DbHashMap::from([
154154
// Roots.
@@ -297,7 +297,7 @@ pub(crate) fn create_contract_state_leaf_entry(val: u128) -> (DbKey, DbValue) {
297297
vec![7, 6, 0],
298298
)]
299299
async fn test_create_original_skeleton_forest(
300-
#[case] input: Input<ConfigImpl, FactsDbInitialRead>,
300+
#[case] input: Input<ReaderConfig, FactsDbInitialRead>,
301301
#[case] storage: MapStorage,
302302
#[case] expected_forest: OriginalSkeletonForest<'_>,
303303
#[case] expected_original_contracts_trie_leaves: HashMap<ContractAddress, ContractState>,
@@ -324,7 +324,7 @@ async fn test_create_original_skeleton_forest(
324324
&actual_storage_updates,
325325
&actual_classes_updates,
326326
&forest_sorted_indices,
327-
ConfigImpl::new(false, LevelFilter::DEBUG),
327+
ReaderConfig::new(false, LevelFilter::DEBUG),
328328
)
329329
.await
330330
.unwrap();

crates/starknet_committer_and_os_cli/src/committer_cli/parse_input/cast.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ use std::collections::HashMap;
33
use starknet_api::core::{ClassHash, ContractAddress, Nonce};
44
use starknet_api::hash::{HashOutput, StateRoots};
55
use starknet_committer::block_committer::input::{
6-
ConfigImpl,
76
FactsDbInitialRead,
87
Input,
8+
ReaderConfig,
99
StarknetStorageKey,
1010
StarknetStorageValue,
1111
StateDiff,
@@ -18,7 +18,7 @@ use starknet_types_core::felt::Felt;
1818

1919
use crate::committer_cli::parse_input::raw_input::RawInput;
2020

21-
pub type FactsDbInputImpl = Input<ConfigImpl, FactsDbInitialRead>;
21+
pub type FactsDbInputImpl = Input<ReaderConfig, FactsDbInitialRead>;
2222

2323
#[derive(Debug, PartialEq)]
2424
pub struct CommitterFactsDbInputImpl {

crates/starknet_committer_and_os_cli/src/committer_cli/parse_input/raw_input.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use serde::{Deserialize, Serialize};
22
use serde_repr::Deserialize_repr;
3-
use starknet_committer::block_committer::input::ConfigImpl;
3+
use starknet_committer::block_committer::input::ReaderConfig;
44
use tracing::level_filters::LevelFilter;
55
type RawFelt = [u8; 32];
66

@@ -43,7 +43,7 @@ pub(crate) enum PythonLogLevel {
4343
Debug = 10,
4444
}
4545

46-
impl From<RawConfigImpl> for ConfigImpl {
46+
impl From<RawConfigImpl> for ReaderConfig {
4747
fn from(raw_config: RawConfigImpl) -> Self {
4848
let log_level = match raw_config.log_level {
4949
PythonLogLevel::NotSet => LevelFilter::TRACE,
@@ -52,7 +52,7 @@ impl From<RawConfigImpl> for ConfigImpl {
5252
PythonLogLevel::Warning => LevelFilter::WARN,
5353
PythonLogLevel::Error | PythonLogLevel::Critical => LevelFilter::ERROR,
5454
};
55-
ConfigImpl::new(raw_config.warn_on_trivial_modifications, log_level)
55+
ReaderConfig::new(raw_config.warn_on_trivial_modifications, log_level)
5656
}
5757
}
5858

crates/starknet_committer_and_os_cli/src/committer_cli/parse_input/read_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use pretty_assertions::assert_eq;
55
use starknet_api::core::{ClassHash, ContractAddress, Nonce};
66
use starknet_api::hash::{HashOutput, StateRoots};
77
use starknet_committer::block_committer::input::{
8-
ConfigImpl,
98
FactsDbInitialRead,
109
Input,
10+
ReaderConfig,
1111
StarknetStorageKey,
1212
StarknetStorageValue,
1313
StateDiff,
@@ -220,7 +220,7 @@ fn test_simple_input_parsing() {
220220
contracts_trie_root_hash: expected_contracts_trie_root_hash,
221221
classes_trie_root_hash: expected_classes_trie_root_hash,
222222
}),
223-
config: ConfigImpl::new(true, LevelFilter::DEBUG),
223+
config: ReaderConfig::new(true, LevelFilter::DEBUG),
224224
};
225225
assert_eq!(
226226
parse_input(input).unwrap(),

crates/starknet_committer_cli/src/commands.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ use rand::{Rng, SeedableRng};
77
use starknet_api::hash::{HashOutput, StateRoots};
88
use starknet_committer::block_committer::commit::commit_block;
99
use starknet_committer::block_committer::input::{
10-
ConfigImpl,
1110
FactsDbInitialRead,
1211
Input,
12+
ReaderConfig,
1313
StarknetStorageKey,
1414
StateDiff,
1515
};
@@ -33,7 +33,7 @@ use crate::args::{
3333
DEFAULT_DATA_PATH,
3434
};
3535

36-
pub type InputImpl = Input<ConfigImpl, FactsDbInitialRead>;
36+
pub type InputImpl = Input<ReaderConfig, FactsDbInitialRead>;
3737

3838
const FLAVOR_PERIOD_MANY_WINDOW: usize = 10;
3939
const FLAVOR_PERIOD_PERIOD: usize = 500;
@@ -352,7 +352,7 @@ pub async fn run_storage_benchmark<S: Storage>(
352352
contracts_trie_root_hash,
353353
classes_trie_root_hash,
354354
}),
355-
config: ConfigImpl::default(),
355+
config: ReaderConfig::default(),
356356
};
357357

358358
time_measurement.start_measurement(Action::EndToEnd);

0 commit comments

Comments
 (0)