@@ -36,7 +36,7 @@ use tokio::time::sleep;
3636
3737const DEFAULT_NUM_VALIDATORS : usize = 4 ;
3838const DEFAULT_EPOCH_DURATION_MS : u64 = 86_400_000 ; // 24 hours; tests that need epoch changes should set a shorter duration
39- const NETWORK_STARTUP_TIMEOUT_SECS : u64 = 60 ;
39+ const NETWORK_STARTUP_TIMEOUT_SECS : u64 = 120 ;
4040const NETWORK_STARTUP_POLL_INTERVAL_SECS : u64 = 1 ;
4141
4242pub fn sui_binary ( ) -> & ' static Path {
@@ -60,7 +60,7 @@ pub fn sui_binary() -> &'static Path {
6060 . as_path ( )
6161}
6262
63- async fn wait_for_ready ( client : & mut Client ) -> Result < ( ) > {
63+ async fn wait_for_ready ( client : & mut Client , dir : & Path ) -> Result < ( ) > {
6464 // Wait till the network has started up and at least one checkpoint has been produced
6565 for _ in 0 ..NETWORK_STARTUP_TIMEOUT_SECS {
6666 if let Ok ( resp) = client
@@ -74,11 +74,19 @@ async fn wait_for_ready(client: &mut Client) -> Result<()> {
7474 sleep ( Duration :: from_secs ( NETWORK_STARTUP_POLL_INTERVAL_SECS ) ) . await ;
7575 }
7676 anyhow:: bail!(
77- "Network failed to start within {}s timeout" ,
77+ "Network failed to start within {}s timeout. {} " ,
7878 NETWORK_STARTUP_TIMEOUT_SECS ,
79+ startup_diagnostics( dir) ,
7980 )
8081}
8182
83+ fn startup_diagnostics ( dir : & Path ) -> String {
84+ crate :: tail_logs ( & [
85+ ( "stderr" , & dir. join ( "out.stderr" ) ) ,
86+ ( "stdout" , & dir. join ( "out.stdout" ) ) ,
87+ ] )
88+ }
89+
8290/// Handle for a Sui network running via pre-compiled binary
8391pub struct SuiNetworkHandle {
8492 /// Child process running sui
@@ -172,7 +180,7 @@ impl SuiNetworkBuilder {
172180 let rpc_url = format ! ( "http://127.0.0.1:{rpc_port}" ) ;
173181
174182 let mut client = sui_rpc:: Client :: new ( & rpc_url) ?;
175- wait_for_ready ( & mut client) . await ?;
183+ wait_for_ready ( & mut client, & dir ) . await ?;
176184 let mut sui = SuiNetworkHandle {
177185 process,
178186 dir,
0 commit comments