Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdplm committed Aug 30, 2019
1 parent caa2d2d commit 145d77c
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 206 deletions.
43 changes: 0 additions & 43 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions ethcore/snapshot/snapshot-tests/src/watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ fn harness(numbers: Vec<u64>, period: u64, history: u64, expected: Option<u64>)
));
}

// helper

#[test]
fn should_not_fire() {
harness(vec![0], 5, 0, None);
Expand Down
2 changes: 0 additions & 2 deletions ethcore/snapshot/src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ impl CodeState {
}
}

// todo[dvdplm] move to test helpers?
// walk the account's storage trie, returning a vector of RLP items containing the
// account address hash, account properties and the storage. Each item contains at most `max_storage_items`
// storage records split according to snapshot format definition.
Expand Down Expand Up @@ -171,7 +170,6 @@ pub fn to_fat_rlps(
}
}

// todo[dvdplm] move to test helpers?
// decode a fat rlp, and rebuild the storage trie as we go.
// returns the account structure along with its newly recovered code,
// if it exists.
Expand Down
75 changes: 0 additions & 75 deletions ethcore/snapshot/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,78 +127,3 @@ impl AbridgedBlock {
Ok(Block { header, transactions, uncles })
}
}

//#[cfg(test)]
//mod tests {
// use super::AbridgedBlock;
//
// use bytes::Bytes;
// use ethereum_types::{H256, U256, Address};
// use common_types::{
// transaction::{Action, Transaction},
// block::Block,
// view,
// views::BlockView,
// };
//
// fn encode_block(b: &Block) -> Bytes {
// b.rlp_bytes()
// }
//
// #[test]
// fn empty_block_abridging() {
// let b = Block::default();
// let receipts_root = b.header.receipts_root().clone();
// let encoded = encode_block(&b);
//
// let abridged = AbridgedBlock::from_block_view(&view!(BlockView, &encoded));
// assert_eq!(abridged.to_block(H256::zero(), 0, receipts_root).unwrap(), b);
// }
//
// #[test]
// #[should_panic]
// fn wrong_number() {
// let b = Block::default();
// let receipts_root = b.header.receipts_root().clone();
// let encoded = encode_block(&b);
//
// let abridged = AbridgedBlock::from_block_view(&view!(BlockView, &encoded));
// assert_eq!(abridged.to_block(H256::zero(), 2, receipts_root).unwrap(), b);
// }
//
// #[test]
// fn with_transactions() {
// let mut b = Block::default();
//
// let t1 = Transaction {
// action: Action::Create,
// nonce: U256::from(42),
// gas_price: U256::from(3000),
// gas: U256::from(50_000),
// value: U256::from(1),
// data: b"Hello!".to_vec()
// }.fake_sign(Address::from_low_u64_be(0x69));
//
// let t2 = Transaction {
// action: Action::Create,
// nonce: U256::from(88),
// gas_price: U256::from(12345),
// gas: U256::from(300000),
// value: U256::from(1000000000),
// data: "Eep!".into(),
// }.fake_sign(Address::from_low_u64_be(0x55));
//
// b.transactions.push(t1.into());
// b.transactions.push(t2.into());
//
// let receipts_root = b.header.receipts_root().clone();
// b.header.set_transactions_root(::triehash::ordered_trie_root(
// b.transactions.iter().map(::rlp::encode)
// ));
//
// let encoded = encode_block(&b);
//
// let abridged = AbridgedBlock::from_block_view(&view!(BlockView, &encoded[..]));
// assert_eq!(abridged.to_block(H256::zero(), 0, receipts_root).unwrap(), b);
// }
//}
2 changes: 0 additions & 2 deletions ethcore/snapshot/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ pub trait SnapshotReader {
fn chunk(&self, hash: H256) -> io::Result<Bytes>;
}


/// Something which can write snapshots.
/// Writing the same chunk multiple times will lead to implementation-defined
/// behavior, and is not advised.
Expand All @@ -199,7 +198,6 @@ pub trait SnapshotWriter {
fn finish(self, manifest: ManifestData) -> std::io::Result<()> where Self: Sized;
}


/// Packed snapshot reader.
pub struct PackedReader {
file: File,
Expand Down
3 changes: 0 additions & 3 deletions ethcore/snapshot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ pub mod watcher;
#[cfg(not(any(test, feature = "test-helpers")))]
mod watcher;

//#[cfg(test)]
//mod tests;

mod traits;

// Try to have chunks be around 4MB (before compression)
Expand Down
79 changes: 0 additions & 79 deletions ethcore/snapshot/src/watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,82 +124,3 @@ impl ChainNotify for Watcher {
}
}
}

//#[cfg(test)]
//mod tests {
// use std::collections::HashMap;
// use std::time::Duration;
//
// use client_traits::ChainNotify;
// use common_types::chain_notify::{NewBlocks, ChainRoute};
//
// use ethereum_types::{H256, U256, BigEndianHash};
//
// use super::{Broadcast, Oracle, Watcher};
//
// struct TestOracle(HashMap<H256, u64>);
//
// impl Oracle for TestOracle {
// fn to_number(&self, hash: H256) -> Option<u64> {
// self.0.get(&hash).cloned()
// }
//
// fn is_major_importing(&self) -> bool { false }
// }
//
// struct TestBroadcast(Option<u64>);
// impl Broadcast for TestBroadcast {
// fn take_at(&self, num: Option<u64>) {
// if num != self.0 {
// panic!("Watcher broadcast wrong number. Expected {:?}, found {:?}", self.0, num);
// }
// }
// }
//
// // helper harness for tests which expect a notification.
// fn harness(numbers: Vec<u64>, period: u64, history: u64, expected: Option<u64>) {
// const DURATION_ZERO: Duration = Duration::from_millis(0);
//
// let hashes: Vec<_> = numbers.clone().into_iter().map(|x| BigEndianHash::from_uint(&U256::from(x))).collect();
// let map = hashes.clone().into_iter().zip(numbers).collect();
//
// let watcher = Watcher {
// oracle: Box::new(TestOracle(map)),
// broadcast: Box::new(TestBroadcast(expected)),
// period,
// history,
// };
//
// watcher.new_blocks(NewBlocks::new(
// hashes,
// vec![],
// ChainRoute::default(),
// vec![],
// vec![],
// DURATION_ZERO,
// false
// ));
// }
//
// // helper
//
// #[test]
// fn should_not_fire() {
// harness(vec![0], 5, 0, None);
// }
//
// #[test]
// fn fires_once_for_two() {
// harness(vec![14, 15], 10, 5, Some(10));
// }
//
// #[test]
// fn finds_highest() {
// harness(vec![15, 25], 10, 5, Some(20));
// }
//
// #[test]
// fn doesnt_fire_before_history() {
// harness(vec![10, 11], 10, 5, None);
// }
//}

0 comments on commit 145d77c

Please sign in to comment.