@@ -195,6 +195,7 @@ func makeCBlockInfo(blockInfo *BlockInfo) C.BlockInfo {
195195
196196 cBlockInfo .block_number = C .ulonglong (blockInfo .Header .Number )
197197 cBlockInfo .block_timestamp = C .ulonglong (blockInfo .Header .Timestamp )
198+ cBlockInfo .is_pending = toUchar (blockInfo .Header .Hash == nil )
198199 copyFeltIntoCArray (blockInfo .Header .SequencerAddress , & cBlockInfo .sequencer_address [0 ])
199200 copyFeltIntoCArray (blockInfo .Header .L1GasPriceETH , & cBlockInfo .l1_gas_price_wei [0 ])
200201 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
223224 handle := cgo .NewHandle (context )
224225 defer handle .Delete ()
225226
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-
236227 cCallInfo , callInfoPinner := makeCCallInfo (callInfo )
237228 cBlockInfo := makeCBlockInfo (blockInfo )
238229 chainID := C .CString (network .L2ChainID )
@@ -243,9 +234,9 @@ func (v *vm) Call(callInfo *CallInfo, blockInfo *BlockInfo, state core.StateRead
243234 C .uintptr_t (handle ),
244235 chainID ,
245236 C .ulonglong (maxSteps ),
246- C . uchar ( concurrencyModeByte ),
237+ toUchar ( v . concurrencyMode ),
247238 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
249240 )
250241 callInfoPinner .Unpin ()
251242 C .free (unsafe .Pointer (chainID ))
@@ -284,31 +275,6 @@ func (v *vm) Execute(txns []core.Transaction, declaredClasses []core.Class, paid
284275 txnsJSONCstr := cstring (txnsJSON )
285276 classesJSONCStr := cstring (classesJSON )
286277
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-
312278 cBlockInfo := makeCBlockInfo (blockInfo )
313279 chainID := C .CString (network .L2ChainID )
314280 C .cairoVMExecute (txnsJSONCstr ,
@@ -317,11 +283,11 @@ func (v *vm) Execute(txns []core.Transaction, declaredClasses []core.Class, paid
317283 & cBlockInfo ,
318284 C .uintptr_t (handle ),
319285 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
325291 )
326292
327293 C .free (unsafe .Pointer (classesJSONCStr ))
@@ -412,3 +378,10 @@ func SetVersionedConstants(filename string) error {
412378
413379 return err
414380}
381+
382+ func toUchar (b bool ) C.uchar {
383+ if b {
384+ return 1
385+ }
386+ return 0
387+ }
0 commit comments