Commit Graph

17 Commits

Author SHA1 Message Date
Paul Hauner
7f6ae4c2f5 Refactor tree hashing (#861)
* Pre-allocated tree hash caches

* Add SmallVec to tree hash cache

* Avoid allocation for validator.pubkey

* Avoid iterator which seems to be doing heap alloc

* Add more smallvecs

* MOAR SMALLVEC

* Move non-test code to Hash256 tree hash

* Fix byte ordering error

* Add incomplete but working merkle stream impl

* Fix zero hash error

* Add zero hash fn

* Add MerkleStream comments

* Add smallvec, tidy

* Integrate into tree hash derive

* Update ssz_types tree hash

* Don't heap alloc for mix in length

* Add byte-level streaming to MerkleStream

* Avoid recursion in write method

* Update BLS to MerkleStream

* Fix some not-compiling tests

* Remove debug profiling

* Remove code duplication

* Move beacon state tree hash to new hasher

* Fix failing tests

* Update comments

* Add some fast-paths to tree_hash::merkle_root

* Remove unncessary test

* Rename MerkleStream -> MerkleHasher

* Rename new_with_leaf_count -> with_leaves

* Tidy

* Remove NonZeroUsize

* Remove todo

* Update smallvec
2020-03-05 08:07:27 +11:00
Paul Hauner
871163aecc Add optimized SSZ decoding for fixed-len items (#865)
* Add custom SSZ decode for Validator

* Move efficient decode into macro

* Don't allocate SSZ offset to heap

* Use smallvec in SszDecoder

* Fix test compile error
2020-03-04 11:45:01 +11:00
pscott
7eb82125ef Clippy clean (#536)
* Change into_iter to iter

* Fix clippy 'easy' warnings

* Clippy eth2/utils

* Add struct NetworkInfo

* Clippy for types, utils, and beacon_node/store/src/iters.rs

* Cargo fmt

* Change foo to my_foo

* Remove complex signature

* suppress clippy warning for unit_value in benches

* Use enumerate instead of iterating over range

* Allow trivially_copy_pass_by_ref in serde_utils
2019-09-30 13:58:45 +10:00
Paul Hauner
6a870d468c Add ssz_fixed_len method to ssz::Encode 2019-09-08 12:23:37 -04:00
Michael Sproul
44ed3228b9 ssz: implement Encode and Decode for tuples 2019-07-01 14:54:34 +10:00
Matt Garnett
db9dd3dffe fix encoding impl for usize on 32-bit architectures 2019-06-25 09:59:50 -04:00
Paul Hauner
45fb11b208 Impl ssz enc/dec for NonZeroUsize 2019-06-04 12:24:13 +10:00
Paul Hauner
7a2ab2e9aa Add support for SSZ union type via Option 2019-06-04 12:03:54 +10:00
Paul Hauner
519ee81c68 Merge branch '368' into ef-tests 2019-05-15 12:33:40 +10:00
Michael Sproul
3a0f00215d spec: ensure types up to date with v0.6.1 2019-05-15 11:48:09 +10:00
Paul Hauner
cf509bea9b Improve ef_tests crate 2019-05-13 22:10:23 +10:00
Paul Hauner
a0148b5aae Rename SSZ traits (Encodable -> Encode) 2019-05-13 15:12:19 +10:00
Paul Hauner
96ef8e7073 Tidy SSZ encode impls 2019-05-06 10:26:49 +10:00
Paul Hauner
56fe63f78d Improve allocations for SszEncoder 2019-05-06 09:58:31 +10:00
Paul Hauner
480c5ff160 Update SszEncoder 2019-05-06 09:26:58 +10:00
Paul Hauner
daf6912d18 Begin refactor for less allocation 2019-05-06 08:47:49 +10:00
Paul Hauner
0bd5119f19 Replace ssz with ssz2, adapt ssz_derive 2019-05-04 14:11:48 +10:00