diff --git a/src/customer-server-client.ts b/src/customer-server-client.ts index c34ba64..50dbbcd 100644 --- a/src/customer-server-client.ts +++ b/src/customer-server-client.ts @@ -12,12 +12,12 @@ class CustomerClient { logger.info(`Pulling messages status for ${JSON.stringify(requestsIds)}`); const { statuses: serverStatuses } = await customerServerApi.messagesStatus({ requestsIds }); if (!!serverStatuses.length) { - logger.info(`Got messages status for ${JSON.stringify(serverStatuses.map((status) => { return { requestId: status.requestId, status: status.status } }))}`); + logger.info(`Got messages status from customer server for ${JSON.stringify(serverStatuses.map((status) => { return { requestId: status.requestId, status: status.status } }))}`); await messagesService.updateStatus(serverStatuses.map((messagesStatus): ExtendedMessageStatusCache => { const decodedMsg = messages.find((msg) => msg.messageStatus.requestId === messagesStatus.requestId); if (!decodedMsg) { - logger.error(`Message with requestId ${messagesStatus.requestId} not found in cache`); + logger.error(`Message with requestId ${messagesStatus.requestId} not in pending cache messages`); return null; } diff --git a/src/services/fireblocks-agent.ts b/src/services/fireblocks-agent.ts index 4ebe90a..86a1f7b 100644 --- a/src/services/fireblocks-agent.ts +++ b/src/services/fireblocks-agent.ts @@ -42,9 +42,9 @@ class FireblocksAgentImpl implements FireblocksAgent { _runLoopStep = async () => { const start = Date.now(); - logger.info(`Waiting for a message`); + logger.info(`Waiting for a messages from Fireblocks...`); const messages = await fbServerApi.getMessages(); - logger.info(`Got ${messages.length} messages after ${Date.now() - start}ms`); + logger.info(`Got ${messages.length} messages from Fireblocks after ${Date.now() - start}ms`); await messageService.handleMessages(messages); }; } diff --git a/src/services/messages.service.ts b/src/services/messages.service.ts index e15de04..483224a 100644 --- a/src/services/messages.service.ts +++ b/src/services/messages.service.ts @@ -27,7 +27,7 @@ class MessageService implements IMessageService { try { const { msgId, request } = decodeAndVerifyMessage(messageEnvelope, certificates); const { transportMetadata } = request; - logger.info(`Got message id ${msgId} with type ${transportMetadata.type} and request id ${transportMetadata.requestId}`); + logger.info(`Got from Fireblocks message id ${msgId} with type ${transportMetadata.type} and request id ${transportMetadata.requestId}`); return { msgId, request }; } catch (e) { logger.error(`Error decoding message ${e.message}`); @@ -51,7 +51,7 @@ class MessageService implements IMessageService { }); if (!!cachedMessages.length) { - cachedMessages.forEach((msg) => logger.info(`Got cached message id ${msg.msgId} request id ${msg.request.transportMetadata.requestId}`)); + cachedMessages.forEach((msg) => logger.info(`Found cached message id ${msg.msgId} request id ${msg.request.transportMetadata.requestId}`)); const cachedMsgsStatus = cachedMessages.map((msg): ExtendedMessageStatusCache => { return { msgId: msg.msgId, @@ -66,7 +66,7 @@ class MessageService implements IMessageService { if (!!messagesToHandle.length) { const msgStatuses = await customerServerApi.messagesToSign(messagesToHandle.map((msg) => msg.request)); - logger.info(`Got messages status for ${JSON.stringify(msgStatuses.map((status) => { return { requestId: status.requestId, status: status.status } }))}`); + logger.info(`Got messages status from customer server for ${JSON.stringify(msgStatuses.map((status) => { return { requestId: status.requestId, status: status.status } }))}`); await this.updateStatus(msgStatuses.map((messageStatus): ExtendedMessageStatusCache => { const decodedMessage = messagesToHandle.find((msg) => msg.request.transportMetadata.requestId === messageStatus.requestId); if (!decodedMessage) { @@ -83,7 +83,7 @@ class MessageService implements IMessageService { } if (!!unknownMessages.length) { - unknownMessages.forEach((msg) => logger.error(`Got unknown message type ${msg.request.transportMetadata.type} and id ${msg.msgId}`)); + unknownMessages.forEach((msg) => logger.error(`Got unknown message from Fireblocks type ${msg.request.transportMetadata.type} and id ${msg.msgId}`)); await this.ackMessages(unknownMessages.map((msg) => msg.msgId)); } } @@ -110,13 +110,13 @@ class MessageService implements IMessageService { } if (status === 'SIGNED' || status === 'FAILED') { - logger.info(`Got message from customer server with status: ${status}, msgId ${msgId}, cacheId: ${requestId}`); + logger.info(`Found message with final status: ${status}, msgId ${msgId}, cacheId: ${requestId}`); await fbServerApi.broadcastResponse(messageStatus, request); await fbServerApi.ackMessage(msgId); this.msgCache[messageStatus.requestId].messageStatus = messageStatus; } } catch (e) { - throw new Error(`Error updating status to fireblocks ${e.message} for message ${msgStatus.msgId} and status ${msgStatus.messageStatus}`); + throw new Error(`Error updating status to fireblocks ${e.message} for message ${msgStatus.msgId} and status ${JSON.stringify(msgStatus.messageStatus)}`); } } }