Skip to content

build: creating config object #312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion crates/committer/src/block_committer/input.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use serde::Deserialize;

use crate::felt::Felt;
use crate::hash::hash_trait::HashOutput;
use crate::patricia_merkle_tree::filled_tree::node::{ClassHash, CompiledClassHash, Nonce};
Expand Down Expand Up @@ -35,7 +37,7 @@ pub trait Config: Debug + Eq + PartialEq {
fn warn_on_trivial_modifications(&self) -> bool;
}

#[derive(Debug, Eq, PartialEq)]
#[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct ConfigImpl {
warn_on_trivial_modifications: bool,
}
Expand Down
2 changes: 1 addition & 1 deletion crates/committer_cli/benches/committer_flow_inputs.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion crates/committer_cli/src/parse_input/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl TryFrom<RawInput> for InputImpl {
classes_trie_root_hash: HashOutput(Felt::from_bytes_be_slice(
&raw_input.classes_trie_root_hash,
)),
config: ConfigImpl::new(raw_input.trivial_updates_config),
config: raw_input.config,
})
}
}
Expand Down
3 changes: 2 additions & 1 deletion crates/committer_cli/src/parse_input/raw_input.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use committer::block_committer::input::ConfigImpl;
use serde::Deserialize;

type RawFelt = [u8; 32];
Expand All @@ -10,7 +11,7 @@ pub(crate) struct RawInput {
pub state_diff: RawStateDiff,
pub contracts_trie_root_hash: RawFelt,
pub classes_trie_root_hash: RawFelt,
pub trivial_updates_config: bool,
pub config: ConfigImpl,
}

#[derive(Deserialize, Debug)]
Expand Down
6 changes: 3 additions & 3 deletions crates/committer_cli/src/parse_input/read_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ fn test_simple_input_parsing() {
],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
true
{"warn_on_trivial_modifications": true}
]

"#;
Expand Down Expand Up @@ -232,7 +232,7 @@ fn test_input_parsing_with_storage_key_duplicate() {
],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 222, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 3],
true
{"warn_on_trivial_modifications": true}
]

"#;
Expand Down Expand Up @@ -274,7 +274,7 @@ fn test_input_parsing_with_mapping_key_duplicate() {
],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 144, 0, 0, 0, 0, 0, 0, 0, 0, 5],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 222, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 3],
false
{"warn_on_trivial_modifications": false}
]

"#;
Expand Down
2 changes: 1 addition & 1 deletion crates/committer_cli/src/tests/flow_test_files_prefix
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7c50039
6cf59e4
Loading