Use concrete basic types for time, hash, bytes, validator id#51
Merged
ebuchman merged 5 commits intobucky/litefrom Nov 1, 2019
Merged
Use concrete basic types for time, hash, bytes, validator id#51ebuchman merged 5 commits intobucky/litefrom
ebuchman merged 5 commits intobucky/litefrom
Conversation
bad27b0 to
35b511a
Compare
tarcieri
reviewed
Oct 29, 2019
lite/src/types.rs
Outdated
| /// Size of the underlying Hash in bytes | ||
| pub const HASH_LENGTH: usize = 32; | ||
| #[derive(Eq, PartialEq)] | ||
| pub struct Hash([u8; HASH_LENGTH]); |
Contributor
There was a problem hiding this comment.
You might consider making this an enum and including the hash algorithm
Contributor
Author
There was a problem hiding this comment.
I just realized that how I've ended up in #36 was to not re-define the types here at all but rather re-use the types from the tendermint crate:
https://github.com/interchainio/tendermint-rs/pull/36/files#diff-b1b6c7ff77dbf13838f76b8403715185
That implies to make this (lite) a module instead of a separate crate (see commit message here: d3ce237)
Contributor
Author
|
|
This is just the simplest way to move forward implementing the traits of the lite package. There are alternatives: We do not want a create a circular dependency between lite and tendermint (which does not even compile). To avoid this we could: 1) make lite a module of tendermint, or, 2) replicate a lot of the types of the tendermint crate in the lite package (e.g. Time, Ids etc), or 3) have a dependency from tendermint to the lite package only (but then the trait impls do need to live in the lite crate instead with the types in the tendermint crate directly). copied changes over from d3ce237
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.
Fix the core types (bytes, hashes, etc.)
Hope we won't run into any trouble with
&[u8](at least in #36 I didn't).ref: #31