github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/module/receipt_validator.go (about)

     1  package module
     2  
     3  import "github.com/onflow/flow-go/model/flow"
     4  
     5  // ReceiptValidator is an interface which is used for validating
     6  // receipts with respect to current protocol state.
     7  type ReceiptValidator interface {
     8  
     9  	// Validate verifies that the ExecutionReceipt satisfies
    10  	// the following conditions:
    11  	// 	* is from Execution node with positive weight
    12  	//	* has valid signature
    13  	//	* chunks are in correct format
    14  	// 	* execution result has a valid parent and satisfies the subgraph check
    15  	// Returns nil if all checks passed successfully.
    16  	// Expected errors during normal operations:
    17  	// * engine.InvalidInputError
    18  	//   if receipt violates protocol condition
    19  	// * engine.UnverifiableInputError
    20  	//   if receipt's parent result is unknown
    21  	Validate(receipts *flow.ExecutionReceipt) error
    22  
    23  	// ValidatePayload verifies the ExecutionReceipts and ExecutionResults
    24  	// in the payload for compliance with the protocol:
    25  	// Receipts:
    26  	// 	* are from Execution node with positive weight
    27  	//	* have valid signature
    28  	//	* chunks are in correct format
    29  	//  * no duplicates in fork
    30  	// Results:
    31  	// 	* have valid parents and satisfy the subgraph check
    32  	//  * extend the execution tree, where the tree root is the latest
    33  	//    finalized block and only results from this fork are included
    34  	//  * no duplicates in fork
    35  	// Expected errors during normal operations:
    36  	// * engine.InvalidInputError
    37  	//   if some receipts in the candidate block violate protocol condition
    38  	// * engine.UnverifiableInputError
    39  	//   if for some of the receipts, their respective parent result is unknown
    40  	ValidatePayload(candidate *flow.Block) error
    41  }