Make HashDB generic (#8739)

The `patricia_trie` crate is generic over the hasher (by way of HashDB) and node encoding scheme. Adds a new `patricia_trie_ethereum` crate with concrete impls for Keccak/RLP.
This commit is contained in:
David
2018-07-02 18:50:05 +02:00
committed by GitHub
parent 202c54d423
commit 9caa868603
89 changed files with 1962 additions and 1282 deletions

View File

@@ -8,6 +8,7 @@ byteorder = "1.0"
ethcore-bytes = { path = "../../util/bytes" }
ethereum-types = "0.3"
patricia-trie = { path = "../../util/patricia_trie" }
patricia-trie-ethereum = { path = "../../util/patricia-trie-ethereum" }
log = "0.3"
common-types = { path = "../types" }
ethjson = { path = "../../json" }

View File

@@ -16,8 +16,8 @@
//! VM errors module
use trie;
use std::fmt;
use ethtrie;
/// VM errors.
#[derive(Debug, Clone, PartialEq)]
@@ -71,8 +71,13 @@ pub enum Error {
Reverted,
}
impl From<Box<trie::TrieError>> for Error {
fn from(err: Box<trie::TrieError>) -> Self {
impl From<Box<ethtrie::TrieError>> for Error {
fn from(err: Box<ethtrie::TrieError>) -> Self {
Error::Internal(format!("Internal error: {}", err))
}
}
impl From<ethtrie::TrieError> for Error {
fn from(err: ethtrie::TrieError) -> Self {
Error::Internal(format!("Internal error: {}", err))
}
}

View File

@@ -22,6 +22,7 @@ extern crate common_types as types;
extern crate ethjson;
extern crate rlp;
extern crate keccak_hash as hash;
extern crate patricia_trie_ethereum as ethtrie;
extern crate patricia_trie as trie;
mod action_params;