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.
This PR makes three changes to both spec and implementation:
Add the type ID to the condition format.
This is very, very slightly inefficient, because it makes conditions larger (by about 3%.) But it reduces the risk that a spec writer or implementer will make a mistake and allow a collision between types.
For example, if there is some bug where an implementation gets confused and treats an RSA-SHA-256 condition as a PREIMAGE-SHA-256 condition, then you could fulfill it just by providing the public key.
This change makes this bug much less likely to happen. In addition it ensures that conditions start with the same prefix as their fulfillments, making crypto-conditions more consistent and easier to use.
The types are:
Switch to ASN.1/OER encoding.
Reduces the amount of time the spec has to spend on specifying the binary format. It reduces the chance that there will be errors or mistake in defining the binary format and gives both spec writers and implementers additional tools they can use.
Remove the version field.
With the first change above, we now have a bit too many numbers in the condition. But one of them is pretty redundant: the version. We already have a field which has the semantics of a version field: The type field. So if we want to increment the version of this standard, introduce a new format, etc. we can simply bump the type field to a value that has not been assigned. As a result, conditions and fulfillments are shorter and easier to read.
Before:
After:
Note the fulfillment (
cf:
) only has one version/type field now and both condition and fulfillment now start with the same type ID.