This change introduces versioning to the identity document format.
The Version type is introduced to captured this. Importantly, it is
very restricted in its construction and API. Since we primarily only
care about serializing and deserializing documents, the Version is
constructed via Deserialize. The only other ways to get a Version
is to use the IDENTITY_VERSION constant or by using
Version::default.
The Deserialize implementation ensures that the version is within
the accepted bounds, i.e. that it is not 0 and that it is not a
version that may not have been released yet – the user may be running
a previous client.
If it does encounter a future version, it will provide a helpful error
message to check version compatabilities, and possibly upgrade their
binaries.
Note that changing the Doc means that the hashes for tests
change. This requires updating a few of the library tests and many of
the CLI tests.
One important note is the introduction of the advance_timestamp helper
in cob::identity::test, which allows us to manipulate the timestamp
so that we keep a stable order for the timeline tests and get the
correct series of events.
This change introduces versioning to the identity document format.
The Version type is introduced to captured this. Importantly, it is
very restricted in its construction and API. Since we primarily only
care about serializing and deserializing documents, the Version is
constructed via Deserialize. The only other ways to get a Version
is to use the IDENTITY_VERSION constant or by using
Version::default.
The Deserialize implementation ensures that the version is within
the accepted bounds, i.e. that it is not 0 and that it is not a
version that may not have been released yet – the user may be running
a previous client.
If it does encounter a future version, it will provide a helpful error
message to check version compatabilities, and possibly upgrade their
binaries.
Note that changing the Doc means that the hashes for tests
change. This requires updating a few of the library tests and many of
the CLI tests.
One important note is the introduction of the advance_timestamp helper
in cob::identity::test, which allows us to manipulate the timestamp
so that we keep a stable order for the timeline tests and get the
correct series of events.
Changes:
- Rebased on f6b2c5110741b776655eca8228ec66de40b7243d
- Added docs to
Version - Moved
radicle_cob::git::STABLE_TIMEto this patch
Changes:
- Use function for setting default value of document version
- Update docs for with_timestamp
Changes:
- Simplify version check by removing the
ACCEPTED_VERSIONSstatic and using a range check instead. - Introduced
Version::newandVersion::try_fromto help with construction of aVersion, along withVersionErrorfor error cases.
Changes:
- Skip serializing
Doc::versionwhen theversion <= 1
Changes:
- Use NonZeroU32 since we do not allow the version 0
Changes:
- Simplify deserialize of version
Changes:
- Clean up typos and comments
- More concise error message for unknown versions
- Renamed
FutureVersiontoUnkownVersion - Rename
deserialize_default_versiontomissing_version - Add
RawDoc::versionandDoc::versiongetters VersionError::verbosefor more verbose version of the error
Rebase.