-
Notifications
You must be signed in to change notification settings - Fork 89
Annotated decoder for TxSubmission mini-protocol #4934
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
Conversation
f7cc59a
to
4b47e98
Compare
4b47e98
to
fede497
Compare
8555251
to
04db194
Compare
04db194
to
4be8297
Compare
There was a problem hiding this 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 adds support for annotated decoders in the TxSubmission mini-protocol, which allows for accessing the raw CBOR bytes alongside the decoded message data. It introduces new APIs for running peers with annotated codecs and implements the AnnotatedCodec
for TxSubmission2.
Key changes:
- Updated typed-protocols dependency from v1.0 to v1.1 across the codebase
- Added driver support for annotated decoders in the network framework
- Implemented
anncodecTxSubmission2
with CBOR byte preservation - Added comprehensive QuickCheck properties for the new codec
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
cabal.project | Adds source repository for typed-protocols dependency |
Various .cabal files | Updates typed-protocols dependency to ^>=1.1 |
TxSubmission2/Codec.hs | Implements annotated codec with WithBytes wrapper and decoder refactoring |
Driver/Simple.hs | Adds annotated peer runner functions and driver support |
Driver/Limits.hs | Extends limit enforcement to annotated codecs |
Various test files | Updates test signatures to return Property instead of Bool |
nix/ouroboros-network.nix | Increases heap size for test execution |
ouroboros-network-protocols/src/Ouroboros/Network/Protocol/TxSubmission2/Codec.hs
Outdated
Show resolved
Hide resolved
ouroboros-network-protocols/src/Ouroboros/Network/Protocol/TxSubmission2/Codec.hs
Outdated
Show resolved
Hide resolved
ouroboros-network-protocols/src/Ouroboros/Network/Protocol/TxSubmission2/Codec.hs
Show resolved
Hide resolved
bd727d1
to
328f239
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One remark on efficiency
ouroboros-network-framework/src/Ouroboros/Network/Driver/Limits.hs
Outdated
Show resolved
Hide resolved
ouroboros-network-framework/src/Ouroboros/Network/Driver/Limits.hs
Outdated
Show resolved
Hide resolved
ouroboros-network-framework/src/Ouroboros/Network/Driver/Simple.hs
Outdated
Show resolved
Hide resolved
8e63f27
to
2838168
Compare
I'll merge it once I'll release |
2838168
to
9cbd6d6
Compare
This commit provides `runAnnotatedPeer` and alikes. It is similar to `runPeer' but allows us to run a decoder which has access to bytes used when decoding a message. This allows one to record ByteString from which a piece of data was decoded, e.g. for each `tx` inside `MsgReplyTxs`. This patch adds the following APIs: * `runAnnotatedPeer` * `runPipelinedAnnotatedPeer` * `runAnnotatedPeerWithLimits` * `runPipelinedAnnotatedPeerWithLimits` The following two are left to be implemented when we'll actually need them: * `runAnnotatedPeerWithLimitsRnd` * `runPipelinedAnnotatedPeerWithLimitsRnd` The `Codec` type in `typed-protocols` was generalised for this purpose. The core functionality is implemented in `runAnnotatedDecoderWithChannel` (and `runAnnotatedDecoderWithLimit`) which runs `AnnotatedCodec` against a `Channel` which does incremental decoding & recording bytes used so far. We also expose `runAnnotatedPeer` which runs a `Peer` against `Channel` using an `AnnotatedCodec` (using `annotatedDriverSimple`).
Use `withMaxSize 50`.
Reorder cases so they are more logical, i.e. first handling trailing bytes from previous message, then bytes received from network followed by `DecodeDone` and `DecodeFail`.
9cbd6d6
to
60b36b1
Compare
Description
This PR depends on input-output-hk/typed-protocols#74.
It provides:
AnnotatedDecoder
;tx-submission
AnnotatedDecoder
;Commits
/This PR can be reviewed commit-by-commit./
Checklist
Quality
Maintenance
ouroboros-network
project.