Skip to content

Commit

Permalink
Merge branch 'develop' into genacc
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyletang authored Oct 13, 2023
2 parents 0483c3b + 264e660 commit 26c4776
Show file tree
Hide file tree
Showing 16 changed files with 2,019 additions and 1,223 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@
- [401](https://github.com/vegaprotocol/OctoberACs/issues/401) - Add integration test for team rewards `0056-REWA-098`
- [400](https://github.com/vegaprotocol/OctoberACs/issues/400) - Add integration test for team rewards `0056-REWA-097`
- [2971](https://github.com/vegaprotocol/system-tests/issues/2971) - Fix margin calculation for `PERPS`.
- [2948](https://github.com/vegaprotocol/system-tests/issues/2948) - Add integration test for failing system test.
- [9541](https://github.com/vegaprotocol/vega/issues/9731) - Add filtering for party to the referral fees API.
- [9541](https://github.com/vegaprotocol/vega/issues/9731) - Add X day aggregate totals for referral set referees.
- [2985](https://github.com/vegaprotocol/system-tests/issues/2985) - Coverage for insurance pool transfers, fix deadlock when terminating pending market through governance.

### 🐛 Fixes

Expand Down Expand Up @@ -300,10 +304,11 @@
- [9734](https://github.com/vegaprotocol/vega/issues/9734) - Fix creation of new account types for existing assets during migration
- [9731](https://github.com/vegaprotocol/vega/issues/9731) - Allow team rewards to apply to all teams.
- [9727](https://github.com/vegaprotocol/vega/issues/9727) - Initialize teams earlier to avoid panic.
- [9746](https://github.com/vegaprotocol/vega/issues/9746) - Fix handling of LP fees reward
- [9746](https://github.com/vegaprotocol/vega/issues/9746) - Fix handling of LP fees reward
- [9747](https://github.com/vegaprotocol/vega/issues/9747) - Return correct destination type
- [9541](https://github.com/vegaprotocol/vega/issues/9731) - Add filtering for party to the referral fees API.
- [9751](https://github.com/vegaprotocol/vega/issues/9751) - Make sure that LP fee party accounts exists.
- [9762](https://github.com/vegaprotocol/vega/issues/9762) - Referral fees API not filtering by party correctly.

## 0.72.1

Expand Down
6 changes: 5 additions & 1 deletion core/execution/future/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -1245,9 +1245,13 @@ func (m *Market) UpdateMarketState(ctx context.Context, changes *types.MarketSta
_ = m.idgen.NextID()
defer func() { m.idgen = nil }()
if changes.UpdateType == types.MarketStateUpdateTypeTerminate {
final := types.MarketStateClosed
if m.mkt.State == types.MarketStatePending || m.mkt.State == types.MarketStateProposed {
final = types.MarketStateCancelled
}
m.uncrossOrderAtAuctionEnd(ctx)
// terminate and settle data (either last traded price for perp, or settlement data provided via governance
m.tradingTerminatedWithFinalState(ctx, types.MarketStateClosed, num.UintZero().Mul(changes.SettlementPrice, m.priceFactor))
m.tradingTerminatedWithFinalState(ctx, final, num.UintZero().Mul(changes.SettlementPrice, m.priceFactor))
} else if changes.UpdateType == types.MarketStateUpdateTypeSuspend {
m.mkt.State = types.MarketStateSuspendedViaGovernance
m.mkt.TradingMode = types.MarketTradingModeSuspendedViaGovernance
Expand Down
109 changes: 109 additions & 0 deletions core/integration/features/auctions/cancel-gfn-auction.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
Feature: When moving into auction, all GFN orders are cancelled

Background:
Given the price monitoring named "my-price-monitoring":
| horizon | probability | auction extension |
| 60 | 0.95 | 240 |
| 600 | 0.99 | 360 |
And the price monitoring named "my-price-monitoring-2":
| horizon | probability | auction extension |
| 60 | 0.95 | 240 |
| 120 | 0.99 | 360 |
And the log normal risk model named "my-log-normal-risk-model":
| risk aversion | tau | mu | r | sigma |
| 0.000001 | 0.00011407711613050422 | 0 | 0.016 | 2.0 |
And the markets:
| id | quote name | asset | risk model | margin calculator | auction duration | fees | price monitoring | data source config | linear slippage factor | quadratic slippage factor | sla params |
| ETH/DEC20 | ETH | ETH | default-log-normal-risk-model | default-margin-calculator | 60 | default-none | my-price-monitoring | default-eth-for-future | 0.01 | 0 | default-futures |
And the following network parameters are set:
| name | value |
| market.auction.minimumDuration | 60 |
| limits.markets.maxPeggedOrders | 2 |


@GFNCancel
Scenario: replicates test_GFN_OrdersCancelledIntoAuction ST - covers 0068-MATC-027 and 0026-AUCT-015
Given the parties deposit on asset's general account the following amount:
| party | asset | amount |
| party1 | ETH | 100000000000 |
| party2 | ETH | 100000000000 |
| party3 | ETH | 100000000000 |
| party4 | ETH | 100000000000 |
| aux | ETH | 100000000000 |
| aux2 | ETH | 100000000000 |
| lpprov | ETH | 100000000000 |

When the parties submit the following liquidity provision:
| id | party | market id | commitment amount | fee | lp type |
| lp1 | lpprov | ETH/DEC20 | 90000000 | 0.1 | submission |
| lp1 | lpprov | ETH/DEC20 | 90000000 | 0.1 | submission |
And the parties place the following pegged iceberg orders:
| party | market id | peak size | minimum visible size | side | pegged reference | volume | offset |
| lpprov | ETH/DEC20 | 2 | 1 | buy | BID | 50 | 100 |
| lpprov | ETH/DEC20 | 2 | 1 | sell | ASK | 50 | 100 |

When the parties place the following orders:
| party | market id | side | volume | price | resulting trades | type | tif |
| aux | ETH/DEC20 | buy | 1 | 1 | 0 | TYPE_LIMIT | TIF_GTC |
| aux | ETH/DEC20 | sell | 1 | 200000 | 0 | TYPE_LIMIT | TIF_GTC |
| aux2 | ETH/DEC20 | buy | 1 | 1000000 | 0 | TYPE_LIMIT | TIF_GTC |
| aux | ETH/DEC20 | sell | 1 | 1000000 | 0 | TYPE_LIMIT | TIF_GTC |

Then the network moves ahead "59" blocks
And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20"

When the parties place the following orders:
| party | market id | side | volume | price | resulting trades | type | tif |
| aux2 | ETH/DEC20 | buy | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC |
| aux | ETH/DEC20 | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC |

Then the opening auction period ends for market "ETH/DEC20"

And the market data for the market "ETH/DEC20" should be:
| mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest |
| 1000 | TRADING_MODE_CONTINUOUS | 60 | 995 | 1005 | 7434 | 90000000 | 10 |
| 1000 | TRADING_MODE_CONTINUOUS | 600 | 978 | 1022 | 7434 | 90000000 | 10 |

# place GFN orders outside of bounds so we can trigger auction without those order uncrossing
When the parties place the following orders:
| party | market id | side | volume | price | resulting trades | type | tif | reference |
| party1 | ETH/DEC20 | buy | 1 | 990 | 0 | TYPE_LIMIT | TIF_GFN | gfn-buy-1 |
| party2 | ETH/DEC20 | sell | 1 | 1010 | 0 | TYPE_LIMIT | TIF_GFN | gfn-sell-1 |
| party4 | ETH/DEC20 | sell | 1 | 1010 | 0 | TYPE_LIMIT | TIF_GTC | gtc-sell-1 |
Then the order book should have the following volumes for market "ETH/DEC20":
| side | volume | price |
| buy | 1 | 1 |
| buy | 2 | 900 |
| buy | 1 | 990 |
| buy | 1 | 1000 |
| sell | 2 | 1010 |
| sell | 2 | 1110 |
| sell | 1 | 200000 |
| sell | 1 | 1000000 |
And the market data for the market "ETH/DEC20" should be:
| mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest |
| 1000 | TRADING_MODE_CONTINUOUS | 60 | 995 | 1005 | 7434 | 90000000 | 10 |
| 1000 | TRADING_MODE_CONTINUOUS | 600 | 978 | 1022 | 7434 | 90000000 | 10 |

When the parties place the following orders:
| party | market id | side | volume | price | resulting trades | type | tif |
| party3 | ETH/DEC20 | buy | 1 | 1010 | 0 | TYPE_LIMIT | TIF_GTC |
Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20"
## The GFN orders will should be removed from the book (buy at 990, sell at 1010)
## the 2 GTC orders that triggered the price auction, however, remain
And the order book should have the following volumes for market "ETH/DEC20":
| side | volume | price |
| buy | 1 | 1 |
| buy | 0 | 900 |
| buy | 0 | 990 |
| buy | 1 | 1000 |
| buy | 1 | 1010 |
| sell | 1 | 1010 |
| sell | 0 | 1110 |
| sell | 1 | 200000 |
| sell | 1 | 1000000 |
And the orders should have the following status:
| party | reference | status |
| party1 | gfn-buy-1 | STATUS_CANCELLED |
| party2 | gfn-sell-1 | STATUS_CANCELLED |
| party4 | gtc-sell-1 | STATUS_ACTIVE |
Loading

0 comments on commit 26c4776

Please sign in to comment.