Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

bulk child trie deletion #5280

Closed
wants to merge 171 commits into from
Closed
Show file tree
Hide file tree
Changes from 116 commits
Commits
Show all changes
171 commits
Select commit Hold shift + click to select a range
e97accb
change from cache root pr
cheme Jan 28, 2020
d7d69a4
Merge branch 'master' into split_child_payload
cheme Jan 28, 2020
cf6393a
Targetted way of putting keyspace.
cheme Jan 28, 2020
2845d0e
changes to state-db
cheme Jan 28, 2020
a0532d1
change transaction to be by child trie.
cheme Jan 28, 2020
eb5961f
slice index fix, many failing tests.
cheme Jan 28, 2020
67687f8
fix state-db tests
cheme Jan 28, 2020
48df830
vec with multiple entry of a same rc prefixeddb did not make sense,
cheme Jan 29, 2020
9e9a684
Merge branch 'master' into split_child_payload
cheme Jan 29, 2020
cb4c4a9
change set to btreemap, seems useless (at least do no solve changetrie
cheme Jan 29, 2020
a398b82
moving get_1 to get, state-machine needs rework
cheme Jan 30, 2020
7b26a93
Resolve a bit of child trie
cheme Jan 30, 2020
4d1378f
Merge branch 'split_child_payload' into split_child_payload_map2
cheme Jan 30, 2020
f39ce3f
small refact
cheme Jan 30, 2020
bc4fe52
Merge branch 'master' into split_child_payload
cheme Jan 30, 2020
f27a2ec
Merge branch 'split_child_payload' into split_child_payload_map2
cheme Jan 30, 2020
9f0c600
indent
cheme Jan 31, 2020
ecb43d0
Use const of null hash check on BackendStorageRef.
cheme Jan 31, 2020
d76a316
Merge branch 'split_child_payload_map2' into split_child_payload
cheme Jan 31, 2020
ae29df5
Associated null node hash set to a non optional const.
cheme Jan 31, 2020
6a06c0a
Make ChildInfo borrow of OwnedChildInfo.
cheme Jan 31, 2020
25aaa3a
Removing unsafe cast, using ref_cast asumption for borrow case.
cheme Feb 3, 2020
0d45d85
Borrow approach on OwnedChildInfo and ChildInfo did not make sense
cheme Feb 3, 2020
274a923
Factoring map of children code, before switching key.
cheme Feb 3, 2020
2e47a1d
Switching children key from optional to simple ChildInfo.
cheme Feb 3, 2020
328ed66
Merge branch 'master' into split_child_payload
cheme Feb 4, 2020
b07d7ca
fix merge test
cheme Feb 4, 2020
e5d7b04
clean todos
cheme Feb 4, 2020
3a71669
fix
cheme Feb 4, 2020
c846471
End up removing all keypacedDB from code.
cheme Feb 4, 2020
0b557b6
Clean unused struct and useless child info.
cheme Feb 4, 2020
8483da4
remove todo
cheme Feb 4, 2020
64ffcea
actual touch to keyspace prefixing (fail on wrong code asserted).
cheme Feb 4, 2020
2bc3cb6
self review changes.
cheme Feb 5, 2020
3136355
bump impl version.
cheme Feb 5, 2020
f655da1
Merge branch 'master' into split_child_payload
cheme Feb 5, 2020
bae6523
calculate size for single operation on usize.
cheme Feb 6, 2020
88ed503
Put keyspace logic in its own struct.
cheme Feb 6, 2020
4eb4676
Restrict top trie in ext to the storage key build from an empty key.
cheme Feb 6, 2020
5151471
Implementation basis for this PR, note that child storage key default
cheme Feb 6, 2020
8715446
Resolve prefix from child_info
cheme Feb 6, 2020
b72cd9c
Removed all child prefix, next is putting it back on full storage and on
cheme Feb 6, 2020
b636687
Prefixing child storage key where needed.
cheme Feb 7, 2020
e88631c
Merge branch 'master' into child_trie_w3_change
cheme Feb 7, 2020
e5b525f
Merge branch 'master' into split_child_payload
cheme Feb 7, 2020
728aedf
Remove deprecated check for genesis and fix some test storage builds.
cheme Feb 7, 2020
8329448
Merge branch 'master' into child_trie_w3_change
cheme Feb 7, 2020
864e9ca
Fix contract to stop using the child storage prefix.
cheme Feb 7, 2020
c87d19b
Revert changes to state-db and plug keyspace above it for default child
cheme Feb 11, 2020
1f62342
Merge branch 'master' into split_child_payload
cheme Feb 11, 2020
8b901a2
Update client-db benches.
cheme Feb 11, 2020
f6efdad
Bump runtime impl version.
cheme Feb 11, 2020
c683198
Merge branch 'master' into split_child_payload
cheme Feb 13, 2020
93de960
fix new code
cheme Feb 13, 2020
2224e2f
Merge branch 'master' into child_trie_w3_change
cheme Feb 17, 2020
c04ba95
Fixing merge.
cheme Feb 17, 2020
ffaf9f5
Switch back to using prefix on host function, remove child_id and
cheme Feb 17, 2020
87bd97c
fix polka ref issue.
cheme Feb 17, 2020
17cf613
Switching back to unprefixed in child info (all temporary struct
cheme Feb 18, 2020
b3ccc93
bump version
cheme Feb 18, 2020
afe85ae
fix tabs and doc.
cheme Feb 18, 2020
befe325
Merge branch 'master' into child_trie_w3_change
cheme Feb 18, 2020
ed480fa
Apply more consistant naming 'storage_key' instead of
cheme Feb 19, 2020
e103c2a
Update primitives/storage/src/lib.rs
cheme Feb 21, 2020
958b626
use prefixed storage key in change trie
cheme Feb 21, 2020
26f8000
Merge branch 'child_trie_w3_change' of github.com:cheme/polkadot into…
cheme Feb 21, 2020
f471d56
renaming 'default_child_trie_root' to 'empty_child_trie_root'
cheme Feb 21, 2020
02ff227
apply some renaming, rpc change are really ugly, will revert them
cheme Feb 21, 2020
8fcc112
Switch back to using child_type for rpc (and light client).
cheme Feb 21, 2020
b7b347a
Merge branch 'master' into child_trie_w3_change
cheme Feb 21, 2020
3869774
Merge branch 'master' into child_trie_w3_change
cheme Feb 26, 2020
4ebc204
Merge branch 'master' into child_trie_w3_change
cheme Feb 26, 2020
74aa3f8
bump runtime version
cheme Feb 26, 2020
dc023d1
merge #4857
cheme Feb 26, 2020
4c40ea7
Resolve merging change of api from #4857
cheme Feb 26, 2020
b6b70f3
revert rpc related default renaming.
cheme Feb 27, 2020
d563278
fix slice indexing for child root
cheme Feb 27, 2020
a85bb38
Switch back to prefixed storage key for rpc.
cheme Feb 27, 2020
5f98fbe
rpc error discrepancy
cheme Feb 27, 2020
320e375
Merge branch 'master' into child_trie_w3_change
cheme Feb 27, 2020
f05a576
Merge branch 'child_trie_w3_change' into split_child_payload
cheme Feb 27, 2020
d85dec2
Fix test
cheme Feb 27, 2020
9f704c9
use correct parameter in overlay and fix change trie.
cheme Feb 28, 2020
c82edbd
Merge branch 'master' into child_trie_w3_change
cheme Mar 2, 2020
7c5d546
bump version
cheme Mar 2, 2020
19ab06b
Merge branch 'master' into child_trie_w3_change
cheme Mar 10, 2020
152f04f
Merge branch 'master' into child_trie_w3_change
cheme Mar 12, 2020
e959e0d
Merge branch 'child_trie_w3_change' into split_child_payload
cheme Mar 12, 2020
eff1d8c
keeping inner hasher, it is needed at state-machine level.
cheme Mar 12, 2020
80136e3
Define child change enum.
cheme Mar 12, 2020
8249a9f
Key delta in child change too.
cheme Mar 12, 2020
6f0a01b
remove storage collection from the change, empty collection is not an
cheme Mar 12, 2020
1c97b84
ChildChangeSet overlay struct
cheme Mar 12, 2020
daf0a7a
fix client
cheme Mar 12, 2020
00ece8f
fix client
cheme Mar 12, 2020
3a2118e
storage_cache changes
cheme Mar 12, 2020
676f2d0
rocksdb patch for prefix delete updated
cheme Mar 12, 2020
07ec221
unprefixed storage key is smaller than random one.
cheme Mar 13, 2020
67e850e
notification and tests
cheme Mar 13, 2020
8160e20
change try_update to skip update on deleted child
cheme Mar 13, 2020
97bbb55
assimilate delete for child change
cheme Mar 13, 2020
fc46e62
overlay filters
cheme Mar 13, 2020
61b1926
in progress, putting child change in transaction (types wrong), next
cheme Mar 13, 2020
921e9d1
Keep change trie delta for drop child.
cheme Mar 16, 2020
cd9d47c
finish adding child change
cheme Mar 16, 2020
2e7bc65
Put bulk delete into top change child trie info, but currently not
cheme Mar 16, 2020
b0e0af8
remove done todos
cheme Mar 17, 2020
c70ef19
Compatibility with old version journal.
cheme Mar 17, 2020
b1994e7
prune test, and fixes.
cheme Mar 17, 2020
0036fd3
Merge branch 'master' into child_trie_w3_change
cheme Mar 17, 2020
29254aa
missing merge
cheme Mar 17, 2020
72cfb6c
Merge branch 'child_trie_w3_change' into split_child_payload
cheme Mar 17, 2020
594fdc8
Merge branch 'split_child_payload' into child_delete_2020
cheme Mar 17, 2020
baacffa
fix bench
cheme Mar 17, 2020
1471c0f
Merge branch 'split_child_payload' into child_delete_2020
cheme Mar 17, 2020
8e1fabc
bump version
cheme Mar 17, 2020
160d2ea
Restore previous cli api (will need deprecation in a v2 of rpc), split
cheme Mar 18, 2020
c76b433
Merge branch 'child_trie_w3_change' into split_child_payload
cheme Mar 18, 2020
b07fd39
Merge branch 'split_child_payload' into child_delete_2020
cheme Mar 18, 2020
63cf6bd
remove old rpc
cheme Mar 19, 2020
5ed450b
Merge branch 'master' into child_trie_w3_change
cheme Mar 19, 2020
f21606f
review change.
cheme Mar 20, 2020
1b2a30c
Using `PrefixedStorageKey` type for child storage key that are prefixed.
cheme Mar 20, 2020
750cdd8
Fix rpc test.
cheme Mar 23, 2020
32e27c9
Merge branch 'master' into child_trie_w3_change
cheme Mar 23, 2020
cc65f44
bump spec version
cheme Mar 23, 2020
c20cef9
Merge branch 'master' into child_trie_w3_change
cheme Mar 26, 2020
797ad34
Merge branch 'master' into child_trie_w3_change
cheme Mar 26, 2020
7e4b405
update head for the rocksdb delete.
cheme Mar 26, 2020
f1b23df
Apply review suggestion
cheme Mar 26, 2020
9651dd1
Merge branch 'master' into child_trie_w3_change
cheme Mar 30, 2020
c631a46
Fix unrelated warning for CI
cheme Mar 30, 2020
217c19b
Merge branch 'master' into child_trie_w3_change
cheme Apr 2, 2020
cf7d90e
Merge branch 'child_trie_w3_change' into split_child_payload
cheme Apr 2, 2020
7c8f393
companion fix
cheme Apr 2, 2020
b2240f1
Update .maintain/gitlab/check_polkadot_companion_build.sh
cheme Apr 2, 2020
f3b9f23
Fix compilation errors.
cheme Apr 2, 2020
63943ee
last attempt
cheme Apr 2, 2020
0d15f6f
Merge branch 'split_child_payload' into child_delete_2020
cheme Apr 2, 2020
784cb22
Forcing companion pr.
cheme Apr 2, 2020
4897109
fixing merge.
cheme Apr 2, 2020
4bbb24d
revert ci changes.
cheme Apr 2, 2020
50c3dd7
Merge branch 'master' into child_trie_w3_change
cheme Apr 3, 2020
a7c16eb
Merge branch 'child_trie_w3_change' of github.com:cheme/substrate int…
cheme Apr 3, 2020
ca40040
Merge branch 'master' into child_trie_w3_change
cheme Apr 9, 2020
226f7cd
name of children in chain spec change.
cheme Apr 14, 2020
5ab115e
Merge branch 'master' into child_trie_w3_change
cheme Apr 14, 2020
1ad4c5a
Merge branch 'master' into child_trie_w3_change
cheme Apr 15, 2020
94b78f3
Merge branch 'child_trie_w3_change' into split_child_payload
cheme Apr 15, 2020
5938d86
remove terminal space
cheme Apr 15, 2020
30e8192
Merge branch 'master' into child_trie_w3_change
cheme Apr 15, 2020
bc2a198
sp-io documentation changes.
cheme Apr 15, 2020
83ff4a0
Merge branch 'master' into child_trie_w3_change
cheme Apr 15, 2020
ecb1c39
Merge branch 'master' into child_trie_w3_change
cheme Apr 15, 2020
619b454
Retain compatibility with network protocol.
cheme Apr 15, 2020
fa52a8c
Revert "Retain compatibility with network protocol."
cheme Apr 15, 2020
167f20c
Merge branch 'master' into child_trie_w3_change
cheme Apr 15, 2020
928fac0
Merge branch 'master' into child_trie_w3_change
gavofyork Apr 17, 2020
69ed118
fix renamed field related error
cheme Apr 17, 2020
b79bd84
Merge branch 'master' into child_trie_w3_change
cheme Apr 20, 2020
ae3a3e1
Merge branch 'child_trie_w3_change' into split_child_payload
cheme Apr 23, 2020
ee1f768
Merge branch 'master' into split_child_payload
cheme Apr 23, 2020
1b3e752
Merge branch 'split_child_payload' into child_delete_2020
cheme Apr 23, 2020
52aa0f2
prototyping changes
cheme Apr 23, 2020
eb8a25d
would need rollback, this is going in a wrong direction
cheme Apr 23, 2020
c48ea04
might be ok design (could use &mut dyn ptr too, but this seems less
cheme Apr 24, 2020
8e63633
Ok design (no trait an pure fn ptr).
cheme Apr 24, 2020
7afbe6a
add root to child change
cheme Apr 27, 2020
03dae51
got the method test in parity-db non rc version (the reference db trick
cheme Apr 27, 2020
329983d
fix next storage key logic
cheme May 6, 2020
12f4229
Merge branch 'child_delete_2020' of github.com:cheme/polkadot into ch…
cheme May 6, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,12 @@ members = [
[profile.release]
# Substrate runtime requires unwinding.
panic = "unwind"

[patch.crates-io]
kvdb = { git = "https://github.com/cheme/parity-common", branch="upgraded_del_range" }
kvdb-rocksdb = { git = "https://github.com/cheme/parity-common", branch="upgraded_del_range" }
kvdb-web = { git = "https://github.com/cheme/parity-common", branch="upgraded_del_range" }
kvdb-memorydb = { git = "https://github.com/cheme/parity-common", branch="upgraded_del_range" }
#parity-util-mem = { git = "https://github.com/cheme/parity-common", branch="upgraded_del_range" }
#fixed-hash = { git = "https://github.com/cheme/parity-common", branch="upgraded_del_range" }
#primitive-types = { git = "https://github.com/cheme/parity-common", branch="upgraded_del_range" }
12 changes: 6 additions & 6 deletions bin/node/executor/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ fn panic_execution_with_foreign_code_gives_error() {
vec![0u8; 32]
}
],
children: map![],
children_default: map![],
});

let r = executor_call::<NeverNativeValue, fn() -> _>(
Expand Down Expand Up @@ -206,7 +206,7 @@ fn bad_extrinsic_with_native_equivalent_code_gives_error() {
vec![0u8; 32]
}
],
children: map![],
children_default: map![],
});

let r = executor_call::<NeverNativeValue, fn() -> _>(
Expand Down Expand Up @@ -240,7 +240,7 @@ fn successful_execution_with_native_equivalent_code_gives_ok() {
},
<frame_system::BlockHash<Runtime>>::hashed_key_for(0) => vec![0u8; 32]
],
children: map![],
children_default: map![],
});

let r = executor_call::<NeverNativeValue, fn() -> _>(
Expand Down Expand Up @@ -282,7 +282,7 @@ fn successful_execution_with_foreign_code_gives_ok() {
},
<frame_system::BlockHash<Runtime>>::hashed_key_for(0) => vec![0u8; 32]
],
children: map![],
children_default: map![],
});

let r = executor_call::<NeverNativeValue, fn() -> _>(
Expand Down Expand Up @@ -704,7 +704,7 @@ fn panic_execution_gives_error() {
},
<frame_system::BlockHash<Runtime>>::hashed_key_for(0) => vec![0u8; 32]
],
children: map![],
children_default: map![],
});

let r = executor_call::<NeverNativeValue, fn() -> _>(
Expand Down Expand Up @@ -738,7 +738,7 @@ fn successful_execution_gives_ok() {
},
<frame_system::BlockHash<Runtime>>::hashed_key_for(0) => vec![0u8; 32]
],
children: map![],
children_default: map![],
});

let r = executor_call::<NeverNativeValue, fn() -> _>(
Expand Down
2 changes: 1 addition & 1 deletion bin/node/executor/tests/fees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ fn transaction_fee_is_correct_ultimate() {
},
<frame_system::BlockHash<Runtime>>::hashed_key_for(0) => vec![0u8; 32]
],
children: map![],
children_default: map![],
});

let tip = 1_000_000;
Expand Down
2 changes: 1 addition & 1 deletion bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// and set impl_version to 0. If only runtime
// implementation changes and behavior does not, then leave spec_version as
// is and increment impl_version.
spec_version: 237,
spec_version: 238,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
};
Expand Down
12 changes: 5 additions & 7 deletions client/api/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use sp_runtime::{generic::BlockId, Justification, Storage};
use sp_runtime::traits::{Block as BlockT, NumberFor, HashFor};
use sp_state_machine::{
ChangesTrieState, ChangesTrieStorage as StateChangesTrieStorage, ChangesTrieTransaction,
StorageCollection, ChildStorageCollection,
ChildStorageCollection, StorageCollection,
};
use sp_storage::{StorageData, StorageKey, ChildInfo};
use crate::{
Expand Down Expand Up @@ -280,6 +280,7 @@ impl<'a, State, Block> Iterator for KeyIterator<'a, State, Block> where
Some(StorageKey(next_key))
}
}

/// Provides acess to storage primitives
pub trait StorageProvider<Block: BlockT, B: Backend<Block>> {
/// Given a `BlockId` and a key, return the value under the key in that block.
Expand Down Expand Up @@ -310,26 +311,23 @@ pub trait StorageProvider<Block: BlockT, B: Backend<Block>> {
fn child_storage(
&self,
id: &BlockId<Block>,
storage_key: &StorageKey,
child_info: ChildInfo,
child_info: &ChildInfo,
key: &StorageKey
) -> sp_blockchain::Result<Option<StorageData>>;

/// Given a `BlockId`, a key prefix, and a child storage key, return the matching child storage keys.
fn child_storage_keys(
&self,
id: &BlockId<Block>,
child_storage_key: &StorageKey,
child_info: ChildInfo,
child_info: &ChildInfo,
key_prefix: &StorageKey
) -> sp_blockchain::Result<Vec<StorageKey>>;

/// Given a `BlockId`, a key and a child storage key, return the hash under the key in that block.
fn child_storage_hash(
&self,
id: &BlockId<Block>,
storage_key: &StorageKey,
child_info: ChildInfo,
child_info: &ChildInfo,
key: &StorageKey
) -> sp_blockchain::Result<Option<Block::Hash>>;

Expand Down
5 changes: 0 additions & 5 deletions client/api/src/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@ pub struct RemoteReadChildRequest<Header: HeaderT> {
pub header: Header,
/// Storage key for child.
pub storage_key: Vec<u8>,
/// Child trie source information.
pub child_info: Vec<u8>,
/// Child type, its required to resolve `child_info`
/// content and choose child implementation.
pub child_type: u32,
/// Child storage key to read.
pub keys: Vec<Vec<u8>>,
/// Number of times to retry request. None means that default RETRY_COUNT is used.
Expand Down
59 changes: 35 additions & 24 deletions client/api/src/notifications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ use std::{

use fnv::{FnvHashSet, FnvHashMap};
use futures::channel::mpsc;
use sp_core::storage::{StorageKey, StorageData};
use sp_core::storage::{StorageKey, StorageData, ChildChange};
use sp_runtime::traits::Block as BlockT;

/// Storage change set
#[derive(Debug)]
pub struct StorageChangeSet {
changes: Arc<Vec<(StorageKey, Option<StorageData>)>>,
child_changes: Arc<Vec<(StorageKey, Vec<(StorageKey, Option<StorageData>)>)>>,
child_changes: Arc<Vec<(StorageKey, ChildChange, Vec<(StorageKey, Option<StorageData>)>)>>,
filter: Option<HashSet<StorageKey>>,
child_filters: Option<HashMap<StorageKey, Option<HashSet<StorageKey>>>>,
}
Expand All @@ -48,16 +48,25 @@ impl StorageChangeSet {
.map(move |(k,v)| (None, k, v.as_ref()));
let children = self.child_changes
.iter()
.filter_map(move |(sk, changes)| {
.filter_map(move |(sk, change, changes)| {
if let Some(cf) = self.child_filters.as_ref() {
if let Some(filter) = cf.get(sk) {
Some(changes
.iter()
.filter(move |&(key, _)| match filter {
Some(ref filter) => filter.contains(key),
None => true,
})
.map(move |(k,v)| (Some(sk), k, v.as_ref())))
let bulk_delete = change == &ChildChange::BulkDeleteByKeyspace;
Some(changes
.iter()
.filter(move |&(key, _)| if bulk_delete {
true
} else {
match filter {
Some(ref filter) => filter.contains(key),
None => true,
}
})
.map(move |(k,v)| (Some(sk), k, if bulk_delete {
None
} else {
v.as_ref()
})))
} else { None }
} else { None }
})
Expand Down Expand Up @@ -110,7 +119,7 @@ impl<Block: BlockT> StorageNotifications<Block> {
hash: &Block::Hash,
changeset: impl Iterator<Item=(Vec<u8>, Option<Vec<u8>>)>,
child_changeset: impl Iterator<
Item=(Vec<u8>, impl Iterator<Item=(Vec<u8>, Option<Vec<u8>>)>)
Item=(Vec<u8>, ChildChange, impl Iterator<Item=(Vec<u8>, Option<Vec<u8>>)>)
>,
) {
let has_wildcard = !self.wildcard_listeners.is_empty();
Expand All @@ -137,7 +146,7 @@ impl<Block: BlockT> StorageNotifications<Block> {
changes.push((k, v.map(StorageData)));
}
}
for (sk, changeset) in child_changeset {
for (sk, change, changeset) in child_changeset {
let sk = StorageKey(sk);
if let Some((cl, cw)) = self.child_listeners.get(&sk) {
let mut changes = Vec::new();
Expand All @@ -156,7 +165,7 @@ impl<Block: BlockT> StorageNotifications<Block> {
}
}
if !changes.is_empty() {
child_changes.push((sk, changes));
child_changes.push((sk, change, changes));
}
}
}
Expand Down Expand Up @@ -313,7 +322,7 @@ mod tests {

type TestChangeSet = (
Vec<(StorageKey, Option<StorageData>)>,
Vec<(StorageKey, Vec<(StorageKey, Option<StorageData>)>)>,
Vec<(StorageKey, ChildChange, Vec<(StorageKey, Option<StorageData>)>)>,
);

#[cfg(test)]
Expand Down Expand Up @@ -360,18 +369,18 @@ mod tests {
(vec![5], Some(vec![4])),
(vec![6], None),
];
let c_changeset = vec![(vec![4], c_changeset_1)];
let c_changeset = vec![(vec![4], ChildChange::Update, c_changeset_1)];
notifications.trigger(
&Hash::from_low_u64_be(1),
changeset.into_iter(),
c_changeset.into_iter().map(|(a,b)| (a, b.into_iter())),
c_changeset.into_iter().map(|(a, b, c)| (a, b, c.into_iter())),
);

// then
assert_eq!(recv.next().unwrap(), (Hash::from_low_u64_be(1), (vec![
(StorageKey(vec![2]), Some(StorageData(vec![3]))),
(StorageKey(vec![3]), None),
], vec![(StorageKey(vec![4]), vec![
], vec![(StorageKey(vec![4]), ChildChange::Update, vec![
(StorageKey(vec![5]), Some(StorageData(vec![4]))),
(StorageKey(vec![6]), None),
])]).into()));
Expand Down Expand Up @@ -402,11 +411,11 @@ mod tests {
(vec![6], None),
];

let c_changeset = vec![(vec![4], c_changeset_1)];
let c_changeset = vec![(vec![4], ChildChange::Update, c_changeset_1)];
notifications.trigger(
&Hash::from_low_u64_be(1),
changeset.into_iter(),
c_changeset.into_iter().map(|(a,b)| (a, b.into_iter())),
c_changeset.into_iter().map(|(a, b, c)| (a, b, c.into_iter())),
);

// then
Expand All @@ -417,9 +426,11 @@ mod tests {
(StorageKey(vec![2]), Some(StorageData(vec![3]))),
], vec![]).into()));
assert_eq!(recv3.next().unwrap(), (Hash::from_low_u64_be(1), (vec![],
vec![
(StorageKey(vec![4]), vec![(StorageKey(vec![5]), Some(StorageData(vec![4])))]),
]).into()));
vec![(
StorageKey(vec![4]),
ChildChange::Update,
vec![(StorageKey(vec![5]), Some(StorageData(vec![4])))],
)]).into()));

}

Expand Down Expand Up @@ -451,7 +462,7 @@ mod tests {
(vec![2], Some(vec![3])),
(vec![1], None),
];
let c_changeset = empty::<(_, Empty<_>)>();
let c_changeset = empty::<(_, _, Empty<_>)>();
notifications.trigger(&Hash::from_low_u64_be(1), changeset.into_iter(), c_changeset);

// then
Expand All @@ -469,7 +480,7 @@ mod tests {

// when
let changeset = vec![];
let c_changeset = empty::<(_, Empty<_>)>();
let c_changeset = empty::<(_, _, Empty<_>)>();
notifications.trigger(&Hash::from_low_u64_be(1), changeset.into_iter(), c_changeset);
recv
};
Expand Down
3 changes: 1 addition & 2 deletions client/api/src/proof_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ pub trait ProofProvider<Block: BlockT> {
fn read_child_proof(
&self,
id: &BlockId<Block>,
storage_key: &[u8],
child_info: ChildInfo,
child_info: &ChildInfo,
keys: &mut dyn Iterator<Item=&[u8]>,
) -> sp_blockchain::Result<StorageProof>;

Expand Down
Loading