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: Initial TssVoteHandler #16061

Merged
merged 18 commits into from
Oct 25, 2024
Merged

Conversation

derektriley
Copy link
Contributor

@derektriley derektriley commented Oct 21, 2024

Description:

This pull request introduces an initial implementation of the TssVoteHandler class, mainly focusing on vote handling and threshold checking. It also includes unit tests to ensure the correctness of these functionalities.

TssVoteHandler:

  • Vote Handling Logic:

    • Added logic to handle TSS votes, including checking for duplicate votes and storing new votes if the threshold is not reached (The sum of node consensus weights which have voted for the candidate roster and have the same vote bit vector, totaling at least 1/3 of weight of active roster).(hedera-node/hedera-app/src/main/java/com/hedera/node/app/tss/handlers/TssVoteHandler.java)
    • Introduced a hasReachedThreshold method to verify if the required threshold of vote consensus weight has been met. (hedera-node/hedera-app/src/main/java/com/hedera/node/app/tss/handlers/TssVoteHandler.java)
  • Constants and Imports:

    • Added necessary imports and a constant CONSENSUS_VOTE_THRESHOLD_ONE_THIRD to support the new vote handling logic. (hedera-node/hedera-app/src/main/java/com/hedera/node/app/tss/handlers/TssVoteHandler.java) [1] [2]

Unit Tests:

  • New Unit Tests:
    • Created unit tests to validate the new vote handling logic, including scenarios for duplicate votes and threshold checks. (hedera-node/hedera-app/src/test/java/com/hedera/node/app/tss/handlers/TssVoteHandlerTest.java)
    • Added mock setups and verifications to ensure the correctness of the handle and hasReachedThreshold methods. (hedera-node/hedera-app/src/test/java/com/hedera/node/app/tss/handlers/TssVoteHandlerTest.java)

Related issue(s):

Fixes #14750

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@derektriley derektriley added this to the v0.56 milestone Oct 21, 2024
@derektriley derektriley self-assigned this Oct 21, 2024
@derektriley derektriley force-pushed the 14750-tssvotetransaction-handler branch from 2f3a264 to c3080cf Compare October 23, 2024 20:30
Copy link

codacy-production bot commented Oct 23, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.17% (target: -1.00%) 96.30%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (a0cc065) 99564 61377 61.65%
Head commit (025ae09) 99792 (+228) 61690 (+313) 61.82% (+0.17%)

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 (#16061) 27 26 96.30%

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 Oct 23, 2024

Codecov Report

Attention: Patch coverage is 88.88889% with 3 lines in your changes missing coverage. Please review.

Project coverage is 58.27%. Comparing base (a0cc065) to head (025ae09).
Report is 16 commits behind head on develop.

Files with missing lines Patch % Lines
...m/hedera/node/app/tss/handlers/TssVoteHandler.java 92.30% 0 Missing and 2 partials ⚠️
...de/app/workflows/handle/DispatchHandleContext.java 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##             develop   #16061      +/-   ##
=============================================
+ Coverage      58.05%   58.27%   +0.22%     
- Complexity     19765    19912     +147     
=============================================
  Files           2726     2731       +5     
  Lines          99747   100129     +382     
  Branches       10295    10346      +51     
=============================================
+ Hits           57908    58354     +446     
+ Misses         38233    38150      -83     
- Partials        3606     3625      +19     
Files with missing lines Coverage Δ
...m/hedera/node/app/spi/workflows/HandleContext.java 85.71% <ø> (ø)
...de/app/workflows/handle/DispatchHandleContext.java 93.69% <0.00%> (-0.86%) ⬇️
...m/hedera/node/app/tss/handlers/TssVoteHandler.java 93.93% <92.30%> (-6.07%) ⬇️

... and 34 files with indirect coverage changes

Impacted file tree graph

@derektriley derektriley force-pushed the 14750-tssvotetransaction-handler branch from c3080cf to 7e8fe83 Compare October 23, 2024 20:50
@derektriley derektriley marked this pull request as ready for review October 23, 2024 20:53
@derektriley derektriley requested a review from a team as a code owner October 23, 2024 20:53
Copy link

Node: HAPI Test (Restart) Results

7 tests   1 ✅  2m 4s ⏱️
8 suites  0 💤
9 files    6 ❌
1 errors

For more details on these parsing errors and failures, see this check.

Results for commit 4fc3543.

Copy link
Member

@Neeharika-Sompalli Neeharika-Sompalli left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @derektriley

Copy link
Contributor

@thomas-swirlds-labs thomas-swirlds-labs left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @derektriley 👍

Signed-off-by: Derek Riley <derek.riley@swirldslabs.com>
Signed-off-by: Derek Riley <derek.riley@swirldslabs.com>
Signed-off-by: Derek Riley <derek.riley@swirldslabs.com>
Signed-off-by: Derek Riley <derek.riley@swirldslabs.com>
Signed-off-by: Derek Riley <derek.riley@swirldslabs.com>
Signed-off-by: Derek Riley <derek.riley@swirldslabs.com>
Signed-off-by: Derek Riley <derek.riley@swirldslabs.com>
Signed-off-by: Derek Riley <derek.riley@swirldslabs.com>
Signed-off-by: Derek Riley <derek.riley@swirldslabs.com>
Signed-off-by: Derek Riley <derek.riley@swirldslabs.com>
Signed-off-by: Derek Riley <derek.riley@swirldslabs.com>
Signed-off-by: Derek Riley <derek.riley@swirldslabs.com>
@derektriley derektriley force-pushed the 14750-tssvotetransaction-handler branch from 9fe6d39 to 6441a20 Compare October 24, 2024 12:40
Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@swirldslabs.com>
Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@swirldslabs.com>
Copy link
Member

@Neeharika-Sompalli Neeharika-Sompalli left a comment

Choose a reason for hiding this comment

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

LGTM!

@Neeharika-Sompalli Neeharika-Sompalli merged commit 76c54fc into develop Oct 25, 2024
58 checks passed
@Neeharika-Sompalli Neeharika-Sompalli deleted the 14750-tssvotetransaction-handler branch October 25, 2024 20:35
Evdokia-Georgieva pushed a commit that referenced this pull request Oct 31, 2024
Signed-off-by: Derek Riley <derek.riley@swirldslabs.com>
Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@swirldslabs.com>
Co-authored-by: Neeharika-Sompalli <neeharika.sompalli@swirldslabs.com>
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.

Create TssVoteTransaction and handle up to voting closed. (Mock Data)
7 participants