-
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
simple_hash_from_byte_slices should take a Vec instead of slice #57
Comments
Although it looks like a good idea, we should also consider that in Rust it is "more common to pass slices as arguments rather than vectors when you just want to provide a read access" There is even a clippy warning about see for example #59 (clippy fails); passing in |
Oh hmm. I was thinking we'd want That said for the recursion we may want an inner function that deals in slices so we don't need to_vec everywhere! |
@ebuchman you can always add a From impl that consumes (or creates) a |
- work in progress as we might want to let an inner function for the recursion - also we might simply want to use From to consume (or create a Vec) instead of changing the method signature (as suggested here: #57 (comment))
* build(deps): update tai64 requirement from 2 to 3 (informalsystems#22) Updates the requirements on [tai64](https://github.com/iqlusioninc/crates) to permit the latest version. - [Release notes](https://github.com/iqlusioninc/crates/releases) - [Commits](iqlusioninc/crates@canonical-path/v2.0.0...tai64/3.0.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * simple_hash_from_byte_slices takes a Vec instead of slice * cargo fmt * WIP: pass in Vec<Vec<u8> instead of &Vec<Vec<u8> - work in progress as we might want to let an inner function for the recursion - also we might simply want to use From to consume (or create a Vec) instead of changing the method signature (as suggested here: informalsystems#57 (comment)) * use Vec<Vec<u8>> with inner recursion method * merge in changes of informalsystems#59 and simplify Header::hash * simplify tests: direct vector initialization instead of going through &[&[u8]] * remove obsolete comment * Further reduce boilerplate code by leveraging generics * max_gas should be i64, can be -1 * remove unneed clones * remove secret_connection * Create a trait for with a blanket impl instead of new type Thanks for the suggestion @tarcieri :-) * impl lite::Commit for commit::SignedHeader * Parse validators field in genesis api * Modify lite::Commit impl for SignedHeader to not include amino dep: - SignedVote can now be constructed without going through CanoncialVote (which is an amino-type) - modify impl to match new constructor and remove amino dep - make explicit where which types are amino_types (in vote.rs) * impl lite::ValidatorSetLookup * Add a few methods to tests and deduplicate code for fn hash of lite::ValidatorSet:: & Set - tests for lite::ValidatorSetLookup lite::ValidatorSet impl - delete `fn hash(self) -> merkle::Hash` from Set and only keep the impl of lite::ValidatorSet * implement utility traits for tendermint data types * Signing bytes need to encoded with encode_length_delimited * utilities
Currently we have
fn simple_hash_from_byte_slices(byte_slices: &[&[u8]]) -> Hash
But this leads to some complexities in the few places it's so far used:
as_slice
would go away)The text was updated successfully, but these errors were encountered: