-
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
[move-stdlib] Implement bcs::constant_serialized_size<T>(): Option<u64> #14984
base: igor/native_compare
Are you sure you want to change the base?
Conversation
⏱️ 1h 2m total CI duration on this PR
|
3bcedb1
to
a5af4dc
Compare
8a929c9
to
a420b4c
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## igor/use_native_vector_move_range #14984 +/- ##
====================================================================
- Coverage 60.1% 57.5% -2.7%
====================================================================
Files 858 858
Lines 211455 211510 +55
====================================================================
- Hits 127237 121651 -5586
- Misses 84218 89859 +5641 ☔ View full report in Codecov by Sentry. |
Ok(fields | ||
.iter() | ||
.map(|field| constant_serialized_size(&field.layout)) | ||
.collect::<Result<Option<Vec<_>>, _>>() |
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 this potentially allocate too much? Shall we bother to write a loop or try_for_each()?
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.
this is nice, but I agree - safer to not worry about 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.
updated
a5af4dc
to
9fcf365
Compare
a420b4c
to
4c0b5bc
Compare
4c0b5bc
to
58152b4
Compare
12807a4
to
1c15e62
Compare
58152b4
to
c268f4a
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
|
1c15e62
to
37384ce
Compare
c268f4a
to
0c7a167
Compare
| MoveTypeLayout::U256 | ||
| MoveTypeLayout::U64 | ||
| MoveTypeLayout::Address | ||
| MoveTypeLayout::Signer => 1, |
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.
Should we return None for signer as it shouldn't have been serialized?
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.
this is for gas charging. below we do say signer doesn't have constant size.
| MoveTypeLayout::U128 | ||
| MoveTypeLayout::U256 | ||
| MoveTypeLayout::U64 | ||
| MoveTypeLayout::Address |
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 the size should be different?
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.
this is type_visit_count
for constant_serialized_size
- i.e. amount needed to charge gas.
constant_serialized_size
below is the actual computation
37384ce
to
6bd7875
Compare
0c7a167
to
4b040df
Compare
Description
It is sometimes useful to know if type has constants serialized size, and for example perform some optimization based on it.
How Has This Been Tested?
provided unit tests
Key Areas to Review
Type of Change
Which Components or Systems Does This Change Impact?
Checklist