Skip to content

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

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

crocodile-dentist
Copy link
Contributor

Description

-local message submission
-local message notification

todo haddocks, tests

Checklist

Quality

  • Commit sequence makes sense and have useful messages, see ref.
  • New tests are added and existing tests are updated.
  • Self-reviewed the PR.

Maintenance

  • Linked an issue or added the PR to the current sprint of ouroboros-network project.
  • Added labels.
  • Updated changelog files.
  • The documentation has been properly updated, see ref.

@crocodile-dentist crocodile-dentist self-assigned this Jul 29, 2025
@crocodile-dentist crocodile-dentist requested review from a team as code owners July 29, 2025 13:28
@crocodile-dentist crocodile-dentist added the dmq-node Issues / PRs related to DMQ Node label Jul 29, 2025
@github-project-automation github-project-automation bot moved this to In Progress in Ouroboros Network Jul 29, 2025
@crocodile-dentist crocodile-dentist force-pushed the mwojtowicz/coot/dmq-node-to-node branch 3 times, most recently from 93d68e0 to 86a6d5b Compare July 29, 2025 17:08
Copy link
Contributor

@coot coot left a 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).

Comment on lines 57 to 73
-- | Termination message, initiated by the server when the client is
-- making a blocking call for more messages.
--
MsgServerDone
:: Message (LocalMsgNotification msg) (StBusy StBlocking) StDone
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

@crocodile-dentist crocodile-dentist force-pushed the mwojtowicz/coot/dmq-node-to-node branch 3 times, most recently from ff6004b to fc7da51 Compare July 31, 2025 15:34
@crocodile-dentist crocodile-dentist marked this pull request as draft July 31, 2025 15:35
@crocodile-dentist crocodile-dentist force-pushed the mwojtowicz/coot/dmq-node-to-node branch 2 times, most recently from 05da6c0 to 4c9c0a4 Compare August 1, 2025 08:08
Comment on lines +95 to +133
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
}
Copy link
Contributor

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?

@crocodile-dentist crocodile-dentist force-pushed the mwojtowicz/coot/dmq-node-to-node branch from 4c9c0a4 to 7858cd3 Compare August 4, 2025 14:11
@coot coot force-pushed the coot/dmq-node-to-node branch from c7e804a to 880441d Compare August 5, 2025 07:43
@coot coot linked an issue Aug 6, 2025 that may be closed by this pull request
@crocodile-dentist crocodile-dentist force-pushed the mwojtowicz/coot/dmq-node-to-node branch 6 times, most recently from cf95d94 to dcd0e7a Compare August 7, 2025 13:21
@coot coot force-pushed the coot/dmq-node-to-node branch from 4c1e720 to 0274efd Compare August 7, 2025 14:49
@crocodile-dentist crocodile-dentist force-pushed the mwojtowicz/coot/dmq-node-to-node branch 2 times, most recently from 704c4ad to 357bd29 Compare August 7, 2025 16:17
@crocodile-dentist crocodile-dentist force-pushed the mwojtowicz/coot/dmq-node-to-node branch from 357bd29 to d5067f1 Compare August 7, 2025 16:19
@@ -74,16 +96,19 @@ library
ouroboros-network-framework ^>=0.19,
ouroboros-network-protocols ^>=0.15,
random ^>=1.2,
singletons,
serialise,
Copy link
Contributor

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?

Comment on lines 53 to 55
return $ ServerReply (BlockingReply (NonEmpty.fromList msgs))
DoesNotHaveMore
(serverIdle undefined lastIdx')
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Comment on lines 27 to 30
maybe failure success . listToMaybe <$> mempoolAddTxs [msg]
-- case addTxRes of
-- MempoolTxAdded _tx -> return (SubmitSuccess, server)
-- MempoolTxRejected _tx addTxErr -> return (SubmitFail addTxErr, server)
Copy link
Contributor

Choose a reason for hiding this comment

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

A todo?

@coot coot force-pushed the coot/dmq-node-to-node branch 5 times, most recently from 76bd86d to f10d698 Compare August 8, 2025 13:06
@crocodile-dentist crocodile-dentist force-pushed the mwojtowicz/coot/dmq-node-to-node branch from 5a069e5 to ecc97d5 Compare August 8, 2025 13:16
@crocodile-dentist crocodile-dentist changed the title DMQ local miniprotocol definitions dmq: node-to-client applications Aug 8, 2025
@coot coot force-pushed the coot/dmq-node-to-node branch 4 times, most recently from cf10ee9 to 6fc67a3 Compare August 8, 2025 15:21
Base automatically changed from coot/dmq-node-to-node to main August 8, 2025 16:27
@crocodile-dentist crocodile-dentist force-pushed the mwojtowicz/coot/dmq-node-to-node branch from ecc97d5 to a7e9ca5 Compare August 19, 2025 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dmq-node Issues / PRs related to DMQ Node
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Implement N2C mithril mini-protocols
2 participants