-
Notifications
You must be signed in to change notification settings - Fork 0
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
Info Encoding Draft Spec #6
Conversation
I modified this to add context at the start of your message |
@keks this read fairly clearly to me: ✔️ I'm confident I'd know how to implement this e.g.
|
- removed newlines for prettier rendering - better wording around double negation - clarified where custom applications specify their own schemas - removed all references to endiannes except in Notations and Definitions section, and in code - don't use l as a variable because it often looks like 1 or I - add section on how to use lists for key-value lists - add examples and more explanations around features they use
Hey @mixmix, thanks for the review! There are two items I didn't want to resolve without checking back with you, would be cool if you could confirm. Also I added a lot of new stuff, could you review that as well? |
info_encoding.md
Outdated
assert i >= 0 | ||
return uint16(i).encode() | ||
} | ||
``` |
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.
This pseudocode confuses me, because it's too far from languages I'm familiar with. (i.e. I might not be the best to review this).
Are you just defining UInt16LE
(unsigned integer, 16 bit, little-endian)?
Isn't this fairly common?
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.
Also, you say method ()
and function ()
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 might be peculiar, but I personally prefer a "pictionary style" approach to introducing new ideas.
- start fuzzy, big picture
"we store things as a concatenated list, so order matters"
- add more detail
"we prefix each thing we concatenate with it's length!"
- get real specific
the encoding of that length is
UInt16LE
, here's exactly what that means, and here's what it all looks like in details when you encode this example string with this example "schema" (the definition of what's in the list and the order)
This is just a style-comment. It's a style I find useful for teaching and introducing new ideas (I was a teacher for quite a few years). We don't have to change anything, this is pretty clear. This plus test-vectors will lock it all in
info_encoding.md
Outdated
This is enough for most simple operations, and can be extended to | ||
key-value stores. | ||
We require the format to support lists of buffers. This is enough for most simple operations, and can be extended to key-value stores. | ||
A property of many structured data encodings is schemalessness. To get a simpler encoding, we do not require this property. Therefore, derivation steps need to define a schema for the encoding of the info field. For the core derivations, this is given. Custom applications that are defined in extensions need to provide this as well. |
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.
This is clear enough.
I think let's just be specific about the core examples ... i.e. "see DeriveSecret"
info_encoding.md
Outdated
is supposed to be used for. | ||
If they are not, the adversary got them to execute their code already, | ||
which means that particular user is in trouble anyways (REPHRASE). | ||
Note that schemalessness would not help in this context, because all users who derive a key agree, by following the specification, on what that key is supposed to be used for up front, so even in a schema |
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.
incomplete sentence
Summary of review@keks this is looking a lot clearer to me. I think once we've got this encoding we just need to add a clear spec about how we use it in DeriveSecret and we're ready to go! Really appreciate the detail you've put into this Keks. |
@keks I made several small changes I'd recommended, and have linked this in to README.md. You can see the changes I made in the commit history above. Hope that's all good :) |
I first sketched
I realized that since everyone who does the derivation knows which derivations they are supposed to do, there is a sort of (up until now) implicit schema.
After thinking about it for a while I could not come up with a reason why whoever performs the derivations would not have such a schema. For our base case, the schema is defined in the core box2 spec. For extensions, it will be in the respective extension's spec.
Therefore, I realized that "type confusion" is not possible, so I scratched the version with type hints.
Since the nested/recursive encoding is just a special case of the flat one, where the buffer contents has a special meaning (i.e. "is of a special type"), I realized that this is safe to use but currently we don't need it.
So I propose using the "flat" SLP for now, and use RLP is extensions where we really need it. After all, it only changes the contents of the buffers in the list, not the encoding of the outer list itself.
Open questions:
<a>
tag for the code heading didn't work. I'll fix that later.