diff --git a/packages/testing/pyproject.toml b/packages/testing/pyproject.toml
index f567d51ea02..dcc4d4af68d 100644
--- a/packages/testing/pyproject.toml
+++ b/packages/testing/pyproject.toml
@@ -114,7 +114,7 @@ exclude = ["*tests*"]
"execution_testing.test_types" = ["kzg_trusted_setup.txt"]
[tool.ruff]
-line-length = 79
+extend = "../../pyproject.toml"
[tool.codespell]
skip = ".venv,__pycache__,.git,build,dist,*.pyc,*.lock"
diff --git a/packages/testing/src/conftest.py b/packages/testing/src/conftest.py
index 7258e23c9ce..835ef901703 100644
--- a/packages/testing/src/conftest.py
+++ b/packages/testing/src/conftest.py
@@ -89,13 +89,11 @@ def default_t8n(
DEFAULT_TRANSITION_TOOL_FOR_UNIT_TESTS.__name__
)
if instance is None:
- raise Exception(
- f"Failed to instantiate {DEFAULT_TRANSITION_TOOL_FOR_UNIT_TESTS.__name__}"
- )
+ tool_name = DEFAULT_TRANSITION_TOOL_FOR_UNIT_TESTS.__name__
+ raise Exception(f"Failed to instantiate {tool_name}")
if isinstance(instance, Exception):
- raise Exception(
- f"Failed to instantiate {DEFAULT_TRANSITION_TOOL_FOR_UNIT_TESTS.__name__}"
- ) from instance
+ tool_name = DEFAULT_TRANSITION_TOOL_FOR_UNIT_TESTS.__name__
+ raise Exception(f"Failed to instantiate {tool_name}") from instance
return instance
diff --git a/packages/testing/src/execution_testing/base_types/composite_types.py b/packages/testing/src/execution_testing/base_types/composite_types.py
index c78c1e0ee9d..1db6e9f7b2e 100644
--- a/packages/testing/src/execution_testing/base_types/composite_types.py
+++ b/packages/testing/src/execution_testing/base_types/composite_types.py
@@ -152,9 +152,10 @@ def __str__(self) -> str:
label_str = ""
if self.address.label is not None:
label_str = f" ({self.address.label})"
+ hint_str = f" ({self.hint})" if self.hint else ""
return (
f"incorrect value in address {self.address}{label_str} for "
- + f"key {Hash(self.key)}{f' ({self.hint})' if self.hint else ''}:"
+ + f"key {Hash(self.key)}{hint_str}:"
+ f" want {HexNumber(self.want)} (dec:{int(self.want)}),"
+ f" got {HexNumber(self.got)} (dec:{int(self.got)})"
)
diff --git a/packages/testing/src/execution_testing/base_types/conversions.py b/packages/testing/src/execution_testing/base_types/conversions.py
index d22d64fd4e1..d7d409d41d2 100644
--- a/packages/testing/src/execution_testing/base_types/conversions.py
+++ b/packages/testing/src/execution_testing/base_types/conversions.py
@@ -62,7 +62,8 @@ def to_fixed_size_bytes(
if right_padding:
return input_bytes.ljust(size, b"\x00")
raise Exception(
- f"input is too small for fixed size bytes: {len(input_bytes)} < {size}\n"
+ f"input is too small for fixed size bytes: "
+ f"{len(input_bytes)} < {size}\n"
"Use `left_padding=True` or `right_padding=True` to allow padding."
)
return input_bytes
diff --git a/packages/testing/src/execution_testing/base_types/mixins.py b/packages/testing/src/execution_testing/base_types/mixins.py
index 7199bb9d40d..f691d2a9aff 100644
--- a/packages/testing/src/execution_testing/base_types/mixins.py
+++ b/packages/testing/src/execution_testing/base_types/mixins.py
@@ -78,9 +78,9 @@ def __repr_args__(self) -> Any:
# Convert field values based on their type. This ensures consistency
# between JSON and Python object representations. Should a custom
- # `__repr__` be needed for a specific type, it can be added in the match
- # statement below. Otherwise, the default string representation is
- # used.
+ # `__repr__` be needed for a specific type, it can be added in the
+ # match statement below. Otherwise, the default string representation
+ # is used.
repr_attrs: List[Tuple[str, Any]] = []
for a, v in attrs:
match v:
diff --git a/packages/testing/src/execution_testing/base_types/reference_spec/git_reference_spec.py b/packages/testing/src/execution_testing/base_types/reference_spec/git_reference_spec.py
index 69cac9b4662..8aaccfdd58d 100644
--- a/packages/testing/src/execution_testing/base_types/reference_spec/git_reference_spec.py
+++ b/packages/testing/src/execution_testing/base_types/reference_spec/git_reference_spec.py
@@ -76,7 +76,8 @@ def _get_latest_spec(self) -> Dict | None:
if response.status_code != 200:
warnings.warn(
- f"Unable to get latest version, status code: {response.status_code} - "
+ f"Unable to get latest version, "
+ f"status code: {response.status_code} - "
f"text: {response.text}",
stacklevel=2,
)
diff --git a/packages/testing/src/execution_testing/base_types/serialization.py b/packages/testing/src/execution_testing/base_types/serialization.py
index ddc01c2483f..251fd4de267 100644
--- a/packages/testing/src/execution_testing/base_types/serialization.py
+++ b/packages/testing/src/execution_testing/base_types/serialization.py
@@ -122,7 +122,8 @@ def to_list(self, signing: bool = False) -> List[Any]:
if signing:
if not self.signable:
raise Exception(
- f'Object "{self.__class__.__name__}" does not support signing'
+ f'Object "{self.__class__.__name__}" '
+ "does not support signing"
)
field_list = self.get_rlp_signing_fields()
else:
diff --git a/packages/testing/src/execution_testing/base_types/tests/test_base_types.py b/packages/testing/src/execution_testing/base_types/tests/test_base_types.py
index 78d32a30d80..3bd3551adf1 100644
--- a/packages/testing/src/execution_testing/base_types/tests/test_base_types.py
+++ b/packages/testing/src/execution_testing/base_types/tests/test_base_types.py
@@ -285,7 +285,8 @@ def test_json_deserialization(
"""Test that to_json returns the expected JSON for the given object."""
if not can_be_deserialized:
pytest.skip(
- reason="The model instance in this case can not be deserialized"
+ reason="The model instance in this case can not be "
+ "deserialized"
)
model_type = type(model_instance)
assert model_type(**json) == model_instance
diff --git a/packages/testing/src/execution_testing/base_types/typing_utils.py b/packages/testing/src/execution_testing/base_types/typing_utils.py
index 18412663a34..f20aa933a3a 100644
--- a/packages/testing/src/execution_testing/base_types/typing_utils.py
+++ b/packages/testing/src/execution_testing/base_types/typing_utils.py
@@ -17,6 +17,7 @@ def unwrap_annotation(hint: Any) -> Any:
Returns:
The unwrapped base type
+
"""
type_args = get_args(hint)
if not type_args:
diff --git a/packages/testing/src/execution_testing/checklists/eip_checklist.py b/packages/testing/src/execution_testing/checklists/eip_checklist.py
index 9fb34ef3a80..df0f7f700fa 100644
--- a/packages/testing/src/execution_testing/checklists/eip_checklist.py
+++ b/packages/testing/src/execution_testing/checklists/eip_checklist.py
@@ -257,7 +257,7 @@ class DataPortionVariables(
If the opcode contains variables in its data portion, for
each variable `n` of the opcode that accesses the nth stack
item, test `n` being:
- """
+ """ # noqa: D400,D415
class Top(ChecklistItem):
"""`n` is the top stack item."""
diff --git a/packages/testing/src/execution_testing/checklists/tests/test_checklist_template_consistency.py b/packages/testing/src/execution_testing/checklists/tests/test_checklist_template_consistency.py
index 29c9cc68418..7d8c478c1cb 100644
--- a/packages/testing/src/execution_testing/checklists/tests/test_checklist_template_consistency.py
+++ b/packages/testing/src/execution_testing/checklists/tests/test_checklist_template_consistency.py
@@ -81,8 +81,8 @@ def test_checklist_template_consistency() -> None:
if missing_in_checklist:
errors.append(
- f"IDs found in markdown template but missing in EIPChecklist class "
- f"({len(missing_in_checklist)} items):\n"
+ f"IDs found in markdown template but missing in EIPChecklist "
+ f"class ({len(missing_in_checklist)} items):\n"
+ "\n".join(f" - `{id_}`" for id_ in sorted(missing_in_checklist))
)
diff --git a/packages/testing/src/execution_testing/cli/benchmark_parser.py b/packages/testing/src/execution_testing/cli/benchmark_parser.py
index f05612fea65..d8e400952ad 100644
--- a/packages/testing/src/execution_testing/cli/benchmark_parser.py
+++ b/packages/testing/src/execution_testing/cli/benchmark_parser.py
@@ -55,7 +55,8 @@ def visit_FunctionDef(self, node: ast.FunctionDef) -> None:
if not self._has_benchmark_test_param(node):
return
- # Filter for code generator usage (required for fixed-opcode-count mode)
+ # Filter for code generator usage (required for fixed-opcode-count
+ # mode)
if not self._uses_code_generator(node):
return
@@ -149,19 +150,37 @@ def _extract_opcode_name(self, node: ast.expr) -> str | None:
Supported patterns (opcode must be first element):
Case 1 - Direct opcode reference:
+
+ ```python
@pytest.mark.parametrize("opcode", [Op.ADD, Op.MUL])
+ ```
Result: ["ADD", "MUL"]
Case 2a - pytest.param with direct opcode:
- @pytest.mark.parametrize("opcode", [pytest.param(Op.ADD, id="add")])
+
+ ```python
+ @pytest.mark.parametrize(
+ "opcode", [pytest.param(Op.ADD, id="add")]
+ )
+ ```
Result: ["ADD"]
Case 2b - pytest.param with tuple (opcode first):
- @pytest.mark.parametrize("opcode,arg", [pytest.param((Op.ADD, 123))])
+
+ ```python
+ @pytest.mark.parametrize(
+ "opcode,arg", [pytest.param((Op.ADD, 123))]
+ )
+ ```
Result: ["ADD"]
Case 3 - Plain tuple (opcode first):
- @pytest.mark.parametrize("opcode,arg", [(Op.ADD, 123), (Op.MUL, 456)])
+
+ ```python
+ @pytest.mark.parametrize(
+ "opcode,arg", [(Op.ADD, 123), (Op.MUL, 456)]
+ )
+ ```
Result: ["ADD", "MUL"]
"""
# Case 1: Direct opcode - Op.ADD
@@ -200,6 +219,7 @@ def scan_benchmark_tests(
Tuple of (config, pattern_sources) where:
- config: mapping of pattern -> opcode counts
- pattern_sources: mapping of pattern -> source file path
+
"""
config: dict[str, list[int]] = {}
pattern_sources: dict[str, Path] = {}
diff --git a/packages/testing/src/execution_testing/cli/check_fixtures.py b/packages/testing/src/execution_testing/cli/check_fixtures.py
index f5f13b3a0df..c8f53b367ff 100644
--- a/packages/testing/src/execution_testing/cli/check_fixtures.py
+++ b/packages/testing/src/execution_testing/cli/check_fixtures.py
@@ -56,7 +56,9 @@ def check_json(json_file_path: Path) -> None:
raise HashMismatchExceptionError(
original_hash,
new_hash,
- message=f"Fixture hash attributes do not match for {fixture_name}",
+ message=(
+ f"Fixture hash attributes do not match for {fixture_name}"
+ ),
)
if "hash" in fixture.info and fixture.info["hash"] != original_hash:
info_hash = fixture.info["hash"]
@@ -125,7 +127,9 @@ def get_input_files() -> Generator[Path, None, None]:
with Progress(
TextColumn(
- f"[bold cyan]{{task.fields[filename]:<{filename_display_width}}}[/]",
+ "[bold cyan]"
+ f"{{task.fields[filename]:<{filename_display_width}}}"
+ "[/]",
justify="left",
),
BarColumn(
diff --git a/packages/testing/src/execution_testing/cli/diff_opcode_counts.py b/packages/testing/src/execution_testing/cli/diff_opcode_counts.py
index d256b0e97c9..8922f5ff079 100644
--- a/packages/testing/src/execution_testing/cli/diff_opcode_counts.py
+++ b/packages/testing/src/execution_testing/cli/diff_opcode_counts.py
@@ -135,9 +135,11 @@ def compare_opcode_counts(
"--remove-from-fixture-names",
"-r",
multiple=True,
- help="String to be removed from the fixture name, in case the fixture names have changed, "
- "in order to make the comparison easier. "
- "Can be specified multiple times.",
+ help=(
+ "String to be removed from the fixture name, in case the fixture "
+ "names have changed, in order to make the comparison easier. "
+ "Can be specified multiple times."
+ ),
)
def main(
base: Path,
@@ -205,7 +207,8 @@ def main(
)
elif show_common:
print(
- f"\n{common_with_same_counts} fixtures have identical opcode counts"
+ f"\n{common_with_same_counts} fixtures have identical opcode "
+ "counts"
)
diff --git a/packages/testing/src/execution_testing/cli/eest/commands/info.py b/packages/testing/src/execution_testing/cli/eest/commands/info.py
index b09c73a52a8..06eeda8a16d 100644
--- a/packages/testing/src/execution_testing/cli/eest/commands/info.py
+++ b/packages/testing/src/execution_testing/cli/eest/commands/info.py
@@ -39,11 +39,12 @@ def info() -> None:
version = AppConfig().version
+ git_commit = get_current_commit_hash_or_tag(shorten_hash=True)
info_text = f"""
{title} {click.style(f"v{version}", fg="blue", bold=True)}
{"โ" * 50}
- Git commit: {click.style(get_current_commit_hash_or_tag(shorten_hash=True), fg="yellow")}
+ Git commit: {click.style(git_commit, fg="yellow")}
Python: {click.style(platform.python_version(), fg="blue")}
uv: {click.style(get_uv_version(), fg="magenta")}
OS: {click.style(f"{platform.system()} {platform.release()}", fg="cyan")}
diff --git a/packages/testing/src/execution_testing/cli/eest/make/commands/test.py b/packages/testing/src/execution_testing/cli/eest/make/commands/test.py
index 19107854299..0e3750d2ec6 100644
--- a/packages/testing/src/execution_testing/cli/eest/make/commands/test.py
+++ b/packages/testing/src/execution_testing/cli/eest/make/commands/test.py
@@ -170,10 +170,12 @@ def test() -> None:
if fork in [dev_fork.name() for dev_fork in get_development_forks()]:
fork_option = f" --until={fork}"
+ docs_url = DocsConfig().DOCS_URL__WRITING_TESTS
click.echo(
click.style(
- f"\n ๐ Get started with tests: {DocsConfig().DOCS_URL__WRITING_TESTS}"
- f"\n โฝ To fill this test, run: `uv run fill {module_path}{fork_option}`",
+ f"\n ๐ Get started with tests: {docs_url}"
+ f"\n โฝ To fill this test, run: "
+ f"`uv run fill {module_path}{fork_option}`",
fg="cyan",
)
)
diff --git a/packages/testing/src/execution_testing/cli/eest/quotes.py b/packages/testing/src/execution_testing/cli/eest/quotes.py
index ea67650e002..d376cb47022 100644
--- a/packages/testing/src/execution_testing/cli/eest/quotes.py
+++ b/packages/testing/src/execution_testing/cli/eest/quotes.py
@@ -6,22 +6,33 @@
make_something_great = [
"๐จ Simplicity is the ultimate sophistication. - Leonardo D.",
"๐๏ธ Simplicity is an acquired taste. - Katharine G.",
- "๐ก To create a memorable design you need to start with a thought thatโs worth remembering."
- " - Thomas M.",
+ (
+ "๐ก To create a memorable design you need to start with a thought "
+ "that's worth remembering. - Thomas M."
+ ),
"๐ Well begun is half done. - Aristotle",
- "๐๏ธ Designers are crazy and yet sane enough to know where to draw the line. - Benjamin W.",
+ (
+ "๐๏ธ Designers are crazy and yet sane enough to know where to draw "
+ "the line. - Benjamin W."
+ ),
"๐ Creativity is piercing the mundane to find the marvelous. - Bill M.",
"๐ Mistakes are the portals of discovery. - James J.",
- "๐ง It's extremely difficult to be simultaneously concerned with the end-user experience of"
- " whatever it is that you're building and the architecture of the program that delivers that"
- " experience. - James H.",
+ (
+ "๐ง It's extremely difficult to be simultaneously concerned with the "
+ "end-user experience of whatever it is that you're building and the "
+ "architecture of the program that delivers that experience. - James H."
+ ),
"๐ง Good design is a lot like clear thinking made visual. - Edward T.",
- "๐ Innovation leads one to see the new in the old and distinguishes the ingenious from the"
- " ingenuous. - Paul R.",
+ (
+ "๐ Innovation leads one to see the new in the old and distinguishes "
+ "the ingenious from the ingenuous. - Paul R."
+ ),
"๐ฎ The best way to predict the future is to invent it. - Alan K.",
- "๐ Perfection is achieved, not when there is nothing more to add, but when there is nothing"
- " left to take away. - Antoine d.",
- "๐ You canโt improve what you donโt measure. - Tom D.",
+ (
+ "๐ Perfection is achieved, not when there is nothing more to add, "
+ "but when there is nothing left to take away. - Antoine d."
+ ),
+ "๐ You can't improve what you don't measure. - Tom D.",
]
diff --git a/packages/testing/src/execution_testing/cli/evm_bytes.py b/packages/testing/src/execution_testing/cli/evm_bytes.py
index ce5a1c6390a..00043451cbc 100644
--- a/packages/testing/src/execution_testing/cli/evm_bytes.py
+++ b/packages/testing/src/execution_testing/cli/evm_bytes.py
@@ -107,9 +107,9 @@ def process_evm_bytes(evm_bytes: bytes) -> List[OpcodeWithOperands]: # noqa: D1
return opcodes
-def format_opcodes(
+def format_opcodes( # noqa: D103
opcodes: List[OpcodeWithOperands], assembly: bool = False
-) -> str: # noqa: D103
+) -> str:
if assembly:
opcodes_with_empty_lines: List[OpcodeWithOperands] = []
for i, op_with_operands in enumerate(opcodes):
diff --git a/packages/testing/src/execution_testing/cli/extract_config.py b/packages/testing/src/execution_testing/cli/extract_config.py
index 29397582b59..10cf25c9657 100755
--- a/packages/testing/src/execution_testing/cli/extract_config.py
+++ b/packages/testing/src/execution_testing/cli/extract_config.py
@@ -27,7 +27,7 @@
)
from execution_testing.base_types import Alloc
-from execution_testing.cli.pytest_commands.plugins.consume.simulators.helpers.ruleset import (
+from execution_testing.cli.pytest_commands.plugins.consume.simulators.helpers.ruleset import ( # noqa: E501
ruleset,
)
from execution_testing.fixtures import (
@@ -130,6 +130,8 @@ def extract_client_files(
class GenesisState(BaseModel):
+ """Model representing genesis state for configuration extraction."""
+
header: FixtureHeader
alloc: Alloc
chain_id: int = Field(exclude=True)
@@ -139,6 +141,7 @@ class GenesisState(BaseModel):
def serialize_model(
self, handler: SerializerFunctionWrapHandler
) -> dict[str, object]:
+ """Serialize the genesis state model to a dictionary."""
serialized = handler(self)
output = serialized["header"]
output["alloc"] = {
@@ -189,9 +192,7 @@ def from_fixture(cls, fixture_path: Path) -> Self:
)
def get_client_environment(self) -> dict:
- """
- Get the environment variables for starting a client with the given fixture.
- """
+ """Get the env vars to start a client with a fixture."""
if self.fork not in ruleset:
raise ValueError(f"Fork '{self.fork}' not found in hive ruleset")
@@ -199,7 +200,8 @@ def get_client_environment(self) -> dict:
"HIVE_CHAIN_ID": str(self.chain_id),
"HIVE_FORK_DAO_VOTE": "1",
"HIVE_NODETYPE": "full",
- "HIVE_CHECK_LIVE_PORT": "8545", # Using RPC port for liveness check
+ # Using RPC port for liveness check
+ "HIVE_CHECK_LIVE_PORT": "8545",
**{k: f"{v:d}" for k, v in ruleset[self.fork].items()},
}
@@ -324,14 +326,16 @@ def extract_config(
if len(new_containers) != 1:
click.echo(
- f"Expected exactly 1 new container, found {len(new_containers)}",
+ f"Expected exactly 1 new container, found "
+ f"{len(new_containers)}",
err=True,
)
sys.exit(1)
container_id = new_containers.pop()
click.echo(
- f"Client started successfully (Container ID: {container_id})"
+ f"Client started successfully "
+ f"(Container ID: {container_id})"
)
# Optionally list files in container
diff --git a/packages/testing/src/execution_testing/cli/fillerconvert/verify_filled.py b/packages/testing/src/execution_testing/cli/fillerconvert/verify_filled.py
index ed0c17e176a..7e0555d3a9a 100644
--- a/packages/testing/src/execution_testing/cli/fillerconvert/verify_filled.py
+++ b/packages/testing/src/execution_testing/cli/fillerconvert/verify_filled.py
@@ -79,7 +79,8 @@ def verify_refilled(refilled: Path, original: Path) -> int:
f"test_name: {refilled_test_name}\n"
f"original_name: {original}\n"
f"refilled_hash: {refilled_result[0].hash}\n"
- f"original_hash: {res.hash} f: {refilled_fork}, d: {d}, g: {g}, v: {v}"
+ f"original_hash: {res.hash} "
+ f"f: {refilled_fork}, d: {d}, g: {g}, v: {v}"
)
found = True
verified_vectors += 1
diff --git a/packages/testing/src/execution_testing/cli/fuzzer_bridge/cli.py b/packages/testing/src/execution_testing/cli/fuzzer_bridge/cli.py
index 9fbc326853e..7d463fd2644 100644
--- a/packages/testing/src/execution_testing/cli/fuzzer_bridge/cli.py
+++ b/packages/testing/src/execution_testing/cli/fuzzer_bridge/cli.py
@@ -330,7 +330,8 @@ def process_directory_parallel(
error_file, exception = error
if not quiet:
progress.console.print(
- f"[red]Error processing {error_file}: {exception}[/red]"
+ f"[red]Error processing {error_file}: "
+ f"{exception}[/red]"
)
# Update progress bar
@@ -365,10 +366,11 @@ def process_directory_parallel(
# Final status
if not quiet:
emoji = "โ
" if error_count == 0 else "โ ๏ธ"
+ status = f"Done! {success_count} succeeded, {error_count} failed"
progress.update(
task_id,
completed=file_count,
- filename=f"Done! {success_count} succeeded, {error_count} failed {emoji}",
+ filename=f"{status} {emoji}",
workers=num_workers,
)
@@ -483,10 +485,11 @@ def process_directory(
# Final status
if not quiet:
emoji = "โ
" if error_count == 0 else "โ ๏ธ"
+ status = f"Done! {success_count} succeeded, {error_count} failed"
progress.update(
task_id,
completed=file_count,
- filename=f"Done! {success_count} succeeded, {error_count} failed {emoji}",
+ filename=f"{status} {emoji}",
)
@@ -667,7 +670,9 @@ def batch_mode(
"--workers",
type=int,
default=None,
- help="Number of parallel workers (default: auto-detect based on CPU count)",
+ help=(
+ "Number of parallel workers (default: auto-detect based on CPU count)"
+ ),
)
@click.option(
"-b",
@@ -680,8 +685,10 @@ def batch_mode(
"--block-strategy",
type=click.Choice(["distribute", "first-block"]),
default="distribute",
- help="Transaction distribution strategy: 'distribute' splits txs evenly, "
- "'first-block' puts all txs in first block (default: distribute)",
+ help=(
+ "Transaction distribution strategy: 'distribute' splits txs evenly, "
+ "'first-block' puts all txs in first block (default: distribute)"
+ ),
)
@click.option(
"--block-time",
@@ -739,7 +746,8 @@ def main(
# Standard mode: require input_path and output_path
if input_path is None or output_path is None:
raise click.UsageError(
- "INPUT_PATH and OUTPUT_PATH are required when not using --batch mode"
+ "INPUT_PATH and OUTPUT_PATH are required when not using "
+ "--batch mode"
)
# Create transition tool
t8n: TransitionTool
diff --git a/packages/testing/src/execution_testing/cli/fuzzer_bridge/converter.py b/packages/testing/src/execution_testing/cli/fuzzer_bridge/converter.py
index 1e62214bbcb..ca575b42e59 100644
--- a/packages/testing/src/execution_testing/cli/fuzzer_bridge/converter.py
+++ b/packages/testing/src/execution_testing/cli/fuzzer_bridge/converter.py
@@ -155,7 +155,8 @@ def create_sender_eoa_map(
# Verify private key matches address (safety check)
assert Address(sender) == addr, (
- f"Private key for account {addr} does not match derived address {sender}"
+ f"Private key for account {addr} does not match derived "
+ f"address {sender}"
)
senders[addr] = sender
diff --git a/packages/testing/src/execution_testing/cli/gen_index.py b/packages/testing/src/execution_testing/cli/gen_index.py
index cd80748c1f4..1e4af37cf1a 100644
--- a/packages/testing/src/execution_testing/cli/gen_index.py
+++ b/packages/testing/src/execution_testing/cli/gen_index.py
@@ -46,8 +46,9 @@ def count_json_files_exclude_index(start_path: Path) -> int:
@click.command(
help=(
- "Generate an index file of all the json fixtures in the specified directory. "
- "The index file is saved as 'index.json' in the specified directory."
+ "Generate an index file of all the json fixtures in the specified "
+ "directory. The index file is saved as 'index.json' in the specified "
+ "directory."
)
)
@click.option(
@@ -124,7 +125,8 @@ def generate_fixtures_index(
):
if not quiet_mode:
rich.print(
- f"Index file [bold cyan]{output_file}[/] is up-to-date."
+ f"Index file [bold cyan]{output_file}[/] "
+ "is up-to-date."
)
return
except Exception as e:
@@ -136,7 +138,9 @@ def generate_fixtures_index(
filename_display_width = 25
with Progress(
TextColumn(
- f"[bold cyan]{{task.fields[filename]:<{filename_display_width}}}[/]",
+ "[bold cyan]"
+ f"{{task.fields[filename]:<{filename_display_width}}}"
+ "[/]",
justify="left",
table_column=Column(ratio=1),
),
diff --git a/packages/testing/src/execution_testing/cli/generate_checklist_stubs.py b/packages/testing/src/execution_testing/cli/generate_checklist_stubs.py
index 300426fc87d..af657eeacf2 100644
--- a/packages/testing/src/execution_testing/cli/generate_checklist_stubs.py
+++ b/packages/testing/src/execution_testing/cli/generate_checklist_stubs.py
@@ -132,7 +132,9 @@ class _CallableChecklistItem:
@overload
def __call__(self, func: F) -> F: ...
@overload
- def __call__(self, *, eip: Any = ..., **kwargs: Any) -> pytest.MarkDecorator: ...
+ def __call__(
+ self, *, eip: Any = ..., **kwargs: Any
+ ) -> pytest.MarkDecorator: ...
def __str__(self) -> str: ...
'''
@@ -173,11 +175,12 @@ def __str__(self) -> str: ...
)
click.echo(
- "\n๐ก This stub file helps mypy understand that EIPChecklist classes are callable."
+ "\n๐ก This stub file helps mypy understand that EIPChecklist "
+ "classes are callable."
)
click.echo(
- " You can now use @EIPChecklist.Opcode.Test.StackComplexOperations() "
- "without type errors!"
+ " You can now use @EIPChecklist.Opcode.Test."
+ "StackComplexOperations() without type errors!"
)
except ImportError as e:
diff --git a/packages/testing/src/execution_testing/cli/gentest/test_context_providers.py b/packages/testing/src/execution_testing/cli/gentest/test_context_providers.py
index 989796648e4..b7163fc7c82 100644
--- a/packages/testing/src/execution_testing/cli/gentest/test_context_providers.py
+++ b/packages/testing/src/execution_testing/cli/gentest/test_context_providers.py
@@ -48,7 +48,8 @@ def _make_rpc_calls(self) -> None:
"""Make RPC calls to fetch transaction and block data."""
request = RPCRequest()
print(
- f"Perform tx request: eth_get_transaction_by_hash({self.transaction_hash})",
+ f"Perform tx request: eth_get_transaction_by_hash"
+ f"({self.transaction_hash})",
file=stderr,
)
self.transaction_response = request.eth_get_transaction_by_hash(
diff --git a/packages/testing/src/execution_testing/cli/hasher.py b/packages/testing/src/execution_testing/cli/hasher.py
index 894ee45195c..ecb49665ac8 100644
--- a/packages/testing/src/execution_testing/cli/hasher.py
+++ b/packages/testing/src/execution_testing/cli/hasher.py
@@ -90,7 +90,8 @@ def from_json_file(
if not isinstance(hash_value, str):
raise TypeError(
- f"Expected hash to be a string in {key}, got {type(hash_value)}"
+ f"Expected hash to be a string in {key}, "
+ f"got {type(hash_value)}"
)
item_hash_bytes = bytes.fromhex(hash_value[2:])
diff --git a/packages/testing/src/execution_testing/cli/modify_static_test_gas_limits.py b/packages/testing/src/execution_testing/cli/modify_static_test_gas_limits.py
index 47087254d9f..70b0d1c1ec8 100644
--- a/packages/testing/src/execution_testing/cli/modify_static_test_gas_limits.py
+++ b/packages/testing/src/execution_testing/cli/modify_static_test_gas_limits.py
@@ -16,7 +16,7 @@
HexNumber,
ZeroPaddedHexNumber,
)
-from execution_testing.cli.pytest_commands.plugins.filler.static_filler import (
+from execution_testing.cli.pytest_commands.plugins.filler.static_filler import ( # noqa: E501
NoIntResolver,
)
from execution_testing.specs import StateStaticTest
@@ -77,8 +77,9 @@ def _check_fixtures(
try:
parsed_test_file = StaticTestFile.model_validate(loaded_yaml)
except Exception as e:
+ yaml_dump = json.dumps(loaded_yaml, indent=2)
raise Exception(
- f"Unable to parse file {test_file}: {json.dumps(loaded_yaml, indent=2)}"
+ f"Unable to parse file {test_file}: {yaml_dump}"
) from e
else:
parsed_test_file = StaticTestFile.model_validate_json(
@@ -95,7 +96,8 @@ def _check_fixtures(
if len(parsed_test.transaction.gas_limit) != 1:
if dry_run or verbose:
print(
- f"Test file {test_file} contains more than one test (after parsing), skipping."
+ f"Test file {test_file} contains more than one test "
+ "(after parsing), skipping."
)
continue
@@ -113,8 +115,8 @@ def _check_fixtures(
if gas_value is None:
if dry_run or verbose:
print(
- f"Test file {test_file} contains at least one test that cannot "
- "be updated, skipping."
+ f"Test file {test_file} contains at least one test "
+ "that cannot be updated, skipping."
)
continue
else:
@@ -134,13 +136,15 @@ def _check_fixtures(
if max_gas_limit is not None and new_gas_limit > max_gas_limit:
if dry_run or verbose:
print(
- f"New gas limit ({new_gas_limit}) exceeds max ({max_gas_limit})"
+ f"New gas limit ({new_gas_limit}) "
+ f"exceeds max ({max_gas_limit})"
)
continue
if dry_run or verbose:
print(
- f"Test file {test_file} requires modification ({new_gas_limit})"
+ f"Test file {test_file} requires modification "
+ f"({new_gas_limit})"
)
# Find the appropriate pattern to replace the current gas limit
@@ -171,7 +175,8 @@ def _check_fixtures(
# Validate that a replacement pattern was found
assert substitute_pattern is not None, (
- f"Current gas limit ({attempted_patterns}) not found in {test_file}"
+ f"Current gas limit ({attempted_patterns}) "
+ f"not found in {test_file}"
)
assert substitute_string is not None
@@ -212,15 +217,19 @@ def _check_fixtures(
exists=True, file_okay=True, dir_okay=False, readable=True
),
required=True,
- help="The input json file or directory containing json listing the new gas limits for the "
- "static test files.",
+ help=(
+ "The input json file or directory containing json listing the new "
+ "gas limits for the static test files."
+ ),
)
@click.option(
"--max-gas-limit",
default=MAX_GAS_LIMIT,
expose_value=True,
- help="Gas limit that triggers a test modification, and also the maximum value that a test "
- "should have after modification.",
+ help=(
+ "Gas limit that triggers a test modification, and also the maximum "
+ "value that a test should have after modification."
+ ),
)
@click.option(
"--dry-run",
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/checklist.py b/packages/testing/src/execution_testing/cli/pytest_commands/checklist.py
index e76d09396fe..e51f3cc593a 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/checklist.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/checklist.py
@@ -13,7 +13,7 @@
"-o",
type=click.Path(file_okay=False, dir_okay=True, writable=True),
default="./checklists",
- help="Directory to output the generated checklists (default: ./checklists)",
+ help="Directory to output checklists (default: ./checklists)",
)
@click.option(
"--eip",
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/fill.py b/packages/testing/src/execution_testing/cli/pytest_commands/fill.py
index 5d58519411c..d9296c91a37 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/fill.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/fill.py
@@ -100,7 +100,7 @@ def _create_single_phase_with_pre_alloc_groups(
]
def _add_default_ignores(self, args: List[str]) -> List[str]:
- """Add default ignore paths for directories not used by fill command."""
+ """Add default ignore paths for directories not used by fill."""
# Directories to ignore by default
default_ignores = [
"tests/evm_tools",
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/consume.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/consume.py
index 0f069b61df1..f95ad6bf1fa 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/consume.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/consume.py
@@ -289,7 +289,8 @@ def validate_local_path(path: Path) -> "FixturesSource":
)
if not any(path.glob("**/*.json")):
pytest.exit(
- f"Specified fixture directory '{path}' does not contain any JSON files."
+ f"Specified fixture directory '{path}' does not contain "
+ "any JSON files."
)
return FixturesSource(input_option=str(path), path=path)
@@ -361,10 +362,11 @@ def pytest_addoption(parser: pytest.Parser) -> None: # noqa: D103
dest="fixtures_source",
default=None,
help=(
- "Specify the JSON test fixtures source. Can be a local directory, a URL pointing to a "
- " fixtures.tar.gz archive, a release name and version in the form of `NAME@v1.2.3` "
- "(`stable` and `develop` are valid release names, and `latest` is a valid version), "
- "or the special keyword 'stdin'. "
+ "Specify the JSON test fixtures source. Can be a local "
+ "directory, a URL pointing to a fixtures.tar.gz archive, a "
+ "release name and version in the form of `NAME@v1.2.3` "
+ "(`stable` and `develop` are valid release names, and `latest` "
+ "is a valid version), or the special keyword 'stdin'. "
f"Defaults to the following local directory: '{default_input()}'."
),
)
@@ -375,7 +377,8 @@ def pytest_addoption(parser: pytest.Parser) -> None: # noqa: D103
default=CACHED_DOWNLOADS_DIRECTORY,
help=(
"Specify the path where the downloaded fixtures are cached. "
- f"Defaults to the following directory: '{CACHED_DOWNLOADS_DIRECTORY}'."
+ "Defaults to the following directory: "
+ f"'{CACHED_DOWNLOADS_DIRECTORY}'."
),
)
consume_group.addoption(
@@ -384,9 +387,10 @@ def pytest_addoption(parser: pytest.Parser) -> None: # noqa: D103
dest="extract_to_folder",
default=None,
help=(
- "Extract downloaded fixtures to the specified directory. Only valid with 'cache' "
- "command. When used, fixtures are extracted directly to this path instead of the "
- "user's execution-spec-tests cache directory."
+ "Extract downloaded fixtures to the specified directory. Only "
+ "valid with 'cache' command. When used, fixtures are extracted "
+ "directly to this path instead of the user's execution-spec-"
+ "tests cache directory."
),
)
if "cache" in sys.argv:
@@ -408,13 +412,16 @@ def pytest_addoption(parser: pytest.Parser) -> None: # noqa: D103
type=SimLimitBehavior.from_string,
default=SimLimitBehavior(".*"),
help=(
- "Filter tests by either a regex pattern or a literal test case ID. To match a "
- "test case by its exact ID, prefix the ID with `id:`. The string following `id:` "
- "will be automatically escaped so that all special regex characters are treated as "
- "literals. Without the `id:` prefix, the argument is interpreted as a Python regex "
- "pattern. To see which test cases are matched, without executing them, prefix with "
- '`collectonly:`, e.g. `--sim.limit "collectonly:.*eip4788.*fork_Prague.*"`. '
- "To list all available test case IDs, set the value to `collectonly`."
+ "Filter tests by either a regex pattern or a literal test case "
+ "ID. To match a test case by its exact ID, prefix the ID with "
+ "`id:`. The string following `id:` will be automatically escaped "
+ "so that all special regex characters are treated as literals. "
+ "Without the `id:` prefix, the argument is interpreted as a "
+ "Python regex pattern. To see which test cases are matched, "
+ "without executing them, prefix with `collectonly:`, e.g. "
+ '`--sim.limit "collectonly:.*eip4788.*fork_Prague.*"`. '
+ "To list all available test case IDs, set the value to "
+ "`collectonly`."
),
)
@@ -498,7 +505,8 @@ def pytest_configure(config: pytest.Config) -> None: # noqa: D103
for fixture_format in BaseFixture.formats.values():
config.addinivalue_line(
"markers",
- f"{fixture_format.format_name}: Tests in `{fixture_format.format_name}` format ",
+ f"{fixture_format.format_name}: "
+ f"Tests in `{fixture_format.format_name}` format ",
)
# All forked defined within EEST
@@ -518,8 +526,8 @@ def pytest_configure(config: pytest.Config) -> None: # noqa: D103
if config.option.sim_limit:
if config.option.dest_regex != ".*":
pytest.exit(
- "Both the --sim.limit (via env var?) and the --regex flags are set. "
- "Please only set one of them."
+ "Both the --sim.limit (via env var?) and the --regex flags "
+ "are set. Please only set one of them."
)
config.option.dest_regex = config.option.sim_limit.pattern
if config.option.sim_limit.collectonly:
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/direct/conftest.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/direct/conftest.py
index 14d47448848..980c4218768 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/direct/conftest.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/direct/conftest.py
@@ -64,8 +64,9 @@ def pytest_addoption(parser: pytest.Parser) -> None: # noqa: D103
type=Path,
default=[],
help=(
- "Path to a geth evm executable that provides `blocktest` or `statetest`. "
- "Flag can be used multiple times to specify multiple fixture consumer binaries."
+ "Path to a geth evm executable that provides `blocktest` or "
+ "`statetest`. Flag can be used multiple times to specify "
+ "multiple fixture consumer binaries."
),
)
consume_group.addoption(
@@ -73,7 +74,10 @@ def pytest_addoption(parser: pytest.Parser) -> None: # noqa: D103
action="store_true",
dest="consumer_collect_traces",
default=False,
- help="Collect traces of the execution information from the fixture consumer tool.",
+ help=(
+ "Collect traces of the execution information from the fixture "
+ "consumer tool."
+ ),
)
debug_group = parser.getgroup("debug", "Arguments defining debug behavior")
debug_group.addoption(
@@ -104,16 +108,18 @@ def pytest_configure(config: pytest.Config) -> None: # noqa: D103
elif not fixture_consumers and config.option.collectonly:
warnings.warn(
(
- "No fixture consumer binaries provided; using a dummy consumer for collect-only; "
- "all possible fixture formats will be collected. "
- "Specify fixture consumer(s) via `--bin` to see actual collection results."
+ "No fixture consumer binaries provided; using a dummy "
+ "consumer for collect-only; all possible fixture formats "
+ "will be collected. Specify fixture consumer(s) via `--bin` "
+ "to see actual collection results."
),
stacklevel=1,
)
fixture_consumers = [CollectOnlyFixtureConsumer()]
elif not fixture_consumers:
pytest.exit(
- "No fixture consumer binaries provided; please specify a binary path via `--bin`."
+ "No fixture consumer binaries provided; please specify a binary "
+ "path via `--bin`."
)
config.fixture_consumers = fixture_consumers # type: ignore[attr-defined]
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/base.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/base.py
index 09225a01a03..cd80201b905 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/base.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/base.py
@@ -33,7 +33,8 @@ def check_live_port(test_suite_name: str) -> Literal[8545, 8551]:
elif test_suite_name in {"eels/consume-engine", "eels/consume-sync"}:
return 8551
raise ValueError(
- f"Unexpected test suite name '{test_suite_name}' while setting HIVE_CHECK_LIVE_PORT."
+ f"Unexpected test suite name '{test_suite_name}' while setting "
+ "HIVE_CHECK_LIVE_PORT."
)
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/exceptions.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/exceptions.py
index ca1de25f9f1..9201cd24036 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/exceptions.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/exceptions.py
@@ -24,8 +24,8 @@ def pytest_addoption(parser: pytest.Parser) -> None:
dest="disable_strict_exception_matching",
default="",
help=(
- "Comma-separated list of client names and/or forks which should NOT use strict "
- "exception matching."
+ "Comma-separated list of client names and/or forks which should "
+ "NOT use strict exception matching."
),
)
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/helpers/exceptions.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/helpers/exceptions.py
index 5e70675ada2..b8c451c0726 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/helpers/exceptions.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/helpers/exceptions.py
@@ -73,7 +73,10 @@ def __init__(
"\nIs the fork configuration correct?"
)
else:
- message += "There were no differences in the expected and received genesis block headers."
+ message += (
+ "There were no differences in the expected and received "
+ "genesis block headers."
+ )
super().__init__(message)
@staticmethod
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/helpers/timing.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/helpers/timing.py
index 1ae83a17b6a..5201938b4b7 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/helpers/timing.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/helpers/timing.py
@@ -49,9 +49,10 @@ def formatted(self, precision: int = 4, indent: int = 0) -> str:
"""Recursively format the timing data with correct indentation."""
assert self.start_time is not None
assert self.end_time is not None
+ time_diff = self.end_time - self.start_time
formatted = (
f"{' ' * indent}{self.name}: "
- f"{TimingData.format_float(self.end_time - self.start_time, precision)}\n"
+ f"{TimingData.format_float(time_diff, precision)}\n"
)
for timing in self.timings:
formatted += timing.formatted(precision, indent + 2)
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/rlp/conftest.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/rlp/conftest.py
index 8fa162f152e..a24425d4dd5 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/rlp/conftest.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/rlp/conftest.py
@@ -38,7 +38,10 @@ def test_suite_name() -> str:
@pytest.fixture(scope="module")
def test_suite_description() -> str:
"""The description of the hive test suite used in this simulator."""
- return "Execute blockchain tests by providing RLP-encoded blocks to a client upon start-up."
+ return (
+ "Execute blockchain tests by providing RLP-encoded blocks to a "
+ "client upon start-up."
+ )
@pytest.fixture(scope="function")
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/simulator_logic/test_via_engine.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/simulator_logic/test_via_engine.py
index f6a1973b12a..9abe0c74a0c 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/simulator_logic/test_via_engine.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/simulator_logic/test_via_engine.py
@@ -77,7 +77,8 @@ def test_blockchain_via_engine(
expected = fixture.genesis.block_hash
got = genesis_block["hash"]
logger.fail(
- f"Genesis block hash mismatch. Expected: {expected}, Got: {got}"
+ f"Genesis block hash mismatch. "
+ f"Expected: {expected}, Got: {got}"
)
raise GenesisBlockMismatchExceptionError(
expected_header=fixture.genesis,
@@ -98,17 +99,15 @@ def test_blockchain_via_engine(
with payload_timing.time(
f"engine_newPayloadV{payload.new_payload_version}"
):
- logger.info(
- f"Sending engine_newPayloadV{payload.new_payload_version}..."
- )
+ version = payload.new_payload_version
+ logger.info(f"Sending engine_newPayloadV{version}...")
try:
payload_response = engine_rpc.new_payload(
*payload.params,
version=payload.new_payload_version,
)
- logger.info(
- f"Payload response status: {payload_response.status}"
- )
+ status = payload_response.status
+ logger.info(f"Payload response status: {status}")
expected_validity = (
PayloadStatusEnum.VALID
if payload.valid()
@@ -121,8 +120,8 @@ def test_blockchain_via_engine(
)
if payload.error_code is not None:
raise LoggedError(
- f"Client failed to raise expected Engine API error code: "
- f"{payload.error_code}"
+ "Client failed to raise expected Engine API "
+ f"error code: {payload.error_code}"
)
elif (
payload_response.status
@@ -130,7 +129,8 @@ def test_blockchain_via_engine(
):
if payload_response.validation_error is None:
raise LoggedError(
- "Client returned INVALID but no validation error was provided."
+ "Client returned INVALID but no "
+ "validation error was provided."
)
if isinstance(
payload_response.validation_error,
@@ -138,9 +138,12 @@ def test_blockchain_via_engine(
):
message = (
"Undefined exception message: "
- f'expected exception: "{payload.validation_error}", '
- f'returned exception: "{payload_response.validation_error}" '
- f'(mapper: "{payload_response.validation_error.mapper_name}")'
+ f"expected exception: "
+ f'"{payload.validation_error}", '
+ f"returned exception: "
+ f'"{payload_response.validation_error}" '
+ f"(mapper: "
+ f'"{payload_response.validation_error.mapper_name}")' # noqa: E501
)
if strict_exception_matching:
raise LoggedError(message)
@@ -152,9 +155,12 @@ def test_blockchain_via_engine(
not in payload_response.validation_error
):
message = (
- "Client returned unexpected validation error: "
- f'got: "{payload_response.validation_error}" '
- f'expected: "{payload.validation_error}"'
+ "Client returned unexpected "
+ "validation error: "
+ f"got: "
+ f'"{payload_response.validation_error}" ' # noqa: E501
+ f"expected: "
+ f'"{payload.validation_error}"'
)
if strict_exception_matching:
raise LoggedError(message)
@@ -163,7 +169,8 @@ def test_blockchain_via_engine(
except JSONRPCError as e:
logger.info(
- f"JSONRPC error encountered: {e.code} - {e.message}"
+ f"JSONRPC error encountered: "
+ f"{e.code} - {e.message}"
)
if payload.error_code is None:
raise LoggedError(
@@ -171,7 +178,8 @@ def test_blockchain_via_engine(
) from e
if e.code != payload.error_code:
raise LoggedError(
- f"Unexpected error code: {e.code}, expected: {payload.error_code}"
+ f"Unexpected error code: {e.code}, "
+ f"expected: {payload.error_code}"
) from e
if payload.valid():
@@ -196,8 +204,9 @@ def test_blockchain_via_engine(
forkchoice_response.payload_status.status
!= PayloadStatusEnum.VALID
):
+ status = forkchoice_response.payload_status.status
raise LoggedError(
- f"unexpected status: want {PayloadStatusEnum.VALID},"
- f" got {forkchoice_response.payload_status.status}"
+ f"unexpected status: want "
+ f"{PayloadStatusEnum.VALID}, got {status}"
)
logger.info("All payloads processed successfully.")
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/simulator_logic/test_via_rlp.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/simulator_logic/test_via_rlp.py
index ef85b9f55f4..b219edf74e2 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/simulator_logic/test_via_rlp.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/simulator_logic/test_via_rlp.py
@@ -64,7 +64,8 @@ def test_via_rlp(
fixture_value = last_block_header[block_field]
if str(block_value) != str(fixture_value):
mismatches.append(
- f" {block_field}: got `{block_value}`, expected `{fixture_value}`"
+ f" {block_field}: got `{block_value}`, "
+ f"expected `{fixture_value}`"
)
raise AssertionError(
"blockHash mismatch in last block - field mismatches:"
@@ -72,6 +73,7 @@ def test_via_rlp(
)
except Exception:
raise AssertionError(
- f"blockHash mismatch in last block: got `{block['hash']}`, "
+ f"blockHash mismatch in last block: "
+ f"got `{block['hash']}`, "
f"expected `{fixture.last_block_hash}`"
) from None
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/simulator_logic/test_via_sync.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/simulator_logic/test_via_sync.py
index 9369b18940a..a989ed5b48a 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/simulator_logic/test_via_sync.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/simulator_logic/test_via_sync.py
@@ -97,7 +97,8 @@ def test_blockchain_via_sync(
expected = fixture.genesis.block_hash
got = genesis_block["hash"]
logger.fail(
- f"Genesis block hash mismatch. Expected: {expected}, Got: {got}"
+ f"Genesis block hash mismatch. "
+ f"Expected: {expected}, Got: {got}"
)
raise GenesisBlockMismatchExceptionError(
expected_header=fixture.genesis,
@@ -122,18 +123,16 @@ def test_blockchain_via_sync(
with payload_timing.time(
f"engine_newPayloadV{payload.new_payload_version}"
):
- logger.info(
- f"Sending engine_newPayloadV{payload.new_payload_version}..."
- )
+ version = payload.new_payload_version
+ logger.info(f"Sending engine_newPayloadV{version}...")
# Note: This is similar to the logic in test_via_engine.py
try:
payload_response = engine_rpc.new_payload(
*payload.params,
version=payload.new_payload_version,
)
- logger.info(
- f"Payload response status: {payload_response.status}"
- )
+ status = payload_response.status
+ logger.info(f"Payload response status: {status}")
expected_validity = (
PayloadStatusEnum.VALID
if payload.valid()
@@ -146,8 +145,8 @@ def test_blockchain_via_sync(
)
if payload.error_code is not None:
raise LoggedError(
- f"Client failed to raise expected Engine API error code: "
- f"{payload.error_code}"
+ "Client failed to raise expected Engine API "
+ f"error code: {payload.error_code}"
)
elif (
payload_response.status
@@ -155,7 +154,8 @@ def test_blockchain_via_sync(
):
if payload_response.validation_error is None:
raise LoggedError(
- "Client returned INVALID but no validation error was provided."
+ "Client returned INVALID but no "
+ "validation error was provided."
)
if isinstance(
payload_response.validation_error,
@@ -163,9 +163,12 @@ def test_blockchain_via_sync(
):
message = (
"Undefined exception message: "
- f'expected exception: "{payload.validation_error}", '
- f'returned exception: "{payload_response.validation_error}" '
- f'(mapper: "{payload_response.validation_error.mapper_name}")'
+ f"expected exception: "
+ f'"{payload.validation_error}", '
+ f"returned exception: "
+ f'"{payload_response.validation_error}" '
+ f"(mapper: "
+ f'"{payload_response.validation_error.mapper_name}")' # noqa: E501
)
if strict_exception_matching:
raise LoggedError(message)
@@ -177,9 +180,12 @@ def test_blockchain_via_sync(
not in payload_response.validation_error
):
message = (
- "Client returned unexpected validation error: "
- f'got: "{payload_response.validation_error}" '
- f'expected: "{payload.validation_error}"'
+ "Client returned unexpected "
+ "validation error: "
+ f"got: "
+ f'"{payload_response.validation_error}" ' # noqa: E501
+ f"expected: "
+ f'"{payload.validation_error}"'
)
if strict_exception_matching:
raise LoggedError(message)
@@ -188,7 +194,8 @@ def test_blockchain_via_sync(
except JSONRPCError as e:
logger.info(
- f"JSONRPC error encountered: {e.code} - {e.message}"
+ f"JSONRPC error encountered: "
+ f"{e.code} - {e.message}"
)
if payload.error_code is None:
raise LoggedError(
@@ -196,7 +203,8 @@ def test_blockchain_via_sync(
) from e
if e.code != payload.error_code:
raise LoggedError(
- f"Unexpected error code: {e.code}, expected: {payload.error_code}"
+ f"Unexpected error code: {e.code}, "
+ f"expected: {payload.error_code}"
) from e
if payload.valid():
@@ -221,9 +229,10 @@ def test_blockchain_via_sync(
forkchoice_response.payload_status.status
!= PayloadStatusEnum.VALID
):
+ status = forkchoice_response.payload_status.status
raise LoggedError(
- f"unexpected status: want {PayloadStatusEnum.VALID},"
- f" got {forkchoice_response.payload_status.status}"
+ f"unexpected status: want "
+ f"{PayloadStatusEnum.VALID}, got {status}"
)
last_valid_block_hash = payload.params[0].block_hash
@@ -234,7 +243,8 @@ def test_blockchain_via_sync(
# sync_payload creates the final block that the sync client will sync to
if not fixture.sync_payload:
pytest.fail(
- "Sync tests require a syncPayload that is not present in this test."
+ "Sync tests require a syncPayload that is not present in this "
+ "test."
)
with timing_data.time("Send sync payload to client under test"):
@@ -277,7 +287,8 @@ def test_blockchain_via_sync(
)
except JSONRPCError as e:
logger.error(
- f"Error sending sync payload to client under test: {e.code} - {e.message}"
+ f"Error sending sync payload to client under test: "
+ f"{e.code} - {e.message}"
)
raise
@@ -297,12 +308,13 @@ def test_blockchain_via_sync(
)
if response.payload_status.status != PayloadStatusEnum.VALID:
raise LoggedError(
- f"Unexpected status on sync client forkchoice updated to genesis: "
- f"{response.payload_status.status}"
+ "Unexpected status on sync client forkchoice updated to "
+ f"genesis: {response.payload_status.status}"
)
except ForkchoiceUpdateTimeoutError as e:
raise LoggedError(
- f"Timed out waiting for sync client forkchoice update to genesis: {e}"
+ "Timed out waiting for sync client forkchoice update to "
+ f"genesis: {e}"
) from None
# Add peer using admin_addPeer This seems to be required... TODO: we can
@@ -369,13 +381,13 @@ def test_blockchain_via_sync(
*last_valid_payload.params,
version=last_valid_payload.new_payload_version,
)
- logger.info(
- f"Sync client newPayload response: {sync_payload_response.status}"
- )
+ status = sync_payload_response.status
+ logger.info(f"Sync client newPayload response: {status}")
# send forkchoice update pointing to latest block
logger.info(
- "Sending forkchoice update with last valid block to trigger sync..."
+ "Sending forkchoice update with last valid block to trigger "
+ "sync..."
)
sync_forkchoice_response = sync_engine_rpc.forkchoice_updated(
forkchoice_state=last_valid_block_forkchoice_state,
@@ -395,16 +407,18 @@ def test_blockchain_via_sync(
== PayloadStatusEnum.ACCEPTED
):
logger.info(
- "Sync client accepted the block, may start syncing ancestors"
+ "Sync client accepted the block, may start syncing "
+ "ancestors"
)
- # Wait for P2P connections after sync starts
- # Note: Reth does not report peer count but still syncs successfully
+ # Wait for P2P connections after sync starts. Note: Reth does not
+ # report peer count but still syncs successfully
try:
assert sync_net_rpc is not None, "sync_net_rpc is required"
sync_net_rpc.wait_for_peer_connection()
logger.debug(
- "Peer connection verified on sync client after sync trigger"
+ "Peer connection verified on sync client after sync "
+ "trigger"
)
except PeerConnectionTimeoutError:
try:
@@ -419,11 +433,13 @@ def test_blockchain_via_sync(
except Exception as e:
logger.warning(
- f"Failed to trigger sync with newPayload/forkchoice update: {e}"
+ "Failed to trigger sync with newPayload/forkchoice update: "
+ f"{e}"
)
else:
logger.warning(
- f"Could not find payload for block {last_valid_block_hash} to send to sync client"
+ f"Could not find payload for block {last_valid_block_hash} to "
+ "send to sync client"
)
# Wait for synchronization with continuous forkchoice updates
@@ -449,12 +465,14 @@ def test_blockchain_via_sync(
)
if response.payload_status.status != PayloadStatusEnum.VALID:
raise LoggedError(
- f"Sync client failed to sync to block {last_valid_block_hash}: "
- f"unexpected status {response.payload_status.status}"
+ f"Sync client failed to sync to block "
+ f"{last_valid_block_hash}: unexpected status "
+ f"{response.payload_status.status}"
)
except ForkchoiceUpdateTimeoutError as e:
raise LoggedError(
- f"Sync client timed out syncing to block {last_valid_block_hash}: {e}"
+ f"Sync client timed out syncing to block "
+ f"{last_valid_block_hash}: {e}"
) from None
logger.info("Sync verification successful! FCU returned VALID.")
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/single_test_client.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/single_test_client.py
index d6cff56670c..4045f922216 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/single_test_client.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/single_test_client.py
@@ -48,7 +48,8 @@ def environment(
chain_id = str(Number(fixture.config.chain_id))
return {
"HIVE_CHAIN_ID": chain_id,
- "HIVE_NETWORK_ID": chain_id, # Use same value for P2P network compatibility
+ # Use same value for P2P network compatibility
+ "HIVE_NETWORK_ID": chain_id,
"HIVE_FORK_DAO_VOTE": "1",
"HIVE_NODETYPE": "full",
"HIVE_CHECK_LIVE_PORT": str(check_live_port),
@@ -76,7 +77,8 @@ def genesis_header(fixture: BlockchainFixtureCommon) -> FixtureHeader:
@pytest.fixture(scope="function")
def client(
hive_test: HiveTest,
- client_files: dict, # configured within: rlp/conftest.py & engine/conftest.py
+ # configured within: rlp/conftest.py & engine/conftest.py
+ client_files: dict,
environment: dict,
client_type: ClientType,
total_timing_data: TimingData,
@@ -85,9 +87,8 @@ def client(
Initialize the client with the appropriate files and environment variables.
"""
logger.info(f"Starting client ({client_type.name})...")
- logger.debug(
- f"Main client Network ID: {environment.get('HIVE_NETWORK_ID', 'NOT SET!')}"
- )
+ network_id = environment.get("HIVE_NETWORK_ID", "NOT SET!")
+ logger.debug(f"Main client Network ID: {network_id}")
logger.debug(
f"Main client Chain ID: {environment.get('HIVE_CHAIN_ID', 'NOT SET!')}"
)
@@ -98,8 +99,9 @@ def client(
files=client_files,
)
error_message = (
- f"Unable to connect to the client container ({client_type.name}) via Hive during test "
- "setup. Check the client or Hive server logs for more information."
+ f"Unable to connect to the client container ({client_type.name}) "
+ "via Hive during test setup. Check the client or Hive server logs "
+ "for more information."
)
assert client is not None, error_message
logger.info(f"Client ({client_type.name}) ready!")
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/sync/conftest.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/sync/conftest.py
index d4602806259..ad01454d7c7 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/sync/conftest.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/sync/conftest.py
@@ -246,7 +246,8 @@ def sync_client(
assert sync_client is not None, error_message
logger.info(
- f"Sync client ({sync_client_type.name}) started with IP: {sync_client.ip}"
+ f"Sync client ({sync_client_type.name}) started with IP: "
+ f"{sync_client.ip}"
)
yield sync_client
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/test_case_description.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/test_case_description.py
index 421b3103835..d73c00a0a69 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/test_case_description.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/simulators/test_case_description.py
@@ -58,13 +58,15 @@ def hive_clients_yaml_generator_command(
.yaml()
.replace(" ", " ")
)
- return f'echo "\\\n{yaml_content}" > {hive_clients_yaml_target_filename}'
+ target = hive_clients_yaml_target_filename
+ return f'echo "\\\n{yaml_content}" > {target}'
except Exception as e:
raise ValueError(f"Failed to generate YAML: {str(e)}") from e
except ValueError as e:
error_message = str(e)
warnings.warn(
- f"{error_message}. The Hive clients YAML generator command will not be available.",
+ f"{error_message}. The Hive clients YAML generator command will "
+ "not be available.",
stacklevel=2,
)
@@ -72,11 +74,16 @@ def hive_clients_yaml_generator_command(
issue_body = (
f"Error: {error_message}\nHive version: {hive_info.commit}\n"
)
- issue_url = f"https://github.com/ethereum/execution-spec-tests/issues/new?title={urllib.parse.quote(issue_title)}&body={urllib.parse.quote(issue_body)}"
+ issue_url = (
+ "https://github.com/ethereum/execution-spec-tests/issues/new"
+ f"?title={urllib.parse.quote(issue_title)}"
+ f"&body={urllib.parse.quote(issue_body)}"
+ )
return (
f"Error: {error_message}\n"
- f'Please create an issue to report this problem.'
+ f'Please create an issue to report '
+ "this problem."
)
@@ -148,7 +155,10 @@ def hive_dev_command(
Return the command used to instantiate hive alongside the `consume`
command.
"""
- return f"./hive --dev {hive_client_config_file_parameter} --client {client_type.name}"
+ return (
+ f"./hive --dev {hive_client_config_file_parameter} "
+ f"--client {client_type.name}"
+ )
@pytest.fixture(scope="function")
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/tests/test_consume_args.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/tests/test_consume_args.py
index f64c1ba8968..a601e1353e2 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/tests/test_consume_args.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/tests/test_consume_args.py
@@ -201,7 +201,10 @@ def test_consume_simlimit_collectonly(
pytester.copy_example(
name="src/execution_testing/cli/pytest_commands/pytest_ini_files/pytest-consume.ini"
)
- consume_test_path = "src/execution_testing/cli/pytest_commands/plugins/consume/direct/test_via_direct.py"
+ consume_test_path = (
+ "src/execution_testing/cli/pytest_commands/plugins/"
+ "consume/direct/test_via_direct.py"
+ )
args = [
"-c",
"pytest-consume.ini",
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/tests/test_fixtures_source_input_types.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/tests/test_fixtures_source_input_types.py
index 34790d2e824..241fda66d32 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/tests/test_fixtures_source_input_types.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/consume/tests/test_fixtures_source_input_types.py
@@ -113,7 +113,8 @@ def test_output_formatting_without_release_page_for_direct_urls(
elif not config.fixtures_source.is_local:
reason += "Fixtures downloaded and cached."
reason += f"\nPath: {config.fixtures_source.path}"
- reason += f"\nInput: {config.fixtures_source.url or config.fixtures_source.path}"
+ input_val = config.fixtures_source.url or config.fixtures_source.path
+ reason += f"\nInput: {input_val}"
if config.fixtures_source.release_page:
reason += f"\nRelease page: {config.fixtures_source.release_page}"
@@ -144,7 +145,8 @@ def test_output_formatting_with_release_page_for_specs(self) -> None:
elif not config.fixtures_source.is_local:
reason += "Fixtures downloaded and cached."
reason += f"\nPath: {config.fixtures_source.path}"
- reason += f"\nInput: {config.fixtures_source.url or config.fixtures_source.path}"
+ input_val = config.fixtures_source.url or config.fixtures_source.path
+ reason += f"\nInput: {input_val}"
if config.fixtures_source.release_page:
reason += f"\nRelease page: {config.fixtures_source.release_page}"
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/custom_logging/plugin_logging.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/custom_logging/plugin_logging.py
index 6b286404121..3fbba65b27d 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/custom_logging/plugin_logging.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/custom_logging/plugin_logging.py
@@ -9,8 +9,8 @@
use case, timestamps are essential to verify timing issues against the clients
log.
-This module provides the pytest plugin hooks that configure logging for
-pytest sessions. The core logging functionality is in execution_testing.logging.
+This module provides the pytest plugin hooks that configure logging for pytest
+sessions. The core logging functionality is in execution_testing.logging.
"""
import functools
@@ -55,8 +55,9 @@ def pytest_addoption(parser: pytest.Parser) -> None: # noqa: D103
type=LogLevel.from_cli,
dest="eest_log_level",
help=(
- "The logging level to use in the test session: DEBUG, INFO, WARNING, ERROR or "
- "CRITICAL, default - INFO. An integer in [0, 50] may be also provided."
+ "The logging level to use in the test session: DEBUG, INFO, "
+ "WARNING, ERROR or CRITICAL, default - INFO. An integer in "
+ "[0, 50] may be also provided."
),
)
logging_group.addoption(
@@ -64,7 +65,10 @@ def pytest_addoption(parser: pytest.Parser) -> None: # noqa: D103
action="store",
default=None,
dest="eest_log_dir",
- help="Directory to write log files. Defaults to ./logs if not specified.",
+ help=(
+ "Directory to write log files. Defaults to ./logs if not "
+ "specified."
+ ),
)
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/contracts.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/contracts.py
index 6f143a8053b..b11216fad2a 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/contracts.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/contracts.py
@@ -89,5 +89,6 @@ def deploy_deterministic_factory_contract(
deployment_contract_code = eth_rpc.get_code(DETERMINISTIC_FACTORY_ADDRESS)
logger.info(f"Deployment contract code: {deployment_contract_code}")
assert deployment_contract_code == DETERMINISTIC_FACTORY_BYTECODE, (
- f"Deployment contract code is not the expected code: {deployment_contract_code} != {DETERMINISTIC_FACTORY_BYTECODE}"
+ f"Deployment contract code is not the expected code: "
+ f"{deployment_contract_code} != {DETERMINISTIC_FACTORY_BYTECODE}"
)
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/eth_config/eth_config.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/eth_config/eth_config.py
index 3202f20c1b2..334d0a53b71 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/eth_config/eth_config.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/eth_config/eth_config.py
@@ -55,8 +55,8 @@ def pytest_addoption(parser: pytest.Parser) -> None:
type=str,
default=None,
help=(
- "Name of the network to verify for the RPC client. Supported networks by default: "
- f"{', '.join(DEFAULT_NETWORKS.root.keys())}."
+ "Name of the network to verify for the RPC client. Supported "
+ f"networks by default: {', '.join(DEFAULT_NETWORKS.root.keys())}."
),
)
eth_config_group.addoption(
@@ -66,10 +66,14 @@ def pytest_addoption(parser: pytest.Parser) -> None:
required=False,
type=Path,
default=None,
- help="Path to the yml file that contains custom network configuration "
- "(e.g. ./src/execution_testing/cli/pytest_commands/plugins/execute/eth_config/networks.yml).\nIf no config is provided "
- "then majority mode will be used for devnet testing (clients that have a different "
- "response than the majority of clients will fail the test)",
+ help=(
+ "Path to the yml file that contains custom network configuration "
+ "(e.g. ./src/execution_testing/cli/pytest_commands/plugins/"
+ "execute/eth_config/networks.yml). If no config is provided then "
+ "majority mode will be used for devnet testing (clients that have "
+ "a different response than the majority of clients will fail the "
+ "test)"
+ ),
)
eth_config_group.addoption(
"--clients",
@@ -78,9 +82,11 @@ def pytest_addoption(parser: pytest.Parser) -> None:
dest="clients",
type=str,
default=None,
- help="Comma-separated list of clients to be tested in majority mode. Example: "
- '"besu,erigon,geth,nethermind,nimbusel,reth"\nIf you do not pass a value, majority mode '
- "testing will be disabled.",
+ help=(
+ "Comma-separated list of clients to be tested in majority mode. "
+ 'Example: "besu,erigon,geth,nethermind,nimbusel,reth". If you do '
+ "not pass a value, majority mode testing will be disabled."
+ ),
)
eth_config_group.addoption(
"--genesis-config-file",
@@ -89,8 +95,10 @@ def pytest_addoption(parser: pytest.Parser) -> None:
required=False,
type=Path,
default=None,
- help="Path to a genesis JSON file from which a custom network configuration "
- "must be derived.",
+ help=(
+ "Path to a genesis JSON file from which a custom network "
+ "configuration must be derived."
+ ),
)
eth_config_group.addoption(
"--genesis-config-url",
@@ -99,8 +107,10 @@ def pytest_addoption(parser: pytest.Parser) -> None:
required=False,
type=str,
default=None,
- help="URL to a genesis JSON file from which a custom network configuration "
- "must be derived.",
+ help=(
+ "URL to a genesis JSON file from which a custom network "
+ "configuration must be derived."
+ ),
)
eth_config_group.addoption(
"--rpc-endpoint",
@@ -127,13 +137,14 @@ def pytest_configure(config: pytest.Config) -> None:
if genesis_config_file and genesis_config_url:
pytest.exit(
- "Cannot specify both the --genesis-config-file and --genesis-config-url flags."
+ "Cannot specify both the --genesis-config-file and "
+ "--genesis-config-url flags."
)
if (genesis_config_file or genesis_config_url) and network_name:
pytest.exit(
- "Cannot specify a network name when using the --genesis-config-file or "
- "--genesis-config-url flag."
+ "Cannot specify a network name when using the "
+ "--genesis-config-file or --genesis-config-url flag."
)
# handle the one of the three flags that was passed
# case 1: genesis_config_file
@@ -153,7 +164,8 @@ def pytest_configure(config: pytest.Config) -> None:
network_configs_path = DEFAULT_NETWORK_CONFIGS_FILE
if not network_configs_path.exists():
pytest.exit(
- f'Specified networks file "{network_configs_path}" does not exist.'
+ f'Specified networks file "{network_configs_path}" does not '
+ "exist."
)
try:
network_configs = NetworkConfigFile.from_yaml(network_configs_path)
@@ -162,7 +174,8 @@ def pytest_configure(config: pytest.Config) -> None:
if network_name not in network_configs.root:
pytest.exit(
- f'Network "{network_name}" could not be found in file "{network_configs_path}".'
+ f'Network "{network_name}" could not be found in file '
+ f'"{network_configs_path}".'
)
config.network = network_configs.root[network_name] # type: ignore
@@ -181,7 +194,8 @@ def pytest_configure(config: pytest.Config) -> None:
config.option.majority_clients = clients # List[str]
else:
logger.info(
- "Majority test mode is disabled because no --clients value was passed."
+ "Majority test mode is disabled because no --clients value was "
+ "passed."
)
if config.getoption("collectonly", default=False):
@@ -201,7 +215,8 @@ def pytest_configure(config: pytest.Config) -> None:
pytest.exit(f"Could not connect to RPC endpoint {rpc_endpoint}: {e}")
try:
logger.debug(
- "Will now briefly check whether eth_config is supported by target rpc.."
+ "Will now briefly check whether eth_config is supported by "
+ "target rpc.."
)
eth_rpc.config()
logger.debug(
@@ -271,7 +286,8 @@ def pytest_generate_tests(metafunc: pytest.Metafunc) -> None:
# The test function is not run because we only have a single
# client, so no majority comparison
logger.info(
- "Skipping eth_config majority because less than 2 exec clients were passed"
+ "Skipping eth_config majority because less than 2 exec "
+ "clients were passed"
)
metafunc.parametrize(
["all_rpc_endpoints"],
@@ -302,7 +318,9 @@ def pytest_generate_tests(metafunc: pytest.Metafunc) -> None:
rpc_endpoint,
id=f"{metafunc.definition.name}[{endpoint_name}]",
)
- for endpoint_name, rpc_endpoint in all_rpc_endpoints_dict.items()
+ for endpoint_name, rpc_endpoint in (
+ all_rpc_endpoints_dict.items()
+ )
],
scope="function",
)
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/eth_config/execute_eth_config.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/eth_config/execute_eth_config.py
index e6d9e9a460e..5edb2bde7fb 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/eth_config/execute_eth_config.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/eth_config/execute_eth_config.py
@@ -235,12 +235,14 @@ def test_eth_config_majority(
response = eth_rpc_target.config(timeout=5)
if response is None:
logger.warning(
- f"Got 'None' as eth_config response from {eth_rpc_target}"
+ f"Got 'None' as eth_config response from "
+ f"{eth_rpc_target}"
)
continue
except Exception as e:
logger.warning(
- f"When trying to get eth_config from {eth_rpc_target} a problem occurred: {e}"
+ f"When trying to get eth_config from {eth_rpc_target} a "
+ f"problem occurred: {e}"
)
continue
@@ -256,12 +258,12 @@ def test_eth_config_majority(
break # no need to gather more responses for this client
assert len(responses.keys()) == len(all_rpc_endpoints.keys()), (
- "Failed to get an eth_config response "
- f" from each specified execution client. Full list of execution clients is "
- f"{all_rpc_endpoints.keys()} but we were only able to gather eth_config responses "
- f"from: {responses.keys()}\n"
- "Will try again with a different consensus-execution client combination for "
- "this execution client"
+ "Failed to get an eth_config response from each specified execution "
+ f"client. Full list of execution clients is "
+ f"{all_rpc_endpoints.keys()} but we were only able to gather "
+ f"eth_config responses from: {responses.keys()}\n"
+ "Will try again with a different consensus-execution client "
+ "combination for this execution client"
)
# determine hashes of client responses
client_to_hash_dict = {} # Dict[exec_client : response hash] # noqa: C408
@@ -298,5 +300,6 @@ def test_eth_config_majority(
assert expected_hash != ""
logger.info(
- "All clients returned the same eth_config response. Test has been passed!"
+ "All clients returned the same eth_config response. Test has been "
+ "passed!"
)
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/eth_config/tests/test_execute_eth_config.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/eth_config/tests/test_execute_eth_config.py
index 2e47ecbfdfd..f9bedc47106 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/eth_config/tests/test_execute_eth_config.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/eth_config/tests/test_execute_eth_config.py
@@ -71,10 +71,12 @@
},
"systemContracts": {
"BEACON_ROOTS_ADDRESS": "0x000f3df6d732807ef1319fb7b8bb8522d0beac02",
- "CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS": "0x0000bbddc7ce488642fb579f8b00f3a590007251",
+ "CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS":
+ "0x0000bbddc7ce488642fb579f8b00f3a590007251",
"DEPOSIT_CONTRACT_ADDRESS": "0x00000000219ab540356cbb839cbe05303d7705fa",
"HISTORY_STORAGE_ADDRESS": "0x0000f90827f1c53a10cb7a02335b175320002935",
- "WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS": "0x00000961ef480eb55e80d19ad83579a64c007002"
+ "WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS":
+ "0x00000961ef480eb55e80d19ad83579a64c007002"
}
}
""")
@@ -111,10 +113,12 @@
},
"systemContracts": {
"BEACON_ROOTS_ADDRESS": "0x000f3df6d732807ef1319fb7b8bb8522d0beac02",
- "CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS": "0x0000bbddc7ce488642fb579f8b00f3a590007251",
+ "CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS":
+ "0x0000bbddc7ce488642fb579f8b00f3a590007251",
"DEPOSIT_CONTRACT_ADDRESS": "0x00000000219ab540356cbb839cbe05303d7705fa",
"HISTORY_STORAGE_ADDRESS": "0x0000f90827f1c53a10cb7a02335b175320002935",
- "WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS": "0x00000961ef480eb55e80d19ad83579a64c007002"
+ "WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS":
+ "0x00000961ef480eb55e80d19ad83579a64c007002"
}
}
""")
@@ -151,10 +155,12 @@
},
"systemContracts": {
"BEACON_ROOTS_ADDRESS": "0x000f3df6d732807ef1319fb7b8bb8522d0beac02",
- "CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS": "0x0000bbddc7ce488642fb579f8b00f3a590007251",
+ "CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS":
+ "0x0000bbddc7ce488642fb579f8b00f3a590007251",
"DEPOSIT_CONTRACT_ADDRESS": "0x00000000219ab540356cbb839cbe05303d7705fa",
"HISTORY_STORAGE_ADDRESS": "0x0000f90827f1c53a10cb7a02335b175320002935",
- "WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS": "0x00000961ef480eb55e80d19ad83579a64c007002"
+ "WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS":
+ "0x00000961ef480eb55e80d19ad83579a64c007002"
}
}
""")
@@ -191,10 +197,12 @@
},
"systemContracts": {
"BEACON_ROOTS_ADDRESS": "0x000f3df6d732807ef1319fb7b8bb8522d0beac02",
- "CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS": "0x0000bbddc7ce488642fb579f8b00f3a590007251",
+ "CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS":
+ "0x0000bbddc7ce488642fb579f8b00f3a590007251",
"DEPOSIT_CONTRACT_ADDRESS": "0x00000000219ab540356cbb839cbe05303d7705fa",
"HISTORY_STORAGE_ADDRESS": "0x0000f90827f1c53a10cb7a02335b175320002935",
- "WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS": "0x00000961ef480eb55e80d19ad83579a64c007002"
+ "WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS":
+ "0x00000961ef480eb55e80d19ad83579a64c007002"
}
}
""")
@@ -231,10 +239,12 @@
},
"systemContracts": {
"BEACON_ROOTS_ADDRESS": "0x000f3df6d732807ef1319fb7b8bb8522d0beac02",
- "CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS": "0x0000bbddc7ce488642fb579f8b00f3a590007251",
+ "CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS":
+ "0x0000bbddc7ce488642fb579f8b00f3a590007251",
"DEPOSIT_CONTRACT_ADDRESS": "0x00000000219ab540356cbb839cbe05303d7705fa",
"HISTORY_STORAGE_ADDRESS": "0x0000f90827f1c53a10cb7a02335b175320002935",
- "WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS": "0x00000961ef480eb55e80d19ad83579a64c007002"
+ "WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS":
+ "0x00000961ef480eb55e80d19ad83579a64c007002"
}
}
""")
@@ -271,10 +281,12 @@
},
"systemContracts": {
"BEACON_ROOTS_ADDRESS": "0x000f3df6d732807ef1319fb7b8bb8522d0beac02",
- "CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS": "0x0000bbddc7ce488642fb579f8b00f3a590007251",
+ "CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS":
+ "0x0000bbddc7ce488642fb579f8b00f3a590007251",
"DEPOSIT_CONTRACT_ADDRESS": "0x00000000219ab540356cbb839cbe05303d7705fa",
"HISTORY_STORAGE_ADDRESS": "0x0000f90827f1c53a10cb7a02335b175320002935",
- "WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS": "0x00000961ef480eb55e80d19ad83579a64c007002"
+ "WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS":
+ "0x00000961ef480eb55e80d19ad83579a64c007002"
}
}
""")
@@ -285,7 +297,7 @@
STATIC_NETWORK_CONFIGS = """
-# Static network configs so updates to the network configs don't break the tests.
+# Static network configs so network config updates don't break the tests.
Mainnet:
chainId: 0x1
genesisHash: 0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3
@@ -414,7 +426,7 @@
target: 15
max: 20
baseFeeUpdateFraction: 5007716
-""" # W505
+""" # noqa: E501
@pytest.fixture(scope="session")
@@ -532,7 +544,8 @@ def test_fork_config_from_fork(
f"{current_config.model_dump_json()}"
)
assert current_config.fork_id == expected_eth_config.current.fork_id, (
- f"Expected {expected_eth_config.current.fork_id} but got {current_config.fork_id}"
+ f"Expected {expected_eth_config.current.fork_id} "
+ f"but got {current_config.fork_id}"
)
if expected_eth_config.next is not None:
assert next_config is not None, "Expected next to be not None"
@@ -543,7 +556,8 @@ def test_fork_config_from_fork(
f"{next_config.model_dump_json()}"
)
assert next_config.fork_id == expected_eth_config.next.fork_id, (
- f"Expected {expected_eth_config.next.fork_id} but got {next_config.fork_id}"
+ f"Expected {expected_eth_config.next.fork_id} "
+ f"but got {next_config.fork_id}"
)
else:
assert next_config is None, "Expected next to be None"
@@ -556,7 +570,8 @@ def test_fork_config_from_fork(
f"{eth_config.last.model_dump_json()}"
)
assert eth_config.last.fork_id == expected_eth_config.last.fork_id, (
- f"Expected {expected_eth_config.last.fork_id} but got {eth_config.last.fork_id}"
+ f"Expected {expected_eth_config.last.fork_id} "
+ f"but got {eth_config.last.fork_id}"
)
else:
assert eth_config.last is None, "Expected last to be None"
@@ -614,19 +629,22 @@ def test_fork_ids(
) -> None:
"""Test various configurations of fork Ids for different timestamps."""
assert expected_current_fork_id == eth_config.current.fork_id, (
- f"Unexpected current fork id: {eth_config.current.fork_id} != {expected_current_fork_id}"
+ f"Unexpected current fork id: "
+ f"{eth_config.current.fork_id} != {expected_current_fork_id}"
)
if expected_next_fork_id is not None:
assert eth_config.next is not None, "Expected next to be not None"
assert expected_next_fork_id == eth_config.next.fork_id, (
- f"Unexpected next fork id: {eth_config.next.fork_id} != {expected_next_fork_id}"
+ f"Unexpected next fork id: "
+ f"{eth_config.next.fork_id} != {expected_next_fork_id}"
)
else:
assert eth_config.next is None, "Expected next to be None"
if expected_last_fork_id is not None:
assert eth_config.last is not None, "Expected last to be not None"
assert expected_last_fork_id == eth_config.last.fork_id, (
- f"Unexpected last fork id: {eth_config.last.fork_id} != {expected_last_fork_id}"
+ f"Unexpected last fork id: "
+ f"{eth_config.last.fork_id} != {expected_last_fork_id}"
)
else:
assert eth_config.last is None, "Expected last to be None"
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/eth_config/tests/test_genesis.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/eth_config/tests/test_genesis.py
index 5e424409533..b71ba856e5f 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/eth_config/tests/test_genesis.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/eth_config/tests/test_genesis.py
@@ -131,9 +131,11 @@ def test_genesis_parsing(
"""
parsed_genesis = Genesis.model_validate_json(genesis_contents)
assert parsed_genesis.hash == expected_hash, (
- f"Unexpected genesis hash: {parsed_genesis.hash}, expected: {expected_hash}"
+ f"Unexpected genesis hash: {parsed_genesis.hash}, "
+ f"expected: {expected_hash}"
)
network_config = parsed_genesis.network_config()
assert network_config == expected_network_config, (
- f"Unexpected network config: {network_config}, expected: {expected_network_config}"
+ f"Unexpected network config: {network_config}, "
+ f"expected: {expected_network_config}"
)
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/execute.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/execute.py
index 30f357fc939..1bdde105396 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/execute.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/execute.py
@@ -51,8 +51,8 @@ def pytest_addoption(parser: pytest.Parser) -> None:
type=int,
default=None,
help=(
- "Default gas price used for transactions, unless overridden by the test. "
- "Default=None (1.5x current network gas price)"
+ "Default gas price used for transactions, unless overridden by "
+ "the test. Default=None (1.5x current network gas price)"
),
)
execute_group.addoption(
@@ -62,8 +62,8 @@ def pytest_addoption(parser: pytest.Parser) -> None:
type=int,
default=None,
help=(
- "Default max fee per gas used for transactions, unless overridden by the test. "
- "Default=None (1.5x current network max fee per gas)"
+ "Default max fee per gas used for transactions, unless overridden "
+ "by the test. Default=None (1.5x current network max fee per gas)"
),
)
execute_group.addoption(
@@ -85,8 +85,9 @@ def pytest_addoption(parser: pytest.Parser) -> None:
type=int,
default=None,
help=(
- "Default max fee per blob gas used for transactions, unless overridden by the test. "
- "Default=None (1.5x current network max fee per blob gas)"
+ "Default max fee per blob gas used for transactions, unless "
+ "overridden by the test. Default=None (1.5x current network max "
+ "fee per blob gas)"
),
)
execute_group.addoption(
@@ -96,9 +97,9 @@ def pytest_addoption(parser: pytest.Parser) -> None:
default=EnvironmentDefaults.gas_limit // 4,
type=int,
help=(
- "Maximum gas used to execute a single transaction. "
- "Will be used as ceiling for tests that attempt to consume the entire block gas limit. "
- f"(Default: {EnvironmentDefaults.gas_limit // 4})"
+ "Maximum gas used to execute a single transaction. Will be used "
+ "as ceiling for tests that attempt to consume the entire block "
+ f"gas limit. (Default: {EnvironmentDefaults.gas_limit // 4})"
),
)
execute_group.addoption(
@@ -118,7 +119,8 @@ def pytest_addoption(parser: pytest.Parser) -> None:
type=float,
default=0.3,
help=(
- "Time to wait after sending a forkchoice_updated before getting the payload."
+ "Time to wait after sending a forkchoice_updated before getting "
+ "the payload."
),
)
execute_group.addoption(
@@ -128,7 +130,8 @@ def pytest_addoption(parser: pytest.Parser) -> None:
default=None,
type=int,
help=(
- "Maximum gas limit for all transactions in a test. Default=None (No limit)"
+ "Maximum gas limit for all transactions in a test. Default=None "
+ "(No limit)"
),
)
execute_group.addoption(
@@ -136,7 +139,10 @@ def pytest_addoption(parser: pytest.Parser) -> None:
action="store_true",
dest="dry_run",
default=False,
- help="Don't send transactions, just print the minimum balance required per test.",
+ help=(
+ "Don't send transactions, just print the minimum balance required "
+ "per test."
+ ),
)
execute_group.addoption(
"--max-tx-per-batch",
@@ -145,8 +151,8 @@ def pytest_addoption(parser: pytest.Parser) -> None:
type=int,
default=None,
help=(
- "Maximum number of transactions to send in a single batch to the RPC. "
- "Default=750. Higher values may cause RPC instability."
+ "Maximum number of transactions to send in a single batch to the "
+ "RPC. Default=750. Higher values may cause RPC instability."
),
)
@@ -221,11 +227,13 @@ def pytest_html_results_table_header(cells: list[str]) -> None:
)
cells.insert(
4,
- '
Funded Accounts | ',
+ ''
+ "Funded Accounts | ",
)
cells.insert(
5,
- 'Deployed Contracts | ',
+ ''
+ "Deployed Contracts | ",
)
del cells[-1] # Remove the "Links" column
@@ -324,7 +332,7 @@ def dry_run(request: pytest.FixtureRequest) -> bool:
@pytest.fixture(scope="session")
def max_transactions_per_batch(request: pytest.FixtureRequest) -> int | None:
- """Return the maximum number of transactions per batch, or None for default."""
+ """Return max number of transactions per batch, or None for default."""
return request.config.getoption("max_tx_per_batch")
@@ -335,12 +343,14 @@ def default_max_fee_per_gas(
"""Return default max fee per gas used for transactions."""
max_fee_per_gas = request.config.getoption("default_max_fee_per_gas")
if max_fee_per_gas is not None:
+ fee_gwei = max_fee_per_gas / 10**9
logger.debug(
- f"Using configured default max fee per gas: {max_fee_per_gas / 10**9:.2f} Gwei"
+ f"Using configured default max fee per gas: {fee_gwei:.2f} Gwei"
)
else:
logger.debug(
- "No default max fee per gas configured, will use network gas price * 1.5"
+ "No default max fee per gas configured, "
+ "will use network gas price * 1.5"
)
return max_fee_per_gas
@@ -354,12 +364,15 @@ def default_max_priority_fee_per_gas(
"default_max_priority_fee_per_gas"
)
if max_priority_fee_per_gas is not None:
+ prio_fee_gwei = max_priority_fee_per_gas / 10**9
logger.debug(
- f"Using configured default max priority fee per gas: {max_priority_fee_per_gas / 10**9:.2f} Gwei"
+ f"Using configured default max priority fee per gas: "
+ f"{prio_fee_gwei:.2f} Gwei"
)
else:
logger.debug(
- "No default max priority fee per gas configured, will use network max priority fee * 1.5"
+ "No default max priority fee per gas configured, "
+ "will use network max priority fee * 1.5"
)
return max_priority_fee_per_gas
@@ -373,12 +386,15 @@ def default_max_fee_per_blob_gas(
"default_max_fee_per_blob_gas"
)
if max_fee_per_blob_gas is not None:
+ blob_fee_gwei = max_fee_per_blob_gas / 10**9
logger.debug(
- f"Using configured default max fee per blob gas: {max_fee_per_blob_gas / 10**9:.2f} Gwei"
+ f"Using configured default max fee per blob gas: "
+ f"{blob_fee_gwei:.2f} Gwei"
)
else:
logger.debug(
- "No default max fee per blob gas configured, will use network blob base fee * 1.5"
+ "No default max fee per blob gas configured, "
+ "will use network blob base fee * 1.5"
)
return max_fee_per_blob_gas
@@ -388,17 +404,21 @@ def max_priority_fee_per_gas(
eth_rpc: EthRPC,
default_max_priority_fee_per_gas: int | None,
) -> int:
- """Return max priority fee per gas used for transactions in a given test."""
+ """Return max priority fee per gas for transactions in a given test."""
max_priority_fee_per_gas = default_max_priority_fee_per_gas
if max_priority_fee_per_gas is None:
network_max_priority_fee = eth_rpc.max_priority_fee_per_gas()
max_priority_fee_per_gas = int(network_max_priority_fee * 1.5)
+ net_gwei = network_max_priority_fee / 10**9
+ calc_gwei = max_priority_fee_per_gas / 10**9
logger.info(
- f"Calculated max priority fee per gas from network: {network_max_priority_fee / 10**9:.2f} Gwei * 1.5 = {max_priority_fee_per_gas / 10**9:.2f} Gwei"
+ f"Calculated max priority fee per gas from network: "
+ f"{net_gwei:.2f} Gwei * 1.5 = {calc_gwei:.2f} Gwei"
)
else:
+ prio_gwei = max_priority_fee_per_gas / 10**9
logger.info(
- f"Using default max priority fee per gas: {max_priority_fee_per_gas / 10**9:.2f} Gwei"
+ f"Using default max priority fee per gas: {prio_gwei:.2f} Gwei"
)
return max_priority_fee_per_gas
@@ -414,24 +434,33 @@ def max_fee_per_gas(
if max_fee_per_gas is None:
network_gas_price = eth_rpc.gas_price()
max_fee_per_gas = int(network_gas_price * 1.5)
+ net_gwei = network_gas_price / 10**9
+ calc_gwei = max_fee_per_gas / 10**9
logger.info(
- f"Calculated max fee per gas from network: {network_gas_price / 10**9:.2f} Gwei * 1.5 = {max_fee_per_gas / 10**9:.2f} Gwei"
+ f"Calculated max fee per gas from network: "
+ f"{net_gwei:.2f} Gwei * 1.5 = {calc_gwei:.2f} Gwei"
)
else:
- logger.info(
- f"Using default max fee per gas: {max_fee_per_gas / 10**9:.2f} Gwei"
- )
+ fee_gwei = max_fee_per_gas / 10**9
+ logger.info(f"Using default max fee per gas: {fee_gwei:.2f} Gwei")
if max_priority_fee_per_gas > max_fee_per_gas:
# Depending on the timing of the request, the priority fee may be
# greater than the max fee. This is a workaround to ensure that the
# transaction is valid.
+ prio_gwei = max_priority_fee_per_gas / 10**9
+ fee_gwei = max_fee_per_gas / 10**9
+ adj_gwei = (max_priority_fee_per_gas + 1) / 10**9
logger.warning(
- f"Max priority fee per gas ({max_priority_fee_per_gas / 10**9:.2f} Gwei) is greater than max fee per gas ({max_fee_per_gas / 10**9:.2f} Gwei), "
- f"adjusting max fee per gas to {(max_priority_fee_per_gas + 1) / 10**9:.2f} Gwei"
+ f"Max priority fee per gas ({prio_gwei:.2f} Gwei) is greater "
+ f"than max fee per gas ({fee_gwei:.2f} Gwei), "
+ f"adjusting max fee per gas to {adj_gwei:.2f} Gwei"
)
max_fee_per_gas = max_priority_fee_per_gas + 1
+ final_gwei = max_fee_per_gas / 10**9
+ prio_gwei = max_priority_fee_per_gas / 10**9
logger.debug(
- f"Final max fee per gas: {max_fee_per_gas / 10**9:.2f} Gwei, max priority fee per gas: {max_priority_fee_per_gas / 10**9:.2f} Gwei"
+ f"Final max fee per gas: {final_gwei:.2f} Gwei, "
+ f"max priority fee per gas: {prio_gwei:.2f} Gwei"
)
return max_fee_per_gas
@@ -446,12 +475,16 @@ def max_fee_per_blob_gas(
if max_fee_per_blob_gas is None:
network_blob_base_fee = eth_rpc.blob_base_fee()
max_fee_per_blob_gas = int(network_blob_base_fee * 1.5)
+ net_gwei = network_blob_base_fee / 10**9
+ calc_gwei = max_fee_per_blob_gas / 10**9
logger.info(
- f"Calculated max fee per blob gas from network: {network_blob_base_fee / 10**9:.2f} Gwei * 1.5 = {max_fee_per_blob_gas / 10**9:.2f} Gwei"
+ f"Calculated max fee per blob gas from network: "
+ f"{net_gwei:.2f} Gwei * 1.5 = {calc_gwei:.2f} Gwei"
)
else:
+ blob_gwei = max_fee_per_blob_gas / 10**9
logger.info(
- f"Using default max fee per blob gas: {max_fee_per_blob_gas / 10**9:.2f} Gwei"
+ f"Using default max fee per blob gas: {blob_gwei:.2f} Gwei"
)
return max_fee_per_blob_gas
@@ -460,8 +493,12 @@ def max_fee_per_blob_gas(
def gas_price(max_fee_per_gas: int, max_priority_fee_per_gas: int) -> int:
"""Return gas price used for transactions in a given test."""
calculated_gas_price = max_fee_per_gas + max_priority_fee_per_gas
+ fee_gwei = max_fee_per_gas / 10**9
+ prio_gwei = max_priority_fee_per_gas / 10**9
+ total_gwei = calculated_gas_price / 10**9
logger.debug(
- f"Calculated gas price: {max_fee_per_gas / 10**9:.2f} Gwei (max fee) + {max_priority_fee_per_gas / 10**9:.2f} Gwei (max priority fee) = {calculated_gas_price / 10**9:.2f} Gwei"
+ f"Calculated gas price: {fee_gwei:.2f} Gwei (max fee) + "
+ f"{prio_gwei:.2f} Gwei (max priority fee) = {total_gwei:.2f} Gwei"
)
return calculated_gas_price
@@ -553,9 +590,8 @@ def gas_limit_accumulator() -> Generator[GasInfoAccumulator, None, None]:
gas_limit_accumulator = GasInfoAccumulator()
yield gas_limit_accumulator
logger.info(f"Total gas limit: {gas_limit_accumulator.total_gas_limit()}")
- logger.info(
- f"Total minimum balance: {gas_limit_accumulator.total_minimum_balance() / 10**18:.18f}"
- )
+ total_min_eth = gas_limit_accumulator.total_minimum_balance() / 10**18
+ logger.info(f"Total minimum balance: {total_min_eth:.18f}")
def base_test_parametrizer(cls: Type[BaseTest]) -> Any:
@@ -601,6 +637,7 @@ def base_test_parametrizer_func(
When parametrize, indirect must be used along with the fixture format
as value.
"""
+ del fixed_opcode_count
execute_format = request.param
assert execute_format in BaseExecute.formats.values()
assert issubclass(execute_format, BaseExecute)
@@ -655,8 +692,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
)
if max_gas_limit_per_test is not None:
assert gas_consumption <= max_gas_limit_per_test, (
- f"Test gas consumption ({gas_consumption}) exceeds the gas limit allowed "
- f"per test({max_gas_limit_per_test})."
+ f"Test gas consumption ({gas_consumption}) exceeds "
+ f"the gas limit allowed per test"
+ f"({max_gas_limit_per_test})."
)
gas_limit_accumulator.add(
@@ -666,9 +704,8 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
)
if dry_run:
- logger.info(
- f"Minimum balance required: {minimum_balance / 10**18:.18f}"
- )
+ min_eth = minimum_balance / 10**18
+ logger.info(f"Minimum balance required: {min_eth:.18f}")
logger.info(f"Gas consumption: {gas_consumption}")
return
@@ -682,8 +719,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
actual_code = eth_rpc.get_code(deployed_contract)
if actual_code != expected_code:
msg = (
- f"Deployed test contract didn't match expected code at address "
- f"{deployed_contract} (not enough gas_limit?).\n"
+ f"Deployed test contract didn't match expected "
+ f"code at address {deployed_contract} "
+ f"(not enough gas_limit?).\n"
f"Expected: {expected_code}\n"
f"Actual: {actual_code}"
)
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/execute_deploy_required_contracts.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/execute_deploy_required_contracts.py
index 94d5c2bad8b..b3510334f6e 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/execute_deploy_required_contracts.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/execute_deploy_required_contracts.py
@@ -40,20 +40,20 @@ def test_deploy_deterministic_deployment_contract(
f"{current_deterministic_deployment_contract_address}"
)
if check_only:
- print(
- f"โ Contract is already deployed at {current_deterministic_deployment_contract_address}"
- )
+ addr = current_deterministic_deployment_contract_address
+ print(f"โ Contract is already deployed at {addr}")
else:
- print(
- f"Contract already exists at {current_deterministic_deployment_contract_address}, skipping deployment"
- )
+ addr = current_deterministic_deployment_contract_address
+ print(f"Contract already exists at {addr}, skipping deployment")
return
if check_only:
+ factory_addr = DETERMINISTIC_FACTORY_ADDRESS
logger.info(
- f"โ Deterministic deployment contract NOT deployed at {DETERMINISTIC_FACTORY_ADDRESS}"
+ f"โ Deterministic deployment contract NOT deployed at "
+ f"{factory_addr}"
)
- print(f"โ Contract is NOT deployed at {DETERMINISTIC_FACTORY_ADDRESS}")
+ print(f"โ Contract is NOT deployed at {factory_addr}")
pytest.fail("Contract not deployed (check-only mode)")
try:
@@ -66,8 +66,9 @@ def test_deploy_deterministic_deployment_contract(
# Verify deployment
deployed_code = eth_rpc.get_code(DETERMINISTIC_FACTORY_ADDRESS)
if deployed_code != Bytes(DETERMINISTIC_FACTORY_BYTECODE):
+ factory_addr = DETERMINISTIC_FACTORY_ADDRESS
pytest.fail(
- f"Verification failed: Contract code mismatch at {DETERMINISTIC_FACTORY_ADDRESS}. "
+ f"Verification failed: Contract code mismatch at {factory_addr}. "
f"Expected: {DETERMINISTIC_FACTORY_BYTECODE}, "
f"Deployed: {deployed_code}"
)
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/execute_flags/execute_flags.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/execute_flags/execute_flags.py
index 80699428f2b..cb1e2a26fba 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/execute_flags/execute_flags.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/execute_flags/execute_flags.py
@@ -65,14 +65,14 @@ def pytest_configure(config: pytest.Config) -> None:
returncode=4,
)
else:
- # Use rpc_chain_id if chain_id is not provided (for backwards compatibility)
+ # Use rpc_chain_id if chain_id is not provided (backwards compat)
if not chain_id:
chain_id = rpc_chain_id
if chain_id is None:
pytest.exit(
- "Chain ID must be provided with the --chain-id/--rpc-chain-id flags or "
- "the CHAIN_ID/RPC_CHAIN_ID environment variables."
+ "Chain ID must be provided with the --chain-id/--rpc-chain-id "
+ "flags or the CHAIN_ID/RPC_CHAIN_ID environment variables."
)
# write to config
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/pre_alloc.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/pre_alloc.py
index caea02a545c..59b4ae7f9b3 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/pre_alloc.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/pre_alloc.py
@@ -183,7 +183,7 @@ def execute_required_contracts(
session_temp_folder: Path,
) -> None:
"""
- Deploy required contracts for the execute command:
+ Deploy required contracts for the execute command.
- Deterministic deployment proxy
"""
@@ -215,9 +215,10 @@ def execute_required_contracts(
class PendingTransaction(Transaction):
"""
- Custom transaction class that defines a transaction that is yet to be sent.
- The value is allowed to be `None` to allow for the value to be set until the
- transaction is sent.
+ Custom transaction class that defines a transaction yet to be sent.
+
+ The value is allowed to be `None` to allow for the value to be set until
+ the transaction is sent.
"""
value: HexNumber | None = None # type: ignore
@@ -313,6 +314,7 @@ def deterministic_deploy_contract(
Deploy a contract to the allocation at a deterministic location
using a deterministic deployment proxy.
"""
+ del storage
gas_costs = self._fork.gas_costs()
memory_expansion_gas_calculator = (
self._fork.memory_expansion_gas_calculator()
@@ -340,7 +342,8 @@ def deterministic_deploy_contract(
f"Current: {chain_code}"
)
logger.info(
- f"Contract already deployed at {contract_address} (label={label})"
+ f"Contract already deployed at {contract_address} "
+ f"(label={label})"
)
else:
# Assert the deployment contract is already on chain
@@ -376,7 +379,8 @@ def deterministic_deploy_contract(
tx_gas_limit_cap = self._fork.transaction_gas_limit_cap()
if tx_gas_limit_cap and deploy_gas_limit > tx_gas_limit_cap:
raise ValueError(
- f"deterministic deploy gas limit exceeds the transaction gas limit cap: {deploy_gas_limit} > {tx_gas_limit_cap}"
+ f"deterministic deploy gas limit exceeds the transaction "
+ f"gas limit cap: {deploy_gas_limit} > {tx_gas_limit_cap}"
)
deploy_tx = self._add_pending_tx(
action="deterministic_deploy_contract",
@@ -386,10 +390,13 @@ def deterministic_deploy_contract(
gas_limit=deploy_gas_limit,
value=0,
)
+ code_size = len(deploy_code)
+ initcode_size = len(initcode)
logger.info(
f"Contract deployment tx created (label={label}): "
f"tx_nonce={deploy_tx.nonce}, gas_limit={deploy_gas_limit}, "
- f"code_size={len(deploy_code)} bytes, initcode_size={len(initcode)} bytes"
+ f"code_size={code_size} bytes, initcode_size={initcode_size} "
+ "bytes"
)
logger.debug(
@@ -458,9 +465,10 @@ def deploy_contract(
)
balance = self._eth_rpc.get_balance(contract_address)
nonce = self._eth_rpc.get_transaction_count(contract_address)
+ bal_eth = balance / 10**18
logger.debug(
- f"Stub contract {contract_address}: balance={balance / 10**18:.18f} ETH, "
- f"nonce={nonce}, code_size={len(code)} bytes"
+ f"Stub contract {contract_address}: balance={bal_eth:.18f} "
+ f"ETH, nonce={nonce}, code_size={len(code)} bytes"
)
super().__setitem__(
contract_address,
@@ -504,9 +512,10 @@ def deploy_contract(
)
max_initcode_size = self._fork.max_initcode_size()
- if len(prepared_initcode) > max_initcode_size:
+ initcode_len = len(prepared_initcode)
+ if initcode_len > max_initcode_size:
raise ValueError(
- f"initcode too large {len(prepared_initcode)} > {max_initcode_size}"
+ f"initcode too large {initcode_len} > {max_initcode_size}"
)
deploy_gas_limit += calldata_gas_calculator(data=prepared_initcode)
@@ -515,7 +524,8 @@ def deploy_contract(
tx_gas_limit_cap = self._fork.transaction_gas_limit_cap()
if tx_gas_limit_cap and deploy_gas_limit > tx_gas_limit_cap:
raise ValueError(
- f"deploy gas limit exceeds the transaction gas limit cap: {deploy_gas_limit} > {tx_gas_limit_cap}"
+ f"deploy gas limit exceeds the transaction gas limit cap: "
+ f"{deploy_gas_limit} > {tx_gas_limit_cap}"
)
deploy_tx = self._add_pending_tx(
@@ -526,11 +536,15 @@ def deploy_contract(
value=balance,
gas_limit=deploy_gas_limit,
)
+ code_sz = len(code)
+ init_sz = len(prepared_initcode)
+ bal_eth = Number(balance) / 10**18
+ slots = len(storage.root)
logger.info(
f"Contract deployment tx created (label={label}): "
f"tx_nonce={deploy_tx.nonce}, gas_limit={deploy_gas_limit}, "
- f"code_size={len(code)} bytes, initcode_size={len(prepared_initcode)} bytes, "
- f"balance={Number(balance) / 10**18:.18f} ETH, storage_slots={len(storage.root)}"
+ f"code_size={code_sz} bytes, initcode_size={init_sz} bytes, "
+ f"balance={bal_eth:.18f} ETH, storage_slots={slots}"
)
contract_address = deploy_tx.created_contract
@@ -588,7 +602,8 @@ def fund_eoa(
if not isinstance(storage, Storage):
storage = Storage.model_validate(storage)
logger.debug(
- f"Deploying storage contract for EOA {eoa} with {len(storage)} storage slots"
+ f"Deploying storage contract for EOA {eoa} "
+ f"with {len(storage)} storage slots"
)
sstore_address = self.deploy_contract(
code=(
@@ -600,7 +615,8 @@ def fund_eoa(
)
)
logger.debug(
- f"Storage contract deployed at {sstore_address} for EOA {eoa}"
+ f"Storage contract deployed at {sstore_address} "
+ f"for EOA {eoa}"
)
self._add_pending_tx(
@@ -715,10 +731,12 @@ def fund_address(
if minimum_balance:
if current_balance >= fund_amount:
+ cur_eth = current_balance / 10**18
+ min_eth = fund_amount / 10**18
logger.info(
- f"Skipping funding for address {address} (label={address.label}): "
- f"current balance {current_balance / 10**18:.18f} ETH >= "
- f"minimum {fund_amount / 10**18:.18f} ETH"
+ f"Skipping funding for address {address} "
+ f"(label={address.label}): current balance "
+ f"{cur_eth:.18f} ETH >= minimum {min_eth:.18f} ETH"
)
if address in self:
account = self[address]
@@ -729,9 +747,10 @@ def fund_address(
address, Account(balance=current_balance)
)
return
+ fund_eth = fund_amount / 10**18
logger.debug(
- f"Funding address to minimum balance {address} (label={address.label}): "
- f"{fund_amount / 10**18:.18f} ETH"
+ f"Funding address to minimum balance {address} "
+ f"(label={address.label}): {fund_eth:.18f} ETH"
)
self._add_pending_tx(
action="fund_address",
@@ -741,9 +760,10 @@ def fund_address(
)
new_balance = fund_amount
else:
+ fund_eth = fund_amount / 10**18
logger.debug(
f"Funding address {address} (label={address.label}): "
- f"{fund_amount / 10**18:.18f} ETH"
+ f"{fund_eth:.18f} ETH"
)
self._add_pending_tx(
action="fund_address",
@@ -757,9 +777,11 @@ def fund_address(
account = self[address]
if account is not None:
account.balance = ZeroPaddedHexNumber(new_balance)
+ cur_eth = current_balance / 10**18
+ new_eth = new_balance / 10**18
logger.debug(
f"Updated balance for existing address {address}: "
- f"{current_balance / 10**18:.18f} ETH -> {new_balance / 10**18:.18f} ETH"
+ f"{cur_eth:.18f} ETH -> {new_eth:.18f} ETH"
)
else:
super().__setitem__(address, Account(balance=new_balance))
@@ -811,27 +833,30 @@ def minimum_balance_for_pending_transactions(
max_fee_per_blob_gas: int,
) -> Tuple[int, int]:
"""
- Calculate the minimum balance required by the sender to send all pending
- transactions.
+ Calculate the minimum balance required by the sender to send all
+ pending transactions.
"""
minimum_balance = 0
gas_consumption = 0
for tx in self._pending_txs:
if tx.value is None:
- # WARN: This currently fails if there's an account with `pre.fund_eoa()` that
- # never sends a transaction during the test.
+ # WARN: This currently fails if there's an account with
+ # `pre.fund_eoa()` that never sends a transaction during test.
if tx.to not in sender_balances:
error_message = (
"Sender balance must be set before sending:"
f"\nTransaction: {tx.model_dump_json(indent=2)}"
)
if tx.metadata is not None:
- error_message += f"\nMetadata: {tx.metadata.model_dump_json(indent=2)}"
+ metadata_json = tx.metadata.model_dump_json(indent=2)
+ error_message += f"\nMetadata: {metadata_json}"
logger.error(error_message)
raise ValueError(error_message)
sender_balance = sender_balances[tx.to]
+ bal_eth = sender_balance / 10**18
logger.info(
- f"Deferred EOA balance for {tx.to} set to {sender_balance / 10**18:.18f} ETH"
+ f"Deferred EOA balance for {tx.to} set to "
+ f"{bal_eth:.18f} ETH"
)
tx.value = HexNumber(sender_balance)
tx.set_gas_price(
@@ -853,12 +878,12 @@ def send_pending_transactions(self) -> List[TransactionByHashResponse]:
)
transaction_batches: List[List[PendingTransaction]] = []
last_tx_batch: List[PendingTransaction] = []
- MAX_TXS_PER_BATCH = 100
+ max_txs_per_batch = 100
for tx in self._pending_txs:
assert tx.value is not None, (
"Transaction value must be set before sending them to the RPC."
)
- if len(last_tx_batch) >= MAX_TXS_PER_BATCH:
+ if len(last_tx_batch) >= max_txs_per_batch:
transaction_batches.append(last_tx_batch)
last_tx_batch = []
last_tx_batch.append(tx)
@@ -869,16 +894,13 @@ def send_pending_transactions(self) -> List[TransactionByHashResponse]:
for tx_batch in transaction_batches:
txs = [tx.with_signature_and_sender() for tx in tx_batch]
tx_hashes = self._eth_rpc.send_transactions(txs)
+ hash_strs = [str(h) for h in tx_hashes[:5]]
+ n_hashes = len(tx_hashes)
+ extra = f" and {n_hashes - 5} more" if n_hashes > 5 else ""
+ logger.info(f"Sent {n_hashes} transactions: {hash_strs}{extra}")
logger.info(
- f"Sent {len(tx_hashes)} transactions: {[str(h) for h in tx_hashes[:5]]}"
- + (
- f" and {len(tx_hashes) - 5} more"
- if len(tx_hashes) > 5
- else ""
- )
- )
- logger.info(
- f"Waiting for {len(tx_batch)} transactions to be included in blocks"
+ f"Waiting for {len(tx_batch)} transactions to be included "
+ "in blocks"
)
responses += self._eth_rpc.wait_for_transactions(tx_batch)
logger.info(
@@ -948,18 +970,23 @@ def pre(
refund_gas_limit = 21_000
tx_cost = refund_gas_limit * max_fee_per_gas
if remaining_balance < tx_cost:
+ rem_eth = remaining_balance / 10**18
+ cost_eth = tx_cost / 10**18
logger.debug(
f"Skipping refund for EOA {eoa} (label={eoa.label}): "
- f"insufficient balance {remaining_balance / 10**18:.18f} ETH < "
- f"transaction cost {tx_cost / 10**18:.18f} ETH"
+ f"insufficient balance {rem_eth:.18f} ETH < "
+ f"transaction cost {cost_eth:.18f} ETH"
)
skipped_refunds += 1
continue
refund_value = remaining_balance - tx_cost
+ ref_eth = refund_value / 10**18
+ rem_eth = remaining_balance / 10**18
+ cost_eth = tx_cost / 10**18
logger.debug(
f"Preparing refund transaction for EOA {eoa} (label={eoa.label}): "
- f"{refund_value / 10**18:.18f} ETH (remaining: {remaining_balance / 10**18:.18f} ETH, "
- f"cost: {tx_cost / 10**18:.18f} ETH)"
+ f"{ref_eth:.18f} ETH (remaining: {rem_eth:.18f} ETH, "
+ f"cost: {cost_eth:.18f} ETH)"
)
refund_tx = Transaction(
sender=eoa,
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/rpc/chain_builder_eth_rpc.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/rpc/chain_builder_eth_rpc.py
index 85ac615e4e5..6702c5d0eab 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/rpc/chain_builder_eth_rpc.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/rpc/chain_builder_eth_rpc.py
@@ -453,8 +453,9 @@ def wait_for_transactions(
for tx_hash, tx in pending_responses.items()
]
)
+ missing_str = ", ".join(missing_txs_strings)
raise Exception(
- f"Transactions {', '.join(missing_txs_strings)} were not included in a block "
+ f"Transactions {missing_str} were not included in a block "
f"within {self.transaction_wait_timeout} seconds:\n"
f"{pending_tx_responses_string}"
)
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/rpc/hive.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/rpc/hive.py
index 5c2a82cd5a4..10c23aa78b7 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/rpc/hive.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/rpc/hive.py
@@ -58,8 +58,12 @@ def pytest_addoption(parser: pytest.Parser) -> None:
action="store",
dest="tx_wait_timeout",
type=int,
- default=10, # Lowered from Remote RPC because of the consistent block production
- help="Maximum time in seconds to wait for a transaction to be included in a block",
+ # Lowered from Remote RPC because of consistent block production
+ default=10,
+ help=(
+ "Maximum time in seconds to wait for a transaction to be "
+ "included in a block"
+ ),
)
@@ -251,7 +255,8 @@ def base_hive_test(
test = test_suite.start_test(
name="Base Hive Test",
description=(
- "Base test used to deploy the main client to be used throughout all tests."
+ "Base test used to deploy the main client to be used "
+ "throughout all tests."
),
)
with open(base_file, "w") as f:
@@ -337,8 +342,9 @@ def client(
)
error_message = (
- f"Unable to connect to the client container ({client_type.name}) via Hive during test "
- "setup. Check the client or Hive server logs for more information."
+ f"Unable to connect to the client container ({client_type.name}) "
+ "via Hive during test setup. Check the client or Hive server logs "
+ "for more information."
)
assert client is not None, error_message
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/rpc/remote.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/rpc/remote.py
index f8b332dfb9f..78609d4fe9f 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/rpc/remote.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/rpc/remote.py
@@ -33,7 +33,10 @@ def pytest_addoption(parser: pytest.Parser) -> None:
dest="tx_wait_timeout",
type=int,
default=60,
- help="Maximum time in seconds to wait for a transaction to be included in a block",
+ help=(
+ "Maximum time in seconds to wait for a transaction to be "
+ "included in a block"
+ ),
)
remote_rpc_group.addoption(
"--address-stubs",
@@ -41,8 +44,11 @@ def pytest_addoption(parser: pytest.Parser) -> None:
dest="address_stubs",
default=AddressStubs(root={}),
type=AddressStubs.model_validate_json_or_file,
- help="The address stubs for contracts that have already been placed in the chain and to "
- "use for the test. Can be a JSON formatted string or a path to a YAML or JSON file.",
+ help=(
+ "The address stubs for contracts that have already been placed "
+ "in the chain and to use for the test. Can be a JSON formatted "
+ "string or a path to a YAML or JSON file."
+ ),
)
engine_rpc_group = parser.getgroup(
@@ -54,10 +60,13 @@ def pytest_addoption(parser: pytest.Parser) -> None:
action="store",
default=None,
dest="engine_endpoint",
- help="Engine endpoint to an execution client, which implies that the execute command "
- "will be used to drive the chain. If not provided, it's assumed that the execution client "
- "is connected to a beacon node and the chain progresses automatically. If provided, the "
- "JWT secret must be provided as well.",
+ help=(
+ "Engine endpoint to an execution client, which implies that the "
+ "execute command will be used to drive the chain. If not "
+ "provided, it's assumed that the execution client is connected "
+ "to a beacon node and the chain progresses automatically. If "
+ "provided, the JWT secret must be provided as well."
+ ),
)
engine_rpc_group.addoption(
"--engine-jwt-secret",
@@ -65,8 +74,11 @@ def pytest_addoption(parser: pytest.Parser) -> None:
action="store",
default=None,
dest="engine_jwt_secret",
- help="JWT secret to be used to authenticate with the engine endpoint. Provided string "
- "will be converted to bytes using the UTF-8 encoding.",
+ help=(
+ "JWT secret to be used to authenticate with the engine endpoint. "
+ "Provided string will be converted to bytes using the UTF-8 "
+ "encoding."
+ ),
)
engine_rpc_group.addoption(
"--engine-jwt-secret-file",
@@ -74,14 +86,17 @@ def pytest_addoption(parser: pytest.Parser) -> None:
action="store",
default=None,
dest="engine_jwt_secret_file",
- help="Path to a file containing the JWT secret to be used to authenticate with the engine "
- "endpoint. The file must contain only the JWT secret as a hex string.",
+ help=(
+ "Path to a file containing the JWT secret to be used to "
+ "authenticate with the engine endpoint. The file must contain "
+ "only the JWT secret as a hex string."
+ ),
)
def pytest_configure(config: pytest.Config) -> None:
"""Check if a chain ID configuration is provided."""
- # Verify the chain ID configuration is consistent with the remote RPC endpoint
+ # Verify chain ID config is consistent with the remote RPC endpoint
rpc_endpoint = config.getoption("rpc_endpoint") or os.environ.get(
"RPC_ENDPOINT"
)
@@ -92,11 +107,13 @@ def pytest_configure(config: pytest.Config) -> None:
)
eth_rpc = EthRPC(rpc_endpoint)
remote_chain_id = eth_rpc.chain_id()
- if remote_chain_id != ChainConfigDefaults.chain_id:
+ configured_chain_id = ChainConfigDefaults.chain_id
+ if remote_chain_id != configured_chain_id:
pytest.exit(
- f"Chain ID obtained from the remote RPC endpoint ({remote_chain_id}) does not match "
- f"the configured chain ID ({ChainConfigDefaults.chain_id})."
- "Please check if the chain ID is correctly configured with the --chain-id flag."
+ f"Chain ID obtained from the remote RPC endpoint "
+ f"({remote_chain_id}) does not match the configured chain ID "
+ f"({configured_chain_id}). Please check if the chain ID is "
+ "correctly configured with the --chain-id flag."
)
engine_endpoint = config.getoption("engine_endpoint")
engine_rpc = None
@@ -106,8 +123,9 @@ def pytest_configure(config: pytest.Config) -> None:
if jwt_secret is None and jwt_secret_file is None:
pytest.exit(
"JWT secret must be provided if engine endpoint is provided. "
- "Please check if the JWT secret is correctly configured with the "
- "--engine-jwt-secret or --engine-jwt-secret-file flag."
+ "Please check if the JWT secret is correctly configured "
+ "with the --engine-jwt-secret or --engine-jwt-secret-file "
+ "flag."
)
elif jwt_secret_file is not None:
with open(jwt_secret_file, "r") as f:
@@ -119,8 +137,8 @@ def pytest_configure(config: pytest.Config) -> None:
except ValueError:
pytest.exit(
"JWT secret must be a hex string if provided as a file. "
- "Please check if the JWT secret is correctly configured with the "
- "--engine-jwt-secret-file flag."
+ "Please check if the JWT secret is correctly configured "
+ "with the --engine-jwt-secret-file flag."
)
if isinstance(jwt_secret, str):
jwt_secret = jwt_secret.encode("utf-8")
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/rpc/remote_seed_sender.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/rpc/remote_seed_sender.py
index 8c3569b3007..5a0480f08c3 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/rpc/remote_seed_sender.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/rpc/remote_seed_sender.py
@@ -26,11 +26,12 @@ def pytest_addoption(parser: pytest.Parser) -> None:
required=False,
dest="rpc_seed_key",
help=(
- "Seed key used to fund all sender keys. This account must have a balance of at least "
- "`sender_key_initial_balance` * `workers` + gas fees. It should also be "
- "exclusively used by this command because the nonce is only checked once and if "
- "it's externally increased, the seed transactions might fail. "
- "Can also be set via RPC_SEED_KEY environment variable."
+ "Seed key used to fund all sender keys. This account must have "
+ "a balance of at least `sender_key_initial_balance` * `workers` "
+ "+ gas fees. It should also be exclusively used by this command "
+ "because the nonce is only checked once and if it's externally "
+ "increased, the seed transactions might fail. Can also be set "
+ "via RPC_SEED_KEY environment variable."
),
)
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/sender.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/sender.py
index e1305047b37..fc403f34647 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/sender.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/sender.py
@@ -39,8 +39,8 @@ def pytest_addoption(parser: pytest.Parser) -> None:
type=Wei,
default=None,
help=(
- "Gas price set for the funding transactions of each worker's sender key. "
- "Default=None (1.5x current network gas price)"
+ "Gas price set for the funding transactions of each worker's "
+ "sender key. Default=None (1.5x current network gas price)"
),
)
@@ -91,8 +91,9 @@ def seed_account_sweep_amount(request: pytest.FixtureRequest) -> int | None:
"""Get the seed account sweep amount."""
sweep_amount = request.config.option.seed_account_sweep_amount
if sweep_amount is not None:
+ sweep_eth = sweep_amount / 10**18
logger.info(
- f"Using specified seed account sweep amount: {sweep_amount / 10**18:.18f} ETH"
+ f"Using specified seed account sweep amount: {sweep_eth:.18f} ETH"
)
else:
logger.info(
@@ -140,8 +141,10 @@ def worker_key_funding_amount(
if base_file.exists():
# Some other worker already did this for us, use that value.
cached_amount = int(base_file.read_text())
+ cached_eth = cached_amount / 10**18
logger.info(
- f"Using cached worker key funding amount: {cached_amount / 10**18:.18f} ETH"
+ f"Using cached worker key funding amount: "
+ f"{cached_eth:.18f} ETH"
)
return cached_amount
@@ -167,10 +170,12 @@ def worker_key_funding_amount(
sender_fund_refund_gas_limit
* sender_funding_transactions_gas_price
)
+ tx_cost_eth = funding_tx_cost / 10**18
+ gas_gwei = sender_funding_transactions_gas_price / 10**9
logger.info(
- f"Funding transaction cost: {funding_tx_cost / 10**18:.18f} ETH "
+ f"Funding transaction cost: {tx_cost_eth:.18f} ETH "
f"(gas_limit={sender_fund_refund_gas_limit}, "
- f"gas_price={sender_funding_transactions_gas_price / 10**9:.9f} Gwei)"
+ f"gas_price={gas_gwei:.9f} Gwei)"
)
# Subtract the cost of the transaction that is going to be sent to
# the seed sender
@@ -178,10 +183,12 @@ def worker_key_funding_amount(
seed_sender_balance_per_worker - funding_tx_cost
)
if worker_key_funding_amount <= 0:
+ avail_eth = available_amount / 10**18
+ fund_cost_eth = funding_tx_cost / 10**18
logger.error(
- f"{amount_source} is too low to distribute to {worker_count} workers. "
- f"Available: {available_amount / 10**18:.6f} ETH, "
- f"Funding cost: {funding_tx_cost / 10**18:.6f} ETH"
+ f"{amount_source} is too low to distribute to "
+ f"{worker_count} workers. Available: {avail_eth:.6f} ETH, "
+ f"Funding cost: {fund_cost_eth:.6f} ETH"
)
raise AssertionError(
f"""
@@ -194,10 +201,13 @@ def worker_key_funding_amount(
negative value.
"""
)
+ wk_fund_eth = worker_key_funding_amount / 10**18
+ per_worker_eth = seed_sender_balance_per_worker / 10**18
+ tx_cost_eth = funding_tx_cost / 10**18
logger.info(
- f"Calculated worker key funding amount: {worker_key_funding_amount / 10**18:.18f} ETH "
- f"({seed_sender_balance_per_worker / 10**18:.18f} ETH per worker - "
- f"{funding_tx_cost / 10**18:.18f} ETH transaction cost)"
+ f"Calculated worker key funding amount: {wk_fund_eth:.18f} ETH "
+ f"({per_worker_eth:.18f} ETH per worker - "
+ f"{tx_cost_eth:.18f} ETH transaction cost)"
)
# Write the value to the file for the rest of the workers to use.
base_file.write_text(str(worker_key_funding_amount))
@@ -277,8 +287,9 @@ def session_worker_key(
gas_price=sender_funding_transactions_gas_price,
value=worker_key_funding_amount,
).with_signature_and_sender()
+ fund_eth = worker_key_funding_amount / 10**18
logger.info(
- f"Preparing funding transaction: {worker_key_funding_amount / 10**18:.18f} ETH "
+ f"Preparing funding transaction: {fund_eth:.18f} ETH "
f"from {seed_key} to {worker_key} (nonce={seed_key.nonce})"
)
if not dry_run:
@@ -318,15 +329,18 @@ def session_worker_key(
# any other transaction that might have been sent by the sender.
refund_gas_price = sender_funding_transactions_gas_price * 2
tx_cost = refund_gas_limit * refund_gas_price
+ tx_cost_eth = tx_cost / 10**18
+ gas_gwei = refund_gas_price / 10**9
logger.debug(
- f"Refund transaction cost: {tx_cost / 10**18:.18f} ETH "
- f"(gas_limit={refund_gas_limit}, gas_price={refund_gas_price / 10**9:.9f} Gwei)"
+ f"Refund transaction cost: {tx_cost_eth:.18f} ETH "
+ f"(gas_limit={refund_gas_limit}, gas_price={gas_gwei:.9f} Gwei)"
)
if (remaining_balance - 1) < tx_cost:
+ rem_eth = remaining_balance / 10**18
logger.warning(
- f"Insufficient balance for refund: {remaining_balance / 10**18:.18f} ETH < "
- f"{tx_cost / 10**18:.18f} ETH (transaction cost). Skipping refund."
+ f"Insufficient balance for refund: {rem_eth:.18f} ETH < "
+ f"{tx_cost_eth:.18f} ETH (transaction cost). Skipping refund."
)
return
@@ -366,17 +380,15 @@ def worker_key(
)
)
if rpc_nonce != session_worker_key.nonce:
- logger.info(
- f"Worker key nonce mismatch: {session_worker_key.nonce} != {rpc_nonce}"
- )
+ wk_nonce = session_worker_key.nonce
+ logger.info(f"Worker key nonce mismatch: {wk_nonce} != {rpc_nonce}")
logger.info(f"Updating worker key nonce to {rpc_nonce}")
session_worker_key.nonce = rpc_nonce
# Record the start balance of the worker key
worker_key_start_balance = eth_rpc.get_balance(session_worker_key)
- logger.debug(
- f"Worker key start balance: {worker_key_start_balance / 10**18:.18f} ETH"
- )
+ start_eth = worker_key_start_balance / 10**18
+ logger.debug(f"Worker key start balance: {start_eth:.18f} ETH")
yield session_worker_key
@@ -385,10 +397,12 @@ def worker_key(
)
final_balance = eth_rpc.get_balance(session_worker_key)
used_balance = worker_key_start_balance - final_balance
+ used_eth = used_balance / 10**18
+ start_eth = worker_key_start_balance / 10**18
+ final_eth = final_balance / 10**18
logger.info(
- f"Worker key {session_worker_key} used balance: {used_balance / 10**18:.18f} ETH "
- f"(start: {worker_key_start_balance / 10**18:.18f} ETH, "
- f"final: {final_balance / 10**18:.18f} ETH)"
+ f"Worker key {session_worker_key} used balance: {used_eth:.18f} ETH "
+ f"(start: {start_eth:.18f} ETH, final: {final_eth:.18f} ETH)"
)
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/tests/test_pre_alloc.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/tests/test_pre_alloc.py
index 452e9e61a27..93200201570 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/tests/test_pre_alloc.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/tests/test_pre_alloc.py
@@ -52,7 +52,7 @@ def test_address_stubs(input_value: Any, expected: AddressStubs) -> None:
),
pytest.param(
"one_address.json",
- '{"DEPOSIT_CONTRACT_ADDRESS": "0x00000000219ab540356cbb839cbe05303d7705fa"}',
+ '{"DEPOSIT_CONTRACT_ADDRESS": "0x00000000219ab540356cbb839cbe05303d7705fa"}', # noqa: E501
AddressStubs(
{
"DEPOSIT_CONTRACT_ADDRESS": Address(
@@ -64,7 +64,7 @@ def test_address_stubs(input_value: Any, expected: AddressStubs) -> None:
),
pytest.param(
"one_address.yaml",
- "DEPOSIT_CONTRACT_ADDRESS: 0x00000000219ab540356cbb839cbe05303d7705fa",
+ "DEPOSIT_CONTRACT_ADDRESS: 0x00000000219ab540356cbb839cbe05303d7705fa", # noqa: E501
AddressStubs(
{
"DEPOSIT_CONTRACT_ADDRESS": Address(
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/eip_checklist.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/eip_checklist.py
index 228e9931336..ade7ec83288 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/eip_checklist.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/eip_checklist.py
@@ -218,15 +218,17 @@ def from_items(
return None
details = [
- "The following checklist items were marked both as not applicable and covered:",
+ "The following checklist items were marked both "
+ "as not applicable and covered:",
"",
"| ID | Description | Not Applicable | Tests |",
"|---|---|---|---|",
]
for item in conflicting_items:
+ tests_str = ", ".join(sorted(item.tests))
details.append(
f"| {item.id} | {item.description} | "
- + f"{item.not_applicable_reason} | {', '.join(sorted(item.tests))} |"
+ f"{item.not_applicable_reason} | {tests_str} |"
)
return cls(details=details)
@@ -252,11 +254,6 @@ def covered_items(self) -> int:
for item in self.items.values()
if item.covered and not item.not_applicable
)
- return sum(
- 1
- for item in self.items.values()
- if item.covered and not item.not_applicable
- )
@property
def total_items(self) -> int:
@@ -315,7 +312,7 @@ def mark_not_applicable(self) -> None:
ids = resolve_id(item_id)
if not ids:
logger.warning(
- f"Item ID {item_id} not found in the checklist template, "
+ f"Item ID {item_id} not found in checklist template "
f"for EIP {self.number}"
)
continue
@@ -343,7 +340,7 @@ def mark_external_coverage(self) -> None:
ids = resolve_id(item_id)
if not ids:
logger.warning(
- f"Item ID {item_id} not found in the checklist template, "
+ f"Item ID {item_id} not found in checklist template "
f"for EIP {self.number}"
)
continue
@@ -362,9 +359,10 @@ def generate_filled_checklist_lines(self) -> List[str]:
# Find the line with this item ID
lines[checklist_item.line_number - 1] = str(checklist_item)
+ emoji = self.completeness_emoji
+ pct = f"{self.percentage:.2f}%"
lines[lines.index(PERCENTAGE_LINE)] = (
- f"| {self.total_items} | {self.covered_items} | {self.completeness_emoji} "
- f"{self.percentage:.2f}% |"
+ f"| {self.total_items} | {self.covered_items} | {emoji} {pct} |"
)
# Replace the title line with the EIP number
@@ -451,8 +449,8 @@ def collect_from_item(
for marker in item.iter_markers("eip_checklist"):
if not marker.args:
pytest.fail(
- f"eip_checklist marker on {item.nodeid} must have at least one argument "
- "(item_id)"
+ f"eip_checklist marker on {item.nodeid} must have "
+ "at least one argument (item_id)"
)
additional_eips = marker.kwargs.get("eip", [])
if not isinstance(additional_eips, list):
@@ -463,8 +461,8 @@ def collect_from_item(
if additional_eips:
if any(not isinstance(eip, int) for eip in additional_eips):
pytest.fail(
- "EIP numbers must be integers. Found non-integer EIPs in "
- f"{item.nodeid}: {additional_eips}"
+ "EIP numbers must be integers. Found non-integer "
+ f"EIPs in {item.nodeid}: {additional_eips}"
)
eips += [self.get_eip(eip) for eip in additional_eips]
@@ -473,7 +471,7 @@ def collect_from_item(
covered_ids = resolve_id(item_id.strip())
if not covered_ids:
logger.warning(
- f"Item ID {item_id} not found in the checklist template, "
+ f"Item ID {item_id} not found in checklist template "
f"for test {item.nodeid}"
)
continue
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/filler.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/filler.py
index e75f01f2279..55a8f37c1e9 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/filler.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/filler.py
@@ -322,9 +322,10 @@ def get_pre_alloc_group(self, hash_key: str) -> PreAllocGroup:
self.fixture_output.pre_alloc_groups_folder_path / hash_key
)
raise ValueError(
- f"Pre-allocation hash {hash_key} not found in pre-allocation groups. "
- f"Please check the pre-allocation groups file at: {pre_alloc_path}. "
- "Make sure phase 1 (--generate-pre-alloc-groups) was run before phase 2."
+ f"Pre-allocation hash {hash_key} not found in "
+ f"pre-allocation groups. Please check the file at: "
+ f"{pre_alloc_path}. Make sure phase 1 "
+ "(--generate-pre-alloc-groups) was run before phase 2."
)
return self.pre_alloc_groups[hash_key]
@@ -442,8 +443,8 @@ def pytest_addoption(parser: pytest.Parser) -> None:
type=Path,
default=None,
help=(
- "Path to an evm executable (or name of an executable in the PATH) that provides `t8n`."
- " Default: `ethereum-spec-evm-resolver`."
+ "Path to an evm executable (or name of an executable in the "
+ "PATH) that provides `t8n`. Default: `ethereum-spec-evm-resolver`."
),
)
evm_group.addoption(
@@ -453,8 +454,8 @@ def pytest_addoption(parser: pytest.Parser) -> None:
type=str,
default=None,
help=(
- "[INTERNAL USE ONLY] URL of the t8n server to use. Used by framework tests/ci; not "
- "intended for regular CLI use."
+ "[INTERNAL USE ONLY] URL of the t8n server to use. Used by "
+ "framework tests/ci; not intended for regular CLI use."
),
)
evm_group.addoption(
@@ -462,7 +463,7 @@ def pytest_addoption(parser: pytest.Parser) -> None:
action="store_true",
dest="evm_collect_traces",
default=None,
- help="Collect traces of the execution information from the transition tool.",
+ help="Collect traces of execution info from the transition tool.",
)
evm_group.addoption(
"--verify-fixtures",
@@ -470,10 +471,12 @@ def pytest_addoption(parser: pytest.Parser) -> None:
dest="verify_fixtures",
default=False,
help=(
- "Verify generated fixture JSON files using geth's evm blocktest command. "
- "By default, the same evm binary as for the t8n tool is used. A different (geth) evm "
- "binary may be specified via --verify-fixtures-bin, this must be specified if filling "
- "with a non-geth t8n tool that does not support blocktest."
+ "Verify generated fixture JSON files using geth's evm "
+ "blocktest command. By default, the same evm binary as for "
+ "the t8n tool is used. A different (geth) evm binary may be "
+ "specified via --verify-fixtures-bin, this must be specified "
+ "if filling with a non-geth t8n tool that does not support "
+ "blocktest."
),
)
evm_group.addoption(
@@ -506,11 +509,13 @@ def pytest_addoption(parser: pytest.Parser) -> None:
type=Path,
default=Path(default_output_directory()),
help=(
- "Directory path to store the generated test fixtures. Must be empty if it exists. "
- "If the specified path ends in '.tar.gz', then the specified tarball is additionally "
- "created (the fixtures are still written to the specified path without the '.tar.gz' "
- f"suffix). Tarball output automatically enables --generate-all-formats. "
- f"Can be deleted. Default: '{default_output_directory()}'."
+ "Directory path to store the generated test fixtures. "
+ "Must be empty if it exists. If the specified path ends in "
+ "'.tar.gz', then the specified tarball is additionally "
+ "created (the fixtures are still written to the specified "
+ "path without the '.tar.gz' suffix). Tarball output "
+ "automatically enables --generate-all-formats. Can be "
+ f"deleted. Default: '{default_output_directory()}'."
),
)
test_group.addoption(
@@ -526,8 +531,9 @@ def pytest_addoption(parser: pytest.Parser) -> None:
dest="single_fixture_per_file",
default=False,
help=(
- "Don't group fixtures in JSON files by test function; write each fixture to its own "
- "file. This can be used to increase the granularity of --verify-fixtures."
+ "Don't group fixtures in JSON files by test function; write "
+ "each fixture to its own file. This can be used to increase "
+ "the granularity of --verify-fixtures."
),
)
test_group.addoption(
@@ -562,8 +568,9 @@ def pytest_addoption(parser: pytest.Parser) -> None:
default=EnvironmentDefaults.gas_limit,
type=int,
help=(
- "Default gas limit used ceiling used for blocks and tests that attempt to "
- f"consume an entire block's gas. (Default: {EnvironmentDefaults.gas_limit})"
+ "Default gas limit ceiling for blocks and tests that attempt "
+ f"to consume an entire block's gas. "
+ f"(Default: {EnvironmentDefaults.gas_limit})"
),
)
test_group.addoption(
@@ -586,9 +593,9 @@ def pytest_addoption(parser: pytest.Parser) -> None:
dest="generate_all_formats",
default=False,
help=(
- "Generate all fixture formats including BlockchainEngineXFixture. "
- "This enables two-phase execution: Phase 1 generates pre-allocation groups, "
- "phase 2 generates all supported fixture formats."
+ "Generate all fixture formats including BlockchainEngineX. "
+ "Enables two-phase execution: Phase 1 generates pre-allocation "
+ "groups, phase 2 generates all supported fixture formats."
),
)
@@ -602,9 +609,9 @@ def pytest_addoption(parser: pytest.Parser) -> None:
dest="optimize_gas",
default=False,
help=(
- "Attempt to optimize the gas used in every transaction for the filled tests, "
- "then print the minimum amount of gas at which the test still produces a correct "
- "post state and the exact same trace."
+ "Attempt to optimize gas used in every transaction for filled "
+ "tests, then print the minimum gas at which the test still "
+ "produces a correct post state and the exact same trace."
),
)
optimize_gas_group.addoption(
@@ -625,8 +632,8 @@ def pytest_addoption(parser: pytest.Parser) -> None:
default=None,
type=int,
help=(
- "Maximum gas limit for gas optimization, if reached the search will stop and "
- "fail for that given test. Requires `--optimize-gas`."
+ "Maximum gas limit for gas optimization, if reached the search "
+ "will stop and fail for that test. Requires `--optimize-gas`."
),
)
optimize_gas_group.addoption(
@@ -635,9 +642,9 @@ def pytest_addoption(parser: pytest.Parser) -> None:
dest="optimize_gas_post_processing",
default=False,
help=(
- "Post process the traces during gas optimization in order to Account for "
- "opcodes that put the current gas in the stack, in order to remove "
- "remaining-gas from the comparison."
+ "Post process traces during gas optimization to account for "
+ "opcodes that put the current gas in the stack, in order to "
+ "remove remaining-gas from the comparison."
),
)
@@ -755,8 +762,8 @@ def pytest_configure(config: pytest.Config) -> None:
and not t8n.supports_xdist
):
pytest.exit(
- f"The {t8n.__class__.__name__} t8n tool does not work well with the xdist plugin;"
- "use -n=0.",
+ f"The {t8n.__class__.__name__} t8n tool does not work well "
+ "with the xdist plugin; use -n=0.",
returncode=pytest.ExitCode.USAGE_ERROR,
)
config.t8n = t8n # type: ignore[attr-defined]
@@ -849,8 +856,8 @@ def pytest_terminal_summary(
terminalreporter.write_sep(
"=",
- f" Phase 1 Complete: Generated {total_groups} pre-allocation groups "
- f"({total_accounts} total accounts) ",
+ f" Phase 1 Complete: Generated {total_groups} pre-alloc "
+ f"groups ({total_accounts} total accounts) ",
bold=True,
green=True,
)
@@ -862,8 +869,8 @@ def pytest_terminal_summary(
terminalreporter.write_sep(
"=",
(
- f' No tests executed - the test fixtures in "{output_dir}" may now be '
- "executed against a client "
+ f" No tests executed - the test fixtures in "
+ f'"{output_dir}" may now be executed against a client '
),
bold=True,
yellow=True,
@@ -879,7 +886,8 @@ def pytest_html_results_table_header(cells: Any) -> None:
"""Customize the table headers of the HTML report table."""
cells.insert(
3,
- 'JSON Fixture File | ',
+ ''
+ "JSON Fixture File | ",
)
cells.insert(
4,
@@ -899,7 +907,10 @@ def pytest_html_results_table_row(report: Any, cells: Any) -> None:
):
fixture_path_absolute = user_props["fixture_path_absolute"]
fixture_path_relative = user_props["fixture_path_relative"]
- fixture_path_link = f'{fixture_path_relative}'
+ fixture_path_link = (
+ f''
+ f"{fixture_path_relative}"
+ )
cells.insert(3, f"{fixture_path_link} | ")
elif report.failed:
cells.insert(3, "Fixture unavailable | ")
@@ -907,14 +918,18 @@ def pytest_html_results_table_row(report: Any, cells: Any) -> None:
if user_props["evm_dump_dir"] is None:
cells.insert(
4,
- "For t8n debug info use --evm-dump-dir=path --traces | ",
+ "For t8n debug info use "
+ "--evm-dump-dir=path --traces | ",
)
else:
evm_dump_dir = user_props.get("evm_dump_dir")
if evm_dump_dir == "N/A":
evm_dump_entry = "N/A"
else:
- evm_dump_entry = f'{evm_dump_dir}'
+ evm_dump_entry = (
+ f''
+ f"{evm_dump_dir}"
+ )
cells.insert(4, f"{evm_dump_entry} | ")
del cells[-1] # Remove the "Links" column
@@ -984,11 +999,12 @@ def t8n(
"""Return configured transition tool."""
t8n: TransitionTool = request.config.t8n # type: ignore
if not t8n.exception_mapper.reliable:
+ t8n_name = t8n.__class__.__name__
warnings.warn(
- f"The t8n tool that is currently being used to fill tests ({t8n.__class__.__name__}) "
- "does not provide reliable exception messages. This may lead to false positives when "
- "writing tests and extra care should be taken when writing tests that produce "
- "exceptions.",
+ f"The t8n tool being used to fill tests ({t8n_name}) "
+ "does not provide reliable exception messages. This may lead to "
+ "false positives when writing tests and extra care should be "
+ "taken when writing tests that produce exceptions.",
stacklevel=2,
)
yield t8n
@@ -1039,16 +1055,18 @@ def evm_fixture_verification(
except Exception:
if reused_evm_bin:
pytest.exit(
- "The binary specified in --evm-bin could not be recognized as a known "
- "FixtureConsumerTool. Either remove --verify-fixtures or set "
- "--verify-fixtures-bin to a known fixture consumer binary.",
+ "The binary specified in --evm-bin could not be recognized "
+ "as a known FixtureConsumerTool. Either remove "
+ "--verify-fixtures or set --verify-fixtures-bin to a known "
+ "fixture consumer binary.",
returncode=pytest.ExitCode.USAGE_ERROR,
)
else:
pytest.exit(
- "Specified binary in --verify-fixtures-bin could not be recognized as a known "
- "FixtureConsumerTool. Please see `GethFixtureConsumer` for an example "
- "of how a new fixture consumer can be defined.",
+ "Specified binary in --verify-fixtures-bin could not be "
+ "recognized as a known FixtureConsumerTool. Please see "
+ "`GethFixtureConsumer` for an example of how a new fixture "
+ "consumer can be defined.",
returncode=pytest.ExitCode.USAGE_ERROR,
)
yield evm_fixture_verification
@@ -1119,7 +1137,8 @@ def create_properties_file(
config[key.lower()] = val
else:
warnings.warn(
- f"Fixtures ini file: Skipping metadata key {key} with value {val}.",
+ f"Fixtures ini file: Skipping metadata key {key} "
+ f"with value {val}.",
stacklevel=2,
)
config["environment"] = environment_properties
@@ -1274,7 +1293,10 @@ def fixture_source_url(
test_module_relative_path,
branch_or_commit_or_tag=commit_hash_or_tag,
)
- github_url += f" called via `{request.node.originalname}()` in {test_module_github_url}"
+ github_url += (
+ f" called via `{request.node.originalname}()` "
+ f"in {test_module_github_url}"
+ )
return github_url
@@ -1319,6 +1341,7 @@ def base_test_parametrizer_func(
When parametrize, indirect must be used along with the fixture format
as value.
"""
+ del fixed_opcode_count
if hasattr(request.node, "fixture_format"):
fixture_format = request.node.fixture_format
else:
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/fixture_output.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/fixture_output.py
index d08064b5aa8..110f0934342 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/fixture_output.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/fixture_output.py
@@ -27,7 +27,7 @@ class FixtureOutput(BaseModel):
)
clean: bool = Field(
default=False,
- description="Clean (remove) the output directory before filling fixtures.",
+ description="Clean (remove) output directory before filling.",
)
generate_pre_alloc_groups: bool = Field(
default=False,
@@ -39,7 +39,7 @@ class FixtureOutput(BaseModel):
)
should_generate_all_formats: bool = Field(
default=False,
- description="Generate all fixture formats including BlockchainEngineXFixture.",
+ description="Generate all formats including BlockchainEngineXFixture.",
)
@property
@@ -190,9 +190,10 @@ def create_directories(self, is_master: bool) -> None:
if self.generate_pre_alloc_groups:
raise ValueError(
- f"Output directory '{self.directory}' must be completely empty for "
- f"pre-allocation group generation (phase 1). Contains: {summary}. "
- "Use --clean to remove all existing files."
+ f"Output directory '{self.directory}' must be completely "
+ f"empty for pre-allocation group generation (phase 1). "
+ f"Contains: {summary}. Use --clean to remove all "
+ "existing files."
)
elif self.use_pre_alloc_groups:
if not self.pre_alloc_groups_folder_path.exists():
@@ -204,8 +205,8 @@ def create_directories(self, is_master: bool) -> None:
else:
raise ValueError(
f"Output directory '{self.directory}' is not empty. "
- f"Contains: {summary}. Use --clean to remove all existing files "
- "or specify a different output directory."
+ f"Contains: {summary}. Use --clean to remove all "
+ "existing files or specify a different output directory."
)
# Create directories
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/gen_test_doc/gen_test_doc.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/gen_test_doc/gen_test_doc.py
index 235c7d49c27..216bc074228 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/gen_test_doc/gen_test_doc.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/gen_test_doc/gen_test_doc.py
@@ -88,7 +88,9 @@ def pytest_addoption(parser: pytest.Parser) -> None: # noqa: D103
action="store_true",
dest="gen_docs",
default=False,
- help="Generate documentation for all collected tests for use in for mkdocs",
+ help=(
+ "Generate documentation for all collected tests for use in mkdocs"
+ ),
)
gen_docs.addoption(
"--gen-docs-target-fork",
@@ -96,8 +98,8 @@ def pytest_addoption(parser: pytest.Parser) -> None: # noqa: D103
dest="gen_docs_target_fork",
default=None,
help=(
- "The default fork to use generated in generated doc pages. Should be the name of the "
- "next upcoming fork."
+ "The default fork to use generated in generated doc pages. "
+ "Should be the name of the next upcoming fork."
),
)
@@ -193,9 +195,10 @@ def get_docstring_one_liner(item: pytest.Item) -> str:
docstring in docstring_test_function_history
and docstring_test_function_history[docstring] != test_function_id
):
+ history_id = docstring_test_function_history[docstring]
logger.info(
f"Duplicate docstring for {test_function_id}: "
- f"{docstring_test_function_history[docstring]} and {test_function_id}"
+ f"{history_id} and {test_function_id}"
)
else:
docstring_test_function_history[docstring] = test_function_id
@@ -233,7 +236,9 @@ def get_test_function_test_type(item: pytest.Item) -> str:
logger.warning(
f"Could not determine the test function type for {item.nodeid}"
)
- return f"unknown ([๐๐]({create_github_issue_url('docs(bug): unknown test function type')}))"
+ issue_title = "docs(bug): unknown test function type"
+ issue_url = create_github_issue_url(issue_title)
+ return f"unknown ([๐๐]({issue_url}))"
class TestDocsGenerator:
@@ -354,15 +359,16 @@ def get_doc_site_base_url(self) -> str:
return f"/execution-spec-tests/{github_ref_name}/"
if ci and not github_ref_name:
raise Exception(
- "Failed to determine target doc version (no GITHUB_REF_NAME env?)."
+ "Failed to determine target doc version "
+ "(no GITHUB_REF_NAME env?)."
)
if (
"--strict" in sys.argv or "deploy" in sys.argv
) and not doc_version:
# assume we're trying to deploy manually via mike (locally)
raise Exception(
- "Failed to determine target doc version during strict build (set "
- "GEN_TEST_DOC_VERSION env var)."
+ "Failed to determine target doc version during strict build "
+ "(set GEN_TEST_DOC_VERSION env var)."
)
# local test build, e.g. via `uv run mkdocs serve`
return "/execution-spec-tests/"
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/gen_test_doc/page_props.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/gen_test_doc/page_props.py
index 9e44233cfc2..c286b10a032 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/gen_test_doc/page_props.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/gen_test_doc/page_props.py
@@ -26,10 +26,11 @@ def apply_name_filters(input_string: str) -> str:
Apply a list of capitalizations/regexes to names used in titles & nav
menus.
- Note: As of 2024-10-08, with 634 doc pages, this function constitutes ~2.0s
- of the total runtime (~5.5s). This seems to be insignificant with the time
- taken by mkdocstrings to include the docstrings in the final output, which
- is a separate mkdocs "build-step" that occurs outside the scope of this plugin.
+ Note: As of 2024-10-08, with 634 doc pages, this function constitutes
+ ~2.0s of the total runtime (~5.5s). This seems to be insignificant with
+ the time taken by mkdocstrings to include the docstrings in the final
+ output, which is a separate mkdocs "build-step" that occurs outside the
+ scope of this plugin.
"""
word_replacements = {
"acl": "ACL",
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/ported_tests.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/ported_tests.py
index 9c9196f567b..e6da59b07d3 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/ported_tests.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/ported_tests.py
@@ -73,8 +73,9 @@ def pytest_addoption(parser: pytest.Parser) -> None:
const="paths",
help=(
"Show information from @pytest.mark.ported_from markers. "
- "Use '--show-ported-from' or '--show-ported-from=paths' to show static filler paths. "
- "Use '--show-ported-from=prs' to show PR URLs."
+ "Use '--show-ported-from' or '--show-ported-from=paths' to show "
+ "static filler paths. Use '--show-ported-from=prs' to show PR "
+ "URLs."
),
)
ported_from_group.addoption(
@@ -84,10 +85,11 @@ def pytest_addoption(parser: pytest.Parser) -> None:
default=False,
help=(
"When using --show-ported-from, exclude tests that have "
- "coverage_missed_reason in their @pytest.mark.ported_from marker. "
- "These are tests that were intentionally not ported from the original "
- "static filler files, typically because they are redundant or obsolete. "
- "This helps filter out accepted coverage gaps when analyzing test coverage."
+ "coverage_missed_reason in their @pytest.mark.ported_from "
+ "marker. These are tests that were intentionally not ported "
+ "from the original static filler files, typically because they "
+ "are redundant or obsolete. This helps filter out accepted "
+ "coverage gaps when analyzing test coverage."
),
)
ported_from_group.addoption(
@@ -103,8 +105,8 @@ def pytest_addoption(parser: pytest.Parser) -> None:
dest="links_as_filled",
default=False,
help=(
- "Convert URLs or paths to filled test file paths for coverage script. "
- "Used in combination with --show-ported-from."
+ "Convert URLs or paths to filled test file paths for coverage "
+ "script. Used in combination with --show-ported-from."
),
)
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/pre_alloc.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/pre_alloc.py
index ce75f76131d..dd60772f9e7 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/pre_alloc.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/pre_alloc.py
@@ -56,7 +56,8 @@ def pytest_addoption(parser: pytest.Parser) -> None:
dest="strict_alloc",
default=False,
help=(
- "[DEBUG ONLY] Disallows deploying a contract in a predefined address."
+ "[DEBUG ONLY] Disallows deploying a contract in a predefined "
+ "address."
),
)
pre_alloc_group.addoption(
@@ -66,7 +67,7 @@ def pytest_addoption(parser: pytest.Parser) -> None:
dest="test_contract_start_address",
default=f"{CONTRACT_START_ADDRESS_DEFAULT}",
type=str,
- help="The starting address from which tests will deploy contracts.",
+ help="Starting address from which tests will deploy contracts.",
)
pre_alloc_group.addoption(
"--ca-incr",
@@ -75,7 +76,7 @@ def pytest_addoption(parser: pytest.Parser) -> None:
dest="test_contract_address_increments",
default=f"{CONTRACT_ADDRESS_INCREMENTS_DEFAULT}",
type=str,
- help="The address increment value for each deployed contract by a test.",
+ help="Address increment value for each deployed contract by a test.",
)
@@ -511,10 +512,13 @@ def eoa_iterator(
) or request.config.getoption("use_pre_alloc_groups", default=False):
# Use a starting address that is derived from the test node
eoa_start_pk = sha256_from_string(node_id_for_entropy)
+ # secp256k1 curve order constant
+ curve_order = ( # noqa: E501
+ 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141
+ )
return iter(
EOA(
- key=(eoa_start_pk + i)
- % 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141,
+ key=(eoa_start_pk + i) % curve_order,
nonce=0,
)
for i in count()
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/static_filler.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/static_filler.py
index 85fc21d4c45..dde15b02a1b 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/static_filler.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/static_filler.py
@@ -213,12 +213,11 @@ def collect(self: "FillerFile") -> Generator["FillerTestItem", None, None]:
test_type.pytest_parameter_name()
)
session = self.config.filling_session # type: ignore[attr-defined]
+ supported = test_type.supported_fixture_formats
fixture_formats.extend(
- fixture_format
- for fixture_format in test_type.supported_fixture_formats
- if session.should_generate_format(
- fixture_format
- )
+ fmt
+ for fmt in supported
+ if session.should_generate_format(fmt)
)
test_fork_set = (
@@ -230,9 +229,9 @@ def collect(self: "FillerFile") -> Generator["FillerTestItem", None, None]:
pytest.fail(
"The test function's "
f"'{key}' fork validity markers generate "
- "an empty fork range. Please check the arguments to its "
- f"markers: @pytest.mark.valid_from and "
- f"@pytest.mark.valid_until."
+ "an empty fork range. Please check the arguments "
+ "to its markers: @pytest.mark.valid_from and "
+ "@pytest.mark.valid_until."
)
intersection_set = (
test_fork_set & self.config.selected_fork_set # type: ignore
@@ -273,7 +272,8 @@ def collect(self: "FillerFile") -> Generator["FillerTestItem", None, None]:
for mark in fixture_format_parameter_set.marks
if mark.name != "parametrize"
]
- test_id = f"fork_{fork.name()}-{fixture_format_parameter_set.id}"
+ ps_id = fixture_format_parameter_set.id
+ test_id = f"fork_{fork.name()}-{ps_id}"
if "fork" in func_parameters:
params["fork"] = fork
if "pre" in func_parameters:
@@ -409,10 +409,11 @@ def yul(fork: Fork, request: pytest.FixtureRequest) -> Type[Yul]:
"""
Fixture that allows contract code to be defined with Yul code.
- This fixture defines a class that wraps the ::execution_testing.tools.Yul class
- so that upon instantiation within the test case, it provides the test
- case's current fork parameter. The fork is then available for use in
- solc's arguments for the Yul code compilation.
+ This fixture defines a class that wraps the
+ ::execution_testing.tools.Yul class so that upon instantiation within
+ the test case, it provides the test case's current fork parameter.
+ The fork is then available for use in solc's arguments for the Yul
+ code compilation.
Test cases can override the default value by specifying a fixed version
with the @pytest.mark.compile_yul_with(FORK) marker.
@@ -424,16 +425,20 @@ def yul(fork: Fork, request: pytest.FixtureRequest) -> Type[Yul]:
)
if marker:
if not marker.args[0]:
+ node_name = request.node.name
pytest.fail(
- f"{request.node.name}: Expected one argument in 'compile_yul_with' marker."
+ f"{node_name}: Expected one argument in "
+ "'compile_yul_with' marker."
)
for fork in request.config.all_forks: # type: ignore
if fork.name() == marker.args[0]:
solc_target_fork = fork
break
else:
+ node_name = request.node.name
+ fork_arg = marker.args[0]
pytest.fail(
- f"{request.node.name}: Fork {marker.args[0]} not found in forks list."
+ f"{node_name}: Fork {fork_arg} not found in forks list."
)
else:
solc_target_fork = get_closest_fork(fork)
@@ -444,8 +449,10 @@ def yul(fork: Fork, request: pytest.FixtureRequest) -> Type[Yul]:
solc_target_fork != fork
and request.config.getoption("verbose") >= 1
):
+ solc_name = solc_target_fork.name()
+ fork_name = fork.name()
warnings.warn(
- f"Compiling Yul for {solc_target_fork.name()}, not {fork.name()}.",
+ f"Compiling Yul for {solc_name}, not {fork_name}.",
stacklevel=2,
)
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/conftest.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/conftest.py
index 381c85f193c..4c7920f5f6c 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/conftest.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/conftest.py
@@ -7,7 +7,11 @@
@pytest.fixture
def restore_environment_defaults() -> Generator[None, None, None]:
- """Restore EnvironmentDefaults.gas_limit after test runs to prevent side effects."""
+ """
+ Restore EnvironmentDefaults.gas_limit after tests.
+
+ Restore the gas limit after the test run to prevent side effects.
+ """
from execution_testing.test_types.block_types import EnvironmentDefaults
original_gas_limit = EnvironmentDefaults.gas_limit
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_benchmarking.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_benchmarking.py
index 30363d66ff0..2138aa6a111 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_benchmarking.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_benchmarking.py
@@ -31,7 +31,7 @@ def test_dummy_no_benchmark_test(benchmark_test: BenchmarkTestFiller) -> None:
target_opcode=Op.JUMPDEST,
code_generator=JumpLoopGenerator(attack_block=Op.JUMPDEST),
)
- """
+ """ # noqa: E501
)
test_module_with_repricing = textwrap.dedent(
@@ -48,12 +48,14 @@ def test_benchmark_with_repricing(benchmark_test: BenchmarkTestFiller) -> None:
)
@pytest.mark.valid_at("Prague")
- def test_benchmark_without_repricing(benchmark_test: BenchmarkTestFiller) -> None:
+ def test_benchmark_without_repricing(
+ benchmark_test: BenchmarkTestFiller
+ ) -> None:
benchmark_test(
target_opcode=Op.JUMPDEST,
code_generator=JumpLoopGenerator(attack_block=Op.JUMPDEST),
)
- """
+ """ # noqa: E501
)
test_module_without_benchmark_test_fixture = textwrap.dedent(
@@ -73,7 +75,7 @@ def test_with_benchmark_test(benchmark_test: BenchmarkTestFiller) -> None:
target_opcode=Op.JUMPDEST,
code_generator=JumpLoopGenerator(attack_block=Op.JUMPDEST),
)
- """
+ """ # noqa: E501
)
test_module_with_repricing_kwargs = textwrap.dedent(
@@ -250,7 +252,7 @@ def test_repricing_marker_filter_with_benchmark_options(
pytester, test_module_with_repricing, "test_repricing_filter.py"
)
- # Test with -m repricing filter - should only collect repricing-marked tests
+ # Test with -m repricing filter - should only collect repricing tests
result = pytester.runpytest(
"-c",
"pytest-fill.ini",
@@ -344,7 +346,7 @@ def test_repricing_marker_with_kwargs_filters_parametrized_tests(
)
assert result.ret == 0
- # For test with repricing(opcode=Op.ADD), only ADD variant should be collected
+ # For repricing(opcode=Op.ADD), only ADD variant should be collected
collected_lines = [
line for line in result.outlines if "test_parametrized" in line
]
@@ -361,7 +363,7 @@ def test_repricing_marker_with_kwargs_filters_parametrized_tests(
assert not any("SUB" in line for line in kwargs_test_lines)
assert not any("MUL" in line for line in kwargs_test_lines)
- # test_parametrized_with_repricing_no_kwargs should have all variants (ADD and SUB)
+ # test_parametrized_with_repricing_no_kwargs: all variants (ADD and SUB)
no_kwargs_test_lines = [
line
for line in collected_lines
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_generate_all_formats.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_generate_all_formats.py
index c4254008fda..1f480270a2b 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_generate_all_formats.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_generate_all_formats.py
@@ -2,7 +2,7 @@
from typing import Any
-from execution_testing.cli.pytest_commands.plugins.filler.fixture_output import (
+from execution_testing.cli.pytest_commands.plugins.filler.fixture_output import ( # noqa: E501
FixtureOutput,
)
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_prealloc_group.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_prealloc_group.py
index d576807821c..650f8fb2a28 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_prealloc_group.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_prealloc_group.py
@@ -280,7 +280,7 @@ def test_chainid(state_test: StateTestFiller, pre: Alloc) -> None:
}}
state_test(env={env}, pre=pre, post=post, tx=tx)
- """
+ """ # noqa: E501
)
@@ -322,7 +322,7 @@ def test_chainid_blockchain(blockchain_test: BlockchainTestFiller, pre: Alloc) -
post=post,
blocks=[Block(txs=[tx])],
)
- """
+ """ # noqa: E501
)
@@ -397,8 +397,9 @@ def test_chainid_blockchain(blockchain_test: BlockchainTestFiller, pre: Alloc) -
2,
id="different_extra_data_different_types",
marks=pytest.mark.xfail(
- reason="Extra data is excluded=True in the Environment model, so it does not "
- "propagate correctly to the genesis header without a lot of code changes.",
+ reason="Extra data is excluded=True in the Environment "
+ "model, so it does not propagate correctly to the genesis "
+ "header without a lot of code changes.",
),
),
# Environment fields affecting the pre-alloc groups
@@ -478,45 +479,49 @@ def test_pre_alloc_grouping_by_test_type(
!= expected_different_pre_alloc_groups
):
error_message = (
- f"Expected {expected_different_pre_alloc_groups} different pre-alloc groups, "
- f"but got {len(groups)}"
+ f"Expected {expected_different_pre_alloc_groups} different "
+ f"pre-alloc groups, but got {len(groups)}"
)
for group_hash, group in groups.items():
error_message += f"\n{group_hash}: \n"
error_message += f"tests: {group.test_ids}\n"
- error_message += f"env: {group.environment.model_dump_json(indent=2, exclude_none=True)}\n"
+ env_json = group.environment.model_dump_json(
+ indent=2, exclude_none=True
+ )
+ error_message += f"env: {env_json}\n"
raise AssertionError(error_message)
for group_hash, group in groups.items():
assert (
group.environment.fee_recipient == group.genesis.fee_recipient
), (
- f"Fee recipient mismatch for group {group_hash}: {group.environment.fee_recipient} != "
+ f"Fee recipient mismatch for group {group_hash}: "
+ f"{group.environment.fee_recipient} != "
f"{group.genesis.fee_recipient}"
)
assert group.environment.prev_randao == group.genesis.prev_randao, (
- f"Prev randao mismatch for group {group_hash}: {group.environment.prev_randao} != "
- f"{group.genesis.prev_randao}"
+ f"Prev randao mismatch for group {group_hash}: "
+ f"{group.environment.prev_randao} != {group.genesis.prev_randao}"
)
assert group.environment.extra_data == group.genesis.extra_data, (
- f"Extra data mismatch for group {group_hash}: {group.environment.extra_data} != "
- f"{group.genesis.extra_data}"
+ f"Extra data mismatch for group {group_hash}: "
+ f"{group.environment.extra_data} != {group.genesis.extra_data}"
)
assert group.environment.number == group.genesis.number, (
- f"Number mismatch for group {group_hash}: {group.environment.number} != "
- f"{group.genesis.number}"
+ f"Number mismatch for group {group_hash}: "
+ f"{group.environment.number} != {group.genesis.number}"
)
assert group.environment.timestamp == group.genesis.timestamp, (
- f"Timestamp mismatch for group {group_hash}: {group.environment.timestamp} != "
- f"{group.genesis.timestamp}"
+ f"Timestamp mismatch for group {group_hash}: "
+ f"{group.environment.timestamp} != {group.genesis.timestamp}"
)
assert group.environment.difficulty == group.genesis.difficulty, (
- f"Difficulty mismatch for group {group_hash}: {group.environment.difficulty} != "
- f"{group.genesis.difficulty}"
+ f"Difficulty mismatch for group {group_hash}: "
+ f"{group.environment.difficulty} != {group.genesis.difficulty}"
)
assert group.environment.gas_limit == group.genesis.gas_limit, (
- f"Gas limit mismatch for group {group_hash}: {group.environment.gas_limit} != "
- f"{group.genesis.gas_limit}"
+ f"Gas limit mismatch for group {group_hash}: "
+ f"{group.environment.gas_limit} != {group.genesis.gas_limit}"
)
assert (
group.environment.base_fee_per_gas
@@ -536,7 +541,8 @@ def test_pre_alloc_grouping_by_test_type(
assert (
group.environment.blob_gas_used == group.genesis.blob_gas_used
), (
- f"Blob gas used mismatch for group {group_hash}: {group.environment.blob_gas_used} != "
+ f"Blob gas used mismatch for group {group_hash}: "
+ f"{group.environment.blob_gas_used} != "
f"{group.genesis.blob_gas_used}"
)
assert (
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_prealloc_group_usage_example.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_prealloc_group_usage_example.py
index af82827f3db..999d46f4cb2 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_prealloc_group_usage_example.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_prealloc_group_usage_example.py
@@ -11,7 +11,8 @@
# Example 1: Test that deploys beacon root contract with hardcoded deployer
@pytest.mark.pre_alloc_group(
"separate",
- reason="Deploys beacon root contract using actual hardcoded deployer address",
+ reason="Deploys beacon root contract using actual hardcoded "
+ "deployer address",
)
def test_beacon_root_contract_deployment() -> None:
"""
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_slow_marker_pre_alloc.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_slow_marker_pre_alloc.py
index cd51c8f3657..0d45f4e7622 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_slow_marker_pre_alloc.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_slow_marker_pre_alloc.py
@@ -21,7 +21,7 @@ def test_slow_without_benchmark(state_test: StateTestFiller, pre: Alloc) -> None
contract = pre.deploy_contract(code=b"")
tx = Transaction(sender=sender, to=contract, gas_limit=100000)
state_test(pre=pre, tx=tx, post={})
- """
+ """ # noqa: E501
)
# Create test directory structure
@@ -67,7 +67,7 @@ def test_slow_with_benchmark(state_test: StateTestFiller, pre: Alloc) -> None:
contract = pre.deploy_contract(code=b"")
tx = Transaction(sender=sender, to=contract, gas_limit=100000)
state_test(pre=pre, tx=tx, post={})
- """
+ """ # noqa: E501
)
# Create test directory structure
@@ -112,7 +112,7 @@ def test_slow_with_existing_pre_alloc(state_test: StateTestFiller, pre: Alloc) -
contract = pre.deploy_contract(code=b"")
tx = Transaction(sender=sender, to=contract, gas_limit=100000)
state_test(pre=pre, tx=tx, post={})
- """
+ """ # noqa: E501
)
# Create test directory structure
@@ -203,7 +203,7 @@ def test_slow_for_integration(state_test: StateTestFiller, pre: Alloc) -> None:
contract = pre.deploy_contract(code=b"")
tx = Transaction(sender=sender, to=contract, gas_limit=100000)
state_test(pre=pre, tx=tx, post={})
- """
+ """ # noqa: E501
)
# Create proper directory structure for tests
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_verify_sync_marker.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_verify_sync_marker.py
index 0f49f6dfa34..4e4fff33402 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_verify_sync_marker.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_verify_sync_marker.py
@@ -59,7 +59,7 @@ def test_verify_sync_with_param_marks(blockchain_test, has_exception) -> None:
],
)
- """
+ """ # noqa: E501
)
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/witness.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/witness.py
index 00596675919..f150dbc74aa 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/witness.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/witness.py
@@ -53,8 +53,8 @@ def pytest_addoption(parser: pytest.Parser) -> None:
dest="witness",
default=False,
help=(
- "Generate execution witness data for blockchain test fixtures using the "
- "witness-filler tool (must be installed separately)."
+ "Generate execution witness data for blockchain test fixtures "
+ "using the witness-filler tool (must be installed separately)."
),
)
@@ -69,10 +69,11 @@ def pytest_configure(config: pytest.Config) -> None:
if config.getoption("witness"):
# Check if witness-filler binary is available in PATH
if not shutil.which("witness-filler"):
+ repo = "https://github.com/kevaundray/reth.git" # noqa: E501
pytest.exit(
- "witness-filler tool not found in PATH. Please build and install witness-filler "
- "from https://github.com/kevaundray/reth.git before using --witness flag.\n"
- "Example: cargo install --git https://github.com/kevaundray/reth.git "
+ "witness-filler tool not found in PATH. Please build and "
+ f"install witness-filler from {repo} before using "
+ f"--witness flag.\nExample: cargo install --git {repo} "
"witness-filler",
1,
)
@@ -119,8 +120,8 @@ def generate_witness(fixture: BlockchainFixture) -> None:
if result.returncode != 0:
raise RuntimeError(
- f"witness-filler tool failed with exit code {result.returncode}. "
- f"stderr: {result.stderr}"
+ f"witness-filler tool failed with exit code "
+ f"{result.returncode}. stderr: {result.stderr}"
)
try:
@@ -135,9 +136,11 @@ def generate_witness(fixture: BlockchainFixture) -> None:
if isinstance(block, FixtureBlock):
block.execution_witness = witness
except Exception as e:
+ output = result.stdout[:500]
+ suffix = "..." if len(result.stdout) > 500 else ""
raise RuntimeError(
f"Failed to parse witness data from witness-filler tool. "
- f"Output was: {result.stdout[:500]}{'...' if len(result.stdout) > 500 else ''}"
+ f"Output was: {output}{suffix}"
) from e
return generate_witness
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/forks/forks.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/forks/forks.py
index 115a94aa78c..faabc10500c 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/forks/forks.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/forks/forks.py
@@ -25,9 +25,6 @@
from pytest import Mark, Metafunc
from execution_testing.client_clis import TransitionTool
-from execution_testing.logging import (
- get_logger,
-)
from execution_testing.forks import (
ALL_FORKS,
ALL_FORKS_WITH_TRANSITIONS,
@@ -39,6 +36,9 @@
get_transition_forks,
transition_fork_to,
)
+from execution_testing.logging import (
+ get_logger,
+)
logger = get_logger(__name__)
@@ -384,22 +384,28 @@ def covariant_decorator(
fork_covariant_decorators: List[Type[CovariantDecorator]] = [
covariant_decorator(
marker_name="with_all_tx_types",
- description="marks a test to be parametrized for all tx types at parameter named tx_type"
- " of type int",
+ description=(
+ "marks a test to be parametrized for all tx types at parameter "
+ "named tx_type of type int"
+ ),
fork_attribute_name="tx_types",
argnames=["tx_type"],
),
covariant_decorator(
marker_name="with_all_contract_creating_tx_types",
- description="marks a test to be parametrized for all tx types that can create a contract"
- " at parameter named tx_type of type int",
+ description=(
+ "marks a test to be parametrized for all tx types that can "
+ "create a contract at parameter named tx_type of type int"
+ ),
fork_attribute_name="contract_creating_tx_types",
argnames=["tx_type"],
),
covariant_decorator(
marker_name="with_all_typed_transactions",
- description="marks a test to be parametrized with default typed transactions named "
- "typed_transaction",
+ description=(
+ "marks a test to be parametrized with default typed "
+ "transactions named typed_transaction"
+ ),
fork_attribute_name="tx_types",
argnames=["typed_transaction"],
# indirect means the values from `tx_types` will be passed to the
@@ -408,29 +414,37 @@ def covariant_decorator(
),
covariant_decorator(
marker_name="with_all_precompiles",
- description="marks a test to be parametrized for all precompiles at parameter named"
- " precompile of type int",
+ description=(
+ "marks a test to be parametrized for all precompiles at "
+ "parameter named precompile of type int"
+ ),
fork_attribute_name="precompiles",
argnames=["precompile"],
),
covariant_decorator(
marker_name="with_all_call_opcodes",
- description="marks a test to be parametrized for all *CALL opcodes at parameter named"
- " call_opcode",
+ description=(
+ "marks a test to be parametrized for all *CALL opcodes at "
+ "parameter named call_opcode"
+ ),
fork_attribute_name="call_opcodes",
argnames=["call_opcode"],
),
covariant_decorator(
marker_name="with_all_create_opcodes",
- description="marks a test to be parametrized for all *CREATE* opcodes at parameter named"
- " create_opcode",
+ description=(
+ "marks a test to be parametrized for all *CREATE* opcodes at "
+ "parameter named create_opcode"
+ ),
fork_attribute_name="create_opcodes",
argnames=["create_opcode"],
),
covariant_decorator(
marker_name="with_all_system_contracts",
- description="marks a test to be parametrized for all system contracts at parameter named"
- " system_contract of type int",
+ description=(
+ "marks a test to be parametrized for all system contracts at "
+ "parameter named system_contract of type int"
+ ),
fork_attribute_name="system_contracts",
argnames=["system_contract"],
),
@@ -468,8 +482,9 @@ def pytest_configure(config: pytest.Config) -> None:
config.addinivalue_line(
"markers",
(
- "parametrize_by_fork(names, values_fn): parametrize a test case by fork using the "
- "specified names and values returned by the function values_fn(fork)"
+ "parametrize_by_fork(names, values_fn): parametrize a test case "
+ "by fork using the specified names and values returned by the "
+ "function values_fn(fork)"
),
)
for d in fork_covariant_decorators:
@@ -526,7 +541,8 @@ def get_fork_option(
if single_fork and (forks_from or forks_until):
print(
- "Error: --fork cannot be used in combination with --from or --until",
+ "Error: --fork cannot be used in combination "
+ "with --from or --until",
file=sys.stderr,
)
pytest.exit(
@@ -546,11 +562,13 @@ def get_fork_option(
getattr(config, "single_fork_mode", False)
and len(selected_fork_set) != 1
):
+ fork_count = len(selected_fork_set)
pytest.exit(
f"""
- Expected exactly one fork to be specified, got {len(selected_fork_set)}
+ Expected exactly one fork to be specified, got {fork_count}
({selected_fork_set}).
- Make sure to specify exactly one fork using the --fork command line argument.
+ Make sure to specify exactly one fork using the --fork
+ command line argument.
""",
returncode=pytest.ExitCode.USAGE_ERROR,
)
@@ -628,7 +646,8 @@ def session_fork(request: pytest.FixtureRequest) -> Fork | None:
):
return list(request.config.selected_fork_set)[0] # type: ignore
raise AssertionError(
- "Plugin used `session_fork` fixture without the correct configuration (single_fork_mode)."
+ "Plugin used `session_fork` fixture without the correct "
+ "configuration (single_fork_mode)."
)
@@ -1072,8 +1091,8 @@ def pytest_generate_tests(metafunc: pytest.Metafunc) -> None:
marks=[
pytest.mark.skip(
reason=(
- f"{test_name} is not valid for any of the forks specified on "
- "the command-line."
+ f"{test_name} is not valid for any of the "
+ "forks specified on the command-line."
)
)
],
@@ -1209,11 +1228,12 @@ def pytest_collection_modifyitems(
"""
Filter tests based on param-level validity markers.
- The pytest_generate_tests hook only considers function-level validity markers.
- This hook runs after parametrization and can access all markers including
- param-level ones, allowing us to properly filter tests based on param-level
- valid_from/valid_until markers.
+ The pytest_generate_tests hook only considers function-level validity
+ markers. This hook runs after parametrization and can access all markers
+ including param-level ones, allowing us to properly filter tests based on
+ param-level valid_from/valid_until markers.
"""
+ del config
items_to_remove = []
for i, item in enumerate(items):
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/forks/tests/test_bad_command_line_options.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/forks/tests/test_bad_command_line_options.py
index 5a5b286eb9c..2dddbaca094 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/forks/tests/test_bad_command_line_options.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/forks/tests/test_bad_command_line_options.py
@@ -9,7 +9,10 @@
"from_nonexistent_fork",
(
("--from", "Marge"), # codespell:ignore marge
- "Unsupported fork provided to --from: Marge", # codespell:ignore marge
+ (
+ "Unsupported fork provided to --from: "
+ "Marge" # codespell:ignore marge
+ ),
),
),
(
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/forks/tests/test_bad_validity_markers.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/forks/tests/test_bad_validity_markers.py
index 4e8aa2d4be8..6c3093a60ba 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/forks/tests/test_bad_validity_markers.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/forks/tests/test_bad_validity_markers.py
@@ -176,7 +176,10 @@ def test_case(state_test):
def test_case(state_test):
assert 0
""",
- "The markers 'valid_from' and 'valid_at_transition_to' can't be combined",
+ (
+ "The markers 'valid_from' and 'valid_at_transition_to' "
+ "can't be combined"
+ ),
),
),
(
@@ -189,7 +192,10 @@ def test_case(state_test):
def test_case(state_test):
assert 0
""",
- "The markers 'valid_until' and 'valid_at_transition_to' can't be combined",
+ (
+ "The markers 'valid_until' and 'valid_at_transition_to' "
+ "can't be combined"
+ ),
),
),
(
@@ -274,7 +280,7 @@ def test_case(state_test, value):
@pytest.mark.valid_until("Prague")
def test_case(state_test, value):
assert 1
- """,
+ """, # noqa: E501
"Too many 'valid_until' markers applied to test",
),
),
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/forks/tests/test_covariant_markers.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/forks/tests/test_covariant_markers.py
index a256bb539d7..ff2cf4f3167 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/forks/tests/test_covariant_markers.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/forks/tests/test_covariant_markers.py
@@ -29,7 +29,7 @@ def test_case(state_test, tx_type):
@pytest.mark.state_test_only
def test_case(state_test, tx_type):
pass
- """,
+ """, # noqa: E501
{"passed": 2, "failed": 0, "skipped": 0, "errors": 0},
None,
id="with_all_tx_types_with_selector",
@@ -45,7 +45,7 @@ def test_case(state_test, tx_type):
@pytest.mark.state_test_only
def test_case(state_test, tx_type):
assert tx_type != 1
- """,
+ """, # noqa: E501
{
"passed": 2,
"xpassed": 0,
@@ -115,7 +115,7 @@ def test_case(request, state_test, tx_type):
assert "state_test" in mark_names
if tx_type == 1:
assert "slow" in mark_names
- """,
+ """, # noqa: E501
{
"passed": 2,
"xpassed": 1,
@@ -192,7 +192,7 @@ def test_case(state_test, call_opcode):
@pytest.mark.state_test_only
def test_case(state_test, call_opcode):
pass
- """,
+ """, # noqa: E501
{"passed": 1, "failed": 0, "skipped": 0, "errors": 0},
None,
id="with_all_call_opcodes_with_selector",
@@ -266,7 +266,7 @@ def test_case(state_test, system_contract):
def test_case(state_test, typed_transaction):
assert isinstance(typed_transaction, Transaction)
assert typed_transaction.ty in [0, 1] # Berlin supports types 0 and 1
- """,
+ """, # noqa: E501
{"passed": 2, "failed": 0, "skipped": 0, "errors": 0},
None,
id="with_all_typed_transactions_berlin",
@@ -282,7 +282,7 @@ def test_case(state_test, typed_transaction):
def test_case(state_test, typed_transaction, pre):
assert isinstance(typed_transaction, Transaction)
assert typed_transaction.ty in [0, 1, 2] # London supports types 0, 1, 2
- """,
+ """, # noqa: E501
{"passed": 3, "failed": 0, "skipped": 0, "errors": 0},
None,
id="with_all_typed_transactions_london",
@@ -404,7 +404,7 @@ def covariant_function(fork):
@pytest.mark.state_test_only
def test_case(state_test, test_parameter, test_parameter_2):
pass
- """,
+ """, # noqa: E501
{"passed": 5, "failed": 0, "skipped": 0, "errors": 0},
None,
id="multi_parameter_custom_covariant_marker",
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/forks/tests/test_markers.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/forks/tests/test_markers.py
index 9379d90b403..e3fd58d50b0 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/forks/tests/test_markers.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/forks/tests/test_markers.py
@@ -106,7 +106,9 @@ def test_case(state_test):
),
pytest.param(
generate_test(
- valid_at_transition_to='"Paris", subsequent_forks=True, until="Cancun"',
+ valid_at_transition_to=(
+ '"Paris", subsequent_forks=True, until="Cancun"'
+ ),
),
["--until=Prague"],
{"passed": 2, "failed": 0, "skipped": 0, "errors": 0},
@@ -143,7 +145,9 @@ def test_case(state_test):
),
pytest.param(
generate_test(
- valid_at_transition_to='"Osaka", subsequent_forks=True, until="BPO1"',
+ valid_at_transition_to=(
+ '"Osaka", subsequent_forks=True, until="BPO1"'
+ ),
),
["--until=BPO1"],
{"passed": 1, "failed": 0, "skipped": 0, "errors": 0},
@@ -152,7 +156,9 @@ def test_case(state_test):
),
pytest.param(
generate_test(
- valid_at_transition_to='"Osaka", subsequent_forks=True, until="BPO1"',
+ valid_at_transition_to=(
+ '"Osaka", subsequent_forks=True, until="BPO1"'
+ ),
valid_for_bpo_forks="",
),
["--until=BPO1"],
@@ -358,7 +364,8 @@ def test_mixed_function_and_param_markers(state_test, value):
generate_param_level_mixed_test(),
["--from=Berlin", "--until=Prague"],
# Function marker: valid_until("Cancun") limits to <= Cancun
- # all_forks (TangerineWhistle): Berlin, London, Paris, Shanghai, Cancun = 5
+ # all_forks (TangerineWhistle):
+ # Berlin, London, Paris, Shanghai, Cancun = 5
# paris_only: Paris, Shanghai, Cancun = 3
# Total: 8 tests
{"passed": 8, "failed": 0, "skipped": 0, "errors": 0},
@@ -384,7 +391,7 @@ def test_param_level_validity_markers(
pytest_args: List[str],
) -> None:
"""
- Test param-level validity markers (valid_from, valid_until on pytest.param).
+ Test param-level validity markers (valid_from, valid_until).
The pytest_collection_modifyitems hook filters tests based on param-level
markers after parametrization, allowing different parameter values to have
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/help/help.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/help/help.py
index 4ef957ee40b..76769f6d9c3 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/help/help.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/help/help.py
@@ -19,7 +19,10 @@ def pytest_addoption(parser: pytest.Parser) -> None:
action="store_true",
dest="show_check_eip_versions_help",
default=False,
- help="Show help options only for the check_eip_versions command and exit.",
+ help=(
+ "Show help options only for the check_eip_versions command "
+ "and exit."
+ ),
)
help_group.addoption(
"--fill-help",
@@ -40,28 +43,39 @@ def pytest_addoption(parser: pytest.Parser) -> None:
action="store_true",
dest="show_execute_help",
default=False,
- help="Show help options specific to the execute remote command and exit.",
+ help=(
+ "Show help options specific to the execute remote command "
+ "and exit."
+ ),
)
help_group.addoption(
"--execute-hive-help",
action="store_true",
dest="show_execute_hive_help",
default=False,
- help="Show help options specific to the execute hive command and exit.",
+ help=(
+ "Show help options specific to the execute hive command and exit."
+ ),
)
help_group.addoption(
"--execute-recover-help",
action="store_true",
dest="show_execute_recover_help",
default=False,
- help="Show help options specific to the execute recover command and exit.",
+ help=(
+ "Show help options specific to the execute recover command "
+ "and exit."
+ ),
)
help_group.addoption(
"--execute-eth-config-help",
action="store_true",
dest="show_execute_eth_config_help",
default=False,
- help="Show help options specific to the execute eth_config command and exit.",
+ help=(
+ "Show help options specific to the execute eth_config command "
+ "and exit."
+ ),
)
@@ -163,7 +177,8 @@ def show_specific_help(
pytest_ini = Path(config.inifile) # type: ignore
if pytest_ini.name != expected_ini:
raise ValueError(
- f"Unexpected {expected_ini}!={pytest_ini.name} file option generating help."
+ f"Unexpected {expected_ini}!={pytest_ini.name} file option "
+ "generating help."
)
test_parser = argparse.ArgumentParser()
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/pytest_hive/pytest_hive.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/pytest_hive/pytest_hive.py
index 8064e2c48e3..62a6b113cd4 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/pytest_hive/pytest_hive.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/pytest_hive/pytest_hive.py
@@ -48,6 +48,7 @@
from hive.testing import HiveTest, HiveTestResult, HiveTestSuite
from execution_testing.logging import get_logger
+
from .hive_info import ClientFile, HiveInfo
logger = get_logger(__name__)
@@ -60,7 +61,8 @@ def pytest_configure(config: pytest.Config) -> None: # noqa: D103
"The HIVE_SIMULATOR environment variable is not set.\n\n"
"If running locally, start hive in --dev mode, for example:\n"
"./hive --dev --client go-ethereum\n\n"
- "and set the HIVE_SIMULATOR to the reported URL. For example, in bash:\n"
+ "and set the HIVE_SIMULATOR to the reported URL. For example, "
+ "in bash:\n"
"export HIVE_SIMULATOR=http://127.0.0.1:3000\n"
"or in fish:\n"
"set -x HIVE_SIMULATOR http://127.0.0.1:3000"
@@ -96,8 +98,9 @@ def pytest_addoption(parser: pytest.Parser) -> None: # noqa: D103
dest="hive_simulator",
default=os.environ.get("HIVE_SIMULATOR"),
help=(
- "The Hive simulator endpoint, e.g. http://127.0.0.1:3000. By default, the value is "
- "taken from the HIVE_SIMULATOR environment variable."
+ "The Hive simulator endpoint, e.g. http://127.0.0.1:3000. By "
+ "default, the value is taken from the HIVE_SIMULATOR environment "
+ "variable."
),
)
@@ -134,9 +137,8 @@ def pytest_report_header(
f"hive date: {hive_info.date}",
]
for client in hive_info.client_file.root:
- header_lines += [
- f"hive client ({client.client}): {client.model_dump_json(exclude_none=True)}",
- ]
+ dump = client.model_dump_json(exclude_none=True)
+ header_lines += [f"hive client ({client.client}): {dump}"]
return header_lines
@@ -264,8 +266,8 @@ def hive_test(
)
except pytest.FixtureLookupError:
pytest.exit(
- "Error: The 'test_case_description' fixture has not been defined by the simulator "
- "or pytest plugin using this plugin!"
+ "Error: The 'test_case_description' fixture has not been defined "
+ "by the simulator or pytest plugin using this plugin!"
)
test_parameter_string = request.node.name
@@ -343,8 +345,8 @@ def hive_test(
else:
test_passed = False
test_result_details = (
- "Test failed for unknown reason (setup or call status unknown).\n\n"
- + captured_output
+ "Test failed for unknown reason (setup or call status "
+ "unknown).\n\n" + captured_output
)
test.end(
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/shared/benchmarking.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/shared/benchmarking.py
index 03e261770c3..b75335333f1 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/shared/benchmarking.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/shared/benchmarking.py
@@ -61,8 +61,8 @@ def pytest_configure(config: pytest.Config) -> None:
fixed_opcode_count = OpcodeCountsConfig.from_config(config)
if gas_benchmark_values is not None and fixed_opcode_count is not None:
raise pytest.UsageError(
- f"{GasBenchmarkValues.flag} and --fixed-opcode-count are mutually exclusive. "
- "Use only one at a time."
+ f"{GasBenchmarkValues.flag} and --fixed-opcode-count are mutually "
+ "exclusive. Use only one at a time."
)
if gas_benchmark_values is not None:
@@ -137,10 +137,12 @@ def from_parameter_value(
cls, config: pytest.Config, value: str
) -> Self | None:
"""Given the parameter value and config, return the expected object."""
+ del config
return cls.model_validate(value.split(","))
def get_test_parameters(self, test_name: str) -> list[ParameterSet]:
"""Get benchmark values. All tests have the same list."""
+ del test_name
return [
pytest.param(
gas_value * 1_000_000,
@@ -218,12 +220,14 @@ def pytest_collection_modifyitems(
if not gas_benchmark_value and not fixed_opcode_count:
return
- # In --fixed-opcode-count mode, we only support tests that meet all of the following:
+ # In --fixed-opcode-count mode, we only support tests that meet all of
+ # the following:
# - The test uses the benchmark_test fixture
# - The benchmark test uses a code generator
#
# Here we filter out tests that do not use the benchmark_test fixture.
- # Note: At this stage we cannot filter based on whether a code generator is used.
+ # Note: At this stage we cannot filter based on whether a code generator
+ # is used.
if fixed_opcode_count is not None:
filtered = []
for item in items:
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/shared/execute_fill.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/shared/execute_fill.py
index acfb3be9db8..b0594208381 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/shared/execute_fill.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/shared/execute_fill.py
@@ -53,12 +53,9 @@ def pytest_configure(config: pytest.Config) -> None:
"execution_testing.cli.pytest_commands.plugins.filler.filler"
):
for fixture_format in BaseFixture.formats.values():
- config.addinivalue_line(
- "markers",
- (
- f"{fixture_format.format_name.lower()}: {fixture_format.description}"
- ),
- )
+ name = fixture_format.format_name.lower()
+ desc = fixture_format.description
+ config.addinivalue_line("markers", f"{name}: {desc}")
for (
label,
labeled_fixture_format,
@@ -71,12 +68,9 @@ def pytest_configure(config: pytest.Config) -> None:
"execution_testing.cli.pytest_commands.plugins.execute.execute"
):
for execute_format in BaseExecute.formats.values():
- config.addinivalue_line(
- "markers",
- (
- f"{execute_format.format_name.lower()}: {execute_format.description}"
- ),
- )
+ name = execute_format.format_name.lower()
+ desc = execute_format.description
+ config.addinivalue_line("markers", f"{name}: {desc}")
for (
label,
labeled_execute_format,
@@ -104,7 +98,8 @@ def pytest_configure(config: pytest.Config) -> None:
)
config.addinivalue_line(
"markers",
- "compile_yul_with(fork): Always compile Yul source using the corresponding evm version.",
+ "compile_yul_with(fork): Always compile Yul source using the "
+ "corresponding evm version.",
)
config.addinivalue_line(
"markers",
@@ -124,35 +119,38 @@ def pytest_configure(config: pytest.Config) -> None:
)
config.addinivalue_line(
"markers",
- "exception_test: Negative tests that include an invalid block or transaction.",
+ "exception_test: Negative tests that include an invalid block or "
+ "transaction.",
)
config.addinivalue_line(
"markers",
- "eip_checklist(item_id, eip=None): Mark a test as implementing a specific checklist item. "
- "The first positional parameter is the checklist item ID. "
- "The optional 'eip' keyword parameter specifies additional EIPs covered by the test.",
+ "eip_checklist(item_id, eip=None): Mark a test as implementing a "
+ "specific checklist item. The first positional parameter is the "
+ "checklist item ID. The optional 'eip' keyword parameter specifies "
+ "additional EIPs covered by the test.",
)
config.addinivalue_line(
"markers",
- "derived_test: Mark a test as a derived test (E.g. a BlockchainTest that is derived "
- "from a StateTest).",
+ "derived_test: Mark a test as a derived test (E.g. a BlockchainTest "
+ "that is derived from a StateTest).",
)
config.addinivalue_line(
"markers",
- "tagged: Marks a static test as tagged. Tags are used to generate dynamic "
- "addresses for static tests at fill time. All tagged tests are compatible with "
- "dynamic address generation.",
+ "tagged: Marks a static test as tagged. Tags are used to generate "
+ "dynamic addresses for static tests at fill time. All tagged tests "
+ "are compatible with dynamic address generation.",
)
config.addinivalue_line(
"markers",
- "untagged: Marks a static test as untagged. Tags are used to generate dynamic "
- "addresses for static tests at fill time. Untagged tests are incompatible with "
- "dynamic address generation.",
+ "untagged: Marks a static test as untagged. Tags are used to generate "
+ "dynamic addresses for static tests at fill time. Untagged tests are "
+ "incompatible with dynamic address generation.",
)
config.addinivalue_line(
"markers",
- "verify_sync: Marks a test to be run with `consume sync`, verifying blockchain "
- "engine tests and having hive clients sync after payload execution.",
+ "verify_sync: Marks a test to be run with `consume sync`, verifying "
+ "blockchain engine tests and having hive clients sync after payload "
+ "execution.",
)
config.addinivalue_line(
"markers",
@@ -161,7 +159,8 @@ def pytest_configure(config: pytest.Config) -> None:
)
config.addinivalue_line(
"markers",
- "pre_alloc_modify: Marks a test to apply plugin-specific pre_alloc_group modifiers",
+ "pre_alloc_modify: Marks a test to apply plugin-specific "
+ "pre_alloc_group modifiers",
)
config.addinivalue_line(
"markers",
@@ -177,7 +176,8 @@ def pytest_configure(config: pytest.Config) -> None:
)
config.addinivalue_line(
"markers",
- "mainnet: Specialty tests crafted for running on mainnet and sanity checking.",
+ "mainnet: Specialty tests crafted for running on mainnet and sanity "
+ "checking.",
)
config.addinivalue_line(
"markers",
@@ -191,7 +191,10 @@ def test_case_description(request: pytest.FixtureRequest) -> str:
Fixture to extract and combine docstrings from the test class and the test
function.
"""
- description_unavailable = "No description available - add a docstring to the python test class or function."
+ description_unavailable = (
+ "No description available - add a docstring to the python test "
+ "class or function."
+ )
test_class_doc = ""
test_function_doc = ""
if hasattr(request.node, "cls"):
@@ -241,7 +244,8 @@ def __init__(self, message: str):
and "blockchain_test" in item.fixturenames
):
raise InvalidFillerError(
- "A filler should only implement either a state test or a blockchain test; not both."
+ "A filler should only implement either a state test or a "
+ "blockchain test; not both."
)
# Check that the test defines either test type as parameter.
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/solc/solc.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/solc/solc.py
index 78ba007c314..1557d18d63c 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/solc/solc.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/solc/solc.py
@@ -22,7 +22,8 @@ def pytest_addoption(parser: pytest.Parser) -> None:
type=str,
default=None,
help=(
- "Path to a solc executable (for Yul source compilation). Default: solc binary in PATH."
+ "Path to a solc executable (for Yul source compilation). "
+ "Default: solc binary in PATH."
),
)
@@ -43,7 +44,8 @@ def pytest_configure(config: pytest.Config) -> None:
solc_bin = which("solc")
if not solc_bin:
pytest.exit(
- "solc binary not found in PATH. Please install solc and ensure it's in your PATH.",
+ "solc binary not found in PATH. Please install solc and "
+ "ensure it's in your PATH.",
returncode=pytest.ExitCode.USAGE_ERROR,
)
@@ -114,8 +116,8 @@ def pytest_configure(config: pytest.Config) -> None:
)
if solc_version_semver < SOLC_EXPECTED_MIN_VERSION:
pytest.exit(
- f"Unsupported solc version: {solc_version_semver}. Minimum required version is "
- f"{SOLC_EXPECTED_MIN_VERSION}",
+ f"Unsupported solc version: {solc_version_semver}. Minimum "
+ f"required version is {SOLC_EXPECTED_MIN_VERSION}",
returncode=pytest.ExitCode.USAGE_ERROR,
)
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/spec_version_checker/spec_version_checker.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/spec_version_checker/spec_version_checker.py
index 62b6363eb5c..05b4a16f7ad 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/spec_version_checker/spec_version_checker.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/spec_version_checker/spec_version_checker.py
@@ -19,9 +19,11 @@
)
GITHUB_TOKEN_HELP = textwrap.dedent(
- "Either set the GITHUB_TOKEN environment variable or specify one via --github-token. "
- "The Github CLI can be used: `--github-token $(gh auth token)` (https://cli.github.com/) "
- "or a PAT can be generated at https://github.com/settings/personal-access-tokens/new."
+ "Either set the GITHUB_TOKEN environment variable or specify one via "
+ "--github-token. The Github CLI can be used: "
+ "`--github-token $(gh auth token)` (https://cli.github.com/) " # noqa: E501
+ "or a PAT can be generated at "
+ "https://github.com/settings/personal-access-tokens/new." # noqa: E501
)
@@ -37,8 +39,8 @@ def pytest_addoption(parser: pytest.Parser) -> None:
dest="github_token",
default=None,
help=(
- "Specify a Github API personal access token (PAT) to avoid rate limiting. "
- f"{GITHUB_TOKEN_HELP}"
+ "Specify a Github API personal access token (PAT) to avoid rate "
+ f"limiting. {GITHUB_TOKEN_HELP}"
),
)
@@ -53,7 +55,8 @@ def pytest_configure(config: pytest.Config) -> None:
"""
config.addinivalue_line(
"markers",
- "eip_version_check: a test that tests the reference spec defined in an EIP test module.",
+ "eip_version_check: a test that tests the reference spec defined in "
+ "an EIP test module.",
)
github_token = config.getoption("github_token") or os.environ.get(
@@ -62,8 +65,8 @@ def pytest_configure(config: pytest.Config) -> None:
if not github_token:
pytest.exit(
- "A Github personal access token (PAT) is required but has not been provided. "
- f"{GITHUB_TOKEN_HELP}"
+ "A Github personal access token (PAT) is required but has not "
+ f"been provided. {GITHUB_TOKEN_HELP}"
)
config.github_token = github_token # type: ignore[attr-defined]
@@ -109,7 +112,8 @@ def get_ref_spec_from_module(
) from e
else:
raise Exception(
- "Test doesn't define REFERENCE_SPEC_GIT_PATH and REFERENCE_SPEC_VERSION"
+ "Test doesn't define REFERENCE_SPEC_GIT_PATH and "
+ "REFERENCE_SPEC_VERSION"
)
return spec_obj
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/processors.py b/packages/testing/src/execution_testing/cli/pytest_commands/processors.py
index dd10fac25af..c47f8990942 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/processors.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/processors.py
@@ -60,7 +60,8 @@ def process_args(self, args: List[str]) -> List[str]:
# Check for incompatible xdist plugin
if any(arg == "-n" or arg.startswith("-n=") for arg in args):
sys.exit(
- "error: xdist-plugin not supported with --output=stdout (remove -n args)."
+ "error: xdist-plugin not supported with --output=stdout "
+ "(remove -n args)."
)
# Add flags to suppress pytest output when writing to stdout
diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/watcher.py b/packages/testing/src/execution_testing/cli/pytest_commands/watcher.py
index bb4e5c9fc1c..8a2504baa0e 100644
--- a/packages/testing/src/execution_testing/cli/pytest_commands/watcher.py
+++ b/packages/testing/src/execution_testing/cli/pytest_commands/watcher.py
@@ -72,7 +72,7 @@ def run_fill() -> None:
file_count = len(file_mtimes)
self.console.print(
- f"[blue]Watching {file_count} files in tests/ and src/ directories."
+ f"[blue]Watching {file_count} files in tests/ and src/."
"\nPress Ctrl+C to stop.[/blue]"
)
@@ -86,7 +86,8 @@ def run_fill() -> None:
if not self.verbose:
os.system("clear" if os.name != "nt" else "cls")
self.console.print(
- "[yellow]File changes detected, re-running...[/yellow]\n"
+ "[yellow]File changes detected, "
+ "re-running...[/yellow]\n"
)
run_fill()
file_mtimes = current_mtimes
diff --git a/packages/testing/src/execution_testing/cli/show_pre_alloc_group_stats.py b/packages/testing/src/execution_testing/cli/show_pre_alloc_group_stats.py
index 55b47ba6025..2ec85527c1f 100644
--- a/packages/testing/src/execution_testing/cli/show_pre_alloc_group_stats.py
+++ b/packages/testing/src/execution_testing/cli/show_pre_alloc_group_stats.py
@@ -383,13 +383,17 @@ def display_stats(stats: Dict, console: Console, verbose: int = 0) -> None:
)
cumulative_groups_display += groups_in_bin
+ cumul_pct = cumulative_groups_display / total_groups * 100
+ cumulative_str = (
+ f"{cumulative_groups_display} ({cumul_pct:.1f}%)"
+ if total_groups > 0
+ else "0"
+ )
coverage_table.add_row(
size_range,
str(tests_in_range),
f"{coverage_percentage:.1f}%",
- f"{cumulative_groups_display} ({cumulative_groups_display / total_groups * 100:.1f}%)"
- if total_groups > 0
- else "0",
+ cumulative_str,
)
console.print(coverage_table)
@@ -449,11 +453,13 @@ def display_stats(stats: Dict, console: Console, verbose: int = 0) -> None:
# Split test functions analysis (only show if there are any)
if stats.get("split_functions"):
console.print(
- "\n[bold yellow]Test Functions Split Across Multiple Groups[/bold yellow]"
+ "\n[bold yellow]Test Functions Split Across Multiple "
+ "Groups[/bold yellow]"
)
console.print(
- "[dim]These test functions create multiple size-1 groups (due to different "
- "forks/parameters), preventing pre-allocation group optimization:[/dim]",
+ "[dim]These test functions create multiple size-1 groups (due to "
+ "different forks/parameters), preventing pre-allocation group "
+ "optimization:[/dim]",
highlight=False,
)
@@ -493,21 +499,22 @@ def display_stats(stats: Dict, console: Console, verbose: int = 0) -> None:
total_split_functions = len(stats["split_functions"])
console.print(
- f"\n[yellow]Optimization Potential:[/yellow] Excluding these {total_split_functions} "
- f"split functions would save {total_split_groups} groups"
+ f"\n[yellow]Optimization Potential:[/yellow] Excluding these "
+ f"{total_split_functions} split functions would save "
+ f"{total_split_groups} groups"
)
# Verbosity hint
console.print()
if verbose == 0:
console.print(
- "[dim]Hint: Use -v to see detailed group and module statistics, or -vv to see all "
- "groups and modules[/dim]"
+ "[dim]Hint: Use -v to see detailed group and module statistics, "
+ "or -vv to see all groups and modules[/dim]"
)
elif verbose == 1:
console.print(
- "[dim]Hint: Use -vv to see all groups and modules (currently showing top entries "
- "only)[/dim]"
+ "[dim]Hint: Use -vv to see all groups and modules (currently "
+ "showing top entries only)[/dim]"
)
diff --git a/packages/testing/src/execution_testing/cli/tests/test_pytest_execute_command.py b/packages/testing/src/execution_testing/cli/tests/test_pytest_execute_command.py
index 1f8179ec0f4..c24b4734469 100644
--- a/packages/testing/src/execution_testing/cli/tests/test_pytest_execute_command.py
+++ b/packages/testing/src/execution_testing/cli/tests/test_pytest_execute_command.py
@@ -85,18 +85,19 @@ def test_execute_eth_config_help(runner: CliRunner) -> None:
def test_all_execute_subcommands_help_no_conflicts(runner: CliRunner) -> None:
- """Test that all execute subcommands --help work without argument conflicts.
+ """
+ Test that all execute subcommands --help work without argument conflicts.
- This is a regression test for issue where --chain-id was defined in multiple
- plugins, causing argparse.ArgumentError conflicts.
+ This is a regression test for issue where --chain-id was defined in
+ multiple plugins, causing argparse.ArgumentError conflicts.
"""
subcommands = ["remote", "recover", "hive", "eth-config"]
for subcommand in subcommands:
result = runner.invoke(execute, [subcommand, "--help"])
assert result.exit_code == 0, (
- f"execute {subcommand} --help failed with exit code {result.exit_code}\n"
- f"Output: {result.output}"
+ f"execute {subcommand} --help failed with exit code "
+ f"{result.exit_code}\nOutput: {result.output}"
)
# Ensure no argparse conflicts
assert "ArgumentError" not in result.output, (
diff --git a/packages/testing/src/execution_testing/cli/tests/test_pytest_fill_command.py b/packages/testing/src/execution_testing/cli/tests/test_pytest_fill_command.py
index dcb3d5a9e05..c663936810b 100644
--- a/packages/testing/src/execution_testing/cli/tests/test_pytest_fill_command.py
+++ b/packages/testing/src/execution_testing/cli/tests/test_pytest_fill_command.py
@@ -21,7 +21,7 @@ def test_function(state_test, pre):
@pytest.fixture
-def expected_exit_code() -> pytest.ExitCode:
+def expected_exit_code() -> pytest.ExitCode: # noqa: D103
return pytest.ExitCode.OK
@@ -81,7 +81,8 @@ class TestFillPytester:
"""
Test fill command using pytester.
- This mode skips the fill command's Click CLI and uses pytester to run the command.
+ This mode skips the fill command's Click CLI and uses pytester to run
+ the command.
Pytester allows actually filling the Python test files.
"""
@@ -143,7 +144,10 @@ def _run_fill(*args: str) -> RunResult:
@pytest.fixture()
def default_html_report_file_path(self) -> str:
"""File path for fill's pytest html report."""
- return execution_testing.cli.pytest_commands.plugins.filler.filler.default_html_report_file_path()
+ filler_module = (
+ execution_testing.cli.pytest_commands.plugins.filler.filler
+ )
+ return filler_module.default_html_report_file_path()
@pytest.fixture(scope="function")
def default_fixtures_output(
diff --git a/packages/testing/src/execution_testing/cli/tox_helpers.py b/packages/testing/src/execution_testing/cli/tox_helpers.py
index 765281464e7..551e90b627b 100644
--- a/packages/testing/src/execution_testing/cli/tox_helpers.py
+++ b/packages/testing/src/execution_testing/cli/tox_helpers.py
@@ -124,8 +124,8 @@ def pyspelling() -> None:
title="Pyspelling Check Failed",
tox_env="spellcheck",
error_message=(
- "aspell is not installed. This tool is required for spell checking "
- "documentation."
+ "aspell is not installed. This tool is required for "
+ "spell checking documentation."
),
fix_commands=[
"# Install aspell on Ubuntu/Debian",
@@ -138,7 +138,8 @@ def pyspelling() -> None:
sys.exit(1)
else:
click.echo(
- "********* Install 'aspell' and 'aspell-en' to enable spellcheck *********"
+ "********* Install 'aspell' and 'aspell-en' to enable "
+ "spellcheck *********"
)
sys.exit(0)
@@ -147,7 +148,9 @@ def pyspelling() -> None:
write_github_summary(
title="Pyspelling Check Failed",
tox_env="spellcheck",
- error_message="Pyspelling found spelling errors in the documentation.",
+ error_message=(
+ "Pyspelling found spelling errors in the documentation."
+ ),
fix_commands=[
"# Check the pyspelling configuration",
"cat .pyspelling.yml",
@@ -189,8 +192,8 @@ def codespell() -> None:
if result.returncode != 0:
console.print("\n[bold red]โ Spellcheck Failed[/bold red]")
console.print(
- "[yellow]Please review the errors above. For single-suggestion fixes, you can "
- "automatically apply them with:[/yellow]"
+ "[yellow]Please review the errors above. For single-suggestion "
+ "fixes, you can automatically apply them with:[/yellow]"
)
console.print(
f"[cyan]uv run codespell {paths_str} --write-changes[/cyan]\n"
@@ -253,7 +256,8 @@ def validate_changelog() -> None:
if invalid_lines:
click.echo(
- f"โ Found bullet points in {changelog_path} without proper punctuation:"
+ f"โ Found bullet points in {changelog_path} without proper "
+ "punctuation:"
)
click.echo()
for line_num, line in invalid_lines:
diff --git a/packages/testing/src/execution_testing/client_clis/cli_types.py b/packages/testing/src/execution_testing/client_clis/cli_types.py
index 190192ffcca..ea79c7554b4 100644
--- a/packages/testing/src/execution_testing/client_clis/cli_types.py
+++ b/packages/testing/src/execution_testing/client_clis/cli_types.py
@@ -137,17 +137,20 @@ def are_equivalent(
"""Return True if the only difference is the gas counter."""
if len(self.traces) != len(other.traces):
logger.debug(
- f"Traces have different lengths: {len(self.traces)} != {len(other.traces)}."
+ f"Traces have different lengths: "
+ f"{len(self.traces)} != {len(other.traces)}."
)
return False
if self.output != other.output:
logger.debug(
- f"Traces have different outputs: {self.output} != {other.output}."
+ f"Traces have different outputs: "
+ f"{self.output} != {other.output}."
)
return False
if self.gas_used != other.gas_used and not enable_post_processing:
logger.debug(
- f"Traces have different gas used: {self.gas_used} != {other.gas_used}."
+ f"Traces have different gas used: "
+ f"{self.gas_used} != {other.gas_used}."
)
return False
own_traces = self.traces.copy()
diff --git a/packages/testing/src/execution_testing/client_clis/clis/besu.py b/packages/testing/src/execution_testing/client_clis/clis/besu.py
index 824197fef7f..3a75c202d41 100644
--- a/packages/testing/src/execution_testing/client_clis/clis/besu.py
+++ b/packages/testing/src/execution_testing/client_clis/clis/besu.py
@@ -56,7 +56,8 @@ def __init__(
result = subprocess.run(args, capture_output=True, text=True)
except subprocess.CalledProcessError as e:
raise Exception(
- f"evm process unexpectedly returned a non-zero status code: {e}."
+ "evm process unexpectedly returned a non-zero status "
+ f"code: {e}."
) from e
except Exception as e:
raise Exception(
@@ -149,7 +150,8 @@ def evaluate(
#!/bin/bash
# Use $1 as t8n-server port if provided, else default to 3000
PORT=${{1:-3000}}
- curl http://localhost:${{PORT}}/ -X POST -H "Content-Type: application/json" \\
+ curl http://localhost:${{PORT}}/ -X POST \\
+ -H "Content-Type: application/json" \\
--data '{indented_post_data_string}'
"""
)
@@ -165,7 +167,8 @@ def evaluate(
)
response = requests.post(self.server_url, json=post_data, timeout=5)
- response.raise_for_status() # exception visible in pytest failure output
+ # exception visible in pytest failure output
+ response.raise_for_status()
output: TransitionToolOutput = TransitionToolOutput.model_validate(
response.json(),
context={"exception_mapper": self.exception_mapper},
@@ -177,7 +180,9 @@ def evaluate(
{
"response.txt": response.text,
"status_code.txt": response.status_code,
- "time_elapsed_seconds.txt": response.elapsed.total_seconds(),
+ "time_elapsed_seconds.txt": (
+ response.elapsed.total_seconds()
+ ),
},
)
@@ -222,7 +227,8 @@ class BesuExceptionMapper(ExceptionMapper):
mapping_substring: ClassVar[Dict[ExceptionBase, str]] = {
TransactionException.NONCE_IS_MAX: "invalid Nonce must be less than",
TransactionException.INSUFFICIENT_MAX_FEE_PER_BLOB_GAS: (
- "transaction invalid tx max fee per blob gas less than block blob gas fee"
+ "transaction invalid tx max fee per blob gas less than "
+ "block blob gas fee"
),
TransactionException.GASLIMIT_PRICE_PRODUCT_OVERFLOW: (
"invalid Upfront gas cost cannot exceed 2^256 Wei"
@@ -230,13 +236,19 @@ class BesuExceptionMapper(ExceptionMapper):
TransactionException.INSUFFICIENT_MAX_FEE_PER_GAS: (
"transaction invalid gasPrice is less than the current BaseFee"
),
- TransactionException.GAS_ALLOWANCE_EXCEEDED: "provided gas insufficient",
+ TransactionException.GAS_ALLOWANCE_EXCEEDED: (
+ "provided gas insufficient"
+ ),
TransactionException.PRIORITY_GREATER_THAN_MAX_FEE_PER_GAS: (
- "transaction invalid max priority fee per gas cannot be greater than max fee per gas"
+ "transaction invalid max priority fee per gas cannot be greater "
+ "than max fee per gas"
+ ),
+ TransactionException.TYPE_3_TX_INVALID_BLOB_VERSIONED_HASH: (
+ "Invalid versionedHash"
),
- TransactionException.TYPE_3_TX_INVALID_BLOB_VERSIONED_HASH: "Invalid versionedHash",
TransactionException.TYPE_3_TX_CONTRACT_CREATION: (
- "transaction invalid transaction blob transactions must have a to address"
+ "transaction invalid transaction blob transactions must have "
+ "a to address"
),
TransactionException.TYPE_3_TX_WITH_FULL_BLOBS: (
"Failed to decode transactions from block parameter"
@@ -248,11 +260,12 @@ class BesuExceptionMapper(ExceptionMapper):
"Transaction type BLOB is invalid, accepted transaction types are"
),
TransactionException.TYPE_4_EMPTY_AUTHORIZATION_LIST: (
- "transaction invalid transaction code delegation transactions must have a "
- "non-empty code delegation list"
+ "transaction invalid transaction code delegation transactions "
+ "must have a non-empty code delegation list"
),
TransactionException.TYPE_4_TX_CONTRACT_CREATION: (
- "transaction invalid transaction code delegation transactions must have a to address"
+ "transaction invalid transaction code delegation transactions "
+ "must have a to address"
),
TransactionException.TYPE_4_TX_PRE_FORK: (
"transaction invalid Transaction type DELEGATE_CODE is invalid"
@@ -269,70 +282,95 @@ class BesuExceptionMapper(ExceptionMapper):
BlockException.INCORRECT_BLOB_GAS_USED: (
"Payload BlobGasUsed does not match calculated BlobGasUsed"
),
- BlockException.INVALID_GAS_USED_ABOVE_LIMIT: "Header validation failed (FULL)",
+ BlockException.INVALID_GAS_USED_ABOVE_LIMIT: (
+ "Header validation failed (FULL)"
+ ),
BlockException.INVALID_GASLIMIT: "Header validation failed (FULL)",
BlockException.EXTRA_DATA_TOO_BIG: "Header validation failed (FULL)",
- BlockException.INVALID_BLOCK_NUMBER: "Header validation failed (FULL)",
- BlockException.INVALID_BASEFEE_PER_GAS: "Header validation failed (FULL)",
- BlockException.INVALID_BLOCK_TIMESTAMP_OLDER_THAN_PARENT: "block timestamp not greater than parent",
- BlockException.INVALID_LOG_BLOOM: "failed to validate output of imported block",
- BlockException.INVALID_RECEIPTS_ROOT: "failed to validate output of imported block",
- BlockException.INVALID_STATE_ROOT: "World State Root does not match expected value",
+ BlockException.INVALID_BLOCK_NUMBER: (
+ "Header validation failed (FULL)"
+ ),
+ BlockException.INVALID_BASEFEE_PER_GAS: (
+ "Header validation failed (FULL)"
+ ),
+ BlockException.INVALID_BLOCK_TIMESTAMP_OLDER_THAN_PARENT: (
+ "block timestamp not greater than parent"
+ ),
+ BlockException.INVALID_LOG_BLOOM: (
+ "failed to validate output of imported block"
+ ),
+ BlockException.INVALID_RECEIPTS_ROOT: (
+ "failed to validate output of imported block"
+ ),
+ BlockException.INVALID_STATE_ROOT: (
+ "World State Root does not match expected value"
+ ),
}
mapping_regex = {
BlockException.INVALID_REQUESTS: (
- r"Invalid execution requests|Requests hash mismatch, calculated: 0x[0-9a-f]+ header: "
- r"0x[0-9a-f]+"
+ r"Invalid execution requests|Requests hash mismatch, "
+ r"calculated: 0x[0-9a-f]+ header: 0x[0-9a-f]+"
),
BlockException.INVALID_BLOCK_HASH: (
- r"Computed block hash 0x[0-9a-f]+ does not match block hash parameter 0x[0-9a-f]+"
+ r"Computed block hash 0x[0-9a-f]+ does not match block "
+ r"hash parameter 0x[0-9a-f]+"
),
BlockException.SYSTEM_CONTRACT_CALL_FAILED: (
- r"System call halted|System call did not execute to completion"
+ r"System call halted|"
+ r"System call did not execute to completion"
),
BlockException.SYSTEM_CONTRACT_EMPTY: (
r"(Invalid system call, no code at address)|"
r"(Invalid system call address:)"
),
BlockException.INVALID_DEPOSIT_EVENT_LAYOUT: (
- r"Invalid (amount|index|pubKey|signature|withdrawalCred) (offset|size): "
- r"expected (\d+), but got (-?\d+)|"
- r"Invalid deposit log length\. Must be \d+ bytes, but is \d+ bytes"
+ r"Invalid (amount|index|pubKey|signature|withdrawalCred) "
+ r"(offset|size): expected (\d+), but got (-?\d+)|"
+ r"Invalid deposit log length\. Must be \d+ bytes, "
+ r"but is \d+ bytes"
),
BlockException.RLP_BLOCK_LIMIT_EXCEEDED: (
r"Block size of \d+ bytes exceeds limit of \d+ bytes"
),
TransactionException.INITCODE_SIZE_EXCEEDED: (
- r"transaction invalid Initcode size of \d+ exceeds maximum size of \d+"
+ r"transaction invalid Initcode size of \d+ exceeds "
+ r"maximum size of \d+"
),
TransactionException.INSUFFICIENT_ACCOUNT_FUNDS: (
- r"transaction invalid transaction up-front cost 0x[0-9a-f]+ exceeds transaction "
- r"sender account balance 0x[0-9a-f]+"
+ r"transaction invalid transaction up-front cost 0x[0-9a-f]+ "
+ r"exceeds transaction sender account balance 0x[0-9a-f]+"
),
TransactionException.INTRINSIC_GAS_TOO_LOW: (
- r"transaction invalid intrinsic gas cost \d+ exceeds gas limit \d+"
+ r"transaction invalid intrinsic gas cost \d+ "
+ r"exceeds gas limit \d+"
),
TransactionException.INTRINSIC_GAS_BELOW_FLOOR_GAS_COST: (
- r"transaction invalid intrinsic gas cost \d+ exceeds gas limit \d+"
+ r"transaction invalid intrinsic gas cost \d+ "
+ r"exceeds gas limit \d+"
),
TransactionException.SENDER_NOT_EOA: (
- r"transaction invalid Sender 0x[0-9a-f]+ has deployed code and so is not authorized "
- r"to send transactions"
+ r"transaction invalid Sender 0x[0-9a-f]+ has deployed code "
+ r"and so is not authorized to send transactions"
),
TransactionException.NONCE_MISMATCH_TOO_LOW: (
- r"transaction invalid transaction nonce \d+ below sender account nonce \d+"
+ r"transaction invalid transaction nonce \d+ "
+ r"below sender account nonce \d+"
),
TransactionException.NONCE_MISMATCH_TOO_HIGH: (
- r"transaction invalid transaction nonce \d+ does not match sender account nonce \d+"
+ r"transaction invalid transaction nonce \d+ "
+ r"does not match sender account nonce \d+"
),
TransactionException.GAS_LIMIT_EXCEEDS_MAXIMUM: (
- r"transaction invalid Transaction gas limit must be at most \d+"
+ r"transaction invalid Transaction gas limit "
+ r"must be at most \d+"
),
TransactionException.TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED: (
- r"Blob transaction 0x[0-9a-f]+ exceeds block blob gas limit: \d+ > \d+"
+ r"Blob transaction 0x[0-9a-f]+ exceeds "
+ r"block blob gas limit: \d+ > \d+"
),
TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED: (
- r"Blob transaction has too many blobs: \d+|Invalid Blob Count: \d+"
+ r"Blob transaction has too many blobs: \d+|"
+ r"Invalid Blob Count: \d+"
),
# BAL Exceptions: TODO - review once all clients completed.
BlockException.INVALID_BAL_EXTRA_ACCOUNT: (
diff --git a/packages/testing/src/execution_testing/client_clis/clis/erigon.py b/packages/testing/src/execution_testing/client_clis/clis/erigon.py
index 8e1f51b8519..b346a6f4b2f 100644
--- a/packages/testing/src/execution_testing/client_clis/clis/erigon.py
+++ b/packages/testing/src/execution_testing/client_clis/clis/erigon.py
@@ -12,57 +12,106 @@ class ErigonExceptionMapper(ExceptionMapper):
mapping_substring = {
TransactionException.SENDER_NOT_EOA: "sender not an eoa",
- TransactionException.INITCODE_SIZE_EXCEEDED: "max initcode size exceeded",
+ TransactionException.INITCODE_SIZE_EXCEEDED: (
+ "max initcode size exceeded"
+ ),
TransactionException.INSUFFICIENT_ACCOUNT_FUNDS: (
"insufficient funds for gas * price + value"
),
TransactionException.NONCE_IS_MAX: "nonce has max value",
TransactionException.INTRINSIC_GAS_TOO_LOW: "intrinsic gas too low",
- TransactionException.INTRINSIC_GAS_BELOW_FLOOR_GAS_COST: "intrinsic gas too low",
- TransactionException.INSUFFICIENT_MAX_FEE_PER_GAS: "fee cap less than block base fee",
- TransactionException.PRIORITY_GREATER_THAN_MAX_FEE_PER_GAS: "tip higher than fee cap",
- TransactionException.INSUFFICIENT_MAX_FEE_PER_BLOB_GAS: "max fee per blob gas too low",
+ TransactionException.INTRINSIC_GAS_BELOW_FLOOR_GAS_COST: (
+ "intrinsic gas too low"
+ ),
+ TransactionException.INSUFFICIENT_MAX_FEE_PER_GAS: (
+ "fee cap less than block base fee"
+ ),
+ TransactionException.PRIORITY_GREATER_THAN_MAX_FEE_PER_GAS: (
+ "tip higher than fee cap"
+ ),
+ TransactionException.INSUFFICIENT_MAX_FEE_PER_BLOB_GAS: (
+ "max fee per blob gas too low"
+ ),
TransactionException.NONCE_MISMATCH_TOO_LOW: "nonce too low",
TransactionException.NONCE_MISMATCH_TOO_HIGH: "nonce too high",
TransactionException.GAS_ALLOWANCE_EXCEEDED: "gas limit reached",
- TransactionException.TYPE_3_TX_PRE_FORK: "blob txn is not supported by signer",
+ TransactionException.TYPE_3_TX_PRE_FORK: (
+ "blob txn is not supported by signer"
+ ),
TransactionException.TYPE_3_TX_INVALID_BLOB_VERSIONED_HASH: (
- "invalid blob versioned hash, must start with VERSIONED_HASH_VERSION_KZG"
+ "invalid blob versioned hash, must start with "
+ "VERSIONED_HASH_VERSION_KZG"
+ ),
+ TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED: (
+ "blob transaction has too many blobs"
+ ),
+ TransactionException.TYPE_3_TX_ZERO_BLOBS: (
+ "a blob stx must contain at least one blob"
+ ),
+ TransactionException.TYPE_3_TX_WITH_FULL_BLOBS: (
+ "rlp: expected String or Byte"
+ ),
+ TransactionException.TYPE_3_TX_CONTRACT_CREATION: (
+ "wrong size for To: 0"
),
- TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED: "blob transaction has too many blobs",
- TransactionException.TYPE_3_TX_ZERO_BLOBS: "a blob stx must contain at least one blob",
- TransactionException.TYPE_3_TX_WITH_FULL_BLOBS: "rlp: expected String or Byte",
- TransactionException.TYPE_3_TX_CONTRACT_CREATION: "wrong size for To: 0",
TransactionException.TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED: (
"blobs/blobgas exceeds max"
),
TransactionException.TYPE_4_EMPTY_AUTHORIZATION_LIST: (
"SetCodeTransaction without authorizations is invalid"
),
- TransactionException.TYPE_4_TX_CONTRACT_CREATION: "wrong size for To: 0",
- TransactionException.TYPE_4_TX_PRE_FORK: "setCode tx is not supported by signer",
- BlockException.INVALID_DEPOSIT_EVENT_LAYOUT: "could not parse requests logs",
- BlockException.SYSTEM_CONTRACT_EMPTY: "Syscall failure: Empty Code at",
- BlockException.SYSTEM_CONTRACT_CALL_FAILED: "Unprecedented Syscall failure",
- BlockException.INVALID_REQUESTS: "invalid requests root hash in header",
+ TransactionException.TYPE_4_TX_CONTRACT_CREATION: (
+ "wrong size for To: 0"
+ ),
+ TransactionException.TYPE_4_TX_PRE_FORK: (
+ "setCode tx is not supported by signer"
+ ),
+ BlockException.INVALID_DEPOSIT_EVENT_LAYOUT: (
+ "could not parse requests logs"
+ ),
+ BlockException.SYSTEM_CONTRACT_EMPTY: (
+ "Syscall failure: Empty Code at"
+ ),
+ BlockException.SYSTEM_CONTRACT_CALL_FAILED: (
+ "Unprecedented Syscall failure"
+ ),
+ BlockException.INVALID_REQUESTS: (
+ "invalid requests root hash in header"
+ ),
BlockException.INVALID_BLOCK_HASH: "invalid block hash",
BlockException.RLP_BLOCK_LIMIT_EXCEEDED: "block exceeds max rlp size",
- BlockException.INVALID_BASEFEE_PER_GAS: "invalid block: invalid baseFee",
- BlockException.INVALID_BLOCK_TIMESTAMP_OLDER_THAN_PARENT: "invalid block: timestamp older than parent",
+ BlockException.INVALID_BASEFEE_PER_GAS: (
+ "invalid block: invalid baseFee"
+ ),
+ BlockException.INVALID_BLOCK_TIMESTAMP_OLDER_THAN_PARENT: (
+ "invalid block: timestamp older than parent"
+ ),
BlockException.INVALID_BLOCK_NUMBER: "invalid block number",
- BlockException.EXTRA_DATA_TOO_BIG: "invalid block: extra-data longer than 32 bytes",
+ BlockException.EXTRA_DATA_TOO_BIG: (
+ "invalid block: extra-data longer than 32 bytes"
+ ),
BlockException.INVALID_GASLIMIT: "invalid block: invalid gas limit",
BlockException.INVALID_STATE_ROOT: "invalid block: wrong trie root",
BlockException.INVALID_RECEIPTS_ROOT: "receiptHash mismatch",
BlockException.INVALID_LOG_BLOOM: "invalid bloom",
}
mapping_regex = {
- BlockException.INVALID_BLOCK_ACCESS_LIST: r"invalid block access list|block access list mismatch",
+ BlockException.INVALID_BLOCK_ACCESS_LIST: (
+ r"invalid block access list|block access list mismatch"
+ ),
TransactionException.GAS_LIMIT_EXCEEDS_MAXIMUM: (
r"invalid block, txnIdx=\d+,.*gas limit too high"
),
- BlockException.INCORRECT_BLOB_GAS_USED: r"blobGasUsed by execution: \d+, in header: \d+",
- BlockException.INCORRECT_EXCESS_BLOB_GAS: r"invalid excessBlobGas: have \d+, want \d+",
- BlockException.INVALID_GAS_USED: r"gas used by execution: \w+, in header: \w+",
- BlockException.INVALID_GAS_USED_ABOVE_LIMIT: r"invalid gasUsed: have \d+, gasLimit \d+",
+ BlockException.INCORRECT_BLOB_GAS_USED: (
+ r"blobGasUsed by execution: \d+, in header: \d+"
+ ),
+ BlockException.INCORRECT_EXCESS_BLOB_GAS: (
+ r"invalid excessBlobGas: have \d+, want \d+"
+ ),
+ BlockException.INVALID_GAS_USED: (
+ r"gas used by execution: \w+, in header: \w+"
+ ),
+ BlockException.INVALID_GAS_USED_ABOVE_LIMIT: (
+ r"invalid gasUsed: have \d+, gasLimit \d+"
+ ),
}
diff --git a/packages/testing/src/execution_testing/client_clis/clis/ethereumjs.py b/packages/testing/src/execution_testing/client_clis/clis/ethereumjs.py
index 77088cddd09..a781be51f8f 100644
--- a/packages/testing/src/execution_testing/client_clis/clis/ethereumjs.py
+++ b/packages/testing/src/execution_testing/client_clis/clis/ethereumjs.py
@@ -65,7 +65,9 @@ class EthereumJSExceptionMapper(ExceptionMapper):
TransactionException.GASLIMIT_PRICE_PRODUCT_OVERFLOW: (
"gas limit * gasPrice cannot exceed MAX_INTEGER"
),
- TransactionException.INSUFFICIENT_MAX_FEE_PER_GAS: "tx unable to pay base fee",
+ TransactionException.INSUFFICIENT_MAX_FEE_PER_GAS: (
+ "tx unable to pay base fee"
+ ),
TransactionException.NONCE_IS_MAX: "nonce cannot equal or exceed",
TransactionException.PRIORITY_GREATER_THAN_MAX_FEE_PER_GAS: (
"maxFeePerGas cannot be less than maxPriorityFeePerGas"
@@ -74,16 +76,25 @@ class EthereumJSExceptionMapper(ExceptionMapper):
"versioned hash does not start with KZG commitment version"
),
# This message is the same as TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED
- TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED: "exceed maximum allowance",
- TransactionException.TYPE_3_TX_ZERO_BLOBS: "tx should contain at least one blob",
- TransactionException.TYPE_3_TX_WITH_FULL_BLOBS: "Invalid EIP-4844 transaction",
+ TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED: (
+ "exceed maximum allowance"
+ ),
+ TransactionException.TYPE_3_TX_ZERO_BLOBS: (
+ "tx should contain at least one blob"
+ ),
+ TransactionException.TYPE_3_TX_WITH_FULL_BLOBS: (
+ "Invalid EIP-4844 transaction"
+ ),
TransactionException.TYPE_3_TX_CONTRACT_CREATION: (
- 'tx should have a "to" field and cannot be used to create contracts'
+ 'tx should have a "to" field and '
+ "cannot be used to create contracts"
),
TransactionException.TYPE_4_EMPTY_AUTHORIZATION_LIST: (
"Invalid EIP-7702 transaction: authorization list is empty"
),
- TransactionException.INTRINSIC_GAS_TOO_LOW: "is lower than the minimum gas limit of",
+ TransactionException.INTRINSIC_GAS_TOO_LOW: (
+ "is lower than the minimum gas limit of"
+ ),
TransactionException.INTRINSIC_GAS_BELOW_FLOOR_GAS_COST: (
"is lower than the minimum gas limit of"
),
@@ -91,37 +102,51 @@ class EthereumJSExceptionMapper(ExceptionMapper):
"the initcode size of this transaction is too large"
),
TransactionException.TYPE_4_TX_CONTRACT_CREATION: (
- 'tx should have a "to" field and cannot be used to create contracts'
+ 'tx should have a "to" field and '
+ "cannot be used to create contracts"
),
TransactionException.INSUFFICIENT_ACCOUNT_FUNDS: (
"sender doesn't have enough funds to send tx"
),
- TransactionException.NONCE_MISMATCH_TOO_LOW: "the tx doesn't have the correct nonce",
- TransactionException.GAS_ALLOWANCE_EXCEEDED: "tx has a higher gas limit than the block",
+ TransactionException.NONCE_MISMATCH_TOO_LOW: (
+ "the tx doesn't have the correct nonce"
+ ),
+ TransactionException.GAS_ALLOWANCE_EXCEEDED: (
+ "tx has a higher gas limit than the block"
+ ),
BlockException.INCORRECT_EXCESS_BLOB_GAS: "Invalid 4844 transactions",
BlockException.INVALID_RECEIPTS_ROOT: "invalid receipttrie",
BlockException.INVALID_DEPOSIT_EVENT_LAYOUT: (
- "Error verifying block while running: error: number exceeds 53 bits"
+ "Error verifying block while running: "
+ "error: number exceeds 53 bits"
),
}
mapping_regex: ClassVar[Dict[ExceptionBase, str]] = {
TransactionException.TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED: (
- r"tx causes total blob gas of \d+ to exceed maximum blob gas per block of \d+|"
- r"tx can contain at most \d+ blobs"
+ r"tx causes total blob gas of \d+ to exceed maximum "
+ r"blob gas per block of \d+|tx can contain at most \d+ blobs"
),
TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED: (
- r"tx causes total blob gas of \d+ to exceed maximum blob gas per block of \d+|"
- r"tx can contain at most \d+ blobs"
+ r"tx causes total blob gas of \d+ to exceed maximum "
+ r"blob gas per block of \d+|tx can contain at most \d+ blobs"
),
TransactionException.TYPE_3_TX_PRE_FORK: (
- r"blob tx used but field env.ExcessBlobGas missing|EIP-4844 not enabled on Common"
+ r"blob tx used but field env.ExcessBlobGas missing|"
+ r"EIP-4844 not enabled on Common"
+ ),
+ BlockException.BLOB_GAS_USED_ABOVE_LIMIT: (
+ r"invalid blobGasUsed expected=\d+ actual=\d+"
+ ),
+ BlockException.INCORRECT_BLOB_GAS_USED: (
+ r"invalid blobGasUsed expected=\d+ actual=\d+"
),
- BlockException.BLOB_GAS_USED_ABOVE_LIMIT: r"invalid blobGasUsed expected=\d+ actual=\d+",
- BlockException.INCORRECT_BLOB_GAS_USED: r"invalid blobGasUsed expected=\d+ actual=\d+",
BlockException.INVALID_BLOCK_HASH: (
- r"Invalid blockHash, expected: 0x[0-9a-f]+, received: 0x[0-9a-f]+"
+ r"Invalid blockHash, expected: 0x[0-9a-f]+, "
+ r"received: 0x[0-9a-f]+"
+ ),
+ BlockException.INVALID_REQUESTS: (
+ r"Unknown request identifier|invalid requestshash"
),
- BlockException.INVALID_REQUESTS: r"Unknown request identifier|invalid requestshash",
BlockException.INVALID_GAS_USED_ABOVE_LIMIT: (
r"Invalid block: too much gas used. Used: \d+, gas limit: \d+"
),
diff --git a/packages/testing/src/execution_testing/client_clis/clis/ethrex.py b/packages/testing/src/execution_testing/client_clis/clis/ethrex.py
index 8db6311a3a3..66ec2ece331 100644
--- a/packages/testing/src/execution_testing/client_clis/clis/ethrex.py
+++ b/packages/testing/src/execution_testing/client_clis/clis/ethrex.py
@@ -18,28 +18,41 @@ class EthrexExceptionMapper(ExceptionMapper):
"Invalid deposit request layout"
),
BlockException.INVALID_REQUESTS: (
- "Requests hash does not match the one in the header after executing"
+ "Requests hash does not match the one in "
+ "the header after executing"
),
BlockException.INVALID_RECEIPTS_ROOT: (
- "Receipts Root does not match the one in the header after executing"
+ "Receipts Root does not match the one in "
+ "the header after executing"
),
BlockException.INVALID_STATE_ROOT: (
- "World State Root does not match the one in the header after executing"
+ "World State Root does not match the one in "
+ "the header after executing"
+ ),
+ BlockException.INVALID_GAS_USED: (
+ "Gas used doesn't match value in header"
+ ),
+ BlockException.INCORRECT_BLOB_GAS_USED: (
+ "Blob gas used doesn't match value in header"
+ ),
+ BlockException.INVALID_BASEFEE_PER_GAS: (
+ "Base fee per gas is incorrect"
),
- BlockException.INVALID_GAS_USED: "Gas used doesn't match value in header",
- BlockException.INCORRECT_BLOB_GAS_USED: "Blob gas used doesn't match value in header",
- BlockException.INVALID_BASEFEE_PER_GAS: "Base fee per gas is incorrect",
}
mapping_regex = {
TransactionException.PRIORITY_GREATER_THAN_MAX_FEE_PER_GAS: (
r"(?i)priority fee.* is greater than max fee.*"
),
- TransactionException.TYPE_4_EMPTY_AUTHORIZATION_LIST: r"(?i)empty authorization list",
+ TransactionException.TYPE_4_EMPTY_AUTHORIZATION_LIST: (
+ r"(?i)empty authorization list"
+ ),
TransactionException.SENDER_NOT_EOA: (
r"reject transactions from senders with deployed code|"
r"Sender account .* shouldn't be a contract"
),
- TransactionException.NONCE_MISMATCH_TOO_LOW: r"nonce \d+ too low, expected \d+|Nonce mismatch.*",
+ TransactionException.NONCE_MISMATCH_TOO_LOW: (
+ r"nonce \d+ too low, expected \d+|Nonce mismatch.*"
+ ),
TransactionException.NONCE_MISMATCH_TOO_HIGH: r"Nonce mismatch.*",
TransactionException.TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED: (
r"blob gas used \d+ exceeds maximum allowance \d+"
@@ -62,28 +75,35 @@ class EthrexExceptionMapper(ExceptionMapper):
# can't decode it.
TransactionException.TYPE_4_TX_CONTRACT_CREATION: (
r"unexpected length|Contract creation in type 4 transaction|"
- r"Error decoding field 'to' of type primitive_types::H160: InvalidLength"
+ r"Error decoding field 'to' of type primitive_types::H160: "
+ r"InvalidLength"
),
TransactionException.TYPE_3_TX_CONTRACT_CREATION: (
r"unexpected length|Contract creation in type 3 transaction|"
- r"Error decoding field 'to' of type primitive_types::H160: InvalidLength"
+ r"Error decoding field 'to' of type primitive_types::H160: "
+ r"InvalidLength"
),
TransactionException.TYPE_4_TX_PRE_FORK: (
r"eip 7702 transactions present in pre-prague payload|"
r"Type 4 transactions are not supported before the Prague fork"
),
TransactionException.INSUFFICIENT_ACCOUNT_FUNDS: (
- r"lack of funds \(\d+\) for max fee \(\d+\)|Insufficient account funds"
+ r"lack of funds \(\d+\) for max fee \(\d+\)|"
+ r"Insufficient account funds"
),
TransactionException.INTRINSIC_GAS_TOO_LOW: (
- r"gas floor exceeds the gas limit|call gas cost exceeds the gas limit|"
- r"Transaction gas limit lower than the minimum gas cost to execute the transaction"
+ r"gas floor exceeds the gas limit|"
+ r"call gas cost exceeds the gas limit|"
+ r"Transaction gas limit lower than the minimum gas cost "
+ r"to execute the transaction"
),
TransactionException.INTRINSIC_GAS_BELOW_FLOOR_GAS_COST: (
- r"Transaction gas limit lower than the gas cost floor for calldata tokens"
+ r"Transaction gas limit lower than the gas cost floor "
+ r"for calldata tokens"
),
TransactionException.INSUFFICIENT_MAX_FEE_PER_GAS: (
- r"gas price is less than basefee|Insufficient max fee per gas"
+ r"gas price is less than basefee|"
+ r"Insufficient max fee per gas"
),
TransactionException.INSUFFICIENT_MAX_FEE_PER_BLOB_GAS: (
r"blob gas price is greater than max fee per blob gas|"
@@ -103,7 +123,8 @@ class EthrexExceptionMapper(ExceptionMapper):
r"Invalid transaction: Gas limit price product overflow.*"
),
TransactionException.GAS_LIMIT_EXCEEDS_MAXIMUM: (
- r"Invalid transaction: Transaction gas limit exceeds maximum.*"
+ r"Invalid transaction: "
+ r"Transaction gas limit exceeds maximum.*"
),
BlockException.SYSTEM_CONTRACT_CALL_FAILED: (r"System call failed.*"),
BlockException.SYSTEM_CONTRACT_EMPTY: (
diff --git a/packages/testing/src/execution_testing/client_clis/clis/evmone.py b/packages/testing/src/execution_testing/client_clis/clis/evmone.py
index 541f88539a9..e474e752aab 100644
--- a/packages/testing/src/execution_testing/client_clis/clis/evmone.py
+++ b/packages/testing/src/execution_testing/client_clis/clis/evmone.py
@@ -144,7 +144,8 @@ def _consume_debug_dump(
shutil.copyfile(fixture_path, debug_fixture_path)
def _skip_message(self, fixture_format: FixtureFormat) -> str:
- return f"Fixture format {fixture_format.format_name} not supported by {self.binary}"
+ fmt_name = fixture_format.format_name
+ return f"Fixture format {fmt_name} not supported by {self.binary}"
@cache # noqa
def consume_test_file(
@@ -175,15 +176,18 @@ def consume_test_file(
result = self._run_command(command)
if result.returncode not in [0, 1]:
+ cmd_str = " ".join(command)
raise Exception(
- f"Unexpected exit code:\n{' '.join(command)}\n\n Error:\n{result.stderr}"
+ f"Unexpected exit code:\n{cmd_str}\n\n Error:\n"
+ f"{result.stderr}"
)
try:
output_data = json.load(tempfile_json)
except json.JSONDecodeError as e:
raise Exception(
- f"Failed to parse JSON output from evmone-state/blockchaintest: {e}"
+ "Failed to parse JSON output from "
+ f"evmone-state/blockchaintest: {e}"
) from e
if debug_output_path:
@@ -334,16 +338,28 @@ class EvmoneExceptionMapper(ExceptionMapper):
"max priority fee per gas higher than max fee per gas"
),
TransactionException.NONCE_IS_MAX: "nonce has max value:",
- TransactionException.TYPE_4_TX_CONTRACT_CREATION: "set code transaction must ",
- TransactionException.TYPE_4_INVALID_AUTHORITY_SIGNATURE: "invalid authorization signature",
+ TransactionException.TYPE_4_TX_CONTRACT_CREATION: (
+ "set code transaction must "
+ ),
+ TransactionException.TYPE_4_INVALID_AUTHORITY_SIGNATURE: (
+ "invalid authorization signature"
+ ),
TransactionException.TYPE_4_INVALID_AUTHORITY_SIGNATURE_S_TOO_HIGH: (
"authorization signature s value too high"
),
- TransactionException.TYPE_4_EMPTY_AUTHORIZATION_LIST: "empty authorization list",
+ TransactionException.TYPE_4_EMPTY_AUTHORIZATION_LIST: (
+ "empty authorization list"
+ ),
TransactionException.INTRINSIC_GAS_TOO_LOW: "intrinsic gas too low",
- TransactionException.INTRINSIC_GAS_BELOW_FLOOR_GAS_COST: "intrinsic gas too low",
- TransactionException.TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED: "blob gas limit exceeded",
- TransactionException.INITCODE_SIZE_EXCEEDED: "max initcode size exceeded",
+ TransactionException.INTRINSIC_GAS_BELOW_FLOOR_GAS_COST: (
+ "intrinsic gas too low"
+ ),
+ TransactionException.TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED: (
+ "blob gas limit exceeded"
+ ),
+ TransactionException.INITCODE_SIZE_EXCEEDED: (
+ "max initcode size exceeded"
+ ),
TransactionException.INSUFFICIENT_ACCOUNT_FUNDS: (
"insufficient funds for gas * price + value"
),
@@ -353,23 +369,43 @@ class EvmoneExceptionMapper(ExceptionMapper):
TransactionException.INSUFFICIENT_MAX_FEE_PER_BLOB_GAS: (
"max blob fee per gas less than block base fee"
),
- TransactionException.TYPE_4_TX_PRE_FORK: "transaction type not supported",
- TransactionException.TYPE_3_TX_PRE_FORK: "transaction type not supported",
- TransactionException.TYPE_2_TX_PRE_FORK: "transaction type not supported",
- TransactionException.TYPE_1_TX_PRE_FORK: "transaction type not supported",
- TransactionException.TYPE_3_TX_INVALID_BLOB_VERSIONED_HASH: "invalid blob hash version",
- TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED: "blob gas limit exceeded",
+ TransactionException.TYPE_4_TX_PRE_FORK: (
+ "transaction type not supported"
+ ),
+ TransactionException.TYPE_3_TX_PRE_FORK: (
+ "transaction type not supported"
+ ),
+ TransactionException.TYPE_2_TX_PRE_FORK: (
+ "transaction type not supported"
+ ),
+ TransactionException.TYPE_1_TX_PRE_FORK: (
+ "transaction type not supported"
+ ),
+ TransactionException.TYPE_3_TX_INVALID_BLOB_VERSIONED_HASH: (
+ "invalid blob hash version"
+ ),
+ TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED: (
+ "blob gas limit exceeded"
+ ),
TransactionException.TYPE_3_TX_ZERO_BLOBS: "empty blob hashes list",
TransactionException.TYPE_3_TX_CONTRACT_CREATION: (
"blob transaction must not be a create transaction"
),
TransactionException.NONCE_MISMATCH_TOO_LOW: "nonce too low",
TransactionException.NONCE_MISMATCH_TOO_HIGH: "nonce too high",
- TransactionException.GAS_LIMIT_EXCEEDS_MAXIMUM: "max gas limit exceeded",
- BlockException.INVALID_DEPOSIT_EVENT_LAYOUT: "invalid deposit event layout",
+ TransactionException.GAS_LIMIT_EXCEEDS_MAXIMUM: (
+ "max gas limit exceeded"
+ ),
+ BlockException.INVALID_DEPOSIT_EVENT_LAYOUT: (
+ "invalid deposit event layout"
+ ),
# TODO EVMONE needs to differentiate when the system contract is
# missing or failing
- BlockException.SYSTEM_CONTRACT_EMPTY: "system contract empty or failed",
- BlockException.SYSTEM_CONTRACT_CALL_FAILED: "system contract empty or failed",
+ BlockException.SYSTEM_CONTRACT_EMPTY: (
+ "system contract empty or failed"
+ ),
+ BlockException.SYSTEM_CONTRACT_CALL_FAILED: (
+ "system contract empty or failed"
+ ),
}
mapping_regex: ClassVar[Dict[ExceptionBase, str]] = {}
diff --git a/packages/testing/src/execution_testing/client_clis/clis/execution_specs.py b/packages/testing/src/execution_testing/client_clis/clis/execution_specs.py
index 70b8a8049c3..7f181df9cc6 100644
--- a/packages/testing/src/execution_testing/client_clis/clis/execution_specs.py
+++ b/packages/testing/src/execution_testing/client_clis/clis/execution_specs.py
@@ -7,12 +7,12 @@
from io import StringIO
from pathlib import Path
from typing import Any, ClassVar, Dict, Optional
-from typing_extensions import override
import ethereum
from ethereum_spec_tools.evm_tools import create_parser
from ethereum_spec_tools.evm_tools.t8n import T8N, ForkCache
from ethereum_spec_tools.evm_tools.utils import get_supported_forks
+from typing_extensions import override
from execution_testing.client_clis.cli_types import TransitionToolOutput
from execution_testing.client_clis.file_utils import (
@@ -159,6 +159,7 @@ def evaluate(
@classmethod
def is_installed(cls, binary_path: Optional[Path] = None) -> bool:
"""ExecutionSpecs is always installed."""
+ del binary_path
return True
@@ -169,13 +170,18 @@ class ExecutionSpecsExceptionMapper(ExceptionMapper):
"""
mapping_substring: ClassVar[Dict[ExceptionBase, str]] = {
- TransactionException.TYPE_4_EMPTY_AUTHORIZATION_LIST: "EmptyAuthorizationListError",
+ TransactionException.TYPE_4_EMPTY_AUTHORIZATION_LIST: (
+ "EmptyAuthorizationListError"
+ ),
TransactionException.SENDER_NOT_EOA: "InvalidSenderError",
TransactionException.TYPE_4_TX_CONTRACT_CREATION: (
"TransactionTypeContractCreationError("
- "'transaction type `SetCodeTransaction` not allowed to create contracts')"
+ "'transaction type `SetCodeTransaction` not allowed to "
+ "create contracts')"
+ ),
+ TransactionException.INSUFFICIENT_ACCOUNT_FUNDS: (
+ "InsufficientBalanceError"
),
- TransactionException.INSUFFICIENT_ACCOUNT_FUNDS: "InsufficientBalanceError",
TransactionException.TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED: (
"BlobGasLimitExceededError"
),
@@ -186,30 +192,46 @@ class ExecutionSpecsExceptionMapper(ExceptionMapper):
"InvalidBlobVersionedHashError"
),
# This message is the same as TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED
- TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED: "BlobCountExceededError",
+ TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED: (
+ "BlobCountExceededError"
+ ),
TransactionException.TYPE_3_TX_ZERO_BLOBS: "NoBlobDataError",
- TransactionException.INTRINSIC_GAS_TOO_LOW: "InsufficientTransactionGasError",
- TransactionException.INTRINSIC_GAS_BELOW_FLOOR_GAS_COST: "InsufficientTransactionGasError",
+ TransactionException.INTRINSIC_GAS_TOO_LOW: (
+ "InsufficientTransactionGasError"
+ ),
+ TransactionException.INTRINSIC_GAS_BELOW_FLOOR_GAS_COST: (
+ "InsufficientTransactionGasError"
+ ),
TransactionException.INITCODE_SIZE_EXCEEDED: "InitCodeTooLargeError",
TransactionException.PRIORITY_GREATER_THAN_MAX_FEE_PER_GAS: (
"PriorityFeeGreaterThanMaxFeeError"
),
- TransactionException.NONCE_MISMATCH_TOO_HIGH: "NonceMismatchError('nonce too high')",
- TransactionException.NONCE_MISMATCH_TOO_LOW: "NonceMismatchError('nonce too low')",
+ TransactionException.NONCE_MISMATCH_TOO_HIGH: (
+ "NonceMismatchError('nonce too high')"
+ ),
+ TransactionException.NONCE_MISMATCH_TOO_LOW: (
+ "NonceMismatchError('nonce too low')"
+ ),
TransactionException.TYPE_3_TX_CONTRACT_CREATION: (
"TransactionTypeContractCreationError("
- "'transaction type `BlobTransaction` not allowed to create contracts')"
+ "'transaction type `BlobTransaction` not allowed to "
+ "create contracts')"
),
TransactionException.NONCE_IS_MAX: "NonceOverflowError",
- TransactionException.GAS_ALLOWANCE_EXCEEDED: "GasUsedExceedsLimitError",
- TransactionException.GAS_LIMIT_EXCEEDS_MAXIMUM: "TransactionGasLimitExceededError",
+ TransactionException.GAS_ALLOWANCE_EXCEEDED: (
+ "GasUsedExceedsLimitError"
+ ),
+ TransactionException.GAS_LIMIT_EXCEEDS_MAXIMUM: (
+ "TransactionGasLimitExceededError"
+ ),
BlockException.SYSTEM_CONTRACT_EMPTY: "System contract address",
BlockException.SYSTEM_CONTRACT_CALL_FAILED: "call failed:",
BlockException.INVALID_DEPOSIT_EVENT_LAYOUT: "deposit",
}
mapping_regex: ClassVar[Dict[ExceptionBase, str]] = {
+ # Temporary solution for issue #1981.
TransactionException.INSUFFICIENT_MAX_FEE_PER_GAS: (
- r"InsufficientMaxFeePerGasError|InvalidBlock" # Temporary solution for issue #1981.
+ r"InsufficientMaxFeePerGasError|InvalidBlock"
),
TransactionException.TYPE_1_TX_PRE_FORK: (
r"module '.*transactions' has no attribute 'AccessListTransaction'"
diff --git a/packages/testing/src/execution_testing/client_clis/clis/geth.py b/packages/testing/src/execution_testing/client_clis/clis/geth.py
index 8c41822020e..e2e2c439d63 100644
--- a/packages/testing/src/execution_testing/client_clis/clis/geth.py
+++ b/packages/testing/src/execution_testing/client_clis/clis/geth.py
@@ -63,41 +63,65 @@ class GethExceptionMapper(ExceptionMapper):
TransactionException.TYPE_3_TX_PRE_FORK: (
"transaction type not supported"
),
- TransactionException.TYPE_3_TX_INVALID_BLOB_VERSIONED_HASH: "has invalid hash version",
+ TransactionException.TYPE_3_TX_INVALID_BLOB_VERSIONED_HASH: (
+ "has invalid hash version"
+ ),
# This message is the same as TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED
- TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED: "blob transaction has too many blobs",
- TransactionException.TYPE_3_TX_ZERO_BLOBS: "blob transaction missing blob hashes",
+ TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED: (
+ "blob transaction has too many blobs"
+ ),
+ TransactionException.TYPE_3_TX_ZERO_BLOBS: (
+ "blob transaction missing blob hashes"
+ ),
TransactionException.TYPE_3_TX_WITH_FULL_BLOBS: (
"unexpected blob sidecar in transaction at index"
),
TransactionException.TYPE_3_TX_CONTRACT_CREATION: (
- "input string too short for common.Address, decoding into (types.BlobTx).To"
+ "input string too short for common.Address, "
+ "decoding into (types.BlobTx).To"
),
TransactionException.TYPE_4_EMPTY_AUTHORIZATION_LIST: (
"EIP-7702 transaction with empty auth list"
),
TransactionException.TYPE_4_TX_CONTRACT_CREATION: (
- "input string too short for common.Address, decoding into (types.SetCodeTx).To"
+ "input string too short for common.Address, "
+ "decoding into (types.SetCodeTx).To"
+ ),
+ TransactionException.GAS_LIMIT_EXCEEDS_MAXIMUM: (
+ "transaction gas limit too high"
),
- TransactionException.GAS_LIMIT_EXCEEDS_MAXIMUM: "transaction gas limit too high",
TransactionException.TYPE_4_TX_PRE_FORK: (
"transaction type not supported"
),
- TransactionException.INITCODE_SIZE_EXCEEDED: "max initcode size exceeded",
+ TransactionException.INITCODE_SIZE_EXCEEDED: (
+ "max initcode size exceeded"
+ ),
TransactionException.NONCE_MISMATCH_TOO_LOW: "nonce too low",
TransactionException.NONCE_MISMATCH_TOO_HIGH: "nonce too high",
BlockException.INCORRECT_BLOB_GAS_USED: "blob gas used mismatch",
BlockException.INCORRECT_EXCESS_BLOB_GAS: "invalid excessBlobGas",
- BlockException.INVALID_VERSIONED_HASHES: "invalid number of versionedHashes",
+ BlockException.INVALID_VERSIONED_HASHES: (
+ "invalid number of versionedHashes"
+ ),
BlockException.INVALID_REQUESTS: "invalid requests hash",
- BlockException.SYSTEM_CONTRACT_CALL_FAILED: "system call failed to execute:",
+ BlockException.SYSTEM_CONTRACT_CALL_FAILED: (
+ "system call failed to execute:"
+ ),
BlockException.INVALID_BLOCK_HASH: "blockhash mismatch",
- BlockException.RLP_BLOCK_LIMIT_EXCEEDED: "block RLP-encoded size exceeds maximum",
- BlockException.INVALID_BAL_EXTRA_ACCOUNT: "BAL change not reported in computed",
- BlockException.INVALID_BAL_MISSING_ACCOUNT: "additional mutations compared to BAL",
+ BlockException.RLP_BLOCK_LIMIT_EXCEEDED: (
+ "block RLP-encoded size exceeds maximum"
+ ),
+ BlockException.INVALID_BAL_EXTRA_ACCOUNT: (
+ "BAL change not reported in computed"
+ ),
+ BlockException.INVALID_BAL_MISSING_ACCOUNT: (
+ "additional mutations compared to BAL"
+ ),
BlockException.INVALID_BLOCK_ACCESS_LIST: "unequal",
BlockException.INVALID_BASEFEE_PER_GAS: "invalid baseFee",
- BlockException.INVALID_BLOCK_TIMESTAMP_OLDER_THAN_PARENT: "invalid timestamp",
+ BlockException.INVALID_BLOCK_TIMESTAMP_OLDER_THAN_PARENT: (
+ "invalid timestamp"
+ ),
BlockException.INVALID_GASLIMIT: "invalid gas limit",
BlockException.INVALID_BLOCK_NUMBER: "invalid block number",
BlockException.EXTRA_DATA_TOO_BIG: "invalid extradata length",
@@ -112,7 +136,9 @@ class GethExceptionMapper(ExceptionMapper):
BlockException.BLOB_GAS_USED_ABOVE_LIMIT: (
r"blob gas used \d+ exceeds maximum allowance \d+"
),
- BlockException.INVALID_GAS_USED_ABOVE_LIMIT: r"invalid gasUsed: have \d+, gasLimit \d+",
+ BlockException.INVALID_GAS_USED_ABOVE_LIMIT: (
+ r"invalid gasUsed: have \d+, gasLimit \d+"
+ ),
BlockException.INVALID_DEPOSIT_EVENT_LAYOUT: (
r"invalid requests hash|failed to parse deposit logs"
),
@@ -136,11 +162,12 @@ class GethExceptionMapper(ExceptionMapper):
),
BlockException.INVALID_BAL_HASH: (r"invalid block access list:"),
BlockException.INVALID_BAL_MISSING_ACCOUNT: (
- r"computed state diff contained mutated accounts which weren't reported in BAL"
+ r"computed state diff contained mutated accounts "
+ r"which weren't reported in BAL"
),
BlockException.INVALID_BLOCK_ACCESS_LIST: (
- r"difference between computed state diff and BAL entry for account"
- r"|invalid block access list:"
+ r"difference between computed state diff and "
+ r"BAL entry for account|invalid block access list:"
),
BlockException.INCORRECT_BLOCK_FORMAT: (r"invalid block access list:"),
}
@@ -306,7 +333,8 @@ def consume_blockchain_test(
if result.returncode != 0:
raise Exception(
- f"Unexpected exit code:\n{' '.join(command)}\n\n Error:\n{result.stderr}"
+ f"Unexpected exit code:\n{' '.join(command)}\n\n"
+ f"Error:\n{result.stderr}"
)
result_json = json.loads(result.stdout)
@@ -360,7 +388,8 @@ def consume_state_test_file(
if result.returncode != 0:
raise Exception(
- f"Unexpected exit code:\n{' '.join(command)}\n\n Error:\n{result.stderr}"
+ f"Unexpected exit code:\n{' '.join(command)}\n\n"
+ f"Error:\n{result.stderr}"
)
result_json = json.loads(result.stdout)
@@ -435,5 +464,6 @@ def consume_fixture(
)
else:
raise Exception(
- f"Fixture format {fixture_format.format_name} not supported by {self.binary}"
+ f"Fixture format {fixture_format.format_name} "
+ f"not supported by {self.binary}"
)
diff --git a/packages/testing/src/execution_testing/client_clis/clis/nethermind.py b/packages/testing/src/execution_testing/client_clis/clis/nethermind.py
index 5db8488f924..bb23b04aa01 100644
--- a/packages/testing/src/execution_testing/client_clis/clis/nethermind.py
+++ b/packages/testing/src/execution_testing/client_clis/clis/nethermind.py
@@ -131,7 +131,8 @@ def _build_command_with_options(
pass # no additional options needed
else:
raise Exception(
- f"Fixture format {fixture_format.format_name} not supported by {self.binary}"
+ f"Fixture format {fixture_format.format_name} "
+ f"not supported by {self.binary}"
)
command += ["--input", str(fixture_path)]
if debug_output_path:
@@ -163,14 +164,16 @@ def consume_state_test_file(
if result.returncode != 0:
raise Exception(
- f"Unexpected exit code:\n{' '.join(command)}\n\n Error:\n{result.stderr}"
+ f"Unexpected exit code:\n{' '.join(command)}\n\n"
+ f"Error:\n{result.stderr}"
)
try:
result_json = json.loads(result.stdout)
except json.JSONDecodeError as e:
raise Exception(
- f"Failed to parse JSON output on stdout from nethtest:\n{result.stdout}"
+ f"Failed to parse JSON output on stdout from nethtest:\n"
+ f"{result.stdout}"
) from e
if not isinstance(result_json, list):
@@ -205,8 +208,8 @@ def consume_state_test(
test_result["name"].endswith(nethtest_suffix)
for test_result in file_results
), (
- "consume direct with nethtest doesn't support the multi-data statetest format "
- "used in ethereum/tests (yet)"
+ "consume direct with nethtest doesn't support the "
+ "multi-data statetest format used in ethereum/tests (yet)"
)
test_result = [
test_result
@@ -221,7 +224,8 @@ def consume_state_test(
f"Test result for {fixture_name} missing"
)
assert test_result[0]["pass"], (
- f"State test '{fixture_name}' failed, available stderr:\n {stderr}"
+ f"State test '{fixture_name}' failed, "
+ f"available stderr:\n {stderr}"
)
else:
if any(not test_result["pass"] for test_result in file_results):
@@ -251,7 +255,8 @@ def consume_blockchain_test(
if result.returncode != 0:
raise Exception(
- f"nethtest exited with non-zero exit code ({result.returncode}).\n"
+ f"nethtest exited with non-zero exit code "
+ f"({result.returncode}).\n"
f"stdout:\n{result.stdout}\n"
f"stderr:\n{result.stderr}\n"
f"{' '.join(command)}"
@@ -287,7 +292,8 @@ def consume_fixture(
)
else:
raise Exception(
- f"Fixture format {fixture_format.format_name} not supported by {self.binary}"
+ f"Fixture format {fixture_format.format_name} "
+ f"not supported by {self.binary}"
)
@@ -297,16 +303,28 @@ class NethermindExceptionMapper(ExceptionMapper):
mapping_substring = {
TransactionException.SENDER_NOT_EOA: "sender has deployed code",
TransactionException.INTRINSIC_GAS_TOO_LOW: "intrinsic gas too low",
- TransactionException.INTRINSIC_GAS_BELOW_FLOOR_GAS_COST: "intrinsic gas too low",
- TransactionException.INSUFFICIENT_MAX_FEE_PER_GAS: "miner premium is negative",
+ TransactionException.INTRINSIC_GAS_BELOW_FLOOR_GAS_COST: (
+ "intrinsic gas too low"
+ ),
+ TransactionException.INSUFFICIENT_MAX_FEE_PER_GAS: (
+ "miner premium is negative"
+ ),
TransactionException.PRIORITY_GREATER_THAN_MAX_FEE_PER_GAS: (
"InvalidMaxPriorityFeePerGas: Cannot be higher than maxFeePerGas"
),
- TransactionException.GAS_ALLOWANCE_EXCEEDED: "Block gas limit exceeded",
+ TransactionException.GAS_ALLOWANCE_EXCEEDED: (
+ "Block gas limit exceeded"
+ ),
TransactionException.NONCE_IS_MAX: "NonceTooHigh",
- TransactionException.INITCODE_SIZE_EXCEEDED: "max initcode size exceeded",
- TransactionException.NONCE_MISMATCH_TOO_LOW: "wrong transaction nonce",
- TransactionException.NONCE_MISMATCH_TOO_HIGH: "wrong transaction nonce",
+ TransactionException.INITCODE_SIZE_EXCEEDED: (
+ "max initcode size exceeded"
+ ),
+ TransactionException.NONCE_MISMATCH_TOO_LOW: (
+ "wrong transaction nonce"
+ ),
+ TransactionException.NONCE_MISMATCH_TOO_HIGH: (
+ "wrong transaction nonce"
+ ),
TransactionException.INSUFFICIENT_MAX_FEE_PER_BLOB_GAS: (
"InsufficientMaxFeePerBlobGas: Not enough to cover blob gas fee"
),
@@ -319,11 +337,15 @@ class NethermindExceptionMapper(ExceptionMapper):
TransactionException.TYPE_3_TX_PRE_FORK: (
"InvalidTxType: Transaction type in Custom is not supported"
),
- TransactionException.TYPE_3_TX_ZERO_BLOBS: "blob transaction missing blob hashes",
+ TransactionException.TYPE_3_TX_ZERO_BLOBS: (
+ "blob transaction missing blob hashes"
+ ),
TransactionException.TYPE_3_TX_INVALID_BLOB_VERSIONED_HASH: (
"InvalidBlobVersionedHashVersion: Blob version not supported"
),
- TransactionException.TYPE_3_TX_CONTRACT_CREATION: "blob transaction of type create",
+ TransactionException.TYPE_3_TX_CONTRACT_CREATION: (
+ "blob transaction of type create"
+ ),
TransactionException.TYPE_4_EMPTY_AUTHORIZATION_LIST: (
"MissingAuthorizationList: Must be set"
),
@@ -334,9 +356,12 @@ class NethermindExceptionMapper(ExceptionMapper):
"InvalidTxType: Transaction type in Custom is not supported"
),
BlockException.INCORRECT_BLOB_GAS_USED: (
- "HeaderBlobGasMismatch: Blob gas in header does not match calculated"
+ "HeaderBlobGasMismatch: "
+ "Blob gas in header does not match calculated"
+ ),
+ BlockException.INVALID_REQUESTS: (
+ "InvalidRequestsHash: Requests hash mismatch in block"
),
- BlockException.INVALID_REQUESTS: "InvalidRequestsHash: Requests hash mismatch in block",
BlockException.INVALID_GAS_USED_ABOVE_LIMIT: (
"ExceededGasLimit: Gas used exceeds gas limit."
),
@@ -346,23 +371,43 @@ class NethermindExceptionMapper(ExceptionMapper):
BlockException.INVALID_DEPOSIT_EVENT_LAYOUT: (
"DepositsInvalid: Invalid deposit event layout:"
),
- BlockException.INVALID_BASEFEE_PER_GAS: "InvalidBaseFeePerGas: Does not match calculated",
- BlockException.INVALID_BLOCK_TIMESTAMP_OLDER_THAN_PARENT: "InvalidTimestamp: Timestamp in header cannot be lower than ancestor",
- BlockException.INVALID_BLOCK_NUMBER: "InvalidBlockNumber: Block number does not match the parent",
- BlockException.EXTRA_DATA_TOO_BIG: "InvalidExtraData: Extra data in header is not valid",
- BlockException.INVALID_GASLIMIT: "InvalidGasLimit: Gas limit is not correct",
- BlockException.INVALID_RECEIPTS_ROOT: "InvalidReceiptsRoot: Receipts root in header does not match",
- BlockException.INVALID_LOG_BLOOM: "InvalidLogsBloom: Logs bloom in header does not match",
- BlockException.INVALID_STATE_ROOT: "InvalidStateRoot: State root in header does not match",
+ BlockException.INVALID_BASEFEE_PER_GAS: (
+ "InvalidBaseFeePerGas: Does not match calculated"
+ ),
+ BlockException.INVALID_BLOCK_TIMESTAMP_OLDER_THAN_PARENT: (
+ "InvalidTimestamp: "
+ "Timestamp in header cannot be lower than ancestor"
+ ),
+ BlockException.INVALID_BLOCK_NUMBER: (
+ "InvalidBlockNumber: Block number does not match the parent"
+ ),
+ BlockException.EXTRA_DATA_TOO_BIG: (
+ "InvalidExtraData: Extra data in header is not valid"
+ ),
+ BlockException.INVALID_GASLIMIT: (
+ "InvalidGasLimit: Gas limit is not correct"
+ ),
+ BlockException.INVALID_RECEIPTS_ROOT: (
+ "InvalidReceiptsRoot: Receipts root in header does not match"
+ ),
+ BlockException.INVALID_LOG_BLOOM: (
+ "InvalidLogsBloom: Logs bloom in header does not match"
+ ),
+ BlockException.INVALID_STATE_ROOT: (
+ "InvalidStateRoot: State root in header does not match"
+ ),
}
mapping_regex = {
TransactionException.INSUFFICIENT_ACCOUNT_FUNDS: (
- r"insufficient sender balance|insufficient MaxFeePerGas for sender balance"
+ r"insufficient sender balance|"
+ r"insufficient MaxFeePerGas for sender balance"
+ ),
+ TransactionException.TYPE_3_TX_WITH_FULL_BLOBS: (
+ r"Transaction \d+ is not valid"
),
- TransactionException.TYPE_3_TX_WITH_FULL_BLOBS: r"Transaction \d+ is not valid",
TransactionException.TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED: (
- r"BlockBlobGasExceeded: A block cannot have more than \d+ blob gas, blobs count \d+, "
- r"blobs gas used: \d+"
+ r"BlockBlobGasExceeded: A block cannot have more than "
+ r"\d+ blob gas, blobs count \d+, blobs gas used: \d+"
),
TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED: (
r"BlobTxGasLimitExceeded: Transaction's totalDataGas=\d+ "
@@ -372,11 +417,12 @@ class NethermindExceptionMapper(ExceptionMapper):
r"TxGasLimitCapExceeded: Gas limit \d+ \w+ cap of \d+\.?"
),
BlockException.INCORRECT_EXCESS_BLOB_GAS: (
- r"HeaderExcessBlobGasMismatch: Excess blob gas in header does not match calculated"
- r"|Overflow in excess blob gas"
+ r"HeaderExcessBlobGasMismatch: Excess blob gas in header "
+ r"does not match calculated|Overflow in excess blob gas"
),
BlockException.INVALID_BLOCK_HASH: (
- r"Invalid block hash 0x[0-9a-f]+ does not match calculated hash 0x[0-9a-f]+"
+ r"Invalid block hash 0x[0-9a-f]+ does not match "
+ r"calculated hash 0x[0-9a-f]+"
),
BlockException.SYSTEM_CONTRACT_EMPTY: (
r"(Withdrawals|Consolidations)Empty: Contract is not deployed\."
@@ -386,17 +432,19 @@ class NethermindExceptionMapper(ExceptionMapper):
),
# BAL Exceptions: TODO - review once all clients completed.
BlockException.INVALID_BAL_EXTRA_ACCOUNT: (
- r"could not be parsed as a block: Could not decode block access list."
+ r"could not be parsed as a block: "
+ r"Could not decode block access list."
),
BlockException.INVALID_BAL_HASH: (r"InvalidBlockLevelAccessListRoot:"),
BlockException.INVALID_BAL_MISSING_ACCOUNT: (
r"InvalidBlockLevelAccessListRoot:"
),
BlockException.INVALID_BLOCK_ACCESS_LIST: (
- r"InvalidBlockLevelAccessListRoot:"
- r"|could not be parsed as a block: Could not decode block access list."
+ r"InvalidBlockLevelAccessListRoot:|could not be parsed as a "
+ r"block: Could not decode block access list."
),
BlockException.INCORRECT_BLOCK_FORMAT: (
- r"could not be parsed as a block: Could not decode block access list."
+ r"could not be parsed as a block: "
+ r"Could not decode block access list."
),
}
diff --git a/packages/testing/src/execution_testing/client_clis/clis/nimbus.py b/packages/testing/src/execution_testing/client_clis/clis/nimbus.py
index 3452e8f22cc..aaacc837d8b 100644
--- a/packages/testing/src/execution_testing/client_clis/clis/nimbus.py
+++ b/packages/testing/src/execution_testing/client_clis/clis/nimbus.py
@@ -44,7 +44,8 @@ def __init__(
result = subprocess.run(args, capture_output=True, text=True)
except subprocess.CalledProcessError as e:
raise Exception(
- f"evm process unexpectedly returned a non-zero status code: {e}."
+ f"evm process unexpectedly returned "
+ f"a non-zero status code: {e}."
) from e
except Exception as e:
raise Exception(
@@ -80,7 +81,9 @@ class NimbusExceptionMapper(ExceptionMapper):
TransactionException.TYPE_4_TX_CONTRACT_CREATION: (
"set code transaction must not be a create transaction"
),
- TransactionException.INSUFFICIENT_ACCOUNT_FUNDS: "invalid tx: not enough cash to send",
+ TransactionException.INSUFFICIENT_ACCOUNT_FUNDS: (
+ "invalid tx: not enough cash to send"
+ ),
TransactionException.TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED: (
"would exceed maximum allowance"
),
@@ -97,22 +100,40 @@ class NimbusExceptionMapper(ExceptionMapper):
"invalid tx: one of blobVersionedHash has invalid version"
),
# TODO: temp solution until mapper for nimbus is fixed
- TransactionException.GAS_LIMIT_EXCEEDS_MAXIMUM: "zero gasUsed but transactions present",
+ TransactionException.GAS_LIMIT_EXCEEDS_MAXIMUM: (
+ "zero gasUsed but transactions present"
+ ),
# This message is the same as TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED
- TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED: "exceeds maximum allowance",
- TransactionException.TYPE_3_TX_ZERO_BLOBS: "blob transaction missing blob hashes",
- TransactionException.INTRINSIC_GAS_TOO_LOW: "zero gasUsed but transactions present",
- TransactionException.INTRINSIC_GAS_BELOW_FLOOR_GAS_COST: "intrinsic gas too low",
- TransactionException.INITCODE_SIZE_EXCEEDED: "max initcode size exceeded",
+ TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED: (
+ "exceeds maximum allowance"
+ ),
+ TransactionException.TYPE_3_TX_ZERO_BLOBS: (
+ "blob transaction missing blob hashes"
+ ),
+ TransactionException.INTRINSIC_GAS_TOO_LOW: (
+ "zero gasUsed but transactions present"
+ ),
+ TransactionException.INTRINSIC_GAS_BELOW_FLOOR_GAS_COST: (
+ "intrinsic gas too low"
+ ),
+ TransactionException.INITCODE_SIZE_EXCEEDED: (
+ "max initcode size exceeded"
+ ),
BlockException.RLP_BLOCK_LIMIT_EXCEEDED: (
# TODO:
"ExceededBlockSizeLimit: Exceeded block size limit"
),
BlockException.INVALID_BASEFEE_PER_GAS: "invalid baseFee",
- BlockException.INVALID_BLOCK_NUMBER: "Blocks must be numbered consecutively",
- BlockException.INVALID_BLOCK_TIMESTAMP_OLDER_THAN_PARENT: "Invalid timestamp",
+ BlockException.INVALID_BLOCK_NUMBER: (
+ "Blocks must be numbered consecutively"
+ ),
+ BlockException.INVALID_BLOCK_TIMESTAMP_OLDER_THAN_PARENT: (
+ "Invalid timestamp"
+ ),
BlockException.INVALID_GASLIMIT: "invalid gas limit",
- BlockException.INVALID_GAS_USED_ABOVE_LIMIT: "gasUsed should be non negative and smaller or equal gasLimit",
+ BlockException.INVALID_GAS_USED_ABOVE_LIMIT: (
+ "gasUsed should be non negative and smaller or equal gasLimit"
+ ),
BlockException.INVALID_BLOCK_HASH: "blockhash mismatch",
BlockException.INVALID_STATE_ROOT: "stateRoot mismatch",
BlockException.INVALID_RECEIPTS_ROOT: "receiptRoot mismatch",
diff --git a/packages/testing/src/execution_testing/client_clis/clis/reth.py b/packages/testing/src/execution_testing/client_clis/clis/reth.py
index d20c44c4727..f2628205aad 100644
--- a/packages/testing/src/execution_testing/client_clis/clis/reth.py
+++ b/packages/testing/src/execution_testing/client_clis/clis/reth.py
@@ -15,17 +15,25 @@ class RethExceptionMapper(ExceptionMapper):
"reject transactions from senders with deployed code"
),
TransactionException.INSUFFICIENT_ACCOUNT_FUNDS: "lack of funds",
- TransactionException.INITCODE_SIZE_EXCEEDED: "create initcode size limit",
- TransactionException.INSUFFICIENT_MAX_FEE_PER_GAS: "gas price is less than basefee",
+ TransactionException.INITCODE_SIZE_EXCEEDED: (
+ "create initcode size limit"
+ ),
+ TransactionException.INSUFFICIENT_MAX_FEE_PER_GAS: (
+ "gas price is less than basefee"
+ ),
TransactionException.PRIORITY_GREATER_THAN_MAX_FEE_PER_GAS: (
"priority fee is greater than max fee"
),
TransactionException.GASLIMIT_PRICE_PRODUCT_OVERFLOW: "overflow",
TransactionException.TYPE_3_TX_CONTRACT_CREATION: "unexpected length",
TransactionException.TYPE_3_TX_WITH_FULL_BLOBS: "unexpected list",
- TransactionException.TYPE_3_TX_INVALID_BLOB_VERSIONED_HASH: "blob version not supported",
+ TransactionException.TYPE_3_TX_INVALID_BLOB_VERSIONED_HASH: (
+ "blob version not supported"
+ ),
TransactionException.TYPE_3_TX_ZERO_BLOBS: "empty blobs",
- TransactionException.TYPE_4_EMPTY_AUTHORIZATION_LIST: "empty authorization list",
+ TransactionException.TYPE_4_EMPTY_AUTHORIZATION_LIST: (
+ "empty authorization list"
+ ),
TransactionException.TYPE_4_TX_CONTRACT_CREATION: "unexpected length",
TransactionException.TYPE_4_TX_PRE_FORK: (
"eip 7702 transactions present in pre-prague payload"
@@ -41,10 +49,15 @@ class RethExceptionMapper(ExceptionMapper):
BlockException.INVALID_LOG_BLOOM: "header bloom filter mismatch",
}
mapping_regex = {
- TransactionException.NONCE_MISMATCH_TOO_LOW: r"nonce \d+ too low, expected \d+",
- TransactionException.NONCE_MISMATCH_TOO_HIGH: r"nonce \d+ too high, expected \d+",
+ TransactionException.NONCE_MISMATCH_TOO_LOW: (
+ r"nonce \d+ too low, expected \d+"
+ ),
+ TransactionException.NONCE_MISMATCH_TOO_HIGH: (
+ r"nonce \d+ too high, expected \d+"
+ ),
TransactionException.INSUFFICIENT_MAX_FEE_PER_BLOB_GAS: (
- r"blob gas price \(\d+\) is greater than max fee per blob gas \(\d+\)"
+ r"blob gas price \(\d+\) is greater than "
+ r"max fee per blob gas \(\d+\)"
),
TransactionException.INTRINSIC_GAS_TOO_LOW: (
r"call gas cost \(\d+\) exceeds the gas limit \(\d+\)"
@@ -55,7 +68,9 @@ class RethExceptionMapper(ExceptionMapper):
TransactionException.TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED: (
r"blob gas used \d+ exceeds maximum allowance \d+"
),
- TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED: r"too many blobs, have \d+, max \d+",
+ TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED: (
+ r"too many blobs, have \d+, max \d+"
+ ),
TransactionException.TYPE_3_TX_PRE_FORK: (
r"blob transactions present in pre-cancun payload|empty blobs"
),
@@ -65,32 +80,40 @@ class RethExceptionMapper(ExceptionMapper):
TransactionException.GAS_LIMIT_EXCEEDS_MAXIMUM: (
r"transaction gas limit.*is greater than the cap"
),
- BlockException.SYSTEM_CONTRACT_CALL_FAILED: r"failed to apply .* requests contract call",
+ BlockException.SYSTEM_CONTRACT_CALL_FAILED: (
+ r"failed to apply .* requests contract call"
+ ),
BlockException.INCORRECT_BLOB_GAS_USED: (
- r"blob gas used mismatch|blob gas used \d+ is not a multiple of blob gas per blob"
+ r"blob gas used mismatch|"
+ r"blob gas used \d+ is not a multiple of blob gas per blob"
),
BlockException.INCORRECT_EXCESS_BLOB_GAS: (
- r"excess blob gas \d+ is not a multiple of blob gas per blob|invalid excess blob gas"
+ r"excess blob gas \d+ is not a multiple of blob gas per blob|"
+ r"invalid excess blob gas"
),
BlockException.INVALID_GAS_USED_ABOVE_LIMIT: (
r"block used gas \(\d+\) is greater than gas limit \(\d+\)"
),
BlockException.INVALID_GASLIMIT: (
- r"child gas_limit \d+ max .* is .*|child gas limit \d+ is below the minimum allowed limit"
+ r"child gas_limit \d+ max .* is .*|"
+ r"child gas limit \d+ is below the minimum allowed limit"
),
BlockException.INVALID_BLOCK_TIMESTAMP_OLDER_THAN_PARENT: (
- r"block timestamp \d+ is in the past compared to the parent timestamp \d+"
+ r"block timestamp \d+ is in the past compared to "
+ r"the parent timestamp \d+"
),
BlockException.INVALID_BLOCK_NUMBER: (
r"block number \d+ does not match parent block number \d+"
),
# BAL Exceptions: TODO - review once all clients completed.
BlockException.INVALID_BAL_EXTRA_ACCOUNT: (
- r"Block BAL contains an account change that is not present in the computed BAL."
+ r"Block BAL contains an account change "
+ r"that is not present in the computed BAL."
),
BlockException.INVALID_BAL_HASH: (r"Block's access list is invalid."),
BlockException.INVALID_BAL_MISSING_ACCOUNT: (
- r"Block BAL is missing an account change that is present in the computed BAL."
+ r"Block BAL is missing an account change "
+ r"that is present in the computed BAL."
),
BlockException.INVALID_BLOCK_ACCESS_LIST: (
r"Block's access list is invalid."
@@ -113,6 +136,7 @@ class RethExceptionMapper(ExceptionMapper):
# EELS definition for `is_valid_deposit_event_data`:
# https://github.com/ethereum/execution-specs/blob/5ddb904fa7ba27daeff423e78466744c51e8cb6a/src/ethereum/forks/prague/requests.py#L51
BlockException.INVALID_DEPOSIT_EVENT_LAYOUT: (
- r"failed to decode deposit requests from receipts|mismatched block requests hash"
+ r"failed to decode deposit requests from receipts|"
+ r"mismatched block requests hash"
),
}
diff --git a/packages/testing/src/execution_testing/client_clis/ethereum_cli.py b/packages/testing/src/execution_testing/client_clis/ethereum_cli.py
index e55e2f602a4..1e02634f5b8 100644
--- a/packages/testing/src/execution_testing/client_clis/ethereum_cli.py
+++ b/packages/testing/src/execution_testing/client_clis/ethereum_cli.py
@@ -111,7 +111,8 @@ def from_binary_path(
binary = Path(resolved_path)
else:
logger.debug(
- f"Resolved path does not exist: {resolved_path}\nTrying to find it via `which`"
+ f"Resolved path does not exist: {resolved_path}\n"
+ "Trying to find it via `which`"
)
# it might be that the provided binary exists in path
@@ -155,7 +156,8 @@ def from_binary_path(
if result.returncode != 0:
logger.debug(
- f"Subprocess returncode is not 0! It is: {result.returncode}"
+ "Subprocess returncode is not 0! "
+ f"It is: {result.returncode}"
)
# don't raise exception, you are supposed to keep trying
# different version flags
@@ -188,12 +190,14 @@ def from_binary_path(
continue
logger.debug(
- f"T8n with version {binary_output} does not belong to subclass {subclass}"
+ f"T8n with version {binary_output} does not "
+ f"belong to subclass {subclass}"
)
except Exception as e:
logger.debug(
- f"Trying to determine t8n version with flag `{version_flag}` failed: {e}"
+ f"Trying to determine t8n version with flag "
+ f"`{version_flag}` failed: {e}"
)
continue
@@ -209,7 +213,8 @@ def detect_binary(cls, binary_output: str) -> bool:
assert cls.detect_binary_pattern is not None
logger.debug(
- f"Trying to match {binary_output} against this pattern: {cls.detect_binary_pattern}"
+ f"Trying to match {binary_output} against this "
+ f"pattern: {cls.detect_binary_pattern}"
)
match_result = cls.detect_binary_pattern.match(binary_output)
match_successful: bool = match_result is not None
diff --git a/packages/testing/src/execution_testing/client_clis/tests/test_execution_specs.py b/packages/testing/src/execution_testing/client_clis/tests/test_execution_specs.py
index df0d35b6a6c..498e08deb07 100644
--- a/packages/testing/src/execution_testing/client_clis/tests/test_execution_specs.py
+++ b/packages/testing/src/execution_testing/client_clis/tests/test_execution_specs.py
@@ -116,7 +116,8 @@ def test_evm_tool_binary_arg(
# typing: Path can not take None; but if None, we may
# as well fail explicitly.
raise Exception(
- f"Failed to find `{DEFAULT_EVM_T8N_BINARY_NAME}` in the PATH via which"
+ f"Failed to find `{DEFAULT_EVM_T8N_BINARY_NAME}` "
+ "in the PATH via which"
)
evm_tool(binary=Path(evm_bin)).version()
return
diff --git a/packages/testing/src/execution_testing/client_clis/tests/test_transition_tool.py b/packages/testing/src/execution_testing/client_clis/tests/test_transition_tool.py
index 7e04f3f88ea..5a77e809122 100644
--- a/packages/testing/src/execution_testing/client_clis/tests/test_transition_tool.py
+++ b/packages/testing/src/execution_testing/client_clis/tests/test_transition_tool.py
@@ -49,7 +49,10 @@ def test_default_tool() -> None:
"ethereum-spec-evm",
ExecutionSpecsTransitionTool,
marks=pytest.mark.skip(
- reason="ExecutionSpecsTransitionTool through binary path is not supported"
+ reason=(
+ "ExecutionSpecsTransitionTool through binary path "
+ "is not supported"
+ )
),
),
(
diff --git a/packages/testing/src/execution_testing/client_clis/transition_tool.py b/packages/testing/src/execution_testing/client_clis/transition_tool.py
index 1ac1b4cffe6..223a0cda71e 100644
--- a/packages/testing/src/execution_testing/client_clis/transition_tool.py
+++ b/packages/testing/src/execution_testing/client_clis/transition_tool.py
@@ -526,9 +526,10 @@ def _evaluate_server(
if debug_output_path:
with profiler.pause():
+ request_data_str = json.dumps(request_data_json, indent=2)
request_info = (
f"Server URL: {self.server_url}\n\n"
- f"Request Data:\n{json.dumps(request_data_json, indent=2)}\n"
+ f"Request Data:\n{request_data_str}\n"
)
dump_files_to_directory(
debug_output_path,
@@ -543,7 +544,9 @@ def _evaluate_server(
tx.model_dump(mode="json", **model_dump_config)
for tx in request_data.input.txs
],
- "input/blob_params.json": request_data.input.blob_params,
+ "input/blob_params.json": (
+ request_data.input.blob_params
+ ),
"request_info.txt": request_info,
},
)
@@ -570,9 +573,10 @@ def _evaluate_server(
if debug_output_path:
with profiler.pause():
+ headers_str = json.dumps(dict(response.headers), indent=2)
response_info = (
f"Status Code: {response.status_code}\n\n"
- f"Headers:\n{json.dumps(dict(response.headers), indent=2)}\n\n"
+ f"Headers:\n{headers_str}\n\n"
f"Content:\n{response.text}\n"
)
dump_files_to_directory(
diff --git a/packages/testing/src/execution_testing/config/app.py b/packages/testing/src/execution_testing/config/app.py
index 6c3f302e64f..2f7a4867904 100644
--- a/packages/testing/src/execution_testing/config/app.py
+++ b/packages/testing/src/execution_testing/config/app.py
@@ -9,7 +9,9 @@
from pydantic import BaseModel
-import execution_testing.cli.pytest_commands.plugins.consume.releases as releases
+from execution_testing.cli.pytest_commands.plugins.consume import (
+ releases,
+)
class AppConfig(BaseModel):
diff --git a/packages/testing/src/execution_testing/exceptions/exceptions.py b/packages/testing/src/execution_testing/exceptions/exceptions.py
index ce5d7de6b73..4243ef39298 100644
--- a/packages/testing/src/execution_testing/exceptions/exceptions.py
+++ b/packages/testing/src/execution_testing/exceptions/exceptions.py
@@ -51,7 +51,8 @@ def from_str(cls, value: "str | ExceptionBase") -> "ExceptionBase":
else:
# Otherwise, use the class that the method is called on
assert cls.__name__ == class_name, (
- f"Unexpected exception type: {class_name}, expected {cls.__name__}"
+ f"Unexpected exception type: {class_name}, "
+ f"expected {cls.__name__}"
)
exception_class = cls
diff --git a/packages/testing/src/execution_testing/exceptions/exceptions/base.py b/packages/testing/src/execution_testing/exceptions/exceptions/base.py
index 4d96f9d148e..7c9a9d8339a 100644
--- a/packages/testing/src/execution_testing/exceptions/exceptions/base.py
+++ b/packages/testing/src/execution_testing/exceptions/exceptions/base.py
@@ -51,7 +51,8 @@ def from_str(cls, value: "str | ExceptionBase") -> "ExceptionBase":
else:
# Otherwise, use the class that the method is called on
assert cls.__name__ == class_name, (
- f"Unexpected exception type: {class_name}, expected {cls.__name__}"
+ f"Unexpected exception type: {class_name}, "
+ f"expected {cls.__name__}"
)
exception_class = cls
diff --git a/packages/testing/src/execution_testing/execution/base.py b/packages/testing/src/execution_testing/execution/base.py
index 71aed551664..dacd8a121b0 100644
--- a/packages/testing/src/execution_testing/execution/base.py
+++ b/packages/testing/src/execution_testing/execution/base.py
@@ -42,8 +42,11 @@ def get_required_sender_balances(
fork: Fork,
) -> Dict[Address, int]:
"""Get the required sender balances."""
+ del gas_price, max_fee_per_gas, max_priority_fee_per_gas
+ del max_fee_per_blob_gas, fork
raise Exception(
- f"Method `get_required_sender_balances` not implemented for {self.format_name}"
+ "Method `get_required_sender_balances` not implemented for "
+ f"{self.format_name}"
)
@abstractmethod
diff --git a/packages/testing/src/execution_testing/execution/blob_transaction.py b/packages/testing/src/execution_testing/execution/blob_transaction.py
index 2dd89cb4c2b..7ffe16641f9 100644
--- a/packages/testing/src/execution_testing/execution/blob_transaction.py
+++ b/packages/testing/src/execution_testing/execution/blob_transaction.py
@@ -50,8 +50,8 @@ def versioned_hashes_with_blobs_and_proofs(
)
else:
raise ValueError(
- f"Blob with versioned hash {blob.versioned_hash.hex()} requires a proof "
- "that is not None"
+ f"Blob with versioned hash {blob.versioned_hash.hex()} "
+ "requires a proof that is not None"
)
return versioned_hashes
@@ -66,8 +66,8 @@ class BlobTransaction(BaseExecute):
format_name: ClassVar[str] = "blob_transaction_test"
description: ClassVar[str] = (
- "Send blob transactions to the execution client and validate their availability via "
- "`engine_getBlobsV*`"
+ "Send blob transactions to the execution client and validate their "
+ "availability via `engine_getBlobsV*`"
)
txs: List[NetworkWrappedTransaction | Transaction]
@@ -132,7 +132,8 @@ def execute(
tx.rlp(), request_id=metadata.to_json()
)
assert expected_hash == received_hash, (
- f"Expected hash {expected_hash} does not match received hash {received_hash}."
+ f"Expected hash {expected_hash} does not match "
+ f"received hash {received_hash}."
)
if engine_rpc is None:
@@ -161,14 +162,14 @@ def execute(
if self.nonexisting_blob_hashes is not None:
if blob_response is not None:
raise ValueError(
- f"Non-existing blob hashes were requested and "
- "the client was expected to respond with 'null', but instead it replied: "
- f"{blob_response.root}"
+ "Non-existing blob hashes were requested and the client "
+ "was expected to respond with 'null', but instead it "
+ f"replied: {blob_response.root}"
)
else:
logger.info(
- "Test was passed (partial responses are not allowed and the client "
- "correctly returned 'null')"
+ "Test was passed (partial responses are not allowed and "
+ "the client correctly returned 'null')"
)
eth_rpc.wait_for_transactions(sent_txs)
return
@@ -176,7 +177,8 @@ def execute(
assert blob_response is not None
local_blobs_and_proofs = list(versioned_hashes.values())
assert len(blob_response) == len(local_blobs_and_proofs), (
- f"Expected {len(local_blobs_and_proofs)} blobs and proofs, got {len(blob_response)}."
+ f"Expected {len(local_blobs_and_proofs)} blobs and proofs, "
+ f"got {len(blob_response)}."
)
for expected_blob, received_blob in zip(
@@ -198,8 +200,14 @@ def execute(
raise ValueError("Blob mismatch.")
if expected_blob.proofs != received_blob.proofs:
error_message = "Proofs mismatch."
- error_message += f"len(expected_blob.proofs) = {len(expected_blob.proofs)}, "
- error_message += f"len(received_blob.proofs) = {len(received_blob.proofs)}\n"
+ expected_len = len(expected_blob.proofs)
+ received_len = len(received_blob.proofs)
+ error_message += (
+ f"len(expected_blob.proofs) = {expected_len}, "
+ )
+ error_message += (
+ f"len(received_blob.proofs) = {received_len}\n"
+ )
if len(expected_blob.proofs) == len(received_blob.proofs):
index = 0
@@ -212,16 +220,28 @@ def execute(
error_message += (
f"Proof length mismatch. index = {index},"
)
- error_message += f"expected_proof length = {len(expected_proof)}, "
- error_message += f"received_proof length = {len(received_proof)}\n"
+ exp_len = len(expected_proof)
+ rcv_len = len(received_proof)
+ error_message += (
+ f"expected_proof length = {exp_len}, "
+ )
+ error_message += (
+ f"received_proof length = {rcv_len}\n"
+ )
index += 1
continue
if expected_proof != received_proof:
error_message += (
f"Proof mismatch. index = {index},"
)
- error_message += f"expected_proof hash = {sha256(expected_proof).hexdigest()}, "
- error_message += f"received_proof hash = {sha256(received_proof).hexdigest()}\n"
+ exp_hash = sha256(expected_proof).hexdigest()
+ rcv_hash = sha256(received_proof).hexdigest()
+ error_message += (
+ f"expected_proof hash = {exp_hash}, "
+ )
+ error_message += (
+ f"received_proof hash = {rcv_hash}\n"
+ )
index += 1
raise ValueError(error_message)
else:
diff --git a/packages/testing/src/execution_testing/execution/transaction_post.py b/packages/testing/src/execution_testing/execution/transaction_post.py
index 716c47793b4..5648ddab06f 100644
--- a/packages/testing/src/execution_testing/execution/transaction_post.py
+++ b/packages/testing/src/execution_testing/execution/transaction_post.py
@@ -41,7 +41,8 @@ class TransactionPost(BaseExecute):
format_name: ClassVar[str] = "transaction_post_test"
description: ClassVar[str] = (
- "Simple transaction sending, then post-check after all transactions are included"
+ "Simple transaction sending, then post-check after all transactions "
+ "are included"
)
def get_required_sender_balances(
@@ -85,7 +86,8 @@ def execute(
for tx in block:
if not isinstance(tx, NetworkWrappedTransaction):
assert tx.ty != 3, (
- "Unwrapped transaction type 3 is not supported in execute mode."
+ "Unwrapped transaction type 3 is not supported in "
+ "execute mode."
)
# Track transaction hashes for gas validation (benchmarking)
@@ -129,7 +131,8 @@ def execute(
) as exc_info:
eth_rpc.send_transaction(transaction)
logger.info(
- f"Transaction rejected as expected: {exc_info.value}"
+ "Transaction rejected as expected: "
+ f"{exc_info.value}"
)
else:
# Send transactions (batching is handled by eth_rpc internally)
@@ -153,10 +156,12 @@ def execute(
total_gas_used += gas_used
# Verify that the total gas consumed matches expectations
- assert total_gas_used == self.expected_benchmark_gas_used, (
+ expected_gas = self.expected_benchmark_gas_used
+ diff = total_gas_used - expected_gas
+ assert total_gas_used == expected_gas, (
f"Total gas used ({total_gas_used}) does not match "
- f"expected benchmark gas ({self.expected_benchmark_gas_used}), "
- f"difference: {total_gas_used - self.expected_benchmark_gas_used}"
+ f"expected benchmark gas ({expected_gas}), "
+ f"difference: {diff}"
)
for address, account in self.post.root.items():
@@ -176,15 +181,18 @@ def execute(
else:
if "balance" in account.model_fields_set:
assert balance == account.balance, (
- f"Balance of {address} is {balance}, expected {account.balance}."
+ f"Balance of {address} is {balance}, "
+ f"expected {account.balance}."
)
if "code" in account.model_fields_set:
assert code == account.code, (
- f"Code of {address} is {code}, expected {account.code}."
+ f"Code of {address} is {code}, "
+ f"expected {account.code}."
)
if "nonce" in account.model_fields_set:
assert nonce == account.nonce, (
- f"Nonce of {address} is {nonce}, expected {account.nonce}."
+ f"Nonce of {address} is {nonce}, "
+ f"expected {account.nonce}."
)
if "storage" in account.model_fields_set:
for key, value in account.storage.items():
@@ -192,6 +200,6 @@ def execute(
address, Hash(key)
)
assert storage_value == value, (
- f"Storage value at {key} of {address} is {storage_value},"
- f"expected {value}."
+ f"Storage value at {key} of {address} is "
+ f"{storage_value}, expected {value}."
)
diff --git a/packages/testing/src/execution_testing/forks/base_fork.py b/packages/testing/src/execution_testing/forks/base_fork.py
index 6c549f2b76a..89fa18afc26 100644
--- a/packages/testing/src/execution_testing/forks/base_fork.py
+++ b/packages/testing/src/execution_testing/forks/base_fork.py
@@ -602,7 +602,7 @@ def get_reward(cls, *, block_number: int = 0, timestamp: int = 0) -> int:
@classmethod
@abstractmethod
def supports_protected_txs(cls) -> bool:
- """Return whether the fork implements EIP-155 transaction protection"""
+ """Return whether the fork implements EIP-155 protection."""
pass
@classmethod
diff --git a/packages/testing/src/execution_testing/forks/forks/forks.py b/packages/testing/src/execution_testing/forks/forks/forks.py
index 5bd10b95f4c..c2deb27bae3 100644
--- a/packages/testing/src/execution_testing/forks/forks/forks.py
+++ b/packages/testing/src/execution_testing/forks/forks/forks.py
@@ -1079,9 +1079,7 @@ def get_reward(cls, *, block_number: int = 0, timestamp: int = 0) -> int:
@classmethod
def supports_protected_txs(cls) -> bool:
- """
- At Genesis, fork does not have support for EIP-155 protected transactions.
- """
+ """At Genesis, fork has no support for EIP-155 protected txs."""
return False
@classmethod
@@ -1374,20 +1372,22 @@ def build_default_block_header(
"""
Build a default block header for this fork with the given attributes.
- This method automatically detects which header fields are required by the fork
- and assigns appropriate default values. It introspects the FixtureHeader model
- to find fields with HeaderForkRequirement annotations and automatically includes
- them if the fork requires them.
+ This method automatically detects which header fields are required by
+ the fork and assigns appropriate default values. It introspects the
+ FixtureHeader model to find fields with HeaderForkRequirement
+ annotations and automatically includes them if the fork requires them.
Args:
block_number: The block number
timestamp: The block timestamp
Returns:
- FixtureHeader instance with default values applied based on fork requirements
+ FixtureHeader instance with default values applied based on fork
+ requirements.
Raises:
TypeError: If the overrides don't have the correct type.
+
"""
from execution_testing.fixtures.blockchain import FixtureHeader
diff --git a/packages/testing/src/execution_testing/forks/helpers.py b/packages/testing/src/execution_testing/forks/helpers.py
index b86c2bc46f0..f78d84468ed 100644
--- a/packages/testing/src/execution_testing/forks/helpers.py
+++ b/packages/testing/src/execution_testing/forks/helpers.py
@@ -66,17 +66,19 @@ def __init__(self, message: str) -> None:
def get_forks() -> List[Type[BaseFork]]:
"""
- Return list of all the fork classes implemented by `execution_testing.forks`
- ordered chronologically by deployment.
+ Return all fork classes implemented by `execution_testing.forks`.
+
+ Ordered chronologically by deployment.
"""
return all_forks[:]
def get_deployed_forks() -> List[Type[BaseFork]]:
"""
- Return list of all the fork classes implemented by `execution_testing.forks`
- that have been deployed to mainnet, chronologically ordered by deployment.
- BPO (Blob Parameter Only) forks are excluded as they are handled separately.
+ Return all fork classes that have been deployed to mainnet.
+
+ Chronologically ordered by deployment. BPO (Blob Parameter Only) forks
+ are excluded as they are handled separately.
"""
return [
fork
@@ -87,9 +89,9 @@ def get_deployed_forks() -> List[Type[BaseFork]]:
def get_development_forks() -> List[Type[BaseFork]]:
"""
- Return list of all the fork classes implemented by `execution_testing.forks`
- that have been not yet deployed to mainnet and are currently under
- development. The list is ordered by their planned deployment date.
+ Return all fork classes not yet deployed and under development.
+
+ The list is ordered by their planned deployment date.
"""
return [fork for fork in get_forks() if not fork.is_deployed()]
diff --git a/packages/testing/src/execution_testing/forks/tests/test_forks.py b/packages/testing/src/execution_testing/forks/tests/test_forks.py
index f945fad0a63..5967b49e64b 100644
--- a/packages/testing/src/execution_testing/forks/tests/test_forks.py
+++ b/packages/testing/src/execution_testing/forks/tests/test_forks.py
@@ -8,11 +8,11 @@
from execution_testing.base_types import BlobSchedule
from ..forks.forks import (
- Amsterdam,
BPO1,
BPO2,
BPO3,
BPO4,
+ Amsterdam,
Berlin,
Cancun,
Frontier,
@@ -236,12 +236,12 @@ def test_fork_in_pydantic_model() -> None:
"fork_2": "ParisToShanghaiAtTime15k",
"fork_3": None,
}
- assert (
- model.model_dump_json()
- == '{"fork_1":"Paris","fork_2":"ParisToShanghaiAtTime15k","fork_3":null}'
+ assert model.model_dump_json() == (
+ '{"fork_1":"Paris","fork_2":"ParisToShanghaiAtTime15k","fork_3":null}'
)
model = ForkInPydanticModel.model_validate_json(
- '{"fork_1": "Paris", "fork_2": "ParisToShanghaiAtTime15k", "fork_3": null}'
+ '{"fork_1": "Paris", "fork_2": "ParisToShanghaiAtTime15k", '
+ '"fork_3": null}'
)
assert model.fork_1 == Paris
assert model.fork_2 == ParisToShanghaiAtTime15k
@@ -415,9 +415,9 @@ def test_tx_types() -> None: # noqa: D103
"create_tx",
[False, True],
)
-def test_tx_intrinsic_gas_functions(
+def test_tx_intrinsic_gas_functions( # noqa: D103
fork: Fork, calldata: bytes, create_tx: bool
-) -> None: # noqa: D103
+) -> None:
intrinsic_gas = 21_000
if calldata == b"\0":
intrinsic_gas += 4
diff --git a/packages/testing/src/execution_testing/forks/tests/test_opcode_gas_costs.py b/packages/testing/src/execution_testing/forks/tests/test_opcode_gas_costs.py
index 6391429a378..11cd3354f97 100644
--- a/packages/testing/src/execution_testing/forks/tests/test_opcode_gas_costs.py
+++ b/packages/testing/src/execution_testing/forks/tests/test_opcode_gas_costs.py
@@ -4,7 +4,7 @@
from execution_testing.vm import Bytecode, Op
-from ..forks.forks import Osaka, Homestead
+from ..forks.forks import Homestead, Osaka
from ..helpers import Fork
@@ -417,7 +417,7 @@
),
],
)
-def test_opcode_gas_costs(fork: Fork, opcode: Op, expected_cost: int) -> None:
+def test_opcode_gas_costs(fork: Fork, opcode: Op, expected_cost: int) -> None: # noqa: D103
op_gas_cost_calc = fork.opcode_gas_calculator()
assert expected_cost == op_gas_cost_calc(opcode)
@@ -445,7 +445,7 @@ def test_opcode_gas_costs(fork: Fork, opcode: Op, expected_cost: int) -> None:
),
],
)
-def test_bytecode_gas_costs(
+def test_bytecode_gas_costs( # noqa: D103
fork: Fork, bytecode: Bytecode, expected_cost: int
) -> None:
assert expected_cost == bytecode.gas_cost(fork)
@@ -486,7 +486,7 @@ def test_bytecode_gas_costs(
),
],
)
-def test_opcode_refunds(fork: Fork, opcode: Op, expected_refund: int) -> None:
+def test_opcode_refunds(fork: Fork, opcode: Op, expected_refund: int) -> None: # noqa: D103
op_refund_calc = fork.opcode_refund_calculator()
assert expected_refund == op_refund_calc(opcode)
@@ -522,7 +522,7 @@ def test_opcode_refunds(fork: Fork, opcode: Op, expected_refund: int) -> None:
),
],
)
-def test_bytecode_refunds(
+def test_bytecode_refunds( # noqa: D103
fork: Fork, bytecode: Bytecode, expected_refund: int
) -> None:
assert expected_refund == bytecode.refund(fork)
diff --git a/packages/testing/src/execution_testing/logging/__init__.py b/packages/testing/src/execution_testing/logging/__init__.py
index 52a97172cda..b0758ba595b 100644
--- a/packages/testing/src/execution_testing/logging/__init__.py
+++ b/packages/testing/src/execution_testing/logging/__init__.py
@@ -10,13 +10,12 @@
VERBOSE_LEVEL,
ColorFormatter,
EESTLogger,
- UTCFormatter,
- get_logger,
LogLevel,
+ UTCFormatter,
configure_logging,
+ get_logger,
)
-
__all__ = [
"VERBOSE_LEVEL",
"FAIL_LEVEL",
diff --git a/packages/testing/src/execution_testing/rpc/rpc.py b/packages/testing/src/execution_testing/rpc/rpc.py
index ccb60f7b07c..65e4643f7b0 100644
--- a/packages/testing/src/execution_testing/rpc/rpc.py
+++ b/packages/testing/src/execution_testing/rpc/rpc.py
@@ -19,6 +19,8 @@
retry_if_exception_type,
stop_after_attempt,
wait_exponential,
+)
+from tenacity import (
wait_fixed as wait_fixed_tenacity,
)
@@ -92,14 +94,15 @@ def __init__(
self.attempts = attempts
self.elapsed = elapsed
self.interval = interval
- super().__init__(
+ msg = (
f"Block {block_hash} not available after {attempts} attempts "
f"over {elapsed:.1f}s (interval: {interval}s)"
)
+ super().__init__(msg)
class ForkchoiceUpdateTimeoutError(Exception):
- """Raised when forkchoice update doesn't reach VALID within retry limits."""
+ """Raised when forkchoice update doesn't reach VALID in time."""
def __init__(
self,
@@ -113,10 +116,12 @@ def __init__(
self.elapsed = elapsed
self.interval = interval
self.final_status = final_status
- super().__init__(
- f"Forkchoice update failed to reach VALID after {attempts} attempts "
- f"over {elapsed:.1f}s (interval: {interval}s), final status: {final_status}"
+ msg = (
+ f"Forkchoice update failed to reach VALID after {attempts} "
+ f"attempts over {elapsed:.1f}s (interval: {interval}s), "
+ f"final status: {final_status}"
)
+ super().__init__(msg)
class PeerConnectionTimeoutError(Exception):
@@ -136,11 +141,12 @@ def __init__(
self.interval = interval
self.expected_peers = expected_peers
self.actual_peers = actual_peers
- super().__init__(
+ msg = (
f"Peer connection not established after {attempts} attempts "
f"over {elapsed:.1f}s (interval: {interval}s), "
f"expected >= {expected_peers} peers, got {actual_peers}"
)
+ super().__init__(msg)
class BaseRPC:
@@ -242,8 +248,8 @@ def post_request(
headers = base_header | extra_headers
logger.debug(
- f"Sending RPC request to {self.url}, method={self.namespace}_{method}, "
- f"timeout={timeout}..."
+ f"Sending RPC request to {self.url}, "
+ f"method={self.namespace}_{method}, timeout={timeout}..."
)
response = self._make_request(self.url, payload, headers, timeout)
@@ -333,8 +339,8 @@ def __init__(
self.max_transactions_per_batch = max_transactions_per_batch
if max_transactions_per_batch > self.OVERLOAD_THRESHOLD:
logger.warning(
- f"max_transactions_per_batch ({max_transactions_per_batch}) exceeds "
- f"the safe threshold ({self.OVERLOAD_THRESHOLD}). "
+ f"max_transactions_per_batch ({max_transactions_per_batch}) "
+ f"exceeds the safe threshold ({self.OVERLOAD_THRESHOLD}). "
"This may cause RPC service instability or failures."
)
@@ -416,6 +422,7 @@ def get_block_by_hash_with_retry(
Raises:
BlockNotAvailableError: If block not available after max_attempts.
+
"""
attempts = 0
start_time = time.time()
@@ -585,9 +592,7 @@ def max_priority_fee_per_gas(self) -> int:
return self._get_gas_information(method="maxPriorityFeePerGas")
def blob_base_fee(self) -> int:
- """
- `eth_blobBaseFee`: Return the current blob base fee per gas of the network.
- """
+ """Return the current blob base fee per gas of the network."""
return self._get_gas_information(method="blobBaseFee")
def send_raw_transaction(
@@ -672,8 +677,9 @@ def wait_for_transaction(
break
time.sleep(self.poll_interval)
raise Exception(
- f"Transaction {tx_hash} ({transaction.model_dump_json()}) not included in a "
- f"block after {self.transaction_wait_timeout} seconds"
+ f"Transaction {tx_hash} ({transaction.model_dump_json()}) "
+ f"not included in a block after {self.transaction_wait_timeout} "
+ "seconds"
)
def wait_for_transactions(
@@ -711,8 +717,8 @@ def wait_for_transactions(
if tx.hash in tx_hashes
]
raise Exception(
- f"Transactions {', '.join(missing_txs_strings)} not included in a block "
- f"after {self.transaction_wait_timeout} seconds"
+ f"Transactions {', '.join(missing_txs_strings)} not included "
+ f"in a block after {self.transaction_wait_timeout} seconds"
)
def send_wait_transaction(self, transaction: TransactionProtocol) -> Any:
@@ -766,10 +772,13 @@ class EngineRPC(BaseRPC):
jwt_secret: bytes
+ # Default secret used in hive
+ DEFAULT_JWT_SECRET: bytes = b"secretsecretsecretsecretsecretse"
+
def __init__(
self,
*args: Any,
- jwt_secret: bytes = b"secretsecretsecretsecretsecretse", # Default secret used in hive
+ jwt_secret: bytes = DEFAULT_JWT_SECRET,
**kwargs: Any,
) -> None:
"""Initialize Engine RPC class with the given JWT secret."""
@@ -902,11 +911,12 @@ def forkchoice_updated_with_retry(
on_retry: Callable[[RetryCallState], None] | None = None,
) -> ForkchoiceUpdateResponse:
"""
- Send forkchoice update, retrying while SYNCING until a terminal status.
+ Send forkchoice update, retrying while SYNCING until terminal.
- Retries only while the client returns SYNCING status. Returns immediately
- on any terminal status (VALID, INVALID, ACCEPTED, etc.) - the caller is
- responsible for checking if the returned status matches expectations.
+ Retries only while the client returns SYNCING status. Returns
+ immediately on any terminal status (VALID, INVALID, ACCEPTED, etc.)
+ - the caller is responsible for checking if the returned status
+ matches expectations.
Args:
forkchoice_state: The forkchoice state to send.
@@ -917,10 +927,11 @@ def forkchoice_updated_with_retry(
Receives tenacity RetryCallState. If None, logs at debug level.
Returns:
- ForkchoiceUpdateResponse with a terminal status (VALID, INVALID, etc.).
+ ForkchoiceUpdateResponse with a terminal status (VALID, etc.).
Raises:
ForkchoiceUpdateTimeoutError: If still SYNCING after max_attempts.
+
"""
# Track state for exception message in the case of timeout
attempts = 0
@@ -928,10 +939,13 @@ def forkchoice_updated_with_retry(
last_response: ForkchoiceUpdateResponse | None = None
def default_on_retry(retry_state: RetryCallState) -> None:
+ if last_response:
+ status = str(last_response.payload_status.status)
+ else:
+ status = "N/A"
logger.debug(
f"Forkchoice update attempt {retry_state.attempt_number}: "
- f"status={last_response.payload_status.status if last_response else 'N/A'}, "
- f"retrying in {wait_fixed}s..."
+ f"status={status}, retrying in {wait_fixed}s..."
)
retry_callback = on_retry if on_retry is not None else default_on_retry
@@ -996,14 +1010,16 @@ def wait_for_peer_connection(
Raises:
PeerConnectionTimeoutError: If min_peers not reached within limits.
+
"""
attempts = 0
start_time = time.time()
last_peer_count = 0
def default_on_retry(retry_state: RetryCallState) -> None:
+ attempt = retry_state.attempt_number
logger.debug(
- f"Waiting for peer connection, attempt {retry_state.attempt_number}: "
+ f"Waiting for peer connection, attempt {attempt}: "
f"{last_peer_count} peers, need >= {min_peers}, "
f"retrying in {wait_fixed}s..."
)
diff --git a/packages/testing/src/execution_testing/rpc/rpc_types.py b/packages/testing/src/execution_testing/rpc/rpc_types.py
index 512ec68c6ae..d543fc56ff9 100644
--- a/packages/testing/src/execution_testing/rpc/rpc_types.py
+++ b/packages/testing/src/execution_testing/rpc/rpc_types.py
@@ -49,7 +49,10 @@ def __init__(
def __str__(self) -> str:
"""Return string representation of the JSONRPCError."""
if self.data is not None:
- return f"JSONRPCError(code={self.code}, message={self.message}, data={self.data})"
+ return (
+ f"JSONRPCError(code={self.code}, message={self.message}, "
+ f"data={self.data})"
+ )
return f"JSONRPCError(code={self.code}, message={self.message})"
diff --git a/packages/testing/src/execution_testing/rpc/tests/test_types.py b/packages/testing/src/execution_testing/rpc/tests/test_types.py
index 0b1a9f5b845..5e490970416 100644
--- a/packages/testing/src/execution_testing/rpc/tests/test_types.py
+++ b/packages/testing/src/execution_testing/rpc/tests/test_types.py
@@ -23,13 +23,15 @@
"BN254_PAIRING": "0x0000000000000000000000000000000000000008",
"ECREC": "0x0000000000000000000000000000000000000001",
"ID": "0x0000000000000000000000000000000000000004",
- "KZG_POINT_EVALUATION": "0x000000000000000000000000000000000000000a",
+ "KZG_POINT_EVALUATION": "0x000000000000000000000000000000000000000a", # noqa: E501
"MODEXP": "0x0000000000000000000000000000000000000005",
"RIPEMD160": "0x0000000000000000000000000000000000000003",
"SHA256": "0x0000000000000000000000000000000000000002",
},
"systemContracts": {
- "BEACON_ROOTS_ADDRESS": "0x000f3df6d732807ef1319fb7b8bb8522d0beac02"
+ "BEACON_ROOTS_ADDRESS": ( # noqa: E501
+ "0x000f3df6d732807ef1319fb7b8bb8522d0beac02"
+ )
},
},
"next": {
@@ -47,21 +49,21 @@
"BLS12_G1MSM": "0x000000000000000000000000000000000000000c",
"BLS12_G2ADD": "0x000000000000000000000000000000000000000d",
"BLS12_G2MSM": "0x000000000000000000000000000000000000000e",
- "BLS12_MAP_FP2_TO_G2": "0x0000000000000000000000000000000000000011",
- "BLS12_MAP_FP_TO_G1": "0x0000000000000000000000000000000000000010",
- "BLS12_PAIRING_CHECK": "0x000000000000000000000000000000000000000f",
+ "BLS12_MAP_FP2_TO_G2": "0x0000000000000000000000000000000000000011", # noqa: E501
+ "BLS12_MAP_FP_TO_G1": "0x0000000000000000000000000000000000000010", # noqa: E501
+ "BLS12_PAIRING_CHECK": "0x000000000000000000000000000000000000000f", # noqa: E501
"BN254_ADD": "0x0000000000000000000000000000000000000006",
"BN254_MUL": "0x0000000000000000000000000000000000000007",
"BN254_PAIRING": "0x0000000000000000000000000000000000000008",
"ECREC": "0x0000000000000000000000000000000000000001",
"ID": "0x0000000000000000000000000000000000000004",
- "KZG_POINT_EVALUATION": "0x000000000000000000000000000000000000000a",
+ "KZG_POINT_EVALUATION": "0x000000000000000000000000000000000000000a", # noqa: E501
"MODEXP": "0x0000000000000000000000000000000000000005",
"RIPEMD160": "0x0000000000000000000000000000000000000003",
"SHA256": "0x0000000000000000000000000000000000000002",
},
"systemContracts": {
- "BEACON_ROOTS_ADDRESS": "0x000f3df6d732807ef1319fb7b8bb8522d0beac02",
+ "BEACON_ROOTS_ADDRESS": "0x000f3df6d732807ef1319fb7b8bb8522d0beac02", # noqa: E501
"CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS": (
"0x0000bbddc7ce488642fb579f8b00f3a590007251"
),
@@ -91,21 +93,21 @@
"BLS12_G1MSM": "0x000000000000000000000000000000000000000c",
"BLS12_G2ADD": "0x000000000000000000000000000000000000000d",
"BLS12_G2MSM": "0x000000000000000000000000000000000000000e",
- "BLS12_MAP_FP2_TO_G2": "0x0000000000000000000000000000000000000011",
- "BLS12_MAP_FP_TO_G1": "0x0000000000000000000000000000000000000010",
- "BLS12_PAIRING_CHECK": "0x000000000000000000000000000000000000000f",
+ "BLS12_MAP_FP2_TO_G2": "0x0000000000000000000000000000000000000011", # noqa: E501
+ "BLS12_MAP_FP_TO_G1": "0x0000000000000000000000000000000000000010", # noqa: E501
+ "BLS12_PAIRING_CHECK": "0x000000000000000000000000000000000000000f", # noqa: E501
"BN254_ADD": "0x0000000000000000000000000000000000000006",
"BN254_MUL": "0x0000000000000000000000000000000000000007",
"BN254_PAIRING": "0x0000000000000000000000000000000000000008",
"ECREC": "0x0000000000000000000000000000000000000001",
"ID": "0x0000000000000000000000000000000000000004",
- "KZG_POINT_EVALUATION": "0x000000000000000000000000000000000000000a",
+ "KZG_POINT_EVALUATION": "0x000000000000000000000000000000000000000a", # noqa: E501
"MODEXP": "0x0000000000000000000000000000000000000005",
"RIPEMD160": "0x0000000000000000000000000000000000000003",
"SHA256": "0x0000000000000000000000000000000000000002",
},
"systemContracts": {
- "BEACON_ROOTS_ADDRESS": "0x000f3df6d732807ef1319fb7b8bb8522d0beac02",
+ "BEACON_ROOTS_ADDRESS": "0x000f3df6d732807ef1319fb7b8bb8522d0beac02", # noqa: E501
"CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS": (
"0x0000bbddc7ce488642fb579f8b00f3a590007251"
),
diff --git a/packages/testing/src/execution_testing/specs/base.py b/packages/testing/src/execution_testing/specs/base.py
index 62c170440c0..fc8ce0d9f72 100644
--- a/packages/testing/src/execution_testing/specs/base.py
+++ b/packages/testing/src/execution_testing/specs/base.py
@@ -59,7 +59,10 @@ def __init__(
def __str__(self) -> str:
"""Return the error message."""
- return f"{self.message}: Expected {self.expected_hash}, got {self.actual_hash}"
+ return (
+ f"{self.message}: Expected {self.expected_hash}, "
+ f"got {self.actual_hash}"
+ )
def verify_result(result: Result, env: Environment) -> None:
@@ -275,15 +278,15 @@ def check_exception_test(
if negative_test_marker != exception:
if exception:
raise Exception(
- "Test produced an invalid block or transaction but was not marked with the "
- "`exception_test` marker. Add the `@pytest.mark.exception_test` decorator "
- "to the test."
+ "Test produced an invalid block or transaction but was "
+ "not marked with the `exception_test` marker. Add the "
+ "`@pytest.mark.exception_test` decorator to the test."
)
else:
raise Exception(
- "Test didn't produce an invalid block or transaction but was marked with the "
- "`exception_test` marker. Remove the `@pytest.mark.exception_test` decorator "
- "from the test."
+ "Test didn't produce an invalid block or transaction but "
+ "was marked with the `exception_test` marker. Remove the "
+ "`@pytest.mark.exception_test` decorator from the test."
)
def get_genesis_environment(self) -> Environment:
@@ -294,8 +297,8 @@ def get_genesis_environment(self) -> Environment:
environment.
"""
raise NotImplementedError(
- f"{self.__class__.__name__} must implement genesis environment access for use with "
- "pre-allocation groups."
+ f"{self.__class__.__name__} must implement genesis environment "
+ "access for use with pre-allocation groups."
)
def update_pre_alloc_groups(
@@ -307,8 +310,9 @@ def update_pre_alloc_groups(
"""
if not hasattr(self, "pre"):
raise AttributeError(
- f"{self.__class__.__name__} does not have a 'pre' field. Pre-allocation groups "
- "are only supported for test types that define pre-allocation."
+ f"{self.__class__.__name__} does not have a 'pre' field. "
+ "Pre-allocation groups are only supported for test types "
+ "that define pre-allocation."
)
pre_alloc_hash = self.compute_pre_alloc_group_hash()
pre_alloc_group_builders.add_test_pre(
@@ -323,8 +327,9 @@ def compute_pre_alloc_group_hash(self) -> str:
"""Hash (fork, env) in order to group tests by genesis config."""
if not hasattr(self, "pre"):
raise AttributeError(
- f"{self.__class__.__name__} does not have a 'pre' field. Pre-allocation group "
- "usage is only supported for test types that define pre-allocs."
+ f"{self.__class__.__name__} does not have a 'pre' field. "
+ "Pre-allocation group usage is only supported for test "
+ "types that define pre-allocs."
)
fork_digest = hashlib.sha256(self.fork.name().encode("utf-8")).digest()
fork_hash = int.from_bytes(fork_digest[:8], byteorder="big")
diff --git a/packages/testing/src/execution_testing/specs/benchmark.py b/packages/testing/src/execution_testing/specs/benchmark.py
index ce4cb2aca17..0777d69b7cf 100644
--- a/packages/testing/src/execution_testing/specs/benchmark.py
+++ b/packages/testing/src/execution_testing/specs/benchmark.py
@@ -178,21 +178,26 @@ def generate_repeated_code(
max_iterations = available_space // len(repeated_code)
# Use fixed_opcode_count if provided, otherwise fill to max
- # Iteration Logic: The goal is to set the total operation count proportional to a
- # 'fixed_opcode_count' multiplied by 1000, across two contracts (Loop M * Target N).
+ # Iteration Logic: The goal is to set the total operation count
+ # proportional to a 'fixed_opcode_count' multiplied by 1000,
+ # across two contracts (Loop M * Target N).
# --- 1. Determine Inner Iterations (N) ---
- # The Target Contract's loop count is determined by block filling, capped at 1000.
+ # The Target Contract's loop count is determined by block filling,
+ # capped at 1000.
#
# 1a. Calculate 'max_iterations' to fill the block.
# 1b. The Inner Iteration count (N) is capped at 1000.
- # 1c. If the calculated N is less than 1000, use 500 as the fallback count.
+ # 1c. If the calculated N is less than 1000, use 500 as the fallback.
# --- 2. Determine Outer Iterations (M) ---
- # The Loop Contract's call count (M) is set to ensure the final total execution is consistent.
+ # The Loop Contract's call count (M) is set to ensure the final
+ # total execution is consistent.
#
- # 2a. If N is 1000: Set M = fixed_opcode_count. (Total ops: fixed_opcode_count * 1000)
- # 2b. If N is 500: Set M = fixed_opcode_count * 2. (Total ops: (fixed_opcode_count * 2) * 500 = fixed_opcode_count * 1000)
+ # 2a. If N is 1000: Set M = fixed_opcode_count.
+ # (Total ops: fixed_opcode_count * 1000)
+ # 2b. If N is 500: Set M = fixed_opcode_count * 2.
+ # (Total ops: (fixed_opcode_count * 2) * 500)
if self.fixed_opcode_count is not None:
inner_iterations = 1000 if max_iterations >= 1000 else 500
self._inner_iterations = min(max_iterations, inner_iterations)
@@ -221,8 +226,8 @@ def _validate_code_size(self, code: Bytecode, fork: Fork) -> None:
"""Validate that the generated code fits within size limits."""
if len(code) > fork.max_code_size():
raise ValueError(
- f"Generated code size {len(code)} exceeds maximum allowed size "
- f"{fork.max_code_size()}"
+ f"Generated code size {len(code)} exceeds maximum "
+ f"allowed size {fork.max_code_size()}"
)
@@ -268,7 +273,9 @@ class BenchmarkTest(BaseTest):
]
supported_markers: ClassVar[Dict[str, str]] = {
- "blockchain_test_engine_only": "Only generate a blockchain test engine fixture",
+ "blockchain_test_engine_only": (
+ "Only generate a blockchain test engine fixture"
+ ),
"blockchain_test_only": "Only generate a blockchain test fixture",
"repricing": "Mark test as reference test for gas repricing analysis",
}
@@ -295,7 +302,8 @@ def model_post_init(self, __context: Any, /) -> None:
if len(set_props) != 1:
raise ValueError(
- f"Exactly one must be set, but got {len(set_props)}: {', '.join(set_props)}"
+ f"Exactly one must be set, but got {len(set_props)}: "
+ f"{', '.join(set_props)}"
)
blocks: List[Block] = self.setup_blocks
@@ -335,7 +343,8 @@ def model_post_init(self, __context: Any, /) -> None:
else:
raise ValueError(
- "Cannot create BlockchainTest without a code generator, transactions, or blocks"
+ "Cannot create BlockchainTest without a code generator, "
+ "transactions, or blocks"
)
self.blocks = blocks
@@ -447,8 +456,9 @@ def generate_blockchain_test(self) -> BlockchainTest:
def _verify_target_opcode_count(
self, opcode_count: OpcodeCount | None
) -> None:
- """Verify the target opcode was executed the expected number of times."""
- # Skip validation if opcode count is not available (e.g. currently only supported for evmone filling)
+ """Verify target opcode was executed the expected number of times."""
+ # Skip validation if opcode count is not available
+ # (e.g. currently only supported for evmone filling)
if opcode_count is None:
return
diff --git a/packages/testing/src/execution_testing/specs/blockchain.py b/packages/testing/src/execution_testing/specs/blockchain.py
index 06d6bebfc9a..b5a6ddffe90 100644
--- a/packages/testing/src/execution_testing/specs/blockchain.py
+++ b/packages/testing/src/execution_testing/specs/blockchain.py
@@ -223,7 +223,8 @@ def verify(self, target: FixtureHeader) -> None:
value = getattr(target, field_name)
if baseline_value is Header.EMPTY_FIELD:
assert value is None, (
- f"invalid header field {field_name}, got {value}, want None"
+ f"invalid header field {field_name}, "
+ f"got {value}, want None"
)
continue
assert value == baseline_value, (
@@ -498,7 +499,9 @@ class BlockchainTest(BaseTest):
]
supported_markers: ClassVar[Dict[str, str]] = {
- "blockchain_test_engine_only": "Only generate a blockchain test engine fixture",
+ "blockchain_test_engine_only": (
+ "Only generate a blockchain test engine fixture"
+ ),
"blockchain_test_only": "Only generate a blockchain test fixture",
}
@@ -586,12 +589,13 @@ def generate_block_data(
if failing_tx_count := len([tx for tx in txs if tx.error]) > 0:
if failing_tx_count > 1:
raise Exception(
- "test correctness: only one transaction can produce an exception in a block"
+ "test correctness: only one transaction can produce "
+ "an exception in a block"
)
if not txs[-1].error:
raise Exception(
- "test correctness: the transaction that produces an exception "
- + "must be the last transaction in the block"
+ "test correctness: the transaction that produces an "
+ "exception must be the last transaction in the block"
)
transition_tool_output = t8n.evaluate(
@@ -664,10 +668,11 @@ def generate_block_data(
gas_used = int(transition_tool_output.result.gas_used)
if not self.skip_gas_used_validation:
+ diff = gas_used - expected_benchmark_gas_used
assert gas_used == expected_benchmark_gas_used, (
- f"gas_used ({gas_used}) does not match expected_benchmark_gas_used "
- f"({expected_benchmark_gas_used})"
- f", difference: {gas_used - expected_benchmark_gas_used}"
+ f"gas_used ({gas_used}) does not match "
+ f"expected_benchmark_gas_used "
+ f"({expected_benchmark_gas_used}), difference: {diff}"
)
requests_list: List[Bytes] | None = None
@@ -683,8 +688,8 @@ def generate_block_data(
if Hash(requests) != header.requests_hash:
raise Exception(
- "Requests root in header does not match the requests root in the transition "
- "tool output: "
+ "Requests root in header does not match the requests "
+ "root in the transition tool output: "
f"{header.requests_hash} != {Hash(requests)}"
)
@@ -702,8 +707,8 @@ def generate_block_data(
assert (
transition_tool_output.result.block_access_list is not None
), (
- "Block access list is required for this block but was not provided "
- "by the transition tool"
+ "Block access list is required for this block but was not "
+ "provided by the transition tool"
)
rlp = transition_tool_output.result.block_access_list.rlp
@@ -727,7 +732,8 @@ def generate_block_data(
t8n_bal = transition_tool_output.result.block_access_list
bal = t8n_bal
- # Always validate BAL structural integrity (ordering, duplicates) if present
+ # Always validate BAL structural integrity (ordering, duplicates)
+ # if present
if t8n_bal is not None:
t8n_bal.validate_structure()
@@ -997,7 +1003,8 @@ def make_hive_fixture(
elif fixture_format == BlockchainEngineSyncFixture:
# Sync fixture format
assert genesis.header.block_hash != head_hash, (
- "Invalid payload tests negative test via sync is not supported yet."
+ "Invalid payload tests negative test via sync is not "
+ "supported yet."
)
# Most clients require the header to start the sync process, so we
# create an empty block on top of the last block of the test to
@@ -1011,7 +1018,9 @@ def make_hive_fixture(
)
fixture_data.update(
{
- "sync_payload": sync_built_block.get_fixture_engine_new_payload(),
+ "sync_payload": (
+ sync_built_block.get_fixture_engine_new_payload()
+ ),
"pre": pre,
"post_state": alloc
if not self.exclude_full_post_state_in_output
diff --git a/packages/testing/src/execution_testing/specs/debugging.py b/packages/testing/src/execution_testing/specs/debugging.py
index 742883a3ac8..0baf544a4f8 100644
--- a/packages/testing/src/execution_testing/specs/debugging.py
+++ b/packages/testing/src/execution_testing/specs/debugging.py
@@ -9,7 +9,8 @@ def print_traces(traces: List[Traces] | None) -> None:
"""Print the traces from the transition tool for debugging."""
if traces is None:
print(
- "Traces not collected. Use `--traces` to see detailed execution information."
+ "Traces not collected. Use `--traces` to see detailed "
+ "execution information."
)
return
print("Printing traces for debugging purposes:")
diff --git a/packages/testing/src/execution_testing/specs/state.py b/packages/testing/src/execution_testing/specs/state.py
index b6923aae7de..e4d5f9c61c2 100644
--- a/packages/testing/src/execution_testing/specs/state.py
+++ b/packages/testing/src/execution_testing/specs/state.py
@@ -184,7 +184,8 @@ def verify_modified_gas_limit(
)
except Exception as e:
logger.debug(
- f"Transactions are not equivalent (gas_limit={current_gas_limit})"
+ "Transactions are not equivalent "
+ f"(gas_limit={current_gas_limit})"
)
logger.debug(e)
return False
@@ -201,14 +202,16 @@ def verify_modified_gas_limit(
for k in base_tool_alloc.root.keys():
if k not in modified_tool_alloc:
logger.debug(
- f"Post alloc is not equivalent (gas_limit={current_gas_limit})"
+ "Post alloc is not equivalent "
+ f"(gas_limit={current_gas_limit})"
)
return False
base_account = base_tool_alloc[k]
modified_account = modified_tool_alloc[k]
if (modified_account is None) != (base_account is None):
logger.debug(
- f"Post alloc is not equivalent (gas_limit={current_gas_limit})"
+ "Post alloc is not equivalent "
+ f"(gas_limit={current_gas_limit})"
)
return False
if (
@@ -217,7 +220,8 @@ def verify_modified_gas_limit(
and base_account.nonce != modified_account.nonce
):
logger.debug(
- f"Post alloc is not equivalent (gas_limit={current_gas_limit})"
+ "Post alloc is not equivalent "
+ f"(gas_limit={current_gas_limit})"
)
return False
logger.debug(
@@ -247,10 +251,12 @@ def _generate_blockchain_genesis_environment(self) -> Environment:
Generate the genesis environment for the BlockchainTest formatted test.
"""
assert self.env.number >= 1, (
- "genesis block number cannot be negative, set state test env.number to at least 1"
+ "genesis block number cannot be negative, set state test "
+ "env.number to at least 1"
)
assert self.env.timestamp >= 1, (
- "genesis timestamp cannot be negative, set state test env.timestamp to at least 1"
+ "genesis timestamp cannot be negative, set state test "
+ "env.timestamp to at least 1"
)
# There's only a handful of values that we need to set in the genesis
# for the environment values at block 1 to make sense:
@@ -435,7 +441,8 @@ def make_state_test_fixture(
):
raise Exception(
"Requires more than the minimum "
- f"{self._gas_optimization_max_gas_limit} wanted."
+ f"{self._gas_optimization_max_gas_limit} "
+ "wanted."
)
assert self.verify_modified_gas_limit(
@@ -459,10 +466,11 @@ def make_state_test_fixture(
)
gas_used = int(transition_tool_output.result.gas_used)
if not self.skip_gas_used_validation:
+ diff = gas_used - expected_benchmark_gas_used
assert gas_used == expected_benchmark_gas_used, (
- f"gas_used ({gas_used}) does not match expected_benchmark_gas_used "
- f"({expected_benchmark_gas_used})"
- f", difference: {gas_used - expected_benchmark_gas_used}"
+ f"gas_used ({gas_used}) does not match "
+ f"expected_benchmark_gas_used "
+ f"({expected_benchmark_gas_used}), difference: {diff}"
)
return StateFixture(
diff --git a/packages/testing/src/execution_testing/specs/static_state/account.py b/packages/testing/src/execution_testing/specs/static_state/account.py
index d4a28835697..fe5c12aa11d 100644
--- a/packages/testing/src/execution_testing/specs/static_state/account.py
+++ b/packages/testing/src/execution_testing/specs/static_state/account.py
@@ -265,7 +265,8 @@ def setup(self, pre: Alloc, all_dependencies: Dict[str, Tag]) -> TagDict:
if extra_dependency not in resolved_accounts:
if all_dependencies[extra_dependency].type != "eoa":
raise ValueError(
- f"Contract dependency {extra_dependency} not found in pre"
+ f"Contract dependency {extra_dependency} "
+ "not found in pre"
)
# Create new EOA - this will have a dynamically generated key
diff --git a/packages/testing/src/execution_testing/specs/static_state/common/common.py b/packages/testing/src/execution_testing/specs/static_state/common/common.py
index 4c3f4c602dc..fead4be2e6f 100644
--- a/packages/testing/src/execution_testing/specs/static_state/common/common.py
+++ b/packages/testing/src/execution_testing/specs/static_state/common/common.py
@@ -130,7 +130,8 @@ def compiled(self, tags: TagDict) -> bytes:
if not isinstance(raw_code, str):
raise ValueError(
- f"code is of type {type(raw_code)} but expected a string: {raw_code}"
+ f"code is of type {type(raw_code)} but expected a string: "
+ f"{raw_code}"
)
if len(raw_code) == 0:
return b""
diff --git a/packages/testing/src/execution_testing/specs/static_state/environment.py b/packages/testing/src/execution_testing/specs/static_state/environment.py
index 6cf7822ddcf..32cd3b4e6db 100644
--- a/packages/testing/src/execution_testing/specs/static_state/environment.py
+++ b/packages/testing/src/execution_testing/specs/static_state/environment.py
@@ -42,7 +42,8 @@ def check_fields(self) -> "EnvironmentInStateTestFiller":
if self.current_difficulty is None:
if self.current_random is None:
raise ValueError(
- "If `currentDifficulty` is not set, `currentRandom` must be set!"
+ "If `currentDifficulty` is not set, "
+ "`currentRandom` must be set!"
)
return self
@@ -51,7 +52,8 @@ def get_environment(self, tags: TagDict) -> Environment:
kwargs: Dict[str, Any] = {}
if isinstance(self.current_coinbase, Tag):
assert self.current_coinbase.name in tags, (
- f"Tag {self.current_coinbase.name} to resolve coinbase not found in tags"
+ f"Tag {self.current_coinbase.name} to resolve coinbase "
+ "not found in tags"
)
kwargs["fee_recipient"] = self.current_coinbase.resolve(tags)
else:
diff --git a/packages/testing/src/execution_testing/specs/tests/test_benchmark.py b/packages/testing/src/execution_testing/specs/tests/test_benchmark.py
index 215ec36de68..3f859417d05 100644
--- a/packages/testing/src/execution_testing/specs/tests/test_benchmark.py
+++ b/packages/testing/src/execution_testing/specs/tests/test_benchmark.py
@@ -51,20 +51,22 @@ def test_split_transaction(
# Verify the number of transactions
assert len(split_txs) == expected_splits, (
- f"Expected {expected_splits} transactions for {gas_benchmark_value_millions}M gas, "
- f"got {len(split_txs)}"
+ f"Expected {expected_splits} transactions for "
+ f"{gas_benchmark_value_millions}M gas, got {len(split_txs)}"
)
# Verify total gas equals the benchmark value
total_gas = sum(tx.gas_limit for tx in split_txs)
assert total_gas == gas_benchmark_value, (
- f"Total gas {total_gas} doesn't match benchmark value {gas_benchmark_value}"
+ f"Total gas {total_gas} doesn't match benchmark "
+ f"value {gas_benchmark_value}"
)
# Verify no transaction exceeds the cap
for i, tx in enumerate(split_txs):
assert tx.gas_limit <= gas_limit_cap, (
- f"Transaction {i} gas limit {tx.gas_limit} exceeds cap {gas_limit_cap}"
+ f"Transaction {i} gas limit {tx.gas_limit} "
+ f"exceeds cap {gas_limit_cap}"
)
# Verify nonces increment correctly
@@ -74,7 +76,8 @@ def test_split_transaction(
# Verify gas distribution
for i, tx in enumerate(split_txs[:-1]): # All but last should be at cap
assert tx.gas_limit == gas_limit_cap, (
- f"Transaction {i} should have gas limit {gas_limit_cap}, got {tx.gas_limit}"
+ f"Transaction {i} should have gas limit {gas_limit_cap}, "
+ f"got {tx.gas_limit}"
)
# Last transaction should have the remainder
@@ -83,7 +86,8 @@ def test_split_transaction(
gas_limit_cap * (expected_splits - 1)
)
assert split_txs[-1].gas_limit == expected_last_gas, (
- f"Last transaction should have {expected_last_gas} gas, got {split_txs[-1].gas_limit}"
+ f"Last transaction should have {expected_last_gas} gas, "
+ f"got {split_txs[-1].gas_limit}"
)
diff --git a/packages/testing/src/execution_testing/specs/tests/test_expect.py b/packages/testing/src/execution_testing/specs/tests/test_expect.py
index a73478d8fc7..5cb5d0519c2 100644
--- a/packages/testing/src/execution_testing/specs/tests/test_expect.py
+++ b/packages/testing/src/execution_testing/specs/tests/test_expect.py
@@ -170,7 +170,6 @@ def test_post_storage_value_mismatch(
expected_exception: Storage.KeyValueMismatchError,
state_test: StateTest,
default_t8n: TransitionTool,
- fork: Fork,
) -> None:
"""
Test post state `Account.storage` exceptions during state test fixture
@@ -205,7 +204,6 @@ def test_post_nonce_value_mismatch(
post: Alloc,
state_test: StateTest,
default_t8n: TransitionTool,
- fork: Fork,
) -> None:
"""
Test post state `Account.nonce` verification and exceptions during state
@@ -251,7 +249,6 @@ def test_post_code_value_mismatch(
post: Alloc,
state_test: StateTest,
default_t8n: TransitionTool,
- fork: Fork,
) -> None:
"""
Test post state `Account.code` verification and exceptions during state
@@ -297,7 +294,6 @@ def test_post_balance_value_mismatch(
post: Alloc,
state_test: StateTest,
default_t8n: TransitionTool,
- fork: Fork,
) -> None:
"""
Test post state `Account.balance` verification and exceptions during state
@@ -352,7 +348,6 @@ def test_post_balance_value_mismatch(
def test_post_account_mismatch(
state_test: StateTest,
default_t8n: TransitionTool,
- fork: Fork,
exception_type: Type[Exception] | None,
) -> None:
"""
@@ -435,7 +430,6 @@ def test_post_account_mismatch(
def test_transaction_expectation(
state_test: StateTest,
default_t8n: TransitionTool,
- fork: Fork,
exception_type: Type[Exception] | None,
fixture_format: FixtureFormat,
) -> None:
diff --git a/packages/testing/src/execution_testing/specs/tests/test_fixtures.py b/packages/testing/src/execution_testing/specs/tests/test_fixtures.py
index aec091a0aba..90680eb05d8 100644
--- a/packages/testing/src/execution_testing/specs/tests/test_fixtures.py
+++ b/packages/testing/src/execution_testing/specs/tests/test_fixtures.py
@@ -92,9 +92,9 @@ def test_check_helper_fixtures() -> None:
Cancun,
],
)
-def test_make_genesis(
+def test_make_genesis( # noqa: D103
fork: Fork, fixture_hash: bytes, default_t8n: TransitionTool
-) -> None: # noqa: D103
+) -> None:
env = Environment(gas_limit=100_000_000_000_000_000)
pre = Alloc(
@@ -202,10 +202,9 @@ def test_fill_state_test(
tag="my_chain_id_test",
).generate(t8n=default_t8n, fixture_format=fixture_format)
assert generated_fixture.__class__ == fixture_format
+ fixture_key = f"000/my_chain_id_test/{fork}/tx_type_{tx_type}"
fixture = {
- f"000/my_chain_id_test/{fork}/tx_type_{tx_type}": generated_fixture.json_dict_with_info(
- hash_only=True
- ),
+ fixture_key: generated_fixture.json_dict_with_info(hash_only=True),
}
format_name = fixture_format.format_name
diff --git a/packages/testing/src/execution_testing/test_types/account_types.py b/packages/testing/src/execution_testing/test_types/account_types.py
index 42922ba3750..04106c40059 100644
--- a/packages/testing/src/execution_testing/test_types/account_types.py
+++ b/packages/testing/src/execution_testing/test_types/account_types.py
@@ -172,7 +172,10 @@ class UnexpectedAccountError(Exception):
def __str__(self) -> str:
"""Print exception string."""
- return f"unexpected account in allocation {self.address}: {self.account}"
+ return (
+ f"unexpected account in allocation {self.address}: "
+ f"{self.account}"
+ )
@dataclass(kw_only=True)
class MissingAccountError(Exception):
@@ -243,7 +246,8 @@ def merge(
if overlapping_keys:
if key_collision_mode == cls.KeyCollisionMode.ERROR:
raise Exception(
- f"Overlapping keys detected: {[key.hex() for key in overlapping_keys]}"
+ f"Overlapping keys detected: "
+ f"{[key.hex() for key in overlapping_keys]}"
)
elif (
key_collision_mode
@@ -410,9 +414,11 @@ def deterministic_deploy_contract(
storage: The expected storage state of the deployed contract after
initcode execution.
label: Label to use for the contract.
+
"""
raise NotImplementedError(
- "deterministic_deploy_contract is not implemented in the base class"
+ "deterministic_deploy_contract is not implemented in the base "
+ "class"
)
def deploy_contract(
@@ -466,6 +472,7 @@ def fund_address(
minimum_balance: If set to True, account will be checked to have a
minimum balance of `amount` and only fund if the balance is
insufficient
+
"""
raise NotImplementedError(
"fund_address is not implemented in the base class"
diff --git a/packages/testing/src/execution_testing/test_types/blob_types.py b/packages/testing/src/execution_testing/test_types/blob_types.py
index 62701359403..b4dfc58a9bb 100644
--- a/packages/testing/src/execution_testing/test_types/blob_types.py
+++ b/packages/testing/src/execution_testing/test_types/blob_types.py
@@ -13,10 +13,10 @@
from execution_testing.base_types.base_types import Bytes, Hash
from execution_testing.base_types.pydantic import CamelModel
+from execution_testing.forks import Fork
from execution_testing.logging import (
get_logger,
)
-from execution_testing.forks import Fork
CACHED_BLOBS_DIRECTORY: Path = (
Path(platformdirs.user_cache_dir("ethereum-execution-spec-tests"))
@@ -161,7 +161,8 @@ def get_commitment(data: Bytes) -> Bytes:
)
assert len(data) == field_elements * bytes_per_field, (
f"Expected blob of length "
- f"{field_elements * bytes_per_field} but got blob of length {len(data)}"
+ f"{field_elements * bytes_per_field} but got blob of length "
+ f"{len(data)}"
)
# calculate commitment
@@ -207,8 +208,9 @@ def get_proof(fork: Fork, data: Bytes) -> List[Bytes] | Bytes:
return proofs
raise AssertionError(
- f"get_proof() has not been implemented yet for fork: {fork.name()}."
- f"Got amount of cell proofs {amount_cell_proofs} but expected 128."
+ f"get_proof() has not been implemented yet for fork: "
+ f"{fork.name()}. Got amount of cell proofs "
+ f"{amount_cell_proofs} but expected 128."
)
def get_cells(fork: Fork, data: Bytes) -> List[Bytes] | None:
@@ -228,8 +230,9 @@ def get_cells(fork: Fork, data: Bytes) -> List[Bytes] | None:
return cells # List[bytes]
raise AssertionError(
- f"get_cells() has not been implemented yet for fork: {fork.name()}. Got amount of "
- f"cell proofs {amount_cell_proofs} but expected 128."
+ f"get_cells() has not been implemented yet for fork: "
+ f"{fork.name()}. Got amount of cell proofs "
+ f"{amount_cell_proofs} but expected 128."
)
# first, create cached blobs dir if necessary
@@ -250,7 +253,8 @@ def get_cells(fork: Fork, data: Bytes) -> List[Bytes] | None:
with FileLock(lock_file_path):
if blob_location.exists():
logger.debug(
- f"Blob exists already, reading it from file {blob_location}"
+ f"Blob exists already, reading it from file "
+ f"{blob_location}"
)
return Blob.from_file(Blob.get_filename(fork, seed))
@@ -293,8 +297,8 @@ def from_file(file_name: str) -> "Blob":
"""
# ensure filename was passed
assert file_name.startswith("blob_"), (
- f"You provided an invalid blob filename. Expected it to start with 'blob_' "
- f"but got: {file_name}"
+ f"You provided an invalid blob filename. Expected it to start "
+ f"with 'blob_' but got: {file_name}"
)
if ".json" not in file_name:
@@ -305,7 +309,8 @@ def from_file(file_name: str) -> "Blob":
# check whether blob exists
assert blob_file_location.exists(), (
- f"Tried to load blob from file but {blob_file_location} does not exist"
+ f"Tried to load blob from file but {blob_file_location} does not "
+ "exist"
)
# read blob from file
@@ -326,7 +331,8 @@ def write_to_file(self) -> None:
# warn if existing static_blob gets overwritten
if output_location.exists():
logger.debug(
- f"Blob {output_location} already exists. It will be overwritten."
+ f"Blob {output_location} already exists. It will be "
+ "overwritten."
)
# overwrite existing
@@ -343,14 +349,16 @@ def verify_cell_kzg_proof_batch(self, cell_indices: list) -> bool:
)
assert amount_cell_proofs > 0, (
- f"verify_cell_kzg_proof_batch() is not available for your fork: {self.fork.name()}."
+ f"verify_cell_kzg_proof_batch() is not available for your fork: "
+ f"{self.fork.name()}."
)
assert self.cells is not None, "self.cells is None, critical error."
assert len(cell_indices) == len(self.cells), (
- f"Cell Indices list (detected length {len(cell_indices)}) and Cell list "
- f"(detected length {len(self.cells)}) should have same length."
+ f"Cell Indices list (detected length {len(cell_indices)}) and "
+ f"Cell list (detected length {len(self.cells)}) should have same "
+ "length."
)
# each cell refers to the same commitment
@@ -386,24 +394,26 @@ def delete_cells_then_recover_them(
)
assert amount_cell_proofs > 0, (
- f"delete_cells_then_recover_them() is not available for fork: {self.fork.name()}"
+ f"delete_cells_then_recover_them() is not available for fork: "
+ f"{self.fork.name()}"
)
assert self.cells is not None, "self.cells is None, critical problem."
assert isinstance(self.proof, list), (
- "This function only works when self.proof is a list, but it seems to be "
- " of type bytes (not a list)"
+ "This function only works when self.proof is a list, but it seems "
+ "to be of type bytes (not a list)"
)
assert len(self.cells) == 128, (
- f"You are supposed to pass a full cell list with 128 elements to this function, "
- f"but got list of length {len(self.cells)}"
+ f"You are supposed to pass a full cell list with 128 elements to "
+ f"this function, but got list of length {len(self.cells)}"
)
assert len(deletion_indices) < 129, (
- f"You can't delete more than every cell (max len of deletion indices list is 128), "
- f"but you passed a deletion indices list of length {len(deletion_indices)}"
+ f"You can't delete more than every cell (max len of deletion "
+ f"indices list is 128), but you passed a deletion indices list of "
+ f"length {len(deletion_indices)}"
)
for i in deletion_indices:
assert 0 <= i <= 127, (
@@ -425,23 +435,26 @@ def delete_cells_then_recover_them(
# determine success/failure
assert len(recovered_cells) == len(self.cells), (
- f"Failed to recover cell list. Original cell list had length {len(self.cells)} but "
- f"recovered cell list has length {len(recovered_cells)}"
+ f"Failed to recover cell list. Original cell list had length "
+ f"{len(self.cells)} but recovered cell list has length "
+ f"{len(recovered_cells)}"
)
assert len(recovered_proofs) == len(self.proof), (
- f"Failed to recover proofs list. Original proofs list had length {len(self.proof)} "
- f"but recovered proofs list has length {len(recovered_proofs)}"
+ f"Failed to recover proofs list. Original proofs list had length "
+ f"{len(self.proof)} but recovered proofs list has length "
+ f"{len(recovered_proofs)}"
)
for i in range(len(recovered_cells)):
assert self.cells[i] == recovered_cells[i], (
- f"Failed to correctly restore missing cells. At index {i} original cell was "
- f"0x{self.cells[i].hex()} but reconstructed cell does not match: "
- f"0x{recovered_cells[i].hex()}"
+ f"Failed to correctly restore missing cells. At index {i} "
+ f"original cell was 0x{self.cells[i].hex()} but reconstructed "
+ f"cell does not match: 0x{recovered_cells[i].hex()}"
)
assert self.proof[i] == recovered_proofs[i], (
- f"Failed to correctly restore missing proofs. At index {i} original proof was "
- f"0x{self.proof[i].hex()} but reconstructed proof does not match: "
+ f"Failed to correctly restore missing proofs. At index {i} "
+ f"original proof was 0x{self.proof[i].hex()} but "
+ f"reconstructed proof does not match: "
f"0x{recovered_proofs[i].hex()}"
)
@@ -502,7 +515,8 @@ def corrupt_byte(b: bytes) -> Bytes:
# pre-osaka (cancun and prague)
assert amount_cell_proofs == 0, (
- f"You need to adjust corrupt_proof to handle fork {self.fork.name()}"
+ f"You need to adjust corrupt_proof to handle fork "
+ f"{self.fork.name()}"
)
assert isinstance(self.proof, Bytes), (
"proof was expected to be Bytes but it isn't"
diff --git a/packages/testing/src/execution_testing/test_types/block_access_list/account_absent_values.py b/packages/testing/src/execution_testing/test_types/block_access_list/account_absent_values.py
index aca89076ac8..3f57082bd1a 100644
--- a/packages/testing/src/execution_testing/test_types/block_access_list/account_absent_values.py
+++ b/packages/testing/src/execution_testing/test_types/block_access_list/account_absent_values.py
@@ -81,8 +81,10 @@ class BalAccountAbsentValues(CamelModel):
)
balance_changes: List[BalBalanceChange] = Field(
default_factory=list,
- description="List of balance changes that should NOT exist in the BAL. "
- "Validates that none of these changes are present.",
+ description=(
+ "List of balance changes that should NOT exist in the BAL. "
+ "Validates that none of these changes are present."
+ ),
)
code_changes: List[BalCodeChange] = Field(
default_factory=list,
@@ -91,8 +93,10 @@ class BalAccountAbsentValues(CamelModel):
)
storage_changes: List[BalStorageSlot] = Field(
default_factory=list,
- description="List of storage slots/changes that should NOT exist in the BAL. "
- "Validates that none of these changes are present.",
+ description=(
+ "List of storage slots/changes that should NOT exist in the BAL. "
+ "Validates that none of these changes are present."
+ ),
)
storage_reads: List[StorageKey] = Field(
default_factory=list,
@@ -114,8 +118,8 @@ def validate_specific_absences_only(self) -> "BalAccountAbsentValues":
):
raise ValueError(
"At least one absence field must be specified. "
- "`BalAccountAbsentValues` is for checking specific forbidden values. "
- f"{EMPTY_LIST_ERROR_MSG}"
+ "`BalAccountAbsentValues` is for checking specific forbidden "
+ f"values. {EMPTY_LIST_ERROR_MSG}"
)
# check that no fields are explicitly set to empty lists
@@ -130,16 +134,17 @@ def validate_specific_absences_only(self) -> "BalAccountAbsentValues":
for field_name, field_value in field_checks:
if field_name in self.model_fields_set and field_value == []:
raise ValueError(
- f"`BalAccountAbsentValues.{field_name}` cannot be an empty list. "
- f"{EMPTY_LIST_ERROR_MSG}"
+ f"`BalAccountAbsentValues.{field_name}` cannot be an "
+ f"empty list. {EMPTY_LIST_ERROR_MSG}"
)
# validate that storage_changes don't have empty slot_changes
for storage_slot in self.storage_changes:
if not storage_slot.slot_changes:
raise ValueError(
- f"`BalAccountAbsentValues.storage_changes[{storage_slot.slot}].slot_changes` "
- f"cannot be an empty list. {EMPTY_LIST_ERROR_MSG}"
+ f"`BalAccountAbsentValues.storage_changes"
+ f"[{storage_slot.slot}].slot_changes` cannot be an empty "
+ f"list. {EMPTY_LIST_ERROR_MSG}"
)
return self
@@ -171,23 +176,35 @@ def validate_against(self, account: BalAccountChange) -> None:
self._validate_forbidden_changes(
account.nonce_changes,
self.nonce_changes,
- lambda a, f: a.block_access_index == f.block_access_index
- and a.post_nonce == f.post_nonce,
- lambda a: f"Unexpected nonce change found at tx {a.block_access_index}",
+ lambda a, f: (
+ a.block_access_index == f.block_access_index
+ and a.post_nonce == f.post_nonce
+ ),
+ lambda a: (
+ f"Unexpected nonce change found at tx {a.block_access_index}"
+ ),
)
self._validate_forbidden_changes(
account.balance_changes,
self.balance_changes,
- lambda a, f: a.block_access_index == f.block_access_index
- and a.post_balance == f.post_balance,
- lambda a: f"Unexpected balance change found at tx {a.block_access_index}",
+ lambda a, f: (
+ a.block_access_index == f.block_access_index
+ and a.post_balance == f.post_balance
+ ),
+ lambda a: (
+ f"Unexpected balance change found at tx {a.block_access_index}"
+ ),
)
self._validate_forbidden_changes(
account.code_changes,
self.code_changes,
- lambda a, f: a.block_access_index == f.block_access_index
- and a.new_code == f.new_code,
- lambda a: f"Unexpected code change found at tx {a.block_access_index}",
+ lambda a, f: (
+ a.block_access_index == f.block_access_index
+ and a.new_code == f.new_code
+ ),
+ lambda a: (
+ f"Unexpected code change found at tx {a.block_access_index}"
+ ),
)
for forbidden_storage_slot in self.storage_changes:
@@ -202,7 +219,8 @@ def validate_against(self, account: BalAccountChange) -> None:
and a.post_value == f.post_value
),
lambda a, slot=slot_id: (
- f"Unexpected storage change found at slot {slot} in tx {a.block_access_index}"
+ f"Unexpected storage change found at slot {slot} "
+ f"in tx {a.block_access_index}"
),
)
diff --git a/packages/testing/src/execution_testing/test_types/block_access_list/expectations.py b/packages/testing/src/execution_testing/test_types/block_access_list/expectations.py
index c700eec77bb..d2c6ce94308 100644
--- a/packages/testing/src/execution_testing/test_types/block_access_list/expectations.py
+++ b/packages/testing/src/execution_testing/test_types/block_access_list/expectations.py
@@ -48,7 +48,9 @@ class BalAccountExpectation(CamelModel):
)
absent_values: Optional[BalAccountAbsentValues] = Field(
default=None,
- description="Explicit absent value expectations using BalAccountAbsentValues",
+ description=(
+ "Explicit absent value expectations using BalAccountAbsentValues"
+ ),
)
_EMPTY: ClassVar[Optional["BalAccountExpectation"]] = None
@@ -108,7 +110,9 @@ class BlockAccessListExpectation(CamelModel):
expected_block_access_list = BlockAccessListExpectation(
account_expectations={
alice: BalAccountExpectation(
- nonce_changes=[BalNonceChange(block_access_index=1, post_nonce=1)]
+ nonce_changes=[
+ BalNonceChange(block_access_index=1, post_nonce=1)
+ ]
),
bob: None, # Bob should NOT be in the BAL
}
@@ -195,10 +199,10 @@ def verify_against(self, actual_bal: "BlockAccessList") -> None:
elif not expectation.model_fields_set:
# Disallow ambiguous BalAccountExpectation() with no fields set
raise BlockAccessListValidationError(
- f"Address {address}: BalAccountExpectation() with no fields set is "
- f"ambiguous. Use BalAccountExpectation.empty() to validate no changes, "
- f"or explicitly set the fields to validate "
- f"(e.g., nonce_changes=[...])."
+ f"Address {address}: BalAccountExpectation() with no "
+ "fields set is ambiguous. Use BalAccountExpectation."
+ "empty() to validate no changes, or explicitly set the "
+ "fields to validate (e.g., nonce_changes=[...])."
)
else:
# check address is present and validate changes
@@ -213,8 +217,9 @@ def verify_against(self, actual_bal: "BlockAccessList") -> None:
address
) != BalAccountChange(address=address):
raise BlockAccessListValidationError(
- f"No account changes expected for {address} but found "
- f"changes: {actual_accounts_by_addr[address]}"
+ f"No account changes expected for {address} but "
+ f"found changes: "
+ f"{actual_accounts_by_addr[address]}"
)
actual_account = actual_accounts_by_addr[address]
@@ -272,7 +277,8 @@ def _compare_account_expectations(
# Check if explicitly set to empty but actual has values
if not expected_list and actual_list:
raise BlockAccessListValidationError(
- f"Expected {field_name} to be empty but found {actual_list}"
+ f"Expected {field_name} to be empty but found "
+ f"{actual_list}"
)
if field_name == "storage_reads":
@@ -289,8 +295,8 @@ def _compare_account_expectations(
if not found:
raise BlockAccessListValidationError(
- f"Storage read {expected_read} not found or not in correct order. "
- f"Actual reads: {actual_list}"
+ f"Storage read {expected_read} not found or not "
+ f"in correct order. Actual reads: {actual_list}"
)
elif field_name == "storage_changes":
@@ -321,12 +327,20 @@ def _compare_account_expectations(
actual_change = actual_slot_changes[
slot_actual_idx
]
- if (
+ actual_ba_idx = (
actual_change.block_access_index
- == expected_change.block_access_index
- and actual_change.post_value
+ )
+ expected_ba_idx = (
+ expected_change.block_access_index
+ )
+ idx_match = (
+ actual_ba_idx == expected_ba_idx
+ )
+ val_match = (
+ actual_change.post_value
== expected_change.post_value
- ):
+ )
+ if idx_match and val_match:
slot_found = True
slot_actual_idx += 1
break
@@ -334,10 +348,12 @@ def _compare_account_expectations(
if not slot_found:
raise BlockAccessListValidationError(
- f"Storage change {expected_change} not found "
- f"or not in correct order in slot "
- f"{expected_slot.slot}. "
- f"Actual slot changes: {actual_slot_changes}"
+ f"Storage change "
+ f"{expected_change} not found or "
+ f"not in correct order in slot "
+ f"{expected_slot.slot}. Actual "
+ f"slot changes: "
+ f"{actual_slot_changes}"
)
found = True
@@ -402,8 +418,9 @@ def _compare_account_expectations(
if not found:
raise BlockAccessListValidationError(
- f"{item_type.capitalize()} change {exp_tuple} not found "
- f"or not in correct order. Actual changes: {actual_tuples}"
+ f"{item_type.capitalize()} change {exp_tuple} not "
+ f"found or not in correct order. Actual changes: "
+ f"{actual_tuples}"
)
diff --git a/packages/testing/src/execution_testing/test_types/block_access_list/modifiers.py b/packages/testing/src/execution_testing/test_types/block_access_list/modifiers.py
index ddad9605d46..550c21e8c80 100644
--- a/packages/testing/src/execution_testing/test_types/block_access_list/modifiers.py
+++ b/packages/testing/src/execution_testing/test_types/block_access_list/modifiers.py
@@ -47,7 +47,8 @@ def transform(bal: BlockAccessList) -> BlockAccessList:
# sanity check that we found all addresses specified
missing = set(addresses) - found_addresses
raise ValueError(
- f"Some specified addresses were not found in the BAL: {missing}"
+ f"Some specified addresses were not found in the BAL: "
+ f"{missing}"
)
return BlockAccessList(root=new_root)
@@ -93,7 +94,9 @@ def transform(bal: BlockAccessList) -> BlockAccessList:
== block_access_index
):
kwargs = {
- "block_access_index": block_access_index,
+ "block_access_index": (
+ block_access_index
+ ),
value_field: new_value,
}
storage_slot.slot_changes[j] = (
@@ -298,8 +301,8 @@ def transform(bal: BlockAccessList) -> BlockAccessList:
ZeroPaddedHexNumber(idx1)
)
- # Note: storage_reads is just a list of StorageKey, no block_access_index to
- # swap
+ # Note: storage_reads is just a list of StorageKey, no
+ # block_access_index to swap
# Swap in code changes
if new_account.code_changes:
@@ -317,7 +320,8 @@ def transform(bal: BlockAccessList) -> BlockAccessList:
new_root.append(new_account)
- # Validate that at least one swap occurred for each index across all change types
+ # Validate at least one swap occurred for each index across all
+ # change types
idx1_found = (
nonce_indices[idx1]
or balance_indices[idx1]
@@ -333,11 +337,13 @@ def transform(bal: BlockAccessList) -> BlockAccessList:
if not idx1_found:
raise ValueError(
- f"Block access index {idx1} not found in any BAL changes to swap"
+ f"Block access index {idx1} not found in any BAL changes "
+ "to swap"
)
if not idx2_found:
raise ValueError(
- f"Block access index {idx2} not found in any BAL changes to swap"
+ f"Block access index {idx2} not found in any BAL changes "
+ "to swap"
)
return BlockAccessList(root=new_root)
@@ -365,8 +371,9 @@ def append_change(
"""
Append a change to an account's field list.
- Generic function to add extraneous entries to nonce_changes, balance_changes,
- or code_changes fields. The field is inferred from the change type.
+ Generic function to add extraneous entries to nonce_changes,
+ balance_changes, or code_changes fields. The field is inferred from the
+ change type.
"""
# Infer field name from change type
if isinstance(change, BalNonceChange):
@@ -396,7 +403,8 @@ def transform(bal: BlockAccessList) -> BlockAccessList:
if not found_address:
raise ValueError(
- f"Address {account} not found in BAL to append change to {field}"
+ f"Address {account} not found in BAL to append change to "
+ f"{field}"
)
return BlockAccessList(root=new_root)
@@ -415,7 +423,8 @@ def append_storage(
Generic function for all storage operations:
- If read=True: appends to storage_reads
- - If change provided and slot exists: appends to existing slot's slot_changes
+ - If change provided and slot exists: appends to existing slot's
+ slot_changes
- If change provided and slot new: creates new BalStorageSlot
"""
found_address = False
diff --git a/packages/testing/src/execution_testing/test_types/block_access_list/t8n.py b/packages/testing/src/execution_testing/test_types/block_access_list/t8n.py
index 19733a240f3..7d1cb2bc071 100644
--- a/packages/testing/src/execution_testing/test_types/block_access_list/t8n.py
+++ b/packages/testing/src/execution_testing/test_types/block_access_list/t8n.py
@@ -63,6 +63,7 @@ def validate_structure(self) -> None:
Raises:
BlockAccessListValidationError: If validation fails
+
"""
# Check address ordering (ascending)
for i in range(1, len(self.root)):
@@ -89,8 +90,9 @@ def validate_structure(self) -> None:
# Check both ordering and duplicates
if bal_indices != sorted(bal_indices):
raise BlockAccessListValidationError(
- f"Block access indices not in ascending order in {field_name} of account "
- f"{account.address}. Got: {bal_indices}, Expected: {sorted(bal_indices)}"
+ f"Block access indices not in ascending order in "
+ f"{field_name} of account {account.address}. Got: "
+ f"{bal_indices}, Expected: {sorted(bal_indices)}"
)
if len(bal_indices) != len(set(bal_indices)):
@@ -102,8 +104,8 @@ def validate_structure(self) -> None:
}
)
raise BlockAccessListValidationError(
- f"Duplicate transaction indices in {field_name} of account "
- f"{account.address}. Duplicates: {duplicates}"
+ f"Duplicate transaction indices in {field_name} of "
+ f"account {account.address}. Duplicates: {duplicates}"
)
# Check storage slot ordering
@@ -114,7 +116,8 @@ def validate_structure(self) -> None:
):
raise BlockAccessListValidationError(
f"Storage slots not in ascending order in account "
- f"{account.address}: {account.storage_changes[i - 1].slot} >= "
+ f"{account.address}: "
+ f"{account.storage_changes[i - 1].slot} >= "
f"{account.storage_changes[i].slot}"
)
@@ -130,9 +133,10 @@ def validate_structure(self) -> None:
# Check both ordering and duplicates
if bal_indices != sorted(bal_indices):
raise BlockAccessListValidationError(
- f"Transaction indices not in ascending order in storage slot "
- f"{storage_slot.slot} of account {account.address}. "
- f"Got: {bal_indices}, Expected: {sorted(bal_indices)}"
+ f"Transaction indices not in ascending order in "
+ f"storage slot {storage_slot.slot} of account "
+ f"{account.address}. Got: {bal_indices}, Expected: "
+ f"{sorted(bal_indices)}"
)
if len(bal_indices) != len(set(bal_indices)):
@@ -154,6 +158,7 @@ def validate_structure(self) -> None:
if account.storage_reads[i - 1] >= account.storage_reads[i]:
raise BlockAccessListValidationError(
f"Storage reads not in ascending order in account "
- f"{account.address}: {account.storage_reads[i - 1]} >= "
+ f"{account.address}: "
+ f"{account.storage_reads[i - 1]} >= "
f"{account.storage_reads[i]}"
)
diff --git a/packages/testing/src/execution_testing/test_types/receipt_types.py b/packages/testing/src/execution_testing/test_types/receipt_types.py
index 4343b25d8dd..66b1216daf4 100644
--- a/packages/testing/src/execution_testing/test_types/receipt_types.py
+++ b/packages/testing/src/execution_testing/test_types/receipt_types.py
@@ -42,7 +42,7 @@ class TransactionReceipt(CamelModel):
@model_validator(mode="before")
@classmethod
def strip_extra_fields(cls, data: Any) -> Any:
- """Strip extra fields from t8n tool output that are not part of the model."""
+ """Strip extra fields from t8n tool output not part of model."""
if isinstance(data, dict):
# t8n tool returns 'succeeded' which is redundant with 'status'
data.pop("succeeded", None)
diff --git a/packages/testing/src/execution_testing/test_types/tests/test_blob_types.py b/packages/testing/src/execution_testing/test_types/tests/test_blob_types.py
index 60490120f08..bcc2b2d1639 100644
--- a/packages/testing/src/execution_testing/test_types/tests/test_blob_types.py
+++ b/packages/testing/src/execution_testing/test_types/tests/test_blob_types.py
@@ -68,8 +68,8 @@ def wait_until_counter_reached(target: int, poll_interval: float = 0.1) -> int:
pytest.fail(
f"The blob_unit_test lock counter is too high! "
f"Expected {target}, but got {current_value}. "
- f"It probably reused an existing file that was not cleared. "
- f"Delete {file_path} manually to fix this."
+ f"It probably reused an existing file that was "
+ f"not cleared. Delete {file_path} to fix this."
)
except Exception:
current_value = 0
@@ -132,8 +132,8 @@ def test_blob_proof_corruption(
b.corrupt_proof(corruption_mode)
assert b.proof != old_valid_proof, (
- f"Proof corruption mode {corruption_mode} for fork {fork.name()} failed, "
- "proof is unchanged!"
+ f"Proof corruption mode {corruption_mode} for fork {fork.name()} "
+ "failed, proof is unchanged!"
)
increment_counter()
@@ -169,8 +169,8 @@ def test_transition_fork_blobs(
if not pre_transition_fork.supports_blobs() and timestamp < 15000:
print(
- f"Skipping blob creation because pre-transition fork is {pre_transition_fork} "
- f"and timestamp is {timestamp}"
+ f"Skipping blob creation because pre-transition fork is "
+ f"{pre_transition_fork} and timestamp is {timestamp}"
)
return
@@ -180,14 +180,17 @@ def test_transition_fork_blobs(
if timestamp == 14999: # case: no transition yet
assert b.fork.name() == pre_transition_fork.name(), (
- f"Transition fork failure! Fork {fork.name()} at timestamp: {timestamp} should have "
- f"stayed at fork {pre_transition_fork.name()} but has unexpectedly transitioned "
+ f"Transition fork failure! Fork {fork.name()} at timestamp: "
+ f"{timestamp} should have stayed at fork "
+ f"{pre_transition_fork.name()} but has unexpectedly transitioned "
f"to {b.fork.name()}"
)
elif timestamp == 15000: # case: transition to next fork has happened
assert b.fork.name() == post_transition_fork_at_15k.name(), (
- f"Transition fork failure! Fork {fork.name()} at timestamp: {timestamp} should have "
- f"transitioned to {post_transition_fork_at_15k.name()} but is still at {b.fork.name()}"
+ f"Transition fork failure! Fork {fork.name()} at timestamp: "
+ f"{timestamp} should have transitioned to "
+ f"{post_transition_fork_at_15k.name()} but is still at "
+ f"{b.fork.name()}"
)
# delete counter at last iteration (otherwise re-running all unit tests
diff --git a/packages/testing/src/execution_testing/test_types/tests/test_block_access_list_serialization.py b/packages/testing/src/execution_testing/test_types/tests/test_block_access_list_serialization.py
index a42d86ff650..d454a097ce1 100644
--- a/packages/testing/src/execution_testing/test_types/tests/test_block_access_list_serialization.py
+++ b/packages/testing/src/execution_testing/test_types/tests/test_block_access_list_serialization.py
@@ -19,7 +19,7 @@
def test_bal_serialization_roundtrip_zero_padded_hex() -> None:
"""
- Test that BAL serializes with zero-padded hex format and round-trips correctly.
+ Test BAL serializes with zero-padded hex format and round-trips correctly.
This verifies that values like 12 serialize as "0x0c" (not "0xc"), which is
required for consistency with other test vector fields.
diff --git a/packages/testing/src/execution_testing/test_types/tests/test_block_access_list_t8n.py b/packages/testing/src/execution_testing/test_types/tests/test_block_access_list_t8n.py
index 942abf6bb2e..b959b39b435 100644
--- a/packages/testing/src/execution_testing/test_types/tests/test_block_access_list_t8n.py
+++ b/packages/testing/src/execution_testing/test_types/tests/test_block_access_list_t8n.py
@@ -129,7 +129,7 @@ def test_bal_storage_reads_ordering() -> None:
)
def test_bal_block_access_indices_ordering(field_name: str) -> None:
"""
- Test that transaction indices must be in ascending order within change lists.
+ Test tx indices must be in ascending order within change lists.
"""
addr = Address(0xA)
@@ -281,20 +281,24 @@ def test_bal_duplicate_block_access_indices(field_name: str) -> None:
[BalAccountChange(address=addr, **{field_name: changes})]
)
+ match_pattern = (
+ f"Duplicate transaction indices in {field_name}.*Duplicates: \\[1\\]"
+ )
with pytest.raises(
BlockAccessListValidationError,
- match=f"Duplicate transaction indices in {field_name}.*Duplicates: \\[1\\]",
+ match=match_pattern,
):
bal.validate_structure()
def test_bal_storage_duplicate_block_access_indices() -> None:
"""
- Test that storage changes must not have duplicate tx indices within same slot.
+ Test storage changes must not have duplicate tx indices within same slot.
"""
addr = Address(0xA)
- # Create storage changes with duplicate block_access_index within the same slot
+ # Create storage changes with duplicate block_access_index within
+ # the same slot
bal = BlockAccessList(
[
BalAccountChange(
@@ -322,9 +326,12 @@ def test_bal_storage_duplicate_block_access_indices() -> None:
]
)
+ match_pattern = (
+ "Duplicate transaction indices in storage slot.*Duplicates: \\[1\\]"
+ )
with pytest.raises(
BlockAccessListValidationError,
- match="Duplicate transaction indices in storage slot.*Duplicates: \\[1\\]",
+ match=match_pattern,
):
bal.validate_structure()
diff --git a/packages/testing/src/execution_testing/test_types/tests/test_helpers.py b/packages/testing/src/execution_testing/test_types/tests/test_helpers.py
index f14c58dc6e4..f85cb6e1d03 100644
--- a/packages/testing/src/execution_testing/test_types/tests/test_helpers.py
+++ b/packages/testing/src/execution_testing/test_types/tests/test_helpers.py
@@ -61,7 +61,7 @@ def test_address() -> None:
"0x06012c8cf97bead5deae237070f9587f8e7a266d",
id="large-nonce-0x-str-address",
marks=pytest.mark.xfail(
- reason="Nonce too large to convert with hard-coded to_bytes length of 1"
+ reason="Nonce too large for hard-coded to_bytes length of 1"
),
),
],
@@ -145,7 +145,7 @@ def test_compute_create2_address(
https://github.com/ethereum/go-ethereum/blob/2189773093b2fe6d161b6477589f964470ff5bce/core/vm/instructions_test.go.
Note: `compute_create2_address` does not generate checksum addresses.
- """
+ """ # noqa: E501
salt_as_int = int(salt, 16)
initcode_as_bytes = bytes.fromhex(initcode[2:])
assert (
diff --git a/packages/testing/src/execution_testing/test_types/tests/test_post_alloc.py b/packages/testing/src/execution_testing/test_types/tests/test_post_alloc.py
index c36fdf0684e..045a0560600 100644
--- a/packages/testing/src/execution_testing/test_types/tests/test_post_alloc.py
+++ b/packages/testing/src/execution_testing/test_types/tests/test_post_alloc.py
@@ -30,7 +30,9 @@ def alloc(request: pytest.FixtureRequest) -> Alloc:
# Account should not exist but contained in alloc
(
{
- "0x0000000000000000000000000000000000000000": Account.NONEXISTENT
+ "0x0000000000000000000000000000000000000000": ( # noqa: E501
+ Account.NONEXISTENT
+ )
},
{
"0x0000000000000000000000000000000000000000": {
@@ -45,7 +47,9 @@ def alloc(request: pytest.FixtureRequest) -> Alloc:
# Account should not exist but contained in alloc
(
{
- "0x0000000000000000000000000000000000000000": Account.NONEXISTENT
+ "0x0000000000000000000000000000000000000000": ( # noqa: E501
+ Account.NONEXISTENT
+ )
},
{"0x0000000000000000000000000000000000000000": {"nonce": "1"}},
Alloc.UnexpectedAccountError,
@@ -53,7 +57,9 @@ def alloc(request: pytest.FixtureRequest) -> Alloc:
# Account should not exist but contained in alloc
(
{
- "0x0000000000000000000000000000000000000001": Account.NONEXISTENT
+ "0x0000000000000000000000000000000000000001": ( # noqa: E501
+ Account.NONEXISTENT
+ )
},
{"0x0000000000000000000000000000000000000001": {"balance": "1"}},
Alloc.UnexpectedAccountError,
@@ -61,7 +67,9 @@ def alloc(request: pytest.FixtureRequest) -> Alloc:
# Account should not exist but contained in alloc
(
{
- "0x000000000000000000000000000000000000000a": Account.NONEXISTENT
+ "0x000000000000000000000000000000000000000a": ( # noqa: E501
+ Account.NONEXISTENT
+ )
},
{"0x000000000000000000000000000000000000000A": {"code": "0x00"}},
Alloc.UnexpectedAccountError,
diff --git a/packages/testing/src/execution_testing/test_types/tests/test_types.py b/packages/testing/src/execution_testing/test_types/tests/test_types.py
index e3e3cf5156c..83ba6dc3011 100644
--- a/packages/testing/src/execution_testing/test_types/tests/test_types.py
+++ b/packages/testing/src/execution_testing/test_types/tests/test_types.py
@@ -468,7 +468,7 @@ def test_account_merge(
True,
Environment(),
{
- "currentCoinbase": "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
+ "currentCoinbase": "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", # noqa: E501
"currentGasLimit": str(
ZeroPaddedHexNumber(Environment().gas_limit)
),
@@ -507,7 +507,7 @@ def test_account_merge(
block_hashes={1: 2, 3: 4},
),
{
- "currentCoinbase": "0x0000000000000000000000000000000000001234",
+ "currentCoinbase": "0x0000000000000000000000000000000000001234", # noqa: E501
"currentGasLimit": str(
ZeroPaddedHexNumber(Environment().gas_limit)
),
@@ -528,7 +528,7 @@ def test_account_merge(
{
"index": "0x0",
"validatorIndex": "0x1",
- "address": "0x0000000000000000000000000000000000001234",
+ "address": "0x0000000000000000000000000000000000001234", # noqa: E501
"amount": "0x2",
},
],
@@ -537,10 +537,10 @@ def test_account_merge(
"currentBlobGasUsed": "0x10",
"currentExcessBlobGas": "0x11",
"blockHashes": {
- "0x01": "0x0000000000000000000000000000000000000000000000000000000000000002",
- "0x03": "0x0000000000000000000000000000000000000000000000000000000000000004",
+ "0x01": "0x0000000000000000000000000000000000000000000000000000000000000002", # noqa: E501
+ "0x03": "0x0000000000000000000000000000000000000000000000000000000000000004", # noqa: E501
},
- "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000004",
+ "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000004", # noqa: E501
"ommers": [],
},
id="environment_2",
@@ -558,8 +558,8 @@ def test_account_merge(
"gas": "0x5208",
"gasPrice": "0xa",
"v": "0x26",
- "r": "0xcc61d852649c34cc0b71803115f38036ace257d2914f087bf885e6806a664fbd",
- "s": "0x2020cb35f5d7731ab540d62614503a7f2344301a86342f67daf011c1341551ff",
+ "r": "0xcc61d852649c34cc0b71803115f38036ace257d2914f087bf885e6806a664fbd", # noqa: E501
+ "s": "0x2020cb35f5d7731ab540d62614503a7f2344301a86342f67daf011c1341551ff", # noqa: E501
"sender": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
},
id="transaction_t8n_default_args",
@@ -579,8 +579,8 @@ def test_account_merge(
"gas": "0x5208",
"gasPrice": "0xa",
"v": "0x25",
- "r": "0x1cfe2cbb0c3577f74d9ae192a7f1ee2d670fe806a040f427af9cb768be3d07ce",
- "s": "0xcbe2d029f52dbf93ade486625bed0603945d2c7358b31de99fe8786c00f13da",
+ "r": "0x1cfe2cbb0c3577f74d9ae192a7f1ee2d670fe806a040f427af9cb768be3d07ce", # noqa: E501
+ "s": "0xcbe2d029f52dbf93ade486625bed0603945d2c7358b31de99fe8786c00f13da", # noqa: E501
"sender": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
},
id="transaction_t8n_to_none",
@@ -600,8 +600,8 @@ def test_account_merge(
"gas": "0x5208",
"gasPrice": "0xa",
"v": "0x25",
- "r": "0x1cfe2cbb0c3577f74d9ae192a7f1ee2d670fe806a040f427af9cb768be3d07ce",
- "s": "0xcbe2d029f52dbf93ade486625bed0603945d2c7358b31de99fe8786c00f13da",
+ "r": "0x1cfe2cbb0c3577f74d9ae192a7f1ee2d670fe806a040f427af9cb768be3d07ce", # noqa: E501
+ "s": "0xcbe2d029f52dbf93ade486625bed0603945d2c7358b31de99fe8786c00f13da", # noqa: E501
"sender": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
},
id="transaction_t8n_to_empty_str",
@@ -629,7 +629,7 @@ def test_account_merge(
"to": "0x0000000000000000000000000000000000001234",
"accessList": [
{
- "address": "0x0000000000000000000000000000000000001234",
+ "address": "0x0000000000000000000000000000000000001234", # noqa: E501
"storageKeys": [
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000001",
@@ -647,8 +647,8 @@ def test_account_merge(
"0x0000000000000000000000000000000000000000000000000000000000000001",
],
"v": "0x0",
- "r": "0x418bb557c43262375f80556cb09dac5e67396acf0eaaf2c2540523d1ce54b280",
- "s": "0x4fa36090ea68a1138043d943ced123c0b0807d82ff3342a6977cbc09230e927c",
+ "r": "0x418bb557c43262375f80556cb09dac5e67396acf0eaaf2c2540523d1ce54b280", # noqa: E501
+ "s": "0x4fa36090ea68a1138043d943ced123c0b0807d82ff3342a6977cbc09230e927c", # noqa: E501
"sender": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
},
id="transaction_3",
@@ -677,7 +677,8 @@ def test_json_deserialization(
"""Test that to_json returns the expected JSON for the given object."""
if not can_be_deserialized:
pytest.skip(
- reason="The model instance in this case can not be deserialized"
+ reason="The model instance in this case can not be "
+ "deserialized"
)
model_type = type(model_instance)
assert model_type(**json) == model_instance
diff --git a/packages/testing/src/execution_testing/test_types/transaction_types.py b/packages/testing/src/execution_testing/test_types/transaction_types.py
index aa4ef542fbd..cb1267b94dc 100644
--- a/packages/testing/src/execution_testing/test_types/transaction_types.py
+++ b/packages/testing/src/execution_testing/test_types/transaction_types.py
@@ -1,9 +1,9 @@
"""Transaction-related types for Ethereum tests."""
+import numbers
from dataclasses import dataclass
from enum import IntEnum
from functools import cached_property
-import numbers
from typing import Any, ClassVar, Dict, Generic, List, Literal, Self, Sequence
import ethereum_rlp as eth_rlp
@@ -832,7 +832,8 @@ def signer_minimum_balance(self, *, fork: Fork) -> int:
if self.ty == 3 and self.blob_versioned_hashes is not None:
max_fee_per_blob_gas = self.max_fee_per_blob_gas
assert max_fee_per_blob_gas is not None, (
- "Impossible to calculate minimum balance without max_fee_per_blob_gas"
+ "Impossible to calculate minimum balance without "
+ "max_fee_per_blob_gas"
)
return (
gas_price * gas_limit
@@ -1008,7 +1009,7 @@ def set_gas_price(
max_priority_fee_per_gas: int,
max_fee_per_blob_gas: int,
) -> None:
- """Set the gas price to the appropriate values of the current execution environment."""
+ """Set gas price to values of the current execution environment."""
self.tx.set_gas_price(
gas_price=gas_price,
max_fee_per_gas=max_fee_per_gas,
diff --git a/packages/testing/src/execution_testing/tools/tests/test_code.py b/packages/testing/src/execution_testing/tools/tests/test_code.py
index 45d0e88e26e..08b423e7d10 100644
--- a/packages/testing/src/execution_testing/tools/tests/test_code.py
+++ b/packages/testing/src/execution_testing/tools/tests/test_code.py
@@ -496,7 +496,8 @@ def test_opcodes_if(conditional_bytecode: bytes, expected: bytes) -> None:
default_action=Op.SSTORE(0, 6),
),
{0: 3},
- id="five-cases-multiple-conditions-met", # first in list should be evaluated
+ # first in list should be evaluated
+ id="five-cases-multiple-conditions-met",
),
pytest.param(
Hash(9),
diff --git a/packages/testing/src/execution_testing/tools/utility/generators.py b/packages/testing/src/execution_testing/tools/utility/generators.py
index 003225f7dcb..8819dfe04ad 100644
--- a/packages/testing/src/execution_testing/tools/utility/generators.py
+++ b/packages/testing/src/execution_testing/tools/utility/generators.py
@@ -360,8 +360,9 @@ def wrapper(
# storage, we need to add some NO-OP (JUMPDEST) to the code
# that each consume 1 gas.
assert gas_costs.G_JUMPDEST == 1, (
- f"JUMPDEST gas cost should be 1, but got {gas_costs.G_JUMPDEST}. "
- "Generator `generate_system_contract_error_test` needs to be updated."
+ "JUMPDEST gas cost should be 1, but got "
+ f"{gas_costs.G_JUMPDEST}. Generator "
+ "`generate_system_contract_error_test` needs updating."
)
modified_system_contract_code += sum(
Op.JUMPDEST
@@ -495,14 +496,14 @@ def gas_test(
# 2 times GAS, POP, CALL, 6 times PUSH1 - instructions charged for at every
# gas run
gas_costs = fork.gas_costs()
- OPCODE_GAS_COST = gas_costs.G_BASE
- OPCODE_POP_COST = gas_costs.G_BASE
- OPCODE_PUSH_COST = gas_costs.G_VERY_LOW
+ opcode_gas_cost = gas_costs.G_BASE
+ opcode_pop_cost = gas_costs.G_BASE
+ opcode_push_cost = gas_costs.G_VERY_LOW
gas_single_gas_run = (
- 2 * OPCODE_GAS_COST
- + OPCODE_POP_COST
+ 2 * opcode_gas_cost
+ + opcode_pop_cost
+ gas_costs.G_WARM_ACCOUNT_ACCESS
- + 6 * OPCODE_PUSH_COST
+ + 6 * opcode_push_cost
)
address_legacy_harness = pre.deploy_contract(
code=(
diff --git a/packages/testing/src/execution_testing/tools/utility/pytest.py b/packages/testing/src/execution_testing/tools/utility/pytest.py
index 2f62fef52b0..ac6c708bdd4 100644
--- a/packages/testing/src/execution_testing/tools/utility/pytest.py
+++ b/packages/testing/src/execution_testing/tools/utility/pytest.py
@@ -131,7 +131,8 @@ def test_range(min_value, max_value, average):
for i, case in enumerate(cases):
if not (len(case.values) == 1 and isinstance(case.values[0], dict)):
raise ValueError(
- "each case must contain exactly one value; a dict of parameter values"
+ "each case must contain exactly one value; "
+ "a dict of parameter values"
)
if set(case.values[0].keys()) - set(defaults.keys()):
raise UnknownParameterInCasesError()
diff --git a/packages/testing/src/execution_testing/tools/utility/tests/test_pytest.py b/packages/testing/src/execution_testing/tools/utility/tests/test_pytest.py
index 5ba3d233a74..09ad5c0957e 100644
--- a/packages/testing/src/execution_testing/tools/utility/tests/test_pytest.py
+++ b/packages/testing/src/execution_testing/tools/utility/tests/test_pytest.py
@@ -164,9 +164,9 @@ def test_extend_with_defaults_raises_for_unknown_default() -> None: # noqa: D10
),
],
)
-def test_extend_with_defaults_raises_value_error(
+def test_extend_with_defaults_raises_value_error( # noqa: D103
defaults: dict, cases: list
-) -> None: # noqa: D103
+) -> None:
expected_message = (
"each case must contain exactly one value; a dict of parameter values"
)
diff --git a/packages/testing/src/execution_testing/tools/utility/versioning.py b/packages/testing/src/execution_testing/tools/utility/versioning.py
index 991474bf6e2..d8399e8e3d5 100644
--- a/packages/testing/src/execution_testing/tools/utility/versioning.py
+++ b/packages/testing/src/execution_testing/tools/utility/versioning.py
@@ -33,7 +33,7 @@ def get_current_commit_hash_or_tag(
)
except InvalidGitRepositoryError:
# Handle the case where the repository is not a valid Git repository
- return "Not a git repository; this should only be seen in framework tests."
+ return "Not a git repository; only seen in framework tests."
def generate_github_url(
diff --git a/packages/testing/src/execution_testing/vm/tests/test_vm.py b/packages/testing/src/execution_testing/vm/tests/test_vm.py
index 5e30845f86d..837de4b25e1 100644
--- a/packages/testing/src/execution_testing/vm/tests/test_vm.py
+++ b/packages/testing/src/execution_testing/vm/tests/test_vm.py
@@ -80,7 +80,7 @@
+ [0xFF] * 32
+ [0x55]
),
- id="SSTORE(-1, CALL(GAS, ADDRESS, PUSH1(0x20), 0, 0, 0x20, 0x1234))",
+ id="SSTORE(-1, CALL(GAS, ADDRESS, PUSH1(0x20), 0, 0, 0x20, 0x1234))", # noqa: E501
),
pytest.param(
Op.CALL(Op.GAS, Op.PUSH20(0x1234), 0, 0, 0, 0, 32),
@@ -395,7 +395,7 @@ def test_opcode_kwargs_validation() -> None:
with pytest.raises(
ValueError,
- match=r"Invalid keyword argument\(s\) \['wrong_arg'\] for opcode MSTORE",
+ match=r"Invalid keyword argument\(s\) \['wrong_arg'\] for opcode MSTORE", # noqa: E501
):
Op.MSTORE(offset=0, value=1, wrong_arg=2)
diff --git a/packages/testing/stubs/requests_unixsocket/__init__.pyi b/packages/testing/stubs/requests_unixsocket/__init__.pyi
index 2937cd54818..c05719f59ee 100644
--- a/packages/testing/stubs/requests_unixsocket/__init__.pyi
+++ b/packages/testing/stubs/requests_unixsocket/__init__.pyi
@@ -1,8 +1,9 @@
+from typing import Callable, Self, Tuple
+
import requests
-from typing import Tuple, Callable, Self
-from requests.sessions import _Data
from _typeshed import Incomplete
from requests.models import _JSON, Response
+from requests.sessions import _Data
DEFAULT_SCHEME: str
@@ -11,7 +12,7 @@ class Session(requests.Session):
self, url_scheme: str = ..., *args: Incomplete, **kwargs: Incomplete
) -> None: ...
-class monkeypatch:
+class monkeypatch: # noqa: N801
session: Session
methods: Tuple[str | bytes, ...]
orig_methods: dict[str | bytes, Callable]
diff --git a/packages/testing/stubs/requests_unixsocket/adapters.pyi b/packages/testing/stubs/requests_unixsocket/adapters.pyi
index 38325850c39..8a87712e415 100644
--- a/packages/testing/stubs/requests_unixsocket/adapters.pyi
+++ b/packages/testing/stubs/requests_unixsocket/adapters.pyi
@@ -1,12 +1,13 @@
+from socket import socket
+from typing import Mapping, Tuple
+
import urllib3
-from typing import Tuple, Mapping
from _typeshed import Incomplete
from requests.adapters import HTTPAdapter
from requests.models import PreparedRequest
-from urllib3.util import Timeout
-from urllib3.connectionpool import HTTPConnectionPool
from urllib3._collections import RecentlyUsedContainer
-from socket import socket
+from urllib3.connectionpool import HTTPConnectionPool
+from urllib3.util import Timeout
class UnixHTTPConnection(urllib3.connection.HTTPConnection):
unix_socket_url: str