From 6ff4785a27c2ea908d704606b18693e28dfd08cf Mon Sep 17 00:00:00 2001 From: Bryce Neal Date: Thu, 2 Feb 2023 18:15:04 -0500 Subject: [PATCH] Fix broken CI and unit tests (#1) * Test commit * empty commit to trigger build * empty commit to trigger build * Fix TestEndBlockValidatorUpdatesResultingInEmptySet * Fix test failures * Add replace using tm-db v0.6.6 * Remove test comment --- config/config.go | 15 +++++++-------- mempool/dydx_helpers.go | 3 ++- state/execution_test.go | 9 ++++++++- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/config/config.go b/config/config.go index c768b00b2f..958820a86f 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 8ec554e315..18513b1847 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 5ae3c3c872..23a602606e 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)