github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/engine/execution/messages.go (about) 1 package execution 2 3 import ( 4 "github.com/onflow/flow-go/model/flow" 5 "github.com/onflow/flow-go/module/mempool/entity" 6 ) 7 8 type ComputationResult struct { 9 *BlockExecutionResult 10 *BlockAttestationResult 11 12 *flow.ExecutionReceipt 13 } 14 15 func NewEmptyComputationResult( 16 block *entity.ExecutableBlock, 17 ) *ComputationResult { 18 ber := NewPopulatedBlockExecutionResult(block) 19 aer := NewEmptyBlockAttestationResult(ber) 20 return &ComputationResult{ 21 BlockExecutionResult: ber, 22 BlockAttestationResult: aer, 23 } 24 } 25 26 // CurrentEndState returns the most recent end state 27 // if no attestation appended yet, it returns start state of block 28 // TODO(ramtin): we probably don't need this long term as part of this method 29 func (cr *ComputationResult) CurrentEndState() flow.StateCommitment { 30 if len(cr.collectionAttestationResults) == 0 { 31 return *cr.StartState 32 } 33 return cr.collectionAttestationResults[len(cr.collectionAttestationResults)-1].endStateCommit 34 }