input-output-hk / hydra

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

Decommit and close with same snapshot #1474

Open ch1bo opened 1 week ago

ch1bo commented 1 week ago

What

Ensure this scenario works correctly, such that the on-chain code ensures not more than the still active UTxO is distributed on fanout:

image

While this could be fixed by clearing the utxoToDecommit + having a new snapshot multi-signed after observing the decrementTx, the goal of this item is to ensure the same snapshot can be used to correctly fan out and any participant is forced to do it correctly.

How

Rough algorithm:

v0d1ch commented 1 week ago

To further elaborate, if we want to close/fanout but decommit was already observed then we are closing using different off-chain version and version from the snapshot. In this case we want to verify snapshot signature using $\eta\omega$ from the close redeemer but alter close datum to remove $\eta\omega$ so that fanout is correct. decommit-with-different-version-snapshot

In the case snapshot version is the same as the off-chain state version then we can verify snapshot signature using $\eta\omega$ from the close datum and fanout $\eta\omega$ accordingly. decommit-with-same-version