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

Ensure all mutable objects are mutated #212

Merged
merged 1 commit into from
Jan 20, 2022
Merged

Ensure all mutable objects are mutated #212

merged 1 commit into from
Jan 20, 2022

Conversation

lxfind
Copy link
Contributor

@lxfind lxfind commented Jan 19, 2022

As discussed in https://mysten-labs.slack.com/archives/C02GD7J9HUM/p1642618186086000,
In some cases, mutable objects will not be mutated. For example:

  1. If order execution failed in the middle.
  2. Or if some objects are passed as read-only reference to Move functions.

The datastore expects every mutable objects' sequence number to increase.
This PR forces that at the end of the order execution. It does so by: Change written's key from ObjectRef to ObjectID, and then change deleted into a BTreeSet of ObjectID. These two combined allows us to quickly discover which objects from active_inputs are not mutated.

Also added a test to verify that.

TODO:
Calling to_object_reference() on an object involves non-trivial cost (runs hash). So if we are doing a lot of repeat calls to to_object_reference() to written we could cache the reference in the map as well.

Copy link
Collaborator

@sblackshear sblackshear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks right on to me. Thanks for noticing/fixing this!

@lxfind lxfind merged commit 909e1fc into MystenLabs:main Jan 20, 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

Successfully merging this pull request may close these issues.

2 participants