-
Notifications
You must be signed in to change notification settings - Fork 269
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
feat(core): add protocol specification #646
Conversation
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.
I really like this comprehensive approach of defining a protocol. Ultimately we'd benefit a lot from separating the syntax of the protocol from its implementation.
Great work! 👍🏻
…i/uAgents into feat/protocol-specification
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.
Looks good to me now!
Proposed Changes
Add protocol specification for easier definition of protocols based on interactions and roles. The original way of defining protocols still works exactly the same, but now if you provide a protocol specification object, for example:
Then you can generate the protocols for both roles:
Creating the protocol this way locks the protocol so that you cannot add handlers for messages that are not already included int he interactions, ensuring that the protocol manifest and digest do not change. Also, when an agent includes a protocol, it calls the
protocol.verify()
function, which checks that all the required handlers for the role have been implemented.Linked Issues
[if applicable, add links to issues resolved by this PR]
Types of changes
What type of change does this pull request make (put an
x
in the boxes that apply)?Checklist
Put an
x
in the boxes that apply:If applicable
python/scripts/generate_api_docs.py
)