@@ -188,6 +188,7 @@ def post_request(
188188 "RPC response didn't contain a result field"
189189 )
190190 result = response_json ["result" ]
191+ logger .info (f"RPC Result: { result } " )
191192 return result
192193
193194
@@ -239,6 +240,7 @@ def config(self, timeout: int | None = None) -> EthConfigResponse | None:
239240 client.
240241 """
241242 try :
243+ logger .info ("Requesting eth_config.." )
242244 response = self .post_request (method = "config" , timeout = timeout )
243245 if response is None :
244246 logger .warning ("eth_config request: failed to get response" )
@@ -257,6 +259,7 @@ def config(self, timeout: int | None = None) -> EthConfigResponse | None:
257259
258260 def chain_id (self ) -> int :
259261 """`eth_chainId`: Returns the current chain id."""
262+ logger .info ("Requesting chainid of provided RPC endpoint.." )
260263 response = self .post_request (method = "chainId" , timeout = 10 )
261264 return int (response , 16 )
262265
@@ -272,6 +275,7 @@ def get_block_by_number(
272275 if isinstance (block_number , int )
273276 else block_number
274277 )
278+ logger .info (f"Requesting info about block { block } .." )
275279 params = [block , full_txs ]
276280 response = self .post_request (method = "getBlockByNumber" , params = params )
277281 return response
@@ -280,6 +284,7 @@ def get_block_by_hash(
280284 self , block_hash : Hash , full_txs : bool = True
281285 ) -> Any | None :
282286 """`eth_getBlockByHash`: Returns information about a block by hash."""
287+ logger .info (f"Requesting block info of { block_hash } .." )
283288 params = [f"{ block_hash } " , full_txs ]
284289 response = self .post_request (method = "getBlockByHash" , params = params )
285290 return response
@@ -295,6 +300,7 @@ def get_balance(
295300 if isinstance (block_number , int )
296301 else block_number
297302 )
303+ logger .info (f"Requesting balance of { address } at block { block } " )
298304 params = [f"{ address } " , block ]
299305 response = self .post_request (method = "getBalance" , params = params )
300306 return int (response , 16 )
@@ -308,6 +314,7 @@ def get_code(
308314 if isinstance (block_number , int )
309315 else block_number
310316 )
317+ logger .info (f"Requesting code of { address } at block { block } " )
311318 params = [f"{ address } " , block ]
312319 response = self .post_request (method = "getCode" , params = params )
313320 return Bytes (response )
@@ -324,6 +331,7 @@ def get_transaction_count(
324331 if isinstance (block_number , int )
325332 else block_number
326333 )
334+ logger .info (f"Requesting nonce of { address } " )
327335 params = [f"{ address } " , block ]
328336 response = self .post_request (
329337 method = "getTransactionCount" , params = params
@@ -335,6 +343,7 @@ def get_transaction_by_hash(
335343 ) -> TransactionByHashResponse | None :
336344 """`eth_getTransactionByHash`: Returns transaction details."""
337345 try :
346+ logger .info (f"Requesting tx details of { transaction_hash } " )
338347 response = self .post_request (
339348 method = "getTransactionByHash" , params = [f"{ transaction_hash } " ]
340349 )
@@ -356,6 +365,7 @@ def get_transaction_receipt(
356365 Used to get the actual gas used by a transaction for gas validation
357366 in benchmark tests.
358367 """
368+ logger .info (f"Requesting tx receipt of { transaction_hash } " )
359369 response = self .post_request (
360370 method = "getTransactionReceipt" , params = [f"{ transaction_hash } " ]
361371 )
@@ -376,15 +386,19 @@ def get_storage_at(
376386 if isinstance (block_number , int )
377387 else block_number
378388 )
389+ logger .info (
390+ f"Requesting storage value mapped to key { position } "
391+ f"of contract { address } "
392+ )
379393 params = [f"{ address } " , f"{ position } " , block ]
380394 response = self .post_request (method = "getStorageAt" , params = params )
381395 return Hash (response )
382396
383397 def gas_price (self ) -> int :
384398 """
385- `eth_gasPrice`: Returns the number of transactions sent from an
386- address.
399+ `eth_gasPrice`: Returns the gas price.
387400 """
401+ logger .info ("Requesting gas price" )
388402 response = self .post_request (method = "gasPrice" )
389403 return int (response , 16 )
390404
@@ -393,6 +407,7 @@ def send_raw_transaction(
393407 ) -> Hash :
394408 """`eth_sendRawTransaction`: Send a transaction to the client."""
395409 try :
410+ logger .info ("Sending raw tx.." )
396411 response = self .post_request (
397412 method = "sendRawTransaction" ,
398413 params = [transaction_rlp .hex ()],
@@ -402,6 +417,7 @@ def send_raw_transaction(
402417 assert result_hash is not None
403418 return result_hash
404419 except Exception as e :
420+ logger .error (e )
405421 raise SendTransactionExceptionError (
406422 str (e ), tx_rlp = transaction_rlp
407423 ) from e
@@ -410,6 +426,7 @@ def send_transaction(self, transaction: Transaction) -> Hash:
410426 """`eth_sendRawTransaction`: Send a transaction to the client."""
411427 # TODO: is this a copypaste error from above?
412428 try :
429+ logger .info ("Sending tx.." )
413430 response = self .post_request (
414431 method = "sendRawTransaction" ,
415432 params = [transaction .rlp ().hex ()],
@@ -455,6 +472,7 @@ def wait_for_transaction(
455472 tx_hash = transaction .hash
456473 start_time = time .time ()
457474 while True :
475+ logger .info (f"Waiting for inclusion of tx { tx_hash } in a block.." )
458476 tx = self .get_transaction_by_hash (tx_hash )
459477 if tx is not None and tx .block_number is not None :
460478 return tx
@@ -476,13 +494,17 @@ def wait_for_transactions(
476494 tx_hashes = [tx .hash for tx in transactions ]
477495 responses : List [TransactionByHashResponse ] = []
478496 start_time = time .time ()
497+ logger .info ("Waiting for all transaction to be included in a block.." )
479498 while True :
480499 i = 0
481500 while i < len (tx_hashes ):
482501 tx_hash = tx_hashes [i ]
483502 tx = self .get_transaction_by_hash (tx_hash )
484503 if tx is not None and tx .block_number is not None :
485504 responses .append (tx )
505+ logger .info (
506+ f"Tx { tx } was included in block { tx .block_number } "
507+ )
486508 tx_hashes .pop (i )
487509 else :
488510 i += 1
0 commit comments