-
Notifications
You must be signed in to change notification settings - Fork 21
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
refactor(blockifier): remove constant from mid execution test #1070
refactor(blockifier): remove constant from mid execution test #1070
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1070 +/- ##
==========================================
- Coverage 74.18% 70.58% -3.61%
==========================================
Files 359 88 -271
Lines 36240 11347 -24893
Branches 36240 11347 -24893
==========================================
- Hits 26886 8009 -18877
+ Misses 7220 2960 -4260
+ Partials 2134 378 -1756
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @yoavGrs)
crates/blockifier/src/transaction/execution_flavors_test.rs
line 107 at r1 (raw file):
/// Returns the amount of L1 gas and derived fee, given base gas amount and a boolean indicating /// if validation is to be done. fn gas_and_fee(base_gas: u64, validation_overhead: bool, fee_type: &FeeType) -> (u64, Fee) {
This name makes more sense for a numeric value. Maybe include_
or add_
?
Suggestion:
add_validation_overhead: bool
crates/blockifier/src/transaction/execution_flavors_test.rs
line 123 at r1 (raw file):
tx_execution_info: &TransactionExecutionInfo, block_context: &BlockContext, validation_overhead: bool,
See above.
Suggestion:
remove_validation_overhead: bool
8cde0b6
to
da7e992
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: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @aner-starkware)
crates/blockifier/src/transaction/execution_flavors_test.rs
line 107 at r1 (raw file):
Previously, aner-starkware wrote…
This name makes more sense for a numeric value. Maybe
include_
oradd_
?
Done.
crates/blockifier/src/transaction/execution_flavors_test.rs
line 123 at r1 (raw file):
Previously, aner-starkware wrote…
See above.
Done.
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 all commit messages.
Reviewable status: 0 of 1 files reviewed, all discussions resolved (waiting on @yoavGrs)
crates/blockifier/src/transaction/execution_flavors_test.rs
line 574 at r2 (raw file):
.unwrap(); let base_gas: u64 = calculate_actual_gas(&tx_execution_info, &block_context, validate).try_into().unwrap();
Maybe consider adding a comment about the offset of the validation overhead between the execute
and calculate_actual_gas
?
Code quote:
.execute(&mut state, &block_context, charge_fee, validate)
.unwrap();
let base_gas: u64 =
calculate_actual_gas(&tx_execution_info, &block_context, validate).try_into().unwrap();
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: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @yoavGrs)
a discussion (no related file):
Blocked until reviewed by @dorimedini-starkware.
da7e992
to
2bf465c
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: 0 of 1 files reviewed, 1 unresolved discussion
crates/blockifier/src/transaction/execution_flavors_test.rs
line 574 at r2 (raw file):
Previously, aner-starkware wrote…
Maybe consider adding a comment about the offset of the validation overhead between the
execute
andcalculate_actual_gas
?
Done.
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 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @aner-starkware and @yoavGrs)
a discussion (no related file):
Previously, aner-starkware wrote…
Blocked until reviewed by @dorimedini-starkware.
done
crates/blockifier/src/transaction/execution_flavors_test.rs
line 137 at r3 (raw file):
.l1_gas - if remove_validation_overhead { VALIDATE_GAS_OVERHEAD.into() } else { 0 } }
why does one function add validation overhead while the other removes?
Code quote:
fn gas_and_fee(base_gas: u64, add_validation_overhead: bool, fee_type: &FeeType) -> (u64, Fee) {
// Validation incurs a constant gas overhead.
let gas = base_gas + if add_validation_overhead { VALIDATE_GAS_OVERHEAD } else { 0 };
(
gas,
get_fee_by_gas_vector(
&BlockContext::create_for_account_testing().block_info,
GasVector::from_l1_gas(gas.into()),
fee_type,
),
)
}
// Calculates the actual gas used by a transaction. Removing the validation overhead if requested,
// as it's already considered in the tx_execution_info.
fn calculate_actual_gas(
tx_execution_info: &TransactionExecutionInfo,
block_context: &BlockContext,
remove_validation_overhead: bool,
) -> u128 {
tx_execution_info
.receipt
.resources
.to_gas_vector(
&block_context.versioned_constants,
block_context.block_info.use_kzg_da,
&GasVectorComputationMode::NoL2Gas,
)
.l1_gas
- if remove_validation_overhead { VALIDATE_GAS_OVERHEAD.into() } else { 0 }
}
2bf465c
to
dced5d2
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: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @aner-starkware and @dorimedini-starkware)
crates/blockifier/src/transaction/execution_flavors_test.rs
line 137 at r3 (raw file):
Previously, dorimedini-starkware wrote…
why does one function add validation overhead while the other removes?
It comes from the stage of the failure. There is validation overhead in mid_execution
, while it isn't in pre_validate
.
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 1 of 1 files at r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @aner-starkware)
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: complete! all files reviewed, all discussions resolved (waiting on @yoavGrs)
This change is