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

Locking on the unbonded frozen balances becomes invalid when users bond after unbonding #402

Closed
liuchengxu opened this issue Dec 1, 2020 · 0 comments · Fixed by #403
Closed
Labels
F2-bug 🐜 The client fails to follow expected behavior.

Comments

@liuchengxu
Copy link
Contributor

liuchengxu commented Dec 1, 2020

Self::set_lock(who, new_bonded);

This line sets a wrong lock if you unbond before and now bond again, the locked value should always be the sum of LockedType::Bonded and LockedType::BondedWithdrawal, now it's wrongly set to LockedType::Bonded only.

After #403, the staking lock should work as expected again. The corrupted unbonded locking state in Staking can be fixed by purging the useless records since the noted balances are actually not locked in Balances, i.e, https://github.com/chainx-org/ChainX/pull/403/files#diff-acfc4fead7dba36919225985639fe230fc951b8b6630dc3e48d15fb5a3366076R538 .

The locking state of these accounts' will be corrected using XStaking::force_unlock_bonded_withdrawal().

[
  "5Q2YbamS7zZb8Mre7EQe2A7jB3bgMFf4ce4P5ouqWPx6zaer",
  "5V9Bu9ydAXnCjJEjgVvNgxAvEMGS3VdEKtMm7givE1o1SDmg",
  "5VHspZ5hNnVHeZ9YH4L6mqoKiW8jjFJJXZirQujLxLSb1uec",
  "5VBN2atxvd9Yp3jnY2ModBgcELnySdXggCbQTwRYN9r1Atk4",
  "5S4hdBy4zvP5MfVtkjtXKPnng2wxBpaXKDrth635nFUnA8gr",
  "5UBiRpsvDwCmTYmsSv5y7doGQRKJDB6nqPVCncpZsmHwdmre",
  "5RHhrWzyz3mejd6Ee8L8AJ6g2bhanFui5wdVdREP7KXBcfW5",
  "5VGSfAorfHPJAvSLRshNXvHjqJWbEZbVNbh9MhKHVaDZ66Gy",
  "5R7K9qZRcYPZHWGEWY5NTxi5y4dCGZiGREv31ksdJjs7EFzC",
  "5UoH7oCJonAhe1VKg85V944Gko8uFCon5ngxqkAMDD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J5NXLzBi",
  "5QXxt4FyWtFoPs2K9utq4FAyuWDcs8DUT2f16JqieLhnpeBH",
  "5Pyqu2EmqwKkaFKam18Q5xdM9B8Tju83PBv7nevWrru93X3i",
  "5UeNTWNtZHcduR57qZMEq1Nbz6wbmfpRgQY54VpRgFNphX2P",
  "5TPvwUmuAAvk6uLLH92chAKLLWuJFvbe9wvine3qsm84xoNw",
  "5V4K9XCRTWZjx5mpVNihb7WVqhZvhFs6ZPvhx4TYMSW9AvRP",
  "5QzmisPCehx44HquiMPxRSW7x3Dc4ZBBekARLgiAveQS2Bs9",
  "5QJcMnyLVXx4NaDyvjqwuYisn9vy4hSvYJ4MWJZ7PgDHegQs",
  "5SucuS8LJmaKCRkBQ2aHHiTKarZeT1xCFXcBSd3YfDTwn9gs"
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F2-bug 🐜 The client fails to follow expected behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant