hyperledger-labs / go-perun

🌔 Perun's Blockchain-Agnostic State Channels Framework in Go.
https://perun.network/
Apache License 2.0
55 stars 18 forks source link

Settling after finalization through ForceUpdate #333

Open leandro-ro opened 2 years ago

leandro-ro commented 2 years ago

Location

client/adjudicate.go

Problem

When a client is enforcing an update via ForceUpdate (e.g., finalizing the channel) and tries to settle directly after, there is no guarantee that the progressed on-chain state persisted in time and is taken over to the client's off-chain state. There is no way to wait for on-chain progression. Hence, there is a short mismatch between these states, leading to problems when trying to settle because the off-chain state may not be finalized yet. This could also be a problem for other (asynchronous) channel participants.

Proposal

Let ForceUpdate return an object that the user can wait for if desired.

matthiasgeihs commented 2 years ago

When ForceUpdate returns, the channel machine may still be in phase Progressing. Only the on-chain event will progress the machine into phase progressed, but ForceUpdate doesn't wait for that.

matthiasgeihs commented 2 years ago

The way we currently receive on-chain events is via the adjudicator subscription. There you can also listen for on-chain progression events. Does that solve the issue? @leandro-ro