-
Notifications
You must be signed in to change notification settings - Fork 175
/
consumer.go
96 lines (72 loc) · 3.02 KB
/
consumer.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
package result
import (
"github.com/onflow/flow-go/fvm/storage/snapshot"
"github.com/onflow/flow-go/model/flow"
"github.com/onflow/flow-go/module"
)
type ExecutableCollection interface {
// BlockHeader returns the block header in which collection was included
BlockHeader() *flow.Header
// Collection returns the content of the collection
Collection() *flow.Collection
// CollectionIndex returns the index of collection in the block
CollectionIndex() int
// IsSystemCollection returns true if the collection is the last collection of the block
IsSystemCollection() bool
}
// ExecutedCollection holds results of a collection execution
type ExecutedCollection interface {
// Events returns a list of all the events emitted during collection execution
Events() flow.EventsList
// ServiceEventList returns a list of only service events emitted during this collection
ServiceEventList() flow.EventsList
// ConvertedServiceEvents returns a list of converted service events
ConvertedServiceEvents() flow.ServiceEventList
// TransactionResults returns a list of transaction results
TransactionResults() flow.TransactionResults
// ExecutionSnapshot returns the execution snapshot
ExecutionSnapshot() *snapshot.ExecutionSnapshot
}
// ExecutedCollectionConsumer consumes ExecutedCollections
type ExecutedCollectionConsumer interface {
module.ReadyDoneAware
OnExecutedCollection(res ExecutedCollection) error
}
// AttestedCollection holds results of a collection attestation
type AttestedCollection interface {
ExecutedCollection
// StartStateCommitment returns a commitment to the state before collection execution
StartStateCommitment() flow.StateCommitment
// EndStateCommitment returns a commitment to the state after collection execution
EndStateCommitment() flow.StateCommitment
// StateProof returns state proofs that could be used to build a partial trie
StateProof() flow.StorageProof
// TODO(ramtin): unlock these
// // StateDeltaCommitment returns a commitment over the state delta
// StateDeltaCommitment() flow.Identifier
// // TxResultListCommitment returns a commitment over the list of transaction results
// TxResultListCommitment() flow.Identifier
// EventCommitment returns commitment over eventList
EventListCommitment() flow.Identifier
}
// AttestedCollectionConsumer consumes AttestedCollection
type AttestedCollectionConsumer interface {
module.ReadyDoneAware
OnAttestedCollection(ac AttestedCollection) error
}
type ExecutedBlock interface {
// BlockHeader returns the block header in which collection was included
BlockHeader() *flow.Header
// Receipt returns the execution receipt
Receipt() *flow.ExecutionReceipt
// AttestedCollections returns attested collections
//
// TODO(ramtin): this could be reduced, currently we need this
// to store chunk data packs, trie updates package used by access nodes,
AttestedCollections() []AttestedCollection
}
// ExecutedBlockConsumer consumes ExecutedBlock
type ExecutedBlockConsumer interface {
module.ReadyDoneAware
OnExecutedBlock(eb ExecutedBlock) error
}