From 691c4a740f90825e969e2a0e179c95df3e8a12d9 Mon Sep 17 00:00:00 2001 From: debris Date: Sun, 31 Jan 2016 18:46:37 +0100 Subject: [PATCH 01/20] check if util coverage is working --- .travis.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6b75fd98e..4d9907c73 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,8 @@ matrix: cache: apt: true directories: + - target/debug/deps + - target/debug/build - target/release/deps - target/release/build addons: @@ -30,8 +32,10 @@ script: 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 ../.. && - ls target/release && - ./kcov-master/tmp/usr/local/bin/kcov --coveralls-id=${COVERALLS_TOKEN} --exclude-pattern=/.cargo --include-pattern=ethcore/src target/kcov target/release/deps/ethcore-* && + cargo test --no-run -p ethcore-util && + cargo test --no-run && + kcov --exclude-pattern /.cargo,/root/.multirust --include-pattern util/src target/kcov target/debug/deps/ethcore_util-* && + kcov --coveralls-id=${COVERALLS_TOKEN} --exclude-pattern /.cargo,/root/.multirust --include-pattern parity target/kcov target/debug/parity-* [ $TRAVIS_BRANCH = master ] && [ $TRAVIS_PULL_REQUEST = false ] && [ $TRAVIS_RUST_VERSION = nightly ] && From 5f73059ee6fd483d900279bcc2c671f8bb19fe26 Mon Sep 17 00:00:00 2001 From: debris Date: Sun, 31 Jan 2016 19:07:25 +0100 Subject: [PATCH 02/20] fixed path to kcov --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4d9907c73..477e8be7a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,8 +34,8 @@ after_success: | tar xzf master.tar.gz && mkdir kcov-master/build && cd kcov-master/build && cmake .. && make && make install DESTDIR=../tmp && cd ../.. && cargo test --no-run -p ethcore-util && cargo test --no-run && - kcov --exclude-pattern /.cargo,/root/.multirust --include-pattern util/src target/kcov target/debug/deps/ethcore_util-* && - kcov --coveralls-id=${COVERALLS_TOKEN} --exclude-pattern /.cargo,/root/.multirust --include-pattern parity target/kcov target/debug/parity-* + ./kcov-master/tmp/usr/local/bin/kcov --exclude-pattern /.cargo,/root/.multirust --include-pattern util/src target/kcov target/debug/deps/ethcore_util-* && + ./kcov-master/tmp/usr/local/bin/kcov --coveralls-id=${COVERALLS_TOKEN} --exclude-pattern /.cargo,/root/.multirust --include-pattern parity target/kcov target/debug/parity-* [ $TRAVIS_BRANCH = master ] && [ $TRAVIS_PULL_REQUEST = false ] && [ $TRAVIS_RUST_VERSION = nightly ] && From bd7ef539b611d795a3607f79caff31553173f155 Mon Sep 17 00:00:00 2001 From: debris Date: Sun, 31 Jan 2016 19:32:05 +0100 Subject: [PATCH 03/20] fixed kcov source code paths --- .travis.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 477e8be7a..e20372ed7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,9 +33,13 @@ 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 ../.. && cargo test --no-run -p ethcore-util && + cargo test --no-run -p ethash && + cargo test --no-run -p ethcore && cargo test --no-run && - ./kcov-master/tmp/usr/local/bin/kcov --exclude-pattern /.cargo,/root/.multirust --include-pattern util/src target/kcov target/debug/deps/ethcore_util-* && - ./kcov-master/tmp/usr/local/bin/kcov --coveralls-id=${COVERALLS_TOKEN} --exclude-pattern /.cargo,/root/.multirust --include-pattern parity target/kcov target/debug/parity-* + ./kcov-master/tmp/usr/local/bin/kcov --exclude-pattern /.cargo,/root/.multirust target/kcov target/debug/deps/ethcore_util-* && + ./kcov-master/tmp/usr/local/bin/kcov --exclude-pattern /.cargo,/root/.multirust target/kcov target/debug/deps/ethash-* && + ./kcov-master/tmp/usr/local/bin/kcov --exclude-pattern /.cargo,/root/.multirust target/kcov target/debug/deps/ethcore-* && + ./kcov-master/tmp/usr/local/bin/kcov --exclude-pattern /.cargo,/root/.multirust target/kcov target/debug/parity-* --coveralls-id=${COVERALLS_TOKEN} [ $TRAVIS_BRANCH = master ] && [ $TRAVIS_PULL_REQUEST = false ] && [ $TRAVIS_RUST_VERSION = nightly ] && From 1a69b3861dd3657a919e0e3774391e052f410148 Mon Sep 17 00:00:00 2001 From: debris Date: Sun, 31 Jan 2016 20:14:27 +0100 Subject: [PATCH 04/20] make json tests optional --- .travis.yml | 2 +- ethcore/Cargo.toml | 2 ++ ethcore/src/tests/test_common.rs | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e20372ed7..ebb88ee7d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,7 @@ after_success: | tar xzf master.tar.gz && mkdir kcov-master/build && cd kcov-master/build && cmake .. && make && make install DESTDIR=../tmp && cd ../.. && cargo test --no-run -p ethcore-util && cargo test --no-run -p ethash && - cargo test --no-run -p ethcore && + cargo test --no-run -p ethcore --no-default-features && cargo test --no-run && ./kcov-master/tmp/usr/local/bin/kcov --exclude-pattern /.cargo,/root/.multirust target/kcov target/debug/deps/ethcore_util-* && ./kcov-master/tmp/usr/local/bin/kcov --exclude-pattern /.cargo,/root/.multirust target/kcov target/debug/deps/ethash-* && diff --git a/ethcore/Cargo.toml b/ethcore/Cargo.toml index ef8111272..c4eff8d05 100644 --- a/ethcore/Cargo.toml +++ b/ethcore/Cargo.toml @@ -25,6 +25,8 @@ crossbeam = "0.1.5" lazy_static = "0.1" [features] +default = ["json-tests"] jit = ["evmjit"] evm_debug = [] +json-tests = [] test-heavy = [] diff --git a/ethcore/src/tests/test_common.rs b/ethcore/src/tests/test_common.rs index 87e7b979e..fd88ae96a 100644 --- a/ethcore/src/tests/test_common.rs +++ b/ethcore/src/tests/test_common.rs @@ -12,6 +12,7 @@ macro_rules! declare_test { #[ignore] #[test] #[allow(non_snake_case)] + #[cfg(feature="json-tests")] fn $id() { test!($name); } @@ -20,6 +21,7 @@ macro_rules! declare_test { #[cfg(feature = "test-heavy")] #[test] #[allow(non_snake_case)] + #[cfg(feature="json-tests")] fn $id() { test!($name); } @@ -27,6 +29,7 @@ macro_rules! declare_test { ($id: ident, $name: expr) => { #[test] #[allow(non_snake_case)] + #[cfg(feature="json-tests")] fn $id() { test!($name); } From f07b514a170bef89ca4e2604672355870016c168 Mon Sep 17 00:00:00 2001 From: debris Date: Sun, 31 Jan 2016 20:38:58 +0100 Subject: [PATCH 05/20] disable json tests for coverage --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index ebb88ee7d..553b64586 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,12 +33,12 @@ 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 ../.. && cargo test --no-run -p ethcore-util && - cargo test --no-run -p ethash && - cargo test --no-run -p ethcore --no-default-features && - cargo test --no-run && ./kcov-master/tmp/usr/local/bin/kcov --exclude-pattern /.cargo,/root/.multirust target/kcov target/debug/deps/ethcore_util-* && + cargo test --no-run -p ethash && ./kcov-master/tmp/usr/local/bin/kcov --exclude-pattern /.cargo,/root/.multirust target/kcov target/debug/deps/ethash-* && + cargo test --no-run -p ethcore --no-default-features && ./kcov-master/tmp/usr/local/bin/kcov --exclude-pattern /.cargo,/root/.multirust target/kcov target/debug/deps/ethcore-* && + cargo test --no-run && ./kcov-master/tmp/usr/local/bin/kcov --exclude-pattern /.cargo,/root/.multirust target/kcov target/debug/parity-* --coveralls-id=${COVERALLS_TOKEN} [ $TRAVIS_BRANCH = master ] && [ $TRAVIS_PULL_REQUEST = false ] && From e3ce813425dccb6ec0cc629407aa8c4fb5bb7a51 Mon Sep 17 00:00:00 2001 From: debris Date: Sun, 31 Jan 2016 20:41:41 +0100 Subject: [PATCH 06/20] fixed kcov params order --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 553b64586..d2bfdd0db 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,7 +39,7 @@ after_success: | cargo test --no-run -p ethcore --no-default-features && ./kcov-master/tmp/usr/local/bin/kcov --exclude-pattern /.cargo,/root/.multirust target/kcov target/debug/deps/ethcore-* && cargo test --no-run && - ./kcov-master/tmp/usr/local/bin/kcov --exclude-pattern /.cargo,/root/.multirust target/kcov target/debug/parity-* --coveralls-id=${COVERALLS_TOKEN} + ./kcov-master/tmp/usr/local/bin/kcov --coveralls-id=${COVERALLS_TOKEN} --exclude-pattern /.cargo,/root/.multirust target/kcov target/debug/parity-* [ $TRAVIS_BRANCH = master ] && [ $TRAVIS_PULL_REQUEST = false ] && [ $TRAVIS_RUST_VERSION = nightly ] && From 0254b36dc17ee5e727f97c91b1fb2d4cdafb7f21 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 31 Jan 2016 22:47:24 +0100 Subject: [PATCH 07/20] Fix CALLDATACOPY (and bonus CODECOPY, too!). Fixes #269 Fixes #270 Also fix evm debug feature. --- ethcore/Cargo.toml | 2 +- ethcore/src/evm/interpreter.rs | 35 ++++++++++++++++++++-------------- ethcore/src/tests/state.rs | 8 +++++--- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/ethcore/Cargo.toml b/ethcore/Cargo.toml index ef8111272..92236bd93 100644 --- a/ethcore/Cargo.toml +++ b/ethcore/Cargo.toml @@ -26,5 +26,5 @@ lazy_static = "0.1" [features] jit = ["evmjit"] -evm_debug = [] +evm-debug = [] test-heavy = [] diff --git a/ethcore/src/evm/interpreter.rs b/ethcore/src/evm/interpreter.rs index 7657b1bbe..f55b94adb 100644 --- a/ethcore/src/evm/interpreter.rs +++ b/ethcore/src/evm/interpreter.rs @@ -791,23 +791,30 @@ impl Interpreter { Ok(InstructionResult::Ok) } - fn copy_data_to_memory(&self, - mem: &mut Memory, - stack: &mut Stack, - data: &[u8]) { - let offset = stack.pop_back(); - let index = stack.pop_back(); + fn copy_data_to_memory(&self, mem: &mut Memory, stack: &mut Stack, data: &[u8]) { + let dest_offset = stack.pop_back(); + let source_offset = stack.pop_back(); let size = stack.pop_back(); - let data_size = data.len(); + let source_size = U256::from(data.len()); - if index < U256::from(data_size) { - let u_index = index.low_u64() as usize; - let bound_size = match size + index > U256::from(data_size) { - true => data_size, - false => size.low_u64() as usize + u_index - }; + let output_end = match source_offset > source_size || size > source_size || source_offset + size > source_size { + true => { + let zero_slice = if source_offset > source_size { + mem.writeable_slice(dest_offset, size) + } else { + mem.writeable_slice(dest_offset + source_size - source_offset, source_offset + size - source_size) + }; + for i in zero_slice.iter_mut() { + *i = 0; + } + data.len() + }, + false => (size.low_u64() + source_offset.low_u64()) as usize + }; - mem.write_slice(offset, &data[u_index..bound_size]); + if source_offset < source_size { + let output_begin = source_offset.low_u64() as usize; + mem.write_slice(dest_offset, &data[output_begin..output_end]); } } diff --git a/ethcore/src/tests/state.rs b/ethcore/src/tests/state.rs index 1956ed91f..a39953199 100644 --- a/ethcore/src/tests/state.rs +++ b/ethcore/src/tests/state.rs @@ -84,7 +84,7 @@ pub fn json_chain_test(json_data: &[u8], era: ChainEra) -> Vec { declare_test!{StateTests_stBlockHashTest, "StateTests/stBlockHashTest"} declare_test!{StateTests_stCallCodes, "StateTests/stCallCodes"} -//declare_test!{StateTests_stCallCreateCallCodeTest, "StateTests/stCallCreateCallCodeTest"} +declare_test!{StateTests_stCallCreateCallCodeTest, "StateTests/stCallCreateCallCodeTest"} declare_test!{StateTests_stDelegatecallTest, "StateTests/stDelegatecallTest"} declare_test!{StateTests_stExample, "StateTests/stExample"} declare_test!{StateTests_stInitCodeTest, "StateTests/stInitCodeTest"} @@ -297,7 +297,8 @@ declare_test!{StateTests_RandomTests_st201503181357CPPJIT, "StateTests/RandomTes declare_test!{StateTests_RandomTests_st201503181358CPPJIT, "StateTests/RandomTests/st201503181358CPPJIT"} declare_test!{StateTests_RandomTests_st201503181358GO, "StateTests/RandomTests/st201503181358GO"} declare_test!{StateTests_RandomTests_st201503181359GO, "StateTests/RandomTests/st201503181359GO"} -//declare_test!{StateTests_RandomTests_st201503181402CPPJIT, "StateTests/RandomTests/st201503181402CPPJIT"} +declare_test!{StateTests_RandomTests_st201503181402CPPJIT, "StateTests/RandomTests/st201503181402CPPJIT"} +// ^^^ BROKEN ^^^ declare_test!{StateTests_RandomTests_st201503181403GO, "StateTests/RandomTests/st201503181403GO"} declare_test!{StateTests_RandomTests_st201503181406CPPJIT, "StateTests/RandomTests/st201503181406CPPJIT"} declare_test!{StateTests_RandomTests_st201503181406GO, "StateTests/RandomTests/st201503181406GO"} @@ -569,7 +570,8 @@ declare_test!{StateTests_RandomTests_st201503181929GO, "StateTests/RandomTests/s declare_test!{StateTests_RandomTests_st201503181931CPPJIT, "StateTests/RandomTests/st201503181931CPPJIT"} declare_test!{StateTests_RandomTests_st201503181931GO, "StateTests/RandomTests/st201503181931GO"} declare_test!{StateTests_RandomTests_st201503181931PYTHON, "StateTests/RandomTests/st201503181931PYTHON"} -//declare_test!{StateTests_RandomTests_st201503191646GO, "StateTests/RandomTests/st201503191646GO"} +declare_test!{StateTests_RandomTests_st201503191646GO, "StateTests/RandomTests/st201503191646GO"} +// ^^^ BROKEN ^^^ declare_test!{StateTests_RandomTests_st201503200837JS, "StateTests/RandomTests/st201503200837JS"} declare_test!{StateTests_RandomTests_st201503200838JS, "StateTests/RandomTests/st201503200838JS"} declare_test!{StateTests_RandomTests_st201503200841JS, "StateTests/RandomTests/st201503200841JS"} From 5ef9e9d55ffe81065843dce6eddf0bb02cc38c82 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 31 Jan 2016 23:48:13 +0100 Subject: [PATCH 08/20] Remove invalid comments. Reorder Stage 4 verification to check easier things first. --- ethcore/src/tests/state.rs | 2 -- ethcore/src/verification.rs | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/ethcore/src/tests/state.rs b/ethcore/src/tests/state.rs index a39953199..947782e8f 100644 --- a/ethcore/src/tests/state.rs +++ b/ethcore/src/tests/state.rs @@ -298,7 +298,6 @@ declare_test!{StateTests_RandomTests_st201503181358CPPJIT, "StateTests/RandomTes declare_test!{StateTests_RandomTests_st201503181358GO, "StateTests/RandomTests/st201503181358GO"} declare_test!{StateTests_RandomTests_st201503181359GO, "StateTests/RandomTests/st201503181359GO"} declare_test!{StateTests_RandomTests_st201503181402CPPJIT, "StateTests/RandomTests/st201503181402CPPJIT"} -// ^^^ BROKEN ^^^ declare_test!{StateTests_RandomTests_st201503181403GO, "StateTests/RandomTests/st201503181403GO"} declare_test!{StateTests_RandomTests_st201503181406CPPJIT, "StateTests/RandomTests/st201503181406CPPJIT"} declare_test!{StateTests_RandomTests_st201503181406GO, "StateTests/RandomTests/st201503181406GO"} @@ -571,7 +570,6 @@ declare_test!{StateTests_RandomTests_st201503181931CPPJIT, "StateTests/RandomTes declare_test!{StateTests_RandomTests_st201503181931GO, "StateTests/RandomTests/st201503181931GO"} declare_test!{StateTests_RandomTests_st201503181931PYTHON, "StateTests/RandomTests/st201503181931PYTHON"} declare_test!{StateTests_RandomTests_st201503191646GO, "StateTests/RandomTests/st201503191646GO"} -// ^^^ BROKEN ^^^ declare_test!{StateTests_RandomTests_st201503200837JS, "StateTests/RandomTests/st201503200837JS"} declare_test!{StateTests_RandomTests_st201503200838JS, "StateTests/RandomTests/st201503200838JS"} declare_test!{StateTests_RandomTests_st201503200841JS, "StateTests/RandomTests/st201503200841JS"} diff --git a/ethcore/src/verification.rs b/ethcore/src/verification.rs index 368ff84e9..020f1b40f 100644 --- a/ethcore/src/verification.rs +++ b/ethcore/src/verification.rs @@ -147,14 +147,14 @@ pub fn verify_block_final(expected: &Header, got: &Header) -> Result<(), Error> if expected.gas_used != got.gas_used { return Err(From::from(BlockError::InvalidGasUsed(Mismatch { expected: expected.gas_used, found: got.gas_used }))) } - if expected.receipts_root != got.receipts_root { - return Err(From::from(BlockError::InvalidReceiptsStateRoot(Mismatch { expected: expected.receipts_root.clone(), found: got.receipts_root.clone() }))) + if expected.log_bloom != got.log_bloom { + return Err(From::from(BlockError::InvalidLogBloom(Mismatch { expected: expected.log_bloom.clone(), found: got.log_bloom.clone() }))) } if expected.state_root != got.state_root { return Err(From::from(BlockError::InvalidStateRoot(Mismatch { expected: expected.state_root.clone(), found: got.state_root.clone() }))) } - if expected.log_bloom != got.log_bloom { - return Err(From::from(BlockError::InvalidLogBloom(Mismatch { expected: expected.log_bloom.clone(), found: got.log_bloom.clone() }))) + if expected.receipts_root != got.receipts_root { + return Err(From::from(BlockError::InvalidReceiptsStateRoot(Mismatch { expected: expected.receipts_root.clone(), found: got.receipts_root.clone() }))) } Ok(()) } From 3d6caa95a1eaffbea80e50bb244b23b8d2dd1f74 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Mon, 1 Feb 2016 00:34:04 +0100 Subject: [PATCH 09/20] added travis && coveralls badge to README.md --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 216ac8091..6537c0cda 100644 --- a/README.md +++ b/README.md @@ -1 +1,8 @@ # ethcore + +[![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] + +[travis-image]: https://travis-ci.com/ethcore/parity.svg?token=DMFvZu71iaTbUYx9UypX&branch=master +[travis-url]: https://travis-ci.com/ethcore/parity +[coveralls-image]: https://coveralls.io/repos/github/ethcore/parity/badge.svg?branch=master&t=Fk0OuQ +[coveralls-url]: https://coveralls.io/r/ethcore/parity?branch=master From 401005fde5136fcc099b08521d21e3392f24a689 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 1 Feb 2016 01:03:57 +0100 Subject: [PATCH 10/20] Test for Receipt RLP. --- ethcore/src/receipt.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ethcore/src/receipt.rs b/ethcore/src/receipt.rs index d320373d6..306066111 100644 --- a/ethcore/src/receipt.rs +++ b/ethcore/src/receipt.rs @@ -36,3 +36,19 @@ impl Encodable for Receipt { s.append(&self.logs); } } + +#[test] +fn test_basic() { + let expected = Bytes::from("f90162a02f697d671e9ae4ee24a43c4b0d7e15f1cb4ba6de1561120d43b9a4e8c4a8a6ee83040caeb9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000f838f794dcf421d093428b096ca501a7cd1a740855a7976fc0a00000000000000000000000000000000000000000000000000000000000000000"); + let r = Receipt::new( + x!("2f697d671e9ae4ee24a43c4b0d7e15f1cb4ba6de1561120d43b9a4e8c4a8a6ee"), + x!(0x40cae), + vec![LogEntry::new( + x!("dcf421d093428b096ca501a7cd1a740855a7976f"), + vec![], + vec![0u8; 20] + )] + ); + //, x!("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000") + assert_eq!(&encode(&r)[..], &expected[..]); +} \ No newline at end of file From 1e6815877e45aaa5f2e4c75fc3561153f7ea5eba Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Mon, 1 Feb 2016 01:08:23 +0100 Subject: [PATCH 11/20] Building from source guide --- README.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/README.md b/README.md index 6537c0cda..786283ac0 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,51 @@ [travis-url]: https://travis-ci.com/ethcore/parity [coveralls-image]: https://coveralls.io/repos/github/ethcore/parity/badge.svg?branch=master&t=Fk0OuQ [coveralls-url]: https://coveralls.io/r/ethcore/parity?branch=master + + +### Building from source + +##### Ubuntu + +```bash +# 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 +LIBRARY_PATH /usr/local/lib + +# download and build parity +git clone https://github.com/ethcore/parity +cd parity +cargo build --release +``` + +##### OSX + +```bash +# install rocksdb +brew update +brew install rocksdb + +# 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 +LIBRARY_PATH /usr/local/lib + +# download and build parity +git clone https://github.com/ethcore/parity +cd parity +cargo build --release +``` From 0076df8475869846f89eb054a9c828e608afbc53 Mon Sep 17 00:00:00 2001 From: arkpar Date: Mon, 1 Feb 2016 01:06:21 +0100 Subject: [PATCH 12/20] Fixed neted empty list encoding --- util/src/rlp/rlpstream.rs | 1 + util/src/rlp/tests.rs | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/util/src/rlp/rlpstream.rs b/util/src/rlp/rlpstream.rs index b6b500a74..492d188f8 100644 --- a/util/src/rlp/rlpstream.rs +++ b/util/src/rlp/rlpstream.rs @@ -59,6 +59,7 @@ impl Stream for RlpStream { // we may finish, if the appended list len is equal 0 self.encoder.bytes.push(0xc0u8); self.note_appended(1); + self.finished_list = true; }, _ => { let position = self.encoder.bytes.len(); diff --git a/util/src/rlp/tests.rs b/util/src/rlp/tests.rs index 3b00676f8..faadbe7d2 100644 --- a/util/src/rlp/tests.rs +++ b/util/src/rlp/tests.rs @@ -405,3 +405,11 @@ fn test_rlp_2bytes_data_length_check() assert_eq!(Err(DecoderError::RlpInconsistentLengthAndData), as_val); } +#[test] +fn test_rlp_nested_empty_list_encode() { + let mut stream = RlpStream::new_list(2); + stream.append(&(Vec::new() as Vec)); + stream.append(&40u32); + assert_eq!(stream.drain()[..], [0xc2u8, 0xc0u8, 40u8][..]); +} + From 86459bc5aa4f05a38e491632bb659c6258692a82 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Mon, 1 Feb 2016 10:43:27 +0100 Subject: [PATCH 13/20] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 786283ac0..4d1adff0b 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ ### Building from source -##### Ubuntu +##### 14.04 Trusty ```bash # install rocksdb From 78e514b52760cfb01fee749771098cc5709c39f8 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 1 Feb 2016 11:00:18 +0100 Subject: [PATCH 14/20] Fix test. --- ethcore/src/receipt.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ethcore/src/receipt.rs b/ethcore/src/receipt.rs index 306066111..b3379c148 100644 --- a/ethcore/src/receipt.rs +++ b/ethcore/src/receipt.rs @@ -39,16 +39,15 @@ impl Encodable for Receipt { #[test] fn test_basic() { - let expected = Bytes::from("f90162a02f697d671e9ae4ee24a43c4b0d7e15f1cb4ba6de1561120d43b9a4e8c4a8a6ee83040caeb9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000f838f794dcf421d093428b096ca501a7cd1a740855a7976fc0a00000000000000000000000000000000000000000000000000000000000000000"); + let expected = FromHex::from_hex("f90162a02f697d671e9ae4ee24a43c4b0d7e15f1cb4ba6de1561120d43b9a4e8c4a8a6ee83040caeb9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000f838f794dcf421d093428b096ca501a7cd1a740855a7976fc0a00000000000000000000000000000000000000000000000000000000000000000").unwrap(); let r = Receipt::new( x!("2f697d671e9ae4ee24a43c4b0d7e15f1cb4ba6de1561120d43b9a4e8c4a8a6ee"), x!(0x40cae), vec![LogEntry::new( x!("dcf421d093428b096ca501a7cd1a740855a7976f"), vec![], - vec![0u8; 20] + vec![0u8; 32] )] ); - //, x!("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000") assert_eq!(&encode(&r)[..], &expected[..]); } \ No newline at end of file From bedc27c90f03e3ca422ab56d67eab852fa3a1142 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Mon, 1 Feb 2016 11:10:36 +0100 Subject: [PATCH 15/20] install multirust through homebrew on osx --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4d1adff0b..1d360c969 100644 --- a/README.md +++ b/README.md @@ -36,12 +36,10 @@ cargo build --release ##### OSX ```bash -# install rocksdb +# install rocksdb && multirust brew update brew install rocksdb - -# install multirust -curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sh -s -- --yes +brew install multirust # install nightly and make it default multirust update nightly && multirust default nightly From 3533447f7a36a5df8642a7d7fef8cb87808b6ab0 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 1 Feb 2016 11:27:46 +0100 Subject: [PATCH 16/20] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1d360c969..ab1aa26e7 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | multirust update nightly && multirust default nightly # export rust LIBRARY_PATH -LIBRARY_PATH /usr/local/lib +export LIBRARY_PATH=/usr/local/lib # download and build parity git clone https://github.com/ethcore/parity @@ -45,7 +45,7 @@ brew install multirust multirust update nightly && multirust default nightly # export rust LIBRARY_PATH -LIBRARY_PATH /usr/local/lib +export LIBRARY_PATH=/usr/local/lib # download and build parity git clone https://github.com/ethcore/parity From 21e5399d8c035308d86b5e5f942e05aacaad7c7d Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 1 Feb 2016 11:28:56 +0100 Subject: [PATCH 17/20] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ab1aa26e7..f442338db 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ ### Building from source -##### 14.04 Trusty +##### Ubuntu 14.04 and later ```bash # install rocksdb From 3000f057e46169251e9c48c5260149bbe9cfccf6 Mon Sep 17 00:00:00 2001 From: debris Date: Mon, 1 Feb 2016 12:08:43 +0100 Subject: [PATCH 18/20] fixed building rpc module --- rpc/Cargo.toml | 3 ++- rpc/src/lib.rs | 1 + rpc/src/v1/impls/net.rs | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index ee1c97f5f..60b29c5d4 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -14,6 +14,7 @@ serde_json = "0.6.0" jsonrpc-core = "1.1" jsonrpc-http-server = "1.1" ethcore-util = { path = "../util" } -ethcore = { path = ".." } +ethcore = { path = "../ethcore" } +ethsync = { path = "../sync" } clippy = "0.0.37" diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index a27afb5f6..fa24694f4 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -10,6 +10,7 @@ extern crate jsonrpc_core; extern crate jsonrpc_http_server; extern crate ethcore_util as util; extern crate ethcore; +extern crate ethsync; use self::jsonrpc_core::{IoHandler, IoDelegate}; diff --git a/rpc/src/v1/impls/net.rs b/rpc/src/v1/impls/net.rs index dff351c33..fe4f22f63 100644 --- a/rpc/src/v1/impls/net.rs +++ b/rpc/src/v1/impls/net.rs @@ -1,7 +1,7 @@ //! Net rpc implementation. use std::sync::Arc; use jsonrpc_core::*; -use ethcore::sync::EthSync; +use ethsync::EthSync; use v1::traits::Net; /// Net rpc implementation. From d4185626478f6964fed8948174ebfad49d666183 Mon Sep 17 00:00:00 2001 From: debris Date: Mon, 1 Feb 2016 12:13:41 +0100 Subject: [PATCH 19/20] add rpc module to travis tests and to coverage check --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index d2bfdd0db..21a77f684 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,6 +27,7 @@ script: - cargo test --release -p ethash --verbose - cargo test --release -p ethcore-util --verbose - cargo test --release -p ethcore --verbose +- cargo test --release -p ethcore-rpc --verbose --features rpc - cargo test --release --verbose - cargo bench --no-run after_success: | @@ -38,6 +39,8 @@ after_success: | ./kcov-master/tmp/usr/local/bin/kcov --exclude-pattern /.cargo,/root/.multirust target/kcov target/debug/deps/ethash-* && cargo test --no-run -p ethcore --no-default-features && ./kcov-master/tmp/usr/local/bin/kcov --exclude-pattern /.cargo,/root/.multirust target/kcov target/debug/deps/ethcore-* && + cargo test --no-run -p ethcore-rpc --features rpc + ./kcov-master/tmp/usr/local/bin/kcov --exclude-pattern /.cargo,/root/.multirust target/kcov target/debug/deps/ethcore_rpc-* && cargo test --no-run && ./kcov-master/tmp/usr/local/bin/kcov --coveralls-id=${COVERALLS_TOKEN} --exclude-pattern /.cargo,/root/.multirust target/kcov target/debug/parity-* [ $TRAVIS_BRANCH = master ] && From fc1610acb8a40464062a69ace8f1378e683a4aed Mon Sep 17 00:00:00 2001 From: debris Date: Mon, 1 Feb 2016 12:35:52 +0100 Subject: [PATCH 20/20] updated docker containers --- docker/{ => ubuntu-dev}/Dockerfile | 0 docker/ubuntu-jit/Dockerfile | 46 ++++++++++++++++++++++++++++++ docker/ubuntu/Dockerfile | 31 ++++++++++++++++++++ 3 files changed, 77 insertions(+) rename docker/{ => ubuntu-dev}/Dockerfile (100%) create mode 100644 docker/ubuntu-jit/Dockerfile create mode 100644 docker/ubuntu/Dockerfile diff --git a/docker/Dockerfile b/docker/ubuntu-dev/Dockerfile similarity index 100% rename from docker/Dockerfile rename to docker/ubuntu-dev/Dockerfile diff --git a/docker/ubuntu-jit/Dockerfile b/docker/ubuntu-jit/Dockerfile new file mode 100644 index 000000000..6229c1524 --- /dev/null +++ b/docker/ubuntu-jit/Dockerfile @@ -0,0 +1,46 @@ +FROM ubuntu:14.04 + +# install tools and dependencies +RUN apt-get update && \ + apt-get install -y \ + # make + build-essential \ + # add-apt-repository + software-properties-common \ + curl \ + wget \ + git \ + # evmjit dependencies + zlib1g-dev \ + libedit-dev + +# cmake, llvm and rocksdb ppas. then update ppas +RUN add-apt-repository -y "ppa:george-edison55/cmake-3.x" && \ + add-apt-repository "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.7 main" && \ + add-apt-repository "deb http://ppa.launchpad.net/giskou/librocksdb/ubuntu trusty main" && \ + apt-get update && \ + apt-get install -y --force-yes cmake llvm-3.7-dev librocksdb + +# install evmjit +RUN git clone https://github.com/debris/evmjit && \ + cd evmjit && \ + mkdir build && cd build && \ + cmake .. && make && make install && cd + +# install multirust +RUN curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sh -s -- --yes + +# install nightly and make it default +RUN multirust update nightly && multirust default nightly + +# export rust LIBRARY_PATH +ENV LIBRARY_PATH /usr/local/lib + +# show backtraces +ENV RUST_BACKTRACE 1 + +# build parity +# TODO: add jit feature +RUN git clone https://github.com/ethcore/parity && \ + cd parity && \ + cargo install --features rpc diff --git a/docker/ubuntu/Dockerfile b/docker/ubuntu/Dockerfile new file mode 100644 index 000000000..a6b05f38a --- /dev/null +++ b/docker/ubuntu/Dockerfile @@ -0,0 +1,31 @@ +FROM ubuntu:14.04 + +# install tools and dependencies +RUN apt-get update && \ + apt-get install -y \ + curl \ + git \ + # add-apt-repository + software-properties-common + +# rocksdb ppas. then update ppas +RUN 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 +RUN curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sh -s -- --yes + +# install nightly and make it default +RUN multirust update nightly && multirust default nightly + +# export rust LIBRARY_PATH +ENV LIBRARY_PATH /usr/local/lib + +# show backtraces +ENV RUST_BACKTRACE 1 + +# build parity +RUN git clone https://github.com/ethcore/parity && \ + cd parity && \ + cargo install --features rpc