From ac51d49ff3a6b5cac748699b81f5e87ae360f9da Mon Sep 17 00:00:00 2001 From: drklee3 Date: Wed, 20 Sep 2023 14:37:00 -0700 Subject: [PATCH] Add Require() to incentive claims in tests to reduce errors --- x/incentive/keeper/msg_server_delegator_test.go | 4 ++-- x/incentive/keeper/msg_server_hard_test.go | 4 ++-- x/incentive/keeper/msg_server_swap_test.go | 4 ++-- x/incentive/keeper/msg_server_usdx_test.go | 2 +- x/incentive/keeper/rewards_borrow_test.go | 2 +- x/incentive/keeper/rewards_supply_test.go | 2 +- x/incentive/keeper/rewards_usdx_test.go | 6 +++--- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/x/incentive/keeper/msg_server_delegator_test.go b/x/incentive/keeper/msg_server_delegator_test.go index 11729c6060..f3d0331f0b 100644 --- a/x/incentive/keeper/msg_server_delegator_test.go +++ b/x/incentive/keeper/msg_server_delegator_test.go @@ -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))) @@ -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) diff --git a/x/incentive/keeper/msg_server_hard_test.go b/x/incentive/keeper/msg_server_hard_test.go index 317ec7015f..44e5ff712f 100644 --- a/x/incentive/keeper/msg_server_hard_test.go +++ b/x/incentive/keeper/msg_server_hard_test.go @@ -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))) @@ -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) diff --git a/x/incentive/keeper/msg_server_swap_test.go b/x/incentive/keeper/msg_server_swap_test.go index 7a5b9a125e..a66a319f5d 100644 --- a/x/incentive/keeper/msg_server_swap_test.go +++ b/x/incentive/keeper/msg_server_swap_test.go @@ -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))) @@ -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) diff --git a/x/incentive/keeper/msg_server_usdx_test.go b/x/incentive/keeper/msg_server_usdx_test.go index 55822b72d0..ae0e56032e 100644 --- a/x/incentive/keeper/msg_server_usdx_test.go +++ b/x/incentive/keeper/msg_server_usdx_test.go @@ -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)) diff --git a/x/incentive/keeper/rewards_borrow_test.go b/x/incentive/keeper/rewards_borrow_test.go index 767e6ef524..eb6aa81d97 100644 --- a/x/incentive/keeper/rewards_borrow_test.go +++ b/x/incentive/keeper/rewards_borrow_test.go @@ -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 diff --git a/x/incentive/keeper/rewards_supply_test.go b/x/incentive/keeper/rewards_supply_test.go index b4775f5899..ed51e4232b 100644 --- a/x/incentive/keeper/rewards_supply_test.go +++ b/x/incentive/keeper/rewards_supply_test.go @@ -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 diff --git a/x/incentive/keeper/rewards_usdx_test.go b/x/incentive/keeper/rewards_usdx_test.go index e7561f09cb..646feb62e8 100644 --- a/x/incentive/keeper/rewards_usdx_test.go +++ b/x/incentive/keeper/rewards_usdx_test.go @@ -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 @@ -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 @@ -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(