Skip to content

Commit 414d453

Browse files
authored
Merge branch 'develop' into rebate_remove_invariant
2 parents b1bc182 + dea2d94 commit 414d453

File tree

7 files changed

+30
-9
lines changed

7 files changed

+30
-9
lines changed

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,24 @@
2222
- [11535](https://github.com/vegaprotocol/vega/issues/11535) - Added support for lottery rank distribution strategy.
2323
- [11536](https://github.com/vegaprotocol/vega/issues/11536) - Make the batch market instructions errors programmatically usable.
2424
- [11546](https://github.com/vegaprotocol/vega/issues/11546) - Add validation to market proposals metadata.
25-
- [11562](https://github.com/vegaprotocol/vega/issues/11562) - Update average notional metric with mark price at the end of the epoch and when calculating live score.
25+
- [11562](https://github.com/vegaprotocol/vega/issues/11562) - Update average notional metric with mark price at the end of the epoch and when calculating live score.
2626
- [11570](https://github.com/vegaprotocol/vega/issues/11570) - Include the required set of parties for evaluation for eligible entities reward.
2727
- [11576](https://github.com/vegaprotocol/vega/issues/11576) - Replace additional rebate validation with a cap.
28-
28+
29+
2930
### 🐛 Fixes
3031

3132
- [11521](https://github.com/vegaprotocol/vega/issues/11521) - Restore `AMM` position factor when loading from a snapshot.
3233
- [11526](https://github.com/vegaprotocol/vega/issues/11526) - `EstimateAMMBounds` now respects the market's decimal places.
3334
- [11486](https://github.com/vegaprotocol/vega/issues/11486) - `AMMs` can now be submitted on markets with more decimal places than asset decimal places.
3435
- [11561](https://github.com/vegaprotocol/vega/issues/11561) - Failing amends on `AMMs` now restore original properly.
36+
- [11583](https://github.com/vegaprotocol/vega/issues/11583) - Remove `AMMs` entirely from engine when market closes.
3537
- [11568](https://github.com/vegaprotocol/vega/issues/11568) - order book shape on closing `AMM` no longer panics.
3638
- [11540](https://github.com/vegaprotocol/vega/issues/11540) - Fix spam check for spots to use not double count quantum.
3739
- [11542](https://github.com/vegaprotocol/vega/issues/11542) - Fix non determinism in lottery ranking.
3840
- [11544](https://github.com/vegaprotocol/vega/issues/11544) - Fix empty candles stream.
41+
- [11579](https://github.com/vegaprotocol/vega/issues/11579) - Spot calculate fee on amend, use order price if no amended price is provided.
42+
- [11585](https://github.com/vegaprotocol/vega/issues/11585) - Initialise rebate stats service in API.
3943

4044

4145
## 0.77.5

cmd/data-node/commands/start/node.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ func (l *NodeCommand) createGRPCServer(config api.Config) *api.GRPCServer {
242242
l.timeWeightedNotionalPositionService,
243243
l.gameScoreService,
244244
l.ammPoolsService,
245+
l.volumeRebateStatsService,
246+
l.volumeRebateProgramService,
245247
)
246248
return grpcServer
247249
}

core/execution/amm/engine.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,10 @@ func (e *Engine) MarketClosing(ctx context.Context) error {
820820
e.sendUpdate(ctx, p)
821821
e.marketActivityTracker.RemoveAMMParty(e.assetID, e.marketID, p.AMMParty)
822822
}
823+
824+
e.pools = nil
825+
e.poolsCpy = nil
826+
e.ammParties = nil
823827
return nil
824828
}
825829

core/execution/amm/engine_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -656,9 +656,9 @@ func testMarketClosure(t *testing.T) {
656656
}
657657

658658
require.NoError(t, tst.engine.MarketClosing(ctx))
659-
for _, p := range tst.engine.poolsCpy {
660-
assert.Equal(t, types.AMMPoolStatusStopped, p.status)
661-
}
659+
require.Equal(t, 0, len(tst.engine.pools))
660+
require.Equal(t, 0, len(tst.engine.poolsCpy))
661+
require.Equal(t, 0, len(tst.engine.ammParties))
662662
}
663663

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

core/execution/spot/market.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2380,13 +2380,13 @@ func (m *Market) validateOrderAmendment(order *types.Order, amendment *types.Ord
23802380
existingHoldingQty, existingHoldingFee := m.orderHoldingTracker.GetCurrentHolding(order.ID)
23812381
oldHoldingRequirement := num.Sum(existingHoldingQty, existingHoldingFee)
23822382
newFeesRequirement := num.UintZero()
2383-
if m.as.InAuction() {
2384-
newFeesRequirement, _ = m.calculateFees(order.Party, remaining, amendment.Price, order.Side)
2385-
}
23862383
price := order.Price
23872384
if amendment.Price != nil {
23882385
price, _ = num.UintFromDecimal(amendment.Price.ToDecimal().Mul(m.priceFactor))
23892386
}
2387+
if m.as.InAuction() {
2388+
newFeesRequirement, _ = m.calculateFees(order.Party, remaining, price, order.Side)
2389+
}
23902390
if order.PeggedOrder != nil {
23912391
p, err := m.getNewPeggedPrice(order)
23922392
if err != nil {

datanode/api/server.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ type GRPCServer struct {
194194
timeWeightedNotionalPositionService *service.TimeWeightedNotionalPosition
195195
gameScoreService *service.GameScore
196196
ammPoolService *service.AMMPools
197+
volumeRebateStatsService *service.VolumeRebateStats
198+
volumeRebateProgramService *service.VolumeRebatePrograms
197199

198200
eventObserver *eventObserver
199201

@@ -266,6 +268,8 @@ func NewGRPCServer(
266268
timeWeightedNotionalPositionService *service.TimeWeightedNotionalPosition,
267269
gameScoreService *service.GameScore,
268270
ammPoolService *service.AMMPools,
271+
volumeRebateStatsService *service.VolumeRebateStats,
272+
volumeRebateProgramsService *service.VolumeRebatePrograms,
269273
) *GRPCServer {
270274
// setup logger
271275
log = log.Named(namedLogger)
@@ -337,7 +341,8 @@ func NewGRPCServer(
337341
timeWeightedNotionalPositionService: timeWeightedNotionalPositionService,
338342
gameScoreService: gameScoreService,
339343
ammPoolService: ammPoolService,
340-
344+
volumeRebateStatsService: volumeRebateStatsService,
345+
volumeRebateProgramService: volumeRebateProgramsService,
341346
eventObserver: &eventObserver{
342347
log: log,
343348
eventService: eventService,
@@ -578,6 +583,8 @@ func (g *GRPCServer) Start(ctx context.Context, lis net.Listener) error {
578583
twNotionalPositionService: g.timeWeightedNotionalPositionService,
579584
gameScoreService: g.gameScoreService,
580585
AMMPoolService: g.ammPoolService,
586+
volumeRebateStatsService: g.volumeRebateStatsService,
587+
volumeRebateProgramService: g.volumeRebateProgramService,
581588
}
582589

583590
protoapi.RegisterTradingDataServiceServer(g.srv, tradingDataSvcV2)

datanode/api/trading_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ func getTestGRPCServer(t *testing.T, ctx context.Context) (tidy func(), conn *gr
163163
gameScoreService := service.NewGameScore(sqlstore.NewGameScores(sqlConn), logger)
164164
ammPoolsService := service.NewAMMPools(sqlstore.NewAMMPools(sqlConn))
165165
sqlMarketDepthService := service.NewMarketDepth(service.NewDefaultConfig().MarketDepth, sqlOrderService, ammPoolsService, nil, nil, nil, nil, logger)
166+
volumeRebateStatsService := service.NewVolumeRebateStats(sqlstore.NewVolumeRebateStats(sqlConn))
167+
volumeRebateProgramssService := service.NewVolumeRebatePrograms(sqlstore.NewVolumeRebatePrograms(sqlConn))
166168

167169
g := api.NewGRPCServer(
168170
logger,
@@ -225,6 +227,8 @@ func getTestGRPCServer(t *testing.T, ctx context.Context) (tidy func(), conn *gr
225227
timeWeightedNotionPositionService,
226228
gameScoreService,
227229
ammPoolsService,
230+
volumeRebateStatsService,
231+
volumeRebateProgramssService,
228232
)
229233
if g == nil {
230234
err = fmt.Errorf("failed to create gRPC server")

0 commit comments

Comments
 (0)