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

QBFT opt-in beta consensus algo #445

Closed
corverroos opened this issue Apr 26, 2022 · 0 comments
Closed

QBFT opt-in beta consensus algo #445

corverroos opened this issue Apr 26, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@corverroos
Copy link
Contributor

Problem to be solved

We have a QBFT PoC but it isn't integrated and so isn't really tested in the field. Add QBFT as opt-in Beta feature consensus algorithm. After sufficient testing and verification, then we can bump to Alpha and Stable.

Proposed solution

Add QBFT as opt-in beta consensus algorithm.

Out of Scope

Related but out of scope is adding the featureset package to control feature rollout.

@corverroos corverroos added the enhancement New feature or request label Apr 26, 2022
@corverroos corverroos self-assigned this Apr 26, 2022
obol-bulldozer bot pushed a commit that referenced this issue May 9, 2022
Ports QBFT PoC implementation form https://github.com/corverroos/qbft. Next step is to refactor implicit justifications to explicit justifications and fix other comments and feedback as per meetings with researchers.

This code is not integrated yet.

category: feature
ticket: #445 
feature_set: alpha
obol-bulldozer bot pushed a commit that referenced this issue May 9, 2022
Refactors QBFT to explicit justifications.

Also:
 - Do not exit when decided, keep running until context cancelled
 - Send Qcommit to others after decided
 - Jump ahead when receiving justified messages
 - Trim old round messages from buffer
 - Add constant period tests
 - Make instance type bytes (to support "any" instance type)

category: refactor 
ticket: #445 
feature_set: alpha
obol-bulldozer bot pushed a commit that referenced this issue May 9, 2022
Refactors qbft to use generics. This simplified the integration significantly since an external buffer isn't required and casting and conversion and (errors) isn't required.

category: refactor 
ticket: #445 
feature_set: alpha
obol-bulldozer bot pushed a commit that referenced this issue May 10, 2022
Calculates `Quorum` and `Faulty` from `Nodes` as per Roberto suggestion. Also using his paper for the formulas.

Also rename `justify` to `justification`

category: refactor
ticket: #445 
feature_set: alpha
obol-bulldozer bot pushed a commit that referenced this issue May 10, 2022
Add the 10% dropped message test, which found some bugs:

- Condition J2 doesn't require quorum identical `preparedValue`, only a single RC with that value (confirmed this with GoQuorum `quorum/consensus/istanbul/qbft/core/justification.go:79`).
- Typo on line 652.
- Trimming older rounds removes required PREPARE message. Disable for now.
- Adds a fail fast if quorum round changes are not justified.

category: bug
ticket: #445 
feature_set: alpha
obol-bulldozer bot pushed a commit that referenced this issue May 10, 2022
Fixes buffer trimming issue:
- There is only a few uses for Justification messages: 
  - a) Check if a received PRE-PREPARE is justified (only use justifications of that single message)
  - b) Check if a received ROUND-CHANGE is justified  (only use justifications of that single message)
  - c) Generate justification of a quorum ROUND-CHANGEs (select from all buffered messages and their justifications)
- We only need previously received justifications for (c), and we can get that by `flattening` the buffer.
- Since we do not add old justifications to the buffer anymore
- We can trim all old messages again.

Also make code a bit more explicit and readable.
Also ensure that send-to-self in the test is always first and never drops or jitters.

category: bug
ticket: #445
obol-bulldozer bot pushed a commit that referenced this issue May 10, 2022
Broadcasting individual COMMIT messages after Decided can result in some being dropped. This can postpone finality in lossy networks. 

Rather batch `Qcommit` as justification of a new message type `MsgDecided`. This ensures that if a valid justified `MsgDecided` is received, that any process will decide. This also makes sending Qcommit explicit and aligns the API with that other messages, mitigating requirement of special case handling.

Also ensure that when filtering/counting messages, that only unique sources/processes are included. Generalise this via `uniq := uniqSource` helper function.

category: refactor
ticket: #445
obol-bulldozer bot pushed a commit that referenced this issue May 10, 2022
Simplify and standardise qbft generic `Value` to built-in `comparable`.

This aligns the implementation with `GoQuorum` that uses hashes of the actual values in the algo. This makes the algo simpler and probably more performant. Actual values will need to "hidden" in the `Msg` implementation.

category: refactor
ticket: #445
obol-bulldozer bot pushed a commit that referenced this issue May 10, 2022
Adds `ctx` and `err` to the `Transport.Broadcast` function. This allows for tracing and shutdown on fatal errors.

category: refactor
ticket: #445 
feature_flag: qbft_consensus
obol-bulldozer bot pushed a commit that referenced this issue May 10, 2022
Adds a random fuzzing test.

Also fixes timer firing after decide bug, which resulted in UnjustDecide rule.

category: test
ticket: #445 
feature_flag: qbft_consensus
obol-bulldozer bot pushed a commit that referenced this issue May 11, 2022
Implements a qbft consensus component that integrates qbft into p2p and the core workflow.

Note this isn't wired yet. Tests will also be added in subsequent PR.

category: feature
ticket: #445 
feature_flag: qbft_consensus
obol-bulldozer bot pushed a commit that referenced this issue May 11, 2022
Adds message signing and verification helper functions for qbft consensus,

category: feature 
ticket: #445 
feature_flag: qbft_consensus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant