Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Add block height to ConfirmedBlock structs #17523

Merged
merged 9 commits into from
May 27, 2021

Conversation

CriesofCarrots
Copy link
Contributor

Problem

As of #17506, last_valid_block_height is available to assess recent-blockhash expiration. But it is only possible to get the block height of the current Bank (via getBlockHeight or getEpochInfo rpcs).

Summary of Changes

  • Add block_height to ConfirmedBlock structs
  • Create BlockHeight column in Blockstore
  • Cache block height along with block time (and rename service to be more general, now that it's doing two things -- this is most of the churn)
  • Return block_height with Blockstore block requests, which means it will also be stored in BigTable blocks

mvines
mvines previously approved these changes May 26, 2021
@@ -2126,6 +2126,9 @@ impl fmt::Display for CliBlock {
if let Some(block_time) = self.encoded_confirmed_block.block_time {
writeln!(f, "Block Time: {:?}", Local.timestamp(block_time, 0))?;
}
if let Some(block_height) = self.encoded_confirmed_block.block_height {
Copy link
Contributor

Choose a reason for hiding this comment

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

heh, I foresee support issues when people now start running solana block <BLOCK> instead of solana block <SLOT>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Totally. solana block-by-height in our future?

Copy link
Contributor

Choose a reason for hiding this comment

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

solana-ledger-tool slot ... got it right though! oh well :)

Copy link
Contributor

@mvines mvines left a comment

Choose a reason for hiding this comment

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

There's a JSON RPC doc update missing here right?

@mergify mergify bot dismissed mvines’s stale review May 26, 2021 23:53

Pull request has been modified.

@codecov
Copy link

codecov bot commented May 27, 2021

Codecov Report

Merging #17523 (060b995) into master (52dccc6) will decrease coverage by 0.0%.
The diff coverage is 62.7%.

@@            Coverage Diff            @@
##           master   #17523     +/-   ##
=========================================
- Coverage    82.6%    82.6%   -0.1%     
=========================================
  Files         427      427             
  Lines      119005   119057     +52     
=========================================
+ Hits        98409    98421     +12     
- Misses      20596    20636     +40     

@CriesofCarrots CriesofCarrots merged commit ab581da into solana-labs:master May 27, 2021
mergify bot pushed a commit that referenced this pull request May 27, 2021
* Add BlockHeight CF to blockstore

* Rename CacheBlockTimeService to be more general

* Cache block-height using service

* Fixup previous proto mishandling

* Add block_height to block structs

* Add block-height to solana block

* Fallback to BankForks if block time or block height are not yet written to Blockstore

* Add docs

* Review comments

(cherry picked from commit ab581da)

# Conflicts:
#	core/src/replay_stage.rs
#	core/src/tvu.rs
#	core/src/validator.rs
mvines pushed a commit that referenced this pull request May 27, 2021
* Add block height to ConfirmedBlock structs (#17523)

* Add BlockHeight CF to blockstore

* Rename CacheBlockTimeService to be more general

* Cache block-height using service

* Fixup previous proto mishandling

* Add block_height to block structs

* Add block-height to solana block

* Fallback to BankForks if block time or block height are not yet written to Blockstore

* Add docs

* Review comments

(cherry picked from commit ab581da)

# Conflicts:
#	core/src/replay_stage.rs
#	core/src/tvu.rs
#	core/src/validator.rs

* Fix conflicts

Co-authored-by: Tyera Eulberg <[email protected]>
Co-authored-by: Tyera Eulberg <[email protected]>
@CriesofCarrots CriesofCarrots deleted the block-height branch July 28, 2021 22:32
@brooksprumo brooksprumo mentioned this pull request Aug 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants