On recovery, set UVM descriptor SVN to minimum of existing KV value and startup endorsements#7717
On recovery, set UVM descriptor SVN to minimum of existing KV value and startup endorsements#7717
Conversation
…ry (#7716) Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com>
…dorsements Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com>
|
@copilot I am sure we have SVN comparison logic already somewhere, please find that and use it, factor it out if necessary in its own function, but don't replicate it inline like that. |
…f_trust and trust_node_uvm_endorsements Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com>
Extracted |
Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR modifies the UVM endorsements trust logic during node recovery to use the minimum SVN (Security Version Number) between the existing stored value and the new node's startup endorsements. This prevents a recovery from inadvertently raising the SVN requirement.
Changes:
- Extract
parse_svnutility function intouvm_endorsements.h/.cpp, replacing duplicated inline parsing logic. - Add a
recoveringparameter totrust_node_uvm_endorsementsthat appliesmin(existing, new)SVN selection during recovery. - Pass the
recoveringflag from the/createhandler and document the behavior change inCHANGELOG.md.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/node/uvm_endorsements.h |
Declares the new parse_svn utility function. |
src/node/uvm_endorsements.cpp |
Implements parse_svn and refactors existing SVN parsing to use it. |
src/service/internal_tables_access.h |
Adds recovering parameter and min-SVN logic to trust_node_uvm_endorsements. |
src/node/rpc/node_frontend.h |
Passes recovering flag to trust_node_uvm_endorsements. |
CHANGELOG.md |
Documents the new recovery SVN behavior. |
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com>
Already addressed in e7296cc — |
|
@copilot capture a boolean value that tells us if we've actually updated the map (did or feed was not there, or svn has changed) and only write if we did make a change! |
Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com>
Done in b8b7f52. A |
…sting KV value and startup endorsements This backport adapts the changes from PR #7717 (merged to main) for the release/6.x branch. Changes: - Extract parse_svn utility in uvm_endorsements.cpp/.h - Refactor matches_uvm_roots_of_trust to use parse_svn - trust_node_uvm_endorsements now accepts recovering flag; during recovery, SVN is set to min(existing, new) - Pass recovering in node_frontend.h - Add internal_tables_access_test unit test - Update e2e_operations.py to bump SVN before recovery - Add CHANGELOG entry under 6.0.24 Note: This branch contains 6.x-adapted code. Please retarget the PR base to release/6.x before merging.
…existing KV value and startup endorsements Co-authored-by: maxtropets <16566519+maxtropets@users.noreply.github.com>
During recovery, the node was unconditionally overwriting the UVM descriptor SVN with the value from the new node's endorsements. This could raise the SVN above what was previously stored, which is incorrect — recovery should never increase the SVN.
Changes
src/node/uvm_endorsements.h/.cpp: Extracted aparse_svnutility function that parses an SVN string tosize_t, reused by bothmatches_uvm_roots_of_trustand the new recovery logic.src/service/internal_tables_access.h:trust_node_uvm_endorsementsnow accepts arecoveringflag. When true, reads the existing SVN from the KV for the same DID/feed and writesmin(existing, new)usingparse_svn. The feed entry is merged into the existing map for the DID, preserving other feeds rather than overwriting the entire map. Achangedboolean tracks whether the map was actually modified (new feed, or SVN value differs), and the KV write is skipped entirely when nothing changed.src/node/rpc/node_frontend.h: Passrecovering(already computed in the/createhandler) totrust_node_uvm_endorsements.CHANGELOG.md: Documented the behaviour change.💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.