@@ -38,8 +38,6 @@ type collectionInfo struct {
3838
3939 collectionIndex int
4040 * entity.CompleteCollection
41-
42- isSystemTransaction bool
4341}
4442
4543type TransactionRequest struct {
@@ -50,6 +48,8 @@ type TransactionRequest struct {
5048
5149 txnIndex uint32
5250
51+ isScheduledTransaction bool
52+ isSystemTransaction bool
5353 lastTransactionInCollection bool
5454
5555 ctx fvm.Context
@@ -62,6 +62,8 @@ func newTransactionRequest(
6262 collectionLogger zerolog.Logger ,
6363 txnIndex uint32 ,
6464 txnBody * flow.TransactionBody ,
65+ isScheduledTransaction bool ,
66+ isSystemTransaction bool ,
6567 lastTransactionInCollection bool ,
6668) TransactionRequest {
6769 txnId := txnBody .ID ()
@@ -83,6 +85,8 @@ func newTransactionRequest(
8385 txnId ,
8486 txnIndex ,
8587 txnBody ),
88+ isScheduledTransaction : isScheduledTransaction ,
89+ isSystemTransaction : isSystemTransaction ,
8690 lastTransactionInCollection : lastTransactionInCollection ,
8791 }
8892}
@@ -281,12 +285,11 @@ func (e *blockComputer) queueUserTransactions(
281285 Logger ()
282286
283287 collectionInfo := collectionInfo {
284- blockId : blockId ,
285- blockIdStr : blockIdStr ,
286- blockHeight : blockHeader .Height ,
287- collectionIndex : idx ,
288- CompleteCollection : collection ,
289- isSystemTransaction : false ,
288+ blockId : blockId ,
289+ blockIdStr : blockIdStr ,
290+ blockHeight : blockHeader .Height ,
291+ collectionIndex : idx ,
292+ CompleteCollection : collection ,
290293 }
291294
292295 for i , txnBody := range collection .Collection .Transactions {
@@ -296,7 +299,10 @@ func (e *blockComputer) queueUserTransactions(
296299 collectionLogger ,
297300 txnIndex ,
298301 txnBody ,
299- i == len (collection .Collection .Transactions )- 1 )
302+ false ,
303+ false ,
304+ i == len (collection .Collection .Transactions )- 1 ,
305+ )
300306 txnIndex += 1
301307 }
302308 }
@@ -307,49 +313,52 @@ func (e *blockComputer) queueUserTransactions(
307313func (e * blockComputer ) queueSystemTransactions (
308314 callbackCtx fvm.Context ,
309315 systemChunkCtx fvm.Context ,
310- systemColection collectionInfo ,
316+ systemCollection collectionInfo ,
311317 systemTxn * flow.TransactionBody ,
312318 executeCallbackTxs []* flow.TransactionBody ,
313319 txnIndex uint32 ,
314320 systemLogger zerolog.Logger ,
315321) chan TransactionRequest {
316- var logger zerolog.Logger
317322
318- systemChunkTxLogger := systemLogger .With ().
319- Uint32 ("num_txs" , uint32 (len (systemColection .CompleteCollection .Collection .Transactions ))).
323+ systemTxLogger := systemLogger .With ().
324+ Uint32 ("num_txs" , uint32 (len (systemCollection .CompleteCollection .Collection .Transactions ))).
325+ Bool ("system_transaction" , true ).
320326 Logger ()
321327
322- scheduledTxLogger := systemChunkTxLogger .With ().
328+ scheduledTxLogger := systemLogger .With ().
329+ Uint32 ("num_txs" , uint32 (len (systemCollection .CompleteCollection .Collection .Transactions ))).
323330 Bool ("scheduled_transaction" , true ).
324- Bool ("critical_error" , false ).
325331 Logger ()
326332
327- allTxs := append (executeCallbackTxs , systemTxn )
328- txQueue := make (chan TransactionRequest , len (allTxs ))
333+ txQueue := make (chan TransactionRequest , len (executeCallbackTxs )+ 1 )
329334 defer close (txQueue )
330335
331- for i , txBody := range allTxs {
332- systemChunkTx := i == len (allTxs )- 1 // last tx in collection is system chunk
333- ctx := callbackCtx
334- logger = scheduledTxLogger
335-
336- if systemChunkTx {
337- ctx = systemChunkCtx
338- logger = systemChunkTxLogger
339- }
340-
336+ for _ , txBody := range executeCallbackTxs {
341337 txQueue <- newTransactionRequest (
342- systemColection ,
343- ctx ,
344- logger ,
338+ systemCollection ,
339+ callbackCtx ,
340+ scheduledTxLogger ,
345341 txnIndex ,
346342 txBody ,
347- systemChunkTx ,
343+ true ,
344+ false ,
345+ false ,
348346 )
349347
350348 txnIndex ++
351349 }
352350
351+ txQueue <- newTransactionRequest (
352+ systemCollection ,
353+ systemChunkCtx ,
354+ systemTxLogger ,
355+ txnIndex ,
356+ systemTxn ,
357+ false ,
358+ true ,
359+ true ,
360+ )
361+
353362 return txQueue
354363}
355364
@@ -495,20 +504,17 @@ func (e *blockComputer) executeSystemTransactions(
495504 )
496505
497506 systemCollectionInfo := collectionInfo {
498- blockId : block .BlockID (),
499- blockIdStr : block .BlockID ().String (),
500- blockHeight : block .Block .Height ,
501- collectionIndex : userCollectionCount ,
502- CompleteCollection : nil , // We do not yet know all the scheduled callbacks, so postpone construction of the collection.
503- isSystemTransaction : true ,
507+ blockId : block .BlockID (),
508+ blockIdStr : block .BlockID ().String (),
509+ blockHeight : block .Block .Height ,
510+ collectionIndex : userCollectionCount ,
511+ CompleteCollection : nil , // We do not yet know all the scheduled callbacks, so postpone construction of the collection.
504512 }
505513
506- systemLogger := callbackCtx .Logger .With ().
514+ systemChunkLogger := callbackCtx .Logger .With ().
507515 Str ("block_id" , block .BlockID ().String ()).
508516 Uint64 ("height" , block .Block .Height ).
509517 Bool ("system_chunk" , true ).
510- Bool ("system_transaction" , true ).
511- Bool ("critical_error" , true ).
512518 Int ("num_collections" , userCollectionCount ).
513519 Logger ()
514520
@@ -528,7 +534,7 @@ func (e *blockComputer) executeSystemTransactions(
528534 database ,
529535 blockSpan ,
530536 txIndex ,
531- systemLogger ,
537+ systemChunkLogger ,
532538 )
533539 if err != nil {
534540 return err
@@ -565,7 +571,7 @@ func (e *blockComputer) executeSystemTransactions(
565571 e .systemTxn ,
566572 callbackTxs ,
567573 txIndex ,
568- systemLogger ,
574+ systemChunkLogger ,
569575 )
570576
571577 e .executeQueue (blockSpan , database , txQueue )
@@ -616,7 +622,7 @@ func (e *blockComputer) executeProcessCallback(
616622 systemLogger zerolog.Logger ,
617623) ([]* flow.TransactionBody , uint32 , error ) {
618624 callbackLogger := systemLogger .With ().
619- Bool ("scheduled_transaction " , true ).
625+ Bool ("system_transaction " , true ).
620626 Logger ()
621627
622628 request := newTransactionRequest (
@@ -625,6 +631,8 @@ func (e *blockComputer) executeProcessCallback(
625631 callbackLogger ,
626632 txnIndex ,
627633 e .processCallbackTxn ,
634+ false ,
635+ true ,
628636 false )
629637
630638 txnIndex ++
0 commit comments