@@ -20,7 +20,7 @@ use reth_trie::{
2020} ;
2121use reth_trie_parallel:: {
2222 proof:: ParallelProof ,
23- proof_task:: { AccountMultiproofInput , ProofTaskKind , ProofTaskManagerHandle } ,
23+ proof_task:: { AccountMultiproofInput , ProofWorkerHandle } ,
2424 root:: ParallelStateRootError ,
2525} ;
2626use std:: {
@@ -346,11 +346,8 @@ pub struct MultiproofManager {
346346 pending : VecDeque < PendingMultiproofTask > ,
347347 /// Executor for tasks
348348 executor : WorkloadExecutor ,
349- /// Handle to the proof task manager used for creating `ParallelProof` instances for storage
350- /// proofs.
351- storage_proof_task_handle : ProofTaskManagerHandle ,
352- /// Handle to the proof task manager used for account multiproofs.
353- account_proof_task_handle : ProofTaskManagerHandle ,
349+ /// Handle to the proof worker pools (storage and account).
350+ proof_worker_handle : ProofWorkerHandle ,
354351 /// Cached storage proof roots for missed leaves; this maps
355352 /// hashed (missed) addresses to their storage proof roots.
356353 ///
@@ -372,8 +369,7 @@ impl MultiproofManager {
372369 fn new (
373370 executor : WorkloadExecutor ,
374371 metrics : MultiProofTaskMetrics ,
375- storage_proof_task_handle : ProofTaskManagerHandle ,
376- account_proof_task_handle : ProofTaskManagerHandle ,
372+ proof_worker_handle : ProofWorkerHandle ,
377373 max_concurrent : usize ,
378374 ) -> Self {
379375 Self {
@@ -382,8 +378,7 @@ impl MultiproofManager {
382378 executor,
383379 inflight : 0 ,
384380 metrics,
385- storage_proof_task_handle,
386- account_proof_task_handle,
381+ proof_worker_handle,
387382 missed_leaves_storage_roots : Default :: default ( ) ,
388383 }
389384 }
@@ -452,7 +447,7 @@ impl MultiproofManager {
452447 multi_added_removed_keys,
453448 } = storage_multiproof_input;
454449
455- let storage_proof_task_handle = self . storage_proof_task_handle . clone ( ) ;
450+ let storage_proof_worker_handle = self . proof_worker_handle . clone ( ) ;
456451 let missed_leaves_storage_roots = self . missed_leaves_storage_roots . clone ( ) ;
457452
458453 self . executor . spawn_blocking ( move || {
@@ -471,7 +466,7 @@ impl MultiproofManager {
471466 config. state_sorted ,
472467 config. prefix_sets ,
473468 missed_leaves_storage_roots,
474- storage_proof_task_handle ,
469+ storage_proof_worker_handle ,
475470 )
476471 . with_branch_node_masks ( true )
477472 . with_multi_added_removed_keys ( Some ( multi_added_removed_keys) )
@@ -524,7 +519,7 @@ impl MultiproofManager {
524519 state_root_message_sender,
525520 multi_added_removed_keys,
526521 } = multiproof_input;
527- let account_proof_task_handle = self . account_proof_task_handle . clone ( ) ;
522+ let account_proof_worker_handle = self . proof_worker_handle . clone ( ) ;
528523 let missed_leaves_storage_roots = self . missed_leaves_storage_roots . clone ( ) ;
529524
530525 self . executor . spawn_blocking ( move || {
@@ -556,15 +551,10 @@ impl MultiproofManager {
556551 missed_leaves_storage_roots,
557552 } ;
558553
559- let ( sender, receiver) = channel ( ) ;
560554 let proof_result: Result < DecodedMultiProof , ParallelStateRootError > = ( || {
561- account_proof_task_handle
562- . queue_task ( ProofTaskKind :: AccountMultiproof ( input, sender) )
563- . map_err ( |_| {
564- ParallelStateRootError :: Other (
565- "Failed to queue account multiproof to worker pool" . into ( ) ,
566- )
567- } ) ?;
555+ let receiver = account_proof_worker_handle
556+ . queue_account_multiproof ( input)
557+ . map_err ( |e| ParallelStateRootError :: Other ( e. to_string ( ) ) ) ?;
568558
569559 receiver
570560 . recv ( )
@@ -693,7 +683,7 @@ impl MultiProofTask {
693683 pub ( super ) fn new (
694684 config : MultiProofConfig ,
695685 executor : WorkloadExecutor ,
696- proof_task_handle : ProofTaskManagerHandle ,
686+ proof_worker_handle : ProofWorkerHandle ,
697687 to_sparse_trie : Sender < SparseTrieUpdate > ,
698688 max_concurrency : usize ,
699689 chunk_size : Option < usize > ,
@@ -713,8 +703,7 @@ impl MultiProofTask {
713703 multiproof_manager : MultiproofManager :: new (
714704 executor,
715705 metrics. clone ( ) ,
716- proof_task_handle. clone ( ) , // handle for storage proof workers
717- proof_task_handle, // handle for account proof workers
706+ proof_worker_handle,
718707 max_concurrency,
719708 ) ,
720709 metrics,
@@ -1223,7 +1212,7 @@ mod tests {
12231212 DatabaseProviderFactory ,
12241213 } ;
12251214 use reth_trie:: { MultiProof , TrieInput } ;
1226- use reth_trie_parallel:: proof_task:: { ProofTaskCtx , ProofTaskManager } ;
1215+ use reth_trie_parallel:: proof_task:: { ProofTaskCtx , ProofWorkerHandle } ;
12271216 use revm_primitives:: { B256 , U256 } ;
12281217
12291218 fn create_test_state_root_task < F > ( factory : F ) -> MultiProofTask
@@ -1238,12 +1227,12 @@ mod tests {
12381227 config. prefix_sets . clone ( ) ,
12391228 ) ;
12401229 let consistent_view = ConsistentDbView :: new ( factory, None ) ;
1241- let proof_task =
1242- ProofTaskManager :: new ( executor. handle ( ) . clone ( ) , consistent_view, task_ctx, 1 , 1 )
1243- . expect ( "Failed to create ProofTaskManager " ) ;
1230+ let proof_handle =
1231+ ProofWorkerHandle :: new ( executor. handle ( ) . clone ( ) , consistent_view, task_ctx, 1 , 1 )
1232+ . expect ( "Failed to spawn proof workers " ) ;
12441233 let channel = channel ( ) ;
12451234
1246- MultiProofTask :: new ( config, executor, proof_task . handle ( ) , channel. 0 , 1 , None )
1235+ MultiProofTask :: new ( config, executor, proof_handle , channel. 0 , 1 , None )
12471236 }
12481237
12491238 #[ test]
0 commit comments