Skip to content

Commit cd5b950

Browse files
committed
added logging
1 parent 1ac4c04 commit cd5b950

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/ethereum_test_rpc/rpc.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""JSON-RPC methods and helper functions for EEST consume based hive simulators."""
22

3+
import json
34
import time
45
from itertools import count
56
from pprint import pprint
@@ -11,6 +12,7 @@
1112

1213
from ethereum_test_base_types import Address, Bytes, Hash, to_json
1314
from ethereum_test_types import Transaction
15+
from pytest_plugins.logging import get_logger
1416

1517
from .types import (
1618
ForkchoiceState,
@@ -24,6 +26,7 @@
2426
)
2527

2628
BlockNumberType = Union[int, Literal["latest", "earliest", "pending"]]
29+
logger = get_logger(__name__)
2730

2831

2932
class SendTransactionExceptionError(Exception):
@@ -94,6 +97,11 @@ def post_request(self, method: str, *params: Any, extra_headers: Dict | None = N
9497
}
9598
headers = base_header | self.extra_headers | extra_headers
9699

100+
# debugging, estimate payload size
101+
payload_json = json.dumps(payload) # pydantic.json
102+
payload_size_mb = len(payload_json.encode("utf-8")) / (1024 * 1024)
103+
logger.info(f"I am about to send an RPC of approximated size: {payload_size_mb:.2f} MB")
104+
97105
response = requests.post(self.url, json=payload, headers=headers)
98106
response.raise_for_status()
99107
response_json = response.json()
@@ -181,8 +189,9 @@ def gas_price(self) -> int:
181189
def send_raw_transaction(self, transaction_rlp: Bytes) -> Hash:
182190
"""`eth_sendRawTransaction`: Send a transaction to the client."""
183191
try:
184-
result_hash = Hash(self.post_request("sendRawTransaction", f"{transaction_rlp.hex()}"))
185-
assert result_hash is not None
192+
tx_rlp_hex = transaction_rlp.hex()
193+
result_hash = Hash(self.post_request("sendRawTransaction", f"{tx_rlp_hex}"))
194+
assert result_hash is not None, "result_hash seems to be None, critical error!"
186195
return result_hash
187196
except Exception as e:
188197
shortened_rlp_error_message = str(e) # signal in console that you don't see full rlp

tests/osaka/eip7594_peerdas/test_get_blobs.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,15 @@
1818
Transaction,
1919
TransactionException,
2020
)
21+
from pytest_plugins.logging import get_logger
2122

2223
from .spec import ref_spec_7594
2324

2425
REFERENCE_SPEC_GIT_PATH = ref_spec_7594.git_path
2526
REFERENCE_SPEC_VERSION = ref_spec_7594.version
2627

28+
logger = get_logger(__name__)
29+
2730

2831
@pytest.fixture
2932
def destination_account(pre: Alloc) -> Address:
@@ -197,6 +200,8 @@ def generate_full_blob_tests(
197200
parametrized for each different fork.
198201
"""
199202
max_blobs = fork.max_blobs_per_block()
203+
logger.info(f"MAX_BLOBS value for fork {fork}: {max_blobs}")
204+
200205
return [
201206
pytest.param(
202207
[ # Txs

0 commit comments

Comments
 (0)