Extract describe_cose_receipt_v1 into reusable API#7700
Conversation
describe_cose_receipt alongside existing v1/v2 describe functions and reuse it in samples/loggingCo-authored-by: maxtropets <16566519+maxtropets@users.noreply.github.com>
describe_cose_receipt from logging app into reusable API
…type alias Co-authored-by: maxtropets <16566519+maxtropets@users.noreply.github.com>
describe_cose_receipt from logging app into reusable APIdescribe_cose_receipt into reusable API
There was a problem hiding this comment.
Pull request overview
This PR extracts COSE receipt construction (COSE signature + Merkle proof combined into a single COSE_Sign1 with unprotected header fields) into a reusable ccf::describe_cose_receipt() helper, and updates the logging sample app to use it.
Changes:
- Added
SerialisedCoseReceiptand declareddescribe_cose_receipt(const TxReceiptImpl&)in the public receipt API. - Implemented
describe_cose_receiptin the historical queries adapter using named COSE header constants (VDP,INCLUSION_PROOFS) instead of magic numbers. - Simplified the logging sample’s
/log/public/cose_receipthandler by callingdescribe_cose_receiptand removing now-inlined logic.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| include/ccf/receipt.h | Exposes the new SerialisedCoseReceipt alias and describe_cose_receipt declaration as part of the public receipt helpers. |
| src/node/historical_queries_adapter.cpp | Implements describe_cose_receipt by combining the existing COSE signature and Merkle proof helpers and setting the appropriate COSE unprotected header fields. |
| samples/apps/logging/logging.cpp | Replaces manual receipt construction with the new helper for the COSE receipt endpoint. |
| CHANGELOG.md | Documents the addition of the new public helper API. |
…signature TXs; update changelog Co-authored-by: maxtropets <16566519+maxtropets@users.noreply.github.com>
|
@copilot e2e test test_cbor_receipts fails on because it now returns a receipt for a signature TX with an empty path. I want to keep returning that, as I consider this a valid receipt, but the test should check for uhdr key presence and keep iterating until it finds non-signature TX. |
…424d-b35f-2deb1fe55701
…ate to find non-signature TX Co-authored-by: maxtropets <16566519+maxtropets@users.noreply.github.com>
... Fixed in 029cf52. The test now checks for the VDP key (396) in UHDR before accessing it. If the key is absent (signature TX with empty UHDR), it breaks the inner retry loop and continues the outer seqno loop to find a non-signature TX with Merkle proof. |
…424d-b35f-2deb1fe55701
…istency Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com>
describe_cose_receipt into reusable APIdescribe_cose_receipt_v1 into reusable API
The COSE receipt construction logic was inlined in the logging sample app instead of being a first-class library function alongside the other
describe_*helpers.Changes
include/ccf/receipt.h: AddSerialisedCoseReceipttype alias (grouped withSerialisedCoseSignature/SerialisedCoseEndorsement) and declaredescribe_cose_receipt_v1.src/node/historical_queries_adapter.cpp: Implementdescribe_cose_receipt_v1using named constantsccf::cose::header::iana::VDPandccf::cose::header::iana::INCLUSION_PROOFSfromsrc/crypto/cose.h. For non-signature TXs, the Merkle proof is embedded in the UHDR; for signature TXs, the COSE signature is returned as-is with an empty UHDR.samples/apps/logging/logging.cpp: Replace inlined receipt construction with a call todescribe_cose_receipt_v1.tests/e2e_logging.py: Fixtest_cbor_receiptsto check for VDP key presence before accessing it; skip signature TXs with empty UHDR and keep iterating to find a non-signature TX with Merkle proof.Usage
Original prompt
This pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.