38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167 | @pytest.mark.parametrize(
"requests",
[
pytest.param(
[
SystemContractInteractionTransaction(
requests=[
DepositRequest(
pubkey=0x01,
withdrawal_credentials=0x02,
amount=32_000_000_000,
signature=0x03,
index=0x0,
valid=False,
),
DepositRequest(
pubkey=0x01,
withdrawal_credentials=0x02,
amount=32_000_000_000,
signature=0x03,
index=0x0,
),
],
# From traces, gas used by the first tx is 82,718
# so reduce by one here
gas_limits=[0x1431D, None],
),
],
id="multiple_deposit_from_same_eoa_first_oog",
),
pytest.param(
[
SystemContractInteractionTransaction(
requests=[
DepositRequest(
pubkey=0x01,
withdrawal_credentials=0x02,
amount=32_000_000_000,
signature=0x03,
index=0x0,
),
DepositRequest(
pubkey=0x01,
withdrawal_credentials=0x02,
amount=32_000_000_000,
signature=0x03,
index=0x0,
valid=False,
),
],
# From traces, gas used by the second tx is 68,594,
# reduce by one here
gas_limits=[None, 0x10BF1],
),
],
id="multiple_deposit_from_same_eoa_last_oog",
),
pytest.param(
[
SystemContractInteractionContract(
requests=[
DepositRequest(
pubkey=0x01,
withdrawal_credentials=0x02,
amount=1_000_000_000,
signature=0x03,
index=0x0,
valid=False,
),
DepositRequest(
pubkey=0x01,
withdrawal_credentials=0x02,
amount=1_000_000_000,
signature=0x03,
index=0x0,
),
],
# Starve the first inner call of gas
gas_limits=[100, None],
),
],
id="multiple_deposits_from_contract_first_oog",
),
pytest.param(
[
SystemContractInteractionContract(
requests=[
DepositRequest(
pubkey=0x01,
withdrawal_credentials=0x02,
amount=1_000_000_000,
signature=0x03,
index=0x0,
),
DepositRequest(
pubkey=0x01,
withdrawal_credentials=0x02,
amount=1_000_000_000,
signature=0x03,
index=0x0,
valid=False,
),
],
# Starve the last inner call of gas
gas_limits=[None, 100],
),
],
id="multiple_deposits_from_contract_last_oog",
),
],
)
@pytest.mark.slow()
def test_deposit_out_of_gas(
blockchain_test: BlockchainTestFiller,
pre: Alloc,
blocks: List[Block],
) -> None:
"""
Test that a deposit request whose triggering call runs out of gas is not
included, while the other requests in the block are.
The gas limits are supplied per-request via the interaction's `gas_limits`
list rather than being baked into the deposit request descriptor, keeping
the gas concern isolated to these dedicated tests.
"""
blockchain_test(
pre=pre,
post={},
blocks=blocks,
)
|