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

Iterate multiple times over the same set of bonds when unbonding #24

Closed
angbrav opened this issue Sep 6, 2022 · 0 comments · Fixed by #26
Closed

Iterate multiple times over the same set of bonds when unbonding #24

angbrav opened this issue Sep 6, 2022 · 0 comments · Fixed by #26

Comments

@angbrav
Copy link
Collaborator

angbrav commented Sep 6, 2022

When a user unbonds a number of tokens = amount, the system iterates over a set a bonds and creates an unbond for each of these bonds until we reach amount. After this process, we create a new bond with -amount. This is a problem, as if there is a second unbond, we will iterate over the same set of bonds, which are supposed to have been unbonded already. We need a solution that avoids iterating over already unbonded bonds.

We have discussed two solutions:

  • Simplest solution: update the amount of each bond. This means to reduce to 0 for all but the last iterated.
    We are destroying info, but seems not to be a problem because we use unbonds when slashing. Only concern: discrepancy between total_deltas and bonds.

  • An alternative solution could be one similar to total_unbonds.

We have agreed to try the simplest solution.

angbrav added a commit that referenced this issue Oct 19, 2022
* alternative fix to 24

* delete commentted text and unused function

* fix typo

* change name variable

* inf -> bottom

* fix to latest issue of #25

* fix typo
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 a pull request may close this issue.

1 participant