Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1424,7 +1424,6 @@ def base_test_parametrizer_func(
fixture_source_url: str,
gas_benchmark_value: int,
fixed_opcode_count: int | None,
witness_generator: Any,
) -> Any:
"""
Fixture used to instantiate an auto-fillable BaseTest object from
Expand Down Expand Up @@ -1577,11 +1576,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
_info_metadata=t8n._info_metadata,
)

# Generate witness data if witness functionality is enabled via
# the witness plugin
if witness_generator is not None:
witness_generator(fixture)

fixture_path = fixture_collector.add_fixture(
node_to_test_info(request.node),
fixture,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ def pytest_configure(config: pytest.Config) -> None:
"defining debug",
"pre-allocation behavior during test filling",
"ported",
"witness",
"benchmark",
],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ addopts =
-p execution_testing.cli.pytest_commands.plugins.forks.forks
-p execution_testing.cli.pytest_commands.plugins.concurrency
-p execution_testing.cli.pytest_commands.plugins.filler.pre_alloc
-p execution_testing.cli.pytest_commands.plugins.filler.witness
-p execution_testing.cli.pytest_commands.plugins.filler.ported_tests
-p execution_testing.cli.pytest_commands.plugins.filler.static_filler
-p execution_testing.cli.pytest_commands.plugins.shared.benchmarking
Expand Down
20 changes: 0 additions & 20 deletions packages/testing/src/execution_testing/fixtures/blockchain.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""BlockchainTest types."""

import json
from functools import cached_property
from typing import (
Annotated,
Expand Down Expand Up @@ -597,24 +596,6 @@ def from_withdrawal(cls, w: WithdrawalGeneric) -> Self:
return cls(**w.model_dump())


class WitnessChunk(CamelModel):
"""Represents execution witness data for a block."""

state: List[str]
codes: List[str]
keys: List[str]
headers: List[str]

@classmethod
def parse_witness_chunks(cls, s: str) -> List[Self]:
"""
Parse multiple witness chunks from JSON string.
Returns a list of WitnessChunk instances parsed from the JSON array.
"""
return [cls(**obj) for obj in json.loads(s)]


class FixtureBlockBase(CamelModel):
"""
Representation of an Ethereum block within a test Fixture without RLP
Expand Down Expand Up @@ -643,7 +624,6 @@ def strip_block_number_computed_field(cls, data: Any) -> Any:
)
withdrawals: List[FixtureWithdrawal] | None = None
receipts: List[FixtureTransactionReceipt] | None = None
execution_witness: WitnessChunk | None = None
block_access_list: BlockAccessList | None = Field(
None, description="EIP-7928 Block Access List"
)
Expand Down
5 changes: 5 additions & 0 deletions packages/testing/src/execution_testing/specs/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ class BenchmarkTest(BaseTest):
fixed_opcode_count: float | None = None
target_opcode: Op | None = None
code_generator: BenchmarkCodeGenerator | None = None
# By default, benchmark tests require neither of these
include_full_post_state_in_output: bool = False
include_tx_receipts_in_output: bool = False

supported_fixture_formats: ClassVar[
Sequence[FixtureFormat | LabeledFixtureFormat]
Expand Down Expand Up @@ -491,6 +494,8 @@ def generate_blockchain_test(self) -> BlockchainTest:
pre=self.pre,
post=self.post,
blocks=self.blocks,
include_full_post_state_in_output=self.include_full_post_state_in_output,
include_tx_receipts_in_output=self.include_tx_receipts_in_output,
)

def _verify_target_opcode_count(
Expand Down
45 changes: 33 additions & 12 deletions packages/testing/src/execution_testing/specs/blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,11 @@ class Block(Header):
If set, the block is expected to produce an error response from the Engine
API.
"""
include_receipts_in_output: bool | None = None
"""
If set to `True`, the block’s output fixture representation will include
full transaction receipts. If unset, the test-level value is used.
"""
txs: List[Transaction] = Field(default_factory=list)
"""List of transactions included in the block."""
ommers: List[Header] | None = None
Expand Down Expand Up @@ -378,7 +383,9 @@ class BuiltBlock(CamelModel):
fork: Fork
block_access_list: BlockAccessList | None

def get_fixture_block(self) -> FixtureBlock | InvalidFixtureBlock:
def get_fixture_block(
self, *, include_receipts: bool = True
) -> FixtureBlock | InvalidFixtureBlock:
"""Get a FixtureBlockBase from the built block."""
fixture_block = FixtureBlockBase(
header=self.header,
Expand All @@ -398,7 +405,7 @@ def get_fixture_block(self) -> FixtureBlock | InvalidFixtureBlock:
)
for i, r in enumerate(self.result.receipts)
]
if self.result.receipts
if self.result.receipts and include_receipts
else None
),
block_access_list=self.block_access_list
Expand Down Expand Up @@ -499,11 +506,15 @@ class BlockchainTest(BaseTest):
blocks: List[Block]
genesis_environment: Environment = Field(default_factory=Environment)
chain_id: int = 1
exclude_full_post_state_in_output: bool = False
include_full_post_state_in_output: bool = True
"""
Exclude the post state from the fixture output. In this case, the state
Include the post state in the fixture output. Otherwise, the state
verification is only performed based on the state root.
"""
include_tx_receipts_in_output: bool = True
"""
Include transaction receipts in the fixture output.
"""

_benchmark_opcode_count: OpcodeCount | None = PrivateAttr(None)

Expand Down Expand Up @@ -872,6 +883,7 @@ def make_fixture(
head = genesis.header.block_hash
invalid_blocks = 0
for i, block in enumerate(self.blocks):
is_last_block = i == len(self.blocks) - 1
# This is the most common case, the RLP needs to be constructed
# based on the transactions to be included in the block.
# Set the environment according to the block to execute.
Expand All @@ -880,9 +892,18 @@ def make_fixture(
block=block,
previous_env=env,
previous_alloc=alloc,
last_block=i == len(self.blocks) - 1,
last_block=is_last_block,
)
include_receipts = (
block.include_receipts_in_output
if block.include_receipts_in_output is not None
else self.include_tx_receipts_in_output
)
fixture_blocks.append(
built_block.get_fixture_block(
include_receipts=include_receipts
)
)
fixture_blocks.append(built_block.get_fixture_block())

# BAL verification already done in to_fixture_bal() if
# expected_block_access_list set
Expand Down Expand Up @@ -918,10 +939,10 @@ def make_fixture(
last_block_hash=head,
pre=pre,
post_state=alloc
if not self.exclude_full_post_state_in_output
if self.include_full_post_state_in_output
else None,
post_state_hash=state_root
if self.exclude_full_post_state_in_output
if not self.include_full_post_state_in_output
else None,
config=FixtureConfig(
fork=self.fork,
Expand Down Expand Up @@ -1004,7 +1025,7 @@ def make_hive_fixture(
"payloads": fixture_payloads,
"last_block_hash": head_hash,
"post_state_hash": state_root
if self.exclude_full_post_state_in_output
if not self.include_full_post_state_in_output
else None,
"config": FixtureConfig(
fork=self.fork,
Expand All @@ -1023,7 +1044,7 @@ def make_hive_fixture(
fixture_data.update(
{
"post_state": alloc
if not self.exclude_full_post_state_in_output
if self.include_full_post_state_in_output
else None,
"pre_hash": "", # Will be set by BaseTestWrapper
}
Expand Down Expand Up @@ -1052,7 +1073,7 @@ def make_hive_fixture(
),
"pre": pre,
"post_state": alloc
if not self.exclude_full_post_state_in_output
if self.include_full_post_state_in_output
else None,
}
)
Expand All @@ -1063,7 +1084,7 @@ def make_hive_fixture(
{
"pre": pre,
"post_state": alloc
if not self.exclude_full_post_state_in_output
if self.include_full_post_state_in_output
else None,
}
)
Expand Down
1 change: 1 addition & 0 deletions tests/constantinople/eip1052_extcodehash/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Cross-client EIP-1052 EXTCODEHASH Tests."""
Loading
Loading