-
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
[package upgrades] change upgrade criteria for struct type params #11369
Merged
tzakian
merged 1 commit into
main
from
tzakian/disallow-generic-type-changes-on-structs
Apr 26, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions
25
crates/sui-adapter-transactional-tests/tests/upgrade/add_ability_during_upgrade_generics.exp
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,25 @@ | ||
processed 6 tasks | ||
|
||
init: | ||
A: object(0,0) | ||
|
||
task 1 'publish'. lines 6-9: | ||
created: object(1,0), object(1,1) | ||
mutated: object(0,0) | ||
gas summary: computation_cost: 1000000, storage_cost: 5403600, storage_rebate: 0, non_refundable_storage_fee: 0 | ||
|
||
task 2 'upgrade'. lines 11-14: | ||
Error: Transaction Effects Status: Invalid package upgrade. New package is incompatible with previous version | ||
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: PackageUpgradeError { upgrade_error: IncompatibleUpgrade }, source: Some(PartialVMError { major_status: BACKWARD_INCOMPATIBLE_MODULE_UPDATE, sub_status: None, message: None, exec_state: None, indices: [], offsets: [] }), command: Some(1) } } | ||
|
||
task 3 'upgrade'. lines 16-19: | ||
Error: Transaction Effects Status: Invalid package upgrade. New package is incompatible with previous version | ||
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: PackageUpgradeError { upgrade_error: IncompatibleUpgrade }, source: Some(PartialVMError { major_status: BACKWARD_INCOMPATIBLE_MODULE_UPDATE, sub_status: None, message: None, exec_state: None, indices: [], offsets: [] }), command: Some(1) } } | ||
|
||
task 4 'upgrade'. lines 21-24: | ||
Error: Transaction Effects Status: Invalid package upgrade. New package is incompatible with previous version | ||
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: PackageUpgradeError { upgrade_error: IncompatibleUpgrade }, source: Some(PartialVMError { major_status: BACKWARD_INCOMPATIBLE_MODULE_UPDATE, sub_status: None, message: None, exec_state: None, indices: [], offsets: [] }), command: Some(1) } } | ||
|
||
task 5 'upgrade'. lines 26-29: | ||
Error: Transaction Effects Status: Invalid package upgrade. New package is incompatible with previous version | ||
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: PackageUpgradeError { upgrade_error: IncompatibleUpgrade }, source: Some(PartialVMError { major_status: BACKWARD_INCOMPATIBLE_MODULE_UPDATE, sub_status: None, message: None, exec_state: None, indices: [], offsets: [] }), command: Some(1) } } |
29 changes: 29 additions & 0 deletions
29
...es/sui-adapter-transactional-tests/tests/upgrade/add_ability_during_upgrade_generics.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 | ||
|
||
//# init --addresses A0=0x0 A1=0x0 B0=0x0 B1=0x0 --accounts A | ||
|
||
//# publish --upgradeable --sender A | ||
module A0::base { | ||
struct Foo<phantom T> { } | ||
} | ||
|
||
//# upgrade --package A0 --upgrade-capability 1,1 --sender A | ||
module A1::base { | ||
struct Foo<T: store> { } | ||
} | ||
|
||
//# upgrade --package A0 --upgrade-capability 1,1 --sender A | ||
module A1::base { | ||
struct Foo<T: copy> { } | ||
} | ||
|
||
//# upgrade --package A0 --upgrade-capability 1,1 --sender A | ||
module A1::base { | ||
struct Foo<T: drop> { } | ||
} | ||
|
||
//# upgrade --package A0 --upgrade-capability 1,1 --sender A | ||
module A1::base { | ||
struct Foo<T: copy + drop + key> { } | ||
} |
28 changes: 28 additions & 0 deletions
28
...-adapter-transactional-tests/tests/upgrade/remove_ability_during_upgrade_fun_generics.exp
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,28 @@ | ||
processed 6 tasks | ||
|
||
init: | ||
A: object(0,0) | ||
|
||
task 1 'publish'. lines 6-9: | ||
created: object(1,0), object(1,1) | ||
mutated: object(0,0) | ||
gas summary: computation_cost: 1000000, storage_cost: 5046400, storage_rebate: 0, non_refundable_storage_fee: 0 | ||
|
||
task 2 'upgrade'. lines 11-14: | ||
created: object(2,0) | ||
mutated: object(0,0), object(1,1) | ||
gas summary: computation_cost: 1000000, storage_cost: 5046400, storage_rebate: 2595780, non_refundable_storage_fee: 26220 | ||
|
||
task 3 'upgrade'. lines 16-19: | ||
created: object(3,0) | ||
mutated: object(0,0), object(1,1) | ||
gas summary: computation_cost: 1000000, storage_cost: 5046400, storage_rebate: 2595780, non_refundable_storage_fee: 26220 | ||
|
||
task 4 'upgrade'. lines 21-24: | ||
created: object(4,0) | ||
mutated: object(0,0), object(1,1) | ||
gas summary: computation_cost: 1000000, storage_cost: 5046400, storage_rebate: 2595780, non_refundable_storage_fee: 26220 | ||
|
||
task 5 'upgrade'. lines 26-29: | ||
Error: Transaction Effects Status: Invalid package upgrade. New package is incompatible with previous version | ||
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: PackageUpgradeError { upgrade_error: IncompatibleUpgrade }, source: Some(PartialVMError { major_status: BACKWARD_INCOMPATIBLE_MODULE_UPDATE, sub_status: None, message: None, exec_state: None, indices: [], offsets: [] }), command: Some(1) } } |
29 changes: 29 additions & 0 deletions
29
...adapter-transactional-tests/tests/upgrade/remove_ability_during_upgrade_fun_generics.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 | ||
|
||
//# init --addresses A0=0x0 A1=0x0 A2=0x0 A3=0x0 A4=0x0 --accounts A | ||
|
||
//# publish --upgradeable --sender A | ||
module A0::base { | ||
public fun f<T: store + copy + key>() { } | ||
} | ||
|
||
//# upgrade --package A0 --upgrade-capability 1,1 --sender A | ||
module A1::base { | ||
public fun f<T: store + copy>() { } | ||
} | ||
|
||
//# upgrade --package A1 --upgrade-capability 1,1 --sender A | ||
module A2::base { | ||
public fun f<T: store>() { } | ||
} | ||
|
||
//# upgrade --package A2 --upgrade-capability 1,1 --sender A | ||
module A3::base { | ||
public fun f<T>() { } | ||
} | ||
|
||
//# upgrade --package A3 --upgrade-capability 1,1 --sender A | ||
module A4::base { | ||
public fun f<T: store>() { } | ||
} |
29 changes: 29 additions & 0 deletions
29
.../sui-adapter-transactional-tests/tests/upgrade/remove_ability_during_upgrade_generics.exp
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 @@ | ||
processed 7 tasks | ||
|
||
init: | ||
A: object(0,0) | ||
|
||
task 1 'publish'. lines 6-11: | ||
created: object(1,0), object(1,1) | ||
mutated: object(0,0) | ||
gas summary: computation_cost: 1000000, storage_cost: 5335200, storage_rebate: 0, non_refundable_storage_fee: 0 | ||
|
||
task 2 'upgrade'. lines 13-18: | ||
Error: Transaction Effects Status: Invalid package upgrade. New package is incompatible with previous version | ||
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: PackageUpgradeError { upgrade_error: IncompatibleUpgrade }, source: Some(PartialVMError { major_status: BACKWARD_INCOMPATIBLE_MODULE_UPDATE, sub_status: None, message: None, exec_state: None, indices: [], offsets: [] }), command: Some(1) } } | ||
|
||
task 3 'upgrade'. lines 20-25: | ||
Error: Transaction Effects Status: Invalid package upgrade. New package is incompatible with previous version | ||
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: PackageUpgradeError { upgrade_error: IncompatibleUpgrade }, source: Some(PartialVMError { major_status: BACKWARD_INCOMPATIBLE_MODULE_UPDATE, sub_status: None, message: None, exec_state: None, indices: [], offsets: [] }), command: Some(1) } } | ||
|
||
task 4 'upgrade'. lines 27-32: | ||
Error: Transaction Effects Status: Invalid package upgrade. New package is incompatible with previous version | ||
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: PackageUpgradeError { upgrade_error: IncompatibleUpgrade }, source: Some(PartialVMError { major_status: BACKWARD_INCOMPATIBLE_MODULE_UPDATE, sub_status: None, message: None, exec_state: None, indices: [], offsets: [] }), command: Some(1) } } | ||
|
||
task 5 'upgrade'. lines 34-39: | ||
Error: Transaction Effects Status: Invalid package upgrade. New package is incompatible with previous version | ||
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: PackageUpgradeError { upgrade_error: IncompatibleUpgrade }, source: Some(PartialVMError { major_status: BACKWARD_INCOMPATIBLE_MODULE_UPDATE, sub_status: None, message: None, exec_state: None, indices: [], offsets: [] }), command: Some(1) } } | ||
|
||
task 6 'upgrade'. lines 41-46: | ||
Error: Transaction Effects Status: Invalid package upgrade. New package is incompatible with previous version | ||
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: PackageUpgradeError { upgrade_error: IncompatibleUpgrade }, source: Some(PartialVMError { major_status: BACKWARD_INCOMPATIBLE_MODULE_UPDATE, sub_status: None, message: None, exec_state: None, indices: [], offsets: [] }), command: Some(1) } } |
46 changes: 46 additions & 0 deletions
46
...sui-adapter-transactional-tests/tests/upgrade/remove_ability_during_upgrade_generics.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,46 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//# init --addresses A0=0x0 A1=0x0 B0=0x0 B1=0x0 --accounts A | ||
|
||
//# publish --upgradeable --sender A | ||
module A0::base { | ||
struct Foo<T: store + copy + drop + key> { | ||
x: T | ||
} | ||
} | ||
|
||
//# upgrade --package A0 --upgrade-capability 1,1 --sender A | ||
module A1::base { | ||
struct Foo<T: store + copy + drop> { | ||
x: T | ||
} | ||
} | ||
|
||
//# upgrade --package A0 --upgrade-capability 1,1 --sender A | ||
module A1::base { | ||
struct Foo<T: copy> { | ||
x: T | ||
} | ||
} | ||
|
||
//# upgrade --package A0 --upgrade-capability 1,1 --sender A | ||
module A1::base { | ||
struct Foo<T: drop> { | ||
x: T | ||
} | ||
} | ||
|
||
//# upgrade --package A0 --upgrade-capability 1,1 --sender A | ||
module A1::base { | ||
struct Foo<T: key> { | ||
x: T | ||
} | ||
} | ||
|
||
//# upgrade --package A0 --upgrade-capability 1,1 --sender A | ||
module A1::base { | ||
struct Foo<T: store> { | ||
x: T | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
crates/sui-adapter-transactional-tests/tests/upgrade/remove_phantom.exp
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,17 @@ | ||
processed 4 tasks | ||
|
||
init: | ||
A: object(0,0) | ||
|
||
task 1 'publish'. lines 6-9: | ||
created: object(1,0), object(1,1) | ||
mutated: object(0,0) | ||
gas summary: computation_cost: 1000000, storage_cost: 5403600, storage_rebate: 0, non_refundable_storage_fee: 0 | ||
|
||
task 2 'upgrade'. lines 11-14: | ||
Error: Transaction Effects Status: Invalid package upgrade. New package is incompatible with previous version | ||
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: PackageUpgradeError { upgrade_error: IncompatibleUpgrade }, source: Some(PartialVMError { major_status: BACKWARD_INCOMPATIBLE_MODULE_UPDATE, sub_status: None, message: None, exec_state: None, indices: [], offsets: [] }), command: Some(1) } } | ||
|
||
task 3 'upgrade'. lines 16-19: | ||
Error: Transaction Effects Status: Invalid package upgrade. New package is incompatible with previous version | ||
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: PackageUpgradeError { upgrade_error: IncompatibleUpgrade }, source: Some(PartialVMError { major_status: BACKWARD_INCOMPATIBLE_MODULE_UPDATE, sub_status: None, message: None, exec_state: None, indices: [], offsets: [] }), command: Some(1) } } |
20 changes: 20 additions & 0 deletions
20
crates/sui-adapter-transactional-tests/tests/upgrade/remove_phantom.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,20 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//# init --addresses A0=0x0 A1=0x0 B0=0x0 B1=0x0 --accounts A | ||
|
||
//# publish --upgradeable --sender A | ||
module A0::base { | ||
struct Foo<phantom T> { } | ||
} | ||
|
||
//# upgrade --package A0 --upgrade-capability 1,1 --sender A | ||
module A1::base { | ||
struct Foo<T> { } | ||
} | ||
|
||
//# upgrade --package A0 --upgrade-capability 1,1 --sender A | ||
module A1::base { | ||
struct Foo<T: store> { } | ||
} | ||
|
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
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
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
Binary file added
BIN
+6.24 KB
...ode_snapshot/testnet/7/0x0000000000000000000000000000000000000000000000000000000000000001
Binary file not shown.
Binary file added
BIN
+36.1 KB
...ode_snapshot/testnet/7/0x0000000000000000000000000000000000000000000000000000000000000002
Binary file not shown.
Binary file added
BIN
+39.9 KB
...ode_snapshot/testnet/7/0x0000000000000000000000000000000000000000000000000000000000000003
Binary file not shown.
Binary file added
BIN
+14.8 KB
...ode_snapshot/testnet/7/0x000000000000000000000000000000000000000000000000000000000000dee9
Binary file not shown.
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
You are also adding a
store
here, is that intentionaly? That would be incompatible anyway but for another reason.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.
Yep! But I just wanted to make sure we were covering that as well here.