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

[package upgrades] change upgrade criteria for struct type params #11369

Merged
merged 1 commit into from
Apr 26, 2023
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
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) } }
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> { }
}
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) } }
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>() { }
}
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) } }
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
}
}
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) } }
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> { }
Copy link
Member

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.

Copy link
Contributor Author

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.

}

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ expression: genesis_config
validator_config_info: ~
parameters:
chain_start_timestamp_ms: 0
protocol_version: 7
protocol_version: 8
allow_insertion_of_extra_objects: true
epoch_duration_ms: 86400000
stake_subsidy_start_epoch: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source: crates/sui-config/tests/snapshot_tests.rs
expression: genesis.sui_system_object().into_genesis_version_for_tooling()
---
epoch: 0
protocol_version: 7
protocol_version: 8
system_state_version: 1
validators:
total_stake: 20000000000000000
Expand Down Expand Up @@ -240,56 +240,56 @@ validators:
next_epoch_worker_address: ~
extra_fields:
id:
id: "0x006f489ddb855ad6dd2ddc0172a5a16b7eb5a349ecce3c1aac36ebe9da17b665"
id: "0x4a0c9788ea5050ecf89c54d428c8427c50a59e89db35a79a598194e2104a68ad"
size: 0
voting_power: 10000
operation_cap_id: "0xe3d50cc5283f5e3e48c939660cff4488eabc8aa2ff5a2c6a0b6ac3e5c218338e"
operation_cap_id: "0x10bbcc539c000681e842b482267ed5088e62cc8f0a0f30f33cd2a8b6885db59f"
gas_price: 1000
staking_pool:
id: "0xae66922aed3d742871b37a5ba729c746b4152b96fb84001099d1ab535877aac8"
id: "0xc0478fe6a2bc3ffac040af44d3d35d7002c5981d318ce8ba9aca8328a0420e5a"
activation_epoch: 0
deactivation_epoch: ~
sui_balance: 20000000000000000
rewards_pool:
value: 0
pool_token_balance: 20000000000000000
exchange_rates:
id: "0x949491e7369c431747e1dc589e943e463fa4178d547b66fef2f659f9206b94cd"
id: "0x651689c415c91de1f15ce6042c8d7d5a9b9b33325abefd0a8ec8496feadef5a1"
size: 1
pending_stake: 0
pending_total_sui_withdraw: 0
pending_pool_token_withdraw: 0
extra_fields:
id:
id: "0x41d17884d8da2c87a8e202cfef6a3899f8509907532ccddbfc9abadfe8db0974"
id: "0xa81c9563b11bd51d3317dd09058181651effcd27d1ae16afd9de06f97b65d057"
size: 0
commission_rate: 200
next_epoch_stake: 20000000000000000
next_epoch_gas_price: 1000
next_epoch_commission_rate: 200
extra_fields:
id:
id: "0xa92bec0e088d01cf5d904c14e8d959eb40acede5a4914e7971bb769f106d81af"
id: "0xbdce91fe9b10e45e0be571158c0f7f9b224e7299b5878c1849ef7cbdc9c378fc"
size: 0
pending_active_validators:
contents:
id: "0xf2aa70ee4c97a1d49d4dcc8ec872394f1a5887f1110f1652ae193c8932e67196"
id: "0x962191c2d53c4167ad014f21a389b3744c9e21efc2d40d40e6a4a812bbb51f9a"
size: 0
pending_removals: []
staking_pool_mappings:
id: "0x0c8939ed51111ffaa1774b83eddd32f7fb3fde2e7226bce7962d8cf589f1e21d"
id: "0x5d1d429b0390c77b94f54b2a0b90aec9e523541a789ca63d27052db85277957c"
size: 1
inactive_validators:
id: "0x432f06a4916b7c0bf916a939fbad1869518c6dd8141ed936c65fda2f2d64cf53"
id: "0xd59ec431b34cd289fab737da8735d618ecf55e69db7d760e4b82479d1d8fd64d"
size: 0
validator_candidates:
id: "0x6c4691ed7697c58e729c0c84dacb1929ada1c62ec1642bb11fe61bc26602ee28"
id: "0x8aa05f9ce6e9edb2170420d56f2e59e83311f3b154234594ff975eedcf0599e0"
size: 0
at_risk_validators:
contents: []
extra_fields:
id:
id: "0x0c2571594f76972d0fd30688ab0b83d9be1a68d8021d2d968d8c9798b1cda126"
id: "0x0193dc3618230dce7312c6e9480d77a998d1d3af16a00048892d2d70bf186a60"
size: 0
storage_fund:
total_object_storage_rebates:
Expand All @@ -306,7 +306,7 @@ parameters:
validator_low_stake_grace_period: 7
extra_fields:
id:
id: "0x6d97c8bbced9771b32accd42b4168127e89f9feadb54906a9821ca949d592ff0"
id: "0x575675181becb2882e4d04c7ca1ba85b021a23279835d05d1583b1c77dbc3b1a"
size: 0
reference_gas_price: 1000
validator_report_records:
Expand All @@ -320,7 +320,7 @@ stake_subsidy:
stake_subsidy_decrease_rate: 10000
extra_fields:
id:
id: "0xdb951b4e2c8e515d3628517c3dd505355ab5915d2e305dd79b45754c40330f08"
id: "0x59530c3949046ec4318d46e68d6545b39d4ec6da5db3ecd5689f84bc5b2d32bd"
size: 0
safe_mode: false
safe_mode_storage_rewards:
Expand All @@ -332,6 +332,6 @@ safe_mode_non_refundable_storage_fee: 0
epoch_start_timestamp_ms: 10
extra_fields:
id:
id: "0x231a9926075f40b0bdbfa45afbe22440b606821d644cda13764224b78e768385"
id: "0xcae46711febb41d4be7c6ba901d7fc67ccd57911233667213a5e7f9241ce25bd"
size: 0

11 changes: 10 additions & 1 deletion crates/sui-framework-snapshot/bytecode_snapshot/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@
"0x0000000000000000000000000000000000000000000000000000000000000003",
"0x000000000000000000000000000000000000000000000000000000000000dee9"
]
},
"7": {
"git_revision": "16e0132840a6b77a7077feb0df99b07cf3bd0a69",
"package_ids": [
"0x0000000000000000000000000000000000000000000000000000000000000001",
"0x0000000000000000000000000000000000000000000000000000000000000002",
"0x0000000000000000000000000000000000000000000000000000000000000003",
"0x000000000000000000000000000000000000000000000000000000000000dee9"
]
}
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions crates/sui-framework/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ pub async fn compare_system_package<S: ObjectStore>(
check_friend_linking: false,
check_private_entry_linking: true,
disallowed_new_abilities: AbilitySet::ALL,
disallow_change_struct_type_params: true,
};

let new_pkg = new_object
Expand Down
Loading