@@ -1036,13 +1036,26 @@ impl TriggersAdapterTrait<Chain> for TriggersAdapter {
10361036 offset : BlockNumber ,
10371037 root : Option < BlockHash > ,
10381038 ) -> Result < Option < BlockFinality > , Error > {
1039+ let ptr_for_log = ptr. clone ( ) ;
10391040 let block: Option < EthereumBlock > = self
10401041 . chain_store
10411042 . cheap_clone ( )
10421043 . ancestor_block ( ptr, offset, root)
10431044 . await ?
1044- . map ( |x| x. 0 )
1045- . map ( json:: from_value)
1045+ . map ( |( json_value, block_ptr) | {
1046+ json:: from_value ( json_value. clone ( ) ) . map_err ( |e| {
1047+ warn ! (
1048+ self . logger,
1049+ "Failed to deserialize cached ancestor block {} (offset {} from {}): {}. \
1050+ This may indicate stale cache data from a previous version.",
1051+ block_ptr. hash_hex( ) ,
1052+ offset,
1053+ ptr_for_log. hash_hex( ) ,
1054+ e
1055+ ) ;
1056+ e
1057+ } )
1058+ } )
10461059 . transpose ( ) ?;
10471060 Ok ( block. map ( |block| {
10481061 BlockFinality :: NonFinal ( EthereumBlockWithCalls {
@@ -1060,9 +1073,21 @@ impl TriggersAdapterTrait<Chain> for TriggersAdapter {
10601073 let chain_store = self . chain_store . cheap_clone ( ) ;
10611074 // First try to get the block from the store
10621075 if let Ok ( blocks) = chain_store. blocks ( vec ! [ block. hash. clone( ) ] ) . await {
1063- if let Some ( block) = blocks. first ( ) {
1064- if let Ok ( block) = json:: from_value :: < LightEthereumBlock > ( block. clone ( ) ) {
1065- return Ok ( block. parent_ptr ( ) ) ;
1076+ if let Some ( cached_json) = blocks. first ( ) {
1077+ match json:: from_value :: < LightEthereumBlock > ( cached_json. clone ( ) ) {
1078+ Ok ( block) => {
1079+ return Ok ( block. parent_ptr ( ) ) ;
1080+ }
1081+ Err ( e) => {
1082+ warn ! (
1083+ self . logger,
1084+ "Failed to deserialize cached block {}: {}. \
1085+ This may indicate stale cache data from a previous version. \
1086+ Falling back to Firehose.",
1087+ block. hash_hex( ) ,
1088+ e
1089+ ) ;
1090+ }
10661091 }
10671092 }
10681093 }
0 commit comments