Skip to content

feat: Highest node id in state#21861

Open
derektriley wants to merge 87 commits intomainfrom
18855-highest-nodeId
Open

feat: Highest node id in state#21861
derektriley wants to merge 87 commits intomainfrom
18855-highest-nodeId

Conversation

@derektriley
Copy link
Contributor

@derektriley derektriley commented Oct 24, 2025

Description:
This PR introduces a new singleton state to track the highest node ID ever used. The change includes:

  • Adding a singleton state definition for the highest node ID.
  • Initializing the highest node ID during migration based on the current number of nodes.
  • Removing nodes that are marked as deleted after network upgrade.

Related issue(s):
Fixes #18855

Notes for reviewer:
Since the new singleton state is part of EntityIdStore, a big part of the changes are just mocking or initializing the new singleton for many unit tests.

Checklist

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

Signed-off-by: Derek Riley <derek.riley@swirldslabs.com>
Signed-off-by: Derek Riley <derek.riley@swirldslabs.com>
@derektriley derektriley added this to the v0.68 milestone Oct 24, 2025
@derektriley derektriley self-assigned this Oct 24, 2025
@derektriley derektriley linked an issue Oct 24, 2025 that may be closed by this pull request
@lfdt-bot
Copy link

lfdt-bot commented Oct 24, 2025

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.

Signed-off-by: Derek Riley <derek.riley@swirldslabs.com>
Signed-off-by: Derek Riley <derek.riley@swirldslabs.com>
@codecov
Copy link

codecov bot commented Oct 24, 2025

Codecov Report

❌ Patch coverage is 86.91589% with 14 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...dera/node/app/workflows/handle/HandleWorkflow.java 0.00% 11 Missing ⚠️
...a/node/app/hapi/utils/blocks/BlockStreamUtils.java 0.00% 2 Missing ⚠️
...app/service/entityid/impl/NodeIdGeneratorImpl.java 80.00% 1 Missing ⚠️

Impacted file tree graph

@@             Coverage Diff              @@
##               main   #21861      +/-   ##
============================================
- Coverage     78.28%   78.27%   -0.01%     
- Complexity    11656    11671      +15     
============================================
  Files          2461     2463       +2     
  Lines         92958    93008      +50     
  Branches       9965     9969       +4     
============================================
+ Hits          72769    72799      +30     
- Misses        16506    16523      +17     
- Partials       3683     3686       +3     
Files with missing lines Coverage Δ Complexity Δ
...ervice/addressbook/impl/ReadableNodeStoreImpl.java 97.14% <100.00%> (ø) 11.00 <2.00> (ø)
...pp/service/addressbook/impl/WritableNodeStore.java 100.00% <100.00%> (ø) 6.00 <2.00> (+1.00)
...e/addressbook/impl/handlers/NodeCreateHandler.java 98.68% <100.00%> (+0.29%) 15.00 <3.00> (+6.00)
...m/hedera/node/app/spi/workflows/HandleContext.java 92.30% <100.00%> (+0.20%) 0.00 <0.00> (ø)
...e/app/blocks/impl/BoundaryStateChangeListener.java 92.17% <100.00%> (+0.13%) 0.00 <0.00> (ø)
...ra/node/app/hints/impl/ReadableHintsStoreImpl.java 84.74% <100.00%> (ø) 0.00 <0.00> (ø)
...ra/node/app/hints/impl/WritableHintsStoreImpl.java 88.72% <100.00%> (ø) 0.00 <0.00> (ø)
...edera/node/app/store/ReadableStoreFactoryImpl.java 84.74% <100.00%> (+1.41%) 0.00 <0.00> (ø)
...om/hedera/node/app/store/WritableStoreFactory.java 81.25% <100.00%> (ø) 0.00 <0.00> (ø)
...de/app/workflows/handle/DispatchHandleContext.java 90.79% <100.00%> (+0.11%) 0.00 <0.00> (ø)
... and 14 more

... and 11 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.

@codacy-production
Copy link

codacy-production bot commented Oct 24, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
-0.01% (target: -1.00%) 86.92%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (1b4bbb3) 92861 76404 82.28%
Head commit (b646f90) 92911 (+50) 76437 (+33) 82.27% (-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 (#21861) 107 93 86.92%

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

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>
# Conflicts:
#	hedera-node/hedera-addressbook-service-impl/src/test/java/com/hedera/node/app/service/addressbook/impl/test/handlers/AddressBookTestBase.java
#	hedera-node/hedera-addressbook-service-impl/src/test/java/com/hedera/node/app/service/addressbook/impl/test/handlers/NodeCreateHandlerTest.java
#	hedera-node/hedera-addressbook-service-impl/src/test/java/com/hedera/node/app/service/addressbook/impl/test/handlers/NodeDeleteHandlerTest.java
Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
@JivkoKelchev JivkoKelchev reopened this Nov 4, 2025
@JivkoKelchev JivkoKelchev self-assigned this Nov 4, 2025
Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
…tion.

Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
@JivkoKelchev JivkoKelchev requested a review from a team as a code owner February 19, 2026 08:59
Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
thenswan
thenswan previously approved these changes Feb 19, 2026
Copy link
Contributor

@thenswan thenswan left a comment

Choose a reason for hiding this comment

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

hapi/hedera-protobuf-java-api/src/main/proto/platform/state/virtual_map_state.proto LGTM, just a couple of nits

Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
thenswan
thenswan previously approved these changes Feb 24, 2026
petreze
petreze previously approved these changes Feb 25, 2026
Copy link
Contributor

@petreze petreze left a comment

Choose a reason for hiding this comment

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

LG 👍

# Conflicts:
#	hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/record/SystemTransactions.java
@JivkoKelchev JivkoKelchev dismissed stale reviews from petreze and thenswan via 17b2217 February 26, 2026 11:50
petreze
petreze previously approved these changes Feb 26, 2026
# Conflicts:
#	hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/utilops/UtilVerbs.java
Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
petreze
petreze previously approved these changes Mar 5, 2026
Signed-off-by: Derek Riley <derek.riley@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.

Store the highest nodeID used in state

7 participants