Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v0.76.7 #11299

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
7c7e2ab
chore: add setting for arbitrum bridge of the validators testnet
jeremyletang May 13, 2024
03b90de
Merge pull request #11262 from vegaprotocol/feature-test-0032-PRIM-033
jeremyletang May 10, 2024
139e1ac
chore: release version 0.76.2
jeremyletang May 13, 2024
daeb04f
Merge pull request #11284 from vegaprotocol/pow-fix
jeremyletang May 15, 2024
4b9a58c
chore: release version 0.76.3
jeremyletang May 17, 2024
d0d6e43
Merge pull request #11294 from vegaprotocol/fix/11293
jeremyletang May 18, 2024
a674305
Merge pull request #11298 from vegaprotocol/fix_ob
ze97286 May 20, 2024
d2d24b0
chore: add mapping for mainnet Arbitrum One bridge
jeremyletang May 20, 2024
86df600
chore: add mapping for mainnet mirror Arbitrum (sepolia) bridge
jeremyletang May 20, 2024
230591d
chore: release version 0.76.4
jeremyletang May 20, 2024
438132a
Merge pull request #11305 from vegaprotocol/11304
jeremyletang May 22, 2024
a4e0d42
chore: release version 0.76.5
jeremyletang May 22, 2024
2952b41
Merge pull request #11306 from vegaprotocol/11304-2
jeremyletang May 22, 2024
34ca0c3
chore: release version 0.76.6
jeremyletang May 22, 2024
1c7f3dd
Merge pull request #11275 from vegaprotocol/order-cancellation-cache
EVODelavega May 14, 2024
d7b7cda
Merge pull request #11310 from vegaprotocol/pegged_update
jeremyletang May 22, 2024
62a12b5
chore: release version 0.76.7
jeremyletang May 23, 2024
8ba7237
Merge pull request #11315 from vegaprotocol/11314-batch-node-validati…
EVODelavega May 23, 2024
e78f89e
chore: release version 0.76.8
jeremyletang May 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,58 @@
- [](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.


## 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.


## 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.


## 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

- [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
Expand Down
2 changes: 1 addition & 1 deletion core/datasource/external/ethcall/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion core/execution/common/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 ...
Expand Down
37 changes: 27 additions & 10 deletions core/execution/future/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand All @@ -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)
}
}
Expand Down Expand Up @@ -1374,26 +1378,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
}
Expand Down Expand Up @@ -1782,6 +1790,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)
}

Expand All @@ -1792,6 +1807,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() {
Expand Down
34 changes: 24 additions & 10 deletions core/execution/spot/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,12 @@ 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)

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 {
Expand All @@ -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)
}
}
Expand Down Expand Up @@ -819,26 +822,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
}
Expand Down Expand Up @@ -971,6 +977,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 {
Expand Down Expand Up @@ -1042,6 +1049,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)
}

Expand Down
6 changes: 3 additions & 3 deletions core/governance/node_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{},
Expand Down
Loading
Loading