diff --git a/config/config.go b/config/config.go index c768b00b2fe..958820a86f3 100644 --- a/config/config.go +++ b/config/config.go @@ -792,14 +792,13 @@ func DefaultMempoolConfig() *MempoolConfig { WalPath: "", // Each signature verification takes .5ms, Size reduced until we implement // ABCI Recheck - Size: 5000, - MaxTxsBytes: 1024 * 1024 * 1024, // 1GB - CacheSize: 10000, - MaxTxBytes: 1024 * 1024, // 1MB - TTLDuration: 0 * time.Second, - TTLNumBlocks: 0, - // Note this is true to avoid re-processing invalid order transactions more than once. - KeepInvalidTxsInCache: true, + Size: 5000, + MaxTxsBytes: 1024 * 1024 * 1024, // 1GB + CacheSize: 10000, + MaxTxBytes: 1024 * 1024, // 1MB + TTLDuration: 0 * time.Second, + TTLNumBlocks: 0, + KeepInvalidTxsInCache: false, } } diff --git a/mempool/dydx_helpers.go b/mempool/dydx_helpers.go index 8ec554e3153..18513b1847b 100644 --- a/mempool/dydx_helpers.go +++ b/mempool/dydx_helpers.go @@ -19,7 +19,8 @@ func IsClobOrderTransaction( return false } - if len(cosmosTx.Body.Messages) == 1 && + if cosmosTx.Body != nil && + len(cosmosTx.Body.Messages) == 1 && (cosmosTx.Body.Messages[0].TypeUrl == "/dydxprotocol.clob.MsgPlaceOrder" || cosmosTx.Body.Messages[0].TypeUrl == "/dydxprotocol.clob.MsgCancelOrder") { return true diff --git a/state/execution_test.go b/state/execution_test.go index 5ae3c3c8723..23a602606ea 100644 --- a/state/execution_test.go +++ b/state/execution_test.go @@ -562,11 +562,13 @@ func TestEndBlockValidatorUpdatesResultingInEmptySet(t *testing.T) { stateStore := sm.NewStore(stateDB, sm.StoreOptions{ DiscardABCIResponses: false, }) + mempoolMock := new(mpmocks.Mempool) + blockExec := sm.NewBlockExecutor( stateStore, log.TestingLogger(), proxyApp.Consensus(), - new(mpmocks.Mempool), + mempoolMock, sm.EmptyEvidencePool{}, ) @@ -582,6 +584,11 @@ func TestEndBlockValidatorUpdatesResultingInEmptySet(t *testing.T) { {PubKey: vp, Power: 0}, } + // dYdX fork: Apply block should lock/unlock the mempool. + mempoolMock.On("Lock").Return() + mempoolMock.On("Unlock").Return() + mempoolMock.On("FlushAppConn").Return(nil) + assert.NotPanics(t, func() { state, _, err = blockExec.ApplyBlock(state, blockID, block) }) assert.NotNil(t, err) assert.NotEmpty(t, state.NextValidators.Validators)