Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-PreAuth #292

Open
JeremyRubin opened this issue Apr 23, 2019 · 2 comments
Open

Multi-PreAuth #292

JeremyRubin opened this issue Apr 23, 2019 · 2 comments
Labels
needs draft This an issue that has no corresponding draft, and as such has not entered the CAP/SEP process.

Comments

@JeremyRubin
Copy link
Contributor

JeremyRubin commented Apr 23, 2019

Currently when using pre-authorized transactions, it is common to want one pre-auth to remove another.

E.g.

PreAuth A:
  Pay Account Alice 10 XLM
  Remove PreAuth B
PreAuth B:
  Pay Account Bob 10 XLM
  Remove PreAuth A

This cannot be done, because there ends up being a hash-cycle between A and B. It's also problematic because if A fails, then B still exists.

Instead, the pattern should be:

PreAuth A: (sequence n)
  Pay Account Alice 10 XLM
PreAuth B: (sequence n)
  Pay Account Bob 10 XLM
PreAuth C: (sequence n+1)
  Remove PreAuth B
  Remove PreAuth A

However in this case, we're restricted to keeping the same sequence number on A and B, which in many cases is undesirable (try A then try B).

One way of addressing this would be to have a new type of preauth which is a merkle tree of up to 4 transactions. The lookup proof would then be 64 bytes, fitting exisiting signature data space.

In this case, the execution of any one of the outcomes can remove all 4 of the preauths under that root, replace the failing transaction with a continuation transaction (specified in the failing transaction), or just prune only the branch tried and failed, leaving the others in place. The simplest option is to just allow that upon successful execution of a transaction, the root is removed.

The number of branches could be increased, but that would bear increased complexity on the management of the lookup proof.

This type of mechanism makes many protocols which require mutually exclusive preauths a bit simpler to work with because the user of this API doesn't need to worry about the hash cycles between pre-auths which should remove each other.

@github-actions
Copy link

This issue is stale because it has been open for 30 days with no activity. It will be closed in 5 days unless the stale label is removed, or a comment is posted.

@github-actions github-actions bot added the stale label Jan 22, 2021
@MonsieurNicolas MonsieurNicolas added needs draft This an issue that has no corresponding draft, and as such has not entered the CAP/SEP process. and removed stale labels Jan 22, 2021
@MonsieurNicolas
Copy link
Contributor

I'm keeping this one around. We're not getting much feedback on the complexity of smart contracts that people use

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs draft This an issue that has no corresponding draft, and as such has not entered the CAP/SEP process.
Projects
None yet
Development

No branches or pull requests

3 participants
@JeremyRubin @MonsieurNicolas and others