Skip to content

Commit

Permalink
fix: when closing a market remove AMMs entirely from engine
Browse files Browse the repository at this point in the history
  • Loading branch information
wwestgarth committed Aug 14, 2024
1 parent 2bfad77 commit 9048e7d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
- [11526](https://github.com/vegaprotocol/vega/issues/11526) - `EstimateAMMBounds` now respects the market's decimal places.
- [11486](https://github.com/vegaprotocol/vega/issues/11486) - `AMMs` can now be submitted on markets with more decimal places than asset decimal places.
- [11561](https://github.com/vegaprotocol/vega/issues/11561) - Failing amends on `AMMs` now restore original properly.
- [11583](https://github.com/vegaprotocol/vega/issues/11583) - Remove `AMMs` entirely from engine when market closes.
- [11568](https://github.com/vegaprotocol/vega/issues/11568) - order book shape on closing `AMM` no longer panics.
- [11540](https://github.com/vegaprotocol/vega/issues/11540) - Fix spam check for spots to use not double count quantum.
- [11542](https://github.com/vegaprotocol/vega/issues/11542) - Fix non determinism in lottery ranking.
Expand Down
4 changes: 4 additions & 0 deletions core/execution/amm/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,10 @@ func (e *Engine) MarketClosing(ctx context.Context) error {
e.sendUpdate(ctx, p)
e.marketActivityTracker.RemoveAMMParty(e.assetID, e.marketID, p.AMMParty)
}

e.pools = nil
e.poolsCpy = nil
e.ammParties = nil
return nil
}

Expand Down
6 changes: 3 additions & 3 deletions core/execution/amm/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -656,9 +656,9 @@ func testMarketClosure(t *testing.T) {
}

require.NoError(t, tst.engine.MarketClosing(ctx))
for _, p := range tst.engine.poolsCpy {
assert.Equal(t, types.AMMPoolStatusStopped, p.status)
}
require.Equal(t, 0, len(tst.engine.pools))
require.Equal(t, 0, len(tst.engine.poolsCpy))
require.Equal(t, 0, len(tst.engine.ammParties))
}

func expectSubaccountCreation(t *testing.T, tst *tstEngine, party, subAccount string) {
Expand Down

0 comments on commit 9048e7d

Please sign in to comment.