Make previous identity endorsement fetching robust to the ledger gaps#7913
Closed
maxtropets wants to merge 5 commits into
Closed
Make previous identity endorsement fetching robust to the ledger gaps#7913maxtropets wants to merge 5 commits into
maxtropets wants to merge 5 commits into
Conversation
822a052 to
19a8272
Compare
19a8272 to
f96a87b
Compare
43d3551 to
02234aa
Compare
02234aa to
30fba92
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates CCF’s network identity subsystem to tolerate gaps in historical ledger availability when fetching previous-identity endorsements, so node startup can proceed with a validated prefix and callers can explicitly request further fetch attempts as missing chunks reappear.
Changes:
- Introduces a
FetchStatus::Partialstate and a newNetworkIdentitySubsystemInterface::trigger_extension()API for caller-driven extension attempts. - Refactors fetching/validation into an incremental state machine with bounded retries and injected accessors/scheduler to enable focused unit testing.
- Adds both unit-test coverage for the state machine and an end-to-end recovery test that simulates missing/restored ledger chunks.
Custom instructions used
.github/copilot-instructions.md.github/instructions/reviewing.instructions.md.github/instructions/changelog.instructions.md
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
tests/recovery.py |
Adds an e2e test that moves/restores a ledger chunk and asserts partial→healed endorsement behavior. |
src/node/test/network_identity_subsystem.cpp |
New unit test suite driving the subsystem state machine with mocks/fake scheduler. |
src/node/rpc/network_identity_subsystem.h |
Implements Partial/Done/Failed state machine, incremental validation, and trigger-driven extension. |
src/node/rpc/network_identity_chain_helpers.h |
Adds pure helper predicates for chain connectivity/front-connection validation. |
src/node/rpc/network_identity_accessors.h |
Defines narrow injection interfaces for live/historical reads and task scheduling. |
src/node/rpc/network_identity_accessors_impl.h |
Provides production adapters over AbstractNodeState, StateCacheImpl, and ccf::tasks. |
src/node/historical_queries_utils.cpp |
Triggers trigger_extension() on nullopt chain reads and returns 202 behavior to callers. |
include/ccf/network_identity_interface.h |
Updates public API: adds Partial, removes Retry/exception-based contract, adds trigger_extension(). |
CMakeLists.txt |
Adds the new unit test target. |
CHANGELOG.md |
Documents the user-visible behavior change and new API. |
e4fbd65 to
5cf01f5
Compare
achamayou
reviewed
Jun 4, 2026
| Retry, ///< Fetching should be retried | ||
| Done, ///< Fetching completed successfully | ||
| Failed ///< Fetching failed | ||
| Done, ///< Fetching trusted identities completed successfully |
Member
There was a problem hiding this comment.
This is problematic in two ways:
- it clearly is a public API break
- the values are re-ordered, which is risky at best
Does the FetchStatus need to be in a public header? If it must, can we at least make the order Partial, Done, Failed?
Collaborator
Author
|
Closed in favour of #7922 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Missing previous-identity endorsement ledger chunks no longer block node startup. The subsystem serves what it has validated, and callers decide when to retry.
FetchStatus::PartialandNetworkIdentitySubsystemInterface::trigger_extension().Partial; cycles end inPartial(recoverable) orDone/Failed(terminal).Retryenum value removed.Partial.trigger_extension()whenever a 202 is due to a partial chain.build_trusted_keysare gone.IdentityHistoryNotFetchedremoved.INodeStateAccessor+IHistoricalStateAccessor+TaskScheduler(production wrappers innetwork_identity_accessors_impl.h); enables a 35-case unit test suite that drives the state machine with mocks.recovery_chain_healsexercises the full healing flow over 3 recoveries with a moved ledger chunk and asserts the trusted-keys count grows aftertrigger_extension().