@@ -1220,7 +1220,8 @@ impl WasmChallengeExecutor {
12201220 }
12211221 }
12221222
1223- let result = pi_guard. instance
1223+ let result = pi_guard
1224+ . instance
12241225 . call_return_i64 ( "sync" )
12251226 . map_err ( |e| anyhow:: anyhow!( "WASM sync call failed: {}" , e) ) ?;
12261227
@@ -1238,7 +1239,8 @@ impl WasmChallengeExecutor {
12381239 } ) ;
12391240 }
12401241
1241- let result_data = pi_guard. instance
1242+ let result_data = pi_guard
1243+ . instance
12421244 . read_memory ( out_ptr as usize , out_len as usize )
12431245 . map_err ( |e| anyhow:: anyhow!( "failed to read WASM memory for sync output: {}" , e) ) ?;
12441246
@@ -1445,7 +1447,12 @@ impl WasmChallengeExecutor {
14451447 block_height : u64 ,
14461448 epoch : u64 ,
14471449 ) -> Result < Arc < Mutex < PersistentInstance > > > {
1448- let current_version = self . module_versions . read ( ) . get ( module_path) . copied ( ) . unwrap_or ( 0 ) ;
1450+ let current_version = self
1451+ . module_versions
1452+ . read ( )
1453+ . get ( module_path)
1454+ . copied ( )
1455+ . unwrap_or ( 0 ) ;
14491456
14501457 // Check if we already have a valid persistent instance
14511458 {
@@ -1461,7 +1468,8 @@ impl WasmChallengeExecutor {
14611468 }
14621469
14631470 // Create a new persistent instance
1464- let module = self . load_module ( module_path)
1471+ let module = self
1472+ . load_module ( module_path)
14651473 . context ( "Failed to load WASM module for persistent instance" ) ?;
14661474
14671475 let real_now_ms = std:: time:: SystemTime :: now ( )
@@ -1490,7 +1498,8 @@ impl WasmChallengeExecutor {
14901498 ..Default :: default ( )
14911499 } ;
14921500
1493- let instance = self . runtime
1501+ let instance = self
1502+ . runtime
14941503 . instantiate ( & module, instance_config, None )
14951504 . map_err ( |e| anyhow:: anyhow!( "Failed to create persistent WASM instance: {}" , e) ) ?;
14961505
@@ -1500,8 +1509,14 @@ impl WasmChallengeExecutor {
15001509 created_at : Instant :: now ( ) ,
15011510 } ) ) ;
15021511
1503- self . persistent_instances . write ( ) . insert ( module_path. to_string ( ) , Arc :: clone ( & pi) ) ;
1504- info ! ( module = module_path, version = current_version, "persistent WASM instance created" ) ;
1512+ self . persistent_instances
1513+ . write ( )
1514+ . insert ( module_path. to_string ( ) , Arc :: clone ( & pi) ) ;
1515+ info ! (
1516+ module = module_path,
1517+ version = current_version,
1518+ "persistent WASM instance created"
1519+ ) ;
15051520 Ok ( pi)
15061521 }
15071522
@@ -1518,7 +1533,10 @@ impl WasmChallengeExecutor {
15181533 let mut guard = match pi. try_lock ( ) {
15191534 Some ( g) => g,
15201535 None => {
1521- debug ! ( module = module_path, "background_tick skipped: instance busy (sync in progress)" ) ;
1536+ debug ! (
1537+ module = module_path,
1538+ "background_tick skipped: instance busy (sync in progress)"
1539+ ) ;
15221540 return Ok ( ( ) ) ;
15231541 }
15241542 } ;
@@ -1571,7 +1589,12 @@ impl WasmChallengeExecutor {
15711589 * v += 1 ;
15721590 info ! ( module = module_path, version = * v, "module version bumped" ) ;
15731591 // Drop old persistent instance
1574- if self . persistent_instances . write ( ) . remove ( module_path) . is_some ( ) {
1592+ if self
1593+ . persistent_instances
1594+ . write ( )
1595+ . remove ( module_path)
1596+ . is_some ( )
1597+ {
15751598 info ! ( module = module_path, "persistent instance dropped" ) ;
15761599 }
15771600 }
0 commit comments