From 7c7e2abfd92bccde2b8b85a0957e138b4880101b Mon Sep 17 00:00:00 2001 From: Jeremy Letang Date: Mon, 13 May 2024 15:42:48 +0200 Subject: [PATCH 01/19] chore: add setting for arbitrum bridge of the validators testnet Signed-off-by: Jeremy Letang --- core/netparams/bridge_mapping.go | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/core/netparams/bridge_mapping.go b/core/netparams/bridge_mapping.go index d7b7c99f108..99cfeba4949 100644 --- a/core/netparams/bridge_mapping.go +++ b/core/netparams/bridge_mapping.go @@ -52,11 +52,29 @@ var testnet = `{ } ] }` +var validatorsTestnet = `{ + "configs": [ + { + "network_id": "421614", + "chain_id": "421614", + "collateral_bridge_contract": { + "address": "0x927067717B0A9bd553fC421Ae63b3377694b4166" + }, + "confirmations": 3, + "multisig_control_contract": { + "address": "0x752faCb1e1EEf7A5a154db5Bf54988E80b0e96Da", + "deployment_block_height": 43630575 + }, + "block_time": "250ms", + "name": "Arbitrum (Sepolia)" + } + ] +}` var bridgeMapping = map[string]string{ "vega-stagnet1-202307191148": stagnet1, "vega-fairground-202305051805": testnet, "vega-mainnet-mirror-202306231148": "{}", - "vega-testnet-0002-v4": "{}", + "vega-testnet-0002-v4": validatorsTestnet, "vega-mainnet-0011": "{}", } From 03b90de2ee86b8f6023f9e5cae86e70af6bd4eea Mon Sep 17 00:00:00 2001 From: Jeremy Letang Date: Fri, 10 May 2024 16:12:16 +0200 Subject: [PATCH 02/19] Merge pull request #11262 from vegaprotocol/feature-test-0032-PRIM-033 Adding feature test for 0032-PRIM-003 and bug fix --- CHANGELOG.md | 1 + core/execution/common/interfaces.go | 2 +- core/execution/future/market.go | 2 +- core/execution/spot/market.go | 2 +- ...d-long-auction-with-trigger-change.feature | 46 +++++-- .../spot/orders/0032-PRIM-033.feature | 112 ++++++++++++++++++ core/monitor/price/pricemonitoring.go | 12 +- core/monitor/price/pricemonitoring_test.go | 13 ++ core/monitor/price/snapshot_test.go | 1 + 9 files changed, 171 insertions(+), 20 deletions(-) create mode 100644 core/integration/features/spot/orders/0032-PRIM-033.feature diff --git a/CHANGELOG.md b/CHANGELOG.md index c3984dc34bb..a98b02a00a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ - [11250](https://github.com/vegaprotocol/vega/issues/11250) - Add missing dispatch strategy in transfer proposal. - [11252](https://github.com/vegaprotocol/vega/issues/11252) - Treat no position as zero position when calculating stop order overrides. - [11249](https://github.com/vegaprotocol/vega/issues/11249) - Composite mark price oracles are now deactivated when a market is rejected. +- [11262](https://github.com/vegaprotocol/vega/pull/11262) - Fix auction extensions after risk parameter update. ## 0.76.0 diff --git a/core/execution/common/interfaces.go b/core/execution/common/interfaces.go index 3ab1f1cbe46..e2060af3160 100644 --- a/core/execution/common/interfaces.go +++ b/core/execution/common/interfaces.go @@ -59,7 +59,7 @@ type PriceMonitor interface { Changed() bool IsBoundFactorsInitialised() bool Initialised() bool - UpdateSettings(risk.Model, *types.PriceMonitoringSettings) + UpdateSettings(risk.Model, *types.PriceMonitoringSettings, price.AuctionState) } // TimeService ... diff --git a/core/execution/future/market.go b/core/execution/future/market.go index 5bb8a65dce0..90e28d6d3fc 100644 --- a/core/execution/future/market.go +++ b/core/execution/future/market.go @@ -602,7 +602,7 @@ func (m *Market) Update(ctx context.Context, config *types.Market, oracleEngine m.risk.UpdateModel(m.stateVarEngine, m.tradableInstrument.MarginCalculator, m.tradableInstrument.RiskModel, m.mkt.LinearSlippageFactor, m.mkt.QuadraticSlippageFactor) m.settlement.UpdateProduct(m.tradableInstrument.Instrument.Product) m.tsCalc.UpdateParameters(*m.mkt.LiquidityMonitoringParameters.TargetStakeParameters) - m.pMonitor.UpdateSettings(m.tradableInstrument.RiskModel, m.mkt.PriceMonitoringSettings) + m.pMonitor.UpdateSettings(m.tradableInstrument.RiskModel, m.mkt.PriceMonitoringSettings, m.as) m.liquidity.UpdateMarketConfig(m.tradableInstrument.RiskModel, m.pMonitor) if err := m.markPriceCalculator.UpdateConfig(ctx, oracleEngine, m.mkt.MarkPriceConfiguration); err != nil { m.markPriceCalculator.SetOraclePriceScalingFunc(m.scaleOracleData) diff --git a/core/execution/spot/market.go b/core/execution/spot/market.go index cf71a400d26..ac3e0e0cc12 100644 --- a/core/execution/spot/market.go +++ b/core/execution/spot/market.go @@ -292,7 +292,7 @@ func (m *Market) Update(ctx context.Context, config *types.Market) error { if err != nil { return err } - m.pMonitor.UpdateSettings(riskModel, m.mkt.PriceMonitoringSettings) + m.pMonitor.UpdateSettings(riskModel, m.mkt.PriceMonitoringSettings, m.as) m.liquidity.UpdateMarketConfig(riskModel, m.pMonitor) m.updateLiquidityFee(ctx) diff --git a/core/integration/features/price_monitoring/end-long-auction-with-trigger-change.feature b/core/integration/features/price_monitoring/end-long-auction-with-trigger-change.feature index dba28256f0f..a053e359dd8 100644 --- a/core/integration/features/price_monitoring/end-long-auction-with-trigger-change.feature +++ b/core/integration/features/price_monitoring/end-long-auction-with-trigger-change.feature @@ -114,16 +114,16 @@ Feature: Confirm return to continuous trading during significant mark price chan | ETH/FEB23 | my-price-monitoring-2 | weight | 0,0,1,0 | 0s,0s,0h0m120s,0s | # first we get bounds based on default factors, once the state variable engine finishes its calculation we get the proper values Then the market data for the market "ETH/FEB23" should be: - | mark price | trading mode | auction trigger | horizon | ref price | min bound | max bound | - | 1000 | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | 30 | 1000 | 900 | 1100 | + | mark price | trading mode | auction trigger | + | 1000 | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | # the last second of the original extensions And the network moves ahead "3" blocks Then the market data for the market "ETH/FEB23" should be: - | mark price | trading mode | auction trigger | horizon | ref price | min bound | max bound | - | 1000 | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | 30 | 1000 | 997 | 1003 | + | mark price | trading mode | auction trigger | + | 1000 | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | - # the updated extension triggered, no triggers left + # the updated extension triggered, no triggers left as they've all been switched off since update took place during auction And the network moves ahead "1" blocks Then the market data for the market "ETH/FEB23" should be: | mark price | trading mode | auction trigger | @@ -174,15 +174,15 @@ Feature: Confirm return to continuous trading during significant mark price chan # the last second of the original extensions And the network moves ahead "3" blocks Then the market data for the market "ETH/FEB23" should be: - | mark price | trading mode | auction trigger | horizon | ref price | min bound | max bound | - | 1000 | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | 30 | 1000 | 997 | 1003 | + | mark price | trading mode | auction trigger | + | 1000 | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | When the parties place the following orders with ticks: | party | market id | side | volume | price | resulting trades | type | tif | | party1 | ETH/FEB23 | buy | 1 | 2004 | 0 | TYPE_LIMIT | TIF_GTC | | party2 | ETH/FEB23 | sell | 1 | 2004 | 0 | TYPE_LIMIT | TIF_GTC | - # the updated extension triggered, no triggers left + # the updated extension triggered, no triggers left as they've all been switched off since update took place during auction And the network moves ahead "1" blocks Then the market data for the market "ETH/FEB23" should be: | mark price | trading mode | auction trigger | @@ -217,14 +217,14 @@ Feature: Confirm return to continuous trading during significant mark price chan # the last second of the original extensions And the network moves ahead "3" blocks Then the market data for the market "ETH/FEB23" should be: - | mark price | trading mode | auction trigger | horizon | ref price | min bound | max bound | - | 1000 | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | 30 | 1000 | 997 | 1003 | + | mark price | trading mode | auction trigger | + | 1000 | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | When the oracles broadcast data with block time signed with "0xCAFECAFE1": | name | value | time offset | | prices.ETH.value | 2000 | -1s | - # the updated extension triggered, no triggers left + # the updated extension triggered, no triggers left as they've all been switched off since update took place during auction And the network moves ahead "1" blocks Then the market data for the market "ETH/FEB23" should be: | mark price | trading mode | auction trigger | @@ -253,4 +253,26 @@ Feature: Confirm return to continuous trading during significant mark price chan And the network moves ahead "118" blocks Then the market data for the market "ETH/FEB23" should be: | mark price | trading mode | auction trigger | last traded price | horizon | ref price | min bound | max bound | - | 1000 | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 1003 | 30 | 1003 | 1000 | 1006 | \ No newline at end of file + | 1000 | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 1003 | 30 | 1003 | 1000 | 1006 | + + Scenario: Verify that trigger update in continuous trading works as expected + + When the network moves ahead "2" blocks + Then the market data for the market "ETH/FEB23" should be: + | mark price | trading mode | horizon | ref price | min bound | max bound | + | 1000 | TRADING_MODE_CONTINUOUS | 60 | 1000 | 995 | 1005 | + + And the price monitoring named "my-price-monitoring-2": + | horizon | probability | auction extension | + | 30 | 0.95 | 1 | + + # update trigger here so that there's only one + When the markets are updated: + | id | price monitoring | price type | source weights | source staleness tolerance | + | ETH/FEB23 | my-price-monitoring-2 | weight | 0,0,1,0 | 0s,0s,0h0m120s,0s | + + # the last second of the original extensions + And the network moves ahead "3" blocks + Then the market data for the market "ETH/FEB23" should be: + | mark price | trading mode | horizon | ref price | min bound | max bound | + | 1000 | TRADING_MODE_CONTINUOUS | 30 | 1000 | 997 | 1003 | diff --git a/core/integration/features/spot/orders/0032-PRIM-033.feature b/core/integration/features/spot/orders/0032-PRIM-033.feature new file mode 100644 index 00000000000..d0ade166939 --- /dev/null +++ b/core/integration/features/spot/orders/0032-PRIM-033.feature @@ -0,0 +1,112 @@ +Feature: Spot market + + Background: + Given time is updated to "2024-01-01T00:00:00Z" + + Given the following network parameters are set: + | name | value | + | network.markPriceUpdateMaximumFrequency | 0s | + | market.value.windowLength | 1h | + + Given the following assets are registered: + | id | decimal places | + | ETH | 2 | + | BTC | 2 | + + Given the fees configuration named "fees-config-1": + | maker fee | infrastructure fee | + | 0.01 | 0.03 | + Given the log normal risk model named "lognormal-risk-model-1": + | risk aversion | tau | mu | r | sigma | + | 0.001 | 0.01 | 0 | 0.0 | 1.2 | + + Given the log normal risk model named "lognormal-risk-model-2": + | risk aversion | tau | mu | r | sigma | + | 0.002 | 0.02 | 0 | 0.1 | 1.3 | + + And the price monitoring named "price-monitoring-1": + | horizon | probability | auction extension | + | 30 | 0.999 | 10 | + | 60 | 0.999 | 20 | + | 90 | 0.999 | 40 | + | 120 | 0.999 | 80 | + + And the spot markets: + | id | name | base asset | quote asset | risk model | auction duration | fees | price monitoring | decimal places | position decimal places | sla params | + | BTC/ETH | BTC/ETH | BTC | ETH | lognormal-risk-model-1 | 1 | fees-config-1 | price-monitoring-1 | 2 | 2 | default-basic | + + # setup accounts + Given the parties deposit on asset's general account the following amount: + | party | asset | amount | + | party1 | ETH | 10000 | + | party1 | BTC | 1000 | + | party2 | ETH | 10000 | + | party4 | BTC | 1000 | + | party5 | BTC | 1000 | + And the average block duration is "1" + + # Place some orders to get out of auction + And the parties place the following orders: + | party | market id | side | volume | price | resulting trades | type | tif | + | party1 | BTC/ETH | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GFA | + | party5 | BTC/ETH | sell | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | + + And the opening auction period ends for market "BTC/ETH" + When the network moves ahead "1" blocks + Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" + And the mark price should be "1000" for the market "BTC/ETH" + + Scenario: When market is in price monitoring auction, change of a risk model or any of its parameters doesn't affect the previously + calculated auction end time, any remaining price monitoring bounds cannot extend the auction further. Upon uncrossing + price monitoring bounds get reset using the updated parameter values. (0032-PRIM-033) + + # Check that the market price bounds are set + And the market data for the market "BTC/ETH" should be: + | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | auction start | auction end | + | 1000 | TRADING_MODE_CONTINUOUS | 30 | 997 | 1003 | 0 | 0 | 0 | 0 | 0 | + | 1000 | TRADING_MODE_CONTINUOUS | 60 | 995 | 1005 | 0 | 0 | 0 | 0 | 0 | + | 1000 | TRADING_MODE_CONTINUOUS | 90 | 994 | 1006 | 0 | 0 | 0 | 0 | 0 | + | 1000 | TRADING_MODE_CONTINUOUS | 120 | 993 | 1007 | 0 | 0 | 0 | 0 | 0 | + + # Place 2 persistent orders that are outside all of the price bounds + And the parties place the following orders: + | party | market id | side | volume | price | resulting trades | type | tif | reference | + | party1 | BTC/ETH | buy | 1 | 1008 | 0 | TYPE_LIMIT | TIF_GTC | buy1 | + | party5 | BTC/ETH | sell | 1 | 1008 | 0 | TYPE_LIMIT | TIF_GTC | sell1 | + When the network moves ahead "1" blocks + + # Check we have been placed in auction + Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "BTC/ETH" + + # Check we know the auction time + And the market data for the market "BTC/ETH" should be: + | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | auction start | auction end | + | 1000 | TRADING_MODE_MONITORING_AUCTION | 60 | 995 | 1005 | 0 | 0 | 0 | 1704067203000000000 | 1704067213000000000 | + | 1000 | TRADING_MODE_MONITORING_AUCTION | 90 | 994 | 1006 | 0 | 0 | 0 | 1704067203000000000 | 1704067213000000000 | + | 1000 | TRADING_MODE_MONITORING_AUCTION | 120 | 993 | 1007 | 0 | 0 | 0 | 1704067203000000000 | 1704067213000000000 | + + # Now update the risk model to deactivate all pending price bounds + Then the spot markets are updated: + | id | risk model | + | BTC/ETH | lognormal-risk-model-2 | + + # If we move ahead 25 blocks we should come out of auction instead of it being extended + When the network moves ahead "25" blocks + + And the market data for the market "BTC/ETH" should be: + | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | auction start | auction end | + | 1008 | TRADING_MODE_CONTINUOUS | 30 | 1004 | 1012 | 0 | 0 | 0 | 0 | 0 | + | 1008 | TRADING_MODE_CONTINUOUS | 60 | 1003 | 1013 | 0 | 0 | 0 | 0 | 0 | + | 1008 | TRADING_MODE_CONTINUOUS | 90 | 1001 | 1015 | 0 | 0 | 0 | 0 | 0 | + | 1008 | TRADING_MODE_CONTINUOUS | 120 | 1000 | 1016 | 0 | 0 | 0 | 0 | 0 | + + Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" + + # The mark price should show the orders have traded + And the mark price should be "1008" for the market "BTC/ETH" + + And the orders should have the following states: + | party | market id | reference | side | volume | remaining | price | status | + | party1 | BTC/ETH | buy1 | buy | 1 | 0 | 1008 | STATUS_FILLED | + | party5 | BTC/ETH | sell1 | sell | 1 | 0 | 1008 | STATUS_FILLED | + diff --git a/core/monitor/price/pricemonitoring.go b/core/monitor/price/pricemonitoring.go index 7bd1d9b682b..449f097aaaa 100644 --- a/core/monitor/price/pricemonitoring.go +++ b/core/monitor/price/pricemonitoring.go @@ -142,9 +142,9 @@ type Engine struct { asset string } -func (e *Engine) UpdateSettings(riskModel risk.Model, settings *types.PriceMonitoringSettings) { +func (e *Engine) UpdateSettings(riskModel risk.Model, settings *types.PriceMonitoringSettings, as AuctionState) { e.riskModel = riskModel - e.fpHorizons, e.bounds = computeBoundsAndHorizons(settings) + e.fpHorizons, e.bounds = computeBoundsAndHorizons(settings, as) e.initialised = false e.boundFactorsInitialised = false e.priceRangesCache = make(map[int]priceRange, len(e.bounds)) // clear the cache @@ -169,7 +169,7 @@ func NewMonitor(asset, mktID string, riskModel RangeProvider, auctionState Aucti } // Other functions depend on this sorting - horizons, bounds := computeBoundsAndHorizons(settings) + horizons, bounds := computeBoundsAndHorizons(settings, auctionState) e := &Engine{ riskModel: riskModel, @@ -525,7 +525,9 @@ func (e *Engine) noHistory() bool { return len(e.pricesPast) == 0 && len(e.pricesNow) == 0 } -func computeBoundsAndHorizons(settings *types.PriceMonitoringSettings) (map[int64]num.Decimal, []*bound) { +func computeBoundsAndHorizons(settings *types.PriceMonitoringSettings, as AuctionState) (map[int64]num.Decimal, []*bound) { + // set bounds to inactive if we're in price monitoring auction + active := !as.IsPriceAuction() parameters := make([]*types.PriceMonitoringTrigger, 0, len(settings.Parameters.Triggers)) for _, p := range settings.Parameters.Triggers { p := *p @@ -541,7 +543,7 @@ func computeBoundsAndHorizons(settings *types.PriceMonitoringSettings) (map[int6 bounds := make([]*bound, 0, len(parameters)) for _, p := range parameters { bounds = append(bounds, &bound{ - Active: true, + Active: active, Trigger: p, }) if _, ok := horizons[p.Horizon]; !ok { diff --git a/core/monitor/price/pricemonitoring_test.go b/core/monitor/price/pricemonitoring_test.go index 4086aa600b7..e4956f0c4c0 100644 --- a/core/monitor/price/pricemonitoring_test.go +++ b/core/monitor/price/pricemonitoring_test.go @@ -48,6 +48,7 @@ func TestEmptyParametersList(t *testing.T) { auctionStateMock.EXPECT().IsFBA().Return(false).Times(4) auctionStateMock.EXPECT().InAuction().Return(false).Times(4) + auctionStateMock.EXPECT().IsPriceAuction().Return(false).Times(1) statevar := mocks.NewMockStateVarEngine(ctrl) statevar.EXPECT().RegisterStateVariable(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()) @@ -87,6 +88,7 @@ func TestErrorWithNilRiskModel(t *testing.T) { settings := types.PriceMonitoringSettingsFromProto(pSet) statevar := mocks.NewMockStateVarEngine(ctrl) // statevar.EXPECT().RegisterStateVariable(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()) + // auctionStateMock.EXPECT().IsPriceAuction().Times(1).Return(false) pm, err := price.NewMonitor("asset", "market", nil, auctionStateMock, settings, statevar, logging.NewTestLogger()) require.Error(t, err) require.Nil(t, pm) @@ -107,6 +109,7 @@ func TestGetHorizonYearFractions(t *testing.T) { settings := types.PriceMonitoringSettingsFromProto(pSet) statevar := mocks.NewMockStateVarEngine(ctrl) statevar.EXPECT().RegisterStateVariable(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()) + auctionStateMock.EXPECT().IsPriceAuction().Times(1).Return(false) pm, err := price.NewMonitor("asset", "market", riskModel, auctionStateMock, settings, statevar, logging.NewTestLogger()) require.NoError(t, err) require.NotNil(t, pm) @@ -136,6 +139,7 @@ func TestRecordPriceChange(t *testing.T) { auctionStateMock.EXPECT().IsFBA().Return(false).Times(4) auctionStateMock.EXPECT().InAuction().Return(false).Times(4) + auctionStateMock.EXPECT().IsPriceAuction().Return(false).Times(1) statevar := mocks.NewMockStateVarEngine(ctrl) statevar.EXPECT().RegisterStateVariable(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()) @@ -190,6 +194,7 @@ func TestCheckBoundViolationsWithinCurrentTimeWith2HorizonProbabilityPairs(t *te upFactors := []num.Decimal{pMax1.Div(cpDec), pMax2.Div(cpDec)} auctionStateMock.EXPECT().IsFBA().Return(false).AnyTimes() + auctionStateMock.EXPECT().IsPriceAuction().Return(false).AnyTimes() auctionStateMock.EXPECT().InAuction().Return(false).Times(14) statevar := mocks.NewMockStateVarEngine(ctrl) statevar.EXPECT().RegisterStateVariable(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() @@ -359,6 +364,7 @@ func TestAuctionStartedAndEndendBy1Trigger(t *testing.T) { auctionStateMock.EXPECT().IsFBA().Return(false).AnyTimes() auctionStateMock.EXPECT().InAuction().Return(false).Times(2) + auctionStateMock.EXPECT().IsPriceAuction().Return(false).Times(1) statevar := mocks.NewMockStateVarEngine(ctrl) statevar.EXPECT().RegisterStateVariable(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()) @@ -413,6 +419,7 @@ func TestAuctionStartedAndEndendBy2Triggers(t *testing.T) { auctionStateMock.EXPECT().IsFBA().Return(false).Times(2) auctionStateMock.EXPECT().InAuction().Return(false).Times(2) + auctionStateMock.EXPECT().IsPriceAuction().Return(false).Times(1) statevar := mocks.NewMockStateVarEngine(ctrl) statevar.EXPECT().RegisterStateVariable(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()) @@ -475,6 +482,7 @@ func TestAuctionStartedAndEndendBy1TriggerAndExtendedBy2nd(t *testing.T) { t2ub1, _ := num.UintFromDecimal(pMax2) auctionStateMock.EXPECT().IsFBA().Return(false).Times(2) + auctionStateMock.EXPECT().IsPriceAuction().Return(false).Times(1) auctionStateMock.EXPECT().InAuction().Return(false).Times(2) statevar := mocks.NewMockStateVarEngine(ctrl) statevar.EXPECT().RegisterStateVariable(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()) @@ -594,6 +602,7 @@ func TestAuctionStartedBy1TriggerAndNotExtendedBy2ndStaleTrigger(t *testing.T) { t2ub1, _ := num.UintFromDecimal(pMax2) auctionStateMock.EXPECT().IsFBA().Return(false).Times(2) + auctionStateMock.EXPECT().IsPriceAuction().Return(false).Times(1) auctionStateMock.EXPECT().InAuction().Return(false).Times(2) statevar := mocks.NewMockStateVarEngine(ctrl) statevar.EXPECT().RegisterStateVariable(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()) @@ -673,6 +682,7 @@ func TestMarketInOpeningAuction(t *testing.T) { ctx := context.Background() auctionStateMock.EXPECT().IsFBA().Return(false).Times(1) + auctionStateMock.EXPECT().IsPriceAuction().Return(false).Times(1) auctionStateMock.EXPECT().InAuction().Return(true).Times(1) end := now.Add(time.Second) auctionStateMock.EXPECT().ExpiresAt().Return(&end).Times(1) @@ -711,6 +721,7 @@ func TestMarketInGenericAuction(t *testing.T) { // price monitoring starts with auction, not initialised, so there's no fixed price level it'll check auctionStateMock.EXPECT().IsFBA().Return(false).AnyTimes() auctionStateMock.EXPECT().InAuction().Return(true).Times(4) + auctionStateMock.EXPECT().IsPriceAuction().Return(false).Times(1) auctionStateMock.EXPECT().CanLeave().Return(false).AnyTimes() statevar := mocks.NewMockStateVarEngine(ctrl) statevar.EXPECT().RegisterStateVariable(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()) @@ -764,6 +775,7 @@ func TestGetValidPriceRange_NoTriggers(t *testing.T) { auctionStateMock.EXPECT().IsFBA().Return(false).Times(1) auctionStateMock.EXPECT().InAuction().Return(false).Times(1) + auctionStateMock.EXPECT().IsPriceAuction().Return(false).Times(1) statevar := mocks.NewMockStateVarEngine(ctrl) statevar.EXPECT().RegisterStateVariable(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()) @@ -810,6 +822,7 @@ func TestGetValidPriceRange_2triggers(t *testing.T) { currentPriceD := currentPrice.ToDecimal() auctionStateMock.EXPECT().IsFBA().Return(false).Times(12) auctionStateMock.EXPECT().InAuction().Return(false).Times(12) + auctionStateMock.EXPECT().IsPriceAuction().Return(false).Times(1) statevar := mocks.NewMockStateVarEngine(ctrl) statevar.EXPECT().RegisterStateVariable(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()) diff --git a/core/monitor/price/snapshot_test.go b/core/monitor/price/snapshot_test.go index 9c085b80f13..c7d30e120b6 100644 --- a/core/monitor/price/snapshot_test.go +++ b/core/monitor/price/snapshot_test.go @@ -40,6 +40,7 @@ func createPriceMonitor(t *testing.T, ctrl *gomock.Controller) *price.Engine { riskModel, auctionState, settings := createPriceMonitorDeps(t, ctrl) statevar := mocks.NewMockStateVarEngine(ctrl) statevar.EXPECT().RegisterStateVariable(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()) + auctionState.EXPECT().IsPriceAuction().Times(1).Return(false) pm, err := price.NewMonitor("asset", "market", riskModel, auctionState, settings, statevar, logging.NewTestLogger()) require.NoError(t, err) From 139e1ac1ed2d7f5df9cd397616e353e328d00055 Mon Sep 17 00:00:00 2001 From: Jeremy Letang Date: Mon, 13 May 2024 15:46:07 +0200 Subject: [PATCH 03/19] chore: release version 0.76.2 Signed-off-by: Jeremy Letang --- CHANGELOG.md | 9 ++++++++- core/netparams/bridge_mapping.go | 1 + protos/blockexplorer/api/v1/blockexplorer.pb.go | 2 +- protos/data-node/api/v2/trading_data.pb.go | 2 +- protos/sources/blockexplorer/api/v1/blockexplorer.proto | 2 +- protos/sources/data-node/api/v2/trading_data.proto | 2 +- protos/sources/vega/api/v1/core.proto | 2 +- protos/sources/vega/api/v1/corestate.proto | 2 +- protos/vega/api/v1/core.pb.go | 2 +- protos/vega/api/v1/corestate.pb.go | 2 +- version/version.go | 2 +- 11 files changed, 18 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a98b02a00a3..e9e8f8a5373 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,14 @@ - [](https://github.com/vegaprotocol/vega/issues/xxx) +## 0.76.2 + +### πŸ› Fixes + +- [11262](https://github.com/vegaprotocol/vega/pull/11262) - Fix auction extensions after risk parameter update. +- Add validators testnet bridge and multisig address + + ## 0.76.1 ### πŸ› Fixes @@ -26,7 +34,6 @@ - [11250](https://github.com/vegaprotocol/vega/issues/11250) - Add missing dispatch strategy in transfer proposal. - [11252](https://github.com/vegaprotocol/vega/issues/11252) - Treat no position as zero position when calculating stop order overrides. - [11249](https://github.com/vegaprotocol/vega/issues/11249) - Composite mark price oracles are now deactivated when a market is rejected. -- [11262](https://github.com/vegaprotocol/vega/pull/11262) - Fix auction extensions after risk parameter update. ## 0.76.0 diff --git a/core/netparams/bridge_mapping.go b/core/netparams/bridge_mapping.go index 99cfeba4949..c5426395228 100644 --- a/core/netparams/bridge_mapping.go +++ b/core/netparams/bridge_mapping.go @@ -52,6 +52,7 @@ var testnet = `{ } ] }` + var validatorsTestnet = `{ "configs": [ { diff --git a/protos/blockexplorer/api/v1/blockexplorer.pb.go b/protos/blockexplorer/api/v1/blockexplorer.pb.go index 577615eb290..0704e771ffb 100644 --- a/protos/blockexplorer/api/v1/blockexplorer.pb.go +++ b/protos/blockexplorer/api/v1/blockexplorer.pb.go @@ -656,7 +656,7 @@ var file_blockexplorer_api_v1_blockexplorer_proto_rawDesc = []byte{ 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x72, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x92, 0x41, 0x3e, 0x12, 0x23, 0x0a, 0x18, 0x56, 0x65, 0x67, 0x61, 0x20, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x20, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x72, 0x65, 0x72, 0x20, - 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x31, 0x1a, 0x13, 0x6c, + 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x32, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/protos/data-node/api/v2/trading_data.pb.go b/protos/data-node/api/v2/trading_data.pb.go index ca403173906..d08e57c2db5 100644 --- a/protos/data-node/api/v2/trading_data.pb.go +++ b/protos/data-node/api/v2/trading_data.pb.go @@ -30538,7 +30538,7 @@ var file_data_node_api_v2_trading_data_proto_rawDesc = []byte{ 0x6f, 0x73, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x2d, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x92, 0x41, 0x8f, 0x01, 0x12, 0x1e, 0x0a, 0x13, 0x56, 0x65, 0x67, 0x61, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x6e, 0x6f, 0x64, 0x65, 0x20, 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, - 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x31, 0x1a, 0x1c, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, + 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x32, 0x1a, 0x1c, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x61, 0x70, 0x69, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x52, 0x39, 0x0a, 0x03, 0x35, diff --git a/protos/sources/blockexplorer/api/v1/blockexplorer.proto b/protos/sources/blockexplorer/api/v1/blockexplorer.proto index f551d1c16ab..4df6ae48078 100644 --- a/protos/sources/blockexplorer/api/v1/blockexplorer.proto +++ b/protos/sources/blockexplorer/api/v1/blockexplorer.proto @@ -11,7 +11,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/blockexplorer/api/v1"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega block explorer APIs"; - version: "v0.76.1"; + version: "v0.76.2"; } schemes: [ HTTP, diff --git a/protos/sources/data-node/api/v2/trading_data.proto b/protos/sources/data-node/api/v2/trading_data.proto index 98df40439f4..cd6ee8a3465 100644 --- a/protos/sources/data-node/api/v2/trading_data.proto +++ b/protos/sources/data-node/api/v2/trading_data.proto @@ -17,7 +17,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/data-node/api/v2"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega data node APIs"; - version: "v0.76.1"; + version: "v0.76.2"; } schemes: [ HTTP, diff --git a/protos/sources/vega/api/v1/core.proto b/protos/sources/vega/api/v1/core.proto index a06f3221ab6..b3f48cdc6be 100644 --- a/protos/sources/vega/api/v1/core.proto +++ b/protos/sources/vega/api/v1/core.proto @@ -12,7 +12,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/vega/api/v1"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega core APIs"; - version: "v0.76.1"; + version: "v0.76.2"; } schemes: [ HTTP, diff --git a/protos/sources/vega/api/v1/corestate.proto b/protos/sources/vega/api/v1/corestate.proto index 956a98a9aee..1e30e6c95de 100644 --- a/protos/sources/vega/api/v1/corestate.proto +++ b/protos/sources/vega/api/v1/corestate.proto @@ -13,7 +13,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/vega/api/v1"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega core state APIs"; - version: "v0.76.1"; + version: "v0.76.2"; } schemes: [ HTTP, diff --git a/protos/vega/api/v1/core.pb.go b/protos/vega/api/v1/core.pb.go index 631b0676f57..d9d1798ee7b 100644 --- a/protos/vega/api/v1/core.pb.go +++ b/protos/vega/api/v1/core.pb.go @@ -2796,7 +2796,7 @@ var file_vega_api_v1_core_proto_rawDesc = []byte{ 0x6f, 0x6c, 0x2e, 0x69, 0x6f, 0x2f, 0x76, 0x65, 0x67, 0x61, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x76, 0x65, 0x67, 0x61, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x92, 0x41, 0x34, 0x12, 0x19, 0x0a, 0x0e, 0x56, 0x65, 0x67, 0x61, 0x20, 0x63, 0x6f, 0x72, 0x65, 0x20, 0x41, 0x50, - 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x31, 0x1a, 0x13, 0x6c, 0x62, 0x2e, + 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x32, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/protos/vega/api/v1/corestate.pb.go b/protos/vega/api/v1/corestate.pb.go index 1556db4ec39..9e826bf05da 100644 --- a/protos/vega/api/v1/corestate.pb.go +++ b/protos/vega/api/v1/corestate.pb.go @@ -1512,7 +1512,7 @@ var file_vega_api_v1_corestate_proto_rawDesc = []byte{ 0x6f, 0x73, 0x2f, 0x76, 0x65, 0x67, 0x61, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x92, 0x41, 0x3a, 0x12, 0x1f, 0x0a, 0x14, 0x56, 0x65, 0x67, 0x61, 0x20, 0x63, 0x6f, 0x72, 0x65, 0x20, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, - 0x2e, 0x31, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, + 0x2e, 0x32, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/version/version.go b/version/version.go index f73395ff20b..a957ad9fa1c 100644 --- a/version/version.go +++ b/version/version.go @@ -22,7 +22,7 @@ import ( var ( cliVersionHash = "" - cliVersion = "v0.76.1" + cliVersion = "v0.76.2" ) func init() { From daeb04fb74cb74cea251448702985606f5c0f9d5 Mon Sep 17 00:00:00 2001 From: Jeremy Letang Date: Wed, 15 May 2024 20:14:22 +0200 Subject: [PATCH 04/19] Merge pull request #11284 from vegaprotocol/pow-fix fix: do not account for started block in the past block range --- core/pow/engine.go | 2 +- core/pow/engine_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/pow/engine.go b/core/pow/engine.go index eb28c8cfdca..467b790520d 100644 --- a/core/pow/engine.go +++ b/core/pow/engine.go @@ -250,7 +250,7 @@ func (e *Engine) updatePowState(txs []abci.Tx) { } for i, p := range e.activeParams { - outOfScopeBlock := int64(e.currentBlock) + 1 - int64(p.spamPoWNumberOfPastBlocks) + outOfScopeBlock := int64(e.currentBlock) - int64(p.spamPoWNumberOfPastBlocks) if outOfScopeBlock < 0 { continue } diff --git a/core/pow/engine_test.go b/core/pow/engine_test.go index 68ba599d41e..7bd508aac81 100644 --- a/core/pow/engine_test.go +++ b/core/pow/engine_test.go @@ -232,7 +232,7 @@ func TestDeliverTxDuplciateNonce(t *testing.T) { require.Equal(t, 2, len(e.heightToNonceRef[100])) // check the maps are purged when we leave scope - e.BeginBlock(104, crypto.RandomHash(), []abci.Tx{}) + e.BeginBlock(105, crypto.RandomHash(), []abci.Tx{}) require.Equal(t, 0, len(e.seenTid)) require.Equal(t, 0, len(e.heightToTid)) require.Equal(t, 0, len(e.heightToNonceRef)) From 4b9a58c65d8eb52184011703354f5d0d929f581f Mon Sep 17 00:00:00 2001 From: Jeremy Letang Date: Fri, 17 May 2024 11:14:58 +0200 Subject: [PATCH 05/19] chore: release version 0.76.3 Signed-off-by: Jeremy Letang --- CHANGELOG.md | 6 ++++++ protos/blockexplorer/api/v1/blockexplorer.pb.go | 2 +- protos/data-node/api/v2/trading_data.pb.go | 2 +- protos/sources/blockexplorer/api/v1/blockexplorer.proto | 2 +- protos/sources/data-node/api/v2/trading_data.proto | 2 +- protos/sources/vega/api/v1/core.proto | 2 +- protos/sources/vega/api/v1/corestate.proto | 2 +- protos/vega/api/v1/core.pb.go | 2 +- protos/vega/api/v1/corestate.pb.go | 2 +- version/version.go | 2 +- 10 files changed, 15 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9e8f8a5373..d85ea8b743b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,12 @@ - [](https://github.com/vegaprotocol/vega/issues/xxx) +## 0.76.3 + +### πŸ› Fixes + +- [11284](https://github.com/vegaprotocol/vega/pull/11284) - Do not account for started block in the past block range. + ## 0.76.2 ### πŸ› Fixes diff --git a/protos/blockexplorer/api/v1/blockexplorer.pb.go b/protos/blockexplorer/api/v1/blockexplorer.pb.go index 0704e771ffb..ae722390ab8 100644 --- a/protos/blockexplorer/api/v1/blockexplorer.pb.go +++ b/protos/blockexplorer/api/v1/blockexplorer.pb.go @@ -656,7 +656,7 @@ var file_blockexplorer_api_v1_blockexplorer_proto_rawDesc = []byte{ 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x72, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x92, 0x41, 0x3e, 0x12, 0x23, 0x0a, 0x18, 0x56, 0x65, 0x67, 0x61, 0x20, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x20, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x72, 0x65, 0x72, 0x20, - 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x32, 0x1a, 0x13, 0x6c, + 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x33, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/protos/data-node/api/v2/trading_data.pb.go b/protos/data-node/api/v2/trading_data.pb.go index d08e57c2db5..39bd30587c4 100644 --- a/protos/data-node/api/v2/trading_data.pb.go +++ b/protos/data-node/api/v2/trading_data.pb.go @@ -30538,7 +30538,7 @@ var file_data_node_api_v2_trading_data_proto_rawDesc = []byte{ 0x6f, 0x73, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x2d, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x92, 0x41, 0x8f, 0x01, 0x12, 0x1e, 0x0a, 0x13, 0x56, 0x65, 0x67, 0x61, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x6e, 0x6f, 0x64, 0x65, 0x20, 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, - 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x32, 0x1a, 0x1c, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, + 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x33, 0x1a, 0x1c, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x61, 0x70, 0x69, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x52, 0x39, 0x0a, 0x03, 0x35, diff --git a/protos/sources/blockexplorer/api/v1/blockexplorer.proto b/protos/sources/blockexplorer/api/v1/blockexplorer.proto index 4df6ae48078..eeb601d797a 100644 --- a/protos/sources/blockexplorer/api/v1/blockexplorer.proto +++ b/protos/sources/blockexplorer/api/v1/blockexplorer.proto @@ -11,7 +11,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/blockexplorer/api/v1"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega block explorer APIs"; - version: "v0.76.2"; + version: "v0.76.3"; } schemes: [ HTTP, diff --git a/protos/sources/data-node/api/v2/trading_data.proto b/protos/sources/data-node/api/v2/trading_data.proto index cd6ee8a3465..7f7f18962e7 100644 --- a/protos/sources/data-node/api/v2/trading_data.proto +++ b/protos/sources/data-node/api/v2/trading_data.proto @@ -17,7 +17,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/data-node/api/v2"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega data node APIs"; - version: "v0.76.2"; + version: "v0.76.3"; } schemes: [ HTTP, diff --git a/protos/sources/vega/api/v1/core.proto b/protos/sources/vega/api/v1/core.proto index b3f48cdc6be..41bc1354f4f 100644 --- a/protos/sources/vega/api/v1/core.proto +++ b/protos/sources/vega/api/v1/core.proto @@ -12,7 +12,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/vega/api/v1"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega core APIs"; - version: "v0.76.2"; + version: "v0.76.3"; } schemes: [ HTTP, diff --git a/protos/sources/vega/api/v1/corestate.proto b/protos/sources/vega/api/v1/corestate.proto index 1e30e6c95de..aba88dff2c6 100644 --- a/protos/sources/vega/api/v1/corestate.proto +++ b/protos/sources/vega/api/v1/corestate.proto @@ -13,7 +13,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/vega/api/v1"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega core state APIs"; - version: "v0.76.2"; + version: "v0.76.3"; } schemes: [ HTTP, diff --git a/protos/vega/api/v1/core.pb.go b/protos/vega/api/v1/core.pb.go index d9d1798ee7b..a5c50099afa 100644 --- a/protos/vega/api/v1/core.pb.go +++ b/protos/vega/api/v1/core.pb.go @@ -2796,7 +2796,7 @@ var file_vega_api_v1_core_proto_rawDesc = []byte{ 0x6f, 0x6c, 0x2e, 0x69, 0x6f, 0x2f, 0x76, 0x65, 0x67, 0x61, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x76, 0x65, 0x67, 0x61, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x92, 0x41, 0x34, 0x12, 0x19, 0x0a, 0x0e, 0x56, 0x65, 0x67, 0x61, 0x20, 0x63, 0x6f, 0x72, 0x65, 0x20, 0x41, 0x50, - 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x32, 0x1a, 0x13, 0x6c, 0x62, 0x2e, + 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x33, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/protos/vega/api/v1/corestate.pb.go b/protos/vega/api/v1/corestate.pb.go index 9e826bf05da..61c58153819 100644 --- a/protos/vega/api/v1/corestate.pb.go +++ b/protos/vega/api/v1/corestate.pb.go @@ -1512,7 +1512,7 @@ var file_vega_api_v1_corestate_proto_rawDesc = []byte{ 0x6f, 0x73, 0x2f, 0x76, 0x65, 0x67, 0x61, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x92, 0x41, 0x3a, 0x12, 0x1f, 0x0a, 0x14, 0x56, 0x65, 0x67, 0x61, 0x20, 0x63, 0x6f, 0x72, 0x65, 0x20, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, - 0x2e, 0x32, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, + 0x2e, 0x33, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/version/version.go b/version/version.go index a957ad9fa1c..cd663262ff0 100644 --- a/version/version.go +++ b/version/version.go @@ -22,7 +22,7 @@ import ( var ( cliVersionHash = "" - cliVersion = "v0.76.2" + cliVersion = "v0.76.3" ) func init() { From d0d6e4386ace168f36bd94e67d725d2805db5254 Mon Sep 17 00:00:00 2001 From: Jeremy Letang Date: Sat, 18 May 2024 18:20:43 +0200 Subject: [PATCH 06/19] Merge pull request #11294 from vegaprotocol/fix/11293 Fix/11293 --- CHANGELOG.md | 8 ++++++++ core/datasource/external/ethcall/engine.go | 2 +- datanode/api/trading_data_v2.go | 17 +++++++++-------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d85ea8b743b..859caa12228 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,12 +19,20 @@ - [](https://github.com/vegaprotocol/vega/issues/xxx) +## 0.76.4 + +### πŸ› Fixes + +- [11293](https://github.com/vegaprotocol/vega/issues/11293) - Panic in data node with position estimate endpoint. + + ## 0.76.3 ### πŸ› Fixes - [11284](https://github.com/vegaprotocol/vega/pull/11284) - Do not account for started block in the past block range. + ## 0.76.2 ### πŸ› Fixes diff --git a/core/datasource/external/ethcall/engine.go b/core/datasource/external/ethcall/engine.go index 8a633ce28e1..be731d0e70d 100644 --- a/core/datasource/external/ethcall/engine.go +++ b/core/datasource/external/ethcall/engine.go @@ -321,7 +321,7 @@ func (e *Engine) Poll(ctx context.Context, wallTime time.Time) { if call.triggered(prevEthBlock, nextEthBlockIsh) { res, err := call.Call(ctx, e.client, nextEthBlock.Number.Uint64()) if err != nil { - e.log.Error("failed to call contract", logging.Error(err), logging.Uint64("chain-id", e.chainID.Load())) + e.log.Error("failed to call contract", logging.Error(err), logging.String("spec-id", specID), logging.Uint64("chain-id", e.chainID.Load())) event := makeErrorChainEvent(err.Error(), specID, nextEthBlockIsh, e.chainID.Load()) e.forwarder.ForwardFromSelf(event) e.lastSent = nextEthBlockIsh diff --git a/datanode/api/trading_data_v2.go b/datanode/api/trading_data_v2.go index ef8e86e64a5..9d6753031e2 100644 --- a/datanode/api/trading_data_v2.go +++ b/datanode/api/trading_data_v2.go @@ -3038,8 +3038,8 @@ func (t *TradingDataServiceV2) scaleFromMarketToAssetPrice( if err != nil { return nil, err } - - return price.Mul(price, priceFactor), nil + price, _ = num.UintFromDecimal(price.ToDecimal().Mul(priceFactor)) + return price, nil } func (t *TradingDataServiceV2) scaleDecimalFromMarketToAssetPrice( @@ -3057,22 +3057,23 @@ func (t *TradingDataServiceV2) scaleDecimalFromAssetToMarketPrice( func (t *TradingDataServiceV2) getMarketPriceFactor( ctx context.Context, mkt entities.Market, -) (*num.Uint, error) { +) (num.Decimal, error) { assetID, err := mkt.ToProto().GetAsset() if err != nil { - return nil, errors.Wrap(err, "getting asset from market") + return num.DecimalZero(), errors.Wrap(err, "getting asset from market") } asset, err := t.AssetService.GetByID(ctx, assetID) if err != nil { - return nil, errors.Wrapf(ErrAssetServiceGetByID, "assetID: %s", assetID) + return num.DecimalZero(), errors.Wrapf(ErrAssetServiceGetByID, "assetID: %s", assetID) } // scale the price if needed // price is expected in market decimal - priceFactor := num.NewUint(1) + priceFactor := num.DecimalOne() + // this could be negative, use decimal if exp := asset.Decimals - mkt.DecimalPlaces; exp != 0 { - priceFactor.Exp(num.NewUint(10), num.NewUint(uint64(exp))) + priceFactor = num.DecimalFromInt64(10).Pow(num.DecimalFromInt64(int64(exp))) } return priceFactor, nil } @@ -3298,7 +3299,7 @@ func (t *TradingDataServiceV2) EstimatePosition(ctx context.Context, req *v2.Est return nil, err } - dPriceFactor := priceFactor.ToDecimal() + dPriceFactor := priceFactor buyOrders := make([]*risk.OrderInfo, 0, len(req.Orders)) sellOrders := make([]*risk.OrderInfo, 0, len(req.Orders)) From a674305f2f1981a44f21094c7477057a7474e77a Mon Sep 17 00:00:00 2001 From: Zohar Etzioni Date: Mon, 20 May 2024 14:04:21 +0100 Subject: [PATCH 07/19] Merge pull request #11298 from vegaprotocol/fix_ob MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix: Handle properly asset decimals < market decimals when uncrossing… --- CHANGELOG.md | 1 + core/matching/orderbook.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 859caa12228..800bd42dce8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ ### πŸ› Fixes - [11293](https://github.com/vegaprotocol/vega/issues/11293) - Panic in data node with position estimate endpoint. +- [11297](https://github.com/vegaprotocol/vega/issues/11297) - Handle properly asset decimals < market decimals when uncrossing the order book upon leaving auction. ## 0.76.3 diff --git a/core/matching/orderbook.go b/core/matching/orderbook.go index ee3a1a72488..ba02938de1d 100644 --- a/core/matching/orderbook.go +++ b/core/matching/orderbook.go @@ -555,8 +555,8 @@ func (b *OrderBook) uncrossBookSide( } // get price factor, if price is 10,000, but market price is 100, this is 10,000/100 -> 100 // so we can get the market price simply by doing price / (order.Price/ order.OriginalPrice) - mPrice := num.UintZero().Div(uncrossOrders[0].Price, uncrossOrders[0].OriginalPrice) - mPrice.Div(price, mPrice) + // as the asset decimals may be < market decimals, the calculation must be done in decimals. + mPrice, _ := num.UintFromDecimal(price.ToDecimal().Div(uncrossOrders[0].Price.ToDecimal().Div(uncrossOrders[0].OriginalPrice.ToDecimal()))) // Uncross each one for _, order := range uncrossOrders { // since all of uncrossOrders will be traded away and at the same uncrossing price From d2d24b07e261deaa87a7b80df79b4f2501f6f76b Mon Sep 17 00:00:00 2001 From: Jeremy Letang Date: Mon, 20 May 2024 15:59:26 +0200 Subject: [PATCH 08/19] chore: add mapping for mainnet Arbitrum One bridge Signed-off-by: Jeremy Letang --- core/netparams/bridge_mapping.go | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/core/netparams/bridge_mapping.go b/core/netparams/bridge_mapping.go index c5426395228..00148120488 100644 --- a/core/netparams/bridge_mapping.go +++ b/core/netparams/bridge_mapping.go @@ -72,10 +72,29 @@ var validatorsTestnet = `{ ] }` +var mainnet = `{ + "configs": [ + { + "network_id": "42161", + "chain_id": "42161", + "collateral_bridge_contract": { + "address": "0x475B597652bCb2769949FD6787b1DC6916518407" + }, + "confirmations": 3, + "multisig_control_contract": { + "address": "0x348372DE65Ca7F2567FE267ccc4D1bF6d4b71f6F", + "deployment_block_height": 213213613 + }, + "block_time": "250ms", + "name": "Arbitrum One" + } + ] +}` + var bridgeMapping = map[string]string{ "vega-stagnet1-202307191148": stagnet1, "vega-fairground-202305051805": testnet, "vega-mainnet-mirror-202306231148": "{}", "vega-testnet-0002-v4": validatorsTestnet, - "vega-mainnet-0011": "{}", + "vega-mainnet-0011": mainnet, } From 86df600fad3707cfac5d2c7d67446d25d5933bad Mon Sep 17 00:00:00 2001 From: Jeremy Letang Date: Mon, 20 May 2024 16:05:48 +0200 Subject: [PATCH 09/19] chore: add mapping for mainnet mirror Arbitrum (sepolia) bridge Signed-off-by: Jeremy Letang --- core/netparams/bridge_mapping.go | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/core/netparams/bridge_mapping.go b/core/netparams/bridge_mapping.go index 00148120488..26e7dff775c 100644 --- a/core/netparams/bridge_mapping.go +++ b/core/netparams/bridge_mapping.go @@ -53,6 +53,25 @@ var testnet = `{ ] }` +var mainnetMirror = `{ + "configs": [ + { + "network_id": "421614", + "chain_id": "421614", + "collateral_bridge_contract": { + "address": "0x412eD3b1951C39c182ea6682D2a16c1Ca22A5874" + }, + "confirmations": 3, + "multisig_control_contract": { + "address": "0x2F933bf63D4059D66F20F97f4a0B540Ea1d0dE69", + "deployment_block_height": 46048993 + }, + "block_time": "250ms", + "name": "Arbitrum (Sepolia)" + } + ] +}` + var validatorsTestnet = `{ "configs": [ { @@ -94,7 +113,7 @@ var mainnet = `{ var bridgeMapping = map[string]string{ "vega-stagnet1-202307191148": stagnet1, "vega-fairground-202305051805": testnet, - "vega-mainnet-mirror-202306231148": "{}", + "vega-mainnet-mirror-202306231148": mainnetMirror, "vega-testnet-0002-v4": validatorsTestnet, "vega-mainnet-0011": mainnet, } From 230591d41c0e99f7ec973ec1739c4462574291b5 Mon Sep 17 00:00:00 2001 From: Jeremy Letang Date: Mon, 20 May 2024 16:07:39 +0200 Subject: [PATCH 10/19] chore: release version 0.76.4 Signed-off-by: Jeremy Letang --- protos/blockexplorer/api/v1/blockexplorer.pb.go | 2 +- protos/data-node/api/v2/trading_data.pb.go | 2 +- protos/sources/blockexplorer/api/v1/blockexplorer.proto | 2 +- protos/sources/data-node/api/v2/trading_data.proto | 2 +- protos/sources/vega/api/v1/core.proto | 2 +- protos/sources/vega/api/v1/corestate.proto | 2 +- protos/vega/api/v1/core.pb.go | 2 +- protos/vega/api/v1/corestate.pb.go | 2 +- version/version.go | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/protos/blockexplorer/api/v1/blockexplorer.pb.go b/protos/blockexplorer/api/v1/blockexplorer.pb.go index ae722390ab8..9885857df90 100644 --- a/protos/blockexplorer/api/v1/blockexplorer.pb.go +++ b/protos/blockexplorer/api/v1/blockexplorer.pb.go @@ -656,7 +656,7 @@ var file_blockexplorer_api_v1_blockexplorer_proto_rawDesc = []byte{ 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x72, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x92, 0x41, 0x3e, 0x12, 0x23, 0x0a, 0x18, 0x56, 0x65, 0x67, 0x61, 0x20, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x20, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x72, 0x65, 0x72, 0x20, - 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x33, 0x1a, 0x13, 0x6c, + 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x34, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/protos/data-node/api/v2/trading_data.pb.go b/protos/data-node/api/v2/trading_data.pb.go index 39bd30587c4..17f0d4ddef0 100644 --- a/protos/data-node/api/v2/trading_data.pb.go +++ b/protos/data-node/api/v2/trading_data.pb.go @@ -30538,7 +30538,7 @@ var file_data_node_api_v2_trading_data_proto_rawDesc = []byte{ 0x6f, 0x73, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x2d, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x92, 0x41, 0x8f, 0x01, 0x12, 0x1e, 0x0a, 0x13, 0x56, 0x65, 0x67, 0x61, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x6e, 0x6f, 0x64, 0x65, 0x20, 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, - 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x33, 0x1a, 0x1c, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, + 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x34, 0x1a, 0x1c, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x61, 0x70, 0x69, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x52, 0x39, 0x0a, 0x03, 0x35, diff --git a/protos/sources/blockexplorer/api/v1/blockexplorer.proto b/protos/sources/blockexplorer/api/v1/blockexplorer.proto index eeb601d797a..1cda3060320 100644 --- a/protos/sources/blockexplorer/api/v1/blockexplorer.proto +++ b/protos/sources/blockexplorer/api/v1/blockexplorer.proto @@ -11,7 +11,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/blockexplorer/api/v1"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega block explorer APIs"; - version: "v0.76.3"; + version: "v0.76.4"; } schemes: [ HTTP, diff --git a/protos/sources/data-node/api/v2/trading_data.proto b/protos/sources/data-node/api/v2/trading_data.proto index 7f7f18962e7..f27d69438bd 100644 --- a/protos/sources/data-node/api/v2/trading_data.proto +++ b/protos/sources/data-node/api/v2/trading_data.proto @@ -17,7 +17,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/data-node/api/v2"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega data node APIs"; - version: "v0.76.3"; + version: "v0.76.4"; } schemes: [ HTTP, diff --git a/protos/sources/vega/api/v1/core.proto b/protos/sources/vega/api/v1/core.proto index 41bc1354f4f..3cc975b6c0c 100644 --- a/protos/sources/vega/api/v1/core.proto +++ b/protos/sources/vega/api/v1/core.proto @@ -12,7 +12,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/vega/api/v1"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega core APIs"; - version: "v0.76.3"; + version: "v0.76.4"; } schemes: [ HTTP, diff --git a/protos/sources/vega/api/v1/corestate.proto b/protos/sources/vega/api/v1/corestate.proto index aba88dff2c6..41828d6648d 100644 --- a/protos/sources/vega/api/v1/corestate.proto +++ b/protos/sources/vega/api/v1/corestate.proto @@ -13,7 +13,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/vega/api/v1"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega core state APIs"; - version: "v0.76.3"; + version: "v0.76.4"; } schemes: [ HTTP, diff --git a/protos/vega/api/v1/core.pb.go b/protos/vega/api/v1/core.pb.go index a5c50099afa..08ee7749b89 100644 --- a/protos/vega/api/v1/core.pb.go +++ b/protos/vega/api/v1/core.pb.go @@ -2796,7 +2796,7 @@ var file_vega_api_v1_core_proto_rawDesc = []byte{ 0x6f, 0x6c, 0x2e, 0x69, 0x6f, 0x2f, 0x76, 0x65, 0x67, 0x61, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x76, 0x65, 0x67, 0x61, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x92, 0x41, 0x34, 0x12, 0x19, 0x0a, 0x0e, 0x56, 0x65, 0x67, 0x61, 0x20, 0x63, 0x6f, 0x72, 0x65, 0x20, 0x41, 0x50, - 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x33, 0x1a, 0x13, 0x6c, 0x62, 0x2e, + 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x34, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/protos/vega/api/v1/corestate.pb.go b/protos/vega/api/v1/corestate.pb.go index 61c58153819..814c882d451 100644 --- a/protos/vega/api/v1/corestate.pb.go +++ b/protos/vega/api/v1/corestate.pb.go @@ -1512,7 +1512,7 @@ var file_vega_api_v1_corestate_proto_rawDesc = []byte{ 0x6f, 0x73, 0x2f, 0x76, 0x65, 0x67, 0x61, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x92, 0x41, 0x3a, 0x12, 0x1f, 0x0a, 0x14, 0x56, 0x65, 0x67, 0x61, 0x20, 0x63, 0x6f, 0x72, 0x65, 0x20, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, - 0x2e, 0x33, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, + 0x2e, 0x34, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/version/version.go b/version/version.go index cd663262ff0..c99271fbb80 100644 --- a/version/version.go +++ b/version/version.go @@ -22,7 +22,7 @@ import ( var ( cliVersionHash = "" - cliVersion = "v0.76.3" + cliVersion = "v0.76.4" ) func init() { From 438132a598a35d6aecbcbb8ac7ce57f0e26e5655 Mon Sep 17 00:00:00 2001 From: Jeremy Letang Date: Wed, 22 May 2024 10:11:54 +0200 Subject: [PATCH 11/19] Merge pull request #11305 from vegaprotocol/11304 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix: Correctly verify pegged order offset with respect to tick size i… --- CHANGELOG.md | 1 + core/execution/future/market.go | 22 +++-- core/execution/spot/market.go | 20 ++-- .../features/orders/0037-OPEG-022.feature | 89 ++++++++++++++++++ .../spot/orders/0037-OPEG-023.feature | 91 +++++++++++++++++++ .../verified/special_orders_crossed.feature | 37 ++++++++ 6 files changed, 244 insertions(+), 16 deletions(-) create mode 100644 core/integration/features/orders/0037-OPEG-022.feature create mode 100644 core/integration/features/spot/orders/0037-OPEG-023.feature create mode 100644 core/integration/features/verified/special_orders_crossed.feature diff --git a/CHANGELOG.md b/CHANGELOG.md index 800bd42dce8..13f952cd3e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ - [11293](https://github.com/vegaprotocol/vega/issues/11293) - Panic in data node with position estimate endpoint. - [11297](https://github.com/vegaprotocol/vega/issues/11297) - Handle properly asset decimals < market decimals when uncrossing the order book upon leaving auction. +- [11304](https://github.com/vegaprotocol/vega/issues/11304) - Correctly verify pegged order offset with respect to tick size in the right units. ## 0.76.3 diff --git a/core/execution/future/market.go b/core/execution/future/market.go index 90e28d6d3fc..66829b7cf4c 100644 --- a/core/execution/future/market.go +++ b/core/execution/future/market.go @@ -1374,26 +1374,30 @@ func (m *Market) getNewPeggedPrice(order *types.Order) (*num.Uint, error) { return num.UintZero(), common.ErrUnableToReprice } - offset, _ := num.UintFromDecimal(order.PeggedOrder.Offset.ToDecimal().Mul(m.priceFactor)) + // we're converting both offset and tick size to asset decimals so we can adjust the price (in asset) directly + priceInMarket, _ := num.UintFromDecimal(price.ToDecimal().Div(m.priceFactor)) if order.Side == types.SideSell { - price = price.AddSum(offset) + priceInMarket.AddSum(order.PeggedOrder.Offset) // this can only happen when pegged to mid, in which case we want to round to the nearest *better* tick size // but this can never cross the mid by construction as the the minimum offset is 1 tick size and all prices must be // whole multiples of tick size. - if mod := num.UintZero().Mod(price, m.mkt.TickSize); !mod.IsZero() { - price.Sub(price, mod) + if mod := num.UintZero().Mod(priceInMarket, m.mkt.TickSize); !mod.IsZero() { + priceInMarket.Sub(priceInMarket, mod) } + price, _ := num.UintFromDecimal(priceInMarket.ToDecimal().Mul(m.priceFactor)) + return price, nil } - if price.LTE(offset) { + if priceInMarket.LTE(order.PeggedOrder.Offset) { return num.UintZero(), common.ErrUnableToReprice } - price.Sub(price, offset) - if mod := num.UintZero().Mod(price, m.mkt.TickSize); !mod.IsZero() { - price = num.UintZero().Sub(price.AddSum(m.mkt.TickSize), mod) + priceInMarket.Sub(priceInMarket, order.PeggedOrder.Offset) + if mod := num.UintZero().Mod(priceInMarket, m.mkt.TickSize); !mod.IsZero() { + priceInMarket = num.UintZero().Sub(priceInMarket.AddSum(m.mkt.TickSize), mod) } + price, _ = num.UintFromDecimal(priceInMarket.ToDecimal().Mul(m.priceFactor)) return price, nil } @@ -1792,6 +1796,8 @@ func (m *Market) validateOrder(ctx context.Context, order *types.Order) (err err return nil } +// validateOrder checks that the order parameters are valid for the market. +// NB: price in market, tickSize in market decimals. func (m *Market) validateTickSize(price *num.Uint) error { d := num.UintZero().Mod(price, m.mkt.TickSize) if !d.IsZero() { diff --git a/core/execution/spot/market.go b/core/execution/spot/market.go index ac3e0e0cc12..2ffcee16207 100644 --- a/core/execution/spot/market.go +++ b/core/execution/spot/market.go @@ -819,26 +819,29 @@ func (m *Market) getNewPeggedPrice(order *types.Order) (*num.Uint, error) { return num.UintZero(), common.ErrUnableToReprice } - offset, _ := num.UintFromDecimal(order.PeggedOrder.Offset.ToDecimal().Mul(m.priceFactor)) + // we're converting both offset and tick size to asset decimals so we can adjust the price (in asset) directly + priceInMarket, _ := num.UintFromDecimal(price.ToDecimal().Div(m.priceFactor)) if order.Side == types.SideSell { - price = price.AddSum(offset) + priceInMarket.AddSum(order.PeggedOrder.Offset) // this can only happen when pegged to mid, in which case we want to round to the nearest *better* tick size // but this can never cross the mid by construction as the the minimum offset is 1 tick size and all prices must be // whole multiples of tick size. - if mod := num.UintZero().Mod(price, m.mkt.TickSize); !mod.IsZero() { - price.Sub(price, mod) + if mod := num.UintZero().Mod(priceInMarket, m.mkt.TickSize); !mod.IsZero() { + priceInMarket.Sub(priceInMarket, mod) } + price, _ := num.UintFromDecimal(priceInMarket.ToDecimal().Mul(m.priceFactor)) return price, nil } - if price.LTE(offset) { + if priceInMarket.LTE(order.PeggedOrder.Offset) { return num.UintZero(), common.ErrUnableToReprice } - price.Sub(price, offset) - if mod := num.UintZero().Mod(price, m.mkt.TickSize); !mod.IsZero() { - price = num.UintZero().Sub(price.AddSum(m.mkt.TickSize), mod) + priceInMarket.Sub(priceInMarket, order.PeggedOrder.Offset) + if mod := num.UintZero().Mod(priceInMarket, m.mkt.TickSize); !mod.IsZero() { + priceInMarket = num.UintZero().Sub(priceInMarket.AddSum(m.mkt.TickSize), mod) } + price, _ = num.UintFromDecimal(priceInMarket.ToDecimal().Mul(m.priceFactor)) return price, nil } @@ -971,6 +974,7 @@ func (m *Market) leaveAuction(ctx context.Context, now time.Time) { } // validateOrder checks that the order parameters are valid for the market. +// NB: price in market, tickSize in market decimals. func (m *Market) validateOrder(ctx context.Context, order *types.Order) (err error) { defer func() { if err != nil { diff --git a/core/integration/features/orders/0037-OPEG-022.feature b/core/integration/features/orders/0037-OPEG-022.feature new file mode 100644 index 00000000000..8d575324b2e --- /dev/null +++ b/core/integration/features/orders/0037-OPEG-022.feature @@ -0,0 +1,89 @@ + +Feature: 0001 tick size should be using market decimal, A pegged order specifying an offset which is not an integer multiple of the markets tick size should be rejected. + + Background: + Given the following network parameters are set: + | name | value | + | market.liquidity.bondPenaltyParameter | 1 | + | network.markPriceUpdateMaximumFrequency | 0s | + | limits.markets.maxPeggedOrders | 6 | + | validators.epoch.length | 5s | + | market.liquidity.earlyExitPenalty | 0.25 | + | market.liquidity.stakeToCcyVolume | 1.0 | + | market.liquidity.sla.nonPerformanceBondPenaltySlope | 0.19 | + | market.liquidity.sla.nonPerformanceBondPenaltyMax | 1 | + + And the liquidity monitoring parameters: + | name | triggering ratio | time window | scaling factor | + | lqm-params | 0.1 | 24h | 1 | + + And the following assets are registered: + | id | decimal places | + | ETH | 1 | + + And the average block duration is "1" + And the simple risk model named "simple-risk-model-1": + | long | short | max move up | min move down | probability of trading | + | 0.1 | 0.1 | 60 | 50 | 0.2 | + And the fees configuration named "fees-config-1": + | maker fee | infrastructure fee | + | 0.004 | 0.001 | + And the price monitoring named "price-monitoring-1": + | horizon | probability | auction extension | + | 1 | 0.99 | 5 | + And the liquidity sla params named "SLA": + | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | + | 0.01 | 0.5 | 1 | 1.0 | + + Scenario: + #0037-OPEG-022:Given a market with non-zero market and asset decimals where the asset decimals are strictly less than the market decimals (yielding a negative price factor). A pegged order specifying an offset which is not an integer multiple of the markets tick size should be rejected. + #0037-OPEG-025:Given a market with non-zero market and asset decimals where the asset decimals are equal to the market decimals (yielding a negative price factor). A pegged order specifying an offset which is not an integer multiple of the markets tick size should be rejected. + #0037-OPEG-026:Given a market with non-zero market and asset decimals where the asset decimals are strictly more than the market decimals (yielding a negative price factor). A pegged order specifying an offset which is not an integer multiple of the markets tick size should be rejected. + And the markets: + | id | quote name | asset | liquidity monitoring | risk model | margin calculator | auction duration | fees | price monitoring | data source config | linear slippage factor | quadratic slippage factor | sla params | decimal places | tick size | + | ETH/DEC21 | ETH | ETH | lqm-params | simple-risk-model-1 | default-margin-calculator | 1 | fees-config-1 | price-monitoring-1 | default-eth-for-future | 0.5 | 0 | SLA | 2 | 10 | + | ETH/DEC22 | ETH | ETH | lqm-params | simple-risk-model-1 | default-margin-calculator | 1 | fees-config-1 | price-monitoring-1 | default-eth-for-future | 0.5 | 0 | SLA | 2 | 5 | + | ETH/DEC23 | ETH | ETH | lqm-params | simple-risk-model-1 | default-margin-calculator | 1 | fees-config-1 | price-monitoring-1 | default-eth-for-future | 0.5 | 0 | SLA | 1 | 5 | + | ETH/DEC24 | ETH | ETH | lqm-params | simple-risk-model-1 | default-margin-calculator | 1 | fees-config-1 | price-monitoring-1 | default-eth-for-future | 0.5 | 0 | SLA | 0 | 10 | + And the parties deposit on asset's general account the following amount: + | party | asset | amount | + | party1 | ETH | 100000 | + | party3 | ETH | 1000000 | + | party4 | ETH | 1000000 | + And the average block duration is "1" + + And the parties place the following orders: + | party | market id | side | volume | price | resulting trades | type | tif | reference | error | + | party3 | ETH/DEC21 | buy | 100 | 101 | 0 | TYPE_LIMIT | TIF_GTC | p3b1-1 | OrderError: price not in tick size | + | party3 | ETH/DEC21 | buy | 10 | 111 | 0 | TYPE_LIMIT | TIF_GTC | p3b2-1 | OrderError: price not in tick size | + | party4 | ETH/DEC21 | sell | 10 | 111 | 0 | TYPE_LIMIT | TIF_GTC | p4s2-1 | OrderError: price not in tick size | + | party4 | ETH/DEC21 | sell | 1000 | 191 | 0 | TYPE_LIMIT | TIF_GTC | p4s1-1 | OrderError: price not in tick size | + | party3 | ETH/DEC22 | buy | 100 | 101 | 0 | TYPE_LIMIT | TIF_GTC | p3b1-2 | OrderError: price not in tick size | + | party3 | ETH/DEC22 | buy | 10 | 111 | 0 | TYPE_LIMIT | TIF_GTC | p3b2-2 | OrderError: price not in tick size | + | party4 | ETH/DEC22 | sell | 10 | 111 | 0 | TYPE_LIMIT | TIF_GTC | p4s2-2 | OrderError: price not in tick size | + | party4 | ETH/DEC22 | sell | 1000 | 191 | 0 | TYPE_LIMIT | TIF_GTC | p4s1-2 | OrderError: price not in tick size | + | party3 | ETH/DEC23 | buy | 100 | 101 | 0 | TYPE_LIMIT | TIF_GTC | p3b1-3 | OrderError: price not in tick size | + | party3 | ETH/DEC23 | buy | 10 | 111 | 0 | TYPE_LIMIT | TIF_GTC | p3b2-3 | OrderError: price not in tick size | + | party4 | ETH/DEC23 | sell | 10 | 111 | 0 | TYPE_LIMIT | TIF_GTC | p4s2-3 | OrderError: price not in tick size | + | party4 | ETH/DEC23 | sell | 1000 | 191 | 0 | TYPE_LIMIT | TIF_GTC | p4s1-3 | OrderError: price not in tick size | + | party3 | ETH/DEC24 | buy | 100 | 101 | 0 | TYPE_LIMIT | TIF_GTC | p3b1-4 | OrderError: price not in tick size | + | party3 | ETH/DEC24 | buy | 10 | 111 | 0 | TYPE_LIMIT | TIF_GTC | p3b2-4 | OrderError: price not in tick size | + | party4 | ETH/DEC24 | sell | 10 | 111 | 0 | TYPE_LIMIT | TIF_GTC | p4s2-4 | OrderError: price not in tick size | + | party4 | ETH/DEC24 | sell | 1000 | 191 | 0 | TYPE_LIMIT | TIF_GTC | p4s1-4 | OrderError: price not in tick size | + + Then the network moves ahead "2" blocks + And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC21" + And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC22" + And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC23" + And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC24" + + And the parties place the following pegged iceberg orders: + | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference | error | + | party1 | ETH/DEC21 | 10 | 5 | buy | MID | 10 | 10 | peg-buy-1 | | + | party1 | ETH/DEC21 | 10 | 5 | sell | MID | 20 | 20 | peg-buy-2 | | + | party1 | ETH/DEC21 | 10 | 5 | buy | MID | 20 | 100 | peg-buy-3 | | + | party1 | ETH/DEC21 | 10 | 5 | sell | MID | 20 | 2 | peg-buy-4 | OrderError: price not in tick size | + | party1 | ETH/DEC21 | 10 | 5 | buy | MID | 20 | 5 | peg-buy-5 | OrderError: price not in tick size | + | party1 | ETH/DEC22 | 10 | 5 | buy | MID | 20 | 15 | peg-buy-6 | | + | party1 | ETH/DEC23 | 10 | 5 | sell | MID | 20 | 6 | peg-buy-7 | OrderError: price not in tick size | + | party1 | ETH/DEC24 | 10 | 5 | buy | MID | 20 | 17 | peg-buy-8 | OrderError: price not in tick size | diff --git a/core/integration/features/spot/orders/0037-OPEG-023.feature b/core/integration/features/spot/orders/0037-OPEG-023.feature new file mode 100644 index 00000000000..71f64c9ce4c --- /dev/null +++ b/core/integration/features/spot/orders/0037-OPEG-023.feature @@ -0,0 +1,91 @@ + +Feature: 0001 tick size should be using market decimal, A pegged order specifying an offset which is not an integer multiple of the markets tick size should be rejected. + + Background: + Given the following network parameters are set: + | name | value | + | market.liquidity.bondPenaltyParameter | 1 | + | network.markPriceUpdateMaximumFrequency | 0s | + | limits.markets.maxPeggedOrders | 6 | + | validators.epoch.length | 5s | + | market.liquidity.earlyExitPenalty | 0.25 | + | market.liquidity.stakeToCcyVolume | 1.0 | + | market.liquidity.sla.nonPerformanceBondPenaltySlope | 0.19 | + | market.liquidity.sla.nonPerformanceBondPenaltyMax | 1 | + + And the liquidity monitoring parameters: + | name | triggering ratio | time window | scaling factor | + | lqm-params | 0.1 | 24h | 1 | + + And the following assets are registered: + | id | decimal places | + | ETH | 1 | + | BTC | 1 | + + And the average block duration is "1" + And the simple risk model named "simple-risk-model-1": + | long | short | max move up | min move down | probability of trading | + | 0.1 | 0.1 | 60 | 50 | 0.2 | + And the fees configuration named "fees-config-1": + | maker fee | infrastructure fee | + | 0 | 0 | + And the price monitoring named "price-monitoring-1": + | horizon | probability | auction extension | + | 1 | 0.99 | 5 | + And the liquidity sla params named "SLA": + | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | + | 0.01 | 0.5 | 1 | 1.0 | + + Scenario: + #0037-OPEG-023:Given a market with non-zero market and asset decimals where the asset decimals are strictly less than the market decimals (yielding a negative price factor). A pegged order specifying an offset which is not an integer multiple of the markets tick size should be rejected. + #0037-OPEG-024:Given a market with non-zero market and asset decimals where the asset decimals are equal to the market decimals (yielding a negative price factor). A pegged order specifying an offset which is not an integer multiple of the markets tick size should be rejected. + #0037-OPEG-027:Given a market with non-zero market and asset decimals where the asset decimals are strictly more than the market decimals (yielding a negative price factor). A pegged order specifying an offset which is not an integer multiple of the markets tick size should be rejected. + And the spot markets: + | id | name | quote asset | base asset | liquidity monitoring | risk model | auction duration | fees | price monitoring | sla params | decimal places | tick size | + | ETH/DEC21 | BTC/ETH | BTC | ETH | lqm-params | simple-risk-model-1 | 1 | fees-config-1 | price-monitoring-1 | default-basic | 2 | 10 | + | ETH/DEC22 | BTC/ETH | BTC | ETH | lqm-params | simple-risk-model-1 | 1 | fees-config-1 | price-monitoring-1 | default-basic | 2 | 5 | + | ETH/DEC23 | BTC/ETH | BTC | ETH | lqm-params | simple-risk-model-1 | 1 | fees-config-1 | price-monitoring-1 | default-basic | 1 | 5 | + | ETH/DEC24 | BTC/ETH | BTC | ETH | lqm-params | simple-risk-model-1 | 1 | fees-config-1 | price-monitoring-1 | default-basic | 0 | 10 | + And the parties deposit on asset's general account the following amount: + | party | asset | amount | + | party1 | ETH | 1000000000000 | + | party1 | BTC | 1000 | + | party3 | ETH | 1000000 | + | party4 | ETH | 1000000 | + And the average block duration is "1" + + And the parties place the following orders: + | party | market id | side | volume | price | resulting trades | type | tif | reference | error | + | party3 | ETH/DEC21 | buy | 100 | 101 | 0 | TYPE_LIMIT | TIF_GTC | p3b1-1 | OrderError: price not in tick size | + | party3 | ETH/DEC21 | buy | 10 | 111 | 0 | TYPE_LIMIT | TIF_GTC | p3b2-1 | OrderError: price not in tick size | + | party4 | ETH/DEC21 | sell | 10 | 111 | 0 | TYPE_LIMIT | TIF_GTC | p4s2-1 | OrderError: price not in tick size | + | party4 | ETH/DEC21 | sell | 1000 | 191 | 0 | TYPE_LIMIT | TIF_GTC | p4s1-1 | OrderError: price not in tick size | + | party3 | ETH/DEC22 | buy | 100 | 101 | 0 | TYPE_LIMIT | TIF_GTC | p3b1-2 | OrderError: price not in tick size | + | party3 | ETH/DEC22 | buy | 10 | 111 | 0 | TYPE_LIMIT | TIF_GTC | p3b2-2 | OrderError: price not in tick size | + | party4 | ETH/DEC22 | sell | 10 | 111 | 0 | TYPE_LIMIT | TIF_GTC | p4s2-2 | OrderError: price not in tick size | + | party4 | ETH/DEC22 | sell | 1000 | 191 | 0 | TYPE_LIMIT | TIF_GTC | p4s1-2 | OrderError: price not in tick size | + | party3 | ETH/DEC23 | buy | 100 | 101 | 0 | TYPE_LIMIT | TIF_GTC | p3b1-3 | OrderError: price not in tick size | + | party3 | ETH/DEC23 | buy | 10 | 111 | 0 | TYPE_LIMIT | TIF_GTC | p3b2-3 | OrderError: price not in tick size | + | party4 | ETH/DEC23 | sell | 10 | 111 | 0 | TYPE_LIMIT | TIF_GTC | p4s2-3 | OrderError: price not in tick size | + | party4 | ETH/DEC23 | sell | 1000 | 191 | 0 | TYPE_LIMIT | TIF_GTC | p4s1-3 | OrderError: price not in tick size | + | party3 | ETH/DEC24 | buy | 100 | 101 | 0 | TYPE_LIMIT | TIF_GTC | p3b1-4 | OrderError: price not in tick size | + | party3 | ETH/DEC24 | buy | 10 | 111 | 0 | TYPE_LIMIT | TIF_GTC | p3b2-4 | OrderError: price not in tick size | + | party4 | ETH/DEC24 | sell | 10 | 111 | 0 | TYPE_LIMIT | TIF_GTC | p4s2-4 | OrderError: price not in tick size | + | party4 | ETH/DEC24 | sell | 1000 | 191 | 0 | TYPE_LIMIT | TIF_GTC | p4s1-4 | OrderError: price not in tick size | + + Then the network moves ahead "2" blocks + And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC21" + And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC22" + And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC23" + And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC24" + + And the parties place the following pegged iceberg orders: + | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference | error | + | party1 | ETH/DEC21 | 10 | 5 | buy | MID | 10 | 10 | peg-buy-1 | | + | party1 | ETH/DEC21 | 10 | 5 | sell | MID | 20 | 20 | peg-buy-2 | | + | party1 | ETH/DEC21 | 10 | 5 | buy | MID | 20 | 100 | peg-buy-3 | | + | party1 | ETH/DEC21 | 10 | 5 | sell | MID | 20 | 2 | peg-buy-4 | OrderError: price not in tick size | + | party1 | ETH/DEC21 | 10 | 5 | buy | MID | 20 | 5 | peg-buy-5 | OrderError: price not in tick size | + | party1 | ETH/DEC22 | 10 | 5 | buy | MID | 20 | 15 | peg-buy-6 | | + | party1 | ETH/DEC23 | 10 | 5 | sell | MID | 20 | 6 | peg-buy-7 | OrderError: price not in tick size | + | party1 | ETH/DEC24 | 10 | 5 | buy | MID | 20 | 17 | peg-buy-8 | OrderError: price not in tick size | diff --git a/core/integration/features/verified/special_orders_crossed.feature b/core/integration/features/verified/special_orders_crossed.feature new file mode 100644 index 00000000000..1d0cced078c --- /dev/null +++ b/core/integration/features/verified/special_orders_crossed.feature @@ -0,0 +1,37 @@ + +Feature: Issue: re submit special order would cross + + Background: + + Given the average block duration is "1" + And the following assets are registered: + | id | decimal places | + | ETH | 1 | + And the following network parameters are set: + | name | value | + | limits.markets.maxPeggedOrders | 6 | + + Given the markets: + | id | quote name | asset | liquidity monitoring | risk model | margin calculator | auction duration | fees | price monitoring | data source config | linear slippage factor | quadratic slippage factor | sla params | decimal places | tick size | + | ETH/DEC21 | ETH | ETH | default-parameters | default-simple-risk-model | default-margin-calculator | 1 | default-none | default-none | default-eth-for-future | 0.5 | 0 | default-basic | 2 | 10 | + And the parties deposit on asset's general account the following amount: + | party | asset | amount | + | aux1 | ETH | 1000000000000 | + | aux2 | ETH | 1000000000000 | + | party1 | ETH | 1000000000000 | + | party2 | ETH | 1000000000000 | + + Scenario: + + Given the parties place the following pegged iceberg orders: + | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference | error | + | party1 | ETH/DEC21 | 10 | 5 | buy | MID | 10 | 10 | peg-buy-1 | | + | party2 | ETH/DEC21 | 10 | 5 | sell | MID | 10 | 10 | peg-buy-2 | | + And the parties place the following orders: + | party | market id | side | volume | price | resulting trades | type | tif | reference | + | aux1 | ETH/DEC21 | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | p3b1-1 | + | aux1 | ETH/DEC21 | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | p3b1-1 | + | aux2 | ETH/DEC21 | sell | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | p3b2-1 | + | aux2 | ETH/DEC21 | sell | 1 | 1010 | 0 | TYPE_LIMIT | TIF_GTC | p3b2-1 | + When the opening auction period ends for market "ETH/DEC21" + Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC21" \ No newline at end of file From a4e0d42c18f69a87729bd716294be8ad87999367 Mon Sep 17 00:00:00 2001 From: Jeremy Letang Date: Wed, 22 May 2024 10:15:11 +0200 Subject: [PATCH 12/19] chore: release version 0.76.5 Signed-off-by: Jeremy Letang --- CHANGELOG.md | 7 ++++++- protos/blockexplorer/api/v1/blockexplorer.pb.go | 2 +- protos/data-node/api/v2/trading_data.pb.go | 2 +- protos/sources/blockexplorer/api/v1/blockexplorer.proto | 2 +- protos/sources/data-node/api/v2/trading_data.proto | 2 +- protos/sources/vega/api/v1/core.proto | 2 +- protos/sources/vega/api/v1/corestate.proto | 2 +- protos/vega/api/v1/core.pb.go | 2 +- protos/vega/api/v1/corestate.pb.go | 2 +- version/version.go | 2 +- 10 files changed, 15 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13f952cd3e7..20344120828 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,13 +19,18 @@ - [](https://github.com/vegaprotocol/vega/issues/xxx) +## 0.76.5 + +### πŸ› Fixes +- [11304](https://github.com/vegaprotocol/vega/issues/11304) - Correctly verify pegged order offset with respect to tick size in the right units. + + ## 0.76.4 ### πŸ› Fixes - [11293](https://github.com/vegaprotocol/vega/issues/11293) - Panic in data node with position estimate endpoint. - [11297](https://github.com/vegaprotocol/vega/issues/11297) - Handle properly asset decimals < market decimals when uncrossing the order book upon leaving auction. -- [11304](https://github.com/vegaprotocol/vega/issues/11304) - Correctly verify pegged order offset with respect to tick size in the right units. ## 0.76.3 diff --git a/protos/blockexplorer/api/v1/blockexplorer.pb.go b/protos/blockexplorer/api/v1/blockexplorer.pb.go index 9885857df90..d7ea6862062 100644 --- a/protos/blockexplorer/api/v1/blockexplorer.pb.go +++ b/protos/blockexplorer/api/v1/blockexplorer.pb.go @@ -656,7 +656,7 @@ var file_blockexplorer_api_v1_blockexplorer_proto_rawDesc = []byte{ 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x72, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x92, 0x41, 0x3e, 0x12, 0x23, 0x0a, 0x18, 0x56, 0x65, 0x67, 0x61, 0x20, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x20, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x72, 0x65, 0x72, 0x20, - 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x34, 0x1a, 0x13, 0x6c, + 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x35, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/protos/data-node/api/v2/trading_data.pb.go b/protos/data-node/api/v2/trading_data.pb.go index 17f0d4ddef0..52cf139cd3c 100644 --- a/protos/data-node/api/v2/trading_data.pb.go +++ b/protos/data-node/api/v2/trading_data.pb.go @@ -30538,7 +30538,7 @@ var file_data_node_api_v2_trading_data_proto_rawDesc = []byte{ 0x6f, 0x73, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x2d, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x92, 0x41, 0x8f, 0x01, 0x12, 0x1e, 0x0a, 0x13, 0x56, 0x65, 0x67, 0x61, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x6e, 0x6f, 0x64, 0x65, 0x20, 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, - 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x34, 0x1a, 0x1c, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, + 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x35, 0x1a, 0x1c, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x61, 0x70, 0x69, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x52, 0x39, 0x0a, 0x03, 0x35, diff --git a/protos/sources/blockexplorer/api/v1/blockexplorer.proto b/protos/sources/blockexplorer/api/v1/blockexplorer.proto index 1cda3060320..368e4a5cd41 100644 --- a/protos/sources/blockexplorer/api/v1/blockexplorer.proto +++ b/protos/sources/blockexplorer/api/v1/blockexplorer.proto @@ -11,7 +11,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/blockexplorer/api/v1"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega block explorer APIs"; - version: "v0.76.4"; + version: "v0.76.5"; } schemes: [ HTTP, diff --git a/protos/sources/data-node/api/v2/trading_data.proto b/protos/sources/data-node/api/v2/trading_data.proto index f27d69438bd..d54d878faef 100644 --- a/protos/sources/data-node/api/v2/trading_data.proto +++ b/protos/sources/data-node/api/v2/trading_data.proto @@ -17,7 +17,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/data-node/api/v2"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega data node APIs"; - version: "v0.76.4"; + version: "v0.76.5"; } schemes: [ HTTP, diff --git a/protos/sources/vega/api/v1/core.proto b/protos/sources/vega/api/v1/core.proto index 3cc975b6c0c..f559cadab47 100644 --- a/protos/sources/vega/api/v1/core.proto +++ b/protos/sources/vega/api/v1/core.proto @@ -12,7 +12,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/vega/api/v1"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega core APIs"; - version: "v0.76.4"; + version: "v0.76.5"; } schemes: [ HTTP, diff --git a/protos/sources/vega/api/v1/corestate.proto b/protos/sources/vega/api/v1/corestate.proto index 41828d6648d..437c4820587 100644 --- a/protos/sources/vega/api/v1/corestate.proto +++ b/protos/sources/vega/api/v1/corestate.proto @@ -13,7 +13,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/vega/api/v1"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega core state APIs"; - version: "v0.76.4"; + version: "v0.76.5"; } schemes: [ HTTP, diff --git a/protos/vega/api/v1/core.pb.go b/protos/vega/api/v1/core.pb.go index 08ee7749b89..e687dca78e7 100644 --- a/protos/vega/api/v1/core.pb.go +++ b/protos/vega/api/v1/core.pb.go @@ -2796,7 +2796,7 @@ var file_vega_api_v1_core_proto_rawDesc = []byte{ 0x6f, 0x6c, 0x2e, 0x69, 0x6f, 0x2f, 0x76, 0x65, 0x67, 0x61, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x76, 0x65, 0x67, 0x61, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x92, 0x41, 0x34, 0x12, 0x19, 0x0a, 0x0e, 0x56, 0x65, 0x67, 0x61, 0x20, 0x63, 0x6f, 0x72, 0x65, 0x20, 0x41, 0x50, - 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x34, 0x1a, 0x13, 0x6c, 0x62, 0x2e, + 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x35, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/protos/vega/api/v1/corestate.pb.go b/protos/vega/api/v1/corestate.pb.go index 814c882d451..2614897ec5b 100644 --- a/protos/vega/api/v1/corestate.pb.go +++ b/protos/vega/api/v1/corestate.pb.go @@ -1512,7 +1512,7 @@ var file_vega_api_v1_corestate_proto_rawDesc = []byte{ 0x6f, 0x73, 0x2f, 0x76, 0x65, 0x67, 0x61, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x92, 0x41, 0x3a, 0x12, 0x1f, 0x0a, 0x14, 0x56, 0x65, 0x67, 0x61, 0x20, 0x63, 0x6f, 0x72, 0x65, 0x20, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, - 0x2e, 0x34, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, + 0x2e, 0x35, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/version/version.go b/version/version.go index c99271fbb80..8d380a93ebf 100644 --- a/version/version.go +++ b/version/version.go @@ -22,7 +22,7 @@ import ( var ( cliVersionHash = "" - cliVersion = "v0.76.4" + cliVersion = "v0.76.5" ) func init() { From 2952b41d4af6856c4edc76c8626d54c1eb37623b Mon Sep 17 00:00:00 2001 From: Jeremy Letang Date: Wed, 22 May 2024 13:51:15 +0200 Subject: [PATCH 13/19] Merge pull request #11306 from vegaprotocol/11304-2 feat: add additional test coverage for pegged orders --- core/execution/future/market.go | 7 + core/execution/spot/market.go | 7 + .../features/verified/pegged_orders.feature | 165 ++++++++++++++++++ 3 files changed, 179 insertions(+) create mode 100644 core/integration/features/verified/pegged_orders.feature diff --git a/core/execution/future/market.go b/core/execution/future/market.go index 66829b7cf4c..825dc0fc1d9 100644 --- a/core/execution/future/market.go +++ b/core/execution/future/market.go @@ -1786,6 +1786,13 @@ func (m *Market) validateOrder(ctx context.Context, order *types.Order) (err err } return reason } + if order.PeggedOrder.Reference == types.PeggedReferenceMid { + offsetInAsset, _ := num.UintFromDecimal(order.PeggedOrder.Offset.ToDecimal().Mul(m.priceFactor)) + tickSizeInAsset, _ := num.UintFromDecimal(m.mkt.TickSize.ToDecimal().Mul(m.priceFactor)) + if offsetInAsset.IsZero() && tickSizeInAsset.IsZero() { + return fmt.Errorf("invalid offset - pegged mid will cross") + } + } return m.validateTickSize(order.PeggedOrder.Offset) } diff --git a/core/execution/spot/market.go b/core/execution/spot/market.go index 2ffcee16207..78c3d1c776d 100644 --- a/core/execution/spot/market.go +++ b/core/execution/spot/market.go @@ -1046,6 +1046,13 @@ func (m *Market) validateOrder(ctx context.Context, order *types.Order) (err err } return reason } + if order.PeggedOrder.Reference == types.PeggedReferenceMid { + offsetInAsset, _ := num.UintFromDecimal(order.PeggedOrder.Offset.ToDecimal().Mul(m.priceFactor)) + tickSizeInAsset, _ := num.UintFromDecimal(m.mkt.TickSize.ToDecimal().Mul(m.priceFactor)) + if offsetInAsset.IsZero() && tickSizeInAsset.IsZero() { + return fmt.Errorf("invalid offset - pegged mid will cross") + } + } return m.validateTickSize(order.PeggedOrder.Offset) } diff --git a/core/integration/features/verified/pegged_orders.feature b/core/integration/features/verified/pegged_orders.feature new file mode 100644 index 00000000000..a99abf2d611 --- /dev/null +++ b/core/integration/features/verified/pegged_orders.feature @@ -0,0 +1,165 @@ + +Feature: Pegged orders do not cross + + Aiming for full coverage of edge-cases, check the following for both + derivative and spot markets: + + - Market decimals > asset decimals + - Market decimals < asset decimals + + - For each of the above + - tick size cannot be expressed in asset decimals + - tick size can just be expressed in asset decimals + - tick size can be expressed in asset decimals + + - For each of the above + - offset cannot be expressed in asset decimals + - offset can just be expressed in asset decimals + - offset can be expressed in asset decimals + + Background: + + Given the average block duration is "1" + And the following assets are registered: + | id | decimal places | quantum | + | ETH.1.10 | 1 | 1 | + | BTC.1.10 | 1 | 1 | + + And the following network parameters are set: + | name | value | + | limits.markets.maxPeggedOrders | 6 | + + And the parties deposit on asset's general account the following amount: + | party | asset | amount | + | aux1 | ETH.1.10 | 1000000000000000 | + | aux2 | ETH.1.10 | 1000000000000000 | + | party1 | ETH.1.10 | 1000000000000000 | + | party2 | ETH.1.10 | 1000000000000000 | + | aux1 | BTC.1.10 | 1000000000000000 | + | aux2 | BTC.1.10 | 1000000000000000 | + | party1 | BTC.1.10 | 1000000000000000 | + | party2 | BTC.1.10 | 1000000000000000 | + + Scenario Outline: Derivative markets - market decimals > asset decimals + + Given the markets: + | id | quote name | asset | liquidity monitoring | risk model | margin calculator | auction duration | fees | price monitoring | data source config | linear slippage factor | quadratic slippage factor | sla params | decimal places | tick size | + | ETH.1.10/DEC21 | ETH.1.10 | ETH.1.10 | default-parameters | default-simple-risk-model | default-margin-calculator | 1 | default-none | default-none | default-eth-for-future | 0.5 | 0 | default-basic | 2 | | + Given the parties place the following pegged orders: + | party | market id | side | pegged reference | volume | offset | reference | error | + | party1 | ETH.1.10/DEC21 | buy | MID | 10 | | peg-buy | | + | party2 | ETH.1.10/DEC21 | sell | MID | 10 | | peg-sell | | + And the parties place the following orders: + | party | market id | side | volume | price | resulting trades | type | tif | reference | + | aux1 | ETH.1.10/DEC21 | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | p3b1-1 | + | aux1 | ETH.1.10/DEC21 | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | p3b1-1 | + | aux2 | ETH.1.10/DEC21 | sell | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | p3b2-1 | + | aux2 | ETH.1.10/DEC21 | sell | 1 | | 0 | TYPE_LIMIT | TIF_GTC | p3b2-1 | + When the opening auction period ends for market "ETH.1.10/DEC21" + Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH.1.10/DEC21" + + Examples: + | bo | tick size | offset | error | + | 1010 | 1 | 1 | invalid offset - pegged mid will cross | + | 1010 | 1 | 10 | | + | 1010 | 1 | 100 | | + | 1010 | 10 | 1 | OrderError: price not in tick size | + | 1010 | 10 | 10 | | + | 1010 | 10 | 100 | | + | 1100 | 100 | 1 | OrderError: price not in tick size | + | 1100 | 100 | 10 | OrderError: price not in tick size | + | 1100 | 100 | 100 | | + + + Scenario Outline: Derivative markets - market decimals < asset decimals + + Given the markets: + | id | quote name | asset | liquidity monitoring | risk model | margin calculator | auction duration | fees | price monitoring | data source config | linear slippage factor | quadratic slippage factor | sla params | decimal places | tick size | + | ETH.1.10/DEC21 | ETH.1.10 | ETH.1.10 | default-parameters | default-simple-risk-model | default-margin-calculator | 1 | default-none | default-none | default-eth-for-future | 0.5 | 0 | default-basic | 0 | | + Given the parties place the following pegged orders: + | party | market id | side | pegged reference | volume | offset | reference | error | + | party1 | ETH.1.10/DEC21 | buy | MID | 10 | | peg-buy | | + | party2 | ETH.1.10/DEC21 | sell | MID | 10 | | peg-sell | | + And the parties place the following orders: + | party | market id | side | volume | price | resulting trades | type | tif | reference | + | aux1 | ETH.1.10/DEC21 | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | p3b1-1 | + | aux1 | ETH.1.10/DEC21 | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | p3b1-1 | + | aux2 | ETH.1.10/DEC21 | sell | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | p3b2-1 | + | aux2 | ETH.1.10/DEC21 | sell | 1 | | 0 | TYPE_LIMIT | TIF_GTC | p3b2-1 | + When the opening auction period ends for market "ETH.1.10/DEC21" + Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH.1.10/DEC21" + + Examples: + | bo | tick size | offset | error | + | 1001 | 1 | 1 | | + | 1001 | 1 | 10 | | + | 1001 | 1 | 100 | | + | 1010 | 10 | 1 | OrderError: price not in tick size | + | 1010 | 10 | 10 | | + | 1010 | 10 | 100 | | + | 1100 | 100 | 1 | OrderError: price not in tick size | + | 1100 | 100 | 10 | OrderError: price not in tick size | + | 1100 | 100 | 100 | | + + + Scenario Outline: Spot market - market decimals > asset decimals + + Given the spot markets: + | id | name | base asset | quote asset | liquidity monitoring | risk model | auction duration | fees | price monitoring | sla params | decimal places | tick size | + | BTC/ETH | BTC/ETH | BTC.1.10 | ETH.1.10 | default-parameters | default-simple-risk-model | 1 | default-none | default-none | default-basic | 2 | | + Given the parties place the following pegged orders: + | party | market id | side | pegged reference | volume | offset | reference | error | + | party1 | BTC/ETH | buy | MID | 10 | | peg-buy | | + | party2 | BTC/ETH | sell | MID | 10 | | peg-sell | | + And the parties place the following orders: + | party | market id | side | volume | price | resulting trades | type | tif | reference | + | aux1 | BTC/ETH | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | p3b1-1 | + | aux1 | BTC/ETH | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | p3b1-1 | + | aux2 | BTC/ETH | sell | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | p3b2-1 | + | aux2 | BTC/ETH | sell | 1 | | 0 | TYPE_LIMIT | TIF_GTC | p3b2-1 | + When the opening auction period ends for market "BTC/ETH" + Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" + + Examples: + | bo | tick size | offset | error | + | 1010 | 1 | 1 | invalid offset - pegged mid will cross | + | 1010 | 1 | 10 | | + | 1010 | 1 | 100 | | + | 1010 | 10 | 1 | OrderError: price not in tick size | + | 1010 | 10 | 10 | | + | 1010 | 10 | 100 | | + | 1100 | 100 | 1 | OrderError: price not in tick size | + | 1100 | 100 | 10 | OrderError: price not in tick size | + | 1100 | 100 | 100 | | + + + Scenario Outline: Spot market - market decimals < asset decimals + + Given the spot markets: + | id | name | base asset | quote asset | liquidity monitoring | risk model | auction duration | fees | price monitoring | sla params | decimal places | tick size | + | BTC/ETH | BTC/ETH | BTC.1.10 | ETH.1.10 | default-parameters | default-simple-risk-model | 1 | default-none | default-none | default-basic | 0 | | + Given the parties place the following pegged orders: + | party | market id | side | pegged reference | volume | offset | reference | error | + | party1 | BTC/ETH | buy | MID | 10 | | peg-buy | | + | party2 | BTC/ETH | sell | MID | 10 | | peg-sell | | + And the parties place the following orders: + | party | market id | side | volume | price | resulting trades | type | tif | reference | + | aux1 | BTC/ETH | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | p3b1-1 | + | aux1 | BTC/ETH | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | p3b1-1 | + | aux2 | BTC/ETH | sell | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | p3b2-1 | + | aux2 | BTC/ETH | sell | 1 | | 0 | TYPE_LIMIT | TIF_GTC | p3b2-1 | + When the opening auction period ends for market "BTC/ETH" + Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" + + Examples: + | bo | tick size | offset | error | + | 1001 | 1 | 1 | | + | 1001 | 1 | 10 | | + | 1001 | 1 | 100 | | + | 1010 | 10 | 1 | OrderError: price not in tick size | + | 1010 | 10 | 10 | | + | 1010 | 10 | 100 | | + | 1100 | 100 | 1 | OrderError: price not in tick size | + | 1100 | 100 | 10 | OrderError: price not in tick size | + | 1100 | 100 | 100 | | + From 34ca0c3c29968fc7fd65e016a411935da2cf10ee Mon Sep 17 00:00:00 2001 From: Jeremy Letang Date: Wed, 22 May 2024 13:55:06 +0200 Subject: [PATCH 14/19] chore: release version 0.76.6 Signed-off-by: Jeremy Letang --- CHANGELOG.md | 7 +++++++ protos/blockexplorer/api/v1/blockexplorer.pb.go | 2 +- protos/data-node/api/v2/trading_data.pb.go | 2 +- protos/sources/blockexplorer/api/v1/blockexplorer.proto | 2 +- protos/sources/data-node/api/v2/trading_data.proto | 2 +- protos/sources/vega/api/v1/core.proto | 2 +- protos/sources/vega/api/v1/corestate.proto | 2 +- protos/vega/api/v1/core.pb.go | 2 +- protos/vega/api/v1/corestate.pb.go | 2 +- version/version.go | 2 +- 10 files changed, 16 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20344120828..cec0c5c329f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,10 +18,17 @@ - [](https://github.com/vegaprotocol/vega/issues/xxx) +## 0.76.6 + +### πŸ› Fixes + +- [11306](https://github.com/vegaprotocol/vega/pull/11306) - More fixes regarding pegged orders. + ## 0.76.5 ### πŸ› Fixes + - [11304](https://github.com/vegaprotocol/vega/issues/11304) - Correctly verify pegged order offset with respect to tick size in the right units. diff --git a/protos/blockexplorer/api/v1/blockexplorer.pb.go b/protos/blockexplorer/api/v1/blockexplorer.pb.go index d7ea6862062..b9ecb9e7182 100644 --- a/protos/blockexplorer/api/v1/blockexplorer.pb.go +++ b/protos/blockexplorer/api/v1/blockexplorer.pb.go @@ -656,7 +656,7 @@ var file_blockexplorer_api_v1_blockexplorer_proto_rawDesc = []byte{ 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x72, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x92, 0x41, 0x3e, 0x12, 0x23, 0x0a, 0x18, 0x56, 0x65, 0x67, 0x61, 0x20, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x20, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x72, 0x65, 0x72, 0x20, - 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x35, 0x1a, 0x13, 0x6c, + 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x36, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/protos/data-node/api/v2/trading_data.pb.go b/protos/data-node/api/v2/trading_data.pb.go index 52cf139cd3c..86e94b15083 100644 --- a/protos/data-node/api/v2/trading_data.pb.go +++ b/protos/data-node/api/v2/trading_data.pb.go @@ -30538,7 +30538,7 @@ var file_data_node_api_v2_trading_data_proto_rawDesc = []byte{ 0x6f, 0x73, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x2d, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x92, 0x41, 0x8f, 0x01, 0x12, 0x1e, 0x0a, 0x13, 0x56, 0x65, 0x67, 0x61, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x6e, 0x6f, 0x64, 0x65, 0x20, 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, - 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x35, 0x1a, 0x1c, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, + 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x36, 0x1a, 0x1c, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x61, 0x70, 0x69, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x52, 0x39, 0x0a, 0x03, 0x35, diff --git a/protos/sources/blockexplorer/api/v1/blockexplorer.proto b/protos/sources/blockexplorer/api/v1/blockexplorer.proto index 368e4a5cd41..85b205a6277 100644 --- a/protos/sources/blockexplorer/api/v1/blockexplorer.proto +++ b/protos/sources/blockexplorer/api/v1/blockexplorer.proto @@ -11,7 +11,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/blockexplorer/api/v1"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega block explorer APIs"; - version: "v0.76.5"; + version: "v0.76.6"; } schemes: [ HTTP, diff --git a/protos/sources/data-node/api/v2/trading_data.proto b/protos/sources/data-node/api/v2/trading_data.proto index d54d878faef..992bb451ebc 100644 --- a/protos/sources/data-node/api/v2/trading_data.proto +++ b/protos/sources/data-node/api/v2/trading_data.proto @@ -17,7 +17,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/data-node/api/v2"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega data node APIs"; - version: "v0.76.5"; + version: "v0.76.6"; } schemes: [ HTTP, diff --git a/protos/sources/vega/api/v1/core.proto b/protos/sources/vega/api/v1/core.proto index f559cadab47..644731cbc52 100644 --- a/protos/sources/vega/api/v1/core.proto +++ b/protos/sources/vega/api/v1/core.proto @@ -12,7 +12,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/vega/api/v1"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega core APIs"; - version: "v0.76.5"; + version: "v0.76.6"; } schemes: [ HTTP, diff --git a/protos/sources/vega/api/v1/corestate.proto b/protos/sources/vega/api/v1/corestate.proto index 437c4820587..f2c3326c9e0 100644 --- a/protos/sources/vega/api/v1/corestate.proto +++ b/protos/sources/vega/api/v1/corestate.proto @@ -13,7 +13,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/vega/api/v1"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega core state APIs"; - version: "v0.76.5"; + version: "v0.76.6"; } schemes: [ HTTP, diff --git a/protos/vega/api/v1/core.pb.go b/protos/vega/api/v1/core.pb.go index e687dca78e7..25f435f9d0d 100644 --- a/protos/vega/api/v1/core.pb.go +++ b/protos/vega/api/v1/core.pb.go @@ -2796,7 +2796,7 @@ var file_vega_api_v1_core_proto_rawDesc = []byte{ 0x6f, 0x6c, 0x2e, 0x69, 0x6f, 0x2f, 0x76, 0x65, 0x67, 0x61, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x76, 0x65, 0x67, 0x61, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x92, 0x41, 0x34, 0x12, 0x19, 0x0a, 0x0e, 0x56, 0x65, 0x67, 0x61, 0x20, 0x63, 0x6f, 0x72, 0x65, 0x20, 0x41, 0x50, - 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x35, 0x1a, 0x13, 0x6c, 0x62, 0x2e, + 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x36, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/protos/vega/api/v1/corestate.pb.go b/protos/vega/api/v1/corestate.pb.go index 2614897ec5b..df1b558bc7e 100644 --- a/protos/vega/api/v1/corestate.pb.go +++ b/protos/vega/api/v1/corestate.pb.go @@ -1512,7 +1512,7 @@ var file_vega_api_v1_corestate_proto_rawDesc = []byte{ 0x6f, 0x73, 0x2f, 0x76, 0x65, 0x67, 0x61, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x92, 0x41, 0x3a, 0x12, 0x1f, 0x0a, 0x14, 0x56, 0x65, 0x67, 0x61, 0x20, 0x63, 0x6f, 0x72, 0x65, 0x20, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, - 0x2e, 0x35, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, + 0x2e, 0x36, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/version/version.go b/version/version.go index 8d380a93ebf..eca8c320144 100644 --- a/version/version.go +++ b/version/version.go @@ -22,7 +22,7 @@ import ( var ( cliVersionHash = "" - cliVersion = "v0.76.5" + cliVersion = "v0.76.6" ) func init() { From 1c7f3dd9213eda4379dde33660b97a636f011bbc Mon Sep 17 00:00:00 2001 From: Elias Van Ootegem Date: Tue, 14 May 2024 12:51:38 +0100 Subject: [PATCH 15/19] Merge pull request #11275 from vegaprotocol/order-cancellation-cache fix: add cache map to order sqlsubscriber --- datanode/sqlsubscribers/order.go | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/datanode/sqlsubscribers/order.go b/datanode/sqlsubscribers/order.go index 10a4b4281bf..81e03dfb81b 100644 --- a/datanode/sqlsubscribers/order.go +++ b/datanode/sqlsubscribers/order.go @@ -58,12 +58,17 @@ type Order struct { subscriber store OrderStore depthService MarketDepthService + // the store uses the batcher type which could be used as a cache, provided we know the + // version and vegatime type for the orders we need to persist. This isn't the case + // but orders are ingested here, so we can cache them here, of course. + cache map[entities.OrderID]entities.Order } func NewOrder(store OrderStore, depthService MarketDepthService) *Order { return &Order{ store: store, depthService: depthService, + cache: map[entities.OrderID]entities.Order{}, } } @@ -91,6 +96,8 @@ func (os *Order) Push(ctx context.Context, evt events.Event) error { } func (os *Order) Flush(ctx context.Context) error { + // clear cache + os.cache = map[entities.OrderID]entities.Order{} return os.store.Flush(ctx) } @@ -114,7 +121,7 @@ func (os *Order) expired(ctx context.Context, eo ExpiredOrdersEvent, seqNum uint } os.depthService.AddOrder(torder, os.vegaTime, seqNum) - if err := os.store.Add(o); err != nil { + if err := os.persist(o); err != nil { return errors.Wrap(os.store.Add(o), "adding order to database") } // the next order will be insterted as though it was the next event on the bus, with a new sequence number: @@ -124,10 +131,22 @@ func (os *Order) expired(ctx context.Context, eo ExpiredOrdersEvent, seqNum uint } func (os *Order) cancelled(ctx context.Context, co CancelledOrdersEvent, seqNum uint64) error { - orders, err := os.store.GetByMarketAndID(ctx, co.MarketID(), co.OrderIDs()) + allIds := co.OrderIDs() + ids := make([]string, 0, len(allIds)) + orders := make([]entities.Order, 0, len(allIds)) + for _, id := range allIds { + k := entities.OrderID(id) + if o, ok := os.cache[k]; ok { + orders = append(orders, o) + } else { + ids = append(ids, id) + } + } + ncOrders, err := os.store.GetByMarketAndID(ctx, co.MarketID(), ids) if err != nil { return err } + orders = append(orders, ncOrders...) txHash := entities.TxHash(co.TxHash()) for _, o := range orders { o.Status = entities.OrderStatusCancelled @@ -142,7 +161,7 @@ func (os *Order) cancelled(ctx context.Context, co CancelledOrdersEvent, seqNum } os.depthService.AddOrder(torder, os.vegaTime, seqNum) - if err := os.store.Add(o); err != nil { + if err := os.persist(o); err != nil { return errors.Wrap(err, "adding order to database") } seqNum++ @@ -166,9 +185,14 @@ func (os *Order) consume(oe OrderEvent, seqNum uint64) error { } os.depthService.AddOrder(torder, os.vegaTime, seqNum) - return errors.Wrap(os.store.Add(order), "adding order to database") + return errors.Wrap(os.persist(order), "adding order to database") } func (os *Order) consumeEndBlock() { os.depthService.PublishAtEndOfBlock() } + +func (os *Order) persist(o entities.Order) error { + os.cache[o.ID] = o + return os.store.Add(o) +} From d7b7cda1ac2dc8d039ffa1b7ac01de6ccbf8c843 Mon Sep 17 00:00:00 2001 From: Jeremy Letang Date: Wed, 22 May 2024 17:55:45 +0200 Subject: [PATCH 16/19] Merge pull request #11310 from vegaprotocol/pegged_update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix: handle invalid offset for pegged on market update when tick size… --- core/execution/future/market.go | 6 +++++- core/execution/spot/market.go | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/core/execution/future/market.go b/core/execution/future/market.go index 825dc0fc1d9..765a8f22ade 100644 --- a/core/execution/future/market.go +++ b/core/execution/future/market.go @@ -643,6 +643,8 @@ func (m *Market) Update(ctx context.Context, config *types.Market, oracleEngine if tickSizeChanged { peggedOrders := m.matching.GetActivePeggedOrderIDs() peggedOrders = append(peggedOrders, m.peggedOrders.GetParkedIDs()...) + + tickSizeInAsset, _ := num.UintFromDecimal(m.mkt.TickSize.ToDecimal().Mul(m.priceFactor)) for _, po := range peggedOrders { order, err := m.matching.GetOrderByID(po) if err != nil { @@ -651,7 +653,9 @@ func (m *Market) Update(ctx context.Context, config *types.Market, oracleEngine continue } } - if !num.UintZero().Mod(order.PeggedOrder.Offset, m.mkt.TickSize).IsZero() { + offsetInAsset, _ := num.UintFromDecimal(order.PeggedOrder.Offset.ToDecimal().Mul(m.priceFactor)) + if !num.UintZero().Mod(order.PeggedOrder.Offset, m.mkt.TickSize).IsZero() || + (order.PeggedOrder.Reference == types.PeggedReferenceMid && offsetInAsset.IsZero() && tickSizeInAsset.IsZero()) { m.cancelOrder(ctx, order.Party, order.ID) } } diff --git a/core/execution/spot/market.go b/core/execution/spot/market.go index 78c3d1c776d..45c5ef8d8aa 100644 --- a/core/execution/spot/market.go +++ b/core/execution/spot/market.go @@ -297,6 +297,7 @@ func (m *Market) Update(ctx context.Context, config *types.Market) error { m.updateLiquidityFee(ctx) if tickSizeChanged { + tickSizeInAsset, _ := num.UintFromDecimal(m.mkt.TickSize.ToDecimal().Mul(m.priceFactor)) peggedOrders := m.matching.GetActivePeggedOrderIDs() peggedOrders = append(peggedOrders, m.peggedOrders.GetParkedIDs()...) for _, po := range peggedOrders { @@ -307,7 +308,9 @@ func (m *Market) Update(ctx context.Context, config *types.Market) error { continue } } - if !num.UintZero().Mod(order.PeggedOrder.Offset, m.mkt.TickSize).IsZero() { + offsetInAsset, _ := num.UintFromDecimal(order.PeggedOrder.Offset.ToDecimal().Mul(m.priceFactor)) + if !num.UintZero().Mod(order.PeggedOrder.Offset, m.mkt.TickSize).IsZero() || + (order.PeggedOrder.Reference == types.PeggedReferenceMid && offsetInAsset.IsZero() && tickSizeInAsset.IsZero()) { m.cancelOrder(ctx, order.Party, order.ID) } } From 62a12b57e8592b9ea27541a8a5b5d9e09c66bc66 Mon Sep 17 00:00:00 2001 From: Jeremy Letang Date: Thu, 23 May 2024 10:02:12 +0200 Subject: [PATCH 17/19] chore: release version 0.76.7 Signed-off-by: Jeremy Letang --- CHANGELOG.md | 9 +++++++++ protos/blockexplorer/api/v1/blockexplorer.pb.go | 2 +- protos/data-node/api/v2/trading_data.pb.go | 2 +- protos/sources/blockexplorer/api/v1/blockexplorer.proto | 2 +- protos/sources/data-node/api/v2/trading_data.proto | 2 +- protos/sources/vega/api/v1/core.proto | 2 +- protos/sources/vega/api/v1/corestate.proto | 2 +- protos/vega/api/v1/core.pb.go | 2 +- protos/vega/api/v1/corestate.pb.go | 2 +- version/version.go | 2 +- 10 files changed, 18 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cec0c5c329f..6163903fa86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,15 @@ - [](https://github.com/vegaprotocol/vega/issues/xxx) + +## 0.76.7 + +### πŸ› Fixes + +- [11275](https://github.com/vegaprotocol/vega/pull/11275) - add cache map to order `sqlsubscriber` to prevent order from not being updated in data node. +- [11310](https://github.com/vegaprotocol/vega/pull/11310) - handle invalid offset for pegged on market update when tick size changes. + + ## 0.76.6 ### πŸ› Fixes diff --git a/protos/blockexplorer/api/v1/blockexplorer.pb.go b/protos/blockexplorer/api/v1/blockexplorer.pb.go index b9ecb9e7182..383a237407c 100644 --- a/protos/blockexplorer/api/v1/blockexplorer.pb.go +++ b/protos/blockexplorer/api/v1/blockexplorer.pb.go @@ -656,7 +656,7 @@ var file_blockexplorer_api_v1_blockexplorer_proto_rawDesc = []byte{ 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x72, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x92, 0x41, 0x3e, 0x12, 0x23, 0x0a, 0x18, 0x56, 0x65, 0x67, 0x61, 0x20, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x20, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x72, 0x65, 0x72, 0x20, - 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x36, 0x1a, 0x13, 0x6c, + 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x37, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/protos/data-node/api/v2/trading_data.pb.go b/protos/data-node/api/v2/trading_data.pb.go index 86e94b15083..030aab5dd06 100644 --- a/protos/data-node/api/v2/trading_data.pb.go +++ b/protos/data-node/api/v2/trading_data.pb.go @@ -30538,7 +30538,7 @@ var file_data_node_api_v2_trading_data_proto_rawDesc = []byte{ 0x6f, 0x73, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x2d, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x92, 0x41, 0x8f, 0x01, 0x12, 0x1e, 0x0a, 0x13, 0x56, 0x65, 0x67, 0x61, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x6e, 0x6f, 0x64, 0x65, 0x20, 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, - 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x36, 0x1a, 0x1c, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, + 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x37, 0x1a, 0x1c, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x61, 0x70, 0x69, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x52, 0x39, 0x0a, 0x03, 0x35, diff --git a/protos/sources/blockexplorer/api/v1/blockexplorer.proto b/protos/sources/blockexplorer/api/v1/blockexplorer.proto index 85b205a6277..05ea0712df6 100644 --- a/protos/sources/blockexplorer/api/v1/blockexplorer.proto +++ b/protos/sources/blockexplorer/api/v1/blockexplorer.proto @@ -11,7 +11,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/blockexplorer/api/v1"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega block explorer APIs"; - version: "v0.76.6"; + version: "v0.76.7"; } schemes: [ HTTP, diff --git a/protos/sources/data-node/api/v2/trading_data.proto b/protos/sources/data-node/api/v2/trading_data.proto index 992bb451ebc..ef890579dd6 100644 --- a/protos/sources/data-node/api/v2/trading_data.proto +++ b/protos/sources/data-node/api/v2/trading_data.proto @@ -17,7 +17,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/data-node/api/v2"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega data node APIs"; - version: "v0.76.6"; + version: "v0.76.7"; } schemes: [ HTTP, diff --git a/protos/sources/vega/api/v1/core.proto b/protos/sources/vega/api/v1/core.proto index 644731cbc52..7190f107f52 100644 --- a/protos/sources/vega/api/v1/core.proto +++ b/protos/sources/vega/api/v1/core.proto @@ -12,7 +12,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/vega/api/v1"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega core APIs"; - version: "v0.76.6"; + version: "v0.76.7"; } schemes: [ HTTP, diff --git a/protos/sources/vega/api/v1/corestate.proto b/protos/sources/vega/api/v1/corestate.proto index f2c3326c9e0..a83d65f6177 100644 --- a/protos/sources/vega/api/v1/corestate.proto +++ b/protos/sources/vega/api/v1/corestate.proto @@ -13,7 +13,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/vega/api/v1"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega core state APIs"; - version: "v0.76.6"; + version: "v0.76.7"; } schemes: [ HTTP, diff --git a/protos/vega/api/v1/core.pb.go b/protos/vega/api/v1/core.pb.go index 25f435f9d0d..f0aea6a437c 100644 --- a/protos/vega/api/v1/core.pb.go +++ b/protos/vega/api/v1/core.pb.go @@ -2796,7 +2796,7 @@ var file_vega_api_v1_core_proto_rawDesc = []byte{ 0x6f, 0x6c, 0x2e, 0x69, 0x6f, 0x2f, 0x76, 0x65, 0x67, 0x61, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x76, 0x65, 0x67, 0x61, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x92, 0x41, 0x34, 0x12, 0x19, 0x0a, 0x0e, 0x56, 0x65, 0x67, 0x61, 0x20, 0x63, 0x6f, 0x72, 0x65, 0x20, 0x41, 0x50, - 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x36, 0x1a, 0x13, 0x6c, 0x62, 0x2e, + 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x37, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/protos/vega/api/v1/corestate.pb.go b/protos/vega/api/v1/corestate.pb.go index df1b558bc7e..03e4dc69835 100644 --- a/protos/vega/api/v1/corestate.pb.go +++ b/protos/vega/api/v1/corestate.pb.go @@ -1512,7 +1512,7 @@ var file_vega_api_v1_corestate_proto_rawDesc = []byte{ 0x6f, 0x73, 0x2f, 0x76, 0x65, 0x67, 0x61, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x92, 0x41, 0x3a, 0x12, 0x1f, 0x0a, 0x14, 0x56, 0x65, 0x67, 0x61, 0x20, 0x63, 0x6f, 0x72, 0x65, 0x20, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, - 0x2e, 0x36, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, + 0x2e, 0x37, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/version/version.go b/version/version.go index eca8c320144..5c44d5703f7 100644 --- a/version/version.go +++ b/version/version.go @@ -22,7 +22,7 @@ import ( var ( cliVersionHash = "" - cliVersion = "v0.76.6" + cliVersion = "v0.76.7" ) func init() { From 8ba723715eaff478d655936aa43b6b681cb679be Mon Sep 17 00:00:00 2001 From: Elias Van Ootegem Date: Thu, 23 May 2024 15:47:29 +0200 Subject: [PATCH 18/19] Merge pull request #11315 from vegaprotocol/11314-batch-node-validation-votes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix: restore votes on batch proposals undergoing node-validation when… --- core/governance/node_validation.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/governance/node_validation.go b/core/governance/node_validation.go index 932c611bfc8..ee34e1c3cd5 100644 --- a/core/governance/node_validation.go +++ b/core/governance/node_validation.go @@ -435,9 +435,9 @@ func (n *NodeValidation) restoreBatch(ctx context.Context, pProto *snapshotpb.Ba nbp := &nodeBatchProposal{ batchProposal: &batchProposal{ BatchProposal: p, - yes: map[string]*types.Vote{}, - no: map[string]*types.Vote{}, - invalidVotes: map[string]*types.Vote{}, + yes: votesAsMapFromProto(pProto.BatchProposal.Yes), + no: votesAsMapFromProto(pProto.BatchProposal.No), + invalidVotes: votesAsMapFromProto(pProto.BatchProposal.Invalid), }, nodeProposals: nodeProposals, state: atomic.Uint32{}, From e78f89e8ee6e922a5063fd3ca94dd4a9108f2681 Mon Sep 17 00:00:00 2001 From: Jeremy Letang Date: Thu, 23 May 2024 16:25:19 +0200 Subject: [PATCH 19/19] chore: release version 0.76.8 Signed-off-by: Jeremy Letang --- CHANGELOG.md | 9 ++++++++- protos/blockexplorer/api/v1/blockexplorer.pb.go | 2 +- protos/data-node/api/v2/trading_data.pb.go | 2 +- protos/sources/blockexplorer/api/v1/blockexplorer.proto | 2 +- protos/sources/data-node/api/v2/trading_data.proto | 2 +- protos/sources/vega/api/v1/core.proto | 2 +- protos/sources/vega/api/v1/corestate.proto | 2 +- protos/vega/api/v1/core.pb.go | 2 +- protos/vega/api/v1/corestate.pb.go | 2 +- version/version.go | 2 +- 10 files changed, 17 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6163903fa86..13253b651e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,12 +19,19 @@ - [](https://github.com/vegaprotocol/vega/issues/xxx) +## 0.76.8 + +### πŸ› Fixes + +- [11315](https://github.com/vegaprotocol/vega/pull/11315) - fix node validation governance snapshot. + + ## 0.76.7 ### πŸ› Fixes - [11275](https://github.com/vegaprotocol/vega/pull/11275) - add cache map to order `sqlsubscriber` to prevent order from not being updated in data node. -- [11310](https://github.com/vegaprotocol/vega/pull/11310) - handle invalid offset for pegged on market update when tick size changes. +- [11310](https://github.com/vegaprotocol/vega/pull/11310) - handle invalid offset for pegged on market update when tick size changes. ## 0.76.6 diff --git a/protos/blockexplorer/api/v1/blockexplorer.pb.go b/protos/blockexplorer/api/v1/blockexplorer.pb.go index 383a237407c..8efd90cab67 100644 --- a/protos/blockexplorer/api/v1/blockexplorer.pb.go +++ b/protos/blockexplorer/api/v1/blockexplorer.pb.go @@ -656,7 +656,7 @@ var file_blockexplorer_api_v1_blockexplorer_proto_rawDesc = []byte{ 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x72, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x92, 0x41, 0x3e, 0x12, 0x23, 0x0a, 0x18, 0x56, 0x65, 0x67, 0x61, 0x20, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x20, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x72, 0x65, 0x72, 0x20, - 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x37, 0x1a, 0x13, 0x6c, + 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x38, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/protos/data-node/api/v2/trading_data.pb.go b/protos/data-node/api/v2/trading_data.pb.go index 030aab5dd06..25a730cc0f7 100644 --- a/protos/data-node/api/v2/trading_data.pb.go +++ b/protos/data-node/api/v2/trading_data.pb.go @@ -30538,7 +30538,7 @@ var file_data_node_api_v2_trading_data_proto_rawDesc = []byte{ 0x6f, 0x73, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x2d, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x92, 0x41, 0x8f, 0x01, 0x12, 0x1e, 0x0a, 0x13, 0x56, 0x65, 0x67, 0x61, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x6e, 0x6f, 0x64, 0x65, 0x20, 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, - 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x37, 0x1a, 0x1c, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, + 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x38, 0x1a, 0x1c, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x61, 0x70, 0x69, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x52, 0x39, 0x0a, 0x03, 0x35, diff --git a/protos/sources/blockexplorer/api/v1/blockexplorer.proto b/protos/sources/blockexplorer/api/v1/blockexplorer.proto index 05ea0712df6..67076af1ece 100644 --- a/protos/sources/blockexplorer/api/v1/blockexplorer.proto +++ b/protos/sources/blockexplorer/api/v1/blockexplorer.proto @@ -11,7 +11,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/blockexplorer/api/v1"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega block explorer APIs"; - version: "v0.76.7"; + version: "v0.76.8"; } schemes: [ HTTP, diff --git a/protos/sources/data-node/api/v2/trading_data.proto b/protos/sources/data-node/api/v2/trading_data.proto index ef890579dd6..c46426a1175 100644 --- a/protos/sources/data-node/api/v2/trading_data.proto +++ b/protos/sources/data-node/api/v2/trading_data.proto @@ -17,7 +17,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/data-node/api/v2"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega data node APIs"; - version: "v0.76.7"; + version: "v0.76.8"; } schemes: [ HTTP, diff --git a/protos/sources/vega/api/v1/core.proto b/protos/sources/vega/api/v1/core.proto index 7190f107f52..46c487016b4 100644 --- a/protos/sources/vega/api/v1/core.proto +++ b/protos/sources/vega/api/v1/core.proto @@ -12,7 +12,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/vega/api/v1"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega core APIs"; - version: "v0.76.7"; + version: "v0.76.8"; } schemes: [ HTTP, diff --git a/protos/sources/vega/api/v1/corestate.proto b/protos/sources/vega/api/v1/corestate.proto index a83d65f6177..f2c964f9815 100644 --- a/protos/sources/vega/api/v1/corestate.proto +++ b/protos/sources/vega/api/v1/corestate.proto @@ -13,7 +13,7 @@ option go_package = "code.vegaprotocol.io/vega/protos/vega/api/v1"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Vega core state APIs"; - version: "v0.76.7"; + version: "v0.76.8"; } schemes: [ HTTP, diff --git a/protos/vega/api/v1/core.pb.go b/protos/vega/api/v1/core.pb.go index f0aea6a437c..ebdee45ee7f 100644 --- a/protos/vega/api/v1/core.pb.go +++ b/protos/vega/api/v1/core.pb.go @@ -2796,7 +2796,7 @@ var file_vega_api_v1_core_proto_rawDesc = []byte{ 0x6f, 0x6c, 0x2e, 0x69, 0x6f, 0x2f, 0x76, 0x65, 0x67, 0x61, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x76, 0x65, 0x67, 0x61, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x92, 0x41, 0x34, 0x12, 0x19, 0x0a, 0x0e, 0x56, 0x65, 0x67, 0x61, 0x20, 0x63, 0x6f, 0x72, 0x65, 0x20, 0x41, 0x50, - 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x37, 0x1a, 0x13, 0x6c, 0x62, 0x2e, + 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, 0x2e, 0x38, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/protos/vega/api/v1/corestate.pb.go b/protos/vega/api/v1/corestate.pb.go index 03e4dc69835..495969b314f 100644 --- a/protos/vega/api/v1/corestate.pb.go +++ b/protos/vega/api/v1/corestate.pb.go @@ -1512,7 +1512,7 @@ var file_vega_api_v1_corestate_proto_rawDesc = []byte{ 0x6f, 0x73, 0x2f, 0x76, 0x65, 0x67, 0x61, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x92, 0x41, 0x3a, 0x12, 0x1f, 0x0a, 0x14, 0x56, 0x65, 0x67, 0x61, 0x20, 0x63, 0x6f, 0x72, 0x65, 0x20, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x41, 0x50, 0x49, 0x73, 0x32, 0x07, 0x76, 0x30, 0x2e, 0x37, 0x36, - 0x2e, 0x37, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, + 0x2e, 0x38, 0x1a, 0x13, 0x6c, 0x62, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x6e, 0x65, 0x74, 0x2e, 0x76, 0x65, 0x67, 0x61, 0x2e, 0x78, 0x79, 0x7a, 0x2a, 0x02, 0x01, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/version/version.go b/version/version.go index 5c44d5703f7..78dee171b19 100644 --- a/version/version.go +++ b/version/version.go @@ -22,7 +22,7 @@ import ( var ( cliVersionHash = "" - cliVersion = "v0.76.7" + cliVersion = "v0.76.8" ) func init() {