-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is an experiment to provide `runAnnotatedPeer`, which is like `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`. The `Codec` type in `typed-protocols` was generalised for this purpose. The core functionality is implemented in `runAnnotatedDecoderWithChannel` 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`). TODO: * `runAnnotatedPeerWithLimits` * `runAnnotatedPipelinedPeerWithLimits` It's actually the last one that we will need in `tx-submission`. * Add ``` data WithBytes a { encoded :: ByteString, decoded :: a ``` and generalise `codecTxSubmission2` so that it can be used to used with annotator and without it - it might require two separate function, but I think it can be generated from one more general function (so we don't need to maintain two codecs). TODO: design & implement quickcheck properties
- Loading branch information
Showing
3 changed files
with
168 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters