Skip to content

Commit 467bb22

Browse files
enitratSamWilsn
authored andcommitted
dev: simplify condition in is_account_alive
1 parent 74fb2a4 commit 467bb22

File tree

12 files changed

+12
-60
lines changed

12 files changed

+12
-60
lines changed

src/ethereum/arrow_glacier/state.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -463,11 +463,7 @@ def is_account_alive(state: State, address: Address) -> bool:
463463
if account is None:
464464
return False
465465
else:
466-
return not (
467-
account.nonce == Uint(0)
468-
and account.code == b""
469-
and account.balance == 0
470-
)
466+
return not account == EMPTY_ACCOUNT
471467

472468

473469
def modify_state(

src/ethereum/berlin/state.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -463,11 +463,7 @@ def is_account_alive(state: State, address: Address) -> bool:
463463
if account is None:
464464
return False
465465
else:
466-
return not (
467-
account.nonce == Uint(0)
468-
and account.code == b""
469-
and account.balance == 0
470-
)
466+
return not account == EMPTY_ACCOUNT
471467

472468

473469
def modify_state(

src/ethereum/byzantium/state.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -437,11 +437,7 @@ def is_account_alive(state: State, address: Address) -> bool:
437437
if account is None:
438438
return False
439439
else:
440-
return not (
441-
account.nonce == Uint(0)
442-
and account.code == b""
443-
and account.balance == 0
444-
)
440+
return not account == EMPTY_ACCOUNT
445441

446442

447443
def modify_state(

src/ethereum/cancun/state.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -496,11 +496,7 @@ def is_account_alive(state: State, address: Address) -> bool:
496496
if account is None:
497497
return False
498498
else:
499-
return not (
500-
account.nonce == Uint(0)
501-
and account.code == b""
502-
and account.balance == 0
503-
)
499+
return not account == EMPTY_ACCOUNT
504500

505501

506502
def modify_state(

src/ethereum/constantinople/state.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -437,11 +437,7 @@ def is_account_alive(state: State, address: Address) -> bool:
437437
if account is None:
438438
return False
439439
else:
440-
return not (
441-
account.nonce == Uint(0)
442-
and account.code == b""
443-
and account.balance == 0
444-
)
440+
return not account == EMPTY_ACCOUNT
445441

446442

447443
def modify_state(

src/ethereum/gray_glacier/state.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -463,11 +463,7 @@ def is_account_alive(state: State, address: Address) -> bool:
463463
if account is None:
464464
return False
465465
else:
466-
return not (
467-
account.nonce == Uint(0)
468-
and account.code == b""
469-
and account.balance == 0
470-
)
466+
return not account == EMPTY_ACCOUNT
471467

472468

473469
def modify_state(

src/ethereum/istanbul/state.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -463,11 +463,7 @@ def is_account_alive(state: State, address: Address) -> bool:
463463
if account is None:
464464
return False
465465
else:
466-
return not (
467-
account.nonce == Uint(0)
468-
and account.code == b""
469-
and account.balance == 0
470-
)
466+
return not account == EMPTY_ACCOUNT
471467

472468

473469
def modify_state(

src/ethereum/london/state.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -463,11 +463,7 @@ def is_account_alive(state: State, address: Address) -> bool:
463463
if account is None:
464464
return False
465465
else:
466-
return not (
467-
account.nonce == Uint(0)
468-
and account.code == b""
469-
and account.balance == 0
470-
)
466+
return not account == EMPTY_ACCOUNT
471467

472468

473469
def modify_state(

src/ethereum/muir_glacier/state.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -463,11 +463,7 @@ def is_account_alive(state: State, address: Address) -> bool:
463463
if account is None:
464464
return False
465465
else:
466-
return not (
467-
account.nonce == Uint(0)
468-
and account.code == b""
469-
and account.balance == 0
470-
)
466+
return not account == EMPTY_ACCOUNT
471467

472468

473469
def modify_state(

src/ethereum/paris/state.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -463,11 +463,7 @@ def is_account_alive(state: State, address: Address) -> bool:
463463
if account is None:
464464
return False
465465
else:
466-
return not (
467-
account.nonce == Uint(0)
468-
and account.code == b""
469-
and account.balance == 0
470-
)
466+
return not account == EMPTY_ACCOUNT
471467

472468

473469
def modify_state(

0 commit comments

Comments
 (0)