Skip to content

Commit

Permalink
fix erroneous initial_shared_version in tx manager tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aschran committed Dec 19, 2024
1 parent a268921 commit 81c978d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion crates/sui-core/src/authority/authority_per_epoch_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1451,7 +1451,8 @@ impl AuthorityPerEpochStore {
let Some(version) = shared_locks.get(&(*id, initial_shared_version)) else {
panic!(
"Shared object locks should have been set. key: {key:?}, obj \
id: {id:?}",
id: {id:?}, initial_shared_version: {initial_shared_version:?}, \
shared_locks: {shared_locks:?}",
)
};
InputKey::VersionedObject {
Expand Down
14 changes: 9 additions & 5 deletions crates/sui-core/src/unit_tests/transaction_manager_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ async fn transaction_manager_object_dependency() {
})
.collect();
let shared_object = Object::shared_for_testing();
let initial_shared_version = shared_object.owner().start_version().unwrap();
let shared_object_2 = Object::shared_for_testing();
let initial_shared_version_2 = shared_object_2.owner().start_version().unwrap();

let state = init_state_with_objects(
[
Expand All @@ -216,7 +218,7 @@ async fn transaction_manager_object_dependency() {
let shared_version = 1000.into();
let shared_object_arg_read = ObjectArg::SharedObject {
id: shared_object.id(),
initial_shared_version: 0.into(),
initial_shared_version,
mutable: false,
};
let transaction_read_0 = make_transaction(
Expand Down Expand Up @@ -257,7 +259,7 @@ async fn transaction_manager_object_dependency() {
// Enqueue one transaction with the same shared object in mutable mode.
let shared_object_arg_default = ObjectArg::SharedObject {
id: shared_object.id(),
initial_shared_version: 0.into(),
initial_shared_version,
mutable: true,
};
let transaction_default = make_transaction(
Expand All @@ -282,7 +284,7 @@ async fn transaction_manager_object_dependency() {
let shared_version_2 = 1000.into();
let shared_object_arg_read_2 = ObjectArg::SharedObject {
id: shared_object_2.id(),
initial_shared_version: 0.into(),
initial_shared_version: initial_shared_version_2,
mutable: false,
};
let transaction_read_2 = make_transaction(
Expand Down Expand Up @@ -755,7 +757,9 @@ async fn transaction_manager_with_cancelled_transactions() {
let (owner, _keypair) = deterministic_random_account_key();
let gas_object = Object::with_id_owner_for_testing(ObjectID::random(), owner);
let shared_object_1 = Object::shared_for_testing();
let initial_shared_version_1 = shared_object_1.owner().start_version().unwrap();
let shared_object_2 = Object::shared_for_testing();
let initial_shared_version_2 = shared_object_2.owner().start_version().unwrap();
let owned_object = Object::with_id_owner_for_testing(ObjectID::random(), owner);

let state = init_state_with_objects(vec![
Expand All @@ -775,12 +779,12 @@ async fn transaction_manager_with_cancelled_transactions() {
// Enqueue one transaction with 2 shared object inputs and 1 owned input.
let shared_object_arg_1 = ObjectArg::SharedObject {
id: shared_object_1.id(),
initial_shared_version: 0.into(),
initial_shared_version: initial_shared_version_1,
mutable: true,
};
let shared_object_arg_2 = ObjectArg::SharedObject {
id: shared_object_2.id(),
initial_shared_version: 0.into(),
initial_shared_version: initial_shared_version_2,
mutable: true,
};

Expand Down

0 comments on commit 81c978d

Please sign in to comment.