Skip to content

Conversation

cendhu
Copy link
Contributor

@cendhu cendhu commented Sep 8, 2025

Type of change

  • New feature

Description

This commit updates the proto messages to define policy using various rules such as threshold, signature, and hierarchical. Further, it integrates the signature rules with the verifier component.

Related issues

@cendhu cendhu marked this pull request as draft September 8, 2025 10:59
@cendhu cendhu force-pushed the integrate-bundle branch 9 times, most recently from 67d33d2 to 28bd138 Compare September 10, 2025 11:35
// A list of signature sets.
// IMPORTANT: This list MUST be the same size as the namespaces list.
// The SignatureSet at index i corresponds to the namespace at index i.
repeated SignatureSet signature_sets = 2;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I suggest renaming the field to endorsements and the message to EndorsementSet.

Suggested change
repeated SignatureSet signature_sets = 2;
repeated EndorsementSet endorsements = 2;

// in the transaction's namespaces list.
message SignatureSet {
// The list of individual signatures for the corresponding namespace.
repeated SignatureWithIdentity signatures_with_identity = 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I suggest renaming

Suggested change
repeated SignatureWithIdentity signatures_with_identity = 1;
repeated EndorsementWithIdentity endorsements_with_identity = 1;

Comment on lines 60 to 61
// The actual cryptographic signature bytes.
bytes signature = 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I suggest renaming

Suggested change
// The actual cryptographic signature bytes.
bytes signature = 1;
// The actual cryptographic signature bytes.
bytes endorsement = 1;


message Identity {
// The identifier of the associated membership service provider
string msp_id = 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: Is this field necessary? Can't we infer the MSP from the certificate's issuing CA?

Comment on lines 48 to 84
message NamespacePolicy {
string scheme = 1; // The scheme for signature verification.
bytes public_key = 2; // The public key for signature verification.
string scheme = 1; // The scheme for signature verification.
bytes policy = 2; // The policy rule.
PolicyType type = 3; // The type of policy used.
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: The scheme field is not needed for all rules. Only for THRESHOLD_RULE.
We should have a sub message:

message ThresholdPolicy {
    string scheme = 1;      // The scheme for signature verification.
    bytes public_key = 2; // The public key for signature verification.
}

Then, this message will be modified as follows:

message NamespacePolicy {
    PolicyType type = 1; // The type of policy used.
    bytes policy = 2; // The policy rule.
}

Alternatively, we can define a different THRESHOLD_RULE per schema: THRESHOLD_ECDSA_RULE, THRESHOLD_BLS_RULE, etc...
In addition, we can also have NONE_RULE for no verification.

Comment on lines 88 to 89
Namespaces: validTxNamespaces,
SignatureSets: make([]*protoblocktx.SignatureSet, 2), // Too many signatures.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this PR removes the test case of "Not enough signatures."?

if v.thresholdVerifier == nil {
return nil
}
digest, err := DigestTxNamespace(txID, tx.Namespaces[nsIndex])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: To align all the verifiers, I suggest using ASN1MarshalTxNamespace(txID, tx.Namespaces[nsIndex]) and digesting inside the "thresholdVerifier".
Additionally, our THRESHOLD verifiers can also use protoutil.SignedData{}, where the identity is pre-fixed.

// A policy that implicitly aggregates the results of policies defined at a lower
// level in the configuration hierarchy. For example, a MAJORITY rule on the
// Admins policies of all member organizations.
HIERARCHICAL_RULE = 2;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that implicit meta requires its own category. The policy type is encoded in the policy bytes.
We can have a single rule. E.g., MSP_POLICY_RULE.

@cendhu cendhu force-pushed the integrate-bundle branch 2 times, most recently from 7a06098 to c357994 Compare September 22, 2025 12:49
@cendhu cendhu marked this pull request as ready for review September 29, 2025 06:18
@cendhu cendhu force-pushed the integrate-bundle branch 2 times, most recently from 52ef263 to c357994 Compare September 29, 2025 13:08
This commit updates the proto messages to define policy using
various rules such as threshold, signature, and hierarchical.

Signed-off-by: Senthil Nathan N <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants