Skip to content
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

propose HIPE: protocols explainer #69

Closed
wants to merge 61 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
de29564
initial draft
dhh1128 Dec 12, 2018
39e7638
minor tweak
dhh1128 Dec 12, 2018
f764e45
Add sample code
dhh1128 Dec 12, 2018
e10df18
tweak unit tests
dhh1128 Dec 12, 2018
5c20581
Clarify Reference section
dhh1128 Dec 12, 2018
08540cf
Fix usage of ill_be attr
dhh1128 Dec 13, 2018
386802d
Add message catalog
dhh1128 Dec 19, 2018
55b5e56
Rename @l10n file
dhh1128 Dec 19, 2018
a0d57d1
fix escape sequence in json
dhh1128 Dec 19, 2018
881ca1a
Polish with @l10n and catalog
dhh1128 Dec 19, 2018
ec54507
Revise so tictactoe is only an example
dhh1128 Dec 29, 2018
41fbe0c
Rename .md file
dhh1128 Dec 29, 2018
24784cf
Polish tictactoe readme
dhh1128 Dec 29, 2018
00dfc84
Fix bug in state machine
dhh1128 Dec 29, 2018
4a17a84
Fix typo in version num
dhh1128 Dec 29, 2018
933d801
Fix URI for message family
dhh1128 Dec 29, 2018
d0cabf4
fix minor typo
dhh1128 Dec 29, 2018
7f2df54
message family as protocol
TelegramSam Jan 7, 2019
a4688b9
notes about adoption
dhh1128 Jan 30, 2019
901971a
Add notes about BPMN
dhh1128 Jan 30, 2019
873fec2
Add notes about BPMN
dhh1128 Jan 30, 2019
f12c422
Improve BPMN notes
dhh1128 Jan 30, 2019
a8a96f3
Add section about MTURIs and PIURIs
dhh1128 Apr 5, 2019
ebdfa60
Add async subprotocol diagram
dhh1128 Apr 5, 2019
3a5613c
generic protocol logo
dhh1128 Apr 5, 2019
1817f93
Expand state machine topic
dhh1128 Apr 5, 2019
cae6e52
Reformat tictactoe protocol slightly
dhh1128 Apr 5, 2019
af9d037
Update protocol and add state machine+tests
dhh1128 Apr 5, 2019
551d1c0
float right
dhh1128 Apr 6, 2019
e1624b5
add banner
dhh1128 Apr 6, 2019
8c566b9
Add visual tile
dhh1128 Apr 6, 2019
cb3d6d1
Improve tile
dhh1128 Apr 6, 2019
bc72f96
Improve tile
dhh1128 Apr 6, 2019
44e33f3
Improve state machine and tests
dhh1128 Apr 6, 2019
fc7a602
Tweak images
dhh1128 Apr 6, 2019
bbb64cc
Tweak some comments about localization
dhh1128 Apr 6, 2019
25ec30c
Break into sub docs
dhh1128 Apr 6, 2019
11436d6
Further decomposition into subdocs
dhh1128 Apr 6, 2019
fa7bd04
Section about protocol styles
dhh1128 Apr 6, 2019
36988fc
Cleanup
dhh1128 Apr 6, 2019
7fd5347
Improve state machine discussion
dhh1128 Apr 6, 2019
1297947
Add a link to state details in reference
dhh1128 Apr 6, 2019
9ef9a0d
correct hyperlink
dhh1128 Apr 6, 2019
23f44ab
correct hyperlink
dhh1128 Apr 6, 2019
fd0e484
correct hyperlink
dhh1128 Apr 6, 2019
d22f609
Add terminology note
dhh1128 Apr 6, 2019
4fb8d67
Improve terminology; clarify state machines
dhh1128 Apr 6, 2019
8ab53b2
Remove bogus line
dhh1128 Apr 6, 2019
ed492ca
further improve state machine discussion
dhh1128 Apr 6, 2019
2db94d7
Add note about decentralized
dhh1128 Apr 6, 2019
76303dc
wordsmith
dhh1128 Apr 6, 2019
840dc1b
Fix mtype regex for final capture group
dhh1128 Apr 9, 2019
a1b4544
Add section on protocol version negotiation
dhh1128 Apr 10, 2019
c9b0888
Improve version negotiation section
dhh1128 Apr 10, 2019
f075813
fix typo
May 2, 2019
5c1fa6d
wordsmith definitions more
dhh1128 May 15, 2019
8062897
Clarify definitions
dhh1128 May 15, 2019
0fe9dec
Supersede with Aries RFC
dhh1128 May 21, 2019
0d885dc
Supersede with Aries RFC
dhh1128 May 21, 2019
b6245be
Supersede with Aries RFC
dhh1128 May 21, 2019
afb164f
Supersede with Aries RFC
dhh1128 May 21, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 21 additions & 31 deletions text/protocols/README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
- Name: protocols
- Name: protocol-message-families
- Authors: Daniel Hardman <daniel.hardman@gmail.com>
- Start Date: 2018-12-28
- PR:

# HIPE 00??: Protocols
# HIPE 00??: Protocol Message Families
[summary]: #summary

Defines protocols in the context of agent-to-agent interactions,
Defines protocol message families in the context of agent-to-agent interactions,
and shows how they should be designed and documented.

# Motivation
[motivation]: #motivation

When we began exploring agent-to-agent interactions, we imagined that
interoperability would be achieved by formally defining message families.
We have since learned that, although a message family definition is
highly useful, it is not quite enough. We also need to formally define the
roles in an interaction, the possible states those roles can have, the way
state changes in response to messages, and the errors that may arise.
We have since learned that message family definitions must define more
than simply the attributes that are a part of each message. We also need
to formally define the roles in an interaction, the possible states those roles
can have, the way state changes in response to messages, and the errors
that may arise.

In addition, we realized that we need clear examples of how to define all
these things, so designs are consistent and robust.
Expand Down Expand Up @@ -57,17 +58,21 @@ inside the protocol for ordering food at a restaurant. The protocol for
reporting an error can occur inside an agent protocol for issuing
credentials.

### Message Families

A Message family is a collection of messages, and serves as the _interface_ of the protocol. Each protocol has a primary message family, and the name of the protocol is the name of the primary message family. For all practical purposes, the primary message family (complete with documentation of the roles, states, events and constraints) _is_ the protocol.

### Ingredients

An agent protocol has the following ingredients:

* _name_ and _version_
* _primary message family name and version_
* _roles_
* _state_ and _sequencing rules_
* _events that can change state_ -- notably, _messages_
* _constraints that provide trust and incentives_

### How to define a protocol
### How to define a protocol message family

To define a protocol, write a HIPE. The [tictactoe 1.0 protocol](
tictactoe-1.0/README.md) is attached to this HIPE as an example.
Expand All @@ -81,20 +86,14 @@ The title of the HIPE should include the official name of the protocol
and its version. Because protocol names are likely to be used in filenames
and URIs, they are conventionally lower-kebab-case, but are compared
case-insensitively and ignoring punctuation.
Typically, the name of the protocol and the name of
its associated message family are identical, and so are the versions.
The name of the protocol and the name of
its primary message family are identical, and so are the versions.
In the [tictactoe 1.0 example](tictactoe-1.0/README.md), the protocol
name and message family name are both "tictactoe", and the protocol
version and message family version are both "1.0".

However, these may diverge (e.g., in a case where a protocol
uses the same messages but has new states or new constraints on when
messages can be sent and how they are processed). It is also possible
for a protocol to use more than one message family, as for example
when a protocol uses a generic [`ack`]( https://github.com/hyperledger/indy-hipe/pull/77)
or a [`problem-report`](https://github.com/hyperledger/indy-hipe/pull/65)).
Therefore, the association between a protocol name+version and a
message family name+version is weak, not strong.
It is also possible for a protocol to use more than one message family, as for example
when a protocol uses a generic [`ack`]( https://github.com/hyperledger/indy-hipe/pull/77) or a [`problem-report`](https://github.com/hyperledger/indy-hipe/pull/65)).

[Semver](http://semver.org) rules apply in cascading fashion to versions
of protocols, message families, and individual message types. Individual
Expand All @@ -106,18 +105,8 @@ version](https://semver.org/#spec-item-7).
Similarly, a message family can add new message types with only a change
to the minor version. These are all backwards-compatible changes.

A protocol has a dependency on one or more message families, and should be
versioned accordingly. If it declares a dependency on message family Y
version 1.X, the protocol's version need not change when message family Y
evolves to 1.X+1; this is a backwards-compatible change from the protocol's
perspective, because parties using the protocol can use either Y 1.X or
Y 1.X+1 and remain interoperable. However, if the protocol uses a new
feature introduced in Y version 1.X+1, then this causes the protocol's
own version to be updated. If the usage of the new feature is optional in
the protocol, then the dependency update is a backwards-compatible change,
and the protocol's minor version gets updated. If the usage of the new
feature is required, then [the protocol's major version gets updated](
https://semver.org/#spec-item-8).
Any change in the expectations of a message family, even if no message attributes
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@TelegramSam : this is the only change in this commit that I don't feel comfortable with. I think your phrase "change in expectations" is not quite clear enough. When party A talks protocol version 1, and party B talks protocol version 2, they should not expect to be interoperable; the different major numbers advertises incompatibility. However, if it's A=1.3 and B=1.5, then they should expect interoperability except on some optional features that B apparently knows about but A does not.

So here's the way I'd state it: minor numbers in a protocol introduce features that are optional, such that the later version could be interoperable with an earlier version having the same major number, as long as the functionality used between the two parties is gracefully degraded. On the other hand, major versions say that no interoperability should be assumed.

are changed, must result in an [increase of the major version of the primary message family](https://semver.org/#spec-item-8).

##### "Key Concepts" under "Tutorial"

Expand Down Expand Up @@ -312,4 +301,5 @@ interop.
[unresolved]: #unresolved-questions

- Should we write a Swagger translator?
- If not swagger, what formal definition format should we use in the future?