Skip to content

Commit ac5904d

Browse files
committed
dev: simplify condition in is_account_alive
1 parent 78fb726 commit ac5904d

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
@@ -497,11 +497,7 @@ def is_account_alive(state: State, address: Address) -> bool:
497497
if account is None:
498498
return False
499499
else:
500-
return not (
501-
account.nonce == Uint(0)
502-
and account.code == b""
503-
and account.balance == 0
504-
)
500+
return not account == EMPTY_ACCOUNT
505501

506502

507503
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(

src/ethereum/shanghai/state.py

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

473469

474470
def modify_state(

src/ethereum/spurious_dragon/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(

0 commit comments

Comments
 (0)