@@ -25,6 +25,8 @@ import {
2525 VoterRegistered ,
2626 VoterRegistrationInfo ,
2727} from "./events" ;
28+ import { ILogger } from "./utils/ILogger" ;
29+ import { errorString } from "./utils/error" ;
2830
2931/**
3032 * Generic object for submission data and finalization data.
@@ -132,7 +134,11 @@ export enum BlockAssuranceResult {
132134 * the protocol data provider to function properly.
133135 */
134136export class IndexerClient {
135- constructor ( private readonly entityManager : EntityManager , public readonly requiredHistoryTimeSec : number ) { }
137+ constructor (
138+ private readonly entityManager : EntityManager ,
139+ public readonly requiredHistoryTimeSec : number ,
140+ private readonly logger : ILogger
141+ ) { }
136142
137143 private readonly encoding = EncodingUtils . instance ;
138144
@@ -477,20 +483,26 @@ export class IndexerClient {
477483 } ;
478484 }
479485 const transactionsResults = await this . queryTransactions ( CONTRACTS . Submission , functionName , startTime , endTime ) ;
480- const submits : SubmissionData [ ] = transactionsResults . map ( tx => {
481- const timestamp = tx . timestamp ;
482- const votingEpochId = EPOCH_SETTINGS . votingEpochForTimeSec ( timestamp ) ;
483- const messages = decodePayloadMessageCalldata ( tx ) ;
484- return {
485- submitAddress : "0x" + tx . from_address ,
486- relativeTimestamp : timestamp - EPOCH_SETTINGS . votingEpochStartSec ( votingEpochId ) ,
487- votingEpochIdFromTimestamp : votingEpochId ,
488- transactionIndex : tx . transaction_index ,
489- timestamp,
490- blockNumber : tx . block_number ,
491- messages,
492- } ;
493- } ) ;
486+
487+ const submits : SubmissionData [ ] = [ ] ;
488+ for ( const tx of transactionsResults ) {
489+ try {
490+ const timestamp = tx . timestamp ;
491+ const votingEpochId = EPOCH_SETTINGS . votingEpochForTimeSec ( timestamp ) ;
492+ const messages = decodePayloadMessageCalldata ( tx ) ;
493+ submits . push ( {
494+ submitAddress : "0x" + tx . from_address ,
495+ relativeTimestamp : timestamp - EPOCH_SETTINGS . votingEpochStartSec ( votingEpochId ) ,
496+ votingEpochIdFromTimestamp : votingEpochId ,
497+ transactionIndex : tx . transaction_index ,
498+ timestamp,
499+ blockNumber : tx . block_number ,
500+ messages,
501+ } ) ;
502+ } catch ( e ) {
503+ this . logger . warn ( `Error processing submission transaction ${ tx . hash } , will ignore: ${ errorString ( e ) } ` ) ;
504+ }
505+ }
494506
495507 return {
496508 status : ensureRange ,
0 commit comments