From c79377e2ef52c32bcdf85c8b6b7216f7c4be426f Mon Sep 17 00:00:00 2001 From: roy-dydx <133032749+roy-dydx@users.noreply.github.com> Date: Thu, 8 Feb 2024 17:08:21 -0500 Subject: [PATCH] [OTE-154] Update CLOB IsSingleClobMsgTx to not take ctx (#1059) --- protocol/app/ante/gas.go | 2 +- protocol/x/clob/ante/ante_wrapper.go | 2 +- protocol/x/clob/ante/clob.go | 4 ++-- protocol/x/clob/ante/clob_test.go | 3 +-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/protocol/app/ante/gas.go b/protocol/app/ante/gas.go index 4f7a03c9bd..a7ad92a395 100644 --- a/protocol/app/ante/gas.go +++ b/protocol/app/ante/gas.go @@ -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 } diff --git a/protocol/x/clob/ante/ante_wrapper.go b/protocol/x/clob/ante/ante_wrapper.go index 54b798f452..3f83ecbf8d 100644 --- a/protocol/x/clob/ante/ante_wrapper.go +++ b/protocol/x/clob/ante/ante_wrapper.go @@ -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 } diff --git a/protocol/x/clob/ante/clob.go b/protocol/x/clob/ante/clob.go index 3ad595d42c..4a50e7c28b 100644 --- a/protocol/x/clob/ante/clob.go +++ b/protocol/x/clob/ante/clob.go @@ -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 } @@ -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 diff --git a/protocol/x/clob/ante/clob_test.go b/protocol/x/clob/ante/clob_test.go index 81f50d4d2c..4be60285df 100644 --- a/protocol/x/clob/ante/clob_test.go +++ b/protocol/x/clob/ante/clob_test.go @@ -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)