Fix/staketb
What does this PR do?
- Resolve #7 (closed)
- Resolve #8 (closed)
Overview
- Move the stakes to
completed
orcancelled
scope once the stake is not in progress. - Update the voting power of the accounts once the final value is completed.
#7 (closed)
Issue:Steps to test
Production Environment (testnet/mainnet)
- Deploy the latest commit from the this branch to
stake.libre
account. - Run
migrate
action until it returns an error sayingMigration is completed
. - Validate the new entries have been added to
completed
andcancelled
scope of thestake
table. Since only stakes that have been unstaked are going to appear in the cancelled scope, that table could be empty. - Validate that the table
stake
scoped bystake.libre
only contains entries withstatus = 1
which means, the stakes are in progress. - Perform a new stake and validate that the new entry is added to the
stake
table scoped bystake.libre
.
Local Libre Network
- Get the version of
stake.libre
that is deployed ontestnet
ormainnet
(at the moment of writing this document they are the same), run some stakes and call themigrate1
action, and latermigrate2
until they return the following errors respectively:Migration #1 is completed
andMigration #2 is completed
. - Unstake a couple of rows.
- Get latest version currently deployed on
testnet
andmainnet
by downloading the respectivewasm
andabi
files. - Run
migrate
to validate that the stakes that are not in progress are moved to completed/canceled scope. - Perform a couple of stakes (1 day, 1 week and 1 month)
- Passed two days from the first stake, you are able to claim the rewards, claim it and validate that your stake row has been moved to scope
completed
. - Cancel a stake in progress by unstaking (
unstake
action) it. - Validate the cancelled stake is moved to
canceled scope
.
#8 (closed)
Issue:Steps to test
Production Environment (testnet/mainnet)
- Stake and validate voting power is increased.
- Unstake/claim and after the
updatevp
call, check the voting power is decreased. - Check that while a voting power update, the voting power is not updated until the end of the calculation, this way the issue with external contracts reading low/wrong voting power values is fixed.
- Write down the current voting power of an account.
- Call
updatevp
with low steps 20. - Check the attribute
vp_state
of the tablestate
is set to1
(calculating voting power). - Check the voting power of the selected account hasn't changed.
- Call
updatevp
with high steps 2000. - Check the voting power of the selected account has been updated.
Edited by Leister Francisco Alvarado Campos