Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix compilation errors.
  • Loading branch information
cheme committed Apr 2, 2020
commit f3b9f234d88bdfb63020b772736cb45c47f1d3e3
16 changes: 14 additions & 2 deletions client/db/src/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,19 @@ impl<B: BlockT> BenchmarkingState<B> {
child_delta,
false,
);
state.genesis = transaction.clone().drain();
let mut keyspace = crate::Keyspaced::new(&[]);
for (info, mut updates) in transaction.clone().into_iter() {
keyspace.change_keyspace(info.keyspace());
for (key, rc_val) in updates.drain() {
let key = if info.is_top_trie() {
key
} else {
keyspace.prefix_key(key.as_slice()).to_vec()
};

state.genesis.insert(key, rc_val);
}
}
state.genesis_root = root.clone();
state.commit(root, transaction)?;
Ok(state)
Expand Down Expand Up @@ -287,8 +299,8 @@ impl<B: BlockT> StateBackend<HashFor<B>> for BenchmarkingState<B> {
} else if rc < 0 {
db_transaction.delete(0, &key);
}
keys.push(key);
}
keys.push(key);
}
self.record.set(keys);
db.write(db_transaction).map_err(|_| String::from("Error committing transaction"))?;
Expand Down
2 changes: 1 addition & 1 deletion client/db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,7 @@ impl<Block: BlockT> Backend<Block> {
let mut ops: u64 = 0;
let mut bytes: u64 = 0;
for (key, value) in operation.storage_updates.iter()
.chain(operation.child_storage_updates.iter().flat_map(|(_, s)| s.iter())) {
.chain(operation.child_storage_updates.iter().flat_map(|(_, s, _)| s.iter())) {
ops += 1;
bytes += key.len() as u64;
if let Some(v) = value.as_ref() {
Expand Down
2 changes: 1 addition & 1 deletion frame/contracts/src/account_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ impl<T: Trait> AccountDb<T> for DirectAccountDb {
new_info.last_write = Some(<frame_system::Module<T>>::block_number());
}

let child_info = &new_info.child_trie_unique_id();
let child_info = &new_info.child_trie_info();
for (k, v) in changed.storage.into_iter() {
if let Some(value) = child::get_raw(
child_info,
Expand Down
2 changes: 1 addition & 1 deletion frame/contracts/src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ where
{
let (output, change_set, deferred) = {
let mut nested = self.nested(dest, trie_id.map(|trie_id| {
crate::trie_unique_id(&trie_id)
crate::child_trie_info(&trie_id)
}));
let output = func(&mut nested)?;
(output, nested.overlay.into_change_set(), nested.deferred)
Expand Down
2 changes: 1 addition & 1 deletion frame/contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ impl<T: Trait> Module<T> {
.get_alive()
.ok_or(ContractAccessError::IsTombstone)?;

let child_info = trie_unique_id(&contract_info.trie_id);
let child_info = child_trie_info(&contract_info.trie_id);
let maybe_value = AccountDb::<T>::get_storage(
&DirectAccountDb,
&address,
Expand Down
4 changes: 2 additions & 2 deletions frame/contracts/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,8 @@ fn account_removal_does_not_remove_storage() {
ExtBuilder::default().existential_deposit(100).build().execute_with(|| {
let trie_id1 = <Test as Trait>::TrieIdGenerator::trie_id(&1);
let trie_id2 = <Test as Trait>::TrieIdGenerator::trie_id(&2);
let child_info1 = crate::trie_unique_id(trie_id1.as_ref());
let child_info2 = crate::trie_unique_id(trie_id2.as_ref());
let child_info1 = crate::child_trie_info(trie_id1.as_ref());
let child_info2 = crate::child_trie_info(trie_id2.as_ref());
let child_info1 = Some(&child_info1);
let child_info2 = Some(&child_info2);
let key1 = &[1; 32];
Expand Down
2 changes: 1 addition & 1 deletion primitives/state-machine/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use sp_core::{Hasher, InnerHasher};
use codec::{Decode, Encode};

use sp_core::{traits::RuntimeCode,
storage::{ChildInfo, ChildrenMap, well_known_keys}};
storage::{ChildInfo, ChildrenMap, well_known_keys, PrefixedStorageKey}};
use sp_trie::{TrieMut, MemoryDB, trie_types::TrieDBMut};
use crate::{
trie_backend::TrieBackend,
Expand Down
3 changes: 2 additions & 1 deletion primitives/state-machine/src/changes_trie/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
//! Changes trie storage utilities.

use std::collections::{BTreeMap, HashSet, HashMap};
use hash_db::{Hasher, Prefix, EMPTY_PREFIX};
use hash_db::{Prefix, EMPTY_PREFIX};
use sp_core::Hasher;
use sp_core::storage::PrefixedStorageKey;
use sp_core::storage::ChildInfo;
use sp_trie::DBValue;
Expand Down
5 changes: 1 addition & 4 deletions primitives/state-machine/src/overlayed_changes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,14 @@ use crate::{
use std::iter::FromIterator;
use std::collections::{HashMap, BTreeMap, BTreeSet};
use codec::{Decode, Encode};
use sp_core::storage::{well_known_keys::EXTRINSIC_INDEX, ChildInfo};
use sp_core::storage::{well_known_keys::EXTRINSIC_INDEX, ChildInfo, PrefixedStorageKey};
use std::{mem, ops};

use sp_core::Hasher;

/// Storage key.
pub type StorageKey = Vec<u8>;

/// Storage key.
pub type PrefixedStorageKey = Vec<u8>;

/// Storage value.
pub type StorageValue = Vec<u8>;

Expand Down
1 change: 0 additions & 1 deletion primitives/state-machine/src/trie_backend_essence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,6 @@ impl<'a, S, H> hash_db::HashDBRef<H, DBValue> for BackendStorageDBRef<'a, S, H>
}
}


/// Key-value pairs storage that is used by trie backend essence.
pub trait TrieBackendStorageRef<H: Hasher> {
/// Type of in-memory overlay.
Expand Down