separate trie from util and make its dependencies into libs:

* bytes
* hashdb
* memorydb
* nibbleslice
* nibblevec
This commit is contained in:
Hawstein
2017-09-07 02:47:45 +08:00
parent 79659bdc76
commit ade37be25b
182 changed files with 497 additions and 251 deletions

View File

@@ -23,6 +23,9 @@ use hash::{KECCAK_EMPTY, KECCAK_NULL_RLP, keccak};
use bigint::prelude::U256;
use bigint::hash::H256;
use util::*;
use bytes::{Bytes, ToPretty};
use trie;
use trie::{SecTrieDB, Trie, TrieFactory, TrieError};
use pod_account::*;
use rlp::*;
use lru_cache::LruCache;
@@ -450,8 +453,8 @@ impl Account {
/// `storage_key` is the hash of the desired storage key, meaning
/// this will only work correctly under a secure trie.
pub fn prove_storage(&self, db: &HashDB, storage_key: H256) -> Result<(Vec<Bytes>, H256), Box<TrieError>> {
use util::trie::{Trie, TrieDB};
use util::trie::recorder::Recorder;
use trie::{Trie, TrieDB};
use trie::recorder::Recorder;
let mut recorder = Recorder::new();
@@ -475,6 +478,7 @@ impl fmt::Debug for Account {
mod tests {
use rlp::{UntrustedRlp, RlpType, Compressible};
use util::*;
use bytes::Bytes;
use super::*;
use account_db::*;

View File

@@ -28,7 +28,7 @@ use state::Account;
use bigint::hash::H256;
use parking_lot::Mutex;
use util::{Address, MemoryDB};
use util::hashdb::{AsHashDB, HashDB, DBValue};
use hashdb::{AsHashDB, HashDB, DBValue};
/// State backend. See module docs for more details.
pub trait Backend: Send {

View File

@@ -45,9 +45,12 @@ use evm::{Factory as EvmFactory};
use bigint::prelude::U256;
use bigint::hash::H256;
use util::*;
use bytes::Bytes;
use trie;
use trie::{Trie, TrieError, TrieDB};
use trie::recorder::Recorder;
use util::trie;
use util::trie::recorder::Recorder;
mod account;
mod substate;