Skip to content
This repository was archived by the owner on Jul 2, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 5 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
"""
Comment thread
marioevz marked this conversation as resolved.
Outdated
abstract: Tests [EIP-7685: General purpose execution layer requests](https://eips.ethereum.org/EIPS/eip-7685)
Cross testing for withdrawal and deposit request for [EIP-7685: General purpose execution layer requests](https://eips.ethereum.org/EIPS/eip-7685).

""" # noqa: E501

import pytest

from ethereum_test_tools import (
Account,
Alloc,
Block,
BlockchainTestFiller,
Header,
Transaction,
)
from ethereum_test_types import Requests
from ethereum_test_types.types import EOA
from tests.prague.eip7685_general_purpose_el_requests.test_multi_type_requests import (
single_withdrawal_from_contract,
single_withdrawal_from_eoa,
)

from ..eip7002_el_triggerable_withdrawals.helpers import (
WithdrawalRequestContract,
)
from ..eip7002_el_triggerable_withdrawals.spec import Spec as Spec_EIP7002
from .spec import ref_spec_7685

REFERENCE_SPEC_GIT_PATH: str = ref_spec_7685.git_path
REFERENCE_SPEC_VERSION: str = ref_spec_7685.version


@pytest.mark.parametrize(
"requests",
[
# create 18 withdrawal contract requests (usually 16 is max, but modified_code dequeues 18)
[
single_withdrawal_from_contract(i)
Comment thread
marioevz marked this conversation as resolved.
Outdated
for i in range(
0,
18,
)
],
# create 18 withdrawal requests
[
single_withdrawal_from_eoa(i)
for i in range(
0,
18,
)
],
],
)
def test_extra_withdrawals(
blockchain_test: BlockchainTestFiller,
pre: Alloc,
requests: WithdrawalRequestContract,
):
"""Test how clients were to behave when more than 16 withdrawals would be allowed per block."""
modified_code: bytes = b"3373fffffffffffffffffffffffffffffffffffffffe1460cb5760115f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff146101f457600182026001905f5b5f82111560685781019083028483029004916001019190604d565b909390049250505036603814608857366101f457346101f4575f5260205ff35b34106101f457600154600101600155600354806003026004013381556001015f35815560010160203590553360601b5f5260385f601437604c5fa0600101600355005b6003546002548082038060121160df575060125b5f5b8181146101835782810160030260040181604c02815460601b8152601401816001015481526020019060020154807fffffffffffffffffffffffffffffffff00000000000000000000000000000000168252906010019060401c908160381c81600701538160301c81600601538160281c81600501538160201c81600401538160181c81600301538160101c81600201538160081c81600101535360010160e1565b910180921461019557906002556101a0565b90505f6002555f6003555b5f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14156101cd57505f5b6001546002828201116101e25750505f6101e8565b01600290035b5f555f600155604c025ff35b5f5ffd" # noqa: E501
pre[Spec_EIP7002.WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS] = Account(
code=modified_code,
nonce=1,
balance=0,
)

sender: EOA = pre.fund_eoa()
tx: Transaction = Transaction(
Comment thread
marioevz marked this conversation as resolved.
Outdated
to=Spec_EIP7002.WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS,
sender=sender,
gas_limit=100_000,
)

blockchain_test(
pre=pre,
blocks=[
Block(
txs=[tx],
# header_verify=Header(
# requests_hash=Requests(
Comment thread
marioevz marked this conversation as resolved.
Outdated
# *[
# request.with_source_address(
# Spec_EIP7002.WITHDRAWAL_REQUEST_PREDEPLOY_SENDER
# )
# for request in sorted(requests, key=lambda r: r.type)
# ],
# )
#
# requests_hash=requests,
#
# withdrawals_root=requests,
# ),
),
],
post={},
)
Loading