Versioning of bytes serializable protocol entities#2767
Versioning of bytes serializable protocol entities#2767KPrasch merged 19 commits intonucypher:mainfrom
Conversation
348eea8 to
51bc193
Compare
derekpierre
left a comment
There was a problem hiding this comment.
Supports immediate backwards-incompatibility with "Treasure Map Con KFrags"
Given the backwards incompatibility with TMapConKfrags, in addition to the feature newsfragment, should we also add a removal newsfragment to indicate deprecation of the non- TMapConKFrags (TMapSinKFrags)?
Provide backwards compatibility for unversioned entities?
Ursula subclasses Versioned too? This will cause an additional major backwards incompatibility in node discovery.
I don't think I understand enough about the future ramifications of not doing this. Could you clarify those for my benefit? Presumably, if we do some sort of Ursula level versioning, we may end up with a fragmented network that may also have implications with respect to sampling of Ursulas i.e. Alice's choice of Ursulas?
Let's start by understanding that new (de)serialization formats for the aforementioned entities will no longer work with previous versions of the code base. This creates several surfaces of backwards-incompatibility, for example:
Currently I expect the failure mode for using outdated bytes to be caused by a missing brand or invalid version bytes . We can potentially improve this behavior by detecting a missing header or invalid version bytes. One issue with this approach is that there is no way to determine if a given bytes blob is outdated or simply invalid since the start bytes will be random. We can potentially even attempt to maintain backwards-compatibility for old policy entities but think this is a bad idea right now since we can still make breaking changes without too much impact.
To consider |
|
An additional consideration that I'd prefer to address in a follow-up is supporting a range of backwards-compatible versions instead of just one. This approach might be implemented with semantic versioning but consider the trade off between complexity and fine-tuning. |
| def __init__(self, | ||
| ursula_checksum_address: ChecksumAddress, # TODO: Use staker address instead (what if the staker rebonds)? | ||
| ursula_checksum_address: ChecksumAddress, | ||
| # TODO: Use staker address instead (what if the staker rebonds)? |
There was a problem hiding this comment.
Not really the topic of this PR, but I think it is the staker address - it comes from the treasure map
|
Some general notes:
|
It certainly will not hurt. Shall I go ahead and also version
It may be good to have a scheme that is compatible across different language implementations. Will This system is elegant and is working right now. Plus, it's a very simple scheme, why will it be hard to implement in |
I'm looking into it myself right now, to separate it into
Well, that's why we wanted to have a core in Rust and bindings to other languages :) But really, it will depend on what we choose as the "reference" binary implementation, and on the specific versioning solution. My guess is it can be made compatible, but perhaps not with the specific scheme in this PR.
Yes, I agree with that. But I'm worried that if we do want to proceed with nucypher-core, we will have to make another major release for it. |
|
I think using this as a reference implementation and attempting to replicate it in nucypher-core is the way to go. Hopefully any tweaks will not be substantial. Keeping this in Python and not doing it in nucypher-core means that we need to copy/rewrite it in nucypher-ts and then in every other future language/platform forever. |
We will have to write our own serializer for that and not use any machinery that |
Do you mean we won't be able to use the |
Co-authored-by: Derek Pierre <derek.pierre@gmail.com>
…ializers in a single dict.
@fjarri, I've incorporated this suggestion in ba6a49e. I've made the assumption that when the major version changes, backwards-compatibility with older bytes strings is broken but maintained for minor versions. In this sense the minor version number is just added metadata. Do you have a different sense of how this might operate? |
Basically what you implemented, but slightly more relaxed: I think, if I am not sure that ideologically it makes sense to keep deserializers for old major versions in the class as opposed to failing right away if |
@fjarri, Considering the above two points. if we expect a minor version increase to be compatible with the current major version ( |
…ds compatibility. Respond to RFCs in PR nucypher#2767.
✔️
✔️ |
Ok, fair enough, you're right. I think the guideline is that X.Y can be deserialized by X.Z as long as Y >= Z, and when you can't guarantee that, you need to bump the major version. But we need some limit on how long the old major versions are supported. Maybe to the point that they can be dropped at any time without further notice. |
derekpierre
left a comment
There was a problem hiding this comment.
🎸
@KPrasch Any thoughts on also adding a removal newsfragment to indicate deprecation of non-versioned object serialization?
I'm a bit hesitant to do so since there are still some unversioned (or differently versioned) entities. I suppose it can say something like "Removes support for almost all unversioned bytestrings." I'm open to suggestions on how to word this accurately. |
Type of PR:
Feature
Required reviews:
2
What this does:
The goal of this PR is to gently introduce a unified version and branding scheme for the following entities (alphabetical):
Arrangementb'AR'b'AR\x00\x01\x00\x00'AuthorizedFragb'KF'b'KF\x00\x01\x00\x00'EncryptedTreasureMapb'EM'b'EM\x00\x01\x00\x00'MessageKitb'MK'b'MK\x00\x01\x00\x00'RetrievalKitb'RK'b'RK\x00\x01\x00\x00'ReencryptionRequestb'RQ'b'RQ\x00\x01\x00\x00'ReencryptionResponseb'RR'b'RR\x00\x01\x00\x00'RevocationOrderb'RV'b'RV\x00\x01\x00\x00'TreasureMapb'TM'b'TM\x00\x01\x00\x00'Related changes:
VersionedABC (inspired by @fjarri 's original gist).Versionedand implement abstract methods on bytes-serializable entities listed above.Revocation->RevocationOrder.AuthorizedKeyFrag.ENCRYPTED_SIZEto accommodate headers.Issues fixed/closed:
#343 #281
Why it's needed:
Notes for reviewers:
UrsulasubclassesVersionedtoo? This will cause an additional major backwards incompatibility in node discovery.