Skip to content

Commit

Permalink
Remove unused error return
Browse files Browse the repository at this point in the history
  • Loading branch information
NotJeremyLiu committed Apr 18, 2023
1 parent ba03134 commit f632b42
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
4 changes: 1 addition & 3 deletions x/protorev/keeper/emit.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

// EmitBackrunEvent updates and emits a backrunEvent
func EmitBackrunEvent(ctx sdk.Context, pool SwapToBackrun, inputCoin sdk.Coin, profit, tokenOutAmount sdk.Int, remainingTxPoolPoints, remainingBlockPoolPoints uint64) error {
func EmitBackrunEvent(ctx sdk.Context, pool SwapToBackrun, inputCoin sdk.Coin, profit, tokenOutAmount sdk.Int, remainingTxPoolPoints, remainingBlockPoolPoints uint64) {
// Get tx hash
txHash := strings.ToUpper(hex.EncodeToString(tmhash.Sum(ctx.TxBytes())))
// Update the backrun event and add it to the context
Expand All @@ -32,6 +32,4 @@ func EmitBackrunEvent(ctx sdk.Context, pool SwapToBackrun, inputCoin sdk.Coin, p
sdk.NewAttribute(types.AttributeKeyProtorevArbDenom, inputCoin.Denom),
)
ctx.EventManager().EmitEvent(backrunEvent)

return nil
}
3 changes: 1 addition & 2 deletions x/protorev/keeper/emit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ func (suite *KeeperTestSuite) TestBackRunEvent() {
sdk.NewAttribute(types.AttributeKeyProtorevArbDenom, tc.inputCoin.Denom),
)

err := keeper.EmitBackrunEvent(suite.Ctx, tc.pool, tc.inputCoin, tc.profit, tc.tokenOutAmount, tc.remainingTxPoolPoints, tc.remainingBlockPoolPoints)
suite.Require().NoError(err)
keeper.EmitBackrunEvent(suite.Ctx, tc.pool, tc.inputCoin, tc.profit, tc.tokenOutAmount, tc.remainingTxPoolPoints, tc.remainingBlockPoolPoints)

// Get last event emitted and ensure it is the expected event
actualEvent := suite.Ctx.EventManager().Events()[len(suite.Ctx.EventManager().Events())-1]
Expand Down
5 changes: 1 addition & 4 deletions x/protorev/keeper/rebalance.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,7 @@ func (k Keeper) ExecuteTrade(ctx sdk.Context, route poolmanagertypes.SwapAmountI
}

// Create and emit the backrun event and add it to the context
err = EmitBackrunEvent(ctx, pool, inputCoin, profit, tokenOutAmount, remainingTxPoolPoints, remainingBlockPoolPoints)
if err != nil {
return err
}
EmitBackrunEvent(ctx, pool, inputCoin, profit, tokenOutAmount, remainingTxPoolPoints, remainingBlockPoolPoints)

return nil
}
Expand Down

0 comments on commit f632b42

Please sign in to comment.