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

Restore test_full_node_cold_sync and make it less fragile #2690

Merged
merged 1 commit into from
Jun 23, 2022
Merged
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
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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should sleep after wait_for_tx, right?

Let's add a comment on why we sleep here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sleep is to make sure that the authorities are quiescent before we start up the node - if they aren't, its not really a cold sync.


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