Skip to content

Commit 5cf2308

Browse files
committed
new(tests): EIP-7002, EIP-7251: system contract error tests
1 parent d5862be commit 5cf2308

File tree

5 files changed

+43
-0
lines changed

5 files changed

+43
-0
lines changed

docs/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Test fixtures for use by clients are available for each release on the [Github r
3939
-[EIP-6110](https://eips.ethereum.org/EIPS/eip-6110): Add extra deposit request edge cases, sending eth to the deposit contract while sending a deposit request ([#1467](https://github.com/ethereum/execution-spec-tests/pull/1467)).
4040
-[EIP-7251](https://eips.ethereum.org/EIPS/eip-7251): Remove pytest skips for consolidation request cases ([#1449](https://github.com/ethereum/execution-spec-tests/pull/1449)).
4141
-[EIP-7002](https://eips.ethereum.org/EIPS/eip-7002), [EIP-7251](https://eips.ethereum.org/EIPS/eip-7251): Add cases to verify behavior of contracts missing at fork ([#1394](https://github.com/ethereum/execution-spec-tests/pull/1394)).
42+
-[EIP-7002](https://eips.ethereum.org/EIPS/eip-7002), [EIP-7251](https://eips.ethereum.org/EIPS/eip-7251): Add cases to verify behavior of system contract errors invalidating a block ([#1394](https://github.com/ethereum/execution-spec-tests/pull/1394)).
4243

4344
### 📋 Misc
4445

tests/prague/eip7002_el_triggerable_withdrawals/spec.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ class Spec:
3434
WITHDRAWAL_REQUEST_PREDEPLOY_SENDER = Address(0x8646861A7CF453DDD086874D622B0696DE5B9674)
3535
SYSTEM_ADDRESS = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE
3636

37+
SYSTEM_CALL_GAS_LIMIT = 30_000_000
38+
3739
EXCESS_WITHDRAWAL_REQUESTS_STORAGE_SLOT = 0
3840
WITHDRAWAL_REQUEST_COUNT_STORAGE_SLOT = 1
3941
WITHDRAWAL_REQUEST_QUEUE_HEAD_STORAGE_SLOT = (

tests/prague/eip7002_el_triggerable_withdrawals/test_modified_withdrawal_contract.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010

1111
from ethereum_test_tools import (
1212
Account,
13+
Address,
1314
Alloc,
1415
Block,
1516
BlockchainTestFiller,
1617
Bytecode,
1718
Transaction,
19+
generate_system_contract_error_test,
1820
)
1921
from ethereum_test_tools import Macros as Om
2022
from ethereum_test_tools import Opcodes as Op
@@ -130,3 +132,20 @@ def test_extra_withdrawals(
130132
],
131133
post={},
132134
)
135+
136+
137+
@pytest.mark.parametrize(
138+
"system_contract", [Address(Spec_EIP7002.WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS)]
139+
)
140+
@generate_system_contract_error_test(
141+
max_gas_limit=Spec_EIP7002.SYSTEM_CALL_GAS_LIMIT,
142+
)
143+
def test_system_contract_errors():
144+
"""
145+
Test system contract raising different errors when called by the system account at the
146+
end of the block execution.
147+
148+
To see the list of generated tests, please refer to the
149+
`generate_system_contract_error_test` decorator definition.
150+
"""
151+
pass

tests/prague/eip7251_consolidations/spec.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class Spec:
2828
CONSOLIDATION_REQUEST_PREDEPLOY_SENDER = Address(0x13D1913D623E6A9D8811736359E50FD31FE54FCA)
2929
SYSTEM_ADDRESS = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE
3030

31+
SYSTEM_CALL_GAS_LIMIT = 30_000_000
32+
3133
EXCESS_CONSOLIDATION_REQUESTS_STORAGE_SLOT = 0
3234
CONSOLIDATION_REQUEST_COUNT_STORAGE_SLOT = 1
3335
CONSOLIDATION_REQUEST_QUEUE_HEAD_STORAGE_SLOT = (

tests/prague/eip7251_consolidations/test_modified_consolidation_contract.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010

1111
from ethereum_test_tools import (
1212
Account,
13+
Address,
1314
Alloc,
1415
Block,
1516
BlockchainTestFiller,
1617
Bytecode,
1718
Transaction,
19+
generate_system_contract_error_test,
1820
)
1921
from ethereum_test_tools import Macros as Om
2022
from ethereum_test_tools import Opcodes as Op
@@ -130,3 +132,20 @@ def test_extra_consolidations(
130132
],
131133
post={},
132134
)
135+
136+
137+
@pytest.mark.parametrize(
138+
"system_contract", [Address(Spec_EIP7251.CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS)]
139+
)
140+
@generate_system_contract_error_test(
141+
max_gas_limit=Spec_EIP7251.SYSTEM_CALL_GAS_LIMIT,
142+
)
143+
def test_system_contract_errors():
144+
"""
145+
Test system contract raising different errors when called by the system account at the
146+
end of the block execution.
147+
148+
To see the list of generated tests, please refer to the
149+
`generate_system_contract_error_test` decorator definition.
150+
"""
151+
pass

0 commit comments

Comments
 (0)