@@ -51,6 +51,7 @@ use crate::transaction::objects::{
51
51
TransactionVersion :: ONE ,
52
52
false ,
53
53
false ,
54
+ false ,
54
55
false ;
55
56
"Native: Validate execution mode: block info fields should be zeroed. Transaction V1."
56
57
)
@@ -63,6 +64,7 @@ use crate::transaction::objects::{
63
64
TransactionVersion :: ONE ,
64
65
false ,
65
66
false ,
67
+ false ,
66
68
false ;
67
69
"Native: Execute execution mode: block info should be as usual. Transaction V1."
68
70
)
@@ -75,6 +77,7 @@ use crate::transaction::objects::{
75
77
TransactionVersion :: THREE ,
76
78
false ,
77
79
false ,
80
+ false ,
78
81
false ;
79
82
"Native: Validate execution mode: block info fields should be zeroed. Transaction V3."
80
83
)
@@ -87,6 +90,7 @@ use crate::transaction::objects::{
87
90
TransactionVersion :: THREE ,
88
91
false ,
89
92
false ,
93
+ false ,
90
94
false ;
91
95
"Native: Execute execution mode: block info should be as usual. Transaction V3."
92
96
)
@@ -99,6 +103,7 @@ use crate::transaction::objects::{
99
103
TransactionVersion :: ONE ,
100
104
false ,
101
105
false ,
106
+ false ,
102
107
false ;
103
108
"Native: Legacy contract. Execute execution mode: block info should be as usual. Transaction
104
109
V1."
@@ -112,6 +117,7 @@ use crate::transaction::objects::{
112
117
TransactionVersion :: THREE ,
113
118
false ,
114
119
false ,
120
+ false ,
115
121
false ;
116
122
"Native: Legacy contract. Execute execution mode: block info should be as usual. Transaction
117
123
V3."
@@ -125,6 +131,7 @@ use crate::transaction::objects::{
125
131
TransactionVersion :: THREE ,
126
132
true ,
127
133
false ,
134
+ false ,
128
135
false ;
129
136
"Native: Execute execution mode: block info should be as usual. Transaction V3. Query"
130
137
)
@@ -137,6 +144,7 @@ use crate::transaction::objects::{
137
144
TransactionVersion :: THREE ,
138
145
false ,
139
146
true ,
147
+ false ,
140
148
false ;
141
149
"Native: V1 bound account: execute"
142
150
)
@@ -149,6 +157,7 @@ use crate::transaction::objects::{
149
157
TransactionVersion :: THREE ,
150
158
true ,
151
159
true ,
160
+ false ,
152
161
false ;
153
162
"Native: V1 bound account: query"
154
163
)
@@ -159,6 +168,7 @@ use crate::transaction::objects::{
159
168
TransactionVersion :: ONE ,
160
169
false ,
161
170
false ,
171
+ false ,
162
172
false ;
163
173
"Validate execution mode: block info fields should be zeroed. Transaction V1." ) ]
164
174
#[ test_case(
@@ -167,6 +177,7 @@ use crate::transaction::objects::{
167
177
TransactionVersion :: ONE ,
168
178
false ,
169
179
false ,
180
+ false ,
170
181
false ;
171
182
"Execute execution mode: block info should be as usual. Transaction V1." ) ]
172
183
#[ test_case(
@@ -175,6 +186,7 @@ use crate::transaction::objects::{
175
186
TransactionVersion :: THREE ,
176
187
false ,
177
188
false ,
189
+ false ,
178
190
false ;
179
191
"Validate execution mode: block info fields should be zeroed. Transaction V3." ) ]
180
192
#[ test_case(
@@ -183,6 +195,7 @@ use crate::transaction::objects::{
183
195
TransactionVersion :: THREE ,
184
196
false ,
185
197
false ,
198
+ false ,
186
199
false ;
187
200
"Execute execution mode: block info should be as usual. Transaction V3." ) ]
188
201
#[ test_case(
@@ -191,6 +204,7 @@ use crate::transaction::objects::{
191
204
TransactionVersion :: ONE ,
192
205
false ,
193
206
false ,
207
+ false ,
194
208
false ;
195
209
"Legacy contract. Execute execution mode: block info should be as usual. Transaction V1." ) ]
196
210
#[ test_case(
@@ -199,6 +213,7 @@ use crate::transaction::objects::{
199
213
TransactionVersion :: THREE ,
200
214
false ,
201
215
false ,
216
+ false ,
202
217
false ;
203
218
"Legacy contract. Execute execution mode: block info should be as usual. Transaction V3." ) ]
204
219
#[ test_case(
@@ -207,6 +222,7 @@ use crate::transaction::objects::{
207
222
TransactionVersion :: THREE ,
208
223
true ,
209
224
false ,
225
+ false ,
210
226
false ;
211
227
"Execute execution mode: block info should be as usual. Transaction V3. Query." ) ]
212
228
#[ test_case(
@@ -215,6 +231,7 @@ use crate::transaction::objects::{
215
231
TransactionVersion :: THREE ,
216
232
false ,
217
233
true ,
234
+ false ,
218
235
false ;
219
236
"V1 bound account: execute" ) ]
220
237
#[ test_case(
@@ -223,16 +240,36 @@ use crate::transaction::objects::{
223
240
TransactionVersion :: THREE ,
224
241
false ,
225
242
true ,
226
- true ;
243
+ true ,
244
+ false ;
227
245
"V1 bound account: execute, high tip" ) ]
228
246
#[ test_case(
229
247
FeatureContract :: TestContract ( CairoVersion :: Cairo1 ( RunnableCairo1 :: Casm ) ) ,
230
248
ExecutionMode :: Execute ,
231
249
TransactionVersion :: THREE ,
232
250
true ,
233
251
true ,
252
+ false ,
234
253
false ;
235
254
"V1 bound account: query" ) ]
255
+ #[ test_case(
256
+ FeatureContract :: TestContract ( CairoVersion :: Cairo1 ( RunnableCairo1 :: Casm ) ) ,
257
+ ExecutionMode :: Execute ,
258
+ TransactionVersion :: THREE ,
259
+ false ,
260
+ false ,
261
+ false ,
262
+ true ;
263
+ "Exclude l1 data gas: execute" ) ]
264
+ #[ test_case(
265
+ FeatureContract :: TestContract ( CairoVersion :: Cairo1 ( RunnableCairo1 :: Casm ) ) ,
266
+ ExecutionMode :: Execute ,
267
+ TransactionVersion :: THREE ,
268
+ true ,
269
+ false ,
270
+ false ,
271
+ true ;
272
+ "Exclude l1 data gas: query" ) ]
236
273
fn test_get_execution_info (
237
274
test_contract : FeatureContract ,
238
275
execution_mode : ExecutionMode ,
@@ -241,13 +278,21 @@ fn test_get_execution_info(
241
278
v1_bound_account : bool ,
242
279
// Whether the tip is larger than `v1_bound_accounts_max_tip`.
243
280
high_tip : bool ,
281
+ exclude_l1_data_gas : bool ,
244
282
) {
245
283
let mut test_contract_data: FeatureContractData = test_contract. into ( ) ;
246
284
if v1_bound_account {
285
+ assert ! (
286
+ !exclude_l1_data_gas,
287
+ "Unable to set both exclude_l1_data_gas and v1_bound_account."
288
+ ) ;
247
289
let optional_class_hash =
248
290
VersionedConstants :: latest_constants ( ) . os_constants . v1_bound_accounts_cairo1 . first ( ) ;
249
291
test_contract_data. class_hash =
250
292
* optional_class_hash. expect ( "No v1 bound accounts found in versioned constants." ) ;
293
+ } else if exclude_l1_data_gas {
294
+ test_contract_data. class_hash =
295
+ * VersionedConstants :: latest_constants ( ) . os_constants . data_gas_accounts . first ( ) . unwrap ( ) ;
251
296
}
252
297
let state =
253
298
& mut test_state_ex ( & ChainInfo :: create_for_testing ( ) , BALANCE , & [ ( test_contract_data, 1 ) ] ) ;
@@ -329,15 +374,17 @@ fn test_get_execution_info(
329
374
( _, version) if version == TransactionVersion :: ONE => vec ! [
330
375
felt!( 0_u16 ) , // Length of resource bounds array.
331
376
] ,
332
- ( _, _) => vec ! [ felt!( 3_u8 ) ] // Length of resource bounds array.
333
- . into_iter ( )
334
- . chain (
335
- valid_resource_bounds_as_felts ( & all_resource_bounds)
336
- . unwrap ( )
337
- . into_iter ( )
338
- . flat_map ( |bounds| bounds. flatten ( ) ) ,
339
- )
340
- . collect ( ) ,
377
+ ( _, _) => {
378
+ vec ! [ felt!( if exclude_l1_data_gas { 2_u8 } else { 3 } ) ] // Length of resource bounds array.
379
+ . into_iter ( )
380
+ . chain (
381
+ valid_resource_bounds_as_felts ( & all_resource_bounds, exclude_l1_data_gas)
382
+ . unwrap ( )
383
+ . into_iter ( )
384
+ . flat_map ( |bounds| bounds. flatten ( ) ) ,
385
+ )
386
+ . collect ( )
387
+ }
341
388
} ;
342
389
343
390
let expected_tx_info: Vec < Felt > ;
0 commit comments