Skip to content
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

Use concrete basic types for time, hash, bytes, validator id #51

Merged
merged 5 commits into from
Nov 1, 2019

Conversation

liamsi
Copy link
Member

@liamsi liamsi commented Oct 29, 2019

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

@liamsi liamsi requested a review from ebuchman October 29, 2019 19:08
/// Size of the underlying Hash in bytes
pub const HASH_LENGTH: usize = 32;
#[derive(Eq, PartialEq)]
pub struct Hash([u8; HASH_LENGTH]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might consider making this an enum and including the hash algorithm

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

@liamsi
Copy link
Member Author

liamsi commented Oct 29, 2019

This was supposed to be a draft PR (please do not merge yet).

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
Copy link
Member

@ebuchman ebuchman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woo thanks!

@ebuchman ebuchman merged commit 1fb9a0f into bucky/lite Nov 1, 2019
@ebuchman ebuchman deleted the ismail/lite_concrete_types branch November 1, 2019 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants