-
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-compiler][sui-mode] Add init and one-time witness rules #13335
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
4 Ignored Deployments
|
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.
A couple nits but otherwise LGTM!
@@ -0,0 +1,12 @@ | |||
warning[W09004]: unnecessary trailing semicolon |
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.
Nit. Since we seem to be testing bool field here, is the trailing semi warning really necessary here?
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.
Missed this, thanks!
|
||
// Find the first invalid field in a one-time witness type, if any. | ||
// First looks for a non-boolean field, otherwise looks for any field after the first. | ||
fn invalid_otw_field_loc(fields: &Fields<Type>) -> Option<Loc> { |
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.
Nit. It took me a bit to parse it for correctness (which I think it is, and I am just slow...) but it probably wouldn't hurt adding a multi-field test.
- Added init and one-time witness rules to the compiler's sui mode
true | ||
}; | ||
if valid_fields { | ||
let name = mdef.structs.get_full_key_(&self.upper_module()).unwrap(); |
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.
Would it make sense to factor out this specific operation into a function or otherwise signpost that this is the way we find our OTW?
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.
Not sure I follow. What is it you want to break out into a separate function?
@cgswords, I'm going to land this since it is a rather large refactor. |
## Description - Added init and one-time witness rules to the compiler's Sui mode ## Test Plan - Migrated tests --- If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process. ### Type of Change (Check all that apply) - [ ] protocol change - [X] 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 In this release, the Move compiler will now error on incorrect declarations (or usage) of `init` functions and one-time witnesses.
## Description - Added init and one-time witness rules to the compiler's Sui mode ## Test Plan - Migrated tests --- If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process. ### Type of Change (Check all that apply) - [ ] protocol change - [X] 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 In this release, the Move compiler will now error on incorrect declarations (or usage) of `init` functions and one-time witnesses.
## Description - Added init and one-time witness rules to the compiler's Sui mode ## Test Plan - Migrated tests --- If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process. ### Type of Change (Check all that apply) - [ ] protocol change - [X] 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 In this release, the Move compiler will now error on incorrect declarations (or usage) of `init` functions and one-time witnesses.
Description
Test Plan
If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process.
Type of Change (Check all that apply)
Release notes
In this release, the Move compiler will now error on incorrect declarations (or usage) of
init
functions and one-time witnesses.