Skip to content
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] upgrade error formatting should use existing diag wrapper #20014

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions crates/sui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@ move-analyzer.workspace = true
move-bytecode-verifier-meter.workspace = true
move-core-types.workspace = true
move-package.workspace = true
move-compiler.workspace = true
csv.workspace = true
move-vm-profiler.workspace = true
move-vm-config.workspace = true
move-ir-types.workspace = true
move-command-line-common.workspace = true

[target.'cfg(not(target_env = "msvc"))'.dependencies]
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

module upgrades::enum_ {
public enum EnumToBeRemoved {
A,
B
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

module upgrades::func_ {
public fun fun_to_be_removed(): u64 {
0
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

#[allow(unused_field)]
module upgrades::struct_ {
public struct StructToBeRemoved {
b: u64
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

module upgrades::enum_ {
//public enum EnumToBeRemoved {}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

module upgrades::func_ {
// public fun fun_to_be_removed(): u64 {}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

module upgrades::struct_ {
// public struct StructToBeRemoved {}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change in error order here is kind of interesting -- is that expected? If the error order changes from run-to-run we may have issues with the snapshot test.

Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,35 @@
source: crates/sui/src/unit_tests/upgrade_compatibility_tests.rs
expression: normalize_path(err.to_string())
---
error: struct is missing
┌─ /fixtures/upgrade_errors/declarations_missing_v2/sources/UpgradeErrors.move:7:18
error[Compatibility E01001]: missing public declaration
┌─ /fixtures/upgrade_errors/declarations_missing_v2/sources/enum.move:4:18
7 │ module upgrades::upgrades {
│ ^^^^^^^^ Module 'upgrades' expected struct 'StructToBeRemoved', but found none
4 │ module upgrades::enum_ {
│ ^^^^^ enum 'EnumToBeRemoved' is missing
= structs are part of a module's public interface and cannot be removed or changed during an upgrade, add back the struct 'StructToBeRemoved'.
= enum is missing expected enum 'EnumToBeRemoved', but found none
= enums are part of a module's public interface and cannot be removed or changed during an upgrade
= add missing enum 'EnumToBeRemoved' back to the module 'enum_'.

error: enum is missing
┌─ /fixtures/upgrade_errors/declarations_missing_v2/sources/UpgradeErrors.move:7:18
error[Compatibility E01001]: missing public declaration
┌─ /fixtures/upgrade_errors/declarations_missing_v2/sources/func.move:4:18
7 │ module upgrades::upgrades {
│ ^^^^^^^^ Module 'upgrades' expected enum 'EnumToBeRemoved', but found none
4 │ module upgrades::func_ {
│ ^^^^^ public function 'fun_to_be_removed' is missing
= enums are part of a module's public interface and cannot be removed or changed during an upgrade, add back the enum 'EnumToBeRemoved'.
= public function is missing expected public function 'fun_to_be_removed', but found none
= public functions are part of a module's public interface and cannot be removed or changed during an upgrade
= add missing public function 'fun_to_be_removed' back to the module 'func_'.

error: public function is missing
┌─ /fixtures/upgrade_errors/declarations_missing_v2/sources/UpgradeErrors.move:7:18
error[Compatibility E01001]: missing public declaration
┌─ /fixtures/upgrade_errors/declarations_missing_v2/sources/struct.move:4:18
7 │ module upgrades::upgrades {
│ ^^^^^^^^ Module 'upgrades' expected public function 'fun_to_be_removed', but found none
4 │ module upgrades::struct_ {
│ ^^^^^^^ struct 'StructToBeRemoved' is missing
= public functions are part of a module's public interface and cannot be removed or changed during an upgrade, add back the public function 'fun_to_be_removed'.
= struct is missing expected struct 'StructToBeRemoved', but found none
= structs are part of a module's public interface and cannot be removed or changed during an upgrade
= add missing struct 'StructToBeRemoved' back to the module 'struct_'.


Upgrade failed, this package requires changes to be compatible with the existing package. Its upgrade policy is set to 'Compatible'.
Loading
Loading