Skip to content

object diffusion: more client agency for graceful termination, and make server idleness explicit - #5431

Open
prednaz wants to merge 3 commits into
IntersectMBO:mainfrom
tweag:object_diffusion/termination_and_caught-up
Open

prednaz wants to merge 3 commits into
IntersectMBO:mainfrom
tweag:object_diffusion/termination_and_caught-up

Conversation

@prednaz

@prednaz prednaz commented Sep 11, 2026 •

Copy link
Copy Markdown

Description

Supports IntersectMBO/ouroboros-consensus#2286.

1. Support graceful Object Diffusion termination

introduce MsgServerIdle to regularly return agency to the client from an idle server so the client can gracefully terminate the protocol as needed for tweag/cardano-peras#187

beforeafter

2. Make Object Diffusion server idleness explicit

split StObjectIds Blocking into 2 states to make idleness of the server explicit so the client can decide if it has caught up or not as needed for tweag/cardano-peras#144

beforeafter

3. default NoThunks instance for Ouroboros.Network.PerasSupport.PerasSupport

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.

@github-project-automation github-project-automation Bot moved this to In Progress in Ouroboros Network Sep 11, 2026
@prednaz prednaz changed the title object diffusion: more client agency for graceful termination termination and make server idleness explicit object diffusion: more client agency for graceful termination, and make server idleness explicit Sep 11, 2026
@ErinvanderVeen ErinvanderVeen moved this to Peer review in cardano-peras Sep 11, 2026

@tbagrel1 tbagrel1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks very good to me! I've only left a couple of syntax/naming nitpicks.

Related note: I don't think the naming convention CanAwait/MustReply for the states is very clear (the message names are fine though). I know it originates from old issues, and I think it was good during prototyping to keep that terminology, but I think it could be a good time now to think about the names a bit more :) Let me know if you have ideas

-> OutboundStObjectIds kind objectId object m a
SendMsgAwaitReply
:: m (OutboundStObjectIds ('StObjectIdsBlocking 'StMustReply) objectId object m a)
-> OutboundStObjectIds ('StObjectIdsBlocking 'StCanAwait) objectId object m a

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Similarly here, is there any advantage of having a mega-state with two phases instead of two distinct states?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

OutboundStObjectIds ('StObjectIdsBlocking 'StMustReply) and OutboundStObjectIds ('StObjectIdsBlocking 'StCanAwait) are just as distinct of 2 types as 2 hypothetical types OutboundStObjectIdsBlockingMustReply and OutboundStObjectIdsBlockingCanAwait. so i do not think it is appropriate to associate OutboundStObjectIds ('StObjectIdsBlocking 'StMustReply) and OutboundStObjectIds ('StObjectIdsBlocking 'StCanAwait) with anything else than 2 distinct states.

the advantage of parametric polymorphism is that code that is oblivious to the distinction expressed by the parameter does not have to be duplicated. SendMsgReplyObjectIds 3 lines above is an example. without parametric polymorphism, we would need to duplicate it into SendMsgReplyObjectIdsNonBlocking, SendMsgReplyObjectIdsBlockingMustReply, and SendMsgReplyObjectIdsBlockingCanAwait. a more important example is sendNewContent defined by a user of this library.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the advantage of parametric polymorphism is that code that is oblivious to the distinction expressed by the parameter does not have to be duplicated. SendMsgReplyObjectIds 3 lines above is an example. without parametric polymorphism, we would need to duplicate it into SendMsgReplyObjectIdsNonBlocking, SendMsgReplyObjectIdsBlockingMustReply, and SendMsgReplyObjectIdsBlockingCanAwait. a more important example is sendNewContent defined by a user of this library.

Thanks for the explanation. Would you mind adding this as docstring in the code? Thanks :)

@prednaz

prednaz commented Sep 18, 2026 •

Copy link
Copy Markdown
Author

I don't think the naming convention CanAwait/MustReply for the states is very clear (the message names are fine though). I know it originates from old issues, and I think it was good during prototyping to keep that terminology, but I think it could be a good time now to think about the names a bit more

if it originated from old issues, those were very old issues indeed because ChainSync is using this naming convention too.

ObjectDiffusionChainSync (Ouroboros Network Specification)

i suspect that staying consistent with ChainSync might be worth accepting this confusing naming.

@tbagrel1

Copy link
Copy Markdown
Contributor

Alright, I'm fine with keeping this terminology, as long as we just explain in a comment where it originates from and what it means exactly :)

ErinvanderVeen and others added 3 commits September 25, 2026 03:35
introduce `MsgServerIdle` to regularly return agency to the client from
an idle server so the client can gracefully terminate the protocol as
needed for tweag/cardano-peras#187
split `StObjectIds Blocking` into 2 states to make idleness of the
server explicit so the client can decide if it has caught up or not as
needed for tweag/cardano-peras#144
@prednaz
prednaz force-pushed the object_diffusion/termination_and_caught-up branch 2 times, most recently from 42e3318 to 2de679a Compare September 25, 2026 02:24

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

4 participants