From d59d500f8033252ee806a5d613e55c6cfebd881e Mon Sep 17 00:00:00 2001 From: Andrius Dagys Date: Mon, 11 Mar 2024 19:42:58 +0200 Subject: [PATCH] DataManager: skip unparasable commits and reveals --- libs/ftso-core/src/DataManager.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/libs/ftso-core/src/DataManager.ts b/libs/ftso-core/src/DataManager.ts index 22801b42..6dcac783 100644 --- a/libs/ftso-core/src/DataManager.ts +++ b/libs/ftso-core/src/DataManager.ts @@ -626,8 +626,12 @@ export class DataManager { message.protocolId === FTSO2_PROTOCOL_ID && message.votingRoundId === submission.votingEpochIdFromTimestamp ) { - const commit = CommitData.decode(message.payload); - voterToLastCommit.set(submission.submitAddress, commit); + try { + const commit = CommitData.decode(message.payload); + voterToLastCommit.set(submission.submitAddress, commit); + } catch (e) { + this.logger.warn(`Unparsable commit message: ${message.payload}, error: ${errorString(e)}`); + } } } } @@ -654,8 +658,12 @@ export class DataManager { message.protocolId === FTSO2_PROTOCOL_ID && message.votingRoundId + 1 === submission.votingEpochIdFromTimestamp ) { - const reveal = RevealData.decode(message.payload, feedOrder); - voterToLastReveal.set(submission.submitAddress, reveal); + try { + const reveal = RevealData.decode(message.payload, feedOrder); + voterToLastReveal.set(submission.submitAddress, reveal); + } catch (e) { + this.logger.warn(`Unparsable reveal message: ${message.payload}, error: ${errorString(e)}`); + } } } }