Skip to content

chore: 23407 Use computeHash instead of getHash#23408

Open
imalygin wants to merge 2 commits intomainfrom
23407-use-compute-hash
Open

chore: 23407 Use computeHash instead of getHash#23408
imalygin wants to merge 2 commits intomainfrom
23407-use-compute-hash

Conversation

@imalygin
Copy link
Contributor

@imalygin imalygin commented Feb 6, 2026

Description:

This PR replaces usages of getHash with copmuteHash where it's appropriate

Related issue(s):

Fixes #23407

Notes for reviewer:

Checklist

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

Signed-off-by: Ivan Malygin <ivan@swirldslabs.com>
@imalygin imalygin requested review from a team as code owners February 6, 2026 22:00
@imalygin imalygin requested a review from poulok February 6, 2026 22:00
@trunk-io
Copy link

trunk-io bot commented Feb 6, 2026

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

@imalygin imalygin self-assigned this Feb 6, 2026
@imalygin imalygin added this to the v0.72 milestone Feb 6, 2026
@lfdt-bot
Copy link

lfdt-bot commented Feb 6, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

artemananiev
artemananiev previously approved these changes Feb 6, 2026
thenswan
thenswan previously approved these changes Feb 9, 2026
lpetrovic05
lpetrovic05 previously approved these changes Feb 9, 2026
Signed-off-by: Ivan Malygin <ivan@swirldslabs.com>
@imalygin imalygin dismissed stale reviews from lpetrovic05, thenswan, and artemananiev via 1030400 February 9, 2026 16:09
@codacy-production
Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
-0.01% (target: -1.00%) 50.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (da6c859) 91263 74842 82.01%
Head commit (1030400) 91262 (-1) 74835 (-7) 82.00% (-0.01%)

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 (#23408) 6 3 50.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

@codecov
Copy link

codecov bot commented Feb 9, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ro/consensus/pcli/GenesisPlatformStateCommand.java 0.00% 1 Missing ⚠️
...consensus/pcli/recovery/EventRecoveryWorkflow.java 0.00% 1 Missing ⚠️
...in/java/com/swirlds/platform/StateInitializer.java 0.00% 1 Missing ⚠️

Impacted file tree graph

@@             Coverage Diff              @@
##               main   #23408      +/-   ##
============================================
- Coverage     78.02%   78.01%   -0.01%     
- Complexity    23404    23405       +1     
============================================
  Files          2458     2458              
  Lines         91446    91445       -1     
  Branches       9707     9707              
============================================
- Hits          71353    71345       -8     
- Misses        16504    16510       +6     
- Partials       3589     3590       +1     
Files with missing lines Coverage Δ Complexity Δ
...wirlds/platform/reconnect/ReconnectController.java 87.50% <100.00%> (ø) 19.00 <0.00> (ø)
...rlds/platform/state/hasher/DefaultStateHasher.java 100.00% <100.00%> (ø) 2.00 <0.00> (ø)
...ro/consensus/pcli/GenesisPlatformStateCommand.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...consensus/pcli/recovery/EventRecoveryWorkflow.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...in/java/com/swirlds/platform/StateInitializer.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)

... and 12 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

abortAndThrowIfInterrupted(
initialState::getHash, // calculate hash
"interrupted while attempting to hash the state");
abortAndThrowIfInterrupted(initialState::computeHash, "interrupted while attempting to hash the state");
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
abortAndThrowIfInterrupted(initialState::computeHash, "interrupted while attempting to hash the state");
abortAndThrowIfInterrupted(initialState::computeHash, "interrupted while attempting to compute the hash of the state");

// Mock SwirldStateManager
stateLifecycleManager = mock(StateLifecycleManager.class);
when(stateLifecycleManager.getMutableState()).thenReturn(testWorkingState);
when(stateLifecycleManager.getLatestImmutableState()).thenReturn(testWorkingState);
Copy link
Contributor

Choose a reason for hiding this comment

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

was this intentional? It seems unrelated to the stated purpose of the PR

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.

Use computeHash instead of getHash where it's applicable

6 participants