Core tracedb functionality. (#996)

* fixed encoding 0u8

* simplified if else stmt

* tracedb core

* more comprehensive tracedb tests

* fixed minor review issues

* addresses filter

* fixed typos

* replace malformed with corrupted

* trace switch

* db key is generic and can be made smaller

* smaller tracedb keys

* tracedb version

* fixed ignored tests

* rename Tracedb -> TraceDB

* fixed typos

* proves

* trace only top level calls to builtins to avoid DDoS attacks

* fixed tracedb config switches

* fix comments fat replaced with trace

* vector-addressing scheme for localized traces

* removed comments

* removed first, redundant 0 from trace address

* updated db.trace method

* additional tests for tracedb.trace()
This commit is contained in:
Marek Kotewicz
2016-04-30 17:41:24 +02:00
committed by Gav Wood
parent e942f86bd7
commit 66477a9476
31 changed files with 2090 additions and 239 deletions

View File

@@ -55,9 +55,6 @@ impl Default for BlockChainConfig {
/// Interface for querying blocks by hash and by number.
pub trait BlockProvider {
/// True if we store full tracing information for transactions.
fn have_tracing(&self) -> bool;
/// Returns true if the given block is known
/// (though not necessarily a part of the canon chain).
fn is_known(&self, hash: &H256) -> bool;
@@ -186,9 +183,6 @@ impl BlockProvider for BlockChain {
self.extras_db.exists_with_cache(&self.block_details, hash)
}
/// We do not store tracing information.
fn have_tracing(&self) -> bool { false }
/// Get raw block data
fn block(&self, hash: &H256) -> Option<Bytes> {
{
@@ -734,9 +728,10 @@ impl BlockChain {
self.query_extras(hash, &self.blocks_blooms)
}
fn query_extras<K, T>(&self, hash: &K, cache: &RwLock<HashMap<K, T>>) -> Option<T> where
fn query_extras<K, T, R>(&self, hash: &K, cache: &RwLock<HashMap<K, T>>) -> Option<T> where
T: ExtrasIndexable + Clone + Decodable,
K: Key<T> + Eq + Hash + Clone,
K: Key<T, Target = R> + Eq + Hash + Clone,
R: Deref<Target = [u8]>,
H256: From<K> {
self.note_used(CacheID::Extras(T::index(), H256::from(hash.clone())));
self.extras_db.read_with_cache(cache, hash)