-
Notifications
You must be signed in to change notification settings - Fork 89
dmq: node-to-client applications #5173
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
base: main
Are you sure you want to change the base?
Conversation
93d68e0
to
86a6d5b
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.
Please add codec tests to this PR. Even if we change the protocols, they won't change that much (just small changes in the generators).
decentralized-message-queue/src/DMQ/Protocol/LocalMsgNotification/Type.hs
Outdated
Show resolved
Hide resolved
decentralized-message-queue/src/DMQ/Protocol/LocalMsgNotification/Type.hs
Outdated
Show resolved
Hide resolved
decentralized-message-queue/src/DMQ/Protocol/LocalMsgNotification/Type.hs
Outdated
Show resolved
Hide resolved
-- | Termination message, initiated by the server when the client is | ||
-- making a blocking call for more messages. | ||
-- | ||
MsgServerDone | ||
:: Message (LocalMsgNotification msg) (StBusy StBlocking) StDone |
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.
We should discuss whether this message is needed at all.
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.
Yes, I have doubts as well.
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.
This may be used during server shutdown.
decentralized-message-queue/src/DMQ/Protocol/LocalMsgNotification/Type.hs
Outdated
Show resolved
Hide resolved
decentralized-message-queue/src/DMQ/Protocol/LocalMsgNotification/Server.hs
Outdated
Show resolved
Hide resolved
decentralized-message-queue/src/DMQ/Protocol/LocalMsgNotification/Codec.hs
Outdated
Show resolved
Hide resolved
decentralized-message-queue/src/DMQ/Protocol/LocalMsgNotification/Codec.hs
Outdated
Show resolved
Hide resolved
decentralized-message-queue/src/DMQ/Protocol/LocalMsgSubmission/Client.hs
Outdated
Show resolved
Hide resolved
decentralized-message-queue/src/DMQ/Protocol/LocalMsgSubmission/Server.hs
Outdated
Show resolved
Hide resolved
ff6004b
to
fc7da51
Compare
05da6c0
to
4c9c0a4
Compare
decentralized-message-queue/src/DMQ/Protocol/LocalMsgNotification/Type.hs
Outdated
Show resolved
Hide resolved
decentralized-message-queue/src/DMQ/Protocol/LocalMsgNotification/Type.hs
Outdated
Show resolved
Hide resolved
decentralized-message-queue/src/DMQ/Protocol/LocalMsgNotification/Type.hs
Outdated
Show resolved
Hide resolved
encodeSigId :: SigId -> CBOR.Encoding | ||
encodeSigId SigId { getSigId } = CBOR.encodeBytes (getSigHash getSigId) | ||
|
||
|
||
decodeSigId :: forall s. CBOR.Decoder s SigId | ||
decodeSigId = SigId . SigHash <$> CBOR.decodeBytes | ||
|
||
|
||
encodeSig :: Sig -> CBOR.Encoding | ||
encodeSig Sig { sigId, | ||
sigBody, | ||
sigExpiresAt, | ||
sigKesSignature, | ||
sigOpCertificate | ||
} | ||
= CBOR.encodeListLen 5 | ||
<> encodeSigId sigId | ||
<> CBOR.encodeBytes (getSigBody sigBody) | ||
<> CBOR.encodeWord32 (floor sigExpiresAt) | ||
<> CBOR.encodeBytes (getSigKesSignature sigKesSignature) | ||
<> CBOR.encodeBytes (getSigOpCertificate sigOpCertificate) | ||
|
||
|
||
decodeSig :: forall s. CBOR.Decoder s Sig | ||
decodeSig = do | ||
a <- CBOR.decodeListLen | ||
when (a /= 5) $ fail (printf "codecSigSubmission: unexpected number of parameters %d" a) | ||
sigId <- decodeSigId | ||
sigBody <- SigBody <$> CBOR.decodeBytes | ||
sigExpiresAt <- realToFrac <$> CBOR.decodeWord32 | ||
sigKesSignature <- SigKesSignature <$> CBOR.decodeBytes | ||
sigOpCertificate <- SigOpCertificate <$> CBOR.decodeBytes | ||
return Sig { | ||
sigId, | ||
sigBody, | ||
sigExpiresAt, | ||
sigKesSignature, | ||
sigOpCertificate | ||
} |
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.
Do we have tests for these?
decentralized-message-queue/test/Test/DMQ/Protocol/LocalMsgNotification.hs
Show resolved
Hide resolved
4c9c0a4
to
7858cd3
Compare
c7e804a
to
880441d
Compare
cf95d94
to
dcd0e7a
Compare
4c1e720
to
0274efd
Compare
704c4ad
to
357bd29
Compare
357bd29
to
d5067f1
Compare
@@ -74,16 +96,19 @@ library | |||
ouroboros-network-framework ^>=0.19, | |||
ouroboros-network-protocols ^>=0.15, | |||
random ^>=1.2, | |||
singletons, | |||
serialise, |
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.
Can we avoid serialise
constraint in the dependency tree of dmq-exe
?
decentralized-message-queue/src/DMQ/NtC_Applications/LocalMsgNotification.hs
Outdated
Show resolved
Hide resolved
decentralized-message-queue/src/DMQ/NtC_Applications/LocalMsgNotification.hs
Outdated
Show resolved
Hide resolved
decentralized-message-queue/src/DMQ/NtC_Applications/LocalMsgNotification.hs
Outdated
Show resolved
Hide resolved
return $ ServerReply (BlockingReply (NonEmpty.fromList msgs)) | ||
DoesNotHaveMore | ||
(serverIdle undefined lastIdx') |
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.
We're sending all at once (the same below in the non-blocking case), but this will likely change once we speak with the mithril team.
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.
I've floated the idea on the slack channel to have the max number of messages a negotiated parameter in the handshake. We can impose some sane hard limit on top in addition of course, and this flexibility would be acceptable for a local protocol I think.
maybe failure success . listToMaybe <$> mempoolAddTxs [msg] | ||
-- case addTxRes of | ||
-- MempoolTxAdded _tx -> return (SubmitSuccess, server) | ||
-- MempoolTxRejected _tx addTxErr -> return (SubmitFail addTxErr, server) |
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.
A todo?
76bd86d
to
f10d698
Compare
5a069e5
to
ecc97d5
Compare
cf10ee9
to
6fc67a3
Compare
ecc97d5
to
a7e9ca5
Compare
Description
-local message submission
-local message notification
todo haddocks, tests
Checklist
Quality
Maintenance
ouroboros-network
project.