From 6c10bb32479ebc700b49035222fa3f523a2da84f Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Tue, 2 Feb 2016 03:24:31 -0800 Subject: [PATCH 01/14] local coverage --- cov.sh | 2 +- cov.sh~ | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100755 cov.sh~ diff --git a/cov.sh b/cov.sh index 371746a39..6936d25be 100755 --- a/cov.sh +++ b/cov.sh @@ -17,5 +17,5 @@ fi cargo test --no-run || exit $? mkdir -p target/coverage -kcov --exclude-pattern ~/.multirust,rocksdb,secp256k1 --include-pattern src --verify target/coverage target/debug/ethcore* +kcov --exclude-pattern ~/.multirust,rocksdb,secp256k1 --include-pattern src --verify target/coverage target/debug/deps/ethcore* xdg-open target/coverage/index.html diff --git a/cov.sh~ b/cov.sh~ new file mode 100755 index 000000000..17466d506 --- /dev/null +++ b/cov.sh~ @@ -0,0 +1,21 @@ +#!/bin/sh +# Installing KCOV under ubuntu +# https://users.rust-lang.org/t/tutorial-how-to-collect-test-coverages-for-rust-project/650# +### Install deps +# $ sudo apt-get install libcurl4-openssl-dev libelf-dev libdw-dev cmake gcc binutils-dev libiberty-dev +# +### Compile kcov +# $ wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz && tar xf master.tar.gz +# $ cd kcov-master && mkdir build && cd build +# $ cmake .. && make && sudo make install + +### Running coverage +if ! type kcov > /dev/null; then + echo "Install kcov first (details inside this file). Aborting." + exit 1 +fi + +cargo test --no-run || exit $? +mkdir -p target/coverage +kcov --exclude-pattern ~/.multirust,rocksdb,secp256k1 --include-pattern src --verify target/coverage target/debug/parity* +xdg-open target/coverage/index.html From b119e2cbb1a96b5ab89eca1c55cce68bd98b92c1 Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Tue, 2 Feb 2016 03:26:19 -0800 Subject: [PATCH 02/14] removed trash --- cov.sh~ | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100755 cov.sh~ diff --git a/cov.sh~ b/cov.sh~ deleted file mode 100755 index 17466d506..000000000 --- a/cov.sh~ +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# Installing KCOV under ubuntu -# https://users.rust-lang.org/t/tutorial-how-to-collect-test-coverages-for-rust-project/650# -### Install deps -# $ sudo apt-get install libcurl4-openssl-dev libelf-dev libdw-dev cmake gcc binutils-dev libiberty-dev -# -### Compile kcov -# $ wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz && tar xf master.tar.gz -# $ cd kcov-master && mkdir build && cd build -# $ cmake .. && make && sudo make install - -### Running coverage -if ! type kcov > /dev/null; then - echo "Install kcov first (details inside this file). Aborting." - exit 1 -fi - -cargo test --no-run || exit $? -mkdir -p target/coverage -kcov --exclude-pattern ~/.multirust,rocksdb,secp256k1 --include-pattern src --verify target/coverage target/debug/parity* -xdg-open target/coverage/index.html From 33499fd6984dbcc14e68f19f5b64d7732a3f0a4f Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Tue, 2 Feb 2016 03:32:28 -0800 Subject: [PATCH 03/14] package spec --- cov.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cov.sh b/cov.sh index 6936d25be..a78e36205 100755 --- a/cov.sh +++ b/cov.sh @@ -15,7 +15,7 @@ if ! type kcov > /dev/null; then exit 1 fi -cargo test --no-run || exit $? +cargo test -p ethcore --no-run || exit $? mkdir -p target/coverage kcov --exclude-pattern ~/.multirust,rocksdb,secp256k1 --include-pattern src --verify target/coverage target/debug/deps/ethcore* xdg-open target/coverage/index.html From 70dee5ecc1ddc110676db02af5ae26e17a765958 Mon Sep 17 00:00:00 2001 From: debris Date: Tue, 2 Feb 2016 14:31:12 +0100 Subject: [PATCH 04/14] doc.sh --- doc.sh | 4 ++++ 1 file changed, 4 insertions(+) create mode 100755 doc.sh diff --git a/doc.sh b/doc.sh new file mode 100755 index 000000000..2fd5ac20f --- /dev/null +++ b/doc.sh @@ -0,0 +1,4 @@ +#!/bin/sh +# generate documentation only for partiy and ethcore libraries + +cargo doc --no-deps --verbose -p ethash -p ethcore-util -p ethcore -p ethsync -p ethcore-rpc -p parity From 3f8fdfaea70e978926e96b02dad7c1f09bbfaefe Mon Sep 17 00:00:00 2001 From: Tomusdrw Date: Tue, 2 Feb 2016 14:33:02 +0100 Subject: [PATCH 05/14] Deploying artifacts for releases --- .travis.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.travis.yml b/.travis.yml index 2663d0d8e..7d5ef19eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,6 +30,7 @@ script: - cargo build --release --verbose ${FEATURES} - cargo test --release --verbose ${FEATURES} ${TARGETS} - cargo bench --no-run ${FEATURES} ${TARGETS} +- zip -j target/release/parity parity-${TRAVIS_TAG}.zip after_success: | wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz && tar xzf master.tar.gz && mkdir kcov-master/build && cd kcov-master/build && cmake .. && make && make install DESTDIR=../tmp && cd ../.. && @@ -53,3 +54,12 @@ env: global: - secure: 3sUjNi9mhdL5h1GTm8LONnDN/SYvUHT+WSkMl93h3nYiLCQXk8eZaPS98AS7oOaTsfW4UvnwckVFCFl49ttInsv4cd/TkAxmrJHe6kPyS9/4NWUdmP8BjicbBvL/ioSdXMECMEYzPDLV+I3KhtC2LcB6ceDEl/XwMOJlzbGf7RbtcXGVQgMLqSYY1YKjQA4vbT5nFgIS/sZu3Z9yFgN0GafnihKcizqoHhdJjs/zxmX+qJepnC6o3V6KcFnS7QHhM1JOr85twE6S422UlvNaEb5ovwLPqmOl5+fA+6shbx4AxFTY6E9Iors+OVY/JliFhrqOdCt0i2P1FUHN4kbGZQkf0rphN/ZOI2uKNFTOyXiPvppfo/ZemKmcqkwkqP9+lf5QqYmtE6hsAYagxn49xJZILl8tAYbdqxF5gxa+TEVrfsBFtz/Sv3q8QhKQNPAmjEcKyMatyEreLUIFEpFTGIco8jN4eXeSoLRdJ+Z75ihttfQWhNfUDgNL30iQLy0AgFSsh/cyb5M8y9lxrGDzDTogvaiKGwr/V45sPkcXWCkmOgMdINqBB6ZtdL3bGHdyjmYj+y3btjf3aP11k++BL0fXIaKn25aS/p/9iyGb1FyGCM03o4ZRQ3YhTOvfMRfRGf6nWbaMx9upv8o5ShSdysewhrnh3082r7u896ny1Ho= - secure: 0/FeVvFl3AhBW0TCPoujY9zOAYoUNMlAz3XjC04vlc4Ksfx0lGU3KFi97LlALxMWV0lfwQc7ixSe2vTgQVQuLVSU9XEW40fQgEjJlmLca2RcRx1kfzJDypuWSiCME7MWmLPH0ac4COdTDS1z5WGggv5YB7GQPCzFvcmOOaPYtF29ngCtkyB2HmNkY/W3omHFEk7Si6bsmOSHZiOAhivPl6ixnGpFyTEKPyraMMqPIj5rbEGkzgeLTiXf2ur143n/tnSr8tmP1MfQi9yS8/ONidMqnxUeuLkeNnb82zj9pVJhVXq0xF44WXJ8Za1jm0ByiTakgqpm8Juk822qjvtNulJ1XZW/fyZQZaN1dy3uq5Ud3W8wS9M7VIVl8CoXozzDpIsdPeUAtkAxeHBsZqL1vAH2yC1YJA7HPySMYzCjYqkJ2r62xYk0gXmNXphfU+F/X/rHzHsTMJPONJ54HQwu12m7zVlKIYBGHgEXg/HAM/g4ljUzl6WWR/nHH/tQM8ND/8FpHluJSZJWacq/1QNhVdTq2x6cqws2fs5A7nVpccR9+6RRgYgv6+YS2LxvFzByuZveGGoKif+uMECXN876j40araUqU528Yz9i8bHJlnM3coRBndaLNWByLcUyXCB9r9IUosUu41rr+L2mVzkSDm0GicuNCzqvzYQ9Q6QY4uQ= + +deploy: + provider: releases + api_key: + secure: ATorsRujvWN9y4bZlUdp2I0hvh3pKkpkrr/oyQyt8ZssE7ORx1+lYgTdYocHyx53uBrGFjRQbSCvdDsrs8c1v2Dh2872TmMQMWgLaeeS6bPiNw7WkJuH1hvvTNAiFCfuT9nnntFvMuKcUpBHQ1eeuEU + skip_cleanup: true + file: parity-${TRAVIS_TAG}.zip + on: + tags: true From 25c87d000441be215911cd00df96b12da937160f Mon Sep 17 00:00:00 2001 From: Tomusdrw Date: Tue, 2 Feb 2016 14:43:55 +0100 Subject: [PATCH 06/14] Including OS_NAME in artifact --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7d5ef19eb..37d9eafee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ matrix: fast_finish: true include: - rust: nightly - env: FEATURES="--features ethcore/json-tests" KCOV_FEATURES="" TARGETS="-p ethash -p ethcore-util -p ethcore -p ethsync -p ethcore-rpc -p parity" + env: FEATURES="--features ethcore/json-tests" KCOV_FEATURES="" TARGETS="-p ethash -p ethcore-util -p ethcore -p ethsync -p ethcore-rpc -p parity" ARCHIVE_SUFFIX="-${TRAVIS_OS_NAME}-${TRAVIS_TAG}" cache: apt: true directories: @@ -30,7 +30,7 @@ script: - cargo build --release --verbose ${FEATURES} - cargo test --release --verbose ${FEATURES} ${TARGETS} - cargo bench --no-run ${FEATURES} ${TARGETS} -- zip -j target/release/parity parity-${TRAVIS_TAG}.zip +- zip -j target/release/parity parity${ARCHIVE_SUFFIX}.zip after_success: | wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz && tar xzf master.tar.gz && mkdir kcov-master/build && cd kcov-master/build && cmake .. && make && make install DESTDIR=../tmp && cd ../.. && @@ -60,6 +60,6 @@ deploy: api_key: secure: ATorsRujvWN9y4bZlUdp2I0hvh3pKkpkrr/oyQyt8ZssE7ORx1+lYgTdYocHyx53uBrGFjRQbSCvdDsrs8c1v2Dh2872TmMQMWgLaeeS6bPiNw7WkJuH1hvvTNAiFCfuT9nnntFvMuKcUpBHQ1eeuEU skip_cleanup: true - file: parity-${TRAVIS_TAG}.zip + file: parity${ARCHIVE_SUFFIX}.zip on: tags: true From 8f12989785503d49fa49b053d04d88060f0daba4 Mon Sep 17 00:00:00 2001 From: Tomusdrw Date: Tue, 2 Feb 2016 15:01:18 +0100 Subject: [PATCH 07/14] Changing packaging to tar.gz --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 37d9eafee..d1cefa6ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ script: - cargo build --release --verbose ${FEATURES} - cargo test --release --verbose ${FEATURES} ${TARGETS} - cargo bench --no-run ${FEATURES} ${TARGETS} -- zip -j target/release/parity parity${ARCHIVE_SUFFIX}.zip +- tar cvzf parity${ARCHIVE_SUFFIX}.tar.gz -C target/release parity after_success: | wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz && tar xzf master.tar.gz && mkdir kcov-master/build && cd kcov-master/build && cmake .. && make && make install DESTDIR=../tmp && cd ../.. && @@ -60,6 +60,6 @@ deploy: api_key: secure: ATorsRujvWN9y4bZlUdp2I0hvh3pKkpkrr/oyQyt8ZssE7ORx1+lYgTdYocHyx53uBrGFjRQbSCvdDsrs8c1v2Dh2872TmMQMWgLaeeS6bPiNw7WkJuH1hvvTNAiFCfuT9nnntFvMuKcUpBHQ1eeuEU skip_cleanup: true - file: parity${ARCHIVE_SUFFIX}.zip + file: parity${ARCHIVE_SUFFIX}.tar.gz on: tags: true From 30dc9d857d277b11825c49a5bd7308c3165b0624 Mon Sep 17 00:00:00 2001 From: debris Date: Tue, 2 Feb 2016 15:29:53 +0100 Subject: [PATCH 08/14] cleanup ethcore public interfaces --- ethcore/src/account.rs | 2 + ethcore/src/account_diff.rs | 2 + ethcore/src/basic_types.rs | 2 + ethcore/src/block.rs | 4 +- ethcore/src/blockchain.rs | 2 +- ethcore/src/client.rs | 2 + ethcore/src/evm/factory.rs | 2 - ethcore/src/extras.rs | 2 + ethcore/src/header.rs | 2 + ethcore/src/lib.rs | 193 ++++++++++++++---------------------- ethcore/src/service.rs | 4 +- ethcore/src/spec.rs | 2 + ethcore/src/substate.rs | 3 +- ethcore/src/transaction.rs | 2 + 14 files changed, 98 insertions(+), 126 deletions(-) diff --git a/ethcore/src/account.rs b/ethcore/src/account.rs index 409637d6f..ab7ad1e53 100644 --- a/ethcore/src/account.rs +++ b/ethcore/src/account.rs @@ -1,3 +1,5 @@ +//! Single account in the system. + use util::*; use pod_account::*; diff --git a/ethcore/src/account_diff.rs b/ethcore/src/account_diff.rs index 1843c4381..c349ade84 100644 --- a/ethcore/src/account_diff.rs +++ b/ethcore/src/account_diff.rs @@ -1,3 +1,5 @@ +//! Diff between two accounts. + use util::*; use pod_account::*; diff --git a/ethcore/src/basic_types.rs b/ethcore/src/basic_types.rs index 3d6fc2609..7bab6e7f1 100644 --- a/ethcore/src/basic_types.rs +++ b/ethcore/src/basic_types.rs @@ -1,3 +1,5 @@ +//! Ethcore basic typenames. + use util::*; /// Type for a 2048-bit log-bloom, as used by our blocks. diff --git a/ethcore/src/block.rs b/ethcore/src/block.rs index f8e8ef16f..1977fb406 100644 --- a/ethcore/src/block.rs +++ b/ethcore/src/block.rs @@ -1,3 +1,5 @@ +//! Blockchain block. + #![allow(ptr_arg)] // Because of &LastHashes -> &Vec<_> use common::*; @@ -394,4 +396,4 @@ mod tests { assert_eq!(orig_db.keys(), db.keys()); assert!(orig_db.keys().iter().filter(|k| orig_db.get(k.0) != db.get(k.0)).next() == None); } -} \ No newline at end of file +} diff --git a/ethcore/src/blockchain.rs b/ethcore/src/blockchain.rs index 1dea65ae7..7ad124133 100644 --- a/ethcore/src/blockchain.rs +++ b/ethcore/src/blockchain.rs @@ -1,4 +1,4 @@ -//! Fast access to blockchain data. +//! Blockchain database. use util::*; use rocksdb::{DB, WriteBatch, Writable}; diff --git a/ethcore/src/client.rs b/ethcore/src/client.rs index ee9b658d8..8d1584e32 100644 --- a/ethcore/src/client.rs +++ b/ethcore/src/client.rs @@ -1,3 +1,5 @@ +//! Blockchain database client. + use util::*; use rocksdb::{Options, DB}; use blockchain::{BlockChain, BlockProvider, CacheSize}; diff --git a/ethcore/src/evm/factory.rs b/ethcore/src/evm/factory.rs index 9f76d25ec..cf78a9692 100644 --- a/ethcore/src/evm/factory.rs +++ b/ethcore/src/evm/factory.rs @@ -93,7 +93,6 @@ fn test_create_vm() { } /// Create tests by injecting different VM factories -#[macro_export] macro_rules! evm_test( ($name_test: ident: $name_jit: ident, $name_int: ident) => { #[test] @@ -109,7 +108,6 @@ macro_rules! evm_test( ); /// Create ignored tests by injecting different VM factories -#[macro_export] macro_rules! evm_test_ignore( ($name_test: ident: $name_jit: ident, $name_int: ident) => { #[test] diff --git a/ethcore/src/extras.rs b/ethcore/src/extras.rs index 4459826cc..be5121a2d 100644 --- a/ethcore/src/extras.rs +++ b/ethcore/src/extras.rs @@ -1,3 +1,5 @@ +//! Blockchain DB extras. + use util::*; use header::BlockNumber; use rocksdb::{DB, Writable}; diff --git a/ethcore/src/header.rs b/ethcore/src/header.rs index c6c18bf4b..531ab93f0 100644 --- a/ethcore/src/header.rs +++ b/ethcore/src/header.rs @@ -1,3 +1,5 @@ +//! Block header. + use util::*; use basic_types::*; use time::now_utc; diff --git a/ethcore/src/lib.rs b/ethcore/src/lib.rs index 0652d964e..b4e7655a2 100644 --- a/ethcore/src/lib.rs +++ b/ethcore/src/lib.rs @@ -2,82 +2,66 @@ #![feature(cell_extras)] #![feature(augmented_assignments)] #![feature(plugin)] -//#![plugin(interpolate_idents)] #![plugin(clippy)] #![allow(needless_range_loop, match_bool)] -//! Ethcore's ethereum implementation +//! Ethcore library //! -//! ### Rust version -//! - beta +//! ### Rust version: //! - nightly //! //! ### Supported platforms: //! - OSX -//! - Linux/Ubuntu +//! - Linux //! -//! ### Dependencies: -//! - RocksDB 3.13 -//! - LLVM 3.7 (optional, required for `jit`) -//! - evmjit (optional, required for `jit`) +//! ### Building: //! -//! ### Dependencies Installation +//! - Ubuntu 14.04 and later: //! -//! - OSX -//! -//! - rocksdb //! ```bash -//! brew install rocksdb +//! # install rocksdb +//! add-apt-repository "deb http://ppa.launchpad.net/giskou/librocksdb/ubuntu trusty main" +//! apt-get update +//! apt-get install -y --force-yes librocksdb +//! +//! # install multirust +//! curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sh -s -- --yes +//! +//! # install nightly and make it default +//! multirust update nightly && multirust default nightly +//! +//! # export rust LIBRARY_PATH +//! export LIBRARY_PATH=/usr/local/lib +//! +//! # download and build parity +//! git clone https://github.com/ethcore/parity +//! cd parity +//! cargo build --release //! ``` +//! +//! - OSX: //! -//! - llvm +//! ```bash +//! # install rocksdb && multirust +//! brew update +//! brew install rocksdb +//! brew install multirust //! -//! - download llvm 3.7 from http://llvm.org/apt/ +//! # install nightly and make it default +//! multirust update nightly && multirust default nightly //! -//! ```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 +//! # export rust LIBRARY_PATH +//! export LIBRARY_PATH=/usr/local/lib //! -//! - 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; +//! # download and build parity +//! git clone https://github.com/ethcore/parity +//! cd parity +//! cargo build --release +//! ``` + +#[macro_use] extern crate log; +#[macro_use] extern crate ethcore_util as util; +#[macro_use] extern crate lazy_static; extern crate rustc_serialize; extern crate flate2; extern crate rocksdb; @@ -86,73 +70,42 @@ extern crate crypto; extern crate time; extern crate env_logger; extern crate num_cpus; -#[cfg(feature = "jit" )] -extern crate evmjit; -#[macro_use] -extern crate ethcore_util as util; extern crate crossbeam; -#[macro_use] -extern crate lazy_static; -// NOTE: Add doc parser exception for these pub declarations. +#[cfg(feature = "jit" )] extern crate evmjit; -/// TODO [Gav Wood] Please document me -pub mod common; -/// TODO [Tomusdrw] Please document me -pub mod basic_types; -#[macro_use] -pub mod evm; +pub mod block; +pub mod blockchain; +pub mod client; pub mod error; -/// TODO [Gav Wood] Please document me -pub mod log_entry; -/// TODO [Gav Wood] Please document me -pub mod env_info; -/// TODO [Gav Wood] Please document me -pub mod pod_account; -/// TODO [Gav Wood] Please document me -pub mod pod_state; -/// TODO [Gav Wood] Please document me -pub mod account_diff; -/// TODO [Gav Wood] Please document me -pub mod state_diff; -/// TODO [Gav Wood] Please document me -pub mod engine; -/// TODO [Gav Wood] Please document me -pub mod state; -/// TODO [Gav Wood] Please document me -pub mod account; -pub mod action_params; -/// TODO [debris] Please document me +pub mod ethereum; pub mod header; -/// TODO [Gav Wood] Please document me -pub mod transaction; -/// TODO [Gav Wood] Please document me -pub mod receipt; -/// TODO [Gav Wood] Please document me -pub mod null_engine; -/// TODO [Gav Wood] Please document me -pub mod builtin; -/// TODO [debris] Please document me +pub mod service; pub mod spec; pub mod views; -pub mod blockchain; -/// TODO [Gav Wood] Please document me -pub mod extras; -/// TODO [arkpar] Please document me -pub mod substate; -/// TODO [Gav Wood] Please document me -pub mod service; -pub mod executive; -pub mod externalities; -#[cfg(test)] -mod tests; +mod common; +mod basic_types; +mod evm; +mod log_entry; +mod env_info; +mod pod_account; +mod pod_state; +mod account_diff; +mod state_diff; +mod engine; +mod state; +mod account; +mod action_params; +mod transaction; +mod receipt; +mod null_engine; +mod builtin; +mod extras; +mod substate; +mod executive; +mod externalities; +mod verification; +mod block_queue; -/// TODO [arkpar] Please document me -pub mod client; -/// TODO [arkpar] Please document me -pub mod block; -/// TODO [arkpar] Please document me -pub mod verification; -pub mod block_queue; -pub mod ethereum; +#[cfg(test)] mod tests; diff --git a/ethcore/src/service.rs b/ethcore/src/service.rs index f24758abb..e12fc249f 100644 --- a/ethcore/src/service.rs +++ b/ethcore/src/service.rs @@ -1,3 +1,5 @@ +//! Creates and registers client and network services. + use util::*; use spec::Spec; use error::*; @@ -109,4 +111,4 @@ mod tests { let service = ClientService::start(spec, NetworkConfiguration::new()); assert!(service.is_ok()); } -} \ No newline at end of file +} diff --git a/ethcore/src/spec.rs b/ethcore/src/spec.rs index d51246b23..ed8b2dd8f 100644 --- a/ethcore/src/spec.rs +++ b/ethcore/src/spec.rs @@ -1,3 +1,5 @@ +//! Parameters for a block chain. + use common::*; use flate2::read::GzDecoder; use engine::*; diff --git a/ethcore/src/substate.rs b/ethcore/src/substate.rs index 73ba267cd..182cef93b 100644 --- a/ethcore/src/substate.rs +++ b/ethcore/src/substate.rs @@ -1,3 +1,4 @@ +//! Execution environment substate. use common::*; /// State changes which should be applied in finalize, @@ -57,4 +58,4 @@ mod tests { assert_eq!(sub_state.sstore_clears_count, x!(12)); assert_eq!(sub_state.suicides.len(), 1); } -} \ No newline at end of file +} diff --git a/ethcore/src/transaction.rs b/ethcore/src/transaction.rs index 24b617f67..18aa07c57 100644 --- a/ethcore/src/transaction.rs +++ b/ethcore/src/transaction.rs @@ -1,3 +1,5 @@ +//! Transaction data structure. + use util::*; use basic_types::*; use error::*; From cb98cbcd4b13dca3db5ff88b7b63bfb48e80209c Mon Sep 17 00:00:00 2001 From: debris Date: Tue, 2 Feb 2016 15:55:44 +0100 Subject: [PATCH 09/14] ethcore public interface cleanup --- ethcore/src/evm/evm.rs | 1 + ethcore/src/evm/factory.rs | 7 +++++++ ethcore/src/executive.rs | 2 +- ethcore/src/lib.rs | 2 +- ethcore/src/log_entry.rs | 15 --------------- ethcore/src/transaction.rs | 25 ++++++------------------- 6 files changed, 16 insertions(+), 36 deletions(-) diff --git a/ethcore/src/evm/evm.rs b/ethcore/src/evm/evm.rs index b90ea5f97..b74cb3140 100644 --- a/ethcore/src/evm/evm.rs +++ b/ethcore/src/evm/evm.rs @@ -44,6 +44,7 @@ pub enum Error { }, /// Returned on evm internal error. Should never be ignored during development. /// Likely to cause consensus issues. + #[allow(dead_code)] // created only by jit Internal, } diff --git a/ethcore/src/evm/factory.rs b/ethcore/src/evm/factory.rs index cf78a9692..a113f7f4b 100644 --- a/ethcore/src/evm/factory.rs +++ b/ethcore/src/evm/factory.rs @@ -1,4 +1,6 @@ //! Evm factory. +//! +//! TODO: consider spliting it into two separate files. use std::fmt; use evm::Evm; @@ -6,6 +8,7 @@ use evm::Evm; /// TODO [Tomusdrw] Please document me pub enum VMType { /// TODO [Tomusdrw] Please document me + #[allow(dead_code)] // crated only by jit Jit, /// TODO [Tomusdrw] Please document me Interpreter @@ -20,6 +23,7 @@ impl fmt::Display for VMType { } } +#[cfg(test)] impl VMType { /// Return all possible VMs (JIT, Interpreter) #[cfg(feature="jit")] @@ -53,6 +57,7 @@ impl Factory { } /// Create new instance of specific `VMType` factory + #[cfg(test)] pub fn new(evm: VMType) -> Factory { Factory { evm: evm @@ -93,6 +98,7 @@ fn test_create_vm() { } /// Create tests by injecting different VM factories +#[macro_export] macro_rules! evm_test( ($name_test: ident: $name_jit: ident, $name_int: ident) => { #[test] @@ -108,6 +114,7 @@ macro_rules! evm_test( ); /// Create ignored tests by injecting different VM factories +#[macro_export] macro_rules! evm_test_ignore( ($name_test: ident: $name_jit: ident, $name_int: ident) => { #[test] diff --git a/ethcore/src/executive.rs b/ethcore/src/executive.rs index d824ccc2c..1471bdca3 100644 --- a/ethcore/src/executive.rs +++ b/ethcore/src/executive.rs @@ -129,7 +129,7 @@ impl<'a> Executive<'a> { let mut substate = Substate::new(); - let res = match *t.action() { + let res = match t.action { Action::Create => { let new_address = contract_address(&sender, &nonce); let params = ActionParams { diff --git a/ethcore/src/lib.rs b/ethcore/src/lib.rs index b4e7655a2..fcaabac55 100644 --- a/ethcore/src/lib.rs +++ b/ethcore/src/lib.rs @@ -86,7 +86,7 @@ pub mod views; mod common; mod basic_types; -mod evm; +#[macro_use] mod evm; mod log_entry; mod env_info; mod pod_account; diff --git a/ethcore/src/log_entry.rs b/ethcore/src/log_entry.rs index 8141549a3..165c6985e 100644 --- a/ethcore/src/log_entry.rs +++ b/ethcore/src/log_entry.rs @@ -31,21 +31,6 @@ impl LogEntry { } } - /// Returns reference to address. - pub fn address(&self) -> &Address { - &self.address - } - - /// Returns reference to topics. - pub fn topics(&self) -> &Vec { - &self.topics - } - - /// Returns reference to data. - pub fn data(&self) -> &Bytes { - &self.data - } - /// Calculates the bloom of this log entry. pub fn bloom(&self) -> LogBloom { self.topics.iter().fold(LogBloom::from_bloomed(&self.address.sha3()), |b, t| b.with_bloomed(&t.sha3())) diff --git a/ethcore/src/transaction.rs b/ethcore/src/transaction.rs index 18aa07c57..61c17a755 100644 --- a/ethcore/src/transaction.rs +++ b/ethcore/src/transaction.rs @@ -22,17 +22,17 @@ impl Default for Action { /// or contract creation operation. #[derive(Default, Debug, Clone)] pub struct Transaction { - /// TODO [debris] Please document me + /// Nonce. pub nonce: U256, - /// TODO [debris] Please document me + /// Gas price. pub gas_price: U256, - /// TODO [debris] Please document me + /// Gas paid up front for transaction execution. pub gas: U256, - /// TODO [debris] Please document me + /// Action, can be either call or contract create. pub action: Action, - /// TODO [debris] Please document me + /// Transfered value. pub value: U256, - /// TODO [Gav Wood] Please document me + /// Transaction data. pub data: Bytes, // signature @@ -98,19 +98,6 @@ impl Transaction { } } - /// Get the nonce of the transaction. - pub fn nonce(&self) -> &U256 { &self.nonce } - /// Get the gas price of the transaction. - pub fn gas_price(&self) -> &U256 { &self.gas_price } - /// Get the gas of the transaction. - pub fn gas(&self) -> &U256 { &self.gas } - /// Get the action of the transaction (Create or Call). - pub fn action(&self) -> &Action { &self.action } - /// Get the value of the transaction. - pub fn value(&self) -> &U256 { &self.value } - /// Get the data of the transaction. - pub fn data(&self) -> &Bytes { &self.data } - /// Append object into RLP stream, optionally with or without the signature. pub fn rlp_append_opt(&self, s: &mut RlpStream, with_seal: Seal) { s.begin_list(6 + match with_seal { Seal::With => 3, _ => 0 }); From 8ea7331d2b667e717ea16f4774e69674111f53af Mon Sep 17 00:00:00 2001 From: Tomusdrw Date: Tue, 2 Feb 2016 16:13:42 +0100 Subject: [PATCH 10/14] Building beta-* and stable-* tags --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index d1cefa6ba..899174b5a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,8 @@ language: rust branches: only: - master + - /^beta-.*$/ + - /^stable-.*$/ matrix: fast_finish: true include: From a1cedaa994816cdfbbd16e226a15ab8466919a49 Mon Sep 17 00:00:00 2001 From: debris Date: Tue, 2 Feb 2016 16:24:37 +0100 Subject: [PATCH 11/14] ethcore block and blockchain module fixes --- ethcore/src/block.rs | 13 ++++++------- ethcore/src/blockchain.rs | 22 ++++++++-------------- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/ethcore/src/block.rs b/ethcore/src/block.rs index 1977fb406..a2de89d13 100644 --- a/ethcore/src/block.rs +++ b/ethcore/src/block.rs @@ -20,7 +20,7 @@ pub struct Block { } impl Block { - /// Returns true iff the given bytes form a valid encoding of a block in RLP. + /// Returns true if the given bytes form a valid encoding of a block in RLP. // TODO: implement Decoder for this and have this use that. pub fn is_good(b: &[u8]) -> bool { /* @@ -73,16 +73,15 @@ pub struct ExecutedBlock { /// A set of references to `ExecutedBlock` fields that are publicly accessible. pub struct BlockRefMut<'a> { - /// TODO [Gav Wood] Please document me + /// Block header. pub header: &'a Header, - /// TODO [Gav Wood] Please document me + /// Block transactions. pub transactions: &'a Vec, - /// TODO [Gav Wood] Please document me + /// Block uncles. pub uncles: &'a Vec
, - - /// TODO [Gav Wood] Please document me + /// Transaction receipts. pub receipts: &'a Vec, - /// TODO [Gav Wood] Please document me + /// State. pub state: &'a mut State, } diff --git a/ethcore/src/blockchain.rs b/ethcore/src/blockchain.rs index 7ad124133..e2ed54c19 100644 --- a/ethcore/src/blockchain.rs +++ b/ethcore/src/blockchain.rs @@ -8,33 +8,27 @@ use transaction::*; use views::*; /// Represents a tree route between `from` block and `to` block: -/// -/// - `blocks` - a vector of hashes of all blocks, ordered from `from` to `to`. -/// -/// - `ancestor` - best common ancestor of these blocks. -/// -/// - `index` - an index where best common ancestor would be. pub struct TreeRoute { - /// TODO [debris] Please document me + /// A vector of hashes of all blocks, ordered from `from` to `to`. pub blocks: Vec, - /// TODO [debris] Please document me + /// Best common ancestor of these blocks. pub ancestor: H256, - /// TODO [debris] Please document me + /// An index where best common ancestor would be. pub index: usize } /// Represents blockchain's in-memory cache size in bytes. #[derive(Debug)] pub struct CacheSize { - /// TODO [debris] Please document me + /// Blocks cache size. pub blocks: usize, - /// TODO [debris] Please document me + /// BlockDetails cache size. pub block_details: usize, - /// TODO [debris] Please document me + /// Transaction addresses cache size. pub transaction_addresses: usize, - /// TODO [debris] Please document me + /// Logs cache size. pub block_logs: usize, - /// TODO [debris] Please document me + /// Blooms cache size. pub blocks_blooms: usize } From e9a516e4dcc377191e7973f00e99a6a322cbec93 Mon Sep 17 00:00:00 2001 From: debris Date: Tue, 2 Feb 2016 16:27:37 +0100 Subject: [PATCH 12/14] make ethcore block_queue module public --- ethcore/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethcore/src/lib.rs b/ethcore/src/lib.rs index fcaabac55..32792fe34 100644 --- a/ethcore/src/lib.rs +++ b/ethcore/src/lib.rs @@ -76,6 +76,7 @@ extern crate crossbeam; pub mod block; pub mod blockchain; +pub mod block_queue; pub mod client; pub mod error; pub mod ethereum; @@ -106,6 +107,5 @@ mod substate; mod executive; mod externalities; mod verification; -mod block_queue; #[cfg(test)] mod tests; From 38dfa18e8ccd805a43bd0b6d89735ad43bd32137 Mon Sep 17 00:00:00 2001 From: debris Date: Tue, 2 Feb 2016 16:35:11 +0100 Subject: [PATCH 13/14] gzip64res_to_json is no longer public --- ethcore/src/spec.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethcore/src/spec.rs b/ethcore/src/spec.rs index ed8b2dd8f..72da929ce 100644 --- a/ethcore/src/spec.rs +++ b/ethcore/src/spec.rs @@ -7,7 +7,7 @@ use pod_state::*; use null_engine::*; /// Converts file from base64 gzipped bytes to json -pub fn gzip64res_to_json(source: &[u8]) -> Json { +fn gzip64res_to_json(source: &[u8]) -> Json { // there is probably no need to store genesis in based64 gzip, // but that's what go does, and it was easy to load it this way let data = source.from_base64().expect("Genesis block is malformed!"); From 1260a4c36d516c63c67cb6f9056f9c0ed5611102 Mon Sep 17 00:00:00 2001 From: Tomusdrw Date: Tue, 2 Feb 2016 17:37:37 +0100 Subject: [PATCH 14/14] Replacing secure token for deployment --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 899174b5a..fff7c94ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -60,7 +60,7 @@ env: deploy: provider: releases api_key: - secure: ATorsRujvWN9y4bZlUdp2I0hvh3pKkpkrr/oyQyt8ZssE7ORx1+lYgTdYocHyx53uBrGFjRQbSCvdDsrs8c1v2Dh2872TmMQMWgLaeeS6bPiNw7WkJuH1hvvTNAiFCfuT9nnntFvMuKcUpBHQ1eeuEU + secure: 3sUjNi9mhdL5h1GTm8LONnDN/SYvUHT+WSkMl93h3nYiLCQXk8eZaPS98AS7oOaTsfW4UvnwckVFCFl49ttInsv4cd/TkAxmrJHe6kPyS9/4NWUdmP8BjicbBvL/ioSdXMECMEYzPDLV+I3KhtC2LcB6ceDEl/XwMOJlzbGf7RbtcXGVQgMLqSYY1YKjQA4vbT5nFgIS/sZu3Z9yFgN0GafnihKcizqoHhdJjs/zxmX+qJepnC6o3V6KcFnS7QHhM1JOr85twE6S422UlvNaEb5ovwLPqmOl5+fA+6shbx4AxFTY6E9Iors+OVY/JliFhrqOdCt0i2P1FUHN4kbGZQkf0rphN/ZOI2uKNFTOyXiPvppfo/ZemKmcqkwkqP9+lf5QqYmtE6hsAYagxn49xJZILl8tAYbdqxF5gxa+TEVrfsBFtz/Sv3q8QhKQNPAmjEcKyMatyEreLUIFEpFTGIco8jN4eXeSoLRdJ+Z75ihttfQWhNfUDgNL30iQLy0AgFSsh/cyb5M8y9lxrGDzDTogvaiKGwr/V45sPkcXWCkmOgMdINqBB6ZtdL3bGHdyjmYj+y3btjf3aP11k++BL0fXIaKn25aS/p/9iyGb1FyGCM03o4ZRQ3YhTOvfMRfRGf6nWbaMx9upv8o5ShSdysewhrnh3082r7u896ny1Ho= skip_cleanup: true file: parity${ARCHIVE_SUFFIX}.tar.gz on: