Skip to content

COSE signatures becomes a map (was singleton value) - #8334

Open
Max (maxtropets) wants to merge 9 commits into
microsoft:mainfrom
maxtropets:f/multisign-part-3
Open

COSE signatures becomes a map (was singleton value)#8334
Max (maxtropets) wants to merge 9 commits into
microsoft:mainfrom
maxtropets:f/multisign-part-3

Conversation

@maxtropets

@maxtropets Max (maxtropets) commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Another step towards #7848.

  • This time, COSE signatures tables becomes ServiceValue -> ServiceMap.
  • Although it's technically public facing change, it's neither blocking or needs advertising, therefore no changelog yet
    • service_value_singleton=0 remains CLASSICAL signature
    • we don't sign PQ yet
  • For all existing purposes, only CLASSICAL value is expected and treated as mandatory (yet)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 9, 2026 15:25
@maxtropets
Max (maxtropets) requested a review from a team as a code owner September 9, 2026 15:25
@maxtropets Max (maxtropets) self-assigned this Sep 9, 2026
@maxtropets Max (maxtropets) changed the title COSE signatures now service map COSE signatures becomes a map Sep 9, 2026
@maxtropets Max (maxtropets) changed the title COSE signatures becomes a map COSE signatures becomes a map (was singleton value) Sep 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

There are a couple of correctness hazards (notably an assertion that can fire on removal-only writes and legacy signature selection returning empty signatures) that should be addressed before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR advances the work towards #7848 by changing the COSE signatures KV table from a singleton ServiceValue to a ServiceMap keyed by IdentityType, enabling multiple concurrent signing identities (currently still using CLASSICAL only) while preserving legacy serialisation compatibility.

Changes:

  • Convert COSE_SIGNATURES from ServiceValue<CoseSignature> to ServiceMap<IdentityType, CoseSignature>, and propagate the new CoseSignatureMap through receipts, snapshotting, and signature caching.
  • Update historical query/receipt description logic to select the CLASSICAL COSE signature for legacy v1 APIs.
  • Add/extend unit tests and update audit documentation to reflect the new map shape and semantics.

Custom instructions used:

  • /.github/copilot-instructions.md
  • /.github/instructions/reviewing.instructions.md
File summaries
File Description
src/service/tables/signatures.h Converts COSE signatures table to a map keyed by IdentityType and adds extraction helper.
src/service/tables/identity_types.h Defines IdentityType and its blit serialiser to preserve legacy singleton key encoding.
src/node/tx_receipt_impl.h Changes receipt storage from optional single COSE signature to a per-identity signature map.
src/node/signature_cache_interface.h Updates cached signature interface to carry a CoseSignatureMap.
src/node/signature_cache_subsystem.h Updates commit hooks/caching logic to collect COSE signature writes as a map.
src/node/snapshotter.h Threads COSE signatures as a map through snapshot persistence flow.
src/node/snapshot_serdes.h Builds snapshot receipts using the COSE signatures map.
src/node/history.h Writes COSE signatures keyed by IdentityType::CLASSICAL and reads per-key previous write version.
src/node/historical_queries.h Fetches COSE signatures as a map and selects CLASSICAL for legacy description paths.
src/node/historical_queries_adapter.cpp Updates v1 receipt description to return CLASSICAL signature from the map.
src/node/rpc/node_frontend.h Updates receipt endpoint path to read CLASSICAL COSE signature from the map.
src/node/node_state.h Updates internal COSE signature reads and snapshotter hook to use extracted map writes.
src/endpoints/endpoint_registry.cpp Constructs receipts using cached COSE signature maps.
src/node/test/snapshotter.cpp Updates snapshotter test to record COSE signatures as a map.
src/node/test/history.cpp Adds round-trip/compatibility/unit tests for the COSE signature map and extraction helper.
src/node/test/historical_queries.cpp Adds tests validating cached vs historical COSE signature transaction alignment and CLASSICAL selection.
doc/audit/builtin_maps.rst Updates documentation for cose_signatures key/value semantics as an identity-keyed map.
Review details
  • Files reviewed: 16/16 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/node/historical_queries.h
Comment thread src/node/historical_queries_adapter.cpp Outdated
Comment thread src/node/node_state.h
Comment thread src/node/test/history.cpp

@cjen1-msft cjen1-msft left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is fine.

Some testing says that consumers who could try to pull in the "public:ccf.internal.cose_signatures" table will be fine as the sentinel value maps over.
And then they can be migrated later.
Similarly for JS.

The only risk is if someone pulled the signatures alias from the private headers somehow.

@maxtropets

Copy link
Copy Markdown
Collaborator Author

The only risk is if someone pulled the signatures alias from the private headers somehow.

Users will be meant to pull those when they are filled up. They aren't now, and won't be until 8.x on AL4, but by then we'll have all the necessary things in.

This step is mainly preparatory work, and should not affect KV at all (from the user's perspective).

@achamayou Amaury Chamayou (achamayou) added the run-long-test Run Long Test job label Sep 11, 2026
Comment thread src/node/historical_queries.h Outdated
Comment thread src/node/historical_queries_adapter.cpp Outdated
Co-authored-by: Amaury Chamayou <amaury@xargs.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-long-test Run Long Test job

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants