-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
introduce SerializedAccountMetadata #32644
introduce SerializedAccountMetadata #32644
Conversation
Codecov Report
@@ Coverage Diff @@
## master #32644 +/- ##
=======================================
Coverage 82.0% 82.0%
=======================================
Files 785 785
Lines 211023 211036 +13
=======================================
+ Hits 173094 173124 +30
+ Misses 37929 37912 -17 |
2dfc0e5
to
0133a1a
Compare
…paramters_(aligned|unaligned) This is in preparation of returning more than just the original length
…f a slice This is in preparation of extracting account lenghts from a larger context
Instead of passing original_account_lengths around as Vec<usize>, introduce an explicit type that includes the length and soon more.
3337ebd
to
07257aa
Compare
transaction_context: &TransactionContext, | ||
instruction_context: &InstructionContext, | ||
copy_account_data: bool, | ||
buffer: &[u8], | ||
account_lengths: &[usize], | ||
account_lengths: I, |
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.
nit: i prefer existential types for these cases for one less type parameter (slight readability improvement, imo):
account_lengths: impl IntoIterator<Item = usize>,
.map(|instruction_account_index| { | ||
if let Some(index) = instruction_context | ||
.is_instruction_account_duplicate(instruction_account_index) | ||
.unwrap() |
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.
(note to self) seems this and below new .unwrap()
s are safe. i.e. these are always infallible before/after this pr.
// fun fact: jemalloc is good at caching tiny allocations like this one, | ||
// so collecting here is actually faster than passing the iterator | ||
// around, since the iterator does the work to produce its items each | ||
// time it's iterated on. |
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.
❤️
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.
lgtm with a nit
Instead of passing
original_account_lengths
around asVec<usize>
, introduce an explicit type that includes the length and soon more. Doesn't change anything in the existing logic, just the type passed around.Extracted from #31986. This is preparation of passing around more data from serialization down to CPI.