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

Clear the score when the user fully unstakes #2992

Merged
merged 4 commits into from
Aug 15, 2024
Merged

Clear the score when the user fully unstakes #2992

merged 4 commits into from
Aug 15, 2024

Conversation

Kailai-Wang
Copy link
Collaborator

Context

A small adjustment based on the new requirement.

When a user fully unstakes, his reward will become 0 according to the current logic, which is fine. However, his score shouldn't participate in the reward calculation, which is unfair to other users.

This PR fixes it in a brutal way - there's room to improve: both structural and algorithmetic way - but the time is limited, we can do the improvement later.

This PR simply clears the user's score for whoever has 0 staking when we calculate the rewards.
We can't simply remove the entry from Scores as the user might still have unclaimed reward.

@Kailai-Wang Kailai-Wang requested review from BillyWooo, wangminqi and a team August 15, 2024 04:27
@Kailai-Wang Kailai-Wang self-assigned this Aug 15, 2024
Copy link
Member

@wangminqi wangminqi left a comment

Choose a reason for hiding this comment

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

LGTM

@Kailai-Wang Kailai-Wang enabled auto-merge (squash) August 15, 2024 10:49
@Kailai-Wang Kailai-Wang merged commit f6da3ec into dev Aug 15, 2024
35 checks passed
@Kailai-Wang Kailai-Wang deleted the remove-score branch August 15, 2024 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants