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

doc: validator structure change, state witness reference impl #546

Merged
merged 10 commits into from
Jun 13, 2024

Conversation

Longarithm
Copy link
Member

@Longarithm Longarithm commented Jun 12, 2024

Documenting changes to validators and describing basics of reference implementation.

@Longarithm Longarithm requested a review from a team as a code owner June 12, 2024 23:02
neps/nep-0509.md Outdated
* TBD

## High level flow

We propose a change to the following parts of the chunk and block production flow:
The current high-level chunk production flow, if we drop details and edge cases, is as follows:
Copy link
Contributor

Choose a reason for hiding this comment

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

just FYI chat gpt suggested the following when I asked to make this sentence more idiomatic:

The current high-level chunk production flow, excluding details and edge cases, is as follows

neps/nep-0509.md Outdated
* TBD

## High level flow

We propose a change to the following parts of the chunk and block production flow:
The current high-level chunk production flow, if we drop details and edge cases, is as follows:
* Block producer at height H BP(H) produces block B(H) with chunks accessible to it and distributes it.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I suggest highlighting expressions as code to make it easier to read:
Block producer at height H BP(H) produces block B(H)...

neps/nep-0509.md Outdated

### New design

* Chunk producer, in addition to producing a chunk, produces new `ChunkStateWitness` message. The `ChunkStateWitness` contains data which is enough to prove validity of the chunk's header what is being produced.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: what is being produced -> that is being produced

neps/nep-0509.md Outdated
* A chunk validator, upon receiving a `ChunkStateWitness`, validates the state witness and determines if the chunk header is indeed correctly produced. If so, it sends a `ChunkEndorsement` to the current block producer.
* A `ChunkEndorsement` contains the chunk hash along with a signature proving the endorsement by the chunk validator. It implicitly carries a weight equal to the amount of the chunk validator's stake that is assigned to this shard for this block. (See Chunk Validator Shuffling).
* As the existing logic is today, the block producer for this block waits until either all chunks are ready, or a timeout occurs, and then proposes a block containing whatever chunks are ready. Now, the notion of readiness here is expanded to also having more than 2/3 of chunk endorsements by weight.
Copy link
Contributor

Choose a reason for hiding this comment

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

having more than 2/3 of chunk endorsements by weight. - unclear what "weight" means here, I suggest changing to "stake"

neps/nep-0509.md Outdated
* (Same as today) Do not require tracking any shard
* (Same as today) Should have a higher barrier of entry for security reasons (e.g. to make block double signing harder)
* (New) No longer require tracking any shard
* (Same as today) Should have a higher barrier of entry (to keep `BlockHeader` size low and for security reasons, to make block double signing harder)
Copy link
Contributor

Choose a reason for hiding this comment

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

how does " higher barrier of entry" helps with "to keep BlockHeader size low"? 🤔

neps/nep-0509.md Outdated
For the context of the NEP, it is enough to assume that `work_quality_ratio = avg_{role}({role}_quality_ratio)`.
So, if node is both a block and chunk producer, we compute quality for each role separately and then take average of them.

When epoch is finalized, all headers of blocks in it uniquely determine who was expected to produce each block and chunk.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: headers of blocks -> block headers

neps/nep-0509.md Outdated
Field structure doesn't change, but we need to carefully pick range of set of source chunks, so different subsets will cover all source receipts without intersection.

Let's say B2 is the block that contains the last new chunk of shard S before chunk which state transition we execute, and B1 is the
block that contains the last new chunk of shard S before B2.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: you don't need line break here

@wacban
Copy link

wacban commented Jun 13, 2024

Sorry I won't have time to review today, feel free to merge to reduce the chance of merge conflicts with others. If I have any nits I'll just send a follow up PR.

@Longarithm Longarithm merged commit a999b1d into state-validation Jun 13, 2024
1 check passed
@Longarithm Longarithm deleted the sv-ref-impl branch June 13, 2024 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: APPROVED FIXES
Development

Successfully merging this pull request may close these issues.

3 participants