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

[7][15/n][enums/Move] Add flavor to serialized compiled module for versions >= 7 #17706

Merged

Conversation

tzakian
Copy link
Contributor

@tzakian tzakian commented May 13, 2024

Description

As discussed at the Move community meeting for versions of the Move binary format >= 7, we will start flavoring Sui serialized modules with the 0x05 flavor flag.

Test plan

Added additional tests to make sure versions are properly serialized (both with and without flavors), and that they are properly deserialized, or an error is thrown if a version >= 7 is supplied without a correct flavor.


Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • Protocol:
  • Nodes (Validators and Full nodes):
  • Indexer:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:

@tzakian tzakian requested review from cgswords, tnowacki, dariorussi and a team May 13, 2024 19:09
Copy link

vercel bot commented May 13, 2024

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 May 24, 2024 5:45pm
3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview May 24, 2024 5:45pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview May 24, 2024 5:45pm
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview May 24, 2024 5:45pm

Copy link
Contributor

@dariorussi dariorussi left a comment

Choose a reason for hiding this comment

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

thanks! it looks pretty good

@@ -19,6 +19,54 @@ use std::{
mem::size_of,
};

// Static assertions about the encoding of the flavor into the version of the binary format.
const _: () = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it worth naming this for easier debugging if the assertions ever fail?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably not, but I'll add some more comments!

Comment on lines +32 to +39
pub const FLAVOR_MASK: u32 = 0xFF00_0000;
pub const VERSION_MASK: u32 = 0x00FF_FFFF;
// The Sui flavor is 0x05
pub const SUI_FLAVOR: u8 = 0x05;
const SHIFT_AMOUNT: u8 = 24;
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if there is a more-canonical way to do this in Rust, since we're doing it a few places now.

@tzakian tzakian force-pushed the tzakian/move-enums-sui-tests branch from 772709d to 20f3837 Compare May 14, 2024 22:09
@tzakian tzakian requested a review from joyqvq as a code owner May 14, 2024 22:09
@tzakian tzakian force-pushed the tzakian/move-enums-flavor-version branch from 7d8b624 to 5bd35d7 Compare May 14, 2024 22:09
@tzakian tzakian force-pushed the tzakian/move-enums-sui-tests branch from 20f3837 to 37ecf65 Compare May 16, 2024 20:51
@tzakian tzakian force-pushed the tzakian/move-enums-flavor-version branch from 5bd35d7 to 55e29f0 Compare May 16, 2024 20:51
@tzakian tzakian force-pushed the tzakian/move-enums-sui-tests branch from 37ecf65 to 3be561d Compare May 21, 2024 19:53
@tzakian tzakian force-pushed the tzakian/move-enums-flavor-version branch from 55e29f0 to 8685a36 Compare May 21, 2024 19:53
@tzakian tzakian force-pushed the tzakian/move-enums-sui-tests branch from 3be561d to 6fd1819 Compare May 21, 2024 20:56
@tzakian tzakian force-pushed the tzakian/move-enums-flavor-version branch from 8685a36 to 51696a1 Compare May 21, 2024 20:56
@tzakian tzakian force-pushed the tzakian/move-enums-sui-tests branch from 6fd1819 to cb31954 Compare May 22, 2024 18:04
@tzakian tzakian force-pushed the tzakian/move-enums-flavor-version branch from 51696a1 to 8b3f82b Compare May 22, 2024 18:04
@tzakian tzakian removed the request for review from joyqvq May 22, 2024 18:07
@tzakian tzakian force-pushed the tzakian/move-enums-sui-tests branch from cb31954 to dc7301f Compare May 23, 2024 17:17
@tzakian tzakian force-pushed the tzakian/move-enums-flavor-version branch from 8b3f82b to d8fbeb9 Compare May 23, 2024 17:17
@tzakian tzakian force-pushed the tzakian/move-enums-sui-tests branch from dc7301f to 415134a Compare May 23, 2024 18:50
@tzakian tzakian force-pushed the tzakian/move-enums-flavor-version branch from d8fbeb9 to fc81aec Compare May 23, 2024 18:50
## Description 

Turns on enums in move 2024 alpha, and updates the location of tests to
reflect that.

## Test plan 

Update existing tests, and make sure they pass. 

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
@tzakian tzakian merged commit dba1915 into tzakian/move-enums-sui-tests May 24, 2024
14 of 18 checks passed
@tzakian tzakian deleted the tzakian/move-enums-flavor-version branch May 24, 2024 17:44
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.

None yet

3 participants