@@ -195,6 +195,7 @@ func makeCBlockInfo(blockInfo *BlockInfo) C.BlockInfo {
195
195
196
196
cBlockInfo .block_number = C .ulonglong (blockInfo .Header .Number )
197
197
cBlockInfo .block_timestamp = C .ulonglong (blockInfo .Header .Timestamp )
198
+ cBlockInfo .is_pending = toUchar (blockInfo .Header .Hash == nil )
198
199
copyFeltIntoCArray (blockInfo .Header .SequencerAddress , & cBlockInfo .sequencer_address [0 ])
199
200
copyFeltIntoCArray (blockInfo .Header .L1GasPriceETH , & cBlockInfo .l1_gas_price_wei [0 ])
200
201
copyFeltIntoCArray (blockInfo .Header .L1GasPriceSTRK , & cBlockInfo .l1_gas_price_fri [0 ])
@@ -223,16 +224,6 @@ func (v *vm) Call(callInfo *CallInfo, blockInfo *BlockInfo, state core.StateRead
223
224
handle := cgo .NewHandle (context )
224
225
defer handle .Delete ()
225
226
226
- var concurrencyModeByte byte
227
- if v .concurrencyMode {
228
- concurrencyModeByte = 1
229
- }
230
- var structuredErrStackByte byte
231
- if structuredErrStack {
232
- structuredErrStackByte = 1
233
- }
234
- C .setVersionedConstants (C .CString ("my_json" ))
235
-
236
227
cCallInfo , callInfoPinner := makeCCallInfo (callInfo )
237
228
cBlockInfo := makeCBlockInfo (blockInfo )
238
229
chainID := C .CString (network .L2ChainID )
@@ -243,9 +234,9 @@ func (v *vm) Call(callInfo *CallInfo, blockInfo *BlockInfo, state core.StateRead
243
234
C .uintptr_t (handle ),
244
235
chainID ,
245
236
C .ulonglong (maxSteps ),
246
- C . uchar ( concurrencyModeByte ),
237
+ toUchar ( v . concurrencyMode ),
247
238
cSierraVersion ,
248
- C . uchar ( structuredErrStackByte ), //nolint:gocritic // don't know why the linter is annoyed
239
+ toUchar ( structuredErrStack ), //nolint:gocritic // See https://github.com/go-critic/go-critic/issues/897
249
240
)
250
241
callInfoPinner .Unpin ()
251
242
C .free (unsafe .Pointer (chainID ))
@@ -284,31 +275,6 @@ func (v *vm) Execute(txns []core.Transaction, declaredClasses []core.Class, paid
284
275
txnsJSONCstr := cstring (txnsJSON )
285
276
classesJSONCStr := cstring (classesJSON )
286
277
287
- var skipChargeFeeByte byte
288
- if skipChargeFee {
289
- skipChargeFeeByte = 1
290
- }
291
-
292
- var skipValidateByte byte
293
- if skipValidate {
294
- skipValidateByte = 1
295
- }
296
-
297
- var errOnRevertByte byte
298
- if errOnRevert {
299
- errOnRevertByte = 1
300
- }
301
-
302
- var errorStackByte byte
303
- if errorStack {
304
- errorStackByte = 1
305
- }
306
-
307
- var concurrencyModeByte byte
308
- if v .concurrencyMode {
309
- concurrencyModeByte = 1
310
- }
311
-
312
278
cBlockInfo := makeCBlockInfo (blockInfo )
313
279
chainID := C .CString (network .L2ChainID )
314
280
C .cairoVMExecute (txnsJSONCstr ,
@@ -317,11 +283,11 @@ func (v *vm) Execute(txns []core.Transaction, declaredClasses []core.Class, paid
317
283
& cBlockInfo ,
318
284
C .uintptr_t (handle ),
319
285
chainID ,
320
- C . uchar ( skipChargeFeeByte ),
321
- C . uchar ( skipValidateByte ),
322
- C . uchar ( errOnRevertByte ), //nolint:gocritic
323
- C . uchar ( concurrencyModeByte ), //nolint:gocritic
324
- C . uchar ( errorStackByte ), //nolint:gocritic
286
+ toUchar ( skipChargeFee ),
287
+ toUchar ( skipValidate ),
288
+ toUchar ( errOnRevert ),
289
+ toUchar ( v . concurrencyMode ),
290
+ toUchar ( errorStack ), //nolint:gocritic // See https://github.com/go-critic/go-critic/issues/897
325
291
)
326
292
327
293
C .free (unsafe .Pointer (classesJSONCStr ))
@@ -412,3 +378,10 @@ func SetVersionedConstants(filename string) error {
412
378
413
379
return err
414
380
}
381
+
382
+ func toUchar (b bool ) C.uchar {
383
+ if b {
384
+ return 1
385
+ }
386
+ return 0
387
+ }
0 commit comments