vegaprotocol / protos

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Oracle ID generation uses pseudo-deterministic `proto.String()`

wwestgarth opened this issue · comments

Problem encountered

We saw here vegaprotocol/vega#4932 that using .String() on a proto structure causes a world of pain.

Looks like we also use the same method to generate oracle IDs, which can cause us to fall out of consensus on blocks where snapshots are taken. We should not do this.

https://github.com/vegaprotocol/protos/blob/develop/vega/oracles/v1/spec.go#L23

Observed behaviour

Snapshots of markets across binaries contain different oracleIDs

Expected behaviour

Snapshots of markets across binaries contain the same oracle IDs

Steps to reproduce

Logs

The output of two snapshots, one from devnet and one from replaying the chain locally:

"future": {
                                  "settlementAsset": "fEURO",
                                  "quoteName": "EURO",
                                  "oracleSpecForSettlementPrice": {
!                                     "id": "7876c87d840d4d7322bdc06a77e9eeb2ccb15f9a956dbe114d3a2bf8cecdf46d",
                                      "pubKeys": [
                                          "0x51a3a77554709b5db7b769d4376560ad6398c7b08380b5a3e49bda1236697f4f"
                                      ],


"future": {
                                  "settlementAsset": "fEURO",
                                  "quoteName": "EURO",
                                  "oracleSpecForSettlementPrice": {
!                                     "id": "85e5a4c6bb6ca91eae623cee061e7506fc695e164e2c1ba60d95a038bac8331f",
                                      "pubKeys": [
                                          "0x51a3a77554709b5db7b769d4376560ad6398c7b08380b5a3e49bda1236697f4f"
                                      ],