-
Notifications
You must be signed in to change notification settings - Fork 100
Add serde feature #331
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
Merged
Merged
Add serde feature #331
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
c093829
Add serde feature
DaviRain-Su 49f7aa6
Merge remote-tracking branch 'origin/main' into 293-serde-feature
hu55a1n1 4122135
Fix clippy warnings
hu55a1n1 f0900a8
Feature gate serde imports
hu55a1n1 9675e66
Fix for `ErasedSerialize`
hu55a1n1 11a9d71
Fix unused imports
hu55a1n1 ee47d54
Fix CI
hu55a1n1 bf3b0a9
Merge remote-tracking branch 'origin/main' into hu55a1n1/293-serde-fe…
hu55a1n1 22faac6
cargo fmt
hu55a1n1 cb21498
Add serde feature to no-std-check's ibc dep
hu55a1n1 c5768f6
Merge remote-tracking branch 'origin/main' into hu55a1n1/293-serde-fe…
hu55a1n1 1d5e2fb
Document ErasedSerialize re-export
hu55a1n1 8cbf8d2
Move TimeoutHeight serde into it's own module
hu55a1n1 4c46646
Move ClientState serde tests into it's own module
hu55a1n1 33b6ce6
Fix typo
hu55a1n1 9030a16
Apply suggestions from code review
hu55a1n1 6e13929
Update issue templates and CONTRIBUTING.md (#345)
Farhad-Shabani c0c0d50
Merge branch 'main' into hu55a1n1/293-serde-feature
plafer a2a3a3f
make transfer application serde-dependent
plafer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
//! Various packet encoding semantics which underpin the various types of transactions. | ||
|
||
#[cfg(feature = "serde")] | ||
pub mod transfer; |
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
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the
serde_string
module necessary? Also the serialization/deserialization is based on theDisplay
implementation, which seems brittle and easy to breakThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
Coin::amount
is serialized as a decimal string so we use the display impl for easy serde. I think this is a popular pattern and there are crates that provide this functionality e.g. serde_with. Can you please expand on why you think this is brittle?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find it brittle because in general,
Display
is for human-readable output; it's easy to forget that it's also used for serialization. If we change it for a different output, we just made a breaking serialization change, which is pretty bad. I find it unfortunate that it's a common pattern... We can leave it as is though