github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/module/executiondatasync/execution_data/execution_data.go (about) 1 package execution_data 2 3 import ( 4 "github.com/onflow/flow-go/ledger" 5 "github.com/onflow/flow-go/model/flow" 6 ) 7 8 // DefaultMaxBlobSize is the default maximum size of a blob. 9 // This is calibrated to fit within a libp2p message and not exceed the max size recommended by bitswap. 10 const DefaultMaxBlobSize = 1 << 20 // 1MiB 11 12 // ChunkExecutionData represents the execution data of a chunk 13 type ChunkExecutionData struct { 14 // Collection is the collection for which this chunk was executed 15 Collection *flow.Collection 16 17 // Events are the events generated by executing the collection 18 Events flow.EventsList 19 20 // TrieUpdate is the trie update generated by executing the collection 21 // This includes a list of all registers updated during the execution 22 TrieUpdate *ledger.TrieUpdate 23 24 // TransactionResults are the results of executing the transactions in the collection 25 // This includes all of the data from flow.TransactionResult, except that it uses a boolean 26 // value to indicate if an error occurred instead of a full error message. 27 TransactionResults []flow.LightTransactionResult 28 } 29 30 // BlockExecutionData represents the execution data of a block. 31 type BlockExecutionData struct { 32 BlockID flow.Identifier 33 ChunkExecutionDatas []*ChunkExecutionData 34 } 35 36 // ConvertTransactionResults converts a list of flow.TransactionResults into a list of 37 // flow.LightTransactionResults to be included in a ChunkExecutionData. 38 func ConvertTransactionResults(results flow.TransactionResults) []flow.LightTransactionResult { 39 if len(results) == 0 { 40 return nil 41 } 42 43 converted := make([]flow.LightTransactionResult, len(results)) 44 for i, txResult := range results { 45 converted[i] = flow.LightTransactionResult{ 46 TransactionID: txResult.TransactionID, 47 ComputationUsed: txResult.ComputationUsed, 48 Failed: txResult.ErrorMessage != "", 49 } 50 } 51 return converted 52 }