-
Notifications
You must be signed in to change notification settings - Fork 83
SIP: block streaming #51
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
Open
mwtian
wants to merge
1
commit into
sui-foundation:main
Choose a base branch
from
mwtian:sip-streaming
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| | SIP-Number | <Leave this blank; it will be assigned by a SIP Editor> | | ||
| | ---: | :--- | | ||
| | Title | Block Streaming | | ||
| | Description | Enable streaming uncommitted consensus blocks to full nodes. | | ||
| | Author | Mingwei Tian <mingwei@mystenlabs.com, @mwtian> | | ||
| | Editor | <Leave this blank; it will be assigned by a SIP Editor> | | ||
| | Type | Standard | | ||
| | Category | Core | | ||
| | Created | 2025-02-25 | | ||
| | Comments-URI | <Leave this blank; it will be assigned by a SIP Editor> | | ||
| | Status | <Leave this blank; it will be assigned by a SIP Editor> | | ||
| | Requires | | | ||
|
|
||
| ## Abstract | ||
|
|
||
| To further decrease the latency of propagating data in Sui, we propose allowing validators to stream | ||
| consensus blocks to full nodes. Full nodes with the feature enabled will run Mysticeti consensus to process | ||
| the incoming blocks, execute transactions before they are received via checkpoints, and create certified | ||
| checkpoints locally. | ||
|
|
||
| ## Motivation | ||
|
|
||
| Currently Sui has 320-350ms p50 consensus latency and sub 700ms p50 e2e transaction settlement latency. But it can take longer for non validators to receive the latest transactions. The diagram below illustrates the common case: | ||
|
|
||
|  | ||
|
|
||
| 1. A transaction is included in consensus, for example in round 100 blocks. | ||
| 1. A quorum of round 103 blocks commit the leader in round 101, which commits the majority of blocks in round 100 including the one containing the transaction. | ||
| - Uncommon cases: Round 101 leader is skipped in round 102. Or round 101 leader is indirectly committed / skipped in a later round. | ||
| 1. Checkpoint signatures can be created immediately after the round 103 commit, or 2~3 consensus rounds later because of checkpoint batching. The range would be round 104-106 in this example. | ||
| 1. After checkpoint signatures are submitted to consensus, it takes another consensus round to propagate the signatures across validators and certify the checkpoint. | ||
|
|
||
| We can see there are places where the latency can be reduced, if full nodes can receive consensus blocks instead of certified checkpoints. | ||
| 1. For information on settled transactions, full nodes can start executing transactions as soon as they are committed in consensus, instead of waiting for the certified checkpoints containing them to arrive. Basically the extra 2-4 consensus rounds or 150ms - 350ms of latency for certifying checkpoints can be eliminated. | ||
| 1. Applications which can utilize optimistic knowledge of the transactions can process transactions as consensus blocks are received. | ||
|
|
||
| One example use case is for market markers who want to observe the latest transactions affecting a trading pair as soon as possible. | ||
|
|
||
| ## Specification | ||
|
|
||
| Full nodes will have a new config flag to enable running Mysticeti consensus. Mysticeti will operate in a new mode on full nodes where no own block is proposed, and peers blocks are subscribed from only 1 peer instead of multiple of them. | ||
|
|
||
| ### Network Config & Discovery | ||
|
|
||
| A new port (”consensus auxiliary”) will be added, to isolate validator consensus traffic from full node block stream subscribers. Access to the validator consensus port will still be restricted to validators. Validators will likely also restrict access to their consensus auxiliary ports to chosen state sync full nodes (SSFNs). SSFNs will open their consensus auxiliary ports to all full nodes. The existing state sync peer discovery implementation can be reused to discover the block stream publisher. | ||
|
|
||
| ## Protocol | ||
|
|
||
| Connections will be initiated by the stream subscriber full node to the stream publisher, by sending over its highest accepted block per authority and highest commit reference. If the subscriber’s highest commit index lags behind the publisher’s, the subscriber can run commit sync with the publisher as peer to catchup quickly. | ||
|
|
||
| Since the subscriber does not provide details on which blocks it has locally, it is possible for the subscriber to receive published blocks that miss ancestors. So it is necessary to run block sync at the subscriber to synchronize blocks from the publisher as well. Alternatively, the subscriber can send all of its local block refs within GC round to the publisher first. Then missing ancestors on received blocks would indicate a faulty publisher, which warrants the subscriber to disconnect. | ||
|
|
||
| The stream publisher should keep track of blocks sent per authority to the subscriber, within the GC window. Only new blocks are sent by the publisher. Blocks are sent in batches, to reduce the number of messages sent. | ||
|
|
||
| ## Rationale | ||
|
|
||
| The design tries to reuse as much of the existing Mysticeti consensus implementation as possible. | ||
|
|
||
| ## Backwards Compatibility | ||
|
|
||
| The biggest compatibility concern is how this works together with the existing state sync protocol. The idea is only enable block streaming if the full node has the feature enabled and it is not lagging in epoch. Otherwise, state sync will run until the block stream subscriber catch up in epoch as the publishers. | ||
|
|
||
| ## Security Considerations | ||
|
|
||
| The most significant security concern is on DDoS protection on SSFNs. We will rely on the existing DDoS protection mechanisms first, and potentially develop ways to bid for SSFN egress by subscribers in the future. | ||
|
|
||
| ## Copyright | ||
|
|
||
| [CC0 1.0](../LICENSE.md). | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The link to the image is broken, it should be changed to:
assets/sip-block-streaming/txn_propagation.png