Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Test fixtures for use by clients are available for each release on the [Github r
- ✨ Add tests for `modexp` and `ripemd` precompiled contracts ([#1691](https://github.com/ethereum/execution-specs/pull/1691)).
- ✨ Add `ecrecover` precompile tests originating form `evmone` unittests ([#1685](https://github.com/ethereum/execution-specs/pull/1685)).
- ✨ Add stack overflow tests and expand `BLOCKHASH` tests ([#1728](https://github.com/ethereum/execution-specs/pull/1728)).
- ✨ Add tests that EIP-1559 and EIP-2930 typed txs are invalid and void before their fork ([#1754](https://github.com/ethereum/execution-specs/pull/1754)).

## [v5.3.0](https://github.com/ethereum/execution-spec-tests/releases/tag/v5.3.0) - 2025-10-09

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ class EthrexExceptionMapper(ExceptionMapper):
TransactionException.TYPE_3_TX_INVALID_BLOB_VERSIONED_HASH: (
r"blob version not supported|Invalid blob versioned hash"
),
TransactionException.TYPE_3_TX_PRE_FORK: (
r"Type 2 transactions are not supported before the London fork"
),
TransactionException.TYPE_3_TX_PRE_FORK: (
r"blob versioned hashes not supported|"
r"Type 3 transactions are not supported before the Cancun fork"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ class EvmoneExceptionMapper(ExceptionMapper):
),
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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ class ExecutionSpecsExceptionMapper(ExceptionMapper):
TransactionException.INSUFFICIENT_MAX_FEE_PER_GAS: (
r"InsufficientMaxFeePerGasError|InvalidBlock" # Temporary solution for issue #1981.
),
TransactionException.TYPE_1_TX_PRE_FORK: (
r"module '.*transactions' has no attribute 'AccessListTransaction'"
),
TransactionException.TYPE_2_TX_PRE_FORK: (
r"'.*transactions' has no attribute 'FeeMarketTransaction'"
),
TransactionException.TYPE_3_TX_PRE_FORK: (
r"module '.*transactions' has no attribute 'BlobTransaction'"
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ class GethExceptionMapper(ExceptionMapper):
TransactionException.PRIORITY_GREATER_THAN_MAX_FEE_PER_GAS: (
"max priority fee per gas higher than max fee per gas"
),
TransactionException.TYPE_1_TX_PRE_FORK: (
"transaction type not supported"
),
TransactionException.TYPE_2_TX_PRE_FORK: (
"transaction type not supported"
),
TransactionException.TYPE_3_TX_PRE_FORK: (
"transaction type not supported"
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,12 @@ class NethermindExceptionMapper(ExceptionMapper):
TransactionException.INSUFFICIENT_MAX_FEE_PER_BLOB_GAS: (
"InsufficientMaxFeePerBlobGas: Not enough to cover blob gas fee"
),
TransactionException.TYPE_1_TX_PRE_FORK: (
"InvalidTxType: Transaction type in Custom is not supported"
),
TransactionException.TYPE_2_TX_PRE_FORK: (
"InvalidTxType: Transaction type in Custom is not supported"
),
TransactionException.TYPE_3_TX_PRE_FORK: (
"InvalidTxType: Transaction type in Custom is not supported"
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ class TransactionException(ExceptionBase):
"""
Transaction's initcode for a contract-creating transaction is too large.
"""
TYPE_1_TX_PRE_FORK = auto()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't catch on to this being duplicate in two files. This might be an artifact of the weld, I'll open an issue.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created #1816.

"""Transaction type 1 included before activation fork."""
TYPE_2_TX_PRE_FORK = auto()
"""Transaction type 2 included before activation fork."""
TYPE_3_TX_PRE_FORK = auto()
"""Transaction type 3 included before activation fork."""
TYPE_3_TX_ZERO_BLOBS_PRE_FORK = auto()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ class TransactionException(ExceptionBase):
"""
Transaction's initcode for a contract-creating transaction is too large.
"""
TYPE_1_TX_PRE_FORK = auto()
"""Transaction type 1 included before activation fork."""
TYPE_2_TX_PRE_FORK = auto()
"""Transaction type 2 included before activation fork."""
TYPE_3_TX_PRE_FORK = auto()
"""Transaction type 3 included before activation fork."""
TYPE_3_TX_ZERO_BLOBS_PRE_FORK = auto()
Expand Down
73 changes: 73 additions & 0 deletions tests/berlin/eip2930_access_list/test_tx_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
"""Test the tx type validation for EIP-2930."""

from typing import Generator

import pytest
from execution_testing import (
Account,
Alloc,
Fork,
ParameterSet,
StateTestFiller,
Transaction,
TransactionException,
)
from execution_testing import Opcodes as Op
from execution_testing.forks import Byzantium

from .spec import ref_spec_2930

REFERENCE_SPEC_GIT_PATH = ref_spec_2930.git_path
REFERENCE_SPEC_VERSION = ref_spec_2930.version

TX_TYPE = 1


def tx_validity(fork: Fork) -> Generator[ParameterSet, None, None]:
"""
Return a generator of parameters for the tx validity test.
"""
valid = TX_TYPE in fork.tx_types()
yield pytest.param(
valid,
marks=[pytest.mark.exception_test] if not valid else [],
id="valid" if valid else "invalid",
)


@pytest.mark.ported_from(
[
"https://github.com/ethereum/legacytests/blob/master/src/LegacyTests/Cancun/GeneralStateTestsFiller/stExample/accessListExampleFiller.yml"
],
pr=["https://github.com/ethereum/execution-specs/pull/1754"],
)
@pytest.mark.parametrize_by_fork("valid", tx_validity)
def test_eip2930_tx_validity(
state_test: StateTestFiller,
fork: Fork,
pre: Alloc,
valid: bool,
) -> None:
"""
Tests that an EIP-2930 tx is correctly rejected before fork activation.
"""
account = pre.deploy_contract(
code=Op.SSTORE(0, 1),
storage={0: 0xDEADBEEF},
)
sender = pre.fund_eoa()

tx = Transaction(
to=account,
sender=sender,
gas_limit=100_000,
access_list=[],
protected=fork >= Byzantium,
error=TransactionException.TYPE_1_TX_PRE_FORK if not valid else None,
)

post = {account: Account(storage={0: 0xDEADBEEF if not valid else 1})}
if not valid:
post[sender] = pre[sender] # type: ignore

state_test(pre=pre, post=post, tx=tx)
3 changes: 3 additions & 0 deletions tests/london/eip1559_fee_market_change/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""
Tests for [EIP-1559: Fee market change for ETH 1.0 chain](https://eips.ethereum.org/EIPS/eip-1559).
"""
16 changes: 16 additions & 0 deletions tests/london/eip1559_fee_market_change/spec.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""Defines EIP-1559 specification constants and functions."""

from dataclasses import dataclass


@dataclass(frozen=True)
class ReferenceSpec:
"""Defines the reference spec version and git path."""

git_path: str
version: str


ref_spec_1559 = ReferenceSpec(
"EIPS/eip-1559.md", "ba6c342c23164072adb500c3136e3ae6eabff306"
)
73 changes: 73 additions & 0 deletions tests/london/eip1559_fee_market_change/test_tx_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
"""Test the tx type validation for EIP-1559."""

from typing import Generator

import pytest
from execution_testing import (
Account,
Alloc,
Fork,
ParameterSet,
StateTestFiller,
Transaction,
TransactionException,
)
from execution_testing import Opcodes as Op
from execution_testing.forks import Byzantium

from .spec import ref_spec_1559

REFERENCE_SPEC_GIT_PATH = ref_spec_1559.git_path
REFERENCE_SPEC_VERSION = ref_spec_1559.version

TX_TYPE = 2


def tx_validity(fork: Fork) -> Generator[ParameterSet, None, None]:
"""
Return a generator of parameters for the tx validity test.
"""
valid = TX_TYPE in fork.tx_types()
yield pytest.param(
valid,
marks=[pytest.mark.exception_test] if not valid else [],
id="valid" if valid else "invalid",
)


@pytest.mark.ported_from(
[
"https://github.com/ethereum/legacytests/blob/master/Cancun/GeneralStateTests/stEIP1559/typeTwoBerlin.json"
],
pr=["https://github.com/ethereum/execution-specs/pull/1754"],
)
@pytest.mark.parametrize_by_fork("valid", tx_validity)
def test_eip1559_tx_validity(
state_test: StateTestFiller,
fork: Fork,
pre: Alloc,
valid: bool,
) -> None:
"""
Tests that an EIP-1559 tx has no effect before London.
"""
account = pre.deploy_contract(
code=Op.SSTORE(0, 1),
storage={0: 0xDEADBEEF},
)
sender = pre.fund_eoa()

tx = Transaction(
to=account,
sender=sender,
gas_limit=100_000,
max_priority_fee_per_gas=1,
protected=fork >= Byzantium,
error=TransactionException.TYPE_2_TX_PRE_FORK if not valid else None,
)

post = {account: Account(storage={0: 0xDEADBEEF if not valid else 1})}
if not valid:
post[sender] = pre[sender] # type: ignore

state_test(pre=pre, post=post, tx=tx)
60 changes: 0 additions & 60 deletions tests/static/state_tests/stEIP1559/typeTwoBerlinFiller.yml

This file was deleted.

66 changes: 0 additions & 66 deletions tests/static/state_tests/stExample/accessListExampleFiller.yml

This file was deleted.

Loading