Use storage::append in the implementation of the storage types (#5889)

* Start improving `storage_append`

* Fix some stuff

* Fix compilation

* Update docs and add new test

* More tests

* Test kill + append
This commit is contained in:
Bastian Köcher
2020-05-05 15:09:07 +02:00
committed by GitHub
parent be0c7b9340
commit bc9707b4c5
19 changed files with 252 additions and 362 deletions
+2 -3
View File
@@ -168,7 +168,7 @@ use sp_runtime::{
DispatchResult, DispatchError, RuntimeDebug,
traits::{Zero, Hash, Dispatchable, Saturating},
};
use codec::{Ref, Encode, Decode};
use codec::{Encode, Decode};
use frame_support::{
decl_module, decl_storage, decl_event, decl_error, ensure, Parameter,
weights::{Weight, DispatchClass},
@@ -553,8 +553,7 @@ decl_module! {
PublicPropCount::put(index + 1);
<DepositOf<T>>::insert(index, (value, &[&who][..]));
let new_prop = (index, proposal_hash, who);
<PublicProps<T>>::append_or_put(&[Ref::from(&new_prop)][..]);
<PublicProps<T>>::append((index, proposal_hash, who));
Self::deposit_event(RawEvent::Proposed(index, value));
}