code.vegaprotocol.io/vega@v0.79.0/core/integration/features/rewards/reward_pk.feature (about) 1 Feature: Staking & Delegation 2 3 Background: 4 Given the following network parameters are set: 5 | name | value | 6 | reward.asset | VEGA | 7 | validators.epoch.length | 10s | 8 | validators.delegation.minAmount | 10 | 9 | reward.staking.delegation.delegatorShare | 0.883 | 10 | reward.staking.delegation.minimumValidatorStake | 100 | 11 | reward.staking.delegation.maxPayoutPerParticipant | 100000 | 12 | reward.staking.delegation.competitionLevel | 1.1 | 13 | reward.staking.delegation.minValidators | 5 | 14 | reward.staking.delegation.optimalStakeMultiplier | 5.0 | 15 16 Given time is updated to "2021-08-26T00:00:00Z" 17 Given the average block duration is "2" 18 19 And the validators: 20 | id | staking account balance | pub_key | 21 | node1 | 1000000 | pk1 | 22 | node2 | 1000000 | pk2 | 23 | node3 | 1000000 | pk3 | 24 | node4 | 1000000 | pk4 | 25 | node5 | 1000000 | pk5 | 26 | node6 | 1000000 | pk6 | 27 | node7 | 1000000 | pk7 | 28 | node8 | 1000000 | pk8 | 29 | node9 | 1000000 | pk9 | 30 | node10 | 1000000 | pk10 | 31 | node11 | 1000000 | pk11 | 32 | node12 | 1000000 | pk12 | 33 | node13 | 1000000 | pk13 | 34 35 #set up the self delegation of the validators 36 Then the parties submit the following delegations: 37 | party | node id | amount | 38 | pk1 | node1 | 10000 | 39 | pk2 | node2 | 10000 | 40 | pk3 | node3 | 10000 | 41 | pk4 | node4 | 10000 | 42 | pk5 | node5 | 10000 | 43 | pk6 | node6 | 10000 | 44 | pk7 | node7 | 10000 | 45 | pk8 | node8 | 10000 | 46 | pk9 | node9 | 10000 | 47 | pk10 | node10 | 10000 | 48 | pk11 | node11 | 10000 | 49 | pk12 | node12 | 10000 | 50 | pk13 | node13 | 10000 | 51 52 And the parties deposit on staking account the following amount: 53 | party | asset | amount | 54 | party1 | VEGA | 10000 | 55 56 Then the parties submit the following delegations: 57 | party | node id | amount | 58 | party1 | node1 | 100 | 59 | party1 | node2 | 200 | 60 | party1 | node3 | 300 | 61 62 And the parties deposit on asset's general account the following amount: 63 | party | asset | amount | 64 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | VEGA | 100000 | 65 And the parties submit the following one off transfers: 66 | id | from | from_account_type | to | to_account_type | asset | amount | delivery_time | 67 | 1 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_GLOBAL_REWARD | VEGA | 50000 | 2021-08-26T00:00:01Z | 68 #complete the first epoch for the self delegation to take effect 69 Then the network moves ahead "7" blocks 70 71 Scenario: Parties get rewarded for a full epoch of having delegated stake - the reward amount is capped 72 Description: Parties have had their tokens delegated to nodes for a full epoch and get rewarded for the full epoch. 73 74 #advance to the end of the epoch 75 Then the network moves ahead "7" blocks 76 77 #verify validator score 78 Then the validators should have the following val scores for epoch 1: 79 | node id | validator score | normalised score | 80 | node1 | 0.07734 | 0.07734 | 81 | node2 | 0.07810 | 0.07810 | 82 | node3 | 0.07887 | 0.07887 | 83 | node4 | 0.07657 | 0.07657 | 84 85 #50k are being distributed 86 And the parties receive the following reward for epoch 1: 87 | party | asset | amount | 88 | party1 | VEGA | 201 | 89 | pk1 | VEGA | 3832 | 90 | pk2 | VEGA | 3837 | 91 | pk3 | VEGA | 3841 | 92 | pk4 | VEGA | 3828 | 93 | pk5 | VEGA | 3828 | 94 | pk6 | VEGA | 3828 | 95 | pk7 | VEGA | 3828 | 96 | pk8 | VEGA | 3828 | 97 | pk9 | VEGA | 3828 | 98 | pk10 | VEGA | 3828 | 99 | pk11 | VEGA | 3828 | 100 | pk12 | VEGA | 3828 | 101 | pk13 | VEGA | 3828 | 102 103 Then "party1" should have vesting account balance of "201" for asset "VEGA" 104 And "pk1" should have vesting account balance of "3832" for asset "VEGA" 105 And "pk2" should have vesting account balance of "3837" for asset "VEGA" 106 And "pk3" should have vesting account balance of "3841" for asset "VEGA" 107 And "pk4" should have vesting account balance of "3828" for asset "VEGA" 108 And "pk5" should have vesting account balance of "3828" for asset "VEGA" 109 And "pk6" should have vesting account balance of "3828" for asset "VEGA" 110 And "pk7" should have vesting account balance of "3828" for asset "VEGA" 111 And "pk8" should have vesting account balance of "3828" for asset "VEGA" 112 And "pk9" should have vesting account balance of "3828" for asset "VEGA" 113 And "pk10" should have vesting account balance of "3828" for asset "VEGA" 114 And "pk11" should have vesting account balance of "3828" for asset "VEGA" 115 And "pk12" should have vesting account balance of "3828" for asset "VEGA" 116 And "pk13" should have vesting account balance of "3828" for asset "VEGA" 117 118 #top up to 25000 119 And the parties submit the following one off transfers: 120 | id | from | from_account_type | to | to_account_type | asset | amount | delivery_time | 121 | 1 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_GLOBAL_REWARD | VEGA | 24991 | 2021-08-26T00:00:01Z | 122 123 Then the network moves ahead "7" blocks 124 And the parties receive the following reward for epoch 2: 125 | party | asset | amount | 126 | party1 | VEGA | 99 | 127 | pk1 | VEGA | 1916 | 128 | pk2 | VEGA | 1918 | 129 | pk3 | VEGA | 1920 | 130 | pk4 | VEGA | 1914 | 131 | pk5 | VEGA | 1914 | 132 | pk6 | VEGA | 1914 | 133 | pk7 | VEGA | 1914 | 134 | pk8 | VEGA | 1914 | 135 | pk9 | VEGA | 1914 | 136 | pk10 | VEGA | 1914 | 137 | pk11 | VEGA | 1914 | 138 | pk12 | VEGA | 1914 | 139 | pk13 | VEGA | 1914 | 140 141 Then "party1" should have vesting account balance of "300" for asset "VEGA" 142 And "pk1" should have vesting account balance of "5748" for asset "VEGA" 143 And "pk2" should have vesting account balance of "5755" for asset "VEGA" 144 And "pk3" should have vesting account balance of "5761" for asset "VEGA" 145 And "pk4" should have vesting account balance of "5742" for asset "VEGA" 146 And "pk5" should have vesting account balance of "5742" for asset "VEGA" 147 And "pk6" should have vesting account balance of "5742" for asset "VEGA" 148 And "pk7" should have vesting account balance of "5742" for asset "VEGA" 149 And "pk8" should have vesting account balance of "5742" for asset "VEGA" 150 And "pk9" should have vesting account balance of "5742" for asset "VEGA" 151 And "pk10" should have vesting account balance of "5742" for asset "VEGA" 152 And "pk11" should have vesting account balance of "5742" for asset "VEGA" 153 And "pk12" should have vesting account balance of "5742" for asset "VEGA" 154 And "pk13" should have vesting account balance of "5742" for asset "VEGA" 155 156 # top up to 12507 157 When the parties submit the following one off transfers: 158 | id | from | from_account_type | to | to_account_type | asset | amount | delivery_time | 159 | 1 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_GLOBAL_REWARD | VEGA | 12500 | 2021-08-26T00:00:01Z | 160 161 Then the network moves ahead "7" blocks 162 And the parties receive the following reward for epoch 3: 163 | party | asset | amount | 164 | party1 | VEGA | 49 | 165 | pk1 | VEGA | 958 | 166 | pk2 | VEGA | 959 | 167 | pk3 | VEGA | 961 | 168 | pk4 | VEGA | 957 | 169 | pk5 | VEGA | 957 | 170 | pk6 | VEGA | 957 | 171 | pk7 | VEGA | 957 | 172 | pk8 | VEGA | 957 | 173 | pk9 | VEGA | 957 | 174 | pk10 | VEGA | 957 | 175 | pk11 | VEGA | 957 | 176 | pk12 | VEGA | 957 | 177 | pk13 | VEGA | 957 | 178 179 Then the network moves ahead "7" blocks 180 Then "party1" should have vesting account balance of "349" for asset "VEGA" 181 And "pk1" should have vesting account balance of "6706" for asset "VEGA" 182 And "pk2" should have vesting account balance of "6714" for asset "VEGA" 183 And "pk3" should have vesting account balance of "6722" for asset "VEGA" 184 And "pk4" should have vesting account balance of "6699" for asset "VEGA" 185 And "pk5" should have vesting account balance of "6699" for asset "VEGA" 186 And "pk6" should have vesting account balance of "6699" for asset "VEGA" 187 And "pk7" should have vesting account balance of "6699" for asset "VEGA" 188 And "pk8" should have vesting account balance of "6699" for asset "VEGA" 189 And "pk9" should have vesting account balance of "6699" for asset "VEGA" 190 And "pk10" should have vesting account balance of "6699" for asset "VEGA" 191 And "pk11" should have vesting account balance of "6699" for asset "VEGA" 192 And "pk12" should have vesting account balance of "6699" for asset "VEGA" 193 And "pk13" should have vesting account balance of "6699" for asset "VEGA"