-
Notifications
You must be signed in to change notification settings - Fork 174
/
receipt_validator.go
41 lines (37 loc) · 1.58 KB
/
receipt_validator.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
package module
import "github.com/onflow/flow-go/model/flow"
// ReceiptValidator is an interface which is used for validating
// receipts with respect to current protocol state.
type ReceiptValidator interface {
// Validate verifies that the ExecutionReceipt satisfies
// the following conditions:
// * is from Execution node with positive weight
// * has valid signature
// * chunks are in correct format
// * execution result has a valid parent and satisfies the subgraph check
// Returns nil if all checks passed successfully.
// Expected errors during normal operations:
// * engine.InvalidInputError
// if receipt violates protocol condition
// * engine.UnverifiableInputError
// if receipt's parent result is unknown
Validate(receipts *flow.ExecutionReceipt) error
// ValidatePayload verifies the ExecutionReceipts and ExecutionResults
// in the payload for compliance with the protocol:
// Receipts:
// * are from Execution node with positive weight
// * have valid signature
// * chunks are in correct format
// * no duplicates in fork
// Results:
// * have valid parents and satisfy the subgraph check
// * extend the execution tree, where the tree root is the latest
// finalized block and only results from this fork are included
// * no duplicates in fork
// Expected errors during normal operations:
// * engine.InvalidInputError
// if some receipts in the candidate block violate protocol condition
// * engine.UnverifiableInputError
// if for some of the receipts, their respective parent result is unknown
ValidatePayload(candidate *flow.Block) error
}