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

Book: Add blockhash to terminology#6711

Merged
solana-grimes merged 6 commits intosolana-labs:masterfrom
t-nelson:blockhash_to_terminology
Nov 7, 2019
Merged

Book: Add blockhash to terminology#6711
solana-grimes merged 6 commits intosolana-labs:masterfrom
t-nelson:blockhash_to_terminology

Conversation

@t-nelson
Copy link
Copy Markdown
Contributor

@t-nelson t-nelson commented Nov 4, 2019

Problem

blockhash is missing from terminology

Summary of Changes

Add it.

As requested in #6663

@t-nelson t-nelson requested a review from garious November 4, 2019 18:14
Copy link
Copy Markdown
Contributor

@CriesofCarrots CriesofCarrots left a comment

Choose a reason for hiding this comment

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

You're right that blockhash isn't in terminology, but I think what happened is all the block id fields got renamed to blockhash without updating the block id entry in the book.

Let's start by renaming the block id listing to blockhash -- and entry id to entry hash -- and then make additions/modifications to those definitions...?

Comment thread book/src/terminology.md Outdated

## blockhash

The hash over a bank's state upon freeze. Used to historically identify the block originated from the bank.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We don't define "freeze". Perhaps replace with "upon completion of a block"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Just realized this definition isn't even correct. We use only the hash of the last entry, which I'm not sure is the RightThing(TM) to do. Seems like we should be covering more of the bank state than that. Is this a performance thing or can it be changed?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm confused by your comment, since each entry hash extends from the entry hash before it.
Perhaps the current entry id definition, although a little ungrammatical, is helpful?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I wasn't clear. By covering I meant the blockhash should probably be generated using more of the bank state. This would, a) make its ID unambiguous, and b) allow verification of the included account states. I'm not sure of the intention of using only the EntryId

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How about: "A preimage resistant hash of the ledger state at a given block height." Some other part of the book can explain how it's calculated and/or how it's used. It might say, "A blockhash is calculated from a SHA256 hash of the previous blockhash and all changes to the ledger state since the previous block."

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's a good definition.

It looks like I'm letting responsibilities meld a bit here... What we store in the blockhash_queue at https://github.com/solana-labs/solana/blob/master/runtime/src/bank.rs#L800-L804 is not the "blockhash" as is calculated at https://github.com/solana-labs/solana/blob/master/runtime/src/bank.rs#L592-L605. The latter is what I would consider to be a "blockhash" so it's confusing that it's not what's going into the thing called blockhash_queue

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Mistake on my end. I mixed Blockhash and BankHash. The blockhash is not a hash of the ledger state. It's only a hash of the transactions (specifically, the fee payer's signature). Vote transactions tie together a blockhash and a bank hash.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So... "A preimage resistant hash of the ledger at a given block height."

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, yeah let's go with that. I'm still unclear as to why we don't use the BankHash as the BlockHash, but that's out side the scope of this PR

garious
garious previously approved these changes Nov 6, 2019
Comment thread book/src/terminology.md Outdated

## blockhash

A preimage resistant [hash](terminology.md#hash) of the [ledger](terminology.md#ledger) state at a given [block height](terminology.md#block-height).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

delete the word state

Copy link
Copy Markdown
Contributor

@CriesofCarrots CriesofCarrots left a comment

Choose a reason for hiding this comment

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

Hoping you're still planning to update/remove "block id" and update "entry id" 🤞

@mergify mergify Bot dismissed garious’s stale review November 6, 2019 22:16

Pull request has been modified.

@t-nelson
Copy link
Copy Markdown
Contributor Author

t-nelson commented Nov 6, 2019

@CriesofCarrots ☝️ for your consideration

Comment thread book/src/terminology.md Outdated
## block height

The [entry id](terminology.md#entry-id) of the last entry in a [block](terminology.md#block).
The number of [blocks](terminology.md#block) beneath the current block. The first block after the [genesis block](terminology.md#genesis-block) has height zero.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@jstarry, is that true? height zero?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, it's currently true, but very confusing. We should probably not be zero-indexing block height.. #6779

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🤔 Must be some greedy diff aggregation going on here. That's not a line that I touched

@t-nelson t-nelson force-pushed the blockhash_to_terminology branch from 540111e to 4183ff3 Compare November 7, 2019 17:17
Comment thread book/src/api-reference/blockstreamer.md Outdated
* `h`, the tick height, as unsigned 64-bit integer
* `l`, the slot leader id, as base-58 encoded string
* `id`, the block id, as base-58 encoded string
* `id`, the [blockhash](terminology.md#blockhash), as base-58 encoded string
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

id also needs updating. It's actually hash now. Thanks for helping clean up :)

@t-nelson t-nelson added the automerge Merge this Pull Request automatically once CI passes label Nov 7, 2019
@solana-grimes solana-grimes removed the automerge Merge this Pull Request automatically once CI passes label Nov 7, 2019
@solana-grimes
Copy link
Copy Markdown
Contributor

💔 Unable to automerge due to CI failure

@t-nelson t-nelson force-pushed the blockhash_to_terminology branch from c1065eb to 4ae8f4c Compare November 7, 2019 18:05
@t-nelson t-nelson added the automerge Merge this Pull Request automatically once CI passes label Nov 7, 2019
@solana-grimes solana-grimes merged commit 180bc17 into solana-labs:master Nov 7, 2019
@t-nelson t-nelson deleted the blockhash_to_terminology branch November 7, 2019 18:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

automerge Merge this Pull Request automatically once CI passes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants