-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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-2024] Method syntax for move-stdlib
#16466
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
c617bab
to
634cb1a
Compare
634cb1a
to
2cda1b0
Compare
2c69bc7
to
0b720f1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall LGTM, just one comment about naming
public use fun std::ascii::string as vector.to_ascii_string; | ||
|
||
/// Allows calling `.try_to_ascii_string()` on a vector of `u8` to get an | ||
/// `ascii::String`. This will return `None` if the vector is not valid ascii. | ||
public use fun std::ascii::try_string as vector.try_to_ascii_string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Y'alls thoughts shortening to to_ascii
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like to_ascii_string
-- to_ascii
might imply it hands back a vector.
@@ -101,7 +101,8 @@ module std::bcs_tests { | |||
} | |||
|
|||
#[test] | |||
#[expected_failure(abort_code = 453, location = std::bcs)] | |||
#[expected_failure] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the dropping of the location and code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error is now that this hits the VM object depth, not the bcs
decoding error that was previously being thrown.
## Description Stacked on #16466 (and also #16634 as a result) This translates `sui-framework` to Move 2024. Public use funs: ``` sources/balance.move 10: public use fun sui::coin::from_balance as Balance.into_coin; sources/kiosk/kiosk.move 97: public use fun kiosk_owner_cap_for as KioskOwnerCap.kiosk; sources/coin.move 16: public use fun sui::pay::split_vec as Coin.split_vec; 19: public use fun sui::pay::join_vec as Coin.join_vec; 22: public use fun sui::pay::split_and_transfer as Coin.split_and_transfer; 25: public use fun sui::pay::divide_and_keep as Coin.divide_and_keep; sources/object.move 19: public use fun id_to_address as ID.to_address; 22: public use fun id_to_bytes as ID.to_bytes; 25: public use fun uid_as_inner as UID.as_inner; 28: public use fun uid_to_inner as UID.to_inner; 31: public use fun uid_to_address as UID.to_address; 34: public use fun uid_to_bytes as UID.to_bytes; sources/address.move 12: public use fun sui::object::id_from_address as address.to_id; ``` ## Test Plan Tests are unchanged. Note that many of the tests may be rewritten to also use method syntax, but this change is already large enough that it seemed prudent to do the tests in a separate diff. --- If your changes are not user-facing and do not break anything, you can skip the following section. Otherwise, please briefly describe what has changed under the Release Notes section. ### Type of Change (Check all that apply) - [ ] protocol change - [ ] user-visible impact - [ ] breaking change for a client SDKs - [ ] breaking change for FNs (FN binary must upgrade) - [ ] breaking change for validators or node operators (must upgrade binaries) - [ ] breaking change for on-chain data layout - [ ] necessitate either a data wipe or data migration ### Release notes --------- Co-authored-by: Todd Nowacki <tmn@mystenlabs.com>
## Description Stacked on #16466 (and also #16634 as a result) This translates `sui-framework` to Move 2024. Public use funs: ``` sources/balance.move 10: public use fun sui::coin::from_balance as Balance.into_coin; sources/kiosk/kiosk.move 97: public use fun kiosk_owner_cap_for as KioskOwnerCap.kiosk; sources/coin.move 16: public use fun sui::pay::split_vec as Coin.split_vec; 19: public use fun sui::pay::join_vec as Coin.join_vec; 22: public use fun sui::pay::split_and_transfer as Coin.split_and_transfer; 25: public use fun sui::pay::divide_and_keep as Coin.divide_and_keep; sources/object.move 19: public use fun id_to_address as ID.to_address; 22: public use fun id_to_bytes as ID.to_bytes; 25: public use fun uid_as_inner as UID.as_inner; 28: public use fun uid_to_inner as UID.to_inner; 31: public use fun uid_to_address as UID.to_address; 34: public use fun uid_to_bytes as UID.to_bytes; sources/address.move 12: public use fun sui::object::id_from_address as address.to_id; ``` ## Test Plan Tests are unchanged. Note that many of the tests may be rewritten to also use method syntax, but this change is already large enough that it seemed prudent to do the tests in a separate diff. --- If your changes are not user-facing and do not break anything, you can skip the following section. Otherwise, please briefly describe what has changed under the Release Notes section. ### Type of Change (Check all that apply) - [ ] protocol change - [ ] user-visible impact - [ ] breaking change for a client SDKs - [ ] breaking change for FNs (FN binary must upgrade) - [ ] breaking change for validators or node operators (must upgrade binaries) - [ ] breaking change for on-chain data layout - [ ] necessitate either a data wipe or data migration ### Release notes --------- Co-authored-by: Todd Nowacki <tmn@mystenlabs.com>
## Description Does what it says on the tin (read: makes the code all shiny!) Public use funs: ``` ascii.move 10: public use fun std::string::from_ascii as String.to_string; vector.move 10: public use fun std::string::utf8 as vector.to_string; 14: public use fun std::string::try_utf8 as vector.try_to_string; 17: public use fun std::ascii::string as vector.to_ascii_string; 21: public use fun std::ascii::try_string as vector.try_to_ascii_string; ``` ## Test Plan All the tests still work as expected, plus hand-analysis of decompiled bytecode matches 1:1. --- If your changes are not user-facing and do not break anything, you can skip the following section. Otherwise, please briefly describe what has changed under the Release Notes section. ### Type of Change (Check all that apply) - [ ] protocol change - [ ] user-visible impact - [ ] breaking change for a client SDKs - [ ] breaking change for FNs (FN binary must upgrade) - [ ] breaking change for validators or node operators (must upgrade binaries) - [ ] breaking change for on-chain data layout - [ ] necessitate either a data wipe or data migration ### Release notes
Stacked on #16466 (and also #16634 as a result) This translates `sui-framework` to Move 2024. Public use funs: ``` sources/balance.move 10: public use fun sui::coin::from_balance as Balance.into_coin; sources/kiosk/kiosk.move 97: public use fun kiosk_owner_cap_for as KioskOwnerCap.kiosk; sources/coin.move 16: public use fun sui::pay::split_vec as Coin.split_vec; 19: public use fun sui::pay::join_vec as Coin.join_vec; 22: public use fun sui::pay::split_and_transfer as Coin.split_and_transfer; 25: public use fun sui::pay::divide_and_keep as Coin.divide_and_keep; sources/object.move 19: public use fun id_to_address as ID.to_address; 22: public use fun id_to_bytes as ID.to_bytes; 25: public use fun uid_as_inner as UID.as_inner; 28: public use fun uid_to_inner as UID.to_inner; 31: public use fun uid_to_address as UID.to_address; 34: public use fun uid_to_bytes as UID.to_bytes; sources/address.move 12: public use fun sui::object::id_from_address as address.to_id; ``` Tests are unchanged. Note that many of the tests may be rewritten to also use method syntax, but this change is already large enough that it seemed prudent to do the tests in a separate diff. --- If your changes are not user-facing and do not break anything, you can skip the following section. Otherwise, please briefly describe what has changed under the Release Notes section. - [ ] protocol change - [ ] user-visible impact - [ ] breaking change for a client SDKs - [ ] breaking change for FNs (FN binary must upgrade) - [ ] breaking change for validators or node operators (must upgrade binaries) - [ ] breaking change for on-chain data layout - [ ] necessitate either a data wipe or data migration --------- Co-authored-by: Todd Nowacki <tmn@mystenlabs.com>
Description
Stacked on top of #16634, does what it says on the tin (and it makes the code all shiny!)
Public use funs:
Test Plan
All the tests still work as expected
If your changes are not user-facing and do not break anything, you can skip the following section. Otherwise, please briefly describe what has changed under the Release Notes section.
Type of Change (Check all that apply)
Release notes