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
@@ -21,11 +21,12 @@ use std::sync::Weak;
|
||||
|
||||
use bytes::Bytes;
|
||||
use ethereum_types::{H256, Address};
|
||||
use machine::{AuxiliaryData, Call, EthereumMachine};
|
||||
use parking_lot::RwLock;
|
||||
use types::BlockNumber;
|
||||
use types::header::Header;
|
||||
|
||||
use client::EngineClient;
|
||||
use header::{Header, BlockNumber};
|
||||
use machine::{AuxiliaryData, Call, EthereumMachine};
|
||||
|
||||
use super::{ValidatorSet, SimpleList, SystemCall};
|
||||
use super::safe_contract::ValidatorSafeContract;
|
||||
@@ -67,7 +68,7 @@ impl ValidatorContract {
|
||||
}
|
||||
|
||||
impl ValidatorSet for ValidatorContract {
|
||||
fn default_caller(&self, id: ::ids::BlockId) -> Box<Call> {
|
||||
fn default_caller(&self, id: ::types::ids::BlockId) -> Box<Call> {
|
||||
self.validators.default_caller(id)
|
||||
}
|
||||
|
||||
@@ -139,7 +140,7 @@ mod tests {
|
||||
use bytes::ToPretty;
|
||||
use rlp::encode;
|
||||
use spec::Spec;
|
||||
use header::Header;
|
||||
use types::header::Header;
|
||||
use account_provider::AccountProvider;
|
||||
use miner::MinerService;
|
||||
use types::ids::BlockId;
|
||||
|
||||
@@ -24,13 +24,16 @@ mod contract;
|
||||
mod multi;
|
||||
|
||||
use std::sync::Weak;
|
||||
use ids::BlockId;
|
||||
use ethereum_types::{H256, Address};
|
||||
|
||||
use bytes::Bytes;
|
||||
use ethereum_types::{H256, Address};
|
||||
use ethjson::spec::ValidatorSet as ValidatorSpec;
|
||||
use client::EngineClient;
|
||||
use header::{Header, BlockNumber};
|
||||
use machine::{AuxiliaryData, Call, EthereumMachine};
|
||||
use types::BlockNumber;
|
||||
use types::header::Header;
|
||||
use types::ids::BlockId;
|
||||
|
||||
use client::EngineClient;
|
||||
|
||||
#[cfg(test)]
|
||||
pub use self::test::TestSet;
|
||||
|
||||
@@ -18,11 +18,14 @@
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use std::sync::Weak;
|
||||
|
||||
use bytes::Bytes;
|
||||
use ethereum_types::{H256, Address};
|
||||
use parking_lot::RwLock;
|
||||
use bytes::Bytes;
|
||||
use ids::BlockId;
|
||||
use header::{BlockNumber, Header};
|
||||
use types::BlockNumber;
|
||||
use types::header::Header;
|
||||
use types::ids::BlockId;
|
||||
|
||||
use client::EngineClient;
|
||||
use machine::{AuxiliaryData, Call, EthereumMachine};
|
||||
use super::{SystemCall, ValidatorSet};
|
||||
@@ -152,7 +155,7 @@ mod tests {
|
||||
use engines::EpochChange;
|
||||
use engines::validator_set::ValidatorSet;
|
||||
use ethkey::Secret;
|
||||
use header::Header;
|
||||
use types::header::Header;
|
||||
use miner::MinerService;
|
||||
use spec::Spec;
|
||||
use test_helpers::{generate_dummy_client_with_spec_and_accounts, generate_dummy_client_with_spec_and_data};
|
||||
|
||||
@@ -16,24 +16,26 @@
|
||||
|
||||
/// Validator set maintained in a contract, updated using `getValidators` method.
|
||||
|
||||
use std::sync::{Weak, Arc};
|
||||
|
||||
use bytes::Bytes;
|
||||
use client::EngineClient;
|
||||
use ethabi::FunctionOutputDecoder;
|
||||
use ethereum_types::{H256, U256, Address, Bloom};
|
||||
use hash::keccak;
|
||||
use header::Header;
|
||||
use ids::BlockId;
|
||||
use kvdb::DBValue;
|
||||
use log_entry::LogEntry;
|
||||
use machine::{AuxiliaryData, Call, EthereumMachine, AuxiliaryRequest};
|
||||
use memory_cache::MemoryLruCache;
|
||||
use parking_lot::RwLock;
|
||||
use receipt::Receipt;
|
||||
use rlp::{Rlp, RlpStream};
|
||||
use std::sync::{Weak, Arc};
|
||||
use types::header::Header;
|
||||
use types::ids::BlockId;
|
||||
use types::log_entry::LogEntry;
|
||||
use types::receipt::Receipt;
|
||||
use unexpected::Mismatch;
|
||||
|
||||
use client::EngineClient;
|
||||
use machine::{AuxiliaryData, Call, EthereumMachine, AuxiliaryRequest};
|
||||
use super::{SystemCall, ValidatorSet};
|
||||
use super::simple_list::SimpleList;
|
||||
use unexpected::Mismatch;
|
||||
use ethabi::FunctionOutputDecoder;
|
||||
|
||||
use_contract!(validator_set, "res/contracts/validator_set.json");
|
||||
|
||||
@@ -91,7 +93,7 @@ fn encode_first_proof(header: &Header, state_items: &[Vec<u8>]) -> Bytes {
|
||||
fn check_first_proof(machine: &EthereumMachine, contract_address: Address, old_header: Header, state_items: &[DBValue])
|
||||
-> Result<Vec<Address>, String>
|
||||
{
|
||||
use transaction::{Action, Transaction};
|
||||
use types::transaction::{Action, Transaction};
|
||||
|
||||
// TODO: match client contract_call_tx more cleanly without duplication.
|
||||
const PROVIDED_GAS: u64 = 50_000_000;
|
||||
@@ -343,7 +345,7 @@ impl ValidatorSet for ValidatorSafeContract {
|
||||
}
|
||||
}
|
||||
|
||||
fn epoch_set(&self, first: bool, machine: &EthereumMachine, _number: ::header::BlockNumber, proof: &[u8])
|
||||
fn epoch_set(&self, first: bool, machine: &EthereumMachine, _number: ::types::BlockNumber, proof: &[u8])
|
||||
-> Result<(SimpleList, Option<H256>), ::error::Error>
|
||||
{
|
||||
let rlp = Rlp::new(proof);
|
||||
@@ -444,7 +446,7 @@ mod tests {
|
||||
use types::ids::BlockId;
|
||||
use spec::Spec;
|
||||
use account_provider::AccountProvider;
|
||||
use transaction::{Transaction, Action};
|
||||
use types::transaction::{Transaction, Action};
|
||||
use client::{ChainInfo, BlockInfo, ImportBlock};
|
||||
use ethkey::Secret;
|
||||
use miner::MinerService;
|
||||
@@ -532,10 +534,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn detects_bloom() {
|
||||
use header::Header;
|
||||
use engines::EpochChange;
|
||||
use machine::AuxiliaryRequest;
|
||||
use log_entry::LogEntry;
|
||||
use types::header::Header;
|
||||
use types::log_entry::LogEntry;
|
||||
|
||||
let client = generate_dummy_client_with_spec_and_accounts(Spec::new_validator_safe_contract, None);
|
||||
let engine = client.engine().clone();
|
||||
@@ -571,7 +573,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn initial_contract_is_signal() {
|
||||
use header::Header;
|
||||
use types::header::Header;
|
||||
use engines::{EpochChange, Proof};
|
||||
|
||||
let client = generate_dummy_client_with_spec_and_accounts(Spec::new_validator_safe_contract, None);
|
||||
|
||||
@@ -20,7 +20,8 @@ use heapsize::HeapSizeOf;
|
||||
use ethereum_types::{H256, Address};
|
||||
|
||||
use machine::{AuxiliaryData, Call, EthereumMachine};
|
||||
use header::{BlockNumber, Header};
|
||||
use types::BlockNumber;
|
||||
use types::header::Header;
|
||||
use super::ValidatorSet;
|
||||
|
||||
/// Validator set containing a known set of addresses.
|
||||
@@ -64,7 +65,7 @@ impl HeapSizeOf for SimpleList {
|
||||
}
|
||||
|
||||
impl ValidatorSet for SimpleList {
|
||||
fn default_caller(&self, _block_id: ::ids::BlockId) -> Box<Call> {
|
||||
fn default_caller(&self, _block_id: ::types::ids::BlockId) -> Box<Call> {
|
||||
Box::new(|_, _| Err("Simple list doesn't require calls.".into()))
|
||||
}
|
||||
|
||||
|
||||
@@ -19,12 +19,14 @@
|
||||
use std::str::FromStr;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrdering};
|
||||
use heapsize::HeapSizeOf;
|
||||
use ethereum_types::{H256, Address};
|
||||
|
||||
use bytes::Bytes;
|
||||
use ethereum_types::{H256, Address};
|
||||
use heapsize::HeapSizeOf;
|
||||
use types::BlockNumber;
|
||||
use types::header::Header;
|
||||
|
||||
use machine::{AuxiliaryData, Call, EthereumMachine};
|
||||
use header::{Header, BlockNumber};
|
||||
use super::{ValidatorSet, SimpleList};
|
||||
|
||||
/// Set used for testing with a single validator.
|
||||
@@ -57,7 +59,7 @@ impl HeapSizeOf for TestSet {
|
||||
}
|
||||
|
||||
impl ValidatorSet for TestSet {
|
||||
fn default_caller(&self, _block_id: ::ids::BlockId) -> Box<Call> {
|
||||
fn default_caller(&self, _block_id: ::types::ids::BlockId) -> Box<Call> {
|
||||
Box::new(|_, _| Err("Test set doesn't require calls.".into()))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user