Compare commits
57 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
84021a6148 | ||
|
|
fee9053c9a | ||
|
|
18c2a599d7 | ||
|
|
f8683058b3 | ||
|
|
03f35d7f82 | ||
|
|
f7572342af | ||
|
|
16ff3a7ad4 | ||
|
|
e6e0dc256f | ||
|
|
aa8ff4628d | ||
|
|
c55e26285b | ||
|
|
1cd45f6578 | ||
|
|
669ba8681a | ||
|
|
e7d7280a89 | ||
|
|
e84819c72d | ||
|
|
426db72a41 | ||
|
|
ac331613ab | ||
|
|
bfe513c954 | ||
|
|
462bb23ffe | ||
|
|
9bf983417d | ||
|
|
9a4a0ba48e | ||
|
|
5e7e3da93d | ||
|
|
b29eb151fd | ||
|
|
3a593ec474 | ||
|
|
0e8f459b61 | ||
|
|
d14fb2c06c | ||
|
|
5ce41da9b2 | ||
|
|
de23d7a2d7 | ||
|
|
2077793b4f | ||
|
|
ea4da34dac | ||
|
|
7a15ea448d | ||
|
|
13300b066e | ||
|
|
5a40dba9ab | ||
|
|
a80e19e51e | ||
|
|
53bbe0d959 | ||
|
|
094fad1155 | ||
|
|
2255b389cc | ||
|
|
e0a86a9a06 | ||
|
|
fb443dbe16 | ||
|
|
603c52f82d | ||
|
|
98598d312d | ||
|
|
c2b7d58aaf | ||
|
|
3bcf8a84ce | ||
|
|
e018395c05 | ||
|
|
69d32b884f | ||
|
|
f3693a0a43 | ||
|
|
f91c3d9d62 | ||
|
|
b007c7225f | ||
|
|
0b2eb3a4c3 | ||
|
|
780cf0ce1a | ||
|
|
f264d10cc5 | ||
|
|
f52aee83bc | ||
|
|
afa21ce001 | ||
|
|
5ef8c75808 | ||
|
|
aedd7477ab | ||
|
|
979e519c79 | ||
|
|
2799a26d66 | ||
|
|
95d57c839d |
218
.gitlab-ci.yml
218
.gitlab-ci.yml
@@ -18,6 +18,7 @@ linux-stable:
|
||||
- beta
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- cargo build --release $CARGOFLAGS
|
||||
- strip target/release/parity
|
||||
@@ -29,10 +30,12 @@ linux-stable:
|
||||
- md5sum "parity_"$VER"_amd64.deb" > "parity_"$VER"_amd64.deb.md5"
|
||||
- aws configure set aws_access_key_id $s3_key
|
||||
- aws configure set aws_secret_access_key $s3_secret
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-linux-gnu/parity --body target/release/parity
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-linux-gnu/parity.md5 --body parity.md5
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-linux-gnu/"parity_"$VER"_amd64.deb" --body "parity_"$VER"_amd64.deb"
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-linux-gnu/"parity_"$VER"_amd64.deb.md5" --body "parity_"$VER"_amd64.deb.md5"
|
||||
- if [[ $CI_BUILD_REF_NAME =~ ^(master|beta|stable)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi
|
||||
- aws s3 rm --recursive s3://$S3_BUCKET/$CI_BUILD_REF_NAME/x86_64-unknown-linux-gnu
|
||||
- aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/x86_64-unknown-linux-gnu/parity --body target/release/parity
|
||||
- aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/x86_64-unknown-linux-gnu/parity.md5 --body parity.md5
|
||||
- aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/x86_64-unknown-linux-gnu/"parity_"$VER"_amd64.deb" --body "parity_"$VER"_amd64.deb"
|
||||
- aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/x86_64-unknown-linux-gnu/"parity_"$VER"_amd64.deb.md5" --body "parity_"$VER"_amd64.deb.md5"
|
||||
tags:
|
||||
- rust
|
||||
- rust-stable
|
||||
@@ -47,6 +50,7 @@ linux-beta:
|
||||
- beta
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- cargo build --release $CARGOFLAGS
|
||||
- strip target/release/parity
|
||||
@@ -65,6 +69,7 @@ linux-nightly:
|
||||
- beta
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- cargo build --release $CARGOFLAGS
|
||||
- strip target/release/parity
|
||||
@@ -83,6 +88,7 @@ linux-centos:
|
||||
- beta
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- export CXX="g++"
|
||||
- export CC="gcc"
|
||||
@@ -91,6 +97,8 @@ linux-centos:
|
||||
- md5sum target/release/parity > parity.md5
|
||||
- aws configure set aws_access_key_id $s3_key
|
||||
- aws configure set aws_secret_access_key $s3_secret
|
||||
- if [[ $CI_BUILD_REF_NAME =~ ^(master|beta|stable)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi
|
||||
- aws s3 rm --recursive s3://$S3_BUCKET/$CI_BUILD_REF_NAME/x86_64-unknown-centos-gnu
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-centos-gnu/parity --body target/release/parity
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-centos-gnu/parity.md5 --body parity.md5
|
||||
tags:
|
||||
@@ -100,14 +108,14 @@ linux-centos:
|
||||
paths:
|
||||
- target/release/parity
|
||||
name: "x86_64-unknown-centos-gnu_parity"
|
||||
allow_failure: true
|
||||
linux-i686:
|
||||
stage: build
|
||||
image: ethcore/rust-i686:latest
|
||||
only:
|
||||
- beta
|
||||
# - tags
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- export HOST_CC=gcc
|
||||
- export HOST_CXX=g++
|
||||
@@ -121,10 +129,12 @@ linux-i686:
|
||||
- md5sum "parity_"$VER"_i386.deb" > "parity_"$VER"_i386.deb.md5"
|
||||
- aws configure set aws_access_key_id $s3_key
|
||||
- aws configure set aws_secret_access_key $s3_secret
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/i686-unknown-linux-gnu/parity --body target/i686-unknown-linux-gnu/release/parity
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/i686-unknown-linux-gnu/parity.md5 --body parity.md5
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/i686-unknown-linux-gnu/"parity_"$VER"_i386.deb" --body "parity_"$VER"_i386.deb"
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/i686-unknown-linux-gnu/"parity_"$VER"_i386.deb.md5" --body "parity_"$VER"_i386.deb.md5"
|
||||
- if [[ $CI_BUILD_REF_NAME =~ ^(master|beta|stable)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi
|
||||
- aws s3 rm --recursive s3://$S3_BUCKET/$CI_BUILD_REF_NAME/i686-unknown-linux-gnu
|
||||
- aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/i686-unknown-linux-gnu/parity --body target/i686-unknown-linux-gnu/release/parity
|
||||
- aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/i686-unknown-linux-gnu/parity.md5 --body parity.md5
|
||||
- aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/i686-unknown-linux-gnu/"parity_"$VER"_i386.deb" --body "parity_"$VER"_i386.deb"
|
||||
- aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/i686-unknown-linux-gnu/"parity_"$VER"_i386.deb.md5" --body "parity_"$VER"_i386.deb.md5"
|
||||
tags:
|
||||
- rust
|
||||
- rust-i686
|
||||
@@ -140,6 +150,7 @@ linux-armv7:
|
||||
- beta
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- export CC=arm-linux-gnueabihf-gcc
|
||||
- export CXX=arm-linux-gnueabihf-g++
|
||||
@@ -160,10 +171,12 @@ linux-armv7:
|
||||
- md5sum "parity_"$VER"_armhf.deb" > "parity_"$VER"_armhf.deb.md5"
|
||||
- aws configure set aws_access_key_id $s3_key
|
||||
- aws configure set aws_secret_access_key $s3_secret
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/armv7-unknown-linux-gnueabihf/parity --body target/armv7-unknown-linux-gnueabihf/release/parity
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/armv7-unknown-linux-gnueabihf/parity.md5 --body parity.md5
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/armv7-unknown-linux-gnueabihf/"parity_"$VER"_armhf.deb" --body "parity_"$VER"_armhf.deb"
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/armv7-unknown-linux-gnueabihf/"parity_"$VER"_armhf.deb.md5" --body "parity_"$VER"_armhf.deb.md5"
|
||||
- if [[ $CI_BUILD_REF_NAME =~ ^(master|beta|stable)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi
|
||||
- aws s3 rm --recursive s3://$S3_BUCKET/$CI_BUILD_REF_NAME/armv7-unknown-linux-gnueabihf
|
||||
- aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/armv7-unknown-linux-gnueabihf/parity --body target/armv7-unknown-linux-gnueabihf/release/parity
|
||||
- aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/armv7-unknown-linux-gnueabihf/parity.md5 --body parity.md5
|
||||
- aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/armv7-unknown-linux-gnueabihf/"parity_"$VER"_armhf.deb" --body "parity_"$VER"_armhf.deb"
|
||||
- aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/armv7-unknown-linux-gnueabihf/"parity_"$VER"_armhf.deb.md5" --body "parity_"$VER"_armhf.deb.md5"
|
||||
tags:
|
||||
- rust
|
||||
- rust-arm
|
||||
@@ -179,6 +192,7 @@ linux-arm:
|
||||
- beta
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- export CC=arm-linux-gnueabihf-gcc
|
||||
- export CXX=arm-linux-gnueabihf-g++
|
||||
@@ -199,10 +213,12 @@ linux-arm:
|
||||
- md5sum "parity_"$VER"_armhf.deb" > "parity_"$VER"_armhf.deb.md5"
|
||||
- aws configure set aws_access_key_id $s3_key
|
||||
- aws configure set aws_secret_access_key $s3_secret
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabihf/parity --body target/arm-unknown-linux-gnueabihf/release/parity
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabihf/parity.md5 --body parity.md5
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabihf/"parity_"$VER"_armhf.deb" --body "parity_"$VER"_armhf.deb"
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabihf/"parity_"$VER"_armhf.deb.md5" --body "parity_"$VER"_armhf.deb.md5"
|
||||
- if [[ $CI_BUILD_REF_NAME =~ ^(master|beta|stable)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi
|
||||
- aws s3 rm --recursive s3://$S3_BUCKET/$CI_BUILD_REF_NAME/arm-unknown-linux-gnueabihf
|
||||
- aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabihf/parity --body target/arm-unknown-linux-gnueabihf/release/parity
|
||||
- aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabihf/parity.md5 --body parity.md5
|
||||
- aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabihf/"parity_"$VER"_armhf.deb" --body "parity_"$VER"_armhf.deb"
|
||||
- aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabihf/"parity_"$VER"_armhf.deb.md5" --body "parity_"$VER"_armhf.deb.md5"
|
||||
tags:
|
||||
- rust
|
||||
- rust-arm
|
||||
@@ -215,9 +231,10 @@ linux-armv6:
|
||||
stage: build
|
||||
image: ethcore/rust-armv6:latest
|
||||
only:
|
||||
# - beta
|
||||
# - tags
|
||||
- beta
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- export CC=arm-linux-gnueabi-gcc
|
||||
- export CXX=arm-linux-gnueabi-g++
|
||||
@@ -233,8 +250,10 @@ linux-armv6:
|
||||
- md5sum target/arm-unknown-linux-gnueabi/release/parity > parity.md5
|
||||
- aws configure set aws_access_key_id $s3_key
|
||||
- aws configure set aws_secret_access_key $s3_secret
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabi/parity --body target/arm-unknown-linux-gnueabi/release/parity
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabi/parity.md5 --body parity.md5
|
||||
- if [[ $CI_BUILD_REF_NAME =~ ^(master|beta|stable)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi
|
||||
- aws s3 rm --recursive s3://$S3_BUCKET/$CI_BUILD_REF_NAME/arm-unknown-linux-gnueabi
|
||||
- aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabi/parity --body target/arm-unknown-linux-gnueabi/release/parity
|
||||
- aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabi/parity.md5 --body parity.md5
|
||||
tags:
|
||||
- rust
|
||||
- rust-arm
|
||||
@@ -250,6 +269,7 @@ linux-aarch64:
|
||||
- beta
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- export CC=aarch64-linux-gnu-gcc
|
||||
- export CXX=aarch64-linux-gnu-g++
|
||||
@@ -270,10 +290,12 @@ linux-aarch64:
|
||||
- md5sum "parity_"$VER"_arm64.deb" > "parity_"$VER"_arm64.deb.md5"
|
||||
- aws configure set aws_access_key_id $s3_key
|
||||
- aws configure set aws_secret_access_key $s3_secret
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/aarch64-unknown-linux-gnu/parity --body target/aarch64-unknown-linux-gnu/release/parity
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/aarch64-unknown-linux-gnu/parity.md5 --body parity.md5
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/aarch64-unknown-linux-gnu/"parity_"$VER"_arm64.deb" --body "parity_"$VER"_arm64.deb"
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/aarch64-unknown-linux-gnu/"parity_"$VER"_arm64.deb.md5" --body "parity_"$VER"_arm64.deb.md5"
|
||||
- if [[ $CI_BUILD_REF_NAME =~ ^(master|beta|stable)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi
|
||||
- aws s3 rm --recursive s3://$S3_BUCKET/$CI_BUILD_REF_NAME/aarch64-unknown-linux-gnu
|
||||
- aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/aarch64-unknown-linux-gnu/parity --body target/aarch64-unknown-linux-gnu/release/parity
|
||||
- aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/aarch64-unknown-linux-gnu/parity.md5 --body parity.md5
|
||||
- aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/aarch64-unknown-linux-gnu/"parity_"$VER"_arm64.deb" --body "parity_"$VER"_arm64.deb"
|
||||
- aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/aarch64-unknown-linux-gnu/"parity_"$VER"_arm64.deb.md5" --body "parity_"$VER"_arm64.deb.md5"
|
||||
tags:
|
||||
- rust
|
||||
- rust-arm
|
||||
@@ -282,26 +304,65 @@ linux-aarch64:
|
||||
- target/aarch64-unknown-linux-gnu/release/parity
|
||||
name: "aarch64-unknown-linux-gnu_parity"
|
||||
allow_failure: true
|
||||
#linux-alpine:
|
||||
# stage: build
|
||||
# image: ethcore/rust-alpine:latest
|
||||
# only:
|
||||
# - beta
|
||||
# - tags
|
||||
# - stable
|
||||
# - triggers
|
||||
# script:
|
||||
# - export HOST_CC=gcc
|
||||
# - export HOST_CXX=g++
|
||||
# - cargo build --release $CARGOFLAGS
|
||||
# - strip target/release/parity
|
||||
# - md5sum target/release/parity > parity.md5
|
||||
# - sh scripts/deb-build.sh arm64
|
||||
# - cp target/aarch64-unknown-linux-gnu/release/parity deb/usr/bin/parity
|
||||
# - export VER=$(grep -m 1 version Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n")
|
||||
# - dpkg-deb -b deb "parity_"$VER"_arm64.deb"
|
||||
# - md5sum "parity_"$VER"_arm64.deb" > "parity_"$VER"_arm64.deb.md5"
|
||||
# - aws configure set aws_access_key_id $s3_key
|
||||
# - aws configure set aws_secret_access_key $s3_secret
|
||||
# - if [[ $CI_BUILD_REF_NAME =~ ^(master|beta|stable)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi
|
||||
# - aws s3 rm --recursive s3://$S3_BUCKET/$CI_BUILD_REF_NAME/aarch64-unknown-linux-gnu
|
||||
# - aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/aarch64-unknown-linux-gnu/parity --body target/aarch64-unknown-linux-gnu/release/parity
|
||||
# - aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/aarch64-unknown-linux-gnu/parity.md5 --body parity.md5
|
||||
# - aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/aarch64-unknown-linux-gnu/"parity_"$VER"_arm64.deb" --body "parity_"$VER"_arm64.deb"
|
||||
# - aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/aarch64-unknown-linux-gnu/"parity_"$VER"_arm64.deb.md5" --body "parity_"$VER"_arm64.deb.md5"
|
||||
# tags:
|
||||
# - rust
|
||||
# - rust-alpine
|
||||
# artifacts:
|
||||
# paths:
|
||||
# - target/aarch64-unknown-linux-gnu/release/parity
|
||||
# name: "aarch64-unknown-linux-gnu_parity"
|
||||
# allow_failure: true
|
||||
darwin:
|
||||
stage: build
|
||||
only:
|
||||
- beta
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- cargo build --release -p ethstore $CARGOFLAGS
|
||||
- cargo build --release $CARGOFLAGS
|
||||
- rm -rf parity.md5
|
||||
- md5sum target/release/parity > parity.md5
|
||||
- packagesbuild -v mac/Parity.pkgproj
|
||||
- mv target/release/Parity\ Ethereum.pkg parity-osx-installer-EXPERIMENTAL.pkg
|
||||
- md5sum parity-osx-installer-EXPERIMENTAL.pkg > parity-osx-installer-EXPERIMENTAL.pkg.md5
|
||||
- export VER=$(grep -m 1 version Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n")
|
||||
- mv target/release/Parity\ Ethereum.pkg "parity-"$VER"-osx-installer-EXPERIMENTAL.pkg"
|
||||
- md5sum "parity-"$VER"-osx-installer-EXPERIMENTAL.pkg" >> "parity-"$VER"-osx-installer-EXPERIMENTAL.pkg.md5"
|
||||
- aws configure set aws_access_key_id $s3_key
|
||||
- aws configure set aws_secret_access_key $s3_secret
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-apple-darwin/parity --body target/release/parity
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-apple-darwin/parity.md5 --body parity.md5
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-apple-darwin/parity-osx-installer-EXPERIMENTAL.pkg --body parity-osx-installer-EXPERIMENTAL.pkg
|
||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-apple-darwin/parity-osx-installer-EXPERIMENTAL.pkg.md5 --body parity-osx-installer-EXPERIMENTAL.pkg.md5
|
||||
- if [[ $CI_BUILD_REF_NAME =~ ^(master|beta|stable)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi
|
||||
- aws s3 rm --recursive s3://$S3_BUCKET/$CI_BUILD_REF_NAME/x86_64-apple-darwin
|
||||
- aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/x86_64-apple-darwin/parity --body target/release/parity
|
||||
- aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/x86_64-apple-darwin/parity.md5 --body parity.md5
|
||||
- aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/x86_64-apple-darwin/"parity-"$VER"-osx-installer-EXPERIMENTAL.pkg" --body "parity-"$VER"-osx-installer-EXPERIMENTAL.pkg"
|
||||
- aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/x86_64-apple-darwin/"parity-"$VER"-osx-installer-EXPERIMENTAL.pkg.md5" --body "parity-"$VER"-osx-installer-EXPERIMENTAL.pkg.md5"
|
||||
tags:
|
||||
- osx
|
||||
artifacts:
|
||||
@@ -317,11 +378,12 @@ windows:
|
||||
- beta
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include;C:\vs2015\VC\include;C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt
|
||||
- set LIB=C:\vs2015\VC\lib;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64
|
||||
- set RUST_BACKTRACE=1
|
||||
- set RUSTFLAGS=%RUSTFLAGS% -Zorbit=off
|
||||
- set RUSTFLAGS=%RUSTFLAGS%
|
||||
- rustup default stable-x86_64-pc-windows-msvc
|
||||
- cargo build --release %CARGOFLAGS%
|
||||
- curl -sL --url "https://github.com/ethcore/win-build/raw/master/SimpleFC.dll" -o nsis\SimpleFC.dll
|
||||
@@ -344,14 +406,20 @@ windows:
|
||||
- cd ..\..
|
||||
- aws configure set aws_access_key_id %s3_key%
|
||||
- aws configure set aws_secret_access_key %s3_secret%
|
||||
- aws s3api put-object --bucket builds-parity --key %CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc/parity.exe --body target\release\parity.exe
|
||||
- aws s3api put-object --bucket builds-parity --key %CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc/parity.exe.md5 --body target\release\parity.exe.md5
|
||||
- aws s3api put-object --bucket builds-parity --key %CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc/parity.zip --body target\release\parity.zip
|
||||
- aws s3api put-object --bucket builds-parity --key %CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc/parity.zip.md5 --body target\release\parity.zip.md5
|
||||
- aws s3api put-object --bucket builds-parity --key %CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc/InstallParity.exe --body nsis\InstallParity.exe
|
||||
- aws s3api put-object --bucket builds-parity --key %CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc/InstallParity.exe.md5 --body nsis\InstallParity.exe.md5
|
||||
- aws s3api put-object --bucket builds-parity --key %CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc/win-installer.zip --body nsis\win-installer.zip
|
||||
- aws s3api put-object --bucket builds-parity --key %CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc/win-installer.zip.md5 --body nsis\win-installer.zip.md5
|
||||
- echo %CI_BUILD_REF_NAME%
|
||||
- echo %CI_BUILD_REF_NAME% | findstr /R "master" >nul 2>&1 && set S3_BUCKET=builds-parity-published || set S3_BUCKET=builds-parity
|
||||
- echo %CI_BUILD_REF_NAME% | findstr /R "beta" >nul 2>&1 && set S3_BUCKET=builds-parity-published || set S3_BUCKET=builds-parity
|
||||
- echo %CI_BUILD_REF_NAME% | findstr /R "stable" >nul 2>&1 && set S3_BUCKET=builds-parity-published || set S3_BUCKET=builds-parity
|
||||
- echo %S3_BUCKET%
|
||||
- aws s3 rm --recursive s3://%S3_BUCKET%/%CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc
|
||||
- aws s3api put-object --bucket %S3_BUCKET% --key %CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc/parity.exe --body target\release\parity.exe
|
||||
- aws s3api put-object --bucket %S3_BUCKET% --key %CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc/parity.exe.md5 --body target\release\parity.exe.md5
|
||||
- aws s3api put-object --bucket %S3_BUCKET% --key %CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc/parity.zip --body target\release\parity.zip
|
||||
- aws s3api put-object --bucket %S3_BUCKET% --key %CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc/parity.zip.md5 --body target\release\parity.zip.md5
|
||||
- aws s3api put-object --bucket %S3_BUCKET% --key %CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc/InstallParity.exe --body nsis\InstallParity.exe
|
||||
- aws s3api put-object --bucket %S3_BUCKET% --key %CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc/InstallParity.exe.md5 --body nsis\InstallParity.exe.md5
|
||||
- aws s3api put-object --bucket %S3_BUCKET% --key %CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc/win-installer.zip --body nsis\win-installer.zip
|
||||
- aws s3api put-object --bucket %S3_BUCKET% --key %CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc/win-installer.zip.md5 --body nsis\win-installer.zip.md5
|
||||
tags:
|
||||
- rust-windows
|
||||
artifacts:
|
||||
@@ -363,9 +431,7 @@ windows:
|
||||
test-darwin:
|
||||
stage: test
|
||||
only:
|
||||
# - beta
|
||||
# - tags
|
||||
- stable
|
||||
- triggers
|
||||
before_script:
|
||||
- git submodule update --init --recursive
|
||||
script:
|
||||
@@ -373,12 +439,11 @@ test-darwin:
|
||||
- ./test.sh $CARGOFLAGS --no-release
|
||||
tags:
|
||||
- osx
|
||||
allow_failure: true
|
||||
test-windows:
|
||||
stage: test
|
||||
only:
|
||||
# - beta
|
||||
# - tags
|
||||
- stable
|
||||
- triggers
|
||||
before_script:
|
||||
- git submodule update --init --recursive
|
||||
script:
|
||||
@@ -392,27 +457,60 @@ test-rust-stable:
|
||||
image: ethcore/rust:stable
|
||||
before_script:
|
||||
- git submodule update --init --recursive
|
||||
- export JS_FILES_MODIFIED=$(git --no-pager diff --name-only $CI_BUILD_REF $CI_BUILD_REF@{1} | grep \.js | wc -l)
|
||||
- export JS_FILES_MODIFIED=$(git --no-pager diff --name-only $CI_BUILD_REF^ $CI_BUILD_REF | grep \.js | wc -l)
|
||||
- echo $JS_FILES_MODIFIED
|
||||
- if [ -z $JS_FILES_MODIFIED ]; then echo "skip js test"; fi
|
||||
- if [ "$JS_FILES_MODIFIED" = 0 ]; then echo "skip js test"; else ./js/scripts/install-deps.sh;fi
|
||||
script:
|
||||
- export RUST_BACKTRACE=1
|
||||
- echo $JS_FILES_MODIFIED
|
||||
- if [ -z $JS_FILES_MODIFIED ]; then echo "skip js test"; else ./test.sh $CARGOFLAGS --no-release; fi
|
||||
- if [ "$JS_FILES_MODIFIED" = 0 ]; then echo "skip js test"&./test.sh $CARGOFLAGS --no-release; else echo "skip rust test"&./js/scripts/lint.sh&./js/scripts/test.sh&./js/scripts/build.sh; fi
|
||||
tags:
|
||||
- rust
|
||||
- rust-stable
|
||||
js-tests:
|
||||
js-test:
|
||||
stage: test
|
||||
image: ethcore/rust:stable
|
||||
before_script:
|
||||
- ./js/scripts/install-deps.sh
|
||||
- git submodule update --init --recursive
|
||||
- export JS_FILES_MODIFIED=$(git --no-pager diff --name-only $CI_BUILD_REF^ $CI_BUILD_REF | grep \.js | wc -l)
|
||||
- echo $JS_FILES_MODIFIED
|
||||
- if [ "$JS_FILES_MODIFIED" = 0 ]; then echo "skip js test"; else ./js/scripts/install-deps.sh;fi
|
||||
script:
|
||||
- ./js/scripts/lint.sh
|
||||
- ./js/scripts/test.sh
|
||||
- ./js/scripts/build.sh
|
||||
- export RUST_BACKTRACE=1
|
||||
- echo $JS_FILES_MODIFIED
|
||||
- if [ "$JS_FILES_MODIFIED" = 0 ]; then echo "skip js test"; else echo "skip rust test"&./js/scripts/lint.sh&./js/scripts/test.sh&./js/scripts/build.sh; fi
|
||||
tags:
|
||||
- javascript-test
|
||||
- rust
|
||||
- rust-stable
|
||||
test-rust-beta:
|
||||
stage: test
|
||||
only:
|
||||
- triggers
|
||||
image: ethcore/rust:beta
|
||||
before_script:
|
||||
- git submodule update --init --recursive
|
||||
script:
|
||||
- export RUST_BACKTRACE=1
|
||||
- echo $JS_FILES_MODIFIED
|
||||
- ./test.sh $CARGOFLAGS --no-release
|
||||
tags:
|
||||
- rust
|
||||
- rust-beta
|
||||
allow_failure: true
|
||||
test-rust-nightly:
|
||||
stage: test
|
||||
only:
|
||||
- triggers
|
||||
image: ethcore/rust:nightly
|
||||
before_script:
|
||||
- git submodule update --init --recursive
|
||||
script:
|
||||
- export RUST_BACKTRACE=1
|
||||
- ./test.sh $CARGOFLAGS --no-release
|
||||
tags:
|
||||
- rust
|
||||
- rust-nightly
|
||||
allow_failure: true
|
||||
js-release:
|
||||
stage: js-build
|
||||
only:
|
||||
@@ -421,9 +519,11 @@ js-release:
|
||||
- stable
|
||||
image: ethcore/rust:stable
|
||||
before_script:
|
||||
- ./js/scripts/install-deps.sh
|
||||
- export JS_FILES_MODIFIED=$(git --no-pager diff --name-only $CI_BUILD_REF^ $CI_BUILD_REF | grep \.js | wc -l)
|
||||
- echo $JS_FILES_MODIFIED
|
||||
- if [ "$JS_FILES_MODIFIED" = 0 ]; then echo "skip js build"; else ./js/scripts/install-deps.sh;fi
|
||||
script:
|
||||
- ./js/scripts/build.sh
|
||||
- ./js/scripts/release.sh
|
||||
- echo $JS_FILES_MODIFIED
|
||||
- if [ "$JS_FILES_MODIFIED" = 0 ]; then echo "skip js build"; else ./js/scripts/build.sh&&./js/scripts/release.sh; fi
|
||||
tags:
|
||||
- javascript
|
||||
|
||||
48
Cargo.lock
generated
48
Cargo.lock
generated
@@ -1,6 +1,6 @@
|
||||
[root]
|
||||
name = "parity"
|
||||
version = "1.4.2"
|
||||
version = "1.4.7"
|
||||
dependencies = [
|
||||
"ansi_term 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clippy 0.0.96 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -21,7 +21,7 @@ dependencies = [
|
||||
"ethcore-rpc 1.4.0",
|
||||
"ethcore-signer 1.4.0",
|
||||
"ethcore-stratum 1.4.0",
|
||||
"ethcore-util 1.4.2",
|
||||
"ethcore-util 1.4.7",
|
||||
"ethsync 1.4.0",
|
||||
"fdlimit 0.1.0",
|
||||
"hyper 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -289,7 +289,7 @@ dependencies = [
|
||||
"ethcore-ipc 1.4.0",
|
||||
"ethcore-ipc-codegen 1.4.0",
|
||||
"ethcore-ipc-nano 1.4.0",
|
||||
"ethcore-util 1.4.2",
|
||||
"ethcore-util 1.4.7",
|
||||
"ethjson 0.1.0",
|
||||
"ethkey 0.2.0",
|
||||
"ethstore 0.1.0",
|
||||
@@ -312,7 +312,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ethcore-bigint"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
dependencies = [
|
||||
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -336,7 +336,7 @@ dependencies = [
|
||||
"ethabi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ethcore-devtools 1.4.0",
|
||||
"ethcore-rpc 1.4.0",
|
||||
"ethcore-util 1.4.2",
|
||||
"ethcore-util 1.4.7",
|
||||
"fetch 0.1.0",
|
||||
"hyper 0.9.4 (git+https://github.com/ethcore/hyper)",
|
||||
"jsonrpc-core 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -371,7 +371,7 @@ version = "1.4.0"
|
||||
dependencies = [
|
||||
"crossbeam 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mio 0.6.1 (git+https://github.com/carllerche/mio)",
|
||||
"mio 0.6.1 (git+https://github.com/ethcore/mio)",
|
||||
"parking_lot 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"slab 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@@ -381,7 +381,7 @@ name = "ethcore-ipc"
|
||||
version = "1.4.0"
|
||||
dependencies = [
|
||||
"ethcore-devtools 1.4.0",
|
||||
"ethcore-util 1.4.2",
|
||||
"ethcore-util 1.4.7",
|
||||
"nanomsg 0.5.1 (git+https://github.com/ethcore/nanomsg.rs.git)",
|
||||
"semver 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@@ -428,7 +428,7 @@ dependencies = [
|
||||
"ethcore-ipc 1.4.0",
|
||||
"ethcore-ipc-codegen 1.4.0",
|
||||
"ethcore-ipc-nano 1.4.0",
|
||||
"ethcore-util 1.4.2",
|
||||
"ethcore-util 1.4.7",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"nanomsg 0.5.1 (git+https://github.com/ethcore/nanomsg.rs.git)",
|
||||
"semver 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -439,7 +439,7 @@ name = "ethcore-logger"
|
||||
version = "1.4.0"
|
||||
dependencies = [
|
||||
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ethcore-util 1.4.2",
|
||||
"ethcore-util 1.4.7",
|
||||
"isatty 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -455,13 +455,13 @@ dependencies = [
|
||||
"bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ethcore-devtools 1.4.0",
|
||||
"ethcore-io 1.4.0",
|
||||
"ethcore-util 1.4.2",
|
||||
"ethcore-util 1.4.7",
|
||||
"ethcrypto 0.1.0",
|
||||
"ethkey 0.2.0",
|
||||
"igd 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mio 0.6.1 (git+https://github.com/carllerche/mio)",
|
||||
"mio 0.6.1 (git+https://github.com/ethcore/mio)",
|
||||
"parking_lot 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rlp 0.1.0",
|
||||
@@ -482,7 +482,7 @@ dependencies = [
|
||||
"ethcore-devtools 1.4.0",
|
||||
"ethcore-io 1.4.0",
|
||||
"ethcore-ipc 1.4.0",
|
||||
"ethcore-util 1.4.2",
|
||||
"ethcore-util 1.4.7",
|
||||
"ethcrypto 0.1.0",
|
||||
"ethjson 0.1.0",
|
||||
"ethkey 0.2.0",
|
||||
@@ -511,7 +511,7 @@ dependencies = [
|
||||
"ethcore-devtools 1.4.0",
|
||||
"ethcore-io 1.4.0",
|
||||
"ethcore-rpc 1.4.0",
|
||||
"ethcore-util 1.4.2",
|
||||
"ethcore-util 1.4.7",
|
||||
"jsonrpc-core 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-dapps-glue 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -530,7 +530,7 @@ dependencies = [
|
||||
"ethcore-ipc 1.4.0",
|
||||
"ethcore-ipc-codegen 1.4.0",
|
||||
"ethcore-ipc-nano 1.4.0",
|
||||
"ethcore-util 1.4.2",
|
||||
"ethcore-util 1.4.7",
|
||||
"json-tcp-server 0.1.0 (git+https://github.com/ethcore/json-tcp-server)",
|
||||
"jsonrpc-core 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -541,7 +541,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ethcore-util"
|
||||
version = "1.4.2"
|
||||
version = "1.4.7"
|
||||
dependencies = [
|
||||
"ansi_term 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"arrayvec 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -549,7 +549,7 @@ dependencies = [
|
||||
"elastic-array 0.6.0 (git+https://github.com/ethcore/elastic-array)",
|
||||
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"eth-secp256k1 0.5.4 (git+https://github.com/ethcore/rust-secp256k1)",
|
||||
"ethcore-bigint 0.1.1",
|
||||
"ethcore-bigint 0.1.2",
|
||||
"ethcore-bloom-journal 0.1.0",
|
||||
"ethcore-devtools 1.4.0",
|
||||
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -580,7 +580,7 @@ name = "ethcrypto"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"eth-secp256k1 0.5.4 (git+https://github.com/ethcore/rust-secp256k1)",
|
||||
"ethcore-bigint 0.1.1",
|
||||
"ethcore-bigint 0.1.2",
|
||||
"ethkey 0.2.0",
|
||||
"rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tiny-keccak 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -590,7 +590,7 @@ dependencies = [
|
||||
name = "ethjson"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"ethcore-util 1.4.2",
|
||||
"ethcore-util 1.4.7",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_codegen 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -603,7 +603,7 @@ version = "0.2.0"
|
||||
dependencies = [
|
||||
"docopt 0.6.80 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"eth-secp256k1 0.5.4 (git+https://github.com/ethcore/rust-secp256k1)",
|
||||
"ethcore-bigint 0.1.1",
|
||||
"ethcore-bigint 0.1.2",
|
||||
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -643,7 +643,7 @@ dependencies = [
|
||||
"ethcore-ipc-codegen 1.4.0",
|
||||
"ethcore-ipc-nano 1.4.0",
|
||||
"ethcore-network 1.4.0",
|
||||
"ethcore-util 1.4.2",
|
||||
"ethcore-util 1.4.7",
|
||||
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -1012,7 +1012,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "0.6.1"
|
||||
source = "git+https://github.com/carllerche/mio#56f8663510196fdca04bdf7c5f4d60b24297826f"
|
||||
source = "git+https://github.com/ethcore/mio#ef182bae193a9c7457cd2cf661fcaffb226e3eef"
|
||||
dependencies = [
|
||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazycell 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -1249,7 +1249,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "parity-ui-precompiled"
|
||||
version = "1.4.0"
|
||||
source = "git+https://github.com/ethcore/js-precompiled.git?branch=beta#8a2b297e342e4a5c441dc15bed54c6b53d0b5657"
|
||||
source = "git+https://github.com/ethcore/js-precompiled.git?branch=beta#a4da6ebd3e2a02fad22ae5ce6d73ff4f0e0bbfaf"
|
||||
dependencies = [
|
||||
"parity-dapps-glue 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@@ -1463,7 +1463,7 @@ name = "rlp"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"elastic-array 0.6.0 (git+https://github.com/ethcore/elastic-array)",
|
||||
"ethcore-bigint 0.1.1",
|
||||
"ethcore-bigint 0.1.2",
|
||||
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@@ -2039,7 +2039,7 @@ dependencies = [
|
||||
"checksum mio 0.5.1 (git+https://github.com/ethcore/mio?branch=v0.5.x)" = "<none>"
|
||||
"checksum mio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a637d1ca14eacae06296a008fa7ad955347e34efcb5891cfd8ba05491a37907e"
|
||||
"checksum mio 0.6.0-dev (git+https://github.com/ethcore/mio?branch=timer-fix)" = "<none>"
|
||||
"checksum mio 0.6.1 (git+https://github.com/carllerche/mio)" = "<none>"
|
||||
"checksum mio 0.6.1 (git+https://github.com/ethcore/mio)" = "<none>"
|
||||
"checksum miow 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d5bfc6782530ac8ace97af10a540054a37126b63b0702ddaaa243b73b5745b9a"
|
||||
"checksum msdos_time 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c04b68cc63a8480fb2550343695f7be72effdec953a9d4508161c3e69041c7d8"
|
||||
"checksum nanomsg 0.5.1 (git+https://github.com/ethcore/nanomsg.rs.git)" = "<none>"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
description = "Ethcore client."
|
||||
name = "parity"
|
||||
version = "1.4.2"
|
||||
version = "1.4.7"
|
||||
license = "GPL-3.0"
|
||||
authors = ["Ethcore <admin@ethcore.io>"]
|
||||
build = "build.rs"
|
||||
|
||||
@@ -131,7 +131,7 @@ impl<A: Authorization + 'static> server::Handler<HttpStream> for Router<A> {
|
||||
StatusCode::NotFound,
|
||||
"404 Not Found",
|
||||
"Your homepage is not available when Trusted Signer is disabled.",
|
||||
Some("You can still access dapps by writing a correct address, though. Re-enabled Signer to get your homepage back."),
|
||||
Some("You can still access dapps by writing a correct address, though. Re-enable Signer to get your homepage back."),
|
||||
self.signer_address.clone(),
|
||||
))
|
||||
}
|
||||
|
||||
@@ -14,6 +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/>.
|
||||
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use std::io::{Read, Write};
|
||||
use std::str::{self, Lines};
|
||||
@@ -42,8 +43,28 @@ pub fn read_block(lines: &mut Lines, all: bool) -> String {
|
||||
block
|
||||
}
|
||||
|
||||
fn connect(address: &SocketAddr) -> TcpStream {
|
||||
let mut retries = 0;
|
||||
let mut last_error = None;
|
||||
while retries < 10 {
|
||||
retries += 1;
|
||||
|
||||
let res = TcpStream::connect(address);
|
||||
match res {
|
||||
Ok(stream) => {
|
||||
return stream;
|
||||
},
|
||||
Err(e) => {
|
||||
last_error = Some(e);
|
||||
thread::sleep(Duration::from_millis(retries * 10));
|
||||
}
|
||||
}
|
||||
}
|
||||
panic!("Unable to connect to the server. Last error: {:?}", last_error);
|
||||
}
|
||||
|
||||
pub fn request(address: &SocketAddr, request: &str) -> Response {
|
||||
let mut req = TcpStream::connect(address).unwrap();
|
||||
let mut req = connect(address);
|
||||
req.set_read_timeout(Some(Duration::from_secs(1))).unwrap();
|
||||
req.write_all(request.as_bytes()).unwrap();
|
||||
|
||||
|
||||
@@ -131,10 +131,11 @@
|
||||
"0x807640a13483f8ac783c557fcdf27be11ea4ac7a"
|
||||
],
|
||||
"eip150Transition": "0x259518",
|
||||
"eip155Transition": "0x7fffffffffffffff",
|
||||
"eip160Transition": "0x7fffffffffffffff",
|
||||
"eip161abcTransition": "0x7fffffffffffffff",
|
||||
"eip161dTransition": "0x7fffffffffffffff"
|
||||
"eip155Transition": 2675000,
|
||||
"eip160Transition": 2675000,
|
||||
"eip161abcTransition": 2675000,
|
||||
"eip161dTransition": 2675000,
|
||||
"maxCodeSize": 24576
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -181,8 +182,8 @@
|
||||
"enode://89d5dc2a81e574c19d0465f497c1af96732d1b61a41de89c2a37f35707689ac416529fae1038809852b235c2d30fd325abdc57c122feeefbeaaf802cc7e9580d@45.55.33.62:30303",
|
||||
"enode://605e04a43b1156966b3a3b66b980c87b7f18522f7f712035f84576016be909a2798a438b2b17b1a8c58db314d88539a77419ca4be36148c086900fba487c9d39@188.166.255.12:30303",
|
||||
"enode://016b20125f447a3b203a3cae953b2ede8ffe51290c071e7599294be84317635730c397b8ff74404d6be412d539ee5bb5c3c700618723d3b53958c92bd33eaa82@159.203.210.80:30303",
|
||||
"enode://01f76fa0561eca2b9a7e224378dd854278735f1449793c46ad0c4e79e8775d080c21dcc455be391e90a98153c3b05dcc8935c8440de7b56fe6d67251e33f4e3c@10.6.6.117:30303",
|
||||
"enode://fe11ef89fc5ac9da358fc160857855f25bbf9e332c79b9ca7089330c02b728b2349988c6062f10982041702110745e203d26975a6b34bcc97144f9fe439034e8@10.1.72.117:30303"
|
||||
"enode://01f76fa0561eca2b9a7e224378dd854278735f1449793c46ad0c4e79e8775d080c21dcc455be391e90a98153c3b05dcc8935c8440de7b56fe6d67251e33f4e3c@51.15.42.252:30303",
|
||||
"enode://8d91c8137890d29110b9463882f17ae4e279cd2c90cf56573187ed1c8546fca5f590a9f05e9f108eb1bd91767ed01ede4daad9e001b61727885eaa246ddb39c2@163.172.171.38:30303"
|
||||
],
|
||||
"accounts": {
|
||||
"0000000000000000000000000000000000000001": { "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
"registrar": "0x52dff57a8a1532e6afb3dc07e2af58bb9eb05b3d",
|
||||
"homesteadTransition": "0x789b0",
|
||||
"eip150Transition": "0x1b34d8",
|
||||
"eip155Transition": "0x7fffffffffffffff",
|
||||
"eip160Transition": "0x7fffffffffffffff",
|
||||
"eip161abcTransition": "0x7fffffffffffffff",
|
||||
"eip161dTransition": "0x7fffffffffffffff"
|
||||
"eip155Transition": 1885000,
|
||||
"eip160Transition": 1885000,
|
||||
"eip161abcTransition": 1885000,
|
||||
"eip161dTransition": 1885000
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
304
ethcore/res/ethereum/ropsten.json
Normal file
304
ethcore/res/ethereum/ropsten.json
Normal file
@@ -0,0 +1,304 @@
|
||||
{
|
||||
"name": "Ropsten",
|
||||
"engine": {
|
||||
"Ethash": {
|
||||
"params": {
|
||||
"gasLimitBoundDivisor": "0x0400",
|
||||
"minimumDifficulty": "0x020000",
|
||||
"difficultyBoundDivisor": "0x0800",
|
||||
"durationLimit": "0x0d",
|
||||
"blockReward": "0x4563918244F40000",
|
||||
"registrar": "0x81a4b044831c4f12ba601adb9274516939e9b8a2",
|
||||
"homesteadTransition": 0,
|
||||
"eip150Transition": 0,
|
||||
"eip155Transition": 10,
|
||||
"eip160Transition": 10,
|
||||
"eip161abcTransition": 10,
|
||||
"eip161dTransition": 10
|
||||
}
|
||||
}
|
||||
},
|
||||
"params": {
|
||||
"accountStartNonce": "0x0",
|
||||
"maximumExtraDataSize": "0x20",
|
||||
"minGasLimit": "0x1388",
|
||||
"networkID" : "0x3"
|
||||
},
|
||||
"genesis": {
|
||||
"seal": {
|
||||
"ethereum": {
|
||||
"nonce": "0x0000000000000042",
|
||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
}
|
||||
},
|
||||
"difficulty": "0x100000",
|
||||
"author": "0x0000000000000000000000000000000000000000",
|
||||
"timestamp": "0x00",
|
||||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"extraData": "0x3535353535353535353535353535353535353535353535353535353535353535",
|
||||
"gasLimit": "0x1000000"
|
||||
},
|
||||
"nodes": [
|
||||
"enode://a22f0977ce02653bf95e38730106356342df48b5222e2c2a1a6f9ef34769bf593bae9ca0a888cf60839edd52efc1b6e393c63a57d76f4c4fe14e641f1f9e637e@128.199.55.137:30303",
|
||||
"enode://012239fccf3ff1d92b036983a430cb6705c6528c96c0354413f8854802138e5135c084ab36e7c54efb621c46728df8c3a6f4c1db9bb48a1330efe3f82f2dd7a6@52.169.94.142:30303"
|
||||
],
|
||||
"accounts": {
|
||||
"0000000000000000000000000000000000000001": { "balance": "1", "nonce": "0", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
|
||||
"0000000000000000000000000000000000000002": { "balance": "1", "nonce": "0", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
|
||||
"0000000000000000000000000000000000000003": { "balance": "1", "nonce": "0", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
|
||||
"0000000000000000000000000000000000000004": { "balance": "1", "nonce": "0", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
|
||||
"0000000000000000000000000000000000000000": { "balance": "1" },
|
||||
"0000000000000000000000000000000000000005": { "balance": "1" },
|
||||
"0000000000000000000000000000000000000006": { "balance": "1" },
|
||||
"0000000000000000000000000000000000000007": { "balance": "1" },
|
||||
"0000000000000000000000000000000000000008": { "balance": "1" },
|
||||
"0000000000000000000000000000000000000009": { "balance": "1" },
|
||||
"000000000000000000000000000000000000000a": { "balance": "0" },
|
||||
"000000000000000000000000000000000000000b": { "balance": "0" },
|
||||
"000000000000000000000000000000000000000c": { "balance": "0" },
|
||||
"000000000000000000000000000000000000000d": { "balance": "0" },
|
||||
"000000000000000000000000000000000000000e": { "balance": "0" },
|
||||
"000000000000000000000000000000000000000f": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000010": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000011": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000012": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000013": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000014": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000015": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000016": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000017": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000018": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000019": { "balance": "0" },
|
||||
"000000000000000000000000000000000000001a": { "balance": "0" },
|
||||
"000000000000000000000000000000000000001b": { "balance": "0" },
|
||||
"000000000000000000000000000000000000001c": { "balance": "0" },
|
||||
"000000000000000000000000000000000000001d": { "balance": "0" },
|
||||
"000000000000000000000000000000000000001e": { "balance": "0" },
|
||||
"000000000000000000000000000000000000001f": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000020": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000021": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000022": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000023": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000024": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000025": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000026": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000027": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000028": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000029": { "balance": "0" },
|
||||
"000000000000000000000000000000000000002a": { "balance": "0" },
|
||||
"000000000000000000000000000000000000002b": { "balance": "0" },
|
||||
"000000000000000000000000000000000000002c": { "balance": "0" },
|
||||
"000000000000000000000000000000000000002d": { "balance": "0" },
|
||||
"000000000000000000000000000000000000002e": { "balance": "0" },
|
||||
"000000000000000000000000000000000000002f": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000030": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000031": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000032": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000033": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000034": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000035": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000036": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000037": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000038": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000039": { "balance": "0" },
|
||||
"000000000000000000000000000000000000003a": { "balance": "0" },
|
||||
"000000000000000000000000000000000000003b": { "balance": "0" },
|
||||
"000000000000000000000000000000000000003c": { "balance": "0" },
|
||||
"000000000000000000000000000000000000003d": { "balance": "0" },
|
||||
"000000000000000000000000000000000000003e": { "balance": "0" },
|
||||
"000000000000000000000000000000000000003f": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000040": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000041": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000042": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000043": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000044": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000045": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000046": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000047": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000048": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000049": { "balance": "0" },
|
||||
"000000000000000000000000000000000000004a": { "balance": "0" },
|
||||
"000000000000000000000000000000000000004b": { "balance": "0" },
|
||||
"000000000000000000000000000000000000004c": { "balance": "0" },
|
||||
"000000000000000000000000000000000000004d": { "balance": "0" },
|
||||
"000000000000000000000000000000000000004e": { "balance": "0" },
|
||||
"000000000000000000000000000000000000004f": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000050": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000051": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000052": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000053": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000054": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000055": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000056": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000057": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000058": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000059": { "balance": "0" },
|
||||
"000000000000000000000000000000000000005a": { "balance": "0" },
|
||||
"000000000000000000000000000000000000005b": { "balance": "0" },
|
||||
"000000000000000000000000000000000000005c": { "balance": "0" },
|
||||
"000000000000000000000000000000000000005d": { "balance": "0" },
|
||||
"000000000000000000000000000000000000005e": { "balance": "0" },
|
||||
"000000000000000000000000000000000000005f": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000060": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000061": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000062": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000063": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000064": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000065": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000066": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000067": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000068": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000069": { "balance": "0" },
|
||||
"000000000000000000000000000000000000006a": { "balance": "0" },
|
||||
"000000000000000000000000000000000000006b": { "balance": "0" },
|
||||
"000000000000000000000000000000000000006c": { "balance": "0" },
|
||||
"000000000000000000000000000000000000006d": { "balance": "0" },
|
||||
"000000000000000000000000000000000000006e": { "balance": "0" },
|
||||
"000000000000000000000000000000000000006f": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000070": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000071": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000072": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000073": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000074": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000075": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000076": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000077": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000078": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000079": { "balance": "0" },
|
||||
"000000000000000000000000000000000000007a": { "balance": "0" },
|
||||
"000000000000000000000000000000000000007b": { "balance": "0" },
|
||||
"000000000000000000000000000000000000007c": { "balance": "0" },
|
||||
"000000000000000000000000000000000000007d": { "balance": "0" },
|
||||
"000000000000000000000000000000000000007e": { "balance": "0" },
|
||||
"000000000000000000000000000000000000007f": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000080": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000081": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000082": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000083": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000084": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000085": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000086": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000087": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000088": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000089": { "balance": "0" },
|
||||
"000000000000000000000000000000000000008a": { "balance": "0" },
|
||||
"000000000000000000000000000000000000008b": { "balance": "0" },
|
||||
"000000000000000000000000000000000000008c": { "balance": "0" },
|
||||
"000000000000000000000000000000000000008d": { "balance": "0" },
|
||||
"000000000000000000000000000000000000008e": { "balance": "0" },
|
||||
"000000000000000000000000000000000000008f": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000090": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000091": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000092": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000093": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000094": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000095": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000096": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000097": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000098": { "balance": "0" },
|
||||
"0000000000000000000000000000000000000099": { "balance": "0" },
|
||||
"000000000000000000000000000000000000009a": { "balance": "0" },
|
||||
"000000000000000000000000000000000000009b": { "balance": "0" },
|
||||
"000000000000000000000000000000000000009c": { "balance": "0" },
|
||||
"000000000000000000000000000000000000009d": { "balance": "0" },
|
||||
"000000000000000000000000000000000000009e": { "balance": "0" },
|
||||
"000000000000000000000000000000000000009f": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000a0": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000a1": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000a2": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000a3": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000a4": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000a5": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000a6": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000a7": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000a8": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000a9": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000aa": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000ab": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000ac": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000ad": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000ae": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000af": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000b0": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000b1": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000b2": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000b3": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000b4": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000b5": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000b6": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000b7": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000b8": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000b9": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000ba": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000bb": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000bc": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000bd": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000be": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000bf": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000c0": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000c1": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000c2": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000c3": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000c4": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000c5": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000c6": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000c7": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000c8": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000c9": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000ca": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000cb": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000cc": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000cd": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000ce": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000cf": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000d0": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000d1": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000d2": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000d3": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000d4": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000d5": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000d6": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000d7": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000d8": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000d9": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000da": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000db": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000dc": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000dd": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000de": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000df": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000e0": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000e1": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000e2": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000e3": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000e4": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000e5": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000e6": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000e7": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000e8": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000e9": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000ea": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000eb": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000ec": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000ed": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000ee": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000ef": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000f0": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000f1": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000f2": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000f3": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000f4": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000f5": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000f6": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000f7": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000f8": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000f9": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000fa": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000fb": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000fc": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000fd": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000fe": { "balance": "0" },
|
||||
"00000000000000000000000000000000000000ff": { "balance": "0" },
|
||||
"874b54a8bd152966d63f706bae1ffeb0411921e5": { "balance": "1000000000000000000000000000000" }
|
||||
}
|
||||
}
|
||||
@@ -266,7 +266,8 @@ impl<'x> OpenBlock<'x> {
|
||||
r.block.base.header.set_extra_data(extra_data);
|
||||
r.block.base.header.note_dirty();
|
||||
|
||||
engine.populate_from_parent(&mut r.block.base.header, parent, gas_range_target.0, gas_range_target.1);
|
||||
let gas_floor_target = ::std::cmp::max(gas_range_target.0, engine.params().min_gas_limit);
|
||||
engine.populate_from_parent(&mut r.block.base.header, parent, gas_floor_target, gas_range_target.1);
|
||||
engine.on_new_block(&mut r.block);
|
||||
Ok(r)
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ use transaction::{LocalizedTransaction, SignedTransaction, Action};
|
||||
use blockchain::extras::TransactionAddress;
|
||||
use types::filter::Filter;
|
||||
use types::mode::Mode as IpcMode;
|
||||
use types::pruning_info::PruningInfo;
|
||||
use log_entry::LocalizedLogEntry;
|
||||
use verification::queue::BlockQueue;
|
||||
use blockchain::{BlockChain, BlockProvider, TreeRoute, ImportRoute};
|
||||
@@ -1050,7 +1051,9 @@ impl BlockChainClient for Client {
|
||||
transaction_hash: transaction_hash.clone(),
|
||||
transaction_index: transaction_index,
|
||||
log_index: i
|
||||
}).collect()
|
||||
}).collect(),
|
||||
log_bloom: receipt.log_bloom,
|
||||
state_root: receipt.state_root,
|
||||
})
|
||||
},
|
||||
_ => None
|
||||
@@ -1079,7 +1082,7 @@ impl BlockChainClient for Client {
|
||||
}
|
||||
|
||||
fn import_block(&self, bytes: Bytes) -> Result<H256, BlockImportError> {
|
||||
use verification::queue::kind::HasHash;
|
||||
use verification::queue::kind::BlockLike;
|
||||
use verification::queue::kind::blocks::Unverified;
|
||||
|
||||
// create unverified block here so the `sha3` calculation can be cached.
|
||||
@@ -1119,7 +1122,9 @@ impl BlockChainClient for Client {
|
||||
}
|
||||
|
||||
fn chain_info(&self) -> BlockChainInfo {
|
||||
self.chain.read().chain_info()
|
||||
let mut chain_info = self.chain.read().chain_info();
|
||||
chain_info.pending_total_difficulty = chain_info.total_difficulty + self.block_queue.total_difficulty();
|
||||
chain_info
|
||||
}
|
||||
|
||||
fn additional_params(&self) -> BTreeMap<String, String> {
|
||||
@@ -1224,6 +1229,12 @@ impl BlockChainClient for Client {
|
||||
self.uncle(id)
|
||||
.map(|header| self.engine.extra_info(&decode(&header)))
|
||||
}
|
||||
|
||||
fn pruning_info(&self) -> PruningInfo {
|
||||
PruningInfo {
|
||||
history_size: Some(self.history),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl MiningBlockChainClient for Client {
|
||||
|
||||
@@ -38,6 +38,7 @@ use evm::{Factory as EvmFactory, VMType, Schedule};
|
||||
use miner::{Miner, MinerService, TransactionImportResult};
|
||||
use spec::Spec;
|
||||
use types::mode::Mode;
|
||||
use types::pruning_info::PruningInfo;
|
||||
use views::BlockView;
|
||||
|
||||
use verification::queue::QueueInfo;
|
||||
@@ -89,6 +90,8 @@ pub struct TestBlockChainClient {
|
||||
pub ancient_block: RwLock<Option<(H256, u64)>>,
|
||||
/// First block info.
|
||||
pub first_block: RwLock<Option<(H256, u64)>>,
|
||||
/// Pruning history size to report.
|
||||
pub history: RwLock<Option<u64>>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
@@ -140,6 +143,7 @@ impl TestBlockChainClient {
|
||||
latest_block_timestamp: RwLock::new(10_000_000),
|
||||
ancient_block: RwLock::new(None),
|
||||
first_block: RwLock::new(None),
|
||||
history: RwLock::new(None),
|
||||
};
|
||||
client.add_blocks(1, EachBlockWith::Nothing); // add genesis block
|
||||
client.genesis_hash = client.last_hash.read().clone();
|
||||
@@ -300,6 +304,11 @@ impl TestBlockChainClient {
|
||||
let res = res.into_iter().next().unwrap().expect("Successful import");
|
||||
assert_eq!(res, TransactionImportResult::Current);
|
||||
}
|
||||
|
||||
/// Set reported history size.
|
||||
pub fn set_history(&self, h: Option<u64>) {
|
||||
*self.history.write() = h;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_temp_state_db() -> GuardedTempResult<StateDB> {
|
||||
@@ -315,7 +324,7 @@ pub fn get_temp_state_db() -> GuardedTempResult<StateDB> {
|
||||
|
||||
impl MiningBlockChainClient for TestBlockChainClient {
|
||||
fn latest_schedule(&self) -> Schedule {
|
||||
Schedule::new_post_eip150(true, true, true)
|
||||
Schedule::new_post_eip150(24576, true, true, true)
|
||||
}
|
||||
|
||||
fn prepare_open_block(&self, author: Address, gas_range_target: (U256, U256), extra_data: Bytes) -> OpenBlock {
|
||||
@@ -650,4 +659,10 @@ impl BlockChainClient for TestBlockChainClient {
|
||||
fn mode(&self) -> Mode { Mode::Active }
|
||||
|
||||
fn set_mode(&self, _: Mode) { unimplemented!(); }
|
||||
|
||||
fn pruning_info(&self) -> PruningInfo {
|
||||
PruningInfo {
|
||||
history_size: *self.history.read(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ use types::call_analytics::CallAnalytics;
|
||||
use types::blockchain_info::BlockChainInfo;
|
||||
use types::block_status::BlockStatus;
|
||||
use types::mode::Mode;
|
||||
use types::pruning_info::PruningInfo;
|
||||
|
||||
#[ipc(client_ident="RemoteClient")]
|
||||
/// Blockchain database client. Owns and manages a blockchain and a block queue.
|
||||
@@ -241,6 +242,9 @@ pub trait BlockChainClient : Sync + Send {
|
||||
|
||||
/// Returns engine-related extra info for `UncleID`.
|
||||
fn uncle_extra_info(&self, id: UncleID) -> Option<BTreeMap<String, String>>;
|
||||
|
||||
/// Get pruning settings.
|
||||
fn pruning_info(&self) -> PruningInfo;
|
||||
}
|
||||
|
||||
/// Extended client interface used for mining
|
||||
|
||||
@@ -55,7 +55,7 @@ impl Engine for InstantSeal {
|
||||
}
|
||||
|
||||
fn schedule(&self, _env_info: &EnvInfo) -> Schedule {
|
||||
Schedule::new_homestead()
|
||||
Schedule::new_post_eip150(usize::max_value(), false, false, false)
|
||||
}
|
||||
|
||||
fn is_sealer(&self, _author: &Address) -> Option<bool> { Some(true) }
|
||||
|
||||
@@ -118,8 +118,9 @@ pub trait Engine : Sync + Send {
|
||||
self.verify_block_basic(header, None).and_then(|_| self.verify_block_unordered(header, None))
|
||||
}
|
||||
|
||||
/// Don't forget to call Super::populate_from_parent when subclassing & overriding.
|
||||
// TODO: consider including State in the params.
|
||||
/// Populate a header's fields based on its parent's header.
|
||||
/// Takes gas floor and ceiling targets.
|
||||
/// The gas floor target must not be lower than the engine's minimum gas limit.
|
||||
fn populate_from_parent(&self, header: &mut Header, parent: &Header, _gas_floor_target: U256, _gas_ceil_target: U256) {
|
||||
header.set_difficulty(parent.difficulty().clone());
|
||||
header.set_gas_limit(parent.gas_limit().clone());
|
||||
|
||||
@@ -70,6 +70,8 @@ pub struct EthashParams {
|
||||
pub eip161abc_transition: u64,
|
||||
/// Number of first block where EIP-161.d begins.
|
||||
pub eip161d_transition: u64,
|
||||
/// Maximum amount of code that can be deploying into a contract.
|
||||
pub max_code_size: u64,
|
||||
}
|
||||
|
||||
impl From<ethjson::spec::EthashParams> for EthashParams {
|
||||
@@ -83,17 +85,18 @@ impl From<ethjson::spec::EthashParams> for EthashParams {
|
||||
block_reward: p.block_reward.into(),
|
||||
registrar: p.registrar.map_or_else(Address::new, Into::into),
|
||||
homestead_transition: p.homestead_transition.map_or(0, Into::into),
|
||||
dao_hardfork_transition: p.dao_hardfork_transition.map_or(0x7fffffffffffffff, Into::into),
|
||||
dao_hardfork_transition: p.dao_hardfork_transition.map_or(u64::max_value(), Into::into),
|
||||
dao_hardfork_beneficiary: p.dao_hardfork_beneficiary.map_or_else(Address::new, Into::into),
|
||||
dao_hardfork_accounts: p.dao_hardfork_accounts.unwrap_or_else(Vec::new).into_iter().map(Into::into).collect(),
|
||||
difficulty_hardfork_transition: p.difficulty_hardfork_transition.map_or(0x7fffffffffffffff, Into::into),
|
||||
difficulty_hardfork_transition: p.difficulty_hardfork_transition.map_or(u64::max_value(), Into::into),
|
||||
difficulty_hardfork_bound_divisor: p.difficulty_hardfork_bound_divisor.map_or(p.difficulty_bound_divisor.into(), Into::into),
|
||||
bomb_defuse_transition: p.bomb_defuse_transition.map_or(0x7fffffffffffffff, Into::into),
|
||||
bomb_defuse_transition: p.bomb_defuse_transition.map_or(u64::max_value(), Into::into),
|
||||
eip150_transition: p.eip150_transition.map_or(0, Into::into),
|
||||
eip155_transition: p.eip155_transition.map_or(0, Into::into),
|
||||
eip160_transition: p.eip160_transition.map_or(0, Into::into),
|
||||
eip161abc_transition: p.eip161abc_transition.map_or(0, Into::into),
|
||||
eip161d_transition: p.eip161d_transition.map_or(0x7fffffffffffffff, Into::into),
|
||||
eip161d_transition: p.eip161d_transition.map_or(u64::max_value(), Into::into),
|
||||
max_code_size: p.max_code_size.map_or(u64::max_value(), Into::into),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -146,6 +149,7 @@ impl Engine for Ethash {
|
||||
Schedule::new_homestead()
|
||||
} else {
|
||||
Schedule::new_post_eip150(
|
||||
self.ethash_params.max_code_size as usize,
|
||||
env_info.number >= self.ethash_params.eip160_transition,
|
||||
env_info.number >= self.ethash_params.eip161abc_transition,
|
||||
env_info.number >= self.ethash_params.eip161d_transition
|
||||
|
||||
@@ -63,6 +63,9 @@ pub fn new_transition_test() -> Spec { load(include_bytes!("../../res/ethereum/t
|
||||
/// Create a new Frontier main net chain spec without genesis accounts.
|
||||
pub fn new_mainnet_like() -> Spec { load(include_bytes!("../../res/ethereum/frontier_like_test.json")) }
|
||||
|
||||
/// Create a new Ropsten chain spec.
|
||||
pub fn new_ropsten() -> Spec { load(include_bytes!("../../res/ethereum/ropsten.json")) }
|
||||
|
||||
/// Create a new Morden chain spec.
|
||||
pub fn new_morden() -> Spec { load(include_bytes!("../../res/ethereum/morden.json")) }
|
||||
|
||||
|
||||
@@ -70,6 +70,8 @@ pub struct Schedule {
|
||||
pub quad_coeff_div: usize,
|
||||
/// Cost for contract length when executing `CREATE`
|
||||
pub create_data_gas: usize,
|
||||
/// Maximum code size when creating a contract.
|
||||
pub create_data_limit: usize,
|
||||
/// Transaction cost
|
||||
pub tx_gas: usize,
|
||||
/// `CREATE` transaction cost
|
||||
@@ -111,7 +113,7 @@ impl Schedule {
|
||||
}
|
||||
|
||||
/// Schedule for the post-EIP-150-era of the Ethereum main net.
|
||||
pub fn new_post_eip150(fix_exp: bool, no_empty: bool, kill_empty: bool) -> Schedule {
|
||||
pub fn new_post_eip150(max_code_size: usize, fix_exp: bool, no_empty: bool, kill_empty: bool) -> Schedule {
|
||||
Schedule {
|
||||
exceptional_failed_code_deposit: true,
|
||||
have_delegate_call: true,
|
||||
@@ -139,6 +141,7 @@ impl Schedule {
|
||||
memory_gas: 3,
|
||||
quad_coeff_div: 512,
|
||||
create_data_gas: 200,
|
||||
create_data_limit: max_code_size,
|
||||
tx_gas: 21000,
|
||||
tx_create_gas: 53000,
|
||||
tx_data_zero_gas: 4,
|
||||
@@ -183,6 +186,7 @@ impl Schedule {
|
||||
memory_gas: 3,
|
||||
quad_coeff_div: 512,
|
||||
create_data_gas: 200,
|
||||
create_data_limit: usize::max_value(),
|
||||
tx_gas: 21000,
|
||||
tx_create_gas: tcg,
|
||||
tx_data_zero_gas: 4,
|
||||
|
||||
@@ -242,7 +242,7 @@ impl<'a, T, V> Ext for Externalities<'a, T, V> where T: 'a + Tracer, V: 'a + VMT
|
||||
},
|
||||
OutputPolicy::InitContract(ref mut copy) => {
|
||||
let return_cost = U256::from(data.len()) * U256::from(self.schedule.create_data_gas);
|
||||
if return_cost > *gas {
|
||||
if return_cost > *gas || data.len() > self.schedule.create_data_limit {
|
||||
return match self.schedule.exceptional_failed_code_deposit {
|
||||
true => Err(evm::Error::OutOfGas),
|
||||
false => Ok(*gas)
|
||||
|
||||
@@ -34,7 +34,7 @@ fn do_json_test(json_data: &[u8]) -> Vec<String> {
|
||||
Some(x) if x < 1_150_000 => &old_schedule,
|
||||
Some(_) => &new_schedule
|
||||
};
|
||||
let allow_network_id_of_one = number.map_or(false, |n| n >= 3_500_000);
|
||||
let allow_network_id_of_one = number.map_or(false, |n| n >= 2_675_000);
|
||||
|
||||
let rlp: Vec<u8> = test.rlp.into();
|
||||
let res = UntrustedRlp::new(&rlp)
|
||||
|
||||
@@ -21,6 +21,7 @@ use util::*;
|
||||
use util::using_queue::{UsingQueue, GetAction};
|
||||
use account_provider::AccountProvider;
|
||||
use views::{BlockView, HeaderView};
|
||||
use header::Header;
|
||||
use state::{State, CleanupMode};
|
||||
use client::{MiningBlockChainClient, Executive, Executed, EnvInfo, TransactOptions, BlockID, CallAnalytics};
|
||||
use executive::contract_address;
|
||||
@@ -564,13 +565,24 @@ impl Miner {
|
||||
|
||||
let schedule = chain.latest_schedule();
|
||||
let gas_required = |tx: &SignedTransaction| tx.gas_required(&schedule).into();
|
||||
let best_block_header: Header = ::rlp::decode(&chain.best_block_header());
|
||||
transactions.into_iter()
|
||||
.map(|tx| match origin {
|
||||
TransactionOrigin::Local | TransactionOrigin::RetractedBlock => {
|
||||
transaction_queue.add(tx, origin, &fetch_account, &gas_required)
|
||||
},
|
||||
TransactionOrigin::External => {
|
||||
transaction_queue.add_with_banlist(tx, &fetch_account, &gas_required)
|
||||
.map(|tx| {
|
||||
match self.engine.verify_transaction_basic(&tx, &best_block_header) {
|
||||
Err(e) => {
|
||||
debug!(target: "miner", "Rejected tx {:?} with invalid signature: {:?}", tx.hash(), e);
|
||||
Err(e)
|
||||
},
|
||||
Ok(()) => {
|
||||
match origin {
|
||||
TransactionOrigin::Local | TransactionOrigin::RetractedBlock => {
|
||||
transaction_queue.add(tx, origin, &fetch_account, &gas_required)
|
||||
},
|
||||
TransactionOrigin::External => {
|
||||
transaction_queue.add_with_banlist(tx, &fetch_account, &gas_required)
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
@@ -935,6 +947,8 @@ impl MinerService for Miner {
|
||||
}
|
||||
},
|
||||
logs: receipt.logs.clone(),
|
||||
log_bloom: receipt.log_bloom,
|
||||
state_root: receipt.state_root,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
use account_db::{AccountDB, AccountDBMut};
|
||||
use snapshot::Error;
|
||||
|
||||
use util::{U256, FixedHash, H256, Bytes, HashDB, DBValue, SHA3_EMPTY, SHA3_NULL_RLP};
|
||||
use util::{U256, FixedHash, H256, Bytes, HashDB, SHA3_EMPTY, SHA3_NULL_RLP};
|
||||
use util::trie::{TrieDB, Trie};
|
||||
use rlp::{Rlp, RlpStream, Stream, UntrustedRlp, View};
|
||||
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::collections::HashSet;
|
||||
|
||||
// An empty account -- these are replaced with RLP null data for a space optimization.
|
||||
const ACC_EMPTY: Account = Account {
|
||||
@@ -150,7 +150,6 @@ impl Account {
|
||||
pub fn from_fat_rlp(
|
||||
acct_db: &mut AccountDBMut,
|
||||
rlp: UntrustedRlp,
|
||||
code_map: &HashMap<H256, Bytes>,
|
||||
) -> Result<(Self, Option<Bytes>), Error> {
|
||||
use util::{TrieDBMut, TrieMut};
|
||||
|
||||
@@ -177,9 +176,6 @@ impl Account {
|
||||
}
|
||||
CodeState::Hash => {
|
||||
let code_hash = try!(rlp.val_at(3));
|
||||
if let Some(code) = code_map.get(&code_hash) {
|
||||
acct_db.emplace(code_hash.clone(), DBValue::from_slice(code));
|
||||
}
|
||||
|
||||
(code_hash, None)
|
||||
}
|
||||
@@ -229,7 +225,7 @@ mod tests {
|
||||
use util::{Address, FixedHash, H256, HashDB, DBValue};
|
||||
use rlp::{UntrustedRlp, View};
|
||||
|
||||
use std::collections::{HashSet, HashMap};
|
||||
use std::collections::HashSet;
|
||||
|
||||
use super::{ACC_EMPTY, Account};
|
||||
|
||||
@@ -250,7 +246,7 @@ mod tests {
|
||||
|
||||
let fat_rlp = account.to_fat_rlp(&AccountDB::new(db.as_hashdb(), &addr), &mut Default::default()).unwrap();
|
||||
let fat_rlp = UntrustedRlp::new(&fat_rlp);
|
||||
assert_eq!(Account::from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &addr), fat_rlp, &Default::default()).unwrap().0, account);
|
||||
assert_eq!(Account::from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &addr), fat_rlp).unwrap().0, account);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -275,7 +271,7 @@ mod tests {
|
||||
|
||||
let fat_rlp = account.to_fat_rlp(&AccountDB::new(db.as_hashdb(), &addr), &mut Default::default()).unwrap();
|
||||
let fat_rlp = UntrustedRlp::new(&fat_rlp);
|
||||
assert_eq!(Account::from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &addr), fat_rlp, &Default::default()).unwrap().0, account);
|
||||
assert_eq!(Account::from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &addr), fat_rlp).unwrap().0, account);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -318,12 +314,11 @@ mod tests {
|
||||
let fat_rlp1 = UntrustedRlp::new(&fat_rlp1);
|
||||
let fat_rlp2 = UntrustedRlp::new(&fat_rlp2);
|
||||
|
||||
let code_map = HashMap::new();
|
||||
let (acc, maybe_code) = Account::from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &addr2), fat_rlp2, &code_map).unwrap();
|
||||
let (acc, maybe_code) = Account::from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &addr2), fat_rlp2).unwrap();
|
||||
assert!(maybe_code.is_none());
|
||||
assert_eq!(acc, account2);
|
||||
|
||||
let (acc, maybe_code) = Account::from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &addr1), fat_rlp1, &code_map).unwrap();
|
||||
let (acc, maybe_code) = Account::from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &addr1), fat_rlp1).unwrap();
|
||||
assert_eq!(maybe_code, Some(b"this is definitely code".to_vec()));
|
||||
assert_eq!(acc, account1);
|
||||
}
|
||||
@@ -332,9 +327,8 @@ mod tests {
|
||||
fn encoding_empty_acc() {
|
||||
let mut db = get_temp_state_db();
|
||||
let mut used_code = HashSet::new();
|
||||
let code_map = HashMap::new();
|
||||
|
||||
assert_eq!(ACC_EMPTY.to_fat_rlp(&AccountDB::new(db.as_hashdb(), &Address::default()), &mut used_code).unwrap(), ::rlp::NULL_RLP.to_vec());
|
||||
assert_eq!(Account::from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &Address::default()), UntrustedRlp::new(&::rlp::NULL_RLP), &code_map).unwrap(), (ACC_EMPTY, None));
|
||||
assert_eq!(Account::from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &Address::default()), UntrustedRlp::new(&::rlp::NULL_RLP)).unwrap(), (ACC_EMPTY, None));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -389,7 +389,7 @@ pub fn chunk_state<'a>(db: &HashDB, root: &H256, writer: &Mutex<SnapshotWriter +
|
||||
pub struct StateRebuilder {
|
||||
db: Box<JournalDB>,
|
||||
state_root: H256,
|
||||
code_map: HashMap<H256, Bytes>, // maps code hashes to code itself.
|
||||
known_code: HashMap<H256, H256>, // code hashes mapped to first account with this code.
|
||||
missing_code: HashMap<H256, Vec<H256>>, // maps code hashes to lists of accounts missing that code.
|
||||
bloom: Bloom,
|
||||
}
|
||||
@@ -400,7 +400,7 @@ impl StateRebuilder {
|
||||
StateRebuilder {
|
||||
db: journaldb::new(db.clone(), pruning, ::db::COL_STATE),
|
||||
state_root: SHA3_NULL_RLP,
|
||||
code_map: HashMap::new(),
|
||||
known_code: HashMap::new(),
|
||||
missing_code: HashMap::new(),
|
||||
bloom: StateDB::load_bloom(&*db),
|
||||
}
|
||||
@@ -419,24 +419,26 @@ impl StateRebuilder {
|
||||
let chunk_size = account_fat_rlps.len() / ::num_cpus::get() + 1;
|
||||
|
||||
// new code contained within this chunk.
|
||||
let mut chunk_code = HashMap::new();
|
||||
let mut chunk_code = Vec::new();
|
||||
|
||||
for (account_chunk, out_pairs_chunk) in account_fat_rlps.chunks(chunk_size).zip(pairs.chunks_mut(chunk_size)) {
|
||||
let code_map = &self.code_map;
|
||||
let status = try!(rebuild_accounts(self.db.as_hashdb_mut(), account_chunk, out_pairs_chunk, code_map));
|
||||
let status = try!(rebuild_accounts(self.db.as_hashdb_mut(), account_chunk, out_pairs_chunk, &self.known_code));
|
||||
chunk_code.extend(status.new_code);
|
||||
|
||||
// update missing code.
|
||||
for (addr_hash, code_hash) in status.missing_code {
|
||||
self.missing_code.entry(code_hash).or_insert_with(Vec::new).push(addr_hash);
|
||||
}
|
||||
}
|
||||
|
||||
// patch up all missing code. must be done after collecting all new missing code entries.
|
||||
for (code_hash, code) in chunk_code {
|
||||
for (code_hash, code, first_with) in chunk_code {
|
||||
for addr_hash in self.missing_code.remove(&code_hash).unwrap_or_else(Vec::new) {
|
||||
let mut db = AccountDBMut::from_hash(self.db.as_hashdb_mut(), addr_hash);
|
||||
db.emplace(code_hash, DBValue::from_slice(&code));
|
||||
}
|
||||
|
||||
self.code_map.insert(code_hash, code);
|
||||
self.known_code.insert(code_hash, first_with);
|
||||
}
|
||||
|
||||
let backing = self.db.backing().clone();
|
||||
@@ -482,7 +484,8 @@ impl StateRebuilder {
|
||||
|
||||
#[derive(Default)]
|
||||
struct RebuiltStatus {
|
||||
new_code: Vec<(H256, Bytes)>, // new code that's become available.
|
||||
// new code that's become available. (code_hash, code, addr_hash)
|
||||
new_code: Vec<(H256, Bytes, H256)>,
|
||||
missing_code: Vec<(H256, H256)>, // accounts that are missing code.
|
||||
}
|
||||
|
||||
@@ -492,9 +495,8 @@ fn rebuild_accounts(
|
||||
db: &mut HashDB,
|
||||
account_chunk: &[&[u8]],
|
||||
out_chunk: &mut [(H256, Bytes)],
|
||||
code_map: &HashMap<H256, Bytes>
|
||||
) -> Result<RebuiltStatus, ::error::Error>
|
||||
{
|
||||
known_code: &HashMap<H256, H256>,
|
||||
) -> Result<RebuiltStatus, ::error::Error> {
|
||||
let mut status = RebuiltStatus::default();
|
||||
for (account_pair, out) in account_chunk.into_iter().zip(out_chunk) {
|
||||
let account_rlp = UntrustedRlp::new(account_pair);
|
||||
@@ -503,17 +505,33 @@ fn rebuild_accounts(
|
||||
let fat_rlp = try!(account_rlp.at(1));
|
||||
|
||||
let thin_rlp = {
|
||||
let mut acct_db = AccountDBMut::from_hash(db, hash);
|
||||
|
||||
// fill out the storage trie and code while decoding.
|
||||
let (acc, maybe_code) = try!(Account::from_fat_rlp(&mut acct_db, fat_rlp, code_map));
|
||||
let (acc, maybe_code) = {
|
||||
let mut acct_db = AccountDBMut::from_hash(db, hash);
|
||||
try!(Account::from_fat_rlp(&mut acct_db, fat_rlp))
|
||||
};
|
||||
|
||||
let code_hash = acc.code_hash().clone();
|
||||
match maybe_code {
|
||||
Some(code) => status.new_code.push((code_hash, code)),
|
||||
// new inline code
|
||||
Some(code) => status.new_code.push((code_hash, code, hash)),
|
||||
None => {
|
||||
if code_hash != ::util::SHA3_EMPTY && !code_map.contains_key(&code_hash) {
|
||||
status.missing_code.push((hash, code_hash));
|
||||
if code_hash != ::util::SHA3_EMPTY {
|
||||
// see if this code has already been included inline
|
||||
match known_code.get(&code_hash) {
|
||||
Some(&first_with) => {
|
||||
// if so, load it from the database.
|
||||
let code = try!(AccountDB::from_hash(db, first_with)
|
||||
.get(&code_hash)
|
||||
.ok_or_else(|| Error::MissingCode(vec![first_with])));
|
||||
|
||||
// and write it again under a different mangled key
|
||||
AccountDBMut::from_hash(db, hash).emplace(code_hash, code);
|
||||
}
|
||||
// if not, queue it up to be filled later
|
||||
None => status.missing_code.push((hash, code_hash)),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
//! State snapshotting tests.
|
||||
|
||||
use snapshot::{chunk_state, Progress, StateRebuilder};
|
||||
use snapshot::account::Account;
|
||||
use snapshot::io::{PackedReader, PackedWriter, SnapshotReader, SnapshotWriter};
|
||||
use super::helpers::{compare_dbs, StateProducer};
|
||||
|
||||
@@ -28,6 +29,8 @@ use util::memorydb::MemoryDB;
|
||||
use util::Mutex;
|
||||
use devtools::RandomTempPath;
|
||||
|
||||
use util::sha3::SHA3_NULL_RLP;
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
#[test]
|
||||
@@ -82,3 +85,54 @@ fn snap_and_restore() {
|
||||
|
||||
compare_dbs(&old_db, new_db.as_hashdb());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn get_code_from_prev_chunk() {
|
||||
use std::collections::HashSet;
|
||||
use rlp::{RlpStream, Stream};
|
||||
use util::{HashDB, H256, FixedHash, U256, Hashable};
|
||||
|
||||
use account_db::{AccountDBMut, AccountDB};
|
||||
|
||||
let code = b"this is definitely code";
|
||||
let mut used_code = HashSet::new();
|
||||
let mut acc_stream = RlpStream::new_list(4);
|
||||
acc_stream.append(&U256::default())
|
||||
.append(&U256::default())
|
||||
.append(&SHA3_NULL_RLP)
|
||||
.append(&code.sha3());
|
||||
|
||||
let (h1, h2) = (H256::random(), H256::random());
|
||||
|
||||
// two accounts with the same code, one per chunk.
|
||||
// first one will have code inlined,
|
||||
// second will just have its hash.
|
||||
let thin_rlp = acc_stream.out();
|
||||
let acc1 = Account::from_thin_rlp(&thin_rlp);
|
||||
let acc2 = Account::from_thin_rlp(&thin_rlp);
|
||||
|
||||
let mut make_chunk = |acc: Account, hash| {
|
||||
let mut db = MemoryDB::new();
|
||||
AccountDBMut::from_hash(&mut db, hash).insert(&code[..]);
|
||||
|
||||
let fat_rlp = acc.to_fat_rlp(&AccountDB::from_hash(&db, hash), &mut used_code).unwrap();
|
||||
|
||||
let mut stream = RlpStream::new_list(1);
|
||||
stream.begin_list(2).append(&hash).append_raw(&fat_rlp, 1);
|
||||
stream.out()
|
||||
};
|
||||
|
||||
let chunk1 = make_chunk(acc1, h1);
|
||||
let chunk2 = make_chunk(acc2, h2);
|
||||
|
||||
let db_path = RandomTempPath::create_dir();
|
||||
let db_cfg = DatabaseConfig::with_columns(::db::NUM_COLUMNS);
|
||||
let new_db = Arc::new(Database::open(&db_cfg, &db_path.to_string_lossy()).unwrap());
|
||||
|
||||
let mut rebuilder = StateRebuilder::new(new_db, Algorithm::Archive);
|
||||
|
||||
rebuilder.feed(&chunk1).unwrap();
|
||||
rebuilder.feed(&chunk2).unwrap();
|
||||
|
||||
rebuilder.check_missing().unwrap();
|
||||
}
|
||||
@@ -33,4 +33,5 @@ pub mod transaction_import;
|
||||
pub mod block_import_error;
|
||||
pub mod restoration_status;
|
||||
pub mod snapshot_manifest;
|
||||
pub mod mode;
|
||||
pub mod mode;
|
||||
pub mod pruning_info;
|
||||
|
||||
29
ethcore/src/types/pruning_info.rs
Normal file
29
ethcore/src/types/pruning_info.rs
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright 2015, 2016 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/>.
|
||||
|
||||
//! Information about portions of the state and chain which the client may serve.
|
||||
//!
|
||||
//! Currently assumes that a client will store everything past a certain point
|
||||
//! or everything. Will be extended in the future to support a definition
|
||||
//! of which portions of the ancient chain and current state trie are stored as well.
|
||||
|
||||
/// Client pruning info. See module-level docs for more details.
|
||||
#[derive(Debug, Clone)]
|
||||
#[cfg_attr(feature = "ipc", binary)]
|
||||
pub struct PruningInfo {
|
||||
/// Pruning history size
|
||||
pub history_size: Option<u64>,
|
||||
}
|
||||
@@ -93,6 +93,10 @@ pub struct RichReceipt {
|
||||
pub contract_address: Option<Address>,
|
||||
/// Logs
|
||||
pub logs: Vec<LogEntry>,
|
||||
/// Logs bloom
|
||||
pub log_bloom: LogBloom,
|
||||
/// State root
|
||||
pub state_root: H256,
|
||||
}
|
||||
|
||||
/// Receipt with additional info.
|
||||
@@ -114,6 +118,10 @@ pub struct LocalizedReceipt {
|
||||
pub contract_address: Option<Address>,
|
||||
/// Logs
|
||||
pub logs: Vec<LocalizedLogEntry>,
|
||||
/// Logs bloom
|
||||
pub log_bloom: LogBloom,
|
||||
/// State root
|
||||
pub state_root: H256,
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -19,18 +19,21 @@
|
||||
use engines::Engine;
|
||||
use error::Error;
|
||||
|
||||
use util::{HeapSizeOf, H256};
|
||||
use util::{HeapSizeOf, H256, U256};
|
||||
|
||||
pub use self::blocks::Blocks;
|
||||
pub use self::headers::Headers;
|
||||
|
||||
/// Something which can produce a hash and a parent hash.
|
||||
pub trait HasHash {
|
||||
pub trait BlockLike {
|
||||
/// Get the hash of this item.
|
||||
fn hash(&self) -> H256;
|
||||
|
||||
/// Get the hash of this item's parent.
|
||||
fn parent_hash(&self) -> H256;
|
||||
|
||||
/// Get the difficulty of this item.
|
||||
fn difficulty(&self) -> U256;
|
||||
}
|
||||
|
||||
/// Defines transitions between stages of verification.
|
||||
@@ -45,13 +48,13 @@ pub trait HasHash {
|
||||
/// consistent.
|
||||
pub trait Kind: 'static + Sized + Send + Sync {
|
||||
/// The first stage: completely unverified.
|
||||
type Input: Sized + Send + HasHash + HeapSizeOf;
|
||||
type Input: Sized + Send + BlockLike + HeapSizeOf;
|
||||
|
||||
/// The second stage: partially verified.
|
||||
type Unverified: Sized + Send + HasHash + HeapSizeOf;
|
||||
type Unverified: Sized + Send + BlockLike + HeapSizeOf;
|
||||
|
||||
/// The third stage: completely verified.
|
||||
type Verified: Sized + Send + HasHash + HeapSizeOf;
|
||||
type Verified: Sized + Send + BlockLike + HeapSizeOf;
|
||||
|
||||
/// Attempt to create the `Unverified` item from the input.
|
||||
fn create(input: Self::Input, engine: &Engine) -> Result<Self::Unverified, Error>;
|
||||
@@ -62,14 +65,14 @@ pub trait Kind: 'static + Sized + Send + Sync {
|
||||
|
||||
/// The blocks verification module.
|
||||
pub mod blocks {
|
||||
use super::{Kind, HasHash};
|
||||
use super::{Kind, BlockLike};
|
||||
|
||||
use engines::Engine;
|
||||
use error::Error;
|
||||
use header::Header;
|
||||
use verification::{PreverifiedBlock, verify_block_basic, verify_block_unordered};
|
||||
|
||||
use util::{Bytes, HeapSizeOf, H256};
|
||||
use util::{Bytes, HeapSizeOf, H256, U256};
|
||||
|
||||
/// A mode for verifying blocks.
|
||||
pub struct Blocks;
|
||||
@@ -126,7 +129,7 @@ pub mod blocks {
|
||||
}
|
||||
}
|
||||
|
||||
impl HasHash for Unverified {
|
||||
impl BlockLike for Unverified {
|
||||
fn hash(&self) -> H256 {
|
||||
self.header.hash()
|
||||
}
|
||||
@@ -134,9 +137,13 @@ pub mod blocks {
|
||||
fn parent_hash(&self) -> H256 {
|
||||
self.header.parent_hash().clone()
|
||||
}
|
||||
|
||||
fn difficulty(&self) -> U256 {
|
||||
self.header.difficulty().clone()
|
||||
}
|
||||
}
|
||||
|
||||
impl HasHash for PreverifiedBlock {
|
||||
impl BlockLike for PreverifiedBlock {
|
||||
fn hash(&self) -> H256 {
|
||||
self.header.hash()
|
||||
}
|
||||
@@ -144,12 +151,16 @@ pub mod blocks {
|
||||
fn parent_hash(&self) -> H256 {
|
||||
self.header.parent_hash().clone()
|
||||
}
|
||||
|
||||
fn difficulty(&self) -> U256 {
|
||||
self.header.difficulty().clone()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Verification for headers.
|
||||
pub mod headers {
|
||||
use super::{Kind, HasHash};
|
||||
use super::{Kind, BlockLike};
|
||||
|
||||
use engines::Engine;
|
||||
use error::Error;
|
||||
@@ -157,10 +168,12 @@ pub mod headers {
|
||||
use verification::verify_header_params;
|
||||
|
||||
use util::hash::H256;
|
||||
use util::U256;
|
||||
|
||||
impl HasHash for Header {
|
||||
impl BlockLike for Header {
|
||||
fn hash(&self) -> H256 { self.hash() }
|
||||
fn parent_hash(&self) -> H256 { self.parent_hash().clone() }
|
||||
fn difficulty(&self) -> U256 { self.difficulty().clone() }
|
||||
}
|
||||
|
||||
/// A mode for verifying headers.
|
||||
|
||||
@@ -26,7 +26,7 @@ use error::*;
|
||||
use engines::Engine;
|
||||
use service::*;
|
||||
|
||||
use self::kind::{HasHash, Kind};
|
||||
use self::kind::{BlockLike, Kind};
|
||||
|
||||
pub use types::verification_queue_info::VerificationQueueInfo as QueueInfo;
|
||||
|
||||
@@ -101,9 +101,10 @@ pub struct VerificationQueue<K: Kind> {
|
||||
deleting: Arc<AtomicBool>,
|
||||
ready_signal: Arc<QueueSignal>,
|
||||
empty: Arc<SCondvar>,
|
||||
processing: RwLock<HashSet<H256>>,
|
||||
processing: RwLock<HashMap<H256, U256>>, // hash to difficulty
|
||||
max_queue_size: usize,
|
||||
max_mem_use: usize,
|
||||
total_difficulty: RwLock<U256>,
|
||||
}
|
||||
|
||||
struct QueueSignal {
|
||||
@@ -214,10 +215,11 @@ impl<K: Kind> VerificationQueue<K> {
|
||||
verification: verification.clone(),
|
||||
verifiers: verifiers,
|
||||
deleting: deleting.clone(),
|
||||
processing: RwLock::new(HashSet::new()),
|
||||
processing: RwLock::new(HashMap::new()),
|
||||
empty: empty.clone(),
|
||||
max_queue_size: max(config.max_queue_size, MIN_QUEUE_LIMIT),
|
||||
max_mem_use: max(config.max_mem_use, MIN_MEM_LIMIT),
|
||||
total_difficulty: RwLock::new(0.into()),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -335,6 +337,7 @@ impl<K: Kind> VerificationQueue<K> {
|
||||
sizes.unverified.store(0, AtomicOrdering::Release);
|
||||
sizes.verifying.store(0, AtomicOrdering::Release);
|
||||
sizes.verified.store(0, AtomicOrdering::Release);
|
||||
*self.total_difficulty.write() = 0.into();
|
||||
|
||||
self.processing.write().clear();
|
||||
}
|
||||
@@ -349,7 +352,7 @@ impl<K: Kind> VerificationQueue<K> {
|
||||
|
||||
/// Check if the item is currently in the queue
|
||||
pub fn status(&self, hash: &H256) -> Status {
|
||||
if self.processing.read().contains(hash) {
|
||||
if self.processing.read().contains_key(hash) {
|
||||
return Status::Queued;
|
||||
}
|
||||
if self.verification.bad.lock().contains(hash) {
|
||||
@@ -362,7 +365,7 @@ impl<K: Kind> VerificationQueue<K> {
|
||||
pub fn import(&self, input: K::Input) -> ImportResult {
|
||||
let h = input.hash();
|
||||
{
|
||||
if self.processing.read().contains(&h) {
|
||||
if self.processing.read().contains_key(&h) {
|
||||
return Err(ImportError::AlreadyQueued.into());
|
||||
}
|
||||
|
||||
@@ -381,7 +384,11 @@ impl<K: Kind> VerificationQueue<K> {
|
||||
Ok(item) => {
|
||||
self.verification.sizes.unverified.fetch_add(item.heap_size_of_children(), AtomicOrdering::SeqCst);
|
||||
|
||||
self.processing.write().insert(h.clone());
|
||||
self.processing.write().insert(h.clone(), item.difficulty());
|
||||
{
|
||||
let mut td = self.total_difficulty.write();
|
||||
*td = *td + item.difficulty();
|
||||
}
|
||||
self.verification.unverified.lock().push_back(item);
|
||||
self.more_to_verify.notify_all();
|
||||
Ok(h)
|
||||
@@ -406,7 +413,10 @@ impl<K: Kind> VerificationQueue<K> {
|
||||
bad.reserve(hashes.len());
|
||||
for hash in hashes {
|
||||
bad.insert(hash.clone());
|
||||
processing.remove(hash);
|
||||
if let Some(difficulty) = processing.remove(hash) {
|
||||
let mut td = self.total_difficulty.write();
|
||||
*td = *td - difficulty;
|
||||
}
|
||||
}
|
||||
|
||||
let mut new_verified = VecDeque::new();
|
||||
@@ -415,7 +425,10 @@ impl<K: Kind> VerificationQueue<K> {
|
||||
if bad.contains(&output.parent_hash()) {
|
||||
removed_size += output.heap_size_of_children();
|
||||
bad.insert(output.hash());
|
||||
processing.remove(&output.hash());
|
||||
if let Some(difficulty) = processing.remove(&output.hash()) {
|
||||
let mut td = self.total_difficulty.write();
|
||||
*td = *td - difficulty;
|
||||
}
|
||||
} else {
|
||||
new_verified.push_back(output);
|
||||
}
|
||||
@@ -433,7 +446,10 @@ impl<K: Kind> VerificationQueue<K> {
|
||||
}
|
||||
let mut processing = self.processing.write();
|
||||
for hash in hashes {
|
||||
processing.remove(hash);
|
||||
if let Some(difficulty) = processing.remove(hash) {
|
||||
let mut td = self.total_difficulty.write();
|
||||
*td = *td - difficulty;
|
||||
}
|
||||
}
|
||||
processing.is_empty()
|
||||
}
|
||||
@@ -487,7 +503,13 @@ impl<K: Kind> VerificationQueue<K> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Optimise memory footprint of the heap fields.
|
||||
/// Get the total difficulty of all the blocks in the queue.
|
||||
pub fn total_difficulty(&self) -> U256 {
|
||||
self.total_difficulty.read().clone()
|
||||
}
|
||||
|
||||
/// Optimise memory footprint of the heap fields, and adjust the number of threads
|
||||
/// to better suit the workload.
|
||||
pub fn collect_garbage(&self) {
|
||||
{
|
||||
self.verification.unverified.lock().shrink_to_fit();
|
||||
@@ -569,6 +591,22 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn returns_total_difficulty() {
|
||||
let queue = get_test_queue();
|
||||
let block = get_good_dummy_block();
|
||||
let hash = BlockView::new(&block).header().hash().clone();
|
||||
if let Err(e) = queue.import(Unverified::new(block)) {
|
||||
panic!("error importing block that is valid by definition({:?})", e);
|
||||
}
|
||||
queue.flush();
|
||||
assert_eq!(queue.total_difficulty(), 131072.into());
|
||||
queue.drain(10);
|
||||
assert_eq!(queue.total_difficulty(), 131072.into());
|
||||
queue.mark_as_good(&[ hash ]);
|
||||
assert_eq!(queue.total_difficulty(), 0.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn returns_ok_for_drained_duplicates() {
|
||||
let queue = get_test_queue();
|
||||
|
||||
@@ -34,16 +34,43 @@ pub const KEY_LENGTH: usize = 32;
|
||||
pub const KEY_ITERATIONS: usize = 10240;
|
||||
pub const KEY_LENGTH_AES: usize = KEY_LENGTH / 2;
|
||||
|
||||
#[derive(PartialEq, Debug)]
|
||||
pub enum ScryptError {
|
||||
// log(N) < r / 16
|
||||
InvalidN,
|
||||
// p <= (2^31-1 * 32)/(128 * r)
|
||||
InvalidP,
|
||||
}
|
||||
|
||||
impl fmt::Display for ScryptError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
let s = match *self {
|
||||
ScryptError::InvalidN => "Invalid N argument of the scrypt encryption" ,
|
||||
ScryptError::InvalidP => "Invalid p argument of the scrypt encryption",
|
||||
};
|
||||
|
||||
write!(f, "{}", s)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Debug)]
|
||||
pub enum Error {
|
||||
Secp(SecpError),
|
||||
Scrypt(ScryptError),
|
||||
InvalidMessage,
|
||||
}
|
||||
|
||||
impl From<ScryptError> for Error {
|
||||
fn from(err: ScryptError) -> Self {
|
||||
Error::Scrypt(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Error {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
let s = match *self {
|
||||
Error::Secp(ref err) => err.to_string(),
|
||||
Error::Scrypt(ref err) => err.to_string(),
|
||||
Error::InvalidMessage => "Invalid message".into(),
|
||||
};
|
||||
|
||||
@@ -80,13 +107,23 @@ pub fn derive_key_iterations(password: &str, salt: &[u8; 32], c: u32) -> (Vec<u8
|
||||
(derived_right_bits.to_vec(), derived_left_bits.to_vec())
|
||||
}
|
||||
|
||||
pub fn derive_key_scrypt(password: &str, salt: &[u8; 32], n: u32, p: u32, r: u32) -> (Vec<u8>, Vec<u8>) {
|
||||
pub fn derive_key_scrypt(password: &str, salt: &[u8; 32], n: u32, p: u32, r: u32) -> Result<(Vec<u8>, Vec<u8>), Error> {
|
||||
// sanity checks
|
||||
let log_n = (32 - n.leading_zeros() - 1) as u8;
|
||||
if log_n as u32 >= r * 16 {
|
||||
return Err(Error::Scrypt(ScryptError::InvalidN));
|
||||
}
|
||||
|
||||
if p as u64 > ((u32::max_value() as u64 - 1) * 32)/(128 * (r as u64)) {
|
||||
return Err(Error::Scrypt(ScryptError::InvalidP));
|
||||
}
|
||||
|
||||
let mut derived_key = vec![0u8; KEY_LENGTH];
|
||||
let scrypt_params = ScryptParams::new(n.trailing_zeros() as u8, r, p);
|
||||
let scrypt_params = ScryptParams::new(log_n, r, p);
|
||||
scrypt(password.as_bytes(), salt, &scrypt_params, &mut derived_key);
|
||||
let derived_right_bits = &derived_key[0..KEY_LENGTH_AES];
|
||||
let derived_left_bits = &derived_key[KEY_LENGTH_AES..KEY_LENGTH];
|
||||
(derived_right_bits.to_vec(), derived_left_bits.to_vec())
|
||||
Ok((derived_right_bits.to_vec(), derived_left_bits.to_vec()))
|
||||
}
|
||||
|
||||
pub fn derive_mac(derived_left_bits: &[u8], cipher_text: &[u8]) -> Vec<u8> {
|
||||
|
||||
@@ -113,7 +113,7 @@ impl Crypto {
|
||||
|
||||
let (derived_left_bits, derived_right_bits) = match self.kdf {
|
||||
Kdf::Pbkdf2(ref params) => crypto::derive_key_iterations(password, ¶ms.salt, params.c),
|
||||
Kdf::Scrypt(ref params) => crypto::derive_key_scrypt(password, ¶ms.salt, params.n, params.p, params.r),
|
||||
Kdf::Scrypt(ref params) => try!(crypto::derive_key_scrypt(password, ¶ms.salt, params.n, params.p, params.r)),
|
||||
};
|
||||
|
||||
let mac = crypto::derive_mac(&derived_right_bits, &self.ciphertext).keccak256();
|
||||
|
||||
@@ -20,6 +20,7 @@ use std::collections::HashMap;
|
||||
use time;
|
||||
use ethkey::Address;
|
||||
use {json, SafeAccount, Error};
|
||||
use json::UUID;
|
||||
use super::KeyDirectory;
|
||||
|
||||
const IGNORED_FILES: &'static [&'static str] = &["thumbs.db", "address_book.json"];
|
||||
@@ -112,7 +113,7 @@ impl KeyDirectory for DiskDirectory {
|
||||
// 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, account.address)
|
||||
format!("UTC--{}Z--{}", timestamp, UUID::from(account.id))
|
||||
});
|
||||
|
||||
// update account filename
|
||||
|
||||
@@ -47,7 +47,7 @@ impl Random for [u8; 32] {
|
||||
pub fn random_phrase(words: usize) -> String {
|
||||
lazy_static! {
|
||||
static ref WORDS: Vec<String> = String::from_utf8_lossy(include_bytes!("../res/wordlist.txt"))
|
||||
.split("\n")
|
||||
.lines()
|
||||
.map(|s| s.to_owned())
|
||||
.collect();
|
||||
}
|
||||
@@ -55,8 +55,19 @@ pub fn random_phrase(words: usize) -> String {
|
||||
(0..words).map(|_| rng.choose(&WORDS).unwrap()).join(" ")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_produce_right_number_of_words() {
|
||||
let p = random_phrase(10);
|
||||
assert_eq!(p.split(" ").count(), 10);
|
||||
}
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::random_phrase;
|
||||
|
||||
#[test]
|
||||
fn should_produce_right_number_of_words() {
|
||||
let p = random_phrase(10);
|
||||
assert_eq!(p.split(" ").count(), 10);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_not_include_carriage_return() {
|
||||
let p = random_phrase(10);
|
||||
assert!(!p.contains('\r'), "Carriage return should be trimmed.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,14 +131,14 @@
|
||||
"mobx-react-devtools": "^4.2.9",
|
||||
"moment": "^2.14.1",
|
||||
"qs": "^6.3.0",
|
||||
"react": "^15.2.1",
|
||||
"react-addons-css-transition-group": "^15.2.1",
|
||||
"react": "~15.3.2",
|
||||
"react-addons-css-transition-group": "~15.3.2",
|
||||
"react-chartjs-2": "^1.5.0",
|
||||
"react-dom": "^15.2.1",
|
||||
"react-dom": "~15.3.2",
|
||||
"react-redux": "^4.4.5",
|
||||
"react-router": "^2.6.1",
|
||||
"react-router-redux": "^4.0.5",
|
||||
"react-tap-event-plugin": "^1.0.0",
|
||||
"react-tap-event-plugin": "~1.0.0",
|
||||
"react-tooltip": "^2.0.3",
|
||||
"recharts": "^0.15.2",
|
||||
"redux": "^3.5.2",
|
||||
|
||||
@@ -68,11 +68,13 @@ if [ "$BRANCH" == "master" ]; then
|
||||
fi
|
||||
|
||||
echo "*** Updating cargo parity-ui-precompiled#$PRECOMPILED_HASH"
|
||||
git submodule update
|
||||
cargo update -p parity-ui-precompiled
|
||||
# --precise "$PRECOMPILED_HASH"
|
||||
|
||||
echo "*** Committing updated files"
|
||||
git add .
|
||||
git add js
|
||||
git add Cargo.lock
|
||||
git commit -m "[ci skip] js-precompiled $UTCDATE"
|
||||
git push origin HEAD:refs/heads/$BRANCH 2>$GITLOG
|
||||
|
||||
|
||||
@@ -162,3 +162,11 @@ export function inTraceFilter (filterObject) {
|
||||
|
||||
return filterObject;
|
||||
}
|
||||
|
||||
export function inTraceType (whatTrace) {
|
||||
if (isString(whatTrace)) {
|
||||
return [whatTrace];
|
||||
}
|
||||
|
||||
return whatTrace;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
import BigNumber from 'bignumber.js';
|
||||
|
||||
import { inAddress, inBlockNumber, inData, inFilter, inHex, inNumber10, inNumber16, inOptions } from './input';
|
||||
import { inAddress, inBlockNumber, inData, inFilter, inHex, inNumber10, inNumber16, inOptions, inTraceType } from './input';
|
||||
import { isAddress } from '../../../test/types';
|
||||
|
||||
describe('api/format/input', () => {
|
||||
@@ -242,4 +242,16 @@ describe('api/format/input', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('inTraceType', () => {
|
||||
it('returns array of types as is', () => {
|
||||
const types = ['vmTrace', 'trace', 'stateDiff'];
|
||||
expect(inTraceType(types)).to.deep.equal(types);
|
||||
});
|
||||
|
||||
it('formats single string type into array', () => {
|
||||
const type = 'vmTrace';
|
||||
expect(inTraceType(type)).to.deep.equal([type]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -254,3 +254,25 @@ export function outTrace (trace) {
|
||||
|
||||
return trace;
|
||||
}
|
||||
|
||||
export function outTraces (traces) {
|
||||
if (traces) {
|
||||
return traces.map(outTrace);
|
||||
}
|
||||
|
||||
return traces;
|
||||
}
|
||||
|
||||
export function outTraceReplay (trace) {
|
||||
if (trace) {
|
||||
Object.keys(trace).forEach((key) => {
|
||||
switch (key) {
|
||||
case 'trace':
|
||||
trace[key] = outTraces(trace[key]);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return trace;
|
||||
}
|
||||
|
||||
@@ -20,15 +20,25 @@ describe('ethapi.trace', () => {
|
||||
const ethapi = createHttpApi();
|
||||
|
||||
describe('block', () => {
|
||||
it('returns the latest block', () => {
|
||||
return ethapi.trace.block().then((block) => {
|
||||
expect(block).to.be.ok;
|
||||
it('returns the latest block traces', () => {
|
||||
return ethapi.trace.block().then((traces) => {
|
||||
expect(traces).to.be.ok;
|
||||
});
|
||||
});
|
||||
|
||||
it('returns a specified block', () => {
|
||||
return ethapi.trace.block('0x65432').then((block) => {
|
||||
expect(block).to.be.ok;
|
||||
it('returns traces for a specified block', () => {
|
||||
return ethapi.trace.block('0x65432').then((traces) => {
|
||||
expect(traces).to.be.ok;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('replayTransaction', () => {
|
||||
it('returns traces for a specific transaction', () => {
|
||||
return ethapi.eth.getBlockByNumber().then((latestBlock) => {
|
||||
return ethapi.trace.replayTransaction(latestBlock.transactions[0]).then((traces) => {
|
||||
expect(traces).to.be.ok;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,35 +14,53 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import { inBlockNumber, inHex, inNumber16, inTraceFilter } from '../../format/input';
|
||||
import { outTrace } from '../../format/output';
|
||||
import { inBlockNumber, inData, inHex, inNumber16, inOptions, inTraceFilter, inTraceType } from '../../format/input';
|
||||
import { outTraces, outTraceReplay } from '../../format/output';
|
||||
|
||||
export default class Trace {
|
||||
constructor (transport) {
|
||||
this._transport = transport;
|
||||
}
|
||||
|
||||
block (blockNumber = 'latest') {
|
||||
return this._transport
|
||||
.execute('trace_block', inBlockNumber(blockNumber))
|
||||
.then(outTraces);
|
||||
}
|
||||
|
||||
call (options, blockNumber = 'latest', whatTrace = ['trace']) {
|
||||
return this._transport
|
||||
.execute('trace_call', inOptions(options), inBlockNumber(blockNumber), inTraceType(whatTrace))
|
||||
.then(outTraceReplay);
|
||||
}
|
||||
|
||||
filter (filterObj) {
|
||||
return this._transport
|
||||
.execute('trace_filter', inTraceFilter(filterObj))
|
||||
.then(traces => traces.map(trace => outTrace(trace)));
|
||||
.then(outTraces);
|
||||
}
|
||||
|
||||
get (txHash, position) {
|
||||
return this._transport
|
||||
.execute('trace_get', inHex(txHash), inNumber16(position))
|
||||
.then(trace => outTrace(trace));
|
||||
.then(outTraces);
|
||||
}
|
||||
|
||||
rawTransaction (data, whatTrace = ['trace']) {
|
||||
return this._transport
|
||||
.execute('trace_rawTransaction', inData(data), inTraceType(whatTrace))
|
||||
.then(outTraceReplay);
|
||||
}
|
||||
|
||||
replayTransaction (txHash, whatTrace = ['trace']) {
|
||||
return this._transport
|
||||
.execute('trace_replayTransaction', txHash, inTraceType(whatTrace))
|
||||
.then(outTraceReplay);
|
||||
}
|
||||
|
||||
transaction (txHash) {
|
||||
return this._transport
|
||||
.execute('trace_transaction', inHex(txHash))
|
||||
.then(traces => traces.map(trace => outTrace(trace)));
|
||||
}
|
||||
|
||||
block (blockNumber = 'latest') {
|
||||
return this._transport
|
||||
.execute('trace_block', inBlockNumber(blockNumber))
|
||||
.then(traces => traces.map(trace => outTrace(trace)));
|
||||
.then(outTraces);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import DappReg from './dappreg';
|
||||
import Registry from './registry';
|
||||
import SignatureReg from './signaturereg';
|
||||
import TokenReg from './tokenreg';
|
||||
import GithubHint from './githubhint';
|
||||
|
||||
let instance = null;
|
||||
|
||||
@@ -30,6 +31,7 @@ export default class Contracts {
|
||||
this._dappreg = new DappReg(api, this._registry);
|
||||
this._signaturereg = new SignatureReg(api, this._registry);
|
||||
this._tokenreg = new TokenReg(api, this._registry);
|
||||
this._githubhint = new GithubHint(api, this._registry);
|
||||
}
|
||||
|
||||
get registry () {
|
||||
@@ -48,6 +50,10 @@ export default class Contracts {
|
||||
return this._tokenreg;
|
||||
}
|
||||
|
||||
get githubHint () {
|
||||
return this._githubhint;
|
||||
}
|
||||
|
||||
static create (api) {
|
||||
return new Contracts(api);
|
||||
}
|
||||
|
||||
32
js/src/contracts/githubhint.js
Normal file
32
js/src/contracts/githubhint.js
Normal file
@@ -0,0 +1,32 @@
|
||||
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||
// This file is part of Parity.
|
||||
|
||||
// Parity is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
export default class GithubHint {
|
||||
constructor (api, registry) {
|
||||
this._api = api;
|
||||
this._registry = registry;
|
||||
|
||||
this.getInstance();
|
||||
}
|
||||
|
||||
getContract () {
|
||||
return this._registry.getContract('githubhint');
|
||||
}
|
||||
|
||||
getInstance () {
|
||||
return this.getContract().instance;
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,7 @@ export default class Registry {
|
||||
});
|
||||
}
|
||||
|
||||
getContractInstance (_name) {
|
||||
getContract (_name) {
|
||||
const name = _name.toLowerCase();
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -54,13 +54,19 @@ export default class Registry {
|
||||
this
|
||||
.lookupAddress(name)
|
||||
.then((address) => {
|
||||
this._contracts[name] = this._api.newContract(abis[name], address).instance;
|
||||
this._contracts[name] = this._api.newContract(abis[name], address);
|
||||
resolve(this._contracts[name]);
|
||||
})
|
||||
.catch(reject);
|
||||
});
|
||||
}
|
||||
|
||||
getContractInstance (_name) {
|
||||
return this
|
||||
.getContract(_name)
|
||||
.then((contract) => contract.instance);
|
||||
}
|
||||
|
||||
lookupAddress (_name) {
|
||||
const name = _name.toLowerCase();
|
||||
const sha3 = this._api.util.sha3(name);
|
||||
|
||||
@@ -22,8 +22,12 @@ export default class TokenReg {
|
||||
this.getInstance();
|
||||
}
|
||||
|
||||
getContract () {
|
||||
return this._registry.getContract('tokenreg');
|
||||
}
|
||||
|
||||
getInstance () {
|
||||
return this._registry.getContractInstance('tokenreg');
|
||||
return this.getContract().instance;
|
||||
}
|
||||
|
||||
tokenCount () {
|
||||
|
||||
@@ -105,7 +105,7 @@ export function attachInstances () {
|
||||
])
|
||||
.then(([registryAddress, netChain]) => {
|
||||
const registry = api.newContract(abis.registry, registryAddress).instance;
|
||||
isTest = netChain === 'morden' || netChain === 'testnet';
|
||||
isTest = netChain === 'ropsten' || netChain === 'morden' || netChain === 'testnet';
|
||||
|
||||
console.log(`contract was found at registry=${registryAddress}`);
|
||||
console.log(`running on ${netChain}, isTest=${isTest}`);
|
||||
|
||||
@@ -28,26 +28,26 @@ export function attachInterface () {
|
||||
return Promise
|
||||
.all([
|
||||
registry.getAddress.call({}, [api.util.sha3('githubhint'), 'A']),
|
||||
api.eth.accounts(),
|
||||
api.parity.accounts()
|
||||
]);
|
||||
})
|
||||
.then(([address, addresses, accountsInfo]) => {
|
||||
accountsInfo = accountsInfo || {};
|
||||
.then(([address, accountsInfo]) => {
|
||||
console.log(`githubhint was found at ${address}`);
|
||||
|
||||
const contract = api.newContract(abis.githubhint, address);
|
||||
const accounts = addresses.reduce((obj, address) => {
|
||||
const info = accountsInfo[address] || {};
|
||||
const accounts = Object
|
||||
.keys(accountsInfo)
|
||||
.filter((address) => accountsInfo[address].uuid)
|
||||
.reduce((obj, address) => {
|
||||
const account = accountsInfo[address];
|
||||
|
||||
return Object.assign(obj, {
|
||||
[address]: {
|
||||
address,
|
||||
name: info.name,
|
||||
uuid: info.uuid
|
||||
}
|
||||
});
|
||||
}, {});
|
||||
return Object.assign(obj, {
|
||||
[address]: {
|
||||
address,
|
||||
name: account.name
|
||||
}
|
||||
});
|
||||
}, {});
|
||||
const fromAddress = Object.keys(accounts)[0];
|
||||
|
||||
return {
|
||||
|
||||
@@ -49,3 +49,15 @@
|
||||
padding-bottom: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.warning {
|
||||
background: #f80;
|
||||
bottom: 0;
|
||||
color: #fff;
|
||||
left: 0;
|
||||
opacity: 1;
|
||||
padding: 1.5em;
|
||||
position: fixed;
|
||||
right: 50%;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ export default class Application extends Component {
|
||||
};
|
||||
|
||||
render () {
|
||||
const { api } = window.parity;
|
||||
const {
|
||||
actions,
|
||||
accounts, contacts,
|
||||
@@ -60,9 +61,11 @@ export default class Application extends Component {
|
||||
lookup,
|
||||
events
|
||||
} = this.props;
|
||||
let warning = null;
|
||||
|
||||
return (
|
||||
<div>
|
||||
{ warning }
|
||||
<div className={ styles.header }>
|
||||
<h1>RΞgistry</h1>
|
||||
<Accounts { ...accounts } actions={ actions.accounts } />
|
||||
@@ -70,13 +73,11 @@ export default class Application extends Component {
|
||||
{ contract && fee ? (
|
||||
<div>
|
||||
<Lookup { ...lookup } accounts={ accounts.all } contacts={ contacts } actions={ actions.lookup } />
|
||||
|
||||
{ this.renderActions() }
|
||||
|
||||
<Events { ...events } accounts={ accounts.all } contacts={ contacts } actions={ actions.events } />
|
||||
<p className={ styles.address }>
|
||||
The Registry is provided by the contract at <code>{ contract.address }.</code>
|
||||
</p>
|
||||
<div className={ styles.warning }>
|
||||
WARNING: The name registry is experimental. Please ensure that you understand the risks, benefits & consequences of registering a name before doing so. A non-refundable fee of { api.util.fromWei(fee).toFormat(3) }<small>ETH</small> is required for all registrations.
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<CircularProgress size={ 60 } />
|
||||
|
||||
@@ -19,18 +19,16 @@ import { api } from '../parity';
|
||||
export const set = (addresses) => ({ type: 'addresses set', addresses });
|
||||
|
||||
export const fetch = () => (dispatch) => {
|
||||
return Promise
|
||||
.all([
|
||||
api.eth.accounts(),
|
||||
api.parity.accounts()
|
||||
])
|
||||
.then(([ accounts, data ]) => {
|
||||
data = data || {};
|
||||
const addresses = Object.keys(data)
|
||||
.filter((address) => data[address] && !data[address].meta.deleted)
|
||||
return api.parity
|
||||
.accounts()
|
||||
.then((accountsInfo) => {
|
||||
const addresses = Object
|
||||
.keys(accountsInfo)
|
||||
.filter((address) => accountsInfo[address] && !accountsInfo[address].meta.deleted)
|
||||
.map((address) => ({
|
||||
...data[address], address,
|
||||
isAccount: accounts.includes(address)
|
||||
...accountsInfo[address],
|
||||
address,
|
||||
isAccount: !!accountsInfo[address].uuid
|
||||
}));
|
||||
dispatch(set(addresses));
|
||||
})
|
||||
|
||||
@@ -146,7 +146,7 @@ export default class Import extends Component {
|
||||
}
|
||||
|
||||
sortFunctions = (a, b) => {
|
||||
return a.name.localeCompare(b.name);
|
||||
return (a.name || '').localeCompare(b.name || '');
|
||||
}
|
||||
|
||||
countFunctions () {
|
||||
|
||||
@@ -49,26 +49,26 @@ export function attachInterface (callback) {
|
||||
return Promise
|
||||
.all([
|
||||
registry.getAddress.call({}, [api.util.sha3('signaturereg'), 'A']),
|
||||
api.eth.accounts(),
|
||||
api.parity.accounts()
|
||||
]);
|
||||
})
|
||||
.then(([address, addresses, accountsInfo]) => {
|
||||
accountsInfo = accountsInfo || {};
|
||||
.then(([address, accountsInfo]) => {
|
||||
console.log(`signaturereg was found at ${address}`);
|
||||
|
||||
const contract = api.newContract(abis.signaturereg, address);
|
||||
const accounts = addresses.reduce((obj, address) => {
|
||||
const info = accountsInfo[address] || {};
|
||||
const accounts = Object
|
||||
.keys(accountsInfo)
|
||||
.filter((address) => accountsInfo[address].uuid)
|
||||
.reduce((obj, address) => {
|
||||
const info = accountsInfo[address] || {};
|
||||
|
||||
return Object.assign(obj, {
|
||||
[address]: {
|
||||
address,
|
||||
name: info.name || 'Unnamed',
|
||||
uuid: info.uuid
|
||||
}
|
||||
});
|
||||
}, {});
|
||||
return Object.assign(obj, {
|
||||
[address]: {
|
||||
address,
|
||||
name: info.name || 'Unnamed'
|
||||
}
|
||||
});
|
||||
}, {});
|
||||
const fromAddress = Object.keys(accounts)[0];
|
||||
|
||||
return {
|
||||
|
||||
@@ -70,7 +70,8 @@ export default class AccountSelector extends Component {
|
||||
static propTypes = {
|
||||
list: PropTypes.array.isRequired,
|
||||
selected: PropTypes.object.isRequired,
|
||||
handleSetSelected: PropTypes.func.isRequired
|
||||
handleSetSelected: PropTypes.func.isRequired,
|
||||
onAccountChange: PropTypes.func
|
||||
};
|
||||
|
||||
state = {
|
||||
@@ -85,7 +86,8 @@ export default class AccountSelector extends Component {
|
||||
nestedItems={ nestedAccounts }
|
||||
open={ this.state.open }
|
||||
onSelectAccount={ this.onToggleOpen }
|
||||
autoGenerateNestedIndicator={ false } />
|
||||
autoGenerateNestedIndicator={ false }
|
||||
nestedListStyle={ { maxHeight: '14em', overflow: 'auto' } } />
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -110,6 +112,10 @@ export default class AccountSelector extends Component {
|
||||
|
||||
onToggleOpen = () => {
|
||||
this.setState({ open: !this.state.open });
|
||||
|
||||
if (typeof this.props.onAccountChange === 'function') {
|
||||
this.props.onAccountChange();
|
||||
}
|
||||
}
|
||||
|
||||
onSelectAccount = (address) => {
|
||||
|
||||
@@ -35,22 +35,17 @@ export const setSelectedAccount = (address) => ({
|
||||
});
|
||||
|
||||
export const loadAccounts = () => (dispatch) => {
|
||||
Promise
|
||||
.all([
|
||||
api.eth.accounts(),
|
||||
api.parity.accounts()
|
||||
])
|
||||
.then(([ accounts, accountsInfo ]) => {
|
||||
accountsInfo = accountsInfo || {};
|
||||
|
||||
const accountsList = accounts
|
||||
.map(address => ({
|
||||
api.parity
|
||||
.accounts()
|
||||
.then((accountsInfo) => {
|
||||
const accountsList = Object
|
||||
.keys(accountsInfo)
|
||||
.filter((address) => accountsInfo[address].uuid)
|
||||
.map((address) => ({
|
||||
...accountsInfo[address],
|
||||
address
|
||||
}));
|
||||
|
||||
console.log('accounts', accountsList);
|
||||
|
||||
dispatch(setAccounts(accountsList));
|
||||
dispatch(setAccountsInfo(accountsInfo));
|
||||
dispatch(setSelectedAccount(accountsList[0].address));
|
||||
|
||||
@@ -42,12 +42,9 @@ export default class QueryAction extends Component {
|
||||
|
||||
onClose: PropTypes.func.isRequired,
|
||||
handleQueryToken: PropTypes.func.isRequired,
|
||||
handleQueryMetaLookup: PropTypes.func.isRequired,
|
||||
|
||||
data: PropTypes.object,
|
||||
notFound: PropTypes.bool,
|
||||
metaLoading: PropTypes.bool,
|
||||
metaData: PropTypes.object
|
||||
notFound: PropTypes.bool
|
||||
}
|
||||
|
||||
state = initState;
|
||||
@@ -131,11 +128,8 @@ export default class QueryAction extends Component {
|
||||
return (
|
||||
<Token
|
||||
fullWidth
|
||||
handleMetaLookup={ this.props.handleQueryMetaLookup }
|
||||
isMetaLoading={ this.props.metaLoading }
|
||||
meta={ this.props.metaData }
|
||||
{ ...data }
|
||||
/>
|
||||
tla={ data.tla }
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import { Dialog, FlatButton } from 'material-ui';
|
||||
import AccountSelector from '../../Accounts/AccountSelector';
|
||||
import InputText from '../../Inputs/Text';
|
||||
|
||||
import { TOKEN_ADDRESS_TYPE, TLA_TYPE, UINT_TYPE, STRING_TYPE } from '../../Inputs/validation';
|
||||
import { TOKEN_ADDRESS_TYPE, TLA_TYPE, DECIMAL_TYPE, STRING_TYPE } from '../../Inputs/validation';
|
||||
|
||||
import styles from '../actions.css';
|
||||
|
||||
@@ -41,11 +41,11 @@ const initState = {
|
||||
floatingLabelText: 'Token TLA',
|
||||
hintText: 'The token short name (3 characters)'
|
||||
},
|
||||
base: {
|
||||
decimals: {
|
||||
...defaultField,
|
||||
type: UINT_TYPE,
|
||||
floatingLabelText: 'Token Base',
|
||||
hintText: 'The token precision'
|
||||
type: DECIMAL_TYPE,
|
||||
floatingLabelText: 'Token Decimals',
|
||||
hintText: 'The number of decimals (0-18)'
|
||||
},
|
||||
name: {
|
||||
...defaultField,
|
||||
@@ -81,6 +81,7 @@ export default class RegisterAction extends Component {
|
||||
className={ styles.dialog }
|
||||
onRequestClose={ this.onClose }
|
||||
actions={ this.renderActions() }
|
||||
ref='dialog'
|
||||
autoScrollBodyContent
|
||||
>
|
||||
{ this.renderContent() }
|
||||
@@ -149,7 +150,9 @@ export default class RegisterAction extends Component {
|
||||
renderForm () {
|
||||
return (
|
||||
<div>
|
||||
<AccountSelector />
|
||||
<AccountSelector
|
||||
onAccountChange={ this.onAccountChange }
|
||||
/>
|
||||
{ this.renderInputs() }
|
||||
</div>
|
||||
);
|
||||
@@ -175,6 +178,11 @@ export default class RegisterAction extends Component {
|
||||
});
|
||||
}
|
||||
|
||||
onAccountChange = () => {
|
||||
const { dialog } = this.refs;
|
||||
dialog.forceUpdate();
|
||||
}
|
||||
|
||||
onChange (fieldKey, valid, value) {
|
||||
const { fields } = this.state;
|
||||
const field = fields[fieldKey];
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
import { getTokenTotalSupply } from '../utils';
|
||||
|
||||
const { sha3, bytesToHex } = window.parity.api.util;
|
||||
|
||||
export const SET_REGISTER_SENDING = 'SET_REGISTER_SENDING';
|
||||
export const setRegisterSending = (isSending) => ({
|
||||
type: SET_REGISTER_SENDING,
|
||||
@@ -41,13 +39,12 @@ export const registerCompleted = () => ({
|
||||
});
|
||||
|
||||
export const registerToken = (tokenData) => (dispatch, getState) => {
|
||||
console.log('registering token', tokenData);
|
||||
|
||||
const state = getState();
|
||||
const contractInstance = state.status.contract.instance;
|
||||
const fee = state.status.contract.fee;
|
||||
|
||||
const { address, base, name, tla } = tokenData;
|
||||
const { address, decimals, name, tla } = tokenData;
|
||||
const base = Math.pow(10, decimals);
|
||||
|
||||
dispatch(setRegisterSending(true));
|
||||
|
||||
@@ -82,8 +79,6 @@ export const registerToken = (tokenData) => (dispatch, getState) => {
|
||||
})
|
||||
.then((gasEstimate) => {
|
||||
options.gas = gasEstimate.mul(1.2).toFixed(0);
|
||||
console.log(`transfer: gas estimated as ${gasEstimate.toFixed(0)} setting to ${options.gas}`);
|
||||
|
||||
return contractInstance.register.postTransaction(options, values);
|
||||
})
|
||||
.then((result) => {
|
||||
@@ -182,34 +177,3 @@ export const queryToken = (key, query) => (dispatch, getState) => {
|
||||
dispatch(setQueryLoading(false));
|
||||
});
|
||||
};
|
||||
|
||||
export const queryTokenMeta = (id, query) => (dispatch, getState) => {
|
||||
console.log('loading token meta', query);
|
||||
|
||||
const state = getState();
|
||||
const contractInstance = state.status.contract.instance;
|
||||
|
||||
const key = sha3(query);
|
||||
|
||||
const startDate = Date.now();
|
||||
dispatch(setQueryMetaLoading(true));
|
||||
|
||||
contractInstance
|
||||
.meta
|
||||
.call({}, [ id, key ])
|
||||
.then((value) => {
|
||||
const meta = {
|
||||
key, query,
|
||||
value: value.find(v => v !== 0) ? bytesToHex(value) : null
|
||||
};
|
||||
|
||||
dispatch(setQueryMeta(meta));
|
||||
|
||||
setTimeout(() => {
|
||||
dispatch(setQueryMetaLoading(false));
|
||||
}, 500 - (Date.now() - startDate));
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error('load meta query error', e);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -37,7 +37,6 @@ export default class Actions extends Component {
|
||||
|
||||
handleQueryToken: PropTypes.func.isRequired,
|
||||
handleQueryClose: PropTypes.func.isRequired,
|
||||
handleQueryMetaLookup: PropTypes.func.isRequired,
|
||||
query: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
@@ -82,7 +81,6 @@ export default class Actions extends Component {
|
||||
show={ this.state.show[ QUERY_ACTION ] }
|
||||
onClose={ this.onQueryClose }
|
||||
handleQueryToken={ this.props.handleQueryToken }
|
||||
handleQueryMetaLookup={ this.props.handleQueryMetaLookup }
|
||||
{ ...this.props.query } />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -19,7 +19,7 @@ import { connect } from 'react-redux';
|
||||
|
||||
import Actions from './component';
|
||||
|
||||
import { registerToken, registerReset, queryToken, queryReset, queryTokenMeta } from './actions';
|
||||
import { registerToken, registerReset, queryToken, queryReset } from './actions';
|
||||
|
||||
class TokensContainer extends Component {
|
||||
|
||||
@@ -49,9 +49,6 @@ const mapDispatchToProps = (dispatch) => {
|
||||
},
|
||||
handleQueryClose: () => {
|
||||
dispatch(queryReset());
|
||||
},
|
||||
handleQueryMetaLookup: (id, query) => {
|
||||
dispatch(queryTokenMeta(id, query));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -19,4 +19,17 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding-bottom: 10em;
|
||||
}
|
||||
|
||||
.warning {
|
||||
background: #f80;
|
||||
bottom: 0;
|
||||
color: #fff;
|
||||
left: 0;
|
||||
opacity: 1;
|
||||
padding: 1.5em;
|
||||
position: fixed;
|
||||
right: 50%;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
import React, { Component, PropTypes } from 'react';
|
||||
import getMuiTheme from 'material-ui/styles/getMuiTheme';
|
||||
|
||||
import { api } from '../parity';
|
||||
|
||||
import Loading from '../Loading';
|
||||
import Status from '../Status';
|
||||
import Tokens from '../Tokens';
|
||||
@@ -59,6 +61,9 @@ export default class Application extends Component {
|
||||
<Actions />
|
||||
|
||||
<Tokens />
|
||||
<div className={ styles.warning }>
|
||||
WARNING: The token registry is experimental. Please ensure that you understand the steps, risks, benefits & consequences of registering a token before doing so. A non-refundable fee of { api.util.fromWei(contract.fee).toFormat(3) }<small>ETH</small> is required for all registrations.
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ export const SIMPLE_TOKEN_ADDRESS_TYPE = 'SIMPLE_TOKEN_ADDRESS_TYPE';
|
||||
export const TLA_TYPE = 'TLA_TYPE';
|
||||
export const SIMPLE_TLA_TYPE = 'SIMPLE_TLA_TYPE';
|
||||
export const UINT_TYPE = 'UINT_TYPE';
|
||||
export const DECIMAL_TYPE = 'DECIMAL_TYPE';
|
||||
export const STRING_TYPE = 'STRING_TYPE';
|
||||
export const HEX_TYPE = 'HEX_TYPE';
|
||||
export const URL_TYPE = 'URL_TYPE';
|
||||
@@ -39,6 +40,7 @@ export const URL_TYPE = 'URL_TYPE';
|
||||
export const ERRORS = {
|
||||
invalidTLA: 'The TLA should be 3 characters long',
|
||||
invalidUint: 'Please enter a non-negative integer',
|
||||
invalidDecimal: 'Please enter a value between 0 and 18',
|
||||
invalidString: 'Please enter at least a character',
|
||||
invalidAccount: 'Please select an account to transact with',
|
||||
invalidRecipient: 'Please select an account to send to',
|
||||
@@ -75,7 +77,7 @@ const validateTokenAddress = (address, contract, simple) => {
|
||||
|
||||
return getTokenTotalSupply(address)
|
||||
.then(balance => {
|
||||
if (balance === null) {
|
||||
if (balance === null || balance.equals(0)) {
|
||||
return {
|
||||
error: ERRORS.invalidTokenAddress,
|
||||
valid: false
|
||||
@@ -152,6 +154,21 @@ const validateUint = (uint) => {
|
||||
};
|
||||
};
|
||||
|
||||
const validateDecimal = (decimal) => {
|
||||
if (!/^\d+$/.test(decimal) || parseInt(decimal) < 0 || parseInt(decimal) > 18) {
|
||||
return {
|
||||
error: ERRORS.invalidDecimal,
|
||||
valid: false
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
value: parseInt(decimal),
|
||||
error: null,
|
||||
valid: true
|
||||
};
|
||||
};
|
||||
|
||||
const validateString = (string) => {
|
||||
if (string.toString().length === 0) {
|
||||
return {
|
||||
@@ -204,6 +221,7 @@ export const validate = (value, type, contract) => {
|
||||
if (type === TLA_TYPE) return validateTLA(value, contract);
|
||||
if (type === SIMPLE_TLA_TYPE) return validateTLA(value, contract, true);
|
||||
if (type === UINT_TYPE) return validateUint(value);
|
||||
if (type === DECIMAL_TYPE) return validateDecimal(value);
|
||||
if (type === STRING_TYPE) return validateString(value);
|
||||
if (type === HEX_TYPE) return validateHex(value);
|
||||
if (type === URL_TYPE) return validateURL(value);
|
||||
|
||||
@@ -14,11 +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 {
|
||||
registry as registryAbi,
|
||||
tokenreg as tokenregAbi,
|
||||
githubhint as githubhintAbi
|
||||
} from '../../../contracts/abi';
|
||||
import Contracts from '../../../contracts';
|
||||
|
||||
import { loadToken, setTokenPending, deleteToken, setTokenData } from '../Tokens/actions';
|
||||
|
||||
@@ -34,43 +30,31 @@ export const FIND_CONTRACT = 'FIND_CONTRACT';
|
||||
export const loadContract = () => (dispatch) => {
|
||||
dispatch(setLoading(true));
|
||||
|
||||
api.parity
|
||||
.registryAddress()
|
||||
.then((registryAddress) => {
|
||||
console.log(`registry found at ${registryAddress}`);
|
||||
const registry = api.newContract(registryAbi, registryAddress).instance;
|
||||
|
||||
return Promise.all([
|
||||
registry.getAddress.call({}, [api.util.sha3('tokenreg'), 'A']),
|
||||
registry.getAddress.call({}, [api.util.sha3('githubhint'), 'A'])
|
||||
]);
|
||||
})
|
||||
.then(([ tokenregAddress, githubhintAddress ]) => {
|
||||
console.log(`tokenreg was found at ${tokenregAddress}`);
|
||||
|
||||
const tokenregContract = api
|
||||
.newContract(tokenregAbi, tokenregAddress);
|
||||
|
||||
const githubhintContract = api
|
||||
.newContract(githubhintAbi, githubhintAddress);
|
||||
const { tokenReg, githubHint } = new Contracts(api);
|
||||
|
||||
return Promise
|
||||
.all([
|
||||
tokenReg.getContract(),
|
||||
githubHint.getContract()
|
||||
])
|
||||
.then(([ tokenRegContract, githubHintContract ]) => {
|
||||
dispatch(setContractDetails({
|
||||
address: tokenregAddress,
|
||||
instance: tokenregContract.instance,
|
||||
raw: tokenregContract
|
||||
address: tokenRegContract.address,
|
||||
instance: tokenRegContract.instance,
|
||||
raw: tokenRegContract
|
||||
}));
|
||||
|
||||
dispatch(setGithubhintDetails({
|
||||
address: githubhintAddress,
|
||||
instance: githubhintContract.instance,
|
||||
raw: githubhintContract
|
||||
address: githubHintContract.address,
|
||||
instance: githubHintContract.instance,
|
||||
raw: githubHintContract
|
||||
}));
|
||||
|
||||
dispatch(loadContractDetails());
|
||||
dispatch(subscribeEvents());
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('loadContract error', error);
|
||||
throw error;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -78,7 +62,7 @@ export const LOAD_CONTRACT_DETAILS = 'LOAD_CONTRACT_DETAILS';
|
||||
export const loadContractDetails = () => (dispatch, getState) => {
|
||||
const state = getState();
|
||||
|
||||
const instance = state.status.contract.instance;
|
||||
const { instance } = state.status.contract;
|
||||
|
||||
Promise
|
||||
.all([
|
||||
@@ -87,8 +71,6 @@ export const loadContractDetails = () => (dispatch, getState) => {
|
||||
instance.fee.call()
|
||||
])
|
||||
.then(([accounts, owner, fee]) => {
|
||||
console.log(`owner as ${owner}, fee set at ${fee.toFormat()}`);
|
||||
|
||||
const isOwner = accounts.filter(a => a === owner).length > 0;
|
||||
|
||||
dispatch(setContractDetails({
|
||||
@@ -119,14 +101,14 @@ export const setGithubhintDetails = (details) => ({
|
||||
export const subscribeEvents = () => (dispatch, getState) => {
|
||||
const state = getState();
|
||||
|
||||
const contract = state.status.contract.raw;
|
||||
const { raw } = state.status.contract;
|
||||
const previousSubscriptionId = state.status.subscriptionId;
|
||||
|
||||
if (previousSubscriptionId) {
|
||||
contract.unsubscribe(previousSubscriptionId);
|
||||
raw.unsubscribe(previousSubscriptionId);
|
||||
}
|
||||
|
||||
contract
|
||||
raw
|
||||
.subscribe(null, {
|
||||
fromBlock: 'latest',
|
||||
toBlock: 'pending',
|
||||
@@ -187,7 +169,7 @@ export const subscribeEvents = () => (dispatch, getState) => {
|
||||
));
|
||||
}
|
||||
|
||||
console.log('new log event', log);
|
||||
console.warn('unknown log event', log);
|
||||
});
|
||||
})
|
||||
.then((subscriptionId) => {
|
||||
|
||||
@@ -25,17 +25,15 @@ const initialState = {
|
||||
isLoading: true,
|
||||
subscriptionId: null,
|
||||
contract: {
|
||||
addres: null,
|
||||
address: null,
|
||||
instance: null,
|
||||
raw: null,
|
||||
owner: null,
|
||||
isOwner: false,
|
||||
fee: null
|
||||
},
|
||||
githubhint: {
|
||||
address: null,
|
||||
instance: null,
|
||||
raw: null
|
||||
instance: null
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -31,6 +31,12 @@
|
||||
.title {
|
||||
font-size: 3rem;
|
||||
font-weight: 300;
|
||||
margin-top: 0;
|
||||
margin: 0;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.byline {
|
||||
font-size: 1.25em;
|
||||
opacity: 0.75;
|
||||
margin: 0 0 1.75em 0;
|
||||
}
|
||||
|
||||
@@ -29,17 +29,12 @@ export default class Status extends Component {
|
||||
};
|
||||
|
||||
render () {
|
||||
const { address, fee } = this.props;
|
||||
const { fee } = this.props;
|
||||
|
||||
return (
|
||||
<div className={ styles.status }>
|
||||
<h1 className={ styles.title }>Token Registry</h1>
|
||||
|
||||
<Chip
|
||||
isAddress
|
||||
value={ address }
|
||||
label='Address' />
|
||||
|
||||
<h3 className={ styles.byline }>A global registry of all recognised tokens on the network</h3>
|
||||
<Chip
|
||||
isAddress={ false }
|
||||
value={ api.util.fromWei(fee).toFixed(3) + 'ETH' }
|
||||
|
||||
@@ -14,4 +14,4 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
export default from './token';
|
||||
export default from './tokenContainer';
|
||||
|
||||
@@ -57,14 +57,28 @@ export default class Token extends Component {
|
||||
isLoading: PropTypes.bool,
|
||||
isPending: PropTypes.bool,
|
||||
isTokenOwner: PropTypes.bool.isRequired,
|
||||
isContractOwner: PropTypes.bool,
|
||||
|
||||
fullWidth: PropTypes.bool
|
||||
};
|
||||
|
||||
state = {
|
||||
metaKeyIndex: 0
|
||||
static defaultProps = {
|
||||
isContractOwner: false
|
||||
};
|
||||
|
||||
state = {
|
||||
metaKeyIndex: 0,
|
||||
showMeta: false
|
||||
};
|
||||
|
||||
shouldComponentUpdate (nextProps) {
|
||||
if (nextProps.isLoading && this.props.isLoading) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
render () {
|
||||
const { isLoading, fullWidth } = this.props;
|
||||
|
||||
@@ -151,8 +165,8 @@ export default class Token extends Component {
|
||||
if (!base || base < 0) return null;
|
||||
return (
|
||||
<Chip
|
||||
value={ base.toString() }
|
||||
label='Base' />
|
||||
value={ Math.log10(base).toString() }
|
||||
label='Decimals' />
|
||||
);
|
||||
}
|
||||
|
||||
@@ -220,7 +234,7 @@ export default class Token extends Component {
|
||||
}
|
||||
|
||||
renderUnregister () {
|
||||
if (!this.props.isTokenOwner) {
|
||||
if (!this.props.isContractOwner) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -236,7 +250,12 @@ export default class Token extends Component {
|
||||
}
|
||||
|
||||
renderMeta (meta) {
|
||||
const isMetaLoading = this.props.isMetaLoading;
|
||||
const { isMetaLoading } = this.props;
|
||||
const { showMeta } = this.state;
|
||||
|
||||
if (!showMeta) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (isMetaLoading) {
|
||||
return (<div>
|
||||
@@ -330,6 +349,7 @@ export default class Token extends Component {
|
||||
const key = metaDataKeys[keyIndex].value;
|
||||
const index = this.props.index;
|
||||
|
||||
this.setState({ showMeta: true });
|
||||
this.props.handleMetaLookup(index, key);
|
||||
}
|
||||
|
||||
|
||||
73
js/src/dapps/tokenreg/Tokens/Token/tokenContainer.js
Normal file
73
js/src/dapps/tokenreg/Tokens/Token/tokenContainer.js
Normal file
@@ -0,0 +1,73 @@
|
||||
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||
// This file is part of Parity.
|
||||
|
||||
// Parity is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import React, { Component, PropTypes } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import Token from './token';
|
||||
|
||||
import { queryTokenMeta, unregisterToken, addTokenMeta } from '../actions';
|
||||
|
||||
class TokenContainer extends Component {
|
||||
static propTypes = {
|
||||
handleMetaLookup: PropTypes.func.isRequired,
|
||||
handleUnregister: PropTypes.func.isRequired,
|
||||
handleAddMeta: PropTypes.func.isRequired,
|
||||
|
||||
tla: PropTypes.string.isRequired
|
||||
};
|
||||
|
||||
render () {
|
||||
return (
|
||||
<Token
|
||||
{ ...this.props }
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (_, initProps) => {
|
||||
const { tla } = initProps;
|
||||
|
||||
return (state) => {
|
||||
const { isOwner } = state.status.contract;
|
||||
const { tokens } = state.tokens;
|
||||
const token = tokens.find((t) => t.tla === tla);
|
||||
|
||||
return { ...token, isContractOwner: isOwner };
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
handleMetaLookup: (index, query) => {
|
||||
dispatch(queryTokenMeta(index, query));
|
||||
},
|
||||
|
||||
handleUnregister: (index) => {
|
||||
dispatch(unregisterToken(index));
|
||||
},
|
||||
|
||||
handleAddMeta: (index, key, value) => {
|
||||
dispatch(addTokenMeta(index, key, value));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(TokenContainer);
|
||||
@@ -67,8 +67,6 @@ export const deleteToken = (index) => ({
|
||||
});
|
||||
|
||||
export const loadTokens = () => (dispatch, getState) => {
|
||||
console.log('loading tokens...');
|
||||
|
||||
const state = getState();
|
||||
const contractInstance = state.status.contract.instance;
|
||||
|
||||
@@ -79,7 +77,6 @@ export const loadTokens = () => (dispatch, getState) => {
|
||||
.call()
|
||||
.then((count) => {
|
||||
const tokenCount = parseInt(count);
|
||||
console.log(`token count: ${tokenCount}`);
|
||||
dispatch(setTokenCount(tokenCount));
|
||||
|
||||
for (let i = 0; i < tokenCount; i++) {
|
||||
@@ -94,8 +91,6 @@ export const loadTokens = () => (dispatch, getState) => {
|
||||
};
|
||||
|
||||
export const loadToken = (index) => (dispatch, getState) => {
|
||||
console.log('loading token', index);
|
||||
|
||||
const state = getState();
|
||||
const contractInstance = state.status.contract.instance;
|
||||
|
||||
@@ -144,7 +139,7 @@ export const loadToken = (index) => (dispatch, getState) => {
|
||||
}
|
||||
|
||||
data.totalSupply = data.totalSupply.toNumber();
|
||||
console.log(`token loaded: #${index}`, data);
|
||||
|
||||
dispatch(setTokenData(index, data));
|
||||
dispatch(setTokenLoading(index, false));
|
||||
})
|
||||
@@ -159,8 +154,6 @@ export const loadToken = (index) => (dispatch, getState) => {
|
||||
};
|
||||
|
||||
export const queryTokenMeta = (index, query) => (dispatch, getState) => {
|
||||
console.log('loading token meta', index, query);
|
||||
|
||||
const state = getState();
|
||||
const contractInstance = state.status.contract.instance;
|
||||
|
||||
@@ -176,7 +169,6 @@ export const queryTokenMeta = (index, query) => (dispatch, getState) => {
|
||||
value: value.find(v => v !== 0) ? bytesToHex(value) : null
|
||||
};
|
||||
|
||||
console.log(`token meta loaded: #${index}`, value);
|
||||
dispatch(setTokenMeta(index, meta));
|
||||
|
||||
setTimeout(() => {
|
||||
@@ -189,8 +181,6 @@ export const queryTokenMeta = (index, query) => (dispatch, getState) => {
|
||||
};
|
||||
|
||||
export const addTokenMeta = (index, key, value) => (dispatch, getState) => {
|
||||
console.log('add token meta', index, key, value);
|
||||
|
||||
const state = getState();
|
||||
const contractInstance = state.status.contract.instance;
|
||||
const token = state.tokens.tokens.find(t => t.index === index);
|
||||
@@ -203,8 +193,6 @@ export const addTokenMeta = (index, key, value) => (dispatch, getState) => {
|
||||
.estimateGas(options, values)
|
||||
.then((gasEstimate) => {
|
||||
options.gas = gasEstimate.mul(1.2).toFixed(0);
|
||||
console.log(`addTokenMeta: gas estimated as ${gasEstimate.toFixed(0)} setting to ${options.gas}`);
|
||||
|
||||
return contractInstance.setMeta.postTransaction(options, values);
|
||||
})
|
||||
.catch((e) => {
|
||||
@@ -213,8 +201,6 @@ export const addTokenMeta = (index, key, value) => (dispatch, getState) => {
|
||||
};
|
||||
|
||||
export const addGithubhintURL = (from, key, url) => (dispatch, getState) => {
|
||||
console.log('add githubhint url', key, url);
|
||||
|
||||
const state = getState();
|
||||
const contractInstance = state.status.githubhint.instance;
|
||||
|
||||
@@ -227,8 +213,6 @@ export const addGithubhintURL = (from, key, url) => (dispatch, getState) => {
|
||||
.estimateGas(options, values)
|
||||
.then((gasEstimate) => {
|
||||
options.gas = gasEstimate.mul(1.2).toFixed(0);
|
||||
console.log(`transfer: gas estimated as ${gasEstimate.toFixed(0)} setting to ${options.gas}`);
|
||||
|
||||
return contractInstance.hintURL.postTransaction(options, values);
|
||||
})
|
||||
.catch((e) => {
|
||||
@@ -237,24 +221,20 @@ export const addGithubhintURL = (from, key, url) => (dispatch, getState) => {
|
||||
};
|
||||
|
||||
export const unregisterToken = (index) => (dispatch, getState) => {
|
||||
console.log('unregistering token', index);
|
||||
|
||||
const state = getState();
|
||||
const contractInstance = state.status.contract.instance;
|
||||
const { contract } = getState().status;
|
||||
const { instance, owner } = contract;
|
||||
|
||||
const values = [ index ];
|
||||
const options = {
|
||||
from: state.accounts.selected.address
|
||||
from: owner
|
||||
};
|
||||
|
||||
contractInstance
|
||||
instance
|
||||
.unregister
|
||||
.estimateGas(options, values)
|
||||
.then((gasEstimate) => {
|
||||
options.gas = gasEstimate.mul(1.2).toFixed(0);
|
||||
console.log(`transfer: gas estimated as ${gasEstimate.toFixed(0)} setting to ${options.gas}`);
|
||||
|
||||
return contractInstance.unregister.postTransaction(options, values);
|
||||
return instance.unregister.postTransaction(options, values);
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(`unregisterToken #${index} error`, e);
|
||||
|
||||
@@ -19,16 +19,13 @@ import { connect } from 'react-redux';
|
||||
|
||||
import Tokens from './tokens';
|
||||
|
||||
import { loadTokens, queryTokenMeta, unregisterToken, addTokenMeta } from './actions';
|
||||
import { loadTokens } from './actions';
|
||||
|
||||
class TokensContainer extends Component {
|
||||
static propTypes = {
|
||||
isOwner: PropTypes.bool,
|
||||
isLoading: PropTypes.bool,
|
||||
tokens: PropTypes.array,
|
||||
tokenCount: PropTypes.number,
|
||||
onLoadTokens: PropTypes.func,
|
||||
accounts: PropTypes.array
|
||||
onLoadTokens: PropTypes.func
|
||||
};
|
||||
|
||||
componentDidMount () {
|
||||
@@ -36,7 +33,6 @@ class TokensContainer extends Component {
|
||||
}
|
||||
|
||||
render () {
|
||||
console.log(this.props);
|
||||
return (
|
||||
<Tokens
|
||||
{ ...this.props }
|
||||
@@ -46,30 +42,19 @@ class TokensContainer extends Component {
|
||||
}
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
const { list } = state.accounts;
|
||||
const { isLoading, tokens, tokenCount } = state.tokens;
|
||||
const { isLoading, tokens } = state.tokens;
|
||||
|
||||
const { isOwner } = state.status.contract;
|
||||
const filteredTokens = tokens
|
||||
.filter((token) => token && token.tla)
|
||||
.map((token) => ({ tla: token.tla, owner: token.owner }));
|
||||
|
||||
return { isLoading, tokens, tokenCount, isOwner, accounts: list };
|
||||
return { isLoading, tokens: filteredTokens };
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
onLoadTokens: () => {
|
||||
dispatch(loadTokens());
|
||||
},
|
||||
|
||||
handleMetaLookup: (index, query) => {
|
||||
dispatch(queryTokenMeta(index, query));
|
||||
},
|
||||
|
||||
handleUnregister: (index) => {
|
||||
dispatch(unregisterToken(index));
|
||||
},
|
||||
|
||||
handleAddMeta: (index, key, value) => {
|
||||
dispatch(addTokenMeta(index, key, value));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -23,13 +23,8 @@ import styles from './tokens.css';
|
||||
|
||||
export default class Tokens extends Component {
|
||||
static propTypes = {
|
||||
handleAddMeta: PropTypes.func.isRequired,
|
||||
handleUnregister: PropTypes.func.isRequired,
|
||||
handleMetaLookup: PropTypes.func.isRequired,
|
||||
isOwner: PropTypes.bool.isRequired,
|
||||
isLoading: PropTypes.bool.isRequired,
|
||||
tokens: PropTypes.array,
|
||||
accounts: PropTypes.array
|
||||
tokens: PropTypes.array
|
||||
};
|
||||
|
||||
render () {
|
||||
@@ -45,23 +40,12 @@ export default class Tokens extends Component {
|
||||
}
|
||||
|
||||
renderTokens (tokens) {
|
||||
const { accounts } = this.props;
|
||||
|
||||
return tokens.map((token, index) => {
|
||||
if (!token || !token.tla) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const isTokenOwner = !!accounts.find((account) => account.address === token.owner);
|
||||
|
||||
return tokens.map((token) => {
|
||||
return (
|
||||
<Token
|
||||
{ ...token }
|
||||
handleUnregister={ this.props.handleUnregister }
|
||||
handleMetaLookup={ this.props.handleMetaLookup }
|
||||
handleAddMeta={ this.props.handleAddMeta }
|
||||
key={ index }
|
||||
isTokenOwner={ isTokenOwner } />
|
||||
key={ token.tla }
|
||||
tla={ token.tla }
|
||||
/>
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -91,3 +91,4 @@ ReactDOM.render(
|
||||
</ContextProvider>,
|
||||
document.querySelector('#container')
|
||||
);
|
||||
|
||||
|
||||
@@ -14,9 +14,45 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import { BlockNumber, Hash, Integer } from '../types';
|
||||
import { BlockNumber, Data, Hash, Integer } from '../types';
|
||||
|
||||
export default {
|
||||
block: {
|
||||
desc: 'Returns traces created at given block',
|
||||
params: [
|
||||
{
|
||||
type: BlockNumber,
|
||||
desc: 'Integer block number, or \'latest\' for the last mined block or \'pending\', \'earliest\' for not yet mined transactions'
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
type: Array,
|
||||
desc: 'Block traces'
|
||||
}
|
||||
},
|
||||
|
||||
call: {
|
||||
desc: 'Returns traces for a specific call',
|
||||
params: [
|
||||
{
|
||||
type: Object,
|
||||
desc: 'Call options'
|
||||
},
|
||||
{
|
||||
type: BlockNumber,
|
||||
desc: 'The blockNumber'
|
||||
},
|
||||
{
|
||||
type: Array,
|
||||
desc: 'Type of trace, one or more of \'vmTrace\', \'trace\' and/or \'stateDiff\''
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
type: Array,
|
||||
desc: 'Block traces'
|
||||
}
|
||||
},
|
||||
|
||||
filter: {
|
||||
desc: 'Returns traces matching given filter',
|
||||
params: [
|
||||
@@ -49,6 +85,42 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
rawTransaction: {
|
||||
desc: 'Traces a call to eth_sendRawTransaction without making the call, returning the traces',
|
||||
params: [
|
||||
{
|
||||
type: Data,
|
||||
desc: 'Transaction data'
|
||||
},
|
||||
{
|
||||
type: Array,
|
||||
desc: 'Type of trace, one or more of \'vmTrace\', \'trace\' and/or \'stateDiff\''
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
type: Array,
|
||||
desc: 'Block traces'
|
||||
}
|
||||
},
|
||||
|
||||
replayTransaction: {
|
||||
desc: 'Replays a transaction, returning the traces',
|
||||
params: [
|
||||
{
|
||||
type: Hash,
|
||||
desc: 'Transaction hash'
|
||||
},
|
||||
{
|
||||
type: Array,
|
||||
desc: 'Type of trace, one or more of \'vmTrace\', \'trace\' and/or \'stateDiff\''
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
type: Array,
|
||||
desc: 'Block traces'
|
||||
}
|
||||
},
|
||||
|
||||
transaction: {
|
||||
desc: 'Returns all traces of given transaction',
|
||||
params: [
|
||||
@@ -61,19 +133,5 @@ export default {
|
||||
type: Array,
|
||||
desc: 'Traces of given transaction'
|
||||
}
|
||||
},
|
||||
|
||||
block: {
|
||||
desc: 'Returns traces created at given block',
|
||||
params: [
|
||||
{
|
||||
type: BlockNumber,
|
||||
desc: 'Integer block number, or \'latest\' for the last mined block or \'pending\', \'earliest\' for not yet mined transactions'
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
type: Array,
|
||||
desc: 'Block traces'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import React, { Component, PropTypes } from 'react';
|
||||
import { Checkbox } from 'material-ui';
|
||||
|
||||
import { Form, Input } from '../../../ui';
|
||||
|
||||
@@ -37,6 +38,7 @@ export default class RecoveryPhrase extends Component {
|
||||
password1Error: ERRORS.invalidPassword,
|
||||
password2: '',
|
||||
password2Error: ERRORS.noMatchPassword,
|
||||
windowsPhrase: false,
|
||||
isValidPass: false,
|
||||
isValidName: false,
|
||||
isValidPhrase: false
|
||||
@@ -47,15 +49,13 @@ export default class RecoveryPhrase extends Component {
|
||||
}
|
||||
|
||||
render () {
|
||||
const { accountName, accountNameError, passwordHint, password1, password1Error, password2, password2Error, recoveryPhrase } = this.state;
|
||||
const { accountName, accountNameError, passwordHint, password1, password1Error, password2, password2Error, recoveryPhrase, windowsPhrase } = this.state;
|
||||
|
||||
return (
|
||||
<Form>
|
||||
<Input
|
||||
hint='the account recovery phrase'
|
||||
label='account recovery phrase'
|
||||
multiLine
|
||||
rows={ 1 }
|
||||
value={ recoveryPhrase }
|
||||
onChange={ this.onEditPhrase } />
|
||||
<Input
|
||||
@@ -88,20 +88,26 @@ export default class RecoveryPhrase extends Component {
|
||||
value={ password2 }
|
||||
onChange={ this.onEditPassword2 } />
|
||||
</div>
|
||||
<Checkbox
|
||||
className={ styles.checkbox }
|
||||
label='Key was created with Parity <1.4.5 on Windows'
|
||||
checked={ windowsPhrase }
|
||||
onCheck={ this.onToggleWindowsPhrase } />
|
||||
</div>
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
|
||||
updateParent = () => {
|
||||
const { isValidName, isValidPass, isValidPhrase, accountName, passwordHint, password1, recoveryPhrase } = this.state;
|
||||
const { isValidName, isValidPass, isValidPhrase, accountName, passwordHint, password1, recoveryPhrase, windowsPhrase } = this.state;
|
||||
const isValid = isValidName && isValidPass && isValidPhrase;
|
||||
|
||||
this.props.onChange(isValid, {
|
||||
name: accountName,
|
||||
passwordHint,
|
||||
password: password1,
|
||||
phrase: recoveryPhrase
|
||||
phrase: recoveryPhrase,
|
||||
windowsPhrase
|
||||
});
|
||||
}
|
||||
|
||||
@@ -111,18 +117,33 @@ export default class RecoveryPhrase extends Component {
|
||||
});
|
||||
}
|
||||
|
||||
onEditPhrase = (event) => {
|
||||
const value = event.target.value;
|
||||
let error = null;
|
||||
onToggleWindowsPhrase = (event) => {
|
||||
this.setState({
|
||||
windowsPhrase: !this.state.windowsPhrase
|
||||
}, this.updateParent);
|
||||
}
|
||||
|
||||
if (!value || value.trim().length < 25) {
|
||||
error = ERRORS.noPhrase;
|
||||
onEditPhrase = (event) => {
|
||||
const recoveryPhrase = event.target.value
|
||||
.toLowerCase() // wordlists are lowercase
|
||||
.trim() // remove whitespace at both ends
|
||||
.replace(/\s/g, ' ') // replace any whitespace with single space
|
||||
.replace(/ +/g, ' '); // replace multiple spaces with a single space
|
||||
|
||||
const phraseParts = recoveryPhrase
|
||||
.split(' ')
|
||||
.map((part) => part.trim())
|
||||
.filter((part) => part.length);
|
||||
let recoveryPhraseError = null;
|
||||
|
||||
if (!recoveryPhrase || recoveryPhrase.length < 25 || phraseParts.length < 8) {
|
||||
recoveryPhraseError = ERRORS.noPhrase;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
recoveryPhrase: value,
|
||||
recoveryPhraseError: error,
|
||||
isValidPhrase: !error
|
||||
recoveryPhrase: phraseParts.join(' '),
|
||||
recoveryPhraseError,
|
||||
isValidPhrase: !recoveryPhraseError
|
||||
}, this.updateParent);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +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/>.
|
||||
*/
|
||||
|
||||
.spaced {
|
||||
line-height: 1.618em;
|
||||
}
|
||||
@@ -67,3 +68,7 @@
|
||||
.upload>div {
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
margin-top: 2em;
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ export default class CreateAccount extends Component {
|
||||
passwordHint: null,
|
||||
password: null,
|
||||
phrase: null,
|
||||
windowsPhrase: false,
|
||||
rawKey: null,
|
||||
json: null,
|
||||
canCreate: false,
|
||||
@@ -200,7 +201,7 @@ export default class CreateAccount extends Component {
|
||||
}
|
||||
|
||||
onCreate = () => {
|
||||
const { createType } = this.state;
|
||||
const { createType, windowsPhrase } = this.state;
|
||||
const { api } = this.context;
|
||||
|
||||
this.setState({
|
||||
@@ -208,8 +209,16 @@ export default class CreateAccount extends Component {
|
||||
});
|
||||
|
||||
if (createType === 'fromNew' || createType === 'fromPhrase') {
|
||||
let phrase = this.state.phrase;
|
||||
if (createType === 'fromPhrase' && windowsPhrase) {
|
||||
phrase = phrase
|
||||
.split(' ') // get the words
|
||||
.map((word) => word === 'misjudged' ? word : `${word}\r`) // add \r after each (except last in dict)
|
||||
.join(' '); // re-create string
|
||||
}
|
||||
|
||||
return api.parity
|
||||
.newAccountFromPhrase(this.state.phrase, this.state.password)
|
||||
.newAccountFromPhrase(phrase, this.state.password)
|
||||
.then((address) => {
|
||||
this.setState({ address });
|
||||
return api.parity
|
||||
@@ -326,7 +335,7 @@ export default class CreateAccount extends Component {
|
||||
});
|
||||
}
|
||||
|
||||
onChangeDetails = (canCreate, { name, passwordHint, address, password, phrase, rawKey }) => {
|
||||
onChangeDetails = (canCreate, { name, passwordHint, address, password, phrase, rawKey, windowsPhrase }) => {
|
||||
this.setState({
|
||||
canCreate,
|
||||
name,
|
||||
@@ -334,6 +343,7 @@ export default class CreateAccount extends Component {
|
||||
address,
|
||||
password,
|
||||
phrase,
|
||||
windowsPhrase: windowsPhrase || false,
|
||||
rawKey
|
||||
});
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ export default class DeployContract extends Component {
|
||||
steps={ deployError ? null : steps }
|
||||
title={ deployError ? 'deployment failed' : null }
|
||||
waiting={ [1] }
|
||||
scroll
|
||||
visible>
|
||||
{ this.renderStep() }
|
||||
</Modal>
|
||||
|
||||
@@ -70,6 +70,7 @@ export default class ExecuteContract extends Component {
|
||||
title='execute function'
|
||||
busy={ sending }
|
||||
waiting={ [1] }
|
||||
scroll
|
||||
visible>
|
||||
{ this.renderStep() }
|
||||
</Modal>
|
||||
|
||||
@@ -314,7 +314,7 @@ export default class Transfer extends Component {
|
||||
}
|
||||
|
||||
const token = balance.tokens.find((balance) => balance.token.tag === tag).token;
|
||||
const s = new BigNumber(num).mul(token.format || 1).toString();
|
||||
const s = new BigNumber(num).mul(token.format || 1).toFixed();
|
||||
|
||||
if (s.indexOf('.') !== -1) {
|
||||
return ERRORS.invalidDecimals;
|
||||
@@ -516,6 +516,13 @@ export default class Transfer extends Component {
|
||||
}
|
||||
|
||||
recalculateGas = () => {
|
||||
if (!this.isValid()) {
|
||||
this.setState({
|
||||
gas: '0'
|
||||
}, this.recalculate);
|
||||
return;
|
||||
}
|
||||
|
||||
(this.state.isEth
|
||||
? this._estimateGasEth()
|
||||
: this._estimateGasToken()
|
||||
|
||||
@@ -109,7 +109,7 @@ export default class Status {
|
||||
this._api.eth.syncing()
|
||||
])
|
||||
.then(([clientVersion, coinbase, defaultExtraData, extraData, gasFloorTarget, hashrate, minGasPrice, netChain, netPeers, netPort, nodeName, rpcSettings, syncing, traceMode]) => {
|
||||
const isTest = netChain === 'morden' || netChain === 'testnet';
|
||||
const isTest = netChain === 'ropsten' || netChain === 'morden' || netChain === 'testnet';
|
||||
|
||||
this._store.dispatch(statusCollection({
|
||||
clientVersion,
|
||||
|
||||
@@ -30,7 +30,7 @@ const initialState = {
|
||||
gasFloorTarget: new BigNumber(0),
|
||||
hashrate: new BigNumber(0),
|
||||
minGasPrice: new BigNumber(0),
|
||||
netChain: 'morden',
|
||||
netChain: 'ropsten',
|
||||
netPeers: {
|
||||
active: new BigNumber(0),
|
||||
connected: new BigNumber(0),
|
||||
|
||||
@@ -17,4 +17,10 @@
|
||||
|
||||
.container {
|
||||
z-index: 10101 !important;
|
||||
|
||||
button {
|
||||
color: white !important;
|
||||
margin: 0 !important;
|
||||
margin-right: -16px !important;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,9 +23,12 @@ import { closeErrors } from './actions';
|
||||
|
||||
import styles from './errors.css';
|
||||
|
||||
const ERROR_REGEX = /-(\d+): (.+)$/;
|
||||
|
||||
class Errors extends Component {
|
||||
static propTypes = {
|
||||
message: PropTypes.string,
|
||||
error: PropTypes.object,
|
||||
visible: PropTypes.bool,
|
||||
onCloseErrors: PropTypes.func
|
||||
};
|
||||
@@ -37,22 +40,60 @@ class Errors extends Component {
|
||||
return null;
|
||||
}
|
||||
|
||||
const text = this.getErrorMessage();
|
||||
|
||||
return (
|
||||
<Snackbar
|
||||
open
|
||||
className={ styles.container }
|
||||
message={ message }
|
||||
autoHideDuration={ 5000 }
|
||||
onRequestClose={ onCloseErrors } />
|
||||
open
|
||||
action='close'
|
||||
autoHideDuration={ 60000 }
|
||||
message={ text }
|
||||
onActionTouchTap={ onCloseErrors }
|
||||
onRequestClose={ this.onRequestClose }
|
||||
bodyStyle={ {
|
||||
whiteSpace: 'pre-line',
|
||||
height: 'auto'
|
||||
} }
|
||||
contentStyle={ {
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
lineHeight: '1.5em',
|
||||
padding: '0.75em 0',
|
||||
alignItems: 'center'
|
||||
} }
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
getErrorMessage = () => {
|
||||
const { message, error } = this.props;
|
||||
|
||||
if (!error.text && !ERROR_REGEX.test(message)) {
|
||||
return message;
|
||||
}
|
||||
|
||||
const matches = ERROR_REGEX.exec(message);
|
||||
|
||||
const code = error.code || parseInt(matches[1]) * -1;
|
||||
const text = error.text || matches[2];
|
||||
|
||||
return `[${code}] ${text}`;
|
||||
}
|
||||
|
||||
onRequestClose = (reason) => {
|
||||
if (reason === 'timeout') {
|
||||
this.props.onCloseErrors();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function mapStateToProps (state) {
|
||||
const { message, visible } = state.errors;
|
||||
const { message, error, visible } = state.errors;
|
||||
|
||||
return {
|
||||
message,
|
||||
error,
|
||||
visible
|
||||
};
|
||||
}
|
||||
|
||||
@@ -19,7 +19,8 @@ function newError (state, action) {
|
||||
|
||||
return Object.assign({}, state, {
|
||||
visible: true,
|
||||
message: error.message
|
||||
message: error.message,
|
||||
error
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ export default class AddDapps extends Component {
|
||||
|
||||
renderApp = (app) => {
|
||||
const { store } = this.props;
|
||||
const isHidden = store.hidden.includes(app.id);
|
||||
const isHidden = store.hiddenApps.includes(app.id);
|
||||
const onCheck = () => {
|
||||
if (isHidden) {
|
||||
store.showApp(app.id);
|
||||
|
||||
43
js/src/views/Dapps/builtin.json
Normal file
43
js/src/views/Dapps/builtin.json
Normal file
@@ -0,0 +1,43 @@
|
||||
[
|
||||
{
|
||||
"id": "0xf9f2d620c2e08f83e45555247146c62185e4ab7cf82a4b9002a265a0d020348f",
|
||||
"url": "basiccoin",
|
||||
"name": "Token Deployment",
|
||||
"description": "Deploy new basic tokens that you are able to send around",
|
||||
"author": "Parity Team <admin@ethcore.io>",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
{
|
||||
"id": "0xd1adaede68d344519025e2ff574650cd99d3830fe6d274c7a7843cdc00e17938",
|
||||
"url": "registry",
|
||||
"name": "Registry",
|
||||
"description": "A global registry of addresses on the network",
|
||||
"author": "Parity Team <admin@ethcore.io>",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
{
|
||||
"id": "0x0a8048117e51e964628d0f2d26342b3cd915248b59bcce2721e1d05f5cfa2208",
|
||||
"url": "tokenreg",
|
||||
"name": "Token Registry",
|
||||
"description": "A registry of transactable tokens on the network",
|
||||
"author": "Parity Team <admin@ethcore.io>",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
{
|
||||
"id": "0xf49089046f53f5d2e5f3513c1c32f5ff57d986e46309a42d2b249070e4e72c46",
|
||||
"url": "signaturereg",
|
||||
"name": "Method Registry",
|
||||
"description": "A registry of method signatures for lookups on transactions",
|
||||
"author": "Parity Team <admin@ethcore.io>",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
{
|
||||
"id": "0x058740ee9a5a3fb9f1cfa10752baec87e09cc45cd7027fd54708271aca300c75",
|
||||
"url": "githubhint",
|
||||
"name": "GitHub Hint",
|
||||
"description": "A mapping of GitHub URLs to hashes for use in contracts as references",
|
||||
"author": "Parity Team <admin@ethcore.io>",
|
||||
"version": "1.0.0",
|
||||
"secure": true
|
||||
}
|
||||
]
|
||||
@@ -14,69 +14,39 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import { action, computed, observable } from 'mobx';
|
||||
import { action, computed, observable, transaction } from 'mobx';
|
||||
|
||||
import Contracts from '../../contracts';
|
||||
import { hashToImageUrl } from '../../redux/util';
|
||||
|
||||
const builtinApps = [
|
||||
{
|
||||
id: '0xf9f2d620c2e08f83e45555247146c62185e4ab7cf82a4b9002a265a0d020348f',
|
||||
url: 'basiccoin',
|
||||
name: 'Token Deployment',
|
||||
description: 'Deploy new basic tokens that you are able to send around',
|
||||
author: 'Parity Team <admin@ethcore.io>',
|
||||
version: '1.0.0'
|
||||
},
|
||||
{
|
||||
id: '0xd1adaede68d344519025e2ff574650cd99d3830fe6d274c7a7843cdc00e17938',
|
||||
url: 'registry',
|
||||
name: 'Registry',
|
||||
description: 'A global registry of addresses on the network',
|
||||
author: 'Parity Team <admin@ethcore.io>',
|
||||
version: '1.0.0'
|
||||
},
|
||||
{
|
||||
id: '0x0a8048117e51e964628d0f2d26342b3cd915248b59bcce2721e1d05f5cfa2208',
|
||||
url: 'tokenreg',
|
||||
name: 'Token Registry',
|
||||
description: 'A registry of transactable tokens on the network',
|
||||
author: 'Parity Team <admin@ethcore.io>',
|
||||
version: '1.0.0'
|
||||
},
|
||||
{
|
||||
id: '0xf49089046f53f5d2e5f3513c1c32f5ff57d986e46309a42d2b249070e4e72c46',
|
||||
url: 'signaturereg',
|
||||
name: 'Method Registry',
|
||||
description: 'A registry of method signatures for lookups on transactions',
|
||||
author: 'Parity Team <admin@ethcore.io>',
|
||||
version: '1.0.0'
|
||||
},
|
||||
{
|
||||
id: '0x058740ee9a5a3fb9f1cfa10752baec87e09cc45cd7027fd54708271aca300c75',
|
||||
url: 'githubhint',
|
||||
name: 'GitHub Hint',
|
||||
description: 'A mapping of GitHub URLs to hashes for use in contracts as references',
|
||||
author: 'Parity Team <admin@ethcore.io>',
|
||||
version: '1.0.0',
|
||||
secure: true
|
||||
}
|
||||
];
|
||||
import builtinApps from './builtin.json';
|
||||
|
||||
const LS_KEY_HIDDEN = 'hiddenApps';
|
||||
const LS_KEY_EXTERNAL = 'externalApps';
|
||||
|
||||
export default class DappsStore {
|
||||
@observable apps = [];
|
||||
@observable hidden = [];
|
||||
@observable externalApps = [];
|
||||
@observable hiddenApps = [];
|
||||
@observable modalOpen = false;
|
||||
|
||||
constructor (api) {
|
||||
this._api = api;
|
||||
|
||||
this._readHiddenApps();
|
||||
this._fetch();
|
||||
this._readExternalApps();
|
||||
|
||||
this._fetchBuiltinApps();
|
||||
this._fetchLocalApps();
|
||||
this._fetchRegistryApps();
|
||||
}
|
||||
|
||||
@computed get visible () {
|
||||
return this.apps.filter((app) => !this.hidden.includes(app.id));
|
||||
return this.apps
|
||||
.filter((app) => {
|
||||
return this.externalApps.includes(app.id) || !this.hiddenApps.includes(app.id);
|
||||
})
|
||||
.sort((a, b) => a.name.localeCompare(b.name));
|
||||
}
|
||||
|
||||
@action openModal = () => {
|
||||
@@ -88,12 +58,12 @@ export default class DappsStore {
|
||||
}
|
||||
|
||||
@action hideApp = (id) => {
|
||||
this.hidden = this.hidden.concat(id);
|
||||
this.hiddenApps = this.hiddenApps.concat(id);
|
||||
this._writeHiddenApps();
|
||||
}
|
||||
|
||||
@action showApp = (id) => {
|
||||
this.hidden = this.hidden.filter((_id) => _id !== id);
|
||||
this.hiddenApps = this.hiddenApps.filter((_id) => _id !== id);
|
||||
this._writeHiddenApps();
|
||||
}
|
||||
|
||||
@@ -103,25 +73,48 @@ export default class DappsStore {
|
||||
: '';
|
||||
}
|
||||
|
||||
_fetch () {
|
||||
Promise
|
||||
.all([
|
||||
this._fetchLocal(),
|
||||
this._fetchRegistry()
|
||||
])
|
||||
.then(([localApps, registryApps]) => {
|
||||
this.apps = []
|
||||
.concat(localApps)
|
||||
.concat(registryApps)
|
||||
.filter((app) => app.id)
|
||||
.sort((a, b) => (a.name || '').localeCompare(b.name || ''));
|
||||
})
|
||||
.catch((error) => {
|
||||
console.warn('DappStore:fetch', error);
|
||||
_fetchBuiltinApps () {
|
||||
const { dappReg } = Contracts.get();
|
||||
|
||||
return Promise
|
||||
.all(builtinApps.map((app) => dappReg.getImage(app.id)))
|
||||
.then((imageIds) => {
|
||||
transaction(() => {
|
||||
builtinApps.forEach((app, index) => {
|
||||
app.type = 'builtin';
|
||||
app.image = hashToImageUrl(imageIds[index]);
|
||||
this.apps.push(app);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
_fetchRegistry () {
|
||||
_fetchLocalApps () {
|
||||
return fetch(`${this._getHost()}/api/apps`)
|
||||
.then((response) => {
|
||||
return response.ok
|
||||
? response.json()
|
||||
: [];
|
||||
})
|
||||
.then((apps) => {
|
||||
return apps
|
||||
.map((app) => {
|
||||
app.type = 'local';
|
||||
return app;
|
||||
})
|
||||
.filter((app) => app.id && !['ui'].includes(app.id));
|
||||
})
|
||||
.then((apps) => {
|
||||
transaction(() => {
|
||||
(apps || []).forEach((app) => this.apps.push(app));
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
console.warn('DappsStore:fetchLocal', error);
|
||||
});
|
||||
}
|
||||
|
||||
_fetchRegistryApps () {
|
||||
const { dappReg } = Contracts.get();
|
||||
|
||||
return dappReg
|
||||
@@ -137,9 +130,9 @@ export default class DappsStore {
|
||||
return Promise.all(promises);
|
||||
})
|
||||
.then((appsInfo) => {
|
||||
const appIds = appsInfo.map(([appId, owner]) => {
|
||||
return this._api.util.bytesToHex(appId);
|
||||
});
|
||||
const appIds = appsInfo
|
||||
.map(([appId, owner]) => this._api.util.bytesToHex(appId))
|
||||
.filter((appId) => !builtinApps.find((app) => app.id === appId));
|
||||
|
||||
return Promise
|
||||
.all([
|
||||
@@ -149,27 +142,21 @@ export default class DappsStore {
|
||||
])
|
||||
.then(([imageIds, contentIds, manifestIds]) => {
|
||||
return appIds.map((appId, index) => {
|
||||
const app = builtinApps.find((ba) => ba.id === appId) || {
|
||||
const app = {
|
||||
id: appId,
|
||||
image: hashToImageUrl(imageIds[index]),
|
||||
contentHash: this._api.util.bytesToHex(contentIds[index]).substr(2),
|
||||
manifestHash: this._api.util.bytesToHex(manifestIds[index]).substr(2),
|
||||
type: 'network'
|
||||
};
|
||||
|
||||
app.image = hashToImageUrl(imageIds[index]);
|
||||
app.type = app.type || 'builtin';
|
||||
|
||||
return app;
|
||||
});
|
||||
});
|
||||
})
|
||||
.then((apps) => {
|
||||
return Promise
|
||||
.all(apps.map((app) => {
|
||||
return app.manifestHash
|
||||
? this._fetchManifest(app.manifestHash)
|
||||
: null;
|
||||
}))
|
||||
.all(apps.map((app) => this._fetchManifest(app.manifestHash)))
|
||||
.then((manifests) => {
|
||||
return apps.map((app, index) => {
|
||||
const manifest = manifests[index];
|
||||
@@ -177,7 +164,7 @@ export default class DappsStore {
|
||||
if (manifest) {
|
||||
app.manifestHash = null;
|
||||
Object.keys(manifest)
|
||||
.filter((key) => key !== 'id')
|
||||
.filter((key) => ['author', 'description', 'name', 'version'].includes(key))
|
||||
.forEach((key) => {
|
||||
app[key] = manifest[key];
|
||||
});
|
||||
@@ -192,6 +179,11 @@ export default class DappsStore {
|
||||
});
|
||||
});
|
||||
})
|
||||
.then((apps) => {
|
||||
transaction(() => {
|
||||
(apps || []).forEach((app) => this.apps.push(app));
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
console.warn('DappsStore:fetchRegistry', error);
|
||||
});
|
||||
@@ -210,39 +202,43 @@ export default class DappsStore {
|
||||
});
|
||||
}
|
||||
|
||||
_fetchLocal () {
|
||||
return fetch(`${this._getHost()}/api/apps`)
|
||||
.then((response) => {
|
||||
return response.ok
|
||||
? response.json()
|
||||
: [];
|
||||
})
|
||||
.then((localApps) => {
|
||||
return localApps
|
||||
.filter((app) => app && app.id && !['ui'].includes(app.id))
|
||||
.map((app) => {
|
||||
app.type = 'local';
|
||||
return app;
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
console.warn('DappsStore:fetchLocal', error);
|
||||
});
|
||||
}
|
||||
|
||||
_readHiddenApps () {
|
||||
const stored = localStorage.getItem('hiddenApps');
|
||||
const stored = localStorage.getItem(LS_KEY_HIDDEN);
|
||||
|
||||
if (stored) {
|
||||
try {
|
||||
this.hidden = JSON.parse(stored);
|
||||
this.hiddenApps = JSON.parse(stored);
|
||||
} catch (error) {
|
||||
console.warn('DappsStore:readHiddenApps', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_readExternalApps () {
|
||||
const stored = localStorage.getItem(LS_KEY_EXTERNAL);
|
||||
|
||||
if (stored) {
|
||||
try {
|
||||
this.externalApps = JSON.parse(stored);
|
||||
} catch (error) {
|
||||
console.warn('DappsStore:readExternalApps', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_writeExternalApps () {
|
||||
try {
|
||||
localStorage.setItem(LS_KEY_EXTERNAL, JSON.stringify(this.externalApps));
|
||||
} catch (error) {
|
||||
console.error('DappsStore:writeExternalApps', error);
|
||||
}
|
||||
}
|
||||
|
||||
_writeHiddenApps () {
|
||||
localStorage.setItem('hiddenApps', JSON.stringify(this.hidden));
|
||||
try {
|
||||
localStorage.setItem(LS_KEY_HIDDEN, JSON.stringify(this.hiddenApps));
|
||||
} catch (error) {
|
||||
console.error('DappsStore:writeHiddenApps', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ export default class AccountLink extends Component {
|
||||
}
|
||||
|
||||
updateLink (address, chain) {
|
||||
const link = addressLink(address, chain === 'morden' || chain === 'testnet');
|
||||
const link = addressLink(address, chain === 'ropsten' || chain === 'morden' || chain === 'testnet');
|
||||
|
||||
this.setState({
|
||||
link
|
||||
|
||||
@@ -32,7 +32,7 @@ export default class TxHashLink extends Component {
|
||||
|
||||
return (
|
||||
<a
|
||||
href={ txLink(txHash, chain === 'morden' || chain === 'testnet') }
|
||||
href={ txLink(txHash, chain === 'ropsten' || chain === 'morden' || chain === 'testnet') }
|
||||
target='_blank'
|
||||
className={ className }>
|
||||
{ children || txHash }
|
||||
|
||||
@@ -85,6 +85,10 @@ pub struct EthashParams {
|
||||
/// See main EthashParams docs.
|
||||
#[serde(rename="eip161dTransition")]
|
||||
pub eip161d_transition: Option<Uint>,
|
||||
|
||||
/// See main EthashParams docs.
|
||||
#[serde(rename="maxCodeSize")]
|
||||
pub max_code_size: Option<Uint>,
|
||||
}
|
||||
|
||||
/// Ethash engine deserialization.
|
||||
|
||||
@@ -26,9 +26,8 @@ extern crate time;
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
|
||||
use std::{env, thread};
|
||||
use std::{env, thread, fs};
|
||||
use std::sync::Arc;
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
use isatty::{stderr_isatty, stdout_isatty};
|
||||
use env_logger::LogBuilder;
|
||||
@@ -80,9 +79,13 @@ pub fn setup_log(config: &Config) -> Result<Arc<RotatingLogger>, String> {
|
||||
let enable_color = config.color && isatty;
|
||||
let logs = Arc::new(RotatingLogger::new(levels));
|
||||
let logger = logs.clone();
|
||||
let mut open_options = fs::OpenOptions::new();
|
||||
|
||||
let maybe_file = match config.file.as_ref() {
|
||||
Some(f) => Some(try!(File::create(f).map_err(|_| format!("Cannot write to log file given: {}", f)))),
|
||||
Some(f) => Some(try!(open_options
|
||||
.append(true).create(true).open(f)
|
||||
.map_err(|_| format!("Cannot write to log file given: {}", f))
|
||||
)),
|
||||
None => None,
|
||||
};
|
||||
|
||||
|
||||
@@ -578,7 +578,7 @@
|
||||
<key>OVERWRITE_PERMISSIONS</key>
|
||||
<false/>
|
||||
<key>VERSION</key>
|
||||
<string>1.4.2</string>
|
||||
<string>1.4.7</string>
|
||||
</dict>
|
||||
<key>UUID</key>
|
||||
<string>2DCD5B81-7BAF-4DA1-9251-6274B089FD36</string>
|
||||
|
||||
@@ -14,7 +14,7 @@ To temporarily disable Parity Wallet (and stop Parity) use:
|
||||
|
||||
To completely uninstall Parity Wallet use:
|
||||
|
||||
sudo -c /usr/local/libexec/uninstall-parity.sh
|
||||
sudo /usr/local/libexec/uninstall-parity.sh
|
||||
|
||||
|
||||
Parity is distributed under the terms of the GPL.
|
||||
Parity is distributed under the terms of the GPL.
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
!define DESCRIPTION "Fast, light, robust Ethereum implementation"
|
||||
!define VERSIONMAJOR 1
|
||||
!define VERSIONMINOR 4
|
||||
!define VERSIONBUILD 2
|
||||
!define VERSIONBUILD 7
|
||||
!define ARGS "--warp"
|
||||
!define FIRST_START_ARGS "ui --warp --mode=passive"
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ reseal_on_txs = "all"
|
||||
reseal_min_period = 4000
|
||||
work_queue_size = 20
|
||||
relay_set = "cheap"
|
||||
usd_per_tx = "0"
|
||||
usd_per_tx = "0.0025"
|
||||
usd_per_eth = "auto"
|
||||
price_update_period = "hourly"
|
||||
gas_floor_target = "4700000"
|
||||
|
||||
@@ -189,7 +189,7 @@ usage! {
|
||||
or |c: &Config| otry!(c.mining).tx_time_limit.clone().map(Some),
|
||||
flag_relay_set: String = "cheap",
|
||||
or |c: &Config| otry!(c.mining).relay_set.clone(),
|
||||
flag_usd_per_tx: String = "0",
|
||||
flag_usd_per_tx: String = "0.0025",
|
||||
or |c: &Config| otry!(c.mining).usd_per_tx.clone(),
|
||||
flag_usd_per_eth: String = "auto",
|
||||
or |c: &Config| otry!(c.mining).usd_per_eth.clone(),
|
||||
@@ -566,7 +566,7 @@ mod tests {
|
||||
flag_tx_gas_limit: Some("6283184".into()),
|
||||
flag_tx_time_limit: Some(100u64),
|
||||
flag_relay_set: "cheap".into(),
|
||||
flag_usd_per_tx: "0".into(),
|
||||
flag_usd_per_tx: "0.0025".into(),
|
||||
flag_usd_per_eth: "auto".into(),
|
||||
flag_price_update_period: "hourly".into(),
|
||||
flag_gas_floor_target: "4700000".into(),
|
||||
|
||||
@@ -32,7 +32,7 @@ Operating Options:
|
||||
(default: {flag_mode_alarm}).
|
||||
--chain CHAIN Specify the blockchain type. CHAIN may be either a
|
||||
JSON chain specification file or olympic, frontier,
|
||||
homestead, mainnet, morden, classic, expanse or
|
||||
homestead, mainnet, ropsten, morden, classic, expanse or
|
||||
testnet (default: {flag_chain}).
|
||||
-d --db-path PATH Specify the database & configuration directory path
|
||||
(default: {flag_db_path}).
|
||||
@@ -321,7 +321,7 @@ Miscellaneous Options:
|
||||
-l --logging LOGGING Specify the logging level. Must conform to the same
|
||||
format as RUST_LOG. (default: {flag_logging:?})
|
||||
--log-file FILENAME Specify a filename into which logging should be
|
||||
directed. (default: {flag_log_file:?})
|
||||
appended. (default: {flag_log_file:?})
|
||||
--no-config Don't load a configuration file.
|
||||
--no-color Don't use terminal color codes in output. (default: {flag_no_color})
|
||||
-v --version Show information about version.
|
||||
|
||||
@@ -315,7 +315,7 @@ impl Configuration {
|
||||
|
||||
fn chain(&self) -> String {
|
||||
if self.args.flag_testnet {
|
||||
"morden".to_owned()
|
||||
"ropsten".to_owned()
|
||||
} else {
|
||||
self.args.flag_chain.clone()
|
||||
}
|
||||
@@ -903,7 +903,7 @@ mod tests {
|
||||
// then
|
||||
assert_eq!(conf.network_settings(), NetworkSettings {
|
||||
name: "testname".to_owned(),
|
||||
chain: "morden".to_owned(),
|
||||
chain: "ropsten".to_owned(),
|
||||
network_port: 30303,
|
||||
rpc_enabled: true,
|
||||
rpc_interface: "local".to_owned(),
|
||||
|
||||
@@ -15,9 +15,8 @@
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::{io, env};
|
||||
use std::io::{Write, Read, BufReader, BufRead};
|
||||
use std::io::{Write, BufReader, BufRead};
|
||||
use std::time::Duration;
|
||||
use std::path::Path;
|
||||
use std::fs::File;
|
||||
use util::{clean_0x, U256, Uint, Address, path, CompactionProfile};
|
||||
use util::journaldb::Algorithm;
|
||||
@@ -299,13 +298,11 @@ pub fn password_prompt() -> Result<String, String> {
|
||||
}
|
||||
|
||||
/// Read a password from password file.
|
||||
pub fn password_from_file<P>(path: P) -> Result<String, String> where P: AsRef<Path> {
|
||||
let mut file = try!(File::open(path).map_err(|_| "Unable to open password file."));
|
||||
let mut file_content = String::new();
|
||||
match file.read_to_string(&mut file_content) {
|
||||
Ok(_) => Ok(file_content.trim().into()),
|
||||
Err(_) => Err("Unable to read password file.".into()),
|
||||
}
|
||||
pub fn password_from_file(path: String) -> Result<String, String> {
|
||||
let passwords = try!(passwords_from_files(vec![path]));
|
||||
// use only first password from the file
|
||||
passwords.get(0).map(String::to_owned)
|
||||
.ok_or_else(|| "Password file seems to be empty.".to_owned())
|
||||
}
|
||||
|
||||
/// Reads passwords from files. Treats each line as a separate password.
|
||||
@@ -314,10 +311,11 @@ pub fn passwords_from_files(files: Vec<String>) -> Result<Vec<String>, String> {
|
||||
let file = try!(File::open(filename).map_err(|_| format!("{} Unable to read password file. Ensure it exists and permissions are correct.", filename)));
|
||||
let reader = BufReader::new(&file);
|
||||
let lines = reader.lines()
|
||||
.map(|l| l.unwrap())
|
||||
.filter_map(|l| l.ok())
|
||||
.map(|pwd| pwd.trim().to_owned())
|
||||
.collect::<Vec<String>>();
|
||||
Ok(lines)
|
||||
}).collect::<Result<Vec<Vec<String>>, String>>();
|
||||
}).collect::<Result<Vec<Vec<String>>, String>>();
|
||||
Ok(try!(passwords).into_iter().flat_map(|x| x).collect())
|
||||
}
|
||||
|
||||
@@ -418,7 +416,20 @@ mod tests {
|
||||
let path = RandomTempPath::new();
|
||||
let mut file = File::create(path.as_path()).unwrap();
|
||||
file.write_all(b"a bc ").unwrap();
|
||||
assert_eq!(password_from_file(path).unwrap().as_bytes(), b"a bc");
|
||||
assert_eq!(password_from_file(path.as_str().into()).unwrap().as_bytes(), b"a bc");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_password_multiline() {
|
||||
let path = RandomTempPath::new();
|
||||
let mut file = File::create(path.as_path()).unwrap();
|
||||
file.write_all(br#" password with trailing whitespace
|
||||
those passwords should be
|
||||
ignored
|
||||
but the first password is trimmed
|
||||
|
||||
"#).unwrap();
|
||||
assert_eq!(&password_from_file(path.as_str().into()).unwrap(), "password with trailing whitespace");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -28,6 +28,7 @@ use user_defaults::UserDefaults;
|
||||
pub enum SpecType {
|
||||
Mainnet,
|
||||
Testnet,
|
||||
Ropsten,
|
||||
Olympic,
|
||||
Classic,
|
||||
Expanse,
|
||||
@@ -48,6 +49,7 @@ impl str::FromStr for SpecType {
|
||||
"frontier" | "homestead" | "mainnet" => SpecType::Mainnet,
|
||||
"frontier-dogmatic" | "homestead-dogmatic" | "classic" => SpecType::Classic,
|
||||
"morden" | "testnet" => SpecType::Testnet,
|
||||
"ropsten" => SpecType::Ropsten,
|
||||
"olympic" => SpecType::Olympic,
|
||||
"expanse" => SpecType::Expanse,
|
||||
other => SpecType::Custom(other.into()),
|
||||
@@ -61,6 +63,7 @@ impl SpecType {
|
||||
match *self {
|
||||
SpecType::Mainnet => Ok(ethereum::new_frontier()),
|
||||
SpecType::Testnet => Ok(ethereum::new_morden()),
|
||||
SpecType::Ropsten => Ok(ethereum::new_ropsten()),
|
||||
SpecType::Olympic => Ok(ethereum::new_olympic()),
|
||||
SpecType::Classic => Ok(ethereum::new_classic()),
|
||||
SpecType::Expanse => Ok(ethereum::new_expanse()),
|
||||
@@ -171,7 +174,7 @@ pub enum GasPricerConfig {
|
||||
impl Default for GasPricerConfig {
|
||||
fn default() -> Self {
|
||||
GasPricerConfig::Calibrated {
|
||||
usd_per_tx: 0f32,
|
||||
usd_per_tx: 0.0025f32,
|
||||
recalibration_period: Duration::from_secs(3600),
|
||||
}
|
||||
}
|
||||
@@ -282,6 +285,7 @@ mod tests {
|
||||
assert_eq!(SpecType::Mainnet, "mainnet".parse().unwrap());
|
||||
assert_eq!(SpecType::Testnet, "testnet".parse().unwrap());
|
||||
assert_eq!(SpecType::Testnet, "morden".parse().unwrap());
|
||||
assert_eq!(SpecType::Ropsten, "ropsten".parse().unwrap());
|
||||
assert_eq!(SpecType::Olympic, "olympic".parse().unwrap());
|
||||
}
|
||||
|
||||
|
||||
@@ -209,6 +209,8 @@ impl MinerService for TestMinerService {
|
||||
gas_used: r.gas_used.clone(),
|
||||
contract_address: None,
|
||||
logs: r.logs.clone(),
|
||||
log_bloom: r.log_bloom,
|
||||
state_root: r.state_root,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user