From d31fa077ea47ee72b61b70980848d741028175f1 Mon Sep 17 00:00:00 2001 From: Lukasz Cwik <126621805+lcwik@users.noreply.github.com> Date: Wed, 7 Feb 2024 09:46:56 -0800 Subject: [PATCH] [STAB-32] Push CheckTx concurrency into protocol (#1030) This pushes locking slightly closer to the CLOB ante decorator hopefully allowing for protocol to control parallelism more finely in the future. --- protocol/app/ante.go | 2 ++ protocol/app/ante_whitebox_test.go | 1 + protocol/go.mod | 2 +- protocol/go.sum | 4 ++-- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/protocol/app/ante.go b/protocol/app/ante.go index ef89349eb6..a0a0e8aab1 100644 --- a/protocol/app/ante.go +++ b/protocol/app/ante.go @@ -2,6 +2,7 @@ package app import ( errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/auth/ante" @@ -50,6 +51,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { // NewAnteDecoratorChain returns a list of AnteDecorators in the expected application chain ordering func NewAnteDecoratorChain(options HandlerOptions) []sdk.AnteDecorator { return []sdk.AnteDecorator{ + baseapp.NewLockAndCacheContextAnteDecorator(), // Note: app-injected messages, and clob transactions don't require Gas fees. libante.NewAppInjectedMsgAnteWrapper( clobante.NewSingleMsgClobTxAnteWrapper( diff --git a/protocol/app/ante_whitebox_test.go b/protocol/app/ante_whitebox_test.go index de4df1ed38..48b28006e2 100644 --- a/protocol/app/ante_whitebox_test.go +++ b/protocol/app/ante_whitebox_test.go @@ -77,6 +77,7 @@ func TestAnteHandlerChainOrder_Valid(t *testing.T) { decoratorTypes := humanReadableDecoratorTypes(decoratorChain) expectedDecoratorTypes := []string{ + "baseapp.lockAndCacheContextDecorator", "ante.AppInjectedMsgAnteWrapper(ante.SingleMsgClobTxAnteWrapper(ante.SetUpContextDecorator))", "ante.FreeInfiniteGasDecorator", "ante.RejectExtensionOptionsDecorator", diff --git a/protocol/go.mod b/protocol/go.mod index ab93232ee3..48a1080a51 100644 --- a/protocol/go.mod +++ b/protocol/go.mod @@ -417,7 +417,7 @@ replace ( // Use dYdX fork of CometBFT github.com/cometbft/cometbft => github.com/dydxprotocol/cometbft v0.38.3-0.20231204185009-5e6c4b6d67b8 // Use dYdX fork of Cosmos SDK - github.com/cosmos/cosmos-sdk => github.com/dydxprotocol/cosmos-sdk v0.50.4-0.20240206213020-ef2fbbac2693 + github.com/cosmos/cosmos-sdk => github.com/dydxprotocol/cosmos-sdk v0.50.4-0.20240206224621-ffeae5184c58 ) replace ( diff --git a/protocol/go.sum b/protocol/go.sum index ff0c1675b7..b1b8334cff 100644 --- a/protocol/go.sum +++ b/protocol/go.sum @@ -537,8 +537,8 @@ github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQx github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= github.com/dydxprotocol/cometbft v0.38.3-0.20231204185009-5e6c4b6d67b8 h1:zmH6go7DRhFcQHoiN/rQ1INaAelp01VUPUTSqSDJsAU= github.com/dydxprotocol/cometbft v0.38.3-0.20231204185009-5e6c4b6d67b8/go.mod h1:KQ8mOea6U2satQbGe2WjxBopa8mGgHatMKS9sQsJ6uY= -github.com/dydxprotocol/cosmos-sdk v0.50.4-0.20240206213020-ef2fbbac2693 h1:FdOhkelNwqyXMP6JFJzi+d9A0cxGJEiieDIkDYtcCa4= -github.com/dydxprotocol/cosmos-sdk v0.50.4-0.20240206213020-ef2fbbac2693/go.mod h1:y+5fRLbztsvx6GHBVXPlgM51ZpuNd8M7y4YEAQNnTPU= +github.com/dydxprotocol/cosmos-sdk v0.50.4-0.20240206224621-ffeae5184c58 h1:3nW+id7dbHUv+RJB2pecjKtA0WWQr3oit4KrxBJ0+kw= +github.com/dydxprotocol/cosmos-sdk v0.50.4-0.20240206224621-ffeae5184c58/go.mod h1:y+5fRLbztsvx6GHBVXPlgM51ZpuNd8M7y4YEAQNnTPU= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-resiliency v1.3.0 h1:RRL0nge+cWGlxXbUzJ7yMcq6w2XBEr19dCN6HECGaT0= github.com/eapache/go-resiliency v1.3.0/go.mod h1:5yPzW0MIvSe0JDsv0v+DvcjEv2FyD6iZYSs1ZI+iQho=