-
Notifications
You must be signed in to change notification settings - Fork 3
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
Encoding relations API #51
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.
Looks pretty good, just some small suggestions.
I feel very good about that. |
As I'm working through these encodings, I think I'm going to split off relation decoding into its own trait. My motivation for this would be to make it possible to implement types without canonical decoders which check for errors. For example, it would be a huge waste of time to implement canonical decoders for all of the WGPS message types, when we will only ever decode relations. Thoughts @AljoschaMeyer? |
Sounds correct. |
Willow's site will soon define encoding relations for many encodings, which are a set of acceptable encodings for a given type. These will be useful for things like WGPS messages where we are decoding many messages and we do not want the implicit overhead of verifying that every message was encoded correctly.
We still want to retain the concept of canonical encodings, as these are important for things like Meadowcap signatures.
So this PR adds new
RelationDecodable
andRelativeRelationDecodable
(open to suggestions) traits with adecode_relation
andrelative_decode_relation
methods on them, respectively.The methods have a default implementation which is an alias for
Decodable
/RelativeDecodable
'sdecode_canonical
andrelative_decode_canonical
.I made these traits separate so that we can define types which have only a canonical decoder, or only a relation decoder (WGPS messages), or both!
Fuzz tests have been refactored to be synchronous and inclued additional checks on encoding tests.
There is also a new shell script for running all the fuzz tests sequentially (see the README) (closes #54).