-
Notifications
You must be signed in to change notification settings - Fork 11.3k
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] Fix toml issues with move-execution #17130
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Ignored Deployments
|
@amnn or @dariorussi, do you know if I need to update any scripts for execution cuts to reflect these changes in the future? (though we will need to fix the issues with the stdlib before changing any such scripts) |
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.
Amazing, thanks for tackling this. I've left comments on how to align this with how the cut script automates this process, so that future cuts all get tests and are included in the workspace.
Cargo.toml
Outdated
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'm assuming/hoping this was done because you flattened v0
as well to make it easier to make other fixes (rather than it having always been broken), because this should be covered by tests...
external-crates/move/Cargo.toml
Outdated
@@ -155,6 +158,23 @@ move-vm-test-utils = { path = "crates/move-vm-test-utils" } | |||
move-vm-types = { path = "crates/move-vm-types" } | |||
prover_bytecode = { path = "crates/move-stackless-bytecode", package="move-stackless-bytecode" } | |||
|
|||
# v0 |
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.
You don't want to make these workspace deps. Instead, we should follow the pattern that we use for other versioned crates, which is to update the toml files of the packages that depend on them to refer to them at their versioned path, but their unversioned name.
The reason for this is that it's much easier to automate (the script doesn't need to look at rust source files and find all references to the latest version and rename that to the versioned form).
See for example:
move-bytecode-verifier = { path = "../move-bytecode-verifier", package = "move-bytecode-verifier-v1" } |
external-crates/move/Cargo.toml
Outdated
"move-execution/v0/crates/*", | ||
"move-execution/v1/crates/*", | ||
"move-execution/v2/crates/*", |
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.
Automating this is going to be ...tricky. The cut tool figures out which packages should be included or excluded from the root workspace here:
sui/sui-execution/cut/src/plan.rs
Line 406 in 127f2cb
fn update_workspace(&self) -> Result<()> { |
But it doesn't currently understand how to handle multiple workspaces, ...or glob patterns. One thing you could do is piggyback off the logic we have in the wrapper script, that updates TOML files when a new cut is introduced, here:
sui/scripts/execution_layer.py
Line 420 in 127f2cb
def update_toml(feature, toml_path): |
This looks for comments in TOML files that contain "$CUT" and adds a line above them with "$CUT" replaced with the cut name, see e.g.
Lines 18 to 32 in 127f2cb
sui-adapter-latest = { path = "latest/sui-adapter" } | |
sui-adapter-v0 = { path = "v0/sui-adapter" } | |
sui-adapter-v1 = { path = "v1/sui-adapter" } | |
sui-adapter-v2 = { path = "v2/sui-adapter" } | |
# sui-adapter-$CUT = { path = "$CUT/sui-adapter" } | |
sui-move-natives-latest = { path = "latest/sui-move-natives" } | |
sui-move-natives-v0 = { path = "v0/sui-move-natives" } | |
sui-move-natives-v1 = { path = "v1/sui-move-natives" } | |
sui-move-natives-v2 = { path = "v2/sui-move-natives" } | |
# sui-move-natives-$CUT = { path = "$CUT/sui-move-natives" } | |
sui-verifier-latest = { path = "latest/sui-verifier" } | |
sui-verifier-v0 = { path = "v0/sui-verifier" } | |
sui-verifier-v1 = { path = "v1/sui-verifier" } | |
sui-verifier-v2 = { path = "v2/sui-verifier" } | |
# sui-verifier-$CUT = { path = "$CUT/sui-verifier" } |
This is maybe a little more brittle, but I think it's the fastest way to get unblocked without losing the automation support.
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.
Two comments here: I'm guessing that this crate is not included in the list of crates to cut right now, here:
sui/scripts/execution_layer.py
Lines 354 to 366 in 127f2cb
def cut_command(f): | |
"""Arguments for creating the cut for 'feature'.""" | |
return [ | |
*["./target/debug/cut", "--feature", f], | |
*["-d", f"sui-execution/latest:sui-execution/{f}:-latest"], | |
*["-d", f"external-crates/move:external-crates/move/move-execution/{f}"], | |
*["-p", "sui-adapter-latest"], | |
*["-p", "sui-move-natives-latest"], | |
*["-p", "sui-verifier-latest"], | |
*["-p", "move-bytecode-verifier"], | |
*["-p", "move-stdlib"], | |
*["-p", "move-vm-runtime"], | |
] |
But we should do that to make sure all future cuts get this crate and it's properly fixed up (Adding a new -p
flag with the crate name should suffice).
Also as per the earlier comment about its dependencies, this is where we would need to change the move-bytecode-verifier
dependency from a workspae dependency to a path
dependency with a customised package name (see my earlier comment on the workspace Cargo.toml
).
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.
...and then all the source files can be left alone.
@amnn thanks for all the guidance! |
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.
LGTM! Note the comment about workspace deps -- they are fine to be there, but if you needed to add them, then that's a worrying sign (probably something is set up incorrectly, bypassing versioning), so it's probably best to remove them.
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.
Is it just luck of the draw that this is considered a file addition instead of a copy?
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 tried to do git mv with then restoring the previous file. This was the result :(
Not sure if there is anything else to do
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.
In this file, the changes to members
is correct, but I don't think you should need the changes to workspace dependencies -- generally, if a crate is versioned in that way, we other crates should depend on it by path, or through some multiplexing crate (which we don't have within the Move workspace, but for sui
it's the sui-execution
crate).
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 tried to remove them at one point, but it did not work. Let me try again now that things are all good across the board
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 can take a look tomorrow as well, thanks for these fixes!
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.
(...never mind, I see it's fixed! Sorry, got confused by Github)
Description
external-crates/move/Cargo.toml
, leading to all sorts of issuesTest plan
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.