Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

Serialize ConsistencySignal before transmitting across signal channel #1691

Merged
merged 3 commits into from
Sep 3, 2019

Conversation

maackle
Copy link
Collaborator

@maackle maackle commented Aug 31, 2019

PR summary

Hachiko expects observable "events" as strings which match up exactly, coming from different sources at different times. Currently the serialization is happening on the JS side via JSON.stringify, but this is not great since JSON.stringify is not deterministic. This PR uses serde to do the serialization, under the assumption that serde_json is deterministic.

testing/benchmarking notes

This will probably break current app spec tests since try-o-rama currently does the serialization itself. I need to update the npm package for try-o-rama to not do this for this PR.

changelog

Please check one of the following, relating to the CHANGELOG-UNRELEASED.md

  • this is a code change that effects some consumer (e.g. zome developers) of holochain core so it is added to the CHANGELOG-UNRELEASED.md (linked above), with the format - summary of change [PR#1234](https://github.com/holochain/holochain-rust/pull/1234)
  • this is not a code change, or doesn't effect anyone outside holochain core development

@@ -10,7 +10,7 @@ use std::thread;
#[serde(tag = "signal_type")]
pub enum Signal {
Trace(ActionWrapper),
Consistency(ConsistencySignal),
Consistency(ConsistencySignal<String>),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This, and the new From impl which goes from enum to String, is the main crux of the PR.

.collect(),
}
}
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the main new part, most of the rest of the PR is just moving stuff around.

@maackle maackle marked this pull request as ready for review September 3, 2019 15:18
@maackle
Copy link
Collaborator Author

maackle commented Sep 3, 2019

NB: I had to rerun tests 3 times to get this to pass

@maackle maackle merged commit 9073700 into develop Sep 3, 2019
@maackle maackle deleted the consistency-serialization branch September 3, 2019 17:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants