-
Notifications
You must be signed in to change notification settings - Fork 174
/
chunks.go
34 lines (30 loc) · 1.59 KB
/
chunks.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
package module
import (
"github.com/onflow/flow-go/engine/verification"
chmodels "github.com/onflow/flow-go/model/chunks"
"github.com/onflow/flow-go/model/flow"
)
// ChunkAssigner presents an interface for assigning chunks to the verifier nodes
type ChunkAssigner interface {
// Assign generates the assignment
// error returns:
// * NoValidChildBlockError indicates that no valid child block is known
// (which contains the block's source of randomness)
// * unexpected errors should be considered symptoms of internal bugs
Assign(result *flow.ExecutionResult, blockID flow.Identifier) (*chmodels.Assignment, error)
}
// ChunkVerifier provides functionality to verify chunks
type ChunkVerifier interface {
// Verify verifies the given VerifiableChunk by executing it and checking the final state commitment
// It returns a Spock Secret as a byte array, verification fault of the chunk, and an error.
// Note: Verify should only be executed on non-system chunks. It returns an error if it is invoked on
// system chunk.
// TODO return challenges plus errors
Verify(ch *verification.VerifiableChunkData) ([]byte, chmodels.ChunkFault, error)
// VerifySystemChunk verifies a given VerifiableChunk corresponding to a system chunk.
// by executing it and checking the final state commitment
// It returns a Spock Secret as a byte array, verification fault of the chunk, and an error.
// Note: Verify should only be executed on system chunks. It returns an error if it is invoked on
// non-system chunks.
SystemChunkVerify(ch *verification.VerifiableChunkData) ([]byte, chmodels.ChunkFault, error)
}