diff --git a/packages/relay/src/lib/clients/mirrorNodeClient.ts b/packages/relay/src/lib/clients/mirrorNodeClient.ts index acb24cf76..840a81d3c 100644 --- a/packages/relay/src/lib/clients/mirrorNodeClient.ts +++ b/packages/relay/src/lib/clients/mirrorNodeClient.ts @@ -18,22 +18,22 @@ * */ +import { ConfigService } from '@hashgraph/json-rpc-config-service/dist/services'; +import Axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'; +import axiosRetry from 'axios-retry'; +import { install as betterLookupInstall } from 'better-lookup'; +import { ethers } from 'ethers'; import http from 'http'; import https from 'https'; import { Logger } from 'pino'; -import { ethers } from 'ethers'; -import axiosRetry from 'axios-retry'; -import constants from './../constants'; import { Histogram, Registry } from 'prom-client'; + +import { formatRequestIdMessage, formatTransactionId, parseNumericEnvVar } from '../../formatters'; import { predefined } from '../errors/JsonRpcError'; +import { MirrorNodeClientError } from '../errors/MirrorNodeClientError'; import { SDKClientError } from '../errors/SDKClientError'; -import { IOpcodesResponse } from './models/IOpcodesResponse'; -import { install as betterLookupInstall } from 'better-lookup'; +import { EthImpl } from '../eth'; import { CacheService } from '../services/cacheService/cacheService'; -import { ConfigService } from '@hashgraph/json-rpc-config-service/dist/services'; -import { MirrorNodeClientError } from '../errors/MirrorNodeClientError'; -import Axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'; -import { formatRequestIdMessage, formatTransactionId, parseNumericEnvVar } from '../../formatters'; import { IContractCallRequest, IContractCallResponse, @@ -45,7 +45,8 @@ import { MirrorNodeTransactionRecord, RequestDetails, } from '../types'; -import { EthImpl } from '../eth'; +import constants from './../constants'; +import { IOpcodesResponse } from './models/IOpcodesResponse'; type REQUEST_METHODS = 'GET' | 'POST'; @@ -1303,6 +1304,9 @@ export class MirrorNodeClient { */ public async repeatedRequest(methodName: string, args: any[], repeatCount: number, requestDetails?: RequestDetails) { let result; + const loggableArgs = [...args]; // Create a copy for logging + args.push(requestDetails); // Add requestDetails only for the method call + for (let i = 0; i < repeatCount; i++) { try { result = await this[methodName](...args); @@ -1315,7 +1319,9 @@ export class MirrorNodeClient { } else { this.logger.warn( e, - `${requestDetails?.formattedRequestId} Error raised during polling mirror node for updated records: method=${methodName}, args=${args}`, + `${requestDetails?.formattedRequestId} Error raised during polling mirror node for updated records: method=${methodName}, args=${JSON.stringify( + loggableArgs, + )}`, ); } } @@ -1327,7 +1333,7 @@ export class MirrorNodeClient { if (this.logger.isLevelEnabled('trace')) { this.logger.trace( `${requestDetails?.formattedRequestId} Repeating request ${methodName} with args ${JSON.stringify( - args, + loggableArgs, )} retry count ${i} of ${repeatCount}. Waiting ${this.MIRROR_NODE_RETRY_DELAY} ms before repeating request`, ); } @@ -1366,7 +1372,7 @@ export class MirrorNodeClient { const transactionRecords = await this.repeatedRequest( this.getTransactionById.name, - [transactionId, requestDetails, 0], + [transactionId, 0], this.MIRROR_NODE_REQUEST_RETRY_COUNT, requestDetails, );