github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/model/flow/resultApproval.go (about) 1 package flow 2 3 import ( 4 "github.com/onflow/crypto" 5 ) 6 7 // Attestation confirms correctness of a chunk of an exec result 8 type Attestation struct { 9 BlockID Identifier // ID of the block included the collection 10 ExecutionResultID Identifier // ID of the execution result 11 ChunkIndex uint64 // index of the approved chunk 12 } 13 14 // ID generates a unique identifier using attestation 15 func (a Attestation) ID() Identifier { 16 return MakeID(a) 17 } 18 19 // ResultApprovalBody holds body part of a result approval 20 type ResultApprovalBody struct { 21 Attestation 22 ApproverID Identifier // node id generating this result approval 23 AttestationSignature crypto.Signature // signature over attestation, this has been separated for BLS aggregation 24 Spock crypto.Signature // proof of re-computation, one per each chunk 25 } 26 27 // PartialID generates a unique identifier using Attestation + ApproverID 28 func (rab ResultApprovalBody) PartialID() Identifier { 29 data := struct { 30 Attestation Attestation 31 ApproverID Identifier 32 }{ 33 Attestation: rab.Attestation, 34 ApproverID: rab.ApproverID, 35 } 36 37 return MakeID(data) 38 } 39 40 // ID generates a unique identifier using ResultApprovalBody 41 func (rab ResultApprovalBody) ID() Identifier { 42 return MakeID(rab) 43 } 44 45 // ResultApproval includes an approval for a chunk, verified by a verification node 46 type ResultApproval struct { 47 Body ResultApprovalBody 48 VerifierSignature crypto.Signature // signature over all above fields 49 } 50 51 // ID generates a unique identifier using result approval body 52 func (ra ResultApproval) ID() Identifier { 53 return MakeID(ra.Body) 54 } 55 56 // Checksum generates checksum using the result approval full content 57 func (ra ResultApproval) Checksum() Identifier { 58 return MakeID(ra) 59 }