-
Notifications
You must be signed in to change notification settings - Fork 1
Atomic execution protocol and primitives #13
Conversation
@aakoshh, may I have a quick review? This PR only includes the SCA functions to orchestrate atomic executions. I will work in the primitives and a sample actor in the next PR (to avoid making this one too long). Thanks 🙏 |
12d67b9
to
a24c90e
Compare
Thank you, as always, for your thorough review, @aakoshh. I think I've addressed almost all your comments (and deferred some to future PRs). Let me know if we are happy to merge or if we should address something else 🙏 |
Thanks for following through with all my comments. I hope that the next PR with the lockable actor will make things clearer, but I was wondering: is the call to I'm curious how the system can ensure that the same state is not locked in multiple atomic executions that have different levels as their common ancestor. Say we have subnets like this:
And there's an actor in S3 that wants to do an atomic swap with one in S4 and another in S2. It locks some state. Then what prevents the user from sending the same locked CID to both S1 and S0? Or sending something that isn't locked at all? If the "I locked some state for atomic execution X" actually comes from the actor in S3 then it's fine because it can only lock once. But that's not the impression I get from the spec. Ultimately I want guarantee that if something is locked it's locked, if somebody is committed to the output they are committed, and I can only see this guaranteed if the messages are unforgeable and come from the actors involved, not crafted by users. You might say that the users can go to each others' subnets and check with the respective actors whether the state is locked. But looking at the model, all I can see is in the |
Just theorizing, but maybe the atomic execution protocol could go like this:
So, the change are that the |
@adlrocha I see that this force-push undid the changes in my PR: https://github.com/adlrocha/builtin-actors/compare/12d67b98bc7c144b8956a0db119a9792cfa06651..a24c90e249da694a1ef35723b94d26e2479a0155 Not sure if it was intentional or you just forgot to pull? |
It was intentional, sorry. Using addresses broke something in the tests and I had to revert the commit so I could keep addressing your comments (see https://github.com/adlrocha/builtin-actors/pull/13#discussion_r930110428). Did tests passed for you? I actually just tested your branch again and it fails, and I am afraid that this is because |
In the current implementation it is the user the one that directly sends a message in the common parent to initialize or submit the execution, now cross-net messages involved.
You are totally right. We wouldn't be able right now to identify that a user is using the same locked state for two executions. Actually, in the current implementation we wouldn't even be able to identify that the same locked state is used in two computations in the same common parent (we are not doing that check, and we should). I opened this discussion to continue there (I don't want comments to get lost in this PR). |
How odd. Then maybe we can wrap it with yet another type, an Sorry, I didn't run the tests, they don't even compile for me because some cases in a match aren't handled. Let me give it another shot then. |
I've moved a lot of things around, so you may need to rebase if we want to be able to merge the change directly, I am really sorry :( I am starting to work on the sample actor supporting atomic execution, I won't touch anything from this PR so you can do your magic. Thanks 🙏 |
Here's a second take, tested this time: https://github.com/adlrocha/builtin-actors/pull/16 |
Add TAddressKey to get around the CBOR limitation with HashMap
Okay, so I'm still not 100% convinced about these:
But if you think these are okay, then merge ahead :) |
Answered, let me know if it makes sense. In any case, as we are proposing some changes to the overall protocol, maybe it's a good idea to have this merged so we have the core to start including the new changes (once we have the whole design). |
Quick update on this: I think that with the recent discussions we're having, the basic atomic primitives will change a lot, and we will be able to lock several parts of the state using different messages over the same actor. The new architecture should remove many of the simplifications used in the MVP. Parts of the code from this PR will change a bit with this new approach. Let's note down our concerns, merge this PR and review them in the next one. WDYT? I am already tinkering with these primtives and the states. I'll try to have a draft PR soon so we can discuss over it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, let's merge this PR, it was a great platform to discuss, but we already know some things will change so there's no reason to keep arguing about the minute details here.
This PR:
In the next PR:
hierarchical_sca/src/atomic/mod.rs
).