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/priority: refactor priority protocol #1271

Merged
merged 3 commits into from
Oct 13, 2022
Merged

Conversation

corverroos
Copy link
Contributor

Refactors the priority protocol:

  • Removes metadata from proto messages since not required anymore
  • Makes all types generic anypb.Any to support arbitrary use-cases.
  • Refactor static msgProvider to provide when triggered.

category: refactor
ticket: #1257

for _, topic := range msg.Topics {
if dedupTopics(msg.PeerId) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

bug!

@codecov
Copy link

codecov bot commented Oct 12, 2022

Codecov Report

Base: 53.75% // Head: 53.74% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (a83cf54) compared to base (d0442c9).
Patch coverage: 67.42% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1271      +/-   ##
==========================================
- Coverage   53.75%   53.74%   -0.01%     
==========================================
  Files         139      139              
  Lines       16365    16446      +81     
==========================================
+ Hits         8797     8839      +42     
- Misses       6312     6345      +33     
- Partials     1256     1262       +6     
Impacted Files Coverage Δ
core/consensus/msg.go 53.48% <ø> (ø)
core/priority/calculate.go 68.34% <66.66%> (-2.77%) ⬇️
core/priority/prioritiser.go 61.65% <68.00%> (-5.45%) ⬇️
app/vmock.go 69.93% <0.00%> (-5.89%) ⬇️
app/app.go 59.23% <0.00%> (-0.43%) ⬇️
dkg/dkg.go 49.53% <0.00%> (+0.23%) ⬆️
core/scheduler/scheduler.go 73.47% <0.00%> (+0.33%) ⬆️
cmd/createdkg.go 66.33% <0.00%> (+0.68%) ⬆️
... and 2 more

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.

// Calculate overall score for all priorities in the topic
// which effectively orders by count then by overall priority.
var (
scores = make(map[string]int)
allPriorities []string
scores = make(map[[32]byte]int)
Copy link
Contributor

Choose a reason for hiding this comment

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

can we give [32]byte a type? will make it more readable

Copy link
Contributor Author

@corverroos corverroos Oct 13, 2022

Choose a reason for hiding this comment

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

yeah not sure, I actually removed the instanceKey type, reverting to just [32]byte. I think defining types is mostly useful if the scope of the type is very large. In this case, it is pretty small.

// Priority is one of many grouped by a Topic being prioritised in an Instance.
type Priority proto.Message

// instanceKey is the hash of an Instance proto.Message and is used to index instanceData. See hashProto.
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
// instanceKey is the hash of an Instance proto.Message and is used to index instanceData. See hashProto.
// instanceKey is the hash of an Instance and is used to index instanceData. See hashProto.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

think the original is fine

@corverroos corverroos added the merge when ready Indicates bulldozer bot may merge when all checks pass label Oct 13, 2022
@obol-bulldozer obol-bulldozer bot merged commit 29d32bd into main Oct 13, 2022
@obol-bulldozer obol-bulldozer bot deleted the corver/priorityrefactor branch October 13, 2022 07:23
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.

2 participants