-
Notifications
You must be signed in to change notification settings - Fork 86
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
TxSubmission2 protocol #2807
TxSubmission2 protocol #2807
Conversation
57a0917
to
cfacdd8
Compare
cfacdd8
to
6f4abf2
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.
Mostly just name suggestions.
But also an important one about the encoding for the hello codec.
@@ -16,6 +16,7 @@ module Network.TypedProtocol.Pipelined | |||
, Nat (Zero, Succ) | |||
, natToInt | |||
, unsafeIntToNat | |||
, fmapPeerPipelined |
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.
If we're adding something like this, we should do it consistently for the non-pipelined case too.
We want to publish this package too.
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.
Sure, so you'd like to export an id
function? ;)
fmapPeer :: (Peer ps pr st m a -> Peer ps' pr st' m b)
-> Peer ps pr st m a
-> Peer ps' pr st' m b
fmapPeer f = f
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.
But what we can do is to add 'Functor' instances to both 'Peer' and 'PeerPipelined'.
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.
Fair point, that wouldn't make sense. If we can do Functor
instances though then yes we should do that.
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.
An Applicative
instance be useful too. It would give poor man's multiplexer in IO
, but a much nicer one using Concurrently
wrapper from async
. But that's for another PR.
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.
Hmm, writing pure :: a -> m a
requires to know which state is the final one, some protocols might not even have a single final state.
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.
Also ap
is only possible for some protocols. it's type signature is similar to connect
.
ouroboros-network/src/Ouroboros/Network/Protocol/Trans/Hello/Type.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/Protocol/Trans/Hello/Type.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/Protocol/Trans/Hello/Type.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/Protocol/Trans/Hello/Codec.hs
Outdated
Show resolved
Hide resolved
6f4abf2
to
42105ea
Compare
42105ea
to
07733ba
Compare
Protocol transformer which transforms initial agency.
This will allow to define the codec of TxSubmission2 protocol the using TxSubmission codec.
This patch provides a type alias for tx-submission protocol wrapped using the Hello protocol transformer. Codec and protocol limits are provided also in terms of the original codec / protocol limits.
By exposing some of TxSubmission test utilities this patch provides a test suite for TxSubmission2 protocol.
Includes a test.
07733ba
to
c2d6245
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.
LGTM!
@@ -16,6 +16,7 @@ module Network.TypedProtocol.Pipelined | |||
, Nat (Zero, Succ) | |||
, natToInt | |||
, unsafeIntToNat | |||
, fmapPeerPipelined |
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.
Fair point, that wouldn't make sense. If we can do Functor
instances though then yes we should do that.
-> Message (Hello ps stIdle) st st' | ||
-> CBOR.Encoding | ||
encodeHello (ClientAgency TokHello) MsgHello = | ||
encodeListLen 1 <> encodeWord helloTag |
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.
Or we could generalise over the whole hello Encoding
, not just a Word
. Doesn't matter at the moment.
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.
Unfortunately not, it would need to go through Codec.Cbor.Term.Term
or something like that: the decoder is in CPS style.
bors merge |
Build succeeded: |
Note that this does not incorporate the latest changes in cardano-ledger-specs. Notable changes: * IntersectMBO/ouroboros-network#2807 * IntersectMBO/ouroboros-network#2811 * IntersectMBO/ouroboros-network#2832
Note that this does not incorporate the latest changes in cardano-ledger-specs. Notable changes: * IntersectMBO/ouroboros-network#2807 * IntersectMBO/ouroboros-network#2811 * IntersectMBO/ouroboros-network#2832
Note that this does not incorporate the latest changes in cardano-ledger-specs. Notable changes: * IntersectMBO/ouroboros-network#2807 * IntersectMBO/ouroboros-network#2811 * IntersectMBO/ouroboros-network#2832 network tracers: moved ToObject TxSubmission instance network tracers: added ToObjcet TxSubmission2 instance
Note that this does not incorporate the latest changes in cardano-ledger-specs. Notable changes: * IntersectMBO/ouroboros-network#2807 * IntersectMBO/ouroboros-network#2811 * IntersectMBO/ouroboros-network#2832 network tracers: moved ToObject TxSubmission instance network tracers: added ToObjcet TxSubmission2 instance Update cabal.project index-state value
Note that this does not incorporate the latest changes in cardano-ledger-specs. Notable changes: * IntersectMBO/ouroboros-network#2807 * IntersectMBO/ouroboros-network#2811 * IntersectMBO/ouroboros-network#2832 network tracers: moved ToObject TxSubmission instance network tracers: added ToObjcet TxSubmission2 instance Update cabal.project index-state value
Note that this does not incorporate the latest changes in cardano-ledger-specs. Notable changes: * IntersectMBO/ouroboros-network#2807 * IntersectMBO/ouroboros-network#2811 * IntersectMBO/ouroboros-network#2832 network tracers: moved ToObject TxSubmission instance network tracers: added ToObjcet TxSubmission2 instance Update cabal.project index-state value
Note that this does not incorporate the latest changes in cardano-ledger-specs. Notable changes: * IntersectMBO/ouroboros-network#2807 * IntersectMBO/ouroboros-network#2811 * IntersectMBO/ouroboros-network#2832 network tracers: moved ToObject TxSubmission instance network tracers: added ToObjcet TxSubmission2 instance Update cabal.project index-state value
Note that this does not incorporate the latest changes in cardano-ledger-specs. Notable changes: * IntersectMBO/ouroboros-network#2807 * IntersectMBO/ouroboros-network#2811 * IntersectMBO/ouroboros-network#2832 network tracers: moved ToObject TxSubmission instance network tracers: added ToObjcet TxSubmission2 instance Update cabal.project index-state value
Note that this does not incorporate the latest changes in cardano-ledger-specs. Notable changes: * IntersectMBO/ouroboros-network#2807 * IntersectMBO/ouroboros-network#2811 * IntersectMBO/ouroboros-network#2832 network tracers: moved ToObject TxSubmission instance network tracers: added ToObjcet TxSubmission2 instance Update cabal.project index-state value
Note that this does not incorporate the latest changes in cardano-ledger-specs. Notable changes: * IntersectMBO/ouroboros-network#2807 * IntersectMBO/ouroboros-network#2811 * IntersectMBO/ouroboros-network#2832 network tracers: moved ToObject TxSubmission instance network tracers: added ToObjcet TxSubmission2 instance Update cabal.project index-state value
Note that this does not incorporate the latest changes in cardano-ledger-specs. Notable changes: * IntersectMBO/ouroboros-network#2807 * IntersectMBO/ouroboros-network#2811 * IntersectMBO/ouroboros-network#2832 network tracers: moved ToObject TxSubmission instance network tracers: added ToObjcet TxSubmission2 instance Update cabal.project index-state value
Note that this does not incorporate the latest changes in cardano-ledger-specs. Notable changes: * IntersectMBO/ouroboros-network#2807 * IntersectMBO/ouroboros-network#2811 * IntersectMBO/ouroboros-network#2832 network tracers: moved ToObject TxSubmission instance network tracers: added ToObjcet TxSubmission2 instance Update cabal.project index-state value
Note that this does not incorporate the latest changes in cardano-ledger-specs. Notable changes: * IntersectMBO/ouroboros-network#2807 * IntersectMBO/ouroboros-network#2811 * IntersectMBO/ouroboros-network#2832 network tracers: moved ToObject TxSubmission instance network tracers: added ToObjcet TxSubmission2 instance Update cabal.project index-state value
Note that this does not incorporate the latest changes in cardano-ledger-specs. Notable changes: * IntersectMBO/ouroboros-network#2807 * IntersectMBO/ouroboros-network#2811 * IntersectMBO/ouroboros-network#2832 network tracers: moved ToObject TxSubmission instance network tracers: added ToObjcet TxSubmission2 instance Update cabal.project index-state value
Note that this does not incorporate the latest changes in cardano-ledger-specs. Notable changes: * IntersectMBO/ouroboros-network#2807 * IntersectMBO/ouroboros-network#2811 * IntersectMBO/ouroboros-network#2832 network tracers: moved ToObject TxSubmission instance network tracers: added ToObjcet TxSubmission2 instance Update cabal.project index-state value
Note that this does not incorporate the latest changes in cardano-ledger-specs. Notable changes: * IntersectMBO/ouroboros-network#2807 * IntersectMBO/ouroboros-network#2811 * IntersectMBO/ouroboros-network#2832 network tracers: moved ToObject TxSubmission instance network tracers: added ToObjcet TxSubmission2 instance Update cabal.project index-state value
2274: Update dependencies r=kderme a=mrBliss Note that this does not incorporate the latest changes in cardano-ledger-specs. Notable changes: * IntersectMBO/ouroboros-network#2807 * IntersectMBO/ouroboros-network#2811 * IntersectMBO/ouroboros-network#2832 Co-authored-by: Thomas Winant <thomas@well-typed.com> Co-authored-by: Hamish Mackenzie <Hamish.K.Mackenzie@gmail.com>
Note that this does not incorporate the latest changes in cardano-ledger-specs. Notable changes: * IntersectMBO/ouroboros-network#2807 * IntersectMBO/ouroboros-network#2811 * IntersectMBO/ouroboros-network#2832 network tracers: moved ToObject TxSubmission instance network tracers: added ToObjcet TxSubmission2 instance Update cabal.project index-state value
Note that this does not incorporate the latest changes in cardano-ledger-specs. Notable changes: * IntersectMBO/ouroboros-network#2807 * IntersectMBO/ouroboros-network#2811 * IntersectMBO/ouroboros-network#2832 network tracers: moved ToObject TxSubmission instance network tracers: added ToObjcet TxSubmission2 instance Update cabal.project index-state value
2274: Update dependencies r=kderme a=mrBliss Note that this does not incorporate the latest changes in cardano-ledger-specs. Notable changes: * IntersectMBO/ouroboros-network#2807 * IntersectMBO/ouroboros-network#2811 * IntersectMBO/ouroboros-network#2832 Co-authored-by: Thomas Winant <thomas@well-typed.com> Co-authored-by: Hamish Mackenzie <Hamish.K.Mackenzie@gmail.com>
This series of patches introduce 'Hello' protocol transformer. It is included
under
Protocol.Trans
module name space (similar to monad transformers). TheTxSubmission2
protocol isTxSubmission
wrapped inHello
transformer.TxSubmission2
protocol will be used from versionNodeToNodeV_6
.typed-protocols: fmapPeerPipelined
ouroboros-network: Hello protocol wrapper
tx-submission: expose more codec functions
TxSubmission2: protocol
TxSubmission2: tests
tx-submission: missing case in id codec
This patch fixes a bug in
codecTxSubmissionId
, it also adds a test whichwould discoverit.
KMsgThx
is not used anywhere hance the bug wasn'tdiscovered.
TxSubmission2: use in node-to-node v6 protocol