-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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 toolchain: fix multiple issues with bytecode dependencies #16523
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Skipped Deployments
|
Thanks @kklas! Kicking off CI so long, review to follow! |
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.
// collect bytecode dependencies as these are not returned as part of core | ||
// `CompiledPackage` |
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 feel like they should be? If this is an issue
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.
Though needing the full deserialized bytes feels maybe like a Sui specific thing? Unsure
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 not nearly as familiar with this codebase as any of you are, but I'm also unsure. Though here the only reason I've added these here is because of source verification (to avoid having to hackily load them somehow in the source verification implementation), which is a Sui specific thing.So perhaps it's justifiable keeping them here unless there's another reason to have them in core CompiledPackage
?
external-crates/move/crates/move-cli/tests/move_unit_tests/bytecode_deps/Move.toml
Outdated
Show resolved
Hide resolved
@tnowacki agree with everything. I'm waiting for other comments to do round 2 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.
I am happy to see a move-bytecode-utils
file get nuked 😄
See inline comments!
} | ||
|
||
match petgraph::algo::toposort(&graph, None) { | ||
Err(_) => panic!("Circular dependency detected"), |
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.
Since we have a Result
return type, think it makes sense to trickle this up in stead of panicking? anyhow::bail
? The match
might also simplify?
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.
It was like that in the old code too. My impression is that you should never be able to end up with a circular dependency on what is essentially a CompiledModule
list. Because otherwise these modules wouldn't even compile. So it's not like a user error here but some serious bug somewhere else so a panic seems fine here.
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
82365f6
to
8dc33d3
Compare
I apologize for this unreasonably long delay. I have restarted the work on this:
@amnn @rvantonder @tnowacki I would appreciate another look |
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.
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.
Let's !
@kklas, my hand is hovering over "Squash and Merge" but let me know if you want to do a final rebase, etc before I send it. |
6d60803
to
373355a
Compare
@amnn rebase done, all good to go! |
It's in, 🚀 , thanks very much @kklas! |
## Description This PR fixes multiple issues caused by bytecode dependencies not being included in `CompiledPackage`: - multiple functionalities failing due to topo sort in `Modules` panicking on missing dependencies - running `move test` on packages with bytecode deps failing due to them not being included in VM storage - source verification failing because bytecode deps aren't handled - commands such as publish and upgrade failing due to bytecode deps not being referenced in the construction of transaction blocks Summary of changes: - removed `move_bytecode_utils::dependency_graph` module and instead added a `compute_topological_order` method to `Modules`. Replaced all calls to `compute_dependency_graph` with a direct call to `compute_topological_order` (2 in total) - added bytecode deps to VM storage for test runs by loading them from `ResolvedGraph` - include bytecode deps in `sui_move_build::CompiledPackage` and fix various module fetching methods to return modules from bytecode deps also - include bytecode deps in `local_modules` function to fix `LocalDependencyNotFound` errors in source verification This is part of the work to enable compiling against on-chain dependencies #14178. cc @rvantonder @amnn ## Test Plan Added unit tests for `move test` and source verification. --- 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
Description
This PR fixes multiple issues caused by bytecode dependencies not being included in
CompiledPackage
:Modules
panicking on missing dependenciesmove test
on packages with bytecode deps failing due to them not being included in VM storageSummary of changes:
move_bytecode_utils::dependency_graph
module and instead added acompute_topological_order
method toModules
. Replaced all calls tocompute_dependency_graph
with a direct call tocompute_topological_order
(2 in total)ResolvedGraph
sui_move_build::CompiledPackage
and fix various module fetching methods to return modules from bytecode deps alsolocal_modules
function to fixLocalDependencyNotFound
errors in source verificationThis is part of the work to enable compiling against on-chain dependencies #14178.
cc @rvantonder @amnn
Test Plan
Added unit tests for
move test
and source verification.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