Skip to content

Commit 16762ec

Browse files
Carsons-EelsSamWilsn
authored andcommitted
Turn vulture fully on, remove dead code, whitelist
- ignore all pytest functions - remove unused variables, functions, methods, and classes - create vulture whitelist and mark some code that either implicitly gets called or only gets called during test runs for vulture to ignore
1 parent 7b1694e commit 16762ec

File tree

55 files changed

+120
-766
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+120
-766
lines changed

src/ethereum/arrow_glacier/state.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -391,31 +391,6 @@ def account_has_storage(state: State, address: Address) -> bool:
391391
return address in state._storage_tries
392392

393393

394-
def is_account_empty(state: State, address: Address) -> bool:
395-
"""
396-
Checks if an account has zero nonce, empty code and zero balance.
397-
398-
Parameters
399-
----------
400-
state:
401-
The state
402-
address:
403-
Address of the account that needs to be checked.
404-
405-
Returns
406-
-------
407-
is_empty : `bool`
408-
True if an account has zero nonce, empty code and zero balance,
409-
False otherwise.
410-
"""
411-
account = get_account(state, address)
412-
return (
413-
account.nonce == Uint(0)
414-
and account.code == b""
415-
and account.balance == 0
416-
)
417-
418-
419394
def account_exists_and_is_empty(state: State, address: Address) -> bool:
420395
"""
421396
Checks if an account exists and has zero nonce, empty code and zero

src/ethereum/arrow_glacier/utils/hexadecimal.py

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
from ethereum.utils.hexadecimal import remove_hex_prefix
1818

19-
from ..fork_types import Address, Bloom, Root
19+
from ..fork_types import Address, Root
2020

2121

2222
def hex_to_root(hex_string: str) -> Root:
@@ -36,23 +36,6 @@ def hex_to_root(hex_string: str) -> Root:
3636
return Root(Bytes.fromhex(remove_hex_prefix(hex_string)))
3737

3838

39-
def hex_to_bloom(hex_string: str) -> Bloom:
40-
"""
41-
Convert hex string to bloom.
42-
43-
Parameters
44-
----------
45-
hex_string :
46-
The hexadecimal string to be converted to bloom.
47-
48-
Returns
49-
-------
50-
bloom : `Bloom`
51-
Bloom obtained from the given hexadecimal string.
52-
"""
53-
return Bloom(Bytes.fromhex(remove_hex_prefix(hex_string)))
54-
55-
5639
def hex_to_address(hex_string: str) -> Address:
5740
"""
5841
Convert hex string to Address (20 bytes).

src/ethereum/berlin/state.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -391,31 +391,6 @@ def account_has_storage(state: State, address: Address) -> bool:
391391
return address in state._storage_tries
392392

393393

394-
def is_account_empty(state: State, address: Address) -> bool:
395-
"""
396-
Checks if an account has zero nonce, empty code and zero balance.
397-
398-
Parameters
399-
----------
400-
state:
401-
The state
402-
address:
403-
Address of the account that needs to be checked.
404-
405-
Returns
406-
-------
407-
is_empty : `bool`
408-
True if an account has zero nonce, empty code and zero balance,
409-
False otherwise.
410-
"""
411-
account = get_account(state, address)
412-
return (
413-
account.nonce == Uint(0)
414-
and account.code == b""
415-
and account.balance == 0
416-
)
417-
418-
419394
def account_exists_and_is_empty(state: State, address: Address) -> bool:
420395
"""
421396
Checks if an account exists and has zero nonce, empty code and zero

src/ethereum/berlin/utils/hexadecimal.py

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
from ethereum.utils.hexadecimal import remove_hex_prefix
1818

19-
from ..fork_types import Address, Bloom, Root
19+
from ..fork_types import Address, Root
2020

2121

2222
def hex_to_root(hex_string: str) -> Root:
@@ -36,23 +36,6 @@ def hex_to_root(hex_string: str) -> Root:
3636
return Root(Bytes.fromhex(remove_hex_prefix(hex_string)))
3737

3838

39-
def hex_to_bloom(hex_string: str) -> Bloom:
40-
"""
41-
Convert hex string to bloom.
42-
43-
Parameters
44-
----------
45-
hex_string :
46-
The hexadecimal string to be converted to bloom.
47-
48-
Returns
49-
-------
50-
bloom : `Bloom`
51-
Bloom obtained from the given hexadecimal string.
52-
"""
53-
return Bloom(Bytes.fromhex(remove_hex_prefix(hex_string)))
54-
55-
5639
def hex_to_address(hex_string: str) -> Address:
5740
"""
5841
Convert hex string to Address (20 bytes).

src/ethereum/byzantium/state.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -365,31 +365,6 @@ def account_has_storage(state: State, address: Address) -> bool:
365365
return address in state._storage_tries
366366

367367

368-
def is_account_empty(state: State, address: Address) -> bool:
369-
"""
370-
Checks if an account has zero nonce, empty code and zero balance.
371-
372-
Parameters
373-
----------
374-
state:
375-
The state
376-
address:
377-
Address of the account that needs to be checked.
378-
379-
Returns
380-
-------
381-
is_empty : `bool`
382-
True if an account has zero nonce, empty code and zero balance,
383-
False otherwise.
384-
"""
385-
account = get_account(state, address)
386-
return (
387-
account.nonce == Uint(0)
388-
and account.code == b""
389-
and account.balance == 0
390-
)
391-
392-
393368
def account_exists_and_is_empty(state: State, address: Address) -> bool:
394369
"""
395370
Checks if an account exists and has zero nonce, empty code and zero

src/ethereum/byzantium/utils/hexadecimal.py

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
from ethereum.utils.hexadecimal import remove_hex_prefix
1818

19-
from ..fork_types import Address, Bloom, Root
19+
from ..fork_types import Address, Root
2020

2121

2222
def hex_to_root(hex_string: str) -> Root:
@@ -36,23 +36,6 @@ def hex_to_root(hex_string: str) -> Root:
3636
return Root(Bytes.fromhex(remove_hex_prefix(hex_string)))
3737

3838

39-
def hex_to_bloom(hex_string: str) -> Bloom:
40-
"""
41-
Convert hex string to bloom.
42-
43-
Parameters
44-
----------
45-
hex_string :
46-
The hexadecimal string to be converted to bloom.
47-
48-
Returns
49-
-------
50-
bloom : `Bloom`
51-
Bloom obtained from the given hexadecimal string.
52-
"""
53-
return Bloom(Bytes.fromhex(remove_hex_prefix(hex_string)))
54-
55-
5639
def hex_to_address(hex_string: str) -> Address:
5740
"""
5841
Convert hex string to Address (20 bytes).

src/ethereum/cancun/state.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -425,31 +425,6 @@ def account_has_storage(state: State, address: Address) -> bool:
425425
return address in state._storage_tries
426426

427427

428-
def is_account_empty(state: State, address: Address) -> bool:
429-
"""
430-
Checks if an account has zero nonce, empty code and zero balance.
431-
432-
Parameters
433-
----------
434-
state:
435-
The state
436-
address:
437-
Address of the account that needs to be checked.
438-
439-
Returns
440-
-------
441-
is_empty : `bool`
442-
True if an account has zero nonce, empty code and zero balance,
443-
False otherwise.
444-
"""
445-
account = get_account(state, address)
446-
return (
447-
account.nonce == Uint(0)
448-
and account.code == b""
449-
and account.balance == 0
450-
)
451-
452-
453428
def account_exists_and_is_empty(state: State, address: Address) -> bool:
454429
"""
455430
Checks if an account exists and has zero nonce, empty code and zero

src/ethereum/cancun/utils/hexadecimal.py

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
from ethereum.utils.hexadecimal import remove_hex_prefix
1818

19-
from ..fork_types import Address, Bloom, Root
19+
from ..fork_types import Address, Root
2020

2121

2222
def hex_to_root(hex_string: str) -> Root:
@@ -36,23 +36,6 @@ def hex_to_root(hex_string: str) -> Root:
3636
return Root(Bytes.fromhex(remove_hex_prefix(hex_string)))
3737

3838

39-
def hex_to_bloom(hex_string: str) -> Bloom:
40-
"""
41-
Convert hex string to bloom.
42-
43-
Parameters
44-
----------
45-
hex_string :
46-
The hexadecimal string to be converted to bloom.
47-
48-
Returns
49-
-------
50-
bloom : `Bloom`
51-
Bloom obtained from the given hexadecimal string.
52-
"""
53-
return Bloom(Bytes.fromhex(remove_hex_prefix(hex_string)))
54-
55-
5639
def hex_to_address(hex_string: str) -> Address:
5740
"""
5841
Convert hex string to Address (20 bytes).

src/ethereum/constantinople/state.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -365,31 +365,6 @@ def account_has_storage(state: State, address: Address) -> bool:
365365
return address in state._storage_tries
366366

367367

368-
def is_account_empty(state: State, address: Address) -> bool:
369-
"""
370-
Checks if an account has zero nonce, empty code and zero balance.
371-
372-
Parameters
373-
----------
374-
state:
375-
The state
376-
address:
377-
Address of the account that needs to be checked.
378-
379-
Returns
380-
-------
381-
is_empty : `bool`
382-
True if an account has zero nonce, empty code and zero balance,
383-
False otherwise.
384-
"""
385-
account = get_account(state, address)
386-
return (
387-
account.nonce == Uint(0)
388-
and account.code == b""
389-
and account.balance == 0
390-
)
391-
392-
393368
def account_exists_and_is_empty(state: State, address: Address) -> bool:
394369
"""
395370
Checks if an account exists and has zero nonce, empty code and zero

src/ethereum/constantinople/utils/hexadecimal.py

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
from ethereum.utils.hexadecimal import remove_hex_prefix
1818

19-
from ..fork_types import Address, Bloom, Root
19+
from ..fork_types import Address, Root
2020

2121

2222
def hex_to_root(hex_string: str) -> Root:
@@ -36,23 +36,6 @@ def hex_to_root(hex_string: str) -> Root:
3636
return Root(Bytes.fromhex(remove_hex_prefix(hex_string)))
3737

3838

39-
def hex_to_bloom(hex_string: str) -> Bloom:
40-
"""
41-
Convert hex string to bloom.
42-
43-
Parameters
44-
----------
45-
hex_string :
46-
The hexadecimal string to be converted to bloom.
47-
48-
Returns
49-
-------
50-
bloom : `Bloom`
51-
Bloom obtained from the given hexadecimal string.
52-
"""
53-
return Bloom(Bytes.fromhex(remove_hex_prefix(hex_string)))
54-
55-
5639
def hex_to_address(hex_string: str) -> Address:
5740
"""
5841
Convert hex string to Address (20 bytes).

0 commit comments

Comments
 (0)