-
Notifications
You must be signed in to change notification settings - Fork 73
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
Closed
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit
Hold shift + click to select a range
de29564
initial draft
dhh1128 39e7638
minor tweak
dhh1128 f764e45
Add sample code
dhh1128 e10df18
tweak unit tests
dhh1128 5c20581
Clarify Reference section
dhh1128 08540cf
Fix usage of ill_be attr
dhh1128 386802d
Add message catalog
dhh1128 55b5e56
Rename @l10n file
dhh1128 a0d57d1
fix escape sequence in json
dhh1128 881ca1a
Polish with @l10n and catalog
dhh1128 ec54507
Revise so tictactoe is only an example
dhh1128 41fbe0c
Rename .md file
dhh1128 24784cf
Polish tictactoe readme
dhh1128 00dfc84
Fix bug in state machine
dhh1128 4a17a84
Fix typo in version num
dhh1128 933d801
Fix URI for message family
dhh1128 d0cabf4
fix minor typo
dhh1128 7f2df54
message family as protocol
TelegramSam a4688b9
notes about adoption
dhh1128 901971a
Add notes about BPMN
dhh1128 873fec2
Add notes about BPMN
dhh1128 f12c422
Improve BPMN notes
dhh1128 a8a96f3
Add section about MTURIs and PIURIs
dhh1128 ebdfa60
Add async subprotocol diagram
dhh1128 3a5613c
generic protocol logo
dhh1128 1817f93
Expand state machine topic
dhh1128 cae6e52
Reformat tictactoe protocol slightly
dhh1128 af9d037
Update protocol and add state machine+tests
dhh1128 551d1c0
float right
dhh1128 e1624b5
add banner
dhh1128 8c566b9
Add visual tile
dhh1128 cb3d6d1
Improve tile
dhh1128 bc72f96
Improve tile
dhh1128 44e33f3
Improve state machine and tests
dhh1128 fc7a602
Tweak images
dhh1128 bbb64cc
Tweak some comments about localization
dhh1128 25ec30c
Break into sub docs
dhh1128 11436d6
Further decomposition into subdocs
dhh1128 fa7bd04
Section about protocol styles
dhh1128 36988fc
Cleanup
dhh1128 7fd5347
Improve state machine discussion
dhh1128 1297947
Add a link to state details in reference
dhh1128 9ef9a0d
correct hyperlink
dhh1128 23f44ab
correct hyperlink
dhh1128 fd0e484
correct hyperlink
dhh1128 d22f609
Add terminology note
dhh1128 4fb8d67
Improve terminology; clarify state machines
dhh1128 8ab53b2
Remove bogus line
dhh1128 ed492ca
further improve state machine discussion
dhh1128 2db94d7
Add note about decentralized
dhh1128 76303dc
wordsmith
dhh1128 840dc1b
Fix mtype regex for final capture group
dhh1128 a1b4544
Add section on protocol version negotiation
dhh1128 c9b0888
Improve version negotiation section
dhh1128 f075813
fix typo
5c1fa6d
wordsmith definitions more
dhh1128 8062897
Clarify definitions
dhh1128 0fe9dec
Supersede with Aries RFC
dhh1128 0d885dc
Supersede with Aries RFC
dhh1128 b6245be
Supersede with Aries RFC
dhh1128 afb164f
Supersede with Aries RFC
dhh1128 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
- Name: protocols | ||
- Name: protocol-message-families | ||
- Authors: Daniel Hardman <[email protected]> | ||
- 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. | ||
|
@@ -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. | ||
|
@@ -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 | ||
|
@@ -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 | ||
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" | ||
|
||
|
@@ -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? | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@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.