[Merged by Bors] - Add serde_utils module with quoted u64 support#1588
Closed
michaelsproul wants to merge 2 commits intomasterfrom
Closed
[Merged by Bors] - Add serde_utils module with quoted u64 support#1588michaelsproul wants to merge 2 commits intomasterfrom
michaelsproul wants to merge 2 commits intomasterfrom
Conversation
michaelsproul
added a commit
that referenced
this pull request
Sep 6, 2020
10 tasks
Member
Author
|
bors r+ |
bors bot
pushed a commit
that referenced
this pull request
Sep 7, 2020
## Proposed Changes This is an extraction of the quoted int code from #1569, that I've come to rely on for #1544. It allows us to parse integers from serde strings in YAML, JSON, etc. The main differences from the code in Paul's original PR are: * Added a submodule that makes quoting mandatory (`require_quotes`). * Decoding is generic over the type `T` being decoded. You can use `#[serde(with = "serde_utils::quoted_u64::require_quotes")]` on `Epoch` and `Slot` fields (this is what I do in my slashing protection PR). I've turned on quoting for `Epoch` and `Slot` in this PR, but will leave the other `types` changes to you Paul. I opted to put everything in the `conseus/serde_utils` module so that BLS can use it without a circular dependency. In future when we want to publish `types` I think we could publish `serde_utils` as `lighthouse_serde_utils` or something. Open to other ideas on this front too.
|
Pull request successfully merged into master. Build succeeded: |
michaelsproul
added a commit
that referenced
this pull request
Sep 7, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Proposed Changes
This is an extraction of the quoted int code from #1569, that I've come to rely on for #1544.
It allows us to parse integers from serde strings in YAML, JSON, etc. The main differences from the code in Paul's original PR are:
require_quotes).Tbeing decoded. You can use#[serde(with = "serde_utils::quoted_u64::require_quotes")]onEpochandSlotfields (this is what I do in my slashing protection PR).I've turned on quoting for
EpochandSlotin this PR, but will leave the othertypeschanges to you Paul.I opted to put everything in the
conseus/serde_utilsmodule so that BLS can use it without a circular dependency. In future when we want to publishtypesI think we could publishserde_utilsaslighthouse_serde_utilsor something. Open to other ideas on this front too.