Skip to content

Commit 9afe917

Browse files
committed
finalizing cleanup
1 parent a8daab2 commit 9afe917

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

src/ethereum/cancun/transactions.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
submitted to be executed. If Ethereum is viewed as a state machine,
44
transactions are the events that move between states.
55
"""
6-
76
from dataclasses import dataclass
87
from typing import Tuple, Union
98

src/ethereum/cancun/vm/__init__.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
from ethereum.crypto.hash import Hash32, keccak256
2323
from ethereum.exceptions import EthereumException
24+
from ethereum.utils.byte import right_pad_zero_bytes
2425

2526
from ..blocks import Log
2627
from ..fork_types import Address, VersionedHash
@@ -174,13 +175,24 @@ def transfer_log(
174175
transfer_amount :
175176
The amount of ETH transacted
176177
"""
177-
# TODO Hash32 implicit conversion will not work here because it doesn't
178-
# know the direction to pad.
179-
# We will need to pre-pad the Address correctly before converting,
178+
import pdb
179+
180+
breakpoint()
181+
writablelog = "".join(str(log) for log in evm.logs)
182+
with open("/tmp/txlog.log", "w") as newlog:
183+
newlog.write(writablelog)
184+
185+
# We need to pre-pad the Address correctly before converting,
180186
# otherwise it will throw because the lengths are not the same
187+
padded_sender = right_pad_zero_bytes(sender, 12)
188+
padded_recipient = right_pad_zero_bytes(recipient, 12)
181189
log_entry = Log(
182190
address=evm.message.current_target,
183-
topics=(MAGIC_LOG_KHASH, Hash32(sender), Hash32(recipient)),
191+
topics=(
192+
MAGIC_LOG_KHASH, # noqa: SC200
193+
Hash32(padded_sender),
194+
Hash32(padded_recipient),
195+
),
184196
data=transfer_amount.to_be_bytes(),
185197
)
186198

0 commit comments

Comments
 (0)