Skip to content

Commit

Permalink
fix(rpc): More fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
marioevz committed Feb 6, 2025
1 parent 7f5aa89 commit 50436ae
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/ethereum_test_rpc/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class TransactionByHashResponse(Transaction):
block_hash: Hash | None = None
block_number: HexNumber | None = None

gas_limit: HexNumber = Field(HexNumber(21_000), alias="gas")
transaction_hash: Hash = Field(..., alias="hash")
from_address: Address = Field(..., alias="from")
to_address: Address | None = Field(..., alias="to")
Expand All @@ -47,8 +48,20 @@ def adapt_clients_response(cls, data: Any) -> Any:
if "gasPrice" in data and "maxFeePerGas" in data:
# Keep only one of the gas price fields.
del data["gasPrice"]
if "yParity" in data:
# Rename yParity to v.
data["v"] = data["yParity"]
del data["yParity"]
return data

def model_post_init(self, __context):
"""
Check that the transaction hash returned by the client matches the one calculated by
us.
"""
Transaction.model_post_init(self, __context)
assert self.transaction_hash == self.hash


class ForkchoiceState(CamelModel):
"""Represents the forkchoice state of the beacon chain."""
Expand Down

0 comments on commit 50436ae

Please sign in to comment.