Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into td-txpool2
Browse files Browse the repository at this point in the history
  • Loading branch information
tomusdrw committed Feb 23, 2018
2 parents e595e83 + e4f863b commit 620e6be
Show file tree
Hide file tree
Showing 55 changed files with 272 additions and 2,321 deletions.
23 changes: 10 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,5 @@ members = [
"miner",
"transaction-pool",
"whisper",
"util/rlp_compress"
]
2 changes: 1 addition & 1 deletion ethcore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ authors = ["Parity Technologies <[email protected]>"]

[dependencies]
ansi_term = "0.10"
bloomchain = { path = "../util/bloomchain" }
bn = { git = "https://github.com/paritytech/bn" }
byteorder = "1.0"
common-types = { path = "types" }
Expand Down Expand Up @@ -46,6 +45,7 @@ parking_lot = "0.5"
rayon = "0.8"
rand = "0.4"
rlp = { path = "../util/rlp" }
rlp_compress = { path = "../util/rlp_compress" }
rlp_derive = { path = "../util/rlp_derive" }
kvdb = { path = "../util/kvdb" }
kvdb-rocksdb = { path = "../util/kvdb-rocksdb" }
Expand Down
17 changes: 10 additions & 7 deletions ethcore/src/blockchain/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use ethereum_types::{H256, Bloom, U256};
use parking_lot::{Mutex, RwLock};
use bytes::Bytes;
use rlp::*;
use rlp_compress::{compress, decompress, blocks_swapper};
use header::*;
use transaction::*;
use views::*;
Expand Down Expand Up @@ -254,7 +255,7 @@ impl BlockProvider for BlockChain {

let result = match opt {
Some(b) => {
let bytes: Bytes = UntrustedRlp::new(&b).decompress(RlpType::Blocks).into_vec();
let bytes = decompress(&b, blocks_swapper()).into_vec();
let mut write = self.block_headers.write();
write.insert(*hash, bytes.clone());
Some(encoded::Header::new(bytes))
Expand Down Expand Up @@ -290,7 +291,7 @@ impl BlockProvider for BlockChain {

let result = match opt {
Some(b) => {
let bytes: Bytes = UntrustedRlp::new(&b).decompress(RlpType::Blocks).into_vec();
let bytes = decompress(&b, blocks_swapper()).into_vec();
let mut write = self.block_bodies.write();
write.insert(*hash, bytes.clone());
Some(encoded::Body::new(bytes))
Expand Down Expand Up @@ -702,9 +703,8 @@ impl BlockChain {

assert!(self.pending_best_block.read().is_none());

let block_rlp = UntrustedRlp::new(bytes);
let compressed_header = block_rlp.at(0).unwrap().compress(RlpType::Blocks);
let compressed_body = UntrustedRlp::new(&Self::block_to_body(bytes)).compress(RlpType::Blocks);
let compressed_header = compress(block.header_rlp().as_raw(), blocks_swapper());
let compressed_body = compress(&Self::block_to_body(bytes), blocks_swapper());

// store block in db
batch.put(db::COL_HEADERS, &hash, &compressed_header);
Expand Down Expand Up @@ -901,9 +901,12 @@ impl BlockChain {

assert!(self.pending_best_block.read().is_none());

let compressed_header = compress(block.header_rlp().as_raw(), blocks_swapper());
let compressed_body = compress(&Self::block_to_body(bytes), blocks_swapper());

// store block in db
batch.put_compressed(db::COL_HEADERS, &hash, block.header_rlp().as_raw().to_vec());
batch.put_compressed(db::COL_BODIES, &hash, Self::block_to_body(bytes));
batch.put(db::COL_HEADERS, &hash, &compressed_header);
batch.put(db::COL_BODIES, &hash, &compressed_body);

let info = self.block_info(&header);

Expand Down
47 changes: 0 additions & 47 deletions ethcore/src/blooms/bloom_group.rs

This file was deleted.

42 changes: 0 additions & 42 deletions ethcore/src/blooms/group_position.rs

This file was deleted.

23 changes: 0 additions & 23 deletions ethcore/src/blooms/mod.rs

This file was deleted.

3 changes: 1 addition & 2 deletions ethcore/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
//! cargo build --release
//! ```
extern crate bloomchain;
extern crate bn;
extern crate byteorder;
extern crate crossbeam;
Expand Down Expand Up @@ -82,6 +81,7 @@ extern crate parking_lot;
extern crate rand;
extern crate rayon;
extern crate rlp;
extern crate rlp_compress;
extern crate keccak_hash as hash;
extern crate heapsize;
extern crate memorydb;
Expand Down Expand Up @@ -155,7 +155,6 @@ pub mod verification;
pub mod views;

mod cache_manager;
mod blooms;
mod pod_account;
mod account_db;
mod builtin;
Expand Down
7 changes: 3 additions & 4 deletions ethcore/src/state/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ impl fmt::Debug for Account {

#[cfg(test)]
mod tests {
use rlp::{UntrustedRlp, RlpType, Compressible};
use rlp_compress::{compress, decompress, snapshot_swapper};
use ethereum_types::{H256, Address};
use memorydb::MemoryDB;
use bytes::Bytes;
Expand All @@ -495,10 +495,9 @@ mod tests {
#[test]
fn account_compress() {
let raw = Account::new_basic(2.into(), 4.into()).rlp();
let rlp = UntrustedRlp::new(&raw);
let compact_vec = rlp.compress(RlpType::Snapshot).into_vec();
let compact_vec = compress(&raw, snapshot_swapper());
assert!(raw.len() > compact_vec.len());
let again_raw = UntrustedRlp::new(&compact_vec).decompress(RlpType::Snapshot);
let again_raw = decompress(&compact_vec, snapshot_swapper());
assert_eq!(raw, again_raw.into_vec());
}

Expand Down
7 changes: 0 additions & 7 deletions ethcore/src/trace/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,13 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.

//! Traces config.
use bloomchain::Config as BloomConfig;
/// Traces config.
#[derive(Debug, PartialEq, Clone)]
pub struct Config {
/// Indicates if tracing should be enabled or not.
/// If it's None, it will be automatically configured.
pub enabled: bool,
/// Traces blooms configuration.
pub blooms: BloomConfig,
/// Preferef cache-size.
pub pref_cache_size: usize,
/// Max cache-size.
Expand All @@ -35,10 +32,6 @@ impl Default for Config {
fn default() -> Self {
Config {
enabled: false,
blooms: BloomConfig {
levels: 3,
elements_per_index: 16,
},
pref_cache_size: 15 * 1024 * 1024,
max_cache_size: 20 * 1024 * 1024,
}
Expand Down
Loading

0 comments on commit 620e6be

Please sign in to comment.