Add append api and use it to deposit events (#5795)

* use append api to deposit events

* use optimized append

* one more optimization

* fix bug

* fix issues

* address review
This commit is contained in:
Nikolay Volf
2020-04-27 19:06:59 +03:00
committed by GitHub
parent 9e4901f3d5
commit 33d00692d8
8 changed files with 123 additions and 13 deletions
@@ -41,6 +41,8 @@ pub enum Error {
ExtensionsAreNotSupported,
/// Extension `TypeId` is not registered.
ExtensionIsNotRegistered(TypeId),
/// Failed to update storage,
StorageUpdateFailed(&'static str),
}
/// The Substrate externalities.
@@ -176,6 +178,15 @@ pub trait Externalities: ExtensionStore {
child_info: &ChildInfo,
) -> Vec<u8>;
/// Append storage item.
///
/// This assumes specific format of the storage item. Also there is no way to undo this operation.
fn storage_append(
&mut self,
key: Vec<u8>,
value: Vec<u8>,
);
/// Get the changes trie root of the current storage overlay at a block with given `parent`.
///
/// `parent` expects a SCALE encoded hash.