-
Notifications
You must be signed in to change notification settings - Fork 224
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
Automatically de/serialize ABCI event attributes from/to base64 #718
Conversation
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Signed-off-by: Thane Thomson <connect@thanethomson.com>
…roadcast_tx_commit Signed-off-by: Thane Thomson <connect@thanethomson.com>
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Codecov Report
@@ Coverage Diff @@
## master #718 +/- ##
========================================
+ Coverage 40.0% 40.1% +0.1%
========================================
Files 202 202
Lines 12805 12838 +33
Branches 3204 3214 +10
========================================
+ Hits 5130 5160 +30
+ Misses 7348 7331 -17
- Partials 327 347 +20
Continue to review full report at Codecov.
|
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.
The code is technically correct and I like that the serialization is done using serde attributes (instead of custom derives) but I have some reservations about where the serialization module is located.
While trying to separate serialization from domain types, there were a few places where serialization code was gathered:
The tendermint_proto::serializers
module contains most of the "raw" serializer/deserializer code in a reusable format. Things like serializing from a string that is supposed to be an integer, etc.
The tendermint::serializers
module contains serializers that have specific validation requirements on the Tendermint domain-type level: for example a Hash
is just a hexstring (serializer implemented in tendermint_proto
) but it also has a length requirement that is validated in the domain type, hence the serializer needs to call that validation (in the form of a TryFrom
trait in this case, which is implemented in tendermint
).
Technically the base64string
module would belong into tendermint_proto
since it doesn't have any domain-type specific restrictions. I understand that this sounds a bit weird, since nothing in tendermint-proto
is actually using the module.
So I leave it to you to decide if it's worth putting it there or keep it in tendermint
, but I would really like to move it into one of the serializers
modules, both for reusability and to keep the idea of a slow but constant separation of serialization from domain types.
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Cool, I've moved just the deserializer into the |
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.
👍
Closes #717