-
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
Add code comment for handle_chaining in blockstore.rs #21876
Add code comment for handle_chaining in blockstore.rs #21876
Conversation
Codecov Report
@@ Coverage Diff @@
## master #21876 +/- ##
=======================================
Coverage 81.3% 81.3%
=======================================
Files 517 517
Lines 145586 145632 +46
=======================================
+ Hits 118445 118538 +93
+ Misses 27141 27094 -47 |
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 for doing all of these; content looks great, just had a couple minor wording tweak suggestions.
ledger/src/blockstore.rs
Outdated
/// on the `SlotMetaWorkingSetEntry` of the specified `slot`. Specifically, | ||
/// it handles the following two things: | ||
/// | ||
/// First, based on the `SlotMetaWorkingSetEntry` of the input `slot`, it 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.
nits:
- "of the input
slot
" ==> "forslot
" (putting inside the backticks implies it is the input parameter) - Extra "it" in this sentence, thinking the first one is supposed to be "if"?
- This first sentence is a tad long; you could maybe break it up into two (incorporating my previous comments)
- "First, based on the
SlotMetaWorkingSetEntry
forslot
, check ifslot
did not previously have a parent slot but does now." - "If
slot
satisfies this condition, update the Orphan property of bothslot
and its parent slot based on their current orphan status."
- "First, based on the
ledger/src/blockstore.rs
Outdated
/// slot, then it will update the Orphan property of both the slot and its | ||
/// parent slot based on their current orphan status. | ||
/// | ||
/// Second, if the `SlotMetaWorkingSetEntry` of the input `slot` indicates this |
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: Similar to above, think you can drop "the input" and change "of" to "for"
==> "Second, if the SlotMetaWorkingSetEntry
for slot
indicates it is newly ..."
Pull request has been modified.
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
ledger/src/blockstore.rs
Outdated
@@ -3454,7 +3454,23 @@ fn find_slot_meta_in_cached_state<'a>( | |||
} | |||
} | |||
|
|||
// Chaining based on latest discussion here: https://github.com/solana-labs/solana/pull/2253 | |||
/// For each entry in `working_set` whose did_insert_occur is true, this |
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: did_insert_occur -> did_insert_occur
ledger/src/blockstore.rs
Outdated
@@ -3454,7 +3454,23 @@ fn find_slot_meta_in_cached_state<'a>( | |||
} | |||
} | |||
|
|||
// Chaining based on latest discussion here: https://github.com/solana-labs/solana/pull/2253 | |||
/// For each entry in `working_set` whose did_insert_occur is true, this | |||
/// function handle its chaining effect by updating the SlotMeta of both |
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: handle -> handles
ledger/src/blockstore.rs
Outdated
// Chaining based on latest discussion here: https://github.com/solana-labs/solana/pull/2253 | ||
/// For each entry in `working_set` whose did_insert_occur is true, this | ||
/// function handle its chaining effect by updating the SlotMeta of both | ||
/// the slot and its parent slot. In addition, when a slot is newly connected, |
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: the slot and its parent slot to reflect that the slot descends from the parent slot
ledger/src/blockstore.rs
Outdated
/// First, based on the `SlotMetaWorkingSetEntry` for `slot`, check if `slot` | ||
/// did not previously have a parent slot but does now. If `slot` satisfies | ||
/// this condition, update the Orphan property of both `slot` and its parent | ||
/// slot based on their current orphan status. | ||
/// | ||
/// Second, if the `SlotMetaWorkingSetEntry` for `slot` indicates this slot | ||
/// is newly connected to a parent slot, then this function will update | ||
/// the is_connected property of all its direct and indirect children slots. |
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.
Usually with lists in comments, I prefer using numbers like 1) and 2) to make it easier to read
ledger/src/blockstore.rs
Outdated
/// First, based on the `SlotMetaWorkingSetEntry` for `slot`, check if `slot` | ||
/// did not previously have a parent slot but does now. If `slot` satisfies | ||
/// this condition, update the Orphan property of both `slot` and its parent | ||
/// slot based on their current orphan status. |
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.
"based on their current orphan status"
slot
cannot be an orphan if it has a parent. So it might be clearer to say:
- updates the orphan property of
slot
to no longer be an orphan because it has a parent - adds to parent to the orphan column family if the parent's parent is currently unknown
Pull request has been modified.
ledger/src/blockstore.rs
Outdated
/// function handles its chaining effect by updating the SlotMeta of both | ||
/// the slot and its parent slot to reflect the slot descends from the | ||
/// parent slot. In addition, when a slot is newly connected, it also | ||
/// checks whether any of its direct and indirect children slot is connected |
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: "children slot is" ==> "children slots are"
ledger/src/blockstore.rs
Outdated
/// the slot and its parent slot to reflect the slot descends from the | ||
/// parent slot. In addition, when a slot is newly connected, it also | ||
/// checks whether any of its direct and indirect children slot is connected | ||
/// ot not. |
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: "ot" ==> "or"
ledger/src/blockstore.rs
Outdated
/// slot based on their current orphan status. Specifically: | ||
/// - updates the orphan property of slot to no longer be an orphan because | ||
/// it has a parent. | ||
/// - adds to parent to the orphan column family if the parent's parent is |
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: "adds to parent" ==> "adds the parent"
Summary of Changes
Add code comment for handle_chaining in blockstore.rs