forked from MystenLabs/sui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[narwhal] implement range fetching of missing certificates (MystenLab…
…s#5058) The partially implemented certificate range sync logic is reworked and completed as _"range fetch"_ in this PR. The goal is to improve on the existing recursive causal completion approach in the following areas: - Improved node resilience by speeding up the certificate catch up process. - Easier to reason about performance, and easier to instrument. ### High level approach 1. When authority X receives a primary message containing certificate C from authority Y where C is missing parents at X, X will forward C to its certificate waiter. 2. The certificate waiter will record C's round number as authority Y's target round, then kick off a task to fetch certificates from other authorities. Or it will ignore C if it already knows a higher or equal round number from Y. 3. Each authority has at most one inflight task fetching certificates at a time. 4. For each fetch task, requests to fetch certificates will be sent out to other authorities in random order with 5s intervals. The first response will be processed. 5. Each fetch request contains the **last committed round** of each authority's internal consensus, and the maximum number of certificates to be sent back. 6. Certificates from the fetch response will be sent to the primary core for verification and processing. 7. After a response is processed, another fetch task will be kicked off. 8. At the beginning of a fetch task, it will check if the target rounds have been fully satisfied by the local certificate store. If yes, no fetch requests will be sent out. ### Most significant changes - `certificate_waiter.rs` contains the fetcher logic of fetching certificates by range. - `primary.rs` contains the logic of fulfilling a request for fetching a range of certificates. - `core.rs` contains changes to - Avoid starting causal completion on certificates with missing parents in `process_header()`. - Remove `process_header()`'s logic to retry requesting parent certificates if they are still missing locally. - Remove gc checks from `process_certificate()`, because it is already checked in `sanitize_certificate()`. Remove gc checks from `process_header()` because itis already checked in `sanitize_header()`. - `header_waiter.rs` is converted from a component performing critical work of retrieving parent certificates, to become best effort only. The load on the system is reduced by removing header waiter initiated retries, and the deadlock when both primary message and header loopback channels are clogged is mitigated by allowing the senders to drop messages. In future, the header's proposer should be responsible for driving the process to obtain votes, instead of relying on the voter's header waiter. ### Less significant changes (but touch more files) - Add FetchCertificates{Request,Response} and handler, to have request response pattern for fetching certificates. - Add a more efficient way to read the latest round of an origin in certificate store. - Remove previous range sync logic that is no longer used. - Rename some variables representing the same channels to be consistent across files.
- Loading branch information
Showing
34 changed files
with
1,409 additions
and
1,112 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.