-
Notifications
You must be signed in to change notification settings - Fork 622
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
runtime: pipelined preparation for incoming and delayed receipts #11904
runtime: pipelined preparation for incoming and delayed receipts #11904
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #11904 +/- ##
==========================================
- Coverage 71.47% 71.45% -0.03%
==========================================
Files 810 812 +2
Lines 163515 163656 +141
Branches 163515 163656 +141
==========================================
+ Hits 116877 116943 +66
- Misses 41581 41670 +89
+ Partials 5057 5043 -14
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
b05c4dc
to
d440b0b
Compare
d440b0b
to
77d15b8
Compare
77d15b8
to
9eb4e47
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.
LGTM
if let Some(nsi) = &mut next_schedule_after { | ||
*nsi = nsi.saturating_sub(1); | ||
if *nsi == 0 { | ||
// We're about to process a receipt that has been submitted for | ||
// preparation, so lets submit the next one in anticipation that it might | ||
// be processed too (it might also be not if we run out of gas/compute.) | ||
next_schedule_after = schedule_contract_preparation( | ||
&mut processing_state.pipeline_manager, | ||
&processing_state.state_update, | ||
&mut prep_lookahead_iter, | ||
); | ||
} | ||
} | ||
|
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: This piece of code seems to be repeating for every receipt type, is there any room to refactor it? I know it's already in a pretty good state but if you can reduce it to a single invocation it would be awesome :)
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.
Yeah, I've been banging my head as to how to best deduplicate this and what I have here is the best I could come up with outside of trying to come up with a way to unify how the receipt types themselves are processed. Perhaps we ought to do that eventually, but it is also non-trivial (esp. due to how different is the handling of delayed receipts.)
state_update: &TrieUpdate, | ||
mut iterator: impl Iterator<Item = R>, | ||
) -> Option<usize> { | ||
let scheduled_receipt_offset = iterator.position(|peek| { |
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 think a for loop with an early return would be more readable. I guess it depends on individual preference so up to you.
…pts (near#11904)" This reverts commit 781805d.
Part of #11319 and the final change in integration with the transaction runtime as all interesting receipt types are handled now. There are also receipt types like yield timeouts which only result in generation of new (delayed) receipts, so they don't need to be handled by this mechanism.