boltlabs-inc / zeekoe

Zero-knowledge layer-2 payment channels
MIT License
24 stars 1 forks source link

Fix mutual close #343

Closed marsella closed 2 years ago

marsella commented 2 years ago

Closes #337

Before, the merchant's close() function called finalize_mutual_close. Now, the merchant's watcher calls it.

The most substantial change here is an addition of MutualCloseBalances to the merchant database. The merchant watcher cannot tell from the contract itself what the final mutual close balances are, so we need to persist them via the database instead. These changes include

Observation: the getters for each field of the database are a bit clumsy -- they're all identical except for the item being queried. Would it be better to have a single getter for the whole row, and have the caller pull out the field relevant to them?

Testing: I think this scenario is not currently caught by the e2e testing infrastructure. Should determine whether it is and either fix it in this PR or make a new issue + PR to address it.

marsella commented 2 years ago

Testing comments remain important, but we've discussed and it seems like they will be better addressed by a significant update to the testing infrastructure, rather than trying to jerry-rig the script we currently have. See #69 for the plan to address this issue.

Force-push to rebase to main and fix a compile issue with the CI.