vegaprotocol / vega

A Go implementation of the Vega Protocol, a protocol for creating and trading derivatives on a fully decentralised network.
https://vega.xyz
GNU Affero General Public License v3.0
36 stars 22 forks source link

[Bug]: Fail gracefully if loaded network-history DB version does not match current #11708

Closed wwestgarth closed 2 weeks ago

wwestgarth commented 2 weeks ago

Problem encountered

When loading from network history across DB schema version, the data-node will migrate through the schema versions as it loads history segments.

For example if history segment n has schema version 10 and history segment n+1 has schema version 11, then when loading the segments the flow is as follows:

The problem is that if a protocol upgrade has just happened, and we are using the latest code version but the last network history segment we find to pull is from the older version, the data node will still start successfully. This means that the schema version will mismatch the sqlstore queries and weird failures will occurr.

Observed behaviour

If the DB schema is older than it should be for whatever reason, strange errors can occur when making queries.

Expected behaviour

The data node should not start if there is a schema mismatch.

Steps to reproduce

1. Submit `xyz` transaction
2. With this payload
3. Query `abc` API
4. Observe the error

Software version

develop

Failing test

No response

Jenkins run

No response

Configuration used

No response

Relevant log output

No response

wwestgarth commented 2 weeks ago

Closed via an accidental push to develop: https://github.com/vegaprotocol/vega/commit/35c14addd541a98435a474c0d13b04bf1300e7fd