Skip to content

Commit 0060c42

Browse files
committed
Merge branch 'forks/amsterdam' into upstream3
2 parents a166b2f + 8e276dc commit 0060c42

93 files changed

Lines changed: 2448 additions & 1911 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/build-fixtures/action.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ runs:
3939
shell: bash
4040
run: |
4141
if [ "${{ steps.evm-builder.outputs.impl }}" = "eels" ]; then
42-
uv run fill -n ${{ steps.evm-builder.outputs.x-dist }} ${{ steps.properties.outputs.fill-params }} --output=fixtures_${{ inputs.release_name }}.tar.gz --build-name ${{ inputs.release_name }}
42+
uv run fill -n ${{ steps.evm-builder.outputs.x-dist }} ${{ steps.properties.outputs.fill-params }} --output=fixtures_${{ inputs.release_name }}.tar.gz --build-name ${{ inputs.release_name }} --no-html --durations=100 --log-level=DEBUG
4343
else
44-
uv run fill -n ${{ steps.evm-builder.outputs.x-dist }} --evm-bin=${{ steps.evm-builder.outputs.evm-bin }} ${{ steps.properties.outputs.fill-params }} --output=fixtures_${{ inputs.release_name }}.tar.gz --build-name ${{ inputs.release_name }}
44+
uv run fill -n ${{ steps.evm-builder.outputs.x-dist }} --evm-bin=${{ steps.evm-builder.outputs.evm-bin }} ${{ steps.properties.outputs.fill-params }} --output=fixtures_${{ inputs.release_name }}.tar.gz --build-name ${{ inputs.release_name }} --no-html --durations=100 --log-level=DEBUG
4545
fi
4646
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
4747
with:

.github/configs/feature.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Unless filling for special features, all features should fill for previous forks (starting from Frontier) too
22
stable:
33
evm-type: stable
4-
fill-params: --until=Prague --fill-static-tests --ignore=tests/static/state_tests/stQuadraticComplexityTest --no-html --durations=50
4+
fill-params: --until=Prague --fill-static-tests --ignore=tests/static/state_tests/stQuadraticComplexityTest
55

66
develop:
77
evm-type: develop
8-
fill-params: --until=BPO4 --fill-static-tests --ignore=tests/static/state_tests/stQuadraticComplexityTest --no-html --durations=50
8+
fill-params: --until=BPO4 --fill-static-tests --ignore=tests/static/state_tests/stQuadraticComplexityTest
99

1010
monad:
1111
evm-type: develop
1212
# --suppress-no-test-exit-code works around a problem where multi-phase fill
1313
# (triggered by tarball output) fails to proceed on no tests processed
1414
# in 1st phase (exit code 5)
15-
fill-params: --suppress-no-test-exit-code -m blockchain_test --from=MONAD_EIGHT --until=MONAD_NEXT --chain-id=143 -k "not eip4844 and not eip7002 and not eip7251 and not eip7685 and not eip6110 and not eip7594 and not eip7918 and not eip7610 and not eip7934 and not invalid_header" --no-html --durations=50
15+
fill-params: --suppress-no-test-exit-code -m blockchain_test --from=MONAD_EIGHT --until=MONAD_NEXT --chain-id=143 -k "not eip4844 and not eip7002 and not eip7251 and not eip7685 and not eip6110 and not eip7594 and not eip7918 and not eip7610 and not eip7934 and not invalid_header"

.github/workflows/test.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
# TODO: tests have been updated without paying attention to filling in pre-monad
6666
# forks. Need to circle back and do proper `if fork >= ...` thing
6767
# py3:
68-
# runs-on: ubuntu-24.04
68+
# runs-on: [self-hosted-ghr, size-xl-x64]
6969
# needs: static
7070
# steps:
7171
# - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955
@@ -78,9 +78,17 @@ jobs:
7878
# - uses: ./.github/actions/setup-env
7979
# - name: Run py3 tests
8080
# run: tox -e py3
81+
# env:
82+
# PYTEST_XDIST_AUTO_NUM_WORKERS: auto
83+
# - name: Upload coverage reports to Codecov
84+
# uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7
85+
# with:
86+
# files: .tox/coverage.xml
87+
# flags: unittests
88+
# token: ${{ secrets.CODECOV_TOKEN }}
8189

8290
# pypy3:
83-
# runs-on: ubuntu-24.04
91+
# runs-on: [self-hosted-ghr, size-xl-x64]
8492
# needs: static
8593
# steps:
8694
# - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955

CONTRIBUTING.md

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,79 @@ This specification aims to be:
2121
2. **Complete** - Capture the entirety of _consensus critical_ parts of Ethereum.
2222
3. **Accessible** - Prioritize readability, clarity, and plain language over performance and brevity.
2323

24-
### Spelling and Naming
24+
### Style
25+
26+
#### Spelling and Naming
2527

2628
- Attempt to use descriptive English words (or _very common_ abbreviations) in documentation and identifiers.
27-
- Avoid using EIP numbers in identifiers.
29+
- Avoid using EIP numbers in identifiers, and prefer descriptive text instead (eg. `FeeMarketTransaction` instead of `Eip1559Transaction`).
2830
- If necessary, there is a custom dictionary `whitelist.txt`.
2931

32+
#### Comments
33+
34+
- Don't repeat what is obvious from the code.
35+
- <details>
36+
<summary><em>(expand)</em> Consider how future changes will interleave with yours, especially when creating semantic blocks.</summary>
37+
38+
<br>Consider:
39+
<table valign="top">
40+
41+
<tr valign="top">
42+
<th>Fork T</th>
43+
<th>Fork T+1</th>
44+
</tr>
45+
46+
<tr valign="top">
47+
48+
<td>
49+
50+
<!--
51+
Note that the trailing whitespace is necessary to move the copy button
52+
in the github UI over so it doesn't obscure the text.
53+
-->
54+
55+
```python
56+
# EIP-1234: The dingus is the rate of fleep
57+
dingus = a + b
58+
dingus += c ^ d
59+
dingus /= fleep(e)
60+
```
61+
62+
</td>
63+
64+
<td>
65+
66+
```python
67+
# EIP-1234: The dingus is the rate of fleep
68+
dingus = a + b
69+
70+
# EIP-4567: Frobulate the dingus
71+
dingus = frobulate(dingus)
72+
73+
dingus += c ^ d # <-
74+
dingus /= fleep(e) # <-
75+
```
76+
77+
</td>
78+
79+
</tr>
80+
81+
</table>
82+
83+
The marked lines (`<-`) are now incorrectly attributed to EIP-4567 in Fork+1. Instead, omit the EIP identifier in the comments, and describe the changes introduced by the EIP in the function's docstrings. The rendered diffs will make it pretty obvious what's changed.
84+
</details>
85+
86+
#### Docstrings
87+
88+
- Don't include the function's signature.
89+
- Format using markdown.
90+
- Don't begin with an article ("the"/"a") or a pronoun ("it", "they", etc.).
91+
- Write in complete sentences, providing background and context for the associated code.
92+
- Link to relevant standards/EIPs.
93+
3094
### Changes across various Forks
3195

32-
Many contributions require changes across multiple forks, organized under `src/ethereum/*`. When making such changes, please ensure that differences between the forks are minimal and consist only of necessary differences. This will help with getting cleaner [diff outputs](https://ethereum.github.io/execution-specs/diffs/index.html).
96+
Many contributions require changes across multiple forks, organized under `src/ethereum/forks/*`. When making such changes, please ensure that differences between the forks are minimal and consist only of necessary differences. This will help with getting cleaner [diff outputs](https://ethereum.github.io/execution-specs/diffs/index.html).
3397

3498
When creating pull requests affecting multiple forks, we recommended submitting your PR in two steps:
3599

docs/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Test fixtures for use by clients are available for each release on the [Github r
1111
### 🛠️ Framework
1212

1313
- 🐞 Remove `Op.CLZ` from `UndefinedOpcodes` list ([#1970](https://github.com/ethereum/execution-specs/pull/1970)).
14+
- 🐞 Make `TransactionTraces` `CamelModel` less lestrictive ([#2081](https://github.com/ethereum/execution-specs/pull/2081)).
1415

1516
#### `fill`
1617

docs/writing_tests/test_markers.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def type_4_default_transaction(sender: Account, pre: Alloc):
101101
@pytest.mark.with_all_typed_transactions
102102
@pytest.mark.valid_from("Prague")
103103
def test_something_with_all_tx_types(
104-
state_test: StateTestFiller,
104+
state_test: StateTestFiller,
105105
pre: Alloc,
106106
typed_transaction: Transaction
107107
):
@@ -327,14 +327,18 @@ In this example, the test will be marked as expected to fail when it is being ex
327327

328328
This marker is used to mark tests that are slow to run. These tests are not run during [`tox` checks](./verifying_changes.md), and are only run when a release is being prepared.
329329

330-
### `@pytest.mark.pre_alloc_modify`
330+
### `@pytest.mark.pre_alloc_mutable`
331331

332332
This marker is used to mark tests that modify the pre-alloc in a way that would be impractical to reproduce in a real-world scenario.
333333

334334
Examples of this include:
335335

336336
- Modifying the pre-alloc to have a balance of 2^256 - 1.
337337
- Address collisions that would require hash collisions.
338+
- EOA accounts containing code
339+
- EOA accounts with a hard-coded nonce
340+
- Contracts having zero-nonce
341+
- Deploying a contract to a hard-coded address
338342

339343
### `@pytest.mark.skip()`
340344

packages/testing/src/execution_testing/base_types/composite_types.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Base composite types for Ethereum test cases."""
22

3+
import hashlib
4+
import json
35
from dataclasses import dataclass
46
from typing import (
57
Any,
@@ -367,6 +369,11 @@ class Account(CamelModel):
367369
state.
368370
"""
369371

372+
model_config = {
373+
**CamelModel.model_config,
374+
"frozen": True,
375+
}
376+
370377
@dataclass(kw_only=True)
371378
class NonceMismatchError(Exception):
372379
"""
@@ -514,6 +521,16 @@ def __bool__(self: "Account") -> bool:
514521
"""Return True on a non-empty account."""
515522
return any((self.nonce, self.balance, self.code, self.storage))
516523

524+
def hash(self) -> Hash:
525+
"""Return the hash of the account given its properties."""
526+
data = self.model_dump(mode="json")
527+
blob = json.dumps(
528+
data,
529+
sort_keys=True,
530+
separators=(",", ":"),
531+
).encode("utf-8")
532+
return Hash(hashlib.sha256(blob).digest())
533+
517534
@classmethod
518535
def with_code(cls: Type, code: BytesConvertible) -> "Account":
519536
"""Create account with provided `code` and nonce of `1`."""

packages/testing/src/execution_testing/base_types/tests/test_base_types.py

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from ..base_types import Address, Hash, Wei
88
from ..base_types_json import to_json
9-
from ..composite_types import AccessList
9+
from ..composite_types import AccessList, Account
1010

1111

1212
@pytest.mark.parametrize(
@@ -290,3 +290,57 @@ def test_json_deserialization(
290290
)
291291
model_type = type(model_instance)
292292
assert model_type(**json) == model_instance
293+
294+
295+
@pytest.mark.parametrize(
296+
"account_1, account_2, equal",
297+
[
298+
(Account(), Account(), True),
299+
(Account(nonce=1), Account(nonce=2), False),
300+
(Account(nonce=1), Account(nonce=1), True),
301+
(Account(nonce=1), Account(nonce=1, code="0x1234"), False),
302+
(Account(nonce=1, code="0x1234"), Account(nonce=1), False),
303+
(
304+
Account(nonce=1, code="0x1234"),
305+
Account(nonce=1, code="0x1234"),
306+
True,
307+
),
308+
(
309+
Account(nonce=1, code="0x1234"),
310+
Account(nonce=1, code="0x5678"),
311+
False,
312+
),
313+
(
314+
Account(nonce=1, code="0x1234"),
315+
Account(nonce=2, code="0x5678"),
316+
False,
317+
),
318+
(
319+
Account(nonce=1, code="0x1234"),
320+
Account(nonce=2, code="0x1234"),
321+
False,
322+
),
323+
(
324+
Account(nonce=1, code="0x1234"),
325+
Account(nonce=1, code="0x1234", storage={0: 0, 1: 1}),
326+
False,
327+
),
328+
(
329+
Account(nonce=1, code="0x1234", storage={1: 1, 0: 0}),
330+
Account(nonce=1, code="0x1234", storage={0: 0, 1: 1}),
331+
True,
332+
),
333+
],
334+
)
335+
def test_account_hash(
336+
account_1: Account, account_2: Account, equal: bool
337+
) -> None:
338+
"""Test two different accounts to return the same hash."""
339+
if equal:
340+
assert account_1.hash() == account_2.hash(), (
341+
f"Account 1: {account_1.hash()}, Account 2: {account_2.hash()}"
342+
)
343+
else:
344+
assert account_1.hash() != account_2.hash(), (
345+
f"Account 1: {account_1.hash()}, Account 2: {account_2.hash()}"
346+
)

packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/execute.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ def pytest_collection_modifyitems(
812812
elif marker.name == "valid_at_transition_to":
813813
items_for_removal.append(i)
814814
continue
815-
elif marker.name == "pre_alloc_modify":
815+
elif marker.name == "pre_alloc_mutable":
816816
item.add_marker(
817817
pytest.mark.skip(
818818
reason="Pre-alloc modification not supported"

0 commit comments

Comments
 (0)