Compare commits
34 Commits
v1.8.7
...
v1.8.10-ci
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4bfabb6752 | ||
|
|
9b54d3f2d3 | ||
|
|
db86dec404 | ||
|
|
d2fa3e3236 | ||
|
|
590362b23c | ||
|
|
5e2258c6de | ||
|
|
f65003c630 | ||
|
|
ceb23638fc | ||
|
|
24ab53245b | ||
|
|
1952d05d9c | ||
|
|
98cccd5b26 | ||
|
|
fd07b608bd | ||
|
|
944ace3b61 | ||
|
|
c697e40e84 | ||
|
|
b322af35bc | ||
|
|
987d26ac46 | ||
|
|
143d4840c7 | ||
|
|
fae7cf6b41 | ||
|
|
d8c1372b7c | ||
|
|
28821142e6 | ||
|
|
791d944a53 | ||
|
|
9e2b3308d4 | ||
|
|
680cc9c0c3 | ||
|
|
346c80ef11 | ||
|
|
efb310f251 | ||
|
|
1ede2fbed2 | ||
|
|
31ef44d718 | ||
|
|
19fc9fcc58 | ||
|
|
835dcaec2a | ||
|
|
2c93b0fdf7 | ||
|
|
e322fd824b | ||
|
|
366320fb8d | ||
|
|
29dc3ca2dd | ||
|
|
5f590a0df5 |
@@ -9,7 +9,7 @@ trim_trailing_whitespace=true
|
||||
max_line_length=120
|
||||
insert_final_newline=true
|
||||
|
||||
[.travis.yml]
|
||||
[*.{yml,sh}]
|
||||
indent_style=space
|
||||
indent_size=2
|
||||
tab_width=8
|
||||
|
||||
@@ -9,7 +9,6 @@ variables:
|
||||
CARGOFLAGS: ""
|
||||
CI_SERVER_NAME: "GitLab CI"
|
||||
LIBSSL: "libssl1.0.0 (>=1.0.0)"
|
||||
CARGO_HOME: "$CI_PROJECT_DIR"
|
||||
cache:
|
||||
key: "$CI_BUILD_STAGE-$CI_BUILD_REF_NAME"
|
||||
paths:
|
||||
@@ -19,14 +18,14 @@ linux-stable:
|
||||
stage: build
|
||||
image: parity/rust:gitlab-ci
|
||||
only:
|
||||
- stable
|
||||
- beta
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- rustup default stable
|
||||
# ARGUMENTS: 1. BUILD_PLATFORM (target for binaries) 2. PLATFORM (target for cargo) 3. ARC (architecture) 4. & 5. CC & CXX flags
|
||||
- scripts/gitlab-build.sh x86_64-unknown-linux-gnu x86_64-unknown-linux-gnu amd64 gcc g++
|
||||
# ARGUMENTS: 1. BUILD_PLATFORM (target for binaries) 2. PLATFORM (target for cargo) 3. ARC (architecture) 4. & 5. CC & CXX flags 6. binary identifier
|
||||
- scripts/gitlab-build.sh x86_64-unknown-linux-gnu x86_64-unknown-linux-gnu amd64 gcc g++ ubuntu
|
||||
tags:
|
||||
- rust-stable
|
||||
artifacts:
|
||||
@@ -37,13 +36,13 @@ linux-stable-debian:
|
||||
stage: build
|
||||
image: parity/rust-debian:gitlab-ci
|
||||
only:
|
||||
- stable
|
||||
- beta
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- export LIBSSL="libssl1.1 (>=1.1.0)"
|
||||
- scripts/gitlab-build.sh x86_64-unknown-debian-gnu x86_64-unknown-linux-gnu amd64 gcc g++
|
||||
- scripts/gitlab-build.sh x86_64-unknown-debian-gnu x86_64-unknown-linux-gnu amd64 gcc g++ debian
|
||||
tags:
|
||||
- rust-debian
|
||||
artifacts:
|
||||
@@ -54,12 +53,12 @@ linux-centos:
|
||||
stage: build
|
||||
image: parity/rust-centos:gitlab-ci
|
||||
only:
|
||||
- stable
|
||||
- beta
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- scripts/gitlab-build.sh x86_64-unknown-centos-gnu x86_64-unknown-linux-gnu x86_64 gcc g++
|
||||
- scripts/gitlab-build.sh x86_64-unknown-centos-gnu x86_64-unknown-linux-gnu x86_64 gcc g++ centos
|
||||
tags:
|
||||
- rust-centos
|
||||
artifacts:
|
||||
@@ -70,12 +69,12 @@ linux-i686:
|
||||
stage: build
|
||||
image: parity/rust-i686:gitlab-ci
|
||||
only:
|
||||
- stable
|
||||
- beta
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- scripts/gitlab-build.sh i686-unknown-linux-gnu i686-unknown-linux-gnu i386 gcc g++
|
||||
- scripts/gitlab-build.sh i686-unknown-linux-gnu i686-unknown-linux-gnu i386 gcc g++ ubuntu
|
||||
tags:
|
||||
- rust-i686
|
||||
artifacts:
|
||||
@@ -86,12 +85,12 @@ linux-armv7:
|
||||
stage: build
|
||||
image: parity/rust-armv7:gitlab-ci
|
||||
only:
|
||||
- stable
|
||||
- beta
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- scripts/gitlab-build.sh armv7-unknown-linux-gnueabihf armv7-unknown-linux-gnueabihf armhf arm-linux-gnueabihf-gcc arm-linux-gnueabihf-g++
|
||||
- scripts/gitlab-build.sh armv7-unknown-linux-gnueabihf armv7-unknown-linux-gnueabihf armhf arm-linux-gnueabihf-gcc arm-linux-gnueabihf-g++ ubuntu
|
||||
tags:
|
||||
- rust-arm
|
||||
artifacts:
|
||||
@@ -102,12 +101,12 @@ linux-arm:
|
||||
stage: build
|
||||
image: parity/rust-arm:gitlab-ci
|
||||
only:
|
||||
- stable
|
||||
- beta
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- scripts/gitlab-build.sh arm-unknown-linux-gnueabihf arm-unknown-linux-gnueabihf armhf arm-linux-gnueabihf-gcc arm-linux-gnueabihf-g++
|
||||
- scripts/gitlab-build.sh arm-unknown-linux-gnueabihf arm-unknown-linux-gnueabihf armhf arm-linux-gnueabihf-gcc arm-linux-gnueabihf-g++ ubuntu
|
||||
tags:
|
||||
- rust-arm
|
||||
artifacts:
|
||||
@@ -118,12 +117,12 @@ linux-aarch64:
|
||||
stage: build
|
||||
image: parity/rust-arm64:gitlab-ci
|
||||
only:
|
||||
- stable
|
||||
- beta
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- scripts/gitlab-build.sh aarch64-unknown-linux-gnu aarch64-unknown-linux-gnu arm64 aarch64-linux-gnu-gcc aarch64-linux-gnu-g++
|
||||
- scripts/gitlab-build.sh aarch64-unknown-linux-gnu aarch64-unknown-linux-gnu arm64 aarch64-linux-gnu-gcc aarch64-linux-gnu-g++ ubuntu
|
||||
tags:
|
||||
- rust-arm
|
||||
artifacts:
|
||||
@@ -132,30 +131,30 @@ linux-aarch64:
|
||||
name: "aarch64-unknown-linux-gnu_parity"
|
||||
linux-snap:
|
||||
stage: build
|
||||
image: parity/snapcraft:gitlab-ci
|
||||
image: snapcore/snapcraft:stable
|
||||
only:
|
||||
- stable
|
||||
- beta
|
||||
- tags
|
||||
- triggers
|
||||
script:
|
||||
- scripts/gitlab-build.sh x86_64-unknown-snap-gnu x86_64-unknown-linux-gnu amd64 gcc g++
|
||||
- scripts/gitlab-build.sh x86_64-unknown-snap-gnu x86_64-unknown-linux-gnu amd64 gcc g++ snap
|
||||
tags:
|
||||
- rust-stable
|
||||
artifacts:
|
||||
paths:
|
||||
- scripts/parity_*_amd64.snap
|
||||
- parity.zip
|
||||
name: "stable-x86_64-unknown-snap-gnu_parity"
|
||||
allow_failure: true
|
||||
darwin:
|
||||
stage: build
|
||||
only:
|
||||
- stable
|
||||
- beta
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- scripts/gitlab-build.sh x86_64-apple-darwin x86_64-apple-darwin macos gcc g++
|
||||
- scripts/gitlab-build.sh x86_64-apple-darwin x86_64-apple-darwin macos gcc g++ macos
|
||||
tags:
|
||||
- osx
|
||||
artifacts:
|
||||
@@ -168,12 +167,12 @@ windows:
|
||||
untracked: true
|
||||
stage: build
|
||||
only:
|
||||
- stable
|
||||
- beta
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- sh scripts/gitlab-build.sh x86_64-pc-windows-msvc x86_64-pc-windows-msvc installer "" "" ""
|
||||
- sh scripts/gitlab-build.sh x86_64-pc-windows-msvc x86_64-pc-windows-msvc installer "" "" windows
|
||||
tags:
|
||||
- rust-windows
|
||||
artifacts:
|
||||
@@ -183,14 +182,12 @@ windows:
|
||||
docker-build:
|
||||
stage: build
|
||||
only:
|
||||
- stable
|
||||
- beta
|
||||
- tags
|
||||
- triggers
|
||||
before_script:
|
||||
- docker info
|
||||
script:
|
||||
- DOCKER_TAG=$CI_BUILD_REF_NAME
|
||||
- if [ "$CI_BUILD_REF_NAME" == "beta-release" ]; then DOCKER_TAG="latest"; else DOCKER_TAG=$CI_BUILD_REF_NAME; fi
|
||||
- echo "Tag:" $DOCKER_TAG
|
||||
- docker login -u $Docker_Hub_User_Parity -p $Docker_Hub_Pass_Parity
|
||||
- scripts/docker-build.sh $DOCKER_TAG
|
||||
@@ -263,8 +260,6 @@ push-release:
|
||||
- triggers
|
||||
image: parity/rust:gitlab-ci
|
||||
script:
|
||||
- rustup default stable
|
||||
- curl --data "secret=$RELEASES_SECRET" http://update.parity.io:1337/push-release/$CI_BUILD_REF_NAME/$CI_BUILD_REF
|
||||
- curl --data "secret=$RELEASES_SECRET" http://update.parity.io:1338/push-release/$CI_BUILD_REF_NAME/$CI_BUILD_REF
|
||||
- scripts/gitlab-push-release.sh
|
||||
tags:
|
||||
- curl
|
||||
|
||||
113
Cargo.lock
generated
113
Cargo.lock
generated
@@ -25,6 +25,11 @@ name = "ansi_term"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "ansi_term"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "app_dirs"
|
||||
version = "1.1.1"
|
||||
@@ -177,6 +182,11 @@ name = "bitflags"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "bloomable"
|
||||
version = "0.1.0"
|
||||
@@ -263,15 +273,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.26.2"
|
||||
version = "2.29.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"atty 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"term_size 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"textwrap 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@@ -363,7 +372,7 @@ dependencies = [
|
||||
"bloomable 0.1.0",
|
||||
"ethcore-bigint 0.1.3",
|
||||
"ethcore-bytes 0.1.0",
|
||||
"ethcore-util 1.8.7",
|
||||
"ethcore-util 1.8.10",
|
||||
"ethjson 0.1.0",
|
||||
"hash 0.1.0",
|
||||
"heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -577,7 +586,7 @@ dependencies = [
|
||||
"ethcore-ipc-nano 1.8.0",
|
||||
"ethcore-logger 1.8.0",
|
||||
"ethcore-stratum 1.8.0",
|
||||
"ethcore-util 1.8.7",
|
||||
"ethcore-util 1.8.10",
|
||||
"ethjson 0.1.0",
|
||||
"ethkey 0.2.0",
|
||||
"ethstore 0.1.0",
|
||||
@@ -612,7 +621,6 @@ dependencies = [
|
||||
"rlp_derive 0.1.0",
|
||||
"rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"semantic_version 0.1.0",
|
||||
"snappy 0.1.0",
|
||||
"stats 0.1.0",
|
||||
"table 0.1.0",
|
||||
@@ -673,7 +681,7 @@ version = "1.8.0"
|
||||
dependencies = [
|
||||
"ethcore-bigint 0.1.3",
|
||||
"ethcore-devtools 1.8.0",
|
||||
"ethcore-util 1.8.7",
|
||||
"ethcore-util 1.8.10",
|
||||
"nanomsg 0.5.1 (git+https://github.com/paritytech/nanomsg.rs.git?branch=parity-1.7)",
|
||||
"semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@@ -723,7 +731,7 @@ dependencies = [
|
||||
"ethcore-ipc 1.8.0",
|
||||
"ethcore-ipc-codegen 1.8.0",
|
||||
"ethcore-ipc-nano 1.8.0",
|
||||
"ethcore-util 1.8.7",
|
||||
"ethcore-util 1.8.10",
|
||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"nanomsg 0.5.1 (git+https://github.com/paritytech/nanomsg.rs.git?branch=parity-1.7)",
|
||||
"semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -742,7 +750,7 @@ dependencies = [
|
||||
"ethcore-ipc 1.8.0",
|
||||
"ethcore-ipc-codegen 1.8.0",
|
||||
"ethcore-network 1.8.0",
|
||||
"ethcore-util 1.8.7",
|
||||
"ethcore-util 1.8.10",
|
||||
"evm 0.1.0",
|
||||
"futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hash 0.1.0",
|
||||
@@ -794,7 +802,7 @@ dependencies = [
|
||||
"ethcore-devtools 1.8.0",
|
||||
"ethcore-io 1.8.0",
|
||||
"ethcore-logger 1.8.0",
|
||||
"ethcore-util 1.8.7",
|
||||
"ethcore-util 1.8.10",
|
||||
"ethcrypto 0.1.0",
|
||||
"ethkey 0.2.0",
|
||||
"hash 0.1.0",
|
||||
@@ -803,12 +811,15 @@ dependencies = [
|
||||
"libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mio 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-version 1.8.10",
|
||||
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"path 0.1.0",
|
||||
"rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rlp 0.2.0",
|
||||
"rust-crypto 0.2.36 (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.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"slab 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -829,7 +840,7 @@ dependencies = [
|
||||
"ethcore-ipc-codegen 1.8.0",
|
||||
"ethcore-ipc-nano 1.8.0",
|
||||
"ethcore-logger 1.8.0",
|
||||
"ethcore-util 1.8.7",
|
||||
"ethcore-util 1.8.10",
|
||||
"ethcrypto 0.1.0",
|
||||
"ethkey 0.2.0",
|
||||
"futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -865,7 +876,7 @@ dependencies = [
|
||||
"ethcore-ipc-codegen 1.8.0",
|
||||
"ethcore-ipc-nano 1.8.0",
|
||||
"ethcore-logger 1.8.0",
|
||||
"ethcore-util 1.8.7",
|
||||
"ethcore-util 1.8.10",
|
||||
"hash 0.1.0",
|
||||
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)",
|
||||
"jsonrpc-macros 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)",
|
||||
@@ -878,7 +889,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ethcore-util"
|
||||
version = "1.8.7"
|
||||
version = "1.8.10"
|
||||
dependencies = [
|
||||
"clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"elastic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -1013,7 +1024,7 @@ dependencies = [
|
||||
"ethcore-ipc-nano 1.8.0",
|
||||
"ethcore-light 1.8.0",
|
||||
"ethcore-network 1.8.0",
|
||||
"ethcore-util 1.8.7",
|
||||
"ethcore-util 1.8.10",
|
||||
"ethkey 0.2.0",
|
||||
"hash 0.1.0",
|
||||
"heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -1040,7 +1051,7 @@ dependencies = [
|
||||
"common-types 0.1.0",
|
||||
"ethcore-bigint 0.1.3",
|
||||
"ethcore-logger 1.8.0",
|
||||
"ethcore-util 1.8.7",
|
||||
"ethcore-util 1.8.10",
|
||||
"ethjson 0.1.0",
|
||||
"evmjit 1.8.0",
|
||||
"hash 0.1.0",
|
||||
@@ -1062,7 +1073,7 @@ dependencies = [
|
||||
"ethcore 1.8.0",
|
||||
"ethcore-bigint 0.1.3",
|
||||
"ethcore-bytes 0.1.0",
|
||||
"ethcore-util 1.8.7",
|
||||
"ethcore-util 1.8.10",
|
||||
"ethjson 0.1.0",
|
||||
"evm 0.1.0",
|
||||
"panic_hook 0.1.0",
|
||||
@@ -1360,7 +1371,8 @@ dependencies = [
|
||||
"ethcore-bigint 0.1.3",
|
||||
"ethcore-ipc 1.8.0",
|
||||
"ethcore-ipc-codegen 1.8.0",
|
||||
"ethcore-util 1.8.7",
|
||||
"ethcore-util 1.8.10",
|
||||
"parity-version 1.8.10",
|
||||
"semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@@ -1871,7 +1883,7 @@ dependencies = [
|
||||
"ethcore-bytes 0.1.0",
|
||||
"ethcore-io 1.8.0",
|
||||
"ethcore-network 1.8.0",
|
||||
"ethcore-util 1.8.7",
|
||||
"ethcore-util 1.8.10",
|
||||
"futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"kvdb-memorydb 0.1.0",
|
||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -2070,11 +2082,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "parity"
|
||||
version = "1.8.7"
|
||||
version = "1.8.10"
|
||||
dependencies = [
|
||||
"ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"app_dirs 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clap 2.26.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clap 2.29.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ctrlc 1.1.1 (git+https://github.com/paritytech/rust-ctrlc.git)",
|
||||
"daemonize 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -2094,7 +2106,7 @@ dependencies = [
|
||||
"ethcore-network 1.8.0",
|
||||
"ethcore-secretstore 1.0.0",
|
||||
"ethcore-stratum 1.8.0",
|
||||
"ethcore-util 1.8.7",
|
||||
"ethcore-util 1.8.10",
|
||||
"ethkey 0.2.0",
|
||||
"ethsync 1.8.0",
|
||||
"fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -2120,6 +2132,7 @@ dependencies = [
|
||||
"parity-rpc 1.8.0",
|
||||
"parity-rpc-client 1.4.0",
|
||||
"parity-updater 1.8.0",
|
||||
"parity-version 1.8.10",
|
||||
"parity-whisper 0.1.0",
|
||||
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"path 0.1.0",
|
||||
@@ -2134,6 +2147,8 @@ dependencies = [
|
||||
"serde 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"term_size 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -2150,7 +2165,7 @@ dependencies = [
|
||||
"ethcore-bigint 0.1.3",
|
||||
"ethcore-bytes 0.1.0",
|
||||
"ethcore-devtools 1.8.0",
|
||||
"ethcore-util 1.8.7",
|
||||
"ethcore-util 1.8.10",
|
||||
"fetch 0.1.0",
|
||||
"futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures-cpupool 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -2166,6 +2181,7 @@ dependencies = [
|
||||
"parity-hash-fetch 1.8.0",
|
||||
"parity-reactor 0.1.0",
|
||||
"parity-ui 1.8.0",
|
||||
"parity-version 1.8.10",
|
||||
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -2212,7 +2228,7 @@ dependencies = [
|
||||
"ethabi 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ethcore-bigint 0.1.3",
|
||||
"ethcore-bytes 0.1.0",
|
||||
"ethcore-util 1.8.7",
|
||||
"ethcore-util 1.8.10",
|
||||
"fetch 0.1.0",
|
||||
"futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hash 0.1.0",
|
||||
@@ -2234,7 +2250,7 @@ dependencies = [
|
||||
"ethcore 1.8.0",
|
||||
"ethcore-bigint 0.1.3",
|
||||
"ethcore-bytes 0.1.0",
|
||||
"ethcore-util 1.8.7",
|
||||
"ethcore-util 1.8.10",
|
||||
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)",
|
||||
"jsonrpc-http-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)",
|
||||
"multihash 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -2248,7 +2264,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"ethcore 1.8.0",
|
||||
"ethcore-io 1.8.0",
|
||||
"ethcore-util 1.8.7",
|
||||
"ethcore-util 1.8.10",
|
||||
"ethkey 0.2.0",
|
||||
"kvdb 0.1.0",
|
||||
"kvdb-memorydb 0.1.0",
|
||||
@@ -2264,7 +2280,7 @@ name = "parity-machine"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"ethcore-bigint 0.1.3",
|
||||
"ethcore-util 1.8.7",
|
||||
"ethcore-util 1.8.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2292,7 +2308,7 @@ dependencies = [
|
||||
"ethcore-light 1.8.0",
|
||||
"ethcore-logger 1.8.0",
|
||||
"ethcore-network 1.8.0",
|
||||
"ethcore-util 1.8.7",
|
||||
"ethcore-util 1.8.10",
|
||||
"ethcrypto 0.1.0",
|
||||
"ethjson 0.1.0",
|
||||
"ethkey 0.2.0",
|
||||
@@ -2318,6 +2334,7 @@ dependencies = [
|
||||
"order-stat 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-reactor 0.1.0",
|
||||
"parity-updater 1.8.0",
|
||||
"parity-version 1.8.10",
|
||||
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pretty_assertions 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -2388,7 +2405,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "parity-ui-precompiled"
|
||||
version = "1.4.0"
|
||||
source = "git+https://github.com/paritytech/js-precompiled.git?branch=stable#bbc5b6c3e3a43ab21b94d37922cdbed766c7b5c8"
|
||||
source = "git+https://github.com/paritytech/js-precompiled.git?branch=stable#d1ee895501ad2914c523635ff601b3bd35f846b8"
|
||||
dependencies = [
|
||||
"parity-dapps-glue 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@@ -2403,18 +2420,31 @@ dependencies = [
|
||||
"ethcore-bytes 0.1.0",
|
||||
"ethcore-ipc 1.8.0",
|
||||
"ethcore-ipc-codegen 1.8.0",
|
||||
"ethcore-util 1.8.7",
|
||||
"ethcore-util 1.8.10",
|
||||
"ethsync 1.8.0",
|
||||
"futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-common-types 1.8.0",
|
||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-hash-fetch 1.8.0",
|
||||
"parity-reactor 0.1.0",
|
||||
"parity-version 1.8.10",
|
||||
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"path 0.1.0",
|
||||
"target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parity-version"
|
||||
version = "1.8.10"
|
||||
dependencies = [
|
||||
"ethcore-bytes 0.1.0",
|
||||
"rlp 0.2.0",
|
||||
"rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vergen 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parity-wasm"
|
||||
version = "0.15.3"
|
||||
@@ -2867,7 +2897,7 @@ name = "rpc-cli"
|
||||
version = "1.4.0"
|
||||
dependencies = [
|
||||
"bigint 4.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ethcore-util 1.8.7",
|
||||
"ethcore-util 1.8.10",
|
||||
"futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-rpc 1.8.0",
|
||||
"parity-rpc-client 1.4.0",
|
||||
@@ -2975,10 +3005,6 @@ dependencies = [
|
||||
"libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semantic_version"
|
||||
version = "0.1.0"
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "0.1.20"
|
||||
@@ -3272,10 +3298,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.8.0"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"term_size 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@@ -3592,7 +3617,7 @@ dependencies = [
|
||||
"common-types 0.1.0",
|
||||
"ethcore-bigint 0.1.3",
|
||||
"ethcore-bytes 0.1.0",
|
||||
"ethcore-util 1.8.7",
|
||||
"ethcore-util 1.8.10",
|
||||
"ethjson 0.1.0",
|
||||
"evmjit 1.8.0",
|
||||
"hash 0.1.0",
|
||||
@@ -3614,7 +3639,7 @@ dependencies = [
|
||||
"byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ethcore-bigint 0.1.3",
|
||||
"ethcore-logger 1.8.0",
|
||||
"ethcore-util 1.8.7",
|
||||
"ethcore-util 1.8.10",
|
||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-wasm 0.15.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vm 0.1.0",
|
||||
@@ -3627,7 +3652,7 @@ version = "0.1.0"
|
||||
source = "git+https://github.com/paritytech/wasm-utils#3d59f7ca0661317bc66894a26b2a5a319fa5d229"
|
||||
dependencies = [
|
||||
"byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clap 2.26.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clap 2.29.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -3706,6 +3731,7 @@ dependencies = [
|
||||
"checksum adler32 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6cbd0b9af8587c72beadc9f72d35b9fbb070982c9e6203e46e93f10df25f8f45"
|
||||
"checksum advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a"
|
||||
"checksum aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "500909c4f87a9e52355b26626d890833e9e1d53ac566db76c36faa984b889699"
|
||||
"checksum ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6b3568b48b7cefa6b8ce125f9bb4989e52fbcc29ebea88df04cc7c5f12f70455"
|
||||
"checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6"
|
||||
"checksum app_dirs 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b7d1c0d48a81bbb13043847f957971f4d87c81542d80ece5e84ba3cba4058fd4"
|
||||
"checksum arrayvec 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)" = "699e63a93b79d717e8c3b5eb1b28b7780d0d6d9e59a72eb769291c83b0c8dc67"
|
||||
@@ -3725,6 +3751,7 @@ dependencies = [
|
||||
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
|
||||
"checksum bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1370e9fc2a6ae53aea8b7a5110edbd08836ed87c88736dfabccade1c2b44bff4"
|
||||
"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5"
|
||||
"checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf"
|
||||
"checksum bloomchain 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3f421095d2a76fc24cd3fb3f912b90df06be7689912b1bdb423caefae59c258d"
|
||||
"checksum bn 0.4.4 (git+https://github.com/paritytech/bn)" = "<none>"
|
||||
"checksum byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855"
|
||||
@@ -3734,7 +3761,7 @@ dependencies = [
|
||||
"checksum cc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7db2f146208d7e0fbee761b09cd65a7f51ccc38705d4e7262dad4d73b12a76b1"
|
||||
"checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de"
|
||||
"checksum cid 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "34aa7da06f10541fbca6850719cdaa8fa03060a5d2fb33840f149cf8133a00c7"
|
||||
"checksum clap 2.26.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3451e409013178663435d6f15fdb212f14ee4424a3d74f979d081d0a66b6f1f2"
|
||||
"checksum clap 2.29.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8f4a2b3bb7ef3c672d7c13d15613211d5a6976b6892c598b0fcb5d40765f19c2"
|
||||
"checksum clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)" = "5b4fabf979ddf6419a313c1c0ada4a5b95cfd2049c56e8418d622d27b4b6ff32"
|
||||
"checksum clippy 0.0.163 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad3f3dc94d81a6505eb28bf545b501fc9d7525ee9864df5a4b2b6d82629f038"
|
||||
"checksum clippy 0.0.90 (registry+https://github.com/rust-lang/crates.io-index)" = "d19bda68c3db98e3a780342f6101b44312fef20a5f13ce756d1202a35922b01b"
|
||||
@@ -3946,7 +3973,7 @@ dependencies = [
|
||||
"checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1"
|
||||
"checksum term_size 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2b6b55df3198cc93372e85dd2ed817f0e38ce8cc0f22eb32391bfad9c4bf209"
|
||||
"checksum termios 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d5d9cf598a6d7ce700a4e6a9199da127e6819a61e64b68609683cc9a01b5683a"
|
||||
"checksum textwrap 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df8e08afc40ae3459e4838f303e465aa50d823df8d7f83ca88108f6d3afe7edd"
|
||||
"checksum textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693"
|
||||
"checksum thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1697c4b57aeeb7a536b647165a2825faddffb1d3bad386d507709bd51a90bb14"
|
||||
"checksum time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)" = "d5d788d3aa77bc0ef3e9621256885555368b47bd495c13dd2e7413c89f845520"
|
||||
"checksum tiny-keccak 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d52d12ad79e4063e0cb0ca5efa202ed7244b6ce4d25f4d3abe410b2a66128292"
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[package]
|
||||
description = "Parity Ethereum client"
|
||||
name = "parity"
|
||||
version = "1.8.7"
|
||||
# NOTE Make sure to update util/version/Cargo.toml as well
|
||||
version = "1.8.10"
|
||||
license = "GPL-3.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
build = "build.rs"
|
||||
@@ -12,6 +13,8 @@ env_logger = "0.4"
|
||||
rustc-hex = "1.0"
|
||||
docopt = "0.8"
|
||||
clap = "2"
|
||||
term_size = "0.3"
|
||||
textwrap = "0.9"
|
||||
time = "0.1"
|
||||
num_cpus = "1.2"
|
||||
number_prefix = "0.2"
|
||||
@@ -58,6 +61,7 @@ parity-reactor = { path = "util/reactor" }
|
||||
parity-rpc = { path = "rpc" }
|
||||
parity-rpc-client = { path = "rpc_client" }
|
||||
parity-updater = { path = "updater" }
|
||||
parity-version = { path = "util/version" }
|
||||
parity-whisper = { path = "whisper" }
|
||||
path = { path = "util/path" }
|
||||
panic_hook = { path = "panic_hook" }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# [Parity](https://parity.io/) - fast, light, and robust Ethereum client
|
||||
# [Parity](https://parity.io/) - fast, light, and robust Ethereum client
|
||||
|
||||
[](https://gitlab.parity.io/parity/parity/commits/master)
|
||||
[](https://build.snapcraft.io/user/paritytech/parity)
|
||||
|
||||
@@ -37,6 +37,7 @@ parity-hash-fetch = { path = "../hash-fetch" }
|
||||
parity-reactor = { path = "../util/reactor" }
|
||||
parity-ui = { path = "./ui" }
|
||||
hash = { path = "../util/hash" }
|
||||
parity-version = { path = "../util/version" }
|
||||
|
||||
clippy = { version = "0.0.103", optional = true}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
use hyper::{self, mime, header};
|
||||
use hyper::StatusCode;
|
||||
|
||||
use util::version;
|
||||
use parity_version::version;
|
||||
|
||||
use handlers::add_security_headers;
|
||||
use Embeddable;
|
||||
|
||||
@@ -44,6 +44,7 @@ extern crate parity_dapps_glue as parity_dapps;
|
||||
extern crate parity_hash_fetch as hash_fetch;
|
||||
extern crate parity_ui;
|
||||
extern crate hash;
|
||||
extern crate parity_version;
|
||||
|
||||
#[macro_use]
|
||||
extern crate futures;
|
||||
|
||||
@@ -74,7 +74,6 @@ vm = { path = "vm" }
|
||||
wasm = { path = "wasm" }
|
||||
hash = { path = "../util/hash" }
|
||||
triehash = { path = "../util/triehash" }
|
||||
semantic_version = { path = "../util/semantic_version" }
|
||||
unexpected = { path = "../util/unexpected" }
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
@@ -90,7 +90,14 @@ impl Pending {
|
||||
match self.requests[idx].respond_local(cache) {
|
||||
Some(response) => {
|
||||
self.requests.supply_response_unchecked(&response);
|
||||
|
||||
// update header and back-references after each from-cache
|
||||
// response to ensure that the requests are left in a consistent
|
||||
// state and increase the likelihood of being able to answer
|
||||
// the next request from cache.
|
||||
self.update_header_refs(idx, &response);
|
||||
self.fill_unanswered();
|
||||
|
||||
self.responses.push(response);
|
||||
}
|
||||
None => break,
|
||||
|
||||
@@ -52,6 +52,8 @@
|
||||
"gasLimit": "0x1000000"
|
||||
},
|
||||
"nodes": [
|
||||
"enode://6332792c4a00e3e4ee0926ed89e0d27ef985424d97b6a45bf0f23e51f0dcb5e66b875777506458aea7af6f9e4ffb69f43f3778ee73c81ed9d34c51c4b16b0b0f@52.232.243.152:30303",
|
||||
"enode://94c15d1b9e2fe7ce56e458b9a3b672ef11894ddedd0c6f247e0f1d3487f52b66208fb4aeb8179fce6e3a749ea93ed147c37976d67af557508d199d9594c35f09@192.81.208.223:30303",
|
||||
"enode://20c9ad97c081d63397d7b685a412227a40e23c8bdc6688c6f37e97cfbc22d2b4d1db1510d8f61e6a8866ad7f0e17c02b14182d37ea7c3c8b9c2683aeb6b733a1@52.169.14.227:30303",
|
||||
"enode://6ce05930c72abc632c58e2e4324f7c7ea478cec0ed4fa2528982cf34483094e9cbc9216e7aa349691242576d552a2a56aaeae426c5303ded677ce455ba1acd9d@13.84.180.240:30303"
|
||||
],
|
||||
|
||||
@@ -257,9 +257,9 @@ impl AccountProvider {
|
||||
Ok(Address::from(account.address).into())
|
||||
}
|
||||
|
||||
/// Import a new presale wallet.
|
||||
pub fn import_wallet(&self, json: &[u8], password: &str) -> Result<Address, Error> {
|
||||
let account = self.sstore.import_wallet(SecretVaultRef::Root, json, password)?;
|
||||
/// Import a new wallet.
|
||||
pub fn import_wallet(&self, json: &[u8], password: &str, gen_id: bool) -> Result<Address, Error> {
|
||||
let account = self.sstore.import_wallet(SecretVaultRef::Root, json, password, gen_id)?;
|
||||
if self.blacklisted_accounts.contains(&account.address) {
|
||||
self.sstore.remove_account(&account, password)?;
|
||||
return Err(SSError::InvalidAccount.into());
|
||||
|
||||
@@ -41,7 +41,6 @@ use itertools::{self, Itertools};
|
||||
use rlp::{UntrustedRlp, encode};
|
||||
use bigint::prelude::{U256, U128};
|
||||
use bigint::hash::{H256, H520};
|
||||
use semantic_version::SemanticVersion;
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
use unexpected::{Mismatch, OutOfBounds};
|
||||
use util::Address;
|
||||
@@ -483,8 +482,6 @@ impl IoHandler<()> for TransitionHandler {
|
||||
impl Engine<EthereumMachine> for AuthorityRound {
|
||||
fn name(&self) -> &str { "AuthorityRound" }
|
||||
|
||||
fn version(&self) -> SemanticVersion { SemanticVersion::new(1, 0, 0) }
|
||||
|
||||
fn machine(&self) -> &EthereumMachine { &self.machine }
|
||||
|
||||
/// Two fields - consensus step and the corresponding proposer signature.
|
||||
@@ -919,7 +916,6 @@ mod tests {
|
||||
fn has_valid_metadata() {
|
||||
let engine = Spec::new_test_round().engine;
|
||||
assert!(!engine.name().is_empty());
|
||||
assert!(engine.version().major >= 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -29,7 +29,6 @@ use ethjson;
|
||||
use header::Header;
|
||||
use client::EngineClient;
|
||||
use machine::{AuxiliaryData, Call, EthereumMachine};
|
||||
use semantic_version::SemanticVersion;
|
||||
use super::signer::EngineSigner;
|
||||
use super::validator_set::{ValidatorSet, SimpleList, new_validator_set};
|
||||
|
||||
@@ -95,7 +94,6 @@ impl BasicAuthority {
|
||||
|
||||
impl Engine<EthereumMachine> for BasicAuthority {
|
||||
fn name(&self) -> &str { "BasicAuthority" }
|
||||
fn version(&self) -> SemanticVersion { SemanticVersion::new(1, 0, 0) }
|
||||
|
||||
fn machine(&self) -> &EthereumMachine { &self.machine }
|
||||
|
||||
@@ -218,7 +216,6 @@ mod tests {
|
||||
fn has_valid_metadata() {
|
||||
let engine = new_test_authority().engine;
|
||||
assert!(!engine.name().is_empty());
|
||||
assert!(engine.version().major >= 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -54,7 +54,6 @@ use ethkey::Signature;
|
||||
use parity_machine::{Machine, LocalizedMachine as Localized};
|
||||
use bigint::prelude::U256;
|
||||
use bigint::hash::H256;
|
||||
use semantic_version::SemanticVersion;
|
||||
use util::*;
|
||||
use unexpected::{Mismatch, OutOfBounds};
|
||||
use bytes::Bytes;
|
||||
@@ -178,8 +177,6 @@ pub enum EpochChange<M: Machine> {
|
||||
pub trait Engine<M: Machine>: Sync + Send {
|
||||
/// The name of this engine.
|
||||
fn name(&self) -> &str;
|
||||
/// The version of this engine. Should be of the form
|
||||
fn version(&self) -> SemanticVersion { SemanticVersion::new(0, 0, 0) }
|
||||
|
||||
/// Get access to the underlying state machine.
|
||||
// TODO: decouple.
|
||||
|
||||
@@ -50,7 +50,6 @@ use super::transition::TransitionHandler;
|
||||
use super::vote_collector::VoteCollector;
|
||||
use self::message::*;
|
||||
use self::params::TendermintParams;
|
||||
use semantic_version::SemanticVersion;
|
||||
use machine::{AuxiliaryData, EthereumMachine};
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]
|
||||
@@ -443,8 +442,6 @@ impl Tendermint {
|
||||
impl Engine<EthereumMachine> for Tendermint {
|
||||
fn name(&self) -> &str { "Tendermint" }
|
||||
|
||||
fn version(&self) -> SemanticVersion { SemanticVersion::new(1, 0, 0) }
|
||||
|
||||
/// (consensus view, proposal signature, authority signatures)
|
||||
fn seal_fields(&self) -> usize { 3 }
|
||||
|
||||
@@ -857,7 +854,6 @@ mod tests {
|
||||
fn has_valid_metadata() {
|
||||
let engine = Spec::new_test_tendermint().engine;
|
||||
assert!(!engine.name().is_empty());
|
||||
assert!(engine.version().major >= 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -31,7 +31,6 @@ use engines::{self, Engine};
|
||||
use ethjson;
|
||||
use rlp::{self, UntrustedRlp};
|
||||
use machine::EthereumMachine;
|
||||
use semantic_version::SemanticVersion;
|
||||
|
||||
/// Number of blocks in an ethash snapshot.
|
||||
// make dependent on difficulty incrment divisor?
|
||||
@@ -169,7 +168,6 @@ impl engines::EpochVerifier<EthereumMachine> for Arc<Ethash> {
|
||||
|
||||
impl Engine<EthereumMachine> for Arc<Ethash> {
|
||||
fn name(&self) -> &str { "Ethash" }
|
||||
fn version(&self) -> SemanticVersion { SemanticVersion::new(1, 0, 0) }
|
||||
fn machine(&self) -> &EthereumMachine { &self.machine }
|
||||
|
||||
// Two fields - nonce and mix.
|
||||
@@ -577,7 +575,6 @@ mod tests {
|
||||
fn has_valid_metadata() {
|
||||
let engine = test_spec().engine;
|
||||
assert!(!engine.name().is_empty());
|
||||
assert!(engine.version().major >= 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -30,15 +30,6 @@ pub use self::denominations::*;
|
||||
use machine::EthereumMachine;
|
||||
use super::spec::*;
|
||||
|
||||
/// Most recent fork block that we support on Mainnet.
|
||||
pub const FORK_SUPPORTED_FOUNDATION: u64 = 4370000;
|
||||
|
||||
/// Most recent fork block that we support on Ropsten.
|
||||
pub const FORK_SUPPORTED_ROPSTEN: u64 = 10;
|
||||
|
||||
/// Most recent fork block that we support on Kovan.
|
||||
pub const FORK_SUPPORTED_KOVAN: u64 = 0;
|
||||
|
||||
fn load<'a, T: Into<Option<SpecParams<'a>>>>(params: T, b: &[u8]) -> Spec {
|
||||
match params.into() {
|
||||
Some(params) => Spec::load(params, b),
|
||||
|
||||
@@ -110,7 +110,6 @@ extern crate memorydb;
|
||||
extern crate patricia_trie as trie;
|
||||
extern crate triehash;
|
||||
extern crate ansi_term;
|
||||
extern crate semantic_version;
|
||||
extern crate unexpected;
|
||||
extern crate kvdb;
|
||||
extern crate kvdb_rocksdb;
|
||||
|
||||
@@ -35,6 +35,15 @@ use std::cell::{RefCell, Cell};
|
||||
|
||||
const STORAGE_CACHE_ITEMS: usize = 8192;
|
||||
|
||||
/// Boolean type for clean/dirty status.
|
||||
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
|
||||
pub enum Filth {
|
||||
/// Data has not been changed.
|
||||
Clean,
|
||||
/// Data has been changed.
|
||||
Dirty,
|
||||
}
|
||||
|
||||
/// Single account in the system.
|
||||
/// Keeps track of changes to the code and storage.
|
||||
/// The changes are applied in `commit_storage` and `commit_code`
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::{fs, io};
|
||||
use std::io::Write;
|
||||
use std::path::{PathBuf, Path};
|
||||
use std::collections::HashMap;
|
||||
use time;
|
||||
@@ -152,31 +153,39 @@ impl<T> DiskDirectory<T> where T: KeyFileManager {
|
||||
)
|
||||
}
|
||||
|
||||
/// insert account with given file name
|
||||
pub fn insert_with_filename(&self, account: SafeAccount, filename: String) -> Result<SafeAccount, Error> {
|
||||
|
||||
/// insert account with given filename. if the filename is a duplicate of any stored account and dedup is set to
|
||||
/// true, a random suffix is appended to the filename.
|
||||
pub fn insert_with_filename(&self, account: SafeAccount, mut filename: String, dedup: bool) -> Result<SafeAccount, Error> {
|
||||
// path to keyfile
|
||||
let mut keyfile_path = self.path.join(filename.as_str());
|
||||
|
||||
// check for duplicate filename and append random suffix
|
||||
if dedup && keyfile_path.exists() {
|
||||
let suffix = ::random::random_string(4);
|
||||
filename.push_str(&format!("-{}", suffix));
|
||||
keyfile_path.set_file_name(&filename);
|
||||
}
|
||||
|
||||
// update account filename
|
||||
let original_account = account.clone();
|
||||
let mut account = account;
|
||||
account.filename = Some(filename.clone());
|
||||
account.filename = Some(filename);
|
||||
|
||||
{
|
||||
// Path to keyfile
|
||||
let mut keyfile_path = self.path.clone();
|
||||
keyfile_path.push(filename.as_str());
|
||||
|
||||
// save the file
|
||||
let mut file = fs::File::create(&keyfile_path)?;
|
||||
if let Err(err) = self.key_manager.write(original_account, &mut file).map_err(|e| Error::Custom(format!("{:?}", e))) {
|
||||
drop(file);
|
||||
fs::remove_file(keyfile_path).expect("Expected to remove recently created file");
|
||||
return Err(err);
|
||||
}
|
||||
|
||||
// write key content
|
||||
self.key_manager.write(original_account, &mut file).map_err(|e| Error::Custom(format!("{:?}", e)))?;
|
||||
|
||||
file.flush()?;
|
||||
|
||||
if let Err(_) = restrict_permissions_to_owner(keyfile_path.as_path()) {
|
||||
drop(file);
|
||||
fs::remove_file(keyfile_path).expect("Expected to remove recently created file");
|
||||
return Err(Error::Io(io::Error::last_os_error()));
|
||||
}
|
||||
|
||||
file.sync_all()?;
|
||||
}
|
||||
|
||||
Ok(account)
|
||||
@@ -199,17 +208,13 @@ impl<T> KeyDirectory for DiskDirectory<T> where T: KeyFileManager {
|
||||
|
||||
fn update(&self, account: SafeAccount) -> Result<SafeAccount, Error> {
|
||||
// Disk store handles updates correctly iff filename is the same
|
||||
self.insert(account)
|
||||
let filename = account_filename(&account);
|
||||
self.insert_with_filename(account, filename, false)
|
||||
}
|
||||
|
||||
fn insert(&self, account: SafeAccount) -> Result<SafeAccount, Error> {
|
||||
// build file path
|
||||
let filename = account.filename.as_ref().cloned().unwrap_or_else(|| {
|
||||
let timestamp = time::strftime("%Y-%m-%dT%H-%M-%S", &time::now_utc()).expect("Time-format string is valid.");
|
||||
format!("UTC--{}Z--{}", timestamp, Uuid::from(account.id))
|
||||
});
|
||||
|
||||
self.insert_with_filename(account, filename)
|
||||
let filename = account_filename(&account);
|
||||
self.insert_with_filename(account, filename, true)
|
||||
}
|
||||
|
||||
fn remove(&self, account: &SafeAccount) -> Result<(), Error> {
|
||||
@@ -285,6 +290,14 @@ impl KeyFileManager for DiskKeyFileManager {
|
||||
}
|
||||
}
|
||||
|
||||
fn account_filename(account: &SafeAccount) -> String {
|
||||
// build file path
|
||||
account.filename.clone().unwrap_or_else(|| {
|
||||
let timestamp = time::strftime("%Y-%m-%dT%H-%M-%S", &time::now_utc()).expect("Time-format string is valid.");
|
||||
format!("UTC--{}Z--{}", timestamp, Uuid::from(account.id))
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
extern crate tempdir;
|
||||
@@ -317,6 +330,38 @@ mod test {
|
||||
let _ = fs::remove_dir_all(dir);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_handle_duplicate_filenames() {
|
||||
// given
|
||||
let mut dir = env::temp_dir();
|
||||
dir.push("ethstore_should_handle_duplicate_filenames");
|
||||
let keypair = Random.generate().unwrap();
|
||||
let password = "hello world";
|
||||
let directory = RootDiskDirectory::create(dir.clone()).unwrap();
|
||||
|
||||
// when
|
||||
let account = SafeAccount::create(&keypair, [0u8; 16], password, 1024, "Test".to_owned(), "{}".to_owned());
|
||||
let filename = "test".to_string();
|
||||
let dedup = true;
|
||||
|
||||
directory.insert_with_filename(account.clone(), "foo".to_string(), dedup).unwrap();
|
||||
let file1 = directory.insert_with_filename(account.clone(), filename.clone(), dedup).unwrap().filename.unwrap();
|
||||
let file2 = directory.insert_with_filename(account.clone(), filename.clone(), dedup).unwrap().filename.unwrap();
|
||||
let file3 = directory.insert_with_filename(account.clone(), filename.clone(), dedup).unwrap().filename.unwrap();
|
||||
|
||||
// then
|
||||
// the first file should have the original names
|
||||
assert_eq!(file1, filename);
|
||||
|
||||
// the following duplicate files should have a suffix appended
|
||||
assert!(file2 != file3);
|
||||
assert_eq!(file2.len(), filename.len() + 5);
|
||||
assert_eq!(file3.len(), filename.len() + 5);
|
||||
|
||||
// cleanup
|
||||
let _ = fs::remove_dir_all(dir);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_manage_vaults() {
|
||||
// given
|
||||
|
||||
@@ -106,7 +106,7 @@ impl VaultDiskDirectory {
|
||||
fn copy_to_vault(&self, vault: &VaultDiskDirectory) -> Result<(), Error> {
|
||||
for account in self.load()? {
|
||||
let filename = account.filename.clone().expect("self is instance of DiskDirectory; DiskDirectory fills filename in load; qed");
|
||||
vault.insert_with_filename(account, filename)?;
|
||||
vault.insert_with_filename(account, filename, true)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -158,9 +158,14 @@ impl SecretStore for EthStore {
|
||||
self.insert_account(vault, keypair.secret().clone(), password)
|
||||
}
|
||||
|
||||
fn import_wallet(&self, vault: SecretVaultRef, json: &[u8], password: &str) -> Result<StoreAccountRef, Error> {
|
||||
fn import_wallet(&self, vault: SecretVaultRef, json: &[u8], password: &str, gen_id: bool) -> Result<StoreAccountRef, Error> {
|
||||
let json_keyfile = json::KeyFile::load(json).map_err(|_| Error::InvalidKeyFile("Invalid JSON format".to_owned()))?;
|
||||
let mut safe_account = SafeAccount::from_file(json_keyfile, None);
|
||||
|
||||
if gen_id {
|
||||
safe_account.id = Random::random();
|
||||
}
|
||||
|
||||
let secret = safe_account.crypto.secret(password).map_err(|_| Error::InvalidPassword)?;
|
||||
safe_account.address = KeyPair::from_secret(secret)?.address();
|
||||
self.store.import(vault, safe_account)
|
||||
|
||||
@@ -116,7 +116,7 @@ pub trait SecretStore: SimpleSecretStore {
|
||||
/// Imports presale wallet
|
||||
fn import_presale(&self, vault: SecretVaultRef, json: &[u8], password: &str) -> Result<StoreAccountRef, Error>;
|
||||
/// Imports existing JSON wallet
|
||||
fn import_wallet(&self, vault: SecretVaultRef, json: &[u8], password: &str) -> Result<StoreAccountRef, Error>;
|
||||
fn import_wallet(&self, vault: SecretVaultRef, json: &[u8], password: &str, gen_id: bool) -> Result<StoreAccountRef, Error>;
|
||||
/// Copies account between stores and vaults.
|
||||
fn copy_account(&self, new_store: &SimpleSecretStore, new_vault: SecretVaultRef, account: &StoreAccountRef, password: &str, new_password: &str) -> Result<(), Error>;
|
||||
/// Checks if password matches given account.
|
||||
|
||||
@@ -14,3 +14,4 @@ semver = "0.6"
|
||||
ethcore-ipc = { path = "../ipc/rpc" }
|
||||
ethcore-util = { path = "../util" }
|
||||
ethcore-bigint = { path = "../util/bigint" }
|
||||
parity-version = { path = "../util/version" }
|
||||
|
||||
@@ -20,6 +20,7 @@ extern crate semver;
|
||||
extern crate ethcore_util as util;
|
||||
extern crate ethcore_bigint as bigint;
|
||||
extern crate ethcore_ipc as ipc;
|
||||
extern crate parity_version as version;
|
||||
|
||||
mod types;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ use std::fmt;
|
||||
use std::str::FromStr;
|
||||
use semver::{Version};
|
||||
use bigint::hash::H160;
|
||||
use util::misc::raw_package_info;
|
||||
use version::raw_package_info;
|
||||
use release_track::ReleaseTrack;
|
||||
|
||||
/// Version information of a particular release.
|
||||
|
||||
@@ -4,7 +4,7 @@ set -e
|
||||
# variables
|
||||
UTCDATE=`date -u "+%Y%m%d-%H%M%S"`
|
||||
PACKAGES=( "parity" "etherscan" "shapeshift" "jsonrpc" )
|
||||
BRANCH=$CI_BUILD_REF_NAME
|
||||
BRANCH="stable"
|
||||
GIT_JS_PRECOMPILED="https://${GITHUB_JS_PRECOMPILED}:@github.com/paritytech/js-precompiled.git"
|
||||
GIT_PARITY="https://${GITHUB_JS_PRECOMPILED}:@github.com/paritytech/parity.git"
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
// test script 11
|
||||
// test script 12
|
||||
|
||||
@@ -105,7 +105,7 @@ export function loadTokens (options = {}) {
|
||||
}
|
||||
|
||||
export function loadTokensBasics (tokenIndexes, options) {
|
||||
const limit = 64;
|
||||
const limit = 128;
|
||||
|
||||
return (dispatch, getState) => {
|
||||
const { api } = getState();
|
||||
@@ -154,7 +154,7 @@ export function loadTokensBasics (tokenIndexes, options) {
|
||||
|
||||
export function fetchTokens (_tokenIndexes) {
|
||||
const tokenIndexes = uniq(_tokenIndexes || []);
|
||||
const tokenChunks = chunk(tokenIndexes, 64);
|
||||
const tokenChunks = chunk(tokenIndexes, 128);
|
||||
|
||||
return (dispatch, getState) => {
|
||||
const { tokenReg } = Contracts.get();
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import { range } from 'lodash';
|
||||
import { chunk, range } from 'lodash';
|
||||
import BigNumber from 'bignumber.js';
|
||||
|
||||
import { hashToImageUrl } from '~/redux/util';
|
||||
@@ -58,23 +58,17 @@ export function fetchTokensBasics (api, tokenReg, start = 0, limit = 100) {
|
||||
return decodeArray(api, 'address[]', result);
|
||||
})
|
||||
.then((tokenAddresses) => {
|
||||
return tokenAddresses.map((tokenAddress, index) => {
|
||||
if (/^0x0*$/.test(tokenAddress)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return tokenAddresses.map((address, index) => {
|
||||
const tokenIndex = start + index;
|
||||
|
||||
return {
|
||||
address: tokenAddress,
|
||||
id: getTokenId(tokenAddress, tokenIndex),
|
||||
id: getTokenId(address, tokenIndex),
|
||||
address,
|
||||
index: tokenIndex,
|
||||
|
||||
fetched: false
|
||||
};
|
||||
});
|
||||
})
|
||||
.then((tokens) => tokens.filter((token) => token))
|
||||
.then((tokens) => {
|
||||
const randomAddress = sha3(`${Date.now()}`).substr(0, 42);
|
||||
|
||||
@@ -82,8 +76,19 @@ export function fetchTokensBasics (api, tokenReg, start = 0, limit = 100) {
|
||||
.then((_balances) => {
|
||||
const balances = _balances[randomAddress];
|
||||
|
||||
return tokens.filter(({ id }) => balances[id].eq(0));
|
||||
return tokens.map((token) => {
|
||||
if (balances[token.id] && balances[token.id].gt(0)) {
|
||||
token.address = null;
|
||||
}
|
||||
|
||||
return token;
|
||||
});
|
||||
});
|
||||
})
|
||||
.then((tokens) => {
|
||||
return tokens.filter(({ address }) => {
|
||||
return address && !/^0x0*$/.test(address);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -193,19 +198,22 @@ export function fetchAccountsBalances (api, tokens, updates) {
|
||||
});
|
||||
|
||||
const tokenPromise = Object.keys(tokenUpdates)
|
||||
.reduce((tokenPromise, accountAddress) => {
|
||||
.reduce((promises, accountAddress) => {
|
||||
const tokenIds = tokenUpdates[accountAddress];
|
||||
const updateTokens = tokens
|
||||
.filter((t) => tokenIds.includes(t.id));
|
||||
|
||||
return tokenPromise
|
||||
.then(() => fetchTokensBalances(api, updateTokens, [ accountAddress ]))
|
||||
.then((balances) => {
|
||||
tokensBalances[accountAddress] = balances[accountAddress];
|
||||
});
|
||||
}, Promise.resolve());
|
||||
promises.push(
|
||||
fetchTokensBalances(api, updateTokens, [ accountAddress ])
|
||||
.then((balances) => {
|
||||
tokensBalances[accountAddress] = balances[accountAddress];
|
||||
})
|
||||
);
|
||||
|
||||
return Promise.all([ ethPromise, tokenPromise ])
|
||||
return promises;
|
||||
}, []);
|
||||
|
||||
return Promise.all([ ethPromise, Promise.all(tokenPromise) ])
|
||||
.then(() => {
|
||||
const balances = Object.assign({}, tokensBalances);
|
||||
|
||||
@@ -241,29 +249,24 @@ function fetchEthBalances (api, accountAddresses) {
|
||||
});
|
||||
}
|
||||
|
||||
function fetchTokensBalances (api, tokens, accountAddresses) {
|
||||
const tokenAddresses = tokens.map((t) => t.address);
|
||||
const tokensBalancesCallData = encode(
|
||||
api,
|
||||
[ 'address[]', 'address[]' ],
|
||||
[ accountAddresses, tokenAddresses ]
|
||||
);
|
||||
function fetchTokensBalances (api, _tokens, accountAddresses) {
|
||||
const promises = chunk(_tokens, 128).map((tokens) => {
|
||||
const data = tokensBalancesBytecode + encode(
|
||||
api,
|
||||
[ 'address[]', 'address[]' ],
|
||||
[ accountAddresses, tokens.map(({ address }) => address) ]
|
||||
);
|
||||
|
||||
return api.eth
|
||||
.call({ data: tokensBalancesBytecode + tokensBalancesCallData })
|
||||
.then((result) => {
|
||||
const rawBalances = decodeArray(api, 'uint[]', result);
|
||||
return api.eth.call({ data }).then((result) => {
|
||||
const balances = {};
|
||||
const rawBalances = decodeArray(api, 'uint[]', result);
|
||||
|
||||
accountAddresses.forEach((accountAddress, accountIndex) => {
|
||||
const preIndex = accountIndex * tokens.length;
|
||||
const balance = {};
|
||||
const preIndex = accountIndex * tokenAddresses.length;
|
||||
|
||||
tokenAddresses.forEach((tokenAddress, tokenIndex) => {
|
||||
const index = preIndex + tokenIndex;
|
||||
const token = tokens[tokenIndex];
|
||||
|
||||
balance[token.id] = rawBalances[index];
|
||||
tokens.forEach((token, tokenIndex) => {
|
||||
balance[token.id] = rawBalances[preIndex + tokenIndex];
|
||||
});
|
||||
|
||||
balances[accountAddress] = balance;
|
||||
@@ -271,6 +274,31 @@ function fetchTokensBalances (api, tokens, accountAddresses) {
|
||||
|
||||
return balances;
|
||||
});
|
||||
});
|
||||
|
||||
return Promise.all(promises).then((results) => {
|
||||
return results.reduce((combined, result) => {
|
||||
Object
|
||||
.keys(result)
|
||||
.forEach((address) => {
|
||||
if (!combined[address]) {
|
||||
combined[address] = {};
|
||||
}
|
||||
|
||||
Object
|
||||
.keys(result[address])
|
||||
.forEach((token) => {
|
||||
const value = result[address][token];
|
||||
|
||||
if (value && value.gt(0)) {
|
||||
combined[address][token] = result[address][token];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return combined;
|
||||
}, {});
|
||||
});
|
||||
}
|
||||
|
||||
function getTokenId (...args) {
|
||||
|
||||
@@ -462,7 +462,7 @@
|
||||
<key>OVERWRITE_PERMISSIONS</key>
|
||||
<false/>
|
||||
<key>VERSION</key>
|
||||
<string>1.8.7</string>
|
||||
<string>1.8.10</string>
|
||||
</dict>
|
||||
<key>UUID</key>
|
||||
<string>2DCD5B81-7BAF-4DA1-9251-6274B089FD36</string>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.9</string>
|
||||
<string>1.8</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
!define DESCRIPTION "Fast, light, robust Ethereum implementation"
|
||||
!define VERSIONMAJOR 1
|
||||
!define VERSIONMINOR 8
|
||||
!define VERSIONBUILD 7
|
||||
!define VERSIONBUILD 10
|
||||
!define ARGS ""
|
||||
!define FIRST_START_ARGS "--mode=passive ui"
|
||||
|
||||
|
||||
@@ -257,12 +257,7 @@ usage! {
|
||||
|
||||
ARG arg_mode: (String) = "last", or |c: &Config| otry!(c.parity).mode.clone(),
|
||||
"--mode=[MODE]",
|
||||
"Set the operating mode. MODE can be one of:
|
||||
last - Uses the last-used mode, active if none.
|
||||
active - Parity continuously syncs the chain.
|
||||
passive - Parity syncs initially, then sleeps and wakes regularly to resync.
|
||||
dark - Parity syncs only when the RPC is active.
|
||||
offline - Parity doesn't sync.",
|
||||
"Set the operating mode. MODE can be one of: last - Uses the last-used mode, active if none; active - Parity continuously syncs the chain; passive - Parity syncs initially, then sleeps and wakes regularly to resync; dark - Parity syncs only when the RPC is active; offline - Parity doesn't sync.",
|
||||
|
||||
ARG arg_mode_timeout: (u64) = 300u64, or |c: &Config| otry!(c.parity).mode_timeout.clone(),
|
||||
"--mode-timeout=[SECS]",
|
||||
@@ -274,19 +269,11 @@ usage! {
|
||||
|
||||
ARG arg_auto_update: (String) = "critical", or |c: &Config| otry!(c.parity).auto_update.clone(),
|
||||
"--auto-update=[SET]",
|
||||
"Set a releases set to automatically update and install.
|
||||
all - All updates in the our release track.
|
||||
critical - Only consensus/security updates.
|
||||
none - No updates will be auto-installed.",
|
||||
"Set a releases set to automatically update and install. SET can be one of: all - All updates in the our release track; critical - Only consensus/security updates; none - No updates will be auto-installed.",
|
||||
|
||||
ARG arg_release_track: (String) = "current", or |c: &Config| otry!(c.parity).release_track.clone(),
|
||||
"--release-track=[TRACK]",
|
||||
"Set which release track we should use for updates.
|
||||
stable - Stable releases.
|
||||
beta - Beta releases.
|
||||
nightly - Nightly releases (unstable).
|
||||
testing - Testing releases (do not use).
|
||||
current - Whatever track this executable was released on",
|
||||
"Set which release track we should use for updates. TRACK can be one of: stable - Stable releases; beta - Beta releases; nightly - Nightly releases (unstable); testing - Testing releases (do not use); current - Whatever track this executable was released on.",
|
||||
|
||||
ARG arg_chain: (String) = "foundation", or |c: &Config| otry!(c.parity).chain.clone(),
|
||||
"--chain=[CHAIN]",
|
||||
@@ -311,8 +298,7 @@ usage! {
|
||||
["Convenience options"]
|
||||
FLAG flag_unsafe_expose: (bool) = false, or |c: &Config| otry!(c.misc).unsafe_expose,
|
||||
"--unsafe-expose",
|
||||
"All servers will listen on external interfaces and will be remotely accessible. It's equivalent with setting the following: --{{ws,jsonrpc,ui,ipfs,secret_store,stratum}}-interface=all --*-hosts=all
|
||||
This option is UNSAFE and should be used with great care!",
|
||||
"All servers will listen on external interfaces and will be remotely accessible. It's equivalent with setting the following: --{{ws,jsonrpc,ui,ipfs,secret_store,stratum}}-interface=all --*-hosts=all This option is UNSAFE and should be used with great care!",
|
||||
|
||||
ARG arg_config: (String) = "$BASE/config.toml", or |_| None,
|
||||
"-c, --config=[CONFIG]",
|
||||
@@ -494,7 +480,7 @@ usage! {
|
||||
|
||||
ARG arg_ws_hosts: (String) = "none", or |c: &Config| otry!(c.websockets).hosts.as_ref().map(|vec| vec.join(",")),
|
||||
"--ws-hosts=[HOSTS]",
|
||||
"List of allowed Host header values. This option will validate the Host header sent by the browser, it is additional security against some attack vectors. Special options: \"all\", \"none\",.",
|
||||
"List of allowed Host header values. This option will validate the Host header sent by the browser, it is additional security against some attack vectors. Special options: \"all\", \"none\".",
|
||||
|
||||
["API and console options – IPC"]
|
||||
FLAG flag_no_ipc: (bool) = false, or |c: &Config| otry!(c.ipc).disable.clone(),
|
||||
@@ -574,7 +560,7 @@ usage! {
|
||||
|
||||
ARG arg_secretstore_path: (String) = "$BASE/secretstore", or |c: &Config| otry!(c.secretstore).path.clone(),
|
||||
"--secretstore-path=[PATH]",
|
||||
"Specify directory where Secret Store should save its data..",
|
||||
"Specify directory where Secret Store should save its data.",
|
||||
|
||||
ARG arg_secretstore_secret: (Option<String>) = None, or |c: &Config| otry!(c.secretstore).self_secret.clone(),
|
||||
"--secretstore-secret=[SECRET]",
|
||||
@@ -659,7 +645,7 @@ usage! {
|
||||
|
||||
ARG arg_tx_queue_gas: (String) = "off", or |c: &Config| otry!(c.mining).tx_queue_gas.clone(),
|
||||
"--tx-queue-gas=[LIMIT]",
|
||||
"Maximum amount of total gas for external transactions in the queue. LIMIT can be either an amount of gas or 'auto' or 'off'. 'auto' sets the limit to be 20x the current block gas limit..",
|
||||
"Maximum amount of total gas for external transactions in the queue. LIMIT can be either an amount of gas or 'auto' or 'off'. 'auto' sets the limit to be 20x the current block gas limit.",
|
||||
|
||||
ARG arg_tx_queue_strategy: (String) = "gas_price", or |c: &Config| otry!(c.mining).tx_queue_strategy.clone(),
|
||||
"--tx-queue-strategy=[S]",
|
||||
@@ -766,7 +752,7 @@ usage! {
|
||||
|
||||
ARG arg_pruning_history: (u64) = 64u64, or |c: &Config| otry!(c.footprint).pruning_history.clone(),
|
||||
"--pruning-history=[NUM]",
|
||||
"Set a minimum number of recent states to keep when pruning is active..",
|
||||
"Set a minimum number of recent states to keep when pruning is active.",
|
||||
|
||||
ARG arg_pruning_memory: (usize) = 32usize, or |c: &Config| otry!(c.footprint).pruning_memory.clone(),
|
||||
"--pruning-memory=[MB]",
|
||||
@@ -1307,12 +1293,15 @@ mod tests {
|
||||
let args = Args::parse(&["parity", "--secretstore-nodes", "abc@127.0.0.1:3333,cde@10.10.10.10:4444"]).unwrap();
|
||||
assert_eq!(args.arg_secretstore_nodes, "abc@127.0.0.1:3333,cde@10.10.10.10:4444");
|
||||
|
||||
// Arguments with a single value shouldn't accept multiple values
|
||||
let args = Args::parse(&["parity", "--auto-update", "critical", "all"]);
|
||||
assert!(args.is_err());
|
||||
|
||||
let args = Args::parse(&["parity", "--password", "~/.safe/1", "~/.safe/2"]).unwrap();
|
||||
let args = Args::parse(&["parity", "--password", "~/.safe/1", "--password", "~/.safe/2", "--ui-port", "8123", "ui"]).unwrap();
|
||||
assert_eq!(args.arg_password, vec!["~/.safe/1".to_owned(), "~/.safe/2".to_owned()]);
|
||||
assert_eq!(args.arg_ui_port, 8123);
|
||||
assert_eq!(args.cmd_ui, true);
|
||||
|
||||
let args = Args::parse(&["parity", "--password", "~/.safe/1,~/.safe/2", "--ui-port", "8123", "ui"]).unwrap();
|
||||
assert_eq!(args.arg_password, vec!["~/.safe/1".to_owned(), "~/.safe/2".to_owned()]);
|
||||
assert_eq!(args.arg_ui_port, 8123);
|
||||
assert_eq!(args.cmd_ui, true);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -150,14 +150,20 @@ macro_rules! usage {
|
||||
}
|
||||
) => {
|
||||
use toml;
|
||||
use std::{fs, io, process};
|
||||
use std::{fs, io, process, cmp};
|
||||
use std::io::{Read, Write};
|
||||
use util::version;
|
||||
use clap::{Arg, App, SubCommand, AppSettings, ArgMatches as ClapArgMatches, Error as ClapError, ErrorKind as ClapErrorKind};
|
||||
use parity_version::version;
|
||||
use clap::{Arg, App, SubCommand, AppSettings, ArgSettings, Error as ClapError, ErrorKind as ClapErrorKind};
|
||||
use helpers::replace_home;
|
||||
use std::ffi::OsStr;
|
||||
use std::collections::HashMap;
|
||||
|
||||
extern crate textwrap;
|
||||
extern crate term_size;
|
||||
use self::textwrap::{Wrapper};
|
||||
|
||||
const MAX_TERM_WIDTH: usize = 120;
|
||||
|
||||
#[cfg(test)]
|
||||
use regex::Regex;
|
||||
|
||||
@@ -365,11 +371,23 @@ macro_rules! usage {
|
||||
#[allow(unused_mut)] // subc_subc_exist may be assigned true by the macro
|
||||
#[allow(unused_assignments)] // Rust issue #22630
|
||||
pub fn print_help() -> String {
|
||||
|
||||
const TAB: &str = " ";
|
||||
const TAB_TAB: &str = " ";
|
||||
|
||||
let term_width = match term_size::dimensions() {
|
||||
None => MAX_TERM_WIDTH,
|
||||
Some((w, _)) => {
|
||||
cmp::min(w, MAX_TERM_WIDTH)
|
||||
}
|
||||
};
|
||||
|
||||
let mut help : String = include_str!("./usage_header.txt").to_owned();
|
||||
|
||||
help.push_str("\n\n");
|
||||
help.push_str("\n");
|
||||
|
||||
// Subcommands
|
||||
let mut subcommands_wrapper = Wrapper::new(term_width).subsequent_indent(TAB);
|
||||
help.push_str("parity [options]\n");
|
||||
$(
|
||||
{
|
||||
@@ -386,11 +404,14 @@ macro_rules! usage {
|
||||
)*
|
||||
];
|
||||
|
||||
if subc_subc_usages.is_empty() {
|
||||
help.push_str(&format!("parity [options] {} {}\n", underscore_to_hyphen!(&stringify!($subc)[4..]), underscore_to_hyphen!(&stringify!($subc_subc)[stringify!($subc).len()+1..])));
|
||||
} else {
|
||||
help.push_str(&format!("parity [options] {} {} {}\n", underscore_to_hyphen!(&stringify!($subc)[4..]), underscore_to_hyphen!(&stringify!($subc_subc)[stringify!($subc).len()+1..]), subc_subc_usages.join(" ")));
|
||||
}
|
||||
help.push_str(&subcommands_wrapper.fill(
|
||||
format!(
|
||||
"parity [options] {} {} {}\n",
|
||||
underscore_to_hyphen!(&stringify!($subc)[4..]),
|
||||
underscore_to_hyphen!(&stringify!($subc_subc)[stringify!($subc).len()+1..]),
|
||||
subc_subc_usages.join(" ")
|
||||
).as_ref())
|
||||
);
|
||||
)*
|
||||
|
||||
// Print the subcommand on its own only if it has no subsubcommands
|
||||
@@ -404,22 +425,30 @@ macro_rules! usage {
|
||||
)*
|
||||
];
|
||||
|
||||
if subc_usages.is_empty() {
|
||||
help.push_str(&format!("parity [options] {}\n", underscore_to_hyphen!(&stringify!($subc)[4..])));
|
||||
} else {
|
||||
help.push_str(&format!("parity [options] {} {}\n", underscore_to_hyphen!(&stringify!($subc)[4..]), subc_usages.join(" ")));
|
||||
}
|
||||
help.push_str(&subcommands_wrapper.fill(
|
||||
format!(
|
||||
"parity [options] {} {}\n",
|
||||
underscore_to_hyphen!(&stringify!($subc)[4..]),
|
||||
subc_usages.join(" ")
|
||||
).as_ref())
|
||||
);
|
||||
}
|
||||
}
|
||||
)*
|
||||
|
||||
help.push_str("\n");
|
||||
|
||||
// Arguments and flags
|
||||
let args_wrapper = Wrapper::new(term_width).initial_indent(TAB_TAB).subsequent_indent(TAB_TAB);
|
||||
$(
|
||||
help.push_str("\n");
|
||||
help.push_str($group_name); help.push_str(":\n");
|
||||
|
||||
$(
|
||||
help.push_str(&format!("\t{}\n\t\t{}\n", $flag_usage, $flag_help));
|
||||
help.push_str(&format!("{}{}\n{}\n",
|
||||
TAB, $flag_usage,
|
||||
args_wrapper.fill($flag_help)
|
||||
));
|
||||
help.push_str("\n");
|
||||
)*
|
||||
|
||||
$(
|
||||
@@ -429,10 +458,24 @@ macro_rules! usage {
|
||||
if_option_vec!(
|
||||
$($arg_type_tt)+,
|
||||
THEN {
|
||||
help.push_str(&format!("\t{}\n\t\t{} (default: {:?})\n", $arg_usage, $arg_help, {let x : inner_option_type!($($arg_type_tt)+)> = $arg_default; x}))
|
||||
help.push_str(&format!("{}{}\n{}\n",
|
||||
TAB, $arg_usage,
|
||||
args_wrapper.fill(format!(
|
||||
"{} (default: {:?})",
|
||||
$arg_help,
|
||||
{let x : inner_option_type!($($arg_type_tt)+)> = $arg_default; x}
|
||||
).as_ref())
|
||||
))
|
||||
}
|
||||
ELSE {
|
||||
help.push_str(&format!("\t{}\n\t\t{}{}\n", $arg_usage, $arg_help, $arg_default.map(|x: inner_option_type!($($arg_type_tt)+)| format!(" (default: {})",x)).unwrap_or("".to_owned())))
|
||||
help.push_str(&format!("{}{}\n{}\n",
|
||||
TAB, $arg_usage,
|
||||
args_wrapper.fill(format!(
|
||||
"{}{}",
|
||||
$arg_help,
|
||||
$arg_default.map(|x: inner_option_type!($($arg_type_tt)+)| format!(" (default: {})",x)).unwrap_or("".to_owned())
|
||||
).as_ref())
|
||||
))
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -440,14 +483,27 @@ macro_rules! usage {
|
||||
if_vec!(
|
||||
$($arg_type_tt)+,
|
||||
THEN {
|
||||
help.push_str(&format!("\t{}\n\t\t{} (default: {:?})\n", $arg_usage, $arg_help, {let x : $($arg_type_tt)+ = $arg_default; x}))
|
||||
help.push_str(&format!("{}{}\n{}\n", TAB, $arg_usage,
|
||||
args_wrapper.fill(format!(
|
||||
"{} (default: {:?})",
|
||||
$arg_help,
|
||||
{let x : $($arg_type_tt)+ = $arg_default; x}
|
||||
).as_ref())
|
||||
))
|
||||
}
|
||||
ELSE {
|
||||
help.push_str(&format!("\t{}\n\t\t{} (default: {})\n", $arg_usage, $arg_help, $arg_default))
|
||||
help.push_str(&format!("{}{}\n{}\n", TAB, $arg_usage,
|
||||
args_wrapper.fill(format!(
|
||||
"{} (default: {})",
|
||||
$arg_help,
|
||||
$arg_default
|
||||
).as_ref())
|
||||
))
|
||||
}
|
||||
)
|
||||
}
|
||||
);
|
||||
help.push_str("\n");
|
||||
)*
|
||||
|
||||
)*
|
||||
@@ -503,36 +559,6 @@ macro_rules! usage {
|
||||
args
|
||||
}
|
||||
|
||||
pub fn hydrate_with_globals(self: &mut Self, matches: &ClapArgMatches) -> Result<(), ClapError> {
|
||||
$(
|
||||
$(
|
||||
self.$flag = self.$flag || matches.is_present(stringify!($flag));
|
||||
)*
|
||||
$(
|
||||
if let some @ Some(_) = return_if_parse_error!(if_option!(
|
||||
$($arg_type_tt)+,
|
||||
THEN {
|
||||
if_option_vec!(
|
||||
$($arg_type_tt)+,
|
||||
THEN { values_t!(matches, stringify!($arg), inner_option_vec_type!($($arg_type_tt)+)) }
|
||||
ELSE { value_t!(matches, stringify!($arg), inner_option_type!($($arg_type_tt)+)) }
|
||||
)
|
||||
}
|
||||
ELSE {
|
||||
if_vec!(
|
||||
$($arg_type_tt)+,
|
||||
THEN { values_t!(matches, stringify!($arg), inner_vec_type!($($arg_type_tt)+)) }
|
||||
ELSE { value_t!(matches, stringify!($arg), $($arg_type_tt)+) }
|
||||
)
|
||||
}
|
||||
)) {
|
||||
self.$arg = some;
|
||||
}
|
||||
)*
|
||||
)*
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(unused_variables)] // the submatches of arg-less subcommands aren't used
|
||||
pub fn parse<S: AsRef<str>>(command: &[S]) -> Result<Self, ClapError> {
|
||||
|
||||
@@ -582,21 +608,31 @@ macro_rules! usage {
|
||||
let matches = App::new("Parity")
|
||||
.global_setting(AppSettings::VersionlessSubcommands)
|
||||
.global_setting(AppSettings::DisableHelpSubcommand)
|
||||
.max_term_width(MAX_TERM_WIDTH)
|
||||
.help(Args::print_help().as_ref())
|
||||
.args(&usages.iter().map(|u| Arg::from_usage(u).use_delimiter(false).allow_hyphen_values(true)).collect::<Vec<Arg>>())
|
||||
.args(&usages.iter().map(|u| {
|
||||
let mut arg = Arg::from_usage(u)
|
||||
.allow_hyphen_values(true) // Allow for example --allow-ips -10.0.0.0/8
|
||||
.global(true) // Argument doesn't have to come before the first subcommand
|
||||
.hidden(true); // Hide global arguments from the (subcommand) help messages generated by Clap
|
||||
|
||||
if arg.is_set(ArgSettings::Multiple) {
|
||||
arg = arg.require_delimiter(true); // Multiple values can only be separated by commas, not spaces (#7428)
|
||||
}
|
||||
|
||||
arg
|
||||
}).collect::<Vec<Arg>>())
|
||||
$(
|
||||
.subcommand(
|
||||
SubCommand::with_name(&underscore_to_hyphen!(&stringify!($subc)[4..]))
|
||||
.about($subc_help)
|
||||
.args(&subc_usages.get(stringify!($subc)).unwrap().iter().map(|u| Arg::from_usage(u).use_delimiter(false).allow_hyphen_values(true)).collect::<Vec<Arg>>())
|
||||
.args(&usages.iter().map(|u| Arg::from_usage(u).use_delimiter(false).allow_hyphen_values(true)).collect::<Vec<Arg>>()) // accept global arguments at this position
|
||||
$(
|
||||
.setting(AppSettings::SubcommandRequired) // prevent from running `parity account`
|
||||
.subcommand(
|
||||
SubCommand::with_name(&underscore_to_hyphen!(&stringify!($subc_subc)[stringify!($subc).len()+1..]))
|
||||
.about($subc_subc_help)
|
||||
.args(&subc_usages.get(stringify!($subc_subc)).unwrap().iter().map(|u| Arg::from_usage(u).use_delimiter(false).allow_hyphen_values(true)).collect::<Vec<Arg>>())
|
||||
.args(&usages.iter().map(|u| Arg::from_usage(u).use_delimiter(false).allow_hyphen_values(true)).collect::<Vec<Arg>>()) // accept global arguments at this position
|
||||
)
|
||||
)*
|
||||
)
|
||||
@@ -605,15 +641,39 @@ macro_rules! usage {
|
||||
|
||||
let mut raw_args : RawArgs = Default::default();
|
||||
|
||||
raw_args.hydrate_with_globals(&matches)?;
|
||||
// Globals
|
||||
$(
|
||||
$(
|
||||
raw_args.$flag = raw_args.$flag || matches.is_present(stringify!($flag));
|
||||
)*
|
||||
$(
|
||||
if let some @ Some(_) = return_if_parse_error!(if_option!(
|
||||
$($arg_type_tt)+,
|
||||
THEN {
|
||||
if_option_vec!(
|
||||
$($arg_type_tt)+,
|
||||
THEN { values_t!(matches, stringify!($arg), inner_option_vec_type!($($arg_type_tt)+)) }
|
||||
ELSE { value_t!(matches, stringify!($arg), inner_option_type!($($arg_type_tt)+)) }
|
||||
)
|
||||
}
|
||||
ELSE {
|
||||
if_vec!(
|
||||
$($arg_type_tt)+,
|
||||
THEN { values_t!(matches, stringify!($arg), inner_vec_type!($($arg_type_tt)+)) }
|
||||
ELSE { value_t!(matches, stringify!($arg), $($arg_type_tt)+) }
|
||||
)
|
||||
}
|
||||
)) {
|
||||
raw_args.$arg = some;
|
||||
}
|
||||
)*
|
||||
)*
|
||||
|
||||
// Subcommands
|
||||
$(
|
||||
if let Some(submatches) = matches.subcommand_matches(&underscore_to_hyphen!(&stringify!($subc)[4..])) {
|
||||
raw_args.$subc = true;
|
||||
|
||||
// Globals
|
||||
raw_args.hydrate_with_globals(&submatches)?;
|
||||
// Subcommand flags
|
||||
$(
|
||||
raw_args.$subc_flag = submatches.is_present(&stringify!($subc_flag));
|
||||
@@ -643,8 +703,6 @@ macro_rules! usage {
|
||||
if let Some(subsubmatches) = submatches.subcommand_matches(&underscore_to_hyphen!(&stringify!($subc_subc)[stringify!($subc).len()+1..])) {
|
||||
raw_args.$subc_subc = true;
|
||||
|
||||
// Globals
|
||||
raw_args.hydrate_with_globals(&subsubmatches)?;
|
||||
// Sub-subcommand flags
|
||||
$(
|
||||
raw_args.$subc_subc_flag = subsubmatches.is_present(&stringify!($subc_subc_flag));
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
Parity. Ethereum Client.
|
||||
By Wood/Paronyan/Kotewicz/Drwięga/Volf et al.
|
||||
Copyright 2015, 2016, 2017 Parity Technologies (UK) Ltd
|
||||
Copyright 2015, 2016, 2017, 2018 Parity Technologies (UK) Ltd
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Parity
|
||||
version {}
|
||||
Copyright 2015, 2016, 2017 Parity Technologies (UK) Ltd
|
||||
Copyright 2015, 2016, 2017, 2018 Parity Technologies (UK) Ltd
|
||||
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law.
|
||||
|
||||
@@ -25,7 +25,8 @@ use cli::{Args, ArgsError};
|
||||
use hash::keccak;
|
||||
use bigint::prelude::U256;
|
||||
use bigint::hash::H256;
|
||||
use util::{version_data, Address};
|
||||
use util::Address;
|
||||
use parity_version::{version_data, version};
|
||||
use bytes::Bytes;
|
||||
use ansi_term::Colour;
|
||||
use ethsync::{NetworkConfiguration, is_valid_node_url};
|
||||
|
||||
@@ -73,6 +73,7 @@ extern crate parity_local_store as local_store;
|
||||
extern crate parity_reactor;
|
||||
extern crate parity_rpc;
|
||||
extern crate parity_updater as updater;
|
||||
extern crate parity_version;
|
||||
extern crate parity_whisper;
|
||||
extern crate path;
|
||||
extern crate rpc_cli;
|
||||
|
||||
@@ -17,8 +17,9 @@
|
||||
use std::{str, fs, fmt};
|
||||
use std::time::Duration;
|
||||
use bigint::prelude::U256;
|
||||
use util::{Address, version_data};
|
||||
use util::Address;
|
||||
use util::journaldb::Algorithm;
|
||||
use parity_version::version_data;
|
||||
use ethcore::spec::{Spec, SpecParams};
|
||||
use ethcore::ethereum;
|
||||
use ethcore::client::Mode;
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
use std::fmt;
|
||||
use std::sync::{Arc, Weak};
|
||||
use std::time::{Duration, Instant};
|
||||
use std::thread;
|
||||
use std::net::{TcpListener};
|
||||
|
||||
use ctrlc::CtrlC;
|
||||
@@ -39,7 +41,7 @@ use parity_reactor::EventLoop;
|
||||
use parity_rpc::{NetworkSettings, informant, is_major_importing};
|
||||
use updater::{UpdatePolicy, Updater};
|
||||
use ansi_term::Colour;
|
||||
use util::version;
|
||||
use parity_version::version;
|
||||
use parking_lot::{Condvar, Mutex};
|
||||
use node_filter::NodeFilter;
|
||||
use util::journaldb::Algorithm;
|
||||
@@ -171,8 +173,10 @@ impl ::local_store::NodeInfo for FullNodeInfo {
|
||||
}
|
||||
}
|
||||
|
||||
type LightClient = ::light::client::Client<::light_helpers::EpochFetch>;
|
||||
|
||||
// helper for light execution.
|
||||
fn execute_light(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) -> Result<(bool, Option<String>), String> {
|
||||
fn execute_light_impl(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) -> Result<((bool, Option<String>), Weak<LightClient>), String> {
|
||||
use light::client as light_client;
|
||||
use ethsync::{LightSyncParams, LightSync, ManageNetwork};
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
@@ -237,8 +241,9 @@ fn execute_light(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) ->
|
||||
|
||||
let service = light_client::Service::start(config, &spec, fetch, &db_dirs.client_path(algorithm), cache.clone())
|
||||
.map_err(|e| format!("Error starting light client: {}", e))?;
|
||||
let client = service.client();
|
||||
let txq = Arc::new(RwLock::new(::light::transaction_queue::TransactionQueue::default()));
|
||||
let provider = ::light::provider::LightProvider::new(service.client().clone(), txq.clone());
|
||||
let provider = ::light::provider::LightProvider::new(client.clone(), txq.clone());
|
||||
|
||||
// start network.
|
||||
// set up bootnodes
|
||||
@@ -275,7 +280,7 @@ fn execute_light(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) ->
|
||||
|
||||
// queue cull service.
|
||||
let queue_cull = Arc::new(::light_helpers::QueueCull {
|
||||
client: service.client().clone(),
|
||||
client: client.clone(),
|
||||
sync: light_sync.clone(),
|
||||
on_demand: on_demand.clone(),
|
||||
txq: txq.clone(),
|
||||
@@ -299,7 +304,7 @@ fn execute_light(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) ->
|
||||
let signer_service = Arc::new(signer::new_service(&cmd.ws_conf, &cmd.ui_conf, &cmd.logger_config));
|
||||
let (node_health, dapps_deps) = {
|
||||
let contract_client = Arc::new(::dapps::LightRegistrar {
|
||||
client: service.client().clone(),
|
||||
client: client.clone(),
|
||||
sync: light_sync.clone(),
|
||||
on_demand: on_demand.clone(),
|
||||
});
|
||||
@@ -342,7 +347,7 @@ fn execute_light(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) ->
|
||||
let dapps_service = dapps::service(&dapps_middleware);
|
||||
let deps_for_rpc_apis = Arc::new(rpc_apis::LightDependencies {
|
||||
signer_service: signer_service,
|
||||
client: service.client().clone(),
|
||||
client: client.clone(),
|
||||
sync: light_sync.clone(),
|
||||
net: light_sync.clone(),
|
||||
health: node_health,
|
||||
@@ -382,7 +387,7 @@ fn execute_light(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) ->
|
||||
// the informant
|
||||
let informant = Arc::new(Informant::new(
|
||||
LightNodeInformantData {
|
||||
client: service.client().clone(),
|
||||
client: client.clone(),
|
||||
sync: light_sync.clone(),
|
||||
cache: cache,
|
||||
},
|
||||
@@ -397,26 +402,13 @@ fn execute_light(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) ->
|
||||
let res = wait_for_exit(None, None, can_restart);
|
||||
informant.shutdown();
|
||||
|
||||
Ok(res)
|
||||
// Create a weak reference to the client so that we can wait on shutdown until it is dropped
|
||||
let weak_client = Arc::downgrade(&client);
|
||||
|
||||
Ok((res, weak_client))
|
||||
}
|
||||
|
||||
pub fn execute(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) -> Result<(bool, Option<String>), String> {
|
||||
if cmd.ui && cmd.dapps_conf.enabled {
|
||||
// Check if Parity is already running
|
||||
let addr = format!("{}:{}", cmd.ui_conf.interface, cmd.ui_conf.port);
|
||||
if !TcpListener::bind(&addr as &str).is_ok() {
|
||||
return open_ui(&cmd.ws_conf, &cmd.ui_conf, &cmd.logger_config).map(|_| (false, None));
|
||||
}
|
||||
}
|
||||
|
||||
// increase max number of open files
|
||||
raise_fd_limit();
|
||||
|
||||
// run as light client.
|
||||
if cmd.light {
|
||||
return execute_light(cmd, can_restart, logger);
|
||||
}
|
||||
|
||||
pub fn execute_impl(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) -> Result<((bool, Option<String>), Weak<Client>), String> {
|
||||
// load spec
|
||||
let spec = cmd.spec.spec(&cmd.dirs.cache)?;
|
||||
|
||||
@@ -858,6 +850,9 @@ pub fn execute(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) -> R
|
||||
open_dapp(&cmd.dapps_conf, &cmd.http_conf, &dapp)?;
|
||||
}
|
||||
|
||||
// Create a weak reference to the client so that we can wait on shutdown until it is dropped
|
||||
let weak_client = Arc::downgrade(&client);
|
||||
|
||||
// Handle exit
|
||||
let restart = wait_for_exit(Some(updater), Some(client), can_restart);
|
||||
|
||||
@@ -875,7 +870,33 @@ pub fn execute(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) -> R
|
||||
// terminated gracefully
|
||||
drop(hypervisor);
|
||||
|
||||
Ok(restart)
|
||||
Ok((restart, weak_client))
|
||||
}
|
||||
|
||||
pub fn execute(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) -> Result<(bool, Option<String>), String> {
|
||||
if cmd.ui && cmd.dapps_conf.enabled {
|
||||
// Check if Parity is already running
|
||||
let addr = format!("{}:{}", cmd.ui_conf.interface, cmd.ui_conf.port);
|
||||
if !TcpListener::bind(&addr as &str).is_ok() {
|
||||
return open_ui(&cmd.ws_conf, &cmd.ui_conf, &cmd.logger_config).map(|_| (false, None));
|
||||
}
|
||||
}
|
||||
|
||||
// increase max number of open files
|
||||
raise_fd_limit();
|
||||
|
||||
fn wait<T>(res: Result<((bool, Option<String>), Weak<T>), String>) -> Result<(bool, Option<String>), String> {
|
||||
res.map(|(restart, weak_client)| {
|
||||
wait_for_drop(weak_client);
|
||||
restart
|
||||
})
|
||||
}
|
||||
|
||||
if cmd.light {
|
||||
wait(execute_light_impl(cmd, can_restart, logger))
|
||||
} else {
|
||||
wait(execute_impl(cmd, can_restart, logger))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
@@ -1002,3 +1023,27 @@ fn wait_for_exit(
|
||||
let _ = exit.1.wait(&mut l);
|
||||
l.clone()
|
||||
}
|
||||
|
||||
fn wait_for_drop<T>(w: Weak<T>) {
|
||||
let sleep_duration = Duration::from_secs(1);
|
||||
let warn_timeout = Duration::from_secs(60);
|
||||
let max_timeout = Duration::from_secs(300);
|
||||
|
||||
let instant = Instant::now();
|
||||
let mut warned = false;
|
||||
|
||||
while instant.elapsed() < max_timeout {
|
||||
if w.upgrade().is_none() {
|
||||
return;
|
||||
}
|
||||
|
||||
if !warned && instant.elapsed() > warn_timeout {
|
||||
warned = true;
|
||||
warn!("Shutdown is taking longer than expected.");
|
||||
}
|
||||
|
||||
thread::sleep(sleep_duration);
|
||||
}
|
||||
|
||||
warn!("Shutdown timeout reached, exiting uncleanly.");
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ fetch = { path = "../util/fetch" }
|
||||
node-health = { path = "../dapps/node-health" }
|
||||
parity-reactor = { path = "../util/reactor" }
|
||||
parity-updater = { path = "../updater" }
|
||||
parity-version = { path = "../util/version" }
|
||||
rlp = { path = "../util/rlp" }
|
||||
stats = { path = "../util/stats" }
|
||||
vm = { path = "../ethcore/vm" }
|
||||
|
||||
@@ -61,6 +61,7 @@ extern crate fetch;
|
||||
extern crate node_health;
|
||||
extern crate parity_reactor;
|
||||
extern crate parity_updater as updater;
|
||||
extern crate parity_version as version;
|
||||
extern crate rlp;
|
||||
extern crate stats;
|
||||
extern crate hash;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
use std::sync::Arc;
|
||||
use std::collections::{BTreeMap, HashSet};
|
||||
|
||||
use util::misc::version_data;
|
||||
use version::version_data;
|
||||
|
||||
use crypto::{ecies, DEFAULT_MAC};
|
||||
use ethkey::{Brain, Generator};
|
||||
|
||||
@@ -20,7 +20,7 @@ use std::str::FromStr;
|
||||
use std::collections::{BTreeMap, HashSet};
|
||||
|
||||
use util::Address;
|
||||
use util::misc::version_data;
|
||||
use version::version_data;
|
||||
|
||||
use crypto::{DEFAULT_MAC, ecies};
|
||||
use ethkey::{Brain, Generator};
|
||||
|
||||
@@ -95,7 +95,7 @@ impl ParityAccounts for ParityAccountsClient {
|
||||
let store = self.account_provider()?;
|
||||
|
||||
store.import_presale(json.as_bytes(), &pass)
|
||||
.or_else(|_| store.import_wallet(json.as_bytes(), &pass))
|
||||
.or_else(|_| store.import_wallet(json.as_bytes(), &pass, true))
|
||||
.map(Into::into)
|
||||
.map_err(|e| errors::account("Could not create account.", e))
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
//! Web3 rpc implementation.
|
||||
use hash::keccak;
|
||||
use jsonrpc_core::Error;
|
||||
use util::version;
|
||||
use version::version;
|
||||
use v1::traits::Web3;
|
||||
use v1::types::{H256, Bytes};
|
||||
|
||||
|
||||
@@ -234,14 +234,14 @@ fn rpc_parity_chain_id() {
|
||||
|
||||
#[test]
|
||||
fn rpc_parity_default_extra_data() {
|
||||
use util::misc;
|
||||
use version::version_data;
|
||||
use bytes::ToPretty;
|
||||
|
||||
let deps = Dependencies::new();
|
||||
let io = deps.default_client();
|
||||
|
||||
let request = r#"{"jsonrpc": "2.0", "method": "parity_defaultExtraData", "params": [], "id": 1}"#;
|
||||
let response = format!(r#"{{"jsonrpc":"2.0","result":"0x{}","id":1}}"#, misc::version_data().to_hex());
|
||||
let response = format!(r#"{{"jsonrpc":"2.0","result":"0x{}","id":1}}"#, version_data().to_hex());
|
||||
|
||||
assert_eq!(io.handle_request_sync(request), Some(response));
|
||||
}
|
||||
|
||||
@@ -480,7 +480,7 @@ fn should_export_account() {
|
||||
// given
|
||||
let tester = setup();
|
||||
let wallet = r#"{"id":"6a186c80-7797-cff2-bc2e-7c1d6a6cc76e","version":3,"crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"a1c6ff99070f8032ca1c4e8add006373"},"ciphertext":"df27e3db64aa18d984b6439443f73660643c2d119a6f0fa2fa9a6456fc802d75","kdf":"pbkdf2","kdfparams":{"c":10240,"dklen":32,"prf":"hmac-sha256","salt":"ddc325335cda5567a1719313e73b4842511f3e4a837c9658eeb78e51ebe8c815"},"mac":"3dc888ae79cbb226ff9c455669f6cf2d79be72120f2298f6cb0d444fddc0aa3d"},"address":"0042e5d2a662eeaca8a7e828c174f98f35d8925b","name":"parity-export-test","meta":"{\"passwordHint\":\"parity-export-test\",\"timestamp\":1490017814987}"}"#;
|
||||
tester.accounts.import_wallet(wallet.as_bytes(), "parity-export-test").unwrap();
|
||||
tester.accounts.import_wallet(wallet.as_bytes(), "parity-export-test", false).unwrap();
|
||||
let accounts = tester.accounts.accounts().unwrap();
|
||||
assert_eq!(accounts.len(), 1);
|
||||
|
||||
@@ -501,6 +501,26 @@ fn should_export_account() {
|
||||
assert_eq!(result, Some(response.into()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_import_wallet() {
|
||||
let tester = setup();
|
||||
|
||||
let id = "6a186c80-7797-cff2-bc2e-7c1d6a6cc76e";
|
||||
let request = r#"{"jsonrpc":"2.0","method":"parity_newAccountFromWallet","params":["{\"id\":\"<ID>\",\"version\":3,\"crypto\":{\"cipher\":\"aes-128-ctr\",\"cipherparams\":{\"iv\":\"478736fb55872c1baf01b27b1998c90b\"},\"ciphertext\":\"fe5a63cc0055d7b0b3b57886f930ad9b63f48950d1348145d95996c41e05f4e0\",\"kdf\":\"pbkdf2\",\"kdfparams\":{\"c\":10240,\"dklen\":32,\"prf\":\"hmac-sha256\",\"salt\":\"658436d6738a19731149a98744e5cf02c8d5aa1f8e80c1a43cc9351c70a984e4\"},\"mac\":\"c7384b26ecf25539d942030230062af9b69de5766cbcc4690bffce1536644631\"},\"address\":\"00bac56a8a27232baa044c03f43bf3648c961735\",\"name\":\"hello world\",\"meta\":\"{}\"}", "himom"],"id":1}"#;
|
||||
let request = request.replace("<ID>", id);
|
||||
let response = r#"{"jsonrpc":"2.0","result":"0x00bac56a8a27232baa044c03f43bf3648c961735","id":1}"#;
|
||||
|
||||
let res = tester.io.handle_request_sync(&request).unwrap();
|
||||
|
||||
assert_eq!(res, response);
|
||||
|
||||
let account_meta = tester.accounts.account_meta("0x00bac56a8a27232baa044c03f43bf3648c961735".into()).unwrap();
|
||||
let account_uuid: String = account_meta.uuid.unwrap().into();
|
||||
|
||||
// the RPC should import the account with a new id
|
||||
assert!(account_uuid != id);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_sign_message() {
|
||||
let tester = setup();
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use jsonrpc_core::IoHandler;
|
||||
use util::version;
|
||||
use version::version;
|
||||
use v1::{Web3, Web3Client};
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
#!/bin/bash
|
||||
set -e # fail on any error
|
||||
set -u # treat unset variables as error
|
||||
|
||||
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
|
||||
./parity import blocks.rlp --chain chain.json
|
||||
./parity restore snap --chain chain.json
|
||||
echo "Aura test complete"
|
||||
|
||||
@@ -2,16 +2,18 @@
|
||||
|
||||
set -e # fail on any error
|
||||
set -u # treat unset variables as error
|
||||
#ARGUMENTS: 1. BUILD_PLATFORM (target for binaries) 2. PLATFORM (target for cargo) 3. ARC (architecture) 4. & 5. CC & CXX flags
|
||||
#ARGUMENTS: 1. BUILD_PLATFORM (target for binaries) 2. PLATFORM (target for cargo) 3. ARC (architecture) 4. & 5. CC & CXX flags 6. binary identifier
|
||||
BUILD_PLATFORM=$1
|
||||
PLATFORM=$2
|
||||
ARC=$3
|
||||
CC=$4
|
||||
CXX=$5
|
||||
VER="$(grep -m 1 version Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n")"
|
||||
IDENT=$6
|
||||
VER="$(grep -m 1 "version =" Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n")"
|
||||
S3WIN=""
|
||||
echo "--------------------"
|
||||
echo "Build for platform: " $BUILD_PLATFORM
|
||||
echo "Build identifier: " $IDENT
|
||||
echo "Cargo target: " $PLATFORM
|
||||
echo "CC&CXX flags: " $CC ", " $CXX
|
||||
echo "Architecture: " $ARC
|
||||
@@ -20,6 +22,14 @@ echo "Parity version: " $VER
|
||||
echo "Branch: " $CI_BUILD_REF_NAME
|
||||
echo "--------------------"
|
||||
|
||||
echo "Rhash version:"
|
||||
# NOTE for md5 and sha256 we want to display filename as well
|
||||
# hence we use --* instead of -p *
|
||||
MD5_BIN="rhash --md5"
|
||||
SHA256_BIN="rhash --sha256"
|
||||
# NOTE For SHA3 we need only hash (hence -p)
|
||||
SHA3_BIN="rhash -p %{sha3-256}"
|
||||
|
||||
set_env () {
|
||||
echo "Set ENVIROMENT"
|
||||
export HOST_CC=gcc
|
||||
@@ -50,21 +60,34 @@ build () {
|
||||
echo "Build ethkey-cli:"
|
||||
cargo build --target $PLATFORM --release -p ethkey-cli
|
||||
}
|
||||
strip_md5 () {
|
||||
strip_binaries () {
|
||||
echo "Strip binaries:"
|
||||
$STRIP_BIN -v target/$PLATFORM/release/parity
|
||||
$STRIP_BIN -v target/$PLATFORM/release/parity-evm
|
||||
$STRIP_BIN -v target/$PLATFORM/release/ethstore
|
||||
$STRIP_BIN -v target/$PLATFORM/release/ethkey;
|
||||
export SHA3=$(rhash --sha3-256 target/$PLATFORM/release/parity -p %h)
|
||||
}
|
||||
calculate_checksums () {
|
||||
echo "Checksum calculation:"
|
||||
rhash --version
|
||||
rm -rf *.md5
|
||||
export SHA3=$(rhash --sha3-256 target/$PLATFORM/release/parity -p %h)
|
||||
echo "Parity file SHA3:" $SHA3
|
||||
md5sum target/$PLATFORM/release/parity > parity.md5
|
||||
md5sum target/$PLATFORM/release/parity-evm > parity-evm.md5
|
||||
md5sum target/$PLATFORM/release/ethstore > ethstore.md5
|
||||
md5sum target/$PLATFORM/release/ethkey > ethkey.md5
|
||||
rm -rf *.sha256
|
||||
|
||||
export SHA3="$($SHA3_BIN target/$PLATFORM/release/parity$S3WIN)"
|
||||
# NOTE rhash 1.3.1 doesnt support keccak, workaround
|
||||
if [ "$SHA3" == "%{sha3-256}" ]; then
|
||||
export SHA3="$(target/$PLATFORM/release/parity$S3WIN tools hash target/$PLATFORM/release/parity$S3WIN)"
|
||||
fi
|
||||
|
||||
echo "Parity file SHA3: $SHA3"
|
||||
$MD5_BIN target/$PLATFORM/release/parity$S3WIN > parity$S3WIN.md5
|
||||
$SHA256_BIN target/$PLATFORM/release/parity$S3WIN > parity$S3WIN.sha256
|
||||
$MD5_BIN target/$PLATFORM/release/parity-evm$S3WIN > parity-evm$S3WIN.md5
|
||||
$SHA256_BIN target/$PLATFORM/release/parity-evm$S3WIN > parity-evm$S3WIN.sha256
|
||||
$MD5_BIN target/$PLATFORM/release/ethstore$S3WIN > ethstore$S3WIN.md5
|
||||
$SHA256_BIN target/$PLATFORM/release/ethstore$S3WIN > ethstore$S3WIN.sha256
|
||||
$MD5_BIN target/$PLATFORM/release/ethkey$S3WIN > ethkey$S3WIN.md5
|
||||
$SHA256_BIN target/$PLATFORM/release/ethkey$S3WIN > ethkey$S3WIN.sha256
|
||||
}
|
||||
make_deb () {
|
||||
rm -rf deb
|
||||
@@ -98,8 +121,9 @@ make_deb () {
|
||||
cp target/$PLATFORM/release/parity-evm deb/usr/bin/parity-evm
|
||||
cp target/$PLATFORM/release/ethstore deb/usr/bin/ethstore
|
||||
cp target/$PLATFORM/release/ethkey deb/usr/bin/ethkey
|
||||
dpkg-deb -b deb "parity_"$VER"_"$ARC".deb"
|
||||
md5sum "parity_"$VER"_"$ARC".deb" > "parity_"$VER"_"$ARC".deb.md5"
|
||||
dpkg-deb -b deb "parity_"$VER"_"$IDENT"_"$ARC".deb"
|
||||
$MD5_BIN "parity_"$VER"_"$IDENT"_"$ARC".deb" > "parity_"$VER"_"$IDENT"_"$ARC".deb.md5"
|
||||
$SHA256_BIN "parity_"$VER"_"$IDENT"_"$ARC".deb" > "parity_"$VER"_"$IDENT"_"$ARC".deb.sha256"
|
||||
}
|
||||
make_rpm () {
|
||||
rm -rf /install
|
||||
@@ -108,9 +132,12 @@ make_rpm () {
|
||||
cp target/$PLATFORM/release/parity-evm /install/usr/bin/parity-evm
|
||||
cp target/$PLATFORM/release/ethstore /install/usr/bin/ethstore
|
||||
cp target/$PLATFORM/release/ethkey /install/usr/bin/ethkey
|
||||
|
||||
rm -rf "parity-"$VER"-1."$ARC".rpm" || true
|
||||
fpm -s dir -t rpm -n parity -v $VER --epoch 1 --license GPLv3 -d openssl --provides parity --url https://parity.io --vendor "Parity Technologies" -a x86_64 -m "<devops@parity.io>" --description "Ethereum network client by Parity Technologies" -C /install/
|
||||
cp "parity-"$VER"-1."$ARC".rpm" "parity_"$VER"_"$ARC".rpm"
|
||||
md5sum "parity_"$VER"_"$ARC".rpm" > "parity_"$VER"_"$ARC".rpm.md5"
|
||||
cp "parity-"$VER"-1."$ARC".rpm" "parity_"$VER"_"$IDENT"_"$ARC".rpm"
|
||||
$MD5_BIN "parity_"$VER"_"$IDENT"_"$ARC".rpm" > "parity_"$VER"_"$IDENT"_"$ARC".rpm.md5"
|
||||
$SHA256_BIN "parity_"$VER"_"$IDENT"_"$ARC".rpm" > "parity_"$VER"_"$IDENT"_"$ARC".rpm.sha256"
|
||||
}
|
||||
make_pkg () {
|
||||
echo "make PKG"
|
||||
@@ -123,19 +150,14 @@ make_pkg () {
|
||||
cd ..
|
||||
packagesbuild -v mac/Parity.pkgproj
|
||||
productsign --sign 'Developer ID Installer: PARITY TECHNOLOGIES LIMITED (P2PX3JU8FT)' target/release/Parity\ Ethereum.pkg target/release/Parity\ Ethereum-signed.pkg
|
||||
mv target/release/Parity\ Ethereum-signed.pkg "parity_"$VER"_"$ARC".pkg"
|
||||
md5sum "parity_"$VER"_"$ARC"."$EXT >> "parity_"$VER"_"$ARC".pkg.md5"
|
||||
mv target/release/Parity\ Ethereum-signed.pkg "parity_"$VER"_"$IDENT"_"$ARC".pkg"
|
||||
$MD5_BIN "parity_"$VER"_"$IDENT"_"$ARC"."$EXT >> "parity_"$VER"_"$IDENT"_"$ARC".pkg.md5"
|
||||
$SHA256_BIN "parity_"$VER"_"$IDENT"_"$ARC"."$EXT >> "parity_"$VER"_"$IDENT"_"$ARC".pkg.sha256"
|
||||
}
|
||||
sign_exe () {
|
||||
./sign.cmd $keyfile $certpass "target/$PLATFORM/release/parity.exe"
|
||||
}
|
||||
make_exe () {
|
||||
./sign.cmd $keyfile $certpass "target/$PLATFORM/release/parity.exe"
|
||||
SHA3=$(rhash --sha3-256 target/$PLATFORM/release/parity.exe -p %h)
|
||||
echo "Checksum calculation:"
|
||||
rm -rf *.md5
|
||||
echo "Parity file SHA3:" $SHA3
|
||||
rhash --md5 target/$PLATFORM/release/parity.exe -p %h > parity.exe.md5
|
||||
rhash --md5 target/$PLATFORM/release/parity-evm.exe -p %h > parity-evm.exe.md5
|
||||
rhash --md5 target/$PLATFORM/release/ethstore.exe -p %h > ethstore.exe.md5
|
||||
rhash --md5 target/$PLATFORM/release/ethkey.exe -p %h > ethkey.exe.md5
|
||||
./msbuild.cmd
|
||||
./sign.cmd $keyfile $certpass windows/ptray/x64/release/ptray.exe
|
||||
cd nsis
|
||||
@@ -143,9 +165,10 @@ make_exe () {
|
||||
echo "makensis.exe installer.nsi" > nsis.cmd
|
||||
./nsis.cmd
|
||||
cd ..
|
||||
cp nsis/installer.exe "parity_"$VER"_"$ARC"."$EXT
|
||||
./sign.cmd $keyfile $certpass "parity_"$VER"_"$ARC"."$EXT
|
||||
rhash --md5 "parity_"$VER"_"$ARC"."$EXT -p %h > "parity_"$VER"_"$ARC"."$EXT".md5"
|
||||
cp nsis/installer.exe "parity_"$VER"_"$IDENT"_"$ARC"."$EXT
|
||||
./sign.cmd $keyfile $certpass "parity_"$VER"_"$IDENT"_"$ARC"."$EXT
|
||||
$MD5_BIN "parity_"$VER"_"$IDENT"_"$ARC"."$EXT -p %h > "parity_"$VER"_"$IDENT"_"$ARC"."$EXT".md5"
|
||||
$SHA256_BIN "parity_"$VER"_"$IDENT"_"$ARC"."$EXT -p %h > "parity_"$VER"_"$IDENT"_"$ARC"."$EXT".sha256"
|
||||
}
|
||||
push_binaries () {
|
||||
echo "Push binaries to AWS S3"
|
||||
@@ -160,25 +183,36 @@ push_binaries () {
|
||||
aws s3 rm --recursive s3://$S3_BUCKET/$CI_BUILD_REF_NAME/$BUILD_PLATFORM
|
||||
aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/parity$S3WIN --body target/$PLATFORM/release/parity$S3WIN
|
||||
aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/parity$S3WIN.md5 --body parity$S3WIN.md5
|
||||
aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/parity$S3WIN.sha256 --body parity$S3WIN.sha256
|
||||
aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/parity-evm$S3WIN --body target/$PLATFORM/release/parity-evm$S3WIN
|
||||
aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/parity-evm$S3WIN.md5 --body parity-evm$S3WIN.md5
|
||||
aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/parity-evm$S3WIN.sha256 --body parity-evm$S3WIN.sha256
|
||||
aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/ethstore$S3WIN --body target/$PLATFORM/release/ethstore$S3WIN
|
||||
aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/ethstore$S3WIN.md5 --body ethstore$S3WIN.md5
|
||||
aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/ethstore$S3WIN.sha256 --body ethstore$S3WIN.sha256
|
||||
aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/ethkey$S3WIN --body target/$PLATFORM/release/ethkey$S3WIN
|
||||
aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/ethkey$S3WIN.md5 --body ethkey$S3WIN.md5
|
||||
aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/"parity_"$VER"_"$ARC"."$EXT --body "parity_"$VER"_"$ARC"."$EXT
|
||||
aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/"parity_"$VER"_"$ARC"."$EXT".md5" --body "parity_"$VER"_"$ARC"."$EXT".md5"
|
||||
aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/ethkey$S3WIN.sha256 --body ethkey$S3WIN.sha256
|
||||
aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/"parity_"$VER"_"$IDENT"_"$ARC"."$EXT --body "parity_"$VER"_"$IDENT"_"$ARC"."$EXT
|
||||
aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/"parity_"$VER"_"$IDENT"_"$ARC"."$EXT".md5" --body "parity_"$VER"_"$IDENT"_"$ARC"."$EXT".md5"
|
||||
aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$BUILD_PLATFORM/"parity_"$VER"_"$IDENT"_"$ARC"."$EXT".sha256" --body "parity_"$VER"_"$IDENT"_"$ARC"."$EXT".sha256"
|
||||
}
|
||||
make_archive () {
|
||||
echo "add artifacts to archive"
|
||||
rm -rf parity.zip
|
||||
zip -r parity.zip target/$PLATFORM/release/parity$S3WIN target/$PLATFORM/release/parity-evm$S3WIN target/$PLATFORM/release/ethstore$S3WIN target/$PLATFORM/release/ethkey$S3WIN parity$S3WIN.md5 parity-evm$S3WIN.md5 ethstore$S3WIN.md5 ethkey$S3WIN.md5
|
||||
zip -r parity.zip target/$PLATFORM/release/parity$S3WIN target/$PLATFORM/release/parity-evm$S3WIN target/$PLATFORM/release/ethstore$S3WIN target/$PLATFORM/release/ethkey$S3WIN parity$S3WIN.md5 parity-evm$S3WIN.md5 ethstore$S3WIN.md5 ethkey$S3WIN.md5 parity$S3WIN.sha256 parity-evm$S3WIN.sha256 ethstore$S3WIN.sha256 ethkey$S3WIN.sha256
|
||||
}
|
||||
push_release () {
|
||||
|
||||
updater_push_release () {
|
||||
echo "push release"
|
||||
curl --data "commit=$CI_BUILD_REF&sha3=$SHA3&filename=parity&secret=$RELEASES_SECRET" http://update.parity.io:1337/push-build/$CI_BUILD_REF_NAME/$PLATFORM
|
||||
curl --data "commit=$CI_BUILD_REF&sha3=$SHA3&filename=parity&secret=$RELEASES_SECRET" http://update.parity.io:1338/push-build/$CI_BUILD_REF_NAME/$PLATFORM
|
||||
|
||||
DATA="commit=$CI_BUILD_REF&sha3=$SHA3&filename=parity$S3WIN&secret=$RELEASES_SECRET"
|
||||
# Mainnet
|
||||
source scripts/safe_curl.sh $DATA "http://update.parity.io:1337/push-build/$CI_BUILD_REF_NAME/$BUILD_PLATFORM"
|
||||
# Kovan
|
||||
source scripts/safe_curl.sh $DATA "http://update.parity.io:1338/push-build/$CI_BUILD_REF_NAME/$BUILD_PLATFORM"
|
||||
}
|
||||
|
||||
case $BUILD_PLATFORM in
|
||||
x86_64-unknown-linux-gnu)
|
||||
#set strip bin
|
||||
@@ -186,11 +220,12 @@ case $BUILD_PLATFORM in
|
||||
#package extention
|
||||
EXT="deb"
|
||||
build
|
||||
strip_md5
|
||||
strip_binaries
|
||||
calculate_checksums
|
||||
make_deb
|
||||
make_archive
|
||||
push_binaries
|
||||
push_release
|
||||
updater_push_release
|
||||
;;
|
||||
x86_64-unknown-debian-gnu)
|
||||
STRIP_BIN="strip"
|
||||
@@ -198,95 +233,118 @@ case $BUILD_PLATFORM in
|
||||
LIBSSL="libssl1.1 (>=1.1.0)"
|
||||
echo "Use libssl1.1 (>=1.1.0) for Debian builds"
|
||||
build
|
||||
strip_md5
|
||||
strip_binaries
|
||||
calculate_checksums
|
||||
make_deb
|
||||
make_archive
|
||||
push_binaries
|
||||
push_release
|
||||
;;
|
||||
x86_64-unknown-centos-gnu)
|
||||
STRIP_BIN="strip"
|
||||
EXT="rpm"
|
||||
build
|
||||
strip_md5
|
||||
strip_binaries
|
||||
calculate_checksums
|
||||
make_rpm
|
||||
make_archive
|
||||
push_binaries
|
||||
push_release
|
||||
;;
|
||||
i686-unknown-linux-gnu)
|
||||
STRIP_BIN="strip"
|
||||
EXT="deb"
|
||||
set_env
|
||||
build
|
||||
strip_md5
|
||||
strip_binaries
|
||||
calculate_checksums
|
||||
make_deb
|
||||
make_archive
|
||||
push_binaries
|
||||
push_release
|
||||
;;
|
||||
armv7-unknown-linux-gnueabihf)
|
||||
STRIP_BIN="arm-linux-gnueabihf-strip"
|
||||
EXT="deb"
|
||||
set_env
|
||||
build
|
||||
strip_md5
|
||||
strip_binaries
|
||||
calculate_checksums
|
||||
make_deb
|
||||
make_archive
|
||||
push_binaries
|
||||
push_release
|
||||
;;
|
||||
arm-unknown-linux-gnueabihf)
|
||||
STRIP_BIN="arm-linux-gnueabihf-strip"
|
||||
EXT="deb"
|
||||
set_env
|
||||
build
|
||||
strip_md5
|
||||
strip_binaries
|
||||
calculate_checksums
|
||||
make_deb
|
||||
make_archive
|
||||
push_binaries
|
||||
push_release
|
||||
;;
|
||||
aarch64-unknown-linux-gnu)
|
||||
STRIP_BIN="aarch64-linux-gnu-strip"
|
||||
EXT="deb"
|
||||
set_env
|
||||
build
|
||||
strip_md5
|
||||
strip_binaries
|
||||
calculate_checksums
|
||||
make_deb
|
||||
make_archive
|
||||
push_binaries
|
||||
push_release
|
||||
;;
|
||||
x86_64-apple-darwin)
|
||||
STRIP_BIN="strip"
|
||||
PLATFORM="x86_64-apple-darwin"
|
||||
EXT="pkg"
|
||||
build
|
||||
strip_md5
|
||||
strip_binaries
|
||||
calculate_checksums
|
||||
make_pkg
|
||||
make_archive
|
||||
push_binaries
|
||||
push_release
|
||||
updater_push_release
|
||||
;;
|
||||
x86_64-unknown-snap-gnu)
|
||||
cd snap
|
||||
ARC="amd64"
|
||||
EXT="snap"
|
||||
rm -rf *snap
|
||||
sed -i 's/master/'"$VER"'/g' snapcraft.yaml
|
||||
snapcraft
|
||||
cp "parity_"$CI_BUILD_REF_NAME"_amd64.snap" "parity_"$VER"_amd64.snap"
|
||||
md5sum "parity_"$VER"_amd64.snap" > "parity_"$VER"_amd64.snap.md5"
|
||||
push_binaries
|
||||
apt install -y expect zip rhash
|
||||
snapcraft clean
|
||||
echo "Prepare snapcraft.yaml for build on Gitlab CI in Docker image"
|
||||
sed -i 's/git/'"$VER"'/g' snap/snapcraft.yaml
|
||||
if [[ "$CI_BUILD_REF_NAME" = "stable" || "$VER" == *1.8* ]];
|
||||
then
|
||||
sed -i -e 's/grade: devel/grade: stable/' snap/snapcraft.yaml;
|
||||
fi
|
||||
mv -f snap/snapcraft.yaml snapcraft.yaml
|
||||
snapcraft -d
|
||||
snapcraft_login=$(expect -c "
|
||||
spawn snapcraft login
|
||||
expect \"Email:\"
|
||||
send \"$SNAP_EMAIL\n\"
|
||||
expect \"Password:\"
|
||||
send \"$SNAP_PASS\n\"
|
||||
expect \"\$\"
|
||||
")
|
||||
echo "$snapcraft_login"
|
||||
snapcraft push "parity_"$VER"_amd64.snap"
|
||||
snapcraft status parity
|
||||
snapcraft logout
|
||||
$MD5_BIN "parity_"$VER"_amd64.snap" > "parity_"$VER"_amd64.snap.md5"
|
||||
$SHA256_BIN "parity_"$VER"_amd64.snap" > "parity_"$VER"_amd64.snap.sha256"
|
||||
echo "add artifacts to archive"
|
||||
rm -rf parity.zip
|
||||
zip -r parity.zip "parity_"$VER"_amd64.snap" "parity_"$VER"_amd64.snap.md5" "parity_"$VER"_amd64.snap.sha256"
|
||||
;;
|
||||
x86_64-pc-windows-msvc)
|
||||
set_env_win
|
||||
EXT="exe"
|
||||
S3WIN=".exe"
|
||||
build
|
||||
sign_exe
|
||||
calculate_checksums
|
||||
make_exe
|
||||
make_archive
|
||||
push_binaries
|
||||
push_release
|
||||
updater_push_release
|
||||
esac
|
||||
|
||||
12
scripts/gitlab-push-release.sh
Executable file
12
scripts/gitlab-push-release.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e # fail on any error
|
||||
set -u # treat unset variables as error
|
||||
|
||||
DATA="secret=$RELEASES_SECRET"
|
||||
|
||||
echo "Pushing release to Mainnet"
|
||||
./scripts/safe_curl.sh $DATA "http://update.parity.io:1337/push-release/$CI_BUILD_REF_NAME/$CI_BUILD_REF"
|
||||
|
||||
echo "Pushing release to Kovan"
|
||||
./scripts/safe_curl.sh $DATA "http://update.parity.io:1338/push-release/$CI_BUILD_REF_NAME/$CI_BUILD_REF"
|
||||
@@ -2,18 +2,18 @@
|
||||
#ARGUMENT test for RUST, JS, COVERAGE or JS_RELEASE
|
||||
set -e # fail on any error
|
||||
set -u # treat unset variables as error
|
||||
|
||||
if [[ "$CI_COMMIT_REF_NAME" = "beta" || "$CI_COMMIT_REF_NAME" = "stable" ]]; then
|
||||
export GIT_COMPARE=$CI_COMMIT_REF_NAME;
|
||||
else
|
||||
export GIT_COMPARE=master;
|
||||
fi
|
||||
export JS_FILES_MODIFIED="$(git --no-pager diff --name-only $GIT_COMPARE...$CI_COMMIT_SHA | grep ^js/ | wc -l)"
|
||||
export JS_OLD_FILES_MODIFIED="$(git --no-pager diff --name-only $GIT_COMPARE...$CI_COMMIT_SHA | grep ^js-old/ | wc -l)"
|
||||
export RUST_FILES_MODIFIED="$(git --no-pager diff --name-only $GIT_COMPARE...$CI_COMMIT_SHA | grep -v -e ^js -e ^\\. -e ^LICENSE -e ^README.md -e ^test.sh -e ^windows/ -e ^scripts/ -e ^mac/ -e ^nsis/ | wc -l)"
|
||||
echo "RUST_FILES_MODIFIED: $RUST_FILES_MODIFIED"
|
||||
echo "JS_FILES_MODIFIED: $JS_FILES_MODIFIED"
|
||||
echo "JS_OLD_FILES_MODIFIED: $JS_OLD_FILES_MODIFIED"
|
||||
if [[ "$CI_COMMIT_REF_NAME" = "beta" || "$CI_COMMIT_REF_NAME" = "stable" ]]; then
|
||||
export GIT_COMPARE=$CI_COMMIT_REF_NAME;
|
||||
else
|
||||
export GIT_COMPARE=master;
|
||||
fi
|
||||
|
||||
echo "RUST_FILES_MODIFIED: $RUST_FILES_MODIFIED"
|
||||
echo "JS_FILES_MODIFIED: $JS_FILES_MODIFIED"
|
||||
echo "JS_OLD_FILES_MODIFIED: $JS_OLD_FILES_MODIFIED"
|
||||
@@ -23,11 +23,12 @@ rust_test () {
|
||||
rustup show
|
||||
if [[ "${RUST_FILES_MODIFIED}" == "0" ]];
|
||||
then echo "Skipping Rust tests since no Rust files modified.";
|
||||
else ./test.sh;
|
||||
fi
|
||||
if [[ "$CI_COMMIT_REF_NAME" == "nightly" ]];
|
||||
then sh scripts/aura-test.sh;
|
||||
else ./test.sh || exit $?;
|
||||
fi
|
||||
# if [[ "$CI_COMMIT_REF_NAME" == "nightly" ]];
|
||||
# ### @TODO re-enable fail after https://github.com/paritytech/parity-import-tests/issues/3
|
||||
# then sh scripts/aura-test.sh; # || exit $?;
|
||||
# fi
|
||||
}
|
||||
js_test () {
|
||||
git submodule update --init --recursive
|
||||
@@ -41,7 +42,7 @@ js_test () {
|
||||
fi
|
||||
if [[ "${JS_FILES_MODIFIED}" == "0" ]];
|
||||
then echo "Skipping JS lint since no JS files modified.";
|
||||
else ./js/scripts/lint.sh && ./js/scripts/test.sh && ./js/scripts/build.sh;
|
||||
else ./js/scripts/lint.sh && ./js/scripts/test.sh && ./js/scripts/build.sh;
|
||||
fi
|
||||
if [[ "${JS_OLD_FILES_MODIFIED}" == "0" ]];
|
||||
then echo "Skipping JS (old) lint since no JS files modified.";
|
||||
@@ -56,7 +57,7 @@ js_release () {
|
||||
fi
|
||||
if [[ "${JS_FILES_MODIFIED}" == "0" ]];
|
||||
then echo "Skipping JS rebuild since no JS files modified.";
|
||||
else ./js/scripts/build.sh && ./js/scripts/push-precompiled.sh;
|
||||
else ./js/scripts/build.sh && ./js/scripts/release.sh;
|
||||
fi
|
||||
if [[ "${JS_OLD_FILES_MODIFIED}" == "0" ]];
|
||||
then echo "Skipping JS (old) deps install since no JS files modified.";
|
||||
@@ -64,11 +65,7 @@ js_release () {
|
||||
fi
|
||||
if [[ "${JS_OLD_FILES_MODIFIED}" == "0" ]];
|
||||
then echo "Skipping JS (old) rebuild since no JS files modified.";
|
||||
else ./js-old/scripts/build.sh && ./js-old/scripts/push-precompiled.sh;
|
||||
fi
|
||||
if [[ "${JS_FILES_MODIFIED}" == "0" ]] && [[ "${JS_OLD_FILES_MODIFIED}" == "0" ]];
|
||||
then echo "Skipping Cargo update since no JS files modified.";
|
||||
else ./js/scripts/push-cargo.sh;
|
||||
else ./js/scripts/build.sh && ./js/scripts/release.sh;
|
||||
fi
|
||||
}
|
||||
coverage_test () {
|
||||
|
||||
20
scripts/safe_curl.sh
Executable file
20
scripts/safe_curl.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
DATA=$1
|
||||
ADDRESS=$2
|
||||
|
||||
CODE=$(curl -o out.txt -w '%{http_code}' --data $DATA $ADDRESS)
|
||||
cat out.txt && rm out.txt
|
||||
echo "\n"
|
||||
|
||||
if [[ $CODE -eq 200 ]]; then
|
||||
echo 'Pushed to updater service.';
|
||||
elif [[ $CODE -eq 202 ]]; then
|
||||
echo 'Updater service ignored request.';
|
||||
else
|
||||
echo 'Unable to push info to updater service.';
|
||||
exit 2
|
||||
fi
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
name: parity
|
||||
version: master
|
||||
summary: Fast, light, robust Ethereum implementation
|
||||
description: |
|
||||
Parity's goal is to be the fastest, lightest, and most secure Ethereum
|
||||
client. We are developing Parity using the sophisticated and cutting-edge
|
||||
Rust programming language. Parity is licensed under the GPLv3, and can be
|
||||
used for all your Ethereum needs.
|
||||
|
||||
grade: devel
|
||||
confinement: strict
|
||||
|
||||
apps:
|
||||
parity:
|
||||
command: parity
|
||||
plugs: [network, network-bind]
|
||||
|
||||
parts:
|
||||
parity:
|
||||
source: ..
|
||||
plugin: rust
|
||||
build-packages: [g++, libudev-dev, libssl-dev, make, pkg-config]
|
||||
BIN
snap/gui/icon.png
Normal file
BIN
snap/gui/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
8
snap/gui/parity.desktop
Normal file
8
snap/gui/parity.desktop
Normal file
@@ -0,0 +1,8 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Encoding=UTF-8
|
||||
Name=parity
|
||||
Comment=Fast, light, robust Ethereum implementation
|
||||
Exec=parity
|
||||
Icon=/usr/share/pixmaps/icon.png
|
||||
Terminal=true
|
||||
@@ -13,10 +13,27 @@ confinement: strict
|
||||
apps:
|
||||
parity:
|
||||
command: parity
|
||||
plugs: [network, network-bind]
|
||||
plugs: [home, network, network-bind, mount-observe, x11, unity7, desktop, desktop-legacy, wayland]
|
||||
desktop: usr/share/applications/parity.desktop
|
||||
|
||||
icon: snap/gui/icon.png
|
||||
|
||||
parts:
|
||||
desktop-icon:
|
||||
source: ./snap
|
||||
plugin: nil
|
||||
prepare: |
|
||||
mkdir -p $SNAPCRAFT_PART_INSTALL/usr/share/applications
|
||||
mkdir -p $SNAPCRAFT_PART_INSTALL/usr/share/pixmaps
|
||||
cp -v gui/parity.desktop $SNAPCRAFT_PART_INSTALL/usr/share/applications/
|
||||
cp -v gui/icon.png $SNAPCRAFT_PART_INSTALL/usr/share/pixmaps/
|
||||
parity:
|
||||
source: .
|
||||
plugin: rust
|
||||
build-attributes: [no-system-libraries]
|
||||
build-packages: [g++, libudev-dev, libssl-dev, make, pkg-config]
|
||||
stage-packages: [libc6, libssl1.0.0, libudev1, libstdc++6]
|
||||
df:
|
||||
plugin: nil
|
||||
stage-packages: [coreutils]
|
||||
stage: [bin/df]
|
||||
|
||||
@@ -24,4 +24,5 @@ parity-hash-fetch = { path = "../hash-fetch" }
|
||||
ipc-common-types = { path = "../ipc-common-types" }
|
||||
ethcore-ipc = { path = "../ipc/rpc" }
|
||||
parity-reactor = { path = "../util/reactor" }
|
||||
parity-version = { path = "../util/version" }
|
||||
path = { path = "../util/path" }
|
||||
|
||||
@@ -30,6 +30,7 @@ extern crate ethcore_ipc as ipc;
|
||||
extern crate futures;
|
||||
extern crate target_info;
|
||||
extern crate parity_reactor;
|
||||
extern crate parity_version as version;
|
||||
extern crate path;
|
||||
|
||||
mod updater;
|
||||
|
||||
68
updater/src/types/version_info.rs
Normal file
68
updater/src/types/version_info.rs
Normal file
@@ -0,0 +1,68 @@
|
||||
// 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/>.
|
||||
|
||||
//! Types used in the public API
|
||||
|
||||
use std::fmt;
|
||||
use semver::{Version};
|
||||
use bigint::hash::H160;
|
||||
use version::raw_package_info;
|
||||
use types::ReleaseTrack;
|
||||
|
||||
/// Version information of a particular release.
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct VersionInfo {
|
||||
/// The track on which it was released.
|
||||
pub track: ReleaseTrack,
|
||||
/// The version.
|
||||
pub version: Version,
|
||||
/// The (SHA1?) 160-bit hash of this build's code base.
|
||||
pub hash: H160,
|
||||
}
|
||||
|
||||
impl fmt::Display for VersionInfo {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
write!(f, "{}.{}.{}-{}-{}", self.version.major, self.version.minor, self.version.patch, self.track, self.hash)
|
||||
}
|
||||
}
|
||||
|
||||
impl VersionInfo {
|
||||
/// Get information for this (currently running) binary.
|
||||
pub fn this() -> Self {
|
||||
let raw = raw_package_info();
|
||||
VersionInfo {
|
||||
track: raw.0.into(),
|
||||
version: { let mut v = Version::parse(raw.1).expect("Environment variables are known to be valid; qed"); v.build = vec![]; v.pre = vec![]; v },
|
||||
hash: raw.2.parse::<H160>().unwrap_or_else(|_| H160::zero()),
|
||||
}
|
||||
}
|
||||
|
||||
/// Compose the information from the provided raw fields.
|
||||
pub fn from_raw(semver: u32, track: u8, hash: H160) -> Self {
|
||||
let t = track.into();
|
||||
VersionInfo {
|
||||
version: Version {
|
||||
major: (semver >> 16) as u64,
|
||||
minor: ((semver >> 8) & 0xff) as u64,
|
||||
patch: (semver & 0xff) as u64,
|
||||
build: vec![],
|
||||
pre: vec![],
|
||||
},
|
||||
track: t,
|
||||
hash: hash,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ use bigint::hash::{H160, H256};
|
||||
use util::Address;
|
||||
use bytes::Bytes;
|
||||
use parking_lot::Mutex;
|
||||
use util::misc;
|
||||
use version;
|
||||
|
||||
/// Filter for releases.
|
||||
#[derive(Debug, Eq, PartialEq, Clone)]
|
||||
@@ -116,7 +116,7 @@ fn platform() -> String {
|
||||
} else if cfg!(target_os = "linux") {
|
||||
format!("{}-unknown-linux-gnu", Target::arch())
|
||||
} else {
|
||||
misc::platform()
|
||||
version::platform()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,8 @@ description = "Ethcore utility library"
|
||||
homepage = "http://parity.io"
|
||||
license = "GPL-3.0"
|
||||
name = "ethcore-util"
|
||||
version = "1.8.7"
|
||||
version = "1.8.10"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
build = "build.rs"
|
||||
|
||||
[dependencies]
|
||||
log = "0.3"
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
// 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/>.
|
||||
|
||||
extern crate vergen;
|
||||
extern crate rustc_version;
|
||||
|
||||
use vergen::*;
|
||||
use std::env;
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
|
||||
fn main() {
|
||||
vergen(OutputFns::all()).unwrap();
|
||||
let out_dir = env::var("OUT_DIR").unwrap();
|
||||
let dest_path = Path::new(&out_dir).join("rustc_version.rs");
|
||||
let mut f = File::create(&dest_path).unwrap();
|
||||
f.write_all(format!("
|
||||
/// Returns compiler version.
|
||||
pub fn rustc_version() -> &'static str {{
|
||||
\"{}\"
|
||||
}}
|
||||
", rustc_version::version()).as_bytes()).unwrap();
|
||||
}
|
||||
@@ -33,7 +33,10 @@ path = { path = "../path" }
|
||||
ethcore-logger = { path ="../../logger" }
|
||||
ipnetwork = "0.12.6"
|
||||
hash = { path = "../hash" }
|
||||
serde = "1.0"
|
||||
serde_json = "1.0"
|
||||
serde_derive = "1.0"
|
||||
parity-version = { path = "../version" }
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
||||
@@ -30,7 +30,7 @@ use mio::*;
|
||||
use mio::deprecated::{EventLoop};
|
||||
use mio::tcp::*;
|
||||
use bigint::hash::*;
|
||||
use util::version;
|
||||
use version::version;
|
||||
use rlp::*;
|
||||
use session::{Session, SessionInfo, SessionData};
|
||||
use error::*;
|
||||
@@ -721,7 +721,7 @@ impl Host {
|
||||
let address = {
|
||||
let mut nodes = self.nodes.write();
|
||||
if let Some(node) = nodes.get_mut(id) {
|
||||
node.last_attempted = Some(::time::now());
|
||||
node.attempts += 1;
|
||||
node.endpoint.address
|
||||
}
|
||||
else {
|
||||
@@ -740,6 +740,7 @@ impl Host {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if let Err(e) = self.create_connection(socket, Some(id), io) {
|
||||
debug!(target: "network", "Can't create connection: {:?}", e);
|
||||
}
|
||||
@@ -1284,4 +1285,3 @@ fn host_client_url() {
|
||||
let host: Host = Host::new(config, Arc::new(NetworkStats::new()), None).unwrap();
|
||||
assert!(host.local_url().starts_with("enode://101b3ef5a4ea7a1c7928e24c4c75fd053c235d7b80c22ae5c03d145d0ac7396e2a4ffff9adee3133a7b05044a5cee08115fd65145e5165d646bde371010d803c@"));
|
||||
}
|
||||
|
||||
|
||||
@@ -80,10 +80,14 @@ extern crate path;
|
||||
extern crate ethcore_logger;
|
||||
extern crate ipnetwork;
|
||||
extern crate hash;
|
||||
extern crate serde;
|
||||
extern crate serde_json;
|
||||
extern crate parity_version as version;
|
||||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
|
||||
#[cfg(test)]
|
||||
extern crate ethcore_devtools as devtools;
|
||||
@@ -206,4 +210,3 @@ pub enum AllowIP {
|
||||
/// Block all addresses
|
||||
None,
|
||||
}
|
||||
|
||||
|
||||
@@ -14,25 +14,20 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::mem;
|
||||
use std::slice::from_raw_parts;
|
||||
use std::net::{SocketAddr, ToSocketAddrs, SocketAddrV4, SocketAddrV6, Ipv4Addr, Ipv6Addr};
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::str::{FromStr};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::fmt::{Display, Formatter};
|
||||
use std::path::{PathBuf};
|
||||
use std::fmt;
|
||||
use std::fs;
|
||||
use std::io::{Read, Write};
|
||||
use bigint::hash::*;
|
||||
use std::fmt::{self, Display, Formatter};
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::net::{SocketAddr, ToSocketAddrs, SocketAddrV4, SocketAddrV6, Ipv4Addr, Ipv6Addr};
|
||||
use std::path::PathBuf;
|
||||
use std::str::FromStr;
|
||||
use std::{fs, mem, slice};
|
||||
use bigint::hash::H512;
|
||||
use rlp::*;
|
||||
use time::Tm;
|
||||
use error::NetworkError;
|
||||
use {AllowIP, IpFilter};
|
||||
use discovery::{TableUpdates, NodeEntry};
|
||||
use ip_utils::*;
|
||||
use serde_json::Value;
|
||||
use serde_json;
|
||||
|
||||
/// Node public key
|
||||
pub type NodeId = H512;
|
||||
@@ -80,7 +75,7 @@ impl NodeEndpoint {
|
||||
4 => Ok(SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::new(addr_bytes[0], addr_bytes[1], addr_bytes[2], addr_bytes[3]), tcp_port))),
|
||||
16 => unsafe {
|
||||
let o: *const u16 = mem::transmute(addr_bytes.as_ptr());
|
||||
let o = from_raw_parts(o, 8);
|
||||
let o = slice::from_raw_parts(o, 8);
|
||||
Ok(SocketAddr::V6(SocketAddrV6::new(Ipv6Addr::new(o[0], o[1], o[2], o[3], o[4], o[5], o[6], o[7]), tcp_port, 0, 0)))
|
||||
},
|
||||
_ => Err(DecoderError::RlpInconsistentLengthAndData)
|
||||
@@ -95,7 +90,7 @@ impl NodeEndpoint {
|
||||
}
|
||||
SocketAddr::V6(a) => unsafe {
|
||||
let o: *const u8 = mem::transmute(a.ip().segments().as_ptr());
|
||||
rlp.append(&from_raw_parts(o, 16));
|
||||
rlp.append(&slice::from_raw_parts(o, 16));
|
||||
}
|
||||
};
|
||||
rlp.append(&self.udp_port);
|
||||
@@ -143,18 +138,30 @@ pub struct Node {
|
||||
pub id: NodeId,
|
||||
pub endpoint: NodeEndpoint,
|
||||
pub peer_type: PeerType,
|
||||
pub attempts: u32,
|
||||
pub failures: u32,
|
||||
pub last_attempted: Option<Tm>,
|
||||
}
|
||||
|
||||
const DEFAULT_FAILURE_PERCENTAGE: usize = 50;
|
||||
|
||||
impl Node {
|
||||
pub fn new(id: NodeId, endpoint: NodeEndpoint) -> Node {
|
||||
Node {
|
||||
id: id,
|
||||
endpoint: endpoint,
|
||||
peer_type: PeerType::Optional,
|
||||
attempts: 0,
|
||||
failures: 0,
|
||||
last_attempted: None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the node's failure percentage (0..100) in buckets of 5%. If there are 0 connection attempts for this
|
||||
/// node the default failure percentage is returned (50%).
|
||||
pub fn failure_percentage(&self) -> usize {
|
||||
if self.attempts == 0 {
|
||||
DEFAULT_FAILURE_PERCENTAGE
|
||||
} else {
|
||||
(self.failures * 100 / self.attempts / 5 * 5) as usize
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -184,7 +191,7 @@ impl FromStr for Node {
|
||||
id: id,
|
||||
endpoint: endpoint,
|
||||
peer_type: PeerType::Optional,
|
||||
last_attempted: None,
|
||||
attempts: 0,
|
||||
failures: 0,
|
||||
})
|
||||
}
|
||||
@@ -203,6 +210,9 @@ impl Hash for Node {
|
||||
}
|
||||
}
|
||||
|
||||
const MAX_NODES: usize = 1024;
|
||||
const NODES_FILE: &str = "nodes.json";
|
||||
|
||||
/// Node table backed by disk file.
|
||||
pub struct NodeTable {
|
||||
nodes: HashMap<NodeId, Node>,
|
||||
@@ -221,23 +231,37 @@ impl NodeTable {
|
||||
|
||||
/// Add a node to table
|
||||
pub fn add_node(&mut self, mut node: Node) {
|
||||
// preserve failure counter
|
||||
let failures = self.nodes.get(&node.id).map_or(0, |n| n.failures);
|
||||
// preserve attempts and failure counter
|
||||
let (attempts, failures) =
|
||||
self.nodes.get(&node.id).map_or((0, 0), |n| (n.attempts, n.failures));
|
||||
|
||||
node.attempts = attempts;
|
||||
node.failures = failures;
|
||||
|
||||
self.nodes.insert(node.id.clone(), node);
|
||||
}
|
||||
|
||||
/// Returns node ids sorted by number of failures
|
||||
/// Returns node ids sorted by failure percentage, for nodes with the same failure percentage the absolute number of
|
||||
/// failures is considered.
|
||||
pub fn nodes(&self, filter: IpFilter) -> Vec<NodeId> {
|
||||
let mut refs: Vec<&Node> = self.nodes.values().filter(|n| !self.useless_nodes.contains(&n.id) && n.endpoint.is_allowed(&filter)).collect();
|
||||
refs.sort_by(|a, b| a.failures.cmp(&b.failures));
|
||||
refs.iter().map(|n| n.id.clone()).collect()
|
||||
let mut refs: Vec<&Node> = self.nodes.values()
|
||||
.filter(|n| !self.useless_nodes.contains(&n.id))
|
||||
.filter(|n| n.endpoint.is_allowed(&filter))
|
||||
.collect();
|
||||
refs.sort_by(|a, b| {
|
||||
a.failure_percentage().cmp(&b.failure_percentage())
|
||||
.then_with(|| a.failures.cmp(&b.failures))
|
||||
.then_with(|| b.attempts.cmp(&a.attempts)) // we use reverse ordering for number of attempts
|
||||
});
|
||||
refs.into_iter().map(|n| n.id).collect()
|
||||
}
|
||||
|
||||
/// Unordered list of all entries
|
||||
pub fn unordered_entries(&self) -> Vec<NodeEntry> {
|
||||
// preserve failure counter
|
||||
self.nodes.values().map(|n| NodeEntry { endpoint: n.endpoint.clone(), id: n.id.clone() }).collect()
|
||||
self.nodes.values().map(|n| NodeEntry {
|
||||
endpoint: n.endpoint.clone(),
|
||||
id: n.id.clone(),
|
||||
}).collect()
|
||||
}
|
||||
|
||||
/// Get particular node
|
||||
@@ -270,7 +294,7 @@ impl NodeTable {
|
||||
}
|
||||
}
|
||||
|
||||
/// Mark as useless, no furter attempts to connect until next call to `clear_useless`.
|
||||
/// Mark as useless, no further attempts to connect until next call to `clear_useless`.
|
||||
pub fn mark_as_useless(&mut self, id: &NodeId) {
|
||||
self.useless_nodes.insert(id.clone());
|
||||
}
|
||||
@@ -282,77 +306,62 @@ impl NodeTable {
|
||||
|
||||
/// Save the nodes.json file.
|
||||
pub fn save(&self) {
|
||||
if let Some(ref path) = self.path {
|
||||
let mut path_buf = PathBuf::from(path);
|
||||
if let Err(e) = fs::create_dir_all(path_buf.as_path()) {
|
||||
warn!("Error creating node table directory: {:?}", e);
|
||||
return;
|
||||
};
|
||||
path_buf.push("nodes.json");
|
||||
let mut json = String::new();
|
||||
json.push_str("{\n");
|
||||
json.push_str("\"nodes\": [\n");
|
||||
let node_ids = self.nodes(IpFilter::default());
|
||||
for i in 0 .. node_ids.len() {
|
||||
let node = self.nodes.get(&node_ids[i]).expect("self.nodes() only returns node IDs from self.nodes");
|
||||
json.push_str(&format!("\t{{ \"url\": \"{}\", \"failures\": {} }}{}\n", node, node.failures, if i == node_ids.len() - 1 {""} else {","}))
|
||||
}
|
||||
json.push_str("]\n");
|
||||
json.push_str("}");
|
||||
let mut file = match fs::File::create(path_buf.as_path()) {
|
||||
Ok(file) => file,
|
||||
Err(e) => {
|
||||
warn!("Error creating node table file: {:?}", e);
|
||||
return;
|
||||
let mut path = match self.path {
|
||||
Some(ref path) => PathBuf::from(path),
|
||||
None => return,
|
||||
};
|
||||
if let Err(e) = fs::create_dir_all(&path) {
|
||||
warn!("Error creating node table directory: {:?}", e);
|
||||
return;
|
||||
}
|
||||
path.push(NODES_FILE);
|
||||
let node_ids = self.nodes(IpFilter::default());
|
||||
let nodes = node_ids.into_iter()
|
||||
.map(|id| self.nodes.get(&id).expect("self.nodes() only returns node IDs from self.nodes"))
|
||||
.take(MAX_NODES)
|
||||
.map(|node| node.clone())
|
||||
.map(Into::into)
|
||||
.collect();
|
||||
let table = json::NodeTable { nodes };
|
||||
|
||||
match fs::File::create(&path) {
|
||||
Ok(file) => {
|
||||
if let Err(e) = serde_json::to_writer_pretty(file, &table) {
|
||||
warn!("Error writing node table file: {:?}", e);
|
||||
}
|
||||
};
|
||||
if let Err(e) = file.write(&json.into_bytes()) {
|
||||
warn!("Error writing node table file: {:?}", e);
|
||||
},
|
||||
Err(e) => {
|
||||
warn!("Error creating node table file: {:?}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn load(path: Option<String>) -> HashMap<NodeId, Node> {
|
||||
let mut nodes: HashMap<NodeId, Node> = HashMap::new();
|
||||
if let Some(path) = path {
|
||||
let mut path_buf = PathBuf::from(path);
|
||||
path_buf.push("nodes.json");
|
||||
let mut file = match fs::File::open(path_buf.as_path()) {
|
||||
Ok(file) => file,
|
||||
Err(e) => {
|
||||
debug!("Error opening node table file: {:?}", e);
|
||||
return nodes;
|
||||
}
|
||||
};
|
||||
let mut buf = String::new();
|
||||
match file.read_to_string(&mut buf) {
|
||||
Ok(_) => {},
|
||||
Err(e) => {
|
||||
warn!("Error reading node table file: {:?}", e);
|
||||
return nodes;
|
||||
}
|
||||
}
|
||||
let json: Value = match ::serde_json::from_str(&buf) {
|
||||
Ok(json) => json,
|
||||
Err(e) => {
|
||||
warn!("Error parsing node table file: {:?}", e);
|
||||
return nodes;
|
||||
}
|
||||
};
|
||||
if let Some(list) = json.as_object().and_then(|o| o.get("nodes")).and_then(|n| n.as_array()) {
|
||||
for n in list.iter().filter_map(|n| n.as_object()) {
|
||||
if let Some(url) = n.get("url").and_then(|u| u.as_str()) {
|
||||
if let Ok(mut node) = Node::from_str(url) {
|
||||
if let Some(failures) = n.get("failures").and_then(|f| f.as_u64()) {
|
||||
node.failures = failures as u32;
|
||||
}
|
||||
nodes.insert(node.id.clone(), node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let path = match path {
|
||||
Some(path) => PathBuf::from(path).join(NODES_FILE),
|
||||
None => return Default::default(),
|
||||
};
|
||||
|
||||
let file = match fs::File::open(&path) {
|
||||
Ok(file) => file,
|
||||
Err(e) => {
|
||||
debug!("Error opening node table file: {:?}", e);
|
||||
return Default::default();
|
||||
},
|
||||
};
|
||||
let res: Result<json::NodeTable, _> = serde_json::from_reader(file);
|
||||
match res {
|
||||
Ok(table) => {
|
||||
table.nodes.into_iter()
|
||||
.filter_map(|n| n.into_node())
|
||||
.map(|n| (n.id.clone(), n))
|
||||
.collect()
|
||||
},
|
||||
Err(e) => {
|
||||
warn!("Error reading node table file: {:?}", e);
|
||||
Default::default()
|
||||
},
|
||||
}
|
||||
nodes
|
||||
}
|
||||
}
|
||||
|
||||
@@ -368,6 +377,45 @@ pub fn is_valid_node_url(url: &str) -> bool {
|
||||
Node::from_str(url).is_ok()
|
||||
}
|
||||
|
||||
mod json {
|
||||
use super::*;
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct NodeTable {
|
||||
pub nodes: Vec<Node>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct Node {
|
||||
pub url: String,
|
||||
pub attempts: u32,
|
||||
pub failures: u32,
|
||||
}
|
||||
|
||||
impl Node {
|
||||
pub fn into_node(self) -> Option<super::Node> {
|
||||
match super::Node::from_str(&self.url) {
|
||||
Ok(mut node) => {
|
||||
node.attempts = self.attempts;
|
||||
node.failures = self.failures;
|
||||
Some(node)
|
||||
},
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a super::Node> for Node {
|
||||
fn from(node: &'a super::Node) -> Self {
|
||||
Node {
|
||||
url: format!("{}", node),
|
||||
attempts: node.attempts,
|
||||
failures: node.failures,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -405,26 +453,42 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn table_failure_order() {
|
||||
fn table_failure_percentage_order() {
|
||||
let node1 = Node::from_str("enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@22.99.55.44:7770").unwrap();
|
||||
let node2 = Node::from_str("enode://b979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@22.99.55.44:7770").unwrap();
|
||||
let node3 = Node::from_str("enode://c979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@22.99.55.44:7770").unwrap();
|
||||
let node4 = Node::from_str("enode://d979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@22.99.55.44:7770").unwrap();
|
||||
let id1 = H512::from_str("a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c").unwrap();
|
||||
let id2 = H512::from_str("b979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c").unwrap();
|
||||
let id3 = H512::from_str("c979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c").unwrap();
|
||||
let id4 = H512::from_str("d979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c").unwrap();
|
||||
let mut table = NodeTable::new(None);
|
||||
table.add_node(node3);
|
||||
|
||||
table.add_node(node1);
|
||||
table.add_node(node2);
|
||||
table.add_node(node3);
|
||||
table.add_node(node4);
|
||||
|
||||
// node 1 - failure percentage 100%
|
||||
table.get_mut(&id1).unwrap().attempts = 2;
|
||||
table.note_failure(&id1);
|
||||
table.note_failure(&id1);
|
||||
|
||||
// node2 - failure percentage 33%
|
||||
table.get_mut(&id2).unwrap().attempts = 3;
|
||||
table.note_failure(&id2);
|
||||
|
||||
// node3 - failure percentage 0%
|
||||
table.get_mut(&id3).unwrap().attempts = 1;
|
||||
|
||||
// node4 - failure percentage 50% (default when no attempts)
|
||||
|
||||
let r = table.nodes(IpFilter::default());
|
||||
|
||||
assert_eq!(r[0][..], id3[..]);
|
||||
assert_eq!(r[1][..], id2[..]);
|
||||
assert_eq!(r[2][..], id1[..]);
|
||||
assert_eq!(r[2][..], id4[..]);
|
||||
assert_eq!(r[3][..], id1[..]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -438,6 +502,9 @@ mod tests {
|
||||
let mut table = NodeTable::new(Some(temp_path.as_path().to_str().unwrap().to_owned()));
|
||||
table.add_node(node1);
|
||||
table.add_node(node2);
|
||||
|
||||
table.get_mut(&id1).unwrap().attempts = 1;
|
||||
table.get_mut(&id2).unwrap().attempts = 1;
|
||||
table.note_failure(&id2);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
[package]
|
||||
name = "semantic_version"
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
|
||||
[dependencies]
|
||||
@@ -1,47 +0,0 @@
|
||||
// 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/>.
|
||||
|
||||
//! Semantic version formatting and comparing.
|
||||
|
||||
/// A version value with strict meaning. Use `as_u32` to convert to a simple integer.
|
||||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// extern crate semantic_version;
|
||||
/// use semantic_version::*;
|
||||
///
|
||||
/// fn main() {
|
||||
/// assert_eq!(SemanticVersion::new(1, 2, 3).as_u32(), 0x010203);
|
||||
/// }
|
||||
/// ```
|
||||
pub struct SemanticVersion {
|
||||
/// Major version - API/feature removals & breaking changes.
|
||||
pub major: u8,
|
||||
/// Minor version - API/feature additions.
|
||||
pub minor: u8,
|
||||
/// Tiny version - bug fixes.
|
||||
pub tiny: u8,
|
||||
}
|
||||
|
||||
impl SemanticVersion {
|
||||
/// Create a new object.
|
||||
pub fn new(major: u8, minor: u8, tiny: u8) -> SemanticVersion { SemanticVersion{major: major, minor: minor, tiny: tiny} }
|
||||
|
||||
/// Convert to a `u32` representation.
|
||||
pub fn as_u32(&self) -> u32 { ((self.major as u32) << 16) + ((self.minor as u32) << 8) + self.tiny as u32 }
|
||||
}
|
||||
|
||||
// TODO: implement Eq, Comparison and Debug/Display for SemanticVersion.
|
||||
@@ -87,6 +87,7 @@
|
||||
//! cargo build --release
|
||||
//! ```
|
||||
|
||||
extern crate util_error as error;
|
||||
extern crate rustc_hex;
|
||||
extern crate rocksdb;
|
||||
extern crate env_logger;
|
||||
@@ -106,9 +107,7 @@ extern crate ethcore_logger;
|
||||
extern crate hash as keccak;
|
||||
extern crate hashdb;
|
||||
extern crate memorydb;
|
||||
extern crate patricia_trie as trie;
|
||||
extern crate kvdb;
|
||||
extern crate util_error as error;
|
||||
|
||||
#[cfg(test)]
|
||||
extern crate kvdb_memorydb;
|
||||
@@ -116,12 +115,10 @@ extern crate kvdb_memorydb;
|
||||
#[macro_use]
|
||||
extern crate log as rlog;
|
||||
|
||||
pub mod misc;
|
||||
pub mod overlaydb;
|
||||
pub mod journaldb;
|
||||
pub mod cache;
|
||||
|
||||
pub use misc::*;
|
||||
pub use hashdb::*;
|
||||
pub use memorydb::MemoryDB;
|
||||
pub use overlaydb::*;
|
||||
|
||||
35
util/version/Cargo.toml
Normal file
35
util/version/Cargo.toml
Normal file
@@ -0,0 +1,35 @@
|
||||
# NOTE This file is used by the auto-updater service.
|
||||
# Make sure to update the service if it's moved or the structure is changed.
|
||||
[package]
|
||||
name = "parity-version"
|
||||
# NOTE: this value is used for Parity version string (via env CARGO_PKG_VERSION)
|
||||
version = "1.8.10"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
build = "build.rs"
|
||||
|
||||
[package.metadata]
|
||||
# This versions track. Should be changed to `stable` or `beta` when on respective branches.
|
||||
# Used by auto-updater and for Parity version string.
|
||||
track = "stable"
|
||||
|
||||
# Indicates a critical release in this track (i.e. consensus issue)
|
||||
critical = false
|
||||
|
||||
# Latest supported fork blocks for various networks. Used ONLY by auto-updater.
|
||||
[package.metadata.forks]
|
||||
foundation = 4370000
|
||||
ropsten = 10
|
||||
kovan = 5067000
|
||||
|
||||
[dependencies]
|
||||
ethcore-bytes = { path = "../bytes" }
|
||||
rlp = { path = "../rlp" }
|
||||
target_info = "0.1"
|
||||
|
||||
[build-dependencies]
|
||||
vergen = "0.1"
|
||||
rustc_version = "0.1.0"
|
||||
toml = "0.4"
|
||||
|
||||
[features]
|
||||
final = []
|
||||
57
util/version/build.rs
Normal file
57
util/version/build.rs
Normal file
@@ -0,0 +1,57 @@
|
||||
// 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/>.
|
||||
|
||||
extern crate rustc_version;
|
||||
extern crate toml;
|
||||
extern crate vergen;
|
||||
|
||||
use std::env;
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
use vergen::{vergen, OutputFns};
|
||||
|
||||
const ERROR_MSG: &'static str = "Failed to generate metadata files";
|
||||
|
||||
fn main() {
|
||||
vergen(OutputFns::all()).expect(ERROR_MSG);
|
||||
|
||||
let version = rustc_version::version();
|
||||
|
||||
let cargo: toml::Value = toml::from_str(include_str!("./Cargo.toml")).expect(ERROR_MSG);
|
||||
let track = cargo["package"]["metadata"]["track"].as_str().expect("'track' has to be a string!");
|
||||
|
||||
create_file("meta.rs", format!("
|
||||
/// This versions track.
|
||||
#[allow(unused)]
|
||||
pub const TRACK: &str = {track:?};
|
||||
|
||||
/// Returns compiler version.
|
||||
pub fn rustc_version() -> &'static str {{
|
||||
\"{version}\"
|
||||
}}
|
||||
",
|
||||
track = track,
|
||||
version = version,
|
||||
));
|
||||
}
|
||||
|
||||
fn create_file(filename: &str, data: String) {
|
||||
let out_dir = env::var("OUT_DIR").expect(ERROR_MSG);
|
||||
let dest_path = Path::new(&out_dir).join(filename);
|
||||
let mut f = File::create(&dest_path).expect(ERROR_MSG);
|
||||
f.write_all(data.as_bytes()).expect(ERROR_MSG);
|
||||
}
|
||||
@@ -14,32 +14,33 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Diff misc.
|
||||
//! Parity version specific information.
|
||||
|
||||
extern crate target_info;
|
||||
extern crate ethcore_bytes as bytes;
|
||||
extern crate rlp;
|
||||
|
||||
use rlp::RlpStream;
|
||||
use target_info::Target;
|
||||
use bytes::Bytes;
|
||||
use rlp::RlpStream;
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/version.rs"));
|
||||
include!(concat!(env!("OUT_DIR"), "/rustc_version.rs"));
|
||||
mod vergen {
|
||||
#![allow(unused)]
|
||||
include!(concat!(env!("OUT_DIR"), "/version.rs"));
|
||||
}
|
||||
|
||||
mod generated {
|
||||
include!(concat!(env!("OUT_DIR"), "/meta.rs"));
|
||||
}
|
||||
|
||||
#[cfg(feature = "final")]
|
||||
const THIS_TRACK: &'static str = "stable";
|
||||
// ^^^ should be reset to "stable" or "beta" according to the release branch.
|
||||
const THIS_TRACK: &'static str = generated::TRACK;
|
||||
// ^^^ should be reset in Cargo.toml to "stable" or "beta" according to the release branch.
|
||||
|
||||
#[cfg(not(feature = "final"))]
|
||||
const THIS_TRACK: &'static str = "unstable";
|
||||
// ^^^ This gets used when we're not building a final release; should stay as "unstable".
|
||||
|
||||
/// Boolean type for clean/dirty status.
|
||||
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
|
||||
pub enum Filth {
|
||||
/// Data has not been changed.
|
||||
Clean,
|
||||
/// Data has been changed.
|
||||
Dirty,
|
||||
}
|
||||
|
||||
/// Get the platform identifier.
|
||||
pub fn platform() -> String {
|
||||
let env = Target::env();
|
||||
@@ -49,11 +50,11 @@ pub fn platform() -> String {
|
||||
|
||||
/// Get the standard version string for this software.
|
||||
pub fn version() -> String {
|
||||
let sha3 = short_sha();
|
||||
let sha3 = vergen::short_sha();
|
||||
let sha3_dash = if sha3.is_empty() { "" } else { "-" };
|
||||
let commit_date = commit_date().replace("-", "");
|
||||
let commit_date = vergen::commit_date().replace("-", "");
|
||||
let date_dash = if commit_date.is_empty() { "" } else { "-" };
|
||||
format!("Parity/v{}-{}{}{}{}{}/{}/rustc{}", env!("CARGO_PKG_VERSION"), THIS_TRACK, sha3_dash, sha3, date_dash, commit_date, platform(), rustc_version())
|
||||
format!("Parity/v{}-{}{}{}{}{}/{}/rustc{}", env!("CARGO_PKG_VERSION"), THIS_TRACK, sha3_dash, sha3, date_dash, commit_date, platform(), generated::rustc_version())
|
||||
}
|
||||
|
||||
/// Get the standard version data for this software.
|
||||
@@ -65,12 +66,12 @@ pub fn version_data() -> Bytes {
|
||||
env!("CARGO_PKG_VERSION_PATCH").parse::<u32>().expect("Environment variables are known to be valid; qed");
|
||||
s.append(&v);
|
||||
s.append(&"Parity");
|
||||
s.append(&rustc_version());
|
||||
s.append(&generated::rustc_version());
|
||||
s.append(&&Target::os()[0..2]);
|
||||
s.out()
|
||||
}
|
||||
|
||||
/// Provide raw information on the package.
|
||||
pub fn raw_package_info() -> (&'static str, &'static str, &'static str) {
|
||||
(THIS_TRACK, env!["CARGO_PKG_VERSION"], sha())
|
||||
(THIS_TRACK, env!["CARGO_PKG_VERSION"], vergen::sha())
|
||||
}
|
||||
Reference in New Issue
Block a user