Skip to content

Commit a5d58f3

Browse files
authored
Merge pull request #11475 from vegaprotocol/release/v0.77.1
Release/v0.77.1
2 parents a72ff4b + 3112aa0 commit a5d58f3

30 files changed

+260
-112
lines changed

.spelling

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ clef
2525
codegen
2626
collateralised
2727
cometbft
28+
CometBFT
2829
config
2930
cyclomatic
3031
dApp

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@
1919
- [](https://github.com/vegaprotocol/vega/issues/xxx)
2020

2121

22+
## 0.77.1
23+
24+
### 🛠 Improvements
25+
26+
- [11466](https://github.com/vegaprotocol/vega/issues/11466) - Update CometBFT to version `0.38.10`.
27+
28+
### 🐛 Fixes
29+
30+
- [11453](https://github.com/vegaprotocol/vega/issues/11453) - Fix margin for fully collateralised markets.
31+
- [11462](https://github.com/vegaprotocol/vega/issues/11462) - Update the time weighted notional when publishing live game scores.
32+
33+
2234
## 0.77.0
2335

2436
### 🛠 Improvements
@@ -72,7 +84,6 @@
7284
- [11457](https://github.com/vegaprotocol/vega/issues/11457) - Fix cursor column ordering for game scores.
7385
- [11454](https://github.com/vegaprotocol/vega/issues/11454) - Ensure ended transfers proper handling.
7486

75-
7687
## 0.76.1
7788

7889
### 🐛 Fixes

core/execution/common/market_activity_tracker.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,8 +1186,11 @@ func (mat *MarketActivityTracker) getTWNotionalPosition(asset, party string, mar
11861186

11871187
for _, mkt := range mkts {
11881188
if tracker, ok := mat.getMarketTracker(asset, mkt); ok {
1189-
if twNotional, ok := tracker.twNotional[party]; ok {
1190-
total.AddSum(twNotional.currentEpochTWNotional)
1189+
if len(tracker.epochTimeWeightedNotional) <= 0 {
1190+
continue
1191+
}
1192+
if twNotional, ok := tracker.epochTimeWeightedNotional[len(tracker.epochTimeWeightedNotional)-1][party]; ok {
1193+
total.AddSum(twNotional)
11911194
}
11921195
}
11931196
}

core/execution/common/market_activity_tracker_internal_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ func TestAverageNotional(t *testing.T) {
321321
// (( 116 * 5000000 ) + ( 600 * 5000000 )) / 10000000 = 358
322322
tracker.processNotionalEndOfEpoch(time.Unix(0, 0), time.Unix(60, 0))
323323
require.Equal(t, "358", tracker.twNotional["p1"].currentEpochTWNotional.String())
324+
require.Equal(t, "358", tracker.epochTimeWeightedNotional[len(tracker.epochTimeWeightedNotional)-1]["p1"].String())
324325

325326
// epoch 2
326327
// (( 358 * 0 ) + ( 600 * 10000000 )) / 10000000 = 600
@@ -330,12 +331,14 @@ func TestAverageNotional(t *testing.T) {
330331
// (( 600 * 5000000 ) + ( 300 * 5000000 )) / 10000000 = 450
331332
tracker.processNotionalEndOfEpoch(time.Unix(60, 0), time.Unix(120, 0))
332333
require.Equal(t, "450", tracker.twNotional["p1"].currentEpochTWNotional.String())
334+
require.Equal(t, "450", tracker.epochTimeWeightedNotional[len(tracker.epochTimeWeightedNotional)-1]["p1"].String())
333335

334336
// epoch 3
335337
// no position changes over the epoch
336338
// (( 450 * 0 ) + ( 300 * 10000000 )) / 10000000 = 300
337339
tracker.processNotionalEndOfEpoch(time.Unix(120, 0), time.Unix(180, 0))
338340
require.Equal(t, "300", tracker.twNotional["p1"].currentEpochTWNotional.String())
341+
require.Equal(t, "300", tracker.epochTimeWeightedNotional[len(tracker.epochTimeWeightedNotional)-1]["p1"].String())
339342
}
340343

341344
func TestCalculateMetricForIndividualsAvePosition(t *testing.T) {

core/integration/features/capped-futures/0016-PFUT-020-ignore.feature

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Feature: When binary settlement is enabled, the market ignored oracle data that
4949
| ETH/DEC22 | ETH | USD | simple-risk-model-1 | default-margin-calculator | 1 | fees-config-1 | price-monitoring-1 | ethDec22Oracle | 0.25 | 0 | default-futures | 1500 | false | true |
5050
| ETH/DEC23 | ETH | USD | lognormal-risk-model-1 | default-margin-calculator | 1 | fees-config-1 | price-monitoring-1 | default-eth-for-future | 0.25 | 0 | default-futures | 1500 | true | true |
5151

52-
@NoPerp @Capped @CBin
52+
@NoPerp @Capped @CBin @CappedBug
5353
Scenario: 0016-PFUT-020: Pass in settlement prices that are neither 0 nor max price, then settle at valid prices.
5454
Given the initial insurance pool balance is "10000" for all the markets
5555
And the parties deposit on asset's general account the following amount:
@@ -157,16 +157,16 @@ Feature: When binary settlement is enabled, the market ignored oracle data that
157157
And the market state should be "STATE_TRADING_TERMINATED" for the market "ETH/DEC22"
158158
And the parties should have the following account balances:
159159
| party | asset | market id | margin | general |
160-
| party1 | USD | ETH/DEC21 | 5000 | 5500 |
161-
| party2 | USD | ETH/DEC21 | 2500 | 7000 |
160+
| party1 | USD | ETH/DEC21 | 5500 | 5000 |
161+
| party2 | USD | ETH/DEC21 | 2000 | 7500 |
162162
| party3 | USD | ETH/DEC22 | 3200 | 7300 |
163163
| party4 | USD | ETH/DEC22 | 2310 | 7190 |
164164
| aux1 | USD | ETH/DEC21 | 3098 | 96908 |
165165
| aux2 | USD | ETH/DEC21 | 402 | 99570 |
166166
| aux5 | USD | ETH/DEC22 | 1122 | 98884 |
167167
| aux6 | USD | ETH/DEC22 | 726 | 99246 |
168-
| party5 | USD | ETH/DEC23 | 5000 | 5500 |
169-
| party6 | USD | ETH/DEC23 | 2500 | 7000 |
168+
| party5 | USD | ETH/DEC23 | 5500 | 5000 |
169+
| party6 | USD | ETH/DEC23 | 2000 | 7500 |
170170
| aux3 | USD | ETH/DEC23 | 3098 | 96908 |
171171
| aux4 | USD | ETH/DEC23 | 402 | 99570 |
172172

core/integration/features/capped-futures/0016-PFUT-021.feature

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Feature: When `max_price` is specified and the market is ran in a fully-collater
3535
| id | quote name | asset | risk model | margin calculator | auction duration | fees | price monitoring | data source config | linear slippage factor | quadratic slippage factor | sla params | max price cap | fully collateralised | binary |
3636
| ETH/DEC21 | ETH | USD | lognormal-risk-model-1 | default-capped-margin-calculator | 1 | fees-config-1 | price-monitoring-1 | ethDec21Oracle | 0.25 | 0 | default-futures | 1500 | true | false |
3737

38-
@SLABug @NoPerp @Capped @CMargin
38+
@SLABug @NoPerp @Capped @CMargin @CappedBug
3939
Scenario: 0016-PFUT-021: parties with open positions settling it at a price of `max_price`
4040
Given the initial insurance pool balance is "10000" for all the markets
4141
And the parties deposit on asset's general account the following amount:
@@ -97,8 +97,8 @@ Feature: When `max_price` is specified and the market is ran in a fully-collater
9797
# aux2's short position and potential margins are calculated separately as 2 * (1500-1301) + 1 * (1500 - 1100) = 398 + 400 = 798
9898
And the parties should have the following account balances:
9999
| party | asset | market id | margin | general |
100-
| party1 | USD | ETH/DEC21 | 5000 | 5500 |
101-
| party2 | USD | ETH/DEC21 | 2500 | 7000 |
100+
| party1 | USD | ETH/DEC21 | 5500 | 5000 |
101+
| party2 | USD | ETH/DEC21 | 2000 | 7500 |
102102
| aux1 | USD | ETH/DEC21 | 3098 | 96908 |
103103
| aux2 | USD | ETH/DEC21 | 402 | 99570 |
104104
# The market is fully collateralised, switching to isolated margin is not supported
@@ -126,18 +126,18 @@ Feature: When `max_price` is specified and the market is ran in a fully-collater
126126
# aux2: short position of size 2, traded price at 1500, then margin: postion size * (max price - average entry price) = 3*(1100+1500*2)/3
127127
And the parties should have the following account balances:
128128
| party | asset | market id | margin | general |
129-
| party1 | USD | ETH/DEC21 | 5000 | 7495 |
130-
| party2 | USD | ETH/DEC21 | 2500 | 5005 |
131-
| aux1 | USD | ETH/DEC21 | 3098 | 97307 |
132-
| aux2 | USD | ETH/DEC21 | 402 | 99186 |
129+
| party1 | USD | ETH/DEC21 | 7495 | 5000 |
130+
| party2 | USD | ETH/DEC21 | 5 | 7500 |
131+
| aux1 | USD | ETH/DEC21 | 3497 | 96908 |
132+
| aux2 | USD | ETH/DEC21 | 3 | 99585 |
133133
| aux3 | USD | ETH/DEC21 | 2998 | 96927 |
134134

135135
And the parties should have the following margin levels:
136136
| party | market id | maintenance | search | initial | release | margin mode |
137-
| party1 | ETH/DEC21 | 5000 | 5000 | 5000 | 5000 | cross margin |
138-
| party2 | ETH/DEC21 | 2500 | 2500 | 2500 | 2500 | cross margin |
139-
| aux2 | ETH/DEC21 | 402 | 402 | 402 | 402 | cross margin |
140-
| aux1 | ETH/DEC21 | 3098 | 3098 | 3098 | 3098 | cross margin |
137+
| party1 | ETH/DEC21 | 7495 | 7495 | 7495 | 7495 | cross margin |
138+
| party2 | ETH/DEC21 | 5 | 5 | 5 | 5 | cross margin |
139+
| aux2 | ETH/DEC21 | 3 | 3 | 3 | 3 | cross margin |
140+
| aux1 | ETH/DEC21 | 3497 | 3497 | 3497 | 3497 | cross margin |
141141

142142
#0016-PFUT-024: trade at max_price, no closeout for parties with short position
143143
When the parties place the following orders:
@@ -148,10 +148,10 @@ Feature: When `max_price` is specified and the market is ran in a fully-collater
148148
And the network moves ahead "2" blocks
149149

150150
# aux5: short position of size 2, traded price at 1500, then margin: postion size * (max price - average entry price) = 0
151-
And the parties should have the following account balances:
151+
Then the parties should have the following account balances:
152152
| party | asset | market id | margin | general |
153-
| aux1 | USD | ETH/DEC21 | 3098 | 97307 |
154-
| aux2 | USD | ETH/DEC21 | 402 | 99186 |
153+
| aux1 | USD | ETH/DEC21 | 3497 | 96908 |
154+
| aux2 | USD | ETH/DEC21 | 3 | 99585 |
155155
| aux4 | USD | ETH/DEC21 | 2998 | 97017 |
156156
| aux5 | USD | ETH/DEC21 | 2 | 99923 |
157157

core/integration/features/capped-futures/0016-PFUT-022-max.feature

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Feature: When max_price is specified and the market is ran in a fully-collateral
3535
| id | quote name | asset | risk model | margin calculator | auction duration | fees | price monitoring | data source config | linear slippage factor | quadratic slippage factor | sla params | max price cap | fully collateralised | binary |
3636
| ETH/DEC21 | ETH | USD | lognormal-risk-model-1 | default-capped-margin-calculator | 1 | fees-config-1 | price-monitoring-1 | ethDec21Oracle | 0.25 | 0 | default-futures | 1500 | true | false |
3737

38-
@NoPerp @Capped @CSettle
38+
@NoPerp @Capped @CSettle @CappedBug
3939
Scenario: 0016-PFUT-022: Same as the settlement at price 0 test, only with a settlement at max price.
4040
Given the initial insurance pool balance is "10000" for all the markets
4141
And the parties deposit on asset's general account the following amount:
@@ -97,8 +97,8 @@ Feature: When max_price is specified and the market is ran in a fully-collateral
9797
# aux2's short position and potential margins are calculated separately as 2 * (1500-1301) + 1 * (1500 - 1100) = 398 + 400 = 798
9898
And the parties should have the following account balances:
9999
| party | asset | market id | margin | general |
100-
| party1 | USD | ETH/DEC21 | 5000 | 5500 |
101-
| party2 | USD | ETH/DEC21 | 2500 | 7000 |
100+
| party1 | USD | ETH/DEC21 | 5500 | 5000 |
101+
| party2 | USD | ETH/DEC21 | 2000 | 7500 |
102102
| aux1 | USD | ETH/DEC21 | 3098 | 96908 |
103103
| aux2 | USD | ETH/DEC21 | 402 | 99570 |
104104
# The market is fully collateralised, switching to isolated margin is not supported
@@ -126,18 +126,18 @@ Feature: When max_price is specified and the market is ran in a fully-collateral
126126
# aux2: short position of size 2, traded price at 1500, then margin: postion size * (max price - average entry price) = 3*(1100+1500*2)/3
127127
And the parties should have the following account balances:
128128
| party | asset | market id | margin | general |
129-
| party1 | USD | ETH/DEC21 | 5000 | 7495 |
130-
| party2 | USD | ETH/DEC21 | 2500 | 5005 |
131-
| aux1 | USD | ETH/DEC21 | 3098 | 97307 |
132-
| aux2 | USD | ETH/DEC21 | 402 | 99186 |
129+
| party1 | USD | ETH/DEC21 | 7495 | 5000 |
130+
| party2 | USD | ETH/DEC21 | 5 | 7500 |
131+
| aux1 | USD | ETH/DEC21 | 3497 | 96908 |
132+
| aux2 | USD | ETH/DEC21 | 3 | 99585 |
133133
| aux3 | USD | ETH/DEC21 | 2998 | 96927 |
134134

135135
And the parties should have the following margin levels:
136136
| party | market id | maintenance | search | initial | release | margin mode |
137-
| party1 | ETH/DEC21 | 5000 | 5000 | 5000 | 5000 | cross margin |
138-
| party2 | ETH/DEC21 | 2500 | 2500 | 2500 | 2500 | cross margin |
139-
| aux2 | ETH/DEC21 | 402 | 402 | 402 | 402 | cross margin |
140-
| aux1 | ETH/DEC21 | 3098 | 3098 | 3098 | 3098 | cross margin |
137+
| party1 | ETH/DEC21 | 7495 | 7495 | 7495 | 7495 | cross margin |
138+
| party2 | ETH/DEC21 | 5 | 5 | 5 | 5 | cross margin |
139+
| aux2 | ETH/DEC21 | 3 | 3 | 3 | 3 | cross margin |
140+
| aux1 | ETH/DEC21 | 3497 | 3497 | 3497 | 3497 | cross margin |
141141
#trade at max_price
142142
When the parties place the following orders:
143143
| party | market id | side | volume | price | resulting trades | type | tif | reference |
@@ -178,12 +178,12 @@ Feature: When max_price is specified and the market is ran in a fully-collateral
178178
| market | aux3 | ACCOUNT_TYPE_SETTLEMENT | ACCOUNT_TYPE_MARGIN | ETH/DEC21 | 2 | USD | TRANSFER_TYPE_WIN |
179179
| market | aux4 | ACCOUNT_TYPE_SETTLEMENT | ACCOUNT_TYPE_MARGIN | ETH/DEC21 | 2 | USD | TRANSFER_TYPE_WIN |
180180
| market | party1 | ACCOUNT_TYPE_SETTLEMENT | ACCOUNT_TYPE_MARGIN | ETH/DEC21 | 5 | USD | TRANSFER_TYPE_WIN |
181-
| aux1 | aux1 | ACCOUNT_TYPE_MARGIN | ACCOUNT_TYPE_GENERAL | ETH/DEC21 | 3099 | USD | TRANSFER_TYPE_CLEAR_ACCOUNT |
182-
| aux2 | aux2 | ACCOUNT_TYPE_MARGIN | ACCOUNT_TYPE_GENERAL | ETH/DEC21 | 399 | USD | TRANSFER_TYPE_CLEAR_ACCOUNT |
181+
| aux1 | aux1 | ACCOUNT_TYPE_MARGIN | ACCOUNT_TYPE_GENERAL | ETH/DEC21 | 3498 | USD | TRANSFER_TYPE_CLEAR_ACCOUNT |
182+
| aux2 | aux2 | ACCOUNT_TYPE_MARGIN | ACCOUNT_TYPE_GENERAL | ETH/DEC21 | 0 | USD | TRANSFER_TYPE_CLEAR_ACCOUNT |
183183
| aux3 | aux3 | ACCOUNT_TYPE_MARGIN | ACCOUNT_TYPE_GENERAL | ETH/DEC21 | 3000 | USD | TRANSFER_TYPE_CLEAR_ACCOUNT |
184184
| aux4 | aux4 | ACCOUNT_TYPE_MARGIN | ACCOUNT_TYPE_GENERAL | ETH/DEC21 | 3000 | USD | TRANSFER_TYPE_CLEAR_ACCOUNT |
185185
| aux5 | aux5 | ACCOUNT_TYPE_MARGIN | ACCOUNT_TYPE_GENERAL | ETH/DEC21 | 0 | USD | TRANSFER_TYPE_CLEAR_ACCOUNT |
186-
| party1 | party1 | ACCOUNT_TYPE_MARGIN | ACCOUNT_TYPE_GENERAL | ETH/DEC21 | 5005 | USD | TRANSFER_TYPE_CLEAR_ACCOUNT |
186+
| party1 | party1 | ACCOUNT_TYPE_MARGIN | ACCOUNT_TYPE_GENERAL | ETH/DEC21 | 7500 | USD | TRANSFER_TYPE_CLEAR_ACCOUNT |
187187
| party-lp | party-lp | ACCOUNT_TYPE_BOND | ACCOUNT_TYPE_GENERAL | ETH/DEC21 | 30000 | USD | TRANSFER_TYPE_CLEAR_ACCOUNT |
188188
And the parties should have the following account balances:
189189
| party | asset | market id | margin | general |

0 commit comments

Comments
 (0)