Switch to shiny new fast, RLP-less trie (#795)

* Bump codec

* Fix tests

* Patricia trie builds

* Introduce trie

* Some yak shaving.

* Some fixes

* Remove RLP ref

* Fixes

* It builds!

* Some tests fixed

* Another test fix

* Rejig more hashes

* substrate-trie::iterator_works test

* Update lock

* Polish

* Docs

* Undo incorrect "fix" for tests

* Fix nits
This commit is contained in:
Gav Wood
2018-09-25 15:32:22 +01:00
committed by Arkadiy Paronyan
parent b02c274374
commit 82d6ca3484
90 changed files with 1977 additions and 1129 deletions
+3 -3
View File
@@ -32,7 +32,7 @@ use transaction_pool::{
};
use jsonrpc_macros::pubsub;
use jsonrpc_pubsub::SubscriptionId;
use primitives::{Bytes, Blake2Hasher, RlpCodec};
use primitives::{Bytes, Blake2Hasher};
use rpc::futures::{Sink, Stream, Future};
use runtime_primitives::{generic, traits};
use subscriptions::Subscriptions;
@@ -100,8 +100,8 @@ impl<B, E, P> Author<B, E, P> where
}
impl<B, E, P> AuthorApi<ExHash<P>, ExtrinsicFor<P>, AllExtrinsics<P>> for Author<B, E, P> where
B: client::backend::Backend<<P as PoolChainApi>::Block, Blake2Hasher, RlpCodec> + Send + Sync + 'static,
E: client::CallExecutor<<P as PoolChainApi>::Block, Blake2Hasher, RlpCodec> + Send + Sync + 'static,
B: client::backend::Backend<<P as PoolChainApi>::Block, Blake2Hasher> + Send + Sync + 'static,
E: client::CallExecutor<<P as PoolChainApi>::Block, Blake2Hasher> + Send + Sync + 'static,
P: PoolChainApi + Sync + Send + 'static,
P::Error: 'static,
{
+5 -5
View File
@@ -27,7 +27,7 @@ use runtime_primitives::generic::{BlockId, SignedBlock};
use runtime_primitives::traits::{Block as BlockT, Header, NumberFor};
use runtime_version::RuntimeVersion;
use tokio::runtime::TaskExecutor;
use primitives::{Blake2Hasher, RlpCodec};
use primitives::{Blake2Hasher};
use subscriptions::Subscriptions;
@@ -92,8 +92,8 @@ impl<B, E, Block: BlockT> Chain<B, E, Block> {
impl<B, E, Block> Chain<B, E, Block> where
Block: BlockT + 'static,
B: client::backend::Backend<Block, Blake2Hasher, RlpCodec> + Send + Sync + 'static,
E: client::CallExecutor<Block, Blake2Hasher, RlpCodec> + Send + Sync + 'static,
B: client::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
E: client::CallExecutor<Block, Blake2Hasher> + Send + Sync + 'static,
{
fn unwrap_or_best(&self, hash: Trailing<Block::Hash>) -> Result<Block::Hash> {
Ok(match hash.into() {
@@ -105,8 +105,8 @@ impl<B, E, Block> Chain<B, E, Block> where
impl<B, E, Block> ChainApi<Block::Hash, Block::Header, NumberFor<Block>, Block::Extrinsic> for Chain<B, E, Block> where
Block: BlockT + 'static,
B: client::backend::Backend<Block, Blake2Hasher, RlpCodec> + Send + Sync + 'static,
E: client::CallExecutor<Block, Blake2Hasher, RlpCodec> + Send + Sync + 'static,
B: client::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
E: client::CallExecutor<Block, Blake2Hasher> + Send + Sync + 'static,
{
type Metadata = ::metadata::Metadata;
+4 -4
View File
@@ -36,7 +36,7 @@ fn should_return_header() {
parent_hash: 0.into(),
number: 0,
state_root: x.state_root.clone(),
extrinsics_root: "45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0".into(),
extrinsics_root: "03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c111314".into(),
digest: Default::default(),
}
);
@@ -47,7 +47,7 @@ fn should_return_header() {
parent_hash: 0.into(),
number: 0,
state_root: x.state_root.clone(),
extrinsics_root: "45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0".into(),
extrinsics_root: "03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c111314".into(),
digest: Default::default(),
}
);
@@ -86,7 +86,7 @@ fn should_return_a_block() {
parent_hash: api.client.genesis_hash(),
number: 1,
state_root: x.block.header.state_root.clone(),
extrinsics_root: "45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0".into(),
extrinsics_root: "03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c111314".into(),
digest: Default::default(),
},
extrinsics: vec![],
@@ -100,7 +100,7 @@ fn should_return_a_block() {
parent_hash: api.client.genesis_hash(),
number: 1,
state_root: x.block.header.state_root.clone(),
extrinsics_root: "45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0".into(),
extrinsics_root: "03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c111314".into(),
digest: Default::default(),
},
extrinsics: vec![],
+5 -5
View File
@@ -27,7 +27,7 @@ use jsonrpc_macros::pubsub;
use jsonrpc_pubsub::SubscriptionId;
use primitives::hexdisplay::HexDisplay;
use primitives::storage::{StorageKey, StorageData, StorageChangeSet};
use primitives::{Blake2Hasher, RlpCodec};
use primitives::{Blake2Hasher};
use rpc::Result as RpcResult;
use rpc::futures::{stream, Future, Sink, Stream};
use runtime_primitives::generic::BlockId;
@@ -107,8 +107,8 @@ impl<B, E, Block: BlockT> State<B, E, Block> {
impl<B, E, Block> State<B, E, Block> where
Block: BlockT,
B: client::backend::Backend<Block, Blake2Hasher, RlpCodec>,
E: CallExecutor<Block, Blake2Hasher, RlpCodec>,
B: client::backend::Backend<Block, Blake2Hasher>,
E: CallExecutor<Block, Blake2Hasher>,
{
fn unwrap_or_best(&self, hash: Trailing<Block::Hash>) -> Result<Block::Hash> {
::helpers::unwrap_or_else(|| Ok(self.client.info()?.chain.best_hash), hash)
@@ -117,8 +117,8 @@ impl<B, E, Block> State<B, E, Block> where
impl<B, E, Block> StateApi<Block::Hash> for State<B, E, Block> where
Block: BlockT + 'static,
B: client::backend::Backend<Block, Blake2Hasher, RlpCodec> + Send + Sync + 'static,
E: CallExecutor<Block, Blake2Hasher, RlpCodec> + Send + Sync + 'static,
B: client::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
E: CallExecutor<Block, Blake2Hasher> + Send + Sync + 'static,
{
type Metadata = ::metadata::Metadata;