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

avoid key collision on child trie and proof on child trie #2209

Closed
wants to merge 142 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
f6c4bb2
Straight forward move of trie related only change from child-trie-soft
cheme Mar 26, 2019
878a7ae
merge backend stuff from old branch, add insertion of child trie root in
cheme Mar 26, 2019
a464936
commit before wasm_executor change (we will keep old interface for now:
cheme Mar 26, 2019
4de73d7
tabify
cheme Mar 26, 2019
be0e340
Things compile (account change is unoptimized), not for wasm.
cheme Mar 26, 2019
7f3a282
Make SutrieField non public
cheme Mar 27, 2019
4d208db
Compile no std child trie with subtrie query (super costy: do we trust
cheme Mar 27, 2019
6d7f355
Make the single child trie test pass.
cheme Mar 27, 2019
25bcb4c
Proving synch child trie content (TODO it requires deletion tests).
cheme Mar 28, 2019
9eaef35
restore test
cheme Apr 1, 2019
37d9536
Merge branch 'master' into child-trie-soft-min
cheme Apr 1, 2019
67c03a2
Fix test error (wrong vec alloc).
cheme Apr 2, 2019
99dbb5a
tests for no key collision
cheme Apr 3, 2019
3be1802
Merge branch 'master' into child-trie-soft-min
cheme Apr 3, 2019
fec73d0
Revert `storage_root` using child, create a variant for it: see
cheme Apr 4, 2019
20d168d
indentation and remove comment
cheme Apr 4, 2019
d797bd0
Remove some TODOs, fix compile error
cheme Apr 4, 2019
27096aa
plaindb does not need to be keyspaceddb
cheme Apr 4, 2019
3560acc
Merge branch 'master' into child-trie-soft-min
cheme Apr 5, 2019
c3fc432
bump impl_version
cheme Apr 8, 2019
3e417eb
Merge branch 'master' into child-trie-soft-min
cheme Apr 16, 2019
5af490f
fix and 2299
cheme Apr 16, 2019
5a8dddd
Merge branch 'master' into child-trie-soft-min
cheme Apr 16, 2019
8f04f00
Merge branch 'master' into child-trie-soft-min
cheme Apr 26, 2019
8051179
fix keyspace insert and start proof (missing in higher level test case a
cheme Apr 29, 2019
8eac118
remove todo of test
cheme Apr 30, 2019
a65f9f2
Merge branch 'master' into child-trie-soft-min
cheme Apr 30, 2019
d495ef5
Merge branch 'master' into child-trie-soft-min &
cheme May 14, 2019
197d77a
- refactor api, use noderef of read only query (require and additional
cheme May 15, 2019
2ea3c89
Remove SubTrieNode struct
cheme May 16, 2019
99c45ea
put extension in encoding/decoding properly
cheme May 16, 2019
3553ab2
SubTrie struct renaming (and single encode point)
cheme May 16, 2019
47984fe
remove contract prefix, and make use of a child trie prefix.
cheme May 16, 2019
2bf2d7b
fix for overlay before reverting
cheme May 16, 2019
bc7165c
fix2 for prefix in overlay
cheme May 16, 2019
21c3acf
revert (will probably need two variant, but for rpc pr)
cheme May 16, 2019
98b2fc3
break some lines
cheme May 16, 2019
432cb10
Merge branch 'master' into child-trie-soft-min
cheme May 16, 2019
e266dfe
Add module specific seed to generator (accountid is undefined)
cheme May 16, 2019
7f64652
Update core/primitives/src/subtrie.rs
cheme May 17, 2019
999a26e
Merge branch 'master' into child-trie-soft-min and adapt rpc test
cheme May 21, 2019
7bbd681
Merge branch 'child-trie-soft-min' of github.com:cheme/substrate into…
cheme May 21, 2019
87f03b7
child trie additional prefix is bad design for primitive, removing it.
cheme May 21, 2019
f18e002
safer encoding of version.
cheme May 24, 2019
0eaeca0
Merge branch 'master' into child-trie-soft-min (untested)
cheme May 24, 2019
b57319d
missing import
cheme May 24, 2019
1f848d2
bump impl version
cheme May 24, 2019
403df51
Merge branch 'master' into child-trie-soft-min
cheme May 24, 2019
305b60a
Merge branch 'master' into child-trie-soft-min
cheme May 28, 2019
423cfb1
correct version
cheme May 28, 2019
a0ffa31
fix typing
cheme May 28, 2019
6e3bed7
Merge branch 'master' into child-trie-soft-min
cheme May 29, 2019
7411146
misnamed storage key variables.
cheme May 29, 2019
331be51
fix error messages.
cheme May 29, 2019
bc2935c
remove convenience constructor, remove unneeded pub on field.
cheme May 29, 2019
5a87b6a
Merge branch 'master' into child-trie-soft-min
cheme May 29, 2019
f40400b
minor tweaks before reworking docs
cheme May 30, 2019
9bc1ab7
First pass of documentation improvement.
cheme May 30, 2019
c073b21
do not refer to parent_key when it is ParentTrie:
cheme May 30, 2019
d15ca49
child trie renaming did exceed 100 character line.
cheme May 30, 2019
0736b96
Link github issue for TODOs
cheme May 31, 2019
9e0485d
Merge branch 'master' into child-trie-soft-min
cheme May 31, 2019
586b50e
comment incorrect variable
cheme May 31, 2019
65d7485
Merge branch 'master' into child-trie-soft-min
cheme Jun 6, 2019
95a69b2
Makes child trie instantiation a bisschen more explicit.
cheme Jun 6, 2019
d089693
Merge branch 'master' into child-trie-soft-min
cheme Jun 12, 2019
ec69ae0
rename fetch and init trie function.
cheme Jun 12, 2019
76ea14d
moved_child is a bad idea, just delete in top, if it is reinserted this
cheme Jun 14, 2019
b2050c8
moved map is correct (fix usage of child trie to return option<option<)
cheme Jun 14, 2019
5a0cbe1
Add missing wasm boilerplate.
cheme Jun 14, 2019
6e84810
remove moved_ct from overlay in favor to optional in pending.
cheme Jun 14, 2019
7f5694f
Merge branch 'master' into child-trie-soft-min
cheme Jun 14, 2019
5006d73
Use keyspace for storage_cache.
cheme Jun 17, 2019
b85508e
Comment of unsafety of `set_child` if directly exposed.
cheme Jun 17, 2019
0c14777
Merge branch 'master' into child-trie-soft-min
cheme Jun 17, 2019
10c4f58
use named fields.
cheme Jun 17, 2019
453927b
Merge branch 'master' into child-trie-soft-min
cheme Jun 21, 2019
349f9a5
Merge branch 'master' into child-trie-soft-min
cheme Jun 25, 2019
fc034fb
Refacto of keyspace to use static creation unique info.
cheme Jun 27, 2019
45cfbd6
put child trie content under their own prefix (with common root with
cheme Jun 28, 2019
4f9717e
Revert to storing keyspace in state approach.
cheme Jun 28, 2019
7cb2d84
invalid asumption for `child_delta_trie_root`.
cheme Jun 28, 2019
c821a08
clean unused child storage key relative methods.
cheme Jun 28, 2019
c3ba830
Merge branch 'master' into child-trie-soft-min and
cheme Jun 28, 2019
acf9641
invalid comment
cheme Jun 28, 2019
0050457
indent and remove deprecated comments/struct
cheme Jun 28, 2019
c36b91b
Make top trie write through keyspace db, this is not going fine because
cheme Jul 2, 2019
9d3d9e2
Fix issue: prefixed_key already got the keyspace in prefix.
cheme Jul 2, 2019
3db4da8
Merge branch 'master' into child-trie-soft-min
cheme Jul 2, 2019
4348d70
Address review comment:
cheme Jul 4, 2019
134a4bf
Merge branch 'master' into child-trie-soft-min
cheme Jul 4, 2019
5325621
Restore auth version.
cheme Jul 4, 2019
97118e8
Avoid confusing Option<Option< in result return of overlay.
cheme Jul 4, 2019
0ed7f80
Missing fix from review on testing ext for set child trie (code from
cheme Jul 4, 2019
8a6986a
Use fields for change trie storage.
cheme Jul 4, 2019
7652de9
switch MapTransaction to a struct.
cheme Jul 4, 2019
94c629e
Merge branch 'master' into child-trie-soft-min
cheme Jul 4, 2019
7675740
Apply same encoding for parent root (compatible with implementation of a
cheme Jul 1, 2019
90fba8a
Fix previous cherry pick
cheme Jul 4, 2019
d8c58c6
Addressing nits.
cheme Jul 4, 2019
661ba2e
Avoid unused creation of child trie.
cheme Jul 4, 2019
833e9ff
Create child trie id from additional storage state.
cheme Jul 5, 2019
71bda12
update default encoding.
cheme Jul 5, 2019
08b3062
Handle possible switch to multiple trie layer.
cheme Jul 5, 2019
89f3cd5
Remove a redundancy on keyspaceddb instantiation.
cheme Jul 5, 2019
834f52a
actually remove redundancy correctly
cheme Jul 5, 2019
0445228
comment
cheme Jul 5, 2019
75add99
Merge branch 'child-trie-soft-min-old' into child-trie-soft-min
cheme Jul 5, 2019
e70edab
Merge branch 'master' into child-trie-soft-min and apply review
cheme Jul 9, 2019
b8a0cd4
Merge branch 'master' into child-trie-soft-min
cheme Jul 10, 2019
1514171
Merge branch 'master' into child-trie-soft-min
cheme Jul 10, 2019
a7da811
Fix new test cases.
cheme Jul 10, 2019
b96c523
Merge branch 'master' into child-trie-soft-min
cheme Jul 11, 2019
865672d
Merge branch 'master' into child-trie-soft-min
cheme Jul 12, 2019
b6d7705
bump runtime version
cheme Jul 12, 2019
b45344c
Merge branch 'master' into child-trie-soft-min
cheme Jul 18, 2019
517f95c
Merge branch 'master' into child-trie-soft-min
cheme Jul 31, 2019
79a07de
Merge branch 'master' into child-trie-soft-min
cheme Aug 2, 2019
a027fb0
Some doc enhancement.
cheme Aug 2, 2019
b92655c
ChildRead correctly defined (previous definition was wrong).
cheme Aug 2, 2019
8a875f4
child_trie 'is_updatable_with' to avoid already broken redundancy.
cheme Aug 2, 2019
fcd8bdb
fix system bench error.
cheme Aug 2, 2019
3241fc4
Fix client doc rust code.
cheme Aug 2, 2019
ecac03b
Merge branch 'master' into child-trie-soft-min
cheme Aug 2, 2019
10369b9
Merge branch 'master' into child-trie-soft-min
cheme Aug 7, 2019
15a2967
Merge branch 'master' into child-trie-soft-min
cheme Aug 8, 2019
acc94e4
Merge branch 'master' into child-trie-soft-min
cheme Aug 8, 2019
7d96338
Remove unused method (in favor of assimilate).
cheme Aug 8, 2019
ba7bdcb
Merge branch 'child-trie-soft-min' of github.com:cheme/polkadot into …
cheme Aug 14, 2019
aacea85
Merge branch 'master' into child-trie-soft-min
cheme Aug 14, 2019
6789641
merge fix.
cheme Aug 14, 2019
2b37160
Rename MapTransaction to StorageContent.
cheme Aug 14, 2019
b1183bd
Get subscription stuff from child-deletion branch:
cheme Aug 14, 2019
bc5653c
Merge branch 'master' into child-trie-soft-min
cheme Aug 22, 2019
5ecfd19
update to master.
cheme Aug 22, 2019
baf89c8
Cast explicitelly for readability.
cheme Aug 26, 2019
0f8bff9
bump spec version.
cheme Aug 26, 2019
5a8576b
Merge branch 'master' into child-trie-soft-min
cheme Aug 29, 2019
045ee32
Merge branch 'master' into child-trie-soft-min
cheme Aug 29, 2019
58e6e41
Fix compilation.
cheme Aug 29, 2019
70555c5
Merge branch 'master' into child-trie-soft-min with conflicts.
cheme Sep 5, 2019
130e5e4
build passing, regression on extrinsics for a set_child (see new TODO).
cheme Sep 6, 2019
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
Merge branch 'master' into child-trie-soft-min
  • Loading branch information
cheme committed Jul 31, 2019
commit 517f95c80c973545a77b6622886520248ca17301
2 changes: 1 addition & 1 deletion core/client/db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ use sr_primitives::{
generic::{BlockId, DigestItem}, Justification, StorageOverlay, ChildrenStorageOverlay,
BuildStorage
};
use runtime_primitives::traits::{
use sr_primitives::traits::{
Block as BlockT, Header as HeaderT, NumberFor, Zero, One, SaturatedConversion,
};
use state_machine::backend::Backend as StateBackend;
Expand Down
2 changes: 1 addition & 1 deletion core/client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use futures::channel::mpsc;
use parking_lot::{Mutex, RwLock};
use primitives::NativeOrEncoded;
use primitives::child_trie::{ChildTrie, ChildTrieReadRef};
use runtime_primitives::{
use sr_primitives::{
Justification,
generic::{BlockId, SignedBlock},
};
Expand Down
4 changes: 2 additions & 2 deletions core/client/src/light/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ use std::collections::HashMap;
use std::sync::{Arc, Weak};
use parking_lot::{RwLock, Mutex};

use runtime_primitives::{generic::BlockId, Justification, StorageOverlay, ChildrenStorageOverlay};
use sr_primitives::{generic::BlockId, Justification, StorageOverlay, ChildrenStorageOverlay};
use primitives::child_trie::ChildTrie;
use primitives::child_trie::ChildTrieReadRef;
use state_machine::{Backend as StateBackend, TrieBackend};
use state_machine::backend::{InMemory as InMemoryState, MapTransaction};
use runtime_primitives::traits::{Block as BlockT, NumberFor, Zero, Header};
use sr_primitives::traits::{Block as BlockT, NumberFor, Zero, Header};
use crate::in_mem::{self, check_genesis_storage};
use crate::backend::{
AuxStore, Backend as ClientBackend, BlockImportOperation, RemoteBackend, NewBlockState,
Expand Down
2 changes: 1 addition & 1 deletion core/client/src/light/fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use hash_db::{HashDB, Hasher};
use parity_codec::{Decode, Encode};
use primitives::{ChangesTrieConfiguration, convert_hash};
use primitives::child_trie::ChildTrieRead;
use runtime_primitives::traits::{
use sr_primitives::traits::{
Block as BlockT, Header as HeaderT, Hash, HashFor, NumberFor,
SimpleArithmetic, CheckedConversion,
};
Expand Down
2 changes: 1 addition & 1 deletion core/network/src/protocol/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//! Network packet message types. These get serialized and put into the lower level protocol payload.

use bitflags::bitflags;
use runtime_primitives::{ConsensusEngineId, traits::{Block as BlockT, Header as HeaderT}};
use sr_primitives::{ConsensusEngineId, traits::{Block as BlockT, Header as HeaderT}};
use primitives::child_trie::ChildTrieRead;
use parity_codec::{Encode, Decode, Input, Output};
pub use self::generic::{
Expand Down
4 changes: 2 additions & 2 deletions core/network/src/protocol/on_demand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use client::light::fetcher::{FetchChecker, RemoteHeaderRequest,
use crate::message::{self, BlockAttributes, Direction, FromBlock, RequestId};
use libp2p::PeerId;
use crate::config::Roles;
use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor};
use sr_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor};
use primitives::child_trie::ChildTrieRead;

/// Remote request timeout.
Expand Down Expand Up @@ -639,7 +639,7 @@ pub mod tests {
use std::time::Instant;
use futures::{Future, sync::oneshot};
use primitives::child_trie::ChildTrieRead;
use runtime_primitives::traits::{Block as BlockT, NumberFor, Header as HeaderT};
use sr_primitives::traits::{Block as BlockT, NumberFor, Header as HeaderT};
use client::{error::{Error as ClientError, Result as ClientResult}};
use client::light::fetcher::{FetchChecker, RemoteHeaderRequest,
ChangesProof, RemoteCallRequest, RemoteReadRequest,
Expand Down
2 changes: 1 addition & 1 deletion core/service/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use std::fs::File;
use std::path::PathBuf;
use serde::{Serialize, Deserialize};
use primitives::storage::{StorageKey, StorageData};
use runtime_primitives::{BuildStorage, StorageOverlay, ChildrenStorageOverlay, MapTransaction};
use sr_primitives::{BuildStorage, StorageOverlay, ChildrenStorageOverlay, MapTransaction};
use serde_json as json;
use crate::components::RuntimeGenesis;
use network::Multiaddr;
Expand Down
9 changes: 5 additions & 4 deletions core/sr-io/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,11 @@ export_api! {
/// `ChildTrie` input need to be fetch or instantiate from a valid `Keyspace` generator.
fn set_child_trie(ct: ChildTrie) -> bool;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be replaced with a safer semantics? Like init_child_trie(storage_key: &[u8]) which returns a new unique keyspace (instead of it being passed in) and rejects if the parent trie is not empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it the same thing as what we do with fetch_or_new method?
I need at some point a method to update child trie extension content, this was reducing the number of methods over the wasm boundary, but yes it can be split between creation and update case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main suggestion here is letting this call generate the keyspace for newly initialized child tries.

The function could just then be set_child_trie(storage_key: &[u8], extension: &[u8]) -> ChildTrie, which fetches or initializes a child trie at the storage key (parent path) and sets its extension data. It might be able to replace fetch_or_new entirely.


/// Get `key` from child storage, placing the value into `value_out` (as much of it as possible) and return
/// the number of bytes that the entry in storage had beyond the offset or None if the storage entry
/// doesn't exist at all. Note that if the buffer is smaller than the storage entry length, the returned
/// number of bytes is not equal to the number of bytes written to the `value_out`.
/// Get `key` from child storage, placing the value into `value_out` and return the number
/// of bytes that the entry in storage has beyond the offset or `None` if the storage entry
/// doesn't exist at all.
/// If `value_out` length is smaller than the returned length, only `value_out` length bytes
/// are copied into `value_out`.
fn read_child_storage(
child_trie: ChildTrieReadRef,
key: &[u8],
Expand Down
45 changes: 27 additions & 18 deletions core/sr-io/without_std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub use rstd;
pub use rstd::{mem, slice};

use core::{intrinsics, panic::PanicInfo};
use rstd::{vec::Vec, cell::Cell, convert::TryInto, ptr};
use rstd::{vec::Vec, cell::Cell, convert::TryInto, convert::TryFrom, ptr};
use primitives::{offchain, Blake2Hasher,
child_trie::{ChildTrie, ChildTrieReadRef}};

Expand Down Expand Up @@ -695,28 +695,37 @@ impl StorageApi for () {

/// Get child trie at storage key location.
fn child_trie(storage_key: &[u8]) -> Option<ChildTrie> {
let mut k = ptr::null_mut();
let mut kl = 0u32;
let mut r = ptr::null_mut();
let mut rl = 0u32;
let mut p = ptr::null_mut();
let mut pl = 0u32;
let mut e = ptr::null_mut();
let mut el = 0u32;
let mut key = ptr::null_mut();
let mut key_length = 0u32;
let mut root = ptr::null_mut();
let mut root_length = 0u32;
let mut parent = ptr::null_mut();
let mut parent_length = 0u32;
let mut extension = ptr::null_mut();
let mut extension_length = 0u32;
unsafe {
if ext_child_trie.get()(
storage_key.as_ptr(),
storage_key.len() as u32,
&mut k as *mut _,
&mut kl,
&mut r as *mut _,
&mut rl,
&mut p as *mut _,
&mut pl,
&mut e as *mut _,
&mut el,
&mut key as *mut _,
&mut key_length,
&mut root as *mut _,
&mut root_length,
&mut parent as *mut _,
&mut parent_length,
&mut extension as *mut _,
&mut extension_length,
) == 1 {
Some(ChildTrie::unsafe_from_ptr_child_trie(k, kl, r, rl, p, pl, e, el))
Some(ChildTrie::unsafe_from_ptr_child_trie(
key,
key_length,
root,
root_length,
parent,
parent_length,
extension,
extension_length,
))
} else {
None
}
Expand Down
12 changes: 5 additions & 7 deletions core/state-machine/src/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ use crate::backend::{Backend, InMemory, MapTransaction};
use hash_db::Hasher;
use trie::{trie_root, default_child_trie_root};
use primitives::offchain;
use primitives::storage::well_known_keys::{HEAP_PAGES, is_child_storage_key};
use primitives::storage::well_known_keys::is_child_storage_key;
use primitives::child_trie::{ChildTrie, ChildTrieReadRef, KeySpace};
use parity_codec::Encode;
use super::Externalities;
use log::warn;

Expand All @@ -43,8 +42,7 @@ impl BasicExternalities {
}

/// Create a new instance of `BasicExternalities` with children
pub fn new_with_children(mut map: MapTransaction) -> Self {
map.top.insert(HEAP_PAGES.to_vec(), 8u64.encode());
pub fn new_with_children(map: MapTransaction) -> Self {
let pending_child = map.children.values()
.map(|(_, child_trie)| (
child_trie.parent_slice().to_vec(),
Expand Down Expand Up @@ -280,8 +278,8 @@ mod tests {
#[test]
fn basic_externalities_is_empty() {
// Make sure no values are set by default in `BasicExternalities`.
let (storage, child_storage) = BasicExternalities::new(Default::default()).into_storages();
assert!(storage.is_empty());
assert!(child_storage.is_empty());
let storages = BasicExternalities::new(Default::default()).into_storages();
assert!(storages.top.is_empty());
assert!(storages.children.is_empty());
}
}
4 changes: 2 additions & 2 deletions core/test-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ pub use keyring::{
sr25519::Keyring as Sr25519Keyring,
};
pub use primitives::Blake2Hasher;
pub use runtime_primitives::MapTransaction;
pub use sr_primitives::MapTransaction;
pub use state_machine::ExecutionStrategy;

use std::sync::Arc;
use std::collections::HashMap;
use primitives::child_trie::ChildTrie;
use futures::future::Ready;
use hash_db::Hasher;
use runtime_primitives::traits::{
use sr_primitives::traits::{
Block as BlockT, NumberFor
};
use client::LocalCallExecutor;
Expand Down
2 changes: 1 addition & 1 deletion core/test-runtime/client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub struct GenesisParameters {

impl generic_test_client::GenesisInit for GenesisParameters {
fn genesis_storage(&self) -> MapTransaction {
let mut storage = genesis_config(self.support_changes_trie).genesis_map();
let mut storage = genesis_config(self.support_changes_trie, self.heap_pages_override).genesis_map();

let state_root = <<<runtime::Block as BlockT>::Header as HeaderT>::Hashing as HashT>::trie_root(
storage.clone().into_iter()
Expand Down
6 changes: 3 additions & 3 deletions core/trie/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ mod node_header;
mod node_codec;
mod trie_stream;

use substrate_primitives::child_trie::{ChildTrieReadRef, KeySpace, keyspace_as_prefix_alloc};
use primitives::child_trie::{ChildTrieReadRef, KeySpace, keyspace_as_prefix_alloc};
use rstd::boxed::Box;
use rstd::vec::Vec;
use rstd::marker::PhantomData;
Expand All @@ -38,7 +38,7 @@ pub use node_codec::NodeCodec;
pub use trie_db::{Trie, TrieMut, DBValue, Recorder, Query};
/// Various re-exports from the `memory-db` crate.
pub use memory_db::KeyFunction;
pub use substrate_primitives::child_trie::prefixed_key;
pub use primitives::child_trie::prefixed_key;
/// Various re-exports from the `hash-db` crate.
pub use hash_db::HashDB as HashDBT;

Expand Down Expand Up @@ -146,7 +146,7 @@ pub fn ordered_trie_root<H: Hasher, I, A>(input: I) -> H::Out where
)
}

/// This function returns the default child trie root.
/// Determine the default child trie root.
/// see issue FIXME #2741, this is not efficient.
pub fn default_child_trie_root<H: Hasher>() -> Vec<u8> {
trie_root::<H, _, Vec<u8>, Vec<u8>>(core::iter::empty()).as_ref().iter().cloned().collect()
Expand Down
4 changes: 2 additions & 2 deletions node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// and set impl_version to equal spec_version. If only runtime
// implementation changes and behavior does not, then leave spec_version as
// is and increment impl_version.
spec_version: 114,
impl_version: 114,
spec_version: 124,
impl_version: 124,
apis: RUNTIME_API_VERSIONS,
};

Expand Down
4 changes: 2 additions & 2 deletions srml/contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ use crate::wasm::{WasmLoader, WasmVm};

#[cfg(feature = "std")]
use serde::{Serialize, Deserialize};
use substrate_primitives::crypto::UncheckedFrom;
use substrate_primitives::child_trie::ChildTrie;
use primitives::crypto::UncheckedFrom;
use primitives::child_trie::ChildTrie;
use rstd::{prelude::*, marker::PhantomData};
use parity_codec::{Codec, Encode, Decode};
use runtime_io::blake2_256;
Expand Down
2 changes: 1 addition & 1 deletion srml/contracts/src/rent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

use crate::{BalanceOf, ContractInfo, ContractInfoOf, TombstoneContractInfo,
Trait, contract_child_trie, AliveContractInfo};
use runtime_primitives::traits::{Bounded, CheckedDiv, CheckedMul, Saturating, Zero,
use sr_primitives::traits::{Bounded, CheckedDiv, CheckedMul, Saturating, Zero,
SaturatedConversion, Hash as HashT};
use srml_support::traits::{Currency, ExistenceRequirement, Get, WithdrawReason};
use srml_support::StorageMap;
Expand Down
6 changes: 3 additions & 3 deletions srml/contracts/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ use srml_support::{
};
use std::cell::RefCell;
use std::sync::atomic::{AtomicUsize, Ordering};
use substrate_primitives::child_trie::ChildTrie;
use substrate_primitives::storage::well_known_keys;
use substrate_primitives::Blake2Hasher;
use primitives::child_trie::ChildTrie;
use primitives::storage::well_known_keys;
use primitives::Blake2Hasher;
use system::{self, EventRecord, Phase};
use {balances, wabt};

Expand Down
5 changes: 3 additions & 2 deletions srml/executive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,8 @@ mod tests {
balances: vec![(1, 211)],
vesting: vec![],
}.assimilate_storage(&mut t.top, &mut t.children).unwrap();
let xt = primitives::testing::TestXt(Some(1), 0, Call::transfer(2, 69));
let xt = sr_primitives::testing::TestXt(sign_extra(1, 0, 0), Call::transfer(2, 69));
let weight = xt.get_dispatch_info().weight as u64;
let mut t = runtime_io::TestExternalities::<Blake2Hasher>::new_with_children(t);
with_externalities(&mut t, || {
Executive::initialize_block(&Header::new(
Expand All @@ -483,7 +484,7 @@ mod tests {
});
}

fn new_test_ext() -> runtime_io::TestExternalities<Blake2Hasher> {
fn new_test_ext(balance_factor: u64) -> runtime_io::TestExternalities<Blake2Hasher> {
let mut t = system::GenesisConfig::default().build_storage::<Runtime>().unwrap();
t.extend(balances::GenesisConfig::<Runtime> {
balances: vec![(1, 111 * balance_factor)],
Expand Down
4 changes: 2 additions & 2 deletions srml/support/procedural/src/storage/transformation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,13 +530,13 @@ fn decl_store_extra_genesis(
#[cfg(feature = "std")]
impl#fparam_impl GenesisConfig#sparam #genesis_where_clause {
pub fn build_storage #fn_generic (self) -> std::result::Result<
#scrate::runtime_primitives::MapTransaction,
#scrate::sr_primitives::MapTransaction,
String
> #fn_where_clause {
let mut storage = Default::default();
let mut child_storage = Default::default();
self.assimilate_storage::<#fn_traitinstance>(&mut storage, &mut child_storage)?;
Ok(#scrate::runtime_primitives::MapTransaction { top: storage, children: child_storage })
Ok(#scrate::sr_primitives::MapTransaction { top: storage, children: child_storage })
}

/// Assimilate the storage for this module into pre-existing overlays.
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.