Skip to content

Commit

Permalink
Fix broken CI and unit tests (#1)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
prettymuchbryce authored and roy-dydx committed Jun 30, 2023
1 parent e1504c7 commit 2601e72
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
15 changes: 7 additions & 8 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand Down
3 changes: 2 additions & 1 deletion mempool/dydx_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion state/execution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{},
)

Expand All @@ -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)
Expand Down

0 comments on commit 2601e72

Please sign in to comment.