Skip to content

Commit

Permalink
Restore test_full_node_cold_sync and make it less fragile (MystenLabs…
Browse files Browse the repository at this point in the history
  • Loading branch information
mystenmark authored Jun 23, 2022
1 parent d52ddf6 commit 61116a2
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion crates/sui/tests/full_node_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use sui_swarm::memory::Swarm;
use sui_types::{
base_types::{ObjectID, ObjectRef, SuiAddress, TransactionDigest},
batch::UpdateItem,
messages::{BatchInfoRequest, BatchInfoResponseItem, Transaction},
messages::{BatchInfoRequest, BatchInfoResponseItem, Transaction, TransactionInfoRequest},
};
use test_utils::network::setup_network_and_wallet;
use tokio::sync::Mutex;
Expand Down Expand Up @@ -393,6 +393,36 @@ async fn test_full_node_indexes() -> Result<(), anyhow::Error> {
Ok(())
}

// Test for syncing a node to an authority that already has many txes.
#[tokio::test]
async fn test_full_node_cold_sync() -> Result<(), anyhow::Error> {
telemetry_subscribers::init_for_testing();

let (swarm, mut context, _) = setup_network_and_wallet().await?;

let (_, _, _, _) = transfer_coin(&mut context).await?;
let (_, _, _, _) = transfer_coin(&mut context).await?;
let (_, _, _, _) = transfer_coin(&mut context).await?;
let (_transfered_object, _sender, _receiver, digest) = transfer_coin(&mut context).await?;

sleep(Duration::from_millis(1000)).await;

let config = swarm.config().generate_fullnode_config();
let node = SuiNode::start(&config).await?;

wait_for_tx(digest, node.state().clone()).await;

let info = node
.state()
.handle_transaction_info_request(TransactionInfoRequest {
transaction_digest: digest,
})
.await?;
assert!(info.signed_effects.is_some());

Ok(())
}

#[tokio::test]
async fn test_full_node_sync_flood() -> Result<(), anyhow::Error> {
telemetry_subscribers::init_for_testing();
Expand Down

0 comments on commit 61116a2

Please sign in to comment.