Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(fw,forks,tox): Misc Prague fixes #562

Merged
merged 10 commits into from
May 17, 2024
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Test fixtures for use by clients are available for each release on the [Github r
- ✨ Use pytest's "short" traceback style (`--tb=short`) for failure summaries in the test report for more compact terminal output ([#542](https://github.com/ethereum/execution-spec-tests/pull/542)).
- ✨ The `fill` command now generates HTML test reports with links to the JSON fixtures and debug information ([#537](https://github.com/ethereum/execution-spec-tests/pull/537)).
- ✨ Add an Ethereum RPC client class for use with consume commands ([#556](https://github.com/ethereum/execution-spec-tests/pull/556)).
- ✨ Add a "slow" pytest marker, in order to be able to limit the filled tests until release ([#562](https://github.com/ethereum/execution-spec-tests/pull/562)).

### 🔧 EVM Tools

Expand Down
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ console_output_style = count
minversion = 7.0
python_files = *.py
testpaths = tests/
markers =
slow
addopts =
-p pytest_plugins.test_filler.test_filler
-p pytest_plugins.forks.forks
Expand Down
2 changes: 2 additions & 0 deletions src/ethereum_test_forks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
London,
MuirGlacier,
Paris,
Prague,
Shanghai,
)
from .forks.transition import (
Expand Down Expand Up @@ -60,6 +61,7 @@
"Shanghai",
"ShanghaiToCancunAtTime15k",
"Cancun",
"Prague",
"get_transition_forks",
"forks_from",
"forks_from_until",
Expand Down
18 changes: 18 additions & 0 deletions src/ethereum_test_forks/forks/forks.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,3 +474,21 @@ def solc_min_version(cls) -> Version:
Returns the minimum version of solc that supports this fork.
"""
return Version.parse("1.0.0") # set a high version; currently unknown

@classmethod
def engine_new_payload_version(
cls, block_number: int = 0, timestamp: int = 0
) -> Optional[int]:
"""
Starting at Prague, new payload calls must use version 4
"""
return 4

@classmethod
def engine_forkchoice_updated_version(
cls, block_number: int = 0, timestamp: int = 0
) -> Optional[int]:
"""
At Prague, version number of NewPayload and ForkchoiceUpdated diverge.
"""
return 3
11 changes: 10 additions & 1 deletion src/ethereum_test_forks/forks/transition.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
List of all transition fork definitions.
"""
from ..transition_base_fork import transition_fork
from .forks import Berlin, Cancun, London, Paris, Shanghai
from .forks import Berlin, Cancun, London, Paris, Prague, Shanghai


# Transition Forks
Expand Down Expand Up @@ -31,3 +31,12 @@ class ShanghaiToCancunAtTime15k(Shanghai):
"""

pass


@transition_fork(to_fork=Prague, at_timestamp=15_000)
class CancunToPragueAtTime15k(Cancun):
"""
Cancun to Prague transition at Timestamp 15k
"""

pass
3 changes: 2 additions & 1 deletion src/ethereum_test_tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
TestInfo,
)
from .spec.blockchain.types import Block, Header
from .vm import Macro, Opcode, OpcodeCallArg, Opcodes
from .vm import Macro, Macros, Opcode, OpcodeCallArg, Opcodes

__all__ = (
"SPEC_TYPES",
Expand Down Expand Up @@ -85,6 +85,7 @@
"Header",
"Initcode",
"Macro",
"Macros",
"Opcode",
"OpcodeCallArg",
"Opcodes",
Expand Down
32 changes: 24 additions & 8 deletions src/ethereum_test_tools/common/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1244,22 +1244,38 @@ def list_blob_versioned_hashes(input_txs: List["Transaction"]) -> List[Hash]:
# Transition tool models


class TransactionLog(CamelModel):
"""
Transaction log
"""

address: Address
topics: List[Hash]
data: Bytes
block_number: HexNumber
transaction_hash: Hash
transaction_index: HexNumber
block_hash: Hash
log_index: HexNumber
removed: bool


class TransactionReceipt(CamelModel):
"""
Transaction receipt
"""

root: Bytes
status: HexNumber
cumulative_gas_used: HexNumber
logs_bloom: Bloom
logs: List[Dict[str, str]] | None = None
transaction_hash: Hash
contract_address: Address
gas_used: HexNumber
root: Bytes | None = None
status: HexNumber | None = None
cumulative_gas_used: HexNumber | None = None
logs_bloom: Bloom | None = None
logs: List[TransactionLog] | None = None
contract_address: Address | None = None
effective_gas_price: HexNumber | None = None
block_hash: Hash
transaction_index: HexNumber
block_hash: Hash | None = None
transaction_index: HexNumber | None = None
blob_gas_used: HexNumber | None = None
blob_gas_price: HexNumber | None = None

Expand Down
3 changes: 2 additions & 1 deletion src/ethereum_test_tools/vm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
Ethereum Virtual Machine related definitions and utilities.
"""

from .opcode import Macro, Opcode, OpcodeCallArg, Opcodes
from .opcode import Macro, Macros, Opcode, OpcodeCallArg, Opcodes

__all__ = (
"Opcode",
"Macro",
"Macros",
"OpcodeCallArg",
"Opcodes",
)
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ extras =

commands =
{[testenv:tests-base]commands}
pytest -n auto
pytest -n auto -k "not slow"

[testenv:tests-develop]
description = Execute test cases in tests/, including tests for development forks
Expand All @@ -64,7 +64,7 @@ extras =
{[testenv:tests-base]extras}

commands =
pytest -n auto --until={[main]development_fork}
pytest -n auto --until={[main]development_fork} -k "not slow"

[testenv:docs]
description = Run documentation checks
Expand Down