@@ -11,6 +11,7 @@ import (
1111 "github.com/onflow/flow-go/crypto"
1212 "github.com/onflow/flow-go/crypto/hash"
1313 "github.com/onflow/flow-go/engine/execution"
14+ "github.com/onflow/flow-go/engine/execution/computation/result"
1415 "github.com/onflow/flow-go/engine/execution/state/delta"
1516 "github.com/onflow/flow-go/fvm/state"
1617 "github.com/onflow/flow-go/ledger"
@@ -41,6 +42,7 @@ type transactionResult struct {
4142 * state.ExecutionSnapshot
4243}
4344
45+ // TODO(ramtin): move committer and other folks to consumers layer
4446type resultCollector struct {
4547 tracer module.Tracer
4648 blockSpan otelTrace.Span
@@ -62,7 +64,8 @@ type resultCollector struct {
6264
6365 parentBlockExecutionResultID flow.Identifier
6466
65- result * execution.ComputationResult
67+ result * execution.ComputationResult
68+ consumers []result.ExecutedCollectionConsumer
6669
6770 chunks []* flow.Chunk
6871 spockSignatures []crypto.Signature
@@ -88,6 +91,7 @@ func newResultCollector(
8891 parentBlockExecutionResultID flow.Identifier ,
8992 block * entity.ExecutableBlock ,
9093 numTransactions int ,
94+ consumers []result.ExecutedCollectionConsumer ,
9195) * resultCollector {
9296 numCollections := len (block .Collections ()) + 1
9397 now := time .Now ()
@@ -104,6 +108,7 @@ func newResultCollector(
104108 executionDataProvider : executionDataProvider ,
105109 parentBlockExecutionResultID : parentBlockExecutionResultID ,
106110 result : execution .NewEmptyComputationResult (block ),
111+ consumers : consumers ,
107112 chunks : make ([]* flow.Chunk , 0 , numCollections ),
108113 spockSignatures : make ([]crypto.Signature , 0 , numCollections ),
109114 blockStartTime : now ,
@@ -226,6 +231,13 @@ func (collector *resultCollector) commitCollection(
226231 NumberOfCollections : 1 ,
227232 }
228233
234+ for _ , consumer := range collector .consumers {
235+ err = consumer .OnExecutedCollection (collector .result .CollectionResult (collection .collectionIndex ))
236+ if err != nil {
237+ return fmt .Errorf ("consumer failed: %w" , err )
238+ }
239+ }
240+
229241 return nil
230242}
231243
0 commit comments