@@ -15,7 +15,6 @@ use graph::{
1515 } ,
1616 components:: store:: DeploymentLocator ,
1717 firehose:: { self as firehose, ForkStep } ,
18- log:: factory:: { ComponentLoggerConfig , ElasticComponentLoggerConfig } ,
1918 prelude:: { async_trait, o, BlockNumber , ChainStore , Error , Logger , LoggerFactory } ,
2019} ;
2120use prost:: Message ;
@@ -154,20 +153,7 @@ impl Blockchain for Chain {
154153 }
155154
156155 fn ingestor_adapter ( & self ) -> Arc < Self :: IngestorAdapter > {
157- let logger = self
158- . logger_factory
159- . component_logger (
160- "BlockIngestor" ,
161- Some ( ComponentLoggerConfig {
162- elastic : Some ( ElasticComponentLoggerConfig {
163- index : String :: from ( "block-ingestor-logs" ) ,
164- } ) ,
165- } ) ,
166- )
167- . new ( o ! ( ) ) ;
168-
169- let adapter = IngestorAdapter { logger } ;
170- Arc :: new ( adapter)
156+ Arc :: new ( IngestorAdapter { } )
171157 }
172158
173159 fn chain_store ( & self ) -> Arc < dyn ChainStore > {
@@ -298,6 +284,7 @@ impl FirehoseMapperTrait<Chain> for FirehoseMapper {
298284 response. step
299285 )
300286 } ) ;
287+
301288 let any_block = response
302289 . block
303290 . as_ref ( )
@@ -321,14 +308,14 @@ impl FirehoseMapperTrait<Chain> for FirehoseMapper {
321308
322309 StepUndo => {
323310 let header = block. header ( ) ;
311+ let parent_ptr = header
312+ . parent_ptr ( )
313+ . expect ( "Genesis block should never be reverted" ) ;
324314
325315 Ok ( BlockStreamEvent :: Revert (
326- BlockPtr {
327- hash : BlockHash :: from ( header. hash . as_ref ( ) . unwrap ( ) . bytes . clone ( ) ) ,
328- number : header. height as i32 ,
329- } ,
316+ block. ptr ( ) ,
330317 Some ( response. cursor . clone ( ) ) ,
331- None , // FIXME: we should get the parent block pointer when we have access to parent block height
318+ Some ( parent_ptr ) ,
332319 ) )
333320 }
334321
@@ -343,42 +330,34 @@ impl FirehoseMapperTrait<Chain> for FirehoseMapper {
343330 }
344331}
345332
346- pub struct IngestorAdapter {
347- logger : Logger ,
348- }
333+ pub struct IngestorAdapter { }
349334
350335#[ async_trait]
351336impl IngestorAdapterTrait < Chain > for IngestorAdapter {
352337 fn logger ( & self ) -> & Logger {
353- & self . logger
338+ panic ! ( "Should never be called, FirehoseBlockIngestor must be used instead" )
354339 }
355340
356341 fn ancestor_count ( & self ) -> BlockNumber {
357- 0
342+ panic ! ( "Should never be called, FirehoseBlockIngestor must be used instead" )
358343 }
359344
360345 async fn latest_block ( & self ) -> Result < BlockPtr , IngestorError > {
361- Ok ( BlockPtr {
362- hash : BlockHash :: from ( vec ! [ 0xff ; 32 ] ) ,
363- number : 0 ,
364- } )
346+ panic ! ( "Should never be called, FirehoseBlockIngestor must be used instead" )
365347 }
366348
367349 async fn ingest_block (
368350 & self ,
369351 _block_hash : & BlockHash ,
370352 ) -> Result < Option < BlockHash > , IngestorError > {
371- // FIXME (NEAR): Might not be necessary for NEAR support for now
372- Ok ( None )
353+ panic ! ( "Should never be called, FirehoseBlockIngestor must be used instead" )
373354 }
374355
375356 fn chain_head_ptr ( & self ) -> Result < Option < BlockPtr > , Error > {
376- // FIXME (NEAR): Might not be necessary for NEAR support for now
377- Ok ( None )
357+ panic ! ( "Should never be called, FirehoseBlockIngestor must be used instead" )
378358 }
379359
380360 fn cleanup_cached_blocks ( & self ) -> Result < Option < ( i32 , usize ) > , Error > {
381- // FIXME (NEAR): Might not be necessary for NEAR support for now
382- Ok ( None )
361+ panic ! ( "Should never be called, FirehoseBlockIngestor must be used instead" )
383362 }
384363}
0 commit comments