Use optimized append and len storage methods in SRML. (#3071)

* expose len from codec to storage.

* refactor runtime with len and append.

* Undo example.

* Remove imports.

* Bump codec.

* Optionify.

* Make decode_len counscious.

* Refactor.

* Update srml/support/src/storage/hashed/generator.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Update srml/support/src/storage/hashed/generator.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Update srml/support/src/storage/hashed/generator.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Update srml/support/src/storage/hashed/generator.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Fix merge.

* fix some docs.

* Add NoDefault trait.

* Bump.

* Final nits.

* Update srml/support/src/traits.rs

* new approach toward len.

* re-create lock file.

* Fix build errors and Option handling.

* More test fix

* Use default for append as well.

* Fix runtime.

* Add support for linked_map

* More tweaks from review.

* Fix style

* Change api for none-values

* Bump.
This commit is contained in:
Kian Paimani
2019-08-27 19:39:05 +02:00
committed by Bastian Köcher
parent 99a7492dbf
commit 095c7de7ff
13 changed files with 573 additions and 179 deletions
+1 -1
View File
@@ -578,7 +578,7 @@ impl<T: Trait> Module<T> {
// We perform early return if we've reached the maximum capacity of the event list,
// so `Events<T>` seems to be corrupted. Also, this has happened after the start of execution
// (since the event list is cleared at the block initialization).
if <Events<T>>::append(&[event]).is_err() {
if <Events<T>>::append([event].into_iter()).is_err() {
// The most sensible thing to do here is to just ignore this event and wait until the
// new block.
return;