-
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
[CLI] Only use referenced dependencies in the linkage table #20509
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Skipped Deployments
|
This PR breaks the following tests. Would have to look into them: TRY 4 FAIL [ 0.897s] sui-core move_package_tests::package_digest_changes_with_dep_upgrades_and_in_sync_with_move_package_digest
TRY 4 FAIL [ 2.742s] sui-package-resolver tests::test_function_parameters
TRY 4 FAIL [ 2.010s] sui-package-resolver tests::test_relinking_layout
TRY 4 FAIL [ 23.935s] sui-source-validation tests::linkage_differs
TRY 4 FAIL [ 18.823s] sui-source-validation tests::successful_verification_upgrades
TRY 4 FAIL [ 16.837s] sui-source-validation tests::successful_verification_with_bytecode_dep |
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 implementation looks good, thanks @stefan-mysten. When it comes to updating the tests, I suspect many of them are now failing because before they were adding a dependency that was not referenced as a convenient short hand as part of the test set-up.
In most if not all cases the right thing to do is probably to introduce a reference to the non-existent dependency in the Move code, not expect that it will be stripped. I made a comment to that effect on the test that was already updated, but watch out for that when cleaning up the other tests too.
crates/sui/tests/cli_tests.rs
Outdated
"{}", | ||
err | ||
); | ||
// publishing with a dependency that is not referenced in code is OK, as the dependency list |
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 seems like in this case you need to update the test such that the dependency is actually referenced but does not exist, because that is what we're trying to test 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.
Yes, but now the issue will be that source verification will trigger an error that it cannot find the on-chain version of this dependency which is a slightly different error than the one we had here with Dependency object does not exist or was deleted
. FWIW, that Move package has set a random published-at
field in the manifest.
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's okay that the error wording is different, the point is that we're testing the error case here.
68faf41
to
883ed0a
Compare
… the local network that is running
e3ef4ae
to
7122a7f
Compare
Description
When a package is added as a dependency in the Move.toml manifest file, it will become part of the linkage table regardless if any code in that package is actually referenced in the code or not.
This PR fixes that by making sure that a package's linkage table contains only the dependencies that are actually referenced in the code by computing the list of dependencies from the modules' dependencies after all modules and their transitive dependencies are compiled rather than the manifest files.
Test plan
Note that now source validation will not allow to publish such a package (see below) because it cannot find the dependency on-chain.
Structure:
A_v1 -> published
A_v2 -> upgrade A_v1
B -> dependency on A_v2, but no code is called from A_v2.
Locally: After the change
Before the change
B's source code is:
B's Move.toml dependency list is:
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.