forked from MystenLabs/sui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5cc439e
commit 401334e
Showing
7 changed files
with
361 additions
and
182 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
crates/sui/src/unit_tests/fixtures/upgrade_errors/function_signature_v1/Move.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[package] | ||
name = "upgrades" | ||
edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move | ||
|
||
[addresses] | ||
upgrades = "0x0" |
29 changes: 29 additions & 0 deletions
29
...i/src/unit_tests/fixtures/upgrade_errors/function_signature_v1/sources/UpgradeErrors.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
/// Module: UpgradeErrors | ||
|
||
#[allow(unused_field)] | ||
module upgrades::upgrades { | ||
public fun func_with_wrong_param(a: u64): u64 { | ||
0 | ||
} | ||
|
||
public fun func_with_wrong_return(): u64 { | ||
0 | ||
} | ||
|
||
public fun func_with_wrong_param_and_return(a: u64): u64 { | ||
0 | ||
} | ||
|
||
public fun func_with_wrong_param_length(a: u64, b: u64): u64 { | ||
0 | ||
} | ||
|
||
public fun func_with_wrong_return_length(): (u64, u64) { | ||
(0,0) | ||
} | ||
|
||
} | ||
|
6 changes: 6 additions & 0 deletions
6
crates/sui/src/unit_tests/fixtures/upgrade_errors/function_signature_v2/Move.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[package] | ||
name = "upgrades" | ||
edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move | ||
|
||
[addresses] | ||
upgrades = "0x0" |
30 changes: 30 additions & 0 deletions
30
...i/src/unit_tests/fixtures/upgrade_errors/function_signature_v2/sources/UpgradeErrors.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
/// Module: UpgradeErrors | ||
|
||
#[allow(unused_field)] | ||
module upgrades::upgrades { | ||
// struct missing | ||
public fun func_with_wrong_param(a: u32): u64 { | ||
0 | ||
} | ||
|
||
public fun func_with_wrong_return(): u32 { | ||
0 | ||
} | ||
|
||
public fun func_with_wrong_param_and_return(a: u32): u32 { | ||
0 | ||
} | ||
|
||
public fun func_with_wrong_param_length(a: u64): u64 { | ||
0 | ||
} | ||
|
||
public fun func_with_wrong_return_length(): u64 { | ||
0 | ||
} | ||
|
||
} | ||
|
54 changes: 54 additions & 0 deletions
54
...napshots/sui__upgrade_compatibility__upgrade_compatibility_tests__function_signature.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--- | ||
source: crates/sui/src/unit_tests/upgrade_compatibility_tests.rs | ||
expression: err.to_string() | ||
--- | ||
Upgrade compatibility check failed: | ||
error: Function signature mismatch | ||
┌─ /Users/jordanjennings/code/sui/crates/sui/src/unit_tests/fixtures/upgrade_errors/function_signature_v2/sources/UpgradeErrors.move:9:38 | ||
│ | ||
9 │ public fun func_with_wrong_param(a: u32): u64 { | ||
│ ^ Function 'func_with_wrong_param' unexpected parameter u32 at position 0, expected u64 | ||
│ | ||
= Functions are part of a module's public interface and cannot be changed during an upgrade, restore the original function's parameters for function 'func_with_wrong_param'. | ||
|
||
error: Function signature mismatch | ||
┌─ /Users/jordanjennings/code/sui/crates/sui/src/unit_tests/fixtures/upgrade_errors/function_signature_v2/sources/UpgradeErrors.move:17:49 | ||
│ | ||
17 │ public fun func_with_wrong_param_and_return(a: u32): u32 { | ||
│ ^ Function 'func_with_wrong_param_and_return' unexpected parameter u32 at position 0, expected u64 | ||
│ | ||
= Functions are part of a module's public interface and cannot be changed during an upgrade, restore the original function's parameters for function 'func_with_wrong_param_and_return'. | ||
|
||
error: Function signature mismatch | ||
┌─ /Users/jordanjennings/code/sui/crates/sui/src/unit_tests/fixtures/upgrade_errors/function_signature_v2/sources/UpgradeErrors.move:17:58 | ||
│ | ||
17 │ public fun func_with_wrong_param_and_return(a: u32): u32 { | ||
│ ^^^ Module 'upgrades' function 'func_with_wrong_param_and_return' has an unexpected return type u32, expected u64 | ||
│ | ||
= Functions are part of a module's public interface and cannot be changed during an upgrade, restore the original function's return types for function 'func_with_wrong_param_and_return'. | ||
|
||
error: Function signature mismatch | ||
┌─ /Users/jordanjennings/code/sui/crates/sui/src/unit_tests/fixtures/upgrade_errors/function_signature_v2/sources/UpgradeErrors.move:21:16 | ||
│ | ||
21 │ public fun func_with_wrong_param_length(a: u64): u64 { | ||
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Function 'func_with_wrong_param_length' expected 2 parameters, have 1 | ||
│ | ||
= Functions are part of a module's public interface and cannot be changed during an upgrade, restore the original function's parameters for function 'func_with_wrong_param_length', expected 2 parameters. | ||
|
||
error: Function signature mismatch | ||
┌─ /Users/jordanjennings/code/sui/crates/sui/src/unit_tests/fixtures/upgrade_errors/function_signature_v2/sources/UpgradeErrors.move:13:42 | ||
│ | ||
13 │ public fun func_with_wrong_return(): u32 { | ||
│ ^^^ Module 'upgrades' function 'func_with_wrong_return' has an unexpected return type u32, expected u64 | ||
│ | ||
= Functions are part of a module's public interface and cannot be changed during an upgrade, restore the original function's return types for function 'func_with_wrong_return'. | ||
|
||
error: Function signature mismatch | ||
┌─ /Users/jordanjennings/code/sui/crates/sui/src/unit_tests/fixtures/upgrade_errors/function_signature_v2/sources/UpgradeErrors.move:25:16 | ||
│ | ||
25 │ public fun func_with_wrong_return_length(): u64 { | ||
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Function 'func_with_wrong_return_length' expected to have 2 return type(s), have 1 | ||
│ | ||
= Functions are part of a module's public interface and cannot be changed during an upgrade, restore the original function's return types for function 'func_with_wrong_return_length'. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.