Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

sdk/state: give close agreements identifiers separate to their iteration number #339

Open
leighmcculloch opened this issue Sep 28, 2021 · 0 comments

Comments

@leighmcculloch
Copy link
Contributor

leighmcculloch commented Sep 28, 2021

I think we need to give close agreements identifiers that are separate to their iteration number. The iteration number is related to where in the history of the channel the close agreement exists. The value is an indicator of the state of the channel, from the proposer's perspective, that came prior but it doesn't provide any uniqueness. As part of the problem described in #287 it is likely that we need some way to uniquely identifier payments. This is also something @nikhilsaraf called out early that we need a unique identifier for a payment, based off what he saw in research of other payment channel designs.

Given that the close agreement is ultimately rendered as a set of transactions, I think the simplest method for constructing an identifier would be to concatenate the transaction hashes from the transaction set in a predefined order, e.g. declaration then closing, using the same hash function that Stellar uses for its transaction hashes, i.e. SHA-256. The result will be unique not only for an iteration number but for the agreement captured in the transactions that get built.

Alternatively we could construct a payload to hash off the close details, but that seems like more work with no benefits that I can see, other than we could include peripheral information like payment amount that aren't captured in the transactions.

This will be required for #338.

Refs:

leighmcculloch added a commit that referenced this issue Sep 30, 2021
Add a memo field to close agreements that is optional. The memo is a string with unspecified bounds. The memo is not included in the final transaction so its contents does not leak to the public ledger when the channel is closed. Subsequently the signatures for close agreements to do not cover the memo.

Payments should have memos so they can be identifiable on the terms of the participants. Participants may communicate about a payment ahead of sending a payment and the memo will provide a way to annotate or identify the payment in whatever way they require.

Note that this is similar but different to #339. #339 is concerned with uniquely identifying payments with an identifier that the state machine attaches to close agreements. That would not be useful in the situation described above where an identifier must be assigned prior to the payment being made.

This is useful for things like buffered channels, something I'm experimenting with right now for #340.
@acharb acharb assigned acharb and unassigned acharb Nov 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants