-
Notifications
You must be signed in to change notification settings - Fork 186
/
Copy pathexecution.go
44 lines (39 loc) · 2.25 KB
/
execution.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
package protocol
import "github.com/onflow/flow-go/model/flow"
// SnapshotExecutionSubset is a subset of the protocol state snapshot that is needed by the FVM
// for execution.
type SnapshotExecutionSubset interface {
// RandomSource provides a source of entropy that can be
// expanded into randoms (using a pseudo-random generator).
// The returned slice should have at least 128 bits of entropy.
// The function doesn't error in normal operations, any
// error should be treated as an exception.
//
// `protocol.SnapshotExecutionSubset` implements `EntropyProvider` interface
// Note that `SnapshotExecutionSubset` possible errors for RandomSource() are:
// - storage.ErrNotFound if the QC is unknown.
// - state.ErrUnknownSnapshotReference if the snapshot reference block is unknown
// However, at this stage, snapshot reference block should be known and the QC should also be known,
// so no error is expected in normal operations, as required by `EntropyProvider`.
RandomSource() ([]byte, error)
// VersionBeacon returns the latest sealed version beacon.
// If no version beacon has been sealed so far during the current spork, returns nil.
// The latest VersionBeacon is only updated for finalized blocks. This means that, when
// querying an un-finalized fork, `VersionBeacon` will have the same value as querying
// the snapshot for the latest finalized block, even if a newer version beacon is included
// in a seal along the un-finalized fork.
//
// The SealedVersionBeacon must contain at least one entry. The first entry is for a past block height.
// The remaining entries are for all future block heights. Future version boundaries
// can be removed, in which case the emitted event will not contain the removed version
// boundaries.
VersionBeacon() (*flow.SealedVersionBeacon, error)
// ProtocolState is needed to check protocol version, which modifies the execution node's behaviour.
// TODO(mainnet27, #6773): remove this function https://github.com/onflow/flow-go/issues/6773
ProtocolState() (KVStoreReader, error)
}
// SnapshotExecutionSubsetProvider is an interface that provides a subset of the protocol state
// at a specific block.
type SnapshotExecutionSubsetProvider interface {
AtBlockID(blockID flow.Identifier) SnapshotExecutionSubset
}