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

delete delegator on claim rewards if needed #3509

Merged
merged 13 commits into from
Oct 15, 2021

Conversation

miiu96
Copy link
Contributor

@miiu96 miiu96 commented Oct 13, 2021

Bug-fix: Fixed the situation when a delegator withdraws all his funds but the rewards remain. In this situation, delegatorData is not deleted because this user still has some rewards to claim.

Now we have a check that will delete delegatorData also on the claimRewards function if needed.

  • Added logLog for transferOwnership function.

@miiu96 miiu96 self-assigned this Oct 13, 2021
@codecov
Copy link

codecov bot commented Oct 13, 2021

Codecov Report

Merging #3509 (080bbda) into development (709f739) will increase coverage by 0.00%.
The diff coverage is 75.47%.

Impacted file tree graph

@@             Coverage Diff              @@
##           development    #3509   +/-   ##
============================================
  Coverage        73.88%   73.88%           
============================================
  Files              582      582           
  Lines            74549    74579   +30     
============================================
+ Hits             55077    55105   +28     
- Misses           15069    15071    +2     
  Partials          4403     4403           
Impacted Files Coverage Δ
node/nodeRunner.go 0.00% <0.00%> (ø)
vm/systemSmartContracts/delegation.go 77.55% <72.72%> (+0.09%) ⬆️
vm/systemSmartContracts/esdt.go 82.05% <100.00%> (+0.07%) ⬆️
vm/systemSmartContracts/logs.go 89.65% <100.00%> (+0.76%) ⬆️
p2p/libp2p/netMessenger.go 75.00% <0.00%> (+0.27%) ⬆️

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 bf1474c...080bbda. Read the comment docs.

vm/systemSmartContracts/delegation.go Outdated Show resolved Hide resolved
vm/systemSmartContracts/logs.go Outdated Show resolved Hide resolved
vm/systemSmartContracts/delegation.go Outdated Show resolved Hide resolved
vm/systemSmartContracts/delegation.go Outdated Show resolved Hide resolved
iulianpascalau
iulianpascalau previously approved these changes Oct 14, 2021
@@ -135,6 +135,9 @@
# CorrectFirstQueuedEpoch represents the epoch when the backward compatibility for setting the first queued node is enabled
CorrectFirstQueuedEpoch = 5

# DeleteDelegatorAfterClaimRewardsEnableEpoch represents the epoch when the delegators data is deleted for delegators that have to claim rewards after they widrawal all funds
DeleteDelegatorAfterClaimRewardsEnableEpoch = 1000000
Copy link
Contributor

Choose a reason for hiding this comment

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

should be 6

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

vm/systemSmartContracts/delegation_test.go Show resolved Hide resolved
iulianpascalau
iulianpascalau previously approved these changes Oct 14, 2021
sasurobert
sasurobert previously approved these changes Oct 14, 2021
@miiu96 miiu96 dismissed stale reviews from sasurobert and iulianpascalau via 4dbe1eb October 14, 2021 11:33
@@ -133,10 +133,10 @@
OptimizeGasUsedInCrossMiniBlocksEnableEpoch = 2

# CorrectFirstQueuedEpoch represents the epoch when the backward compatibility for setting the first queued node is enabled
CorrectFirstQueuedEpoch = 6
CorrectFirstQueuedEpoch = 5
Copy link
Contributor

Choose a reason for hiding this comment

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

as these 2 will probably be set altogether, why not setting CorrectFirstQueuedEpoch and DeleteDelegatorAfterClaimRewardsEnableEpoch to 2?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

iulianpascalau
iulianpascalau previously approved these changes Oct 14, 2021
sasurobert
sasurobert previously approved these changes Oct 14, 2021
@miiu96 miiu96 dismissed stale reviews from sasurobert and iulianpascalau via 1f7ba9a October 15, 2021 14:56
iulianpascalau
iulianpascalau previously approved these changes Oct 15, 2021
sasurobert
sasurobert previously approved these changes Oct 15, 2021
gabi-vuls
gabi-vuls previously approved these changes Oct 15, 2021
Copy link
Collaborator

@gabi-vuls gabi-vuls left a comment

Choose a reason for hiding this comment

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

System test passed.
image

Copy link
Contributor

@LucianMincu LucianMincu left a comment

Choose a reason for hiding this comment

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

Re-approved on system tests as only integration tests changed since latest review from @gabi-vuls.

@LucianMincu LucianMincu merged commit 9e5459d into development Oct 15, 2021
@LucianMincu LucianMincu deleted the delete-delegator-on-claim-rewards branch October 15, 2021 17:33
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.

None yet

5 participants