Move ethcore files back into root.
This commit is contained in:
parent
9b87bae322
commit
6ea8eaa3b5
30
Cargo.toml
30
Cargo.toml
@ -1,32 +1,24 @@
|
||||
[package]
|
||||
description = "Ethcore utility library"
|
||||
description = "Ethcore library"
|
||||
homepage = "http://ethcore.io"
|
||||
license = "GPL-3.0"
|
||||
name = "ethcore-util"
|
||||
name = "ethcore"
|
||||
version = "0.1.0"
|
||||
authors = ["Ethcore <admin@ethcore.io>"]
|
||||
build = "build.rs"
|
||||
|
||||
[build-dependencies]
|
||||
gcc = "0.3"
|
||||
|
||||
[dependencies]
|
||||
log = "0.3"
|
||||
env_logger = "0.3"
|
||||
ethcore-util = { path = "util" }
|
||||
rustc-serialize = "0.3"
|
||||
arrayvec = "0.3"
|
||||
mio = "0.5.0"
|
||||
rand = "0.3.12"
|
||||
time = "0.1.34"
|
||||
tiny-keccak = "1.0"
|
||||
flate2 = "0.2"
|
||||
rocksdb = "0.3"
|
||||
lazy_static = "0.1"
|
||||
eth-secp256k1 = { git = "https://github.com/arkpar/rust-secp256k1.git" }
|
||||
heapsize = "0.2.0"
|
||||
rust-crypto = "0.2.34"
|
||||
elastic-array = "0.4"
|
||||
heapsize = "0.2"
|
||||
itertools = "0.4"
|
||||
slab = { git = "https://github.com/arkpar/slab.git" }
|
||||
time = "0.1"
|
||||
#interpolate_idents = { git = "https://github.com/SkylerLipthay/interpolate_idents" }
|
||||
evmjit = { path = "rust-evmjit", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
json-tests = { path = "json-tests" }
|
||||
[features]
|
||||
jit = ["evmjit"]
|
||||
evm_debug = []
|
||||
|
@ -1,24 +0,0 @@
|
||||
[package]
|
||||
description = "Ethcore library"
|
||||
homepage = "http://ethcore.io"
|
||||
license = "GPL-3.0"
|
||||
name = "ethcore"
|
||||
version = "0.1.0"
|
||||
authors = ["Ethcore <admin@ethcore.io>"]
|
||||
|
||||
[dependencies]
|
||||
log = "0.3"
|
||||
env_logger = "0.3"
|
||||
ethcore-util = { path = "../ethcore-util" }
|
||||
rustc-serialize = "0.3"
|
||||
flate2 = "0.2"
|
||||
rocksdb = "0.3"
|
||||
heapsize = "0.2.0"
|
||||
rust-crypto = "0.2.34"
|
||||
time = "0.1"
|
||||
#interpolate_idents = { git = "https://github.com/SkylerLipthay/interpolate_idents" }
|
||||
evmjit = { path = "rust-evmjit", optional = true }
|
||||
|
||||
[features]
|
||||
jit = ["evmjit"]
|
||||
evm_debug = []
|
@ -1 +0,0 @@
|
||||
# ethcore
|
@ -1,12 +0,0 @@
|
||||
pub use util::*;
|
||||
pub use basic_types::*;
|
||||
pub use error::*;
|
||||
pub use env_info::*;
|
||||
pub use views::*;
|
||||
pub use builtin::*;
|
||||
pub use header::*;
|
||||
pub use account::*;
|
||||
pub use transaction::*;
|
||||
pub use log_entry::*;
|
||||
pub use receipt::*;
|
||||
pub use action_params::*;
|
@ -1,152 +0,0 @@
|
||||
//! General error types for use in ethcore.
|
||||
|
||||
use util::*;
|
||||
use header::BlockNumber;
|
||||
use basic_types::LogBloom;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub struct Mismatch<T: fmt::Debug> {
|
||||
pub expected: T,
|
||||
pub found: T,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub struct OutOfBounds<T: fmt::Debug> {
|
||||
pub min: Option<T>,
|
||||
pub max: Option<T>,
|
||||
pub found: T,
|
||||
}
|
||||
|
||||
/// Result of executing the transaction.
|
||||
#[derive(PartialEq, Debug)]
|
||||
pub enum ExecutionError {
|
||||
/// Returned when there gas paid for transaction execution is
|
||||
/// lower than base gas required.
|
||||
NotEnoughBaseGas { required: U256, got: U256 },
|
||||
/// Returned when block (gas_used + gas) > gas_limit.
|
||||
///
|
||||
/// If gas =< gas_limit, upstream may try to execute the transaction
|
||||
/// in next block.
|
||||
BlockGasLimitReached { gas_limit: U256, gas_used: U256, gas: U256 },
|
||||
/// Returned when transaction nonce does not match state nonce.
|
||||
InvalidNonce { expected: U256, got: U256 },
|
||||
/// Returned when cost of transaction (value + gas_price * gas) exceeds
|
||||
/// current sender balance.
|
||||
NotEnoughCash { required: U512, got: U512 },
|
||||
/// Returned when internal evm error occurs.
|
||||
Internal
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum TransactionError {
|
||||
InvalidGasLimit(OutOfBounds<U256>),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub enum BlockError {
|
||||
TooManyUncles(OutOfBounds<usize>),
|
||||
UncleWrongGeneration,
|
||||
ExtraDataOutOfBounds(OutOfBounds<usize>),
|
||||
InvalidSealArity(Mismatch<usize>),
|
||||
TooMuchGasUsed(OutOfBounds<U256>),
|
||||
InvalidUnclesHash(Mismatch<H256>),
|
||||
UncleTooOld(OutOfBounds<BlockNumber>),
|
||||
UncleIsBrother(OutOfBounds<BlockNumber>),
|
||||
UncleInChain(H256),
|
||||
UncleParentNotInChain(H256),
|
||||
InvalidStateRoot(Mismatch<H256>),
|
||||
InvalidGasUsed(Mismatch<U256>),
|
||||
InvalidTransactionsRoot(Mismatch<H256>),
|
||||
InvalidDifficulty(Mismatch<U256>),
|
||||
InvalidGasLimit(OutOfBounds<U256>),
|
||||
InvalidReceiptsStateRoot(Mismatch<H256>),
|
||||
InvalidTimestamp(OutOfBounds<u64>),
|
||||
InvalidLogBloom(Mismatch<LogBloom>),
|
||||
InvalidBlockNonce(Mismatch<H256>),
|
||||
InvalidParentHash(Mismatch<H256>),
|
||||
InvalidNumber(OutOfBounds<BlockNumber>),
|
||||
UnknownParent(H256),
|
||||
UnknownUncleParent(H256),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum ImportError {
|
||||
Bad(Option<Error>),
|
||||
AlreadyInChain,
|
||||
AlreadyQueued,
|
||||
}
|
||||
|
||||
impl From<Error> for ImportError {
|
||||
fn from(err: Error) -> ImportError {
|
||||
ImportError::Bad(Some(err))
|
||||
}
|
||||
}
|
||||
|
||||
/// Result of import block operation.
|
||||
pub type ImportResult = Result<(), ImportError>;
|
||||
|
||||
#[derive(Debug)]
|
||||
/// General error type which should be capable of representing all errors in ethcore.
|
||||
pub enum Error {
|
||||
Util(UtilError),
|
||||
Block(BlockError),
|
||||
UnknownEngineName(String),
|
||||
Execution(ExecutionError),
|
||||
Transaction(TransactionError),
|
||||
}
|
||||
|
||||
impl From<TransactionError> for Error {
|
||||
fn from(err: TransactionError) -> Error {
|
||||
Error::Transaction(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<BlockError> for Error {
|
||||
fn from(err: BlockError) -> Error {
|
||||
Error::Block(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ExecutionError> for Error {
|
||||
fn from(err: ExecutionError) -> Error {
|
||||
Error::Execution(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<CryptoError> for Error {
|
||||
fn from(err: CryptoError) -> Error {
|
||||
Error::Util(UtilError::Crypto(err))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<DecoderError> for Error {
|
||||
fn from(err: DecoderError) -> Error {
|
||||
Error::Util(UtilError::Decoder(err))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<UtilError> for Error {
|
||||
fn from(err: UtilError) -> Error {
|
||||
Error::Util(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<IoError> for Error {
|
||||
fn from(err: IoError) -> Error {
|
||||
Error::Util(From::from(err))
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: uncomment below once https://github.com/rust-lang/rust/issues/27336 sorted.
|
||||
/*#![feature(concat_idents)]
|
||||
macro_rules! assimilate {
|
||||
($name:ident) => (
|
||||
impl From<concat_idents!($name, Error)> for Error {
|
||||
fn from(err: concat_idents!($name, Error)) -> Error {
|
||||
Error:: $name (err)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
assimilate!(FromHex);
|
||||
assimilate!(BaseData);*/
|
@ -1,128 +0,0 @@
|
||||
#![feature(cell_extras)]
|
||||
#![feature(augmented_assignments)]
|
||||
#![feature(wrapping)]
|
||||
//#![feature(plugin)]
|
||||
//#![plugin(interpolate_idents)]
|
||||
//! Ethcore's ethereum implementation
|
||||
//!
|
||||
//! ### Rust version
|
||||
//! - beta
|
||||
//! - nightly
|
||||
//!
|
||||
//! ### Supported platforms:
|
||||
//! - OSX
|
||||
//! - Linux/Ubuntu
|
||||
//!
|
||||
//! ### Dependencies:
|
||||
//! - RocksDB 3.13
|
||||
//! - LLVM 3.7 (optional, required for `jit`)
|
||||
//! - evmjit (optional, required for `jit`)
|
||||
//!
|
||||
//! ### Dependencies Installation
|
||||
//!
|
||||
//! - OSX
|
||||
//!
|
||||
//! - rocksdb
|
||||
//! ```bash
|
||||
//! brew install rocksdb
|
||||
//! ```
|
||||
//!
|
||||
//! - llvm
|
||||
//!
|
||||
//! - download llvm 3.7 from http://llvm.org/apt/
|
||||
//!
|
||||
//! ```bash
|
||||
//! cd llvm-3.7.0.src
|
||||
//! mkdir build && cd $_
|
||||
//! cmake -G "Unix Makefiles" .. -DCMAKE_C_FLAGS_RELEASE= -DCMAKE_CXX_FLAGS_RELEASE= -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/llvm/3.7 -DCMAKE_BUILD_TYPE=Release
|
||||
//! make && make install
|
||||
//! ```
|
||||
//! - evmjit
|
||||
//!
|
||||
//! - download from https://github.com/debris/evmjit
|
||||
//!
|
||||
//! ```bash
|
||||
//! cd evmjit
|
||||
//! mkdir build && cd $_
|
||||
//! cmake -DLLVM_DIR=/usr/local/lib/llvm-3.7/share/llvm/cmake ..
|
||||
//! make && make install
|
||||
//! ```
|
||||
//!
|
||||
//! - Linux/Ubuntu
|
||||
//!
|
||||
//! - rocksdb
|
||||
//!
|
||||
//! ```bash
|
||||
//! wget https://github.com/facebook/rocksdb/archive/rocksdb-3.13.tar.gz
|
||||
//! tar xvf rocksdb-3.13.tar.gz && cd rocksdb-rocksdb-3.13 && make shared_lib
|
||||
//! sudo make install
|
||||
//! ```
|
||||
//!
|
||||
//! - llvm
|
||||
//!
|
||||
//! - install using packages from http://llvm.org/apt/
|
||||
//!
|
||||
//! - evmjit
|
||||
//!
|
||||
//! - download from https://github.com/debris/evmjit
|
||||
//!
|
||||
//! ```bash
|
||||
//! cd evmjit
|
||||
//! mkdir build && cd $_
|
||||
//! cmake .. && make
|
||||
//! sudo make install
|
||||
//! sudo ldconfig
|
||||
//! ```
|
||||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
extern crate rustc_serialize;
|
||||
extern crate flate2;
|
||||
extern crate rocksdb;
|
||||
extern crate heapsize;
|
||||
extern crate crypto;
|
||||
extern crate time;
|
||||
extern crate env_logger;
|
||||
#[cfg(feature = "jit" )]
|
||||
extern crate evmjit;
|
||||
#[macro_use]
|
||||
extern crate ethcore_util as util;
|
||||
|
||||
pub mod common;
|
||||
pub mod basic_types;
|
||||
#[macro_use]
|
||||
pub mod evm;
|
||||
pub mod error;
|
||||
pub mod log_entry;
|
||||
pub mod env_info;
|
||||
pub mod pod_account;
|
||||
pub mod pod_state;
|
||||
pub mod account_diff;
|
||||
pub mod state_diff;
|
||||
pub mod engine;
|
||||
pub mod state;
|
||||
pub mod account;
|
||||
pub mod action_params;
|
||||
pub mod header;
|
||||
pub mod transaction;
|
||||
pub mod receipt;
|
||||
pub mod null_engine;
|
||||
pub mod builtin;
|
||||
pub mod spec;
|
||||
pub mod views;
|
||||
pub mod blockchain;
|
||||
pub mod extras;
|
||||
pub mod substate;
|
||||
pub mod service;
|
||||
pub mod executive;
|
||||
pub mod externalities;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
pub mod client;
|
||||
pub mod sync;
|
||||
pub mod block;
|
||||
pub mod verification;
|
||||
pub mod queue;
|
||||
pub mod ethereum;
|
@ -1,57 +1,12 @@
|
||||
pub use standard::*;
|
||||
pub use from_json::*;
|
||||
pub use util::*;
|
||||
pub use basic_types::*;
|
||||
pub use error::*;
|
||||
pub use hash::*;
|
||||
pub use uint::*;
|
||||
pub use bytes::*;
|
||||
pub use vector::*;
|
||||
pub use sha3::*;
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! map {
|
||||
( $( $x:expr => $y:expr ),* ) => {
|
||||
vec![ $( ($x, $y) ),* ].into_iter().collect::<BTreeMap<_, _>>()
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! mapx {
|
||||
( $( $x:expr => $y:expr ),* ) => {
|
||||
vec![ $( ( From::from($x), From::from($y) ) ),* ].into_iter().collect::<BTreeMap<_, _>>()
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! x {
|
||||
( $x:expr ) => {
|
||||
From::from($x)
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! xx {
|
||||
( $x:expr ) => {
|
||||
From::from(From::from($x))
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! flush {
|
||||
($($arg:tt)*) => ($crate::flush(format!("{}", format_args!($($arg)*))));
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! flushln {
|
||||
($fmt:expr) => (flush!(concat!($fmt, "\n")));
|
||||
($fmt:expr, $($arg:tt)*) => (flush!(concat!($fmt, "\n"), $($arg)*));
|
||||
}
|
||||
|
||||
pub fn flush(s: String) {
|
||||
::std::io::stdout().write(s.as_bytes()).unwrap();
|
||||
::std::io::stdout().flush().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_flush() {
|
||||
flushln!("hello_world {:?}", 1);
|
||||
}
|
||||
pub use env_info::*;
|
||||
pub use views::*;
|
||||
pub use builtin::*;
|
||||
pub use header::*;
|
||||
pub use account::*;
|
||||
pub use transaction::*;
|
||||
pub use log_entry::*;
|
||||
pub use receipt::*;
|
||||
pub use action_params::*;
|
152
src/error.rs
152
src/error.rs
@ -1,75 +1,139 @@
|
||||
//! General error types for use in ethcore.
|
||||
|
||||
use rustc_serialize::hex::FromHexError;
|
||||
use network::NetworkError;
|
||||
use rlp::DecoderError;
|
||||
use io;
|
||||
use util::*;
|
||||
use header::BlockNumber;
|
||||
use basic_types::LogBloom;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub struct Mismatch<T: fmt::Debug> {
|
||||
pub expected: T,
|
||||
pub found: T,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub struct OutOfBounds<T: fmt::Debug> {
|
||||
pub min: Option<T>,
|
||||
pub max: Option<T>,
|
||||
pub found: T,
|
||||
}
|
||||
|
||||
/// Result of executing the transaction.
|
||||
#[derive(PartialEq, Debug)]
|
||||
pub enum ExecutionError {
|
||||
/// Returned when there gas paid for transaction execution is
|
||||
/// lower than base gas required.
|
||||
NotEnoughBaseGas { required: U256, got: U256 },
|
||||
/// Returned when block (gas_used + gas) > gas_limit.
|
||||
///
|
||||
/// If gas =< gas_limit, upstream may try to execute the transaction
|
||||
/// in next block.
|
||||
BlockGasLimitReached { gas_limit: U256, gas_used: U256, gas: U256 },
|
||||
/// Returned when transaction nonce does not match state nonce.
|
||||
InvalidNonce { expected: U256, got: U256 },
|
||||
/// Returned when cost of transaction (value + gas_price * gas) exceeds
|
||||
/// current sender balance.
|
||||
NotEnoughCash { required: U512, got: U512 },
|
||||
/// Returned when internal evm error occurs.
|
||||
Internal
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum BaseDataError {
|
||||
NegativelyReferencedHash,
|
||||
pub enum TransactionError {
|
||||
InvalidGasLimit(OutOfBounds<U256>),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub enum BlockError {
|
||||
TooManyUncles(OutOfBounds<usize>),
|
||||
UncleWrongGeneration,
|
||||
ExtraDataOutOfBounds(OutOfBounds<usize>),
|
||||
InvalidSealArity(Mismatch<usize>),
|
||||
TooMuchGasUsed(OutOfBounds<U256>),
|
||||
InvalidUnclesHash(Mismatch<H256>),
|
||||
UncleTooOld(OutOfBounds<BlockNumber>),
|
||||
UncleIsBrother(OutOfBounds<BlockNumber>),
|
||||
UncleInChain(H256),
|
||||
UncleParentNotInChain(H256),
|
||||
InvalidStateRoot(Mismatch<H256>),
|
||||
InvalidGasUsed(Mismatch<U256>),
|
||||
InvalidTransactionsRoot(Mismatch<H256>),
|
||||
InvalidDifficulty(Mismatch<U256>),
|
||||
InvalidGasLimit(OutOfBounds<U256>),
|
||||
InvalidReceiptsStateRoot(Mismatch<H256>),
|
||||
InvalidTimestamp(OutOfBounds<u64>),
|
||||
InvalidLogBloom(Mismatch<LogBloom>),
|
||||
InvalidBlockNonce(Mismatch<H256>),
|
||||
InvalidParentHash(Mismatch<H256>),
|
||||
InvalidNumber(OutOfBounds<BlockNumber>),
|
||||
UnknownParent(H256),
|
||||
UnknownUncleParent(H256),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum ImportError {
|
||||
Bad(Option<Error>),
|
||||
AlreadyInChain,
|
||||
AlreadyQueued,
|
||||
}
|
||||
|
||||
impl From<Error> for ImportError {
|
||||
fn from(err: Error) -> ImportError {
|
||||
ImportError::Bad(Some(err))
|
||||
}
|
||||
}
|
||||
|
||||
/// Result of import block operation.
|
||||
pub type ImportResult = Result<(), ImportError>;
|
||||
|
||||
#[derive(Debug)]
|
||||
/// General error type which should be capable of representing all errors in ethcore.
|
||||
pub enum UtilError {
|
||||
Crypto(::crypto::CryptoError),
|
||||
StdIo(::std::io::Error),
|
||||
Io(io::IoError),
|
||||
AddressParse(::std::net::AddrParseError),
|
||||
AddressResolve(Option<::std::io::Error>),
|
||||
FromHex(FromHexError),
|
||||
BaseData(BaseDataError),
|
||||
Network(NetworkError),
|
||||
Decoder(DecoderError),
|
||||
BadSize,
|
||||
pub enum Error {
|
||||
Util(UtilError),
|
||||
Block(BlockError),
|
||||
UnknownEngineName(String),
|
||||
Execution(ExecutionError),
|
||||
Transaction(TransactionError),
|
||||
}
|
||||
|
||||
impl From<FromHexError> for UtilError {
|
||||
fn from(err: FromHexError) -> UtilError {
|
||||
UtilError::FromHex(err)
|
||||
impl From<TransactionError> for Error {
|
||||
fn from(err: TransactionError) -> Error {
|
||||
Error::Transaction(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<BaseDataError> for UtilError {
|
||||
fn from(err: BaseDataError) -> UtilError {
|
||||
UtilError::BaseData(err)
|
||||
impl From<BlockError> for Error {
|
||||
fn from(err: BlockError) -> Error {
|
||||
Error::Block(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<NetworkError> for UtilError {
|
||||
fn from(err: NetworkError) -> UtilError {
|
||||
UtilError::Network(err)
|
||||
impl From<ExecutionError> for Error {
|
||||
fn from(err: ExecutionError) -> Error {
|
||||
Error::Execution(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<::std::io::Error> for UtilError {
|
||||
fn from(err: ::std::io::Error) -> UtilError {
|
||||
UtilError::StdIo(err)
|
||||
impl From<CryptoError> for Error {
|
||||
fn from(err: CryptoError) -> Error {
|
||||
Error::Util(UtilError::Crypto(err))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<io::IoError> for UtilError {
|
||||
fn from(err: io::IoError) -> UtilError {
|
||||
UtilError::Io(err)
|
||||
impl From<DecoderError> for Error {
|
||||
fn from(err: DecoderError) -> Error {
|
||||
Error::Util(UtilError::Decoder(err))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<::crypto::CryptoError> for UtilError {
|
||||
fn from(err: ::crypto::CryptoError) -> UtilError {
|
||||
UtilError::Crypto(err)
|
||||
impl From<UtilError> for Error {
|
||||
fn from(err: UtilError) -> Error {
|
||||
Error::Util(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<::std::net::AddrParseError> for UtilError {
|
||||
fn from(err: ::std::net::AddrParseError) -> UtilError {
|
||||
UtilError::AddressParse(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<::rlp::DecoderError> for UtilError {
|
||||
fn from(err: ::rlp::DecoderError) -> UtilError {
|
||||
UtilError::Decoder(err)
|
||||
impl From<IoError> for Error {
|
||||
fn from(err: IoError) -> Error {
|
||||
Error::Util(From::from(err))
|
||||
}
|
||||
}
|
||||
|
||||
|
175
src/lib.rs
175
src/lib.rs
@ -1,101 +1,128 @@
|
||||
#![feature(op_assign_traits)]
|
||||
#![feature(cell_extras)]
|
||||
#![feature(augmented_assignments)]
|
||||
#![feature(associated_consts)]
|
||||
#![feature(wrapping)]
|
||||
//! Ethcore-util library
|
||||
//#![feature(plugin)]
|
||||
//#![plugin(interpolate_idents)]
|
||||
//! Ethcore's ethereum implementation
|
||||
//!
|
||||
//! ### Rust version:
|
||||
//! ### Rust version
|
||||
//! - beta
|
||||
//! - nightly
|
||||
//!
|
||||
//! ### Supported platforms:
|
||||
//! - OSX
|
||||
//! - Linux
|
||||
//! - Linux/Ubuntu
|
||||
//!
|
||||
//! ### Dependencies:
|
||||
//! - RocksDB 3.13
|
||||
//! - LLVM 3.7 (optional, required for `jit`)
|
||||
//! - evmjit (optional, required for `jit`)
|
||||
//!
|
||||
//! ### Dependencies Installation:
|
||||
//! ### Dependencies Installation
|
||||
//!
|
||||
//! - OSX:
|
||||
//! - OSX
|
||||
//!
|
||||
//! - rocksdb
|
||||
//! ```bash
|
||||
//! brew install rocksdb
|
||||
//! ```
|
||||
//!
|
||||
//! - From source:
|
||||
//! - llvm
|
||||
//!
|
||||
//! ```bash
|
||||
//! wget https://github.com/facebook/rocksdb/archive/rocksdb-3.13.tar.gz
|
||||
//! tar xvf rocksdb-3.13.tar.gz && cd rocksdb-rocksdb-3.13 && make shared_lib
|
||||
//! sudo make install
|
||||
//! ```
|
||||
//! - download llvm 3.7 from http://llvm.org/apt/
|
||||
//!
|
||||
//! ```bash
|
||||
//! cd llvm-3.7.0.src
|
||||
//! mkdir build && cd $_
|
||||
//! cmake -G "Unix Makefiles" .. -DCMAKE_C_FLAGS_RELEASE= -DCMAKE_CXX_FLAGS_RELEASE= -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/llvm/3.7 -DCMAKE_BUILD_TYPE=Release
|
||||
//! make && make install
|
||||
//! ```
|
||||
//! - evmjit
|
||||
//!
|
||||
//! - download from https://github.com/debris/evmjit
|
||||
//!
|
||||
//! ```bash
|
||||
//! cd evmjit
|
||||
//! mkdir build && cd $_
|
||||
//! cmake -DLLVM_DIR=/usr/local/lib/llvm-3.7/share/llvm/cmake ..
|
||||
//! make && make install
|
||||
//! ```
|
||||
//!
|
||||
//! - Linux/Ubuntu
|
||||
//!
|
||||
//! - rocksdb
|
||||
//!
|
||||
//! ```bash
|
||||
//! wget https://github.com/facebook/rocksdb/archive/rocksdb-3.13.tar.gz
|
||||
//! tar xvf rocksdb-3.13.tar.gz && cd rocksdb-rocksdb-3.13 && make shared_lib
|
||||
//! sudo make install
|
||||
//! ```
|
||||
//!
|
||||
//! - llvm
|
||||
//!
|
||||
//! - install using packages from http://llvm.org/apt/
|
||||
//!
|
||||
//! - evmjit
|
||||
//!
|
||||
//! - download from https://github.com/debris/evmjit
|
||||
//!
|
||||
//! ```bash
|
||||
//! cd evmjit
|
||||
//! mkdir build && cd $_
|
||||
//! cmake .. && make
|
||||
//! sudo make install
|
||||
//! sudo ldconfig
|
||||
//! ```
|
||||
|
||||
extern crate slab;
|
||||
extern crate rustc_serialize;
|
||||
extern crate mio;
|
||||
extern crate rand;
|
||||
extern crate rocksdb;
|
||||
extern crate tiny_keccak;
|
||||
#[macro_use]
|
||||
extern crate heapsize;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
#[macro_use]
|
||||
extern crate itertools;
|
||||
extern crate env_logger;
|
||||
extern crate rustc_serialize;
|
||||
extern crate flate2;
|
||||
extern crate rocksdb;
|
||||
extern crate heapsize;
|
||||
extern crate crypto;
|
||||
extern crate time;
|
||||
extern crate crypto as rcrypto;
|
||||
extern crate secp256k1;
|
||||
extern crate arrayvec;
|
||||
extern crate elastic_array;
|
||||
extern crate env_logger;
|
||||
#[cfg(feature = "jit" )]
|
||||
extern crate evmjit;
|
||||
#[macro_use]
|
||||
extern crate ethcore_util as util;
|
||||
|
||||
pub mod standard;
|
||||
#[macro_use]
|
||||
pub mod from_json;
|
||||
#[macro_use]
|
||||
pub mod common;
|
||||
pub mod basic_types;
|
||||
#[macro_use]
|
||||
pub mod evm;
|
||||
pub mod error;
|
||||
pub mod hash;
|
||||
pub mod uint;
|
||||
pub mod bytes;
|
||||
pub mod rlp;
|
||||
pub mod misc;
|
||||
pub mod json_aid;
|
||||
pub mod vector;
|
||||
pub mod sha3;
|
||||
pub mod hashdb;
|
||||
pub mod memorydb;
|
||||
pub mod overlaydb;
|
||||
pub mod math;
|
||||
pub mod chainfilter;
|
||||
pub mod crypto;
|
||||
pub mod triehash;
|
||||
pub mod trie;
|
||||
pub mod nibbleslice;
|
||||
pub mod heapsizeof;
|
||||
pub mod squeeze;
|
||||
pub mod semantic_version;
|
||||
pub mod io;
|
||||
pub mod network;
|
||||
pub mod log_entry;
|
||||
pub mod env_info;
|
||||
pub mod pod_account;
|
||||
pub mod pod_state;
|
||||
pub mod account_diff;
|
||||
pub mod state_diff;
|
||||
pub mod engine;
|
||||
pub mod state;
|
||||
pub mod account;
|
||||
pub mod action_params;
|
||||
pub mod header;
|
||||
pub mod transaction;
|
||||
pub mod receipt;
|
||||
pub mod null_engine;
|
||||
pub mod builtin;
|
||||
pub mod spec;
|
||||
pub mod views;
|
||||
pub mod blockchain;
|
||||
pub mod extras;
|
||||
pub mod substate;
|
||||
pub mod service;
|
||||
pub mod executive;
|
||||
pub mod externalities;
|
||||
|
||||
pub use common::*;
|
||||
pub use misc::*;
|
||||
pub use json_aid::*;
|
||||
pub use rlp::*;
|
||||
pub use hashdb::*;
|
||||
pub use memorydb::*;
|
||||
pub use overlaydb::*;
|
||||
pub use math::*;
|
||||
pub use chainfilter::*;
|
||||
pub use crypto::*;
|
||||
pub use triehash::*;
|
||||
pub use trie::*;
|
||||
pub use nibbleslice::*;
|
||||
pub use heapsizeof::*;
|
||||
pub use squeeze::*;
|
||||
pub use semantic_version::*;
|
||||
pub use network::*;
|
||||
pub use io::*;
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
pub mod client;
|
||||
pub mod sync;
|
||||
pub mod block;
|
||||
pub mod verification;
|
||||
pub mod queue;
|
||||
pub mod ethereum;
|
||||
|
32
util/Cargo.toml
Normal file
32
util/Cargo.toml
Normal file
@ -0,0 +1,32 @@
|
||||
[package]
|
||||
description = "Ethcore utility library"
|
||||
homepage = "http://ethcore.io"
|
||||
license = "GPL-3.0"
|
||||
name = "ethcore-util"
|
||||
version = "0.1.0"
|
||||
authors = ["Ethcore <admin@ethcore.io>"]
|
||||
build = "build.rs"
|
||||
|
||||
[build-dependencies]
|
||||
gcc = "0.3"
|
||||
|
||||
[dependencies]
|
||||
log = "0.3"
|
||||
env_logger = "0.3"
|
||||
rustc-serialize = "0.3"
|
||||
arrayvec = "0.3"
|
||||
mio = "0.5.0"
|
||||
rand = "0.3.12"
|
||||
time = "0.1.34"
|
||||
tiny-keccak = "1.0"
|
||||
rocksdb = "0.3"
|
||||
lazy_static = "0.1"
|
||||
eth-secp256k1 = { git = "https://github.com/arkpar/rust-secp256k1.git" }
|
||||
rust-crypto = "0.2.34"
|
||||
elastic-array = "0.4"
|
||||
heapsize = "0.2"
|
||||
itertools = "0.4"
|
||||
slab = { git = "https://github.com/arkpar/slab.git" }
|
||||
|
||||
[dev-dependencies]
|
||||
json-tests = { path = "json-tests" }
|
1
util/README.md
Normal file
1
util/README.md
Normal file
@ -0,0 +1 @@
|
||||
# ethcore-util
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user