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

     1  package flow
     2  
     3  import (
     4  	"github.com/onflow/crypto"
     5  )
     6  
     7  // AggregatedSignature contains a set of of signatures from verifiers attesting
     8  // to the validity of an execution result chunk.
     9  // TODO: this will be replaced with BLS aggregation
    10  type AggregatedSignature struct {
    11  	// List of signatures
    12  	VerifierSignatures []crypto.Signature
    13  	// List of signer identifiers
    14  	SignerIDs IdentifierList
    15  }
    16  
    17  // CardinalitySignerSet returns the number of _distinct_ signer IDs in the AggregatedSignature.
    18  // We explicitly de-duplicate here to prevent repetition attacks.
    19  func (a *AggregatedSignature) CardinalitySignerSet() int {
    20  	return len(a.SignerIDs.Lookup())
    21  }
    22  
    23  // HasSigner returns true if and only if signer's signature is part of this aggregated signature
    24  func (a *AggregatedSignature) HasSigner(signerID Identifier) bool {
    25  	for _, id := range a.SignerIDs {
    26  		if id == signerID {
    27  			return true
    28  		}
    29  	}
    30  	return false
    31  }