From 28545d706f1c2ef16fbfc26fc567fd7cfb7b2ded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Thu, 26 May 2016 16:41:03 +0200 Subject: [PATCH] Empty trusted signer crate with it's general purpose --- .travis.yml | 3 ++- Cargo.lock | 12 ++++++++++++ Cargo.toml | 5 +++-- cov.sh | 2 ++ doc.sh | 1 + fmt.sh | 1 + hook.sh | 2 +- signer/Cargo.toml | 21 +++++++++++++++++++++ signer/build.rs | 25 +++++++++++++++++++++++++ signer/src/lib.rs | 41 +++++++++++++++++++++++++++++++++++++++++ test.sh | 1 + 11 files changed, 110 insertions(+), 4 deletions(-) create mode 100644 signer/Cargo.toml create mode 100644 signer/build.rs create mode 100644 signer/src/lib.rs diff --git a/.travis.yml b/.travis.yml index 1f88bcecf..06f10b7aa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,7 @@ env: global: # GH_TOKEN - secure: bumJASbZSU8bxJ0EyPUJmu16AiV9EXOpyOj86Jlq/Ty9CfwGqsSXt96uDyE+OUJf34RUFQMsw0nk37/zC4lcn6kqk2wpuH3N/o85Zo/cVZY/NusBWLQqtT5VbYWsV+u2Ua4Tmmsw8yVYQhYwU2ZOejNpflL+Cs9XGgORp1L+/gMRMC2y5Se6ZhwnKPQlRJ8LGsG1dzjQULxzADIt3/zuspNBS8a2urJwlHfGMkvHDoUWCviP/GXoSqw3TZR7FmKyxE19I8n9+iSvm9+oZZquvcgfUxMHn8Gq/b44UbPvjtFOg2yam4xdWXF/RyWCHdc/R9EHorSABeCbefIsm+zcUF3/YQxwpSxM4IZEeH2rTiC7dcrsKw3XsO16xFQz5YI5Bay+CT/wTdMmJd7DdYz7Dyf+pOvcM9WOf/zorxYWSBOMYy0uzbusU2iyIghQ82s7E/Ahg+WARtPgkuTLSB5aL1oCTBKHqQscMr7lo5Ti6RpWLxEdTQMBznc+bMr+6dEtkEcG9zqc6cE9XX+ox3wTU6+HVMfQ1ltCntJ4UKcw3A6INEbw9wgocQa812CIASQ2fE+SCAbz6JxBjIAlFUnD1lUB7S8PdMPwn9plfQgKQ2A5YZqg6FnBdf0rQXIJYxQWKHXj/rBHSUCT0tHACDlzTA+EwWggvkP5AGIxRxm8jhw= - - TARGETS="-p ethash -p ethcore-util -p ethcore -p ethsync -p ethcore-rpc -p parity -p ethminer -p ethjson -p ethcore-webapp" + - TARGETS="-p ethash -p ethcore-util -p ethcore -p ethsync -p ethcore-rpc -p parity -p ethminer -p ethjson -p ethcore-webapp -p ethcore-signer" - ARCHIVE_SUFFIX="-${TRAVIS_OS_NAME}-${TRAVIS_TAG}" - KCOV_FEATURES="" - KCOV_CMD="./kcov-master/tmp/usr/local/bin/kcov --exclude-pattern /usr/,/.cargo,/root/.multirust,src/tests,util/json-tests,util/src/network/tests,sync/src/tests,ethcore/src/tests,ethcore/src/evm/tests target/kcov" @@ -71,6 +71,7 @@ after_success: | $KCOV_CMD target/debug/deps/ethsync-* && $KCOV_CMD target/debug/deps/ethcore_rpc-* && $KCOV_CMD target/debug/deps/ethcore_webapp-* && + $KCOV_CMD target/debug/deps/ethcore_signer-* && $KCOV_CMD target/debug/deps/ethminer-* && $KCOV_CMD target/debug/deps/ethjson-* && $KCOV_CMD target/debug/parity-* && diff --git a/Cargo.lock b/Cargo.lock index cd40d0974..11c04d77d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,6 +14,7 @@ dependencies = [ "ethcore-ipc-codegen 1.2.0", "ethcore-ipc-nano 1.2.0", "ethcore-rpc 1.2.0", + "ethcore-signer 1.2.0", "ethcore-util 1.2.0", "ethcore-webapp 1.2.0", "ethminer 1.2.0", @@ -315,6 +316,17 @@ dependencies = [ "transient-hashmap 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "ethcore-signer" +version = "1.2.0" +dependencies = [ + "clippy 0.0.69 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "ethcore-util 1.2.0", + "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "ethcore-util" version = "1.2.0" diff --git a/Cargo.toml b/Cargo.toml index 5193e2435..e3f62fc75 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,6 +30,7 @@ ethsync = { path = "sync" } ethminer = { path = "miner" } ethcore-devtools = { path = "devtools" } ethcore-rpc = { path = "rpc", optional = true } +ethcore-signer = { path = "signer", optional = true } ethcore-webapp = { path = "webapp", optional = true } semver = "0.2" ethcore-ipc-nano = { path = "ipc/nano" } @@ -42,11 +43,11 @@ version = "0.8" default-features = false [features] -default = ["rpc", "webapp"] +default = ["rpc", "webapp", "ethcore-signer"] rpc = ["ethcore-rpc"] webapp = ["ethcore-webapp"] dev = ["clippy", "ethcore/dev", "ethcore-util/dev", "ethsync/dev", "ethcore-rpc/dev", "ethminer/dev", -"ethcore-webapp/dev"] +"ethcore-webapp/dev", "ethcore-signer/dev"] travis-beta = ["ethcore/json-tests"] travis-nightly = ["ethcore/json-tests", "dev"] diff --git a/cov.sh b/cov.sh index 1698d6f36..0ed50a841 100755 --- a/cov.sh +++ b/cov.sh @@ -24,6 +24,7 @@ cargo test \ -p parity \ -p ethminer \ -p ethcore-webapp \ + -p ethcore-signer \ --no-run || exit $? rm -rf target/coverage mkdir -p target/coverage @@ -35,5 +36,6 @@ kcov --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage t kcov --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethsync-* kcov --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore_rpc-* kcov --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore_webapp-* +kcov --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore_signer-* kcov --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethminer-* xdg-open target/coverage/index.html diff --git a/doc.sh b/doc.sh index 9b0f13817..460e4af44 100755 --- a/doc.sh +++ b/doc.sh @@ -8,5 +8,6 @@ cargo doc --no-deps --verbose \ -p ethsync \ -p ethcore-rpc \ -p ethcore-webapp \ + -p ethcore-signer \ -p parity \ -p ethminer diff --git a/fmt.sh b/fmt.sh index 4d835967f..774014c55 100755 --- a/fmt.sh +++ b/fmt.sh @@ -10,6 +10,7 @@ $RUSTFMT ./miner/src/lib.rs $RUSTFMT ./parity/main.rs $RUSTFMT ./rpc/src/lib.rs $RUSTFMT ./webapp/src/lib.rs +$RUSTFMT ./signer/src/lib.rs $RUSTFMT ./sync/src/lib.rs $RUSTFMT ./util/src/lib.rs diff --git a/hook.sh b/hook.sh index 7fac4a834..0e5c1cc9d 100755 --- a/hook.sh +++ b/hook.sh @@ -7,6 +7,6 @@ echo "set -e" >> $FILE echo "cargo build --features dev" >> $FILE # Build tests echo "cargo test --no-run --features dev \\" >> $FILE -echo " -p ethash -p ethcore-util -p ethcore -p ethsync -p ethcore-rpc -p parity -p ethminer -p ethcore-webapp" >> $FILE +echo " -p ethash -p ethcore-util -p ethcore -p ethsync -p ethcore-rpc -p parity -p ethminer -p ethcore-webapp -p ethcore-signer" >> $FILE echo "" >> $FILE chmod +x $FILE diff --git a/signer/Cargo.toml b/signer/Cargo.toml new file mode 100644 index 000000000..f72865f4f --- /dev/null +++ b/signer/Cargo.toml @@ -0,0 +1,21 @@ +[package] +description = "Ethcore Trusted Signer" +homepage = "http://ethcore.io" +license = "GPL-3.0" +name = "ethcore-signer" +version = "1.2.0" +authors = ["Ethcore "] +build = "build.rs" + +[build-dependencies] +rustc_version = "0.1" + +[dependencies] +ethcore-util = { path = "../util" } +log = "0.3" +env_logger = "0.3" +clippy = { version = "0.0.69", optional = true} + +[features] +default = [] +dev = ["clippy"] diff --git a/signer/build.rs b/signer/build.rs new file mode 100644 index 000000000..41b9a1b3e --- /dev/null +++ b/signer/build.rs @@ -0,0 +1,25 @@ +// Copyright 2015, 2016 Ethcore (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +extern crate rustc_version; + +use rustc_version::{version_meta, Channel}; + +fn main() { + if let Channel::Nightly = version_meta().channel { + println!("cargo:rustc-cfg=nightly"); + } +} diff --git a/signer/src/lib.rs b/signer/src/lib.rs new file mode 100644 index 000000000..d60056f80 --- /dev/null +++ b/signer/src/lib.rs @@ -0,0 +1,41 @@ +// Copyright 2015, 2016 Ethcore (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +#![warn(missing_docs)] +#![cfg_attr(all(nightly, feature="dev"), feature(plugin))] +#![cfg_attr(all(nightly, feature="dev"), plugin(clippy))] + +//! Signer module +//! +//! This module manages your private keys and accounts/identities +//! that can be used within Dapps. +//! +//! It exposes API (over WebSockets) accessed by System UIs. +//! Each transaction sent by Dapp is broadcasted to System UIs +//! and their responsibility is to confirm (or confirm and sign) +//! the transaction for you. +//! +//! + +#[macro_use] +extern crate log; +extern crate env_logger; + +#[cfg(test)] +mod tests { + #[test] + fn should_work() {} +} diff --git a/test.sh b/test.sh index 5094158cc..afcce52f1 100755 --- a/test.sh +++ b/test.sh @@ -8,6 +8,7 @@ cargo test --features ethcore/json-tests $1 \ -p ethsync \ -p ethcore-rpc \ -p ethcore-webapp \ + -p ethcore-signer \ -p parity \ -p ethminer \ -p bigint