1- use crate :: { DataCompat , journal:: JournalDb } ;
2- use futures_util:: { Stream , StreamExt } ;
1+ use crate :: journal:: JournalDb ;
2+ use futures_util:: StreamExt ;
33use reth:: {
4+ primitives:: SealedHeader ,
45 providers:: {
56 CanonChainTracker , DatabaseProviderFactory , DatabaseProviderRW , ProviderResult ,
67 providers:: BlockchainProvider ,
78 } ,
89 rpc:: types:: engine:: ForkchoiceState ,
910} ;
11+ use signet_journal:: { Journal , JournalStream } ;
1012use signet_node_types:: { NodeTypesDbTrait , SignetNodeTypes } ;
11- use signet_types:: primitives:: SealedHeader ;
1213use tokio:: task:: JoinHandle ;
13- use trevm:: journal:: BlockUpdate ;
1414
1515/// A task that processes journal updates for a specific database, and calls
1616/// the appropriate methods on a [`BlockchainProvider`] to update the in-memory
@@ -40,21 +40,20 @@ impl<Db: NodeTypesDbTrait> JournalProviderTask<Db> {
4040 /// task-spawning system.
4141 pub async fn task_future < S > ( self , mut journals : S ) -> ProviderResult < ( ) >
4242 where
43- S : Stream < Item = ( SealedHeader , BlockUpdate < ' static > ) > + Send + Unpin + ' static ,
43+ S : JournalStream < ' static > + Send + Unpin + ' static ,
4444 {
4545 loop {
46- let Some ( ( header, block_update) ) = journals. next ( ) . await else { break } ;
47-
48- let block_hash = header. hash ( ) ;
46+ let Some ( Journal :: V1 ( journal) ) = journals. next ( ) . await else { break } ;
4947
5048 let rw = self . provider . database_provider_rw ( ) . map ( DatabaseProviderRW ) ;
5149
52- let r_header = header. clone_convert ( ) ;
50+ let r_header = SealedHeader :: new_unhashed ( journal. header ( ) . clone ( ) ) ;
51+ let block_hash = r_header. hash ( ) ;
5352
5453 // DB interaction is sync, so we spawn a blocking task for it. We
5554 // immediately await that task. This prevents blocking the worker
5655 // thread
57- tokio:: task:: spawn_blocking ( move || rw?. ingest ( header , block_update ) )
56+ tokio:: task:: spawn_blocking ( move || rw?. ingest ( journal ) )
5857 . await
5958 . expect ( "ingestion should not panic" ) ?;
6059
@@ -74,7 +73,7 @@ impl<Db: NodeTypesDbTrait> JournalProviderTask<Db> {
7473 /// Spawn the journal provider task.
7574 pub fn spawn < S > ( self , journals : S ) -> JoinHandle < ProviderResult < ( ) > >
7675 where
77- S : Stream < Item = ( SealedHeader , BlockUpdate < ' static > ) > + Send + Unpin + ' static ,
76+ S : JournalStream < ' static > + Send + Unpin + ' static ,
7877 {
7978 tokio:: spawn ( self . task_future ( journals) )
8079 }
0 commit comments