Skip to content

Commit

Permalink
Add Require() to incentive claims in tests to reduce errors
Browse files Browse the repository at this point in the history
  • Loading branch information
drklee3 committed Sep 20, 2023
1 parent 33a41e7 commit ac51d49
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions x/incentive/keeper/msg_server_delegator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (suite *HandlerTestSuite) TestPayoutDelegatorClaimMultiDenom() {

// Claim denoms
err := suite.DeliverIncentiveMsg(&msg)
suite.NoError(err)
suite.Require().NoError(err)

// Check rewards were paid out
expectedRewardsHard := c("hard", int64(0.2*float64(2*7*1e6)))
Expand Down Expand Up @@ -97,7 +97,7 @@ func (suite *HandlerTestSuite) TestPayoutDelegatorClaimSingleDenom() {

// Claim rewards
err := suite.DeliverIncentiveMsg(&msg)
suite.NoError(err)
suite.Require().NoError(err)

// Check rewards were paid out
expectedRewards := c("swap", 2*7*1e6)
Expand Down
4 changes: 2 additions & 2 deletions x/incentive/keeper/msg_server_hard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (suite *HandlerTestSuite) TestPayoutHardClaimMultiDenom() {

// Claim denoms
err := suite.DeliverIncentiveMsg(&msg)
suite.NoError(err)
suite.Require().NoError(err)

// Check rewards were paid out
expectedRewardsHard := c("hard", int64(0.2*float64(2*7*1e6)))
Expand Down Expand Up @@ -85,7 +85,7 @@ func (suite *HandlerTestSuite) TestPayoutHardClaimSingleDenom() {

// Claim rewards
err := suite.DeliverIncentiveMsg(&msg)
suite.NoError(err)
suite.Require().NoError(err)

// Check rewards were paid out
expectedRewards := c("swap", 2*7*1e6)
Expand Down
4 changes: 2 additions & 2 deletions x/incentive/keeper/msg_server_swap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (suite *HandlerTestSuite) TestPayoutSwapClaimMultiDenom() {

// Claim rewards
err := suite.DeliverIncentiveMsg(&msg)
suite.NoError(err)
suite.Require().NoError(err)

// Check rewards were paid out
expectedRewardsHard := c("hard", int64(0.2*float64(7*1e6)))
Expand Down Expand Up @@ -176,7 +176,7 @@ func (suite *HandlerTestSuite) TestPayoutSwapClaimSingleDenom() {

// Claim rewards
err := suite.DeliverIncentiveMsg(&msg)
suite.NoError(err)
suite.Require().NoError(err)

// Check rewards were paid out
expectedRewards := c("swap", 7*1e6)
Expand Down
2 changes: 1 addition & 1 deletion x/incentive/keeper/msg_server_usdx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (suite *HandlerTestSuite) TestPayoutUSDXClaim() {

// Claim a single denom
err = suite.DeliverIncentiveMsg(&msg)
suite.NoError(err)
suite.Require().NoError(err)

// Check rewards were paid out
expectedRewards := cs(c(types.USDXMintingRewardDenom, 7*1e6))
Expand Down
2 changes: 1 addition & 1 deletion x/incentive/keeper/rewards_borrow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (suite *BorrowIntegrationTests) TestSingleUserAccumulatesRewardsAfterSyncin
})

// User claims all their rewards
suite.NoError(suite.DeliverIncentiveMsg(&msg))
suite.Require().NoError(suite.DeliverIncentiveMsg(&msg))

// The users has always had 100% of borrows, so they should receive all rewards for the previous two blocks.
// Total rewards for each block is block duration * rewards per second
Expand Down
2 changes: 1 addition & 1 deletion x/incentive/keeper/rewards_supply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (suite *SupplyIntegrationTests) TestSingleUserAccumulatesRewardsAfterSyncin
})

// User claims all their rewards
suite.NoError(suite.DeliverIncentiveMsg(&msg))
suite.Require().NoError(suite.DeliverIncentiveMsg(&msg))

// The users has always had 100% of deposits, so they should receive all rewards for the previous two blocks.
// Total rewards for each block is block duration * rewards per second
Expand Down
6 changes: 3 additions & 3 deletions x/incentive/keeper/rewards_usdx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (suite *USDXIntegrationTests) TestSingleUserAccumulatesRewardsAfterSyncing(

// User claims all their rewards
msg := types.NewMsgClaimUSDXMintingReward(userA.String(), "large")
suite.NoError(suite.DeliverIncentiveMsg(&msg))
suite.Require().NoError(suite.DeliverIncentiveMsg(&msg))

// The users has always had 100% of cdp debt, so they should receive all rewards for the previous two blocks.
// Total rewards for each block is block duration * rewards per second
Expand Down Expand Up @@ -141,7 +141,7 @@ func (suite *USDXIntegrationTests) TestSingleUserAccumulatesRewardsWithoutSyncin
suite.NextBlockAfter(1e6 * time.Second)

msg := types.NewMsgClaimUSDXMintingReward(user.String(), "large")
suite.NoError(suite.DeliverIncentiveMsg(&msg))
suite.Require().NoError(suite.DeliverIncentiveMsg(&msg))

// The users has always had 100% of cdp debt, so they should receive all rewards for the previous two blocks.
// Total rewards for each block is block duration * rewards per second
Expand Down Expand Up @@ -217,7 +217,7 @@ func (suite *USDXIntegrationTests) TestReinstatingRewardParamsDoesNotTriggerOver

// Claim rewards
msg := types.NewMsgClaimUSDXMintingReward(userB.String(), "large")
suite.NoError(suite.DeliverIncentiveMsg(&msg))
suite.Require().NoError(suite.DeliverIncentiveMsg(&msg))

// The cdp had half the total borrows for a 1s block. So should earn half the rewards for that block
suite.BalanceInEpsilon(
Expand Down

0 comments on commit ac51d49

Please sign in to comment.