@@ -16,9 +16,9 @@ use bindings::{
1616} ;
1717use event_indexer:: indexer:: ShastaEventIndexer ;
1818use protocol:: shasta:: {
19- constants:: shasta_fork_height_for_chain , manifest:: DerivationSourceManifest ,
19+ constants:: shasta_fork_timestamp_for_chain , manifest:: DerivationSourceManifest ,
2020} ;
21- use rpc:: { blob:: BlobDataSource , client:: Client , error :: RpcClientError } ;
21+ use rpc:: { blob:: BlobDataSource , client:: Client } ;
2222
2323use crate :: {
2424 derivation:: {
5454 anchor_constructor : AnchorTxConstructor < P > ,
5555 derivation_source_manifest_fetcher :
5656 Arc < dyn ManifestFetcher < Manifest = DerivationSourceManifest > > ,
57- shasta_fork_height : u64 ,
57+ shasta_fork_timestamp : u64 ,
5858}
5959
6060impl < P > ShastaDerivationPipeline < P >
@@ -73,20 +73,15 @@ where
7373 let source_manifest_fetcher: Arc < dyn ManifestFetcher < Manifest = DerivationSourceManifest > > =
7474 Arc :: new ( ShastaSourceManifestFetcher :: new ( blob_source. clone ( ) ) ) ;
7575 let anchor_constructor = AnchorTxConstructor :: new ( rpc. clone ( ) ) . await ?;
76- let chain_id = rpc
77- . l2_provider
78- . get_chain_id ( )
79- . await
80- . map_err ( |err| DerivationError :: Rpc ( RpcClientError :: Provider ( err. to_string ( ) ) ) ) ?;
81- let shasta_fork_height = shasta_fork_height_for_chain ( chain_id)
76+ let chain_id = rpc. l2_provider . get_chain_id ( ) . await ?;
77+ let shasta_fork_timestamp = shasta_fork_timestamp_for_chain ( chain_id)
8278 . map_err ( |err| DerivationError :: Other ( err. into ( ) ) ) ?;
83-
8479 Ok ( Self {
8580 rpc,
8681 indexer,
8782 anchor_constructor,
8883 derivation_source_manifest_fetcher : source_manifest_fetcher,
89- shasta_fork_height ,
84+ shasta_fork_timestamp ,
9085 } )
9186 }
9287
@@ -162,7 +157,7 @@ where
162157 async fn initialize_parent_state (
163158 & self ,
164159 parent_block : & RpcBlock < TxEnvelope > ,
165- ) -> Result < ( ParentState , u64 ) , DerivationError > {
160+ ) -> Result < ParentState , DerivationError > {
166161 let anchor_state = self . rpc . shasta_anchor_state_by_hash ( parent_block. hash ( ) ) . await ?;
167162 let parent_header = parent_block. header . inner . clone ( ) ;
168163
@@ -186,9 +181,10 @@ where
186181 header : parent_header,
187182 bond_instructions_hash : anchor_state. bond_instructions_hash ,
188183 anchor_block_number : anchor_state. anchor_block_number ,
184+ shasta_fork_timestamp : self . shasta_fork_timestamp ,
189185 } ;
190186
191- Ok ( ( state, self . shasta_fork_height ) )
187+ Ok ( state)
192188 }
193189}
194190
@@ -269,14 +265,12 @@ where
269265 } ,
270266 ) ?;
271267
272- let ( mut parent_state, shasta_fork_height) =
273- self . initialize_parent_state ( & parent_block) . await ?;
268+ let mut parent_state = self . initialize_parent_state ( & parent_block) . await ?;
274269
275270 self . build_payloads_from_sources (
276271 sources,
277272 & meta,
278273 proposal_origin_block_hash,
279- shasta_fork_height,
280274 & mut parent_state,
281275 applier,
282276 )
0 commit comments