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 authored and GitHub committed 2020-04-27 18:06:59 +02:00
1 parent 9e4901f3d5
commit 33d00692d8
8 files changed
+123 -13

No files matched your search

@@ -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.