-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add locking functionality to Noto #455
Comments
Some additional points after further thought on this design:
The last point above is particularly important in the case that Pente hooks are being used to enforce policies. If I lock a $100 state, and then add a possible outcome that I would like to transfer it to Bob, but then Bob's account is later frozen before I resolve the lock, the hooks contract must have a way to remove the "transfer to Bob" as a valid outcome for the lock at the moment he is frozen. The hook contract would need to maintain a map of all locked/potential transfers by recipient address, and purge the relevant entries if an account is frozen. Additional logic could be added to allow the lock to become valid again if that account is unfrozen. In the case of policies involving balances, the hook contract would need to track min/max values for all confirmed balances along with any possible outstanding debits and credits from in-flight locks, and ensure that all possible outcomes would remain in the allowed range. |
There's still a bit of an odd window between these two steps:
Perhaps (1) needs to emit an event, and the notary should have logic to listen for that event and then trigger (2). |
This definitely feels in the right direction to me. I just couldn't convince myself we've covered all the angles yet. I'm really focussed on the Pente-backed-notary case, because it's the most complex, but also because I think it's the most pure and attractive way to implement a notary pattern. I can see that using a Noto+Pente transaction to enter the locked state works. However, I can't yet see how the completion transaction can be atomic. Struggling to put it into words, but my assumption of how it would work is as follows:
How did I do? The fact this this flow does not allow a coin to be immediately spendable by OrgB is awkward, but possibly unavoidable. There is a lot of detail to work out on which Paladin TransactionIDs get confirmed at which points, and how the steps are orchestrated. But this does seem like a plausible way forwards. |
@peterbroadhurst That's mostly what I've proposed, except that I'm proposing state The slight alternative you've outlined is that |
After thinking some more, I can see an argument for making the Noto state confirmation happen in (3), particularly for the purposes of ownership tracking. If it's important to know the exact moment that Org B took ownership of the value (and it certainly is), then it's useful to reflect the Noto state change in (3). In DvP or PvP scenarios, this would ensure that both legs of the transaction are recorded together. There are still some difficulties with this approach, and it means accepting that the private notary contract may get temporarily out of sync with Noto. But it also reinforces that Noto is the true ownership record. |
As I've started working through this and related ideas on #483 and #485, I believe the API can be generalized as follows. Private ABI of Noto:
I believe the "lock outcomes" outlined previously are implementable as "approveUnlock" transactions. Additional thoughts on approvals:
When combined with Pente hooks, this set of operations should also allow implementing custom patterns similar to the one proposed on #485. More on hooks:
|
This issue is stale because it has been open 30 days with no activity. |
What would you like to be added?
Add functionality to Noto for locking a particular amount of value, such that a transaction can be built and guaranteed to be successful when certain conditions are met.
Why is this needed?
Currently Noto supports a pre-approval flow (where an owning party can approve some of their tokens to be spent by another), but it provides no way to guarantee that the flow will be possible. The input states are still available after a particular transfer has been approved - so they may end up getting consumed by another transaction before the approved transfer is able to execute. This lack of an execution guarantee prevents many types of trades and cross-chain flows from being implemented with Noto.
The text was updated successfully, but these errors were encountered: