44
55""" # noqa: E501
66
7- import pytest
7+ from typing import List
88
99from ethereum_test_tools import (
1010 Account ,
1111 Alloc ,
1212 Block ,
1313 BlockchainTestFiller ,
14- Header ,
1514 Transaction ,
1615)
1716from ethereum_test_types import Requests
18- from ethereum_test_types .types import EOA
19- from tests .prague .eip7685_general_purpose_el_requests .test_multi_type_requests import (
20- single_withdrawal_from_contract ,
21- single_withdrawal_from_eoa ,
22- )
2317
2418from ..eip7002_el_triggerable_withdrawals .helpers import (
25- WithdrawalRequestContract ,
19+ WithdrawalRequest ,
20+ # WithdrawalRequestBase,
21+ # WithdrawalRequestContract,
22+ WithdrawalRequestTransaction ,
2623)
2724from ..eip7002_el_triggerable_withdrawals .spec import Spec as Spec_EIP7002
2825from .spec import ref_spec_7685
3128REFERENCE_SPEC_VERSION : str = ref_spec_7685 .version
3229
3330
34- @pytest .mark .parametrize (
35- "requests" ,
36- [
37- # create 18 withdrawal contract requests (usually 16 is max, but modified_code dequeues 18)
38- [
39- single_withdrawal_from_contract (i )
40- for i in range (
41- 0 ,
42- 18 ,
43- )
44- ],
45- # create 18 withdrawal requests
46- [
47- single_withdrawal_from_eoa (i )
48- for i in range (
49- 0 ,
50- 18 ,
51- )
52- ],
53- ],
54- )
31+ # @pytest.mark.parametrize(
32+ # "requests_list",
33+ # [
34+ # WithdrawalRequest(
35+ # validator_pubkey=0x01,
36+ # amount=0,
37+ # fee=Spec_EIP7002.get_fee(0),
38+ # ),
39+ # WithdrawalRequest(
40+ # validator_pubkey=0x01,
41+ # amount=0,
42+ # fee=Spec_EIP7002.get_fee(0),
43+ # ),
44+ # ],
45+ # )
5546def test_extra_withdrawals (
5647 blockchain_test : BlockchainTestFiller ,
5748 pre : Alloc ,
58- requests : WithdrawalRequestContract ,
49+ # requests_list: List[WithdrawalRequest] ,
5950):
6051 """Test how clients were to behave when more than 16 withdrawals would be allowed per block."""
6152 modified_code : bytes = b"3373fffffffffffffffffffffffffffffffffffffffe1460cb5760115f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff146101f457600182026001905f5b5f82111560685781019083028483029004916001019190604d565b909390049250505036603814608857366101f457346101f4575f5260205ff35b34106101f457600154600101600155600354806003026004013381556001015f35815560010160203590553360601b5f5260385f601437604c5fa0600101600355005b6003546002548082038060121160df575060125b5f5b8181146101835782810160030260040181604c02815460601b8152601401816001015481526020019060020154807fffffffffffffffffffffffffffffffff00000000000000000000000000000000168252906010019060401c908160381c81600701538160301c81600601538160281c81600501538160201c81600401538160181c81600301538160101c81600201538160081c81600101535360010160e1565b910180921461019557906002556101a0565b90505f6002555f6003555b5f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14156101cd57505f5b6001546002828201116101e25750505f6101e8565b01600290035b5f555f600155604c025ff35b5f5ffd" # noqa: E501
@@ -65,32 +56,34 @@ def test_extra_withdrawals(
6556 balance = 0 ,
6657 )
6758
68- sender : EOA = pre .fund_eoa ()
69- tx : Transaction = Transaction (
70- to = Spec_EIP7002 .WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS ,
71- sender = sender ,
72- gas_limit = 100_000 ,
73- )
59+ # TODO: when i replace the following list with the parameterized version nothing works, why?
60+ requests_list : List [WithdrawalRequest ] = [
61+ WithdrawalRequest (
62+ validator_pubkey = 0x01 ,
63+ amount = 0 ,
64+ fee = Spec_EIP7002 .get_fee (0 ),
65+ ),
66+ WithdrawalRequest (
67+ validator_pubkey = 0x01 ,
68+ amount = 0 ,
69+ fee = Spec_EIP7002 .get_fee (0 ),
70+ ),
71+ ]
72+
73+ # given a list of withdrawal requests construct a withdrawal request transaction
74+ withdrawal_request_transaction = WithdrawalRequestTransaction (requests = requests_list )
75+ # prepare withdrawal senders
76+ withdrawal_request_transaction .update_pre (pre = pre )
77+ # get transaction list
78+ txs : List [Transaction ] = withdrawal_request_transaction .transactions ()
7479
7580 blockchain_test (
7681 pre = pre ,
7782 blocks = [
7883 Block (
79- txs = [tx ],
80- # header_verify=Header(
81- # requests_hash=Requests(
82- # *[
83- # request.with_source_address(
84- # Spec_EIP7002.WITHDRAWAL_REQUEST_PREDEPLOY_SENDER
85- # )
86- # for request in sorted(requests, key=lambda r: r.type)
87- # ],
88- # )
89- #
90- # requests_hash=requests,
91- #
92- # withdrawals_root=requests,
93- # ),
84+ txs = txs ,
85+ # TODO: why do i have to put the first element here to avoid an error? there is more than 1 request per block # noqa: E501
86+ requests_hash = Requests (requests_list [0 ]),
9487 ),
9588 ],
9689 post = {},
0 commit comments