Skip to content

Commit

Permalink
fix: publish market updates on restart from 73.1
Browse files Browse the repository at this point in the history
Signed-off-by: Jeremy Letang <me@jeremyletang.com>
  • Loading branch information
jeremyletang committed Nov 1, 2023
1 parent 8866cf2 commit 53b2b19
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
6 changes: 6 additions & 0 deletions core/execution/future/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ type Market struct {
// are applied properly
ensuredMigration73 bool
epoch types.Epoch

publishMarketOnRestart bool
}

// NewMarket creates a new market using the market framework configuration and creates underlying engines.
Expand Down Expand Up @@ -433,6 +435,10 @@ func (m *Market) onEpochEndPartiesStats() {
}

func (m *Market) BeginBlock(ctx context.Context) {
if m.publishMarketOnRestart {
m.broker.Send(events.NewMarketUpdatedEvent(ctx, *m.mkt))
m.publishMarketOnRestart = false
}
if m.ensuredMigration73 {
return
}
Expand Down
7 changes: 7 additions & 0 deletions core/execution/future/market_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
"code.vegaprotocol.io/vega/core/risk"
"code.vegaprotocol.io/vega/core/settlement"
"code.vegaprotocol.io/vega/core/types"
vgcontext "code.vegaprotocol.io/vega/libs/context"
"code.vegaprotocol.io/vega/libs/num"
"code.vegaprotocol.io/vega/libs/ptr"
"code.vegaprotocol.io/vega/logging"
Expand Down Expand Up @@ -172,6 +173,11 @@ func NewMarketFromSnapshot(
expiringStopOrders = common.NewExpiringOrdersFromState(em.ExpiringStopOrders)
}

var publishMarket bool
if vgcontext.InProgressUpgradeFrom(ctx, "v0.73.1") {
publishMarket = true
}

now := timeService.GetTimeNow()
marketType := mkt.MarketType()
market := &Market{
Expand Down Expand Up @@ -218,6 +224,7 @@ func NewMarketFromSnapshot(
stopOrders: stopOrders,
expiringStopOrders: expiringStopOrders,
perp: marketType == types.MarketTypePerp,
publishMarketOnRestart: publishMarket,
}

for _, p := range em.Parties {
Expand Down
4 changes: 0 additions & 4 deletions core/netparams/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,6 @@ func (s *Store) LoadState(ctx context.Context, pl *types.Payload) ([]types.State
Key: "governance.proposal.transfer.minVoterBalance",
Value: "1000000000000000000",
},
{
Key: "governance.proposal.transfer.minVoterBalance",
Value: "1000000000000000000",
},
{
Key: "governance.proposal.transfer.requiredParticipation",
Value: "0.01",
Expand Down

0 comments on commit 53b2b19

Please sign in to comment.