Skip to content

chore: Updated fork name from Merge -> Paris #363

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

Merged
merged 2 commits into from
Jan 18, 2024
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
17 changes: 10 additions & 7 deletions .vscode/launch.recommended.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387

// If the VS Code "Run and Debug" button, respecively launch selector are not visible, see this answer:
// https://stackoverflow.com/a/74245823
//
Expand Down Expand Up @@ -41,7 +40,7 @@
"${input:testPathOrId}"
],
"cwd": "${workspaceFolder}"
},
},
{
"name": "Launch fill --until Shanghai",
"type": "python",
Expand Down Expand Up @@ -80,7 +79,11 @@
"type": "python",
"request": "launch",
"module": "pytest",
"args": ["-c", "pytest.ini", "--test-help"],
"args": [
"-c",
"pytest.ini",
"--test-help"
],
"cwd": "/home/dtopz/code/github/danceratopz/execution-spec-tests"
},
],
Expand Down Expand Up @@ -118,15 +121,15 @@
"id": "fork",
"description": "Which fork do you want to use?",
"options": [
"Frontier",
"Homestead",
"Frontier",
"Homestead",
"Byzantium",
"Constantinople",
"ConstantinopleFix",
"Istanbul",
"Berlin",
"London",
"Merge",
"Paris",
"Shanghai",
"Cancun",
],
Expand All @@ -139,4 +142,4 @@
"default": "test_"
}
]
}
}
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Test fixtures for use by clients are available for each release on the [Github r
- ✨ `StateTestOnly`, spec format is now available and its only difference with `StateTest` is that it does not produce a `BlockchainTest` ([#368](https://github.com/ethereum/execution-spec-tests/pull/368))
- ✨ Add a helper class `ethereum_test_tools.TestParameterGroup` to define test parameters as dataclasses and auto-generate test IDs ([#364](https://github.com/ethereum/execution-spec-tests/pull/364)).
- πŸ”€ Change custom exception classes to dataclasses to improve testability ([#386](https://github.com/ethereum/execution-spec-tests/pull/386)).
- πŸ”€ Updates fork name from Merge to Paris ([#363](https://github.com/ethereum/execution-spec-tests/pull/363)).

### πŸ”§ EVM Tools

Expand Down
2 changes: 1 addition & 1 deletion docs/getting_started/executing_tests_command_line.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ fill tests/shanghai/eip3651_warm_coinbase/test_warm_coinbase.py::test_warm_coinb
or, for a test function and specific parameter combination:

```console
fill tests/shanghai/eip3651_warm_coinbase/test_warm_coinbase.py::test_warm_coinbase_gas_usage[fork_Merge-DELEGATECALL]
fill tests/shanghai/eip3651_warm_coinbase/test_warm_coinbase.py::test_warm_coinbase_gas_usage[fork_Paris-DELEGATECALL]
```

## Execution for Development Forks
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/state_transition.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ In this case, the decorator is a custom [pytest fixture](https://docs.pytest.org
and to execute it for a specific fork range, we can provide the `--from` and `--until` command-line arguments:

```console
fill -k test_yul --from London --until Merge
fill -k test_yul --from London --until Paris
```

```python
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/state_transition_bad_opcode.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ We don't know what will be the fork names after Shanghai, so it is easiest to sp
We don't need to worry about forks prior to London because the decorator for this test says it is only valid from London.

```python
if fork in {"london", "merge"} and opc==0x5F:
if fork in {"london", "paris"} and opc==0x5F:
```

Python has a [set data structure](https://docs.python.org/3/tutorial/datastructures.html#sets).
Expand Down
8 changes: 4 additions & 4 deletions src/ethereum_test_forks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
Homestead,
Istanbul,
London,
Merge,
MuirGlacier,
Paris,
Shanghai,
)
from .forks.transition import (
BerlinToLondonAt5,
MergeToShanghaiAtTime15k,
ParisToShanghaiAtTime15k,
ShanghaiToCancunAtTime15k,
)
from .helpers import (
Expand Down Expand Up @@ -51,8 +51,8 @@
"InvalidForkError",
"Istanbul",
"London",
"Merge",
"MergeToShanghaiAtTime15k",
"Paris",
"ParisToShanghaiAtTime15k",
"MuirGlacier",
"Shanghai",
"ShanghaiToCancunAtTime15k",
Expand Down
15 changes: 7 additions & 8 deletions src/ethereum_test_forks/forks/forks.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,34 +280,33 @@ class GrayGlacier(ArrowGlacier):
pass


class Merge(
class Paris(
London,
transition_tool_name="Merge",
blockchain_test_network_name="Merge",
solc_name="Paris",
):
"""
Merge fork
Paris (Merge) fork
"""

@classmethod
def header_prev_randao_required(cls, block_number: int = 0, timestamp: int = 0) -> bool:
"""
Prev Randao is required starting from Merge.
Prev Randao is required starting from Paris.
"""
return True

@classmethod
def header_zero_difficulty_required(cls, block_number: int = 0, timestamp: int = 0) -> bool:
"""
Zero difficulty is required starting from Merge.
Zero difficulty is required starting from Paris.
"""
return True

@classmethod
def get_reward(cls, block_number: int = 0, timestamp: int = 0) -> int:
"""
Merge updates the reward to 0.
Paris updates the reward to 0.
"""
return 0

Expand All @@ -316,12 +315,12 @@ def engine_new_payload_version(
cls, block_number: int = 0, timestamp: int = 0
) -> Optional[int]:
"""
Starting at the merge, payloads can be sent through the engine API
Starting at Paris, payloads can be sent through the engine API
"""
return 1


class Shanghai(Merge):
class Shanghai(Paris):
"""
Shanghai fork
"""
Expand Down
6 changes: 3 additions & 3 deletions 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, Merge, Shanghai
from .forks import Berlin, Cancun, London, Paris, Shanghai


# Transition Forks
Expand All @@ -16,9 +16,9 @@ class BerlinToLondonAt5(Berlin):


@transition_fork(to_fork=Shanghai, at_timestamp=15_000)
class MergeToShanghaiAtTime15k(Merge, blockchain_test_network_name="MergeToShanghaiAtTime15k"):
class ParisToShanghaiAtTime15k(Paris, blockchain_test_network_name="ParisToShanghaiAtTime15k"):
"""
Merge to Shanghai transition at Timestamp 15k
Paris to Shanghai transition at Timestamp 15k
"""

pass
Expand Down
70 changes: 35 additions & 35 deletions src/ethereum_test_forks/tests/test_forks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from typing import Mapping, cast

from ..base_fork import Fork
from ..forks.forks import Berlin, Cancun, Frontier, London, Merge, Shanghai
from ..forks.transition import BerlinToLondonAt5, MergeToShanghaiAtTime15k
from ..forks.forks import Berlin, Cancun, Frontier, London, Paris, Shanghai
from ..forks.transition import BerlinToLondonAt5, ParisToShanghaiAtTime15k
from ..helpers import (
forks_from,
forks_from_until,
Expand All @@ -29,8 +29,8 @@ def test_transition_forks():
Test transition fork utilities.
"""
assert transition_fork_from_to(Berlin, London) == BerlinToLondonAt5
assert transition_fork_from_to(Berlin, Merge) is None
assert transition_fork_to(Shanghai) == [MergeToShanghaiAtTime15k]
assert transition_fork_from_to(Berlin, Paris) is None
assert transition_fork_to(Shanghai) == [ParisToShanghaiAtTime15k]

# Test forks transitioned to and from
assert BerlinToLondonAt5.transitions_to() == London
Expand All @@ -41,24 +41,24 @@ def test_transition_forks():
# Default values of transition forks is the transition block
assert BerlinToLondonAt5.transition_tool_name() == "London"

assert MergeToShanghaiAtTime15k.transition_tool_name(0, 14_999) == "Merge"
assert MergeToShanghaiAtTime15k.transition_tool_name(0, 15_000) == "Shanghai"
assert MergeToShanghaiAtTime15k.transition_tool_name() == "Shanghai"
assert ParisToShanghaiAtTime15k.transition_tool_name(0, 14_999) == "Merge"
assert ParisToShanghaiAtTime15k.transition_tool_name(0, 15_000) == "Shanghai"
assert ParisToShanghaiAtTime15k.transition_tool_name() == "Shanghai"

assert BerlinToLondonAt5.header_base_fee_required(4, 0) is False
assert BerlinToLondonAt5.header_base_fee_required(5, 0) is True

assert MergeToShanghaiAtTime15k.header_withdrawals_required(0, 14_999) is False
assert MergeToShanghaiAtTime15k.header_withdrawals_required(0, 15_000) is True
assert ParisToShanghaiAtTime15k.header_withdrawals_required(0, 14_999) is False
assert ParisToShanghaiAtTime15k.header_withdrawals_required(0, 15_000) is True

assert MergeToShanghaiAtTime15k.engine_new_payload_version(0, 14_999) == 1
assert MergeToShanghaiAtTime15k.engine_new_payload_version(0, 15_000) == 2
assert ParisToShanghaiAtTime15k.engine_new_payload_version(0, 14_999) == 1
assert ParisToShanghaiAtTime15k.engine_new_payload_version(0, 15_000) == 2


def test_forks_from(): # noqa: D103
assert forks_from(Merge) == [Merge, LAST_DEPLOYED]
assert forks_from(Merge, deployed_only=True) == [Merge, LAST_DEPLOYED]
assert forks_from(Merge, deployed_only=False) == [Merge, LAST_DEPLOYED] + DEVELOPMENT_FORKS
assert forks_from(Paris) == [Paris, LAST_DEPLOYED]
assert forks_from(Paris, deployed_only=True) == [Paris, LAST_DEPLOYED]
assert forks_from(Paris, deployed_only=False) == [Paris, LAST_DEPLOYED] + DEVELOPMENT_FORKS


def test_forks():
Expand All @@ -67,50 +67,50 @@ def test_forks():
"""
assert forks_from_until(Berlin, Berlin) == [Berlin]
assert forks_from_until(Berlin, London) == [Berlin, London]
assert forks_from_until(Berlin, Merge) == [
assert forks_from_until(Berlin, Paris) == [
Berlin,
London,
Merge,
Paris,
]

# Test fork names
assert London.name() == "London"
assert MergeToShanghaiAtTime15k.name() == "MergeToShanghaiAtTime15k"
assert ParisToShanghaiAtTime15k.name() == "ParisToShanghaiAtTime15k"
assert f"{London}" == "London"
assert f"{MergeToShanghaiAtTime15k}" == "MergeToShanghaiAtTime15k"
assert f"{ParisToShanghaiAtTime15k}" == "ParisToShanghaiAtTime15k"

# Merge name will be changed to paris, but we need to check the inheriting fork name is still
# the default
assert Merge.transition_tool_name() == "Merge"
assert Paris.transition_tool_name() == "Merge"
assert Shanghai.transition_tool_name() == "Shanghai"
assert Merge.blockchain_test_network_name() == "Merge"
assert Paris.blockchain_test_network_name() == "Merge"
assert Shanghai.blockchain_test_network_name() == "Shanghai"
assert MergeToShanghaiAtTime15k.blockchain_test_network_name() == "MergeToShanghaiAtTime15k"
assert ParisToShanghaiAtTime15k.blockchain_test_network_name() == "ParisToShanghaiAtTime15k"

# Test some fork properties
assert Berlin.header_base_fee_required(0, 0) is False
assert London.header_base_fee_required(0, 0) is True
assert Merge.header_base_fee_required(0, 0) is True
assert Paris.header_base_fee_required(0, 0) is True
# Default values of normal forks if the genesis block
assert Merge.header_base_fee_required() is True
assert Paris.header_base_fee_required() is True

# Transition forks too
assert cast(Fork, BerlinToLondonAt5).header_base_fee_required(4, 0) is False
assert cast(Fork, BerlinToLondonAt5).header_base_fee_required(5, 0) is True
assert cast(Fork, MergeToShanghaiAtTime15k).header_withdrawals_required(0, 14_999) is False
assert cast(Fork, MergeToShanghaiAtTime15k).header_withdrawals_required(0, 15_000) is True
assert cast(Fork, MergeToShanghaiAtTime15k).header_withdrawals_required() is True
assert cast(Fork, ParisToShanghaiAtTime15k).header_withdrawals_required(0, 14_999) is False
assert cast(Fork, ParisToShanghaiAtTime15k).header_withdrawals_required(0, 15_000) is True
assert cast(Fork, ParisToShanghaiAtTime15k).header_withdrawals_required() is True

# Test fork comparison
assert Merge > Berlin
assert not Berlin > Merge
assert Berlin < Merge
assert not Merge < Berlin

assert Merge >= Berlin
assert not Berlin >= Merge
assert Berlin <= Merge
assert not Merge <= Berlin
assert Paris > Berlin
assert not Berlin > Paris
assert Berlin < Paris
assert not Paris < Berlin

assert Paris >= Berlin
assert not Berlin >= Paris
assert Berlin <= Paris
assert not Paris <= Berlin

assert London > Berlin
assert not Berlin > London
Expand Down
4 changes: 2 additions & 2 deletions src/ethereum_test_tools/tests/test_filler.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import pytest
from semver import Version

from ethereum_test_forks import Berlin, Fork, Istanbul, London, Merge, Shanghai
from ethereum_test_forks import Berlin, Fork, Istanbul, London, Paris, Shanghai
from evm_transition_tool import FixtureFormats, GethTransitionTool

from ..code import Yul
Expand Down Expand Up @@ -96,7 +96,7 @@ def test_make_genesis(fork: Fork, hash: bytes): # noqa: D103
[
(Istanbul, False, "chainid_istanbul_filled.json"),
(London, False, "chainid_london_filled.json"),
(Merge, True, "chainid_merge_filled_hive.json"),
(Paris, True, "chainid_paris_filled_hive.json"),
(Shanghai, True, "chainid_shanghai_filled_hive.json"),
],
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"000/my_chain_id_test/Merge": {
"000/my_chain_id_test/Paris": {
"network": "Merge",
"genesisBlockHeader": {
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
Expand Down Expand Up @@ -82,4 +82,4 @@
}
}
}
}
}
11 changes: 8 additions & 3 deletions src/pytest_plugins/forks/forks.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,14 @@ def pytest_configure(config):
for d in fork_covariant_descriptors:
config.addinivalue_line("markers", f"{d.marker_name}: {d.description}")

single_fork = config.getoption("single_fork")
forks_from = config.getoption("forks_from")
forks_until = config.getoption("forks_until")
def get_fork_option(config, option_name):
"""Post-process get option to allow for external fork conditions."""
option = config.getoption(option_name)
return "Paris" if option == "Merge" else option

single_fork = get_fork_option(config, "single_fork")
forks_from = get_fork_option(config, "forks_from")
forks_until = get_fork_option(config, "forks_until")
show_fork_help = config.getoption("show_fork_help")

all_forks = get_forks()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
(
"invalid_fork_range",
(
("--from", "Merge", "--until", "Frontier"),
"--from Merge --until Frontier creates an empty fork range",
("--from", "Paris", "--until", "Frontier"),
"--from Paris --until Frontier creates an empty fork range",
),
),
)
Expand Down
Loading