Skip to content

Commit 97be373

Browse files
committed
remove dead code, add two functions to the vulture whitelist
1 parent 1ea4042 commit 97be373

2 files changed

Lines changed: 10 additions & 38 deletions

File tree

packages/testing/src/execution_testing/cli/eest/commands/gas_map.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -62,44 +62,6 @@ def _get_opcode_gas_map_sources(fork_class):
6262
return "\n".join(sources)
6363

6464

65-
def _build_source_opcode_field_map(fork_class):
66-
"""Build opcode→GasCosts fields map by parsing opcode_gas_map source."""
67-
source = _get_opcode_gas_map_sources(fork_class)
68-
valid_fields = {f.name for f in fields(GasCosts)}
69-
opcode_fields = defaultdict(set)
70-
71-
pattern = re.compile(
72-
r"Opcodes\.(\w+)\s*:\s*(.*?)(?=Opcodes\.\w+\s*:|$)",
73-
re.DOTALL,
74-
)
75-
for match in pattern.finditer(source):
76-
opcode_name = match.group(1)
77-
value_expr = match.group(2)
78-
for field_name in valid_fields:
79-
if field_name in value_expr:
80-
opcode_fields[opcode_name].add(field_name)
81-
82-
helper_pattern = re.compile(
83-
r"def\s+(_with_\w+|_calculate_\w+)\s*\(.*?\)\s*:"
84-
r"(.*?)(?=\n (?:def |@|$))",
85-
re.DOTALL,
86-
)
87-
helper_fields = defaultdict(set)
88-
for match in helper_pattern.finditer(source):
89-
helper_name = match.group(1)
90-
body = match.group(2)
91-
for field_name in valid_fields:
92-
if field_name in body:
93-
helper_fields[helper_name].add(field_name)
94-
95-
for opcode_name, expr_fields in opcode_fields.items():
96-
for helper_name, hf in helper_fields.items():
97-
if helper_name in source:
98-
pass
99-
100-
return {k: sorted(v) for k, v in opcode_fields.items()}
101-
102-
10365
def _get_helper_method_fields(fork_class):
10466
"""Extract GasCosts fields from helper methods on the fork class."""
10567
valid_fields = {f.name for f in fields(GasCosts)}

vulture_whitelist.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
"""
88

99
from ethereum.cancun.blocks import Withdrawal
10+
from execution_testing.cli.eest.commands.gas_map import gas_map
11+
from execution_testing.forks.tests.test_gas_repricing import (
12+
_clear_repricing_cache,
13+
)
1014
from ethereum_spec_tools.evm_tools.t8n.transition_tool import EELST8N
1115

1216
from ethereum.ethash import *
@@ -136,4 +140,10 @@
136140
CommentReplaceCommand
137141
CommentReplaceCommand.transform_module_impl
138142

143+
# packages/testing/src/execution_testing/cli/eest/commands/gas_map.py
144+
gas_map # Click entry point registered in pyproject.toml
145+
146+
# packages/testing/src/execution_testing/forks/tests/test_gas_repricing.py
147+
_clear_repricing_cache # pytest autouse fixture
148+
139149
_children # unused attribute (src/ethereum_spec_tools/docc.py:751)

0 commit comments

Comments
 (0)