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/infosync: implement infosync priority protocol use case #1385

Merged
merged 3 commits into from
Nov 4, 2022

Conversation

corverroos
Copy link
Contributor

Adds the infosync component that prioritised cluster supported versions. Also add the priority.Component that wraps the prioritiser to hide protobuf types and do signing.

category: feature
ticket: #1380

@corverroos
Copy link
Contributor Author

Will add tests in next PR
Will wire in PR after that

@codecov
Copy link

codecov bot commented Nov 3, 2022

Codecov Report

Base: 54.10% // Head: 53.61% // Decreases project coverage by -0.48% ⚠️

Coverage data is based on head (3b6a4dd) compared to base (2260111).
Patch coverage: 5.26% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1385      +/-   ##
==========================================
- Coverage   54.10%   53.61%   -0.49%     
==========================================
  Files         144      145       +1     
  Lines       17804    17985     +181     
==========================================
+ Hits         9632     9643      +11     
- Misses       6847     7016     +169     
- Partials     1325     1326       +1     
Impacted Files Coverage Δ
core/priority/component.go 0.00% <0.00%> (ø)
core/types.go 28.48% <14.28%> (-0.43%) ⬇️
core/consensus/component.go 43.82% <28.57%> (-0.23%) ⬇️
p2p/peer.go 35.55% <31.25%> (-0.94%) ⬇️
core/priority/prioritiser.go 62.05% <100.00%> (+0.39%) ⬆️
dkg/transport.go 53.70% <0.00%> (-12.97%) ⬇️
core/dutydb/memory.go 68.59% <0.00%> (-0.70%) ⬇️
app/app.go 61.07% <0.00%> (+0.86%) ⬆️
app/vmock.go 77.54% <0.00%> (+5.34%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

core/infosync/infosync.go Outdated Show resolved Hide resolved

// signMsg returns a copy of the proto message with a populated signature signed by the provided private key.
func signMsg(msg *pbv1.PriorityMsg, privkey *ecdsa.PrivateKey) (*pbv1.PriorityMsg, error) {
clone := proto.Clone(msg).(*pbv1.PriorityMsg)
Copy link
Contributor

Choose a reason for hiding this comment

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

what if msg is nil? clone.Signature would panic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nil checks are not required in golang, one assumes valid data is being passed in 99% of cases

@@ -72,13 +73,14 @@ func (d DutyType) String() string {
DutySyncMessage: "sync_message",
DutyPrepareSyncContribution: "prepare_sync_contribution",
DutySyncContribution: "sync_contribution",
DutyInfoSync: "info_sync",
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 this duty for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we prioritise "cluster-agreed-upon-supported-version" every epoch. This is used to decide to upgrade or not.

@@ -213,7 +212,7 @@ func (c *Component) Propose(ctx context.Context, duty core.Duty, data core.Unsig

// ProposePriority participants in a consensus instance proposing the provided priority message.
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
// ProposePriority participants in a consensus instance proposing the provided priority message.
// ProposePriority participants in a consensus instance proposing the provided priority result.

@corverroos corverroos added the merge when ready Indicates bulldozer bot may merge when all checks pass label Nov 4, 2022
@obol-bulldozer obol-bulldozer bot merged commit c7d1bc8 into main Nov 4, 2022
@obol-bulldozer obol-bulldozer bot deleted the corver/priocomp branch November 4, 2022 13:33
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