Extract blockchain from ethcore (#10114)
* Split blockchain & db from ethcore. * Clean up blockchain deps. * Missing docs. * Fix blockchain tests. * Make other crates compile. * Remove some re-exports. * Remove types re-export from ethcore. * Remove EVM dependency from transaction. * Merge ethcore-transaction with common-types. * Clean-up ethcore deps a bit. * remove ethcore from cargo.toml * Update ethcore/blockchain/src/lib.rs Co-Authored-By: tomusdrw <tomusdrw@users.noreply.github.com> * Address review comments. * Update DB comment. * Add tracking issue to the TODO and fix typo. * Common naming for common types. * Update ethcore/db/src/keys.rs Co-Authored-By: tomusdrw <tomusdrw@users.noreply.github.com> * Update ethcore/blockchain/src/generator.rs Co-Authored-By: tomusdrw <tomusdrw@users.noreply.github.com> * Try to fix beta tests.
This commit is contained in:
committed by
Afri Schoedon
parent
3090324366
commit
3650f2d51c
@@ -19,7 +19,7 @@
|
||||
use client::{BlockInfo, CallContract};
|
||||
use engines::EthEngine;
|
||||
use error::Error;
|
||||
use header::Header;
|
||||
use types::header::Header;
|
||||
use super::Verifier;
|
||||
use super::verification;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
use client::{BlockInfo, CallContract};
|
||||
use engines::EthEngine;
|
||||
use error::Error;
|
||||
use header::Header;
|
||||
use types::header::Header;
|
||||
use super::{verification, Verifier};
|
||||
|
||||
/// A no-op verifier -- this will verify everything it's given immediately.
|
||||
|
||||
@@ -70,9 +70,9 @@ pub mod blocks {
|
||||
|
||||
use engines::EthEngine;
|
||||
use error::{Error, ErrorKind, BlockError};
|
||||
use header::Header;
|
||||
use types::header::Header;
|
||||
use verification::{PreverifiedBlock, verify_block_basic, verify_block_unordered};
|
||||
use transaction::UnverifiedTransaction;
|
||||
use types::transaction::UnverifiedTransaction;
|
||||
|
||||
use heapsize::HeapSizeOf;
|
||||
use ethereum_types::{H256, U256};
|
||||
@@ -190,7 +190,7 @@ pub mod headers {
|
||||
|
||||
use engines::EthEngine;
|
||||
use error::Error;
|
||||
use header::Header;
|
||||
use types::header::Header;
|
||||
use verification::verify_header_params;
|
||||
|
||||
use ethereum_types::{H256, U256};
|
||||
|
||||
@@ -117,9 +117,9 @@ pub enum Status {
|
||||
Unknown,
|
||||
}
|
||||
|
||||
impl Into<::block_status::BlockStatus> for Status {
|
||||
fn into(self) -> ::block_status::BlockStatus {
|
||||
use ::block_status::BlockStatus;
|
||||
impl Into<::types::block_status::BlockStatus> for Status {
|
||||
fn into(self) -> ::types::block_status::BlockStatus {
|
||||
use ::types::block_status::BlockStatus;
|
||||
match self {
|
||||
Status::Queued => BlockStatus::Queued,
|
||||
Status::Bad => BlockStatus::Bad,
|
||||
@@ -744,8 +744,9 @@ mod tests {
|
||||
use super::kind::blocks::Unverified;
|
||||
use test_helpers::{get_good_dummy_block_seq, get_good_dummy_block};
|
||||
use error::*;
|
||||
use views::BlockView;
|
||||
use bytes::Bytes;
|
||||
use types::view;
|
||||
use types::views::BlockView;
|
||||
|
||||
// create a test block queue.
|
||||
// auto_scaling enables verifier adjustment.
|
||||
|
||||
@@ -35,8 +35,8 @@ use blockchain::*;
|
||||
use client::{BlockInfo, CallContract};
|
||||
use engines::EthEngine;
|
||||
use error::{BlockError, Error};
|
||||
use header::{BlockNumber, Header};
|
||||
use transaction::SignedTransaction;
|
||||
use types::{BlockNumber, header::Header};
|
||||
use types::transaction::SignedTransaction;
|
||||
use verification::queue::kind::blocks::Unverified;
|
||||
|
||||
/// Preprocessed block data gathered in `verify_block_unordered` call
|
||||
@@ -378,7 +378,7 @@ mod tests {
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
use ethereum_types::{H256, BloomRef, U256};
|
||||
use blockchain::{BlockDetails, TransactionAddress, BlockReceipts};
|
||||
use encoded;
|
||||
use types::encoded;
|
||||
use hash::keccak;
|
||||
use engines::EthEngine;
|
||||
use error::BlockError::*;
|
||||
@@ -386,7 +386,7 @@ mod tests {
|
||||
use ethkey::{Random, Generator};
|
||||
use spec::{CommonParams, Spec};
|
||||
use test_helpers::{create_test_block_with_data, create_test_block};
|
||||
use transaction::{SignedTransaction, Transaction, UnverifiedTransaction, Action};
|
||||
use types::transaction::{SignedTransaction, Transaction, UnverifiedTransaction, Action};
|
||||
use types::log_entry::{LogEntry, LocalizedLogEntry};
|
||||
use rlp;
|
||||
use triehash::ordered_trie_root;
|
||||
@@ -638,14 +638,18 @@ mod tests {
|
||||
good_uncle1.set_parent_hash(parent8.hash());
|
||||
good_uncle1.set_difficulty(parent8.difficulty().clone() + diff_inc);
|
||||
good_uncle1.set_timestamp(parent8.timestamp() + 10);
|
||||
good_uncle1.extra_data_mut().push(1u8);
|
||||
let mut ex = good_uncle1.extra_data().to_vec();
|
||||
ex.push(1u8);
|
||||
good_uncle1.set_extra_data(ex);
|
||||
|
||||
let mut good_uncle2 = good.clone();
|
||||
good_uncle2.set_number(8);
|
||||
good_uncle2.set_parent_hash(parent7.hash());
|
||||
good_uncle2.set_difficulty(parent7.difficulty().clone() + diff_inc);
|
||||
good_uncle2.set_timestamp(parent7.timestamp() + 10);
|
||||
good_uncle2.extra_data_mut().push(2u8);
|
||||
let mut ex = good_uncle2.extra_data().to_vec();
|
||||
ex.push(2u8);
|
||||
good_uncle2.set_extra_data(ex);
|
||||
|
||||
let good_uncles = vec![ good_uncle1.clone(), good_uncle2.clone() ];
|
||||
let mut uncles_rlp = RlpStream::new();
|
||||
@@ -702,12 +706,16 @@ mod tests {
|
||||
TooMuchGasUsed(OutOfBounds { max: Some(header.gas_limit().clone()), min: None, found: header.gas_used().clone() }));
|
||||
|
||||
header = good.clone();
|
||||
header.extra_data_mut().resize(engine.maximum_extra_data_size() + 1, 0u8);
|
||||
let mut ex = header.extra_data().to_vec();
|
||||
ex.resize(engine.maximum_extra_data_size() + 1, 0u8);
|
||||
header.set_extra_data(ex);
|
||||
check_fail(basic_test(&create_test_block(&header), engine),
|
||||
ExtraDataOutOfBounds(OutOfBounds { max: Some(engine.maximum_extra_data_size()), min: None, found: header.extra_data().len() }));
|
||||
|
||||
header = good.clone();
|
||||
header.extra_data_mut().resize(engine.maximum_extra_data_size() + 1, 0u8);
|
||||
let mut ex = header.extra_data().to_vec();
|
||||
ex.resize(engine.maximum_extra_data_size() + 1, 0u8);
|
||||
header.set_extra_data(ex);
|
||||
check_fail(basic_test(&create_test_block(&header), engine),
|
||||
ExtraDataOutOfBounds(OutOfBounds { max: Some(engine.maximum_extra_data_size()), min: None, found: header.extra_data().len() }));
|
||||
|
||||
@@ -778,7 +786,7 @@ mod tests {
|
||||
#[test]
|
||||
fn dust_protection() {
|
||||
use ethkey::{Generator, Random};
|
||||
use transaction::{Transaction, Action};
|
||||
use types::transaction::{Transaction, Action};
|
||||
use machine::EthereumMachine;
|
||||
use engines::NullEngine;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
use client::{BlockInfo, CallContract};
|
||||
use engines::EthEngine;
|
||||
use error::Error;
|
||||
use header::Header;
|
||||
use types::header::Header;
|
||||
use super::verification;
|
||||
|
||||
/// Should be used to verify blocks.
|
||||
|
||||
Reference in New Issue
Block a user