Skip to content

Commit

Permalink
[OTE-154] Update CLOB IsSingleClobMsgTx to not take ctx (#1059)
Browse files Browse the repository at this point in the history
  • Loading branch information
roy-dydx authored Feb 8, 2024
1 parent d3273b1 commit c79377e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion protocol/app/ante/gas.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (dec FreeInfiniteGasDecorator) AnteHandle(
simulate bool,
next sdk.AnteHandler,
) (newCtx sdk.Context, err error) {
isSingleClobMsgTx, err := clobante.IsSingleClobMsgTx(ctx, tx)
isSingleClobMsgTx, err := clobante.IsSingleClobMsgTx(tx)
if err != nil {
return ctx, err
}
Expand Down
2 changes: 1 addition & 1 deletion protocol/x/clob/ante/ante_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (anteWrapper SingleMsgClobTxAnteWrapper) AnteHandle(
simulate bool,
next sdk.AnteHandler,
) (sdk.Context, error) {
isSingleClobMsgTx, err := IsSingleClobMsgTx(ctx, tx)
isSingleClobMsgTx, err := IsSingleClobMsgTx(tx)
if err != nil {
return ctx, err
}
Expand Down
4 changes: 2 additions & 2 deletions protocol/x/clob/ante/clob.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (cd ClobDecorator) AnteHandle(

// Ensure that if this is a clob message then that there is only one.
// If it isn't a clob message then pass to the next AnteHandler.
isSingleClobMsgTx, err := IsSingleClobMsgTx(ctx, tx)
isSingleClobMsgTx, err := IsSingleClobMsgTx(tx)
if err != nil {
return ctx, err
}
Expand Down Expand Up @@ -141,7 +141,7 @@ func (cd ClobDecorator) AnteHandle(
// IsSingleClobMsgTx returns `true` if the supplied `tx` consist of a single clob message
// (`MsgPlaceOrder` or `MsgCancelOrder`). If `msgs` consist of multiple clob messages,
// or a mix of on-chain and clob messages, an error is returned.
func IsSingleClobMsgTx(ctx sdk.Context, tx sdk.Tx) (bool, error) {
func IsSingleClobMsgTx(tx sdk.Tx) (bool, error) {
msgs := tx.GetMsgs()
var hasMessage = false

Expand Down
3 changes: 1 addition & 2 deletions protocol/x/clob/ante/clob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,9 @@ func TestIsClobTransaction(t *testing.T) {
err := builder.SetMsgs(tc.msgs...)
require.NoError(t, err)
tx := builder.GetTx()
ctx, _, _ := sdktest.NewSdkContextWithMultistore()

// Invoke the function under test.
result, err := ante.IsSingleClobMsgTx(ctx, tx)
result, err := ante.IsSingleClobMsgTx(tx)

// Assert the results.
require.Equal(t, tc.expectedResult, result)
Expand Down

0 comments on commit c79377e

Please sign in to comment.