Skip to content

Commit

Permalink
Review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Art authored and Art committed Jun 1, 2024
1 parent 4690c38 commit e6fd6b9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
12 changes: 9 additions & 3 deletions src/cli/gentest.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
from typing import Dict, List, TextIO

import click
import requests

from ethereum_test_tools import Account, Address, Transaction, common
from ethereum_test_tools.rpc.rpc import EthRPC
Expand Down Expand Up @@ -344,9 +343,16 @@ def eth_get_block_by_number(self, block_number: str) -> RemoteBlock:

def debug_trace_call(self, tr: RemoteTransaction) -> Dict[Address, Account]:
"""
Get pre state required for transaction
Get pre-state required for transaction
"""
response = self.rpc.debug_trace_call(tr)
response = self.rpc.debug_trace_call(
{
"from": f"{str(tr.transaction.sender)}",
"to": f"{str(tr.transaction.to)}",
"data": f"{str(tr.transaction.data)}",
},
tr.block_number
)
if "error" in response:
raise Exception(response["error"]["message"])
assert "result" in response, "No result in response on debug_traceCall"
Expand Down
13 changes: 4 additions & 9 deletions src/ethereum_test_tools/rpc/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from typing import Any, Dict, List, Literal, Optional, Union

import requests
from cli.gentest import RequestManager
from tenacity import retry, stop_after_attempt, wait_exponential

from ethereum_test_tools import Address
Expand Down Expand Up @@ -95,7 +94,7 @@ def get_transaction_count(self, address: Address, block_number: BlockNumberType

def get_transaction_by_hash(self, transaction_hash: str):
"""
`eth_getTransactionByHash`: Returns transation details.
`eth_getTransactionByHash`: Returns transaction details.
"""
return self.post_request("eth_getTransactionByHash", [f"{transaction_hash}"])

Expand All @@ -121,17 +120,13 @@ def storage_at_keys(
results[key] = storage_value
return results

def debug_trace_call(self, tr: RequestManager.RemoteTransaction):
def debug_trace_call(self, tr: dict[str, str], block_number: str):
"""
`debug_traceCall`: Returns pre state required for transaction
"""
params = [
{
"from": f"{str(tr.transaction.sender)}",
"to": f"{str(tr.transaction.to)}",
"data": f"{str(tr.transaction.data)}",
},
f"{tr.block_number}",
tr,
block_number,
{"tracer": "prestateTracer"},
]
return self.post_request("debug_traceCall", params)

0 comments on commit e6fd6b9

Please sign in to comment.