From a012eb0cae4625829997865aef55b4428c306cfd Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Tue, 24 Sep 2019 10:36:01 -0700 Subject: [PATCH] Updated changelog and ran prettier --- contracts/staking/CHANGELOG.json | 8 +++ .../test/cumulative_reward_tracking_test.ts | 50 ++++--------------- 2 files changed, 18 insertions(+), 40 deletions(-) diff --git a/contracts/staking/CHANGELOG.json b/contracts/staking/CHANGELOG.json index 625793f960..da9df57fe2 100644 --- a/contracts/staking/CHANGELOG.json +++ b/contracts/staking/CHANGELOG.json @@ -61,6 +61,14 @@ { "note": "Introduce multi-block finalization.", "pr": 2155 + }, + { + "note": "Removed reference counting for cumulative rewards.", + "pr": 2188 + }, + { + "note": "Removed explicit dependency on epoch+1 when delegating.", + "pr": 2188 } ] } diff --git a/contracts/staking/test/cumulative_reward_tracking_test.ts b/contracts/staking/test/cumulative_reward_tracking_test.ts index 8c9dbb9dff..e23191ee6d 100644 --- a/contracts/staking/test/cumulative_reward_tracking_test.ts +++ b/contracts/staking/test/cumulative_reward_tracking_test.ts @@ -68,10 +68,7 @@ blockchainTests.resets('Cumulative Reward Tracking', env => { // Updates CR for epoch 0 TestAction.Delegate, ], - [ - { event: 'SetCumulativeReward', epoch: 0 }, - { event: 'SetCumulativeReward', epoch: 0 }, - ], + [{ event: 'SetCumulativeReward', epoch: 0 }, { event: 'SetCumulativeReward', epoch: 0 }], ); }); it('delegating in new epoch', async () => { @@ -89,10 +86,7 @@ blockchainTests.resets('Cumulative Reward Tracking', env => { // Unsets the CR for epoch 0 TestAction.Delegate, ], - [ - { event: 'SetCumulativeReward', epoch: 1 }, - { event: 'SetMostRecentCumulativeReward', epoch: 1 }, - ], + [{ event: 'SetCumulativeReward', epoch: 1 }, { event: 'SetMostRecentCumulativeReward', epoch: 1 }], ); }); it('re-delegating in a new epoch', async () => { @@ -111,10 +105,7 @@ blockchainTests.resets('Cumulative Reward Tracking', env => { // Sets MRCR to epoch 1 TestAction.Delegate, ], - [ - { event: 'SetCumulativeReward', epoch: 1 }, - { event: 'SetMostRecentCumulativeReward', epoch: 1 }, - ], + [{ event: 'SetCumulativeReward', epoch: 1 }, { event: 'SetMostRecentCumulativeReward', epoch: 1 }], ); }); it('delegating in epoch 1 then again in epoch 2', async () => { @@ -137,10 +128,7 @@ blockchainTests.resets('Cumulative Reward Tracking', env => { // Clears CR for epoch 1 TestAction.Delegate, ], - [ - { event: 'SetCumulativeReward', epoch: 2 }, - { event: 'SetMostRecentCumulativeReward', epoch: 2 }, - ], + [{ event: 'SetCumulativeReward', epoch: 2 }, { event: 'SetMostRecentCumulativeReward', epoch: 2 }], ); }); it('delegate in epoch 1 then undelegate in epoch 2', async () => { @@ -193,10 +181,7 @@ blockchainTests.resets('Cumulative Reward Tracking', env => { // Clears CR for epoch 1 TestAction.Undelegate, ], - [ - { event: 'SetCumulativeReward', epoch: 2 }, - { event: 'SetMostRecentCumulativeReward', epoch: 2 }, - ], + [{ event: 'SetCumulativeReward', epoch: 2 }, { event: 'SetMostRecentCumulativeReward', epoch: 2 }], ); }); it('delegate in epoch 1 and 2 then again in 3', async () => { @@ -225,10 +210,7 @@ blockchainTests.resets('Cumulative Reward Tracking', env => { // Clears CR for epoch 1 TestAction.Delegate, ], - [ - { event: 'SetCumulativeReward', epoch: 2 }, - { event: 'SetMostRecentCumulativeReward', epoch: 2 }, - ], + [{ event: 'SetCumulativeReward', epoch: 2 }, { event: 'SetMostRecentCumulativeReward', epoch: 2 }], ); }); it('delegate in epoch 0, earn reward in epoch 1', async () => { @@ -359,10 +341,7 @@ blockchainTests.resets('Cumulative Reward Tracking', env => { // Clears CR for epoch 1 TestAction.Delegate, ], - [ - { event: 'SetCumulativeReward', epoch: 4 }, - { event: 'SetMostRecentCumulativeReward', epoch: 4 }, - ], + [{ event: 'SetCumulativeReward', epoch: 4 }, { event: 'SetMostRecentCumulativeReward', epoch: 4 }], ); }); it('earn reward in epoch 1 with no stake, then delegate', async () => { @@ -383,10 +362,7 @@ blockchainTests.resets('Cumulative Reward Tracking', env => { // Creates CR for epoch 2 TestAction.Delegate, ], - [ - { event: 'SetCumulativeReward', epoch: 1 }, - { event: 'SetMostRecentCumulativeReward', epoch: 1 }, - ], + [{ event: 'SetCumulativeReward', epoch: 1 }, { event: 'SetMostRecentCumulativeReward', epoch: 1 }], ); }); it('delegate in epoch 1, 3, then delegate in epoch 4', async () => { @@ -421,10 +397,7 @@ blockchainTests.resets('Cumulative Reward Tracking', env => { // Creates CR for epoch 5 TestAction.Delegate, ], - [ - { event: 'SetCumulativeReward', epoch: 4 }, - { event: 'SetMostRecentCumulativeReward', epoch: 4 }, - ], + [{ event: 'SetCumulativeReward', epoch: 4 }, { event: 'SetMostRecentCumulativeReward', epoch: 4 }], ); }); it('delegate in epoch 1, then epoch 3', async () => { @@ -452,10 +425,7 @@ blockchainTests.resets('Cumulative Reward Tracking', env => { // Clears CR for epoch 2 TestAction.Delegate, ], - [ - { event: 'SetCumulativeReward', epoch: 3 }, - { event: 'SetMostRecentCumulativeReward', epoch: 3 }, - ], + [{ event: 'SetCumulativeReward', epoch: 3 }, { event: 'SetMostRecentCumulativeReward', epoch: 3 }], ); }); });