Merge branch 'master' into ui-2

This commit is contained in:
Jaco Greeff 2017-07-21 09:33:05 +02:00
commit 7f3bb37b96
38 changed files with 216 additions and 52 deletions

View File

@ -561,11 +561,9 @@ docker-build:
- docker info - docker info
script: script:
- if [ "$CI_BUILD_REF_NAME" == "beta-release" ]; then DOCKER_TAG="latest"; else DOCKER_TAG=$CI_BUILD_REF_NAME; fi - if [ "$CI_BUILD_REF_NAME" == "beta-release" ]; then DOCKER_TAG="latest"; else DOCKER_TAG=$CI_BUILD_REF_NAME; fi
- docker login -u $Docker_Hub_User -p $Docker_Hub_Pass - echo "Tag:" $DOCKER_TAG
- sh scripts/docker-build.sh $DOCKER_TAG ethcore
- docker logout
- docker login -u $Docker_Hub_User_Parity -p $Docker_Hub_Pass_Parity - docker login -u $Docker_Hub_User_Parity -p $Docker_Hub_Pass_Parity
- sh scripts/docker-build.sh $DOCKER_TAG parity - sh scripts/docker-build.sh $DOCKER_TAG
- docker logout - docker logout
tags: tags:
- docker - docker
@ -613,11 +611,12 @@ test-rust-stable:
image: parity/rust:gitlab-ci image: parity/rust:gitlab-ci
before_script: before_script:
- git submodule update --init --recursive - git submodule update --init --recursive
- export RUST_FILES_MODIFIED=$(git --no-pager diff --name-only $CI_BUILD_REF^ $CI_BUILD_REF | grep -v -e ^js -e ^\\. -e ^LICENSE -e ^README.md -e ^appveyor.yml -e ^test.sh -e ^windows/ -e ^scripts/ -e^mac/ -e ^nsis/ | wc -l) - export RUST_FILES_MODIFIED=$(git --no-pager diff --name-only $CI_BUILD_REF^ $CI_BUILD_REF | grep -v -e ^js -e ^\\. -e ^LICENSE -e ^README.md -e ^test.sh -e ^windows/ -e ^scripts/ -e^mac/ -e ^nsis/ | wc -l)
script: script:
- rustup show - rustup show
- export RUST_BACKTRACE=1 - export RUST_BACKTRACE=1
- if [ $RUST_FILES_MODIFIED -eq 0 ]; then echo "Skipping Rust tests since no Rust files modified."; else ./test.sh $CARGOFLAGS; fi - if [ $RUST_FILES_MODIFIED -eq 0 ]; then echo "Skipping Rust tests since no Rust files modified."; else ./test.sh $CARGOFLAGS; fi
- if [ "$CI_BUILD_REF_NAME" == "nightly" ]; then sh scripts/aura-test.sh; fi
tags: tags:
- rust - rust
- rust-stable - rust-stable

28
Cargo.lock generated
View File

@ -81,6 +81,20 @@ dependencies = [
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "backtrace"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"backtrace-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"dbghelp-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-demangle 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "backtrace-sys" name = "backtrace-sys"
version = "0.1.11" version = "0.1.11"
@ -783,6 +797,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"docopt 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "docopt 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ethkey 0.2.0", "ethkey 0.2.0",
"panic_hook 0.1.0",
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
@ -818,6 +833,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"docopt 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "docopt 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ethstore 0.1.0", "ethstore 0.1.0",
"panic_hook 0.1.0",
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
@ -875,6 +891,7 @@ dependencies = [
"ethcore 1.8.0", "ethcore 1.8.0",
"ethcore-util 1.8.0", "ethcore-util 1.8.0",
"evm 0.1.0", "evm 0.1.0",
"panic_hook 0.1.0",
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1713,6 +1730,13 @@ dependencies = [
"stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "panic_hook"
version = "0.1.0"
dependencies = [
"backtrace 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "parity" name = "parity"
version = "1.7.0" version = "1.7.0"
@ -1746,6 +1770,7 @@ dependencies = [
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"number_prefix 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "number_prefix 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"panic_hook 0.1.0",
"parity-dapps 1.8.0", "parity-dapps 1.8.0",
"parity-hash-fetch 1.8.0", "parity-hash-fetch 1.8.0",
"parity-ipfs-api 1.8.0", "parity-ipfs-api 1.8.0",
@ -1978,7 +2003,7 @@ dependencies = [
[[package]] [[package]]
name = "parity-ui-precompiled" name = "parity-ui-precompiled"
version = "1.4.0" version = "1.4.0"
source = "git+https://github.com/paritytech/js-precompiled.git#26873a9ae6fca50fbf523f201325a20792db3e23" source = "git+https://github.com/paritytech/js-precompiled.git#b4c17fb0478fc9655ca373637816ee6e325da0d7"
dependencies = [ dependencies = [
"parity-dapps-glue 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-dapps-glue 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -3126,6 +3151,7 @@ dependencies = [
"checksum aster 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ccfdf7355d9db158df68f976ed030ab0f6578af811f5a7bb6dcf221ec24e0e0" "checksum aster 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ccfdf7355d9db158df68f976ed030ab0f6578af811f5a7bb6dcf221ec24e0e0"
"checksum atty 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d912da0db7fa85514874458ca3651fe2cddace8d0b0505571dbdcd41ab490159" "checksum atty 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d912da0db7fa85514874458ca3651fe2cddace8d0b0505571dbdcd41ab490159"
"checksum backtrace 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "346d7644f0b5f9bc73082d3b2236b69a05fd35cce0cfa3724e184e6a5c9e2a2f" "checksum backtrace 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "346d7644f0b5f9bc73082d3b2236b69a05fd35cce0cfa3724e184e6a5c9e2a2f"
"checksum backtrace 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "72f9b4182546f4b04ebc4ab7f84948953a118bd6021a1b6a6c909e3e94f6be76"
"checksum backtrace-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3a0d842ea781ce92be2bf78a9b38883948542749640b8378b3b2f03d1fd9f1ff" "checksum backtrace-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3a0d842ea781ce92be2bf78a9b38883948542749640b8378b3b2f03d1fd9f1ff"
"checksum base-x 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2f59103b47307f76e03bef1633aec7fa9e29bfb5aa6daf5a334f94233c71f6c1" "checksum base-x 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2f59103b47307f76e03bef1633aec7fa9e29bfb5aa6daf5a334f94233c71f6c1"
"checksum base32 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1b9605ba46d61df0410d8ac686b0007add8172eba90e8e909c347856fe794d8c" "checksum base32 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1b9605ba46d61df0410d8ac686b0007add8172eba90e8e909c347856fe794d8c"

View File

@ -53,6 +53,7 @@ parity-rpc-client = { path = "rpc_client" }
parity-updater = { path = "updater" } parity-updater = { path = "updater" }
parity-whisper = { path = "whisper" } parity-whisper = { path = "whisper" }
path = { path = "util/path" } path = { path = "util/path" }
panic_hook = { path = "panic_hook" }
parity-dapps = { path = "dapps", optional = true } parity-dapps = { path = "dapps", optional = true }
clippy = { version = "0.0.103", optional = true} clippy = { version = "0.0.103", optional = true}

View File

@ -4,7 +4,7 @@ WORKDIR /build
#ENV for build TAG #ENV for build TAG
ARG BUILD_TAG ARG BUILD_TAG
ENV BUILD_TAG ${BUILD_TAG:-master} ENV BUILD_TAG ${BUILD_TAG:-master}
RUN echo $BUILD_TAG RUN echo "Build tag:" $BUILD_TAG
# install tools and dependencies # install tools and dependencies
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y --force-yes --no-install-recommends \ apt-get install -y --force-yes --no-install-recommends \

View File

@ -211,6 +211,7 @@ impl<Cost: CostType> Interpreter<Cost> {
if (instruction == instructions::DELEGATECALL && !schedule.have_delegate_call) || if (instruction == instructions::DELEGATECALL && !schedule.have_delegate_call) ||
(instruction == instructions::CREATE2 && !schedule.have_create2) || (instruction == instructions::CREATE2 && !schedule.have_create2) ||
(instruction == instructions::STATICCALL && !schedule.have_static_call) || (instruction == instructions::STATICCALL && !schedule.have_static_call) ||
((instruction == instructions::RETURNDATACOPY || instruction == instructions::RETURNDATASIZE) && !schedule.have_return_data) ||
(instruction == instructions::REVERT && !schedule.have_revert) { (instruction == instructions::REVERT && !schedule.have_revert) {
return Err(evm::Error::BadInstruction { return Err(evm::Error::BadInstruction {

View File

@ -107,6 +107,8 @@ pub struct Schedule {
pub blockhash_gas: usize, pub blockhash_gas: usize,
/// Static Call opcode enabled. /// Static Call opcode enabled.
pub have_static_call: bool, pub have_static_call: bool,
/// RETURNDATA and RETURNDATASIZE opcodes enabled.
pub have_return_data: bool,
/// Kill basic accounts below this balance if touched. /// Kill basic accounts below this balance if touched.
pub kill_dust: CleanDustMode, pub kill_dust: CleanDustMode,
} }
@ -140,6 +142,7 @@ impl Schedule {
have_delegate_call: true, have_delegate_call: true,
have_create2: false, have_create2: false,
have_revert: false, have_revert: false,
have_return_data: false,
stack_limit: 1024, stack_limit: 1024,
max_depth: 1024, max_depth: 1024,
tier_step_gas: [0, 2, 3, 5, 8, 10, 20, 0], tier_step_gas: [0, 2, 3, 5, 8, 10, 20, 0],
@ -190,6 +193,7 @@ impl Schedule {
schedule.have_create2 = true; schedule.have_create2 = true;
schedule.have_revert = true; schedule.have_revert = true;
schedule.have_static_call = true; schedule.have_static_call = true;
schedule.have_return_data = true;
schedule.blockhash_gas = 350; schedule.blockhash_gas = 350;
schedule schedule
} }
@ -200,6 +204,7 @@ impl Schedule {
have_delegate_call: hdc, have_delegate_call: hdc,
have_create2: false, have_create2: false,
have_revert: false, have_revert: false,
have_return_data: false,
stack_limit: 1024, stack_limit: 1024,
max_depth: 1024, max_depth: 1024,
tier_step_gas: [0, 2, 3, 5, 8, 10, 20, 0], tier_step_gas: [0, 2, 3, 5, 8, 10, 20, 0],

@ -1 +1 @@
Subproject commit 4e8b9be3fba16ec32e0cdf50b8f9329826283aaa Subproject commit ef191fdc61cf76cdb9cdc147465fb447304b0ed2

View File

@ -558,9 +558,9 @@ impl SnapshotService for Service {
self.reader.read().as_ref().map(|r| r.manifest().clone()) self.reader.read().as_ref().map(|r| r.manifest().clone())
} }
fn min_supported_version(&self) -> Option<u64> { fn supported_versions(&self) -> Option<(u64, u64)> {
self.engine.snapshot_components() self.engine.snapshot_components()
.map(|c| c.min_supported_version()) .map(|c| (c.min_supported_version(), c.current_version()))
} }
fn chunk(&self, hash: H256) -> Option<Bytes> { fn chunk(&self, hash: H256) -> Option<Bytes> {

View File

@ -27,9 +27,9 @@ pub trait SnapshotService : Sync + Send {
/// Query the most recent manifest data. /// Query the most recent manifest data.
fn manifest(&self) -> Option<ManifestData>; fn manifest(&self) -> Option<ManifestData>;
/// Get the minimum supported snapshot version number. /// Get the supported range of snapshot version numbers.
/// `None` indicates warp sync isn't supported by the consensus engine. /// `None` indicates warp sync isn't supported by the consensus engine.
fn min_supported_version(&self) -> Option<u64>; fn supported_versions(&self) -> Option<(u64, u64)>;
/// Get raw chunk for a given hash. /// Get raw chunk for a given hash.
fn chunk(&self, hash: H256) -> Option<Bytes>; fn chunk(&self, hash: H256) -> Option<Bytes>;

View File

@ -100,6 +100,7 @@ impl CommonParams {
schedule.have_create2 = block_number >= self.eip86_transition; schedule.have_create2 = block_number >= self.eip86_transition;
schedule.have_revert = block_number >= self.eip140_transition; schedule.have_revert = block_number >= self.eip140_transition;
schedule.have_static_call = block_number >= self.eip214_transition; schedule.have_static_call = block_number >= self.eip214_transition;
schedule.have_return_data = block_number >= self.eip211_transition;
if block_number >= self.eip210_transition { if block_number >= self.eip210_transition {
schedule.blockhash_gas = 350; schedule.blockhash_gas = 350;
} }

View File

@ -9,6 +9,7 @@ serde = "1.0"
serde_derive = "1.0" serde_derive = "1.0"
rustc-hex = "1.0" rustc-hex = "1.0"
docopt = "0.8" docopt = "0.8"
panic_hook = { path = "../../panic_hook" }
[[bin]] [[bin]]
name = "ethkey" name = "ethkey"

View File

@ -20,12 +20,14 @@ extern crate serde;
#[macro_use] #[macro_use]
extern crate serde_derive; extern crate serde_derive;
extern crate ethkey; extern crate ethkey;
extern crate panic_hook;
use std::{env, fmt, process}; use std::{env, fmt, process};
use std::num::ParseIntError; use std::num::ParseIntError;
use docopt::Docopt; use docopt::Docopt;
use rustc_hex::{FromHex, FromHexError}; use rustc_hex::{FromHex, FromHexError};
use ethkey::{KeyPair, Random, Brain, Prefix, Error as EthkeyError, Generator, sign, verify_public, verify_address}; use ethkey::{KeyPair, Random, Brain, Prefix, Error as EthkeyError, Generator, sign, verify_public, verify_address};
use std::io;
pub const USAGE: &'static str = r#" pub const USAGE: &'static str = r#"
Ethereum keys generator. Ethereum keys generator.
@ -87,6 +89,7 @@ enum Error {
FromHex(FromHexError), FromHex(FromHexError),
ParseInt(ParseIntError), ParseInt(ParseIntError),
Docopt(docopt::Error), Docopt(docopt::Error),
Io(io::Error),
} }
impl From<EthkeyError> for Error { impl From<EthkeyError> for Error {
@ -113,6 +116,12 @@ impl From<docopt::Error> for Error {
} }
} }
impl From<io::Error> for Error {
fn from(err: io::Error) -> Self {
Error::Io(err)
}
}
impl fmt::Display for Error { impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
match *self { match *self {
@ -120,6 +129,7 @@ impl fmt::Display for Error {
Error::FromHex(ref e) => write!(f, "{}", e), Error::FromHex(ref e) => write!(f, "{}", e),
Error::ParseInt(ref e) => write!(f, "{}", e), Error::ParseInt(ref e) => write!(f, "{}", e),
Error::Docopt(ref e) => write!(f, "{}", e), Error::Docopt(ref e) => write!(f, "{}", e),
Error::Io(ref e) => write!(f, "{}", e),
} }
} }
} }
@ -146,6 +156,8 @@ impl DisplayMode {
} }
fn main() { fn main() {
panic_hook::set();
match execute(env::args()) { match execute(env::args()) {
Ok(ok) => println!("{}", ok), Ok(ok) => println!("{}", ok),
Err(err) => { Err(err) => {
@ -176,17 +188,17 @@ fn execute<S, I>(command: I) -> Result<String, Error> where I: IntoIterator<Item
} else if args.cmd_generate { } else if args.cmd_generate {
let display_mode = DisplayMode::new(&args); let display_mode = DisplayMode::new(&args);
let keypair = if args.cmd_random { let keypair = if args.cmd_random {
Random.generate() Random.generate()?
} else if args.cmd_prefix { } else if args.cmd_prefix {
let prefix = args.arg_prefix.from_hex()?; let prefix = args.arg_prefix.from_hex()?;
let iterations = usize::from_str_radix(&args.arg_iterations, 10)?; let iterations = usize::from_str_radix(&args.arg_iterations, 10)?;
Prefix::new(prefix, iterations).generate() Prefix::new(prefix, iterations).generate()?
} else if args.cmd_brain { } else if args.cmd_brain {
Brain::new(args.arg_seed).generate() Brain::new(args.arg_seed).generate().expect("Brain wallet generator is infallible; qed")
} else { } else {
unreachable!(); unreachable!();
}; };
Ok(display(keypair?, display_mode)) Ok(display(keypair, display_mode))
} else if args.cmd_sign { } else if args.cmd_sign {
let secret = args.arg_secret.parse().map_err(|_| EthkeyError::InvalidSecret)?; let secret = args.arg_secret.parse().map_err(|_| EthkeyError::InvalidSecret)?;
let message = args.arg_message.parse().map_err(|_| EthkeyError::InvalidMessage)?; let message = args.arg_message.parse().map_err(|_| EthkeyError::InvalidMessage)?;

View File

@ -9,6 +9,7 @@ serde = "1.0"
serde_derive = "1.0" serde_derive = "1.0"
docopt = "0.8" docopt = "0.8"
ethstore = { path = "../" } ethstore = { path = "../" }
panic_hook = { path = "../../panic_hook" }
[[bin]] [[bin]]
name = "ethstore" name = "ethstore"

View File

@ -20,6 +20,7 @@ extern crate serde;
#[macro_use] #[macro_use]
extern crate serde_derive; extern crate serde_derive;
extern crate ethstore; extern crate ethstore;
extern crate panic_hook;
use std::{env, process, fs, fmt}; use std::{env, process, fs, fmt};
use std::io::Read; use std::io::Read;
@ -134,6 +135,8 @@ impl fmt::Display for Error {
} }
fn main() { fn main() {
panic_hook::set();
match execute(env::args()) { match execute(env::args()) {
Ok(result) => println!("{}", result), Ok(result) => println!("{}", result),
Err(err) => { Err(err) => {

View File

@ -16,6 +16,7 @@ serde_derive = "1.0"
ethcore = { path = "../ethcore" } ethcore = { path = "../ethcore" }
ethcore-util = { path = "../util" } ethcore-util = { path = "../util" }
evm = { path = "../ethcore/evm" } evm = { path = "../ethcore/evm" }
panic_hook = { path = "../panic_hook" }
[features] [features]
evm-debug = ["ethcore/evm-debug-tests"] evm-debug = ["ethcore/evm-debug-tests"]

View File

@ -26,6 +26,7 @@ extern crate serde_derive;
extern crate docopt; extern crate docopt;
extern crate ethcore_util as util; extern crate ethcore_util as util;
extern crate evm; extern crate evm;
extern crate panic_hook;
use std::sync::Arc; use std::sync::Arc;
use std::{fmt, fs}; use std::{fmt, fs};
@ -63,6 +64,8 @@ General options:
fn main() { fn main() {
panic_hook::set();
let args: Args = Docopt::new(USAGE).and_then(|d| d.deserialize()).unwrap_or_else(|e| e.exit()); let args: Args = Docopt::new(USAGE).and_then(|d| d.deserialize()).unwrap_or_else(|e| e.exit());
if args.flag_json { if args.flag_json {

View File

@ -1,6 +1,6 @@
{ {
"name": "parity.js", "name": "parity.js",
"version": "1.7.101", "version": "1.8.3",
"main": "release/index.js", "main": "release/index.js",
"jsnext:main": "src/index.js", "jsnext:main": "src/index.js",
"author": "Parity Team <admin@parity.io>", "author": "Parity Team <admin@parity.io>",

File diff suppressed because one or more lines are too long

View File

@ -104,7 +104,7 @@ contract WalletLibrary is WalletEvents {
// constructor is given number of sigs required to do protected "onlymanyowners" transactions // constructor is given number of sigs required to do protected "onlymanyowners" transactions
// as well as the selection of addresses capable of confirming them. // as well as the selection of addresses capable of confirming them.
function initMultiowned(address[] _owners, uint _required) { function initMultiowned(address[] _owners, uint _required) only_uninitialized {
m_numOwners = _owners.length + 1; m_numOwners = _owners.length + 1;
m_owners[1] = uint(msg.sender); m_owners[1] = uint(msg.sender);
m_ownerIndex[uint(msg.sender)] = 1; m_ownerIndex[uint(msg.sender)] = 1;
@ -198,7 +198,7 @@ contract WalletLibrary is WalletEvents {
} }
// constructor - stores initial daily limit and records the present day's index. // constructor - stores initial daily limit and records the present day's index.
function initDaylimit(uint _limit) { function initDaylimit(uint _limit) only_uninitialized {
m_dailyLimit = _limit; m_dailyLimit = _limit;
m_lastDay = today(); m_lastDay = today();
} }
@ -211,9 +211,12 @@ contract WalletLibrary is WalletEvents {
m_spentToday = 0; m_spentToday = 0;
} }
// throw unless the contract is not yet initialized.
modifier only_uninitialized { if (m_numOwners > 0) throw; _; }
// constructor - just pass on the owner array to the multiowned and // constructor - just pass on the owner array to the multiowned and
// the limit to daylimit // the limit to daylimit
function initWallet(address[] _owners, uint _required, uint _daylimit) { function initWallet(address[] _owners, uint _required, uint _daylimit) only_uninitialized {
initDaylimit(_daylimit); initDaylimit(_daylimit);
initMultiowned(_owners, _required); initMultiowned(_owners, _required);
} }

View File

@ -183,6 +183,8 @@ export default class CreateWalletStore {
return null; // exception when registry is not available return null; // exception when registry is not available
}) })
.then((address) => { .then((address) => {
console.warn('WalletLibrary address in registry', address);
if (!address || /^(0x)?0*$/.test(address)) { if (!address || /^(0x)?0*$/.test(address)) {
return null; return null;
} }

10
panic_hook/Cargo.toml Normal file
View File

@ -0,0 +1,10 @@
[package]
description = "Parity custom panic hook"
homepage = "http://parity.io"
license = "GPL-3.0"
name = "panic_hook"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
[dependencies]
backtrace = "0.3.2"

69
panic_hook/src/lib.rs Normal file
View File

@ -0,0 +1,69 @@
// Copyright 2015-2017 Parity Technologies (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 <http://www.gnu.org/licenses/>.
//! Custom panic hook with bug report link
extern crate backtrace;
use backtrace::Backtrace;
use std::io::{self, Write};
use std::panic::{self, PanicInfo};
use std::thread;
/// Set the panic hook
pub fn set() {
panic::set_hook(Box::new(panic_hook));
}
static ABOUT_PANIC: &str = "
This is a bug. Please report it at:
https://github.com/paritytech/parity/issues/new
";
fn panic_hook(info: &PanicInfo) {
let location = info.location();
let file = location.as_ref().map(|l| l.file()).unwrap_or("<unknown>");
let line = location.as_ref().map(|l| l.line()).unwrap_or(0);
let msg = match info.payload().downcast_ref::<&'static str>() {
Some(s) => *s,
None => match info.payload().downcast_ref::<String>() {
Some(s) => &s[..],
None => "Box<Any>",
}
};
let thread = thread::current();
let name = thread.name().unwrap_or("<unnamed>");
let backtrace = Backtrace::new();
let mut stderr = io::stderr();
let _ = writeln!(stderr, "");
let _ = writeln!(stderr, "====================");
let _ = writeln!(stderr, "");
let _ = writeln!(stderr, "{:?}", backtrace);
let _ = writeln!(stderr, "");
let _ = writeln!(
stderr,
"Thread '{}' panicked at '{}', {}:{}",
name, msg, file, line
);
let _ = writeln!(stderr, "{}", ABOUT_PANIC);
}

View File

@ -531,10 +531,12 @@ pub fn kill_db(cmd: KillBlockchain) -> Result<(), String> {
let genesis_hash = spec.genesis_header().hash(); let genesis_hash = spec.genesis_header().hash();
let db_dirs = cmd.dirs.database(genesis_hash, None, spec.data_dir); let db_dirs = cmd.dirs.database(genesis_hash, None, spec.data_dir);
let user_defaults_path = db_dirs.user_defaults_path(); let user_defaults_path = db_dirs.user_defaults_path();
let user_defaults = UserDefaults::load(&user_defaults_path)?; let mut user_defaults = UserDefaults::load(&user_defaults_path)?;
let algorithm = cmd.pruning.to_algorithm(&user_defaults); let algorithm = cmd.pruning.to_algorithm(&user_defaults);
let dir = db_dirs.db_path(algorithm); let dir = db_dirs.db_path(algorithm);
fs::remove_dir_all(&dir).map_err(|e| format!("Error removing database: {:?}", e))?; fs::remove_dir_all(&dir).map_err(|e| format!("Error removing database: {:?}", e))?;
user_defaults.is_first_launch = true;
user_defaults.save(&user_defaults_path)?;
info!("Database deleted."); info!("Database deleted.");
Ok(()) Ok(())
} }

View File

@ -152,7 +152,7 @@ impl InformantData for FullNodeInformantData {
max_peers: status.current_max_peers(net_config.min_peers, net_config.max_peers), max_peers: status.current_max_peers(net_config.min_peers, net_config.max_peers),
})) }))
} }
_ => (is_major_importing(None, queue_info.clone()), None), _ => (is_major_importing(self.sync.as_ref().map(|s| s.status().state), queue_info.clone()), None),
}; };
Report { Report {
@ -254,8 +254,6 @@ impl<T: InformantData> Informant<T> {
return; return;
} }
*self.last_tick.write() = Instant::now();
let (client_report, full_report) = { let (client_report, full_report) = {
let mut last_report = self.last_report.lock(); let mut last_report = self.last_report.lock();
let full_report = self.target.report(); let full_report = self.target.report();
@ -287,6 +285,8 @@ impl<T: InformantData> Informant<T> {
return; return;
} }
*self.last_tick.write() = Instant::now();
let paint = |c: Style, t: String| match self.with_color && stdout_isatty() { let paint = |c: Style, t: String| match self.with_color && stdout_isatty() {
true => format!("{}", c.paint(t)), true => format!("{}", c.paint(t)),
false => t, false => t,

View File

@ -57,6 +57,7 @@ extern crate ethcore_logger;
extern crate ethcore_util as util; extern crate ethcore_util as util;
extern crate ethkey; extern crate ethkey;
extern crate ethsync; extern crate ethsync;
extern crate panic_hook;
extern crate parity_hash_fetch as hash_fetch; extern crate parity_hash_fetch as hash_fetch;
extern crate parity_ipfs_api; extern crate parity_ipfs_api;
extern crate parity_local_store as local_store; extern crate parity_local_store as local_store;
@ -315,8 +316,7 @@ macro_rules! trace_main {
} }
fn main() { fn main() {
// Always print backtrace on panic. panic_hook::set();
env::set_var("RUST_BACKTRACE", "1");
// assuming the user is not running with `--force-direct`, then: // assuming the user is not running with `--force-direct`, then:
// if argv[0] == "parity" and this executable != ~/.parity-updates/parity, run that instead. // if argv[0] == "parity" and this executable != ~/.parity-updates/parity, run that instead.

View File

@ -754,6 +754,7 @@ pub fn execute(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) -> R
service.register_io_handler(informant.clone()).map_err(|_| "Unable to register informant handler".to_owned())?; service.register_io_handler(informant.clone()).map_err(|_| "Unable to register informant handler".to_owned())?;
// save user defaults // save user defaults
user_defaults.is_first_launch = false;
user_defaults.pruning = algorithm; user_defaults.pruning = algorithm;
user_defaults.tracing = tracing; user_defaults.tracing = tracing;
user_defaults.fat_db = fat_db; user_defaults.fat_db = fat_db;

View File

@ -41,6 +41,7 @@ impl Serialize for UserDefaults {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer { where S: Serializer {
let mut map: BTreeMap<String, Value> = BTreeMap::new(); let mut map: BTreeMap<String, Value> = BTreeMap::new();
map.insert("is_first_launch".into(), Value::Bool(self.is_first_launch));
map.insert("pruning".into(), Value::String(self.pruning.as_str().into())); map.insert("pruning".into(), Value::String(self.pruning.as_str().into()));
map.insert("tracing".into(), Value::Bool(self.tracing)); map.insert("tracing".into(), Value::Bool(self.tracing));
map.insert("fat_db".into(), Value::Bool(self.fat_db)); map.insert("fat_db".into(), Value::Bool(self.fat_db));

View File

@ -21,9 +21,10 @@ use ethsync::SyncState;
/// Check if client is during major sync or during block import. /// Check if client is during major sync or during block import.
pub fn is_major_importing(sync_state: Option<SyncState>, queue_info: BlockQueueInfo) -> bool { pub fn is_major_importing(sync_state: Option<SyncState>, queue_info: BlockQueueInfo) -> bool {
let is_syncing_state = sync_state.map_or(false, |s| let is_syncing_state = sync_state.map_or(false, |s| match s {
s != SyncState::Idle && s != SyncState::NewBlocks SyncState::Idle | SyncState::NewBlocks | SyncState::WaitingPeers => false,
); _ => true,
});
let is_verifying = queue_info.unverified_queue_size + queue_info.verified_queue_size > 3; let is_verifying = queue_info.unverified_queue_size + queue_info.verified_queue_size > 3;
is_verifying || is_syncing_state is_verifying || is_syncing_state
} }

View File

@ -41,7 +41,7 @@ impl TestSnapshotService {
impl SnapshotService for TestSnapshotService { impl SnapshotService for TestSnapshotService {
fn manifest(&self) -> Option<ManifestData> { None } fn manifest(&self) -> Option<ManifestData> { None }
fn min_supported_version(&self) -> Option<u64> { None } fn supported_versions(&self) -> Option<(u64, u64)> { None }
fn chunk(&self, _hash: H256) -> Option<Bytes> { None } fn chunk(&self, _hash: H256) -> Option<Bytes> { None }
fn status(&self) -> RestorationStatus { self.status.lock().clone() } fn status(&self) -> RestorationStatus { self.status.lock().clone() }
fn begin_restore(&self, _manifest: ManifestData) { } fn begin_restore(&self, _manifest: ManifestData) { }

9
scripts/aura-test.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
cargo build -j $(nproc) --release --features final $CARGOFLAGS
git clone https://github.com/paritytech/parity-import-tests
cp target/release/parity parity-import-tests/aura/parity
cd parity-import-tests/aura
echo "Start Aura test"
parity import blocks.rlp --chain chain.json
parity restore snap --chain chain.json
echo "Aura test complete"

0
scripts/deb-build.sh Normal file → Executable file
View File

0
scripts/deploy.sh Normal file → Executable file
View File

8
scripts/docker-build.sh Normal file → Executable file
View File

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
cd docker/hub cd docker/hub
if [ "$1" == "latest" ]; then DOCKER_BUILD_TAG="beta-release"; fi DOCKER_BUILD_TAG=$1
docker build --build-arg BUILD_TAG=$DOCKER_BUILD_TAG --no-cache=true --tag $2/parity:$1 . echo "Docker build tag: " $DOCKER_BUILD_TAG
docker push $2/parity:$1 docker build --build-arg BUILD_TAG=$DOCKER_BUILD_TAG --no-cache=true --tag parity/parity:$DOCKER_BUILD_TAG .
docker run -it parity/parity:$DOCKER_BUILD_TAG -v
docker push parity/parity:$DOCKER_BUILD_TAG

0
scripts/targets.sh Normal file → Executable file
View File

View File

@ -504,7 +504,7 @@ impl ChainSync {
} }
fn maybe_start_snapshot_sync(&mut self, io: &mut SyncIo) { fn maybe_start_snapshot_sync(&mut self, io: &mut SyncIo) {
if !self.enable_warp_sync || io.snapshot_service().min_supported_version().is_none() { if !self.enable_warp_sync || io.snapshot_service().supported_versions().is_none() {
return; return;
} }
if self.state != SyncState::WaitingPeers && self.state != SyncState::Blocks && self.state != SyncState::Waiting { if self.state != SyncState::WaitingPeers && self.state != SyncState::Blocks && self.state != SyncState::Waiting {
@ -1044,11 +1044,11 @@ impl ChainSync {
Ok(manifest) => manifest, Ok(manifest) => manifest,
}; };
let is_supported_version = io.snapshot_service().min_supported_version() let is_supported_version = io.snapshot_service().supported_versions()
.map_or(false, |v| manifest.version >= v); .map_or(false, |(l, h)| manifest.version >= l && manifest.version <= h);
if !is_supported_version { if !is_supported_version {
trace!(target: "sync", "{}: Snapshot manifest version too low: {}", peer_id, manifest.version); trace!(target: "sync", "{}: Snapshot manifest version not supported: {}", peer_id, manifest.version);
io.disable_peer(peer_id); io.disable_peer(peer_id);
self.continue_sync(io); self.continue_sync(io);
return Ok(()); return Ok(());

View File

@ -71,8 +71,8 @@ impl SnapshotService for TestSnapshotService {
self.manifest.as_ref().cloned() self.manifest.as_ref().cloned()
} }
fn min_supported_version(&self) -> Option<u64> { fn supported_versions(&self) -> Option<(u64, u64)> {
Some(1) Some((1, 2))
} }
fn chunk(&self, hash: H256) -> Option<Bytes> { fn chunk(&self, hash: H256) -> Option<Bytes> {

View File

@ -857,14 +857,19 @@ impl Host {
// Add it to the node table // Add it to the node table
if !s.info.originated { if !s.info.originated {
if let Ok(address) = s.remote_addr() { if let Ok(address) = s.remote_addr() {
let entry = NodeEntry { id: id, endpoint: NodeEndpoint { address: address, udp_port: address.port() } }; // We can't know remote listening ports, so just assume defaults and hope for the best.
self.nodes.write().add_node(Node::new(entry.id.clone(), entry.endpoint.clone())); let endpoint = NodeEndpoint { address: SocketAddr::new(address.ip(), DEFAULT_PORT), udp_port: DEFAULT_PORT };
let entry = NodeEntry { id: id, endpoint: endpoint };
let mut nodes = self.nodes.write();
if !nodes.contains(&entry.id) {
nodes.add_node(Node::new(entry.id.clone(), entry.endpoint.clone()));
let mut discovery = self.discovery.lock(); let mut discovery = self.discovery.lock();
if let Some(ref mut discovery) = *discovery { if let Some(ref mut discovery) = *discovery {
discovery.add_node(entry); discovery.add_node(entry);
} }
} }
} }
}
for (p, _) in self.handlers.read().iter() { for (p, _) in self.handlers.read().iter() {
if s.have_capability(*p) { if s.have_capability(*p) {
ready_data.push(*p); ready_data.push(*p);

View File

@ -236,6 +236,11 @@ impl NodeTable {
self.nodes.get_mut(id) self.nodes.get_mut(id)
} }
/// Check if a node exists in the table.
pub fn contains(&self, id: &NodeId) -> bool {
self.nodes.contains_key(id)
}
/// Apply table changes coming from discovery /// Apply table changes coming from discovery
pub fn update(&mut self, mut update: TableUpdates, reserved: &HashSet<NodeId>) { pub fn update(&mut self, mut update: TableUpdates, reserved: &HashSet<NodeId>) {
for (_, node) in update.added.drain() { for (_, node) in update.added.drain() {