diff --git a/common/crypto/sanitize.go b/common/crypto/sanitize.go index c036074e782..5d4ce16fa1f 100644 --- a/common/crypto/sanitize.go +++ b/common/crypto/sanitize.go @@ -38,6 +38,7 @@ func SanitizeIdentity(identity []byte) ([]byte, error) { return proto.Marshal(sID) } +// SanitizeX509Cert sanitizes an X.509 certificate to ensure that the ECDSA signature uses a "low-S" value. func SanitizeX509Cert(initialPEM []byte) ([]byte, error) { der, _ := pem.Decode(initialPEM) if der == nil { diff --git a/common/deliver/deliver.go b/common/deliver/deliver.go index d50f0284478..361ca85b80a 100644 --- a/common/deliver/deliver.go +++ b/common/deliver/deliver.go @@ -197,6 +197,8 @@ func isFiltered(srv *Server) bool { return false } +// deliverBlocks handles delivering blocks to the client from the blockchain channel. +// It processes a signed envelope from a client and responds with the requested blocks. func (h *Handler) deliverBlocks(ctx context.Context, srv *Server, envelope *cb.Envelope) (status cb.Status, err error) { addr := util.ExtractRemoteAddress(ctx) payload, chdr, shdr, err := h.parseEnvelope(ctx, envelope) diff --git a/common/policies/bft.go b/common/policies/bft.go index 660a9fba33a..1ba6f11be3e 100644 --- a/common/policies/bft.go +++ b/common/policies/bft.go @@ -19,6 +19,9 @@ const ( BlockValidationPolicyKey = "BlockValidation" ) +// EncodeBFTBlockVerificationPolicy creates a block verification policy based on Byzantine Fault Tolerance (BFT). +// It takes a list of consenters (orderer nodes), constructs a BFT policy using their identities, and updates +// the orderer's configuration group with this new policy. func EncodeBFTBlockVerificationPolicy(consenterProtos []*cb.Consenter, ordererGroup *cb.ConfigGroup) { n := len(consenterProtos) f := (n - 1) / 3 diff --git a/common/policydsl/policyparser.go b/common/policydsl/policyparser.go index f06e28e8d90..db18b85950a 100644 --- a/common/policydsl/policyparser.go +++ b/common/policydsl/policyparser.go @@ -92,6 +92,8 @@ func or(args ...interface{}) (interface{}, error) { return outof(args...) } +// firstPass processes a variadic list of arguments and returns a formatted string. +// The function expects arguments to be of either string, float32, or float64 types. func firstPass(args ...interface{}) (interface{}, error) { toret := "outof(ID" for _, arg := range args { @@ -115,6 +117,9 @@ func firstPass(args ...interface{}) (interface{}, error) { return toret + ")", nil } +// secondPass processes a list of arguments to build a "t-out-of-n" policy. +// It expects the first argument to be a context, the second an integer (threshold t), +// and the rest as either principals (strings) or pre-existing policies. func secondPass(args ...interface{}) (interface{}, error) { /* general sanity check, we expect at least 3 args */ if len(args) < 3 {