Skip to content
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

Fix #1547: Store pin metadata in a sorted array #1664

Merged
merged 2 commits into from May 5, 2022

Conversation

hsanjuan
Copy link
Collaborator

@hsanjuan hsanjuan commented May 5, 2022

This deprecates the Metadata protobuf map and starts serializing metadata as an
array that is always sorted by the metadata key.

This should resolve the issue that an state export file can be imported
resulting in two different CRDT dags because the binary representation of the
pin can arbitrarily change depending on how the keys in the map are listed,
and thus the CID of a delta is impacted.

So with this, a state export should result in exactly the same DAG regardless
of where it is imported.

This deprecates the Metadata protobuf map and starts serializing metadata as an
array that is always sorted by the metadata key.

This should resolve the issue that an state export file can be imported
resulting in two different CRDT dags because the binary representation of the
pin can arbitrarily change depending on how the keys in the map are listed,
and thus the CID of a delta is impacted.

So with this, a state export should result in exactly the same DAG regardless
of where it is imported.
@hsanjuan hsanjuan self-assigned this May 5, 2022
@hsanjuan hsanjuan linked an issue May 5, 2022 that may be closed by this pull request
@hsanjuan hsanjuan added this to the Release v1.0.1 milestone May 5, 2022
Metadata: pin.Metadata,
PinUpdate: pin.PinUpdate.Bytes(),
ExpireAt: expireAtProto,
// Metadata: pin.Metadata,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Peers on older versions will not be able to see metadata for pins submitted on newer versions.

@hsanjuan hsanjuan merged commit 72a7c37 into master May 5, 2022
@hsanjuan hsanjuan deleted the fix/1547-metadata-serialization branch May 5, 2022 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

State exports can be deserialized in multiple ways
1 participant