Skip to content

Commit 07cdd62

Browse files
lukelee-slebadiereAlfredoG87
authored
Cherry pick 966 964 (#970)
* 993-Request-ID-is-missing-from-some-mirror-node-relay-logs. This was… (#964) 993-Request-ID-is-missing-from-some-mirror-node-relay-logs. This was resolved by adding the requestId to the getAccount call in the eth_estimateGas call to the mirror node client. Signed-off-by: ebadiere <[email protected]> * Enhance logs when calling eth_sendRawTransaction to include from and … (#966) * Enhance logs when calling eth_sendRawTransaction to include from and to fields besides the raw transaction Signed-off-by: Alfredo Gutierrez <[email protected]> --------- Signed-off-by: ebadiere <[email protected]> Signed-off-by: Alfredo Gutierrez <[email protected]> Co-authored-by: Eric Badiere <[email protected]> Co-authored-by: Alfredo Gutierrez <[email protected]>
1 parent 56fde12 commit 07cdd62

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/relay/src/lib/eth.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ export class EthImpl implements Eth {
335335
const accountCacheKey = `account_${transaction.to}`;
336336
let toAccount: object | null = this.cache.get(accountCacheKey);
337337
if (!toAccount) {
338-
toAccount = await this.mirrorNodeClient.getAccount(transaction.to);
338+
toAccount = await this.mirrorNodeClient.getAccount(transaction.to, requestId);
339339
}
340340

341341
// when account exists return default base gas, otherwise return the minimum amount of gas to create an account entity
@@ -916,13 +916,17 @@ export class EthImpl implements Eth {
916916
async sendRawTransaction(transaction: string, requestId?: string): Promise<string | JsonRpcError> {
917917
const requestIdPrefix = formatRequestIdMessage(requestId);
918918
let interactingEntity = '';
919-
this.logger.trace(`${requestIdPrefix} sendRawTransaction(transaction=${transaction})`);
919+
let originatingAddress = '';
920920
try {
921921
const parsedTx = Precheck.parseTxIfNeeded(transaction);
922922
interactingEntity = parsedTx.to ? parsedTx.to.toString() : '';
923+
originatingAddress = parsedTx.from ? parsedTx.from.toString() : '';
924+
this.logger.trace(`${requestIdPrefix} sendRawTransaction(from=${originatingAddress}, to=${interactingEntity}, transaction=${transaction})`);
925+
923926
const gasPrice = Number(await this.gasPrice(requestId));
924927
await this.precheck.sendRawTransactionCheck(parsedTx, gasPrice, requestId);
925928
} catch (e: any) {
929+
this.logger.warn(`${requestIdPrefix} Error on precheck sendRawTransaction(from=${originatingAddress}, to=${interactingEntity}, transaction=${transaction})`);
926930
throw this.genericErrorHandler(e);
927931
}
928932

0 commit comments

Comments
 (0)