Skip to content

Commit

Permalink
chore: added a debug level log to expose contract call response for e…
Browse files Browse the repository at this point in the history
…th_call requests (#2441) (#2442)

chore: added a debug level log to expose contract call response for eth_call requests

Signed-off-by: Logan Nguyen <[email protected]>
  • Loading branch information
quiet-node authored May 2, 2024
1 parent 9fb587f commit bce8278
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/relay/src/lib/eth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1564,6 +1564,7 @@ export class EthImpl implements Eth {

this.contractCallFormat(call);

let result: string | JsonRpcError = '';
try {
// ETH_CALL_DEFAULT_TO_CONSENSUS_NODE = false enables the use of Mirror node
if (
Expand All @@ -1572,10 +1573,14 @@ export class EthImpl implements Eth {
) {
//temporary workaround until precompiles are implemented in Mirror node evm module
// Execute the call and get the response
return await this.callMirrorNode(call, gas, call.value, blockNumberOrTag, requestIdPrefix);
result = await this.callMirrorNode(call, gas, call.value, blockNumberOrTag, requestIdPrefix);
} else {
result = await this.callConsensusNode(call, gas, requestIdPrefix);
}

return await this.callConsensusNode(call, gas, requestIdPrefix);
this.logger.debug(`${requestIdPrefix} eth_call response: ${JSON.stringify(result)}`);

return result;
} catch (e: any) {
this.logger.error(e, `${requestIdPrefix} Failed to successfully submit eth_call`);
if (e instanceof JsonRpcError) {
Expand Down Expand Up @@ -1675,7 +1680,7 @@ export class EthImpl implements Eth {
let callData: any = {};
try {
this.logger.debug(
`${requestIdPrefix} Making eth_call on contract ${call.to} with gas ${gas} and call data "${call.data}" from "${call.from}" using mirror-node. for blockBlockNumberOrTag: "${block}"`,
`${requestIdPrefix} Making eth_call on contract ${call.to} with gas ${gas} and call data "${call.data}" from "${call.from}" at blockBlockNumberOrTag: "${block}" using mirror-node.`,
call.to,
gas,
call.data,
Expand Down

0 comments on commit bce8278

Please sign in to comment.