Skip to content

Commit

Permalink
finalizing cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
codeofcarson committed Feb 3, 2025
1 parent a8daab2 commit 71cb0e0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/ethereum/cancun/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
submitted to be executed. If Ethereum is viewed as a state machine,
transactions are the events that move between states.
"""

from dataclasses import dataclass
from typing import Tuple, Union

Expand Down
13 changes: 9 additions & 4 deletions src/ethereum/cancun/vm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from ethereum.crypto.hash import Hash32, keccak256
from ethereum.exceptions import EthereumException
from ethereum.utils.byte import right_pad_zero_bytes

from ..blocks import Log
from ..fork_types import Address, VersionedHash
Expand Down Expand Up @@ -174,13 +175,17 @@ def transfer_log(
transfer_amount :
The amount of ETH transacted
"""
# TODO Hash32 implicit conversion will not work here because it doesn't
# know the direction to pad.
# We will need to pre-pad the Address correctly before converting,
# We need to pre-pad the Address correctly before converting,
# otherwise it will throw because the lengths are not the same
padded_sender = right_pad_zero_bytes(sender, 12)
padded_recipient = right_pad_zero_bytes(recipient, 12)
log_entry = Log(
address=evm.message.current_target,
topics=(MAGIC_LOG_KHASH, Hash32(sender), Hash32(recipient)),
topics=(
MAGIC_LOG_KHASH, # noqa: SC200
Hash32(padded_sender),
Hash32(padded_recipient),
),
data=transfer_amount.to_be_bytes(),
)

Expand Down
2 changes: 1 addition & 1 deletion src/ethereum/cancun/vm/instructions/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"""
from functools import partial

from ethereum_types.numeric import U256, Uint
from ethereum_types.numeric import Uint

from ...blocks import Log
from .. import Evm
Expand Down

0 comments on commit 71cb0e0

Please sign in to comment.