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

Potential race condition between delegation record updates and withdrawal acknowledgements #1162

Closed
joe-bowman opened this issue Feb 19, 2024 · 1 comment · Fixed by #1183
Assignees
Labels
bug Something isn't working
Milestone

Comments

@joe-bowman
Copy link
Contributor

Summary of Bug

At the epoch boundary, the following operations happen:

  • Process unbondings
  • Query DelegatorDelegations (in order to ensure parity between QS records and host chain)
  • Withdraw rewards

Recently there have been changes in the redemption rate outside of expected bounds; we believe this may relate to a race condition between updating delegation records and receiving unbonding tx acknowledgements.

The delegatorDelegations query is not height bound - it uses the height of 0. We do collect the height of the epoch on other chains for a boundary but this is stored outside of the interchainstaking module. This means the delegation records are collected from the current height at the point the ICQ query is made.

This combined with the ICA unbonding txs that are triggered when the unbondings are processed, it is undeterminable whether the delegation record we get is before, or after the unbonding tx hits the host chain, nor whether the response posted to the QS chain hits before or after the unbonding acknowledgement is updated.

Expected Behaviour

The expected behaviour is that we have an up to date version of the host chain delegation state reflected on QS at the point we calculate the redemption rate.

In order to achieve this, we will need to process unbondings and wait for the acknowledgements before the RR update can take place - or ensure unbondings are triggered after delegations have been updated.

@joe-bowman joe-bowman added the bug Something isn't working label Feb 19, 2024
@joe-bowman joe-bowman added this to the v1.5.0 milestone Feb 19, 2024
@joe-bowman
Copy link
Contributor Author

An ideal way to fix this, would be to have a 'height' field on the delegation record; as we have the height for an ICQ request, but an ICA acknowledgement does not give us a height, and therefore we cannot use it as a comparison.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants