-
Notifications
You must be signed in to change notification settings - Fork 0
feat(block_hash): add basic block info command #173
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @yoavGrs)
crates/committer_cli/src/tests/python_tests.rs
line 172 at r1 (raw file):
"da mode: {}, data gas: {:?}, gas: {:?}", da_mode, data_gas, gas )
I suggest the following:
- define a struct
S
describing the inputs of the block hash (or reuse the starknet-api struct). - define a function to deserialize a
HashMap<String, Value>
to an instance ofS
- in this test, just call the
S
deserializer, and compare the result to an explicitly constructedS
instance
Code quote:
let da_mode_value = get_param_from_args(&test_args, "l1_da_mode");
let da_mode: bool = da_mode_value.as_bool().expect("serialize da mode");
let data_gas_value = get_param_from_args(&test_args, "l1_data_gas_price_per_token");
let data_gas: GasPricePerToken =
serde_json::from_value(data_gas_value.to_owned()).expect("serialize data gas");
let gas_value = get_param_from_args(&test_args, "l1_gas_price_per_token");
let gas: GasPricePerToken =
serde_json::from_value(gas_value.to_owned()).expect("serialize gas");
format!(
"da mode: {}, data gas: {:?}, gas: {:?}",
da_mode, data_gas, gas
)
crates/committer_cli/src/tests/python_tests.rs
line 178 at r1 (raw file):
let error_message = format!("{} not found", param_name); test_args.get(param_name).expect(&error_message) }
why not use get_key_or_not_found
? just return a Result<String, PythonTestError>
from your test function and propagate the error
Code quote:
fn get_param_from_args<'a>(test_args: &'a HashMap<String, Value>, param_name: &str) -> &'a Value {
let error_message = format!("{} not found", param_name);
test_args.get(param_name).expect(&error_message)
}
0020be3
to
9c72c08
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #173 +/- ##
==========================================
- Coverage 62.27% 61.88% -0.40%
==========================================
Files 35 36 +1
Lines 1662 1721 +59
Branches 1662 1721 +59
==========================================
+ Hits 1035 1065 +30
- Misses 578 609 +31
+ Partials 49 47 -2 ☔ View full report in Codecov by Sentry. |
9c72c08
to
2ea1a51
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 3 of 6 files reviewed, 2 unresolved discussions (waiting on @dorimedini-starkware)
crates/committer_cli/src/tests/python_tests.rs
line 172 at r1 (raw file):
Previously, dorimedini-starkware wrote…
I suggest the following:
- define a struct
S
describing the inputs of the block hash (or reuse the starknet-api struct).- define a function to deserialize a
HashMap<String, Value>
to an instance ofS
- in this test, just call the
S
deserializer, and compare the result to an explicitly constructedS
instance
This is a really good goal.
For now, I want to deserialize only a subset of S
.
crates/committer_cli/src/tests/python_tests.rs
line 178 at r1 (raw file):
Previously, dorimedini-starkware wrote…
why not use
get_key_or_not_found
? just return aResult<String, PythonTestError>
from your test function and propagate the error
I did something simpler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 3 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @yoavGrs)
2ea1a51
to
8bd7345
Compare
8bd7345
to
256ba4b
Compare
This change is