Skip to content

Conversation

@maxtropets
Copy link
Collaborator

@maxtropets maxtropets commented Jan 20, 2026

Nit. Changed to shared_ptr to make it easy to read one CBOR and produce another from the same data. There was no particular reason for Value to be unique_ptr, I defaulted to it because we needed a pointer to keep a tree of Values.

@maxtropets maxtropets self-assigned this Jan 20, 2026
@maxtropets maxtropets force-pushed the f/cbor-wrappers-historical-adapter branch from e112fe3 to 0cfa859 Compare January 20, 2026 18:16
@maxtropets maxtropets force-pushed the f/cbor-wrappers-historical-adapter branch from 0cfa859 to ae5ffd0 Compare January 20, 2026 18:16
@maxtropets maxtropets marked this pull request as ready for review January 20, 2026 18:16
@maxtropets maxtropets requested a review from a team as a code owner January 20, 2026 18:16
Copilot AI review requested due to automatic review settings January 20, 2026 18:16
@maxtropets maxtropets changed the title [DRAFT] [WIP] COSE wrappers (ser) in COSE editing and historical wrappers CBOR wrappers in cose::edit and historical wrappers Jan 20, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request refactors COSE encoding/editing and historical query code to use new CBOR wrapper functions instead of direct QCBOR library calls. The change simplifies the code by introducing higher-level abstraction functions for building CBOR values.

Changes:

  • Added new CBOR helper functions (make_simple, make_tagged, make_array, make_map, boolean_to_simple) to simplify CBOR value construction
  • Changed Value type from unique_ptr to shared_ptr to enable easier value sharing
  • Refactored set_unprotected_header in cose.cpp to use new CBOR wrappers instead of raw QCBOR calls
  • Refactored Merkle proof encoding in historical_queries_adapter.cpp to use new CBOR wrappers
  • Updated tests to use new CBOR parsing and comparison approach

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/crypto/cbor.h Added declarations for new helper functions and changed Value from unique_ptr to shared_ptr
src/crypto/cbor.cpp Implemented new helper functions and updated all Value allocations to use make_shared
src/crypto/cose.cpp Refactored COSE editing to use new CBOR wrappers instead of direct QCBOR calls
src/node/historical_queries_adapter.cpp Refactored Merkle proof encoding to use new CBOR wrappers
src/crypto/test/cose.cpp Updated tests to use CBOR parsing and string comparison instead of manual QCBOR decoding

@maxtropets maxtropets enabled auto-merge (squash) January 20, 2026 21:05
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.

1 participant