-
Notifications
You must be signed in to change notification settings - Fork 212
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
feat: Reputation: CNS-1004 - QoS excellence epoch score aggregation #1612
base: CNS-1003-reputation-proto-definitions
Are you sure you want to change the base?
feat: Reputation: CNS-1004 - QoS excellence epoch score aggregation #1612
Conversation
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
…putation-qos-score-aggregation
…putation-qos-score-aggregation
…putation-qos-score-aggregation
…putation-qos-score-aggregation
…putation-qos-score-aggregation
…putation-qos-score-aggregation
…putation-qos-score-aggregation
…putation-qos-score-aggregation
…putation-qos-score-aggregation
@@ -170,6 +170,46 @@ func (k msgServer) RelayPayment(goCtx context.Context, msg *types.MsgRelayPaymen | |||
k.handleBadgeCu(ctx, badgeData, relay.Provider, relay.CuSum, newBadgeTimerExpiry) | |||
} | |||
|
|||
// update the reputation's epoch QoS score | |||
// the excellece QoS report can be nil when the provider and consumer geolocations are not equal | |||
if relay.QosExcellenceReport != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better in a function for readability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. see 5ad9aae
…putation-qos-score-aggregation
// update the reputation's epoch QoS score | ||
// the excellece QoS report can be nil when the provider and consumer geolocations are not equal | ||
if relay.QosExcellenceReport != nil { | ||
err = k.updateReputationEpochQosScore(ctx, project.Subscription, relay) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change the name of the method since we have another one with the same name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. see 600464d
} | ||
effectiveStake := sdk.NewCoin(stakeEntry.Stake.Denom, stakeEntry.TotalStake()) | ||
|
||
// note the current weight used is by relay num. In the future, it might change |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain why this is? afaik this is just an incrementing number to count sessions (?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The goal was to give more weight to relay payments with lots of relays. I also remember is the counter, will fix later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. see 600464d
x/pairing/keeper/reputation.go
Outdated
} | ||
|
||
// calculate the updated QoS epoch score | ||
updatedEpochScore := r.EpochScore.Update(score, truncate, weight) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we make this in place method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. see 600464d
// update the reputation and set | ||
r.EpochScore = updatedEpochScore | ||
r.TimeLastUpdated = ctx.BlockTime().UTC().Unix() | ||
r.Stake = stake |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is the stake needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from the comment in the proto:
The stake is used when converting the reputation QoS scores to repuatation pairing score.
You'll see it in the next parts
…putation-qos-score-aggregation
Description
Closes: #XXXX
In this PR I implemented the QoS excellence epoch score aggregation, done in the relay payment mechanism.
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
in the type prefix if API or client breaking changemain
branchReviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...