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

[move][stdlib] Add vec_map::from_key_values and vec_set::from_keys #17880

Merged
merged 3 commits into from
May 22, 2024

Conversation

tnowacki
Copy link
Contributor

Description

  • There was no easy way to make a VecMap or VecSet from a PTB

Test plan

  • New functions and tests

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: New Move functions for vec_map::from_key_values and vec_set::from_key_values
  • Rust SDK:

@tnowacki tnowacki requested review from damirka and a team May 22, 2024 18:24
Copy link

vercel bot commented May 22, 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 22, 2024 9:42pm

Copy link

vercel bot commented May 22, 2024

@tnowacki is attempting to deploy a commit to the Mysten Labs Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@tzakian tzakian left a comment

Choose a reason for hiding this comment

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

LGTM, just if you could add the one test for from_keys

@@ -61,4 +61,18 @@ module sui::vec_set_tests {
assert!(m.size() == 3, 0);
assert!(m.keys() == &vector[1, 2, 3], 1);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a test that tries to call from_keys with a vector containing duplicate elements to make sure it aborts with EKeyAlreadyExists?

Copy link
Contributor Author

@tnowacki tnowacki May 22, 2024

Choose a reason for hiding this comment

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

Ah I'll add that for maps too, good catch

@tnowacki tnowacki enabled auto-merge (squash) May 22, 2024 21:43
@tnowacki tnowacki merged commit 690fa2a into MystenLabs:main May 22, 2024
42 of 45 checks passed
@tnowacki tnowacki deleted the roundtrip branch May 22, 2024 22:59
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

2 participants