You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We currently have custom rolled domain types for the ConnectionEnd, ChannelEnd, etc. We also have the generated protobuf types. We should follows the convention adopted in the tendermint-rs repo that uses the protobuf types as an intermediary for deserializing from the wire into our domain types. We can do this by implementing TryFrom on our domain types to populate them from the protobuf types. Then with some serde magic, the deserialization can automatically flow through the protobuf types into our types.
See for instance the CommitSig and RawCommitSig in Tendermint:
informalsystems/hermes#152 fixes that with the same pattern but slightly different tools (because prost doesn't support serde).
CommitSig uses serde annotation in the domain type to identify the raw serde-decoded type and the TryFrom trait to validate the data from the raw type into the domain type.
ConnectionEnd (and others in ibc-rc) uses a "TryFromRaw" custom trait that does both: it works similarly to TryFrom as in it has a try_from(raw) method but it also introduces an associated type to store what exactly that raw type is. (Which in the previous case came from the serde annotation.)
We currently have custom rolled domain types for the ConnectionEnd, ChannelEnd, etc. We also have the generated protobuf types. We should follows the convention adopted in the tendermint-rs repo that uses the protobuf types as an intermediary for deserializing from the wire into our domain types. We can do this by implementing TryFrom on our domain types to populate them from the protobuf types. Then with some serde magic, the deserialization can automatically flow through the protobuf types into our types.
See for instance the CommitSig and RawCommitSig in Tendermint:
https://github.com/informalsystems/tendermint-rs/blob/aefb3e062bb9026d765db509a676a9492b3c23f2/tendermint/src/block/commit_sig.rs#L11-L13
https://github.com/informalsystems/tendermint-rs/blob/aefb3e062bb9026d765db509a676a9492b3c23f2/tendermint/src/serializers/raw_commit_sig.rs#L22-L37
The text was updated successfully, but these errors were encountered: