@@ -15,7 +15,6 @@ use graph::{
15
15
} ,
16
16
components:: store:: DeploymentLocator ,
17
17
firehose:: { self as firehose, ForkStep } ,
18
- log:: factory:: { ComponentLoggerConfig , ElasticComponentLoggerConfig } ,
19
18
prelude:: { async_trait, o, BlockNumber , ChainStore , Error , Logger , LoggerFactory } ,
20
19
} ;
21
20
use prost:: Message ;
@@ -154,20 +153,7 @@ impl Blockchain for Chain {
154
153
}
155
154
156
155
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 { } )
171
157
}
172
158
173
159
fn chain_store ( & self ) -> Arc < dyn ChainStore > {
@@ -298,6 +284,7 @@ impl FirehoseMapperTrait<Chain> for FirehoseMapper {
298
284
response. step
299
285
)
300
286
} ) ;
287
+
301
288
let any_block = response
302
289
. block
303
290
. as_ref ( )
@@ -321,14 +308,14 @@ impl FirehoseMapperTrait<Chain> for FirehoseMapper {
321
308
322
309
StepUndo => {
323
310
let header = block. header ( ) ;
311
+ let parent_ptr = header
312
+ . parent_ptr ( )
313
+ . expect ( "Genesis block should never be reverted" ) ;
324
314
325
315
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 ( ) ,
330
317
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 ) ,
332
319
) )
333
320
}
334
321
@@ -343,42 +330,34 @@ impl FirehoseMapperTrait<Chain> for FirehoseMapper {
343
330
}
344
331
}
345
332
346
- pub struct IngestorAdapter {
347
- logger : Logger ,
348
- }
333
+ pub struct IngestorAdapter { }
349
334
350
335
#[ async_trait]
351
336
impl IngestorAdapterTrait < Chain > for IngestorAdapter {
352
337
fn logger ( & self ) -> & Logger {
353
- & self . logger
338
+ panic ! ( "Should never be called, FirehoseBlockIngestor must be used instead" )
354
339
}
355
340
356
341
fn ancestor_count ( & self ) -> BlockNumber {
357
- 0
342
+ panic ! ( "Should never be called, FirehoseBlockIngestor must be used instead" )
358
343
}
359
344
360
345
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" )
365
347
}
366
348
367
349
async fn ingest_block (
368
350
& self ,
369
351
_block_hash : & BlockHash ,
370
352
) -> 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" )
373
354
}
374
355
375
356
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" )
378
358
}
379
359
380
360
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" )
383
362
}
384
363
}
0 commit comments