Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Protobufs for exact weight TSS #17230

Closed
wants to merge 2 commits into from

Conversation

Neeharika-Sompalli
Copy link
Member

@Neeharika-Sompalli Neeharika-Sompalli commented Jan 6, 2025

Fixes #17194
Sub-PR of #17215

Adds protobufs for exact-weight TSS

Signed-off-by: Neeharika-Sompalli <[email protected]>
Copy link

codacy-production bot commented Jan 6, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.00% (target: -1.00%) 0.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (0d78221) 95934 65324 68.09%
Head commit (07e554a) 95939 (+5) 65331 (+7) 68.10% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#17230) 7 0 0.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Copy link

codecov bot commented Jan 6, 2025

Codecov Report

Attention: Patch coverage is 0% with 7 lines in your changes missing coverage. Please review.

Project coverage is 64.34%. Comparing base (0d78221) to head (07e554a).
Report is 23 commits behind head on main.

Files with missing lines Patch % Lines
.../src/main/java/com/hedera/hapi/util/HapiUtils.java 0.00% 7 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##               main   #17230   +/-   ##
=========================================
  Coverage     64.34%   64.34%           
- Complexity    20941    20946    +5     
=========================================
  Files          2555     2555           
  Lines         96171    96176    +5     
  Branches      10055    10054    -1     
=========================================
+ Hits          61878    61885    +7     
+ Misses        30655    30653    -2     
  Partials       3638     3638           
Files with missing lines Coverage Δ
.../src/main/java/com/hedera/hapi/util/HapiUtils.java 58.60% <0.00%> (-2.30%) ⬇️

... and 17 files with indirect coverage changes

Impacted file tree graph

Signed-off-by: Neeharika-Sompalli <[email protected]>
* This value MUST be set.<br/>
* This value MUST be greater than zero.<br/>
*/
uint64 construction_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.

Is this a roster hash? If not, why not use the roster hash? What associates a particular construction with a roster if the roster hash is not used?

* maximum universe size. A hinTS key is an "extended" public key;
* that is, a BLS public key combined with hints a signature
* aggregator can use to prove its aggregate public key by a SNARK
* for the aggregate secret key.
Copy link
Contributor

Choose a reason for hiding this comment

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

I wasn't aware of an aggregate secret key. Where is this term coming from?

* This value MUST be set.<br/>
* This value MUST be greater than zero.<br/>
*/
uint64 construction_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.

I assume that this is technically a different construction id for the HistoryService even though it is most likely in-synch with the construction id of the HintsService. I think both ids can be the roster hash.

* This value MUST NOT be empty.<br/>
* This value MUST contain a valid proof key.
*/
bytes proof_key = 1;
Copy link
Contributor

@edward-swirldslabs edward-swirldslabs Jan 7, 2025

Choose a reason for hiding this comment

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

Is this the Schnorr key? It's a public key. Should we add the term public to it?

I would prefer the term history_signing_public_key or something like that.

The proof use the key directly? Or is the key used to generate signatures and the signatures are input into the proof?

* certain maximum size M = 2^k; maps to the node's party id
* in the range [0, M).
*/
message NodeSchemeId {
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is this used? There is no protobuf data structure that uses this. Where is the mapping to the node's party id taking place?

proto.Timestamp aggregation_time = 5;
/**
* If set, the preprocessed hinTS keys that were approved by nodes
* holding at least 1/3 of the weight in the source roster.
Copy link
Contributor

Choose a reason for hiding this comment

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

is source the candidate roster? Normally source and target are directed from old (source) to new (target). Maybe we could call them current and candidate to avoid confusion?

* This value MUST be set.<br/>
* This value MUST NOT be empty.
*/
repeated PartyAssignment party_assignments = 7;
Copy link
Contributor

Choose a reason for hiding this comment

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

If we stored the size in the construction, we wouldn't have the size duplicated in so many more data structure instances.

* This value MUST be set.<br/>
* This value MUST NOT be empty.
*/
bytes proof_public_key = 3;
Copy link
Contributor

Choose a reason for hiding this comment

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

How is this different than the proof_key in the history_proof_key_publication.proto?

* roster transition phase; so the node should begin using it
* then.
*/
bytes next_key = 4;
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these two different keys belonging to two different constructions? I don't understand why they are being paired like this. And they are not associated to particular constructions.

* This value MUST be set.<br/>
* This value MUST NOT be empty.
*/
bytes key = 2;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this key value a duplicate of a key contained in the ProofKeySet? Is it a duplicate of the proof_key value in the publication?

* The unique identifier for the proof roster construction that this
* vote is associated with.
*/
uint64 construction_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.

if the construction id was a roster hash, does this data structure evaporate as the roster matching the hash would indicate all the valid node ids?

* The id of any node that already voted for the exact tagged proof roster
* this node is voting for.
*/
uint64 congruent_node_id = 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 still not following the purpose of referencing the vote of another node? data redundancy reduction? Would voting on a hash of the proof be sufficient data reduction?

/**
* A set of Schnorr keys for a node; that is, the key the node is
* currently using and the key it party wishes to use for the next
* proof roster assembly.
Copy link
Contributor

Choose a reason for hiding this comment

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

What is a proof roster? I am reading as adjective noun. It's a roster in support of a proof? I can make more sense of the term roster proof being a proof that is in support of a roster.

* This value MUST be set.<br/>
* This value MUST NOT be empty.
*/
repeated ProofKey proof_keys = 4;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is source here the current roster or the candidate roster?

uint64 construction_id = 1;
/**
* The hash of the roster whose weights are used to determine when
* certain thresholds are during construction.
Copy link
Contributor

Choose a reason for hiding this comment

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

which thresholds?

/**
* The hash of the roster whose weights are used to assess progress
* toward obtaining Schnorr keys for parties that hold at least a
* strong minority of the stake in that roster.
Copy link
Contributor

Choose a reason for hiding this comment

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

strong minority is defined as? The candidate roster needs >2/3 weight of keys to be present before any node should move forward with computing the proof. The current roster needs to have >=1/3 weight on acceptance votes for the network to be able to adopt the roster proof.

* <p>
* This value MUST be set.
*/
HistoryAssembly assembly = 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be a hash of the assembly?

I don't understand the difference between the terms assembly and construction. They are synonyms, each non-descriptive terms. The high level design document doesn't explain what an assembly is.

/**
* A recorded history assembly signature.
*/
message RecordedHistoryAssemblySignature {
Copy link
Contributor

Choose a reason for hiding this comment

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

No hash of what is being signed?

Copy link
Member

@jsync-swirlds jsync-swirlds left a comment

Choose a reason for hiding this comment

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

The proto file layout is quite good. The field specifications, in particular, are generally good.
We could improve the style and structure of the descriptions a bit, and most of the messages would benefit from more detail and more information to explain what the message is for, how it is used, etc...

I've made suggestions in a subset of items as examples. These are not exhaustive, and are intended to serve as guidance for improvement.

Entirely at your discretion, of course.

If you are uncertain what I am suggesting, or I can be of assistance in adding more rigor and detail, I am happy to discuss in chat or in a huddle.

*/
message HintsAggregationVoteTransactionBody {
/**
* The id of the hinTS construction this vote is for.<br/>
Copy link
Member

Choose a reason for hiding this comment

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

We're following some older habits here. Not incorrect so much as a bit inconsistent with the broader base of proto files.

Suggested change
* The id of the hinTS construction this vote is for.<br/>
* A hinTS construction identifier.<br/>
* This is the identifier of the hinTS construction that this vote transaction
* seeks to approve.

* construction.
* <p>
* This value MUST be set.<br/>
* This value MUST be greater than zero.<br/>
Copy link
Member

Choose a reason for hiding this comment

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

The line break is not needed on the last line

Suggested change
* This value MUST be greater than zero.<br/>
* This value MUST be greater than zero.

Comment on lines +58 to +61
* The vote the node is casting for the aggregation of the hints
* in the given construction (which should be ongoing).
* <p>
* This value MUST be set.<br/>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* The vote the node is casting for the aggregation of the hints
* in the given construction (which should be ongoing).
* <p>
* This value MUST be set.<br/>
* A pre-processed keys vote.<br/>
* This is a vote cast by a particular node supporting the aggregation of
* the hints in a given construction (which should be ongoing).
* <p>
* This value is REQUIRED.

Comment on lines +53 to +54
* The base-2 logarithm "k" of the maximum universe size for this
* publication.
Copy link
Member

Choose a reason for hiding this comment

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

Another example

Suggested change
* The base-2 logarithm "k" of the maximum universe size for this
* publication.
* A base-2 logarithm "universe" size.<br/>
* This is the base-2 logarithm "k" of the maximum universe size for this
* hinTS key publication.

Comment on lines +37 to +38
* A transaction body to publish a node's hinTS partial signature on
* a particular message for a certain construction id.
Copy link
Member

Choose a reason for hiding this comment

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

We're trying to say everything in a single sentence here, when we should probably be presenting more detail with less complex language.
Note the suggestion for more detail, which should be replaced with additional information that a third-party wishing to validate or reconstruct the process from these transactions might find useful.

Suggested change
* A transaction body to publish a node's hinTS partial signature on
* a particular message for a certain construction id.
* A transaction body to publish a single node's hinTS partial signature.<br/>
* This presents a partial signature on a particular message. The signature is
* valid for a particular hinTS construction id.
* << Any additional detail for this transaction body >>
*
* This message MUST specify a construction identifier.<br/>
* This message MUST specify the message that is signed.<br/>
* This message MUST include a signature value.<br/>
* The current hinTS process SHALL support BLS partial signatures
* and Alt-BN-128 keys

* This value MUST NOT be empty.
*/
repeated PartyAssignment party_assignments = 7;
}
Copy link
Member

Choose a reason for hiding this comment

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

Missing newline at EOF.

@Neeharika-Sompalli
Copy link
Member Author

Thanks for the review @edward-swirldslabs @jsync-swirlds .
Closing this PR, will open smaller PRs for each service for clarity.
I will address all the comments on this PR in the smaller PRs.

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.

Add Protobufs needed for exact weight TSS
3 participants