-
Notifications
You must be signed in to change notification settings - Fork 178
/
messages.go
51 lines (42 loc) · 1.55 KB
/
messages.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package execution
import (
"github.com/onflow/flow-go/engine/execution/state/delta"
"github.com/onflow/flow-go/ledger"
"github.com/onflow/flow-go/model/flow"
"github.com/onflow/flow-go/module/mempool/entity"
)
// TODO If the executor will be a separate process/machine we would need to rework
// sending view as local data, but that would be much greater refactor of storage anyway
type ComputationOrder struct {
Block *entity.ExecutableBlock
View *delta.View
StartState flow.StateCommitment
}
type ComputationResult struct {
ExecutableBlock *entity.ExecutableBlock
StateSnapshots []*delta.SpockSnapshot
StateCommitments []flow.StateCommitment
Proofs [][]byte
Events []flow.EventsList
EventsHashes []flow.Identifier
ServiceEvents flow.EventsList
TransactionResults []flow.TransactionResult
ComputationUsed uint64
StateReads uint64
TrieUpdates []*ledger.TrieUpdate
}
func (cr *ComputationResult) AddEvents(chunkIndex int, inp []flow.Event) {
cr.Events[chunkIndex] = append(cr.Events[chunkIndex], inp...)
}
func (cr *ComputationResult) AddServiceEvents(inp []flow.Event) {
cr.ServiceEvents = append(cr.ServiceEvents, inp...)
}
func (cr *ComputationResult) AddTransactionResult(inp *flow.TransactionResult) {
cr.TransactionResults = append(cr.TransactionResults, *inp)
}
func (cr *ComputationResult) AddComputationUsed(inp uint64) {
cr.ComputationUsed += inp
}
func (cr *ComputationResult) AddStateSnapshot(inp *delta.SpockSnapshot) {
cr.StateSnapshots = append(cr.StateSnapshots, inp)
}