-
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
Storage fee for state bytes refundable #11279
Conversation
Current dependencies on/for this PR:
This stack of pull requests is managed by Graphite. |
4fb6d4a
to
2634170
Compare
39163cb
to
1f382c0
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #11279 +/- ##
========================================
Coverage 71.4% 71.4%
========================================
Files 799 799
Lines 183539 183702 +163
========================================
+ Hits 131050 131217 +167
+ Misses 52489 52485 -4 ☔ View full report in Codecov by Sentry. |
2634170
to
ad64c24
Compare
9b277b2
to
c38c619
Compare
c38c619
to
d177cc6
Compare
e2a17a7
to
daea84e
Compare
b745f5c
to
690c116
Compare
daea84e
to
2661421
Compare
690c116
to
4afcf64
Compare
2661421
to
bc00839
Compare
4afcf64
to
ba94712
Compare
bc00839
to
b054435
Compare
ba94712
to
7c75a2b
Compare
b054435
to
1b28cd6
Compare
7c75a2b
to
7a33a9a
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.
This comment has been minimized.
This comment has been minimized.
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.
@gelash can you take a look, and recheck would access to prev_size be properly captured and validated (especially new field in ResourceGroupWrite?
do we need test/proptest for that?
fff37b8
to
568e8d7
Compare
71410f1
to
6ae89bd
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.
This comment has been minimized.
This comment has been minimized.
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.
pre_group_size looks good
@@ -133,6 +154,7 @@ pub struct GroupWrite { | |||
pub(crate) inner_ops: BTreeMap<StructTag, (WriteOp, Option<Arc<MoveTypeLayout>>)>, | |||
/// Group size as used for gas charging, None if (metadata_)op is Deletion. | |||
pub(crate) maybe_group_op_size: Option<u64>, | |||
pub(crate) prev_group_size: u64, |
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 suppose this is 0 if group is being created?
I'm fine with it, just wondering whether we should have maybe_group_op_size and prev_group_size have a consistent convention. It's also fine to wait for later (can add a TODO)
@@ -255,6 +255,7 @@ impl<'r> WriteOpConverter<'r> { | |||
self.convert(state_value_metadata, metadata_op, false)?, | |||
inner_ops, | |||
post_group_size.get(), | |||
pre_group_size.get(), |
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.
@msmouse if you don't mind, and are making changes to the PR anyway (otherwise i'll do it later), could you update the comment above, just noticed it's outdated (we don't encode the size, also an important point is to explain why we even need an Op now).
i.e. could you please replace 243-246 with
"Create an op to encode the proper kind for resource group operation"
(@igor-aptos I think now this is the main reason?)
Interestingly, we may be able to get rid of the ugly metadata_op, since we have both pre_group_size and post_group_size, thanks @msmouse! (but not in this PR obviously :)
Otherwise, pre_group_size should be properly validated, we rely on it for resource group correctness, in fact the kind, i.e. Creation/Modification/Deletion, and it passed replay.
proptests for resource groups do already check the resource_group_size() call (re: @igor-aptos)
6ae89bd
to
f1aca08
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
Description
1. legacy slots that didn't pay bytes deposits won't get charged for the bytes allocated for free.
1. Considering pricing change, charge only to the point where the total deposit for bytes don't go beyond
current_price_per_byte x num_current_bytes
Pricing is reduced to 4k octas per slot and 40 octas per byte. As a result:
1. allocating an item smaller than 250 bytes is cheaper than before.
2. allocating an item of the size between 250 to 4K bytes will be slightly more expensive. The price increase peaks at 1KB at about 60%
3. merely touching a slot > 1KB no longer imposes penalty so such txns get significantly cheaper. As seen in MutateLargeTokenV2, UpgradeLarge, etc.
Test Plan