-
Notifications
You must be signed in to change notification settings - Fork 26
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
build(fee): sn_resources depend on resource bounds signature #454
build(fee): sn_resources depend on resource bounds signature #454
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, 3 unresolved discussions (waiting on @nimrod-starkware and @TzahiTaub)
crates/blockifier/src/fee/actual_cost_test.rs
line 0 at r1 (raw file):
I would prefer the include_l2_gas
flag be a "parametrized fixture"
TAL at rstest_reuse
, so you can define something like:
#[template]
#[rstest]
fn include_l2_gas_param(#[values(false)] include_l2_gas: bool) {}
and use it in tests like this:
#[apply(include_l2_gas_param)]
fn test_calculate_tx_gas_usage_basic<'a>(#[values(false, true)] use_kzg_da: bool, include_l2_gas: bool) {
...
not sure if it works, but if it does, you'll be able to edit include_l2_gas_param
by adding , true
to #[values]
and get test coverage for free
crates/blockifier/src/fee/gas_usage_test.rs
line 0 at r1 (raw file):
ditto on the parametrization comment above
crates/blockifier/src/transaction/objects.rs
line 320 at r1 (raw file):
+ self.get_messages_cost() + self.get_events_cost(versioned_constants, include_l2_gas) }
wouldn't this be cleaner?
then you wouldn't need to propagate this flag everywhere
Suggestion:
versioned_constants: &VersionedConstants,
use_kzg_da: bool,
include_l2_gas: bool,
) -> GasVector {
if include_l2_gas {
todo!();
} else {
self.get_calldata_and_signature_cost(versioned_constants, include_l2_gas)
+ self.get_code_cost(versioned_constants, include_l2_gas)
+ self.get_state_changes_cost(use_kzg_da)
+ self.get_messages_cost()
+ self.get_events_cost(versioned_constants, include_l2_gas)
}
}
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: all files reviewed, 3 unresolved discussions (waiting on @dorimedini-starkware and @TzahiTaub)
crates/blockifier/src/fee/actual_cost_test.rs
line at r1 (raw file):
Previously, dorimedini-starkware wrote…
I would prefer the
include_l2_gas
flag be a "parametrized fixture"
TAL atrstest_reuse
, so you can define something like:#[template] #[rstest] fn include_l2_gas_param(#[values(false)] include_l2_gas: bool) {}
and use it in tests like this:
#[apply(include_l2_gas_param)] fn test_calculate_tx_gas_usage_basic<'a>(#[values(false, true)] use_kzg_da: bool, include_l2_gas: bool) { ...
not sure if it works, but if it does, you'll be able to edit
include_l2_gas_param
by adding, true
to#[values]
and get test coverage for free
Nice!
I'll add it to tests that I think are independent of l1/l2 gas calculation (that don't compare hard coded gas vectors for example)
crates/blockifier/src/transaction/objects.rs
line 320 at r1 (raw file):
Previously, dorimedini-starkware wrote…
wouldn't this be cleaner?
then you wouldn't need to propagate this flag everywhere
it's cleaner but get_calldata_and_signature_cost
needs to know whether to calculate as l1 or l2... no?
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: all files reviewed, 3 unresolved discussions (waiting on @dorimedini-starkware and @TzahiTaub)
crates/blockifier/src/fee/actual_cost_test.rs
line at r1 (raw file):
Previously, nimrod-starkware wrote…
Nice!
I'll add it to tests that I think are independent of l1/l2 gas calculation (that don't compare hard coded gas vectors for example)
added it to test_calculate_tx_gas_usage
crates/blockifier/src/fee/gas_usage_test.rs
line at r1 (raw file):
Previously, dorimedini-starkware wrote…
ditto on the parametrization comment above
Done
614086d
to
855c361
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.
Reviewed 5 of 5 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @nimrod-starkware and @TzahiTaub)
crates/blockifier/Cargo.toml
line 68 at r2 (raw file):
regex.workspace = true rstest.workspace = true test-case.workspace = true
to pass machete I think you'll need to do this (rstest_reuse isn't used in non-testing code)
Suggestion:
rand = { workspace = true, optional = true }
rstest = { workspace = true, optional = true }
rstest_reuse = { workspace = true, optional = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true, features = ["arbitrary_precision"] }
sha2.workspace = true
sha3.workspace = true
starknet-types-core.workspace = true
starknet_api = { workspace = true, features = ["testing"] }
strum.workspace = true
strum_macros.workspace = true
tempfile.workspace = true
thiserror.workspace = true
tikv-jemallocator = { workspace = true, optional = true }
toml.workspace = true
[dev-dependencies]
assert_matches.workspace = true
criterion = { workspace = true, features = ["html_reports"] }
glob.workspace = true
pretty_assertions.workspace = true
rand.workspace = true
regex.workspace = true
rstest.workspace = true
rstest_reuse.workspace = true
test-case.workspace = true
crates/blockifier/src/fee/actual_cost_test.rs
line 36 at r2 (raw file):
#[rstest] // TODO(Nimrod): Add true as a case. fn include_l2_gas(#[values(false)] has_l2_gas: bool) {}
since this is used on other tests, please move it to a test utils module
Code quote:
#[rstest_reuse::template]
#[rstest]
// TODO(Nimrod): Add true as a case.
fn include_l2_gas(#[values(false)] has_l2_gas: bool) {}
crates/blockifier/src/transaction/objects.rs
line 320 at r1 (raw file):
Previously, nimrod-starkware wrote…
it's cleaner but
get_calldata_and_signature_cost
needs to know whether to calculate as l1 or l2... no?
won't there be a completely different function to compute L2 gas cost? I guess not... unblocking
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## nimrod/resources_enum/impl_methods #454 +/- ##
======================================================================
+ Coverage 75.72% 75.82% +0.09%
======================================================================
Files 85 352 +267
Lines 10984 37507 +26523
Branches 10984 37507 +26523
======================================================================
+ Hits 8318 28440 +20122
- Misses 2242 6746 +4504
- Partials 424 2321 +1897 ☔ 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: all files reviewed, 2 unresolved discussions (waiting on @dorimedini-starkware and @TzahiTaub)
crates/blockifier/Cargo.toml
line 68 at r2 (raw file):
Previously, dorimedini-starkware wrote…
to pass machete I think you'll need to do this (rstest_reuse isn't used in non-testing code)
machete passed, but added it anyway
crates/blockifier/src/fee/actual_cost_test.rs
line 36 at r2 (raw file):
Previously, dorimedini-starkware wrote…
since this is used on other tests, please move it to a test utils module
Done
855c361
to
991209e
Compare
Benchmark movements: |
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 3 of 3 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @nimrod-starkware and @TzahiTaub)
crates/blockifier/src/test_utils.rs
line 446 at r3 (raw file):
} #[cfg(test)]
why is this needed...? in case feature = "testing"
causes this module to compile, in non-test mode?
Code quote:
#[cfg(test)]
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: all files reviewed, 1 unresolved discussion (waiting on @dorimedini-starkware and @TzahiTaub)
crates/blockifier/src/test_utils.rs
line 446 at r3 (raw file):
Previously, dorimedini-starkware wrote…
why is this needed...? in case
feature = "testing"
causes this module to compile, in non-test mode?
without this, i get a clippy warning for unused macros.
I think it's because it's only being used in tests (under cfg(test)
) but not declared in a test module.
For some weird reason annotating #[allow(unused_macros)]
didn't solve it...
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 @TzahiTaub)
991209e
to
85b439a
Compare
Benchmark movements: |
43c559a
to
3b621e3
Compare
85b439a
to
45f3fbe
Compare
Benchmark movements: |
3b621e3
to
a60c744
Compare
45f3fbe
to
e0533bb
Compare
338fe8c
to
60e4881
Compare
fa26d2d
to
74b7e19
Compare
60e4881
to
324e884
Compare
Benchmark movements: full_committer_flow performance improved 😺 |
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 @TzahiTaub)
74b7e19
to
b8e6fb8
Compare
324e884
to
10a6f72
Compare
Benchmark movements: |
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 @TzahiTaub)
b8e6fb8
to
5a131b2
Compare
10a6f72
to
e396522
Compare
5a131b2
to
2b2bf85
Compare
e396522
to
b3581ba
Compare
Benchmark movements: |
2b2bf85
to
badb3d6
Compare
b3581ba
to
0e755c4
Compare
badb3d6
to
104b7ad
Compare
0e755c4
to
427a81a
Compare
104b7ad
to
29d9f97
Compare
427a81a
to
ae18c8f
Compare
Benchmark movements: |
29d9f97
to
be7a1da
Compare
ae18c8f
to
b1a68c1
Compare
1a33a5f
to
f357376
Compare
b1a68c1
to
35201a3
Compare
Benchmark movements: |
This change is