Skip to content

AnnotatedCodec #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 5, 2025
Merged

AnnotatedCodec #74

merged 5 commits into from
Aug 5, 2025

Conversation

coot
Copy link
Collaborator

@coot coot commented Jul 28, 2025

This PR provides AnnotatedCodec to typed-protocols which allows to retain
bytes received from the network. It also includes new quickcheck properties
for the new codec as well as an example implementation for ReqResp
mini-protocol.

  • Generalised Codec to provide AnnotatedCodec
  • typed-protocols:codec-properties library
  • typed-protocols:test - added prop_anncodec for ReqResp mini-protocol
  • typed-protocols: bump version

@coot coot requested a review from Copilot July 28, 2025 08:41
@coot coot self-assigned this Jul 28, 2025
Copy link

@Copilot 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 PR introduces AnnotatedCodec to the typed-protocols library, which enables retaining the original bytes received from the network during message decoding. This is particularly useful for cryptographic applications where the exact received bytes must be preserved for signature verification.

Key changes include:

  • Generalization of the Codec type to CodecF with type aliases for backward compatibility
  • Creation of a new codec-properties library for testing utilities
  • Addition of comprehensive QuickCheck properties for the new annotated codec functionality

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
typed-protocols/typed-protocols.cabal Version bump to 1.1.0.0 and addition of new codec-properties library
typed-protocols/src/Network/TypedProtocol/Codec.hs Core implementation of CodecF generalization and AnnotatedCodec type
typed-protocols/properties/Network/TypedProtocol/Codec/Properties.hs New comprehensive QuickCheck properties for codec testing
typed-protocols/examples/Network/TypedProtocol/ReqResp/Codec.hs Example implementation of annotated codec for ReqResp protocol
typed-protocols/test/Network/TypedProtocol/ReqResp/Tests.hs Test integration for the new annotated codec properties

@coot coot force-pushed the coot/annotated-codec branch 3 times, most recently from a959766 to fcb0a53 Compare July 28, 2025 10:29
Copy link

@crocodile-dentist crocodile-dentist left a comment

Choose a reason for hiding this comment

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

lgtm - with some minor comments.

@coot coot force-pushed the coot/annotated-codec branch from fcb0a53 to ee05d80 Compare August 5, 2025 14:56
@coot coot enabled auto-merge August 5, 2025 14:58
@coot coot added this pull request to the merge queue Aug 5, 2025
Merged via the queue into main with commit 16f4b2b Aug 5, 2025
13 checks passed
@coot coot deleted the coot/annotated-codec branch August 5, 2025 15:21
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.

2 participants