Skip to content

Commit

Permalink
revert invalid change for batch withdrawal variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
antstalepresh committed Oct 30, 2023
1 parent 3e7ac26 commit 081526a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions x/batch/keeper/delegation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ func (suite *KeeperTestSuite) TestWithdrawAllDelegationRewards() {
}

// Withdraw all rewards using a single batch transaction
gasForBatchDelegation := suite.ctx.GasMeter().GasConsumed()
gasForBatchWithdrawal := suite.ctx.GasMeter().GasConsumed()
res, err := batchMsgServer.WithdrawAllDelegatorRewards(suite.ctx, batchtypes.NewMsgWithdrawAllDelegatorRewards(delAddr))
gasForBatchDelegation = suite.ctx.GasMeter().GasConsumed() - gasForBatchDelegation
gasForBatchWithdrawal = suite.ctx.GasMeter().GasConsumed() - gasForBatchWithdrawal
require.NoError(suite.T(), err)
require.False(suite.T(), res.Amount.IsZero())

Expand All @@ -114,7 +114,7 @@ func (suite *KeeperTestSuite) TestWithdrawAllDelegationRewards() {
suite.app.DistrKeeper.AllocateTokensToValidator(suite.ctx, suite.app.StakingKeeper.Validator(suite.ctx, valAddr), valRewardTokens)
}

totalGasForIndividualDelegations := suite.ctx.GasMeter().GasConsumed()
totalGasForIndividualWithdrawals := suite.ctx.GasMeter().GasConsumed()
// Withdraw all rewards using multiple individual transactions
for i := 0; i < totalVals; i++ {
valAddr := sdk.ValAddress(valConsAddrs[i])
Expand All @@ -124,11 +124,11 @@ func (suite *KeeperTestSuite) TestWithdrawAllDelegationRewards() {
require.False(suite.T(), res.Amount.IsZero())

}
totalGasForIndividualDelegations = suite.ctx.GasMeter().GasConsumed() - totalGasForIndividualDelegations
totalGasForIndividualWithdrawals = suite.ctx.GasMeter().GasConsumed() - totalGasForIndividualWithdrawals

require.True(suite.T(), gasForBatchDelegation < totalGasForIndividualDelegations)
suite.T().Log(">>>>>>> Gas usage for batch withdrawals is ", gasForBatchDelegation)
suite.T().Log(">>>>>>> Gas usage for individual withdrawals is ", totalGasForIndividualDelegations)
require.True(suite.T(), gasForBatchWithdrawal < totalGasForIndividualWithdrawals)
suite.T().Log(">>>>>>> Gas usage for batch withdrawals is ", gasForBatchWithdrawal)
suite.T().Log(">>>>>>> Gas usage for individual withdrawals is ", totalGasForIndividualWithdrawals)
}

func (suite *KeeperTestSuite) TestBatchResetDelegation() {
Expand Down

0 comments on commit 081526a

Please sign in to comment.