@@ -474,7 +474,7 @@ impl RuntimeHostTrait for RuntimeHost {
474
474
async fn process_call (
475
475
& self ,
476
476
logger : & Logger ,
477
- block : & Arc < LightEthereumBlock > ,
477
+ block : & Arc < EthereumBlockType > ,
478
478
transaction : & Arc < Transaction > ,
479
479
call : & Arc < EthereumCall > ,
480
480
state : BlockState ,
@@ -561,7 +561,7 @@ impl RuntimeHostTrait for RuntimeHost {
561
561
outputs,
562
562
handler : call_handler. clone ( ) ,
563
563
} ,
564
- & Arc :: new ( EthereumBlockType :: Light ( LightEthereumBlock :: from ( block. as_ref ( ) . clone ( ) ) ) ) ,
564
+ block,
565
565
proof_of_indexing,
566
566
)
567
567
. await
@@ -570,37 +570,41 @@ impl RuntimeHostTrait for RuntimeHost {
570
570
async fn process_block (
571
571
& self ,
572
572
logger : & Logger ,
573
- block : & Arc < LightEthereumBlock > ,
573
+ block : & Arc < EthereumBlockType > ,
574
574
trigger_type : & EthereumBlockTriggerType ,
575
575
state : BlockState ,
576
576
proof_of_indexing : SharedProofOfIndexing ,
577
577
) -> Result < BlockState , anyhow:: Error > {
578
578
let block_handler = self . handler_for_block ( trigger_type) ?;
579
579
let mapping_block: EthereumBlockType = match trigger_type {
580
- EthereumBlockTriggerType :: Every ( BlockType :: FullWithReceipts ) => match graph:: block_on_allow_panic (
581
- future:: lazy ( move || {
582
- self . host_exports
583
- . ethereum_adapter
584
- . load_full_block ( logger, block. as_ref ( ) . clone ( ) )
585
- } )
586
- . compat ( ) ,
587
- ) {
588
- Ok ( block) => Ok ( EthereumBlockType :: FullWithReceipts ( block) ) ,
589
- Err ( e) => Err ( anyhow:: anyhow!(
590
- "Failed to load full block: {}, error: {}" ,
591
- & block. number. unwrap( ) . to_string( ) ,
592
- e
593
- ) ) ,
594
- } ?,
595
- EthereumBlockTriggerType :: Every ( BlockType :: Full ) => EthereumBlockType :: Full ( LightEthereumBlock :: from ( block. as_ref ( ) . clone ( ) ) ) ,
596
- _ => EthereumBlockType :: Light ( LightEthereumBlock :: from ( block. as_ref ( ) . clone ( ) ) )
580
+ EthereumBlockTriggerType :: Every ( BlockType :: FullWithReceipts ) => {
581
+ match graph:: block_on_allow_panic (
582
+ future:: lazy ( move || {
583
+ self . host_exports
584
+ . ethereum_adapter
585
+ . load_full_block ( logger, block. light_block ( ) . clone ( ) )
586
+ } )
587
+ . compat ( ) ,
588
+ ) {
589
+ Ok ( block) => Ok ( EthereumBlockType :: FullWithReceipts ( block) ) ,
590
+ Err ( e) => Err ( anyhow:: anyhow!(
591
+ "Failed to load full block: {}, error: {}" ,
592
+ & block. number( ) . to_string( ) ,
593
+ e
594
+ ) ) ,
595
+ } ?
596
+ }
597
+ EthereumBlockTriggerType :: Every ( BlockType :: Full ) => {
598
+ EthereumBlockType :: Full ( block. light_block ( ) . clone ( ) )
599
+ }
600
+ _ => block. as_ref ( ) . clone ( ) ,
597
601
} ;
598
602
599
603
self . send_mapping_request (
600
604
logger,
601
605
o ! {
602
- "hash" => block. hash. unwrap ( ) . to_string( ) ,
603
- "number" => & block. number. unwrap ( ) . to_string( ) ,
606
+ "hash" => block. hash( ) . to_string( ) ,
607
+ "number" => & block. number( ) . to_string( ) ,
604
608
} ,
605
609
state,
606
610
& block_handler. handler ,
@@ -616,7 +620,7 @@ impl RuntimeHostTrait for RuntimeHost {
616
620
async fn process_log (
617
621
& self ,
618
622
logger : & Logger ,
619
- block : & Arc < LightEthereumBlock > ,
623
+ block : & Arc < EthereumBlockType > ,
620
624
transaction : & Arc < Transaction > ,
621
625
log : & Arc < Log > ,
622
626
state : BlockState ,
@@ -721,7 +725,7 @@ impl RuntimeHostTrait for RuntimeHost {
721
725
params,
722
726
handler : event_handler. clone ( ) ,
723
727
} ,
724
- & Arc :: new ( EthereumBlockType :: Light ( block. as_ref ( ) ) ) ) ,
728
+ block,
725
729
proof_of_indexing,
726
730
)
727
731
. await
0 commit comments