Skip to content

Commit

Permalink
added some logs
Browse files Browse the repository at this point in the history
  • Loading branch information
AnastasiyaTarasova committed Nov 29, 2024
1 parent 2650b23 commit c508137
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
15 changes: 14 additions & 1 deletion common/neon_rpc/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,11 @@ async def emulate_neon_call(
sol_account_dict=emul_sol_acct_dict,
slot=self._get_slot(block),
)
_LOG.info("emulate_neon_call, req = %+v", req)

resp: EmulNeonCallResp = await self._send_request("emulate", req, EmulNeonCallResp)
_LOG.info("emulate_neon_call, resp = %v", resp)

if check_result:
self._check_emulator_result(resp)
return resp
Expand Down Expand Up @@ -309,6 +313,8 @@ async def _send_request(
method=method,
)

_LOG.info("_send_request, request = %v", request)

with request:
for retry in itertools.count():
if retry >= self._max_retry_cnt:
Expand All @@ -318,8 +324,10 @@ async def _send_request(

request.start_timer()
resp_json = await self._send_client_request(request, path=HttpURL(method))
_LOG.info("_send_request, resp_json = %v", resp_json)
try:
resp = CoreApiResp.from_json(resp_json)
_LOG.info("_send_request, CoreApiResp.from_json resp.value = %v", resp.value)

except PydanticValidationError as exc:
_LOG.debug("bad response from neon-core-api", exc_info=exc, extra=self._msg_filter)
Expand All @@ -337,7 +345,12 @@ async def _send_request(
elif resp.error:
raise EthError(resp.error)

return resp_type.from_dict(resp.value)
_LOG.info("_send_request, resp.value = %v", resp.value)

_LOG.info("_send_request, resp_type = %v", resp_type)
result = resp_type.from_dict(resp.value)
_LOG.info("_send_request, resp_type.from_dict(resp.value) = %v", result)
return result

@ttl_cached_method(ttl_sec=60)
async def _get_evm_exec_addr(self) -> SolPubKey:
Expand Down
6 changes: 6 additions & 0 deletions proxy/rpc/np_call_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
from .server_abc import NeonProxyApi
from ..base.rpc_api import RpcEthTxRequest
from ..base.rpc_gas_limit_calculator import RpcNeonGasLimitCalculator
import logging

_LOG = logging.getLogger(__name__)

class _RpcEthAccountModel(BaseJsonRpcModel):
nonce: HexUIntField = Field(0)
Expand Down Expand Up @@ -109,14 +111,18 @@ async def eth_call(
) -> EthBinStrField:
_ = object_state
chain_id = self._get_tx_chain_id(ctx, tx)
_LOG.info("eth_call, chain_id = %d", chain_id)
block = await self.get_block_by_tag(block_tag)
_LOG.info("eth_call, block.slot = %d", block.slot)
evm_cfg = await self._get_evm_cfg()
resp = await self._core_api_client.emulate_neon_call(
evm_cfg,
tx.to_core_tx(chain_id),
check_result=True,
block=block,
)
_LOG.info("eth_call, resp.result = %d", resp.result)
_LOG.info("eth_call, resp.result = %d", resp.result)
return resp.result

@NeonProxyApi.method(name="eth_estimateGas")
Expand Down

0 comments on commit c508137

Please sign in to comment.