Skip to content

Conversation

@coot
Copy link
Collaborator

@coot coot commented Sep 24, 2024

Fixes #59

  • typed-protocols-stateful: pass initial state through Yield
  • typed-protocols-codec: changed how AnyMessageAndAgency is exported
  • typed-protocols-0.3.0.0: bumped versions

This removes the need to pass it in messages, like we used to in
`MsgResp` in `typed-protocols-examples`.

The `Driver` and `Codec` were modified:
* `encode` and `sendMessage` receive the initial state of the protocol
  state transition imposed by a message, which is dual to
* `decode` and `recvMessage` receive the final state of the protocol
  state transition imposed by a message

This is seems more natural than always passing the final state.

The drawback of this systemic approach is that every `Yield` needs
access to both initial and final state of a transition.  In previous
approach one had more control over which messages require access to the
initial state (e.g. `MsgRecv` in `Stateful.ReqResp`) - although it was
looking more like a hack since that part of a message wasn't sent over
the wire.
Also done for typed-protocols-stateful-codec.
@coot coot self-assigned this Sep 24, 2024
@coot coot added the stateful-api issues / PRs related to the stateful API label Sep 24, 2024
@coot coot added this pull request to the merge queue Sep 26, 2024
Merged via the queue into main with commit d127d3e Sep 26, 2024
16 checks passed
@coot coot deleted the coot/stateful branch September 26, 2024 15:07
github-merge-queue bot pushed a commit to IntersectMBO/ouroboros-consensus that referenced this pull request Oct 21, 2024
# Description

Use `typed-protocols-0.3.0.0`.

Depends on:

* [x] input-output-hk/typed-protocols#52
* [x] input-output-hk/typed-protocols#61
* [x] IntersectMBO/ouroboros-network#4935

- **Updated to use typed-protocols-0.3.0.0**
- **Added KeepAlive tracer**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stateful-api issues / PRs related to the stateful API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extend stateful API

3 participants