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 protocol describing the semantics of the consensus network messages #66

Merged
merged 1 commit into from
Feb 20, 2025

Conversation

matan-starkware
Copy link
Collaborator

No description provided.

@matan-starkware matan-starkware force-pushed the matan/consensus_protocol_spec branch 3 times, most recently from 313b0f1 to 761cc69 Compare February 4, 2025 11:22
Copy link

@cason cason left a comment

Choose a reason for hiding this comment

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

Thank you for this, some general comments and suggestions.

@@ -30,68 +29,52 @@ message Vote {
// messages, to make sure the data, and therefore the signatures, are unambiguous between
// Prevote and Precommit.
VoteType vote_type = 1;
uint64 fork_id = 2;
uint64 block_number = 3;
Copy link

Choose a reason for hiding this comment

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

We call this height in consensus. In particular because consensus does not know the concept of "block".

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Discussed in slack, height will refer to (block_number, fork_id)

// This is optional since a vote can be NIL.
optional Hash block_hash = 6;
optional Hash block_hash = 5;
Copy link

Choose a reason for hiding this comment

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

We call this value_id in consensus, namely id(v).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think we prefer the term proposal_commitment as that seems to be more self explanatory to people who don't have a theoretical basis in consensus. It actually describes what we are voting on.

optional uint32 valid_round = 3;
Address proposer = 4;
uint64 fork_id = 1;
uint64 height = 2;
Copy link

Choose a reason for hiding this comment

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

We are using height here and block_number for votes.

If this is the message that maps into the PROPOSAL message in the paper, the name should be the same.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

aligned so that we always have fork_id and block_number as the fields. height is the combination of the 2.


message ProposalCommitment {
uint64 block_number = 1;
uint64 fork_id = 2;
Copy link

Choose a reason for hiding this comment

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

Do we really need that many numbers for fork IDs?

Copy link

Choose a reason for hiding this comment

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

Notice that round is a uint32.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The reason I did it this way is that fork_id and height progress across time indefinitely.

Round on the other hand is reset for each height. My thinking is that if somehow rounds take only 100ms (implying good network connectivity) but no decision is reached, it will still take over 10 years to reach round 2**32, in which case the network is dead anyways.

@matan-starkware matan-starkware force-pushed the matan/consensus_protocol_spec branch from 761cc69 to f7514f7 Compare February 18, 2025 07:50
@matan-starkware matan-starkware requested review from cason and dan-starkware and removed request for cason February 18, 2025 07:50
@matan-starkware matan-starkware force-pushed the matan/consensus_protocol_spec branch from f7514f7 to b294c68 Compare February 18, 2025 07:53
Copy link

@cason cason left a comment

Choose a reason for hiding this comment

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

Thank you for the changes, I left another couple of comments.

I would like to discuss with you how to render the consensus proto and documentation more self-contained and how we align with the pseudo-code or generic concepts from Tendermint.

Probably a different proto file with Starnet internals content would be the way to go.

3. ProposalCommitment - once
4. ProposalFin

#### Empty Proposals
Copy link

Choose a reason for hiding this comment

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

Are empty proposals really empty? Namely, don't they have the height, the hash of the previous block etc.?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point I added the ProposalCommitment for an empty block and what the fields should be.

A proposer may not be able to offer a valid proposal. If so, the height can be agreed to be empty.
In this case the proposer will send ProposalInit immediately followed by ProposalFin.

#### Known Proposals
Copy link

Choose a reason for hiding this comment

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

Here I assume that the content of the proposal is nonetheless broadcast.

Which would be a problem, since the Fin sequence number is considered to be the last valid one.

But this is right now a proposed approach, without details.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The ProposalFin and the StreamMessage Fin are not the same thing. The streaming protocol below is indifferent about which messages are sent at which sequence_number

uint64 fork_id = 4;
uint32 round = 5;
VoteType vote_type = 1;
uint64 fork_id = 2;
Copy link

Choose a reason for hiding this comment

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

You could define a Height type consisting of the pair fork_id and block_number. This would be more self-explanatory.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tend to like the flat struct, so I'll let @dan-starkware tie break on this

@matan-starkware matan-starkware force-pushed the matan/consensus_protocol_spec branch 2 times, most recently from 9d7df9b to 9509e1d Compare February 19, 2025 14:10
@matan-starkware matan-starkware force-pushed the matan/consensus_protocol_spec branch from 9509e1d to a75602f Compare February 20, 2025 09:09
@matan-starkware matan-starkware merged commit eefce0a into main Feb 20, 2025
1 check passed
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