Skip to content

Commit

Permalink
Add more checks in shared_object_sync test (MystenLabs#2552)
Browse files Browse the repository at this point in the history
  • Loading branch information
lxfind authored Jun 14, 2022
1 parent 2a0df25 commit 10d7fed
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions crates/sui/tests/shared_objects_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
// SPDX-License-Identifier: Apache-2.0

use std::sync::Arc;
use sui_core::authority_client::AuthorityAPI;
use sui_core::gateway_state::{GatewayAPI, GatewayState};
use sui_types::messages::{CallArg, ExecutionStatus};
use sui_types::messages::{CallArg, ExecutionStatus, ObjectInfoRequest, ObjectInfoRequestKind};
use sui_types::object::OBJECT_START_VERSION;
use test_utils::authority::test_authority_aggregator;
use test_utils::authority::{get_client, test_authority_aggregator};
use test_utils::transaction::{
publish_counter_package, submit_shared_object_transaction, submit_single_owner_transaction,
};
Expand Down Expand Up @@ -247,6 +248,28 @@ async fn shared_object_sync() {
assert!(matches!(effects.status, ExecutionStatus::Success { .. }));
let ((counter_id, _, _), _) = effects.created[0];

// Check that the counter object only exist in the first validator, but not the rest.
get_client(&configs.validator_set()[0])
.handle_object_info_request(ObjectInfoRequest {
object_id: counter_id,
request_kind: ObjectInfoRequestKind::LatestObjectInfo(None),
})
.await
.unwrap()
.object()
.unwrap();
for config in configs.validator_set().iter().skip(1) {
assert!(get_client(config)
.handle_object_info_request(ObjectInfoRequest {
object_id: counter_id,
request_kind: ObjectInfoRequestKind::LatestObjectInfo(None),
})
.await
.unwrap()
.object()
.is_none());
}

// Make a transaction to increment the counter.
tokio::task::yield_now().await;
let increment_counter_transaction = move_transaction(
Expand Down

0 comments on commit 10d7fed

Please sign in to comment.