Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/ethereum/forks/amsterdam/state_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from ethereum_types.numeric import U256, Uint

from ethereum.crypto.hash import Hash32, keccak256
from ethereum.exceptions import InvalidBlock
from ethereum.state import (
EMPTY_ACCOUNT,
EMPTY_CODE_HASH,
Expand Down Expand Up @@ -562,7 +563,7 @@ def reduce_sender_balance(sender: Account) -> None:
sender.balance -= amount

def increase_recipient_balance(recipient: Account) -> None:
recipient.balance += amount
recipient.balance = recipient.balance.wrapping_add(amount)

modify_state(tx_state, sender_address, reduce_sender_balance)
modify_state(tx_state, recipient_address, increase_recipient_balance)
Expand All @@ -586,6 +587,8 @@ def create_ether(
"""

def increase_balance(account: Account) -> None:
if Uint(account.balance) + Uint(amount) > Uint(U256.MAX_VALUE):
raise InvalidBlock("account balance overflow")
account.balance += amount

modify_state(tx_state, address, increase_balance)
Expand Down
5 changes: 4 additions & 1 deletion src/ethereum/forks/arrow_glacier/state_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from ethereum_types.numeric import U256, Uint

from ethereum.crypto.hash import Hash32, keccak256
from ethereum.exceptions import InvalidBlock
from ethereum.state import (
EMPTY_ACCOUNT,
EMPTY_CODE_HASH,
Expand Down Expand Up @@ -555,7 +556,7 @@ def reduce_sender_balance(sender: Account) -> None:
sender.balance -= amount

def increase_recipient_balance(recipient: Account) -> None:
recipient.balance += amount
recipient.balance = recipient.balance.wrapping_add(amount)

modify_state(tx_state, sender_address, reduce_sender_balance)
modify_state(tx_state, recipient_address, increase_recipient_balance)
Expand All @@ -579,6 +580,8 @@ def create_ether(
"""

def increase_balance(account: Account) -> None:
if Uint(account.balance) + Uint(amount) > Uint(U256.MAX_VALUE):
raise InvalidBlock("account balance overflow")
account.balance += amount

modify_state(tx_state, address, increase_balance)
Expand Down
5 changes: 4 additions & 1 deletion src/ethereum/forks/berlin/state_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from ethereum_types.numeric import U256, Uint

from ethereum.crypto.hash import Hash32, keccak256
from ethereum.exceptions import InvalidBlock
from ethereum.state import (
EMPTY_ACCOUNT,
EMPTY_CODE_HASH,
Expand Down Expand Up @@ -555,7 +556,7 @@ def reduce_sender_balance(sender: Account) -> None:
sender.balance -= amount

def increase_recipient_balance(recipient: Account) -> None:
recipient.balance += amount
recipient.balance = recipient.balance.wrapping_add(amount)

modify_state(tx_state, sender_address, reduce_sender_balance)
modify_state(tx_state, recipient_address, increase_recipient_balance)
Expand All @@ -579,6 +580,8 @@ def create_ether(
"""

def increase_balance(account: Account) -> None:
if Uint(account.balance) + Uint(amount) > Uint(U256.MAX_VALUE):
raise InvalidBlock("account balance overflow")
account.balance += amount

modify_state(tx_state, address, increase_balance)
Expand Down
5 changes: 4 additions & 1 deletion src/ethereum/forks/bpo1/state_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from ethereum_types.numeric import U256, Uint

from ethereum.crypto.hash import Hash32, keccak256
from ethereum.exceptions import InvalidBlock
from ethereum.state import (
EMPTY_ACCOUNT,
EMPTY_CODE_HASH,
Expand Down Expand Up @@ -542,7 +543,7 @@ def reduce_sender_balance(sender: Account) -> None:
sender.balance -= amount

def increase_recipient_balance(recipient: Account) -> None:
recipient.balance += amount
recipient.balance = recipient.balance.wrapping_add(amount)

modify_state(tx_state, sender_address, reduce_sender_balance)
modify_state(tx_state, recipient_address, increase_recipient_balance)
Expand All @@ -566,6 +567,8 @@ def create_ether(
"""

def increase_balance(account: Account) -> None:
if Uint(account.balance) + Uint(amount) > Uint(U256.MAX_VALUE):
raise InvalidBlock("account balance overflow")
account.balance += amount

modify_state(tx_state, address, increase_balance)
Expand Down
5 changes: 4 additions & 1 deletion src/ethereum/forks/bpo2/state_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from ethereum_types.numeric import U256, Uint

from ethereum.crypto.hash import Hash32, keccak256
from ethereum.exceptions import InvalidBlock
from ethereum.state import (
EMPTY_ACCOUNT,
EMPTY_CODE_HASH,
Expand Down Expand Up @@ -542,7 +543,7 @@ def reduce_sender_balance(sender: Account) -> None:
sender.balance -= amount

def increase_recipient_balance(recipient: Account) -> None:
recipient.balance += amount
recipient.balance = recipient.balance.wrapping_add(amount)

modify_state(tx_state, sender_address, reduce_sender_balance)
modify_state(tx_state, recipient_address, increase_recipient_balance)
Expand All @@ -566,6 +567,8 @@ def create_ether(
"""

def increase_balance(account: Account) -> None:
if Uint(account.balance) + Uint(amount) > Uint(U256.MAX_VALUE):
raise InvalidBlock("account balance overflow")
account.balance += amount

modify_state(tx_state, address, increase_balance)
Expand Down
5 changes: 4 additions & 1 deletion src/ethereum/forks/bpo3/state_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from ethereum_types.numeric import U256, Uint

from ethereum.crypto.hash import Hash32, keccak256
from ethereum.exceptions import InvalidBlock
from ethereum.state import (
EMPTY_ACCOUNT,
EMPTY_CODE_HASH,
Expand Down Expand Up @@ -542,7 +543,7 @@ def reduce_sender_balance(sender: Account) -> None:
sender.balance -= amount

def increase_recipient_balance(recipient: Account) -> None:
recipient.balance += amount
recipient.balance = recipient.balance.wrapping_add(amount)

modify_state(tx_state, sender_address, reduce_sender_balance)
modify_state(tx_state, recipient_address, increase_recipient_balance)
Expand All @@ -566,6 +567,8 @@ def create_ether(
"""

def increase_balance(account: Account) -> None:
if Uint(account.balance) + Uint(amount) > Uint(U256.MAX_VALUE):
raise InvalidBlock("account balance overflow")
account.balance += amount

modify_state(tx_state, address, increase_balance)
Expand Down
5 changes: 4 additions & 1 deletion src/ethereum/forks/bpo4/state_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from ethereum_types.numeric import U256, Uint

from ethereum.crypto.hash import Hash32, keccak256
from ethereum.exceptions import InvalidBlock
from ethereum.state import (
EMPTY_ACCOUNT,
EMPTY_CODE_HASH,
Expand Down Expand Up @@ -542,7 +543,7 @@ def reduce_sender_balance(sender: Account) -> None:
sender.balance -= amount

def increase_recipient_balance(recipient: Account) -> None:
recipient.balance += amount
recipient.balance = recipient.balance.wrapping_add(amount)

modify_state(tx_state, sender_address, reduce_sender_balance)
modify_state(tx_state, recipient_address, increase_recipient_balance)
Expand All @@ -566,6 +567,8 @@ def create_ether(
"""

def increase_balance(account: Account) -> None:
if Uint(account.balance) + Uint(amount) > Uint(U256.MAX_VALUE):
raise InvalidBlock("account balance overflow")
account.balance += amount

modify_state(tx_state, address, increase_balance)
Expand Down
5 changes: 4 additions & 1 deletion src/ethereum/forks/bpo5/state_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from ethereum_types.numeric import U256, Uint

from ethereum.crypto.hash import Hash32, keccak256
from ethereum.exceptions import InvalidBlock
from ethereum.state import (
EMPTY_ACCOUNT,
EMPTY_CODE_HASH,
Expand Down Expand Up @@ -542,7 +543,7 @@ def reduce_sender_balance(sender: Account) -> None:
sender.balance -= amount

def increase_recipient_balance(recipient: Account) -> None:
recipient.balance += amount
recipient.balance = recipient.balance.wrapping_add(amount)

modify_state(tx_state, sender_address, reduce_sender_balance)
modify_state(tx_state, recipient_address, increase_recipient_balance)
Expand All @@ -566,6 +567,8 @@ def create_ether(
"""

def increase_balance(account: Account) -> None:
if Uint(account.balance) + Uint(amount) > Uint(U256.MAX_VALUE):
raise InvalidBlock("account balance overflow")
account.balance += amount

modify_state(tx_state, address, increase_balance)
Expand Down
5 changes: 4 additions & 1 deletion src/ethereum/forks/byzantium/state_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from ethereum_types.numeric import U256, Uint

from ethereum.crypto.hash import Hash32, keccak256
from ethereum.exceptions import InvalidBlock
from ethereum.state import (
EMPTY_ACCOUNT,
EMPTY_CODE_HASH,
Expand Down Expand Up @@ -555,7 +556,7 @@ def reduce_sender_balance(sender: Account) -> None:
sender.balance -= amount

def increase_recipient_balance(recipient: Account) -> None:
recipient.balance += amount
recipient.balance = recipient.balance.wrapping_add(amount)

modify_state(tx_state, sender_address, reduce_sender_balance)
modify_state(tx_state, recipient_address, increase_recipient_balance)
Expand All @@ -579,6 +580,8 @@ def create_ether(
"""

def increase_balance(account: Account) -> None:
if Uint(account.balance) + Uint(amount) > Uint(U256.MAX_VALUE):
raise InvalidBlock("account balance overflow")
account.balance += amount

modify_state(tx_state, address, increase_balance)
Expand Down
5 changes: 4 additions & 1 deletion src/ethereum/forks/cancun/state_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from ethereum_types.numeric import U256, Uint

from ethereum.crypto.hash import Hash32, keccak256
from ethereum.exceptions import InvalidBlock
from ethereum.state import (
EMPTY_ACCOUNT,
EMPTY_CODE_HASH,
Expand Down Expand Up @@ -542,7 +543,7 @@ def reduce_sender_balance(sender: Account) -> None:
sender.balance -= amount

def increase_recipient_balance(recipient: Account) -> None:
recipient.balance += amount
recipient.balance = recipient.balance.wrapping_add(amount)

modify_state(tx_state, sender_address, reduce_sender_balance)
modify_state(tx_state, recipient_address, increase_recipient_balance)
Expand All @@ -566,6 +567,8 @@ def create_ether(
"""

def increase_balance(account: Account) -> None:
if Uint(account.balance) + Uint(amount) > Uint(U256.MAX_VALUE):
raise InvalidBlock("account balance overflow")
account.balance += amount

modify_state(tx_state, address, increase_balance)
Expand Down
5 changes: 4 additions & 1 deletion src/ethereum/forks/constantinople/state_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from ethereum_types.numeric import U256, Uint

from ethereum.crypto.hash import Hash32, keccak256
from ethereum.exceptions import InvalidBlock
from ethereum.state import (
EMPTY_ACCOUNT,
EMPTY_CODE_HASH,
Expand Down Expand Up @@ -555,7 +556,7 @@ def reduce_sender_balance(sender: Account) -> None:
sender.balance -= amount

def increase_recipient_balance(recipient: Account) -> None:
recipient.balance += amount
recipient.balance = recipient.balance.wrapping_add(amount)

modify_state(tx_state, sender_address, reduce_sender_balance)
modify_state(tx_state, recipient_address, increase_recipient_balance)
Expand All @@ -579,6 +580,8 @@ def create_ether(
"""

def increase_balance(account: Account) -> None:
if Uint(account.balance) + Uint(amount) > Uint(U256.MAX_VALUE):
raise InvalidBlock("account balance overflow")
account.balance += amount

modify_state(tx_state, address, increase_balance)
Expand Down
5 changes: 4 additions & 1 deletion src/ethereum/forks/dao_fork/state_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from ethereum_types.numeric import U256, Uint

from ethereum.crypto.hash import Hash32, keccak256
from ethereum.exceptions import InvalidBlock
from ethereum.state import (
EMPTY_ACCOUNT,
EMPTY_CODE_HASH,
Expand Down Expand Up @@ -555,7 +556,7 @@ def reduce_sender_balance(sender: Account) -> None:
sender.balance -= amount

def increase_recipient_balance(recipient: Account) -> None:
recipient.balance += amount
recipient.balance = recipient.balance.wrapping_add(amount)

modify_state(tx_state, sender_address, reduce_sender_balance)
modify_state(tx_state, recipient_address, increase_recipient_balance)
Expand All @@ -579,6 +580,8 @@ def create_ether(
"""

def increase_balance(account: Account) -> None:
if Uint(account.balance) + Uint(amount) > Uint(U256.MAX_VALUE):
raise InvalidBlock("account balance overflow")
account.balance += amount

modify_state(tx_state, address, increase_balance)
Expand Down
5 changes: 4 additions & 1 deletion src/ethereum/forks/frontier/state_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from ethereum_types.numeric import U256, Uint

from ethereum.crypto.hash import Hash32, keccak256
from ethereum.exceptions import InvalidBlock
from ethereum.state import (
EMPTY_ACCOUNT,
EMPTY_CODE_HASH,
Expand Down Expand Up @@ -555,7 +556,7 @@ def reduce_sender_balance(sender: Account) -> None:
sender.balance -= amount

def increase_recipient_balance(recipient: Account) -> None:
recipient.balance += amount
recipient.balance = recipient.balance.wrapping_add(amount)

modify_state(tx_state, sender_address, reduce_sender_balance)
modify_state(tx_state, recipient_address, increase_recipient_balance)
Expand All @@ -579,6 +580,8 @@ def create_ether(
"""

def increase_balance(account: Account) -> None:
if Uint(account.balance) + Uint(amount) > Uint(U256.MAX_VALUE):
raise InvalidBlock("account balance overflow")
account.balance += amount

modify_state(tx_state, address, increase_balance)
Expand Down
5 changes: 4 additions & 1 deletion src/ethereum/forks/gray_glacier/state_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from ethereum_types.numeric import U256, Uint

from ethereum.crypto.hash import Hash32, keccak256
from ethereum.exceptions import InvalidBlock
from ethereum.state import (
EMPTY_ACCOUNT,
EMPTY_CODE_HASH,
Expand Down Expand Up @@ -555,7 +556,7 @@ def reduce_sender_balance(sender: Account) -> None:
sender.balance -= amount

def increase_recipient_balance(recipient: Account) -> None:
recipient.balance += amount
recipient.balance = recipient.balance.wrapping_add(amount)

modify_state(tx_state, sender_address, reduce_sender_balance)
modify_state(tx_state, recipient_address, increase_recipient_balance)
Expand All @@ -579,6 +580,8 @@ def create_ether(
"""

def increase_balance(account: Account) -> None:
if Uint(account.balance) + Uint(amount) > Uint(U256.MAX_VALUE):
raise InvalidBlock("account balance overflow")
account.balance += amount

modify_state(tx_state, address, increase_balance)
Expand Down
5 changes: 4 additions & 1 deletion src/ethereum/forks/homestead/state_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from ethereum_types.numeric import U256, Uint

from ethereum.crypto.hash import Hash32, keccak256
from ethereum.exceptions import InvalidBlock
from ethereum.state import (
EMPTY_ACCOUNT,
EMPTY_CODE_HASH,
Expand Down Expand Up @@ -555,7 +556,7 @@ def reduce_sender_balance(sender: Account) -> None:
sender.balance -= amount

def increase_recipient_balance(recipient: Account) -> None:
recipient.balance += amount
recipient.balance = recipient.balance.wrapping_add(amount)

modify_state(tx_state, sender_address, reduce_sender_balance)
modify_state(tx_state, recipient_address, increase_recipient_balance)
Expand All @@ -579,6 +580,8 @@ def create_ether(
"""

def increase_balance(account: Account) -> None:
if Uint(account.balance) + Uint(amount) > Uint(U256.MAX_VALUE):
raise InvalidBlock("account balance overflow")
account.balance += amount

modify_state(tx_state, address, increase_balance)
Expand Down
Loading
Loading