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

[6/n][vm-rewrite][sui-execution] Update object runtime to use type tags instead of runtime VM types #21070

Open
wants to merge 3 commits into
base: tzakian/vm-rewrite-adapter-5
Choose a base branch
from

Conversation

tzakian
Copy link
Contributor

@tzakian tzakian commented Feb 3, 2025

Since the VM instance no longer will live across commands/the entire lifetime of the object runtime, this replaces all VM runtime Types with TypeTags or MoveObjectTypes where appropriate. This also updates the natives and runtime to handle the new
NativeContextExtensions model.

NB: The code in the PR may not be working as future PRs will build on top of this.

@tzakian tzakian requested a review from cgswords February 3, 2025 21:05
Copy link

vercel bot commented Feb 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 7, 2025 8:18pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Feb 7, 2025 8:18pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Feb 7, 2025 8:18pm

@tzakian tzakian temporarily deployed to sui-typescript-aws-kms-test-env February 3, 2025 21:05 — with GitHub Actions Inactive
@tzakian tzakian force-pushed the tzakian/vm-rewrite-adapter-6 branch from 489397b to 53ce0a8 Compare February 3, 2025 21:22
@tzakian tzakian temporarily deployed to sui-typescript-aws-kms-test-env February 3, 2025 21:22 — with GitHub Actions Inactive
@tzakian tzakian force-pushed the tzakian/vm-rewrite-adapter-5 branch from 2f24850 to 49f2c90 Compare February 4, 2025 17:44
@tzakian tzakian requested a review from ronny-mysten as a code owner February 4, 2025 17:44
@tzakian tzakian force-pushed the tzakian/vm-rewrite-adapter-6 branch from 53ce0a8 to 04ed3db Compare February 4, 2025 17:44
@tzakian tzakian temporarily deployed to sui-typescript-aws-kms-test-env February 4, 2025 17:45 — with GitHub Actions Inactive
@tzakian tzakian force-pushed the tzakian/vm-rewrite-adapter-5 branch from 49f2c90 to b5ffa61 Compare February 4, 2025 20:30
@tzakian tzakian force-pushed the tzakian/vm-rewrite-adapter-6 branch from 04ed3db to 89b34cf Compare February 4, 2025 20:30
@tzakian tzakian temporarily deployed to sui-typescript-aws-kms-test-env February 4, 2025 20:31 — with GitHub Actions Inactive
@tzakian tzakian force-pushed the tzakian/vm-rewrite-adapter-5 branch from b5ffa61 to fb777e6 Compare February 5, 2025 20:10
@tzakian tzakian force-pushed the tzakian/vm-rewrite-adapter-6 branch from 89b34cf to 208bdfc Compare February 5, 2025 20:10
@tzakian tzakian temporarily deployed to sui-typescript-aws-kms-test-env February 5, 2025 20:11 — with GitHub Actions Inactive
@tzakian tzakian requested a review from tnowacki February 5, 2025 20:45
Comment on lines 251 to 254
let mut obj_runtime: RefMut<ObjectRuntime> = context
.extensions()
.get::<NativeContextMut<ObjectRuntime>>()
.get_mut();
Copy link
Contributor

@tnowacki tnowacki Feb 7, 2025

Choose a reason for hiding this comment

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

Suggested change
let mut obj_runtime: RefMut<ObjectRuntime> = context
.extensions()
.get::<NativeContextMut<ObjectRuntime>>()
.get_mut();
let obj_runtime = context.extensions_mut().get::<NativeContextMut<ObjectRuntime>>().borrow_mut();

Copy link
Contributor

Choose a reason for hiding this comment

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

This is the point of doing Deref :)

…gs instead of runtime VM types.

Since the VM instance no longer will live across commands/the entire
lifetime of the object runtime, this replaces all VM runtime `Type`s
with `TypeTag`s or `MoveObjectType`s where appropriate. This also
updates the natives and runtime to handle the new
`NativeContextExtensions` model.

NB: The code in the PR may not be working as future PRs will build on top of
this.
…to use type tags instead of runtime VM types.
// NB: We need to borrow the runtime and grab the mutable reference and then pass this into
// `get_or_fetch_object` so that the lifetime of the returned object is tied to the lifetime of
// the runtime reference we are creating here and the borrow checker will be happy with us.
let object_runtime: &NativeContextMut<'_, ObjectRuntime<'_>> = context.extensions().get();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
let object_runtime: &NativeContextMut<'_, ObjectRuntime<'_>> = context.extensions().get();
let object_runtime: &NativeContextMut<'_, ObjectRuntime<'_>> = context.extensions().get();

Bit of a nit, but let me message you a cleaner way for this. This seems a bit messy

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