Skip to content
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

Merged
merged 1 commit into from
Dec 22, 2021
Merged

Add code comment for handle_chaining in blockstore.rs #21876

merged 1 commit into from
Dec 22, 2021

Conversation

yhchiang-sol
Copy link
Contributor

Summary of Changes

Add code comment for handle_chaining in blockstore.rs

@codecov
Copy link

codecov bot commented Dec 15, 2021

Codecov Report

Merging #21876 (4aa9be9) into master (d896ff7) will increase coverage by 0.0%.
The diff coverage is 99.0%.

@@           Coverage Diff           @@
##           master   #21876   +/-   ##
=======================================
  Coverage    81.3%    81.3%           
=======================================
  Files         517      517           
  Lines      145586   145632   +46     
=======================================
+ Hits       118445   118538   +93     
+ Misses      27141    27094   -47     

steviez
steviez previously approved these changes Dec 15, 2021
Copy link
Contributor

@steviez steviez left a 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.

/// 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
Copy link
Contributor

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" ==> "for slot" (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 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."

/// 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
Copy link
Contributor

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 ..."

@mergify mergify bot dismissed steviez’s stale review December 15, 2021 22:13

Pull request has been modified.

steviez
steviez previously approved these changes Dec 16, 2021
Copy link
Contributor

@steviez steviez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -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
Copy link
Contributor

@carllin carllin Dec 16, 2021

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

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: handle -> handles

// 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,
Copy link
Contributor

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

Comment on lines 3499 to 3523
/// 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.
Copy link
Contributor

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

/// 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.
Copy link
Contributor

@carllin carllin Dec 16, 2021

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:

  1. updates the orphan property of slot to no longer be an orphan because it has a parent
  2. adds to parent to the orphan column family if the parent's parent is currently unknown

@mergify mergify bot dismissed steviez’s stale review December 18, 2021 00:55

Pull request has been modified.

/// 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
Copy link
Contributor

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"

/// 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "ot" ==> "or"

/// 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
Copy link
Contributor

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"

@yhchiang-sol yhchiang-sol merged commit bf8fbf8 into solana-labs:master Dec 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants