cardano-scaling / hydra

Implementation of the Hydra Head protocol
https://hydra.family/head-protocol/
Apache License 2.0
285 stars 86 forks source link

Hydra node software,scripts & protocol updates #191

Closed ch1bo closed 8 months ago

ch1bo commented 2 years ago

What & Why

How we deal with changes and upgrades to various parts of the Hydra system. This is only about changes we issue, for Cardano network changes, see: https://github.com/input-output-hk/hydra-poc/issues/195

We should distinguish breaking and non-breaking changes. Definition of breaking change could be: An already existing Hydra Head becomes unavailable after an update.

Given this definition we can identify at least these steps on a dimensional plan:

To address this, we want to

Scenarios (examples)

Versioned entities

How (TBD, incomplete)

ch1bo commented 2 years ago

It seems like all changes to plutus scripts need to be treated as "breaking changes", i.e. a Hydra Head would need to be closed and re-opened. Why? When implementing the V1 script, we would not know the V2 script hash already and hence we could not make it "forward compatible".

Furthermore, any change to the scripts and the upstream components like the plutus-tx compiler will result in changes to the script hashes. So we ought to prevent accidental change!

ch1bo commented 2 years ago

We discussed and detailed the description of this feature a bit today. The on-chain scripts really feel a bit like "shipping hardware" as they won't be upgradable (without introducing authority) and we better get them right / good enough when shipping a 1.0.0.

Besides that, it might be enough to contain those breaking changes and not accidentally change them.

Open question just coming to mind when writing this: What situations where we add significant (but independent of on-chain scripts) improvements to the hydra-node, and some people want/need to use them with V1 and V2 of the scripts? Do we need to maintain two branches of hydra-node?

ch1bo commented 2 years ago

Running a hydra-node which expects Babbage era on the chain layer against an Alonzo testnet produces this error:

hydra-node: HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Babbage"})
ch1bo commented 2 years ago

When implementing the V1 script, we would not know the V2 script hash already and hence we could not make it "forward compatible".

An interesting thread in that direction can be found here: https://input-output-rnd.slack.com/archives/C21UF2WVC/p1656494873725559 (ask @ch1bo for details)

The gist: image i.e. authorizing a governance output to enumerate the target (V2) script hashes in the datum and allow re-spending script outputs there while maintaining an identical datums (a.k.a. self-transition in a utxo state machine).

ch1bo commented 1 year ago

We have created a golden test suite which persists scripts as binary data in the repository and detects any changes to them: https://github.com/input-output-hk/hydra/pull/772

ch1bo commented 8 months ago

We had a look at this again and this is / was always not much actionable. It turns out, however, that we navigated all mentioned scenarios in the past and implemented most of the regression and version checks anyhow. Only remaining would be #1010, which supersedes this item on our roadmap.