frontend-monorepo
frontend-monorepo copied to clipboard
Change diff library to better handle arrays
The Chore
This diff
Doesnt seem to match this diff in the governance
Tasks
- [ ]
- [ ]
Additional details / background info
@JonRay15 can we please get the id of the proposal in question here in order to re-validate the claim? (after my previous amendments for batch propposals)
Yeh so if you look at this template JSON diff at the BTC part.
https://github.com/vegaprotocol/governance-templates/pull/17/files#diff-04b4d4340dd52fae1d55e98b2fcb942d9c4d54bd2e23777a71be3cf7a9f34e6a
And compare to the mainnet proposal diff here: https://governance.vega.xyz/proposals/59d09095ea6334e19437ab8dde340dc2a89ed6aed4eed181be98b5ffd0c992bd
You can see the issue... you can also view the full current config for that market here: https://vega-data.nodes.guru:3008/api/v2/market/4e9081e20e9e81f3e747d42cb0c9b8826454df01899e6027a22e771e19cc79fc
I suspect this is because I dont know if the price monitoring array is ordered or not. I dont think it is and I think that just logically they are applied in ascending order of the horizon.
So what this update was doing concepttually was:
- Increasing the auction extension duration of all existing monitoring bounds
- Adding one more especially cautious bound (the 86400 duration one)
So you can actually see on the JSON diff on github that the horizons of the existing ones have not changed (360, 1440, 4320) ... but the governance app thinks they have since its diffing them against the wrong one (4320>21600, 1440>4320, 360>1440).
I suspect there are two ways to play this:
- Always order price bounds by horizon before applying the diff
- If there is any change to price monitoring just treat it as a delete all / replace all and red out ALL bounds and show ALL new ones in green
I've time boxed this to 2h today and from my initial research I believe the best course of action would be to change the diff library to something more configurable.
I've found this https://github.com/rexskz/json-diff-kit to display the proposal diffs in a nice way.
Park it until we see one change