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

chore(code/part_stream): Use random StreamId #583

Merged
merged 3 commits into from
Nov 21, 2024
Merged

Conversation

romac
Copy link
Member

@romac romac commented Nov 20, 2024

This ensures that a stream id is not re-used when a node crashes and restarts quickly.

…t re-used when a node crashes and restarts quickly
@romac romac requested a review from ancazamfir November 20, 2024 12:42
@romac romac changed the title chore(code/part_stream): Use random StreamId chore(code/part_stream): Use random StreamId Nov 20, 2024
@romac romac requested a review from ancazamfir November 21, 2024 13:10
let stream_id = self.next_stream_id;
// Wrap around if we get to u64::MAX, which may happen if the initial
// stream id was close to it already.
self.next_stream_id = self.next_stream_id.wrapping_add(1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

@romac romac enabled auto-merge (squash) November 21, 2024 14:07
@romac romac merged commit 77653d3 into main Nov 21, 2024
11 checks passed
@romac romac deleted the romac/random-stream-id branch November 21, 2024 14:07
cason pushed a commit that referenced this pull request Nov 22, 2024
* chore(code/part_stream): Use random StreamId to ensure a stream is not re-used when a node crashes and restarts quickly

* Start with random StreamId and increment from there
josef-widder added a commit that referenced this pull request Nov 22, 2024
* startin with witnesses and invariants

* more invariants

* feat(code): Start consensus at `H+1` where `H` is the height of the latest committed block (#587)

* feat(code): Start consensus at `H+1` where `H` is the height of the latest committed block

* Update spawn.bash

* chore(code/part_stream): Deduplicate received proposal parts by sequence number (#584)

* chore(code/part_stream): Use random `StreamId` (#583)

* chore(code/part_stream): Use random StreamId to ensure a stream is not re-used when a node crashes and restarts quickly

* Start with random StreamId and increment from there

* spec/quint: some renaming and comments

* spec/quint: undoing new line changes

* spec/quint: witness renamed, comments added

* spec/quint: invariant renamed, comments adapted

* spec/quint: invariant renamed, comments adapted

* more invariants

* spec/quint: re-tabbing blocksync.qnt

* spec/quint: fix comments, types, identation

---------

Co-authored-by: Romain Ruetschi <[email protected]>
Co-authored-by: Daniel Cason <[email protected]>
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.

2 participants