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

core/qbft: refactor to explicit justifications #500

Merged
merged 1 commit into from
May 9, 2022

Conversation

corverroos
Copy link
Contributor

@corverroos corverroos commented May 7, 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

@codecov
Copy link

codecov bot commented May 7, 2022

Codecov Report

Merging #500 (0fd9213) into main (d5e6741) will increase coverage by 0.13%.
The diff coverage is 71.60%.

❗ Current head 0fd9213 differs from pull request most recent head 0972499. Consider uploading reports for the commit 0972499 to get more accurate results

@@            Coverage Diff             @@
##             main     #500      +/-   ##
==========================================
+ Coverage   56.39%   56.53%   +0.13%     
==========================================
  Files          87       87              
  Lines        7846     7974     +128     
==========================================
+ Hits         4425     4508      +83     
- Misses       2829     2866      +37     
- Partials      592      600       +8     
Impacted Files Coverage Δ
core/qbft/uponrule_string.go 40.00% <40.00%> (ø)
core/qbft/msgtype_string.go 50.00% <50.00%> (ø)
core/qbft/qbft.go 72.35% <72.35%> (-1.58%) ⬇️
cmd/enr.go 0.00% <0.00%> (-11.77%) ⬇️
app/app.go 63.31% <0.00%> (-0.89%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d5e6741...0972499. Read the comment docs.

Base automatically changed from corver/qbft to main May 9, 2022 09:07
@corverroos corverroos added the merge when ready Indicates bulldozer bot may merge when all checks pass label May 9, 2022
@obol-bulldozer obol-bulldozer bot merged commit e6e0837 into main May 9, 2022
@obol-bulldozer obol-bulldozer bot deleted the corver/qbftexplicit branch May 9, 2022 11:18
// Run returns the consensus decided value (Qcommit) or a context closed error.
func Run(ctx context.Context, d Definition, t Transport, instance, process int64, inputValue []byte) (value []byte, err error) {
// Run executes the consensus algorithm until the context closed.
//nolint:gocognit // If is indeed a complex algorithm.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
//nolint:gocognit // If is indeed a complex algorithm.
//nolint:gocognit // It is indeed a complex algorithm.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will fix in generics PR 👍

preparedJustify []Msg
qCommit []Msg
buffer []Msg
dedupIn = make(map[dedupKey]bool)
Copy link
Contributor

Choose a reason for hiding this comment

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

What is dedup?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A very common term for "deduplication"

func Run(ctx context.Context, d Definition, t Transport, instance, process int64, inputValue []byte) (value []byte, err error) {
// Run executes the consensus algorithm until the context closed.
//nolint:gocognit // If is indeed a complex algorithm.
func Run(ctx context.Context, d Definition, t Transport, instance []byte, process int64, inputValue []byte) (err error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest: parameter names can be def Defination, trn Transport

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, but d and t also works no?

Copy link
Contributor

Choose a reason for hiding this comment

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

def sounds more of defination and t confuses with t of testing

@@ -72,13 +75,22 @@ const (

// Msg defines the inter process messages.
Copy link
Contributor

Choose a reason for hiding this comment

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

suggest: replace word process with nodes as it is confusing since we deal with Charon nodes not processes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the algorithm paper talks about processes (so sticking with its terminology)

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah sure, paper talks about processes but we are dealing with nodes not processes so we can/should modify terminologies as per our usecases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge when ready Indicates bulldozer bot may merge when all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants