-
Notifications
You must be signed in to change notification settings - Fork 107
feat(execution): use gas costs only from VersionedConstants #1392
feat(execution): use gas costs only from VersionedConstants #1392
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main-v0.13.1 #1392 +/- ##
================================================
+ Coverage 70.37% 70.83% +0.46%
================================================
Files 60 60
Lines 7773 8167 +394
Branches 7773 8167 +394
================================================
+ Hits 5470 5785 +315
- Misses 1874 1946 +72
- Partials 429 436 +7 ☔ View full report in Codecov by Sentry. |
717e323
to
a32eb89
Compare
VersionedConstants
VersionedConstants
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 14 of 14 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @giladchase and @noaov1)
crates/blockifier/src/versioned_constants.rs
line 54 at r1 (raw file):
let os_consts = &self.starknet_os_constants; os_consts.gas_costs["initial_gas_cost"] - os_consts.gas_costs["transaction_gas_cost"]
Suggestion:
let os_consts = &self.starknet_os_constants;
os_consts.gas_costs["initial_gas_cost"] - os_consts.gas_costs["transaction_gas_cost"]
crates/blockifier/src/abi/constants.rs
line 41 at r1 (raw file):
// Gas Cost. // See documentation in core/os/constants.cairo.
Is moving those part of an unmerged PR?
a32eb89
to
27043f4
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: all files reviewed, 1 unresolved discussion (waiting on @elintul and @noaov1)
crates/blockifier/src/abi/constants.rs
line 41 at r1 (raw file):
Previously, elintul (Elin) wrote…
Is moving those part of an unmerged PR?
WDYM by part of an unmerged PR?
I'm removing them because they are now stored in the StarknetOSConstants
, and are accessible via versioned_constants.get_gas_cost("name_of_const")
.
That is, they are no longer const
s, since they are dynamically loaded from a json file.
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 r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @noaov1)
17854d7
to
f367a56
Compare
27043f4
to
8b38505
Compare
VersionedConstants
f367a56
to
d1a2393
Compare
8b38505
to
350ba79
Compare
d1a2393
to
8d10d2c
Compare
350ba79
to
b93c238
Compare
8d10d2c
to
86a95e1
Compare
b93c238
to
458bc11
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 11 of 11 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @noaov1)
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 @noaov1)
755a80c
to
bd185f3
Compare
458bc11
to
406eda9
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 r4, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @noaov1)
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 14 files at r1, 6 of 11 files at r3, 5 of 5 files at r4, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @giladchase)
crates/blockifier/src/test_utils.rs
line 215 at r4 (raw file):
caller_address: ContractAddress::default(), call_type: CallType::Call, initial_gas: VersionedConstants::create_for_account_testing().gas_cost("initial_gas_cost"),
Suggestion:
VersionedConstants::create_for_testing().gas_cost("initial_gas_cost"),
crates/blockifier/src/transaction/transactions_test.rs
line 81 at r4 (raw file):
#[fixture] fn initial_gas() -> u64 {
Suggestion:
fn tx_initial_gas() -> u64 {
crates/blockifier/src/transaction/transactions_test.rs
line 82 at r4 (raw file):
#[fixture] fn initial_gas() -> u64 { VersionedConstants::latest_constants().tx_initial_gas()
?
Suggestion:
VersionedConstants::create_for_testing().tx_initial_gas()
crates/blockifier/src/transaction/transactions_test.rs
line 313 at r4 (raw file):
validate_gas_consumed: 0, execute_gas_consumed: 0, inner_call_initial_gas: VersionedConstants::create_for_account_testing().gas_cost("initial_gas_cost"),
Create a fixture?
Code quote:
inner_call_initial_gas: VersionedConstants::create_for_account_testing().gas_cost("initial_gas_cost"),
- Remove from constants module and replace all usages with `VersionedConstants#gas_cost(..)` - Move all comments from the constants module into the const whitelist in `VersionedConstants`. - Add gas cost getter to `EntryPointExecutionContext`, for readability - enclose in closure inside hint_processor.rs for even more brevity. - Move `Transaction::Initial_gas` into `VersionedConstants`: it is now derived from the constants json. - No other logic changes.
406eda9
to
1af90d3
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 2 of 2 files at r5, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @giladchase)
crates/blockifier/src/transaction/transactions_test.rs
line 88 at r5 (raw file):
fn versioned_constants_for_account_testing() -> VersionedConstants { VersionedConstants::create_for_account_testing() }
Create a fixture for versioned constants?
Code quote:
#[fixture]
fn tx_initial_gas() -> u64 {
VersionedConstants::create_for_testing().tx_initial_gas()
}
#[fixture]
fn versioned_constants_for_account_testing() -> VersionedConstants {
VersionedConstants::create_for_account_testing()
}
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 @noaov1)
crates/blockifier/src/transaction/transactions_test.rs
line 88 at r5 (raw file):
Previously, noaov1 (Noa Oved) wrote…
Create a fixture for versioned constants?
Called explicitly later down, complicates this.
VersionedConstants#gas_cost(..)
VersionedConstants
.EntryPointExecutionContext
, for readabilityTransaction::Initial_gas
intoVersionedConstants
: it is now derived from the constants json.This change is