sui icon indicating copy to clipboard operation
sui copied to clipboard

move toolchain: fix multiple issues with bytecode dependencies

Open kklas opened this issue 1 year ago • 4 comments

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 https://github.com/MystenLabs/sui/pull/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

kklas avatar Mar 04 '24 12:03 kklas

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-core ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 11, 2024 0:56am
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 11, 2024 0:56am
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Sep 11, 2024 0:56am
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Sep 11, 2024 0:56am
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview Sep 11, 2024 0:56am

vercel[bot] avatar Mar 04 '24 12:03 vercel[bot]

Thanks @kklas! Kicking off CI so long, review to follow!

rvantonder avatar Mar 04 '24 19:03 rvantonder

@tnowacki agree with everything. I'm waiting for other comments to do round 2 here.

kklas avatar Mar 13 '24 22:03 kklas

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.

github-actions[bot] avatar May 15 '24 01:05 github-actions[bot]

I apologize for this unreasonably long delay. I have restarted the work on this:

  • rebase
  • move bytecode_deps_modules inside TestRunner
  • use IndexMap in compute_topological_order

@amnn @rvantonder @tnowacki I would appreciate another look

kklas avatar Sep 02 '24 08:09 kklas

@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.

amnn avatar Sep 11 '24 12:09 amnn

@amnn rebase done, all good to go!

kklas avatar Sep 11 '24 12:09 kklas

It's in, 🚀 , thanks very much @kklas!

amnn avatar Sep 11 '24 13:09 amnn