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

We shouldn't call AuthorityTemporaryStore::check_invariants if the order failed #165

Closed
lxfind opened this issue Jan 13, 2022 · 3 comments
Closed
Assignees

Comments

@lxfind
Copy link
Contributor

lxfind commented Jan 13, 2022

With this change (#130) we no longer return error right away if an order failed to execute. When an order failed to execute, it's possible that variants in AuthorityTemporaryStore may no longer hold (e.g. no objects are mutated). So in that case, we want to avoid calling AuthorityTemporaryStore::check_invariants.
Also worth double checking if there are other similar places making same assumption as well (i.e. that the transaction has failed)
@gdanezis thoughts?

@gdanezis
Copy link
Collaborator

I think we have to agree on what happens when the function executing an order (in the adaptor) fails:

  • Option 1: the adaptor cleans up and returns a good AuthorityTemporaryStore, for example with no mutations except the gas object having gas deducted, OR
  • Option 2: the adaptor cannot guarantee this, and the outer function (handle_confirmation_order) needs to handle throwing away results, and deducting the appropriate amount of gas.

I have assumed so far that Option 1 is what we do, but I am open to Option 2. In practice I would move most of this logic to a separate function no matter what, to keep the handle_confirmation_order simple, and abstract execution as much as possible.

@gdanezis
Copy link
Collaborator

See longer discussion here on how to handle this issue:
https://mysten-labs.slack.com/archives/C02GD7J9HUM/p1642046053176100

@lxfind
Copy link
Contributor Author

lxfind commented Jan 21, 2022

This was now resolved. We went with Option 2. If order execution failed, we reset AuthorityTemporaryStore.

@lxfind lxfind closed this as completed Jan 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants