Tests - operation in Hive - account witness proxy operation
Operation: account_witness_proxy_operation, // 13
Configuration:
HIVE_GOVERNANCE_VOTE_EXPIRATION_PERIOD, default mainnet value: 365 days
Test case:
-
1. User has not voted for witness or proposal and sets proxy.
Preconditions:
- There are witnesses X and Y.
- There are proposals X and Y.
- There is an account A, who votes for witness X and proposal X.
- User B hasn't voted for witness or proposal.
Steps:
Step 1: User B sets a proxy: account A.
Expected results:
- After operation: The proxy is set.
- After operation: RC is reduced.
- After operation: The proxy (user A) vote power was increased by the user B votes for witness X.
- After operation: The proxy (user A) vote power was increased by the user B votes for proposal X.
- After operation: The user's vote is not added to vote for witness Y.
- After operation: The user's vote is not added to vote for proposal Y.
Test case:
-
2. User removes a proxy and before setting user did not vote.
Preconditions:
- There are witnesses X and Y.
- There are proposals X and Y.
- There is an account A, who votes for witness X and proposal X.
- User B didn't vote for witness or proposal.
- User B sets account A as a proxy.
Steps:
Step 1: User B removes a proxy: account A.
Expected results:
- After operation: The proxy is removed.
- After operation: RC is reduced.
- After operation: The proxy (user A) vote power was decreased by the user B votes for witness X. for witness X.
- After operation: The proxy (user A) vote power was decreased by the user B votes for proposal X.
- After operation: The user's vote is not added to vote for witness Y.
- After operation: The user's vote is not added to vote for proposal Y.
- After operation: The virtual operation proxy_cleared_operation is generated.
Test case:
-
3. User voted for witness and proposal and now sets proxy.
Preconditions:
- There are witnesses X, Y and Z.
- There are proposals X, Y and Z.
- There is an account A, who votes for witness X and proposal X.
Steps:
Step 1: User B votes for witness Z.
Expected results:
- After operation: The witness Z receives the vote.
- After operation: RC is reduced.
Step 2: User votes for proposal Z.
- After operation: The proposal Z receives the vote.
- After operation: RC is reduced.
Step 3: User B sets a proxy: account A.
- After operation: The proxy is set.
- After operation: RC is reduced.
- After operation: The proxy (user A) vote power was increased by the user B votes for witness X.
- After operation: The proxy (user A) vote power was increased by the user B votes for proposal X.
- After operation: The user's vote is not added to vote for witness Y.
- After operation: The user's vote is not added to vote for proposal Y.
- After operation: The proxy (user A) vote power was decreased by the user B votes for witness Z.
- After operation: The proxy (user A) vote power was decreased by the user B votes for proposal Z.
Test case:
-
4. User removes a proxy and before setting user voted.
Preconditions:
- There are witnesses X, Y and Z.
- There are proposals X, Y and Z.
- There is an account A, who votes for witness X and proposal X.
Steps:
Step 1: User B votes for witness Z.
Expected results:
- After operation: The witness Z receives the vote.
- After operation: RC is reduced.
Step 2: User votes for proposal Z.
- After operation: The proposal Z receives the vote.
- After operation: RC is reduced.
Step 3: User B sets a proxy: account A.
- After operation: The proxy is set.
- After operation: RC is reduced.
- After operation: The proxy (user A) vote power was increased by the user B votes for witness X.
- After operation: The proxy (user A) vote power was increased by the user B votes for proposal X.
- After operation: The user's vote is not added to vote for witness Y.
- After operation: The user's vote is not added to vote for proposal Y.
- After operation: The proxy (user A) vote power was decreased by the user B votes for witness Z.
- After operation: The proxy (user A) vote power was decreased by the user B votes for proposal Z.
Step 4: User B removes a proxy: account A.
Expected results:
- After operation: The proxy is removed.
- After operation: RC is reduced.
- After operation: The proxy (user A) vote power was decreased by the user B votes for witness X.
- After operation: The proxy (user A) vote power was decreased by the user B votes for proposal X.
- After operation: The user's vote is not added to vote for witness Y.
- After operation: The user's vote is not added to vote for proposal Y.
- After operation: The user's vote is not added to vote for witness Z.
- After operation: The proxy (user A) vote power was increased by the user B votes for proposal Z.
- After operation: The virtual operation proxy_cleared_operation is generated.
Test case:
-
5. User hasn't vote for a HIVE_GOVERNANCE_VOTE_EXPIRATION_PERIOD.
Preconditions:
- There are witnesses X and Y.
- There are proposals X and Y.
- There is an account A, who votes for wintess X and proposal X.
- A user hasn't voted for witness or proposal.
Steps:
Step 1: User sets a proxy: account A.
Expected results:
- After operation: The proxy is set.
- After operation: RC is reduced.
- After operation: The proxy (user A) vote power was increased by the user B votes for witness X.
- After operation: The proxy (user A) vote power was increased by the user B votes for proposal X.
- After operation: The user's vote is not added to vote for witness Y.
- After operation: The user's vote is not added to vote for proposal Y.
Step 2: One year (HIVE_GOVERNANCE_VOTE_EXPIRATION_PERIOD) passes...
- After HIVE_GOVERNANCE_VOTE_EXPIRATION_PERIOD: The proposal X doesn't have the vote.
- After HIVE_GOVERNANCE_VOTE_EXPIRATION_PERIOD: The proposal Y doesn't have the vote.
- After HIVE_GOVERNANCE_VOTE_EXPIRATION_PERIOD: The witness X doesn't have the vote.
- After HIVE_GOVERNANCE_VOTE_EXPIRATION_PERIOD: The witness Y doesn't have the vote.
- After HIVE_GOVERNANCE_VOTE_EXPIRATION_PERIOD: The proxy is removed.
- After operation: The virtual operation proxy_cleared_operation is generated.
Edited by Aleksandra Grabowska