-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Io Gas adjustments #11300
Io Gas adjustments #11300
Conversation
Current dependencies on/for this PR:
This stack of pull requests is managed by Graphite. |
6806ce9
to
60bbc60
Compare
663bea5
to
754add7
Compare
60bbc60
to
4e833e9
Compare
754add7
to
bd9eeca
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #11300 +/- ##
=========================================
- Coverage 68.7% 68.6% -0.1%
=========================================
Files 764 764
Lines 176947 176995 +48
=========================================
- Hits 121722 121583 -139
- Misses 55225 55412 +187 ☔ View full report in Codecov by Sentry. |
4e833e9
to
aacb739
Compare
b05127f
to
9cf068a
Compare
aacb739
to
de475b6
Compare
9cf068a
to
4849504
Compare
if self.feature_version >= 12 { | ||
size.checked_sub(self.legacy_free_write_bytes_quota) | ||
.unwrap_or(NumBytes::zero()) |
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.
shouldn't it be the opposite?
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.
👍 👍 👍
impl StoragePricingV3 { | ||
impl IoPricingV3 { | ||
fn read_size(&self, loaded: NumBytes) -> NumBytes { | ||
if self.feature_version >= 12 { |
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.
you have multiple places with if self.feature_version >= 12
, what's the logic when you introduce new version (i.e. IoPricingV4) vs having these conditions inside?
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.
if I added v4
it complains that v3 and v4 returns different opaque types here, although they are both STORAGE_IO_PER_STATE_SLOT_READ * NumArgs + STORAGE_IO_PER_STATE_BYTE_READ * NumBytes
only differing in the specific numbers inside of NumArgs
and NumBytes
:
V3(v3) => Either::Right(v3.calculate_read_gas(bytes_loaded)), |
I got lazy and just updated v3..
cc @vgao1996
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.
I guess I can do
V3(v3) => Either::Right(Either::Left(v3.calculate_read_gas(bytes_loaded))),
V4(v4) => Either::Right(Either::Right(v4.calculate_read_gas(bytes_loaded)))
?
Do you prefer that?
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.
since some params are not part of "V4" , I prefer having separate V3 and V4 in this case
@@ -287,7 +287,17 @@ fn charge_load_cost( | |||
|
|||
match loaded { | |||
Some(Some(num_bytes)) => { | |||
context.charge(COMMON_LOAD_BASE_NEW + COMMON_LOAD_PER_BYTE * num_bytes) | |||
if context.gas_feature_version() >= 12 { |
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.
stupid question, why does this not go through IoPricing utilities, like everything else?
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.
I was just keeping the structure..
Indeed it'll be nice if we can remove this shit as well:
aptos-core/aptos-move/aptos-vm/src/gas.rs
Lines 63 to 88 in b1f3abe
match gas_feature_version { | |
0..=1 => (), | |
2..=6 => { | |
if let IoPricing::V2(pricing) = &storage_gas_params.io_pricing { | |
g.common_load_base_legacy = pricing.per_item_read * NumArgs::new(1); | |
g.common_load_base_new = 0.into(); | |
g.common_load_per_byte = pricing.per_byte_read; | |
g.common_load_failure = 0.into(); | |
} | |
} | |
7..=9 => { | |
if let IoPricing::V2(pricing) = &storage_gas_params.io_pricing { | |
g.common_load_base_legacy = 0.into(); | |
g.common_load_base_new = pricing.per_item_read * NumArgs::new(1); | |
g.common_load_per_byte = pricing.per_byte_read; | |
g.common_load_failure = 0.into(); | |
} | |
} | |
10.. => { | |
g.common_load_base_legacy = 0.into(); | |
g.common_load_base_new = gas_params.vm.txn.storage_io_per_state_slot_read * NumArgs::new(1); | |
g.common_load_per_byte = gas_params.vm.txn.storage_io_per_state_byte_read; | |
g.common_load_failure = 0.into(); | |
} | |
}; | |
Ok(storage_gas_params) |
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.
can you at least add a TODO?
seems like it is very easy to miss this place when modifying gas schedule.
ae4b209
to
24bdab5
Compare
24bdab5
to
db2aecc
Compare
db2aecc
to
9df8c4c
Compare
9df8c4c
to
febfa30
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.
thanks , looks much cleaner!
@@ -287,7 +287,17 @@ fn charge_load_cost( | |||
|
|||
match loaded { | |||
Some(Some(num_bytes)) => { | |||
context.charge(COMMON_LOAD_BASE_NEW + COMMON_LOAD_PER_BYTE * num_bytes) | |||
if context.gas_feature_version() >= 12 { |
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.
can you at least add a TODO?
seems like it is very easy to miss this place when modifying gas schedule.
febfa30
to
ad48063
Compare
1. read bytes charged in 4k steps 2. remove per write op free quota, while make per byte write cheaper tune write gas numbers
ad48063
to
3c0ca5c
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
❌ Forge suite
|
Description
Test Plan