Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0a2beddfe | ||
|
|
e7dc0bed16 | ||
|
|
6eae372524 |
@@ -1,3 +1,3 @@
|
||||
[target.x86_64-pc-windows-msvc]
|
||||
# Link the C runtime statically ; https://github.com/paritytech/parity-ethereum/issues/6643
|
||||
# Link the C runtime statically ; https://github.com/paritytech/parity/issues/6643
|
||||
rustflags = ["-Ctarget-feature=+crt-static"]
|
||||
|
||||
14
.github/CONTRIBUTING.md
vendored
14
.github/CONTRIBUTING.md
vendored
@@ -2,7 +2,7 @@
|
||||
|
||||
## Do you have a question?
|
||||
|
||||
Check out our [Basic Usage](https://wiki.parity.io/Basic-Usage), [Configuration](https://wiki.parity.io/Configuring-Parity-Ethereum), and [FAQ](https://wiki.parity.io/FAQ) articles on our [wiki](https://wiki.parity.io/)!
|
||||
Check out our [Basic Usage](https://github.com/paritytech/parity/wiki/Basic-Usage), [Configuration](https://github.com/paritytech/parity/wiki/Configuring-Parity), and [FAQ](https://github.com/paritytech/parity/wiki/FAQ) articles on our [wiki](https://github.com/paritytech/parity/wiki)!
|
||||
|
||||
See also frequently asked questions [tagged with `parity`](https://ethereum.stackexchange.com/questions/tagged/parity?sort=votes&pageSize=50) on Stack Exchange.
|
||||
|
||||
@@ -10,11 +10,11 @@ See also frequently asked questions [tagged with `parity`](https://ethereum.stac
|
||||
|
||||
Do **not** open an issue on Github if you think your discovered bug could be a **security-relevant vulnerability**. Please, read our [security policy](../SECURITY.md) instead.
|
||||
|
||||
Otherwise, just create a [new issue](https://github.com/paritytech/parity-ethereum/issues/new) in our repository and state:
|
||||
Otherwise, just create a [new issue](https://github.com/paritytech/parity/issues/new) in our repository and state:
|
||||
|
||||
- What's your Parity Ethereum version?
|
||||
- What's your Parity version?
|
||||
- What's your operating system and version?
|
||||
- How did you install Parity Ethereum?
|
||||
- How did you install parity?
|
||||
- Is your node fully synchronized?
|
||||
- Did you try turning it off and on again?
|
||||
|
||||
@@ -22,12 +22,12 @@ Also, try to include **steps to reproduce** the issue and expand on the **actual
|
||||
|
||||
## Contribute!
|
||||
|
||||
If you would like to contribute to Parity Ethereum, please **fork it**, fix bugs or implement features, and [propose a pull request](https://github.com/paritytech/parity-ethereum/compare).
|
||||
If you would like to contribute to Parity, please **fork it**, fix bugs or implement features, and [propose a pull request](https://github.com/paritytech/parity/compare).
|
||||
|
||||
Please, refer to the [Coding Guide](https://wiki.parity.io/Coding-guide) in our wiki for more details about hacking on Parity.
|
||||
Please, refer to the [Coding Guide](https://github.com/paritytech/parity/wiki/Coding-guide) in our wiki for more details about hacking on Parity.
|
||||
|
||||
## License.
|
||||
|
||||
By contributing to Parity Ethereum, you agree that your contributions will be licensed under the [GPLv3 License](../LICENSE).
|
||||
By contributing to Parity, you agree that your contributions will be licensed under the [GPLv3 License](../LICENSE).
|
||||
|
||||
Each contributor has to sign our Contributor License Agreement. The purpose of the CLA is to ensure that the guardian of a project's outputs has the necessary ownership or grants of rights over all contributions to allow them to distribute under the chosen license. You can read and sign our full Contributor License Agreement at [cla.parity.io](https://cla.parity.io) before submitting a pull request.
|
||||
|
||||
14
.github/ISSUE_TEMPLATE.md
vendored
14
.github/ISSUE_TEMPLATE.md
vendored
@@ -1,11 +1,13 @@
|
||||
_Before filing a new issue, please **provide the following information**._
|
||||
|
||||
- **Parity Ethereum version**: 0.0.0
|
||||
- **Operating system**: Windows / MacOS / Linux
|
||||
- **Installation**: homebrew / one-line installer / built from source
|
||||
- **Fully synchronized**: no / yes
|
||||
- **Network**: ethereum / ropsten / kovan / ...
|
||||
- **Restarted**: no / yes
|
||||
> I'm running:
|
||||
>
|
||||
> - **Which Parity version?**: 0.0.0
|
||||
> - **Which operating system?**: Windows / MacOS / Linux
|
||||
> - **How installed?**: via installer / homebrew / binaries / from source
|
||||
> - **Are you fully synchronized?**: no / yes
|
||||
> - **Which network are you connected to?**: ethereum / ropsten / kovan / ...
|
||||
> - **Did you try to restart the node?**: no / yes
|
||||
|
||||
_Your issue description goes here below. Try to include **actual** vs. **expected behavior** and **steps to reproduce** the issue._
|
||||
|
||||
|
||||
481
.gitlab-ci.yml
481
.gitlab-ci.yml
@@ -1,301 +1,242 @@
|
||||
stages:
|
||||
- test
|
||||
- push-release
|
||||
- build
|
||||
- package
|
||||
- publish
|
||||
- docs
|
||||
|
||||
image: parity/rust:gitlab-ci
|
||||
|
||||
variables:
|
||||
CI_SERVER_NAME: "GitLab CI"
|
||||
CARGO_HOME: "${CI_PROJECT_DIR}/cargo"
|
||||
|
||||
BUILD_TARGET: ubuntu
|
||||
BUILD_ARCH: amd64
|
||||
CARGO_TARGET: x86_64-unknown-linux-gnu
|
||||
|
||||
RUST_BACKTRACE: "1"
|
||||
RUSTFLAGS: ""
|
||||
CARGOFLAGS: ""
|
||||
CI_SERVER_NAME: "GitLab CI"
|
||||
cache:
|
||||
key: "${CI_JOB_NAME}"
|
||||
key: "$CI_BUILD_STAGE-$CI_BUILD_REF_NAME"
|
||||
paths:
|
||||
- ${CI_PROJECT_DIR}/target/
|
||||
- ${CI_PROJECT_DIR}/cargo/
|
||||
|
||||
.releaseable_branches: # list of git refs for building GitLab artifacts (think "pre-release binaries")
|
||||
only: &releaseable_branches
|
||||
- master
|
||||
- target/
|
||||
untracked: true
|
||||
linux-amd64:
|
||||
stage: build
|
||||
image: parity/rust:gitlab-ci
|
||||
only:
|
||||
- beta
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- rustup default stable
|
||||
# ARGUMENTS: 1. BUILD_PLATFORM (target for binaries) 2. PLATFORM (target for cargo) 3. ARC (architecture) 4. & 5. CC & CXX flags 6. binary identifier
|
||||
- scripts/gitlab-build.sh x86_64-unknown-linux-gnu x86_64-unknown-linux-gnu amd64 gcc g++ linux
|
||||
tags:
|
||||
- rust-stable
|
||||
artifacts:
|
||||
paths:
|
||||
- parity.zip
|
||||
name: "stable-x86_64-unknown-linux-gnu_parity"
|
||||
linux-i686:
|
||||
stage: build
|
||||
image: parity/rust-i686:gitlab-ci
|
||||
only:
|
||||
- beta
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- scripts/gitlab-build.sh i686-unknown-linux-gnu i686-unknown-linux-gnu i386 gcc g++ linux
|
||||
tags:
|
||||
- rust-i686
|
||||
artifacts:
|
||||
paths:
|
||||
- parity.zip
|
||||
name: "i686-unknown-linux-gnu"
|
||||
allow_failure: true
|
||||
linux-armv7:
|
||||
stage: build
|
||||
image: parity/rust-armv7:gitlab-ci
|
||||
only:
|
||||
- beta
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- scripts/gitlab-build.sh armv7-unknown-linux-gnueabihf armv7-unknown-linux-gnueabihf armhf arm-linux-gnueabihf-gcc arm-linux-gnueabihf-g++ linux
|
||||
tags:
|
||||
- rust-arm
|
||||
artifacts:
|
||||
paths:
|
||||
- parity.zip
|
||||
name: "armv7_unknown_linux_gnueabihf_parity"
|
||||
allow_failure: true
|
||||
linux-armhf:
|
||||
stage: build
|
||||
image: parity/rust-arm:gitlab-ci
|
||||
only:
|
||||
- beta
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- scripts/gitlab-build.sh arm-unknown-linux-gnueabihf arm-unknown-linux-gnueabihf armhf arm-linux-gnueabihf-gcc arm-linux-gnueabihf-g++ linux
|
||||
tags:
|
||||
- rust-arm
|
||||
artifacts:
|
||||
paths:
|
||||
- parity.zip
|
||||
name: "arm-unknown-linux-gnueabihf_parity"
|
||||
allow_failure: true
|
||||
linux-aarch64:
|
||||
stage: build
|
||||
image: parity/rust-arm64:gitlab-ci
|
||||
only:
|
||||
- beta
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- scripts/gitlab-build.sh aarch64-unknown-linux-gnu aarch64-unknown-linux-gnu arm64 aarch64-linux-gnu-gcc aarch64-linux-gnu-g++ linux
|
||||
tags:
|
||||
- rust-arm
|
||||
artifacts:
|
||||
paths:
|
||||
- parity.zip
|
||||
name: "aarch64-unknown-linux-gnu_parity"
|
||||
linux-snap:
|
||||
stage: build
|
||||
image: parity/snapcraft:gitlab-ci
|
||||
only:
|
||||
- stable
|
||||
- beta
|
||||
- tags
|
||||
|
||||
.publishable_branches: # list of git refs for publishing builds to the "production" locations
|
||||
only: &publishable_branches
|
||||
- nightly # Our nightly builds from schedule, on `master`
|
||||
- /^v2.*$/ # Our version tags
|
||||
|
||||
.collect_artifacts: &collect_artifacts
|
||||
- triggers
|
||||
script:
|
||||
- scripts/gitlab-build.sh x86_64-unknown-snap-gnu x86_64-unknown-linux-gnu amd64 gcc g++ snap
|
||||
tags:
|
||||
- rust-stable
|
||||
artifacts:
|
||||
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
|
||||
when: on_success
|
||||
expire_in: 1 mos
|
||||
paths:
|
||||
- artifacts/
|
||||
|
||||
.determine_version: &determine_version
|
||||
- VERSION="$(sed -r -n '1,/^version/s/^version = "([^"]+)".*$/\1/p' Cargo.toml)"
|
||||
- DATE_STR="$(date +%Y%m%d)"
|
||||
- ID_SHORT="$(echo ${CI_COMMIT_SHA} | cut -c 1-7)"
|
||||
- test "${CI_COMMIT_REF_NAME}" = "nightly" && VERSION="${VERSION}-${ID_SHORT}-${DATE_STR}"
|
||||
- export VERSION
|
||||
- echo "Version = ${VERSION}"
|
||||
|
||||
|
||||
|
||||
#### stage: test
|
||||
|
||||
test-rust-stable: &test
|
||||
stage: test
|
||||
script:
|
||||
- scripts/gitlab/test.sh stable
|
||||
tags:
|
||||
- rust-stable
|
||||
|
||||
.optional_test: &optional_test
|
||||
<<: *test
|
||||
allow_failure: true
|
||||
- parity.zip
|
||||
name: "stable-x86_64-unknown-snap-gnu_parity"
|
||||
darwin:
|
||||
stage: build
|
||||
only:
|
||||
- master
|
||||
|
||||
test-rust-beta:
|
||||
<<: *optional_test
|
||||
- beta
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- scripts/gitlab/test.sh beta
|
||||
|
||||
test-rust-nightly:
|
||||
<<: *optional_test
|
||||
script:
|
||||
- scripts/gitlab/test.sh nightly
|
||||
|
||||
test-lint-rustfmt:
|
||||
<<: *optional_test
|
||||
script:
|
||||
- scripts/gitlab/rustfmt.sh
|
||||
|
||||
test-lint-clippy:
|
||||
<<: *optional_test
|
||||
script:
|
||||
- scripts/gitlab/clippy.sh
|
||||
|
||||
test-coverage-kcov:
|
||||
stage: test
|
||||
only:
|
||||
- master
|
||||
script:
|
||||
- scripts/gitlab/coverage.sh
|
||||
tags:
|
||||
- shell
|
||||
allow_failure: true
|
||||
|
||||
|
||||
#### stage: build
|
||||
|
||||
build-linux-ubuntu-amd64: &build
|
||||
stage: build
|
||||
only: *releaseable_branches
|
||||
variables:
|
||||
CARGO_TARGET: x86_64-unknown-linux-gnu
|
||||
script:
|
||||
- scripts/gitlab/build-unix.sh
|
||||
<<: *collect_artifacts
|
||||
tags:
|
||||
- rust-stable
|
||||
allow_failure: true
|
||||
|
||||
build-linux-ubuntu-i386:
|
||||
<<: *build
|
||||
image: parity/rust-i686:gitlab-ci
|
||||
variables:
|
||||
CARGO_TARGET: i686-unknown-linux-gnu
|
||||
tags:
|
||||
- rust-i686
|
||||
|
||||
build-linux-ubuntu-arm64:
|
||||
<<: *build
|
||||
image: parity/rust-arm64:gitlab-ci
|
||||
variables:
|
||||
CARGO_TARGET: aarch64-unknown-linux-gnu
|
||||
tags:
|
||||
- rust-arm
|
||||
|
||||
build-linux-ubuntu-armhf:
|
||||
<<: *build
|
||||
image: parity/rust-armv7:gitlab-ci
|
||||
variables:
|
||||
CARGO_TARGET: armv7-unknown-linux-gnueabihf
|
||||
tags:
|
||||
- rust-arm
|
||||
|
||||
build-linux-android-armhf:
|
||||
<<: *build
|
||||
image: parity/rust-android:gitlab-ci
|
||||
variables:
|
||||
CARGO_TARGET: armv7-linux-androideabi
|
||||
tags:
|
||||
- rust-arm
|
||||
|
||||
build-darwin-macos-x86_64:
|
||||
<<: *build
|
||||
variables:
|
||||
CARGO_TARGET: x86_64-apple-darwin
|
||||
CC: gcc
|
||||
CXX: g++
|
||||
- scripts/gitlab-build.sh x86_64-apple-darwin x86_64-apple-darwin macos gcc g++ macos
|
||||
tags:
|
||||
- osx
|
||||
<<: *collect_artifacts
|
||||
|
||||
build-windows-msvc-x86_64:
|
||||
stage: build
|
||||
only: *releaseable_branches
|
||||
cache:
|
||||
key: "%CI_JOB_NAME%"
|
||||
artifacts:
|
||||
paths:
|
||||
- "%CI_PROJECT_DIR%/target/"
|
||||
- "%CI_PROJECT_DIR%/cargo/"
|
||||
# No cargo caching, since fetch-locking on Windows gets stuck
|
||||
variables:
|
||||
CARGO_TARGET: x86_64-pc-windows-msvc
|
||||
- parity.zip
|
||||
name: "x86_64-apple-darwin_parity"
|
||||
windows:
|
||||
cache:
|
||||
key: "%CI_BUILD_STAGE%-%CI_BUILD_REF_NAME%"
|
||||
untracked: true
|
||||
stage: build
|
||||
only:
|
||||
- beta
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- sh scripts/gitlab/build-windows.sh
|
||||
- sh scripts/gitlab-build.sh x86_64-pc-windows-msvc x86_64-pc-windows-msvc amd64 "" "" windows
|
||||
tags:
|
||||
- rust-windows
|
||||
<<: *collect_artifacts
|
||||
|
||||
|
||||
#### stage: package
|
||||
|
||||
package-linux-snap-amd64: &package_snap
|
||||
stage: package
|
||||
only: *releaseable_branches
|
||||
image: parity/snapcraft:gitlab-ci
|
||||
cache: {}
|
||||
before_script: *determine_version
|
||||
variables:
|
||||
CARGO_TARGET: x86_64-unknown-linux-gnu
|
||||
dependencies:
|
||||
- build-linux-ubuntu-amd64
|
||||
artifacts:
|
||||
paths:
|
||||
- parity.zip
|
||||
name: "x86_64-pc-windows-msvc_parity"
|
||||
android-armv7:
|
||||
stage: build
|
||||
image: parity/parity-android:latest
|
||||
only:
|
||||
- beta
|
||||
- tags
|
||||
- stable
|
||||
- triggers
|
||||
script:
|
||||
- scripts/gitlab/package-snap.sh
|
||||
- cargo build --target=armv7-linux-androideabi
|
||||
tags:
|
||||
- rust-arm
|
||||
allow_failure: true
|
||||
artifacts:
|
||||
paths:
|
||||
- parity.zip
|
||||
name: "armv7-linux-androideabi_parity"
|
||||
docker-build:
|
||||
stage: build
|
||||
only:
|
||||
- tags
|
||||
- master
|
||||
- beta
|
||||
- stable
|
||||
- triggers
|
||||
before_script:
|
||||
- docker info
|
||||
script:
|
||||
- if [ "$CI_BUILD_REF_NAME" == "master" ]; then DOCKER_TAG="latest"; else DOCKER_TAG=$CI_BUILD_REF_NAME; fi
|
||||
- echo "Tag:" $DOCKER_TAG
|
||||
- docker login -u $Docker_Hub_User_Parity -p $Docker_Hub_Pass_Parity
|
||||
- scripts/docker-build.sh $DOCKER_TAG
|
||||
- docker logout
|
||||
tags:
|
||||
- docker
|
||||
test-coverage:
|
||||
stage: test
|
||||
only:
|
||||
- master
|
||||
script:
|
||||
- scripts/gitlab-test.sh test-coverage
|
||||
tags:
|
||||
- kcov
|
||||
allow_failure: true
|
||||
test-rust-stable:
|
||||
stage: test
|
||||
image: parity/rust:gitlab-ci
|
||||
script:
|
||||
- scripts/gitlab-test.sh stable
|
||||
tags:
|
||||
- rust-stable
|
||||
<<: *collect_artifacts
|
||||
|
||||
package-linux-snap-i386:
|
||||
<<: *package_snap
|
||||
variables:
|
||||
BUILD_ARCH: i386
|
||||
CARGO_TARGET: i686-unknown-linux-gnu
|
||||
dependencies:
|
||||
- build-linux-ubuntu-i386
|
||||
|
||||
package-linux-snap-arm64:
|
||||
<<: *package_snap
|
||||
variables:
|
||||
BUILD_ARCH: arm64
|
||||
CARGO_TARGET: aarch64-unknown-linux-gnu
|
||||
dependencies:
|
||||
- build-linux-ubuntu-arm64
|
||||
|
||||
package-linux-snap-armhf:
|
||||
<<: *package_snap
|
||||
variables:
|
||||
BUILD_ARCH: armhf
|
||||
CARGO_TARGET: armv7-unknown-linux-gnueabihf
|
||||
dependencies:
|
||||
- build-linux-ubuntu-armhf
|
||||
|
||||
|
||||
#### stage: publish
|
||||
|
||||
publish-linux-snap-amd64: &publish_snap
|
||||
stage: publish
|
||||
only: *publishable_branches
|
||||
image: parity/snapcraft:gitlab-ci
|
||||
cache: {}
|
||||
before_script: *determine_version
|
||||
variables:
|
||||
BUILD_ARCH: amd64
|
||||
dependencies:
|
||||
- package-linux-snap-amd64
|
||||
test-rust-beta:
|
||||
stage: test
|
||||
only:
|
||||
- triggers
|
||||
- master
|
||||
image: parity/rust:gitlab-ci
|
||||
script:
|
||||
- scripts/gitlab/publish-snap.sh
|
||||
- scripts/gitlab-test.sh beta
|
||||
tags:
|
||||
- rust-stable
|
||||
|
||||
publish-linux-snap-i386:
|
||||
<<: *publish_snap
|
||||
variables:
|
||||
BUILD_ARCH: i386
|
||||
dependencies:
|
||||
- package-linux-snap-i386
|
||||
|
||||
publish-linux-snap-arm64:
|
||||
<<: *publish_snap
|
||||
variables:
|
||||
BUILD_ARCH: arm64
|
||||
dependencies:
|
||||
- package-linux-snap-arm64
|
||||
|
||||
publish-linux-snap-armhf:
|
||||
<<: *publish_snap
|
||||
variables:
|
||||
BUILD_ARCH: armhf
|
||||
dependencies:
|
||||
- package-linux-snap-armhf
|
||||
|
||||
publish-docker-parity-amd64: &publish_docker
|
||||
stage: publish
|
||||
only: *releaseable_branches
|
||||
cache: {}
|
||||
dependencies:
|
||||
- build-linux-ubuntu-amd64
|
||||
- rust-beta
|
||||
allow_failure: true
|
||||
test-rust-nightly:
|
||||
stage: test
|
||||
only:
|
||||
- triggers
|
||||
- master
|
||||
image: parity/rust:gitlab-ci
|
||||
script:
|
||||
- scripts/gitlab-test.sh nightly
|
||||
tags:
|
||||
- shell
|
||||
allow_failure: true
|
||||
script:
|
||||
- scripts/gitlab/publish-docker.sh parity
|
||||
|
||||
publish-docker-parityevm-amd64:
|
||||
<<: *publish_docker
|
||||
script:
|
||||
- scripts/gitlab/publish-docker.sh parity-evm
|
||||
|
||||
publish-github-and-s3:
|
||||
stage: publish
|
||||
only: *publishable_branches
|
||||
cache: {}
|
||||
dependencies:
|
||||
- build-linux-ubuntu-amd64
|
||||
- build-linux-ubuntu-i386
|
||||
- build-linux-ubuntu-armhf
|
||||
- build-linux-ubuntu-arm64
|
||||
- build-darwin-macos-x86_64
|
||||
- build-windows-msvc-x86_64
|
||||
before_script: *determine_version
|
||||
script:
|
||||
- scripts/gitlab/push.sh
|
||||
tags:
|
||||
- shell
|
||||
allow_failure: true
|
||||
|
||||
|
||||
####stage: docs
|
||||
|
||||
docs-rpc-json:
|
||||
- rust
|
||||
- rust-nightly
|
||||
allow_failure: true
|
||||
json-rpc-docs:
|
||||
stage: docs
|
||||
only:
|
||||
- tags
|
||||
cache: {}
|
||||
image: parity/rust:gitlab-ci
|
||||
script:
|
||||
- scripts/gitlab/rpc-docs.sh
|
||||
- scripts/gitlab-rpc-docs.sh
|
||||
tags:
|
||||
- shell
|
||||
- docs
|
||||
push-release:
|
||||
stage: push-release
|
||||
only:
|
||||
- tags
|
||||
- triggers
|
||||
image: parity/rust:gitlab-ci
|
||||
script:
|
||||
- scripts/gitlab-push-release.sh
|
||||
tags:
|
||||
- curl
|
||||
|
||||
980
CHANGELOG.md
980
CHANGELOG.md
@@ -1,371 +1,639 @@
|
||||
## Parity-Ethereum [v2.0.1](https://github.com/paritytech/parity-ethereum/releases/tag/v2.0.1) (2018-07-27)
|
||||
## Parity [v1.11.6](https://github.com/paritytech/parity/releases/tag/v1.11.6) (2018-07-09)
|
||||
|
||||
Parity-Ethereum 2.0.1-beta is a bug-fix release to improve performance and stability.
|
||||
|
||||
Note, authorities in PoA networks based on the Aura engine, should upgrade their nodes to 1.11.8-stable or 2.0.1-beta as this release includes a critical fix.
|
||||
Parity 1.11.6 is a bug-fix release to improve performance and stability.
|
||||
|
||||
The full list of included changes:
|
||||
|
||||
- Backports to 2.0.1-beta ([#9145](https://github.com/paritytech/parity-ethereum/pull/9145))
|
||||
- Parity-version: bump beta to 2.0.1
|
||||
- Ci: update version strings for snaps ([#9160](https://github.com/paritytech/parity-ethereum/pull/9160))
|
||||
- Be more graceful on Aura difficulty validation ([#9164](https://github.com/paritytech/parity-ethereum/pull/9164))
|
||||
- Be more graceful on Aura difficulty validation
|
||||
- Test: rejects_step_backwards
|
||||
- Test: proposer_switching
|
||||
- Test: rejects_future_block
|
||||
- Test: reports_skipped
|
||||
- Test: verify_empty_seal_steps
|
||||
- Remove node-health ([#9119](https://github.com/paritytech/parity-ethereum/pull/9119))
|
||||
- Remove node-health
|
||||
- Remove ntp_servers
|
||||
- Add --ntp-servers as legacy instead of removing it
|
||||
- Add --ntp-servers to deprecated args
|
||||
- Remove unused stuff
|
||||
- Remove _legacy_ntp_servers
|
||||
- Parity: fix UserDefaults json parser ([#9189](https://github.com/paritytech/parity-ethereum/pull/9189))
|
||||
- Parity: fix UserDefaults json parser
|
||||
- Parity: use serde_derive for UserDefaults
|
||||
- Parity: support deserialization of old UserDefault json format
|
||||
- Parity: make UserDefaults serde backwards compatible
|
||||
- Parity: tabify indentation in UserDefaults
|
||||
- Fix bugfix hard fork logic ([#9138](https://github.com/paritytech/parity-ethereum/pull/9138))
|
||||
- Fix bugfix hard fork logic
|
||||
- Remove dustProtectionTransition from bugfix category
|
||||
- Eip-168 is not enabled by default
|
||||
- Remove unnecessary 'static
|
||||
- Disable per-sender limit for local transactions. ([#9148](https://github.com/paritytech/parity-ethereum/pull/9148))
|
||||
- Disable per-sender limit for local transactions.
|
||||
- Add a missing new line.
|
||||
- Rpc: fix is_major_importing sync state condition ([#9112](https://github.com/paritytech/parity-ethereum/pull/9112))
|
||||
- Rpc: fix is_major_importing sync state condition
|
||||
- Rpc: fix informant printout when waiting for peers
|
||||
- Fix verification in ethcore-sync collect_blocks ([#9135](https://github.com/paritytech/parity-ethereum/pull/9135))
|
||||
- Docker: update hub dockerfile ([#9173](https://github.com/paritytech/parity-ethereum/pull/9173))
|
||||
- Update Dockerfile for hub
|
||||
- Update to Ubuntu Xenial 16.04
|
||||
- Fix cmake version
|
||||
- Docker: fix tab indentation in hub dockerfile
|
||||
- Rpc: fix broken merge
|
||||
- Rpc: remove node_health leftover from merge
|
||||
- Rpc: remove dapps leftover from merge
|
||||
- Beta: 1.11.6 backports ([#9015](https://github.com/paritytech/parity/pull/9015))
|
||||
- Parity-version: bump beta to 1.11.6
|
||||
- Scripts: remove md5 checksums ([#8884](https://github.com/paritytech/parity/pull/8884))
|
||||
- Add support for --chain tobalaba
|
||||
- Convert indents to tabs :)
|
||||
- Fixes for misbehavior reporting in AuthorityRound ([#8998](https://github.com/paritytech/parity/pull/8998))
|
||||
- Aura: only report after checking for repeated skipped primaries
|
||||
- Aura: refactor duplicate code for getting epoch validator set
|
||||
- Aura: verify_external: report on validator set contract instance
|
||||
- Aura: use correct validator set epoch number when reporting
|
||||
- Aura: use epoch set when verifying blocks
|
||||
- Aura: report skipped primaries when generating seal
|
||||
- Aura: handle immediate transitions
|
||||
- Aura: don't report skipped steps from genesis to first block
|
||||
- Aura: fix reporting test
|
||||
- Aura: refactor duplicate code to handle immediate_transitions
|
||||
- Aura: let reporting fail on verify_block_basic
|
||||
- Aura: add comment about possible failure of reporting
|
||||
- Only return error log for rustls ([#9025](https://github.com/paritytech/parity/pull/9025))
|
||||
- Transaction Pool improvements ([#8470](https://github.com/paritytech/parity/pull/8470))
|
||||
- Don't use ethereum_types in transaction pool.
|
||||
- Hide internal insertion_id.
|
||||
- Fix tests.
|
||||
- Review grumbles.
|
||||
- Improve should_replace on NonceAndGasPrice ([#8980](https://github.com/paritytech/parity/pull/8980))
|
||||
- Additional tests for NonceAndGasPrice::should_replace.
|
||||
- Fix should_replace in the distinct sender case.
|
||||
- Use natural priority ordering to simplify should_replace.
|
||||
- Minimal effective gas price in the queue ([#8934](https://github.com/paritytech/parity/pull/8934))
|
||||
- Minimal effective gas price.
|
||||
- Fix naming, add test
|
||||
- Fix minimal entry score and add test.
|
||||
- Fix worst_transaction.
|
||||
- Remove effective gas price threshold.
|
||||
- Don't leak gas_price decisions out of Scoring.
|
||||
- Never drop local transactions from different senders. ([#9002](https://github.com/paritytech/parity/pull/9002))
|
||||
- Recently rejected cache for transaction queue ([#9005](https://github.com/paritytech/parity/pull/9005))
|
||||
- Store recently rejected transactions.
|
||||
- Don't cache AlreadyImported rejections.
|
||||
- Make the size of transaction verification queue dependent on pool size.
|
||||
- Add a test for recently rejected.
|
||||
- Fix logging for recently rejected.
|
||||
- Make rejection cache smaller.
|
||||
- Obsolete test removed
|
||||
- Obsolete test removed
|
||||
- Construct cache with_capacity.
|
||||
- Optimize pending transactions filter ([#9026](https://github.com/paritytech/parity/pull/9026))
|
||||
- Rpc: return unordered transactions in pending transactions filter
|
||||
- Ethcore: use LruCache for nonce cache
|
||||
- Only clear the nonce cache when a block is retracted
|
||||
- Revert "ethcore: use LruCache for nonce cache"
|
||||
- This reverts commit b382c19.
|
||||
- Use only cached nonces when computing pending hashes.
|
||||
- Give filters their own locks, so that they don't block one another.
|
||||
- Fix pending transaction count if not sealing.
|
||||
- Clear cache only when block is enacted.
|
||||
- Fix RPC tests.
|
||||
- Address review comments.
|
||||
- A last bunch of txqueue performance optimizations ([#9024](https://github.com/paritytech/parity/pull/9024))
|
||||
- Clear cache only when block is enacted.
|
||||
- Add tracing for cull.
|
||||
- Cull split.
|
||||
- Cull after creating pending block.
|
||||
- Add constant, remove sync::read tracing.
|
||||
- Reset debug.
|
||||
- Remove excessive tracing.
|
||||
- Use struct for NonceCache.
|
||||
- Fix build
|
||||
- Remove warnings.
|
||||
- Fix build again.
|
||||
- Miner: add missing macro use for trace_time
|
||||
- Ci: remove md5 merge leftovers
|
||||
|
||||
## Parity-Ethereum [v2.0.0](https://github.com/paritytech/parity-ethereum/releases/tag/v2.0.0) "Ethereum" (2018-07-18)
|
||||
## Parity [v1.11.5](https://github.com/paritytech/parity/releases/tag/v1.11.5) (2018-06-29)
|
||||
|
||||
This is the Parity-Ethereum//v2.0.0-beta release, code-named "Ethereum", **YOLO!**
|
||||
|
||||
Please note, Parity-Ethereum//v2.0.0 comes with some breaking changes that might be interrupting your usual workflows. Please mind them before upgrading:
|
||||
|
||||
- The Parity client is now called _Parity-Ethereum_ to distinguish it from other software we provide, such as [_Parity-Bitcoin_](https://github.com/paritytech/parity-bitcoin/) and [_Parity-Polkadot_](https://github.com/paritytech/polkadot) ([#9052](https://github.com/paritytech/parity-ethereum/pull/9052)).
|
||||
- The public node and the user interface (a.k.a. _"Parity Wallet"_) are completely removed from the Parity-Ethereum//v2.0.0 client ([#8758](https://github.com/paritytech/parity-ethereum/pull/8758), [#8783](https://github.com/paritytech/parity-ethereum/pull/8783), [#8641](https://github.com/paritytech/parity-ethereum/pull/8641)). Users interested running a Parity Wallet, check out [the stand-alone UI application](https://github.com/Parity-JS/shell/releases).
|
||||
- The DApps subsystem was completely removed from the client ([#9017](https://github.com/paritytech/parity-ethereum/pull/9017), [#9107](https://github.com/paritytech/parity-ethereum/pull/9107)). Again, use the standalone wallet if you wish to continue working with them.
|
||||
- Windows and MacOS versions are not available as installer anymore and the system trays were removed ([#8778](https://github.com/paritytech/parity-ethereum/pull/8778)). If you desire to run Parity-Ethereum on Windows or MacOS, you still can get the binaries from our mirrors. Furthermore, MacOS users are encouraged [to use our homebrew tap](https://github.com/paritytech/homebrew-paritytech/).
|
||||
- Linux versions are not available as deb-/rpm-packages anymore ([#8887](https://github.com/paritytech/parity-ethereum/pull/8887)). Communities are encouraged to provide their own packages or maintain their own repositories, such as [Arch Linux does](https://www.archlinux.org/packages/community/x86_64/parity/) for instance.
|
||||
- MD5-checksums are completely replaced by SHA256-checksums ([#8884](https://github.com/paritytech/parity-ethereum/pull/8884)). This is also reflected on our homepage by now.
|
||||
- Deprecated, removed, or replaced CLI-options are hidden from client `--help` to further discourage their usage ([#8967](https://github.com/paritytech/parity-ethereum/pull/8967)).
|
||||
|
||||
Additional noteworthy changes to the client:
|
||||
|
||||
- Tracing of precompiled contracts when the transfer value is not zero ([#8486](https://github.com/paritytech/parity-ethereum/pull/8486))
|
||||
- _Parity-Ethereum_ as a library now provides APIs for running full and light nodes and a C interface ([#8412](https://github.com/paritytech/parity-ethereum/pull/8412)). Shared crates are now available in [_Parity-Common_](https://github.com/paritytech/parity-common) ([#9083](https://github.com/paritytech/parity-ethereum/pull/9083)).
|
||||
- The Morden database and keys are now moved to a `./Morden` subdirectory instead of `./test` which is by default used by Ropsten ([#8621](https://github.com/paritytech/parity-ethereum/pull/8621)).
|
||||
- Adding support for having an on-chain contract calculating the block rewards ([#8419](https://github.com/paritytech/parity-ethereum/pull/8419)).
|
||||
- Enforcing warp-only synchronization with `--warp-barrier [blocknumber]` flag ([#8228](https://github.com/paritytech/parity-ethereum/pull/8228)).
|
||||
- Adding a fork-choice and meta-data framework suitable for implementing Casper ([#8401](https://github.com/paritytech/parity-ethereum/pull/8401)).
|
||||
- Returning an error if RLP-size of a transaction exceeds a 300kB limit ([#8473](https://github.com/paritytech/parity-ethereum/pull/8473)).
|
||||
- Warp-sync is now resumable by keeping the downloaded chunks between client restarts. Also, it seeds downloaded snapshots for other nodes ([#8544](https://github.com/paritytech/parity-ethereum/pull/8544)).
|
||||
- The developer chain `--chain dev` now contains Byzantium features, this breaks existing developer chains ([#8717](https://github.com/paritytech/parity-ethereum/pull/8717)).
|
||||
- The EIP150, EIP160 and EIP161 forks are now to be specified in common params section of a chain-spec file instead of the Ethash params to enable these features on non-proof-of-work chains ([#8614](https://github.com/paritytech/parity-ethereum/pull/8614)). Please update your chain specs.
|
||||
- Allowing to disable local-by-default for transactions with new configurations ([#8882](https://github.com/paritytech/parity-ethereum/pull/8882)).
|
||||
- Never drop local transactions from different senders ([#9002](https://github.com/paritytech/parity-ethereum/pull/9002)).
|
||||
- Optimize pending transactions filter and fix ethstats reporting of pending transactions ([#9026](https://github.com/paritytech/parity-ethereum/pull/9026)).
|
||||
- Add separate database directory for light client allowing to run full and light nodes at the same time ([#9064](https://github.com/paritytech/parity-ethereum/pull/9064)).
|
||||
|
||||
If you are upgrading directly from versions 1.10.9 or earlier, please note important changes to our transaction-queue implementation, namely:
|
||||
|
||||
- The pool now limits transactions per-sender (see `--tx-queue-per-sender`), local transactions also have to obey that limit. Consider increasing the limit via CLI-flag when running benchmarks or sending a lot of transactions at once.
|
||||
- In case the pool is full, transactions received over the network, but originating from accounts that you have private keys for might not get accepted to the pool any more with higher priority. Consider running with larger pool size or submitting the transactions directly on the node via `eth_sendRawTransaction`.
|
||||
Parity 1.11.5 is a bug-fix release to improve performance and stability.
|
||||
|
||||
The full list of included changes:
|
||||
|
||||
- Backports to 2.0.0-beta ([#9094](https://github.com/paritytech/parity-ethereum/pull/9094))
|
||||
- Parity-version: betalize 2.0
|
||||
- Multiple improvements to discovery ping handling ([#8771](https://github.com/paritytech/parity-ethereum/pull/8771))
|
||||
- Discovery: Only add nodes to routing table after receiving pong.
|
||||
- Discovery: Refactor packet creation into its own function.
|
||||
- Discovery: Additional testing for new add_node behavior.
|
||||
- Discovery: Track expiration of pings to non-yet-in-bucket nodes.
|
||||
- Discovery: Verify echo hash on pong packets.
|
||||
- Discovery: Track timeouts on FIND_NODE requests.
|
||||
- Discovery: Retry failed pings with exponential backoff.
|
||||
- !fixup Use slice instead of Vec for request_backoff.
|
||||
- Add separate database directory for light client ([#9064](https://github.com/paritytech/parity-ethereum/pull/9064))
|
||||
- Add separate default DB path for light client ([#8927](https://github.com/paritytech/parity-ethereum/pull/8927))
|
||||
- Improve readability
|
||||
- Revert "Replace `std::env::home_dir` with `dirs::home_dir` ([#9077](https://github.com/paritytech/parity-ethereum/pull/9077))" ([#9097](https://github.com/paritytech/parity-ethereum/pull/9097))
|
||||
- Revert "Replace `std::env::home_dir` with `dirs::home_dir` ([#9077](https://github.com/paritytech/parity-ethereum/pull/9077))"
|
||||
- This reverts commit 7e77932.
|
||||
- Restore some of the changes
|
||||
- Update parity-common
|
||||
- Offload cull to IoWorker. ([#9099](https://github.com/paritytech/parity-ethereum/pull/9099))
|
||||
- Fix work-notify. ([#9104](https://github.com/paritytech/parity-ethereum/pull/9104))
|
||||
- Update hidapi, fixes [#7542](https://github.com/paritytech/parity-ethereum/issues/7542) ([#9108](https://github.com/paritytech/parity-ethereum/pull/9108))
|
||||
- Docker: add cmake dependency ([#9111](https://github.com/paritytech/parity-ethereum/pull/9111))
|
||||
- Update light client hardcoded headers ([#9098](https://github.com/paritytech/parity-ethereum/pull/9098))
|
||||
- Insert Kovan hardcoded headers until 7690241
|
||||
- Insert Kovan hardcoded headers until block 7690241
|
||||
- Insert Ropsten hardcoded headers until 3612673
|
||||
- Insert Mainnet hardcoded headers until block 5941249
|
||||
- Make sure to produce full blocks. ([#9115](https://github.com/paritytech/parity-ethereum/pull/9115))
|
||||
- Insert ETC (classic) hardcoded headers until block 6170625 ([#9121](https://github.com/paritytech/parity-ethereum/pull/9121))
|
||||
- Fix verification in ethcore-sync collect_blocks ([#9135](https://github.com/paritytech/parity-ethereum/pull/9135))
|
||||
- Completely remove all dapps struct from rpc ([#9107](https://github.com/paritytech/parity-ethereum/pull/9107))
|
||||
- Completely remove all dapps struct from rpc
|
||||
- Remove unused pub use
|
||||
- `evm bench` fix broken dependencies ([#9134](https://github.com/paritytech/parity-ethereum/pull/9134))
|
||||
- `evm bench` use valid dependencies
|
||||
- Benchmarks of the `evm` used stale versions of a couple a crates that this commit fixes!
|
||||
- Fix warnings
|
||||
- Update snapcraft.yaml ([#9132](https://github.com/paritytech/parity-ethereum/pull/9132))
|
||||
- Parity Ethereum 2.0.0 ([#9052](https://github.com/paritytech/parity-ethereum/pull/9052))
|
||||
- Don't fetch snapshot chunks at random ([#9088](https://github.com/paritytech/parity-ethereum/pull/9088))
|
||||
- Remove the dapps system ([#9017](https://github.com/paritytech/parity-ethereum/pull/9017))
|
||||
- Fix nightly warnings ([#9080](https://github.com/paritytech/parity-ethereum/pull/9080))
|
||||
- Db: remove wal disabling / fast-and-loose option. ([#8963](https://github.com/paritytech/parity-ethereum/pull/8963))
|
||||
- Transactions hashes missing in trace_replayBlockTransactions method result [#8725](https://github.com/paritytech/parity-ethereum/issues/8725) ([#8883](https://github.com/paritytech/parity-ethereum/pull/8883))
|
||||
- Delete crates from parity-ethereum and fetch them from parity-common instead ([#9083](https://github.com/paritytech/parity-ethereum/pull/9083))
|
||||
- Updater verification ([#8787](https://github.com/paritytech/parity-ethereum/pull/8787))
|
||||
- Phrasing, precisions and typos in CLI help ([#9060](https://github.com/paritytech/parity-ethereum/pull/9060))
|
||||
- Some work towards iOS build ([#9045](https://github.com/paritytech/parity-ethereum/pull/9045))
|
||||
- Clean up deprecated options and add CHECK macro ([#9036](https://github.com/paritytech/parity-ethereum/pull/9036))
|
||||
- Replace `std::env::home_dir` with `dirs::home_dir` ([#9077](https://github.com/paritytech/parity-ethereum/pull/9077))
|
||||
- Fix warning in secret-store test ([#9074](https://github.com/paritytech/parity-ethereum/pull/9074))
|
||||
- Seedhashcompute remove needless `new` impl ([#9063](https://github.com/paritytech/parity-ethereum/pull/9063))
|
||||
- Remove trait bounds from several structs ([#9055](https://github.com/paritytech/parity-ethereum/pull/9055))
|
||||
- Docs: add changelog for 1.10.9 stable and 1.11.6 beta ([#9069](https://github.com/paritytech/parity-ethereum/pull/9069))
|
||||
- Enable test in `miner/pool/test` ([#9072](https://github.com/paritytech/parity-ethereum/pull/9072))
|
||||
- Fetch: replace futures-timer with tokio-timer ([#9066](https://github.com/paritytech/parity-ethereum/pull/9066))
|
||||
- Remove util-error ([#9054](https://github.com/paritytech/parity-ethereum/pull/9054))
|
||||
- Fixes for misbehavior reporting in AuthorityRound ([#8998](https://github.com/paritytech/parity-ethereum/pull/8998))
|
||||
- A last bunch of txqueue performance optimizations ([#9024](https://github.com/paritytech/parity-ethereum/pull/9024))
|
||||
- Reduce number of constraints for triedb types ([#9043](https://github.com/paritytech/parity-ethereum/pull/9043))
|
||||
- Bump fs-swap to 0.2.3 so it is compatible with osx 10.11 again ([#9050](https://github.com/paritytech/parity-ethereum/pull/9050))
|
||||
- Recursive test ([#9042](https://github.com/paritytech/parity-ethereum/pull/9042))
|
||||
- Introduce more optional features in ethcore ([#9020](https://github.com/paritytech/parity-ethereum/pull/9020))
|
||||
- Update ETSC bootnodes ([#9038](https://github.com/paritytech/parity-ethereum/pull/9038))
|
||||
- Optimize pending transactions filter ([#9026](https://github.com/paritytech/parity-ethereum/pull/9026))
|
||||
- Eip160/eip161 spec: u64 -> BlockNumber ([#9044](https://github.com/paritytech/parity-ethereum/pull/9044))
|
||||
- Move the C/C++ example to another directory ([#9032](https://github.com/paritytech/parity-ethereum/pull/9032))
|
||||
- Bump parking_lot to 0.6 ([#9013](https://github.com/paritytech/parity-ethereum/pull/9013))
|
||||
- Never drop local transactions from different senders. ([#9002](https://github.com/paritytech/parity-ethereum/pull/9002))
|
||||
- Precise HTTP or WebSockets for JSON-RPC options ([#9027](https://github.com/paritytech/parity-ethereum/pull/9027))
|
||||
- Recently rejected cache for transaction queue ([#9005](https://github.com/paritytech/parity-ethereum/pull/9005))
|
||||
- Make HashDB generic ([#8739](https://github.com/paritytech/parity-ethereum/pull/8739))
|
||||
- Only return error log for rustls ([#9025](https://github.com/paritytech/parity-ethereum/pull/9025))
|
||||
- Update Changelogs for 1.10.8 and 1.11.5 ([#9012](https://github.com/paritytech/parity-ethereum/pull/9012))
|
||||
- Attempt to graceful shutdown in case of panics ([#8999](https://github.com/paritytech/parity-ethereum/pull/8999))
|
||||
- Simplify kvdb error types ([#8924](https://github.com/paritytech/parity-ethereum/pull/8924))
|
||||
- Add option for user to set max size limit for RPC requests ([#9010](https://github.com/paritytech/parity-ethereum/pull/9010))
|
||||
- Bump ntp to 0.5.0 ([#9009](https://github.com/paritytech/parity-ethereum/pull/9009))
|
||||
- Removed duplicate dependency ([#9021](https://github.com/paritytech/parity-ethereum/pull/9021))
|
||||
- Minimal effective gas price in the queue ([#8934](https://github.com/paritytech/parity-ethereum/pull/8934))
|
||||
- Parity: fix db path when migrating to blooms db ([#8975](https://github.com/paritytech/parity-ethereum/pull/8975))
|
||||
- Preserve the current abort behavior ([#8995](https://github.com/paritytech/parity-ethereum/pull/8995))
|
||||
- Improve should_replace on NonceAndGasPrice ([#8980](https://github.com/paritytech/parity-ethereum/pull/8980))
|
||||
- Tentative fix for missing dependency error ([#8973](https://github.com/paritytech/parity-ethereum/pull/8973))
|
||||
- Refactor evm Instruction to be a c-like enum ([#8914](https://github.com/paritytech/parity-ethereum/pull/8914))
|
||||
- Fix deadlock in blockchain. ([#8977](https://github.com/paritytech/parity-ethereum/pull/8977))
|
||||
- Snap: downgrade rust to revision 1.26.2, ref snapcraft/+bug/1778530 ([#8984](https://github.com/paritytech/parity-ethereum/pull/8984))
|
||||
- Use local parity-dapps-glue instead of crate published at crates.io ([#8983](https://github.com/paritytech/parity-ethereum/pull/8983))
|
||||
- Parity: omit redundant last imported block number in light sync informant ([#8962](https://github.com/paritytech/parity-ethereum/pull/8962))
|
||||
- Disable hardware-wallets on platforms that don't support `libusb` ([#8464](https://github.com/paritytech/parity-ethereum/pull/8464))
|
||||
- Bump error-chain and quick_error versions ([#8972](https://github.com/paritytech/parity-ethereum/pull/8972))
|
||||
- Evm benchmark utilities ([#8944](https://github.com/paritytech/parity-ethereum/pull/8944))
|
||||
- Parity: hide legacy options from cli --help ([#8967](https://github.com/paritytech/parity-ethereum/pull/8967))
|
||||
- Scripts: fix docker build tag on latest using master ([#8952](https://github.com/paritytech/parity-ethereum/pull/8952))
|
||||
- Add type for passwords. ([#8920](https://github.com/paritytech/parity-ethereum/pull/8920))
|
||||
- Deps: bump fs-swap ([#8953](https://github.com/paritytech/parity-ethereum/pull/8953))
|
||||
- Eliminate some more `transmute()` ([#8879](https://github.com/paritytech/parity-ethereum/pull/8879))
|
||||
- Restrict vault.json permssion to owner and using random suffix for temp vault.json file ([#8932](https://github.com/paritytech/parity-ethereum/pull/8932))
|
||||
- Print SS.self_public when starting SS node ([#8949](https://github.com/paritytech/parity-ethereum/pull/8949))
|
||||
- Scripts: minor improvements ([#8930](https://github.com/paritytech/parity-ethereum/pull/8930))
|
||||
- Rpc: cap gas limit of local calls ([#8943](https://github.com/paritytech/parity-ethereum/pull/8943))
|
||||
- Docs: update changelogs ([#8931](https://github.com/paritytech/parity-ethereum/pull/8931))
|
||||
- Ethcore: fix compilation when using slow-blocks or evm-debug features ([#8936](https://github.com/paritytech/parity-ethereum/pull/8936))
|
||||
- Fixed blooms dir creation ([#8941](https://github.com/paritytech/parity-ethereum/pull/8941))
|
||||
- Update hardcoded headers ([#8925](https://github.com/paritytech/parity-ethereum/pull/8925))
|
||||
- New blooms database ([#8712](https://github.com/paritytech/parity-ethereum/pull/8712))
|
||||
- Ethstore: retry deduplication of wallet file names until success ([#8910](https://github.com/paritytech/parity-ethereum/pull/8910))
|
||||
- Update ropsten.json ([#8926](https://github.com/paritytech/parity-ethereum/pull/8926))
|
||||
- Include node identity in the P2P advertised client version. ([#8830](https://github.com/paritytech/parity-ethereum/pull/8830))
|
||||
- Allow disabling local-by-default for transactions with new config entry ([#8882](https://github.com/paritytech/parity-ethereum/pull/8882))
|
||||
- Allow Poll Lifetime to be configured via CLI ([#8885](https://github.com/paritytech/parity-ethereum/pull/8885))
|
||||
- Cleanup nibbleslice ([#8915](https://github.com/paritytech/parity-ethereum/pull/8915))
|
||||
- Hardware-wallets `Clean up things I missed in the latest PR` ([#8890](https://github.com/paritytech/parity-ethereum/pull/8890))
|
||||
- Remove debian/.deb and centos/.rpm packaging scripts ([#8887](https://github.com/paritytech/parity-ethereum/pull/8887))
|
||||
- Remove a weird emoji in new_social docs ([#8913](https://github.com/paritytech/parity-ethereum/pull/8913))
|
||||
- Minor fix in chain supplier and light provider ([#8906](https://github.com/paritytech/parity-ethereum/pull/8906))
|
||||
- Block 0 is valid in queries ([#8891](https://github.com/paritytech/parity-ethereum/pull/8891))
|
||||
- Fixed osx permissions ([#8901](https://github.com/paritytech/parity-ethereum/pull/8901))
|
||||
- Atomic create new files with permissions to owner in ethstore ([#8896](https://github.com/paritytech/parity-ethereum/pull/8896))
|
||||
- Add ETC Cooperative-run load balanced parity node ([#8892](https://github.com/paritytech/parity-ethereum/pull/8892))
|
||||
- Add support for --chain tobalaba ([#8870](https://github.com/paritytech/parity-ethereum/pull/8870))
|
||||
- Fix some warns on nightly ([#8889](https://github.com/paritytech/parity-ethereum/pull/8889))
|
||||
- Add new ovh bootnodes and fix port for foundation bootnode 3.2 ([#8886](https://github.com/paritytech/parity-ethereum/pull/8886))
|
||||
- Secretstore: service pack 1 ([#8435](https://github.com/paritytech/parity-ethereum/pull/8435))
|
||||
- Handle removed logs in filter changes and add geth compatibility field ([#8796](https://github.com/paritytech/parity-ethereum/pull/8796))
|
||||
- Fixed ipc leak, closes [#8774](https://github.com/paritytech/parity-ethereum/issues/8774) ([#8876](https://github.com/paritytech/parity-ethereum/pull/8876))
|
||||
- Scripts: remove md5 checksums ([#8884](https://github.com/paritytech/parity-ethereum/pull/8884))
|
||||
- Hardware_wallet/Ledger `Sign messages` + some refactoring ([#8868](https://github.com/paritytech/parity-ethereum/pull/8868))
|
||||
- Check whether we need resealing in miner and unwrap has_account in account_provider ([#8853](https://github.com/paritytech/parity-ethereum/pull/8853))
|
||||
- Docker: Fix alpine build ([#8878](https://github.com/paritytech/parity-ethereum/pull/8878))
|
||||
- Remove mac os installers etc ([#8875](https://github.com/paritytech/parity-ethereum/pull/8875))
|
||||
- Readme.md: update the list of dependencies ([#8864](https://github.com/paritytech/parity-ethereum/pull/8864))
|
||||
- Fix concurrent access to signer queue ([#8854](https://github.com/paritytech/parity-ethereum/pull/8854))
|
||||
- Tx permission contract improvement ([#8400](https://github.com/paritytech/parity-ethereum/pull/8400))
|
||||
- Limit the number of transactions in pending set ([#8777](https://github.com/paritytech/parity-ethereum/pull/8777))
|
||||
- Use sealing.enabled to emit eth_mining information ([#8844](https://github.com/paritytech/parity-ethereum/pull/8844))
|
||||
- Don't allocate in expect_valid_rlp unless necessary ([#8867](https://github.com/paritytech/parity-ethereum/pull/8867))
|
||||
- Fix Cli Return Code on --help for ethkey, ethstore & whisper ([#8863](https://github.com/paritytech/parity-ethereum/pull/8863))
|
||||
- Fix subcrate test compile ([#8862](https://github.com/paritytech/parity-ethereum/pull/8862))
|
||||
- Network-devp2p: downgrade logging to debug, add target ([#8784](https://github.com/paritytech/parity-ethereum/pull/8784))
|
||||
- Clearing up a comment about the prefix for signing ([#8828](https://github.com/paritytech/parity-ethereum/pull/8828))
|
||||
- Disable parallel verification and skip verifiying already imported txs. ([#8834](https://github.com/paritytech/parity-ethereum/pull/8834))
|
||||
- Devp2p: Move UDP socket handling from Discovery to Host. ([#8790](https://github.com/paritytech/parity-ethereum/pull/8790))
|
||||
- Fixed AuthorityRound deadlock on shutdown, closes [#8088](https://github.com/paritytech/parity-ethereum/issues/8088) ([#8803](https://github.com/paritytech/parity-ethereum/pull/8803))
|
||||
- Specify critical release flag per network ([#8821](https://github.com/paritytech/parity-ethereum/pull/8821))
|
||||
- Fix `deadlock_detection` feature branch compilation ([#8824](https://github.com/paritytech/parity-ethereum/pull/8824))
|
||||
- Use system allocator when profiling memory ([#8831](https://github.com/paritytech/parity-ethereum/pull/8831))
|
||||
- Added from and to to Receipt ([#8756](https://github.com/paritytech/parity-ethereum/pull/8756))
|
||||
- Ethcore: fix ancient block error msg handling ([#8832](https://github.com/paritytech/parity-ethereum/pull/8832))
|
||||
- Ci: Fix docker tags ([#8822](https://github.com/paritytech/parity-ethereum/pull/8822))
|
||||
- Parity: fix indentation in sync logging ([#8794](https://github.com/paritytech/parity-ethereum/pull/8794))
|
||||
- Removed obsolete IpcMode enum ([#8819](https://github.com/paritytech/parity-ethereum/pull/8819))
|
||||
- Remove UI related settings from CLI ([#8783](https://github.com/paritytech/parity-ethereum/pull/8783))
|
||||
- Remove windows tray and installer ([#8778](https://github.com/paritytech/parity-ethereum/pull/8778))
|
||||
- Docs: add changelogs for 1.10.6 and 1.11.3 ([#8810](https://github.com/paritytech/parity-ethereum/pull/8810))
|
||||
- Fix ancient blocks queue deadlock ([#8751](https://github.com/paritytech/parity-ethereum/pull/8751))
|
||||
- Disallow unsigned transactions in case EIP-86 is disabled ([#8802](https://github.com/paritytech/parity-ethereum/pull/8802))
|
||||
- Fix evmbin compilation ([#8795](https://github.com/paritytech/parity-ethereum/pull/8795))
|
||||
- Have space between feature cfg flag ([#8791](https://github.com/paritytech/parity-ethereum/pull/8791))
|
||||
- Rpc: fix address formatting in TransactionRequest Display ([#8786](https://github.com/paritytech/parity-ethereum/pull/8786))
|
||||
- Conditionally compile ethcore public test helpers ([#8743](https://github.com/paritytech/parity-ethereum/pull/8743))
|
||||
- Remove Result wrapper from AccountProvider in RPC impls ([#8763](https://github.com/paritytech/parity-ethereum/pull/8763))
|
||||
- Update `license header` and `scripts` ([#8666](https://github.com/paritytech/parity-ethereum/pull/8666))
|
||||
- Remove HostTrait altogether ([#8681](https://github.com/paritytech/parity-ethereum/pull/8681))
|
||||
- Ethcore-sync: fix connection to peers behind chain fork block ([#8710](https://github.com/paritytech/parity-ethereum/pull/8710))
|
||||
- Remove public node settings from cli ([#8758](https://github.com/paritytech/parity-ethereum/pull/8758))
|
||||
- Custom Error Messages on ENFILE and EMFILE IO Errors ([#8744](https://github.com/paritytech/parity-ethereum/pull/8744))
|
||||
- Ci: Fixes for Android Pipeline ([#8745](https://github.com/paritytech/parity-ethereum/pull/8745))
|
||||
- Remove NetworkService::config() ([#8653](https://github.com/paritytech/parity-ethereum/pull/8653))
|
||||
- Fix XOR distance calculation in discovery Kademlia impl ([#8589](https://github.com/paritytech/parity-ethereum/pull/8589))
|
||||
- Print warnings when fetching pending blocks ([#8711](https://github.com/paritytech/parity-ethereum/pull/8711))
|
||||
- Fix PoW blockchains sealing notifications in chain_new_blocks ([#8656](https://github.com/paritytech/parity-ethereum/pull/8656))
|
||||
- Remove -k/--insecure option from curl installer ([#8719](https://github.com/paritytech/parity-ethereum/pull/8719))
|
||||
- Ease tiny-keccak version requirements (1.4.1 -> 1.4) ([#8726](https://github.com/paritytech/parity-ethereum/pull/8726))
|
||||
- Bump tinykeccak to 1.4 ([#8728](https://github.com/paritytech/parity-ethereum/pull/8728))
|
||||
- Remove a couple of unnecessary `transmute()` ([#8736](https://github.com/paritytech/parity-ethereum/pull/8736))
|
||||
- Fix some nits using clippy ([#8731](https://github.com/paritytech/parity-ethereum/pull/8731))
|
||||
- Add 'interface' option to cli ([#8699](https://github.com/paritytech/parity-ethereum/pull/8699))
|
||||
- Remove unused function new_pow_test_spec ([#8735](https://github.com/paritytech/parity-ethereum/pull/8735))
|
||||
- Add a deadlock detection thread ([#8727](https://github.com/paritytech/parity-ethereum/pull/8727))
|
||||
- Fix local transactions policy. ([#8691](https://github.com/paritytech/parity-ethereum/pull/8691))
|
||||
- Shutdown the Snapshot Service early ([#8658](https://github.com/paritytech/parity-ethereum/pull/8658))
|
||||
- Network-devp2p: handle UselessPeer disconnect ([#8686](https://github.com/paritytech/parity-ethereum/pull/8686))
|
||||
- Fix compilation error on nightly rust ([#8707](https://github.com/paritytech/parity-ethereum/pull/8707))
|
||||
- Add a test for decoding corrupt data ([#8713](https://github.com/paritytech/parity-ethereum/pull/8713))
|
||||
- Update dev chain ([#8717](https://github.com/paritytech/parity-ethereum/pull/8717))
|
||||
- Remove unused imports ([#8722](https://github.com/paritytech/parity-ethereum/pull/8722))
|
||||
- Implement recursive Debug for Nodes in patrica_trie::TrieDB ([#8697](https://github.com/paritytech/parity-ethereum/pull/8697))
|
||||
- Parity: trim whitespace when parsing duration strings ([#8692](https://github.com/paritytech/parity-ethereum/pull/8692))
|
||||
- Set the request index to that of the current request ([#8683](https://github.com/paritytech/parity-ethereum/pull/8683))
|
||||
- Remove empty file ([#8705](https://github.com/paritytech/parity-ethereum/pull/8705))
|
||||
- Update mod.rs ([#8695](https://github.com/paritytech/parity-ethereum/pull/8695))
|
||||
- Use impl Future in the light client RPC helpers ([#8628](https://github.com/paritytech/parity-ethereum/pull/8628))
|
||||
- Fix cli signer ([#8682](https://github.com/paritytech/parity-ethereum/pull/8682))
|
||||
- Allow making direct RPC queries from the C API ([#8588](https://github.com/paritytech/parity-ethereum/pull/8588))
|
||||
- Remove the error when stopping the network ([#8671](https://github.com/paritytech/parity-ethereum/pull/8671))
|
||||
- Move connection_filter to the network crate ([#8674](https://github.com/paritytech/parity-ethereum/pull/8674))
|
||||
- Remove HostInfo::client_version() and secret() ([#8677](https://github.com/paritytech/parity-ethereum/pull/8677))
|
||||
- Refactor EIP150, EIP160 and EIP161 forks to be specified in CommonParams ([#8614](https://github.com/paritytech/parity-ethereum/pull/8614))
|
||||
- Parity: improve cli help and logging ([#8665](https://github.com/paritytech/parity-ethereum/pull/8665))
|
||||
- Updated tiny-keccak to 1.4.2 ([#8669](https://github.com/paritytech/parity-ethereum/pull/8669))
|
||||
- Remove the Keccak C library and use the pure Rust impl ([#8657](https://github.com/paritytech/parity-ethereum/pull/8657))
|
||||
- Remove HostInfo::next_nonce ([#8644](https://github.com/paritytech/parity-ethereum/pull/8644))
|
||||
- Fix not downloading old blocks ([#8642](https://github.com/paritytech/parity-ethereum/pull/8642))
|
||||
- Resumable warp-sync / Seed downloaded snapshots ([#8544](https://github.com/paritytech/parity-ethereum/pull/8544))
|
||||
- Don't open Browser post-install on Mac ([#8641](https://github.com/paritytech/parity-ethereum/pull/8641))
|
||||
- Changelog for 1.10.4-stable and 1.11.1-beta ([#8637](https://github.com/paritytech/parity-ethereum/pull/8637))
|
||||
- Typo ([#8640](https://github.com/paritytech/parity-ethereum/pull/8640))
|
||||
- Fork choice and metadata framework for Engine ([#8401](https://github.com/paritytech/parity-ethereum/pull/8401))
|
||||
- Check that the Android build doesn't dep on c++_shared ([#8538](https://github.com/paritytech/parity-ethereum/pull/8538))
|
||||
- Remove NetworkContext::io_channel() ([#8625](https://github.com/paritytech/parity-ethereum/pull/8625))
|
||||
- Fix light sync with initial validator-set contract ([#8528](https://github.com/paritytech/parity-ethereum/pull/8528))
|
||||
- Store morden db and keys in "path/to/parity/data/Morden" (ropsten uses "test", like before) ([#8621](https://github.com/paritytech/parity-ethereum/pull/8621))
|
||||
- ´main.rs´ typo ([#8629](https://github.com/paritytech/parity-ethereum/pull/8629))
|
||||
- Fix BlockReward contract "arithmetic operation overflow" ([#8611](https://github.com/paritytech/parity-ethereum/pull/8611))
|
||||
- Gitlab test script fixes ([#8573](https://github.com/paritytech/parity-ethereum/pull/8573))
|
||||
- Remove manually added text to the errors ([#8595](https://github.com/paritytech/parity-ethereum/pull/8595))
|
||||
- Fix account list double 0x display ([#8596](https://github.com/paritytech/parity-ethereum/pull/8596))
|
||||
- Typo: wrong indentation in kovan config ([#8610](https://github.com/paritytech/parity-ethereum/pull/8610))
|
||||
- Fix packet count when talking with PAR2 peers ([#8555](https://github.com/paritytech/parity-ethereum/pull/8555))
|
||||
- Use full qualified syntax for itertools::Itertools::flatten ([#8606](https://github.com/paritytech/parity-ethereum/pull/8606))
|
||||
- 2 tiny modification on snapshot ([#8601](https://github.com/paritytech/parity-ethereum/pull/8601))
|
||||
- Fix the mio test again ([#8602](https://github.com/paritytech/parity-ethereum/pull/8602))
|
||||
- Remove inject.js server-side injection for dapps ([#8539](https://github.com/paritytech/parity-ethereum/pull/8539))
|
||||
- Block_header can fail so return Result ([#8581](https://github.com/paritytech/parity-ethereum/pull/8581))
|
||||
- Block::decode() returns Result ([#8586](https://github.com/paritytech/parity-ethereum/pull/8586))
|
||||
- Fix compiler warning ([#8590](https://github.com/paritytech/parity-ethereum/pull/8590))
|
||||
- Fix Parity UI link ([#8600](https://github.com/paritytech/parity-ethereum/pull/8600))
|
||||
- Make mio optional in ethcore-io ([#8537](https://github.com/paritytech/parity-ethereum/pull/8537))
|
||||
- Attempt to fix intermittent test failures ([#8584](https://github.com/paritytech/parity-ethereum/pull/8584))
|
||||
- Changelog and Readme ([#8591](https://github.com/paritytech/parity-ethereum/pull/8591))
|
||||
- Added Dockerfile for alpine linux by @andresilva, closes [#3565](https://github.com/paritytech/parity-ethereum/issues/3565) ([#8587](https://github.com/paritytech/parity-ethereum/pull/8587))
|
||||
- Add whisper CLI to the pipelines ([#8578](https://github.com/paritytech/parity-ethereum/pull/8578))
|
||||
- Rename `whisper-cli binary` to `whisper` ([#8579](https://github.com/paritytech/parity-ethereum/pull/8579))
|
||||
- Changelog nit ([#8585](https://github.com/paritytech/parity-ethereum/pull/8585))
|
||||
- Remove unnecessary cloning in overwrite_with ([#8580](https://github.com/paritytech/parity-ethereum/pull/8580))
|
||||
- Handle socket address parsing errors ([#8545](https://github.com/paritytech/parity-ethereum/pull/8545))
|
||||
- Update CHANGELOG for 1.9, 1.10, and 1.11 ([#8556](https://github.com/paritytech/parity-ethereum/pull/8556))
|
||||
- Decoding headers can fail ([#8570](https://github.com/paritytech/parity-ethereum/pull/8570))
|
||||
- Refactoring `ethcore-sync` - Fixing warp-sync barrier ([#8543](https://github.com/paritytech/parity-ethereum/pull/8543))
|
||||
- Remove State::replace_backend ([#8569](https://github.com/paritytech/parity-ethereum/pull/8569))
|
||||
- Make trace-time publishable. ([#8568](https://github.com/paritytech/parity-ethereum/pull/8568))
|
||||
- Don't block sync when importing old blocks ([#8530](https://github.com/paritytech/parity-ethereum/pull/8530))
|
||||
- Trace precompiled contracts when the transfer value is not zero ([#8486](https://github.com/paritytech/parity-ethereum/pull/8486))
|
||||
- Parity as a library ([#8412](https://github.com/paritytech/parity-ethereum/pull/8412))
|
||||
- Rlp decode returns Result ([#8527](https://github.com/paritytech/parity-ethereum/pull/8527))
|
||||
- Node table sorting according to last contact data ([#8541](https://github.com/paritytech/parity-ethereum/pull/8541))
|
||||
- Keep all enacted blocks notify in order ([#8524](https://github.com/paritytech/parity-ethereum/pull/8524))
|
||||
- Ethcore, rpc, machine: refactor block reward application and tracing ([#8490](https://github.com/paritytech/parity-ethereum/pull/8490))
|
||||
- Consolidate crypto functionality in `ethcore-crypto`. ([#8432](https://github.com/paritytech/parity-ethereum/pull/8432))
|
||||
- Eip 145: Bitwise shifting instructions in EVM ([#8451](https://github.com/paritytech/parity-ethereum/pull/8451))
|
||||
- Remove expect ([#8536](https://github.com/paritytech/parity-ethereum/pull/8536))
|
||||
- Don't panic in import_block if invalid rlp ([#8522](https://github.com/paritytech/parity-ethereum/pull/8522))
|
||||
- Pass on storage keys tracing to handle the case when it is not modified ([#8491](https://github.com/paritytech/parity-ethereum/pull/8491))
|
||||
- Fetching logs by hash in blockchain database ([#8463](https://github.com/paritytech/parity-ethereum/pull/8463))
|
||||
- Transaction Pool improvements ([#8470](https://github.com/paritytech/parity-ethereum/pull/8470))
|
||||
- More changes for Android ([#8421](https://github.com/paritytech/parity-ethereum/pull/8421))
|
||||
- Enable WebAssembly and Byzantium for Ellaism ([#8520](https://github.com/paritytech/parity-ethereum/pull/8520))
|
||||
- Secretstore: merge two types of errors into single one + Error::is_non_fatal ([#8357](https://github.com/paritytech/parity-ethereum/pull/8357))
|
||||
- Hardware Wallet trait ([#8071](https://github.com/paritytech/parity-ethereum/pull/8071))
|
||||
- Directly return None if tracing is disabled ([#8504](https://github.com/paritytech/parity-ethereum/pull/8504))
|
||||
- Show imported messages for light client ([#8517](https://github.com/paritytech/parity-ethereum/pull/8517))
|
||||
- Remove unused dependency `bigint` ([#8505](https://github.com/paritytech/parity-ethereum/pull/8505))
|
||||
- `duration_ns: u64 -> duration: Duration` ([#8457](https://github.com/paritytech/parity-ethereum/pull/8457))
|
||||
- Return error if RLP size of transaction exceeds the limit ([#8473](https://github.com/paritytech/parity-ethereum/pull/8473))
|
||||
- Remove three old warp boot nodes. ([#8497](https://github.com/paritytech/parity-ethereum/pull/8497))
|
||||
- Update wasmi and pwasm-utils ([#8493](https://github.com/paritytech/parity-ethereum/pull/8493))
|
||||
- Update hardcodedSync for Ethereum, Kovan, and Ropsten ([#8489](https://github.com/paritytech/parity-ethereum/pull/8489))
|
||||
- Fix snap builds ([#8483](https://github.com/paritytech/parity-ethereum/pull/8483))
|
||||
- Bump master to 1.12 ([#8477](https://github.com/paritytech/parity-ethereum/pull/8477))
|
||||
- Don't require write lock when fetching status. ([#8481](https://github.com/paritytech/parity-ethereum/pull/8481))
|
||||
- Use rename_all for RichBlock and RichHeader serialization ([#8471](https://github.com/paritytech/parity-ethereum/pull/8471))
|
||||
- Bump beta to 1.11.5 / Backports ([#8955](https://github.com/paritytech/parity/pull/8955))
|
||||
- Parity-version: bump beta to 1.11.5
|
||||
- Update ropsten.json ([#8926](https://github.com/paritytech/parity/pull/8926))
|
||||
- Update hardcoded headers ([#8925](https://github.com/paritytech/parity/pull/8925))
|
||||
- Update kovan.json
|
||||
- Update Kovan to block 7693549
|
||||
- Update foundation.json
|
||||
- Updated to block 5812225
|
||||
- Update ropsten.json
|
||||
- Update to 3465217
|
||||
- Scripts: minor improvements ([#8930](https://github.com/paritytech/parity/pull/8930))
|
||||
- CI: enable 'latest' docker tag on master pipeline
|
||||
- CI: mark both beta and stable as stable snap.
|
||||
- CI: sign all windows binaries
|
||||
- Scripts: fix docker build tag on latest using master ([#8952](https://github.com/paritytech/parity/pull/8952))
|
||||
- Rpc: cap gas limit of local calls ([#8943](https://github.com/paritytech/parity/pull/8943))
|
||||
- Snap: downgrade rust to revision 1.26.2, ref snapcraft/+bug/1778530 ([#8984](https://github.com/paritytech/parity/pull/8984))
|
||||
- Snap: downgrade rust to revision 1.26.2, ref snapcraft/+bug/1778530
|
||||
- Snap: use plugin rust
|
||||
- Fix deadlock in blockchain. ([#8977](https://github.com/paritytech/parity/pull/8977))
|
||||
- Remove js-glue from workspace
|
||||
- This fixes test error on Rust 1.27 but also prevents js-glue from building itself.
|
||||
- Builtin dapp users can still use js-glue from crates.io.
|
||||
- Fix Android build on beta ([#9003](https://github.com/paritytech/parity/pull/9003))
|
||||
|
||||
## Parity [v1.11.4](https://github.com/paritytech/parity/releases/tag/v1.11.4) (2018-06-20)
|
||||
|
||||
Parity 1.11.4 is a bug-fix release to improve performance and stability.
|
||||
|
||||
The full list of included changes:
|
||||
|
||||
- Backports ([#8916](https://github.com/paritytech/parity/pull/8916))
|
||||
- `Duration_ns: u64 -> duration: Duration` ([#8457](https://github.com/paritytech/parity/pull/8457))
|
||||
- Duration_ns: u64 -> duration: Duration
|
||||
- Format on millis {:.2} -> {}
|
||||
- Keep all enacted blocks notify in order ([#8524](https://github.com/paritytech/parity/pull/8524))
|
||||
- Keep all enacted blocks notify in order
|
||||
- Collect is unnecessary
|
||||
- Update ChainNotify to use ChainRouteType
|
||||
- Fix all ethcore fn defs
|
||||
- Wrap the type within ChainRoute
|
||||
- Fix private-tx and sync api
|
||||
- Fix secret_store API
|
||||
- Fix updater API
|
||||
- Fix rpc api
|
||||
- Fix informant api
|
||||
- Eagerly cache enacted/retracted and remove contain_enacted/retracted
|
||||
- Fix indent
|
||||
- Tests: should use full expr form for struct constructor
|
||||
- Use into_enacted_retracted to further avoid copy
|
||||
- Typo: not a function
|
||||
- Rpc/tests: ChainRoute -> ChainRoute::new
|
||||
- Handle removed logs in filter changes and add geth compatibility field ([#8796](https://github.com/paritytech/parity/pull/8796))
|
||||
- Add removed geth compatibility field in log
|
||||
- Fix mocked tests
|
||||
- Add field block hash in PollFilter
|
||||
- Store last block hash info for log filters
|
||||
- Implement canon route
|
||||
- Use canon logs for fetching reorg logs
|
||||
- Make sure removed flag is set
|
||||
- Address grumbles
|
||||
- Fixed AuthorityRound deadlock on shutdown, closes [#8088](https://github.com/paritytech/parity/issues/8088) ([#8803](https://github.com/paritytech/parity/pull/8803))
|
||||
- Ci: Fix docker tags ([#8822](https://github.com/paritytech/parity/pull/8822))
|
||||
- Scripts: enable docker builds for beta and stable
|
||||
- Scripts: docker latest should be beta not master
|
||||
- Scripts: docker latest is master
|
||||
- Ethcore: fix ancient block error msg handling ([#8832](https://github.com/paritytech/parity/pull/8832))
|
||||
- Disable parallel verification and skip verifiying already imported txs. ([#8834](https://github.com/paritytech/parity/pull/8834))
|
||||
- Reject transactions that are already in pool without verifying them.
|
||||
- Avoid verifying already imported transactions.
|
||||
- Fix concurrent access to signer queue ([#8854](https://github.com/paritytech/parity/pull/8854))
|
||||
- Fix concurrent access to signer queue
|
||||
- Put request back to the queue if confirmation failed
|
||||
- Typo: fix docs and rename functions to be more specific
|
||||
- Change trace info "Transaction" -> "Request"
|
||||
- Don't allocate in expect_valid_rlp unless necessary ([#8867](https://github.com/paritytech/parity/pull/8867))
|
||||
- Don't allocate via format! in case there's no error
|
||||
- Fix test?
|
||||
- Fixed ipc leak, closes [#8774](https://github.com/paritytech/parity/issues/8774) ([#8876](https://github.com/paritytech/parity/pull/8876))
|
||||
- Add new ovh bootnodes and fix port for foundation bootnode 3.2 ([#8886](https://github.com/paritytech/parity/pull/8886))
|
||||
- Add new ovh bootnodes and fix port for foundation bootnode 3.2
|
||||
- Remove old bootnodes.
|
||||
- Remove duplicate 1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082
|
||||
- Block 0 is valid in queries ([#8891](https://github.com/paritytech/parity/pull/8891))
|
||||
- Add ETC Cooperative-run load balanced parity node ([#8892](https://github.com/paritytech/parity/pull/8892))
|
||||
- Minor fix in chain supplier and light provider ([#8906](https://github.com/paritytech/parity/pull/8906))
|
||||
- Fix chain supplier increment
|
||||
- Fix light provider block_headers
|
||||
- Check whether we need resealing in miner and unwrap has_account in account_provider ([#8853](https://github.com/paritytech/parity/pull/8853))
|
||||
- Remove unused Result wrap in has_account
|
||||
- Check whether we need to reseal for external transactions
|
||||
- Fix reference to has_account interface
|
||||
- Typo: missing )
|
||||
- Refactor duplicates to prepare_and_update_sealing
|
||||
- Fix build
|
||||
- Allow disabling local-by-default for transactions with new config entry ([#8882](https://github.com/paritytech/parity/pull/8882))
|
||||
- Add tx_queue_allow_unknown_local config option
|
||||
- Refactor flag name + don't change import_own_tx behaviour
|
||||
- Add fn to TestMinerService
|
||||
- Avoid race condition from trusted sources
|
||||
- Parity-version: beta release 1.11.4 ([#8856](https://github.com/paritytech/parity/pull/8856))
|
||||
- Cherry-pick network-specific release flag ([#8821](https://github.com/paritytech/parity/pull/8821))
|
||||
- Parity-version: bump beta to 1.11.4
|
||||
- Parity-version: remove merge leftovers
|
||||
|
||||
## Parity [v1.11.3](https://github.com/paritytech/parity/releases/tag/v1.11.3) (2018-06-06)
|
||||
|
||||
Parity 1.11.3 is a security-relevant release. Please upgrade your nodes as soon as possible to [v1.10.6](https://github.com/paritytech/parity/releases/tag/v1.10.6) or [v1.11.3](https://github.com/paritytech/parity/releases/tag/v1.11.3).
|
||||
|
||||
The full list of included changes:
|
||||
|
||||
- Parity-version: bump beta to 1.11.3 ([#8806](https://github.com/paritytech/parity/pull/8806))
|
||||
- Parity-version: bump beta to 1.11.3
|
||||
- Disallow unsigned transactions in case EIP-86 is disabled ([#8802](https://github.com/paritytech/parity/pull/8802))
|
||||
- Fix ancient blocks queue deadlock ([#8751](https://github.com/paritytech/parity/pull/8751))
|
||||
- Update shell32-sys to fix windows build ([#8792](https://github.com/paritytech/parity/pull/8792))
|
||||
- Backports ([#8785](https://github.com/paritytech/parity/pull/8785))
|
||||
- Fix light sync with initial validator-set contract ([#8528](https://github.com/paritytech/parity/pull/8528))
|
||||
- Fix #8468
|
||||
- Use U256::max_value() instead
|
||||
- Also change initial transaction gas
|
||||
- Resumable warp-sync / Seed downloaded snapshots ([#8544](https://github.com/paritytech/parity/pull/8544))
|
||||
- Start dividing sync chain : first supplier method
|
||||
- WIP - updated chain sync supplier
|
||||
- Finish refactoring the Chain Sync Supplier
|
||||
- Create Chain Sync Requester
|
||||
- Add Propagator for Chain Sync
|
||||
- Add the Chain Sync Handler
|
||||
- Move tests from mod -> handler
|
||||
- Move tests to propagator
|
||||
- Refactor SyncRequester arguments
|
||||
- Refactoring peer fork header handler
|
||||
- Fix wrong highest block number in snapshot sync
|
||||
- Small refactor...
|
||||
- Resume warp-sync downloaded chunks
|
||||
- Refactoring the previous chunks import
|
||||
- Address PR grumbles
|
||||
- Fix not seeding current snapshot
|
||||
- Update SnapshotService readiness check
|
||||
- Early abort importing previous chunks
|
||||
- Update Gitlab CI config
|
||||
- SyncState back to Waiting when Manifest peers disconnect
|
||||
- Revert GitLab CI changes
|
||||
- Refactor resuming snapshots
|
||||
- Revert "Refactor resuming snapshots"
|
||||
- Update informant log
|
||||
- Refactor resuming snapshots
|
||||
- Update informant message : show chunks done
|
||||
- Don't open Browser post-install on Mac ([#8641](https://github.com/paritytech/parity/pull/8641))
|
||||
- Fix not downloading old blocks ([#8642](https://github.com/paritytech/parity/pull/8642))
|
||||
- Fix PoW blockchains sealing notifications in chain_new_blocks ([#8656](https://github.com/paritytech/parity/pull/8656))
|
||||
- Shutdown the Snapshot Service early ([#8658](https://github.com/paritytech/parity/pull/8658))
|
||||
- Shutdown the Snapshot Service when shutting down the runner
|
||||
- Rename `service` to `client_service`
|
||||
- Fix tests
|
||||
- Fix cli signer ([#8682](https://github.com/paritytech/parity/pull/8682))
|
||||
- Update ethereum-types so `{:#x}` applies 0x prefix
|
||||
- Set the request index to that of the current request ([#8683](https://github.com/paritytech/parity/pull/8683))
|
||||
- Set the request index to that of the current request
|
||||
- Network-devp2p: handle UselessPeer disconnect ([#8686](https://github.com/paritytech/parity/pull/8686))
|
||||
- Fix local transactions policy. ([#8691](https://github.com/paritytech/parity/pull/8691))
|
||||
- CI: Fixes for Android Pipeline ([#8745](https://github.com/paritytech/parity/pull/8745))
|
||||
- Ci: Remove check for shared libraries in gitlab script
|
||||
- Ci: allow android arm build to fail
|
||||
- Custom Error Messages on ENFILE and EMFILE IO Errors ([#8744](https://github.com/paritytech/parity/pull/8744))
|
||||
- Custom Error Messages on ENFILE and EMFILE IO Errors
|
||||
- Use assert-matches for more readable tests
|
||||
- Fix Wording and consistency
|
||||
- Ethcore-sync: fix connection to peers behind chain fork block ([#8710](https://github.com/paritytech/parity/pull/8710))
|
||||
- Parity-version: bump beta to 1.11.2 ([#8750](https://github.com/paritytech/parity/pull/8750))
|
||||
- Parity-version: bump beta to 1.11.2
|
||||
- Parity-version: unset critical flag
|
||||
|
||||
## Parity [v1.11.1](https://github.com/paritytech/parity/releases/tag/v1.11.1) (2018-05-15)
|
||||
|
||||
This is the Parity 1.11.1-beta release! Hurray!
|
||||
|
||||
Notable changes in reversed alphabetical order:
|
||||
|
||||
- TOOLING: **Whisper CLI** [#8201](https://github.com/paritytech/parity/pull/8201)
|
||||
- `whisper-cli` is a standalone tool to communicate with the Whisper protocol.
|
||||
- It provides functionality to specify `whisper-pool-size`, `port` and `address` to use.
|
||||
- All whisper RPC APIs are enabled and can be directly accessed.
|
||||
- JSON-RPC API: **Return error in case eth_call returns VM errors** [#8448](https://github.com/paritytech/parity/pull/8448)
|
||||
- This changes the behaviors of `eth_call` to respect VM errors if any.
|
||||
- In case of `REVERT`, it will also return the reverted return data in hex format.
|
||||
- ENGINES: **Block Reward Contract** [#8419](https://github.com/paritytech/parity/pull/8419)
|
||||
- The _AuRa_ PoA engine has now support for having a contract to calculate the block rewards.
|
||||
- The engine passes a list of benefactors and reward types to the contract which then returns a list of addresses and respective rewards.
|
||||
- CORE: **Private Transactions** [#6422](https://github.com/paritytech/parity/pull/6422)
|
||||
- Parity now provides a private transactions system.
|
||||
- Please, check out our wiki to get an [overview and setup instructions](https://wiki.parity.io/Private-Transactions.html).
|
||||
- CORE: **New Transaction Queue implementation** [#8074](https://github.com/paritytech/parity/pull/8074)
|
||||
- Verification is now done in parallel.
|
||||
- Previous queue had `O(1)` time to get pending set, but `O(n^2)` insertion time. And obviously insertion/removal happens much more often than retrieving the pending set (only for propagation and pending block building) Currently we have `O(n * log(senders))` pending set time (with cache) and `O(tx_per_sender)` (usually within `log(tx_per_sender)`) insertion time.
|
||||
- `Scoring` and `Readiness` are separated from the pool, so it's easier to customize them or introduce different definitions (for instance for [EIP-859](https://github.com/ethereum/EIPs/issues/859) or private transactions, etc).
|
||||
- Banning removed, soft-penalization introduced instead: if transaction exceeds the limit other transactions from that sender get lower priority.
|
||||
- There is no explicit distinction between current and future transactions in the pool - `Readiness` determines that. Because of this we additionally remove `future` transactions that occupy the pool for long time.
|
||||
- CONFIGURATION: **Warp-only sync with --warp-barrier [block-number] flag.** [#8228](https://github.com/paritytech/parity/pull/8228)
|
||||
- Enables warp-only sync in case `--warp-barrier [block-number]` is provided.
|
||||
- This avoids clients to warp to outdated snapshots that are too far away from the best block.
|
||||
- This avoids clients to fall back to normal sync if there are no recent snapshots available currently.
|
||||
- CONFIGURATION: **Disable UI by default.** [#8105](https://github.com/paritytech/parity/pull/8105)
|
||||
- The user interface is now disabled by default. It still can be activated with the `--force-ui` flag.
|
||||
- To get the stand-alone Parity UI, please check the dedicated [releases page](https://github.com/parity-js/shell/releases).
|
||||
- CONFIGURATION: **Auto-updater improvements** [#8078](https://github.com/paritytech/parity/pull/8078)
|
||||
- Added `--auto-update-delay` to randomly delay updates by `n` blocks. This takes into account the number of the block of the update release (old updates aren't delayed).
|
||||
- Added `--auto-update-check-frequency` to define the periodicity of auto-update checks in number of blocks.
|
||||
- This is an important improvement to ensure the network does not update all clients at the same time.
|
||||
- CHAIN SPECS: **Enable WebAssembly and Byzantium for Ellaism** [#8520](https://github.com/paritytech/parity/pull/8520)
|
||||
- This activates the Ellaism Byzantium hardfork ([2018-0004-byzantium](https://github.com/ellaism/specs/blob/master/specs/2018-0004-byzantium.md)) at block `2_000_000`.
|
||||
- This enables the Wasm VM on Ellaism ([2018-0003-wasm-hardfork](https://github.com/ellaism/specs/blob/master/specs/2018-0003-wasm-hardfork.md)) at block `2_000_000`.
|
||||
- Please, upgrade your clients if you run an Ellaism configuration.
|
||||
- CHAIN SPECS: **Dev chain - increase gasLimit to 8_000_000** [#8362](https://github.com/paritytech/parity/pull/8362)
|
||||
- This increases the default block gas limit on development chains to `8_000_000`.
|
||||
- Please note, this makes previous dev chain configurations incompatible.
|
||||
- CHAIN SPECS: **Add MCIP-6 Byzyantium transition to Musicoin spec** [#7841](https://github.com/paritytech/parity/pull/7841)
|
||||
- This activates the Musicoin Byzantium hardfork ([MCIP-6](https://github.com/Musicoin/MCIPs/blob/master/MCIPS/mcip-6.md)) at block `2_222_222`.
|
||||
- Please, upgrade your clients if you run a Musicoin configuration.
|
||||
|
||||
The full list of included changes:
|
||||
|
||||
- Backports ([#8624](https://github.com/paritytech/parity/pull/8624))
|
||||
- Trace precompiled contracts when the transfer value is not zero ([#8486](https://github.com/paritytech/parity/pull/8486))
|
||||
- Trace precompiled contracts when the transfer value is not zero
|
||||
- Add tests for precompiled CALL tracing
|
||||
- Use byzantium test machine for the new test
|
||||
- Add notes in comments on why we don't trace all precompiles
|
||||
- Use is_transferred instead of transferred
|
||||
- Return error if RLP size of transaction exceeds the limit ([#8473](https://github.com/paritytech/parity/pull/8473))
|
||||
- Return error if RLP size of transaction exceeds the limit
|
||||
- Review comments fixed
|
||||
- RLP check moved to verifier, corresponding pool test added
|
||||
- Don't block sync when importing old blocks ([#8530](https://github.com/paritytech/parity/pull/8530))
|
||||
- Alter IO queueing.
|
||||
- Don't require IoMessages to be Clone
|
||||
- Ancient blocks imported via IoChannel.
|
||||
- Get rid of private transactions io message.
|
||||
- Get rid of deadlock and fix disconnected handler.
|
||||
- Revert to old disconnect condition.
|
||||
- Fix tests.
|
||||
- Fix deadlock.
|
||||
- Refactoring `ethcore-sync` - Fixing warp-sync barrier ([#8543](https://github.com/paritytech/parity/pull/8543))
|
||||
- Start dividing sync chain : first supplier method
|
||||
- WIP - updated chain sync supplier
|
||||
- Finish refactoring the Chain Sync Supplier
|
||||
- Create Chain Sync Requester
|
||||
- Add Propagator for Chain Sync
|
||||
- Add the Chain Sync Handler
|
||||
- Move tests from mod -> handler
|
||||
- Move tests to propagator
|
||||
- Refactor SyncRequester arguments
|
||||
- Refactoring peer fork header handler
|
||||
- Fix wrong highest block number in snapshot sync
|
||||
- Small refactor...
|
||||
- Address PR grumbles
|
||||
- Retry failed CI job
|
||||
- Fix tests
|
||||
- PR Grumbles
|
||||
- Handle socket address parsing errors ([#8545](https://github.com/paritytech/parity/pull/8545))
|
||||
- Fix packet count when talking with PAR2 peers ([#8555](https://github.com/paritytech/parity/pull/8555))
|
||||
- Support diferent packet counts in different protocol versions.
|
||||
- Fix light timeouts and eclipse protection.
|
||||
- Fix devp2p tests.
|
||||
- Fix whisper-cli compilation.
|
||||
- Fix compilation.
|
||||
- Fix ethcore-sync tests.
|
||||
- Revert "Fix light timeouts and eclipse protection."
|
||||
- Increase timeouts.
|
||||
- Add whisper CLI to the pipelines ([#8578](https://github.com/paritytech/parity/pull/8578))
|
||||
- Add whisper CLI to the pipelines
|
||||
- Address todo, ref [#8579](https://github.com/paritytech/parity/pull/8579)
|
||||
- Rename `whisper-cli binary` to `whisper` ([#8579](https://github.com/paritytech/parity/pull/8579))
|
||||
- Rename whisper-cli binary to whisper
|
||||
- Fix tests
|
||||
- Remove manually added text to the errors ([#8595](https://github.com/paritytech/parity/pull/8595))
|
||||
- Fix account list double 0x display ([#8596](https://github.com/paritytech/parity/pull/8596))
|
||||
- Remove unused self import
|
||||
- Fix account list double 0x display
|
||||
- Fix BlockReward contract "arithmetic operation overflow" ([#8611](https://github.com/paritytech/parity/pull/8611))
|
||||
- Fix BlockReward contract "arithmetic operation overflow"
|
||||
- Add docs on how execute_as_system works
|
||||
- Fix typo
|
||||
- Rlp decode returns Result ([#8527](https://github.com/paritytech/parity/pull/8527))
|
||||
- Remove expect ([#8536](https://github.com/paritytech/parity/pull/8536))
|
||||
- Remove expect and propagate rlp::DecoderErrors as TrieErrors
|
||||
- Decoding headers can fail ([#8570](https://github.com/paritytech/parity/pull/8570))
|
||||
- Rlp::decode returns Result
|
||||
- Fix journaldb to handle rlp::decode Result
|
||||
- Fix ethcore to work with rlp::decode returning Result
|
||||
- Light client handles rlp::decode returning Result
|
||||
- Fix tests in rlp_derive
|
||||
- Fix tests
|
||||
- Cleanup
|
||||
- Cleanup
|
||||
- Allow panic rather than breaking out of iterator
|
||||
- Let decoding failures when reading from disk blow up
|
||||
- Syntax
|
||||
- Fix the trivial grumbles
|
||||
- Fix failing tests
|
||||
- Make Account::from_rlp return Result
|
||||
- Syntx, sigh
|
||||
- Temp-fix for decoding failures
|
||||
- Header::decode returns Result
|
||||
- Do not continue reading from the DB when a value could not be read
|
||||
- Fix tests
|
||||
- Handle header decoding in light_sync
|
||||
- Handling header decoding errors
|
||||
- Let the DecodeError bubble up unchanged
|
||||
- Remove redundant error conversion
|
||||
- Fix compiler warning ([#8590](https://github.com/paritytech/parity/pull/8590))
|
||||
- Attempt to fix intermittent test failures ([#8584](https://github.com/paritytech/parity/pull/8584))
|
||||
- Block_header can fail so return Result ([#8581](https://github.com/paritytech/parity/pull/8581))
|
||||
- Block_header can fail so return Result
|
||||
- Restore previous return type based on feedback
|
||||
- Fix failing doc tests running on non-code
|
||||
- Block::decode() returns Result ([#8586](https://github.com/paritytech/parity/pull/8586))
|
||||
- Gitlab test script fixes ([#8573](https://github.com/paritytech/parity/pull/8573))
|
||||
- Exclude /docs from modified files.
|
||||
- Ensure all references in the working tree are available
|
||||
- Remove duplicated line from test script
|
||||
- Bump beta to 1.11.1 ([#8627](https://github.com/paritytech/parity/pull/8627))
|
||||
|
||||
## Parity [v1.11.0](https://github.com/paritytech/parity/releases/tag/v1.11.0) (2018-05-09)
|
||||
|
||||
This is the Parity 1.11.0-beta release! ~~Hurray!~~ This release has been pulled due to peering issues, please use 1.11.1-beta.
|
||||
|
||||
The full list of included changes:
|
||||
|
||||
- Backports ([#8558](https://github.com/paritytech/parity/pull/8558))
|
||||
- Fetching logs by hash in blockchain database ([#8463](https://github.com/paritytech/parity/pull/8463))
|
||||
- Fetch logs by hash in blockchain database
|
||||
- Fix tests
|
||||
- Add unit test for branch block logs fetching
|
||||
- Add docs that blocks must already be sorted
|
||||
- Handle branch block cases properly
|
||||
- typo: empty -> is_empty
|
||||
- Remove return_empty_if_none by using a closure
|
||||
- Use BTreeSet to avoid sorting again
|
||||
- Move is_canon to BlockChain
|
||||
- typo: pass value by reference
|
||||
- Use loop and wrap inside blocks to simplify the code
|
||||
- typo: missed a comment
|
||||
- Pass on storage keys tracing to handle the case when it is not modified ([#8491](https://github.com/paritytech/parity/pull/8491))
|
||||
- Pass on storage keys even if it is not modified
|
||||
- typo: account and storage query
|
||||
- Fix tests
|
||||
- Use state query directly because of suicided accounts
|
||||
- Fix a RefCell borrow issue
|
||||
- Add tests for unmodified storage trace
|
||||
- Address grumbles
|
||||
- typo: remove unwanted empty line
|
||||
- ensure_cached compiles with the original signature
|
||||
- Update wasmi and pwasm-utils ([#8493](https://github.com/paritytech/parity/pull/8493))
|
||||
- Update wasmi to 0.2
|
||||
- Update pwasm-utils to 0.1.5
|
||||
- Show imported messages for light client ([#8517](https://github.com/paritytech/parity/pull/8517))
|
||||
- Enable WebAssembly and Byzantium for Ellaism ([#8520](https://github.com/paritytech/parity/pull/8520))
|
||||
- Enable WebAssembly and Byzantium for Ellaism
|
||||
- Fix indentation
|
||||
- Remove empty lines
|
||||
- Don't panic in import_block if invalid rlp ([#8522](https://github.com/paritytech/parity/pull/8522))
|
||||
- Don't panic in import_block if invalid rlp
|
||||
- Remove redundant type annotation
|
||||
- Replace RLP header view usage with safe decoding
|
||||
- Node table sorting according to last contact data ([#8541](https://github.com/paritytech/parity/pull/8541))
|
||||
- network-devp2p: sort nodes in node table using last contact data
|
||||
- network-devp2p: rename node contact types in node table json output
|
||||
- network-devp2p: fix node table tests
|
||||
- network-devp2p: note node failure when failed to establish connection
|
||||
- network-devp2p: handle UselessPeer error
|
||||
- network-devp2p: note failure when marking node as useless
|
||||
- Betalize 1.11 :) ([#8475](https://github.com/paritytech/parity/pull/8475))
|
||||
- Betalize 1.11 :)
|
||||
- Update Gitlab scripts
|
||||
- Use master as gitlab latest
|
||||
- Fix snap builds ([#8483](https://github.com/paritytech/parity/pull/8483))
|
||||
- Update hardcodedSync for Ethereum, Kovan, and Ropsten ([#8489](https://github.com/paritytech/parity/pull/8489))
|
||||
- Fix typos in vm description comment ([#8446](https://github.com/paritytech/parity/pull/8446))
|
||||
- Add changelog for 1.9.7 and 1.10.2 ([#8460](https://github.com/paritytech/parity/pull/8460))
|
||||
- Fix docker build ([#8462](https://github.com/paritytech/parity/pull/8462))
|
||||
- Parityshell::open `Return result` ([#8377](https://github.com/paritytech/parity/pull/8377))
|
||||
- Return error in case eth_call returns VM errors ([#8448](https://github.com/paritytech/parity/pull/8448))
|
||||
- Update wasmi ([#8452](https://github.com/paritytech/parity/pull/8452))
|
||||
- Allow 32 bit pipelines to fail ([#8454](https://github.com/paritytech/parity/pull/8454))
|
||||
- Update Cargo hidapi-rs dependency ([#8447](https://github.com/paritytech/parity/pull/8447))
|
||||
- Private transactions processing error handling ([#8431](https://github.com/paritytech/parity/pull/8431))
|
||||
- Improve VM executor stack size estimation rules ([#8439](https://github.com/paritytech/parity/pull/8439))
|
||||
- Block reward contract ([#8419](https://github.com/paritytech/parity/pull/8419))
|
||||
- Permission fix ([#8441](https://github.com/paritytech/parity/pull/8441))
|
||||
- Use forked app_dirs crate for reverted Windows dir behavior ([#8438](https://github.com/paritytech/parity/pull/8438))
|
||||
- Remove From::from. ([#8390](https://github.com/paritytech/parity/pull/8390))
|
||||
- Move ethcore::Error to error_chain ([#8386](https://github.com/paritytech/parity/pull/8386))
|
||||
- Changelogs for 1.9.6 and 1.10.1 ([#8411](https://github.com/paritytech/parity/pull/8411))
|
||||
- Fix receipts stripping. ([#8414](https://github.com/paritytech/parity/pull/8414))
|
||||
- Typo, docs parity_chainId: empty string -> None ([#8434](https://github.com/paritytech/parity/pull/8434))
|
||||
- Update zip to 0.3 ([#8381](https://github.com/paritytech/parity/pull/8381))
|
||||
- Fix TODO comments ([#8413](https://github.com/paritytech/parity/pull/8413))
|
||||
- Replace legacy Rlp with UntrustedRlp and use in ethcore rlp views ([#8316](https://github.com/paritytech/parity/pull/8316))
|
||||
- Tokio-core v0.1.16 -> v0.1.17 ([#8408](https://github.com/paritytech/parity/pull/8408))
|
||||
- More code refactoring to integrate Duration ([#8322](https://github.com/paritytech/parity/pull/8322))
|
||||
- Remove Tendermint extra_info due to seal inconsistencies ([#8367](https://github.com/paritytech/parity/pull/8367))
|
||||
- Use tokio::spawn in secret_store listener and fix Uri ([#8373](https://github.com/paritytech/parity/pull/8373))
|
||||
- Unify and limit rocksdb dependency places ([#8371](https://github.com/paritytech/parity/pull/8371))
|
||||
- Clarify that windows need perl and yasm ([#8402](https://github.com/paritytech/parity/pull/8402))
|
||||
- New Transaction Queue implementation ([#8074](https://github.com/paritytech/parity/pull/8074))
|
||||
- Some tweaks to main.rs for parity as a library ([#8370](https://github.com/paritytech/parity/pull/8370))
|
||||
- Handle queue import errors a bit more gracefully ([#8385](https://github.com/paritytech/parity/pull/8385))
|
||||
- Ci: fix change detection in master builds ([#8382](https://github.com/paritytech/parity/pull/8382))
|
||||
- Fix config test by adding no-hardcodec-sync ([#8380](https://github.com/paritytech/parity/pull/8380))
|
||||
- Fixed unsafe shell call on windows ([#8372](https://github.com/paritytech/parity/pull/8372))
|
||||
- Parity uses winapi 0.3.4 ([#8366](https://github.com/paritytech/parity/pull/8366))
|
||||
- No hardcoded client name ([#8368](https://github.com/paritytech/parity/pull/8368))
|
||||
- Add `util/mem` to zero out memory on drop. ([#8356](https://github.com/paritytech/parity/pull/8356))
|
||||
- Use atty instead of isatty ([#8365](https://github.com/paritytech/parity/pull/8365))
|
||||
- Increase gasLimit to 8'000'000 ([#8362](https://github.com/paritytech/parity/pull/8362))
|
||||
- Util `fake-fetch` ([#8363](https://github.com/paritytech/parity/pull/8363))
|
||||
- Bump snappy and ring, use single rayon version, closes [#8296](https://github.com/paritytech/parity/issues/8296) ([#8364](https://github.com/paritytech/parity/pull/8364))
|
||||
- Use async hyper server in secret_store and upgrade igd ([#8359](https://github.com/paritytech/parity/pull/8359))
|
||||
- Enable UI by default, but only display deprecation notice ([#8262](https://github.com/paritytech/parity/pull/8262))
|
||||
- Ethcrypto renamed to ethcore-crypto and moved to ethcore dir ([#8340](https://github.com/paritytech/parity/pull/8340))
|
||||
- Use hyper 0.11 in ethcore-miner and improvements in parity-reactor ([#8335](https://github.com/paritytech/parity/pull/8335))
|
||||
- Ethcore-sync ([#8347](https://github.com/paritytech/parity/pull/8347))
|
||||
- Rpc, eth_filter: return error if the filter id does not exist ([#8341](https://github.com/paritytech/parity/pull/8341))
|
||||
- Ethcore-stratum crate moved to ethcore directory ([#8338](https://github.com/paritytech/parity/pull/8338))
|
||||
- Secretstore: get rid of engine.signer dependency ([#8173](https://github.com/paritytech/parity/pull/8173))
|
||||
- Whisper cli ([#8201](https://github.com/paritytech/parity/pull/8201))
|
||||
- Replace_home for password_files, reserved_peers and log_file ([#8324](https://github.com/paritytech/parity/pull/8324))
|
||||
- Add Ethereum Social support ([#8325](https://github.com/paritytech/parity/pull/8325))
|
||||
- Private transactions integration pr ([#6422](https://github.com/paritytech/parity/pull/6422))
|
||||
- Decouple rocksdb dependency from ethcore ([#8320](https://github.com/paritytech/parity/pull/8320))
|
||||
- Remove the clone operation of code_cache ([#8334](https://github.com/paritytech/parity/pull/8334))
|
||||
- Fix the JSONRPC API not running with the light client ([#8326](https://github.com/paritytech/parity/pull/8326))
|
||||
- Read registry_address from block with REQUEST_CONFIRMATIONS_REQUIRED ([#8309](https://github.com/paritytech/parity/pull/8309))
|
||||
- Tweaks and add a Dockerfile for Android ([#8036](https://github.com/paritytech/parity/pull/8036))
|
||||
- Use associated type M::Error instead of Error ([#8308](https://github.com/paritytech/parity/pull/8308))
|
||||
- Remove InvalidParentHash in favor of assert! ([#8300](https://github.com/paritytech/parity/pull/8300))
|
||||
- Bump proc macro deps ([#8310](https://github.com/paritytech/parity/pull/8310))
|
||||
- Decouple timestamp open-block-assignment/verification to Engine ([#8305](https://github.com/paritytech/parity/pull/8305))
|
||||
- Validate if gas limit is not zero ([#8307](https://github.com/paritytech/parity/pull/8307))
|
||||
- Implement Easthub chain spec ([#8295](https://github.com/paritytech/parity/pull/8295))
|
||||
- Update some dependencies ([#8285](https://github.com/paritytech/parity/pull/8285))
|
||||
- Ethcore now uses Rayon 1.0 as a dependency ([#8296](https://github.com/paritytech/parity/pull/8296)) ([#8304](https://github.com/paritytech/parity/pull/8304))
|
||||
- Upgrader `remove raw unwrap` and bump semver ([#8251](https://github.com/paritytech/parity/pull/8251))
|
||||
- Cleaner binary shutdown system ([#8284](https://github.com/paritytech/parity/pull/8284))
|
||||
- Ethcore now uses rayon to 0.9 as a dependency ([#8296](https://github.com/paritytech/parity/pull/8296)) ([#8302](https://github.com/paritytech/parity/pull/8302))
|
||||
- Include suicided accounts in state diff ([#8297](https://github.com/paritytech/parity/pull/8297))
|
||||
- Remove evmjit ([#8229](https://github.com/paritytech/parity/pull/8229))
|
||||
- Build: fix updater rand dependency in Cargo.lock ([#8298](https://github.com/paritytech/parity/pull/8298))
|
||||
- Honor --max-peers if --min-peers is not specified ([#8087](https://github.com/paritytech/parity/pull/8087))
|
||||
- Auto-updater improvements ([#8078](https://github.com/paritytech/parity/pull/8078))
|
||||
- Dapps-fetcher: calculate keccak in-flight while reading the response ([#8294](https://github.com/paritytech/parity/pull/8294))
|
||||
- Cleanup Ellaism bootnodes ([#8276](https://github.com/paritytech/parity/pull/8276))
|
||||
- Allow unsafe js eval on Parity Wallet. ([#8204](https://github.com/paritytech/parity/pull/8204))
|
||||
- Remove RefCell from Header ([#8227](https://github.com/paritytech/parity/pull/8227))
|
||||
- Typo fix: todo with no content ([#8292](https://github.com/paritytech/parity/pull/8292))
|
||||
- Revert "ci: disable link-dead-code in coverage build ([#8118](https://github.com/paritytech/parity/pull/8118))" ([#8287](https://github.com/paritytech/parity/pull/8287))
|
||||
- Bump ethabi & ethereum-types. ([#8258](https://github.com/paritytech/parity/pull/8258))
|
||||
- Allow customization of max WS connections. ([#8257](https://github.com/paritytech/parity/pull/8257))
|
||||
- Supress TemporaryInvalid verification failures. ([#8256](https://github.com/paritytech/parity/pull/8256))
|
||||
- Return null number for pending block in eth_getBlockByNumber ([#8281](https://github.com/paritytech/parity/pull/8281))
|
||||
- Use constant durations ([#8278](https://github.com/paritytech/parity/pull/8278))
|
||||
- Typo fix: Mode doc - RLP should be client ([#8283](https://github.com/paritytech/parity/pull/8283))
|
||||
- Eth_uninstallfilter should return false for non-existent filter ([#8280](https://github.com/paritytech/parity/pull/8280))
|
||||
- Update `app_dirs` to 1.2.1 ([#8268](https://github.com/paritytech/parity/pull/8268))
|
||||
- Add missing license header for runtime.rs ([#8252](https://github.com/paritytech/parity/pull/8252))
|
||||
- Warp-only sync with warp-barrier [blocknumber] flag. ([#8228](https://github.com/paritytech/parity/pull/8228))
|
||||
- Replace all Rlp usages with UntrustedRlp except for ethcore views ([#8233](https://github.com/paritytech/parity/pull/8233))
|
||||
- Add test for ethstore-cli, fixes [#8027](https://github.com/paritytech/parity/issues/8027) ([#8187](https://github.com/paritytech/parity/pull/8187))
|
||||
- Update musicoin spec in line with gmc v2.6.2 ([#8242](https://github.com/paritytech/parity/pull/8242))
|
||||
- Fixed ethcore tx_filter ([#8200](https://github.com/paritytech/parity/pull/8200))
|
||||
- Update CLI help for jsonrpc-apis, ws-apis and ipc-apis ([#8234](https://github.com/paritytech/parity/pull/8234))
|
||||
- Remove network stats ([#8225](https://github.com/paritytech/parity/pull/8225))
|
||||
- Node-filter does not use ChainNotify ([#8231](https://github.com/paritytech/parity/pull/8231))
|
||||
- Implement hardcoded sync in the light client ([#8075](https://github.com/paritytech/parity/pull/8075))
|
||||
- Update some of the dependencies for WASM ([#8223](https://github.com/paritytech/parity/pull/8223))
|
||||
- Bump wasmi version ([#8209](https://github.com/paritytech/parity/pull/8209))
|
||||
- Updated jsonrpc to point to the 1.11 branch ([#8180](https://github.com/paritytech/parity/pull/8180))
|
||||
- Change name Wallet -> UI ([#8164](https://github.com/paritytech/parity/pull/8164))
|
||||
- Introduce Parity UI ([#8202](https://github.com/paritytech/parity/pull/8202))
|
||||
- Update Changelogs ([#8175](https://github.com/paritytech/parity/pull/8175))
|
||||
- Returns number of topcis to take fr.. ([#8199](https://github.com/paritytech/parity/pull/8199))
|
||||
- Make docopt usage non-const ([#8189](https://github.com/paritytech/parity/pull/8189))
|
||||
- Avoid allocations when computing triehash. ([#8176](https://github.com/paritytech/parity/pull/8176))
|
||||
- Handle rlp decoding Result in patricia trie ([#8166](https://github.com/paritytech/parity/pull/8166))
|
||||
- Bump wasm libs ([#8171](https://github.com/paritytech/parity/pull/8171))
|
||||
- Re-enable signer, even with no UI. ([#8167](https://github.com/paritytech/parity/pull/8167))
|
||||
- Update daemonize ([#8165](https://github.com/paritytech/parity/pull/8165))
|
||||
- Some tiny modifications. ([#8163](https://github.com/paritytech/parity/pull/8163))
|
||||
- Secretstore: store key author address in db ([#7887](https://github.com/paritytech/parity/pull/7887))
|
||||
- Rename DatabaseValueView::new to from_rlp ([#8159](https://github.com/paritytech/parity/pull/8159))
|
||||
- Dapps: update parity-ui dependencies ([#8160](https://github.com/paritytech/parity/pull/8160))
|
||||
- Disable UI by default. ([#8105](https://github.com/paritytech/parity/pull/8105))
|
||||
- Fix wasmi x32 builds ([#8155](https://github.com/paritytech/parity/pull/8155))
|
||||
- Postpone Kovan hard fork ([#8137](https://github.com/paritytech/parity/pull/8137))
|
||||
- Secretstore: ability to identify requester via Public/Address ([#7886](https://github.com/paritytech/parity/pull/7886))
|
||||
- Optional dependency on secp256k1 for ethcrypto ([#8109](https://github.com/paritytech/parity/pull/8109))
|
||||
- Network: init discovery using healthy nodes ([#8061](https://github.com/paritytech/parity/pull/8061))
|
||||
- Check one step deeper if we're on release track branches ([#8134](https://github.com/paritytech/parity/pull/8134))
|
||||
- Explicitly mention pruning_history uses RAM ([#8130](https://github.com/paritytech/parity/pull/8130))
|
||||
- Remove `ethcrypto::{en,de}crypt_single_message`. ([#8126](https://github.com/paritytech/parity/pull/8126))
|
||||
- Fix typo ([#8124](https://github.com/paritytech/parity/pull/8124))
|
||||
- Secret_store: use `ecies::encrypt`/`ecies::decrypt`. ([#8125](https://github.com/paritytech/parity/pull/8125))
|
||||
- Fix comment for fn gas() in wasm/runtime ([#8122](https://github.com/paritytech/parity/pull/8122))
|
||||
- Structured rlp encoding in journaldb ([#8047](https://github.com/paritytech/parity/pull/8047))
|
||||
- Ci: disable link-dead-code in coverage build ([#8118](https://github.com/paritytech/parity/pull/8118))
|
||||
- Fix trace filter returning returning unrelated reward calls, closes [#8070](https://github.com/paritytech/parity/issues/8070) ([#8098](https://github.com/paritytech/parity/pull/8098))
|
||||
- Const time comparison ([#8113](https://github.com/paritytech/parity/pull/8113))
|
||||
- Replace reqwest with hyper ([#8099](https://github.com/paritytech/parity/pull/8099))
|
||||
- More dos protection ([#8104](https://github.com/paritytech/parity/pull/8104))
|
||||
- Remove the time dependency where possible ([#8100](https://github.com/paritytech/parity/pull/8100))
|
||||
- Fix comment for gas extern in Wasm runtime ([#8101](https://github.com/paritytech/parity/pull/8101))
|
||||
- Replace std::env::temp_dir with tempdir in tests ([#8103](https://github.com/paritytech/parity/pull/8103))
|
||||
- Fix Cargo.lock not parsable ([#8102](https://github.com/paritytech/parity/pull/8102))
|
||||
- Additional data in EVMTestClient ([#7964](https://github.com/paritytech/parity/pull/7964))
|
||||
- Update serde, serde-derive, ethabi-derive, syn, quote and rlp_derive ([#8085](https://github.com/paritytech/parity/pull/8085))
|
||||
- Ethcore-service ([#8089](https://github.com/paritytech/parity/pull/8089))
|
||||
- [contract-client] refactor ([#7978](https://github.com/paritytech/parity/pull/7978))
|
||||
- Revert removing blooms ([#8066](https://github.com/paritytech/parity/pull/8066))
|
||||
- Ethcore test::helpers cleanup ([#8086](https://github.com/paritytech/parity/pull/8086))
|
||||
- Add some dos protection ([#8084](https://github.com/paritytech/parity/pull/8084))
|
||||
- Wasm libraries bump ([#7970](https://github.com/paritytech/parity/pull/7970))
|
||||
- Echo back the message hash of a ping in the pong request ([#8042](https://github.com/paritytech/parity/pull/8042))
|
||||
- Add Kovan WASM activation blocknumber ([#8057](https://github.com/paritytech/parity/pull/8057))
|
||||
- [ethkey] Unify debug/display for Address/Public/Secret ([#8076](https://github.com/paritytech/parity/pull/8076))
|
||||
- Limit incoming connections. ([#8060](https://github.com/paritytech/parity/pull/8060))
|
||||
- Max code size on Kovan ([#8067](https://github.com/paritytech/parity/pull/8067))
|
||||
- Updater: apply exponential backoff after download failure ([#8059](https://github.com/paritytech/parity/pull/8059))
|
||||
- Make blockchain functions more idiomatic, avoid needless writes to cache_man ([#8054](https://github.com/paritytech/parity/pull/8054))
|
||||
- Make patricia-trie more idiomatic and remove redundant code ([#8056](https://github.com/paritytech/parity/pull/8056))
|
||||
- Abstract devp2p ([#8048](https://github.com/paritytech/parity/pull/8048))
|
||||
- Update refs to shell ([#8051](https://github.com/paritytech/parity/pull/8051))
|
||||
- Fix cache & snapcraft CI build ([#8052](https://github.com/paritytech/parity/pull/8052))
|
||||
- Prelude to the block module cleanup ([#8025](https://github.com/paritytech/parity/pull/8025))
|
||||
- Add MCIP-6 Byzyantium transition to Musicoin spec ([#7841](https://github.com/paritytech/parity/pull/7841))
|
||||
- Bump master to 1.11.0 ([#8021](https://github.com/paritytech/parity/pull/8021))
|
||||
- `client` refactoring ([#7038](https://github.com/paritytech/parity/pull/7038))
|
||||
- [hardware wallet] sleeping -> pollling ([#8018](https://github.com/paritytech/parity/pull/8018))
|
||||
- Fixed broken link in README ([#8012](https://github.com/paritytech/parity/pull/8012))
|
||||
- Support parity protocol. ([#8035](https://github.com/paritytech/parity/pull/8035))
|
||||
- Add changelog for 1.8.11 stable and 1.9.4 beta ([#8017](https://github.com/paritytech/parity/pull/8017))
|
||||
- Fix for verify_block_basic crashing on invalid transaction rlp ([#8032](https://github.com/paritytech/parity/pull/8032))
|
||||
- Extract the hard dependency on rocksdb from the light client ([#8034](https://github.com/paritytech/parity/pull/8034))
|
||||
- Fixed parsing ethash seals and verify_block_undordered ([#8031](https://github.com/paritytech/parity/pull/8031))
|
||||
- Fixed ethstore sign ([#8026](https://github.com/paritytech/parity/pull/8026))
|
||||
- Ci: Fix cargo cache ([#7968](https://github.com/paritytech/parity/pull/7968))
|
||||
- Update ref to new shell ([#8024](https://github.com/paritytech/parity/pull/8024))
|
||||
|
||||
## Previous releases
|
||||
|
||||
- [CHANGELOG-1.11](docs/CHANGELOG-1.11.md) (_stable_)
|
||||
- [CHANGELOG-1.10](docs/CHANGELOG-1.10.md) (EOL: 2018-07-18)
|
||||
- [CHANGELOG-1.10](docs/CHANGELOG-1.10.md) (_stable_)
|
||||
- [CHANGELOG-1.9](docs/CHANGELOG-1.9.md) (EOL: 2018-05-09)
|
||||
- [CHANGELOG-1.8](docs/CHANGELOG-1.8.md) (EOL: 2018-03-22)
|
||||
- [CHANGELOG-1.7](docs/CHANGELOG-1.7.md) (EOL: 2018-01-25)
|
||||
|
||||
2620
Cargo.lock
generated
2620
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
22
Cargo.toml
22
Cargo.toml
@@ -2,14 +2,14 @@
|
||||
description = "Parity Ethereum client"
|
||||
name = "parity-ethereum"
|
||||
# NOTE Make sure to update util/version/Cargo.toml as well
|
||||
version = "2.1.1"
|
||||
version = "2.0.3"
|
||||
license = "GPL-3.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
|
||||
[dependencies]
|
||||
blooms-db = { path = "util/blooms-db" }
|
||||
log = "0.4"
|
||||
env_logger = "0.5"
|
||||
log = "0.3"
|
||||
env_logger = "0.4"
|
||||
rustc-hex = "1.0"
|
||||
docopt = "0.8"
|
||||
clap = "2"
|
||||
@@ -33,7 +33,7 @@ fdlimit = "0.1"
|
||||
ctrlc = { git = "https://github.com/paritytech/rust-ctrlc.git" }
|
||||
jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.11" }
|
||||
ethcore = { path = "ethcore", features = ["parity"] }
|
||||
parity-bytes = "0.1"
|
||||
parity-bytes = { git = "https://github.com/paritytech/parity-common" }
|
||||
ethcore-io = { path = "util/io" }
|
||||
ethcore-light = { path = "ethcore/light" }
|
||||
ethcore-logger = { path = "logger" }
|
||||
@@ -43,10 +43,10 @@ ethcore-private-tx = { path = "ethcore/private-tx" }
|
||||
ethcore-service = { path = "ethcore/service" }
|
||||
ethcore-sync = { path = "ethcore/sync" }
|
||||
ethcore-transaction = { path = "ethcore/transaction" }
|
||||
ethereum-types = "0.4"
|
||||
ethereum-types = "0.3"
|
||||
node-filter = { path = "ethcore/node_filter" }
|
||||
ethkey = { path = "ethkey" }
|
||||
rlp = { version = "0.2.4", features = ["ethereum"] }
|
||||
rlp = { git = "https://github.com/paritytech/parity-common" }
|
||||
rpc-cli = { path = "rpc_cli" }
|
||||
parity-hash-fetch = { path = "hash-fetch" }
|
||||
parity-ipfs-api = { path = "ipfs" }
|
||||
@@ -57,13 +57,13 @@ parity-rpc-client = { path = "rpc_client" }
|
||||
parity-updater = { path = "updater" }
|
||||
parity-version = { path = "util/version" }
|
||||
parity-whisper = { path = "whisper" }
|
||||
parity-path = "0.1"
|
||||
path = { git = "https://github.com/paritytech/parity-common" }
|
||||
dir = { path = "util/dir" }
|
||||
panic_hook = { path = "util/panic_hook" }
|
||||
keccak-hash = "0.1"
|
||||
keccak-hash = { git = "https://github.com/paritytech/parity-common" }
|
||||
migration-rocksdb = { path = "util/migration-rocksdb" }
|
||||
kvdb = "0.1"
|
||||
kvdb-rocksdb = "0.1.3"
|
||||
kvdb = { git = "https://github.com/paritytech/parity-common" }
|
||||
kvdb-rocksdb = { git = "https://github.com/paritytech/parity-common" }
|
||||
journaldb = { path = "util/journaldb" }
|
||||
mem = { path = "util/mem" }
|
||||
|
||||
@@ -130,12 +130,12 @@ members = [
|
||||
"evmbin",
|
||||
"miner",
|
||||
"parity-clib",
|
||||
"transaction-pool",
|
||||
"whisper",
|
||||
"whisper/cli",
|
||||
"util/triehash-ethereum",
|
||||
"util/keccak-hasher",
|
||||
"util/patricia-trie-ethereum",
|
||||
"util/fastmap",
|
||||
]
|
||||
|
||||
[patch.crates-io]
|
||||
|
||||
151
README.md
151
README.md
@@ -1,66 +1,78 @@
|
||||

|
||||
# Parity - fast, light, and robust Ethereum client
|
||||
|
||||
## The fastest and most advanced Ethereum client.
|
||||
## [» Download the latest release «](https://github.com/paritytech/parity/releases/latest)
|
||||
|
||||
<p align="center"><strong><a href="https://github.com/paritytech/parity-ethereum/releases/latest">» Download the latest release «</a></strong></p>
|
||||
[](https://gitlab.parity.io/parity/parity/commits/master)
|
||||
[](https://codecov.io/gh/paritytech/parity)
|
||||
[](https://build.snapcraft.io/user/paritytech/parity)
|
||||
[](https://www.gnu.org/licenses/gpl-3.0.en.html)
|
||||
|
||||
<p align="center"><a href="https://gitlab.parity.io/parity/parity/commits/master" target="_blank"><img src="https://gitlab.parity.io/parity/parity/badges/master/build.svg" /></a>
|
||||
<a href="https://codecov.io/gh/paritytech/parity-ethereum" target="_blank"><img src="https://codecov.io/gh/paritytech/parity-ethereum/branch/master/graph/badge.svg" /></a>
|
||||
<a href="https://build.snapcraft.io/user/paritytech/parity" target="_blank"><img src="https://build.snapcraft.io/badge/paritytech/parity.svg" /></a>
|
||||
<a href="https://www.gnu.org/licenses/gpl-3.0.en.html" target="_blank"><img src="https://img.shields.io/badge/license-GPL%20v3-green.svg" /></a></p>
|
||||
|
||||
**Built for mission-critical use**: Miners, service providers, and exchanges need fast synchronisation and maximum uptime. Parity Ethereum provides the core infrastructure essential for speedy and reliable services.
|
||||
### Join the chat!
|
||||
|
||||
- Clean, modular codebase for easy customisation
|
||||
- Advanced CLI-based client
|
||||
- Minimal memory and storage footprint
|
||||
- Synchronise in hours, not days with Warp Sync
|
||||
- Modular for light integration into your service or product
|
||||
Get in touch with us on Gitter:
|
||||
[](https://gitter.im/paritytech/parity)
|
||||
[](https://gitter.im/paritytech/parity.js)
|
||||
[](https://gitter.im/paritytech/parity/miners)
|
||||
[](https://gitter.im/paritytech/parity-poa)
|
||||
|
||||
## Technical Overview
|
||||
Or join our community on Matrix:
|
||||
[](https://riot.im/app/#/group/+parity:matrix.parity.io)
|
||||
|
||||
Parity Ethereum's goal is to be the fastest, lightest, and most secure Ethereum client. We are developing Parity Ethereum using the sophisticated and cutting-edge **Rust programming language**. Parity Ethereum is licensed under the GPLv3 and can be used for all your Ethereum needs.
|
||||
Official website: https://parity.io | Be sure to check out [our wiki](https://wiki.parity.io) for more information.
|
||||
|
||||
By default, Parity Ethereum runs a JSON-RPC HTTP server on port `:8545` and a Web-Sockets server on port `:8546`. This is fully configurable and supports a number of APIs.
|
||||
----
|
||||
|
||||
If you run into problems while using Parity Ethereum, check out the [wiki for documentation](https://wiki.parity.io/), feel free to [file an issue in this repository](https://github.com/paritytech/parity-ethereum/issues/new), or hop on our [Gitter](https://gitter.im/paritytech/parity) or [Riot](https://riot.im/app/#/group/+parity:matrix.parity.io) chat room to ask a question. We are glad to help! **For security-critical issues**, please refer to the security policy outlined in [SECURITY.md](SECURITY.md).
|
||||
## About Parity
|
||||
|
||||
Parity Ethereum's current beta-release is 2.0. You can download it at [the releases page](https://github.com/paritytech/parity-ethereum/releases) or follow the instructions below to build from source. Please, mind the [CHANGELOG.md](CHANGELOG.md) for a list of all changes between different versions.
|
||||
Parity's goal is to be the fastest, lightest, and most secure Ethereum client. We are developing Parity using the sophisticated and cutting-edge Rust programming language. Parity is licensed under the GPLv3, and can be used for all your Ethereum needs.
|
||||
|
||||
## Build Dependencies
|
||||
From Parity Ethereum client version 1.10.0, the User Interface (UI) is accessible in a separate application called Parity UI. To keep using the UI in the browser (deprecated), [follow these steps](https://wiki.parity.io/FAQ-Basic-Operations,-Configuration,-and-Synchronization#the-parity-ui-application-isnt-working-the-way-i-want).
|
||||
|
||||
Parity Ethereum requires **Rust version 1.28.x** to build.
|
||||
By default, Parity will also run a JSONRPC server on `127.0.0.1:8545` and a websockets server on `127.0.0.1:8546`. This is fully configurable and supports a number of APIs.
|
||||
|
||||
We recommend installing Rust through [rustup](https://www.rustup.rs/). If you don't already have `rustup`, you can install it like this:
|
||||
If you run into an issue while using Parity, feel free to file one in this repository or hop on our [Gitter](https://gitter.im/paritytech/parity) or [Riot](https://riot.im/app/#/group/+parity:matrix.parity.io) chat room to ask a question. We are glad to help! **For security-critical issues**, please refer to the security policy outlined in [SECURITY.MD](SECURITY.md).
|
||||
|
||||
Parity's current beta-release is 1.11. You can download it at https://github.com/paritytech/parity/releases or follow the instructions below to build from source.
|
||||
|
||||
----
|
||||
|
||||
## Build dependencies
|
||||
|
||||
**Parity requires Rust version 1.26.0 to build**
|
||||
|
||||
We recommend installing Rust through [rustup](https://www.rustup.rs/). If you don't already have rustup, you can install it like this:
|
||||
|
||||
- Linux:
|
||||
```bash
|
||||
$ curl https://sh.rustup.rs -sSf | sh
|
||||
```
|
||||
```bash
|
||||
$ curl https://sh.rustup.rs -sSf | sh
|
||||
```
|
||||
|
||||
Parity Ethereum also requires `gcc`, `g++`, `libudev-dev`, `pkg-config`, `file`, `make`, and `cmake` packages to be installed.
|
||||
Parity also requires `gcc`, `g++`, `libssl-dev`/`openssl`, `libudev-dev`, `pkg-config`, `file` and `make` packages to be installed.
|
||||
|
||||
- OSX:
|
||||
```bash
|
||||
$ curl https://sh.rustup.rs -sSf | sh
|
||||
```
|
||||
```bash
|
||||
$ curl https://sh.rustup.rs -sSf | sh
|
||||
```
|
||||
|
||||
`clang` is required. It comes with Xcode command line tools or can be installed with homebrew.
|
||||
`clang` is required. It comes with Xcode command line tools or can be installed with homebrew.
|
||||
|
||||
- Windows
|
||||
Make sure you have Visual Studio 2015 with C++ support installed. Next, download and run the `rustup` installer from
|
||||
https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe, start "VS2015 x64 Native Tools Command Prompt", and use the following command to install and set up the `msvc` toolchain:
|
||||
Make sure you have Visual Studio 2015 with C++ support installed. Next, download and run the rustup installer from
|
||||
https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe, start "VS2015 x64 Native Tools Command Prompt", and use the following command to install and set up the msvc toolchain:
|
||||
```bash
|
||||
$ rustup default stable-x86_64-pc-windows-msvc
|
||||
$ rustup default stable-x86_64-pc-windows-msvc
|
||||
```
|
||||
|
||||
Once you have `rustup` installed, then you need to install:
|
||||
Once you have rustup installed, then you need to install:
|
||||
* [Perl](https://www.perl.org)
|
||||
* [Yasm](https://yasm.tortall.net)
|
||||
* [Yasm](http://yasm.tortall.net)
|
||||
|
||||
Make sure that these binaries are in your `PATH`. After that, you should be able to build Parity Ethereum from source.
|
||||
Make sure that these binaries are in your `PATH`. After that you should be able to build parity from source.
|
||||
|
||||
## Install from the Snapcraft Store
|
||||
----
|
||||
|
||||
## Install from the snap store
|
||||
|
||||
In any of the [supported Linux distros](https://snapcraft.io/docs/core/install):
|
||||
|
||||
@@ -68,30 +80,32 @@ In any of the [supported Linux distros](https://snapcraft.io/docs/core/install):
|
||||
sudo snap install parity
|
||||
```
|
||||
|
||||
Alternatively, if you want to contribute testing the upcoming release:
|
||||
Or, if you want to contribute testing the upcoming release:
|
||||
|
||||
```bash
|
||||
sudo snap install parity --beta
|
||||
```
|
||||
|
||||
Moreover, to test the latest code from the master branch:
|
||||
And to test the latest code landed into the master branch:
|
||||
|
||||
```bash
|
||||
sudo snap install parity --edge
|
||||
```
|
||||
|
||||
## Build from Source Code
|
||||
----
|
||||
|
||||
## Build from source
|
||||
|
||||
```bash
|
||||
# download Parity Ethereum code
|
||||
$ git clone https://github.com/paritytech/parity-ethereum
|
||||
$ cd parity-ethereum
|
||||
# download Parity code
|
||||
$ git clone https://github.com/paritytech/parity
|
||||
$ cd parity
|
||||
|
||||
# build in release mode
|
||||
$ cargo build --release --features final
|
||||
$ cargo build --release
|
||||
```
|
||||
|
||||
This produces an executable in the `./target/release` subdirectory.
|
||||
This will produce an executable in the `./target/release` subdirectory.
|
||||
|
||||
Note: if cargo fails to parse manifest try:
|
||||
|
||||
@@ -105,7 +119,7 @@ Note, when compiling a crate and you receive errors, it's in most cases your out
|
||||
$ cargo clean
|
||||
```
|
||||
|
||||
This always compiles the latest nightly builds. If you want to build stable or beta, do a
|
||||
This will always compile the latest nightly builds. If you want to build stable or beta, do a
|
||||
|
||||
```bash
|
||||
$ git checkout stable
|
||||
@@ -117,7 +131,11 @@ or
|
||||
$ git checkout beta
|
||||
```
|
||||
|
||||
## Simple One-Line Installer for Mac and Linux
|
||||
first.
|
||||
|
||||
----
|
||||
|
||||
## Simple one-line installer for Mac and Ubuntu
|
||||
|
||||
```bash
|
||||
bash <(curl https://get.parity.io -L)
|
||||
@@ -129,49 +147,22 @@ The one-line installer always defaults to the latest beta release. To install a
|
||||
bash <(curl https://get.parity.io -L) -r stable
|
||||
```
|
||||
|
||||
## Start Parity Ethereum
|
||||
## Start Parity
|
||||
|
||||
### Manually
|
||||
|
||||
To start Parity Ethereum manually, just run
|
||||
To start Parity manually, just run
|
||||
|
||||
```bash
|
||||
$ ./target/release/parity
|
||||
```
|
||||
|
||||
so Parity Ethereum begins syncing the Ethereum blockchain.
|
||||
and Parity will begin syncing the Ethereum blockchain.
|
||||
|
||||
### Using `systemd` service file
|
||||
### Using systemd service file
|
||||
|
||||
To start Parity Ethereum as a regular user using `systemd` init:
|
||||
To start Parity as a regular user using systemd init:
|
||||
|
||||
1. Copy `./scripts/parity.service` to your
|
||||
`systemd` user directory (usually `~/.config/systemd/user`).
|
||||
2. To configure Parity Ethereum, write a `/etc/parity/config.toml` config file, see [Configuring Parity Ethereum](https://paritytech.github.io/wiki/Configuring-Parity) for details.
|
||||
|
||||
## Parity Ethereum toolchain
|
||||
|
||||
In addition to the Parity Ethereum client, there are additional tools in this repository available:
|
||||
|
||||
- [evmbin](https://github.com/paritytech/parity-ethereum/blob/master/evmbin/) - EVM implementation for Parity Ethereum.
|
||||
- [ethabi](https://github.com/paritytech/ethabi) - Parity Ethereum function calls encoding.
|
||||
- [ethstore](https://github.com/paritytech/parity-ethereum/blob/master/ethstore/) - Parity Ethereum key management.
|
||||
- [ethkey](https://github.com/paritytech/parity-ethereum/blob/master/ethkey/) - Parity Ethereum keys generator.
|
||||
- [whisper](https://github.com/paritytech/parity-ethereum/blob/master/whisper/) - Implementation of Whisper-v2 PoC.
|
||||
|
||||
## Join the chat!
|
||||
|
||||
Questions? Get in touch with us on Gitter:
|
||||
[](https://gitter.im/paritytech/parity)
|
||||
[](https://gitter.im/paritytech/parity.js)
|
||||
[](https://gitter.im/paritytech/parity/miners)
|
||||
[](https://gitter.im/paritytech/parity-poa)
|
||||
|
||||
Alternatively, join our community on Matrix:
|
||||
[](https://riot.im/app/#/group/+parity:matrix.parity.io)
|
||||
|
||||
## Documentation
|
||||
|
||||
Official website: https://parity.io
|
||||
|
||||
Be sure to [check out our wiki](https://wiki.parity.io) for more information.
|
||||
systemd user directory (usually `~/.config/systemd/user`).
|
||||
2. To configure Parity, write a `/etc/parity/config.toml` config file, see [Configuring Parity](https://paritytech.github.io/wiki/Configuring-Parity) for details.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "chainspec"
|
||||
version = "0.1.0"
|
||||
authors = ["Marek Kotewicz <marek@parity.io>"]
|
||||
authors = ["debris <marek.kotewicz@gmail.com>"]
|
||||
|
||||
[dependencies]
|
||||
ethjson = { path = "../json" }
|
||||
|
||||
@@ -1,40 +1,3 @@
|
||||
## Usage
|
||||
Usage
|
||||
|
||||
```docker build -f docker/ubuntu/Dockerfile --tag ethcore/parity:branch_or_tag_name .```
|
||||
|
||||
## Usage - CentOS
|
||||
|
||||
Builds a lightweight non-root Parity docker image:
|
||||
```
|
||||
git clone https://github.com/paritytech/parity-ethereum.git
|
||||
cd parity-ethereum
|
||||
./docker/centos/build.sh
|
||||
```
|
||||
|
||||
Fully customised build:
|
||||
```
|
||||
PARITY_IMAGE_REPO=my-personal/parity \
|
||||
PARITY_BUILDER_IMAGE_TAG=build-latest \
|
||||
PARITY_RUNNER_IMAGE_TAG=centos-parity-experimental \
|
||||
./docker/centos/build.sh
|
||||
```
|
||||
|
||||
Default values:
|
||||
```
|
||||
# The image name
|
||||
PARITY_IMAGE_REPO - parity/parity
|
||||
|
||||
# The tag to be used for builder image, git commit sha will be appended
|
||||
PARITY_BUILDER_IMAGE_TAG - build
|
||||
|
||||
# The tag to be used for runner image
|
||||
PARITY_RUNNER_IMAGE_TAG - latest
|
||||
```
|
||||
|
||||
All default ports you might use will be exposed:
|
||||
```
|
||||
# secret
|
||||
# ipfs store ui rpc ws listener discovery
|
||||
# ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
||||
EXPOSE 5001 8082 8083 8180 8545 8546 30303/tcp 30303/udp
|
||||
```
|
||||
|
||||
@@ -1,43 +1,29 @@
|
||||
FROM alpine:edge AS builder
|
||||
|
||||
# show backtraces
|
||||
ENV RUST_BACKTRACE 1
|
||||
|
||||
RUN apk add --no-cache \
|
||||
build-base \
|
||||
cargo \
|
||||
cmake \
|
||||
eudev-dev \
|
||||
linux-headers \
|
||||
perl \
|
||||
rust
|
||||
|
||||
WORKDIR /parity
|
||||
COPY . /parity
|
||||
RUN cargo build --release --target x86_64-alpine-linux-musl --verbose
|
||||
RUN strip target/x86_64-alpine-linux-musl/release/parity
|
||||
|
||||
|
||||
FROM alpine:edge
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# install tools and dependencies
|
||||
RUN apk add --no-cache gcc musl-dev pkgconfig g++ make curl \
|
||||
eudev-dev rust cargo git file binutils \
|
||||
libusb-dev linux-headers perl cmake
|
||||
|
||||
# show backtraces
|
||||
ENV RUST_BACKTRACE 1
|
||||
|
||||
RUN apk add --no-cache \
|
||||
libstdc++ \
|
||||
eudev-libs \
|
||||
libgcc
|
||||
# show tools
|
||||
RUN rustc -vV && \
|
||||
cargo -V && \
|
||||
gcc -v &&\
|
||||
g++ -v
|
||||
|
||||
RUN addgroup -g 1000 parity \
|
||||
&& adduser -u 1000 -G parity -s /bin/sh -D parity
|
||||
# build parity
|
||||
ADD . /build/parity
|
||||
RUN cd parity && \
|
||||
cargo build --release --verbose && \
|
||||
ls /build/parity/target/release/parity && \
|
||||
strip /build/parity/target/release/parity
|
||||
|
||||
USER parity
|
||||
RUN file /build/parity/target/release/parity
|
||||
|
||||
EXPOSE 8080 8545 8180
|
||||
|
||||
WORKDIR /home/parity
|
||||
|
||||
RUN mkdir -p /home/parity/.local/share/io.parity.ethereum/
|
||||
COPY --chown=parity:parity --from=builder /parity/target/x86_64-alpine-linux-musl/release/parity ./
|
||||
|
||||
ENTRYPOINT ["./parity"]
|
||||
ENTRYPOINT ["/build/parity/target/release/parity"]
|
||||
|
||||
@@ -1,28 +1,36 @@
|
||||
FROM centos:latest
|
||||
WORKDIR /build
|
||||
|
||||
RUN mkdir -p /opt/parity/data && \
|
||||
chmod g+rwX /opt/parity/data && \
|
||||
mkdir -p /opt/parity/release
|
||||
# install tools and dependencies
|
||||
RUN yum -y update&& \
|
||||
yum install -y git make gcc-c++ gcc file binutils cmake
|
||||
|
||||
COPY parity/parity /opt/parity/release
|
||||
# install rustup
|
||||
RUN curl -sSf https://static.rust-lang.org/rustup.sh -o rustup.sh &&\
|
||||
ls&&\
|
||||
sh rustup.sh --disable-sudo
|
||||
|
||||
WORKDIR /opt/parity/data
|
||||
# show backtraces
|
||||
ENV RUST_BACKTRACE 1
|
||||
|
||||
# exposing default ports
|
||||
#
|
||||
# secret
|
||||
# ipfs store ui rpc ws listener discovery
|
||||
# ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
||||
EXPOSE 5001 8082 8083 8180 8545 8546 30303/tcp 30303/udp
|
||||
# set compiler
|
||||
ENV CXX g++
|
||||
ENV CC gcc
|
||||
|
||||
# switch to non-root user
|
||||
USER 1001
|
||||
# show tools
|
||||
RUN rustc -vV && \
|
||||
cargo -V && \
|
||||
gcc -v &&\
|
||||
g++ -v
|
||||
|
||||
#if no base path provided, assume it's current workdir
|
||||
CMD ["--base-path","."]
|
||||
ENTRYPOINT ["/opt/parity/release/parity"]
|
||||
|
||||
|
||||
|
||||
# build parity
|
||||
ADD . /build/parity
|
||||
RUN cd parity&&\
|
||||
cargo build --release --verbose && \
|
||||
ls /build/parity/target/release/parity && \
|
||||
strip /build/parity/target/release/parity
|
||||
|
||||
RUN file /build/parity/target/release/parity
|
||||
|
||||
EXPOSE 8080 8545 8180
|
||||
ENTRYPOINT ["/build/parity/target/release/parity"]
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
FROM centos:latest
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
ADD . /build/parity-ethereum
|
||||
|
||||
RUN yum -y update && \
|
||||
yum install -y systemd-devel git make gcc-c++ gcc file binutils && \
|
||||
curl -L "https://cmake.org/files/v3.12/cmake-3.12.0-Linux-x86_64.tar.gz" -o cmake.tar.gz && \
|
||||
tar -xzf cmake.tar.gz && \
|
||||
cp -r cmake-3.12.0-Linux-x86_64/* /usr/ && \
|
||||
curl https://sh.rustup.rs -sSf | sh -s -- -y && \
|
||||
PATH=/root/.cargo/bin:$PATH && \
|
||||
RUST_BACKTRACE=1 && \
|
||||
rustc -vV && \
|
||||
cargo -V && \
|
||||
gcc -v && \
|
||||
g++ -v && \
|
||||
cmake --version && \
|
||||
cd parity-ethereum && \
|
||||
cargo build --verbose --release --features final && \
|
||||
strip /build/parity-ethereum/target/release/parity && \
|
||||
file /build/parity-ethereum/target/release/parity
|
||||
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# The image name
|
||||
PARITY_IMAGE_REPO=${PARITY_IMAGE_REPO:-parity/parity}
|
||||
# The tag to be used for builder image
|
||||
PARITY_BUILDER_IMAGE_TAG=${PARITY_BUILDER_IMAGE_TAG:-build}
|
||||
# The tag to be used for runner image
|
||||
PARITY_RUNNER_IMAGE_TAG=${PARITY_RUNNER_IMAGE_TAG:-latest}
|
||||
|
||||
echo Building $PARITY_IMAGE_REPO:$PARITY_BUILDER_IMAGE_TAG-$(git log -1 --format="%H")
|
||||
docker build --no-cache -t $PARITY_IMAGE_REPO:$PARITY_BUILDER_IMAGE_TAG-$(git log -1 --format="%H") . -f docker/centos/Dockerfile.build
|
||||
|
||||
echo Creating $PARITY_BUILDER_IMAGE_TAG-$(git log -1 --format="%H"), extracting binary
|
||||
docker create --name extract $PARITY_IMAGE_REPO:$PARITY_BUILDER_IMAGE_TAG-$(git log -1 --format="%H")
|
||||
mkdir docker/centos/parity
|
||||
docker cp extract:/build/parity-ethereum/target/release/parity docker/centos/parity
|
||||
|
||||
echo Building $PARITY_IMAGE_REPO:$PARITY_RUNNER_IMAGE_TAG
|
||||
docker build --no-cache -t $PARITY_IMAGE_REPO:$PARITY_RUNNER_IMAGE_TAG docker/centos/ -f docker/centos/Dockerfile
|
||||
|
||||
echo Cleaning up ...
|
||||
rm -rf docker/centos/parity
|
||||
docker rm -f extract
|
||||
docker rmi -f $PARITY_IMAGE_REPO:$PARITY_BUILDER_IMAGE_TAG-$(git log -1 --format="%H")
|
||||
|
||||
echo Echoing Parity version:
|
||||
docker run $PARITY_IMAGE_REPO:$PARITY_RUNNER_IMAGE_TAG --version
|
||||
|
||||
echo Done.
|
||||
@@ -1,27 +1,65 @@
|
||||
FROM ubuntu:xenial
|
||||
MAINTAINER Parity Technologies <devops@parity.io>
|
||||
#set ENVIROMENT
|
||||
ARG TARGET
|
||||
ENV TARGET ${TARGET}
|
||||
|
||||
WORKDIR /build
|
||||
#ENV for build TAG
|
||||
ARG BUILD_TAG
|
||||
ENV BUILD_TAG ${BUILD_TAG:-master}
|
||||
RUN echo "Build tag:" $BUILD_TAG
|
||||
# install tools and dependencies
|
||||
RUN apt update && apt install -y --no-install-recommends openssl libudev-dev file
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --force-yes --no-install-recommends \
|
||||
# make
|
||||
build-essential \
|
||||
# add-apt-repository
|
||||
software-properties-common \
|
||||
make \
|
||||
cmake \
|
||||
curl \
|
||||
wget \
|
||||
git \
|
||||
g++ \
|
||||
gcc \
|
||||
libc6 \
|
||||
libc6-dev \
|
||||
binutils \
|
||||
file \
|
||||
libudev-dev \
|
||||
pkg-config \
|
||||
dpkg-dev \
|
||||
libudev-dev &&\
|
||||
# install rustup
|
||||
curl https://sh.rustup.rs -sSf | sh -s -- -y && \
|
||||
# rustup directory
|
||||
PATH=/root/.cargo/bin:$PATH && \
|
||||
# show backtraces
|
||||
ENV RUST_BACKTRACE 1
|
||||
|
||||
RUST_BACKTRACE=1 && \
|
||||
# build parity
|
||||
cd /build&&git clone https://github.com/paritytech/parity-ethereum && \
|
||||
cd parity-ethereum && \
|
||||
git pull&& \
|
||||
git checkout $BUILD_TAG && \
|
||||
cargo build --verbose --release --features final && \
|
||||
strip /build/parity-ethereum/target/release/parity && \
|
||||
file /build/parity-ethereum/target/release/parity&&mkdir -p /parity&& cp /build/parity-ethereum/target/release/parity /parity&&\
|
||||
#cleanup Docker image
|
||||
RUN apt autoremove -y
|
||||
RUN apt clean -y
|
||||
RUN rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/*
|
||||
|
||||
#add TARGET to docker image
|
||||
COPY artifacts/x86_64-unknown-linux-gnu/$TARGET /usr/bin/$TARGET
|
||||
|
||||
# Build a shell script because the ENTRYPOINT command doesn't like using ENV
|
||||
RUN echo "#!/bin/bash \n ${TARGET} \$@" > ./entrypoint.sh
|
||||
RUN chmod +x ./entrypoint.sh
|
||||
|
||||
rm -rf /root/.cargo&&rm -rf /root/.multirust&&rm -rf /root/.rustup&&rm -rf /build&&\
|
||||
apt-get purge -y \
|
||||
# make
|
||||
build-essential \
|
||||
# add-apt-repository
|
||||
software-properties-common \
|
||||
make \
|
||||
cmake \
|
||||
curl \
|
||||
wget \
|
||||
git \
|
||||
g++ \
|
||||
gcc \
|
||||
binutils \
|
||||
file \
|
||||
pkg-config \
|
||||
dpkg-dev &&\
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
# setup ENTRYPOINT
|
||||
EXPOSE 5001 8080 8082 8083 8545 8546 8180 30303/tcp 30303/udp
|
||||
ENTRYPOINT ["./entrypoint.sh"]
|
||||
EXPOSE 8080 8545 8180
|
||||
ENTRYPOINT ["/parity/parity"]
|
||||
|
||||
@@ -6,7 +6,7 @@ RUN apt-get -y update && \
|
||||
apt-get install -y --force-yes --no-install-recommends \
|
||||
curl git make g++ gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \
|
||||
libc6-arm64-cross libc6-dev-arm64-cross wget file ca-certificates \
|
||||
binutils-aarch64-linux-gnu cmake3 libudev-dev \
|
||||
binutils-aarch64-linux-gnu cmake \
|
||||
&& \
|
||||
apt-get clean
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ RUN apt-get -y update && \
|
||||
apt-get install -y --force-yes --no-install-recommends \
|
||||
curl git make g++ gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf \
|
||||
libc6-dev-armhf-cross wget file ca-certificates \
|
||||
binutils-arm-linux-gnueabihf cmake3 libudev-dev \
|
||||
binutils-arm-linux-gnueabihf cmake \
|
||||
&& \
|
||||
apt-get clean
|
||||
|
||||
|
||||
42
docker/ubuntu/Dockerfile
Normal file
42
docker/ubuntu/Dockerfile
Normal file
@@ -0,0 +1,42 @@
|
||||
FROM ubuntu:14.04
|
||||
WORKDIR /build
|
||||
|
||||
# install tools and dependencies
|
||||
RUN apt-get update && \
|
||||
apt-get install -y \
|
||||
g++ \
|
||||
build-essential \
|
||||
cmake \
|
||||
curl \
|
||||
git \
|
||||
file \
|
||||
binutils \
|
||||
pkg-config \
|
||||
libudev-dev
|
||||
|
||||
# install rustup
|
||||
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
|
||||
|
||||
# rustup directory
|
||||
ENV PATH /root/.cargo/bin:$PATH
|
||||
|
||||
# show backtraces
|
||||
ENV RUST_BACKTRACE 1
|
||||
|
||||
# show tools
|
||||
RUN rustc -vV && \
|
||||
cargo -V && \
|
||||
gcc -v &&\
|
||||
g++ -v
|
||||
|
||||
# build parity
|
||||
ADD . /build/parity
|
||||
RUN cd parity && \
|
||||
cargo build --release --verbose && \
|
||||
ls /build/parity/target/release/parity && \
|
||||
strip /build/parity/target/release/parity
|
||||
|
||||
RUN file /build/parity/target/release/parity
|
||||
|
||||
EXPOSE 8080 8545 8180
|
||||
ENTRYPOINT ["/build/parity/target/release/parity"]
|
||||
@@ -1,5 +1,3 @@
|
||||
Note: Parity 1.10 reached End-of-Life on 2018-07-18 (EOL).
|
||||
|
||||
## Parity [v1.10.9](https://github.com/paritytech/parity/releases/tag/v1.10.9) (2018-07-07)
|
||||
|
||||
Parity 1.10.9 is a bug-fix release to improve performance and stability.
|
||||
|
||||
@@ -1,724 +0,0 @@
|
||||
## Parity [v1.11.8](https://github.com/paritytech/parity-ethereum/releases/tag/v1.11.8) (2018-07-27)
|
||||
|
||||
Parity 1.11.8-stable is a bug-fix release to improve performance and stability.
|
||||
|
||||
Note, authorities in PoA networks based on the Aura engine, should upgrade their nodes immediately as this release includes a critical fix.
|
||||
|
||||
The full list of included changes:
|
||||
|
||||
- Backports to 1.11.8-stable ([#9144](https://github.com/paritytech/parity-ethereum/pull/9144))
|
||||
- Parity-version: bump stable to 1.11.8
|
||||
- Ci: update version strings for snaps ([#9160](https://github.com/paritytech/parity-ethereum/pull/9160))
|
||||
- Be more graceful on Aura difficulty validation ([#9164](https://github.com/paritytech/parity-ethereum/pull/9164))
|
||||
- Be more graceful on Aura difficulty validation
|
||||
- Test: rejects_step_backwards
|
||||
- Test: proposer_switching
|
||||
- Test: rejects_future_block
|
||||
- Test: reports_skipped
|
||||
- Test: verify_empty_seal_steps
|
||||
- Parity: fix UserDefaults json parser ([#9189](https://github.com/paritytech/parity-ethereum/pull/9189))
|
||||
- Parity: fix UserDefaults json parser
|
||||
- Parity: use serde_derive for UserDefaults
|
||||
- Parity: support deserialization of old UserDefault json format
|
||||
- Parity: make UserDefaults serde backwards compatible
|
||||
- Parity: tabify indentation in UserDefaults
|
||||
- Fix bugfix hard fork logic ([#9138](https://github.com/paritytech/parity-ethereum/pull/9138))
|
||||
- Fix bugfix hard fork logic
|
||||
- Remove dustProtectionTransition from bugfix category
|
||||
- EIP-168 is not enabled by default
|
||||
- Remove unnecessary 'static
|
||||
- Disable per-sender limit for local transactions. ([#9148](https://github.com/paritytech/parity-ethereum/pull/9148))
|
||||
- Disable per-sender limit for local transactions.
|
||||
- Add a missing new line.
|
||||
- Rpc: fix is_major_importing sync state condition ([#9112](https://github.com/paritytech/parity-ethereum/pull/9112))
|
||||
- Rpc: fix is_major_importing sync state condition
|
||||
- Rpc: fix informant printout when waiting for peers
|
||||
- Fix verification in ethcore-sync collect_blocks ([#9135](https://github.com/paritytech/parity-ethereum/pull/9135))
|
||||
- Docker: update hub dockerfile ([#9173](https://github.com/paritytech/parity-ethereum/pull/9173))
|
||||
- Update Dockerfile for hub
|
||||
- Update to Ubuntu Xenial 16.04
|
||||
- Fix cmake version
|
||||
- Docker: fix tab indentation in hub dockerfile
|
||||
- Ethcore: update to parity-wasm 0.31
|
||||
- Rpc: fix broken merge
|
||||
|
||||
## Parity [v1.11.7](https://github.com/paritytech/parity-ethereum/releases/tag/v1.11.7) "Prosperity" (2018-07-17)
|
||||
|
||||
Parity 1.11.7 "Prosperity" is a bug-fix release to improve performance and stability that marks the 1.11 release track as `stable`. Among other fixes, this release significantly addresses peering and synchronization issues. If you experienced such issues before, upgrading is highly recommended. If you rely on old versions of Parity, check out the `old-stable-1.10` branch, cherry-pick fixes, and compile your binaries independently. There will be no official support for any versions prior to 1.11.7, however (EOL).
|
||||
|
||||
If you are upgrading directly from versions 1.10.9 or earlier, please note important changes to our transaction-queue implementation, namely:
|
||||
|
||||
- The pool now limits transactions per-sender (see `--tx-queue-per-sender`), local transactions also have to obey that limit. Consider increasing the limit via CLI-flag when running benchmarks or sending a lot of transactions at once.
|
||||
- In case the pool is full, transactions received over the network, but originating from accounts that you have private keys for might not get accepted to the pool any more with higher priority. Consider running with larger pool size or submitting the transactions directly on the node via `eth_sendRawTransaction`.
|
||||
|
||||
The full list of included changes:
|
||||
|
||||
- Backports to 1.11.7-stable ([#9093](https://github.com/paritytech/parity/pull/9093))
|
||||
- Parity-version: stabilize 1.11
|
||||
- Parity-version: bump stable to 1.11.7
|
||||
- Don't fetch snapshot chunks at random ([#9088](https://github.com/paritytech/parity/pull/9088))
|
||||
- Offload cull to IoWorker. ([#9099](https://github.com/paritytech/parity/pull/9099))
|
||||
- Limit the number of transactions in pending set ([#8777](https://github.com/paritytech/parity/pull/8777))
|
||||
- Unordered iterator.
|
||||
- Use unordered and limited set if full not required.
|
||||
- Split timeout work into smaller timers.
|
||||
- Avoid collecting all pending transactions when mining
|
||||
- Remove println.
|
||||
- Use priority ordering in eth-filter.
|
||||
- Fix ethcore-miner tests and tx propagation.
|
||||
- Review grumbles addressed.
|
||||
- Add test for unordered not populating the cache.
|
||||
- Fix ethcore tests.
|
||||
- Fix light tests.
|
||||
- Fix ethcore-sync tests.
|
||||
- Fix RPC tests.
|
||||
- Make sure to produce full blocks. ([#9115](https://github.com/paritytech/parity/pull/9115))
|
||||
- Update hidapi, fixes [#7542](https://github.com/paritytech/parity-ethereum/issues/7542) ([#9108](https://github.com/paritytech/parity/pull/9108))
|
||||
- Docker: add cmake dependency ([#9111](https://github.com/paritytech/parity/pull/9111))
|
||||
- Fix miner tests.
|
||||
- Revert "Make sure to produce full blocks."
|
||||
- This reverts commit b12d592.
|
||||
- Update light client hardcoded headers ([#9098](https://github.com/paritytech/parity/pull/9098))
|
||||
- Insert Kovan hardcoded headers until 7690241
|
||||
- Insert Kovan hardcoded headers until block 7690241
|
||||
- Insert Ropsten hardcoded headers until 3612673
|
||||
- Insert Mainnet hardcoded headers until block 5941249
|
||||
- Make sure to produce full blocks. ([#9115](https://github.com/paritytech/parity/pull/9115))
|
||||
- Insert ETC (classic) hardcoded headers until block 6170625 ([#9121](https://github.com/paritytech/parity/pull/9121))
|
||||
- Fix verification in ethcore-sync collect_blocks ([#9135](https://github.com/paritytech/parity/pull/9135))
|
||||
- `evm bench` fix broken dependencies ([#9134](https://github.com/paritytech/parity/pull/9134))
|
||||
- `evm bench` use valid dependencies
|
||||
- Fix warnings
|
||||
|
||||
## Parity [v1.11.6](https://github.com/paritytech/parity/releases/tag/v1.11.6) (2018-07-09)
|
||||
|
||||
Parity 1.11.6 is a bug-fix release to improve performance and stability.
|
||||
|
||||
The full list of included changes:
|
||||
|
||||
- Beta: 1.11.6 backports ([#9015](https://github.com/paritytech/parity/pull/9015))
|
||||
- Parity-version: bump beta to 1.11.6
|
||||
- Scripts: remove md5 checksums ([#8884](https://github.com/paritytech/parity/pull/8884))
|
||||
- Add support for --chain tobalaba
|
||||
- Convert indents to tabs :)
|
||||
- Fixes for misbehavior reporting in AuthorityRound ([#8998](https://github.com/paritytech/parity/pull/8998))
|
||||
- Aura: only report after checking for repeated skipped primaries
|
||||
- Aura: refactor duplicate code for getting epoch validator set
|
||||
- Aura: verify_external: report on validator set contract instance
|
||||
- Aura: use correct validator set epoch number when reporting
|
||||
- Aura: use epoch set when verifying blocks
|
||||
- Aura: report skipped primaries when generating seal
|
||||
- Aura: handle immediate transitions
|
||||
- Aura: don't report skipped steps from genesis to first block
|
||||
- Aura: fix reporting test
|
||||
- Aura: refactor duplicate code to handle immediate_transitions
|
||||
- Aura: let reporting fail on verify_block_basic
|
||||
- Aura: add comment about possible failure of reporting
|
||||
- Only return error log for rustls ([#9025](https://github.com/paritytech/parity/pull/9025))
|
||||
- Transaction Pool improvements ([#8470](https://github.com/paritytech/parity/pull/8470))
|
||||
- Don't use ethereum_types in transaction pool.
|
||||
- Hide internal insertion_id.
|
||||
- Fix tests.
|
||||
- Review grumbles.
|
||||
- Improve should_replace on NonceAndGasPrice ([#8980](https://github.com/paritytech/parity/pull/8980))
|
||||
- Additional tests for NonceAndGasPrice::should_replace.
|
||||
- Fix should_replace in the distinct sender case.
|
||||
- Use natural priority ordering to simplify should_replace.
|
||||
- Minimal effective gas price in the queue ([#8934](https://github.com/paritytech/parity/pull/8934))
|
||||
- Minimal effective gas price.
|
||||
- Fix naming, add test
|
||||
- Fix minimal entry score and add test.
|
||||
- Fix worst_transaction.
|
||||
- Remove effective gas price threshold.
|
||||
- Don't leak gas_price decisions out of Scoring.
|
||||
- Never drop local transactions from different senders. ([#9002](https://github.com/paritytech/parity/pull/9002))
|
||||
- Recently rejected cache for transaction queue ([#9005](https://github.com/paritytech/parity/pull/9005))
|
||||
- Store recently rejected transactions.
|
||||
- Don't cache AlreadyImported rejections.
|
||||
- Make the size of transaction verification queue dependent on pool size.
|
||||
- Add a test for recently rejected.
|
||||
- Fix logging for recently rejected.
|
||||
- Make rejection cache smaller.
|
||||
- Obsolete test removed
|
||||
- Obsolete test removed
|
||||
- Construct cache with_capacity.
|
||||
- Optimize pending transactions filter ([#9026](https://github.com/paritytech/parity/pull/9026))
|
||||
- Rpc: return unordered transactions in pending transactions filter
|
||||
- Ethcore: use LruCache for nonce cache
|
||||
- Only clear the nonce cache when a block is retracted
|
||||
- Revert "ethcore: use LruCache for nonce cache"
|
||||
- This reverts commit b382c19.
|
||||
- Use only cached nonces when computing pending hashes.
|
||||
- Give filters their own locks, so that they don't block one another.
|
||||
- Fix pending transaction count if not sealing.
|
||||
- Clear cache only when block is enacted.
|
||||
- Fix RPC tests.
|
||||
- Address review comments.
|
||||
- A last bunch of txqueue performance optimizations ([#9024](https://github.com/paritytech/parity/pull/9024))
|
||||
- Clear cache only when block is enacted.
|
||||
- Add tracing for cull.
|
||||
- Cull split.
|
||||
- Cull after creating pending block.
|
||||
- Add constant, remove sync::read tracing.
|
||||
- Reset debug.
|
||||
- Remove excessive tracing.
|
||||
- Use struct for NonceCache.
|
||||
- Fix build
|
||||
- Remove warnings.
|
||||
- Fix build again.
|
||||
- Miner: add missing macro use for trace_time
|
||||
- Ci: remove md5 merge leftovers
|
||||
|
||||
## Parity [v1.11.5](https://github.com/paritytech/parity/releases/tag/v1.11.5) (2018-06-29)
|
||||
|
||||
Parity 1.11.5 is a bug-fix release to improve performance and stability.
|
||||
|
||||
The full list of included changes:
|
||||
|
||||
- Bump beta to 1.11.5 / Backports ([#8955](https://github.com/paritytech/parity/pull/8955))
|
||||
- Parity-version: bump beta to 1.11.5
|
||||
- Update ropsten.json ([#8926](https://github.com/paritytech/parity/pull/8926))
|
||||
- Update hardcoded headers ([#8925](https://github.com/paritytech/parity/pull/8925))
|
||||
- Update kovan.json
|
||||
- Update Kovan to block 7693549
|
||||
- Update foundation.json
|
||||
- Updated to block 5812225
|
||||
- Update ropsten.json
|
||||
- Update to 3465217
|
||||
- Scripts: minor improvements ([#8930](https://github.com/paritytech/parity/pull/8930))
|
||||
- CI: enable 'latest' docker tag on master pipeline
|
||||
- CI: mark both beta and stable as stable snap.
|
||||
- CI: sign all windows binaries
|
||||
- Scripts: fix docker build tag on latest using master ([#8952](https://github.com/paritytech/parity/pull/8952))
|
||||
- Rpc: cap gas limit of local calls ([#8943](https://github.com/paritytech/parity/pull/8943))
|
||||
- Snap: downgrade rust to revision 1.26.2, ref snapcraft/+bug/1778530 ([#8984](https://github.com/paritytech/parity/pull/8984))
|
||||
- Snap: downgrade rust to revision 1.26.2, ref snapcraft/+bug/1778530
|
||||
- Snap: use plugin rust
|
||||
- Fix deadlock in blockchain. ([#8977](https://github.com/paritytech/parity/pull/8977))
|
||||
- Remove js-glue from workspace
|
||||
- This fixes test error on Rust 1.27 but also prevents js-glue from building itself.
|
||||
- Builtin dapp users can still use js-glue from crates.io.
|
||||
- Fix Android build on beta ([#9003](https://github.com/paritytech/parity/pull/9003))
|
||||
|
||||
## Parity [v1.11.4](https://github.com/paritytech/parity/releases/tag/v1.11.4) (2018-06-20)
|
||||
|
||||
Parity 1.11.4 is a bug-fix release to improve performance and stability.
|
||||
|
||||
The full list of included changes:
|
||||
|
||||
- Backports ([#8916](https://github.com/paritytech/parity/pull/8916))
|
||||
- `Duration_ns: u64 -> duration: Duration` ([#8457](https://github.com/paritytech/parity/pull/8457))
|
||||
- Duration_ns: u64 -> duration: Duration
|
||||
- Format on millis {:.2} -> {}
|
||||
- Keep all enacted blocks notify in order ([#8524](https://github.com/paritytech/parity/pull/8524))
|
||||
- Keep all enacted blocks notify in order
|
||||
- Collect is unnecessary
|
||||
- Update ChainNotify to use ChainRouteType
|
||||
- Fix all ethcore fn defs
|
||||
- Wrap the type within ChainRoute
|
||||
- Fix private-tx and sync api
|
||||
- Fix secret_store API
|
||||
- Fix updater API
|
||||
- Fix rpc api
|
||||
- Fix informant api
|
||||
- Eagerly cache enacted/retracted and remove contain_enacted/retracted
|
||||
- Fix indent
|
||||
- Tests: should use full expr form for struct constructor
|
||||
- Use into_enacted_retracted to further avoid copy
|
||||
- Typo: not a function
|
||||
- Rpc/tests: ChainRoute -> ChainRoute::new
|
||||
- Handle removed logs in filter changes and add geth compatibility field ([#8796](https://github.com/paritytech/parity/pull/8796))
|
||||
- Add removed geth compatibility field in log
|
||||
- Fix mocked tests
|
||||
- Add field block hash in PollFilter
|
||||
- Store last block hash info for log filters
|
||||
- Implement canon route
|
||||
- Use canon logs for fetching reorg logs
|
||||
- Make sure removed flag is set
|
||||
- Address grumbles
|
||||
- Fixed AuthorityRound deadlock on shutdown, closes [#8088](https://github.com/paritytech/parity/issues/8088) ([#8803](https://github.com/paritytech/parity/pull/8803))
|
||||
- Ci: Fix docker tags ([#8822](https://github.com/paritytech/parity/pull/8822))
|
||||
- Scripts: enable docker builds for beta and stable
|
||||
- Scripts: docker latest should be beta not master
|
||||
- Scripts: docker latest is master
|
||||
- Ethcore: fix ancient block error msg handling ([#8832](https://github.com/paritytech/parity/pull/8832))
|
||||
- Disable parallel verification and skip verifiying already imported txs. ([#8834](https://github.com/paritytech/parity/pull/8834))
|
||||
- Reject transactions that are already in pool without verifying them.
|
||||
- Avoid verifying already imported transactions.
|
||||
- Fix concurrent access to signer queue ([#8854](https://github.com/paritytech/parity/pull/8854))
|
||||
- Fix concurrent access to signer queue
|
||||
- Put request back to the queue if confirmation failed
|
||||
- Typo: fix docs and rename functions to be more specific
|
||||
- Change trace info "Transaction" -> "Request"
|
||||
- Don't allocate in expect_valid_rlp unless necessary ([#8867](https://github.com/paritytech/parity/pull/8867))
|
||||
- Don't allocate via format! in case there's no error
|
||||
- Fix test?
|
||||
- Fixed ipc leak, closes [#8774](https://github.com/paritytech/parity/issues/8774) ([#8876](https://github.com/paritytech/parity/pull/8876))
|
||||
- Add new ovh bootnodes and fix port for foundation bootnode 3.2 ([#8886](https://github.com/paritytech/parity/pull/8886))
|
||||
- Add new ovh bootnodes and fix port for foundation bootnode 3.2
|
||||
- Remove old bootnodes.
|
||||
- Remove duplicate 1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082
|
||||
- Block 0 is valid in queries ([#8891](https://github.com/paritytech/parity/pull/8891))
|
||||
- Add ETC Cooperative-run load balanced parity node ([#8892](https://github.com/paritytech/parity/pull/8892))
|
||||
- Minor fix in chain supplier and light provider ([#8906](https://github.com/paritytech/parity/pull/8906))
|
||||
- Fix chain supplier increment
|
||||
- Fix light provider block_headers
|
||||
- Check whether we need resealing in miner and unwrap has_account in account_provider ([#8853](https://github.com/paritytech/parity/pull/8853))
|
||||
- Remove unused Result wrap in has_account
|
||||
- Check whether we need to reseal for external transactions
|
||||
- Fix reference to has_account interface
|
||||
- Typo: missing )
|
||||
- Refactor duplicates to prepare_and_update_sealing
|
||||
- Fix build
|
||||
- Allow disabling local-by-default for transactions with new config entry ([#8882](https://github.com/paritytech/parity/pull/8882))
|
||||
- Add tx_queue_allow_unknown_local config option
|
||||
- Refactor flag name + don't change import_own_tx behaviour
|
||||
- Add fn to TestMinerService
|
||||
- Avoid race condition from trusted sources
|
||||
- Parity-version: beta release 1.11.4 ([#8856](https://github.com/paritytech/parity/pull/8856))
|
||||
- Cherry-pick network-specific release flag ([#8821](https://github.com/paritytech/parity/pull/8821))
|
||||
- Parity-version: bump beta to 1.11.4
|
||||
- Parity-version: remove merge leftovers
|
||||
|
||||
## Parity [v1.11.3](https://github.com/paritytech/parity/releases/tag/v1.11.3) (2018-06-06)
|
||||
|
||||
Parity 1.11.3 is a security-relevant release. Please upgrade your nodes as soon as possible to [v1.10.6](https://github.com/paritytech/parity/releases/tag/v1.10.6) or [v1.11.3](https://github.com/paritytech/parity/releases/tag/v1.11.3).
|
||||
|
||||
The full list of included changes:
|
||||
|
||||
- Parity-version: bump beta to 1.11.3 ([#8806](https://github.com/paritytech/parity/pull/8806))
|
||||
- Parity-version: bump beta to 1.11.3
|
||||
- Disallow unsigned transactions in case EIP-86 is disabled ([#8802](https://github.com/paritytech/parity/pull/8802))
|
||||
- Fix ancient blocks queue deadlock ([#8751](https://github.com/paritytech/parity/pull/8751))
|
||||
- Update shell32-sys to fix windows build ([#8792](https://github.com/paritytech/parity/pull/8792))
|
||||
- Backports ([#8785](https://github.com/paritytech/parity/pull/8785))
|
||||
- Fix light sync with initial validator-set contract ([#8528](https://github.com/paritytech/parity/pull/8528))
|
||||
- Fix [#8468](https://github.com/paritytech/parity-ethereum/issues/8468)
|
||||
- Use U256::max_value() instead
|
||||
- Also change initial transaction gas
|
||||
- Resumable warp-sync / Seed downloaded snapshots ([#8544](https://github.com/paritytech/parity/pull/8544))
|
||||
- Start dividing sync chain : first supplier method
|
||||
- WIP - updated chain sync supplier
|
||||
- Finish refactoring the Chain Sync Supplier
|
||||
- Create Chain Sync Requester
|
||||
- Add Propagator for Chain Sync
|
||||
- Add the Chain Sync Handler
|
||||
- Move tests from mod -> handler
|
||||
- Move tests to propagator
|
||||
- Refactor SyncRequester arguments
|
||||
- Refactoring peer fork header handler
|
||||
- Fix wrong highest block number in snapshot sync
|
||||
- Small refactor...
|
||||
- Resume warp-sync downloaded chunks
|
||||
- Refactoring the previous chunks import
|
||||
- Address PR grumbles
|
||||
- Fix not seeding current snapshot
|
||||
- Update SnapshotService readiness check
|
||||
- Early abort importing previous chunks
|
||||
- Update Gitlab CI config
|
||||
- SyncState back to Waiting when Manifest peers disconnect
|
||||
- Revert GitLab CI changes
|
||||
- Refactor resuming snapshots
|
||||
- Revert "Refactor resuming snapshots"
|
||||
- Update informant log
|
||||
- Refactor resuming snapshots
|
||||
- Update informant message : show chunks done
|
||||
- Don't open Browser post-install on Mac ([#8641](https://github.com/paritytech/parity/pull/8641))
|
||||
- Fix not downloading old blocks ([#8642](https://github.com/paritytech/parity/pull/8642))
|
||||
- Fix PoW blockchains sealing notifications in chain_new_blocks ([#8656](https://github.com/paritytech/parity/pull/8656))
|
||||
- Shutdown the Snapshot Service early ([#8658](https://github.com/paritytech/parity/pull/8658))
|
||||
- Shutdown the Snapshot Service when shutting down the runner
|
||||
- Rename `service` to `client_service`
|
||||
- Fix tests
|
||||
- Fix cli signer ([#8682](https://github.com/paritytech/parity/pull/8682))
|
||||
- Update ethereum-types so `{:#x}` applies 0x prefix
|
||||
- Set the request index to that of the current request ([#8683](https://github.com/paritytech/parity/pull/8683))
|
||||
- Set the request index to that of the current request
|
||||
- Network-devp2p: handle UselessPeer disconnect ([#8686](https://github.com/paritytech/parity/pull/8686))
|
||||
- Fix local transactions policy. ([#8691](https://github.com/paritytech/parity/pull/8691))
|
||||
- CI: Fixes for Android Pipeline ([#8745](https://github.com/paritytech/parity/pull/8745))
|
||||
- Ci: Remove check for shared libraries in gitlab script
|
||||
- Ci: allow android arm build to fail
|
||||
- Custom Error Messages on ENFILE and EMFILE IO Errors ([#8744](https://github.com/paritytech/parity/pull/8744))
|
||||
- Custom Error Messages on ENFILE and EMFILE IO Errors
|
||||
- Use assert-matches for more readable tests
|
||||
- Fix Wording and consistency
|
||||
- Ethcore-sync: fix connection to peers behind chain fork block ([#8710](https://github.com/paritytech/parity/pull/8710))
|
||||
- Parity-version: bump beta to 1.11.2 ([#8750](https://github.com/paritytech/parity/pull/8750))
|
||||
- Parity-version: bump beta to 1.11.2
|
||||
- Parity-version: unset critical flag
|
||||
|
||||
## Parity [v1.11.1](https://github.com/paritytech/parity/releases/tag/v1.11.1) (2018-05-15)
|
||||
|
||||
This is the Parity 1.11.1-beta release! Hurray!
|
||||
|
||||
Notable changes in reversed alphabetical order:
|
||||
|
||||
- TOOLING: **Whisper CLI** [#8201](https://github.com/paritytech/parity/pull/8201)
|
||||
- `whisper-cli` is a standalone tool to communicate with the Whisper protocol.
|
||||
- It provides functionality to specify `whisper-pool-size`, `port` and `address` to use.
|
||||
- All whisper RPC APIs are enabled and can be directly accessed.
|
||||
- JSON-RPC API: **Return error in case eth_call returns VM errors** [#8448](https://github.com/paritytech/parity/pull/8448)
|
||||
- This changes the behaviors of `eth_call` to respect VM errors if any.
|
||||
- In case of `REVERT`, it will also return the reverted return data in hex format.
|
||||
- ENGINES: **Block Reward Contract** [#8419](https://github.com/paritytech/parity/pull/8419)
|
||||
- The _AuRa_ PoA engine has now support for having a contract to calculate the block rewards.
|
||||
- The engine passes a list of benefactors and reward types to the contract which then returns a list of addresses and respective rewards.
|
||||
- CORE: **Private Transactions** [#6422](https://github.com/paritytech/parity/pull/6422)
|
||||
- Parity now provides a private transactions system.
|
||||
- Please, check out our wiki to get an [overview and setup instructions](https://wiki.parity.io/Private-Transactions.html).
|
||||
- CORE: **New Transaction Queue implementation** [#8074](https://github.com/paritytech/parity/pull/8074)
|
||||
- Verification is now done in parallel.
|
||||
- Previous queue had `O(1)` time to get pending set, but `O(n^2)` insertion time. And obviously insertion/removal happens much more often than retrieving the pending set (only for propagation and pending block building) Currently we have `O(n * log(senders))` pending set time (with cache) and `O(tx_per_sender)` (usually within `log(tx_per_sender)`) insertion time.
|
||||
- `Scoring` and `Readiness` are separated from the pool, so it's easier to customize them or introduce different definitions (for instance for [EIP-859](https://github.com/ethereum/EIPs/issues/859) or private transactions, etc).
|
||||
- Banning removed, soft-penalization introduced instead: if transaction exceeds the limit other transactions from that sender get lower priority.
|
||||
- There is no explicit distinction between current and future transactions in the pool - `Readiness` determines that. Because of this we additionally remove `future` transactions that occupy the pool for long time.
|
||||
- CONFIGURATION: **Warp-only sync with --warp-barrier [block-number] flag.** [#8228](https://github.com/paritytech/parity/pull/8228)
|
||||
- Enables warp-only sync in case `--warp-barrier [block-number]` is provided.
|
||||
- This avoids clients to warp to outdated snapshots that are too far away from the best block.
|
||||
- This avoids clients to fall back to normal sync if there are no recent snapshots available currently.
|
||||
- CONFIGURATION: **Disable UI by default.** [#8105](https://github.com/paritytech/parity/pull/8105)
|
||||
- The user interface is now disabled by default. It still can be activated with the `--force-ui` flag.
|
||||
- To get the stand-alone Parity UI, please check the dedicated [releases page](https://github.com/parity-js/shell/releases).
|
||||
- CONFIGURATION: **Auto-updater improvements** [#8078](https://github.com/paritytech/parity/pull/8078)
|
||||
- Added `--auto-update-delay` to randomly delay updates by `n` blocks. This takes into account the number of the block of the update release (old updates aren't delayed).
|
||||
- Added `--auto-update-check-frequency` to define the periodicity of auto-update checks in number of blocks.
|
||||
- This is an important improvement to ensure the network does not update all clients at the same time.
|
||||
- CHAIN SPECS: **Enable WebAssembly and Byzantium for Ellaism** [#8520](https://github.com/paritytech/parity/pull/8520)
|
||||
- This activates the Ellaism Byzantium hardfork ([2018-0004-byzantium](https://github.com/ellaism/specs/blob/master/specs/2018-0004-byzantium.md)) at block `2_000_000`.
|
||||
- This enables the Wasm VM on Ellaism ([2018-0003-wasm-hardfork](https://github.com/ellaism/specs/blob/master/specs/2018-0003-wasm-hardfork.md)) at block `2_000_000`.
|
||||
- Please, upgrade your clients if you run an Ellaism configuration.
|
||||
- CHAIN SPECS: **Dev chain - increase gasLimit to 8_000_000** [#8362](https://github.com/paritytech/parity/pull/8362)
|
||||
- This increases the default block gas limit on development chains to `8_000_000`.
|
||||
- Please note, this makes previous dev chain configurations incompatible.
|
||||
- CHAIN SPECS: **Add MCIP-6 Byzyantium transition to Musicoin spec** [#7841](https://github.com/paritytech/parity/pull/7841)
|
||||
- This activates the Musicoin Byzantium hardfork ([MCIP-6](https://github.com/Musicoin/MCIPs/blob/master/MCIPS/mcip-6.md)) at block `2_222_222`.
|
||||
- Please, upgrade your clients if you run a Musicoin configuration.
|
||||
|
||||
The full list of included changes:
|
||||
|
||||
- Backports ([#8624](https://github.com/paritytech/parity/pull/8624))
|
||||
- Trace precompiled contracts when the transfer value is not zero ([#8486](https://github.com/paritytech/parity/pull/8486))
|
||||
- Trace precompiled contracts when the transfer value is not zero
|
||||
- Add tests for precompiled CALL tracing
|
||||
- Use byzantium test machine for the new test
|
||||
- Add notes in comments on why we don't trace all precompiles
|
||||
- Use is_transferred instead of transferred
|
||||
- Return error if RLP size of transaction exceeds the limit ([#8473](https://github.com/paritytech/parity/pull/8473))
|
||||
- Return error if RLP size of transaction exceeds the limit
|
||||
- Review comments fixed
|
||||
- RLP check moved to verifier, corresponding pool test added
|
||||
- Don't block sync when importing old blocks ([#8530](https://github.com/paritytech/parity/pull/8530))
|
||||
- Alter IO queueing.
|
||||
- Don't require IoMessages to be Clone
|
||||
- Ancient blocks imported via IoChannel.
|
||||
- Get rid of private transactions io message.
|
||||
- Get rid of deadlock and fix disconnected handler.
|
||||
- Revert to old disconnect condition.
|
||||
- Fix tests.
|
||||
- Fix deadlock.
|
||||
- Refactoring `ethcore-sync` - Fixing warp-sync barrier ([#8543](https://github.com/paritytech/parity/pull/8543))
|
||||
- Start dividing sync chain : first supplier method
|
||||
- WIP - updated chain sync supplier
|
||||
- Finish refactoring the Chain Sync Supplier
|
||||
- Create Chain Sync Requester
|
||||
- Add Propagator for Chain Sync
|
||||
- Add the Chain Sync Handler
|
||||
- Move tests from mod -> handler
|
||||
- Move tests to propagator
|
||||
- Refactor SyncRequester arguments
|
||||
- Refactoring peer fork header handler
|
||||
- Fix wrong highest block number in snapshot sync
|
||||
- Small refactor...
|
||||
- Address PR grumbles
|
||||
- Retry failed CI job
|
||||
- Fix tests
|
||||
- PR Grumbles
|
||||
- Handle socket address parsing errors ([#8545](https://github.com/paritytech/parity/pull/8545))
|
||||
- Fix packet count when talking with PAR2 peers ([#8555](https://github.com/paritytech/parity/pull/8555))
|
||||
- Support diferent packet counts in different protocol versions.
|
||||
- Fix light timeouts and eclipse protection.
|
||||
- Fix devp2p tests.
|
||||
- Fix whisper-cli compilation.
|
||||
- Fix compilation.
|
||||
- Fix ethcore-sync tests.
|
||||
- Revert "Fix light timeouts and eclipse protection."
|
||||
- Increase timeouts.
|
||||
- Add whisper CLI to the pipelines ([#8578](https://github.com/paritytech/parity/pull/8578))
|
||||
- Add whisper CLI to the pipelines
|
||||
- Address todo, ref [#8579](https://github.com/paritytech/parity/pull/8579)
|
||||
- Rename `whisper-cli binary` to `whisper` ([#8579](https://github.com/paritytech/parity/pull/8579))
|
||||
- Rename whisper-cli binary to whisper
|
||||
- Fix tests
|
||||
- Remove manually added text to the errors ([#8595](https://github.com/paritytech/parity/pull/8595))
|
||||
- Fix account list double 0x display ([#8596](https://github.com/paritytech/parity/pull/8596))
|
||||
- Remove unused self import
|
||||
- Fix account list double 0x display
|
||||
- Fix BlockReward contract "arithmetic operation overflow" ([#8611](https://github.com/paritytech/parity/pull/8611))
|
||||
- Fix BlockReward contract "arithmetic operation overflow"
|
||||
- Add docs on how execute_as_system works
|
||||
- Fix typo
|
||||
- Rlp decode returns Result ([#8527](https://github.com/paritytech/parity/pull/8527))
|
||||
- Remove expect ([#8536](https://github.com/paritytech/parity/pull/8536))
|
||||
- Remove expect and propagate rlp::DecoderErrors as TrieErrors
|
||||
- Decoding headers can fail ([#8570](https://github.com/paritytech/parity/pull/8570))
|
||||
- Rlp::decode returns Result
|
||||
- Fix journaldb to handle rlp::decode Result
|
||||
- Fix ethcore to work with rlp::decode returning Result
|
||||
- Light client handles rlp::decode returning Result
|
||||
- Fix tests in rlp_derive
|
||||
- Fix tests
|
||||
- Cleanup
|
||||
- Cleanup
|
||||
- Allow panic rather than breaking out of iterator
|
||||
- Let decoding failures when reading from disk blow up
|
||||
- Syntax
|
||||
- Fix the trivial grumbles
|
||||
- Fix failing tests
|
||||
- Make Account::from_rlp return Result
|
||||
- Syntx, sigh
|
||||
- Temp-fix for decoding failures
|
||||
- Header::decode returns Result
|
||||
- Do not continue reading from the DB when a value could not be read
|
||||
- Fix tests
|
||||
- Handle header decoding in light_sync
|
||||
- Handling header decoding errors
|
||||
- Let the DecodeError bubble up unchanged
|
||||
- Remove redundant error conversion
|
||||
- Fix compiler warning ([#8590](https://github.com/paritytech/parity/pull/8590))
|
||||
- Attempt to fix intermittent test failures ([#8584](https://github.com/paritytech/parity/pull/8584))
|
||||
- Block_header can fail so return Result ([#8581](https://github.com/paritytech/parity/pull/8581))
|
||||
- Block_header can fail so return Result
|
||||
- Restore previous return type based on feedback
|
||||
- Fix failing doc tests running on non-code
|
||||
- Block::decode() returns Result ([#8586](https://github.com/paritytech/parity/pull/8586))
|
||||
- Gitlab test script fixes ([#8573](https://github.com/paritytech/parity/pull/8573))
|
||||
- Exclude /docs from modified files.
|
||||
- Ensure all references in the working tree are available
|
||||
- Remove duplicated line from test script
|
||||
- Bump beta to 1.11.1 ([#8627](https://github.com/paritytech/parity/pull/8627))
|
||||
|
||||
## Parity [v1.11.0](https://github.com/paritytech/parity/releases/tag/v1.11.0) (2018-05-09)
|
||||
|
||||
This is the Parity 1.11.0-beta release! ~~Hurray!~~ This release has been pulled due to peering issues, please use 1.11.1-beta.
|
||||
|
||||
The full list of included changes:
|
||||
|
||||
- Backports ([#8558](https://github.com/paritytech/parity/pull/8558))
|
||||
- Fetching logs by hash in blockchain database ([#8463](https://github.com/paritytech/parity/pull/8463))
|
||||
- Fetch logs by hash in blockchain database
|
||||
- Fix tests
|
||||
- Add unit test for branch block logs fetching
|
||||
- Add docs that blocks must already be sorted
|
||||
- Handle branch block cases properly
|
||||
- typo: empty -> is_empty
|
||||
- Remove return_empty_if_none by using a closure
|
||||
- Use BTreeSet to avoid sorting again
|
||||
- Move is_canon to BlockChain
|
||||
- typo: pass value by reference
|
||||
- Use loop and wrap inside blocks to simplify the code
|
||||
- typo: missed a comment
|
||||
- Pass on storage keys tracing to handle the case when it is not modified ([#8491](https://github.com/paritytech/parity/pull/8491))
|
||||
- Pass on storage keys even if it is not modified
|
||||
- typo: account and storage query
|
||||
- Fix tests
|
||||
- Use state query directly because of suicided accounts
|
||||
- Fix a RefCell borrow issue
|
||||
- Add tests for unmodified storage trace
|
||||
- Address grumbles
|
||||
- typo: remove unwanted empty line
|
||||
- ensure_cached compiles with the original signature
|
||||
- Update wasmi and pwasm-utils ([#8493](https://github.com/paritytech/parity/pull/8493))
|
||||
- Update wasmi to 0.2
|
||||
- Update pwasm-utils to 0.1.5
|
||||
- Show imported messages for light client ([#8517](https://github.com/paritytech/parity/pull/8517))
|
||||
- Enable WebAssembly and Byzantium for Ellaism ([#8520](https://github.com/paritytech/parity/pull/8520))
|
||||
- Enable WebAssembly and Byzantium for Ellaism
|
||||
- Fix indentation
|
||||
- Remove empty lines
|
||||
- Don't panic in import_block if invalid rlp ([#8522](https://github.com/paritytech/parity/pull/8522))
|
||||
- Don't panic in import_block if invalid rlp
|
||||
- Remove redundant type annotation
|
||||
- Replace RLP header view usage with safe decoding
|
||||
- Node table sorting according to last contact data ([#8541](https://github.com/paritytech/parity/pull/8541))
|
||||
- network-devp2p: sort nodes in node table using last contact data
|
||||
- network-devp2p: rename node contact types in node table json output
|
||||
- network-devp2p: fix node table tests
|
||||
- network-devp2p: note node failure when failed to establish connection
|
||||
- network-devp2p: handle UselessPeer error
|
||||
- network-devp2p: note failure when marking node as useless
|
||||
- Betalize 1.11 :) ([#8475](https://github.com/paritytech/parity/pull/8475))
|
||||
- Betalize 1.11 :)
|
||||
- Update Gitlab scripts
|
||||
- Use master as gitlab latest
|
||||
- Fix snap builds ([#8483](https://github.com/paritytech/parity/pull/8483))
|
||||
- Update hardcodedSync for Ethereum, Kovan, and Ropsten ([#8489](https://github.com/paritytech/parity/pull/8489))
|
||||
- Fix typos in vm description comment ([#8446](https://github.com/paritytech/parity/pull/8446))
|
||||
- Add changelog for 1.9.7 and 1.10.2 ([#8460](https://github.com/paritytech/parity/pull/8460))
|
||||
- Fix docker build ([#8462](https://github.com/paritytech/parity/pull/8462))
|
||||
- Parityshell::open `Return result` ([#8377](https://github.com/paritytech/parity/pull/8377))
|
||||
- Return error in case eth_call returns VM errors ([#8448](https://github.com/paritytech/parity/pull/8448))
|
||||
- Update wasmi ([#8452](https://github.com/paritytech/parity/pull/8452))
|
||||
- Allow 32 bit pipelines to fail ([#8454](https://github.com/paritytech/parity/pull/8454))
|
||||
- Update Cargo hidapi-rs dependency ([#8447](https://github.com/paritytech/parity/pull/8447))
|
||||
- Private transactions processing error handling ([#8431](https://github.com/paritytech/parity/pull/8431))
|
||||
- Improve VM executor stack size estimation rules ([#8439](https://github.com/paritytech/parity/pull/8439))
|
||||
- Block reward contract ([#8419](https://github.com/paritytech/parity/pull/8419))
|
||||
- Permission fix ([#8441](https://github.com/paritytech/parity/pull/8441))
|
||||
- Use forked app_dirs crate for reverted Windows dir behavior ([#8438](https://github.com/paritytech/parity/pull/8438))
|
||||
- Remove From::from. ([#8390](https://github.com/paritytech/parity/pull/8390))
|
||||
- Move ethcore::Error to error_chain ([#8386](https://github.com/paritytech/parity/pull/8386))
|
||||
- Changelogs for 1.9.6 and 1.10.1 ([#8411](https://github.com/paritytech/parity/pull/8411))
|
||||
- Fix receipts stripping. ([#8414](https://github.com/paritytech/parity/pull/8414))
|
||||
- Typo, docs parity_chainId: empty string -> None ([#8434](https://github.com/paritytech/parity/pull/8434))
|
||||
- Update zip to 0.3 ([#8381](https://github.com/paritytech/parity/pull/8381))
|
||||
- Fix TODO comments ([#8413](https://github.com/paritytech/parity/pull/8413))
|
||||
- Replace legacy Rlp with UntrustedRlp and use in ethcore rlp views ([#8316](https://github.com/paritytech/parity/pull/8316))
|
||||
- Tokio-core v0.1.16 -> v0.1.17 ([#8408](https://github.com/paritytech/parity/pull/8408))
|
||||
- More code refactoring to integrate Duration ([#8322](https://github.com/paritytech/parity/pull/8322))
|
||||
- Remove Tendermint extra_info due to seal inconsistencies ([#8367](https://github.com/paritytech/parity/pull/8367))
|
||||
- Use tokio::spawn in secret_store listener and fix Uri ([#8373](https://github.com/paritytech/parity/pull/8373))
|
||||
- Unify and limit rocksdb dependency places ([#8371](https://github.com/paritytech/parity/pull/8371))
|
||||
- Clarify that windows need perl and yasm ([#8402](https://github.com/paritytech/parity/pull/8402))
|
||||
- New Transaction Queue implementation ([#8074](https://github.com/paritytech/parity/pull/8074))
|
||||
- Some tweaks to main.rs for parity as a library ([#8370](https://github.com/paritytech/parity/pull/8370))
|
||||
- Handle queue import errors a bit more gracefully ([#8385](https://github.com/paritytech/parity/pull/8385))
|
||||
- Ci: fix change detection in master builds ([#8382](https://github.com/paritytech/parity/pull/8382))
|
||||
- Fix config test by adding no-hardcodec-sync ([#8380](https://github.com/paritytech/parity/pull/8380))
|
||||
- Fixed unsafe shell call on windows ([#8372](https://github.com/paritytech/parity/pull/8372))
|
||||
- Parity uses winapi 0.3.4 ([#8366](https://github.com/paritytech/parity/pull/8366))
|
||||
- No hardcoded client name ([#8368](https://github.com/paritytech/parity/pull/8368))
|
||||
- Add `util/mem` to zero out memory on drop. ([#8356](https://github.com/paritytech/parity/pull/8356))
|
||||
- Use atty instead of isatty ([#8365](https://github.com/paritytech/parity/pull/8365))
|
||||
- Increase gasLimit to 8'000'000 ([#8362](https://github.com/paritytech/parity/pull/8362))
|
||||
- Util `fake-fetch` ([#8363](https://github.com/paritytech/parity/pull/8363))
|
||||
- Bump snappy and ring, use single rayon version, closes [#8296](https://github.com/paritytech/parity/issues/8296) ([#8364](https://github.com/paritytech/parity/pull/8364))
|
||||
- Use async hyper server in secret_store and upgrade igd ([#8359](https://github.com/paritytech/parity/pull/8359))
|
||||
- Enable UI by default, but only display deprecation notice ([#8262](https://github.com/paritytech/parity/pull/8262))
|
||||
- Ethcrypto renamed to ethcore-crypto and moved to ethcore dir ([#8340](https://github.com/paritytech/parity/pull/8340))
|
||||
- Use hyper 0.11 in ethcore-miner and improvements in parity-reactor ([#8335](https://github.com/paritytech/parity/pull/8335))
|
||||
- Ethcore-sync ([#8347](https://github.com/paritytech/parity/pull/8347))
|
||||
- Rpc, eth_filter: return error if the filter id does not exist ([#8341](https://github.com/paritytech/parity/pull/8341))
|
||||
- Ethcore-stratum crate moved to ethcore directory ([#8338](https://github.com/paritytech/parity/pull/8338))
|
||||
- Secretstore: get rid of engine.signer dependency ([#8173](https://github.com/paritytech/parity/pull/8173))
|
||||
- Whisper cli ([#8201](https://github.com/paritytech/parity/pull/8201))
|
||||
- Replace_home for password_files, reserved_peers and log_file ([#8324](https://github.com/paritytech/parity/pull/8324))
|
||||
- Add Ethereum Social support ([#8325](https://github.com/paritytech/parity/pull/8325))
|
||||
- Private transactions integration pr ([#6422](https://github.com/paritytech/parity/pull/6422))
|
||||
- Decouple rocksdb dependency from ethcore ([#8320](https://github.com/paritytech/parity/pull/8320))
|
||||
- Remove the clone operation of code_cache ([#8334](https://github.com/paritytech/parity/pull/8334))
|
||||
- Fix the JSONRPC API not running with the light client ([#8326](https://github.com/paritytech/parity/pull/8326))
|
||||
- Read registry_address from block with REQUEST_CONFIRMATIONS_REQUIRED ([#8309](https://github.com/paritytech/parity/pull/8309))
|
||||
- Tweaks and add a Dockerfile for Android ([#8036](https://github.com/paritytech/parity/pull/8036))
|
||||
- Use associated type M::Error instead of Error ([#8308](https://github.com/paritytech/parity/pull/8308))
|
||||
- Remove InvalidParentHash in favor of assert! ([#8300](https://github.com/paritytech/parity/pull/8300))
|
||||
- Bump proc macro deps ([#8310](https://github.com/paritytech/parity/pull/8310))
|
||||
- Decouple timestamp open-block-assignment/verification to Engine ([#8305](https://github.com/paritytech/parity/pull/8305))
|
||||
- Validate if gas limit is not zero ([#8307](https://github.com/paritytech/parity/pull/8307))
|
||||
- Implement Easthub chain spec ([#8295](https://github.com/paritytech/parity/pull/8295))
|
||||
- Update some dependencies ([#8285](https://github.com/paritytech/parity/pull/8285))
|
||||
- Ethcore now uses Rayon 1.0 as a dependency ([#8296](https://github.com/paritytech/parity/pull/8296)) ([#8304](https://github.com/paritytech/parity/pull/8304))
|
||||
- Upgrader `remove raw unwrap` and bump semver ([#8251](https://github.com/paritytech/parity/pull/8251))
|
||||
- Cleaner binary shutdown system ([#8284](https://github.com/paritytech/parity/pull/8284))
|
||||
- Ethcore now uses rayon to 0.9 as a dependency ([#8296](https://github.com/paritytech/parity/pull/8296)) ([#8302](https://github.com/paritytech/parity/pull/8302))
|
||||
- Include suicided accounts in state diff ([#8297](https://github.com/paritytech/parity/pull/8297))
|
||||
- Remove evmjit ([#8229](https://github.com/paritytech/parity/pull/8229))
|
||||
- Build: fix updater rand dependency in Cargo.lock ([#8298](https://github.com/paritytech/parity/pull/8298))
|
||||
- Honor --max-peers if --min-peers is not specified ([#8087](https://github.com/paritytech/parity/pull/8087))
|
||||
- Auto-updater improvements ([#8078](https://github.com/paritytech/parity/pull/8078))
|
||||
- Dapps-fetcher: calculate keccak in-flight while reading the response ([#8294](https://github.com/paritytech/parity/pull/8294))
|
||||
- Cleanup Ellaism bootnodes ([#8276](https://github.com/paritytech/parity/pull/8276))
|
||||
- Allow unsafe js eval on Parity Wallet. ([#8204](https://github.com/paritytech/parity/pull/8204))
|
||||
- Remove RefCell from Header ([#8227](https://github.com/paritytech/parity/pull/8227))
|
||||
- Typo fix: todo with no content ([#8292](https://github.com/paritytech/parity/pull/8292))
|
||||
- Revert "ci: disable link-dead-code in coverage build ([#8118](https://github.com/paritytech/parity/pull/8118))" ([#8287](https://github.com/paritytech/parity/pull/8287))
|
||||
- Bump ethabi & ethereum-types. ([#8258](https://github.com/paritytech/parity/pull/8258))
|
||||
- Allow customization of max WS connections. ([#8257](https://github.com/paritytech/parity/pull/8257))
|
||||
- Supress TemporaryInvalid verification failures. ([#8256](https://github.com/paritytech/parity/pull/8256))
|
||||
- Return null number for pending block in eth_getBlockByNumber ([#8281](https://github.com/paritytech/parity/pull/8281))
|
||||
- Use constant durations ([#8278](https://github.com/paritytech/parity/pull/8278))
|
||||
- Typo fix: Mode doc - RLP should be client ([#8283](https://github.com/paritytech/parity/pull/8283))
|
||||
- Eth_uninstallfilter should return false for non-existent filter ([#8280](https://github.com/paritytech/parity/pull/8280))
|
||||
- Update `app_dirs` to 1.2.1 ([#8268](https://github.com/paritytech/parity/pull/8268))
|
||||
- Add missing license header for runtime.rs ([#8252](https://github.com/paritytech/parity/pull/8252))
|
||||
- Warp-only sync with warp-barrier [blocknumber] flag. ([#8228](https://github.com/paritytech/parity/pull/8228))
|
||||
- Replace all Rlp usages with UntrustedRlp except for ethcore views ([#8233](https://github.com/paritytech/parity/pull/8233))
|
||||
- Add test for ethstore-cli, fixes [#8027](https://github.com/paritytech/parity/issues/8027) ([#8187](https://github.com/paritytech/parity/pull/8187))
|
||||
- Update musicoin spec in line with gmc v2.6.2 ([#8242](https://github.com/paritytech/parity/pull/8242))
|
||||
- Fixed ethcore tx_filter ([#8200](https://github.com/paritytech/parity/pull/8200))
|
||||
- Update CLI help for jsonrpc-apis, ws-apis and ipc-apis ([#8234](https://github.com/paritytech/parity/pull/8234))
|
||||
- Remove network stats ([#8225](https://github.com/paritytech/parity/pull/8225))
|
||||
- Node-filter does not use ChainNotify ([#8231](https://github.com/paritytech/parity/pull/8231))
|
||||
- Implement hardcoded sync in the light client ([#8075](https://github.com/paritytech/parity/pull/8075))
|
||||
- Update some of the dependencies for WASM ([#8223](https://github.com/paritytech/parity/pull/8223))
|
||||
- Bump wasmi version ([#8209](https://github.com/paritytech/parity/pull/8209))
|
||||
- Updated jsonrpc to point to the 1.11 branch ([#8180](https://github.com/paritytech/parity/pull/8180))
|
||||
- Change name Wallet -> UI ([#8164](https://github.com/paritytech/parity/pull/8164))
|
||||
- Introduce Parity UI ([#8202](https://github.com/paritytech/parity/pull/8202))
|
||||
- Update Changelogs ([#8175](https://github.com/paritytech/parity/pull/8175))
|
||||
- Returns number of topcis to take fr.. ([#8199](https://github.com/paritytech/parity/pull/8199))
|
||||
- Make docopt usage non-const ([#8189](https://github.com/paritytech/parity/pull/8189))
|
||||
- Avoid allocations when computing triehash. ([#8176](https://github.com/paritytech/parity/pull/8176))
|
||||
- Handle rlp decoding Result in patricia trie ([#8166](https://github.com/paritytech/parity/pull/8166))
|
||||
- Bump wasm libs ([#8171](https://github.com/paritytech/parity/pull/8171))
|
||||
- Re-enable signer, even with no UI. ([#8167](https://github.com/paritytech/parity/pull/8167))
|
||||
- Update daemonize ([#8165](https://github.com/paritytech/parity/pull/8165))
|
||||
- Some tiny modifications. ([#8163](https://github.com/paritytech/parity/pull/8163))
|
||||
- Secretstore: store key author address in db ([#7887](https://github.com/paritytech/parity/pull/7887))
|
||||
- Rename DatabaseValueView::new to from_rlp ([#8159](https://github.com/paritytech/parity/pull/8159))
|
||||
- Dapps: update parity-ui dependencies ([#8160](https://github.com/paritytech/parity/pull/8160))
|
||||
- Disable UI by default. ([#8105](https://github.com/paritytech/parity/pull/8105))
|
||||
- Fix wasmi x32 builds ([#8155](https://github.com/paritytech/parity/pull/8155))
|
||||
- Postpone Kovan hard fork ([#8137](https://github.com/paritytech/parity/pull/8137))
|
||||
- Secretstore: ability to identify requester via Public/Address ([#7886](https://github.com/paritytech/parity/pull/7886))
|
||||
- Optional dependency on secp256k1 for ethcrypto ([#8109](https://github.com/paritytech/parity/pull/8109))
|
||||
- Network: init discovery using healthy nodes ([#8061](https://github.com/paritytech/parity/pull/8061))
|
||||
- Check one step deeper if we're on release track branches ([#8134](https://github.com/paritytech/parity/pull/8134))
|
||||
- Explicitly mention pruning_history uses RAM ([#8130](https://github.com/paritytech/parity/pull/8130))
|
||||
- Remove `ethcrypto::{en,de}crypt_single_message`. ([#8126](https://github.com/paritytech/parity/pull/8126))
|
||||
- Fix typo ([#8124](https://github.com/paritytech/parity/pull/8124))
|
||||
- Secret_store: use `ecies::encrypt`/`ecies::decrypt`. ([#8125](https://github.com/paritytech/parity/pull/8125))
|
||||
- Fix comment for fn gas() in wasm/runtime ([#8122](https://github.com/paritytech/parity/pull/8122))
|
||||
- Structured rlp encoding in journaldb ([#8047](https://github.com/paritytech/parity/pull/8047))
|
||||
- Ci: disable link-dead-code in coverage build ([#8118](https://github.com/paritytech/parity/pull/8118))
|
||||
- Fix trace filter returning returning unrelated reward calls, closes [#8070](https://github.com/paritytech/parity/issues/8070) ([#8098](https://github.com/paritytech/parity/pull/8098))
|
||||
- Const time comparison ([#8113](https://github.com/paritytech/parity/pull/8113))
|
||||
- Replace reqwest with hyper ([#8099](https://github.com/paritytech/parity/pull/8099))
|
||||
- More dos protection ([#8104](https://github.com/paritytech/parity/pull/8104))
|
||||
- Remove the time dependency where possible ([#8100](https://github.com/paritytech/parity/pull/8100))
|
||||
- Fix comment for gas extern in Wasm runtime ([#8101](https://github.com/paritytech/parity/pull/8101))
|
||||
- Replace std::env::temp_dir with tempdir in tests ([#8103](https://github.com/paritytech/parity/pull/8103))
|
||||
- Fix Cargo.lock not parsable ([#8102](https://github.com/paritytech/parity/pull/8102))
|
||||
- Additional data in EVMTestClient ([#7964](https://github.com/paritytech/parity/pull/7964))
|
||||
- Update serde, serde-derive, ethabi-derive, syn, quote and rlp_derive ([#8085](https://github.com/paritytech/parity/pull/8085))
|
||||
- Ethcore-service ([#8089](https://github.com/paritytech/parity/pull/8089))
|
||||
- [contract-client] refactor ([#7978](https://github.com/paritytech/parity/pull/7978))
|
||||
- Revert removing blooms ([#8066](https://github.com/paritytech/parity/pull/8066))
|
||||
- Ethcore test::helpers cleanup ([#8086](https://github.com/paritytech/parity/pull/8086))
|
||||
- Add some dos protection ([#8084](https://github.com/paritytech/parity/pull/8084))
|
||||
- Wasm libraries bump ([#7970](https://github.com/paritytech/parity/pull/7970))
|
||||
- Echo back the message hash of a ping in the pong request ([#8042](https://github.com/paritytech/parity/pull/8042))
|
||||
- Add Kovan WASM activation blocknumber ([#8057](https://github.com/paritytech/parity/pull/8057))
|
||||
- [ethkey] Unify debug/display for Address/Public/Secret ([#8076](https://github.com/paritytech/parity/pull/8076))
|
||||
- Limit incoming connections. ([#8060](https://github.com/paritytech/parity/pull/8060))
|
||||
- Max code size on Kovan ([#8067](https://github.com/paritytech/parity/pull/8067))
|
||||
- Updater: apply exponential backoff after download failure ([#8059](https://github.com/paritytech/parity/pull/8059))
|
||||
- Make blockchain functions more idiomatic, avoid needless writes to cache_man ([#8054](https://github.com/paritytech/parity/pull/8054))
|
||||
- Make patricia-trie more idiomatic and remove redundant code ([#8056](https://github.com/paritytech/parity/pull/8056))
|
||||
- Abstract devp2p ([#8048](https://github.com/paritytech/parity/pull/8048))
|
||||
- Update refs to shell ([#8051](https://github.com/paritytech/parity/pull/8051))
|
||||
- Fix cache & snapcraft CI build ([#8052](https://github.com/paritytech/parity/pull/8052))
|
||||
- Prelude to the block module cleanup ([#8025](https://github.com/paritytech/parity/pull/8025))
|
||||
- Add MCIP-6 Byzyantium transition to Musicoin spec ([#7841](https://github.com/paritytech/parity/pull/7841))
|
||||
- Bump master to 1.11.0 ([#8021](https://github.com/paritytech/parity/pull/8021))
|
||||
- `client` refactoring ([#7038](https://github.com/paritytech/parity/pull/7038))
|
||||
- [hardware wallet] sleeping -> pollling ([#8018](https://github.com/paritytech/parity/pull/8018))
|
||||
- Fixed broken link in README ([#8012](https://github.com/paritytech/parity/pull/8012))
|
||||
- Support parity protocol. ([#8035](https://github.com/paritytech/parity/pull/8035))
|
||||
- Add changelog for 1.8.11 stable and 1.9.4 beta ([#8017](https://github.com/paritytech/parity/pull/8017))
|
||||
- Fix for verify_block_basic crashing on invalid transaction rlp ([#8032](https://github.com/paritytech/parity/pull/8032))
|
||||
- Extract the hard dependency on rocksdb from the light client ([#8034](https://github.com/paritytech/parity/pull/8034))
|
||||
- Fixed parsing ethash seals and verify_block_undordered ([#8031](https://github.com/paritytech/parity/pull/8031))
|
||||
- Fixed ethstore sign ([#8026](https://github.com/paritytech/parity/pull/8026))
|
||||
- Ci: Fix cargo cache ([#7968](https://github.com/paritytech/parity/pull/7968))
|
||||
- Update ref to new shell ([#8024](https://github.com/paritytech/parity/pull/8024))
|
||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 7.9 KiB |
@@ -3,11 +3,13 @@ name = "ethash"
|
||||
version = "1.12.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
|
||||
[lib]
|
||||
|
||||
[dependencies]
|
||||
crunchy = "0.1.0"
|
||||
either = "1.0.0"
|
||||
ethereum-types = "0.4"
|
||||
keccak-hash = "0.1"
|
||||
ethereum-types = "0.3"
|
||||
keccak-hash = { git = "https://github.com/paritytech/parity-common" }
|
||||
log = "0.4"
|
||||
memmap = "0.6"
|
||||
parking_lot = "0.6"
|
||||
|
||||
@@ -15,23 +15,23 @@ common-types = { path = "types" }
|
||||
crossbeam = "0.3"
|
||||
ethash = { path = "../ethash" }
|
||||
ethcore-bloom-journal = { path = "../util/bloom" }
|
||||
parity-bytes = "0.1"
|
||||
hashdb = "0.2.1"
|
||||
memorydb = "0.2.1"
|
||||
patricia-trie = "0.2"
|
||||
parity-bytes = { git = "https://github.com/paritytech/parity-common" }
|
||||
hashdb = { git = "https://github.com/paritytech/parity-common" }
|
||||
memorydb = { git = "https://github.com/paritytech/parity-common" }
|
||||
patricia-trie = { git = "https://github.com/paritytech/parity-common" }
|
||||
patricia-trie-ethereum = { path = "../util/patricia-trie-ethereum" }
|
||||
parity-crypto = "0.1"
|
||||
parity-crypto = { git = "https://github.com/paritytech/parity-common" }
|
||||
error-chain = { version = "0.12", default-features = false }
|
||||
ethcore-io = { path = "../util/io" }
|
||||
ethcore-logger = { path = "../logger" }
|
||||
ethcore-miner = { path = "../miner" }
|
||||
ethcore-stratum = { path = "./stratum", optional = true }
|
||||
ethcore-transaction = { path = "./transaction" }
|
||||
ethereum-types = "0.4"
|
||||
ethereum-types = "0.3"
|
||||
memory-cache = { path = "../util/memory_cache" }
|
||||
ethabi = "5.1.2"
|
||||
ethabi-derive = "5.1.3"
|
||||
ethabi-contract = "5.1.1"
|
||||
ethabi = "5.1"
|
||||
ethabi-derive = "5.0"
|
||||
ethabi-contract = "5.0"
|
||||
ethjson = { path = "../json" }
|
||||
ethkey = { path = "../ethkey" }
|
||||
ethstore = { path = "../ethstore" }
|
||||
@@ -39,7 +39,7 @@ evm = { path = "evm" }
|
||||
heapsize = "0.4"
|
||||
itertools = "0.5"
|
||||
lazy_static = "1.0"
|
||||
log = "0.4"
|
||||
log = "0.3"
|
||||
lru-cache = "0.1"
|
||||
num = { version = "0.1", default-features = false, features = ["bigint"] }
|
||||
num_cpus = "1.2"
|
||||
@@ -47,26 +47,26 @@ parity-machine = { path = "../machine" }
|
||||
parking_lot = "0.6"
|
||||
rayon = "1.0"
|
||||
rand = "0.4"
|
||||
rlp = { version = "0.2.4", features = ["ethereum"] }
|
||||
rlp = { git = "https://github.com/paritytech/parity-common" }
|
||||
rlp_compress = { path = "../util/rlp_compress" }
|
||||
rlp_derive = { path = "../util/rlp_derive" }
|
||||
kvdb = "0.1"
|
||||
kvdb-memorydb = "0.1"
|
||||
parity-snappy = "0.1"
|
||||
kvdb = { git = "https://github.com/paritytech/parity-common" }
|
||||
kvdb-memorydb = { git = "https://github.com/paritytech/parity-common" }
|
||||
snappy = { git = "https://github.com/paritytech/rust-snappy" }
|
||||
stop-guard = { path = "../util/stop-guard" }
|
||||
macros = { path = "../util/macros" }
|
||||
rustc-hex = "1.0"
|
||||
stats = { path = "../util/stats" }
|
||||
trace-time = "0.1"
|
||||
trace-time = { path = "../util/trace-time" }
|
||||
using_queue = { path = "../util/using_queue" }
|
||||
vm = { path = "vm" }
|
||||
wasm = { path = "wasm" }
|
||||
keccak-hash = "0.1"
|
||||
keccak-hash = { git = "https://github.com/paritytech/parity-common" }
|
||||
triehash-ethereum = { version = "0.2", path = "../util/triehash-ethereum" }
|
||||
unexpected = { path = "../util/unexpected" }
|
||||
journaldb = { path = "../util/journaldb" }
|
||||
keccak-hasher = { path = "../util/keccak-hasher" }
|
||||
kvdb-rocksdb = "0.1.3"
|
||||
kvdb-rocksdb = { git = "https://github.com/paritytech/parity-common" }
|
||||
tempdir = {version="0.3", optional = true}
|
||||
|
||||
[target.'cfg(any(target_os = "linux", target_os = "macos", target_os = "windows", target_os = "android"))'.dependencies]
|
||||
@@ -77,7 +77,7 @@ fake-hardware-wallet = { path = "../util/fake-hardware-wallet" }
|
||||
|
||||
[dev-dependencies]
|
||||
tempdir = "0.3"
|
||||
trie-standardmap = "0.1"
|
||||
trie-standardmap = { git = "https://github.com/paritytech/parity-common" }
|
||||
|
||||
[features]
|
||||
parity = ["work-notify", "price-info", "stratum"]
|
||||
|
||||
@@ -1,658 +0,0 @@
|
||||
// Copyright 2015-2018 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/>.
|
||||
|
||||
#![feature(test)]
|
||||
extern crate test;
|
||||
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
|
||||
extern crate ethcore;
|
||||
extern crate ethereum_types;
|
||||
extern crate parity_bytes as bytes;
|
||||
extern crate rustc_hex;
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use bytes::BytesRef;
|
||||
use ethcore::builtin::Builtin;
|
||||
use ethcore::machine::EthereumMachine;
|
||||
use ethereum_types::{Address, U256};
|
||||
use ethcore::ethereum::new_byzantium_test_machine;
|
||||
use rustc_hex::FromHex;
|
||||
use self::test::Bencher;
|
||||
|
||||
lazy_static! {
|
||||
static ref BYZANTIUM_MACHINE: EthereumMachine = new_byzantium_test_machine();
|
||||
}
|
||||
|
||||
struct BuiltinBenchmark<'a> {
|
||||
builtin: &'a Builtin,
|
||||
input: Vec<u8>,
|
||||
expected: Vec<u8>,
|
||||
}
|
||||
|
||||
impl<'a> BuiltinBenchmark<'a> {
|
||||
fn new(builtin_address: &'static str, input: &str, expected: &str) -> BuiltinBenchmark<'a> {
|
||||
let builtins = BYZANTIUM_MACHINE.builtins();
|
||||
|
||||
let builtin = builtins.get(&builtin_address.into()).unwrap().clone();
|
||||
let input = FromHex::from_hex(input).unwrap();
|
||||
let expected = FromHex::from_hex(expected).unwrap();
|
||||
|
||||
BuiltinBenchmark {
|
||||
builtin, input, expected
|
||||
}
|
||||
}
|
||||
|
||||
fn gas_cost(&self) -> U256 {
|
||||
self.builtin.cost(&self.input)
|
||||
}
|
||||
|
||||
fn run(&self, b: &mut Bencher) {
|
||||
let mut output = vec![0; self.expected.len()];
|
||||
|
||||
b.iter(|| {
|
||||
self.builtin.execute(&self.input, &mut BytesRef::Fixed(&mut output)).unwrap();
|
||||
});
|
||||
|
||||
assert_eq!(self.expected[..], output[..]);
|
||||
}
|
||||
}
|
||||
|
||||
fn bench(
|
||||
builtin_address: &'static str,
|
||||
input: &str,
|
||||
expected: &str,
|
||||
b: &mut Bencher,
|
||||
) {
|
||||
let bench = BuiltinBenchmark::new(builtin_address, input, expected);
|
||||
|
||||
println!("gas cost: {}", bench.gas_cost());
|
||||
bench.run(b);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn ecrecover(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000001", // ecrecover
|
||||
"38d18acb67d25c8bb9942764b62f18e17054f66a817bd4295423adf9ed98873e000000000000000000000000000000000000000000000000000000000000001b38d18acb67d25c8bb9942764b62f18e17054f66a817bd4295423adf9ed98873e789d1dd423d25f0772d2748d60f7e4b81bb14d086eba8e8e8efb6dcff8a4ae02",
|
||||
"000000000000000000000000ceaccac640adf55b2028469bd36ba501f28b699d",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn sha256(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000002", // sha256
|
||||
"38d18acb67d25c8bb9942764b62f18e17054f66a817bd4295423adf9ed98873e000000000000000000000000000000000000000000000000000000000000001b38d18acb67d25c8bb9942764b62f18e17054f66a817bd4295423adf9ed98873e789d1dd423d25f0772d2748d60f7e4b81bb14d086eba8e8e8efb6dcff8a4ae02",
|
||||
"811c7003375852fabd0d362e40e68607a12bdabae61a7d068fe5fdd1dbbf2a5d",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn ripemd(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000003", // ripemd
|
||||
"38d18acb67d25c8bb9942764b62f18e17054f66a817bd4295423adf9ed98873e000000000000000000000000000000000000000000000000000000000000001b38d18acb67d25c8bb9942764b62f18e17054f66a817bd4295423adf9ed98873e789d1dd423d25f0772d2748d60f7e4b81bb14d086eba8e8e8efb6dcff8a4ae02",
|
||||
"0000000000000000000000009215b8d9882ff46f0dfde6684d78e831467f65e6",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn identity(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000004", // identity
|
||||
"38d18acb67d25c8bb9942764b62f18e17054f66a817bd4295423adf9ed98873e000000000000000000000000000000000000000000000000000000000000001b38d18acb67d25c8bb9942764b62f18e17054f66a817bd4295423adf9ed98873e789d1dd423d25f0772d2748d60f7e4b81bb14d086eba8e8e8efb6dcff8a4ae02",
|
||||
"38d18acb67d25c8bb9942764b62f18e17054f66a817bd4295423adf9ed98873e000000000000000000000000000000000000000000000000000000000000001b38d18acb67d25c8bb9942764b62f18e17054f66a817bd4295423adf9ed98873e789d1dd423d25f0772d2748d60f7e4b81bb14d086eba8e8e8efb6dcff8a4ae02",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn modexp_eip_example1(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000005", // modexp
|
||||
"00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002003fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2efffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f",
|
||||
"0000000000000000000000000000000000000000000000000000000000000001",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn modexp_eip_example2(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000005", // modexp
|
||||
"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2efffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f",
|
||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn modexp_nagydani_1_square(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000005", // modexp
|
||||
"000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040e09ad9675465c53a109fac66a445c91b292d2bb2c5268addb30cd82f80fcb0033ff97c80a5fc6f39193ae969c6ede6710a6b7ac27078a06d90ef1c72e5c85fb502fc9e1f6beb81516545975218075ec2af118cd8798df6e08a147c60fd6095ac2bb02c2908cf4dd7c81f11c289e4bce98f3553768f392a80ce22bf5c4f4a248c6b",
|
||||
"60008f1614cc01dcfb6bfb09c625cf90b47d4468db81b5f8b7a39d42f332eab9b2da8f2d95311648a8f243f4bb13cfb3d8f7f2a3c014122ebb3ed41b02783adc",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn modexp_nagydani_1_qube(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000005", // modexp
|
||||
"000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040e09ad9675465c53a109fac66a445c91b292d2bb2c5268addb30cd82f80fcb0033ff97c80a5fc6f39193ae969c6ede6710a6b7ac27078a06d90ef1c72e5c85fb503fc9e1f6beb81516545975218075ec2af118cd8798df6e08a147c60fd6095ac2bb02c2908cf4dd7c81f11c289e4bce98f3553768f392a80ce22bf5c4f4a248c6b",
|
||||
"4834a46ba565db27903b1c720c9d593e84e4cbd6ad2e64b31885d944f68cd801f92225a8961c952ddf2797fa4701b330c85c4b363798100b921a1a22a46a7fec",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn modexp_nagydani_1_pow0x10001(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000005", // modexp
|
||||
"000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000040e09ad9675465c53a109fac66a445c91b292d2bb2c5268addb30cd82f80fcb0033ff97c80a5fc6f39193ae969c6ede6710a6b7ac27078a06d90ef1c72e5c85fb5010001fc9e1f6beb81516545975218075ec2af118cd8798df6e08a147c60fd6095ac2bb02c2908cf4dd7c81f11c289e4bce98f3553768f392a80ce22bf5c4f4a248c6b",
|
||||
"c36d804180c35d4426b57b50c5bfcca5c01856d104564cd513b461d3c8b8409128a5573e416d0ebe38f5f736766d9dc27143e4da981dfa4d67f7dc474cbee6d2",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn modexp_nagydani_2_square(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000005", // modexp
|
||||
"000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000080cad7d991a00047dd54d3399b6b0b937c718abddef7917c75b6681f40cc15e2be0003657d8d4c34167b2f0bbbca0ccaa407c2a6a07d50f1517a8f22979ce12a81dcaf707cc0cebfc0ce2ee84ee7f77c38b9281b9822a8d3de62784c089c9b18dcb9a2a5eecbede90ea788a862a9ddd9d609c2c52972d63e289e28f6a590ffbf5102e6d893b80aeed5e6e9ce9afa8a5d5675c93a32ac05554cb20e9951b2c140e3ef4e433068cf0fb73bc9f33af1853f64aa27a0028cbf570d7ac9048eae5dc7b28c87c31e5810f1e7fa2cda6adf9f1076dbc1ec1238560071e7efc4e9565c49be9e7656951985860a558a754594115830bcdb421f741408346dd5997bb01c287087",
|
||||
"981dd99c3b113fae3e3eaa9435c0dc96779a23c12a53d1084b4f67b0b053a27560f627b873e3f16ad78f28c94f14b6392def26e4d8896c5e3c984e50fa0b3aa44f1da78b913187c6128baa9340b1e9c9a0fd02cb78885e72576da4a8f7e5a113e173a7a2889fde9d407bd9f06eb05bc8fc7b4229377a32941a02bf4edcc06d70",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
#[bench]
|
||||
fn modexp_nagydani_2_qube(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000005", // modexp
|
||||
"000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000080cad7d991a00047dd54d3399b6b0b937c718abddef7917c75b6681f40cc15e2be0003657d8d4c34167b2f0bbbca0ccaa407c2a6a07d50f1517a8f22979ce12a81dcaf707cc0cebfc0ce2ee84ee7f77c38b9281b9822a8d3de62784c089c9b18dcb9a2a5eecbede90ea788a862a9ddd9d609c2c52972d63e289e28f6a590ffbf5103e6d893b80aeed5e6e9ce9afa8a5d5675c93a32ac05554cb20e9951b2c140e3ef4e433068cf0fb73bc9f33af1853f64aa27a0028cbf570d7ac9048eae5dc7b28c87c31e5810f1e7fa2cda6adf9f1076dbc1ec1238560071e7efc4e9565c49be9e7656951985860a558a754594115830bcdb421f741408346dd5997bb01c287087",
|
||||
"d89ceb68c32da4f6364978d62aaa40d7b09b59ec61eb3c0159c87ec3a91037f7dc6967594e530a69d049b64adfa39c8fa208ea970cfe4b7bcd359d345744405afe1cbf761647e32b3184c7fbe87cee8c6c7ff3b378faba6c68b83b6889cb40f1603ee68c56b4c03d48c595c826c041112dc941878f8c5be828154afd4a16311f",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn modexp_nagydani_2_pow0x10001(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000005", // modexp
|
||||
"000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000080cad7d991a00047dd54d3399b6b0b937c718abddef7917c75b6681f40cc15e2be0003657d8d4c34167b2f0bbbca0ccaa407c2a6a07d50f1517a8f22979ce12a81dcaf707cc0cebfc0ce2ee84ee7f77c38b9281b9822a8d3de62784c089c9b18dcb9a2a5eecbede90ea788a862a9ddd9d609c2c52972d63e289e28f6a590ffbf51010001e6d893b80aeed5e6e9ce9afa8a5d5675c93a32ac05554cb20e9951b2c140e3ef4e433068cf0fb73bc9f33af1853f64aa27a0028cbf570d7ac9048eae5dc7b28c87c31e5810f1e7fa2cda6adf9f1076dbc1ec1238560071e7efc4e9565c49be9e7656951985860a558a754594115830bcdb421f741408346dd5997bb01c287087",
|
||||
"ad85e8ef13fd1dd46eae44af8b91ad1ccae5b7a1c92944f92a19f21b0b658139e0cabe9c1f679507c2de354bf2c91ebd965d1e633978a830d517d2f6f8dd5fd58065d58559de7e2334a878f8ec6992d9b9e77430d4764e863d77c0f87beede8f2f7f2ab2e7222f85cc9d98b8467f4bb72e87ef2882423ebdb6daf02dddac6db2",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn modexp_nagydani_3_square(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000005", // modexp
|
||||
"000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000100c9130579f243e12451760976261416413742bd7c91d39ae087f46794062b8c239f2a74abf3918605a0e046a7890e049475ba7fbb78f5de6490bd22a710cc04d30088179a919d86c2da62cf37f59d8f258d2310d94c24891be2d7eeafaa32a8cb4b0cfe5f475ed778f45907dc8916a73f03635f233f7a77a00a3ec9ca6761a5bbd558a2318ecd0caa1c5016691523e7e1fa267dd35e70c66e84380bdcf7c0582f540174e572c41f81e93da0b757dff0b0fe23eb03aa19af0bdec3afb474216febaacb8d0381e631802683182b0fe72c28392539850650b70509f54980241dc175191a35d967288b532a7a8223ce2440d010615f70df269501944d4ec16fe4a3cb02d7a85909174757835187cb52e71934e6c07ef43b4c46fc30bbcd0bc72913068267c54a4aabebb493922492820babdeb7dc9b1558fcf7bd82c37c82d3147e455b623ab0efa752fe0b3a67ca6e4d126639e645a0bf417568adbb2a6a4eef62fa1fa29b2a5a43bebea1f82193a7dd98eb483d09bb595af1fa9c97c7f41f5649d976aee3e5e59e2329b43b13bea228d4a93f16ba139ccb511de521ffe747aa2eca664f7c9e33da59075cc335afcd2bf3ae09765f01ab5a7c3e3938ec168b74724b5074247d200d9970382f683d6059b94dbc336603d1dfee714e4b447ac2fa1d99ecb4961da2854e03795ed758220312d101e1e3d87d5313a6d052aebde75110363d",
|
||||
"affc7507ea6d84751ec6b3f0d7b99dbcc263f33330e450d1b3ff0bc3d0874320bf4edd57debd587306988157958cb3cfd369cc0c9c198706f635c9e0f15d047df5cb44d03e2727f26b083c4ad8485080e1293f171c1ed52aef5993a5815c35108e848c951cf1e334490b4a539a139e57b68f44fee583306f5b85ffa57206b3ee5660458858534e5386b9584af3c7f67806e84c189d695e5eb96e1272d06ec2df5dc5fabc6e94b793718c60c36be0a4d031fc84cd658aa72294b2e16fc240aef70cb9e591248e38bd49c5a554d1afa01f38dab72733092f7555334bbef6c8c430119840492380aa95fa025dcf699f0a39669d812b0c6946b6091e6e235337b6f8",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn modexp_nagydani_3_qube(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000005", // modexp
|
||||
"000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000100c9130579f243e12451760976261416413742bd7c91d39ae087f46794062b8c239f2a74abf3918605a0e046a7890e049475ba7fbb78f5de6490bd22a710cc04d30088179a919d86c2da62cf37f59d8f258d2310d94c24891be2d7eeafaa32a8cb4b0cfe5f475ed778f45907dc8916a73f03635f233f7a77a00a3ec9ca6761a5bbd558a2318ecd0caa1c5016691523e7e1fa267dd35e70c66e84380bdcf7c0582f540174e572c41f81e93da0b757dff0b0fe23eb03aa19af0bdec3afb474216febaacb8d0381e631802683182b0fe72c28392539850650b70509f54980241dc175191a35d967288b532a7a8223ce2440d010615f70df269501944d4ec16fe4a3cb03d7a85909174757835187cb52e71934e6c07ef43b4c46fc30bbcd0bc72913068267c54a4aabebb493922492820babdeb7dc9b1558fcf7bd82c37c82d3147e455b623ab0efa752fe0b3a67ca6e4d126639e645a0bf417568adbb2a6a4eef62fa1fa29b2a5a43bebea1f82193a7dd98eb483d09bb595af1fa9c97c7f41f5649d976aee3e5e59e2329b43b13bea228d4a93f16ba139ccb511de521ffe747aa2eca664f7c9e33da59075cc335afcd2bf3ae09765f01ab5a7c3e3938ec168b74724b5074247d200d9970382f683d6059b94dbc336603d1dfee714e4b447ac2fa1d99ecb4961da2854e03795ed758220312d101e1e3d87d5313a6d052aebde75110363d",
|
||||
"1b280ecd6a6bf906b806d527c2a831e23b238f89da48449003a88ac3ac7150d6a5e9e6b3be4054c7da11dd1e470ec29a606f5115801b5bf53bc1900271d7c3ff3cd5ed790d1c219a9800437a689f2388ba1a11d68f6a8e5b74e9a3b1fac6ee85fc6afbac599f93c391f5dc82a759e3c6c0ab45ce3f5d25d9b0c1bf94cf701ea6466fc9a478dacc5754e593172b5111eeba88557048bceae401337cd4c1182ad9f700852bc8c99933a193f0b94cf1aedbefc48be3bc93ef5cb276d7c2d5462ac8bb0c8fe8923a1db2afe1c6b90d59c534994a6a633f0ead1d638fdc293486bb634ff2c8ec9e7297c04241a61c37e3ae95b11d53343d4ba2b4cc33d2cfa7eb705e",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn modexp_nagydani_3_pow0x10001(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000005", // modexp
|
||||
"000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000100c9130579f243e12451760976261416413742bd7c91d39ae087f46794062b8c239f2a74abf3918605a0e046a7890e049475ba7fbb78f5de6490bd22a710cc04d30088179a919d86c2da62cf37f59d8f258d2310d94c24891be2d7eeafaa32a8cb4b0cfe5f475ed778f45907dc8916a73f03635f233f7a77a00a3ec9ca6761a5bbd558a2318ecd0caa1c5016691523e7e1fa267dd35e70c66e84380bdcf7c0582f540174e572c41f81e93da0b757dff0b0fe23eb03aa19af0bdec3afb474216febaacb8d0381e631802683182b0fe72c28392539850650b70509f54980241dc175191a35d967288b532a7a8223ce2440d010615f70df269501944d4ec16fe4a3cb010001d7a85909174757835187cb52e71934e6c07ef43b4c46fc30bbcd0bc72913068267c54a4aabebb493922492820babdeb7dc9b1558fcf7bd82c37c82d3147e455b623ab0efa752fe0b3a67ca6e4d126639e645a0bf417568adbb2a6a4eef62fa1fa29b2a5a43bebea1f82193a7dd98eb483d09bb595af1fa9c97c7f41f5649d976aee3e5e59e2329b43b13bea228d4a93f16ba139ccb511de521ffe747aa2eca664f7c9e33da59075cc335afcd2bf3ae09765f01ab5a7c3e3938ec168b74724b5074247d200d9970382f683d6059b94dbc336603d1dfee714e4b447ac2fa1d99ecb4961da2854e03795ed758220312d101e1e3d87d5313a6d052aebde75110363d",
|
||||
"37843d7c67920b5f177372fa56e2a09117df585f81df8b300fba245b1175f488c99476019857198ed459ed8d9799c377330e49f4180c4bf8e8f66240c64f65ede93d601f957b95b83efdee1e1bfde74169ff77002eaf078c71815a9220c80b2e3b3ff22c2f358111d816ebf83c2999026b6de50bfc711ff68705d2f40b753424aefc9f70f08d908b5a20276ad613b4ab4309a3ea72f0c17ea9df6b3367d44fb3acab11c333909e02e81ea2ed404a712d3ea96bba87461720e2d98723e7acd0520ac1a5212dbedcd8dc0c1abf61d4719e319ff4758a774790b8d463cdfe131d1b2dcfee52d002694e98e720cb6ae7ccea353bc503269ba35f0f63bf8d7b672a76",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn modexp_nagydani_4_square(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000005", // modexp
|
||||
"000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000200db34d0e438249c0ed685c949cc28776a05094e1c48691dc3f2dca5fc3356d2a0663bd376e4712839917eb9a19c670407e2c377a2de385a3ff3b52104f7f1f4e0c7bf7717fb913896693dc5edbb65b760ef1b00e42e9d8f9af17352385e1cd742c9b006c0f669995cb0bb21d28c0aced2892267637b6470d8cee0ab27fc5d42658f6e88240c31d6774aa60a7ebd25cd48b56d0da11209f1928e61005c6eb709f3e8e0aaf8d9b10f7d7e296d772264dc76897ccdddadc91efa91c1903b7232a9e4c3b941917b99a3bc0c26497dedc897c25750af60237aa67934a26a2bc491db3dcc677491944bc1f51d3e5d76b8d846a62db03dedd61ff508f91a56d71028125035c3a44cbb041497c83bf3e4ae2a9613a401cc721c547a2afa3b16a2969933d3626ed6d8a7428648f74122fd3f2a02a20758f7f693892c8fd798b39abac01d18506c45e71432639e9f9505719ee822f62ccbf47f6850f096ff77b5afaf4be7d772025791717dbe5abf9b3f40cff7d7aab6f67e38f62faf510747276e20a42127e7500c444f9ed92baf65ade9e836845e39c4316d9dce5f8e2c8083e2c0acbb95296e05e51aab13b6b8f53f06c9c4276e12b0671133218cc3ea907da3bd9a367096d9202128d14846cc2e20d56fc8473ecb07cecbfb8086919f3971926e7045b853d85a69d026195c70f9f7a823536e2a8f4b3e12e94d9b53a934353451094b8102df3143a0057457d75e8c708b6337a6f5a4fd1a06727acf9fb93e2993c62f3378b37d56c85e7b1e00f0145ebf8e4095bd723166293c60b6ac1252291ef65823c9e040ddad14969b3b340a4ef714db093a587c37766d68b8d6b5016e741587e7e6bf7e763b44f0247e64bae30f994d248bfd20541a333e5b225ef6a61199e301738b1e688f70ec1d7fb892c183c95dc543c3e12adf8a5e8b9ca9d04f9445cced3ab256f29e998e69efaa633a7b60e1db5a867924ccab0a171d9d6e1098dfa15acde9553de599eaa56490c8f411e4985111f3d40bddfc5e301edb01547b01a886550a61158f7e2033c59707789bf7c854181d0c2e2a42a93cf09209747d7082e147eb8544de25c3eb14f2e35559ea0c0f5877f2f3fc92132c0ae9da4e45b2f6c866a224ea6d1f28c05320e287750fbc647368d41116e528014cc1852e5531d53e4af938374daba6cee4baa821ed07117253bb3601ddd00d59a3d7fb2ef1f5a2fbba7c429f0cf9a5b3462410fd833a69118f8be9c559b1000cc608fd877fb43f8e65c2d1302622b944462579056874b387208d90623fcdaf93920ca7a9e4ba64ea208758222ad868501cc2c345e2d3a5ea2a17e5069248138c8a79c0251185d29ee73e5afab5354769142d2bf0cb6712727aa6bf84a6245fcdae66e4938d84d1b9dd09a884818622080ff5f98942fb20acd7e0c916c2d5ea7ce6f7e173315384518f",
|
||||
"8a5aea5f50dcc03dc7a7a272b5aeebc040554dbc1ffe36753c4fc75f7ed5f6c2cc0de3a922bf96c78bf0643a73025ad21f45a4a5cadd717612c511ab2bff1190fe5f1ae05ba9f8fe3624de1de2a817da6072ddcdb933b50216811dbe6a9ca79d3a3c6b3a476b079fd0d05f04fb154e2dd3e5cb83b148a006f2bcbf0042efb2ae7b916ea81b27aac25c3bf9a8b6d35440062ad8eae34a83f3ffa2cc7b40346b62174a4422584f72f95316f6b2bee9ff232ba9739301c97c99a9ded26c45d72676eb856ad6ecc81d36a6de36d7f9dafafee11baa43a4b0d5e4ecffa7b9b7dcefd58c397dd373e6db4acd2b2c02717712e6289bed7c813b670c4a0c6735aa7f3b0f1ce556eae9fcc94b501b2c8781ba50a8c6220e8246371c3c7359fe4ef9da786ca7d98256754ca4e496be0a9174bedbecb384bdf470779186d6a833f068d2838a88d90ef3ad48ff963b67c39cc5a3ee123baf7bf3125f64e77af7f30e105d72c4b9b5b237ed251e4c122c6d8c1405e736299c3afd6db16a28c6a9cfa68241e53de4cd388271fe534a6a9b0dbea6171d170db1b89858468885d08fecbd54c8e471c3e25d48e97ba450b96d0d87e00ac732aaa0d3ce4309c1064bd8a4c0808a97e0143e43a24cfa847635125cd41c13e0574487963e9d725c01375db99c31da67b4cf65eff555f0c0ac416c727ff8d438ad7c42030551d68c2e7adda0abb1ca7c10",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn modexp_nagydani_4_qube(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000005", // modexp
|
||||
"000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000200db34d0e438249c0ed685c949cc28776a05094e1c48691dc3f2dca5fc3356d2a0663bd376e4712839917eb9a19c670407e2c377a2de385a3ff3b52104f7f1f4e0c7bf7717fb913896693dc5edbb65b760ef1b00e42e9d8f9af17352385e1cd742c9b006c0f669995cb0bb21d28c0aced2892267637b6470d8cee0ab27fc5d42658f6e88240c31d6774aa60a7ebd25cd48b56d0da11209f1928e61005c6eb709f3e8e0aaf8d9b10f7d7e296d772264dc76897ccdddadc91efa91c1903b7232a9e4c3b941917b99a3bc0c26497dedc897c25750af60237aa67934a26a2bc491db3dcc677491944bc1f51d3e5d76b8d846a62db03dedd61ff508f91a56d71028125035c3a44cbb041497c83bf3e4ae2a9613a401cc721c547a2afa3b16a2969933d3626ed6d8a7428648f74122fd3f2a02a20758f7f693892c8fd798b39abac01d18506c45e71432639e9f9505719ee822f62ccbf47f6850f096ff77b5afaf4be7d772025791717dbe5abf9b3f40cff7d7aab6f67e38f62faf510747276e20a42127e7500c444f9ed92baf65ade9e836845e39c4316d9dce5f8e2c8083e2c0acbb95296e05e51aab13b6b8f53f06c9c4276e12b0671133218cc3ea907da3bd9a367096d9202128d14846cc2e20d56fc8473ecb07cecbfb8086919f3971926e7045b853d85a69d026195c70f9f7a823536e2a8f4b3e12e94d9b53a934353451094b8103df3143a0057457d75e8c708b6337a6f5a4fd1a06727acf9fb93e2993c62f3378b37d56c85e7b1e00f0145ebf8e4095bd723166293c60b6ac1252291ef65823c9e040ddad14969b3b340a4ef714db093a587c37766d68b8d6b5016e741587e7e6bf7e763b44f0247e64bae30f994d248bfd20541a333e5b225ef6a61199e301738b1e688f70ec1d7fb892c183c95dc543c3e12adf8a5e8b9ca9d04f9445cced3ab256f29e998e69efaa633a7b60e1db5a867924ccab0a171d9d6e1098dfa15acde9553de599eaa56490c8f411e4985111f3d40bddfc5e301edb01547b01a886550a61158f7e2033c59707789bf7c854181d0c2e2a42a93cf09209747d7082e147eb8544de25c3eb14f2e35559ea0c0f5877f2f3fc92132c0ae9da4e45b2f6c866a224ea6d1f28c05320e287750fbc647368d41116e528014cc1852e5531d53e4af938374daba6cee4baa821ed07117253bb3601ddd00d59a3d7fb2ef1f5a2fbba7c429f0cf9a5b3462410fd833a69118f8be9c559b1000cc608fd877fb43f8e65c2d1302622b944462579056874b387208d90623fcdaf93920ca7a9e4ba64ea208758222ad868501cc2c345e2d3a5ea2a17e5069248138c8a79c0251185d29ee73e5afab5354769142d2bf0cb6712727aa6bf84a6245fcdae66e4938d84d1b9dd09a884818622080ff5f98942fb20acd7e0c916c2d5ea7ce6f7e173315384518f",
|
||||
"5a2664252aba2d6e19d9600da582cdd1f09d7a890ac48e6b8da15ae7c6ff1856fc67a841ac2314d283ffa3ca81a0ecf7c27d89ef91a5a893297928f5da0245c99645676b481b7e20a566ee6a4f2481942bee191deec5544600bb2441fd0fb19e2ee7d801ad8911c6b7750affec367a4b29a22942c0f5f4744a4e77a8b654da2a82571037099e9c6d930794efe5cdca73c7b6c0844e386bdca8ea01b3d7807146bb81365e2cdc6475f8c23e0ff84463126189dc9789f72bbce2e3d2d114d728a272f1345122de23df54c922ec7a16e5c2a8f84da8871482bd258c20a7c09bbcd64c7a96a51029bbfe848736a6ba7bf9d931a9b7de0bcaf3635034d4958b20ae9ab3a95a147b0421dd5f7ebff46c971010ebfc4adbbe0ad94d5498c853e7142c450d8c71de4b2f84edbf8acd2e16d00c8115b150b1c30e553dbb82635e781379fe2a56360420ff7e9f70cc64c00aba7e26ed13c7c19622865ae07248daced36416080f35f8cc157a857ed70ea4f347f17d1bee80fa038abd6e39b1ba06b97264388b21364f7c56e192d4b62d9b161405f32ab1e2594e86243e56fcf2cb30d21adef15b9940f91af681da24328c883d892670c6aa47940867a81830a82b82716895db810df1b834640abefb7db2092dd92912cb9a735175bc447be40a503cf22dfe565b4ed7a3293ca0dfd63a507430b323ee248ec82e843b673c97ad730728cebc",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn modexp_nagydani_4_pow0x10001(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000005", // modexp
|
||||
"000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000200db34d0e438249c0ed685c949cc28776a05094e1c48691dc3f2dca5fc3356d2a0663bd376e4712839917eb9a19c670407e2c377a2de385a3ff3b52104f7f1f4e0c7bf7717fb913896693dc5edbb65b760ef1b00e42e9d8f9af17352385e1cd742c9b006c0f669995cb0bb21d28c0aced2892267637b6470d8cee0ab27fc5d42658f6e88240c31d6774aa60a7ebd25cd48b56d0da11209f1928e61005c6eb709f3e8e0aaf8d9b10f7d7e296d772264dc76897ccdddadc91efa91c1903b7232a9e4c3b941917b99a3bc0c26497dedc897c25750af60237aa67934a26a2bc491db3dcc677491944bc1f51d3e5d76b8d846a62db03dedd61ff508f91a56d71028125035c3a44cbb041497c83bf3e4ae2a9613a401cc721c547a2afa3b16a2969933d3626ed6d8a7428648f74122fd3f2a02a20758f7f693892c8fd798b39abac01d18506c45e71432639e9f9505719ee822f62ccbf47f6850f096ff77b5afaf4be7d772025791717dbe5abf9b3f40cff7d7aab6f67e38f62faf510747276e20a42127e7500c444f9ed92baf65ade9e836845e39c4316d9dce5f8e2c8083e2c0acbb95296e05e51aab13b6b8f53f06c9c4276e12b0671133218cc3ea907da3bd9a367096d9202128d14846cc2e20d56fc8473ecb07cecbfb8086919f3971926e7045b853d85a69d026195c70f9f7a823536e2a8f4b3e12e94d9b53a934353451094b81010001df3143a0057457d75e8c708b6337a6f5a4fd1a06727acf9fb93e2993c62f3378b37d56c85e7b1e00f0145ebf8e4095bd723166293c60b6ac1252291ef65823c9e040ddad14969b3b340a4ef714db093a587c37766d68b8d6b5016e741587e7e6bf7e763b44f0247e64bae30f994d248bfd20541a333e5b225ef6a61199e301738b1e688f70ec1d7fb892c183c95dc543c3e12adf8a5e8b9ca9d04f9445cced3ab256f29e998e69efaa633a7b60e1db5a867924ccab0a171d9d6e1098dfa15acde9553de599eaa56490c8f411e4985111f3d40bddfc5e301edb01547b01a886550a61158f7e2033c59707789bf7c854181d0c2e2a42a93cf09209747d7082e147eb8544de25c3eb14f2e35559ea0c0f5877f2f3fc92132c0ae9da4e45b2f6c866a224ea6d1f28c05320e287750fbc647368d41116e528014cc1852e5531d53e4af938374daba6cee4baa821ed07117253bb3601ddd00d59a3d7fb2ef1f5a2fbba7c429f0cf9a5b3462410fd833a69118f8be9c559b1000cc608fd877fb43f8e65c2d1302622b944462579056874b387208d90623fcdaf93920ca7a9e4ba64ea208758222ad868501cc2c345e2d3a5ea2a17e5069248138c8a79c0251185d29ee73e5afab5354769142d2bf0cb6712727aa6bf84a6245fcdae66e4938d84d1b9dd09a884818622080ff5f98942fb20acd7e0c916c2d5ea7ce6f7e173315384518f",
|
||||
"bed8b970c4a34849fc6926b08e40e20b21c15ed68d18f228904878d4370b56322d0da5789da0318768a374758e6375bfe4641fca5285ec7171828922160f48f5ca7efbfee4d5148612c38ad683ae4e3c3a053d2b7c098cf2b34f2cb19146eadd53c86b2d7ccf3d83b2c370bfb840913ee3879b1057a6b4e07e110b6bcd5e958bc71a14798c91d518cc70abee264b0d25a4110962a764b364ac0b0dd1ee8abc8426d775ec0f22b7e47b32576afaf1b5a48f64573ed1c5c29f50ab412188d9685307323d990802b81dacc06c6e05a1e901830ba9fcc67688dc29c5e27bde0a6e845ca925f5454b6fb3747edfaa2a5820838fb759eadf57f7cb5cec57fc213ddd8a4298fa079c3c0f472b07fb15aa6a7f0a3780bd296ff6a62e58ef443870b02260bd4fd2bbc98255674b8e1f1f9f8d33c7170b0ebbea4523b695911abbf26e41885344823bd0587115fdd83b721a4e8457a31c9a84b3d3520a07e0e35df7f48e5a9d534d0ec7feef1ff74de6a11e7f93eab95175b6ce22c68d78a642ad642837897ec11349205d8593ac19300207572c38d29ca5dfa03bc14cdbc32153c80e5cc3e739403d34c75915e49beb43094cc6dcafb3665b305ddec9286934ae66ec6b777ca528728c851318eb0f207b39f1caaf96db6eeead6b55ed08f451939314577d42bcc9f97c0b52d0234f88fd07e4c1d7780fdebc025cfffcb572cb27a8c33963",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn modexp_nagydani_5_square(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000005", // modexp
|
||||
"000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000400c5a1611f8be90071a43db23cc2fe01871cc4c0e8ab5743f6378e4fef77f7f6db0095c0727e20225beb665645403453e325ad5f9aeb9ba99bf3c148f63f9c07cf4fe8847ad5242d6b7d4499f93bd47056ddab8f7dee878fc2314f344dbee2a7c41a5d3db91eff372c730c2fdd3a141a4b61999e36d549b9870cf2f4e632c4d5df5f024f81c028000073a0ed8847cfb0593d36a47142f578f05ccbe28c0c06aeb1b1da027794c48db880278f79ba78ae64eedfea3c07d10e0562668d839749dc95f40467d15cf65b9cfc52c7c4bcef1cda3596dd52631aac942f146c7cebd46065131699ce8385b0db1874336747ee020a5698a3d1a1082665721e769567f579830f9d259cec1a836845109c21cf6b25da572512bf3c42fd4b96e43895589042ab60dd41f497db96aec102087fe784165bb45f942859268fd2ff6c012d9d00c02ba83eace047cc5f7b2c392c2955c58a49f0338d6fc58749c9db2155522ac17914ec216ad87f12e0ee95574613942fa615898c4d9e8a3be68cd6afa4e7a003dedbdf8edfee31162b174f965b20ae752ad89c967b3068b6f722c16b354456ba8e280f987c08e0a52d40a2e8f3a59b94d590aeef01879eb7a90b3ee7d772c839c85519cbeaddc0c193ec4874a463b53fcaea3271d80ebfb39b33489365fc039ae549a17a9ff898eea2f4cb27b8dbee4c17b998438575b2b8d107e4a0d66ba7fca85b41a58a8d51f191a35c856dfbe8aef2b00048a694bbccff832d23c8ca7a7ff0b6c0b3011d00b97c86c0628444d267c951d9e4fb8f83e154b8f74fb51aa16535e498235c5597dac9606ed0be3173a3836baa4e7d756ffe1e2879b415d3846bccd538c05b847785699aefde3e305decb600cd8fb0e7d8de5efc26971a6ad4e6d7a2d91474f1023a0ac4b78dc937da0ce607a45974d2cac1c33a2631ff7fe6144a3b2e5cf98b531a9627dea92c1dc82204d09db0439b6a11dd64b484e1263aa45fd9539b6020b55e3baece3986a8bffc1003406348f5c61265099ed43a766ee4f93f5f9c5abbc32a0fd3ac2b35b87f9ec26037d88275bd7dd0a54474995ee34ed3727f3f97c48db544b1980193a4b76a8a3ddab3591ce527f16d91882e67f0103b5cda53f7da54d489fc4ac08b6ab358a5a04aa9daa16219d50bd672a7cb804ed769d218807544e5993f1c27427104b349906a0b654df0bf69328afd3013fbe430155339c39f236df5557bf92f1ded7ff609a8502f49064ec3d1dbfb6c15d3a4c11a4f8acd12278cbf68acd5709463d12e3338a6eddb8c112f199645e23154a8e60879d2a654e3ed9296aa28f134168619691cd2c6b9e2eba4438381676173fc63c2588a3c5910dc149cf3760f0aa9fa9c3f5faa9162b0bf1aac9dd32b706a60ef53cbdb394b6b40222b5bc80eea82ba8958386672564cae3794f977871ab62337cf02e30049201ec12937e7ce79d0f55d9c810e20acf52212aca1d3888949e0e4830aad88d804161230eb89d4d329cc83570fe257217d2119134048dd2ed167646975fc7d77136919a049ea74cf08ddd2b896890bb24a0ba18094a22baa351bf29ad96c66bbb1a598f2ca391749620e62d61c3561a7d3653ccc8892c7b99baaf76bf836e2991cb06d6bc0514568ff0d1ec8bb4b3d6984f5eaefb17d3ea2893722375d3ddb8e389a8eef7d7d198f8e687d6a513983df906099f9a2d23f4f9dec6f8ef2f11fc0a21fac45353b94e00486f5e17d386af42502d09db33cf0cf28310e049c07e88682aeeb00cb833c5174266e62407a57583f1f88b304b7c6e0c84bbe1c0fd423072d37a5bd0aacf764229e5c7cd02473460ba3645cd8e8ae144065bf02d0dd238593d8e230354f67e0b2f23012c23274f80e3ee31e35e2606a4a3f31d94ab755e6d163cff52cbb36b6d0cc67ffc512aeed1dce4d7a0d70ce82f2baba12e8d514dc92a056f994adfb17b5b9712bd5186f27a2fda1f7039c5df2c8587fdc62f5627580c13234b55be4df3056050e2d1ef3218f0dd66cb05265fe1acfb0989d8213f2c19d1735a7cf3fa65d88dad5af52dc2bba22b7abf46c3bc77b5091baab9e8f0ddc4d5e581037de91a9f8dcbc69309be29cc815cf19a20a7585b8b3073edf51fc9baeb3e509b97fa4ecfd621e0fd57bd61cac1b895c03248ff12bdbc57509250df3517e8a3fe1d776836b34ab352b973d932ef708b14f7418f9eceb1d87667e61e3e758649cb083f01b133d37ab2f5afa96d6c84bcacf4efc3851ad308c1e7d9113624fce29fab460ab9d2a48d92cdb281103a5250ad44cb2ff6e67ac670c02fdafb3e0f1353953d6d7d5646ca1568dea55275a050ec501b7c6250444f7219f1ba7521ba3b93d089727ca5f3bbe0d6c1300b423377004954c5628fdb65770b18ced5c9b23a4a5a6d6ef25fe01b4ce278de0bcc4ed86e28a0a68818ffa40970128cf2c38740e80037984428c1bd5113f40ff47512ee6f4e4d8f9b8e8e1b3040d2928d003bd1c1329dc885302fbce9fa81c23b4dc49c7c82d29b52957847898676c89aa5d32b5b0e1c0d5a2b79a19d67562f407f19425687971a957375879d90c5f57c857136c17106c9ab1b99d80e69c8c954ed386493368884b55c939b8d64d26f643e800c56f90c01079d7c534e3b2b7ae352cefd3016da55f6a85eb803b85e2304915fd2001f77c74e28746293c46e4f5f0fd49cf988aafd0026b8e7a3bab2da5cdce1ea26c2e29ec03f4807fac432662b2d6c060be1c7be0e5489de69d0a6e03a4b9117f9244b34a0f1ecba89884f781c6320412413a00c4980287409a2a78c2cd7e65cecebbe4ec1c28cac4dd95f6998e78fc6f1392384331c9436aa10e10e2bf8ad2c4eafbcf276aa7bae64b74428911b3269c749338b0fc5075ad",
|
||||
"d61fe4e3f32ac260915b5b03b78a86d11bfc41d973fce5b0cc59035cf8289a8a2e3878ea15fa46565b0d806e2f85b53873ea20ed653869b688adf83f3ef444535bf91598ff7e80f334fb782539b92f39f55310cc4b35349ab7b278346eda9bc37c0d8acd3557fae38197f412f8d9e57ce6a76b7205c23564cab06e5615be7c6f05c3d05ec690cba91da5e89d55b152ff8dd2157dc5458190025cf94b1ad98f7cbe64e9482faba95e6b33844afc640892872b44a9932096508f4a782a4805323808f23e54b6ff9b841dbfa87db3505ae4f687972c18ea0f0d0af89d36c1c2a5b14560c153c3fee406f5cf15cfd1c0bb45d767426d465f2f14c158495069d0c5955a00150707862ecaae30624ebacdd8ac33e4e6aab3ff90b6ba445a84689386b9e945d01823a65874444316e83767290fcff630d2477f49d5d8ffdd200e08ee1274270f86ed14c687895f6caf5ce528bd970c20d2408a9ba66216324c6a011ac4999098362dbd98a038129a2d40c8da6ab88318aa3046cb660327cc44236d9e5d2163bd0959062195c51ed93d0088b6f92051fc99050ece2538749165976233697ab4b610385366e5ce0b02ad6b61c168ecfbedcdf74278a38de340fd7a5fead8e588e294795f9b011e2e60377a89e25c90e145397cdeabc60fd32444a6b7642a611a83c464d8b8976666351b4865c37b02e6dc21dbcdf5f930341707b618cc0f03c3122646b3385c9df9f2ec730eec9d49e7dfc9153b6e6289da8c4f0ebea9ccc1b751948e3bb7171c9e4d57423b0eeeb79095c030cb52677b3f7e0b45c30f645391f3f9c957afa549c4e0b2465b03c67993cd200b1af01035962edbc4c9e89b31c82ac121987d6529dafdeef67a132dc04b6dc68e77f22862040b75e2ceb9ff16da0fca534e6db7bd12fa7b7f51b6c08c1e23dfcdb7acbd2da0b51c87ffbced065a612e9b1c8bba9b7e2d8d7a2f04fcc4aaf355b60d764879a76b5e16762d5f2f55d585d0c8e82df6940960cddfb72c91dfa71f6b4e1c6ca25dfc39a878e998a663c04fe29d5e83b9586d047b4d7ff70a9f0d44f127e7d741685ca75f11629128d916a0ffef4be586a30c4b70389cc746e84ebf177c01ee8a4511cfbb9d1ecf7f7b33c7dd8177896e10bbc82f838dcd6db7ac67de62bf46b6a640fb580c5d1d2708f3862e3d2b645d0d18e49ef088053e3a220adc0e033c2afcfe61c90e32151152eb3caaf746c5e377d541cafc6cbb0cc0fa48b5caf1728f2e1957f5addfc234f1a9d89e40d49356c9172d0561a695fce6dab1d412321bbf407f63766ffd7b6b3d79bcfa07991c5a9709849c1008689e3b47c50d613980bec239fb64185249d055b30375ccb4354d71fe4d05648fbf6c80634dfc3575f2f24abb714c1e4c95e8896763bf4316e954c7ad19e5780ab7a040ca6fb9271f90a8b22ae738daf6cb",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn modexp_nagydani_5_qube(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000005", // modexp
|
||||
"000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000400c5a1611f8be90071a43db23cc2fe01871cc4c0e8ab5743f6378e4fef77f7f6db0095c0727e20225beb665645403453e325ad5f9aeb9ba99bf3c148f63f9c07cf4fe8847ad5242d6b7d4499f93bd47056ddab8f7dee878fc2314f344dbee2a7c41a5d3db91eff372c730c2fdd3a141a4b61999e36d549b9870cf2f4e632c4d5df5f024f81c028000073a0ed8847cfb0593d36a47142f578f05ccbe28c0c06aeb1b1da027794c48db880278f79ba78ae64eedfea3c07d10e0562668d839749dc95f40467d15cf65b9cfc52c7c4bcef1cda3596dd52631aac942f146c7cebd46065131699ce8385b0db1874336747ee020a5698a3d1a1082665721e769567f579830f9d259cec1a836845109c21cf6b25da572512bf3c42fd4b96e43895589042ab60dd41f497db96aec102087fe784165bb45f942859268fd2ff6c012d9d00c02ba83eace047cc5f7b2c392c2955c58a49f0338d6fc58749c9db2155522ac17914ec216ad87f12e0ee95574613942fa615898c4d9e8a3be68cd6afa4e7a003dedbdf8edfee31162b174f965b20ae752ad89c967b3068b6f722c16b354456ba8e280f987c08e0a52d40a2e8f3a59b94d590aeef01879eb7a90b3ee7d772c839c85519cbeaddc0c193ec4874a463b53fcaea3271d80ebfb39b33489365fc039ae549a17a9ff898eea2f4cb27b8dbee4c17b998438575b2b8d107e4a0d66ba7fca85b41a58a8d51f191a35c856dfbe8aef2b00048a694bbccff832d23c8ca7a7ff0b6c0b3011d00b97c86c0628444d267c951d9e4fb8f83e154b8f74fb51aa16535e498235c5597dac9606ed0be3173a3836baa4e7d756ffe1e2879b415d3846bccd538c05b847785699aefde3e305decb600cd8fb0e7d8de5efc26971a6ad4e6d7a2d91474f1023a0ac4b78dc937da0ce607a45974d2cac1c33a2631ff7fe6144a3b2e5cf98b531a9627dea92c1dc82204d09db0439b6a11dd64b484e1263aa45fd9539b6020b55e3baece3986a8bffc1003406348f5c61265099ed43a766ee4f93f5f9c5abbc32a0fd3ac2b35b87f9ec26037d88275bd7dd0a54474995ee34ed3727f3f97c48db544b1980193a4b76a8a3ddab3591ce527f16d91882e67f0103b5cda53f7da54d489fc4ac08b6ab358a5a04aa9daa16219d50bd672a7cb804ed769d218807544e5993f1c27427104b349906a0b654df0bf69328afd3013fbe430155339c39f236df5557bf92f1ded7ff609a8502f49064ec3d1dbfb6c15d3a4c11a4f8acd12278cbf68acd5709463d12e3338a6eddb8c112f199645e23154a8e60879d2a654e3ed9296aa28f134168619691cd2c6b9e2eba4438381676173fc63c2588a3c5910dc149cf3760f0aa9fa9c3f5faa9162b0bf1aac9dd32b706a60ef53cbdb394b6b40222b5bc80eea82ba8958386672564cae3794f977871ab62337cf03e30049201ec12937e7ce79d0f55d9c810e20acf52212aca1d3888949e0e4830aad88d804161230eb89d4d329cc83570fe257217d2119134048dd2ed167646975fc7d77136919a049ea74cf08ddd2b896890bb24a0ba18094a22baa351bf29ad96c66bbb1a598f2ca391749620e62d61c3561a7d3653ccc8892c7b99baaf76bf836e2991cb06d6bc0514568ff0d1ec8bb4b3d6984f5eaefb17d3ea2893722375d3ddb8e389a8eef7d7d198f8e687d6a513983df906099f9a2d23f4f9dec6f8ef2f11fc0a21fac45353b94e00486f5e17d386af42502d09db33cf0cf28310e049c07e88682aeeb00cb833c5174266e62407a57583f1f88b304b7c6e0c84bbe1c0fd423072d37a5bd0aacf764229e5c7cd02473460ba3645cd8e8ae144065bf02d0dd238593d8e230354f67e0b2f23012c23274f80e3ee31e35e2606a4a3f31d94ab755e6d163cff52cbb36b6d0cc67ffc512aeed1dce4d7a0d70ce82f2baba12e8d514dc92a056f994adfb17b5b9712bd5186f27a2fda1f7039c5df2c8587fdc62f5627580c13234b55be4df3056050e2d1ef3218f0dd66cb05265fe1acfb0989d8213f2c19d1735a7cf3fa65d88dad5af52dc2bba22b7abf46c3bc77b5091baab9e8f0ddc4d5e581037de91a9f8dcbc69309be29cc815cf19a20a7585b8b3073edf51fc9baeb3e509b97fa4ecfd621e0fd57bd61cac1b895c03248ff12bdbc57509250df3517e8a3fe1d776836b34ab352b973d932ef708b14f7418f9eceb1d87667e61e3e758649cb083f01b133d37ab2f5afa96d6c84bcacf4efc3851ad308c1e7d9113624fce29fab460ab9d2a48d92cdb281103a5250ad44cb2ff6e67ac670c02fdafb3e0f1353953d6d7d5646ca1568dea55275a050ec501b7c6250444f7219f1ba7521ba3b93d089727ca5f3bbe0d6c1300b423377004954c5628fdb65770b18ced5c9b23a4a5a6d6ef25fe01b4ce278de0bcc4ed86e28a0a68818ffa40970128cf2c38740e80037984428c1bd5113f40ff47512ee6f4e4d8f9b8e8e1b3040d2928d003bd1c1329dc885302fbce9fa81c23b4dc49c7c82d29b52957847898676c89aa5d32b5b0e1c0d5a2b79a19d67562f407f19425687971a957375879d90c5f57c857136c17106c9ab1b99d80e69c8c954ed386493368884b55c939b8d64d26f643e800c56f90c01079d7c534e3b2b7ae352cefd3016da55f6a85eb803b85e2304915fd2001f77c74e28746293c46e4f5f0fd49cf988aafd0026b8e7a3bab2da5cdce1ea26c2e29ec03f4807fac432662b2d6c060be1c7be0e5489de69d0a6e03a4b9117f9244b34a0f1ecba89884f781c6320412413a00c4980287409a2a78c2cd7e65cecebbe4ec1c28cac4dd95f6998e78fc6f1392384331c9436aa10e10e2bf8ad2c4eafbcf276aa7bae64b74428911b3269c749338b0fc5075ad",
|
||||
"5f9c70ec884926a89461056ad20ac4c30155e817f807e4d3f5bb743d789c83386762435c3627773fa77da5144451f2a8aad8adba88e0b669f5377c5e9bad70e45c86fe952b613f015a9953b8a5de5eaee4566acf98d41e327d93a35bd5cef4607d025e58951167957df4ff9b1627649d3943805472e5e293d3efb687cfd1e503faafeb2840a3e3b3f85d016051a58e1c9498aab72e63b748d834b31eb05d85dcde65e27834e266b85c75cc4ec0135135e0601cb93eeeb6e0010c8ceb65c4c319623c5e573a2c8c9fbbf7df68a930beb412d3f4dfd146175484f45d7afaa0d2e60684af9b34730f7c8438465ad3e1d0c3237336722f2aa51095bd5759f4b8ab4dda111b684aa3dac62a761722e7ae43495b7709933512c81c4e3c9133a51f7ce9f2b51fcec064f65779666960b4e45df3900f54311f5613e8012dd1b8efd359eda31a778264c72aa8bb419d862734d769076bce2810011989a45374e5c5d8729fec21427f0bf397eacbb4220f603cf463a4b0c94efd858ffd9768cd60d6ce68d755e0fbad007ce5c2223d70c7018345a102e4ab3c60a13a9e7794303156d4c2063e919f2153c13961fb324c80b240742f47773a7a8e25b3e3fb19b00ce839346c6eb3c732fbc6b888df0b1fe0a3d07b053a2e9402c267b2d62f794d8a2840526e3ade15ce2264496ccd7519571dfde47f7a4bb16292241c20b2be59f3f8fb4f6383f232d838c5a22d8c95b6834d9d2ca493f5a505ebe8899503b0e8f9b19e6e2dd81c1628b80016d02097e0134de51054c4e7674824d4d758760fc52377d2cad145e259aa2ffaf54139e1a66b1e0c1c191e32ac59474c6b526f5b3ba07d3e5ec286eddf531fcd5292869be58c9f22ef91026159f7cf9d05ef66b4299f4da48cc1635bf2243051d342d378a22c83390553e873713c0454ce5f3234397111ac3fe3207b86f0ed9fc025c81903e1748103692074f83824fda6341be4f95ff00b0a9a208c267e12fa01825054cc0513629bf3dbb56dc5b90d4316f87654a8be18227978ea0a8a522760cad620d0d14fd38920fb7321314062914275a5f99f677145a6979b156bd82ecd36f23f8e1273cc2759ecc0b2c69d94dad5211d1bed939dd87ed9e07b91d49713a6e16ade0a98aea789f04994e318e4ff2c8a188cd8d43aeb52c6daa3bc29b4af50ea82a247c5cd67b573b34cbadcc0a376d3bbd530d50367b42705d870f2e27a8197ef46070528bfe408360faa2ebb8bf76e9f388572842bcb119f4d84ee34ae31f5cc594f23705a49197b181fb78ed1ec99499c690f843a4d0cf2e226d118e9372271054fbabdcc5c92ae9fefaef0589cd0e722eaf30c1703ec4289c7fd81beaa8a455ccee5298e31e2080c10c366a6fcf56f7d13582ad0bcad037c612b710fc595b70fbefaaca23623b60c6c39b11beb8e5843b6b3dac60f",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
#[bench]
|
||||
fn modexp_nagydani_5_pow0x10001(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000005", // modexp
|
||||
"000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000400c5a1611f8be90071a43db23cc2fe01871cc4c0e8ab5743f6378e4fef77f7f6db0095c0727e20225beb665645403453e325ad5f9aeb9ba99bf3c148f63f9c07cf4fe8847ad5242d6b7d4499f93bd47056ddab8f7dee878fc2314f344dbee2a7c41a5d3db91eff372c730c2fdd3a141a4b61999e36d549b9870cf2f4e632c4d5df5f024f81c028000073a0ed8847cfb0593d36a47142f578f05ccbe28c0c06aeb1b1da027794c48db880278f79ba78ae64eedfea3c07d10e0562668d839749dc95f40467d15cf65b9cfc52c7c4bcef1cda3596dd52631aac942f146c7cebd46065131699ce8385b0db1874336747ee020a5698a3d1a1082665721e769567f579830f9d259cec1a836845109c21cf6b25da572512bf3c42fd4b96e43895589042ab60dd41f497db96aec102087fe784165bb45f942859268fd2ff6c012d9d00c02ba83eace047cc5f7b2c392c2955c58a49f0338d6fc58749c9db2155522ac17914ec216ad87f12e0ee95574613942fa615898c4d9e8a3be68cd6afa4e7a003dedbdf8edfee31162b174f965b20ae752ad89c967b3068b6f722c16b354456ba8e280f987c08e0a52d40a2e8f3a59b94d590aeef01879eb7a90b3ee7d772c839c85519cbeaddc0c193ec4874a463b53fcaea3271d80ebfb39b33489365fc039ae549a17a9ff898eea2f4cb27b8dbee4c17b998438575b2b8d107e4a0d66ba7fca85b41a58a8d51f191a35c856dfbe8aef2b00048a694bbccff832d23c8ca7a7ff0b6c0b3011d00b97c86c0628444d267c951d9e4fb8f83e154b8f74fb51aa16535e498235c5597dac9606ed0be3173a3836baa4e7d756ffe1e2879b415d3846bccd538c05b847785699aefde3e305decb600cd8fb0e7d8de5efc26971a6ad4e6d7a2d91474f1023a0ac4b78dc937da0ce607a45974d2cac1c33a2631ff7fe6144a3b2e5cf98b531a9627dea92c1dc82204d09db0439b6a11dd64b484e1263aa45fd9539b6020b55e3baece3986a8bffc1003406348f5c61265099ed43a766ee4f93f5f9c5abbc32a0fd3ac2b35b87f9ec26037d88275bd7dd0a54474995ee34ed3727f3f97c48db544b1980193a4b76a8a3ddab3591ce527f16d91882e67f0103b5cda53f7da54d489fc4ac08b6ab358a5a04aa9daa16219d50bd672a7cb804ed769d218807544e5993f1c27427104b349906a0b654df0bf69328afd3013fbe430155339c39f236df5557bf92f1ded7ff609a8502f49064ec3d1dbfb6c15d3a4c11a4f8acd12278cbf68acd5709463d12e3338a6eddb8c112f199645e23154a8e60879d2a654e3ed9296aa28f134168619691cd2c6b9e2eba4438381676173fc63c2588a3c5910dc149cf3760f0aa9fa9c3f5faa9162b0bf1aac9dd32b706a60ef53cbdb394b6b40222b5bc80eea82ba8958386672564cae3794f977871ab62337cf010001e30049201ec12937e7ce79d0f55d9c810e20acf52212aca1d3888949e0e4830aad88d804161230eb89d4d329cc83570fe257217d2119134048dd2ed167646975fc7d77136919a049ea74cf08ddd2b896890bb24a0ba18094a22baa351bf29ad96c66bbb1a598f2ca391749620e62d61c3561a7d3653ccc8892c7b99baaf76bf836e2991cb06d6bc0514568ff0d1ec8bb4b3d6984f5eaefb17d3ea2893722375d3ddb8e389a8eef7d7d198f8e687d6a513983df906099f9a2d23f4f9dec6f8ef2f11fc0a21fac45353b94e00486f5e17d386af42502d09db33cf0cf28310e049c07e88682aeeb00cb833c5174266e62407a57583f1f88b304b7c6e0c84bbe1c0fd423072d37a5bd0aacf764229e5c7cd02473460ba3645cd8e8ae144065bf02d0dd238593d8e230354f67e0b2f23012c23274f80e3ee31e35e2606a4a3f31d94ab755e6d163cff52cbb36b6d0cc67ffc512aeed1dce4d7a0d70ce82f2baba12e8d514dc92a056f994adfb17b5b9712bd5186f27a2fda1f7039c5df2c8587fdc62f5627580c13234b55be4df3056050e2d1ef3218f0dd66cb05265fe1acfb0989d8213f2c19d1735a7cf3fa65d88dad5af52dc2bba22b7abf46c3bc77b5091baab9e8f0ddc4d5e581037de91a9f8dcbc69309be29cc815cf19a20a7585b8b3073edf51fc9baeb3e509b97fa4ecfd621e0fd57bd61cac1b895c03248ff12bdbc57509250df3517e8a3fe1d776836b34ab352b973d932ef708b14f7418f9eceb1d87667e61e3e758649cb083f01b133d37ab2f5afa96d6c84bcacf4efc3851ad308c1e7d9113624fce29fab460ab9d2a48d92cdb281103a5250ad44cb2ff6e67ac670c02fdafb3e0f1353953d6d7d5646ca1568dea55275a050ec501b7c6250444f7219f1ba7521ba3b93d089727ca5f3bbe0d6c1300b423377004954c5628fdb65770b18ced5c9b23a4a5a6d6ef25fe01b4ce278de0bcc4ed86e28a0a68818ffa40970128cf2c38740e80037984428c1bd5113f40ff47512ee6f4e4d8f9b8e8e1b3040d2928d003bd1c1329dc885302fbce9fa81c23b4dc49c7c82d29b52957847898676c89aa5d32b5b0e1c0d5a2b79a19d67562f407f19425687971a957375879d90c5f57c857136c17106c9ab1b99d80e69c8c954ed386493368884b55c939b8d64d26f643e800c56f90c01079d7c534e3b2b7ae352cefd3016da55f6a85eb803b85e2304915fd2001f77c74e28746293c46e4f5f0fd49cf988aafd0026b8e7a3bab2da5cdce1ea26c2e29ec03f4807fac432662b2d6c060be1c7be0e5489de69d0a6e03a4b9117f9244b34a0f1ecba89884f781c6320412413a00c4980287409a2a78c2cd7e65cecebbe4ec1c28cac4dd95f6998e78fc6f1392384331c9436aa10e10e2bf8ad2c4eafbcf276aa7bae64b74428911b3269c749338b0fc5075ad",
|
||||
"5a0eb2bdf0ac1cae8e586689fa16cd4b07dfdedaec8a110ea1fdb059dd5253231b6132987598dfc6e11f86780428982d50cf68f67ae452622c3b336b537ef3298ca645e8f89ee39a26758206a5a3f6409afc709582f95274b57b71fae5c6b74619ae6f089a5393c5b79235d9caf699d23d88fb873f78379690ad8405e34c19f5257d596580c7a6a7206a3712825afe630c76b31cdb4a23e7f0632e10f14f4e282c81a66451a26f8df2a352b5b9f607a7198449d1b926e27036810368e691a74b91c61afa73d9d3b99453e7c8b50fd4f09c039a2f2feb5c419206694c31b92df1d9586140cb3417b38d0c503c7b508cc2ed12e813a1c795e9829eb39ee78eeaf360a169b491a1d4e419574e712402de9d48d54c1ae5e03739b7156615e8267e1fb0a897f067afd11fb33f6e24182d7aaaaa18fe5bc1982f20d6b871e5a398f0f6f718181d31ec225cfa9a0a70124ed9a70031bdf0c1c7829f708b6e17d50419ef361cf77d99c85f44607186c8d683106b8bd38a49b5d0fb503b397a83388c5678dcfcc737499d84512690701ed621a6f0172aecf037184ddf0f2453e4053024018e5ab2e30d6d5363b56e8b41509317c99042f517247474ab3abc848e00a07f69c254f46f2a05cf6ed84e5cc906a518fdcfdf2c61ce731f24c5264f1a25fc04934dc28aec112134dd523f70115074ca34e3807aa4cb925147f3a0ce152d323bd8c675ace446d0fd1ae30c4b57f0eb2c23884bc18f0964c0114796c5b6d080c3d89175665fbf63a6381a6a9da39ad070b645c8bb1779506da14439a9f5b5d481954764ea114fac688930bc68534d403cff4210673b6a6ff7ae416b7cd41404c3d3f282fcd193b86d0f54d0006c2a503b40d5c3930da980565b8f9630e9493a79d1c03e74e5f93ac8e4dc1a901ec5e3b3e57049124c7b72ea345aa359e782285d9e6a5c144a378111dd02c40855ff9c2be9b48425cb0b2fd62dc8678fd151121cf26a65e917d65d8e0dacfae108eb5508b601fb8ffa370be1f9a8b749a2d12eeab81f41079de87e2d777994fa4d28188c579ad327f9957fb7bdecec5c680844dd43cb57cf87aeb763c003e65011f73f8c63442df39a92b946a6bd968a1c1e4d5fa7d88476a68bd8e20e5b70a99259c7d3f85fb1b65cd2e93972e6264e74ebf289b8b6979b9b68a85cd5b360c1987f87235c3c845d62489e33acf85d53fa3561fe3a3aee18924588d9c6eba4edb7a4d106b31173e42929f6f0c48c80ce6a72d54eca7c0fe870068b7a7c89c63cdda593f5b32d3cb4ea8a32c39f00ab449155757172d66763ed9527019d6de6c9f2416aa6203f4d11c9ebee1e1d3845099e55504446448027212616167eb36035726daa7698b075286f5379cd3e93cb3e0cf4f9cb8d017facbb5550ed32d5ec5400ae57e47e2bf78d1eaeff9480cc765ceff39db500",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_add_chfast1(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000006", // alt_bn128_add
|
||||
"18b18acfb4c2c30276db5411368e7185b311dd124691610c5d3b74034e093dc9063c909c4720840cb5134cb9f59fa749755796819658d32efc0d288198f3726607c2b7f58a84bd6145f00c9c2bc0bb1a187f20ff2c92963a88019e7c6a014eed06614e20c147e940f2d70da3f74c9a17df361706a4485c742bd6788478fa17d7",
|
||||
"2243525c5efd4b9c3d3c45ac0ca3fe4dd85e830a4ce6b65fa1eeaee202839703301d1d33be6da8e509df21cc35964723180eed7532537db9ae5e7d48f195c915",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_add_chfast2(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000006", // alt_bn128_add
|
||||
"2243525c5efd4b9c3d3c45ac0ca3fe4dd85e830a4ce6b65fa1eeaee202839703301d1d33be6da8e509df21cc35964723180eed7532537db9ae5e7d48f195c91518b18acfb4c2c30276db5411368e7185b311dd124691610c5d3b74034e093dc9063c909c4720840cb5134cb9f59fa749755796819658d32efc0d288198f37266",
|
||||
"2bd3e6d0f3b142924f5ca7b49ce5b9d54c4703d7ae5648e61d02268b1a0a9fb721611ce0a6af85915e2f1d70300909ce2e49dfad4a4619c8390cae66cefdb204",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_add_cdetrio1(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000006", // alt_bn128_add
|
||||
"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_add_cdetrio2(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000006", // alt_bn128_add
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_add_cdetrio3(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000006", // alt_bn128_add
|
||||
"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_add_cdetrio4(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000006", // alt_bn128_add
|
||||
"",
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_add_cdetrio5(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000006", // alt_bn128_add
|
||||
"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_add_cdetrio6(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000006", // alt_bn128_add
|
||||
"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002",
|
||||
"00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_add_cdetrio7(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000006", // alt_bn128_add
|
||||
"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_add_cdetrio8(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000006", // alt_bn128_add
|
||||
"00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002",
|
||||
"00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_add_cdetrio9(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000006", // alt_bn128_add
|
||||
"0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_add_cdetrio10(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000006", // alt_bn128_add
|
||||
"000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_add_cdetrio11(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000006", // alt_bn128_add
|
||||
"0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002",
|
||||
"030644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd315ed738c0e0a7c92e7845f96b2ae9c0a68a6a449e3538fc7ff3ebf7a5a18a2c4",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_add_cdetrio12(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000006", // alt_bn128_add
|
||||
"000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"030644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd315ed738c0e0a7c92e7845f96b2ae9c0a68a6a449e3538fc7ff3ebf7a5a18a2c4",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_add_cdetrio13(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000006", // alt_bn128_add
|
||||
"17c139df0efee0f766bc0204762b774362e4ded88953a39ce849a8a7fa163fa901e0559bacb160664764a357af8a9fe70baa9258e0b959273ffc5718c6d4cc7c039730ea8dff1254c0fee9c0ea777d29a9c710b7e616683f194f18c43b43b869073a5ffcc6fc7a28c30723d6e58ce577356982d65b833a5a5c15bf9024b43d98",
|
||||
"15bf2bb17880144b5d1cd2b1f46eff9d617bffd1ca57c37fb5a49bd84e53cf66049c797f9ce0d17083deb32b5e36f2ea2a212ee036598dd7624c168993d1355f",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_add_cdetrio14(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000006", // alt_bn128_add
|
||||
"17c139df0efee0f766bc0204762b774362e4ded88953a39ce849a8a7fa163fa901e0559bacb160664764a357af8a9fe70baa9258e0b959273ffc5718c6d4cc7c17c139df0efee0f766bc0204762b774362e4ded88953a39ce849a8a7fa163fa92e83f8d734803fc370eba25ed1f6b8768bd6d83887b87165fc2434fe11a830cb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_mul_chfast1(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000007", // alt_bn128_mul
|
||||
"2bd3e6d0f3b142924f5ca7b49ce5b9d54c4703d7ae5648e61d02268b1a0a9fb721611ce0a6af85915e2f1d70300909ce2e49dfad4a4619c8390cae66cefdb20400000000000000000000000000000000000000000000000011138ce750fa15c2",
|
||||
"070a8d6a982153cae4be29d434e8faef8a47b274a053f5a4ee2a6c9c13c31e5c031b8ce914eba3a9ffb989f9cdd5b0f01943074bf4f0f315690ec3cec6981afc",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_mul_chfast2(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000007", // alt_bn128_mul
|
||||
"070a8d6a982153cae4be29d434e8faef8a47b274a053f5a4ee2a6c9c13c31e5c031b8ce914eba3a9ffb989f9cdd5b0f01943074bf4f0f315690ec3cec6981afc30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd46",
|
||||
"025a6f4181d2b4ea8b724290ffb40156eb0adb514c688556eb79cdea0752c2bb2eff3f31dea215f1eb86023a133a996eb6300b44da664d64251d05381bb8a02e",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_mul_chfast3(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000007", // alt_bn128_mul
|
||||
"025a6f4181d2b4ea8b724290ffb40156eb0adb514c688556eb79cdea0752c2bb2eff3f31dea215f1eb86023a133a996eb6300b44da664d64251d05381bb8a02e183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e10460b6c3e7ea3",
|
||||
"14789d0d4a730b354403b5fac948113739e276c23e0258d8596ee72f9cd9d3230af18a63153e0ec25ff9f2951dd3fa90ed0197bfef6e2a1a62b5095b9d2b4a27",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_mul_cdetrio1(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000007", // alt_bn128_mul
|
||||
"1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f6ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"2cde5879ba6f13c0b5aa4ef627f159a3347df9722efce88a9afbb20b763b4c411aa7e43076f6aee272755a7f9b84832e71559ba0d2e0b17d5f9f01755e5b0d11",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_mul_cdetrio6(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000007", // alt_bn128_mul
|
||||
"17c139df0efee0f766bc0204762b774362e4ded88953a39ce849a8a7fa163fa901e0559bacb160664764a357af8a9fe70baa9258e0b959273ffc5718c6d4cc7cffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"29e587aadd7c06722aabba753017c093f70ba7eb1f1c0104ec0564e7e3e21f6022b1143f6a41008e7755c71c3d00b6b915d386de21783ef590486d8afa8453b1",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_mul_cdetrio11(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000007", // alt_bn128_mul
|
||||
"039730ea8dff1254c0fee9c0ea777d29a9c710b7e616683f194f18c43b43b869073a5ffcc6fc7a28c30723d6e58ce577356982d65b833a5a5c15bf9024b43d98ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"00a1a234d08efaa2616607e31eca1980128b00b415c845ff25bba3afcb81dc00242077290ed33906aeb8e42fd98c41bcb9057ba03421af3f2d08cfc441186024",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_pairing_jeff1(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000008", // alt_bn128_pairing
|
||||
"1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550111e129f1cf1097710d41c4ac70fcdfa5ba2023c6ff1cbeac322de49d1b6df7c2032c61a830e3c17286de9462bf242fca2883585b93870a73853face6a6bf411198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
|
||||
"0000000000000000000000000000000000000000000000000000000000000001",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_pairing_jeff2(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000008", // alt_bn128_pairing
|
||||
"2eca0c7238bf16e83e7a1e6c5d49540685ff51380f309842a98561558019fc0203d3260361bb8451de5ff5ecd17f010ff22f5c31cdf184e9020b06fa5997db841213d2149b006137fcfb23036606f848d638d576a120ca981b5b1a5f9300b3ee2276cf730cf493cd95d64677bbb75fc42db72513a4c1e387b476d056f80aa75f21ee6226d31426322afcda621464d0611d226783262e21bb3bc86b537e986237096df1f82dff337dd5972e32a8ad43e28a78a96a823ef1cd4debe12b6552ea5f06967a1237ebfeca9aaae0d6d0bab8e28c198c5a339ef8a2407e31cdac516db922160fa257a5fd5b280642ff47b65eca77e626cb685c84fa6d3b6882a283ddd1198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
|
||||
"0000000000000000000000000000000000000000000000000000000000000001",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_pairing_jeff3(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000008", // alt_bn128_pairing
|
||||
"0f25929bcb43d5a57391564615c9e70a992b10eafa4db109709649cf48c50dd216da2f5cb6be7a0aa72c440c53c9bbdfec6c36c7d515536431b3a865468acbba2e89718ad33c8bed92e210e81d1853435399a271913a6520736a4729cf0d51eb01a9e2ffa2e92599b68e44de5bcf354fa2642bd4f26b259daa6f7ce3ed57aeb314a9a87b789a58af499b314e13c3d65bede56c07ea2d418d6874857b70763713178fb49a2d6cd347dc58973ff49613a20757d0fcc22079f9abd10c3baee245901b9e027bd5cfc2cb5db82d4dc9677ac795ec500ecd47deee3b5da006d6d049b811d7511c78158de484232fc68daf8a45cf217d1c2fae693ff5871e8752d73b21198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
|
||||
"0000000000000000000000000000000000000000000000000000000000000001",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_pairing_jeff4(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000008", // alt_bn128_pairing
|
||||
"2f2ea0b3da1e8ef11914acf8b2e1b32d99df51f5f4f206fc6b947eae860eddb6068134ddb33dc888ef446b648d72338684d678d2eb2371c61a50734d78da4b7225f83c8b6ab9de74e7da488ef02645c5a16a6652c3c71a15dc37fe3a5dcb7cb122acdedd6308e3bb230d226d16a105295f523a8a02bfc5e8bd2da135ac4c245d065bbad92e7c4e31bf3757f1fe7362a63fbfee50e7dc68da116e67d600d9bf6806d302580dc0661002994e7cd3a7f224e7ddc27802777486bf80f40e4ca3cfdb186bac5188a98c45e6016873d107f5cd131f3a3e339d0375e58bd6219347b008122ae2b09e539e152ec5364e7e2204b03d11d3caa038bfc7cd499f8176aacbee1f39e4e4afc4bc74790a4a028aff2c3d2538731fb755edefd8cb48d6ea589b5e283f150794b6736f670d6a1033f9b46c6f5204f50813eb85c8dc4b59db1c5d39140d97ee4d2b36d99bc49974d18ecca3e7ad51011956051b464d9e27d46cc25e0764bb98575bd466d32db7b15f582b2d5c452b36aa394b789366e5e3ca5aabd415794ab061441e51d01e94640b7e3084a07e02c78cf3103c542bc5b298669f211b88da1679b0b64a63b7e0e7bfe52aae524f73a55be7fe70c7e9bfc94b4cf0da1213d2149b006137fcfb23036606f848d638d576a120ca981b5b1a5f9300b3ee2276cf730cf493cd95d64677bbb75fc42db72513a4c1e387b476d056f80aa75f21ee6226d31426322afcda621464d0611d226783262e21bb3bc86b537e986237096df1f82dff337dd5972e32a8ad43e28a78a96a823ef1cd4debe12b6552ea5f",
|
||||
"0000000000000000000000000000000000000000000000000000000000000001",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_pairing_jeff5(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000008", // alt_bn128_pairing
|
||||
"20a754d2071d4d53903e3b31a7e98ad6882d58aec240ef981fdf0a9d22c5926a29c853fcea789887315916bbeb89ca37edb355b4f980c9a12a94f30deeed30211213d2149b006137fcfb23036606f848d638d576a120ca981b5b1a5f9300b3ee2276cf730cf493cd95d64677bbb75fc42db72513a4c1e387b476d056f80aa75f21ee6226d31426322afcda621464d0611d226783262e21bb3bc86b537e986237096df1f82dff337dd5972e32a8ad43e28a78a96a823ef1cd4debe12b6552ea5f1abb4a25eb9379ae96c84fff9f0540abcfc0a0d11aeda02d4f37e4baf74cb0c11073b3ff2cdbb38755f8691ea59e9606696b3ff278acfc098fa8226470d03869217cee0a9ad79a4493b5253e2e4e3a39fc2df38419f230d341f60cb064a0ac290a3d76f140db8418ba512272381446eb73958670f00cf46f1d9e64cba057b53c26f64a8ec70387a13e41430ed3ee4a7db2059cc5fc13c067194bcc0cb49a98552fd72bd9edb657346127da132e5b82ab908f5816c826acb499e22f2412d1a2d70f25929bcb43d5a57391564615c9e70a992b10eafa4db109709649cf48c50dd2198a1f162a73261f112401aa2db79c7dab1533c9935c77290a6ce3b191f2318d198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
|
||||
"0000000000000000000000000000000000000000000000000000000000000001",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_pairing_jeff6(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000008", // alt_bn128_pairing
|
||||
"1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550111e129f1cf1097710d41c4ac70fcdfa5ba2023c6ff1cbeac322de49d1b6df7c103188585e2364128fe25c70558f1560f4f9350baf3959e603cc91486e110936198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
|
||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_pairing_empty_data(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000008", // alt_bn128_pairing
|
||||
"",
|
||||
"0000000000000000000000000000000000000000000000000000000000000001",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_pairing_one_point(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000008", // alt_bn128_pairing
|
||||
"00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
|
||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_pairing_two_point_match_2(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000008", // alt_bn128_pairing
|
||||
"00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed275dc4a288d1afb3cbb1ac09187524c7db36395df7be3b99e673b13a075a65ec1d9befcd05a5323e6da4d435f3b617cdb3af83285c2df711ef39c01571827f9d",
|
||||
"0000000000000000000000000000000000000000000000000000000000000001",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_pairing_two_point_match_3(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000008", // alt_bn128_pairing
|
||||
"00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002203e205db4f19b37b60121b83a7333706db86431c6d835849957ed8c3928ad7927dc7234fd11d3e8c36c59277c3e6f149d5cd3cfa9a62aee49f8130962b4b3b9195e8aa5b7827463722b8c153931579d3505566b4edf48d498e185f0509de15204bb53b8977e5f92a0bc372742c4830944a59b4fe6b1c0466e2a6dad122b5d2e030644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd31a76dae6d3272396d0cbe61fced2bc532edac647851e3ac53ce1cc9c7e645a83198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
|
||||
"0000000000000000000000000000000000000000000000000000000000000001",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_pairing_two_point_match_4(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000008", // alt_bn128_pairing
|
||||
"105456a333e6d636854f987ea7bb713dfd0ae8371a72aea313ae0c32c0bf10160cf031d41b41557f3e7e3ba0c51bebe5da8e6ecd855ec50fc87efcdeac168bcc0476be093a6d2b4bbf907172049874af11e1b6267606e00804d3ff0037ec57fd3010c68cb50161b7d1d96bb71edfec9880171954e56871abf3d93cc94d745fa114c059d74e5b6c4ec14ae5864ebe23a71781d86c29fb8fb6cce94f70d3de7a2101b33461f39d9e887dbb100f170a2345dde3c07e256d1dfa2b657ba5cd030427000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000021a2c3013d2ea92e13c800cde68ef56a294b883f6ac35d25f587c09b1b3c635f7290158a80cd3d66530f74dc94c94adb88f5cdb481acca997b6e60071f08a115f2f997f3dbd66a7afe07fe7862ce239edba9e05c5afff7f8a1259c9733b2dfbb929d1691530ca701b4a106054688728c9972c8512e9789e9567aae23e302ccd75",
|
||||
"0000000000000000000000000000000000000000000000000000000000000001",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_pairing_ten_point_match_1(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000008", // alt_bn128_pairing
|
||||
"00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed275dc4a288d1afb3cbb1ac09187524c7db36395df7be3b99e673b13a075a65ec1d9befcd05a5323e6da4d435f3b617cdb3af83285c2df711ef39c01571827f9d00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed275dc4a288d1afb3cbb1ac09187524c7db36395df7be3b99e673b13a075a65ec1d9befcd05a5323e6da4d435f3b617cdb3af83285c2df711ef39c01571827f9d00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed275dc4a288d1afb3cbb1ac09187524c7db36395df7be3b99e673b13a075a65ec1d9befcd05a5323e6da4d435f3b617cdb3af83285c2df711ef39c01571827f9d00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed275dc4a288d1afb3cbb1ac09187524c7db36395df7be3b99e673b13a075a65ec1d9befcd05a5323e6da4d435f3b617cdb3af83285c2df711ef39c01571827f9d00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed275dc4a288d1afb3cbb1ac09187524c7db36395df7be3b99e673b13a075a65ec1d9befcd05a5323e6da4d435f3b617cdb3af83285c2df711ef39c01571827f9d",
|
||||
"0000000000000000000000000000000000000000000000000000000000000001",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_pairing_ten_point_match_2(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000008", // alt_bn128_pairing
|
||||
"00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002203e205db4f19b37b60121b83a7333706db86431c6d835849957ed8c3928ad7927dc7234fd11d3e8c36c59277c3e6f149d5cd3cfa9a62aee49f8130962b4b3b9195e8aa5b7827463722b8c153931579d3505566b4edf48d498e185f0509de15204bb53b8977e5f92a0bc372742c4830944a59b4fe6b1c0466e2a6dad122b5d2e030644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd31a76dae6d3272396d0cbe61fced2bc532edac647851e3ac53ce1cc9c7e645a83198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002203e205db4f19b37b60121b83a7333706db86431c6d835849957ed8c3928ad7927dc7234fd11d3e8c36c59277c3e6f149d5cd3cfa9a62aee49f8130962b4b3b9195e8aa5b7827463722b8c153931579d3505566b4edf48d498e185f0509de15204bb53b8977e5f92a0bc372742c4830944a59b4fe6b1c0466e2a6dad122b5d2e030644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd31a76dae6d3272396d0cbe61fced2bc532edac647851e3ac53ce1cc9c7e645a83198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002203e205db4f19b37b60121b83a7333706db86431c6d835849957ed8c3928ad7927dc7234fd11d3e8c36c59277c3e6f149d5cd3cfa9a62aee49f8130962b4b3b9195e8aa5b7827463722b8c153931579d3505566b4edf48d498e185f0509de15204bb53b8977e5f92a0bc372742c4830944a59b4fe6b1c0466e2a6dad122b5d2e030644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd31a76dae6d3272396d0cbe61fced2bc532edac647851e3ac53ce1cc9c7e645a83198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002203e205db4f19b37b60121b83a7333706db86431c6d835849957ed8c3928ad7927dc7234fd11d3e8c36c59277c3e6f149d5cd3cfa9a62aee49f8130962b4b3b9195e8aa5b7827463722b8c153931579d3505566b4edf48d498e185f0509de15204bb53b8977e5f92a0bc372742c4830944a59b4fe6b1c0466e2a6dad122b5d2e030644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd31a76dae6d3272396d0cbe61fced2bc532edac647851e3ac53ce1cc9c7e645a83198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002203e205db4f19b37b60121b83a7333706db86431c6d835849957ed8c3928ad7927dc7234fd11d3e8c36c59277c3e6f149d5cd3cfa9a62aee49f8130962b4b3b9195e8aa5b7827463722b8c153931579d3505566b4edf48d498e185f0509de15204bb53b8977e5f92a0bc372742c4830944a59b4fe6b1c0466e2a6dad122b5d2e030644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd31a76dae6d3272396d0cbe61fced2bc532edac647851e3ac53ce1cc9c7e645a83198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa",
|
||||
"0000000000000000000000000000000000000000000000000000000000000001",
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn alt_bn128_pairing_ten_point_match_3(b: &mut Bencher) {
|
||||
bench(
|
||||
"0000000000000000000000000000000000000008", // alt_bn128_pairing
|
||||
"105456a333e6d636854f987ea7bb713dfd0ae8371a72aea313ae0c32c0bf10160cf031d41b41557f3e7e3ba0c51bebe5da8e6ecd855ec50fc87efcdeac168bcc0476be093a6d2b4bbf907172049874af11e1b6267606e00804d3ff0037ec57fd3010c68cb50161b7d1d96bb71edfec9880171954e56871abf3d93cc94d745fa114c059d74e5b6c4ec14ae5864ebe23a71781d86c29fb8fb6cce94f70d3de7a2101b33461f39d9e887dbb100f170a2345dde3c07e256d1dfa2b657ba5cd030427000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000021a2c3013d2ea92e13c800cde68ef56a294b883f6ac35d25f587c09b1b3c635f7290158a80cd3d66530f74dc94c94adb88f5cdb481acca997b6e60071f08a115f2f997f3dbd66a7afe07fe7862ce239edba9e05c5afff7f8a1259c9733b2dfbb929d1691530ca701b4a106054688728c9972c8512e9789e9567aae23e302ccd75",
|
||||
"0000000000000000000000000000000000000000000000000000000000000001",
|
||||
b,
|
||||
);
|
||||
}
|
||||
91
ethcore/benches/evm.rs
Normal file
91
ethcore/benches/evm.rs
Normal file
@@ -0,0 +1,91 @@
|
||||
// Copyright 2015-2018 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/>.
|
||||
|
||||
#![feature(test)]
|
||||
|
||||
extern crate bn;
|
||||
extern crate ethereum_types;
|
||||
extern crate ethkey;
|
||||
extern crate parity_crypto;
|
||||
extern crate rand;
|
||||
extern crate rustc_hex;
|
||||
extern crate test;
|
||||
|
||||
use self::test::Bencher;
|
||||
use rand::StdRng;
|
||||
|
||||
#[bench]
|
||||
fn bn_128_pairing(b: &mut Bencher) {
|
||||
use bn::{pairing, G1, G2, Fr, Group};
|
||||
|
||||
let rng = &mut ::rand::thread_rng();
|
||||
|
||||
let sk0 = Fr::random(rng);
|
||||
let sk1 = Fr::random(rng);
|
||||
|
||||
let pk0 = G1::one() * sk0;
|
||||
let pk1 = G2::one() * sk1;
|
||||
|
||||
b.iter(|| {
|
||||
let _ = pairing(pk0, pk1);
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bn_128_mul(b: &mut Bencher) {
|
||||
use bn::{AffineG1, G1, Fr, Group};
|
||||
|
||||
let mut rng = StdRng::new().unwrap();
|
||||
let p: G1 = G1::random(&mut rng);
|
||||
let fr = Fr::random(&mut rng);
|
||||
|
||||
b.iter(|| {
|
||||
let _ = AffineG1::from_jacobian(p * fr);
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn sha256(b: &mut Bencher) {
|
||||
use parity_crypto::digest::sha256;
|
||||
|
||||
let input = [0_u8; 256];
|
||||
|
||||
b.iter(|| {
|
||||
sha256(&input);
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn ecrecover(b: &mut Bencher) {
|
||||
use rustc_hex::FromHex;
|
||||
use ethkey::{Signature, recover as ec_recover};
|
||||
use ethereum_types::H256;
|
||||
let input = FromHex::from_hex("47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad000000000000000000000000000000000000000000000000000000000000001b650acf9d3f5f0a2c799776a1254355d5f4061762a237396a99a0e0e3fc2bcd6729514a0dacb2e623ac4abd157cb18163ff942280db4d5caad66ddf941ba12e03").unwrap();
|
||||
let hash = H256::from_slice(&input[0..32]);
|
||||
let v = H256::from_slice(&input[32..64]);
|
||||
let r = H256::from_slice(&input[64..96]);
|
||||
let s = H256::from_slice(&input[96..128]);
|
||||
|
||||
let bit = match v[31] {
|
||||
27 | 28 if &v.0[..31] == &[0; 31] => v[31] - 27,
|
||||
_ => { return; },
|
||||
};
|
||||
|
||||
let s = Signature::from_rsv(&r, &s, bit);
|
||||
b.iter(|| {
|
||||
let _ = ec_recover(&s, &hash);
|
||||
});
|
||||
}
|
||||
@@ -5,13 +5,12 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
||||
|
||||
[dependencies]
|
||||
bit-set = "0.4"
|
||||
parity-bytes = "0.1"
|
||||
ethereum-types = "0.4"
|
||||
ethereum-types = "0.3"
|
||||
heapsize = "0.4"
|
||||
lazy_static = "1.0"
|
||||
log = "0.4"
|
||||
log = "0.3"
|
||||
vm = { path = "../vm" }
|
||||
keccak-hash = "0.1"
|
||||
keccak-hash = { git = "https://github.com/paritytech/parity-common" }
|
||||
parking_lot = "0.6"
|
||||
memory-cache = { path = "../../util/memory_cache" }
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ impl Finalize for Result<GasLeft> {
|
||||
fn finalize<E: Ext>(self, ext: E) -> Result<FinalizationResult> {
|
||||
match self {
|
||||
Ok(GasLeft::Known(gas_left)) => Ok(FinalizationResult { gas_left: gas_left, apply_state: true, return_data: ReturnData::empty() }),
|
||||
Ok(GasLeft::NeedsReturn { gas_left, data, apply_state }) => ext.ret(&gas_left, &data, apply_state).map(|gas_left| FinalizationResult {
|
||||
Ok(GasLeft::NeedsReturn {gas_left, data, apply_state}) => ext.ret(&gas_left, &data, apply_state).map(|gas_left| FinalizationResult {
|
||||
gas_left: gas_left,
|
||||
apply_state: apply_state,
|
||||
return_data: data,
|
||||
@@ -55,12 +55,6 @@ impl Finalize for Result<GasLeft> {
|
||||
}
|
||||
}
|
||||
|
||||
impl Finalize for Error {
|
||||
fn finalize<E: Ext>(self, _ext: E) -> Result<FinalizationResult> {
|
||||
Err(self)
|
||||
}
|
||||
}
|
||||
|
||||
/// Cost calculation type. For low-gas usage we calculate costs using usize instead of U256
|
||||
pub trait CostType: Sized + From<usize> + Copy
|
||||
+ ops::Mul<Output=Self> + ops::Div<Output=Self> + ops::Add<Output=Self> +ops::Sub<Output=Self>
|
||||
|
||||
@@ -17,9 +17,8 @@
|
||||
//! Evm factory.
|
||||
//!
|
||||
use std::sync::Arc;
|
||||
use vm::{Vm, Schedule};
|
||||
use vm::Vm;
|
||||
use ethereum_types::U256;
|
||||
use super::vm::ActionParams;
|
||||
use super::interpreter::SharedCache;
|
||||
use super::vmtype::VMType;
|
||||
|
||||
@@ -33,12 +32,12 @@ pub struct Factory {
|
||||
impl Factory {
|
||||
/// Create fresh instance of VM
|
||||
/// Might choose implementation depending on supplied gas.
|
||||
pub fn create(&self, params: ActionParams, schedule: &Schedule, depth: usize) -> Box<Vm> {
|
||||
pub fn create(&self, gas: &U256) -> Box<Vm> {
|
||||
match self.evm {
|
||||
VMType::Interpreter => if Self::can_fit_in_usize(¶ms.gas) {
|
||||
Box::new(super::interpreter::Interpreter::<usize>::new(params, self.evm_cache.clone(), schedule, depth))
|
||||
VMType::Interpreter => if Self::can_fit_in_usize(gas) {
|
||||
Box::new(super::interpreter::Interpreter::<usize>::new(self.evm_cache.clone()))
|
||||
} else {
|
||||
Box::new(super::interpreter::Interpreter::<U256>::new(params, self.evm_cache.clone(), schedule, depth))
|
||||
Box::new(super::interpreter::Interpreter::<U256>::new(self.evm_cache.clone()))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,14 +68,7 @@ impl Default for Factory {
|
||||
|
||||
#[test]
|
||||
fn test_create_vm() {
|
||||
use vm::Ext;
|
||||
use vm::tests::FakeExt;
|
||||
use bytes::Bytes;
|
||||
|
||||
let mut params = ActionParams::default();
|
||||
params.code = Some(Arc::new(Bytes::default()));
|
||||
let ext = FakeExt::new();
|
||||
let _vm = Factory::default().create(params, ext.schedule(), ext.depth());
|
||||
let _vm = Factory::default().create(&U256::zero());
|
||||
}
|
||||
|
||||
/// Create tests by injecting different VM factories
|
||||
|
||||
@@ -134,8 +134,6 @@ enum_with_from_u8! {
|
||||
RETURNDATASIZE = 0x3d,
|
||||
#[doc = "copy return data buffer to memory"]
|
||||
RETURNDATACOPY = 0x3e,
|
||||
#[doc = "return the keccak256 hash of contract code"]
|
||||
EXTCODEHASH = 0x3f,
|
||||
|
||||
#[doc = "get hash of most recent complete block"]
|
||||
BLOCKHASH = 0x40,
|
||||
@@ -328,7 +326,7 @@ enum_with_from_u8! {
|
||||
#[doc = "like CALLCODE but keeps caller's value and sender"]
|
||||
DELEGATECALL = 0xf4,
|
||||
#[doc = "create a new account and set creation address to sha3(sender + sha3(init code)) % 2**160"]
|
||||
CREATE2 = 0xf5,
|
||||
CREATE2 = 0xfb,
|
||||
#[doc = "stop execution and revert state changes. Return output data."]
|
||||
REVERT = 0xfd,
|
||||
#[doc = "like CALL but it does not take value, nor modify the state"]
|
||||
@@ -494,7 +492,6 @@ lazy_static! {
|
||||
arr[CALLDATALOAD as usize] = Some(InstructionInfo::new("CALLDATALOAD", 1, 1, GasPriceTier::VeryLow));
|
||||
arr[CALLDATASIZE as usize] = Some(InstructionInfo::new("CALLDATASIZE", 0, 1, GasPriceTier::Base));
|
||||
arr[CALLDATACOPY as usize] = Some(InstructionInfo::new("CALLDATACOPY", 3, 0, GasPriceTier::VeryLow));
|
||||
arr[EXTCODEHASH as usize] = Some(InstructionInfo::new("EXTCODEHASH", 1, 1, GasPriceTier::Special));
|
||||
arr[CODESIZE as usize] = Some(InstructionInfo::new("CODESIZE", 0, 1, GasPriceTier::Base));
|
||||
arr[CODECOPY as usize] = Some(InstructionInfo::new("CODECOPY", 3, 0, GasPriceTier::VeryLow));
|
||||
arr[GASPRICE as usize] = Some(InstructionInfo::new("GASPRICE", 0, 1, GasPriceTier::Base));
|
||||
@@ -594,7 +591,7 @@ lazy_static! {
|
||||
arr[DELEGATECALL as usize] = Some(InstructionInfo::new("DELEGATECALL", 6, 1, GasPriceTier::Special));
|
||||
arr[STATICCALL as usize] = Some(InstructionInfo::new("STATICCALL", 6, 1, GasPriceTier::Special));
|
||||
arr[SUICIDE as usize] = Some(InstructionInfo::new("SUICIDE", 1, 0, GasPriceTier::Special));
|
||||
arr[CREATE2 as usize] = Some(InstructionInfo::new("CREATE2", 4, 1, GasPriceTier::Special));
|
||||
arr[CREATE2 as usize] = Some(InstructionInfo::new("CREATE2", 3, 1, GasPriceTier::Special));
|
||||
arr[REVERT as usize] = Some(InstructionInfo::new("REVERT", 2, 0, GasPriceTier::Zero));
|
||||
arr
|
||||
};
|
||||
|
||||
@@ -125,17 +125,12 @@ impl<Gas: evm::CostType> Gasometer<Gas> {
|
||||
let newval = stack.peek(1);
|
||||
let val = U256::from(&*ext.storage_at(&address)?);
|
||||
|
||||
let gas = if schedule.eip1283 {
|
||||
let orig = U256::from(&*ext.initial_storage_at(&address)?);
|
||||
calculate_eip1283_sstore_gas(schedule, &orig, &val, &newval)
|
||||
let gas = if val.is_zero() && !newval.is_zero() {
|
||||
schedule.sstore_set_gas
|
||||
} else {
|
||||
if val.is_zero() && !newval.is_zero() {
|
||||
schedule.sstore_set_gas
|
||||
} else {
|
||||
// Refund for below case is added when actually executing sstore
|
||||
// !is_zero(&val) && is_zero(newval)
|
||||
schedule.sstore_reset_gas
|
||||
}
|
||||
// Refund for below case is added when actually executing sstore
|
||||
// !is_zero(&val) && is_zero(newval)
|
||||
schedule.sstore_reset_gas
|
||||
};
|
||||
Request::Gas(Gas::from(gas))
|
||||
},
|
||||
@@ -148,9 +143,6 @@ impl<Gas: evm::CostType> Gasometer<Gas> {
|
||||
instructions::EXTCODESIZE => {
|
||||
Request::Gas(Gas::from(schedule.extcodesize_gas))
|
||||
},
|
||||
instructions::EXTCODEHASH => {
|
||||
Request::Gas(Gas::from(schedule.extcodehash_gas))
|
||||
},
|
||||
instructions::SUICIDE => {
|
||||
let mut gas = Gas::from(schedule.suicide_gas);
|
||||
|
||||
@@ -343,89 +335,6 @@ fn add_gas_usize<Gas: evm::CostType>(value: Gas, num: usize) -> (Gas, bool) {
|
||||
value.overflow_add(Gas::from(num))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn calculate_eip1283_sstore_gas<Gas: evm::CostType>(schedule: &Schedule, original: &U256, current: &U256, new: &U256) -> Gas {
|
||||
Gas::from(
|
||||
if current == new {
|
||||
// 1. If current value equals new value (this is a no-op), 200 gas is deducted.
|
||||
schedule.sload_gas
|
||||
} else {
|
||||
// 2. If current value does not equal new value
|
||||
if original == current {
|
||||
// 2.1. If original value equals current value (this storage slot has not been changed by the current execution context)
|
||||
if original.is_zero() {
|
||||
// 2.1.1. If original value is 0, 20000 gas is deducted.
|
||||
schedule.sstore_set_gas
|
||||
} else {
|
||||
// 2.1.2. Otherwise, 5000 gas is deducted.
|
||||
schedule.sstore_reset_gas
|
||||
|
||||
// 2.1.2.1. If new value is 0, add 15000 gas to refund counter.
|
||||
}
|
||||
} else {
|
||||
// 2.2. If original value does not equal current value (this storage slot is dirty), 200 gas is deducted. Apply both of the following clauses.
|
||||
schedule.sload_gas
|
||||
|
||||
// 2.2.1. If original value is not 0
|
||||
// 2.2.1.1. If current value is 0 (also means that new value is not 0), remove 15000 gas from refund counter. We can prove that refund counter will never go below 0.
|
||||
// 2.2.1.2. If new value is 0 (also means that current value is not 0), add 15000 gas to refund counter.
|
||||
|
||||
// 2.2.2. If original value equals new value (this storage slot is reset)
|
||||
// 2.2.2.1. If original value is 0, add 19800 gas to refund counter.
|
||||
// 2.2.2.2. Otherwise, add 4800 gas to refund counter.
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
pub fn handle_eip1283_sstore_clears_refund(ext: &mut vm::Ext, original: &U256, current: &U256, new: &U256) {
|
||||
let sstore_clears_schedule = U256::from(ext.schedule().sstore_refund_gas);
|
||||
|
||||
if current == new {
|
||||
// 1. If current value equals new value (this is a no-op), 200 gas is deducted.
|
||||
} else {
|
||||
// 2. If current value does not equal new value
|
||||
if original == current {
|
||||
// 2.1. If original value equals current value (this storage slot has not been changed by the current execution context)
|
||||
if original.is_zero() {
|
||||
// 2.1.1. If original value is 0, 20000 gas is deducted.
|
||||
} else {
|
||||
// 2.1.2. Otherwise, 5000 gas is deducted.
|
||||
if new.is_zero() {
|
||||
// 2.1.2.1. If new value is 0, add 15000 gas to refund counter.
|
||||
ext.add_sstore_refund(sstore_clears_schedule);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 2.2. If original value does not equal current value (this storage slot is dirty), 200 gas is deducted. Apply both of the following clauses.
|
||||
|
||||
if !original.is_zero() {
|
||||
// 2.2.1. If original value is not 0
|
||||
if current.is_zero() {
|
||||
// 2.2.1.1. If current value is 0 (also means that new value is not 0), remove 15000 gas from refund counter. We can prove that refund counter will never go below 0.
|
||||
ext.sub_sstore_refund(sstore_clears_schedule);
|
||||
} else if new.is_zero() {
|
||||
// 2.2.1.2. If new value is 0 (also means that current value is not 0), add 15000 gas to refund counter.
|
||||
ext.add_sstore_refund(sstore_clears_schedule);
|
||||
}
|
||||
}
|
||||
|
||||
if original == new {
|
||||
// 2.2.2. If original value equals new value (this storage slot is reset)
|
||||
if original.is_zero() {
|
||||
// 2.2.2.1. If original value is 0, add 19800 gas to refund counter.
|
||||
let refund = U256::from(ext.schedule().sstore_set_gas - ext.schedule().sload_gas);
|
||||
ext.add_sstore_refund(refund);
|
||||
} else {
|
||||
// 2.2.2.2. Otherwise, add 4800 gas to refund counter.
|
||||
let refund = U256::from(ext.schedule().sstore_reset_gas - ext.schedule().sload_gas);
|
||||
ext.add_sstore_refund(refund);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mem_gas_cost() {
|
||||
// given
|
||||
|
||||
@@ -119,19 +119,14 @@ impl Memory for Vec<u8> {
|
||||
fn into_return_data(mut self, offset: U256, size: U256) -> ReturnData {
|
||||
let mut offset = offset.low_u64() as usize;
|
||||
let size = size.low_u64() as usize;
|
||||
|
||||
if !is_valid_range(offset, size) {
|
||||
return ReturnData::empty();
|
||||
return ReturnData::empty()
|
||||
}
|
||||
|
||||
if self.len() - size > MAX_RETURN_WASTE_BYTES {
|
||||
if offset == 0 {
|
||||
self.truncate(size);
|
||||
self.shrink_to_fit();
|
||||
} else {
|
||||
self = self[offset..(offset + size)].to_vec();
|
||||
offset = 0;
|
||||
}
|
||||
{ let _ = self.drain(..offset); }
|
||||
self.truncate(size);
|
||||
self.shrink_to_fit();
|
||||
offset = 0;
|
||||
}
|
||||
ReturnData::new(self, offset, size)
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -23,7 +23,6 @@ extern crate heapsize;
|
||||
extern crate vm;
|
||||
extern crate keccak_hash as hash;
|
||||
extern crate memory_cache;
|
||||
extern crate parity_bytes as bytes;
|
||||
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
|
||||
@@ -21,7 +21,7 @@ use std::sync::Arc;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use rustc_hex::FromHex;
|
||||
use ethereum_types::{U256, H256, Address};
|
||||
use vm::{self, ActionParams, ActionValue, Ext};
|
||||
use vm::{self, ActionParams, ActionValue};
|
||||
use vm::tests::{FakeExt, FakeCall, FakeCallType, test_finalize};
|
||||
use factory::Factory;
|
||||
use vmtype::VMType;
|
||||
@@ -38,8 +38,8 @@ fn test_add(factory: super::Factory) {
|
||||
let mut ext = FakeExt::new();
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_eq!(gas_left, U256::from(79_988));
|
||||
@@ -58,8 +58,8 @@ fn test_sha3(factory: super::Factory) {
|
||||
let mut ext = FakeExt::new();
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_eq!(gas_left, U256::from(79_961));
|
||||
@@ -78,8 +78,8 @@ fn test_address(factory: super::Factory) {
|
||||
let mut ext = FakeExt::new();
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_eq!(gas_left, U256::from(79_995));
|
||||
@@ -100,8 +100,8 @@ fn test_origin(factory: super::Factory) {
|
||||
let mut ext = FakeExt::new();
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_eq!(gas_left, U256::from(79_995));
|
||||
@@ -122,8 +122,8 @@ fn test_sender(factory: super::Factory) {
|
||||
let mut ext = FakeExt::new();
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_eq!(gas_left, U256::from(79_995));
|
||||
@@ -157,8 +157,8 @@ fn test_extcodecopy(factory: super::Factory) {
|
||||
ext.codes.insert(sender, Arc::new(sender_code));
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_eq!(gas_left, U256::from(79_935));
|
||||
@@ -177,8 +177,8 @@ fn test_log_empty(factory: super::Factory) {
|
||||
let mut ext = FakeExt::new();
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_eq!(gas_left, U256::from(99_619));
|
||||
@@ -209,8 +209,8 @@ fn test_log_sender(factory: super::Factory) {
|
||||
let mut ext = FakeExt::new();
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_eq!(gas_left, U256::from(98_974));
|
||||
@@ -234,8 +234,8 @@ fn test_blockhash(factory: super::Factory) {
|
||||
ext.blockhashes.insert(U256::zero(), blockhash.clone());
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_eq!(gas_left, U256::from(79_974));
|
||||
@@ -256,8 +256,8 @@ fn test_calldataload(factory: super::Factory) {
|
||||
let mut ext = FakeExt::new();
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_eq!(gas_left, U256::from(79_991));
|
||||
@@ -277,8 +277,8 @@ fn test_author(factory: super::Factory) {
|
||||
ext.info.author = author;
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_eq!(gas_left, U256::from(79_995));
|
||||
@@ -297,8 +297,8 @@ fn test_timestamp(factory: super::Factory) {
|
||||
ext.info.timestamp = timestamp;
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_eq!(gas_left, U256::from(79_995));
|
||||
@@ -317,8 +317,8 @@ fn test_number(factory: super::Factory) {
|
||||
ext.info.number = number;
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_eq!(gas_left, U256::from(79_995));
|
||||
@@ -337,8 +337,8 @@ fn test_difficulty(factory: super::Factory) {
|
||||
ext.info.difficulty = difficulty;
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_eq!(gas_left, U256::from(79_995));
|
||||
@@ -357,8 +357,8 @@ fn test_gas_limit(factory: super::Factory) {
|
||||
ext.info.gas_limit = gas_limit;
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_eq!(gas_left, U256::from(79_995));
|
||||
@@ -375,8 +375,8 @@ fn test_mul(factory: super::Factory) {
|
||||
let mut ext = FakeExt::new();
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_store(&ext, 0, "000000000000000000000000000000000000000000000000734349397b853383");
|
||||
@@ -393,8 +393,8 @@ fn test_sub(factory: super::Factory) {
|
||||
let mut ext = FakeExt::new();
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_store(&ext, 0, "0000000000000000000000000000000000000000000000000000012364ad0302");
|
||||
@@ -411,8 +411,8 @@ fn test_div(factory: super::Factory) {
|
||||
let mut ext = FakeExt::new();
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_store(&ext, 0, "000000000000000000000000000000000000000000000000000000000002e0ac");
|
||||
@@ -429,8 +429,8 @@ fn test_div_zero(factory: super::Factory) {
|
||||
let mut ext = FakeExt::new();
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_store(&ext, 0, "0000000000000000000000000000000000000000000000000000000000000000");
|
||||
@@ -447,8 +447,8 @@ fn test_mod(factory: super::Factory) {
|
||||
let mut ext = FakeExt::new();
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_store(&ext, 0, "0000000000000000000000000000000000000000000000000000000000076b4b");
|
||||
@@ -466,8 +466,8 @@ fn test_smod(factory: super::Factory) {
|
||||
let mut ext = FakeExt::new();
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_store(&ext, 0, "0000000000000000000000000000000000000000000000000000000000076b4b");
|
||||
@@ -485,8 +485,8 @@ fn test_sdiv(factory: super::Factory) {
|
||||
let mut ext = FakeExt::new();
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_store(&ext, 0, "000000000000000000000000000000000000000000000000000000000002e0ac");
|
||||
@@ -504,8 +504,8 @@ fn test_exp(factory: super::Factory) {
|
||||
let mut ext = FakeExt::new();
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_store(&ext, 0, "90fd23767b60204c3d6fc8aec9e70a42a3f127140879c133a20129a597ed0c59");
|
||||
@@ -524,8 +524,8 @@ fn test_comparison(factory: super::Factory) {
|
||||
let mut ext = FakeExt::new();
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_store(&ext, 0, "0000000000000000000000000000000000000000000000000000000000000000");
|
||||
@@ -545,8 +545,8 @@ fn test_signed_comparison(factory: super::Factory) {
|
||||
let mut ext = FakeExt::new();
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_store(&ext, 0, "0000000000000000000000000000000000000000000000000000000000000000");
|
||||
@@ -566,8 +566,8 @@ fn test_bitops(factory: super::Factory) {
|
||||
let mut ext = FakeExt::new();
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_store(&ext, 0, "00000000000000000000000000000000000000000000000000000000000000f0");
|
||||
@@ -589,8 +589,8 @@ fn test_addmod_mulmod(factory: super::Factory) {
|
||||
let mut ext = FakeExt::new();
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_store(&ext, 0, "0000000000000000000000000000000000000000000000000000000000000001");
|
||||
@@ -610,8 +610,8 @@ fn test_byte(factory: super::Factory) {
|
||||
let mut ext = FakeExt::new();
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_store(&ext, 0, "0000000000000000000000000000000000000000000000000000000000000000");
|
||||
@@ -629,8 +629,8 @@ fn test_signextend(factory: super::Factory) {
|
||||
let mut ext = FakeExt::new();
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_store(&ext, 0, "0000000000000000000000000000000000000000000000000000000000000fff");
|
||||
@@ -649,8 +649,8 @@ fn test_badinstruction_int() {
|
||||
let mut ext = FakeExt::new();
|
||||
|
||||
let err = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap_err()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap_err()
|
||||
};
|
||||
|
||||
match err {
|
||||
@@ -669,8 +669,8 @@ fn test_pop(factory: super::Factory) {
|
||||
let mut ext = FakeExt::new();
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_store(&ext, 0, "00000000000000000000000000000000000000000000000000000000000000f0");
|
||||
@@ -689,8 +689,8 @@ fn test_extops(factory: super::Factory) {
|
||||
let mut ext = FakeExt::new();
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_store(&ext, 0, "0000000000000000000000000000000000000000000000000000000000000004"); // PC / CALLDATASIZE
|
||||
@@ -712,11 +712,11 @@ fn test_jumps(factory: super::Factory) {
|
||||
let mut ext = FakeExt::new();
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_eq!(ext.sstore_clears, U256::from(ext.schedule().sstore_refund_gas));
|
||||
assert_eq!(ext.sstore_clears, 1);
|
||||
assert_store(&ext, 0, "0000000000000000000000000000000000000000000000000000000000000000"); // 5!
|
||||
assert_store(&ext, 1, "0000000000000000000000000000000000000000000000000000000000000078"); // 5!
|
||||
assert_eq!(gas_left, U256::from(54_117));
|
||||
@@ -740,13 +740,12 @@ fn test_calls(factory: super::Factory) {
|
||||
};
|
||||
|
||||
let gas_left = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_set_contains(&ext.calls, &FakeCall {
|
||||
call_type: FakeCallType::Call,
|
||||
create_scheme: None,
|
||||
gas: U256::from(2556),
|
||||
sender_address: Some(address.clone()),
|
||||
receive_address: Some(code_address.clone()),
|
||||
@@ -756,7 +755,6 @@ fn test_calls(factory: super::Factory) {
|
||||
});
|
||||
assert_set_contains(&ext.calls, &FakeCall {
|
||||
call_type: FakeCallType::Call,
|
||||
create_scheme: None,
|
||||
gas: U256::from(2556),
|
||||
sender_address: Some(address.clone()),
|
||||
receive_address: Some(address.clone()),
|
||||
@@ -781,8 +779,8 @@ fn test_create_in_staticcall(factory: super::Factory) {
|
||||
ext.is_static = true;
|
||||
|
||||
let err = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap_err()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap_err()
|
||||
};
|
||||
|
||||
assert_eq!(err, vm::Error::MutableCallInStaticContext);
|
||||
@@ -1049,8 +1047,8 @@ fn push_two_pop_one_constantinople_test(factory: &super::Factory, opcode: u8, pu
|
||||
let mut ext = FakeExt::new_constantinople();
|
||||
|
||||
let _ = {
|
||||
let mut vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
test_finalize(vm.exec(&mut ext)).unwrap()
|
||||
let mut vm = factory.create(¶ms.gas);
|
||||
test_finalize(vm.exec(params, &mut ext)).unwrap()
|
||||
};
|
||||
|
||||
assert_store(&ext, 0, result);
|
||||
|
||||
@@ -7,21 +7,21 @@ version = "1.12.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
|
||||
[dependencies]
|
||||
log = "0.4"
|
||||
log = "0.3"
|
||||
ethcore = { path = ".."}
|
||||
parity-bytes = "0.1"
|
||||
parity-bytes = { git = "https://github.com/paritytech/parity-common" }
|
||||
ethcore-transaction = { path = "../transaction" }
|
||||
ethereum-types = "0.4"
|
||||
memorydb = "0.2.1"
|
||||
patricia-trie = "0.2"
|
||||
ethereum-types = "0.3"
|
||||
memorydb = { git = "https://github.com/paritytech/parity-common" }
|
||||
patricia-trie = { git = "https://github.com/paritytech/parity-common" }
|
||||
patricia-trie-ethereum = { path = "../../util/patricia-trie-ethereum" }
|
||||
ethcore-network = { path = "../../util/network" }
|
||||
ethcore-io = { path = "../../util/io" }
|
||||
hashdb = "0.2.1"
|
||||
hashdb = { git = "https://github.com/paritytech/parity-common" }
|
||||
heapsize = "0.4"
|
||||
vm = { path = "../vm" }
|
||||
fastmap = { path = "../../util/fastmap" }
|
||||
rlp = { version = "0.2.4", features = ["ethereum"] }
|
||||
plain_hasher = { git = "https://github.com/paritytech/parity-common" }
|
||||
rlp = { git = "https://github.com/paritytech/parity-common" }
|
||||
rlp_derive = { path = "../../util/rlp_derive" }
|
||||
smallvec = "0.4"
|
||||
futures = "0.1"
|
||||
@@ -32,16 +32,16 @@ serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
parking_lot = "0.6"
|
||||
stats = { path = "../../util/stats" }
|
||||
keccak-hash = "0.1"
|
||||
keccak-hash = { git = "https://github.com/paritytech/parity-common" }
|
||||
keccak-hasher = { path = "../../util/keccak-hasher" }
|
||||
triehash-ethereum = { version = "0.2", path = "../../util/triehash-ethereum" }
|
||||
kvdb = "0.1"
|
||||
kvdb = { git = "https://github.com/paritytech/parity-common" }
|
||||
memory-cache = { path = "../../util/memory_cache" }
|
||||
error-chain = { version = "0.12", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
ethcore = { path = "..", features = ["test-helpers"] }
|
||||
kvdb-memorydb = "0.1"
|
||||
kvdb-memorydb = { git = "https://github.com/paritytech/parity-common" }
|
||||
tempdir = "0.3"
|
||||
|
||||
[features]
|
||||
|
||||
@@ -31,7 +31,7 @@ use ethereum_types::{H256, U256};
|
||||
use memory_cache::MemoryLruCache;
|
||||
|
||||
/// Configuration for how much data to cache.
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct CacheSizes {
|
||||
/// Maximum size, in bytes, of cached headers.
|
||||
pub headers: usize,
|
||||
@@ -83,33 +83,33 @@ impl Cache {
|
||||
receipts: MemoryLruCache::new(sizes.receipts),
|
||||
chain_score: MemoryLruCache::new(sizes.chain_score),
|
||||
corpus: None,
|
||||
corpus_expiration,
|
||||
corpus_expiration: corpus_expiration,
|
||||
}
|
||||
}
|
||||
|
||||
/// Query header by hash.
|
||||
pub fn block_header(&mut self, hash: &H256) -> Option<encoded::Header> {
|
||||
self.headers.get_mut(hash).cloned()
|
||||
self.headers.get_mut(hash).map(|x| x.clone())
|
||||
}
|
||||
|
||||
/// Query hash by number.
|
||||
pub fn block_hash(&mut self, num: BlockNumber) -> Option<H256> {
|
||||
self.canon_hashes.get_mut(&num).map(|h| *h)
|
||||
pub fn block_hash(&mut self, num: &BlockNumber) -> Option<H256> {
|
||||
self.canon_hashes.get_mut(num).map(|x| x.clone())
|
||||
}
|
||||
|
||||
/// Query block body by block hash.
|
||||
pub fn block_body(&mut self, hash: &H256) -> Option<encoded::Body> {
|
||||
self.bodies.get_mut(hash).cloned()
|
||||
self.bodies.get_mut(hash).map(|x| x.clone())
|
||||
}
|
||||
|
||||
/// Query block receipts by block hash.
|
||||
pub fn block_receipts(&mut self, hash: &H256) -> Option<Vec<Receipt>> {
|
||||
self.receipts.get_mut(hash).cloned()
|
||||
self.receipts.get_mut(hash).map(|x| x.clone())
|
||||
}
|
||||
|
||||
/// Query chain score by block hash.
|
||||
pub fn chain_score(&mut self, hash: &H256) -> Option<U256> {
|
||||
self.chain_score.get_mut(hash).map(|h| *h)
|
||||
self.chain_score.get_mut(hash).map(|x| x.clone())
|
||||
}
|
||||
|
||||
/// Cache the given header.
|
||||
|
||||
@@ -92,7 +92,7 @@ pub struct BlockInfo {
|
||||
/// Build an in-memory CHT from a closure which provides necessary information
|
||||
/// about blocks. If the fetcher ever fails to provide the info, the CHT
|
||||
/// will not be generated.
|
||||
pub fn build<F>(cht_num: u64, mut fetcher: F) -> Option<CHT<MemoryDB<KeccakHasher>>>
|
||||
pub fn build<F>(cht_num: u64, mut fetcher: F) -> Option<CHT<MemoryDB<KeccakHasher>>>
|
||||
where F: FnMut(BlockId) -> Option<BlockInfo>
|
||||
{
|
||||
let mut db = MemoryDB::<KeccakHasher>::new();
|
||||
@@ -118,8 +118,8 @@ pub fn build<F>(cht_num: u64, mut fetcher: F) -> Option<CHT<MemoryDB<KeccakHashe
|
||||
}
|
||||
|
||||
Some(CHT {
|
||||
db,
|
||||
root,
|
||||
db: db,
|
||||
root: root,
|
||||
number: cht_num,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ use ethereum_types::{H256, H264, U256};
|
||||
use heapsize::HeapSizeOf;
|
||||
use kvdb::{DBTransaction, KeyValueDB};
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
use fastmap::H256FastMap;
|
||||
use plain_hasher::H256FastMap;
|
||||
use rlp::{Encodable, Decodable, DecoderError, RlpStream, Rlp};
|
||||
use smallvec::SmallVec;
|
||||
|
||||
@@ -51,10 +51,10 @@ use smallvec::SmallVec;
|
||||
const HISTORY: u64 = 2048;
|
||||
|
||||
/// The best block key. Maps to an RLP list: [best_era, last_era]
|
||||
const CURRENT_KEY: &[u8] = &*b"best_and_latest";
|
||||
const CURRENT_KEY: &'static [u8] = &*b"best_and_latest";
|
||||
|
||||
/// Key storing the last canonical epoch transition.
|
||||
const LAST_CANONICAL_TRANSITION: &[u8] = &*b"canonical_transition";
|
||||
const LAST_CANONICAL_TRANSITION: &'static [u8] = &*b"canonical_transition";
|
||||
|
||||
/// Information about a block.
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -97,10 +97,9 @@ struct Entry {
|
||||
|
||||
impl HeapSizeOf for Entry {
|
||||
fn heap_size_of_children(&self) -> usize {
|
||||
if self.candidates.spilled() {
|
||||
self.candidates.capacity() * ::std::mem::size_of::<Candidate>()
|
||||
} else {
|
||||
0
|
||||
match self.candidates.spilled() {
|
||||
false => 0,
|
||||
true => self.candidates.capacity() * ::std::mem::size_of::<Candidate>(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -135,7 +134,7 @@ impl Decodable for Entry {
|
||||
// rely on the invariant that the canonical entry is always first.
|
||||
let canon_hash = candidates[0].hash;
|
||||
Ok(Entry {
|
||||
candidates,
|
||||
candidates: candidates,
|
||||
canonical_hash: canon_hash,
|
||||
})
|
||||
}
|
||||
@@ -270,9 +269,9 @@ impl HeaderChain {
|
||||
best_block: RwLock::new(best_block),
|
||||
candidates: RwLock::new(candidates),
|
||||
live_epoch_proofs: RwLock::new(live_epoch_proofs),
|
||||
db,
|
||||
col,
|
||||
cache,
|
||||
db: db,
|
||||
col: col,
|
||||
cache: cache,
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -286,8 +285,8 @@ impl HeaderChain {
|
||||
candidates: RwLock::new(BTreeMap::new()),
|
||||
live_epoch_proofs: RwLock::new(live_epoch_proofs),
|
||||
db: db.clone(),
|
||||
col,
|
||||
cache,
|
||||
col: col,
|
||||
cache: cache,
|
||||
};
|
||||
|
||||
// insert the hardcoded sync into the database.
|
||||
@@ -303,8 +302,9 @@ impl HeaderChain {
|
||||
let decoded_header_num = decoded_header.number();
|
||||
|
||||
// write the block in the DB.
|
||||
info!(target: "chain", "Inserting hardcoded block #{} in chain", decoded_header_num);
|
||||
let pending = chain.insert_with_td(&mut batch, &decoded_header,
|
||||
info!(target: "chain", "Inserting hardcoded block #{} in chain",
|
||||
decoded_header_num);
|
||||
let pending = chain.insert_with_td(&mut batch, decoded_header,
|
||||
hardcoded_sync.total_difficulty, None)?;
|
||||
|
||||
// check that we have enough hardcoded CHT roots. avoids panicking later.
|
||||
@@ -324,7 +324,7 @@ impl HeaderChain {
|
||||
};
|
||||
|
||||
// instantiate genesis epoch data if it doesn't exist.
|
||||
if chain.db.get(col, LAST_CANONICAL_TRANSITION)?.is_none() {
|
||||
if let None = chain.db.get(col, LAST_CANONICAL_TRANSITION)? {
|
||||
let genesis_data = spec.genesis_epoch_data()?;
|
||||
|
||||
{
|
||||
@@ -349,7 +349,7 @@ impl HeaderChain {
|
||||
pub fn insert(
|
||||
&self,
|
||||
transaction: &mut DBTransaction,
|
||||
header: &Header,
|
||||
header: Header,
|
||||
transition_proof: Option<Vec<u8>>,
|
||||
) -> Result<PendingChanges, BlockImportError> {
|
||||
self.insert_inner(transaction, header, None, transition_proof)
|
||||
@@ -361,7 +361,7 @@ impl HeaderChain {
|
||||
pub fn insert_with_td(
|
||||
&self,
|
||||
transaction: &mut DBTransaction,
|
||||
header: &Header,
|
||||
header: Header,
|
||||
total_difficulty: U256,
|
||||
transition_proof: Option<Vec<u8>>,
|
||||
) -> Result<PendingChanges, BlockImportError> {
|
||||
@@ -371,7 +371,7 @@ impl HeaderChain {
|
||||
fn insert_inner(
|
||||
&self,
|
||||
transaction: &mut DBTransaction,
|
||||
header: &Header,
|
||||
header: Header,
|
||||
total_difficulty: Option<U256>,
|
||||
transition_proof: Option<Vec<u8>>,
|
||||
) -> Result<PendingChanges, BlockImportError> {
|
||||
@@ -381,7 +381,7 @@ impl HeaderChain {
|
||||
let transition = transition_proof.map(|proof| EpochTransition {
|
||||
block_hash: hash,
|
||||
block_number: number,
|
||||
proof,
|
||||
proof: proof,
|
||||
});
|
||||
|
||||
let mut pending = PendingChanges {
|
||||
@@ -415,9 +415,9 @@ impl HeaderChain {
|
||||
let cur_era = candidates.entry(number)
|
||||
.or_insert_with(|| Entry { candidates: SmallVec::new(), canonical_hash: hash });
|
||||
cur_era.candidates.push(Candidate {
|
||||
hash,
|
||||
parent_hash,
|
||||
total_difficulty,
|
||||
hash: hash,
|
||||
parent_hash: parent_hash,
|
||||
total_difficulty: total_difficulty,
|
||||
});
|
||||
|
||||
// fix ordering of era before writing.
|
||||
@@ -479,9 +479,9 @@ impl HeaderChain {
|
||||
|
||||
trace!(target: "chain", "New best block: ({}, {}), TD {}", number, hash, total_difficulty);
|
||||
pending.best_block = Some(BlockDescriptor {
|
||||
hash,
|
||||
number,
|
||||
total_difficulty,
|
||||
hash: hash,
|
||||
number: number,
|
||||
total_difficulty: total_difficulty,
|
||||
});
|
||||
|
||||
// produce next CHT root if it's time.
|
||||
@@ -651,7 +651,7 @@ impl HeaderChain {
|
||||
Ok(db_value) => {
|
||||
db_value.map(|x| x.into_vec()).map(encoded::Header::new)
|
||||
.and_then(|header| {
|
||||
cache.insert_block_header(hash, header.clone());
|
||||
cache.insert_block_header(hash.clone(), header.clone());
|
||||
Some(header)
|
||||
})
|
||||
},
|
||||
@@ -772,17 +772,16 @@ impl HeaderChain {
|
||||
|
||||
/// Get block status.
|
||||
pub fn status(&self, hash: &H256) -> BlockStatus {
|
||||
if self.db.get(self.col, hash).ok().map_or(false, |x| x.is_some()) {
|
||||
BlockStatus::InChain
|
||||
} else {
|
||||
BlockStatus::Unknown
|
||||
match self.db.get(self.col, &*hash).ok().map_or(false, |x| x.is_some()) {
|
||||
true => BlockStatus::InChain,
|
||||
false => BlockStatus::Unknown,
|
||||
}
|
||||
}
|
||||
|
||||
/// Insert a pending transition.
|
||||
pub fn insert_pending_transition(&self, batch: &mut DBTransaction, hash: H256, t: &PendingEpochTransition) {
|
||||
pub fn insert_pending_transition(&self, batch: &mut DBTransaction, hash: H256, t: PendingEpochTransition) {
|
||||
let key = pending_transition_key(hash);
|
||||
batch.put(self.col, &*key, &*::rlp::encode(t));
|
||||
batch.put(self.col, &*key, &*::rlp::encode(&t));
|
||||
}
|
||||
|
||||
/// Get pending transition for a specific block hash.
|
||||
@@ -866,7 +865,7 @@ mod tests {
|
||||
use ethcore::ids::BlockId;
|
||||
use ethcore::header::Header;
|
||||
use ethcore::spec::Spec;
|
||||
use cache::Cache;
|
||||
use cache::Cache;
|
||||
use kvdb::KeyValueDB;
|
||||
use kvdb_memorydb;
|
||||
|
||||
@@ -898,7 +897,7 @@ mod tests {
|
||||
parent_hash = header.hash();
|
||||
|
||||
let mut tx = db.transaction();
|
||||
let pending = chain.insert(&mut tx, &header, None).unwrap();
|
||||
let pending = chain.insert(&mut tx, header, None).unwrap();
|
||||
db.write(tx).unwrap();
|
||||
chain.apply_pending(pending);
|
||||
|
||||
@@ -931,7 +930,7 @@ mod tests {
|
||||
parent_hash = header.hash();
|
||||
|
||||
let mut tx = db.transaction();
|
||||
let pending = chain.insert(&mut tx, &header, None).unwrap();
|
||||
let pending = chain.insert(&mut tx, header, None).unwrap();
|
||||
db.write(tx).unwrap();
|
||||
chain.apply_pending(pending);
|
||||
|
||||
@@ -950,7 +949,7 @@ mod tests {
|
||||
parent_hash = header.hash();
|
||||
|
||||
let mut tx = db.transaction();
|
||||
let pending = chain.insert(&mut tx, &header, None).unwrap();
|
||||
let pending = chain.insert(&mut tx, header, None).unwrap();
|
||||
db.write(tx).unwrap();
|
||||
chain.apply_pending(pending);
|
||||
|
||||
@@ -974,7 +973,7 @@ mod tests {
|
||||
parent_hash = header.hash();
|
||||
|
||||
let mut tx = db.transaction();
|
||||
let pending = chain.insert(&mut tx, &header, None).unwrap();
|
||||
let pending = chain.insert(&mut tx, header, None).unwrap();
|
||||
db.write(tx).unwrap();
|
||||
chain.apply_pending(pending);
|
||||
|
||||
@@ -1027,7 +1026,7 @@ mod tests {
|
||||
parent_hash = header.hash();
|
||||
|
||||
let mut tx = db.transaction();
|
||||
let pending = chain.insert(&mut tx, &header, None).unwrap();
|
||||
let pending = chain.insert(&mut tx, header, None).unwrap();
|
||||
db.write(tx).unwrap();
|
||||
chain.apply_pending(pending);
|
||||
|
||||
@@ -1067,7 +1066,7 @@ mod tests {
|
||||
parent_hash = header.hash();
|
||||
|
||||
let mut tx = db.transaction();
|
||||
let pending = chain.insert(&mut tx, &header, None).unwrap();
|
||||
let pending = chain.insert(&mut tx, header, None).unwrap();
|
||||
db.write(tx).unwrap();
|
||||
chain.apply_pending(pending);
|
||||
|
||||
@@ -1084,7 +1083,7 @@ mod tests {
|
||||
parent_hash = header.hash();
|
||||
|
||||
let mut tx = db.transaction();
|
||||
let pending = chain.insert(&mut tx, &header, None).unwrap();
|
||||
let pending = chain.insert(&mut tx, header, None).unwrap();
|
||||
db.write(tx).unwrap();
|
||||
chain.apply_pending(pending);
|
||||
|
||||
@@ -1142,7 +1141,7 @@ mod tests {
|
||||
None
|
||||
};
|
||||
|
||||
let pending = chain.insert(&mut tx, &header, epoch_proof).unwrap();
|
||||
let pending = chain.insert(&mut tx, header, epoch_proof).unwrap();
|
||||
db.write(tx).unwrap();
|
||||
chain.apply_pending(pending);
|
||||
|
||||
@@ -1170,7 +1169,7 @@ mod tests {
|
||||
parent_hash = header.hash();
|
||||
|
||||
let mut tx = db.transaction();
|
||||
let pending = chain.insert(&mut tx, &header, None).unwrap();
|
||||
let pending = chain.insert(&mut tx, header, None).unwrap();
|
||||
db.write(tx).unwrap();
|
||||
chain.apply_pending(pending);
|
||||
|
||||
@@ -1209,7 +1208,7 @@ mod tests {
|
||||
parent_hash = header.hash();
|
||||
|
||||
let mut tx = db.transaction();
|
||||
let pending = chain.insert(&mut tx, &header, None).expect("failed inserting a transaction");
|
||||
let pending = chain.insert(&mut tx, header, None).expect("failed inserting a transaction");
|
||||
db.write(tx).unwrap();
|
||||
chain.apply_pending(pending);
|
||||
|
||||
|
||||
@@ -127,6 +127,9 @@ pub trait LightChainClient: Send + Sync {
|
||||
/// Get the `i`th CHT root.
|
||||
fn cht_root(&self, i: usize) -> Option<H256>;
|
||||
|
||||
/// Get the EIP-86 transition block number.
|
||||
fn eip86_transition(&self) -> BlockNumber;
|
||||
|
||||
/// Get a report of import activity since the last call.
|
||||
fn report(&self) -> ClientReport;
|
||||
}
|
||||
@@ -176,7 +179,7 @@ impl<T: ChainDataFetcher> Client<T> {
|
||||
io_channel: IoChannel<ClientIoMessage>,
|
||||
cache: Arc<Mutex<Cache>>
|
||||
) -> Result<Self, Error> {
|
||||
Ok(Self {
|
||||
Ok(Client {
|
||||
queue: HeaderQueue::new(config.queue, spec.engine.clone(), io_channel, config.check_seal),
|
||||
engine: spec.engine.clone(),
|
||||
chain: {
|
||||
@@ -185,9 +188,9 @@ impl<T: ChainDataFetcher> Client<T> {
|
||||
},
|
||||
report: RwLock::new(ClientReport::default()),
|
||||
import_lock: Mutex::new(()),
|
||||
db,
|
||||
db: db,
|
||||
listeners: RwLock::new(vec![]),
|
||||
fetcher,
|
||||
fetcher: fetcher,
|
||||
verify_full: config.verify_full,
|
||||
})
|
||||
}
|
||||
@@ -229,7 +232,7 @@ impl<T: ChainDataFetcher> Client<T> {
|
||||
BlockChainInfo {
|
||||
total_difficulty: best_td,
|
||||
pending_total_difficulty: best_td + self.queue.total_difficulty(),
|
||||
genesis_hash,
|
||||
genesis_hash: genesis_hash,
|
||||
best_block_hash: best_hdr.hash(),
|
||||
best_block_number: best_hdr.number(),
|
||||
best_block_timestamp: best_hdr.timestamp(),
|
||||
@@ -313,14 +316,14 @@ impl<T: ChainDataFetcher> Client<T> {
|
||||
The node may not be able to synchronize further.", e);
|
||||
}
|
||||
|
||||
let epoch_proof = self.engine.is_epoch_end(
|
||||
let epoch_proof = self.engine.is_epoch_end(
|
||||
&verified_header,
|
||||
&|h| self.chain.block_header(BlockId::Hash(h)).and_then(|hdr| hdr.decode().ok()),
|
||||
&|h| self.chain.pending_transition(h),
|
||||
);
|
||||
|
||||
let mut tx = self.db.transaction();
|
||||
let pending = match self.chain.insert(&mut tx, &verified_header, epoch_proof) {
|
||||
let pending = match self.chain.insert(&mut tx, verified_header, epoch_proof) {
|
||||
Ok(pending) => {
|
||||
good.push(hash);
|
||||
self.report.write().blocks_imported += 1;
|
||||
@@ -511,8 +514,8 @@ impl<T: ChainDataFetcher> Client<T> {
|
||||
};
|
||||
|
||||
let mut batch = self.db.transaction();
|
||||
self.chain.insert_pending_transition(&mut batch, header.hash(), &epoch::PendingTransition {
|
||||
proof,
|
||||
self.chain.insert_pending_transition(&mut batch, header.hash(), epoch::PendingTransition {
|
||||
proof: proof,
|
||||
});
|
||||
self.db.write_buffered(batch);
|
||||
Ok(())
|
||||
@@ -582,6 +585,10 @@ impl<T: ChainDataFetcher> LightChainClient for Client<T> {
|
||||
Client::cht_root(self, i)
|
||||
}
|
||||
|
||||
fn eip86_transition(&self) -> BlockNumber {
|
||||
self.engine().params().eip86_transition
|
||||
}
|
||||
|
||||
fn report(&self) -> ClientReport {
|
||||
Client::report(self)
|
||||
}
|
||||
@@ -602,7 +609,7 @@ impl<T: ChainDataFetcher> ::ethcore::client::EngineClient for Client<T> {
|
||||
self.chain.epoch_transition_for(parent_hash).map(|(hdr, proof)| EpochTransition {
|
||||
block_hash: hdr.hash(),
|
||||
block_number: hdr.number(),
|
||||
proof,
|
||||
proof: proof,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -79,8 +79,8 @@ impl<T: ChainDataFetcher> Service<T> {
|
||||
spec.engine.register_client(Arc::downgrade(&client) as _);
|
||||
|
||||
Ok(Service {
|
||||
client,
|
||||
io_service,
|
||||
client: client,
|
||||
io_service: io_service,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ extern crate keccak_hasher;
|
||||
extern crate memorydb;
|
||||
extern crate patricia_trie as trie;
|
||||
extern crate patricia_trie_ethereum as ethtrie;
|
||||
extern crate fastmap;
|
||||
extern crate plain_hasher;
|
||||
extern crate rand;
|
||||
extern crate rlp;
|
||||
extern crate parking_lot;
|
||||
|
||||
@@ -44,9 +44,6 @@ pub trait IoContext {
|
||||
|
||||
/// Persistent peer id
|
||||
fn persistent_peer_id(&self, peer: PeerId) -> Option<NodeId>;
|
||||
|
||||
/// Whether given peer id is reserved peer
|
||||
fn is_reserved_peer(&self, peer: PeerId) -> bool;
|
||||
}
|
||||
|
||||
impl<T> IoContext for T where T: ?Sized + NetworkContext {
|
||||
@@ -79,10 +76,6 @@ impl<T> IoContext for T where T: ?Sized + NetworkContext {
|
||||
fn persistent_peer_id(&self, peer: PeerId) -> Option<NodeId> {
|
||||
self.session_info(peer).and_then(|info| info.id)
|
||||
}
|
||||
|
||||
fn is_reserved_peer(&self, peer: PeerId) -> bool {
|
||||
NetworkContext::is_reserved_peer(self, peer)
|
||||
}
|
||||
}
|
||||
|
||||
/// Basic context for the protocol.
|
||||
@@ -133,7 +126,7 @@ impl<'a> BasicContext for TickCtx<'a> {
|
||||
}
|
||||
|
||||
fn request_from(&self, peer: PeerId, requests: Requests) -> Result<ReqId, Error> {
|
||||
self.proto.request_from(self.io, peer, requests)
|
||||
self.proto.request_from(self.io, &peer, requests)
|
||||
}
|
||||
|
||||
fn make_announcement(&self, announcement: Announcement) {
|
||||
@@ -166,7 +159,7 @@ impl<'a> BasicContext for Ctx<'a> {
|
||||
}
|
||||
|
||||
fn request_from(&self, peer: PeerId, requests: Requests) -> Result<ReqId, Error> {
|
||||
self.proto.request_from(self.io, peer, requests)
|
||||
self.proto.request_from(self.io, &peer, requests)
|
||||
}
|
||||
|
||||
fn make_announcement(&self, announcement: Announcement) {
|
||||
|
||||
@@ -108,9 +108,9 @@ impl LoadDistribution {
|
||||
|
||||
LoadTimer {
|
||||
start: Instant::now(),
|
||||
n,
|
||||
n: n,
|
||||
dist: self,
|
||||
kind,
|
||||
kind: kind,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,15 +120,17 @@ impl LoadDistribution {
|
||||
pub fn expected_time(&self, kind: Kind) -> Duration {
|
||||
let samples = self.samples.read();
|
||||
samples.get(&kind).and_then(|s| {
|
||||
if s.is_empty() { return None }
|
||||
if s.len() == 0 { return None }
|
||||
|
||||
let alpha: f64 = 1_f64 / s.len() as f64;
|
||||
let start = *s.front().expect("length known to be non-zero; qed") as f64;
|
||||
let ema = s.iter().skip(1).fold(start, |a, &c| {
|
||||
let alpha: f64 = 1f64 / s.len() as f64;
|
||||
let start = s.front().expect("length known to be non-zero; qed").clone();
|
||||
let ema = s.iter().skip(1).fold(start as f64, |a, &c| {
|
||||
(alpha * c as f64) + ((1.0 - alpha) * a)
|
||||
});
|
||||
|
||||
Some(Duration::from_nanos(ema as u64))
|
||||
// TODO: use `Duration::from_nanos` once stable (https://github.com/rust-lang/rust/issues/46507)
|
||||
let ema = ema as u64;
|
||||
Some(Duration::new(ema / 1_000_000_000, (ema % 1_000_000_000) as u32))
|
||||
}).unwrap_or_else(move || hardcoded_serve_time(kind))
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ const UPDATE_INTERVAL: Duration = Duration::from_millis(5000);
|
||||
const PACKET_COUNT_V1: u8 = 9;
|
||||
|
||||
/// Supported protocol versions.
|
||||
pub const PROTOCOL_VERSIONS: &[(u8, u8)] = &[
|
||||
pub const PROTOCOL_VERSIONS: &'static [(u8, u8)] = &[
|
||||
(1, PACKET_COUNT_V1),
|
||||
];
|
||||
|
||||
@@ -309,9 +309,9 @@ mod id_guard {
|
||||
/// (for forming responses, triggering handlers) until defused
|
||||
pub fn new(peers: RwLockReadGuard<'a, PeerMap>, peer_id: PeerId, req_id: ReqId) -> Self {
|
||||
IdGuard {
|
||||
peers,
|
||||
peer_id,
|
||||
req_id,
|
||||
peers: peers,
|
||||
peer_id: peer_id,
|
||||
req_id: req_id,
|
||||
active: true,
|
||||
}
|
||||
}
|
||||
@@ -354,7 +354,6 @@ pub struct LightProtocol {
|
||||
peers: RwLock<PeerMap>,
|
||||
capabilities: RwLock<Capabilities>,
|
||||
flow_params: RwLock<Arc<FlowParams>>,
|
||||
free_flow_params: Arc<FlowParams>,
|
||||
handlers: Vec<Arc<Handler>>,
|
||||
req_id: AtomicUsize,
|
||||
sample_store: Box<SampleStore>,
|
||||
@@ -376,24 +375,23 @@ impl LightProtocol {
|
||||
);
|
||||
|
||||
LightProtocol {
|
||||
provider,
|
||||
provider: provider,
|
||||
config: params.config,
|
||||
genesis_hash,
|
||||
genesis_hash: genesis_hash,
|
||||
network_id: params.network_id,
|
||||
pending_peers: RwLock::new(HashMap::new()),
|
||||
peers: RwLock::new(HashMap::new()),
|
||||
capabilities: RwLock::new(params.capabilities),
|
||||
flow_params: RwLock::new(Arc::new(flow_params)),
|
||||
free_flow_params: Arc::new(FlowParams::free()),
|
||||
handlers: Vec::new(),
|
||||
req_id: AtomicUsize::new(0),
|
||||
sample_store,
|
||||
load_distribution,
|
||||
sample_store: sample_store,
|
||||
load_distribution: load_distribution,
|
||||
}
|
||||
}
|
||||
|
||||
/// Attempt to get peer status.
|
||||
pub fn peer_status(&self, peer: PeerId) -> Option<Status> {
|
||||
pub fn peer_status(&self, peer: &PeerId) -> Option<Status> {
|
||||
self.peers.read().get(&peer)
|
||||
.map(|peer| peer.lock().status.clone())
|
||||
}
|
||||
@@ -414,9 +412,9 @@ impl LightProtocol {
|
||||
/// insufficient credits. Does not check capabilities before sending.
|
||||
/// On success, returns a request id which can later be coordinated
|
||||
/// with an event.
|
||||
pub fn request_from(&self, io: &IoContext, peer_id: PeerId, requests: Requests) -> Result<ReqId, Error> {
|
||||
pub fn request_from(&self, io: &IoContext, peer_id: &PeerId, requests: Requests) -> Result<ReqId, Error> {
|
||||
let peers = self.peers.read();
|
||||
let peer = match peers.get(&peer_id) {
|
||||
let peer = match peers.get(peer_id) {
|
||||
Some(peer) => peer,
|
||||
None => return Err(Error::UnknownPeer),
|
||||
};
|
||||
@@ -444,7 +442,7 @@ impl LightProtocol {
|
||||
peer_id, cost, pre_creds);
|
||||
|
||||
let req_id = ReqId(self.req_id.fetch_add(1, Ordering::SeqCst));
|
||||
io.send(peer_id, packet::REQUEST, {
|
||||
io.send(*peer_id, packet::REQUEST, {
|
||||
let mut stream = RlpStream::new_list(2);
|
||||
stream.append(&req_id.0).append_list(&requests.requests());
|
||||
stream.out()
|
||||
@@ -473,7 +471,7 @@ impl LightProtocol {
|
||||
// TODO: "urgent" announcements like new blocks?
|
||||
// the timer approach will skip 1 (possibly 2) in rare occasions.
|
||||
if peer_info.sent_head == announcement.head_hash ||
|
||||
peer_info.status.head_num >= announcement.head_num ||
|
||||
peer_info.status.head_num >= announcement.head_num ||
|
||||
now - peer_info.last_update < UPDATE_INTERVAL {
|
||||
continue
|
||||
}
|
||||
@@ -530,18 +528,18 @@ impl LightProtocol {
|
||||
// - check whether peer exists
|
||||
// - check whether request was made
|
||||
// - check whether request kinds match
|
||||
fn pre_verify_response(&self, peer: PeerId, raw: &Rlp) -> Result<IdGuard, Error> {
|
||||
fn pre_verify_response(&self, peer: &PeerId, raw: &Rlp) -> Result<IdGuard, Error> {
|
||||
let req_id = ReqId(raw.val_at(0)?);
|
||||
let cur_credits: U256 = raw.val_at(1)?;
|
||||
|
||||
trace!(target: "pip", "pre-verifying response for {} from peer {}", req_id, peer);
|
||||
|
||||
let peers = self.peers.read();
|
||||
let res = match peers.get(&peer) {
|
||||
let res = match peers.get(peer) {
|
||||
Some(peer_info) => {
|
||||
let mut peer_info = peer_info.lock();
|
||||
let peer_info: &mut Peer = &mut *peer_info;
|
||||
let req_info = peer_info.pending_requests.remove(req_id, Instant::now());
|
||||
let req_info = peer_info.pending_requests.remove(&req_id, Instant::now());
|
||||
let last_batched = peer_info.pending_requests.is_empty();
|
||||
let flow_info = peer_info.remote_flow.as_mut();
|
||||
|
||||
@@ -567,29 +565,29 @@ impl LightProtocol {
|
||||
None => Err(Error::UnknownPeer), // probably only occurs in a race of some kind.
|
||||
};
|
||||
|
||||
res.map(|_| IdGuard::new(peers, peer, req_id))
|
||||
res.map(|_| IdGuard::new(peers, *peer, req_id))
|
||||
}
|
||||
|
||||
/// Handle a packet using the given io context.
|
||||
/// Packet data is _untrusted_, which means that invalid data won't lead to
|
||||
/// issues.
|
||||
pub fn handle_packet(&self, io: &IoContext, peer: PeerId, packet_id: u8, data: &[u8]) {
|
||||
pub fn handle_packet(&self, io: &IoContext, peer: &PeerId, packet_id: u8, data: &[u8]) {
|
||||
let rlp = Rlp::new(data);
|
||||
|
||||
trace!(target: "pip", "Incoming packet {} from peer {}", packet_id, peer);
|
||||
|
||||
// handle the packet
|
||||
let res = match packet_id {
|
||||
packet::STATUS => self.status(peer, io, &rlp),
|
||||
packet::ANNOUNCE => self.announcement(peer, io, &rlp),
|
||||
packet::STATUS => self.status(peer, io, rlp),
|
||||
packet::ANNOUNCE => self.announcement(peer, io, rlp),
|
||||
|
||||
packet::REQUEST => self.request(peer, io, &rlp),
|
||||
packet::RESPONSE => self.response(peer, io, &rlp),
|
||||
packet::REQUEST => self.request(peer, io, rlp),
|
||||
packet::RESPONSE => self.response(peer, io, rlp),
|
||||
|
||||
packet::UPDATE_CREDITS => self.update_credits(peer, io, &rlp),
|
||||
packet::ACKNOWLEDGE_UPDATE => self.acknowledge_update(peer, io, &rlp),
|
||||
packet::UPDATE_CREDITS => self.update_credits(peer, io, rlp),
|
||||
packet::ACKNOWLEDGE_UPDATE => self.acknowledge_update(peer, io, rlp),
|
||||
|
||||
packet::SEND_TRANSACTIONS => self.relay_transactions(peer, io, &rlp),
|
||||
packet::SEND_TRANSACTIONS => self.relay_transactions(peer, io, rlp),
|
||||
|
||||
other => {
|
||||
Err(Error::UnrecognizedPacket(other))
|
||||
@@ -597,7 +595,7 @@ impl LightProtocol {
|
||||
};
|
||||
|
||||
if let Err(e) = res {
|
||||
punish(peer, io, &e);
|
||||
punish(*peer, io, e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -684,14 +682,14 @@ impl LightProtocol {
|
||||
}
|
||||
|
||||
/// called when a peer connects.
|
||||
pub fn on_connect(&self, peer: PeerId, io: &IoContext) {
|
||||
let proto_version = match io.protocol_version(peer).ok_or(Error::WrongNetwork) {
|
||||
pub fn on_connect(&self, peer: &PeerId, io: &IoContext) {
|
||||
let proto_version = match io.protocol_version(*peer).ok_or(Error::WrongNetwork) {
|
||||
Ok(pv) => pv,
|
||||
Err(e) => { punish(peer, io, &e); return }
|
||||
Err(e) => { punish(*peer, io, e); return }
|
||||
};
|
||||
|
||||
if PROTOCOL_VERSIONS.iter().find(|x| x.0 == proto_version).is_none() {
|
||||
punish(peer, io, &Error::UnsupportedProtocolVersion(proto_version));
|
||||
punish(*peer, io, Error::UnsupportedProtocolVersion(proto_version));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -707,22 +705,17 @@ impl LightProtocol {
|
||||
last_head: None,
|
||||
};
|
||||
|
||||
let capabilities = self.capabilities.read();
|
||||
let cost_local_flow = self.flow_params.read();
|
||||
let local_flow = if io.is_reserved_peer(peer) {
|
||||
&*self.free_flow_params
|
||||
} else {
|
||||
&**cost_local_flow
|
||||
};
|
||||
let status_packet = status::write_handshake(&status, &capabilities, Some(local_flow));
|
||||
let capabilities = self.capabilities.read().clone();
|
||||
let local_flow = self.flow_params.read();
|
||||
let status_packet = status::write_handshake(&status, &capabilities, Some(&**local_flow));
|
||||
|
||||
self.pending_peers.write().insert(peer, PendingPeer {
|
||||
self.pending_peers.write().insert(*peer, PendingPeer {
|
||||
sent_head: chain_info.best_block_hash,
|
||||
last_update: Instant::now(),
|
||||
});
|
||||
|
||||
trace!(target: "pip", "Sending status to peer {}", peer);
|
||||
io.send(peer, packet::STATUS, status_packet);
|
||||
io.send(*peer, packet::STATUS, status_packet);
|
||||
}
|
||||
|
||||
/// called when a peer disconnects.
|
||||
@@ -743,8 +736,8 @@ impl LightProtocol {
|
||||
|
||||
for handler in &self.handlers {
|
||||
handler.on_disconnect(&Ctx {
|
||||
peer,
|
||||
io,
|
||||
peer: peer,
|
||||
io: io,
|
||||
proto: self,
|
||||
}, &unfulfilled)
|
||||
}
|
||||
@@ -755,7 +748,7 @@ impl LightProtocol {
|
||||
where F: FnOnce(&BasicContext) -> T
|
||||
{
|
||||
f(&TickCtx {
|
||||
io,
|
||||
io: io,
|
||||
proto: self,
|
||||
})
|
||||
}
|
||||
@@ -763,7 +756,7 @@ impl LightProtocol {
|
||||
fn tick_handlers(&self, io: &IoContext) {
|
||||
for handler in &self.handlers {
|
||||
handler.tick(&TickCtx {
|
||||
io,
|
||||
io: io,
|
||||
proto: self,
|
||||
})
|
||||
}
|
||||
@@ -794,15 +787,15 @@ impl LightProtocol {
|
||||
let mut peer_info = peer_info.lock();
|
||||
|
||||
io.send(*peer_id, packet::UPDATE_CREDITS, packet_body.clone());
|
||||
peer_info.awaiting_acknowledge = Some((now, new_params.clone()));
|
||||
peer_info.awaiting_acknowledge = Some((now.clone(), new_params.clone()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl LightProtocol {
|
||||
// Handle status message from peer.
|
||||
fn status(&self, peer: PeerId, io: &IoContext, data: &Rlp) -> Result<(), Error> {
|
||||
let pending = match self.pending_peers.write().remove(&peer) {
|
||||
fn status(&self, peer: &PeerId, io: &IoContext, data: Rlp) -> Result<(), Error> {
|
||||
let pending = match self.pending_peers.write().remove(peer) {
|
||||
Some(pending) => pending,
|
||||
None => {
|
||||
return Err(Error::UnexpectedHandshake);
|
||||
@@ -820,37 +813,33 @@ impl LightProtocol {
|
||||
return Err(Error::WrongNetwork);
|
||||
}
|
||||
|
||||
if Some(status.protocol_version as u8) != io.protocol_version(peer) {
|
||||
if Some(status.protocol_version as u8) != io.protocol_version(*peer) {
|
||||
return Err(Error::BadProtocolVersion);
|
||||
}
|
||||
|
||||
let remote_flow = flow_params.map(|params| (params.create_credits(), params));
|
||||
let local_flow = if io.is_reserved_peer(peer) {
|
||||
self.free_flow_params.clone()
|
||||
} else {
|
||||
self.flow_params.read().clone()
|
||||
};
|
||||
let local_flow = self.flow_params.read().clone();
|
||||
|
||||
self.peers.write().insert(peer, Mutex::new(Peer {
|
||||
self.peers.write().insert(*peer, Mutex::new(Peer {
|
||||
local_credits: local_flow.create_credits(),
|
||||
status: status.clone(),
|
||||
capabilities,
|
||||
remote_flow,
|
||||
capabilities: capabilities.clone(),
|
||||
remote_flow: remote_flow,
|
||||
sent_head: pending.sent_head,
|
||||
last_update: pending.last_update,
|
||||
pending_requests: RequestSet::default(),
|
||||
failed_requests: Vec::new(),
|
||||
propagated_transactions: HashSet::new(),
|
||||
skip_update: false,
|
||||
local_flow,
|
||||
local_flow: local_flow,
|
||||
awaiting_acknowledge: None,
|
||||
}));
|
||||
|
||||
let any_kept = self.handlers.iter().map(
|
||||
|handler| handler.on_connect(
|
||||
&Ctx {
|
||||
peer,
|
||||
io,
|
||||
peer: *peer,
|
||||
io: io,
|
||||
proto: self,
|
||||
},
|
||||
&status,
|
||||
@@ -866,8 +855,8 @@ impl LightProtocol {
|
||||
}
|
||||
|
||||
// Handle an announcement.
|
||||
fn announcement(&self, peer: PeerId, io: &IoContext, data: &Rlp) -> Result<(), Error> {
|
||||
if !self.peers.read().contains_key(&peer) {
|
||||
fn announcement(&self, peer: &PeerId, io: &IoContext, data: Rlp) -> Result<(), Error> {
|
||||
if !self.peers.read().contains_key(peer) {
|
||||
debug!(target: "pip", "Ignoring announcement from unknown peer");
|
||||
return Ok(())
|
||||
}
|
||||
@@ -877,7 +866,7 @@ impl LightProtocol {
|
||||
// scope to ensure locks are dropped before moving into handler-space.
|
||||
{
|
||||
let peers = self.peers.read();
|
||||
let peer_info = match peers.get(&peer) {
|
||||
let peer_info = match peers.get(peer) {
|
||||
Some(info) => info,
|
||||
None => return Ok(()),
|
||||
};
|
||||
@@ -901,8 +890,8 @@ impl LightProtocol {
|
||||
|
||||
for handler in &self.handlers {
|
||||
handler.on_announcement(&Ctx {
|
||||
peer,
|
||||
io,
|
||||
peer: *peer,
|
||||
io: io,
|
||||
proto: self,
|
||||
}, &announcement);
|
||||
}
|
||||
@@ -911,7 +900,7 @@ impl LightProtocol {
|
||||
}
|
||||
|
||||
// Receive requests from a peer.
|
||||
fn request(&self, peer_id: PeerId, io: &IoContext, raw: &Rlp) -> Result<(), Error> {
|
||||
fn request(&self, peer_id: &PeerId, io: &IoContext, raw: Rlp) -> Result<(), Error> {
|
||||
// the maximum amount of requests we'll fill in a single packet.
|
||||
const MAX_REQUESTS: usize = 256;
|
||||
|
||||
@@ -919,7 +908,7 @@ impl LightProtocol {
|
||||
use ::request::CompleteRequest;
|
||||
|
||||
let peers = self.peers.read();
|
||||
let peer = match peers.get(&peer_id) {
|
||||
let peer = match peers.get(peer_id) {
|
||||
Some(peer) => peer,
|
||||
None => {
|
||||
debug!(target: "pip", "Ignoring request from unknown peer");
|
||||
@@ -979,7 +968,7 @@ impl LightProtocol {
|
||||
}
|
||||
|
||||
// handle a packet with responses.
|
||||
fn response(&self, peer: PeerId, io: &IoContext, raw: &Rlp) -> Result<(), Error> {
|
||||
fn response(&self, peer: &PeerId, io: &IoContext, raw: Rlp) -> Result<(), Error> {
|
||||
let (req_id, responses) = {
|
||||
let id_guard = self.pre_verify_response(peer, &raw)?;
|
||||
let responses: Vec<Response> = raw.list_at(2)?;
|
||||
@@ -988,9 +977,9 @@ impl LightProtocol {
|
||||
|
||||
for handler in &self.handlers {
|
||||
handler.on_responses(&Ctx {
|
||||
io,
|
||||
io: io,
|
||||
proto: self,
|
||||
peer,
|
||||
peer: *peer,
|
||||
}, req_id, &responses);
|
||||
}
|
||||
|
||||
@@ -998,10 +987,10 @@ impl LightProtocol {
|
||||
}
|
||||
|
||||
// handle an update of request credits parameters.
|
||||
fn update_credits(&self, peer_id: PeerId, io: &IoContext, raw: &Rlp) -> Result<(), Error> {
|
||||
fn update_credits(&self, peer_id: &PeerId, io: &IoContext, raw: Rlp) -> Result<(), Error> {
|
||||
let peers = self.peers.read();
|
||||
|
||||
let peer = peers.get(&peer_id).ok_or(Error::UnknownPeer)?;
|
||||
let peer = peers.get(peer_id).ok_or(Error::UnknownPeer)?;
|
||||
let mut peer = peer.lock();
|
||||
|
||||
trace!(target: "pip", "Received an update to request credit params from peer {}", peer_id);
|
||||
@@ -1033,9 +1022,9 @@ impl LightProtocol {
|
||||
}
|
||||
|
||||
// handle an acknowledgement of request credits update.
|
||||
fn acknowledge_update(&self, peer_id: PeerId, _io: &IoContext, _raw: &Rlp) -> Result<(), Error> {
|
||||
fn acknowledge_update(&self, peer_id: &PeerId, _io: &IoContext, _raw: Rlp) -> Result<(), Error> {
|
||||
let peers = self.peers.read();
|
||||
let peer = peers.get(&peer_id).ok_or(Error::UnknownPeer)?;
|
||||
let peer = peers.get(peer_id).ok_or(Error::UnknownPeer)?;
|
||||
let mut peer = peer.lock();
|
||||
|
||||
trace!(target: "pip", "Received an acknowledgement for new request credit params from peer {}", peer_id);
|
||||
@@ -1052,7 +1041,7 @@ impl LightProtocol {
|
||||
}
|
||||
|
||||
// Receive a set of transactions to relay.
|
||||
fn relay_transactions(&self, peer: PeerId, io: &IoContext, data: &Rlp) -> Result<(), Error> {
|
||||
fn relay_transactions(&self, peer: &PeerId, io: &IoContext, data: Rlp) -> Result<(), Error> {
|
||||
const MAX_TRANSACTIONS: usize = 256;
|
||||
|
||||
let txs: Vec<_> = data.iter()
|
||||
@@ -1064,8 +1053,8 @@ impl LightProtocol {
|
||||
|
||||
for handler in &self.handlers {
|
||||
handler.on_transactions(&Ctx {
|
||||
peer,
|
||||
io,
|
||||
peer: *peer,
|
||||
io: io,
|
||||
proto: self,
|
||||
}, &txs);
|
||||
}
|
||||
@@ -1075,7 +1064,7 @@ impl LightProtocol {
|
||||
}
|
||||
|
||||
// if something went wrong, figure out how much to punish the peer.
|
||||
fn punish(peer: PeerId, io: &IoContext, e: &Error) {
|
||||
fn punish(peer: PeerId, io: &IoContext, e: Error) {
|
||||
match e.punishment() {
|
||||
Punishment::None => {}
|
||||
Punishment::Disconnect => {
|
||||
@@ -1102,11 +1091,11 @@ impl NetworkProtocolHandler for LightProtocol {
|
||||
}
|
||||
|
||||
fn read(&self, io: &NetworkContext, peer: &PeerId, packet_id: u8, data: &[u8]) {
|
||||
self.handle_packet(&io, *peer, packet_id, data);
|
||||
self.handle_packet(&io, peer, packet_id, data);
|
||||
}
|
||||
|
||||
fn connected(&self, io: &NetworkContext, peer: &PeerId) {
|
||||
self.on_connect(*peer, &io);
|
||||
self.on_connect(peer, &io);
|
||||
}
|
||||
|
||||
fn disconnected(&self, io: &NetworkContext, peer: &PeerId) {
|
||||
|
||||
@@ -46,7 +46,7 @@ pub struct Credits {
|
||||
|
||||
impl Credits {
|
||||
/// Get the current amount of credits..
|
||||
pub fn current(&self) -> U256 { self.estimate }
|
||||
pub fn current(&self) -> U256 { self.estimate.clone() }
|
||||
|
||||
/// Make a definitive update.
|
||||
/// This will be the value obtained after receiving
|
||||
@@ -68,11 +68,12 @@ impl Credits {
|
||||
/// If unsuccessful, the structure will be unaltered an an
|
||||
/// error will be produced.
|
||||
pub fn deduct_cost(&mut self, cost: U256) -> Result<(), Error> {
|
||||
if cost > self.estimate {
|
||||
Err(Error::NoCredits)
|
||||
} else {
|
||||
self.estimate = self.estimate - cost;
|
||||
Ok(())
|
||||
match cost > self.estimate {
|
||||
true => Err(Error::NoCredits),
|
||||
false => {
|
||||
self.estimate = self.estimate - cost;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -120,7 +121,7 @@ impl Default for CostTable {
|
||||
fn default() -> Self {
|
||||
// arbitrarily chosen constants.
|
||||
CostTable {
|
||||
base: 100_000.into(),
|
||||
base: 100000.into(),
|
||||
headers: Some(10000.into()),
|
||||
transaction_index: Some(10000.into()),
|
||||
body: Some(15000.into()),
|
||||
@@ -140,7 +141,7 @@ impl Encodable for CostTable {
|
||||
fn append_cost(s: &mut RlpStream, cost: &Option<U256>, kind: request::Kind) {
|
||||
if let Some(ref cost) = *cost {
|
||||
s.begin_list(2);
|
||||
// hack around https://github.com/paritytech/parity-ethereum/issues/4356
|
||||
// hack around https://github.com/paritytech/parity/issues/4356
|
||||
Encodable::rlp_append(&kind, s);
|
||||
s.append(cost);
|
||||
}
|
||||
@@ -192,17 +193,17 @@ impl Decodable for CostTable {
|
||||
}
|
||||
|
||||
let table = CostTable {
|
||||
base,
|
||||
headers,
|
||||
transaction_index,
|
||||
body,
|
||||
receipts,
|
||||
account,
|
||||
storage,
|
||||
code,
|
||||
header_proof,
|
||||
transaction_proof,
|
||||
epoch_signal,
|
||||
base: base,
|
||||
headers: headers,
|
||||
transaction_index: transaction_index,
|
||||
body: body,
|
||||
receipts: receipts,
|
||||
account: account,
|
||||
storage: storage,
|
||||
code: code,
|
||||
header_proof: header_proof,
|
||||
transaction_proof: transaction_proof,
|
||||
epoch_signal: epoch_signal,
|
||||
};
|
||||
|
||||
if table.costs_set() == 0 {
|
||||
@@ -226,9 +227,9 @@ impl FlowParams {
|
||||
/// credit limit, and (minimum) rate of recharge.
|
||||
pub fn new(limit: U256, costs: CostTable, recharge: U256) -> Self {
|
||||
FlowParams {
|
||||
costs,
|
||||
limit,
|
||||
recharge,
|
||||
costs: costs,
|
||||
limit: limit,
|
||||
recharge: recharge,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,7 +283,7 @@ impl FlowParams {
|
||||
};
|
||||
|
||||
FlowParams {
|
||||
costs,
|
||||
costs: costs,
|
||||
limit: max.into(),
|
||||
recharge: recharge.into(),
|
||||
}
|
||||
@@ -292,19 +293,19 @@ impl FlowParams {
|
||||
pub fn free() -> Self {
|
||||
let free_cost: Option<U256> = Some(0.into());
|
||||
FlowParams {
|
||||
limit: (!0_u64).into(),
|
||||
limit: (!0u64).into(),
|
||||
recharge: 1.into(),
|
||||
costs: CostTable {
|
||||
base: 0.into(),
|
||||
headers: free_cost,
|
||||
transaction_index: free_cost,
|
||||
body: free_cost,
|
||||
receipts: free_cost,
|
||||
account: free_cost,
|
||||
storage: free_cost,
|
||||
code: free_cost,
|
||||
header_proof: free_cost,
|
||||
transaction_proof: free_cost,
|
||||
headers: free_cost.clone(),
|
||||
transaction_index: free_cost.clone(),
|
||||
body: free_cost.clone(),
|
||||
receipts: free_cost.clone(),
|
||||
account: free_cost.clone(),
|
||||
storage: free_cost.clone(),
|
||||
code: free_cost.clone(),
|
||||
header_proof: free_cost.clone(),
|
||||
transaction_proof: free_cost.clone(),
|
||||
epoch_signal: free_cost,
|
||||
}
|
||||
}
|
||||
@@ -369,7 +370,7 @@ impl FlowParams {
|
||||
// recompute and update only in terms of full seconds elapsed
|
||||
// in order to keep the estimate as an underestimate.
|
||||
let elapsed = (now - credits.recharge_point).as_secs();
|
||||
credits.recharge_point += Duration::from_secs(elapsed);
|
||||
credits.recharge_point = credits.recharge_point + Duration::from_secs(elapsed);
|
||||
|
||||
let elapsed: U256 = elapsed.into();
|
||||
|
||||
@@ -417,7 +418,7 @@ mod tests {
|
||||
use std::time::Duration;
|
||||
|
||||
let flow_params = FlowParams::new(100.into(), Default::default(), 20.into());
|
||||
let mut credits = flow_params.create_credits();
|
||||
let mut credits = flow_params.create_credits();
|
||||
|
||||
assert!(credits.deduct_cost(101.into()).is_err());
|
||||
assert!(credits.deduct_cost(10.into()).is_ok());
|
||||
|
||||
@@ -73,7 +73,7 @@ impl RequestSet {
|
||||
}
|
||||
|
||||
/// Remove a set of requests from the stack.
|
||||
pub fn remove(&mut self, req_id: ReqId, now: Instant) -> Option<Requests> {
|
||||
pub fn remove(&mut self, req_id: &ReqId, now: Instant) -> Option<Requests> {
|
||||
let id = match self.ids.remove(&req_id) {
|
||||
Some(id) => id,
|
||||
None => return None,
|
||||
@@ -165,7 +165,7 @@ mod tests {
|
||||
let test_end = test_begin + req_time;
|
||||
assert!(req_set.check_timeout(test_end));
|
||||
|
||||
req_set.remove(ReqId(0), test_begin + Duration::from_secs(1)).unwrap();
|
||||
req_set.remove(&ReqId(0), test_begin + Duration::from_secs(1)).unwrap();
|
||||
assert!(!req_set.check_timeout(test_end));
|
||||
assert!(req_set.check_timeout(test_end + Duration::from_secs(1)));
|
||||
}
|
||||
@@ -183,7 +183,7 @@ mod tests {
|
||||
}
|
||||
|
||||
for i in (0..5).rev() {
|
||||
assert!(req_set.remove(ReqId(i), test_end).is_some());
|
||||
assert!(req_set.remove(&ReqId(i), test_end).is_some());
|
||||
assert_eq!(req_set.cumulative_cost, i.into());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,8 +43,8 @@ enum Key {
|
||||
|
||||
impl Key {
|
||||
// get the string value of this key.
|
||||
fn as_str(self) -> &'static str {
|
||||
match self {
|
||||
fn as_str(&self) -> &'static str {
|
||||
match *self {
|
||||
Key::ProtocolVersion => "protocolVersion",
|
||||
Key::NetworkId => "networkId",
|
||||
Key::HeadTD => "headTd",
|
||||
@@ -85,7 +85,7 @@ impl Key {
|
||||
// helper for decoding key-value pairs in the handshake or an announcement.
|
||||
struct Parser<'a> {
|
||||
pos: usize,
|
||||
rlp: &'a Rlp<'a>,
|
||||
rlp: Rlp<'a>,
|
||||
}
|
||||
|
||||
impl<'a> Parser<'a> {
|
||||
@@ -169,7 +169,7 @@ impl Status {
|
||||
}
|
||||
|
||||
/// Peer capabilities.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct Capabilities {
|
||||
/// Whether this peer can serve headers
|
||||
pub serve_headers: bool,
|
||||
@@ -208,10 +208,10 @@ impl Capabilities {
|
||||
/// - chain status
|
||||
/// - serving capabilities
|
||||
/// - request credit parameters
|
||||
pub fn parse_handshake(rlp: &Rlp) -> Result<(Status, Capabilities, Option<FlowParams>), DecoderError> {
|
||||
pub fn parse_handshake(rlp: Rlp) -> Result<(Status, Capabilities, Option<FlowParams>), DecoderError> {
|
||||
let mut parser = Parser {
|
||||
pos: 0,
|
||||
rlp,
|
||||
rlp: rlp,
|
||||
};
|
||||
|
||||
let status = Status {
|
||||
@@ -304,7 +304,7 @@ pub struct Announcement {
|
||||
}
|
||||
|
||||
/// Parse an announcement.
|
||||
pub fn parse_announcement(rlp: &Rlp) -> Result<Announcement, DecoderError> {
|
||||
pub fn parse_announcement(rlp: Rlp) -> Result<Announcement, DecoderError> {
|
||||
let mut last_key = None;
|
||||
|
||||
let mut announcement = Announcement {
|
||||
@@ -320,7 +320,7 @@ pub fn parse_announcement(rlp: &Rlp) -> Result<Announcement, DecoderError> {
|
||||
|
||||
let mut parser = Parser {
|
||||
pos: 4,
|
||||
rlp,
|
||||
rlp: rlp,
|
||||
};
|
||||
|
||||
while let Some((key, item)) = parser.get_next()? {
|
||||
@@ -404,7 +404,7 @@ mod tests {
|
||||
let handshake = write_handshake(&status, &capabilities, Some(&flow_params));
|
||||
|
||||
let (read_status, read_capabilities, read_flow)
|
||||
= parse_handshake(&Rlp::new(&handshake)).unwrap();
|
||||
= parse_handshake(Rlp::new(&handshake)).unwrap();
|
||||
|
||||
assert_eq!(read_status, status);
|
||||
assert_eq!(read_capabilities, capabilities);
|
||||
@@ -439,7 +439,7 @@ mod tests {
|
||||
let handshake = write_handshake(&status, &capabilities, Some(&flow_params));
|
||||
|
||||
let (read_status, read_capabilities, read_flow)
|
||||
= parse_handshake(&Rlp::new(&handshake)).unwrap();
|
||||
= parse_handshake(Rlp::new(&handshake)).unwrap();
|
||||
|
||||
assert_eq!(read_status, status);
|
||||
assert_eq!(read_capabilities, capabilities);
|
||||
@@ -489,7 +489,7 @@ mod tests {
|
||||
};
|
||||
|
||||
let (read_status, read_capabilities, read_flow)
|
||||
= parse_handshake(&Rlp::new(&interleaved)).unwrap();
|
||||
= parse_handshake(Rlp::new(&interleaved)).unwrap();
|
||||
|
||||
assert_eq!(read_status, status);
|
||||
assert_eq!(read_capabilities, capabilities);
|
||||
@@ -510,7 +510,7 @@ mod tests {
|
||||
};
|
||||
|
||||
let serialized = write_announcement(&announcement);
|
||||
let read = parse_announcement(&Rlp::new(&serialized)).unwrap();
|
||||
let read = parse_announcement(Rlp::new(&serialized)).unwrap();
|
||||
|
||||
assert_eq!(read, announcement);
|
||||
}
|
||||
@@ -522,26 +522,26 @@ mod tests {
|
||||
let mut stream = RlpStream::new_list(6);
|
||||
stream
|
||||
.append(&H256::zero())
|
||||
.append(&10_u64)
|
||||
.append(&100_000_u64)
|
||||
.append(&2_u64)
|
||||
.append_raw(&encode_pair(Key::ServeStateSince, &44_u64), 1)
|
||||
.append(&10u64)
|
||||
.append(&100_000u64)
|
||||
.append(&2u64)
|
||||
.append_raw(&encode_pair(Key::ServeStateSince, &44u64), 1)
|
||||
.append_raw(&encode_flag(Key::ServeHeaders), 1);
|
||||
|
||||
let out = stream.drain();
|
||||
assert!(parse_announcement(&Rlp::new(&out)).is_err());
|
||||
assert!(parse_announcement(Rlp::new(&out)).is_err());
|
||||
|
||||
let mut stream = RlpStream::new_list(6);
|
||||
stream
|
||||
.append(&H256::zero())
|
||||
.append(&10_u64)
|
||||
.append(&100_000_u64)
|
||||
.append(&2_u64)
|
||||
.append(&10u64)
|
||||
.append(&100_000u64)
|
||||
.append(&2u64)
|
||||
.append_raw(&encode_flag(Key::ServeHeaders), 1)
|
||||
.append_raw(&encode_pair(Key::ServeStateSince, &44_u64), 1);
|
||||
.append_raw(&encode_pair(Key::ServeStateSince, &44u64), 1);
|
||||
|
||||
let out = stream.drain();
|
||||
assert!(parse_announcement(&Rlp::new(&out)).is_ok());
|
||||
assert!(parse_announcement(Rlp::new(&out)).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -566,7 +566,7 @@ mod tests {
|
||||
let handshake = write_handshake(&status, &capabilities, None);
|
||||
|
||||
let (read_status, read_capabilities, read_flow)
|
||||
= parse_handshake(&Rlp::new(&handshake)).unwrap();
|
||||
= parse_handshake(Rlp::new(&handshake)).unwrap();
|
||||
|
||||
assert_eq!(read_status, status);
|
||||
assert_eq!(read_capabilities, capabilities);
|
||||
|
||||
@@ -87,10 +87,6 @@ impl IoContext for Expect {
|
||||
fn persistent_peer_id(&self, _peer: PeerId) -> Option<NodeId> {
|
||||
None
|
||||
}
|
||||
|
||||
fn is_reserved_peer(&self, peer: PeerId) -> bool {
|
||||
peer == 0xff
|
||||
}
|
||||
}
|
||||
|
||||
// can't implement directly for Arc due to cross-crate orphan rules.
|
||||
@@ -194,10 +190,6 @@ fn write_handshake(status: &Status, capabilities: &Capabilities, proto: &LightPr
|
||||
::net::status::write_handshake(status, capabilities, Some(&*flow_params))
|
||||
}
|
||||
|
||||
fn write_free_handshake(status: &Status, capabilities: &Capabilities, proto: &LightProtocol) -> Vec<u8> {
|
||||
::net::status::write_handshake(status, capabilities, Some(&proto.free_flow_params))
|
||||
}
|
||||
|
||||
// helper for setting up the protocol handler and provider.
|
||||
fn setup(capabilities: Capabilities) -> (Arc<TestProviderInner>, LightProtocol) {
|
||||
let provider = Arc::new(TestProviderInner {
|
||||
@@ -230,26 +222,13 @@ fn status(chain_info: BlockChainInfo) -> Status {
|
||||
fn handshake_expected() {
|
||||
let capabilities = capabilities();
|
||||
|
||||
let (provider, proto) = setup(capabilities);
|
||||
let (provider, proto) = setup(capabilities.clone());
|
||||
|
||||
let status = status(provider.client.chain_info());
|
||||
|
||||
let packet_body = write_handshake(&status, &capabilities, &proto);
|
||||
|
||||
proto.on_connect(1, &Expect::Send(1, packet::STATUS, packet_body));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reserved_handshake_expected() {
|
||||
let capabilities = capabilities();
|
||||
|
||||
let (provider, proto) = setup(capabilities);
|
||||
|
||||
let status = status(provider.client.chain_info());
|
||||
|
||||
let packet_body = write_free_handshake(&status, &capabilities, &proto);
|
||||
|
||||
proto.on_connect(0xff, &Expect::Send(0xff, packet::STATUS, packet_body));
|
||||
proto.on_connect(&1, &Expect::Send(1, packet::STATUS, packet_body));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -257,32 +236,32 @@ fn reserved_handshake_expected() {
|
||||
fn genesis_mismatch() {
|
||||
let capabilities = capabilities();
|
||||
|
||||
let (provider, proto) = setup(capabilities);
|
||||
let (provider, proto) = setup(capabilities.clone());
|
||||
|
||||
let mut status = status(provider.client.chain_info());
|
||||
status.genesis_hash = H256::default();
|
||||
|
||||
let packet_body = write_handshake(&status, &capabilities, &proto);
|
||||
|
||||
proto.on_connect(1, &Expect::Send(1, packet::STATUS, packet_body));
|
||||
proto.on_connect(&1, &Expect::Send(1, packet::STATUS, packet_body));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn credit_overflow() {
|
||||
let capabilities = capabilities();
|
||||
|
||||
let (provider, proto) = setup(capabilities);
|
||||
let (provider, proto) = setup(capabilities.clone());
|
||||
|
||||
let status = status(provider.client.chain_info());
|
||||
|
||||
{
|
||||
let packet_body = write_handshake(&status, &capabilities, &proto);
|
||||
proto.on_connect(1, &Expect::Send(1, packet::STATUS, packet_body));
|
||||
proto.on_connect(&1, &Expect::Send(1, packet::STATUS, packet_body));
|
||||
}
|
||||
|
||||
{
|
||||
let my_status = write_handshake(&status, &capabilities, &proto);
|
||||
proto.handle_packet(&Expect::Nothing, 1, packet::STATUS, &my_status);
|
||||
proto.handle_packet(&Expect::Nothing, &1, packet::STATUS, &my_status);
|
||||
}
|
||||
|
||||
// 1 billion requests is far too many for the default flow params.
|
||||
@@ -294,7 +273,7 @@ fn credit_overflow() {
|
||||
}));
|
||||
let request = make_packet(111, &requests);
|
||||
|
||||
proto.handle_packet(&Expect::Punish(1), 1, packet::REQUEST, &request);
|
||||
proto.handle_packet(&Expect::Punish(1), &1, packet::REQUEST, &request);
|
||||
}
|
||||
|
||||
// test the basic request types -- these just make sure that requests are parsed
|
||||
@@ -304,7 +283,7 @@ fn credit_overflow() {
|
||||
fn get_block_headers() {
|
||||
let capabilities = capabilities();
|
||||
|
||||
let (provider, proto) = setup(capabilities);
|
||||
let (provider, proto) = setup(capabilities.clone());
|
||||
let flow_params = proto.flow_params.read().clone();
|
||||
|
||||
let cur_status = status(provider.client.chain_info());
|
||||
@@ -316,8 +295,8 @@ fn get_block_headers() {
|
||||
|
||||
{
|
||||
let packet_body = write_handshake(&cur_status, &capabilities, &proto);
|
||||
proto.on_connect(1, &Expect::Send(1, packet::STATUS, packet_body));
|
||||
proto.handle_packet(&Expect::Nothing, 1, packet::STATUS, &my_status);
|
||||
proto.on_connect(&1, &Expect::Send(1, packet::STATUS, packet_body));
|
||||
proto.handle_packet(&Expect::Nothing, &1, packet::STATUS, &my_status);
|
||||
}
|
||||
|
||||
let request = Request::Headers(IncompleteHeadersRequest {
|
||||
@@ -338,7 +317,9 @@ fn get_block_headers() {
|
||||
|
||||
let new_creds = *flow_params.limit() - flow_params.compute_cost_multi(requests.requests()).unwrap();
|
||||
|
||||
let response = vec![Response::Headers(HeadersResponse { headers })];
|
||||
let response = vec![Response::Headers(HeadersResponse {
|
||||
headers: headers,
|
||||
})];
|
||||
|
||||
let mut stream = RlpStream::new_list(3);
|
||||
stream.append(&req_id).append(&new_creds).append_list(&response);
|
||||
@@ -347,14 +328,14 @@ fn get_block_headers() {
|
||||
};
|
||||
|
||||
let expected = Expect::Respond(packet::RESPONSE, response);
|
||||
proto.handle_packet(&expected, 1, packet::REQUEST, &request_body);
|
||||
proto.handle_packet(&expected, &1, packet::REQUEST, &request_body);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn get_block_bodies() {
|
||||
let capabilities = capabilities();
|
||||
|
||||
let (provider, proto) = setup(capabilities);
|
||||
let (provider, proto) = setup(capabilities.clone());
|
||||
let flow_params = proto.flow_params.read().clone();
|
||||
|
||||
let cur_status = status(provider.client.chain_info());
|
||||
@@ -366,8 +347,8 @@ fn get_block_bodies() {
|
||||
|
||||
{
|
||||
let packet_body = write_handshake(&cur_status, &capabilities, &proto);
|
||||
proto.on_connect(1, &Expect::Send(1, packet::STATUS, packet_body));
|
||||
proto.handle_packet(&Expect::Nothing, 1, packet::STATUS, &my_status);
|
||||
proto.on_connect(&1, &Expect::Send(1, packet::STATUS, packet_body));
|
||||
proto.handle_packet(&Expect::Nothing, &1, packet::STATUS, &my_status);
|
||||
}
|
||||
|
||||
let mut builder = Builder::default();
|
||||
@@ -395,14 +376,14 @@ fn get_block_bodies() {
|
||||
};
|
||||
|
||||
let expected = Expect::Respond(packet::RESPONSE, response);
|
||||
proto.handle_packet(&expected, 1, packet::REQUEST, &request_body);
|
||||
proto.handle_packet(&expected, &1, packet::REQUEST, &request_body);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn get_block_receipts() {
|
||||
let capabilities = capabilities();
|
||||
|
||||
let (provider, proto) = setup(capabilities);
|
||||
let (provider, proto) = setup(capabilities.clone());
|
||||
let flow_params = proto.flow_params.read().clone();
|
||||
|
||||
let cur_status = status(provider.client.chain_info());
|
||||
@@ -414,8 +395,8 @@ fn get_block_receipts() {
|
||||
|
||||
{
|
||||
let packet_body = write_handshake(&cur_status, &capabilities, &proto);
|
||||
proto.on_connect(1, &Expect::Send(1, packet::STATUS, packet_body));
|
||||
proto.handle_packet(&Expect::Nothing, 1, packet::STATUS, &my_status);
|
||||
proto.on_connect(&1, &Expect::Send(1, packet::STATUS, packet_body));
|
||||
proto.handle_packet(&Expect::Nothing, &1, packet::STATUS, &my_status);
|
||||
}
|
||||
|
||||
// find the first 10 block hashes starting with `f` because receipts are only provided
|
||||
@@ -450,14 +431,14 @@ fn get_block_receipts() {
|
||||
};
|
||||
|
||||
let expected = Expect::Respond(packet::RESPONSE, response);
|
||||
proto.handle_packet(&expected, 1, packet::REQUEST, &request_body);
|
||||
proto.handle_packet(&expected, &1, packet::REQUEST, &request_body);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn get_state_proofs() {
|
||||
let capabilities = capabilities();
|
||||
|
||||
let (provider, proto) = setup(capabilities);
|
||||
let (provider, proto) = setup(capabilities.clone());
|
||||
let flow_params = proto.flow_params.read().clone();
|
||||
|
||||
let provider = TestProvider(provider);
|
||||
@@ -466,8 +447,8 @@ fn get_state_proofs() {
|
||||
|
||||
{
|
||||
let packet_body = write_handshake(&cur_status, &capabilities, &proto);
|
||||
proto.on_connect(1, &Expect::Send(1, packet::STATUS, packet_body.clone()));
|
||||
proto.handle_packet(&Expect::Nothing, 1, packet::STATUS, &packet_body);
|
||||
proto.on_connect(&1, &Expect::Send(1, packet::STATUS, packet_body.clone()));
|
||||
proto.handle_packet(&Expect::Nothing, &1, packet::STATUS, &packet_body);
|
||||
}
|
||||
|
||||
let req_id = 112;
|
||||
@@ -509,22 +490,22 @@ fn get_state_proofs() {
|
||||
};
|
||||
|
||||
let expected = Expect::Respond(packet::RESPONSE, response);
|
||||
proto.handle_packet(&expected, 1, packet::REQUEST, &request_body);
|
||||
proto.handle_packet(&expected, &1, packet::REQUEST, &request_body);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn get_contract_code() {
|
||||
let capabilities = capabilities();
|
||||
|
||||
let (provider, proto) = setup(capabilities);
|
||||
let (provider, proto) = setup(capabilities.clone());
|
||||
let flow_params = proto.flow_params.read().clone();
|
||||
|
||||
let cur_status = status(provider.client.chain_info());
|
||||
|
||||
{
|
||||
let packet_body = write_handshake(&cur_status, &capabilities, &proto);
|
||||
proto.on_connect(1, &Expect::Send(1, packet::STATUS, packet_body.clone()));
|
||||
proto.handle_packet(&Expect::Nothing, 1, packet::STATUS, &packet_body);
|
||||
proto.on_connect(&1, &Expect::Send(1, packet::STATUS, packet_body.clone()));
|
||||
proto.handle_packet(&Expect::Nothing, &1, packet::STATUS, &packet_body);
|
||||
}
|
||||
|
||||
let req_id = 112;
|
||||
@@ -552,22 +533,22 @@ fn get_contract_code() {
|
||||
};
|
||||
|
||||
let expected = Expect::Respond(packet::RESPONSE, response);
|
||||
proto.handle_packet(&expected, 1, packet::REQUEST, &request_body);
|
||||
proto.handle_packet(&expected, &1, packet::REQUEST, &request_body);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn epoch_signal() {
|
||||
let capabilities = capabilities();
|
||||
|
||||
let (provider, proto) = setup(capabilities);
|
||||
let (provider, proto) = setup(capabilities.clone());
|
||||
let flow_params = proto.flow_params.read().clone();
|
||||
|
||||
let cur_status = status(provider.client.chain_info());
|
||||
|
||||
{
|
||||
let packet_body = write_handshake(&cur_status, &capabilities, &proto);
|
||||
proto.on_connect(1, &Expect::Send(1, packet::STATUS, packet_body.clone()));
|
||||
proto.handle_packet(&Expect::Nothing, 1, packet::STATUS, &packet_body);
|
||||
proto.on_connect(&1, &Expect::Send(1, packet::STATUS, packet_body.clone()));
|
||||
proto.handle_packet(&Expect::Nothing, &1, packet::STATUS, &packet_body);
|
||||
}
|
||||
|
||||
let req_id = 112;
|
||||
@@ -595,22 +576,22 @@ fn epoch_signal() {
|
||||
};
|
||||
|
||||
let expected = Expect::Respond(packet::RESPONSE, response);
|
||||
proto.handle_packet(&expected, 1, packet::REQUEST, &request_body);
|
||||
proto.handle_packet(&expected, &1, packet::REQUEST, &request_body);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn proof_of_execution() {
|
||||
let capabilities = capabilities();
|
||||
|
||||
let (provider, proto) = setup(capabilities);
|
||||
let (provider, proto) = setup(capabilities.clone());
|
||||
let flow_params = proto.flow_params.read().clone();
|
||||
|
||||
let cur_status = status(provider.client.chain_info());
|
||||
|
||||
{
|
||||
let packet_body = write_handshake(&cur_status, &capabilities, &proto);
|
||||
proto.on_connect(1, &Expect::Send(1, packet::STATUS, packet_body.clone()));
|
||||
proto.handle_packet(&Expect::Nothing, 1, packet::STATUS, &packet_body);
|
||||
proto.on_connect(&1, &Expect::Send(1, packet::STATUS, packet_body.clone()));
|
||||
proto.handle_packet(&Expect::Nothing, &1, packet::STATUS, &packet_body);
|
||||
}
|
||||
|
||||
let req_id = 112;
|
||||
@@ -641,7 +622,7 @@ fn proof_of_execution() {
|
||||
};
|
||||
|
||||
let expected = Expect::Respond(packet::RESPONSE, response);
|
||||
proto.handle_packet(&expected, 1, packet::REQUEST, &request_body);
|
||||
proto.handle_packet(&expected, &1, packet::REQUEST, &request_body);
|
||||
|
||||
// next: way too much requested gas.
|
||||
if let Request::Execution(ref mut req) = request {
|
||||
@@ -652,7 +633,7 @@ fn proof_of_execution() {
|
||||
let request_body = make_packet(req_id, &requests);
|
||||
|
||||
let expected = Expect::Punish(1);
|
||||
proto.handle_packet(&expected, 1, packet::REQUEST, &request_body);
|
||||
proto.handle_packet(&expected, &1, packet::REQUEST, &request_body);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -662,7 +643,7 @@ fn id_guard() {
|
||||
|
||||
let capabilities = capabilities();
|
||||
|
||||
let (provider, proto) = setup(capabilities);
|
||||
let (provider, proto) = setup(capabilities.clone());
|
||||
let flow_params = proto.flow_params.read().clone();
|
||||
|
||||
let req_id_1 = ReqId(5143);
|
||||
@@ -685,7 +666,7 @@ fn id_guard() {
|
||||
proto.peers.write().insert(peer_id, ::parking_lot::Mutex::new(Peer {
|
||||
local_credits: flow_params.create_credits(),
|
||||
status: status(provider.client.chain_info()),
|
||||
capabilities,
|
||||
capabilities: capabilities.clone(),
|
||||
remote_flow: Some((flow_params.create_credits(), (&*flow_params).clone())),
|
||||
sent_head: provider.client.chain_info().best_block_hash,
|
||||
last_update: Instant::now(),
|
||||
@@ -701,33 +682,33 @@ fn id_guard() {
|
||||
{
|
||||
let mut stream = RlpStream::new_list(3);
|
||||
stream.append(&req_id_1.0);
|
||||
stream.append(&4_000_000_usize);
|
||||
stream.begin_list(2).append(&125_usize).append(&3_usize);
|
||||
stream.append(&4_000_000usize);
|
||||
stream.begin_list(2).append(&125usize).append(&3usize);
|
||||
|
||||
let packet = stream.out();
|
||||
assert!(proto.response(peer_id, &Expect::Nothing, &Rlp::new(&packet)).is_err());
|
||||
assert!(proto.response(&peer_id, &Expect::Nothing, Rlp::new(&packet)).is_err());
|
||||
}
|
||||
|
||||
// next, do an unexpected response.
|
||||
{
|
||||
let mut stream = RlpStream::new_list(3);
|
||||
stream.append(&10000_usize);
|
||||
stream.append(&3_000_000_usize);
|
||||
stream.append(&10000usize);
|
||||
stream.append(&3_000_000usize);
|
||||
stream.begin_list(0);
|
||||
|
||||
let packet = stream.out();
|
||||
assert!(proto.response(peer_id, &Expect::Nothing, &Rlp::new(&packet)).is_err());
|
||||
assert!(proto.response(&peer_id, &Expect::Nothing, Rlp::new(&packet)).is_err());
|
||||
}
|
||||
|
||||
// lastly, do a valid (but empty) response.
|
||||
{
|
||||
let mut stream = RlpStream::new_list(3);
|
||||
stream.append(&req_id_2.0);
|
||||
stream.append(&3_000_000_usize);
|
||||
stream.append(&3_000_000usize);
|
||||
stream.begin_list(0);
|
||||
|
||||
let packet = stream.out();
|
||||
assert!(proto.response(peer_id, &Expect::Nothing, &Rlp::new(&packet)).is_ok());
|
||||
assert!(proto.response(&peer_id, &Expect::Nothing, Rlp::new(&packet)).is_ok());
|
||||
}
|
||||
|
||||
let peers = proto.peers.read();
|
||||
@@ -742,15 +723,15 @@ fn id_guard() {
|
||||
fn get_transaction_index() {
|
||||
let capabilities = capabilities();
|
||||
|
||||
let (provider, proto) = setup(capabilities);
|
||||
let (provider, proto) = setup(capabilities.clone());
|
||||
let flow_params = proto.flow_params.read().clone();
|
||||
|
||||
let cur_status = status(provider.client.chain_info());
|
||||
|
||||
{
|
||||
let packet_body = write_handshake(&cur_status, &capabilities, &proto);
|
||||
proto.on_connect(1, &Expect::Send(1, packet::STATUS, packet_body.clone()));
|
||||
proto.handle_packet(&Expect::Nothing, 1, packet::STATUS, &packet_body);
|
||||
proto.on_connect(&1, &Expect::Send(1, packet::STATUS, packet_body.clone()));
|
||||
proto.handle_packet(&Expect::Nothing, &1, packet::STATUS, &packet_body);
|
||||
}
|
||||
|
||||
let req_id = 112;
|
||||
@@ -778,5 +759,5 @@ fn get_transaction_index() {
|
||||
};
|
||||
|
||||
let expected = Expect::Respond(packet::RESPONSE, response);
|
||||
proto.handle_packet(&expected, 1, packet::REQUEST, &request_body);
|
||||
proto.handle_packet(&expected, &1, packet::REQUEST, &request_body);
|
||||
}
|
||||
|
||||
@@ -69,8 +69,8 @@ impl Peer {
|
||||
};
|
||||
|
||||
local_caps.serve_headers >= request.serve_headers &&
|
||||
can_serve_since(request.serve_chain_since, local_caps.serve_chain_since) &&
|
||||
can_serve_since(request.serve_state_since, local_caps.serve_state_since)
|
||||
can_serve_since(request.serve_chain_since, local_caps.serve_chain_since) &&
|
||||
can_serve_since(request.serve_state_since, local_caps.serve_state_since)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,16 +111,19 @@ impl Pending {
|
||||
// verification.
|
||||
// `idx` is the index of the request the response corresponds to.
|
||||
fn update_header_refs(&mut self, idx: usize, response: &Response) {
|
||||
if let Response::HeaderByHash(ref hdr) = *response {
|
||||
match *response {
|
||||
Response::HeaderByHash(ref hdr) => {
|
||||
// fill the header for all requests waiting on this one.
|
||||
// TODO: could be faster if we stored a map usize => Vec<usize>
|
||||
// but typical use just has one header request that others
|
||||
// depend on.
|
||||
for r in self.requests.iter_mut().skip(idx + 1) {
|
||||
if r.needs_header().map_or(false, |(i, _)| i == idx) {
|
||||
r.provide_header(hdr.clone())
|
||||
for r in self.requests.iter_mut().skip(idx + 1) {
|
||||
if r.needs_header().map_or(false, |(i, _)| i == idx) {
|
||||
r.provide_header(hdr.clone())
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {}, // no other responses produce headers.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,7 +265,7 @@ impl OnDemand {
|
||||
pending: RwLock::new(Vec::new()),
|
||||
peers: RwLock::new(HashMap::new()),
|
||||
in_transit: RwLock::new(HashMap::new()),
|
||||
cache,
|
||||
cache: cache,
|
||||
no_immediate_dispatch: false,
|
||||
}
|
||||
}
|
||||
@@ -309,7 +312,7 @@ impl OnDemand {
|
||||
}
|
||||
}
|
||||
if let CheckedRequest::HeaderByHash(ref req, _) = request {
|
||||
header_producers.insert(i, req.0);
|
||||
header_producers.insert(i, req.0.clone());
|
||||
}
|
||||
|
||||
builder.push(request)?;
|
||||
@@ -320,11 +323,11 @@ impl OnDemand {
|
||||
let capabilities = guess_capabilities(requests.requests());
|
||||
|
||||
self.submit_pending(ctx, Pending {
|
||||
requests,
|
||||
net_requests,
|
||||
requests: requests,
|
||||
net_requests: net_requests,
|
||||
required_capabilities: capabilities,
|
||||
responses,
|
||||
sender,
|
||||
responses: responses,
|
||||
sender: sender,
|
||||
});
|
||||
|
||||
Ok(receiver)
|
||||
@@ -417,7 +420,7 @@ impl Handler for OnDemand {
|
||||
) -> PeerStatus {
|
||||
self.peers.write().insert(
|
||||
ctx.peer(),
|
||||
Peer { status: status.clone(), capabilities: *capabilities }
|
||||
Peer { status: status.clone(), capabilities: capabilities.clone() }
|
||||
);
|
||||
self.attempt_dispatch(ctx.as_basic());
|
||||
PeerStatus::Kept
|
||||
|
||||
@@ -39,7 +39,7 @@ use transaction::SignedTransaction;
|
||||
use trie::Trie;
|
||||
use vm::EnvInfo;
|
||||
|
||||
const SUPPLIED_MATCHES: &str = "supplied responses always match produced requests; enforced by `check_response`; qed";
|
||||
const SUPPLIED_MATCHES: &'static str = "supplied responses always match produced requests; enforced by `check_response`; qed";
|
||||
|
||||
/// Core unit of the API: submit batches of these to be answered with `Response`s.
|
||||
#[derive(Clone)]
|
||||
@@ -224,7 +224,7 @@ impl HeaderRef {
|
||||
fn field(&self) -> Field<H256> {
|
||||
match *self {
|
||||
HeaderRef::Stored(ref hdr) => Field::Scalar(hdr.hash()),
|
||||
HeaderRef::Unresolved(_, field) => field,
|
||||
HeaderRef::Unresolved(_, ref field) => field.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ impl HeaderRef {
|
||||
fn needs_header(&self) -> Option<(usize, Field<H256>)> {
|
||||
match *self {
|
||||
HeaderRef::Stored(_) => None,
|
||||
HeaderRef::Unresolved(idx, field) => Some((idx, field)),
|
||||
HeaderRef::Unresolved(idx, ref field) => Some((idx, field.clone())),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -270,7 +270,6 @@ impl From<Request> for CheckedRequest {
|
||||
max: 1,
|
||||
reverse: false,
|
||||
};
|
||||
trace!(target: "on_demand", "HeaderByHash Request, {:?}", net_req);
|
||||
CheckedRequest::HeaderByHash(req, net_req)
|
||||
}
|
||||
Request::HeaderWithAncestors(req) => {
|
||||
@@ -287,28 +286,24 @@ impl From<Request> for CheckedRequest {
|
||||
let net_req = net_request::IncompleteHeaderProofRequest {
|
||||
num: req.num().into(),
|
||||
};
|
||||
trace!(target: "on_demand", "HeaderProof Request, {:?}", net_req);
|
||||
CheckedRequest::HeaderProof(req, net_req)
|
||||
}
|
||||
Request::TransactionIndex(req) => {
|
||||
let net_req = net_request::IncompleteTransactionIndexRequest {
|
||||
hash: req.0,
|
||||
hash: req.0.clone(),
|
||||
};
|
||||
trace!(target: "on_demand", "TransactionIndex Request, {:?}", net_req);
|
||||
CheckedRequest::TransactionIndex(req, net_req)
|
||||
}
|
||||
Request::Body(req) => {
|
||||
Request::Body(req) => {
|
||||
let net_req = net_request::IncompleteBodyRequest {
|
||||
hash: req.0.field(),
|
||||
};
|
||||
trace!(target: "on_demand", "Body Request, {:?}", net_req);
|
||||
CheckedRequest::Body(req, net_req)
|
||||
}
|
||||
Request::Receipts(req) => {
|
||||
let net_req = net_request::IncompleteReceiptsRequest {
|
||||
hash: req.0.field(),
|
||||
};
|
||||
trace!(target: "on_demand", "Receipt Request, {:?}", net_req);
|
||||
CheckedRequest::Receipts(req, net_req)
|
||||
}
|
||||
Request::Account(req) => {
|
||||
@@ -316,15 +311,13 @@ impl From<Request> for CheckedRequest {
|
||||
block_hash: req.header.field(),
|
||||
address_hash: ::hash::keccak(&req.address).into(),
|
||||
};
|
||||
trace!(target: "on_demand", "Account Request, {:?}", net_req);
|
||||
CheckedRequest::Account(req, net_req)
|
||||
}
|
||||
Request::Code(req) => {
|
||||
let net_req = net_request::IncompleteCodeRequest {
|
||||
block_hash: req.header.field(),
|
||||
code_hash: req.code_hash,
|
||||
code_hash: req.code_hash.into(),
|
||||
};
|
||||
trace!(target: "on_demand", "Code Request, {:?}", net_req);
|
||||
CheckedRequest::Code(req, net_req)
|
||||
}
|
||||
Request::Execution(req) => {
|
||||
@@ -337,14 +330,12 @@ impl From<Request> for CheckedRequest {
|
||||
value: req.tx.value,
|
||||
data: req.tx.data.clone(),
|
||||
};
|
||||
trace!(target: "on_demand", "Execution request, {:?}", net_req);
|
||||
CheckedRequest::Execution(req, net_req)
|
||||
}
|
||||
Request::Signal(req) => {
|
||||
let net_req = net_request::IncompleteSignalRequest {
|
||||
block_hash: req.hash.into(),
|
||||
};
|
||||
trace!(target: "on_demand", "Signal Request, {:?}", net_req);
|
||||
CheckedRequest::Signal(req, net_req)
|
||||
}
|
||||
}
|
||||
@@ -404,7 +395,7 @@ impl CheckedRequest {
|
||||
match *self {
|
||||
CheckedRequest::HeaderProof(ref check, _) => {
|
||||
let mut cache = cache.lock();
|
||||
cache.block_hash(check.num)
|
||||
cache.block_hash(&check.num)
|
||||
.and_then(|h| cache.chain_score(&h).map(|s| (h, s)))
|
||||
.map(|(h, s)| Response::HeaderProof((h, s)))
|
||||
}
|
||||
@@ -448,7 +439,7 @@ impl CheckedRequest {
|
||||
}
|
||||
CheckedRequest::Body(ref check, ref req) => {
|
||||
// check for empty body.
|
||||
if let Ok(hdr) = check.0.as_ref() {
|
||||
if let Some(hdr) = check.0.as_ref().ok() {
|
||||
if hdr.transactions_root() == KECCAK_NULL_RLP && hdr.uncles_hash() == KECCAK_EMPTY_LIST_RLP {
|
||||
let mut stream = RlpStream::new_list(3);
|
||||
stream.append_raw(hdr.rlp().as_raw(), 1);
|
||||
@@ -769,9 +760,9 @@ impl HeaderProof {
|
||||
/// Provide the expected CHT root to compare against.
|
||||
pub fn new(num: u64, cht_root: H256) -> Option<Self> {
|
||||
::cht::block_to_cht_number(num).map(|cht_num| HeaderProof {
|
||||
num,
|
||||
cht_num,
|
||||
cht_root,
|
||||
num: num,
|
||||
cht_num: cht_num,
|
||||
cht_root: cht_root,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -817,9 +808,9 @@ impl HeaderWithAncestors {
|
||||
headers: &[encoded::Header]
|
||||
) -> Result<Vec<encoded::Header>, Error> {
|
||||
let expected_hash = match (self.block_hash, start) {
|
||||
(Field::Scalar(h), &net_request::HashOrNumber::Hash(h2)) => {
|
||||
if h != h2 { return Err(Error::WrongHash(h, h2)) }
|
||||
h
|
||||
(Field::Scalar(ref h), &net_request::HashOrNumber::Hash(ref h2)) => {
|
||||
if h != h2 { return Err(Error::WrongHash(*h, *h2)) }
|
||||
*h
|
||||
}
|
||||
(_, &net_request::HashOrNumber::Hash(h2)) => h2,
|
||||
_ => return Err(Error::HeaderByNumber),
|
||||
@@ -871,9 +862,9 @@ impl HeaderByHash {
|
||||
headers: &[encoded::Header]
|
||||
) -> Result<encoded::Header, Error> {
|
||||
let expected_hash = match (self.0, start) {
|
||||
(Field::Scalar(h), &net_request::HashOrNumber::Hash(h2)) => {
|
||||
if h != h2 { return Err(Error::WrongHash(h, h2)) }
|
||||
h
|
||||
(Field::Scalar(ref h), &net_request::HashOrNumber::Hash(ref h2)) => {
|
||||
if h != h2 { return Err(Error::WrongHash(*h, *h2)) }
|
||||
*h
|
||||
}
|
||||
(_, &net_request::HashOrNumber::Hash(h2)) => h2,
|
||||
_ => return Err(Error::HeaderByNumber),
|
||||
@@ -881,11 +872,12 @@ impl HeaderByHash {
|
||||
|
||||
let header = headers.get(0).ok_or(Error::Empty)?;
|
||||
let hash = header.hash();
|
||||
if hash == expected_hash {
|
||||
cache.lock().insert_block_header(hash, header.clone());
|
||||
Ok(header.clone())
|
||||
} else {
|
||||
Err(Error::WrongHash(expected_hash, hash))
|
||||
match hash == expected_hash {
|
||||
true => {
|
||||
cache.lock().insert_block_header(hash, header.clone());
|
||||
Ok(header.clone())
|
||||
}
|
||||
false => Err(Error::WrongHash(expected_hash, hash)),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -928,13 +920,11 @@ impl Body {
|
||||
let header = self.0.as_ref()?;
|
||||
let tx_root = ::triehash::ordered_trie_root(body.transactions_rlp().iter().map(|r| r.as_raw()));
|
||||
if tx_root != header.transactions_root() {
|
||||
trace!(target: "on_demand", "Body Response: \"WrongTrieRoot\" tx_root: {:?} header_root: {:?}", tx_root, header.transactions_root());
|
||||
return Err(Error::WrongTrieRoot(header.transactions_root(), tx_root));
|
||||
}
|
||||
|
||||
let uncles_hash = keccak(body.uncles_rlp().as_raw());
|
||||
if uncles_hash != header.uncles_hash() {
|
||||
trace!(target: "on_demand", "Body Response: \"WrongHash\" tx_root: {:?} header_root: {:?}", uncles_hash, header.uncles_hash());
|
||||
return Err(Error::WrongHash(header.uncles_hash(), uncles_hash));
|
||||
}
|
||||
|
||||
@@ -942,6 +932,7 @@ impl Body {
|
||||
let block = encoded::Block::new_from_header_and_body(&header.view(), &body.view());
|
||||
|
||||
cache.lock().insert_block_body(header.hash(), body.clone());
|
||||
|
||||
Ok(block)
|
||||
}
|
||||
}
|
||||
@@ -956,12 +947,12 @@ impl BlockReceipts {
|
||||
let receipts_root = self.0.as_ref()?.receipts_root();
|
||||
let found_root = ::triehash::ordered_trie_root(receipts.iter().map(|r| ::rlp::encode(r)));
|
||||
|
||||
if receipts_root == found_root {
|
||||
cache.lock().insert_block_receipts(receipts_root, receipts.to_vec());
|
||||
Ok(receipts.to_vec())
|
||||
} else {
|
||||
trace!(target: "on_demand", "Receipt Reponse: \"WrongTrieRoot\" receipts_root: {:?} found_root: {:?}", receipts_root, found_root);
|
||||
Err(Error::WrongTrieRoot(receipts_root, found_root))
|
||||
match receipts_root == found_root {
|
||||
true => {
|
||||
cache.lock().insert_block_receipts(receipts_root, receipts.to_vec());
|
||||
Ok(receipts.to_vec())
|
||||
}
|
||||
false => Err(Error::WrongTrieRoot(receipts_root, found_root)),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -994,10 +985,7 @@ impl Account {
|
||||
code_hash: rlp.val_at(3)?,
|
||||
}))
|
||||
},
|
||||
None => {
|
||||
trace!(target: "on_demand", "Account {:?} not found", self.address);
|
||||
Ok(None)
|
||||
}
|
||||
None => Ok(None),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1048,7 +1036,7 @@ impl TransactionProof {
|
||||
let root = self.header.as_ref()?.state_root();
|
||||
|
||||
let mut env_info = self.env_info.clone();
|
||||
env_info.gas_limit = self.tx.gas;
|
||||
env_info.gas_limit = self.tx.gas.clone();
|
||||
|
||||
let proved_execution = state::check_proof(
|
||||
state_items,
|
||||
@@ -1059,18 +1047,9 @@ impl TransactionProof {
|
||||
);
|
||||
|
||||
match proved_execution {
|
||||
ProvedExecution::BadProof => {
|
||||
trace!(target: "on_demand", "BadExecution Proof");
|
||||
Err(Error::BadProof)
|
||||
}
|
||||
ProvedExecution::Failed(e) => {
|
||||
trace!(target: "on_demand", "Execution Proof failed: {:?}", e);
|
||||
Ok(Err(e))
|
||||
}
|
||||
ProvedExecution::Complete(e) => {
|
||||
trace!(target: "on_demand", "Execution successful: {:?}", e);
|
||||
Ok(Ok(e))
|
||||
}
|
||||
ProvedExecution::BadProof => Err(Error::BadProof),
|
||||
ProvedExecution::Failed(e) => Ok(Err(e)),
|
||||
ProvedExecution::Complete(e) => Ok(Ok(e)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,9 +87,9 @@ pub trait Provider: Send + Sync {
|
||||
|
||||
let max = ::std::cmp::min(MAX_HEADERS_PER_REQUEST, req.max);
|
||||
|
||||
let headers: Vec<_> = (0_u64..max)
|
||||
let headers: Vec<_> = (0u64..max)
|
||||
.map(|x: u64| x.saturating_mul(req.skip.saturating_add(1)))
|
||||
.take_while(|&x| if req.reverse { x < start_num } else { best_num.saturating_sub(start_num) >= x })
|
||||
.take_while(|x| if req.reverse { x < &start_num } else { best_num.saturating_sub(start_num) >= *x })
|
||||
.map(|x| if req.reverse { start_num.saturating_sub(x) } else { start_num.saturating_add(x) })
|
||||
.map(|x| self.block_header(BlockId::Number(x)))
|
||||
.take_while(|x| x.is_some())
|
||||
@@ -99,7 +99,7 @@ pub trait Provider: Send + Sync {
|
||||
if headers.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(::request::HeadersResponse { headers })
|
||||
Some(::request::HeadersResponse { headers: headers })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ impl<T: ProvingBlockChainClient + ?Sized> Provider for T {
|
||||
|
||||
fn block_body(&self, req: request::CompleteBodyRequest) -> Option<request::BodyResponse> {
|
||||
BlockChainClient::block_body(self, BlockId::Hash(req.hash))
|
||||
.map(|body| ::request::BodyResponse { body })
|
||||
.map(|body| ::request::BodyResponse { body: body })
|
||||
}
|
||||
|
||||
fn block_receipts(&self, req: request::CompleteReceiptsRequest) -> Option<request::ReceiptsResponse> {
|
||||
@@ -183,7 +183,7 @@ impl<T: ProvingBlockChainClient + ?Sized> Provider for T {
|
||||
fn account_proof(&self, req: request::CompleteAccountRequest) -> Option<request::AccountResponse> {
|
||||
self.prove_account(req.address_hash, BlockId::Hash(req.block_hash)).map(|(proof, acc)| {
|
||||
::request::AccountResponse {
|
||||
proof,
|
||||
proof: proof,
|
||||
nonce: acc.nonce,
|
||||
balance: acc.balance,
|
||||
code_hash: acc.code_hash,
|
||||
@@ -195,7 +195,7 @@ impl<T: ProvingBlockChainClient + ?Sized> Provider for T {
|
||||
fn storage_proof(&self, req: request::CompleteStorageRequest) -> Option<request::StorageResponse> {
|
||||
self.prove_storage(req.address_hash, req.key_hash, BlockId::Hash(req.block_hash)).map(|(proof, item) | {
|
||||
::request::StorageResponse {
|
||||
proof,
|
||||
proof: proof,
|
||||
value: item,
|
||||
}
|
||||
})
|
||||
@@ -203,7 +203,7 @@ impl<T: ProvingBlockChainClient + ?Sized> Provider for T {
|
||||
|
||||
fn contract_code(&self, req: request::CompleteCodeRequest) -> Option<request::CodeResponse> {
|
||||
self.state_data(&req.code_hash)
|
||||
.map(|code| ::request::CodeResponse { code })
|
||||
.map(|code| ::request::CodeResponse { code: code })
|
||||
}
|
||||
|
||||
fn header_proof(&self, req: request::CompleteHeaderProofRequest) -> Option<request::HeaderProofResponse> {
|
||||
@@ -252,7 +252,7 @@ impl<T: ProvingBlockChainClient + ?Sized> Provider for T {
|
||||
// prove our result.
|
||||
match cht.prove(req.num, 0) {
|
||||
Ok(Some(proof)) => Some(::request::HeaderProofResponse {
|
||||
proof,
|
||||
proof: proof,
|
||||
hash: needed_hdr.hash(),
|
||||
td: needed_td,
|
||||
}),
|
||||
@@ -268,12 +268,12 @@ impl<T: ProvingBlockChainClient + ?Sized> Provider for T {
|
||||
use transaction::Transaction;
|
||||
|
||||
let id = BlockId::Hash(req.block_hash);
|
||||
let nonce = match self.nonce(&req.from, id) {
|
||||
let nonce = match self.nonce(&req.from, id.clone()) {
|
||||
Some(nonce) => nonce,
|
||||
None => return None,
|
||||
};
|
||||
let transaction = Transaction {
|
||||
nonce,
|
||||
nonce: nonce,
|
||||
gas: req.gas,
|
||||
gas_price: req.gas_price,
|
||||
action: req.action,
|
||||
@@ -294,7 +294,7 @@ impl<T: ProvingBlockChainClient + ?Sized> Provider for T {
|
||||
|
||||
fn epoch_signal(&self, req: request::CompleteSignalRequest) -> Option<request::SignalResponse> {
|
||||
self.epoch_signal(req.block_hash).map(|signal| request::SignalResponse {
|
||||
signal,
|
||||
signal: signal,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -310,8 +310,8 @@ impl<L> LightProvider<L> {
|
||||
/// Create a new `LightProvider` from the given client and transaction queue.
|
||||
pub fn new(client: Arc<L>, txqueue: Arc<RwLock<TransactionQueue>>) -> Self {
|
||||
LightProvider {
|
||||
client,
|
||||
txqueue,
|
||||
client: client,
|
||||
txqueue: txqueue,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ use std::collections::hash_map::Entry;
|
||||
|
||||
use transaction::{self, Condition, PendingTransaction, SignedTransaction};
|
||||
use ethereum_types::{H256, U256, Address};
|
||||
use fastmap::H256FastMap;
|
||||
use plain_hasher::H256FastMap;
|
||||
|
||||
// Knowledge of an account's current nonce.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
@@ -74,7 +74,7 @@ impl<'a> From<&'a PendingTransaction> for TransactionInfo {
|
||||
fn from(tx: &'a PendingTransaction) -> Self {
|
||||
TransactionInfo {
|
||||
hash: tx.hash(),
|
||||
nonce: tx.nonce,
|
||||
nonce: tx.nonce.clone(),
|
||||
condition: tx.condition.clone(),
|
||||
}
|
||||
}
|
||||
@@ -95,7 +95,7 @@ impl AccountTransactions {
|
||||
}
|
||||
|
||||
fn next_nonce(&self) -> U256 {
|
||||
self.current.last().map(|last| last.nonce + 1)
|
||||
self.current.last().map(|last| last.nonce + 1.into())
|
||||
.unwrap_or_else(|| *self.cur_nonce.value())
|
||||
}
|
||||
|
||||
@@ -104,10 +104,16 @@ impl AccountTransactions {
|
||||
let mut promoted = Vec::new();
|
||||
let mut next_nonce = self.next_nonce();
|
||||
|
||||
while let Some(tx) = self.future.remove(&next_nonce) {
|
||||
promoted.push(tx.hash);
|
||||
self.current.push(tx);
|
||||
next_nonce = next_nonce + 1;
|
||||
loop {
|
||||
match self.future.remove(&next_nonce) {
|
||||
Some(tx) => {
|
||||
promoted.push(tx.hash);
|
||||
self.current.push(tx)
|
||||
},
|
||||
None => break,
|
||||
}
|
||||
|
||||
next_nonce = next_nonce + 1.into();
|
||||
}
|
||||
|
||||
promoted
|
||||
@@ -148,7 +154,7 @@ impl fmt::Debug for TransactionQueue {
|
||||
|
||||
impl TransactionQueue {
|
||||
/// Import a pending transaction to be queued.
|
||||
pub fn import(&mut self, tx: PendingTransaction) -> Result<ImportDestination, transaction::Error> {
|
||||
pub fn import(&mut self, tx: PendingTransaction) -> Result<ImportDestination, transaction::Error> {
|
||||
let sender = tx.sender();
|
||||
let hash = tx.hash();
|
||||
let nonce = tx.nonce;
|
||||
@@ -168,7 +174,7 @@ impl TransactionQueue {
|
||||
}
|
||||
Entry::Occupied(mut entry) => {
|
||||
let acct_txs = entry.get_mut();
|
||||
if nonce < *acct_txs.cur_nonce.value() {
|
||||
if &nonce < acct_txs.cur_nonce.value() {
|
||||
// don't accept txs from before known current nonce.
|
||||
if acct_txs.cur_nonce.is_known() {
|
||||
return Err(transaction::Error::Old)
|
||||
@@ -190,7 +196,7 @@ impl TransactionQueue {
|
||||
}
|
||||
Err(idx) => {
|
||||
let cur_len = acct_txs.current.len();
|
||||
let incr_nonce = nonce + 1;
|
||||
let incr_nonce = nonce + 1.into();
|
||||
|
||||
// current is sorted with one tx per nonce,
|
||||
// so if a tx with given nonce wasn't found that means it is either
|
||||
@@ -209,7 +215,7 @@ impl TransactionQueue {
|
||||
}
|
||||
|
||||
(ImportDestination::Current, vec![hash])
|
||||
} else if idx == cur_len && acct_txs.current.last().map_or(false, |f| f.nonce + 1 != nonce) {
|
||||
} else if idx == cur_len && acct_txs.current.last().map_or(false, |f| f.nonce + 1.into() != nonce) {
|
||||
trace!(target: "txqueue", "Queued future transaction for {}, nonce={}", sender, nonce);
|
||||
let future_nonce = nonce;
|
||||
acct_txs.future.insert(future_nonce, tx_info);
|
||||
@@ -529,7 +535,7 @@ mod tests {
|
||||
let tx_b: PendingTransaction = Transaction::default().fake_sign(sender).into();
|
||||
let tx_a: PendingTransaction = {
|
||||
let mut tx_a = Transaction::default();
|
||||
tx_a.gas_price = tx_b.gas_price + 1;
|
||||
tx_a.gas_price = tx_b.gas_price + 1.into();
|
||||
tx_a.fake_sign(sender).into()
|
||||
};
|
||||
|
||||
|
||||
@@ -349,7 +349,7 @@ impl Encodable for Request {
|
||||
fn rlp_append(&self, s: &mut RlpStream) {
|
||||
s.begin_list(2);
|
||||
|
||||
// hack around https://github.com/paritytech/parity-ethereum/issues/4356
|
||||
// hack around https://github.com/paritytech/parity/issues/4356
|
||||
Encodable::rlp_append(&self.kind(), s);
|
||||
|
||||
match *self {
|
||||
@@ -596,7 +596,7 @@ impl Encodable for Response {
|
||||
fn rlp_append(&self, s: &mut RlpStream) {
|
||||
s.begin_list(2);
|
||||
|
||||
// hack around https://github.com/paritytech/parity-ethereum/issues/4356
|
||||
// hack around https://github.com/paritytech/parity/issues/4356
|
||||
Encodable::rlp_append(&self.kind(), s);
|
||||
|
||||
match *self {
|
||||
@@ -764,7 +764,9 @@ pub mod header {
|
||||
headers.push(encoded::Header::new(item.as_raw().to_owned()));
|
||||
}
|
||||
|
||||
Ok(Response { headers })
|
||||
Ok(Response {
|
||||
headers: headers,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -812,7 +814,7 @@ pub mod header_proof {
|
||||
fn fill<F>(&mut self, oracle: F) where F: Fn(usize, usize) -> Result<Output, NoSuchOutput> {
|
||||
if let Field::BackReference(req, idx) = self.num {
|
||||
self.num = match oracle(req, idx) {
|
||||
Ok(Output::Number(num)) => Field::Scalar(num),
|
||||
Ok(Output::Number(num)) => Field::Scalar(num.into()),
|
||||
_ => Field::BackReference(req, idx),
|
||||
}
|
||||
}
|
||||
@@ -1051,7 +1053,7 @@ pub mod block_body {
|
||||
fn fill<F>(&mut self, oracle: F) where F: Fn(usize, usize) -> Result<Output, NoSuchOutput> {
|
||||
if let Field::BackReference(req, idx) = self.hash {
|
||||
self.hash = match oracle(req, idx) {
|
||||
Ok(Output::Hash(hash)) => Field::Scalar(hash),
|
||||
Ok(Output::Hash(hash)) => Field::Scalar(hash.into()),
|
||||
_ => Field::BackReference(req, idx),
|
||||
}
|
||||
}
|
||||
@@ -1150,14 +1152,14 @@ pub mod account {
|
||||
fn fill<F>(&mut self, oracle: F) where F: Fn(usize, usize) -> Result<Output, NoSuchOutput> {
|
||||
if let Field::BackReference(req, idx) = self.block_hash {
|
||||
self.block_hash = match oracle(req, idx) {
|
||||
Ok(Output::Hash(block_hash)) => Field::Scalar(block_hash),
|
||||
Ok(Output::Hash(block_hash)) => Field::Scalar(block_hash.into()),
|
||||
_ => Field::BackReference(req, idx),
|
||||
}
|
||||
}
|
||||
|
||||
if let Field::BackReference(req, idx) = self.address_hash {
|
||||
self.address_hash = match oracle(req, idx) {
|
||||
Ok(Output::Hash(address_hash)) => Field::Scalar(address_hash),
|
||||
Ok(Output::Hash(address_hash)) => Field::Scalar(address_hash.into()),
|
||||
_ => Field::BackReference(req, idx),
|
||||
}
|
||||
}
|
||||
@@ -1255,21 +1257,21 @@ pub mod storage {
|
||||
fn fill<F>(&mut self, oracle: F) where F: Fn(usize, usize) -> Result<Output, NoSuchOutput> {
|
||||
if let Field::BackReference(req, idx) = self.block_hash {
|
||||
self.block_hash = match oracle(req, idx) {
|
||||
Ok(Output::Hash(block_hash)) => Field::Scalar(block_hash),
|
||||
Ok(Output::Hash(block_hash)) => Field::Scalar(block_hash.into()),
|
||||
_ => Field::BackReference(req, idx),
|
||||
}
|
||||
}
|
||||
|
||||
if let Field::BackReference(req, idx) = self.address_hash {
|
||||
self.address_hash = match oracle(req, idx) {
|
||||
Ok(Output::Hash(address_hash)) => Field::Scalar(address_hash),
|
||||
Ok(Output::Hash(address_hash)) => Field::Scalar(address_hash.into()),
|
||||
_ => Field::BackReference(req, idx),
|
||||
}
|
||||
}
|
||||
|
||||
if let Field::BackReference(req, idx) = self.key_hash {
|
||||
self.key_hash = match oracle(req, idx) {
|
||||
Ok(Output::Hash(key_hash)) => Field::Scalar(key_hash),
|
||||
Ok(Output::Hash(key_hash)) => Field::Scalar(key_hash.into()),
|
||||
_ => Field::BackReference(req, idx),
|
||||
}
|
||||
}
|
||||
@@ -1355,14 +1357,14 @@ pub mod contract_code {
|
||||
fn fill<F>(&mut self, oracle: F) where F: Fn(usize, usize) -> Result<Output, NoSuchOutput> {
|
||||
if let Field::BackReference(req, idx) = self.block_hash {
|
||||
self.block_hash = match oracle(req, idx) {
|
||||
Ok(Output::Hash(block_hash)) => Field::Scalar(block_hash),
|
||||
Ok(Output::Hash(block_hash)) => Field::Scalar(block_hash.into()),
|
||||
_ => Field::BackReference(req, idx),
|
||||
}
|
||||
}
|
||||
|
||||
if let Field::BackReference(req, idx) = self.code_hash {
|
||||
self.code_hash = match oracle(req, idx) {
|
||||
Ok(Output::Hash(code_hash)) => Field::Scalar(code_hash),
|
||||
Ok(Output::Hash(code_hash)) => Field::Scalar(code_hash.into()),
|
||||
_ => Field::BackReference(req, idx),
|
||||
}
|
||||
}
|
||||
@@ -1450,7 +1452,7 @@ pub mod execution {
|
||||
fn fill<F>(&mut self, oracle: F) where F: Fn(usize, usize) -> Result<Output, NoSuchOutput> {
|
||||
if let Field::BackReference(req, idx) = self.block_hash {
|
||||
self.block_hash = match oracle(req, idx) {
|
||||
Ok(Output::Hash(block_hash)) => Field::Scalar(block_hash),
|
||||
Ok(Output::Hash(block_hash)) => Field::Scalar(block_hash.into()),
|
||||
_ => Field::BackReference(req, idx),
|
||||
}
|
||||
}
|
||||
@@ -1512,7 +1514,9 @@ pub mod execution {
|
||||
items.push(item);
|
||||
}
|
||||
|
||||
Ok(Response { items })
|
||||
Ok(Response {
|
||||
items: items,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1574,7 +1578,7 @@ pub mod epoch_signal {
|
||||
fn fill<F>(&mut self, oracle: F) where F: Fn(usize, usize) -> Result<Output, NoSuchOutput> {
|
||||
if let Field::BackReference(req, idx) = self.block_hash {
|
||||
self.block_hash = match oracle(req, idx) {
|
||||
Ok(Output::Hash(block_hash)) => Field::Scalar(block_hash),
|
||||
Ok(Output::Hash(block_hash)) => Field::Scalar(block_hash.into()),
|
||||
_ => Field::BackReference(req, idx),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,16 +10,16 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
||||
ethcore = { path = ".."}
|
||||
ethcore-network = { path = "../../util/network" }
|
||||
ethcore-network-devp2p = { path = "../../util/network-devp2p" }
|
||||
ethereum-types = "0.4"
|
||||
log = "0.4"
|
||||
ethereum-types = "0.3"
|
||||
log = "0.3"
|
||||
parking_lot = "0.6"
|
||||
ethabi = "5.1.2"
|
||||
ethabi-derive = "5.1.3"
|
||||
ethabi-contract = "5.1.1"
|
||||
ethabi = "5.1"
|
||||
ethabi-derive = "5.0"
|
||||
ethabi-contract = "5.0"
|
||||
lru-cache = "0.1"
|
||||
|
||||
[dev-dependencies]
|
||||
ethcore = { path = "..", features = ["test-helpers"] }
|
||||
kvdb-memorydb = "0.1"
|
||||
kvdb-memorydb = { git = "https://github.com/paritytech/parity-common" }
|
||||
ethcore-io = { path = "../../util/io" }
|
||||
tempdir = "0.3"
|
||||
|
||||
@@ -7,36 +7,34 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
||||
|
||||
[dependencies]
|
||||
error-chain = { version = "0.12", default-features = false }
|
||||
ethabi = "5.1.2"
|
||||
ethabi-derive = "5.1.3"
|
||||
ethabi-contract = "5.1.1"
|
||||
ethabi = "5.1"
|
||||
ethabi-contract = "5.0"
|
||||
ethabi-derive = "5.0"
|
||||
ethcore = { path = ".." }
|
||||
parity-bytes = "0.1"
|
||||
parity-crypto = "0.1"
|
||||
parity-bytes = { git = "https://github.com/paritytech/parity-common" }
|
||||
parity-crypto = { git = "https://github.com/paritytech/parity-common" }
|
||||
ethcore-io = { path = "../../util/io" }
|
||||
ethcore-logger = { path = "../../logger" }
|
||||
ethcore-miner = { path = "../../miner" }
|
||||
ethcore-transaction = { path = "../transaction" }
|
||||
ethereum-types = "0.4"
|
||||
ethereum-types = "0.3"
|
||||
ethjson = { path = "../../json" }
|
||||
ethkey = { path = "../../ethkey" }
|
||||
fetch = { path = "../../util/fetch" }
|
||||
futures = "0.1"
|
||||
heapsize = "0.4"
|
||||
keccak-hash = "0.1.2"
|
||||
log = "0.4"
|
||||
keccak-hash = { git = "https://github.com/paritytech/parity-common" }
|
||||
log = "0.3"
|
||||
parking_lot = "0.6"
|
||||
patricia-trie = "0.2"
|
||||
patricia-trie = { git = "https://github.com/paritytech/parity-common" }
|
||||
patricia-trie-ethereum = { path = "../../util/patricia-trie-ethereum" }
|
||||
rand = "0.3"
|
||||
rlp = { version = "0.2.4", features = ["ethereum"] }
|
||||
rlp = { git = "https://github.com/paritytech/parity-common" }
|
||||
rlp_derive = { path = "../../util/rlp_derive" }
|
||||
rustc-hex = "1.0"
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
serde_json = "1.0"
|
||||
tiny-keccak = "1.4"
|
||||
transaction-pool = "1.13.2"
|
||||
url = "1"
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
@@ -208,7 +208,7 @@ impl Encryptor for SecretStoreEncryptor {
|
||||
let key = match self.retrieve_key("", false, contract_address, &*accounts) {
|
||||
Ok(key) => Ok(key),
|
||||
Err(Error(ErrorKind::EncryptionKeyNotFound(_), _)) => {
|
||||
trace!(target: "privatetx", "Key for account wasnt found in sstore. Creating. Address: {:?}", contract_address);
|
||||
trace!("Key for account wasnt found in sstore. Creating. Address: {:?}", contract_address);
|
||||
self.retrieve_key(&format!("/{}", self.config.threshold), true, contract_address, &*accounts)
|
||||
}
|
||||
Err(err) => Err(err),
|
||||
|
||||
@@ -21,14 +21,12 @@ use ethcore::account_provider::SignError;
|
||||
use ethcore::error::{Error as EthcoreError, ExecutionError};
|
||||
use transaction::Error as TransactionError;
|
||||
use ethkey::Error as KeyError;
|
||||
use txpool::Error as TxPoolError;
|
||||
|
||||
error_chain! {
|
||||
foreign_links {
|
||||
Io(::std::io::Error) #[doc = "Error concerning the Rust standard library's IO subsystem."];
|
||||
Decoder(DecoderError) #[doc = "RLP decoding error."];
|
||||
Trie(TrieError) #[doc = "Error concerning TrieDBs."];
|
||||
Txpool(TxPoolError) #[doc = "Tx pool error."];
|
||||
}
|
||||
|
||||
errors {
|
||||
|
||||
@@ -37,11 +37,9 @@ extern crate ethkey;
|
||||
extern crate ethjson;
|
||||
extern crate fetch;
|
||||
extern crate futures;
|
||||
extern crate heapsize;
|
||||
extern crate keccak_hash as hash;
|
||||
extern crate parking_lot;
|
||||
extern crate patricia_trie as trie;
|
||||
extern crate transaction_pool as txpool;
|
||||
extern crate patricia_trie_ethereum as ethtrie;
|
||||
extern crate rlp;
|
||||
extern crate url;
|
||||
@@ -63,7 +61,7 @@ extern crate rand;
|
||||
extern crate ethcore_logger;
|
||||
|
||||
pub use encryptor::{Encryptor, SecretStoreEncryptor, EncryptorConfig, NoopEncryptor};
|
||||
pub use private_transactions::{VerifiedPrivateTransaction, VerificationStore, PrivateTransactionSigningDesc, SigningStore};
|
||||
pub use private_transactions::{PrivateTransactionDesc, VerificationStore, PrivateTransactionSigningDesc, SigningStore};
|
||||
pub use messages::{PrivateTransaction, SignedPrivateTransaction};
|
||||
pub use error::{Error, ErrorKind};
|
||||
|
||||
@@ -73,7 +71,7 @@ use std::time::Duration;
|
||||
use ethereum_types::{H128, H256, U256, Address};
|
||||
use hash::keccak;
|
||||
use rlp::*;
|
||||
use parking_lot::RwLock;
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
use bytes::Bytes;
|
||||
use ethkey::{Signature, recover, public_to_address};
|
||||
use io::IoChannel;
|
||||
@@ -130,8 +128,9 @@ pub struct Provider {
|
||||
signer_account: Option<Address>,
|
||||
passwords: Vec<Password>,
|
||||
notify: RwLock<Vec<Weak<ChainNotify>>>,
|
||||
transactions_for_signing: RwLock<SigningStore>,
|
||||
transactions_for_verification: VerificationStore,
|
||||
transactions_for_signing: Mutex<SigningStore>,
|
||||
// TODO [ToDr] Move the Mutex/RwLock inside `VerificationStore` after refactored to `drain`.
|
||||
transactions_for_verification: Mutex<VerificationStore>,
|
||||
client: Arc<Client>,
|
||||
miner: Arc<Miner>,
|
||||
accounts: Arc<AccountProvider>,
|
||||
@@ -162,8 +161,8 @@ impl Provider where {
|
||||
signer_account: config.signer_account,
|
||||
passwords: config.passwords,
|
||||
notify: RwLock::default(),
|
||||
transactions_for_signing: RwLock::default(),
|
||||
transactions_for_verification: VerificationStore::default(),
|
||||
transactions_for_signing: Mutex::default(),
|
||||
transactions_for_verification: Mutex::default(),
|
||||
client,
|
||||
miner,
|
||||
accounts,
|
||||
@@ -191,9 +190,9 @@ impl Provider where {
|
||||
/// 3. Save it with state returned on prev step to the queue for signing
|
||||
/// 4. Broadcast corresponding message to the chain
|
||||
pub fn create_private_transaction(&self, signed_transaction: SignedTransaction) -> Result<Receipt, Error> {
|
||||
trace!(target: "privatetx", "Creating private transaction from regular transaction: {:?}", signed_transaction);
|
||||
trace!("Creating private transaction from regular transaction: {:?}", signed_transaction);
|
||||
if self.signer_account.is_none() {
|
||||
warn!(target: "privatetx", "Signing account not set");
|
||||
trace!("Signing account not set");
|
||||
bail!(ErrorKind::SignerAccountNotSet);
|
||||
}
|
||||
let tx_hash = signed_transaction.hash();
|
||||
@@ -204,7 +203,10 @@ impl Provider where {
|
||||
Action::Call(contract) => {
|
||||
let data = signed_transaction.rlp_bytes();
|
||||
let encrypted_transaction = self.encrypt(&contract, &Self::iv_from_transaction(&signed_transaction), &data)?;
|
||||
let private = PrivateTransaction::new(encrypted_transaction, contract);
|
||||
let private = PrivateTransaction {
|
||||
encrypted: encrypted_transaction,
|
||||
contract,
|
||||
};
|
||||
// TODO [ToDr] Using BlockId::Latest is bad here,
|
||||
// the block may change in the middle of execution
|
||||
// causing really weird stuff to happen.
|
||||
@@ -213,16 +215,16 @@ impl Provider where {
|
||||
// in private-tx to avoid such mistakes.
|
||||
let contract_nonce = self.get_contract_nonce(&contract, BlockId::Latest)?;
|
||||
let private_state = self.execute_private_transaction(BlockId::Latest, &signed_transaction)?;
|
||||
trace!(target: "privatetx", "Private transaction created, encrypted transaction: {:?}, private state: {:?}", private, private_state);
|
||||
trace!("Private transaction created, encrypted transaction: {:?}, private state: {:?}", private, private_state);
|
||||
let contract_validators = self.get_validators(BlockId::Latest, &contract)?;
|
||||
trace!(target: "privatetx", "Required validators: {:?}", contract_validators);
|
||||
trace!("Required validators: {:?}", contract_validators);
|
||||
let private_state_hash = self.calculate_state_hash(&private_state, contract_nonce);
|
||||
trace!(target: "privatetx", "Hashed effective private state for sender: {:?}", private_state_hash);
|
||||
self.transactions_for_signing.write().add_transaction(private.hash(), signed_transaction, contract_validators, private_state, contract_nonce)?;
|
||||
self.broadcast_private_transaction(private.hash(), private.rlp_bytes().into_vec());
|
||||
trace!("Hashed effective private state for sender: {:?}", private_state_hash);
|
||||
self.transactions_for_signing.lock().add_transaction(private.hash(), signed_transaction, contract_validators, private_state, contract_nonce)?;
|
||||
self.broadcast_private_transaction(private.rlp_bytes().into_vec());
|
||||
Ok(Receipt {
|
||||
hash: tx_hash,
|
||||
contract_address: Some(contract),
|
||||
contract_address: None,
|
||||
status_code: 0,
|
||||
})
|
||||
}
|
||||
@@ -238,6 +240,14 @@ impl Provider where {
|
||||
keccak(&state_buf.as_ref())
|
||||
}
|
||||
|
||||
/// Extract signed transaction from private transaction
|
||||
fn extract_original_transaction(&self, private: PrivateTransaction, contract: &Address) -> Result<UnverifiedTransaction, Error> {
|
||||
let encrypted_transaction = private.encrypted;
|
||||
let transaction_bytes = self.decrypt(contract, &encrypted_transaction)?;
|
||||
let original_transaction: UnverifiedTransaction = Rlp::new(&transaction_bytes).as_val()?;
|
||||
Ok(original_transaction)
|
||||
}
|
||||
|
||||
fn pool_client<'a>(&'a self, nonce_cache: &'a NonceCache) -> miner::pool_client::PoolClient<'a, Client> {
|
||||
let engine = self.client.engine();
|
||||
let refuse_service_transactions = true;
|
||||
@@ -251,122 +261,48 @@ impl Provider where {
|
||||
}
|
||||
|
||||
/// Retrieve and verify the first available private transaction for every sender
|
||||
fn process_verification_queue(&self) -> Result<(), Error> {
|
||||
///
|
||||
/// TODO [ToDr] It seems that:
|
||||
/// The 3 methods `ready_transaction,get_descriptor,remove` are always used in conjuction so most likely
|
||||
/// can be replaced with a single `drain()` method instead.
|
||||
/// Thanks to this we also don't really need to lock the entire verification for the time of execution.
|
||||
fn process_queue(&self) -> Result<(), Error> {
|
||||
let nonce_cache = NonceCache::new(NONCE_CACHE_SIZE);
|
||||
let process_transaction = |transaction: &VerifiedPrivateTransaction| -> Result<_, String> {
|
||||
let private_hash = transaction.private_transaction.hash();
|
||||
match transaction.validator_account {
|
||||
None => {
|
||||
trace!(target: "privatetx", "Propagating transaction further");
|
||||
self.broadcast_private_transaction(private_hash, transaction.private_transaction.rlp_bytes().into_vec());
|
||||
return Ok(());
|
||||
}
|
||||
Some(validator_account) => {
|
||||
if !self.validator_accounts.contains(&validator_account) {
|
||||
trace!(target: "privatetx", "Propagating transaction further");
|
||||
self.broadcast_private_transaction(private_hash, transaction.private_transaction.rlp_bytes().into_vec());
|
||||
return Ok(());
|
||||
}
|
||||
let tx_action = transaction.transaction.action.clone();
|
||||
if let Action::Call(contract) = tx_action {
|
||||
// TODO [ToDr] Usage of BlockId::Latest
|
||||
let contract_nonce = self.get_contract_nonce(&contract, BlockId::Latest);
|
||||
if let Err(e) = contract_nonce {
|
||||
bail!("Cannot retrieve contract nonce: {:?}", e);
|
||||
}
|
||||
let contract_nonce = contract_nonce.expect("Error was checked before");
|
||||
let private_state = self.execute_private_transaction(BlockId::Latest, &transaction.transaction);
|
||||
if let Err(e) = private_state {
|
||||
bail!("Cannot retrieve private state: {:?}", e);
|
||||
}
|
||||
let private_state = private_state.expect("Error was checked before");
|
||||
let private_state_hash = self.calculate_state_hash(&private_state, contract_nonce);
|
||||
trace!(target: "privatetx", "Hashed effective private state for validator: {:?}", private_state_hash);
|
||||
let password = find_account_password(&self.passwords, &*self.accounts, &validator_account);
|
||||
let signed_state = self.accounts.sign(validator_account, password, private_state_hash);
|
||||
if let Err(e) = signed_state {
|
||||
bail!("Cannot sign the state: {:?}", e);
|
||||
}
|
||||
let signed_state = signed_state.expect("Error was checked before");
|
||||
let signed_private_transaction = SignedPrivateTransaction::new(private_hash, signed_state, None);
|
||||
trace!(target: "privatetx", "Sending signature for private transaction: {:?}", signed_private_transaction);
|
||||
self.broadcast_signed_private_transaction(signed_private_transaction.hash(), signed_private_transaction.rlp_bytes().into_vec());
|
||||
} else {
|
||||
bail!("Incorrect type of action for the transaction");
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
};
|
||||
let ready_transactions = self.transactions_for_verification.drain(self.pool_client(&nonce_cache));
|
||||
let mut verification_queue = self.transactions_for_verification.lock();
|
||||
let ready_transactions = verification_queue.ready_transactions(self.pool_client(&nonce_cache));
|
||||
for transaction in ready_transactions {
|
||||
if let Err(e) = process_transaction(&transaction) {
|
||||
warn!(target: "privatetx", "Error: {:?}", e);
|
||||
let transaction_hash = transaction.signed().hash();
|
||||
match verification_queue.private_transaction_descriptor(&transaction_hash) {
|
||||
Ok(desc) => {
|
||||
if !self.validator_accounts.contains(&desc.validator_account) {
|
||||
trace!("Cannot find validator account in config");
|
||||
bail!(ErrorKind::ValidatorAccountNotSet);
|
||||
}
|
||||
let account = desc.validator_account;
|
||||
if let Action::Call(contract) = transaction.signed().action {
|
||||
// TODO [ToDr] Usage of BlockId::Latest
|
||||
let contract_nonce = self.get_contract_nonce(&contract, BlockId::Latest)?;
|
||||
let private_state = self.execute_private_transaction(BlockId::Latest, transaction.signed())?;
|
||||
let private_state_hash = self.calculate_state_hash(&private_state, contract_nonce);
|
||||
trace!("Hashed effective private state for validator: {:?}", private_state_hash);
|
||||
let password = find_account_password(&self.passwords, &*self.accounts, &account);
|
||||
let signed_state = self.accounts.sign(account, password, private_state_hash)?;
|
||||
let signed_private_transaction = SignedPrivateTransaction::new(desc.private_hash, signed_state, None);
|
||||
trace!("Sending signature for private transaction: {:?}", signed_private_transaction);
|
||||
self.broadcast_signed_private_transaction(signed_private_transaction.rlp_bytes().into_vec());
|
||||
} else {
|
||||
warn!("Incorrect type of action for the transaction");
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
warn!("Cannot retrieve descriptor for transaction with error {:?}", e);
|
||||
}
|
||||
}
|
||||
verification_queue.remove_private_transaction(&transaction_hash);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Add signed private transaction into the store
|
||||
/// Creates corresponding public transaction if last required signature collected and sends it to the chain
|
||||
pub fn process_signature(&self, signed_tx: &SignedPrivateTransaction) -> Result<(), Error> {
|
||||
trace!(target: "privatetx", "Processing signed private transaction");
|
||||
let private_hash = signed_tx.private_transaction_hash();
|
||||
let desc = match self.transactions_for_signing.read().get(&private_hash) {
|
||||
None => {
|
||||
// Not our transaction, broadcast further to peers
|
||||
self.broadcast_signed_private_transaction(signed_tx.hash(), signed_tx.rlp_bytes().into_vec());
|
||||
return Ok(());
|
||||
},
|
||||
Some(desc) => desc,
|
||||
};
|
||||
let last = self.last_required_signature(&desc, signed_tx.signature())?;
|
||||
|
||||
if last {
|
||||
let mut signatures = desc.received_signatures.clone();
|
||||
signatures.push(signed_tx.signature());
|
||||
let rsv: Vec<Signature> = signatures.into_iter().map(|sign| sign.into_electrum().into()).collect();
|
||||
//Create public transaction
|
||||
let public_tx = self.public_transaction(
|
||||
desc.state.clone(),
|
||||
&desc.original_transaction,
|
||||
&rsv,
|
||||
desc.original_transaction.nonce,
|
||||
desc.original_transaction.gas_price
|
||||
)?;
|
||||
trace!(target: "privatetx", "Last required signature received, public transaction created: {:?}", public_tx);
|
||||
//Sign and add it to the queue
|
||||
let chain_id = desc.original_transaction.chain_id();
|
||||
let hash = public_tx.hash(chain_id);
|
||||
let signer_account = self.signer_account.ok_or_else(|| ErrorKind::SignerAccountNotSet)?;
|
||||
let password = find_account_password(&self.passwords, &*self.accounts, &signer_account);
|
||||
let signature = self.accounts.sign(signer_account, password, hash)?;
|
||||
let signed = SignedTransaction::new(public_tx.with_signature(signature, chain_id))?;
|
||||
match self.miner.import_own_transaction(&*self.client, signed.into()) {
|
||||
Ok(_) => trace!(target: "privatetx", "Public transaction added to queue"),
|
||||
Err(err) => {
|
||||
warn!(target: "privatetx", "Failed to add transaction to queue, error: {:?}", err);
|
||||
bail!(err);
|
||||
}
|
||||
}
|
||||
//Remove from store for signing
|
||||
if let Err(err) = self.transactions_for_signing.write().remove(&private_hash) {
|
||||
warn!(target: "privatetx", "Failed to remove transaction from signing store, error: {:?}", err);
|
||||
bail!(err);
|
||||
}
|
||||
} else {
|
||||
//Add signature to the store
|
||||
match self.transactions_for_signing.write().add_signature(&private_hash, signed_tx.signature()) {
|
||||
Ok(_) => trace!(target: "privatetx", "Signature stored for private transaction"),
|
||||
Err(err) => {
|
||||
warn!(target: "privatetx", "Failed to add signature to signing store, error: {:?}", err);
|
||||
bail!(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn last_required_signature(&self, desc: &PrivateTransactionSigningDesc, sign: Signature) -> Result<bool, Error> {
|
||||
if desc.received_signatures.contains(&sign) {
|
||||
return Ok(false);
|
||||
@@ -380,26 +316,26 @@ impl Provider where {
|
||||
Ok(desc.received_signatures.len() + 1 == desc.validators.len())
|
||||
}
|
||||
false => {
|
||||
warn!(target: "privatetx", "Sender's state doesn't correspond to validator's");
|
||||
trace!("Sender's state doesn't correspond to validator's");
|
||||
bail!(ErrorKind::StateIncorrect);
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
warn!(target: "privatetx", "Sender's state doesn't correspond to validator's, error {:?}", err);
|
||||
trace!("Sender's state doesn't correspond to validator's, error {:?}", err);
|
||||
bail!(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Broadcast the private transaction message to the chain
|
||||
fn broadcast_private_transaction(&self, transaction_hash: H256, message: Bytes) {
|
||||
self.notify(|notify| notify.broadcast(ChainMessageType::PrivateTransaction(transaction_hash, message.clone())));
|
||||
fn broadcast_private_transaction(&self, message: Bytes) {
|
||||
self.notify(|notify| notify.broadcast(ChainMessageType::PrivateTransaction(message.clone())));
|
||||
}
|
||||
|
||||
/// Broadcast signed private transaction message to the chain
|
||||
fn broadcast_signed_private_transaction(&self, transaction_hash: H256, message: Bytes) {
|
||||
self.notify(|notify| notify.broadcast(ChainMessageType::SignedPrivateTransaction(transaction_hash, message.clone())));
|
||||
fn broadcast_signed_private_transaction(&self, message: Bytes) {
|
||||
self.notify(|notify| notify.broadcast(ChainMessageType::SignedPrivateTransaction(message.clone())));
|
||||
}
|
||||
|
||||
fn iv_from_transaction(transaction: &SignedTransaction) -> H128 {
|
||||
@@ -415,12 +351,12 @@ impl Provider where {
|
||||
}
|
||||
|
||||
fn encrypt(&self, contract_address: &Address, initialisation_vector: &H128, data: &[u8]) -> Result<Bytes, Error> {
|
||||
trace!(target: "privatetx", "Encrypt data using key(address): {:?}", contract_address);
|
||||
trace!("Encrypt data using key(address): {:?}", contract_address);
|
||||
Ok(self.encryptor.encrypt(contract_address, &*self.accounts, initialisation_vector, data)?)
|
||||
}
|
||||
|
||||
fn decrypt(&self, contract_address: &Address, data: &[u8]) -> Result<Bytes, Error> {
|
||||
trace!(target: "privatetx", "Decrypt data using key(address): {:?}", contract_address);
|
||||
trace!("Decrypt data using key(address): {:?}", contract_address);
|
||||
Ok(self.encryptor.decrypt(contract_address, &*self.accounts, data)?)
|
||||
}
|
||||
|
||||
@@ -485,7 +421,7 @@ impl Provider where {
|
||||
Action::Call(ref contract_address) => {
|
||||
let contract_code = Arc::new(self.get_decrypted_code(contract_address, block)?);
|
||||
let contract_state = self.get_decrypted_state(contract_address, block)?;
|
||||
trace!(target: "privatetx", "Patching contract at {:?}, code: {:?}, state: {:?}", contract_address, contract_code, contract_state);
|
||||
trace!("Patching contract at {:?}, code: {:?}, state: {:?}", contract_address, contract_code, contract_state);
|
||||
state.patch_account(contract_address, contract_code, Self::snapshot_to_storage(contract_state))?;
|
||||
Some(*contract_address)
|
||||
},
|
||||
@@ -499,9 +435,7 @@ impl Provider where {
|
||||
let (new_address, _) = ethcore_contract_address(engine.create_address_scheme(env_info.number), &sender, &nonce, &transaction.data);
|
||||
Some(new_address)
|
||||
});
|
||||
let machine = engine.machine();
|
||||
let schedule = machine.schedule(env_info.number);
|
||||
let result = Executive::new(&mut state, &env_info, &machine, &schedule).transact_virtual(transaction, options)?;
|
||||
let result = Executive::new(&mut state, &env_info, engine.machine()).transact_virtual(transaction, options)?;
|
||||
let (encrypted_code, encrypted_storage) = match contract_address {
|
||||
None => bail!(ErrorKind::ContractDoesNotExist),
|
||||
Some(address) => {
|
||||
@@ -513,7 +447,7 @@ impl Provider where {
|
||||
(enc_code, self.encrypt(&address, &Self::iv_from_transaction(transaction), &Self::snapshot_from_storage(&storage))?)
|
||||
},
|
||||
};
|
||||
trace!(target: "privatetx", "Private contract executed. code: {:?}, state: {:?}, result: {:?}", encrypted_code, encrypted_storage, result.output);
|
||||
trace!("Private contract executed. code: {:?}, state: {:?}, result: {:?}", encrypted_code, encrypted_storage, result.output);
|
||||
Ok(PrivateExecutionResult {
|
||||
code: encrypted_code,
|
||||
state: encrypted_storage,
|
||||
@@ -614,12 +548,12 @@ impl Provider where {
|
||||
|
||||
pub trait Importer {
|
||||
/// Process received private transaction
|
||||
fn import_private_transaction(&self, _rlp: &[u8]) -> Result<H256, Error>;
|
||||
fn import_private_transaction(&self, _rlp: &[u8]) -> Result<(), Error>;
|
||||
|
||||
/// Add signed private transaction into the store
|
||||
///
|
||||
/// Creates corresponding public transaction if last required signature collected and sends it to the chain
|
||||
fn import_signed_private_transaction(&self, _rlp: &[u8]) -> Result<H256, Error>;
|
||||
fn import_signed_private_transaction(&self, _rlp: &[u8]) -> Result<(), Error>;
|
||||
}
|
||||
|
||||
// TODO [ToDr] Offload more heavy stuff to the IoService thread.
|
||||
@@ -628,59 +562,115 @@ pub trait Importer {
|
||||
// for both verification and execution.
|
||||
|
||||
impl Importer for Arc<Provider> {
|
||||
fn import_private_transaction(&self, rlp: &[u8]) -> Result<H256, Error> {
|
||||
trace!(target: "privatetx", "Private transaction received");
|
||||
fn import_private_transaction(&self, rlp: &[u8]) -> Result<(), Error> {
|
||||
trace!("Private transaction received");
|
||||
let private_tx: PrivateTransaction = Rlp::new(rlp).as_val()?;
|
||||
let private_tx_hash = private_tx.hash();
|
||||
let contract = private_tx.contract();
|
||||
let contract = private_tx.contract;
|
||||
let contract_validators = self.get_validators(BlockId::Latest, &contract)?;
|
||||
|
||||
let validation_account = contract_validators
|
||||
.iter()
|
||||
.find(|address| self.validator_accounts.contains(address));
|
||||
|
||||
//extract the original transaction
|
||||
let encrypted_data = private_tx.encrypted();
|
||||
let transaction_bytes = self.decrypt(&contract, &encrypted_data)?;
|
||||
let original_tx: UnverifiedTransaction = Rlp::new(&transaction_bytes).as_val()?;
|
||||
let nonce_cache = NonceCache::new(NONCE_CACHE_SIZE);
|
||||
//add to the queue for further verification
|
||||
self.transactions_for_verification.add_transaction(
|
||||
original_tx,
|
||||
validation_account.map(|&account| account),
|
||||
private_tx,
|
||||
self.pool_client(&nonce_cache),
|
||||
)?;
|
||||
let provider = Arc::downgrade(self);
|
||||
let result = self.channel.send(ClientIoMessage::execute(move |_| {
|
||||
if let Some(provider) = provider.upgrade() {
|
||||
if let Err(e) = provider.process_verification_queue() {
|
||||
warn!(target: "privatetx", "Unable to process the queue: {}", e);
|
||||
}
|
||||
match validation_account {
|
||||
None => {
|
||||
// TODO [ToDr] This still seems a bit invalid, imho we should still import the transaction to the pool.
|
||||
// Importing to pool verifies correctness and nonce; here we are just blindly forwarding.
|
||||
//
|
||||
// Not for verification, broadcast further to peers
|
||||
self.broadcast_private_transaction(rlp.into());
|
||||
return Ok(());
|
||||
},
|
||||
Some(&validation_account) => {
|
||||
let hash = private_tx.hash();
|
||||
trace!("Private transaction taken for verification");
|
||||
let original_tx = self.extract_original_transaction(private_tx, &contract)?;
|
||||
trace!("Validating transaction: {:?}", original_tx);
|
||||
// Verify with the first account available
|
||||
trace!("The following account will be used for verification: {:?}", validation_account);
|
||||
let nonce_cache = NonceCache::new(NONCE_CACHE_SIZE);
|
||||
self.transactions_for_verification.lock().add_transaction(
|
||||
original_tx,
|
||||
contract,
|
||||
validation_account,
|
||||
hash,
|
||||
self.pool_client(&nonce_cache),
|
||||
)?;
|
||||
let provider = Arc::downgrade(self);
|
||||
self.channel.send(ClientIoMessage::execute(move |_| {
|
||||
if let Some(provider) = provider.upgrade() {
|
||||
if let Err(e) = provider.process_queue() {
|
||||
debug!("Unable to process the queue: {}", e);
|
||||
}
|
||||
}
|
||||
})).map_err(|_| ErrorKind::ClientIsMalformed.into())
|
||||
}
|
||||
}));
|
||||
if let Err(e) = result {
|
||||
warn!(target: "privatetx", "Error sending NewPrivateTransaction message: {:?}", e);
|
||||
}
|
||||
Ok(private_tx_hash)
|
||||
}
|
||||
|
||||
fn import_signed_private_transaction(&self, rlp: &[u8]) -> Result<H256, Error> {
|
||||
fn import_signed_private_transaction(&self, rlp: &[u8]) -> Result<(), Error> {
|
||||
let tx: SignedPrivateTransaction = Rlp::new(rlp).as_val()?;
|
||||
trace!(target: "privatetx", "Signature for private transaction received: {:?}", tx);
|
||||
trace!("Signature for private transaction received: {:?}", tx);
|
||||
let private_hash = tx.private_transaction_hash();
|
||||
let provider = Arc::downgrade(self);
|
||||
let result = self.channel.send(ClientIoMessage::execute(move |_| {
|
||||
if let Some(provider) = provider.upgrade() {
|
||||
if let Err(e) = provider.process_signature(&tx) {
|
||||
warn!(target: "privatetx", "Unable to process the signature: {}", e);
|
||||
let desc = match self.transactions_for_signing.lock().get(&private_hash) {
|
||||
None => {
|
||||
// TODO [ToDr] Verification (we can't just blindly forward every transaction)
|
||||
|
||||
// Not our transaction, broadcast further to peers
|
||||
self.broadcast_signed_private_transaction(rlp.into());
|
||||
return Ok(());
|
||||
},
|
||||
Some(desc) => desc,
|
||||
};
|
||||
|
||||
let last = self.last_required_signature(&desc, tx.signature())?;
|
||||
|
||||
if last {
|
||||
let mut signatures = desc.received_signatures.clone();
|
||||
signatures.push(tx.signature());
|
||||
let rsv: Vec<Signature> = signatures.into_iter().map(|sign| sign.into_electrum().into()).collect();
|
||||
//Create public transaction
|
||||
let public_tx = self.public_transaction(
|
||||
desc.state.clone(),
|
||||
&desc.original_transaction,
|
||||
&rsv,
|
||||
desc.original_transaction.nonce,
|
||||
desc.original_transaction.gas_price
|
||||
)?;
|
||||
trace!("Last required signature received, public transaction created: {:?}", public_tx);
|
||||
//Sign and add it to the queue
|
||||
let chain_id = desc.original_transaction.chain_id();
|
||||
let hash = public_tx.hash(chain_id);
|
||||
let signer_account = self.signer_account.ok_or_else(|| ErrorKind::SignerAccountNotSet)?;
|
||||
let password = find_account_password(&self.passwords, &*self.accounts, &signer_account);
|
||||
let signature = self.accounts.sign(signer_account, password, hash)?;
|
||||
let signed = SignedTransaction::new(public_tx.with_signature(signature, chain_id))?;
|
||||
match self.miner.import_own_transaction(&*self.client, signed.into()) {
|
||||
Ok(_) => trace!("Public transaction added to queue"),
|
||||
Err(err) => {
|
||||
trace!("Failed to add transaction to queue, error: {:?}", err);
|
||||
bail!(err);
|
||||
}
|
||||
}
|
||||
//Remove from store for signing
|
||||
match self.transactions_for_signing.lock().remove(&private_hash) {
|
||||
Ok(_) => {}
|
||||
Err(err) => {
|
||||
trace!("Failed to remove transaction from signing store, error: {:?}", err);
|
||||
bail!(err);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//Add signature to the store
|
||||
match self.transactions_for_signing.lock().add_signature(&private_hash, tx.signature()) {
|
||||
Ok(_) => trace!("Signature stored for private transaction"),
|
||||
Err(err) => {
|
||||
trace!("Failed to add signature to signing store, error: {:?}", err);
|
||||
bail!(err);
|
||||
}
|
||||
}
|
||||
}));
|
||||
if let Err(e) = result {
|
||||
warn!(target: "privatetx", "Error sending NewSignedPrivateTransaction message: {:?}", e);
|
||||
}
|
||||
Ok(private_hash)
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -697,9 +687,9 @@ fn find_account_password(passwords: &Vec<Password>, account_provider: &AccountPr
|
||||
impl ChainNotify for Provider {
|
||||
fn new_blocks(&self, imported: Vec<H256>, _invalid: Vec<H256>, _route: ChainRoute, _sealed: Vec<H256>, _proposed: Vec<Bytes>, _duration: Duration) {
|
||||
if !imported.is_empty() {
|
||||
trace!(target: "privatetx", "New blocks imported, try to prune the queue");
|
||||
if let Err(err) = self.process_verification_queue() {
|
||||
warn!(target: "privatetx", "Cannot prune private transactions queue. error: {:?}", err);
|
||||
trace!("New blocks imported, try to prune the queue");
|
||||
if let Err(err) = self.process_queue() {
|
||||
trace!("Cannot prune private transactions queue. error: {:?}", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,41 +25,15 @@ use transaction::signature::{add_chain_replay_protection, check_replay_protectio
|
||||
#[derive(Default, Debug, Clone, PartialEq, RlpEncodable, RlpDecodable, Eq)]
|
||||
pub struct PrivateTransaction {
|
||||
/// Encrypted data
|
||||
encrypted: Bytes,
|
||||
pub encrypted: Bytes,
|
||||
/// Address of the contract
|
||||
contract: Address,
|
||||
/// Hash
|
||||
hash: H256,
|
||||
pub contract: Address,
|
||||
}
|
||||
|
||||
impl PrivateTransaction {
|
||||
/// Constructor
|
||||
pub fn new(encrypted: Bytes, contract: Address) -> Self {
|
||||
PrivateTransaction {
|
||||
encrypted,
|
||||
contract,
|
||||
hash: 0.into(),
|
||||
}.compute_hash()
|
||||
}
|
||||
|
||||
fn compute_hash(mut self) -> PrivateTransaction {
|
||||
self.hash = keccak(&*self.rlp_bytes());
|
||||
self
|
||||
}
|
||||
|
||||
/// Hash of the private transaction
|
||||
/// Compute hash on private transaction
|
||||
pub fn hash(&self) -> H256 {
|
||||
self.hash
|
||||
}
|
||||
|
||||
/// Address of the contract
|
||||
pub fn contract(&self) -> Address {
|
||||
self.contract
|
||||
}
|
||||
|
||||
/// Encrypted data
|
||||
pub fn encrypted(&self) -> Bytes {
|
||||
self.encrypted.clone()
|
||||
keccak(&*self.rlp_bytes())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,8 +49,6 @@ pub struct SignedPrivateTransaction {
|
||||
r: U256,
|
||||
/// The S field of the signature
|
||||
s: U256,
|
||||
/// Hash
|
||||
hash: H256,
|
||||
}
|
||||
|
||||
impl SignedPrivateTransaction {
|
||||
@@ -87,13 +59,7 @@ impl SignedPrivateTransaction {
|
||||
r: sig.r().into(),
|
||||
s: sig.s().into(),
|
||||
v: add_chain_replay_protection(sig.v() as u64, chain_id),
|
||||
hash: 0.into(),
|
||||
}.compute_hash()
|
||||
}
|
||||
|
||||
fn compute_hash(mut self) -> SignedPrivateTransaction {
|
||||
self.hash = keccak(&*self.rlp_bytes());
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
pub fn standard_v(&self) -> u8 { check_replay_protection(self.v) }
|
||||
@@ -107,9 +73,4 @@ impl SignedPrivateTransaction {
|
||||
pub fn private_transaction_hash(&self) -> H256 {
|
||||
self.private_transaction_hash
|
||||
}
|
||||
|
||||
/// Own hash
|
||||
pub fn hash(&self) -> H256 {
|
||||
self.hash
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,139 +15,61 @@
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::cmp;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
use bytes::Bytes;
|
||||
use ethcore_miner::pool;
|
||||
use ethereum_types::{H256, U256, Address};
|
||||
use heapsize::HeapSizeOf;
|
||||
use ethkey::Signature;
|
||||
use messages::PrivateTransaction;
|
||||
use parking_lot::RwLock;
|
||||
use transaction::{UnverifiedTransaction, SignedTransaction};
|
||||
use txpool;
|
||||
use txpool::{VerifiedTransaction, Verifier};
|
||||
use error::{Error, ErrorKind};
|
||||
|
||||
type Pool = txpool::Pool<VerifiedPrivateTransaction, pool::scoring::NonceAndGasPrice>;
|
||||
use error::{Error, ErrorKind};
|
||||
|
||||
/// Maximum length for private transactions queues.
|
||||
const MAX_QUEUE_LEN: usize = 8312;
|
||||
|
||||
/// Private transaction stored in queue for verification
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct VerifiedPrivateTransaction {
|
||||
/// Original private transaction
|
||||
pub private_transaction: PrivateTransaction,
|
||||
/// Desriptor for private transaction stored in queue for verification
|
||||
#[derive(Default, Debug, Clone, PartialEq, Eq)]
|
||||
pub struct PrivateTransactionDesc {
|
||||
/// Hash of the private transaction
|
||||
pub private_hash: H256,
|
||||
/// Contract's address used in private transaction
|
||||
pub contract: Address,
|
||||
/// Address that should be used for verification
|
||||
pub validator_account: Option<Address>,
|
||||
/// Resulting verified transaction
|
||||
pub transaction: SignedTransaction,
|
||||
/// Original transaction hash
|
||||
pub transaction_hash: H256,
|
||||
/// Original transaction sender
|
||||
pub transaction_sender: Address,
|
||||
}
|
||||
|
||||
impl txpool::VerifiedTransaction for VerifiedPrivateTransaction {
|
||||
type Hash = H256;
|
||||
type Sender = Address;
|
||||
|
||||
fn hash(&self) -> &H256 {
|
||||
&self.transaction_hash
|
||||
}
|
||||
|
||||
fn mem_usage(&self) -> usize {
|
||||
self.transaction.heap_size_of_children()
|
||||
}
|
||||
|
||||
fn sender(&self) -> &Address {
|
||||
&self.transaction_sender
|
||||
}
|
||||
}
|
||||
|
||||
impl pool::ScoredTransaction for VerifiedPrivateTransaction {
|
||||
fn priority(&self) -> pool::Priority {
|
||||
pool::Priority::Regular
|
||||
}
|
||||
|
||||
/// Gets transaction gas price.
|
||||
fn gas_price(&self) -> &U256 {
|
||||
&self.transaction.gas_price
|
||||
}
|
||||
|
||||
/// Gets transaction nonce.
|
||||
fn nonce(&self) -> U256 {
|
||||
self.transaction.nonce
|
||||
}
|
||||
}
|
||||
|
||||
/// Checks readiness of transactions by looking if the transaction from sender already exists.
|
||||
/// Guarantees only one transaction per sender
|
||||
#[derive(Debug)]
|
||||
pub struct PrivateReadyState<C> {
|
||||
senders: HashSet<Address>,
|
||||
state: C,
|
||||
}
|
||||
|
||||
impl<C> PrivateReadyState<C> {
|
||||
/// Create new State checker, given client interface.
|
||||
pub fn new(
|
||||
state: C,
|
||||
) -> Self {
|
||||
PrivateReadyState {
|
||||
senders: Default::default(),
|
||||
state,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<C: pool::client::NonceClient> txpool::Ready<VerifiedPrivateTransaction> for PrivateReadyState<C> {
|
||||
fn is_ready(&mut self, tx: &VerifiedPrivateTransaction) -> txpool::Readiness {
|
||||
let sender = tx.sender();
|
||||
let state = &self.state;
|
||||
let state_nonce = state.account_nonce(sender);
|
||||
if self.senders.contains(sender) {
|
||||
txpool::Readiness::Future
|
||||
} else {
|
||||
self.senders.insert(*sender);
|
||||
match tx.transaction.nonce.cmp(&state_nonce) {
|
||||
cmp::Ordering::Greater => txpool::Readiness::Future,
|
||||
cmp::Ordering::Less => txpool::Readiness::Stale,
|
||||
cmp::Ordering::Equal => txpool::Readiness::Ready,
|
||||
}
|
||||
}
|
||||
}
|
||||
pub validator_account: Address,
|
||||
}
|
||||
|
||||
/// Storage for private transactions for verification
|
||||
pub struct VerificationStore {
|
||||
verification_pool: RwLock<Pool>,
|
||||
verification_options: pool::verifier::Options,
|
||||
/// Descriptors for private transactions in queue for verification with key - hash of the original transaction
|
||||
descriptors: HashMap<H256, PrivateTransactionDesc>,
|
||||
/// Queue with transactions for verification
|
||||
///
|
||||
/// TODO [ToDr] Might actually be better to use `txpool` directly and:
|
||||
/// 1. Store descriptors inside `VerifiedTransaction`
|
||||
/// 2. Use custom `ready` implementation to only fetch one transaction per sender.
|
||||
/// 3. Get rid of passing dummy `block_number` and `timestamp`
|
||||
transactions: pool::TransactionQueue,
|
||||
}
|
||||
|
||||
impl Default for VerificationStore {
|
||||
fn default() -> Self {
|
||||
VerificationStore {
|
||||
verification_pool: RwLock::new(
|
||||
txpool::Pool::new(
|
||||
txpool::NoopListener,
|
||||
pool::scoring::NonceAndGasPrice(pool::PrioritizationStrategy::GasPriceOnly),
|
||||
pool::Options {
|
||||
max_count: MAX_QUEUE_LEN,
|
||||
max_per_sender: MAX_QUEUE_LEN / 10,
|
||||
max_mem_usage: 8 * 1024 * 1024,
|
||||
},
|
||||
)
|
||||
),
|
||||
verification_options: pool::verifier::Options {
|
||||
// TODO [ToDr] This should probably be based on some real values?
|
||||
minimal_gas_price: 0.into(),
|
||||
block_gas_limit: 8_000_000.into(),
|
||||
tx_gas_limit: U256::max_value(),
|
||||
no_early_reject: false,
|
||||
},
|
||||
descriptors: Default::default(),
|
||||
transactions: pool::TransactionQueue::new(
|
||||
pool::Options {
|
||||
max_count: MAX_QUEUE_LEN,
|
||||
max_per_sender: MAX_QUEUE_LEN / 10,
|
||||
max_mem_usage: 8 * 1024 * 1024,
|
||||
},
|
||||
pool::verifier::Options {
|
||||
// TODO [ToDr] This should probably be based on some real values?
|
||||
minimal_gas_price: 0.into(),
|
||||
block_gas_limit: 8_000_000.into(),
|
||||
tx_gas_limit: U256::max_value(),
|
||||
},
|
||||
pool::PrioritizationStrategy::GasPriceOnly,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -155,43 +77,66 @@ impl Default for VerificationStore {
|
||||
impl VerificationStore {
|
||||
/// Adds private transaction for verification into the store
|
||||
pub fn add_transaction<C: pool::client::Client>(
|
||||
&self,
|
||||
&mut self,
|
||||
transaction: UnverifiedTransaction,
|
||||
validator_account: Option<Address>,
|
||||
private_transaction: PrivateTransaction,
|
||||
contract: Address,
|
||||
validator_account: Address,
|
||||
private_hash: H256,
|
||||
client: C,
|
||||
) -> Result<(), Error> {
|
||||
if self.descriptors.len() > MAX_QUEUE_LEN {
|
||||
bail!(ErrorKind::QueueIsFull);
|
||||
}
|
||||
|
||||
let options = self.verification_options.clone();
|
||||
// Use pool's verifying pipeline for original transaction's verification
|
||||
let verifier = pool::verifier::Verifier::new(client, options, Default::default(), None);
|
||||
let unverified = pool::verifier::Transaction::Unverified(transaction);
|
||||
let verified_tx = verifier.verify_transaction(unverified)?;
|
||||
let signed_tx: SignedTransaction = verified_tx.signed().clone();
|
||||
let signed_hash = signed_tx.hash();
|
||||
let signed_sender = signed_tx.sender();
|
||||
let verified = VerifiedPrivateTransaction {
|
||||
private_transaction,
|
||||
let transaction_hash = transaction.hash();
|
||||
if self.descriptors.get(&transaction_hash).is_some() {
|
||||
bail!(ErrorKind::PrivateTransactionAlreadyImported);
|
||||
}
|
||||
|
||||
let results = self.transactions.import(
|
||||
client,
|
||||
vec![pool::verifier::Transaction::Unverified(transaction)],
|
||||
);
|
||||
|
||||
// Verify that transaction was imported
|
||||
results.into_iter()
|
||||
.next()
|
||||
.expect("One transaction inserted; one result returned; qed")?;
|
||||
|
||||
self.descriptors.insert(transaction_hash, PrivateTransactionDesc {
|
||||
private_hash,
|
||||
contract,
|
||||
validator_account,
|
||||
transaction: signed_tx,
|
||||
transaction_hash: signed_hash,
|
||||
transaction_sender: signed_sender,
|
||||
};
|
||||
let mut pool = self.verification_pool.write();
|
||||
pool.import(verified)?;
|
||||
});
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Drains transactions ready for verification from the pool
|
||||
/// Returns transactions ready for verification
|
||||
/// Returns only one transaction per sender because several cannot be verified in a row without verification from other peers
|
||||
pub fn drain<C: pool::client::NonceClient>(&self, client: C) -> Vec<Arc<VerifiedPrivateTransaction>> {
|
||||
let ready = PrivateReadyState::new(client);
|
||||
let transactions: Vec<_> = self.verification_pool.read().pending(ready).collect();
|
||||
let mut pool = self.verification_pool.write();
|
||||
for tx in &transactions {
|
||||
pool.remove(tx.hash(), true);
|
||||
}
|
||||
transactions
|
||||
pub fn ready_transactions<C: pool::client::NonceClient>(&self, client: C) -> Vec<Arc<pool::VerifiedTransaction>> {
|
||||
// We never store PendingTransactions and we don't use internal cache,
|
||||
// so we don't need to provide real block number of timestamp here
|
||||
let block_number = 0;
|
||||
let timestamp = 0;
|
||||
let nonce_cap = None;
|
||||
|
||||
self.transactions.collect_pending(client, block_number, timestamp, nonce_cap, |transactions| {
|
||||
// take only one transaction per sender
|
||||
let mut senders = HashSet::with_capacity(self.descriptors.len());
|
||||
transactions.filter(move |tx| senders.insert(tx.signed().sender())).collect()
|
||||
})
|
||||
}
|
||||
|
||||
/// Returns descriptor of the corresponding private transaction
|
||||
pub fn private_transaction_descriptor(&self, transaction_hash: &H256) -> Result<&PrivateTransactionDesc, Error> {
|
||||
self.descriptors.get(transaction_hash).ok_or(ErrorKind::PrivateTransactionNotFound.into())
|
||||
}
|
||||
|
||||
/// Remove transaction from the queue for verification
|
||||
pub fn remove_private_transaction(&mut self, transaction_hash: &H256) {
|
||||
self.descriptors.remove(transaction_hash);
|
||||
self.transactions.remove(&[*transaction_hash], true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,12 +6,11 @@
|
||||
"minimumDifficulty": "0x020000",
|
||||
"difficultyBoundDivisor": "0x0800",
|
||||
"durationLimit": "0x0d",
|
||||
"blockReward": "0x29A2241AF62C0000",
|
||||
"blockReward": "0x4563918244F40000",
|
||||
"homesteadTransition": "0x0",
|
||||
"eip649Reward": "0x29A2241AF62C0000",
|
||||
"eip100bTransition": "0x0",
|
||||
"difficultyBombDelays": {
|
||||
"0": 3000000
|
||||
}
|
||||
"eip649Transition": "0x0"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -31,7 +31,8 @@
|
||||
"eip161abcTransition": "0x7fffffffffffffff",
|
||||
"eip161dTransition": "0x7fffffffffffffff",
|
||||
"eip155Transition": 3000000,
|
||||
"eip98Transition": "0x7fffffffffffff"
|
||||
"eip98Transition": "0x7fffffffffffff",
|
||||
"eip86Transition": "0x7fffffffffffff"
|
||||
},
|
||||
"genesis": {
|
||||
"seal": {
|
||||
@@ -3076,9 +3077,7 @@
|
||||
"enode://72e445f4e89c0f476d404bc40478b0df83a5b500d2d2e850e08eb1af0cd464ab86db6160d0fde64bd77d5f0d33507ae19035671b3c74fec126d6e28787669740@104.198.71.200:30303",
|
||||
"enode://39abab9d2a41f53298c0c9dc6bbca57b0840c3ba9dccf42aa27316addc1b7e56ade32a0a9f7f52d6c5db4fe74d8824bcedfeaecf1a4e533cacb71cf8100a9442@144.76.238.49:30303",
|
||||
"enode://f50e675a34f471af2438b921914b5f06499c7438f3146f6b8936f1faeb50b8a91d0d0c24fb05a66f05865cd58c24da3e664d0def806172ddd0d4c5bdbf37747e@144.76.238.49:30306",
|
||||
"enode://83b33409349ffa25e150555f7b4f8deebc68f3d34d782129dc3c8ba07b880c209310a4191e1725f2f6bef59bce9452d821111eaa786deab08a7e6551fca41f4f@159.89.223.6:30303",
|
||||
"enode://5cd218959f8263bc3721d7789070806b0adff1a0ed3f95ec886fb469f9362c7507e3b32b256550b9a7964a23a938e8d42d45a0c34b332bfebc54b29081e83b93@35.187.57.94:30303",
|
||||
"enode://6dd3ac8147fa82e46837ec8c3223d69ac24bcdbab04b036a3705c14f3a02e968f7f1adfcdb002aacec2db46e625c04bf8b5a1f85bb2d40a479b3cc9d45a444af@104.237.131.102:30303"
|
||||
"enode://83b33409349ffa25e150555f7b4f8deebc68f3d34d782129dc3c8ba07b880c209310a4191e1725f2f6bef59bce9452d821111eaa786deab08a7e6551fca41f4f@159.89.223.6:30303"
|
||||
],
|
||||
"accounts": {
|
||||
"0000000000000000000000000000000000000001": { "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
{
|
||||
"name": "Constantinople (test)",
|
||||
"name": "Byzantium (Test)",
|
||||
"engine": {
|
||||
"Ethash": {
|
||||
"params": {
|
||||
"minimumDifficulty": "0x020000",
|
||||
"difficultyBoundDivisor": "0x0800",
|
||||
"durationLimit": "0x0d",
|
||||
"blockReward": "0x1BC16D674EC80000",
|
||||
"blockReward": "0x4563918244F40000",
|
||||
"homesteadTransition": "0x0",
|
||||
"eip649Reward": "0x29A2241AF62C0000",
|
||||
"eip100bTransition": "0x0",
|
||||
"difficultyBombDelays": {
|
||||
"0": 5000000
|
||||
}
|
||||
"eip649Transition": "0x0"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -30,14 +29,11 @@
|
||||
"eip161abcTransition": "0x0",
|
||||
"eip161dTransition": "0x0",
|
||||
"eip140Transition": "0x0",
|
||||
"eip210Transition": "0x0",
|
||||
"eip211Transition": "0x0",
|
||||
"eip214Transition": "0x0",
|
||||
"eip155Transition": "0x0",
|
||||
"eip658Transition": "0x0",
|
||||
"eip145Transition": "0x0",
|
||||
"eip1014Transition": "0x0",
|
||||
"eip1052Transition": "0x0",
|
||||
"eip1283Transition": "0x0"
|
||||
"eip658Transition": "0x0"
|
||||
},
|
||||
"genesis": {
|
||||
"seal": {
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
"eip155Transition": "0x0",
|
||||
"eip161abcTransition": "0x7fffffffffffffff",
|
||||
"eip161dTransition": "0x7fffffffffffffff",
|
||||
"eip98Transition": "0x7fffffffffffff"
|
||||
"eip98Transition": "0x7fffffffffffff",
|
||||
"eip86Transition": "0x7fffffffffffff"
|
||||
},
|
||||
"genesis": {
|
||||
"seal": {
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
"eip161abcTransition": "0x7fffffffffffffff",
|
||||
"eip161dTransition": "0x7fffffffffffffff",
|
||||
"eip98Transition": "0x7fffffffffffffff",
|
||||
"eip86Transition": "0x7fffffffffffffff",
|
||||
"eip155Transition": "0x7fffffffffffffff",
|
||||
"maxCodeSize": 24576,
|
||||
"maxCodeSizeTransition": "0x7fffffffffffffff"
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
"eip161abcTransition": "0x0",
|
||||
"eip161dTransition": "0x0",
|
||||
"eip98Transition": "0x7fffffffffffffff",
|
||||
"eip155Transition": "0x0",
|
||||
"eip86Transition": "0x7fffffffffffffff",
|
||||
"eip155Transition": "0x7fffffffffffffff",
|
||||
"maxCodeSize": 24576,
|
||||
"maxCodeSizeTransition": "0x0"
|
||||
},
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
{
|
||||
"name": "EIP210 (test)",
|
||||
"engine": {
|
||||
"Ethash": {
|
||||
"params": {
|
||||
"minimumDifficulty": "0x020000",
|
||||
"difficultyBoundDivisor": "0x0800",
|
||||
"durationLimit": "0x0d",
|
||||
"blockReward": "0x4563918244F40000",
|
||||
"homesteadTransition": "0x0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"params": {
|
||||
"gasLimitBoundDivisor": "0x0400",
|
||||
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
||||
"accountStartNonce": "0x00",
|
||||
"maximumExtraDataSize": "0x20",
|
||||
"minGasLimit": "0x1388",
|
||||
"networkID" : "0x1",
|
||||
"maxCodeSize": 24576,
|
||||
"maxCodeSizeTransition": "0x0",
|
||||
"eip98Transition": "0xffffffffffffffff",
|
||||
"eip150Transition": "0x0",
|
||||
"eip160Transition": "0x0",
|
||||
"eip161abcTransition": "0x0",
|
||||
"eip161dTransition": "0x0",
|
||||
"eip210Transition": "0x0"
|
||||
},
|
||||
"genesis": {
|
||||
"seal": {
|
||||
"ethereum": {
|
||||
"nonce": "0x0000000000000042",
|
||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
}
|
||||
},
|
||||
"difficulty": "0x400000000",
|
||||
"author": "0x0000000000000000000000000000000000000000",
|
||||
"timestamp": "0x00",
|
||||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",
|
||||
"gasLimit": "0x1388"
|
||||
},
|
||||
"accounts": {
|
||||
"0000000000000000000000000000000000000001": { "balance": "1", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
|
||||
"0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
|
||||
"0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
|
||||
"0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
|
||||
"0000000000000000000000000000000000000005": { "builtin": { "name": "modexp", "activate_at": "0x00", "pricing": { "modexp": { "divisor": 100 } } } },
|
||||
"0000000000000000000000000000000000000006": { "builtin": { "name": "alt_bn128_add", "activate_at": "0x00", "pricing": { "linear": { "base": 500, "word": 0 } } } },
|
||||
"0000000000000000000000000000000000000007": { "builtin": { "name": "alt_bn128_mul", "activate_at": "0x00", "pricing": { "linear": { "base": 2000, "word": 0 } } } },
|
||||
"0000000000000000000000000000000000000008": { "builtin": { "name": "alt_bn128_pairing", "activate_at": "0x00", "pricing": { "alt_bn128_pairing": { "base": 100000, "pair": 80000 } } } }
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@
|
||||
"eip161dTransition": "0x7fffffffffffffff",
|
||||
"eip155Transition": "0x0",
|
||||
"eip98Transition": "0x7fffffffffffff",
|
||||
"eip86Transition": "0x7fffffffffffff",
|
||||
"wasmActivationTransition": 2000000,
|
||||
"eip140Transition": 2000000,
|
||||
"eip211Transition": 2000000,
|
||||
@@ -58,8 +59,7 @@
|
||||
"enode://5dd35866da95aea15211fb1f98684f6e8c4e355e6aa3cc17585680ed53fa164477b8c52cb6ca4b24ec4d80f3d48ff9212b53feb131d825c7945a3abaaf02d24d@178.79.189.58:60606",
|
||||
"enode://6c585c18024eb902ca093278af73b04863ac904caabc39ac2920c23532307c572ad92afd828a990c980d272b1f26307f2409cc97aec3ff9fe866732cae49a8c2@144.217.163.224:31337",
|
||||
"enode://edd90c4cc64528802ad52fd127d80b641ff80fd43fa5292fb111c8bd2914482dffee288fd1b0d26440c6b2c669b10a53cbcd37c895ba0d6194110e100a965b2d@188.166.179.159:30303",
|
||||
"enode://9d960373335c1cc38ca696dea8f2893e2a071c8f21524f21e8aae22be032acc3b67797b1d21e866f9d832943ae7d9555b8466c6ab34f473d21e547114952df37@213.32.53.183:30303",
|
||||
"enode://5120308ebf25261c8423866a3a082e8d0f31106343d8b3b6c4dfe9d41bd900f5e03c64356ba51b6d343a951846a3f5ede5c5dd05925eaea4e4b9c35b1be9237c@95.53.247.188:30303"
|
||||
"enode://9d960373335c1cc38ca696dea8f2893e2a071c8f21524f21e8aae22be032acc3b67797b1d21e866f9d832943ae7d9555b8466c6ab34f473d21e547114952df37@213.32.53.183:30303"
|
||||
],
|
||||
"accounts": {
|
||||
"0000000000000000000000000000000000000001": { "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
|
||||
|
||||
@@ -8,19 +8,15 @@
|
||||
"difficultyBoundDivisor": "0x0800",
|
||||
"difficultyIncrementDivisor": "0x3C",
|
||||
"durationLimit": "0x3C",
|
||||
"blockReward": {
|
||||
"0x0": "0x6f05b59d3b200000",
|
||||
"0xC3500": "0x3782DACE9D900000"
|
||||
},
|
||||
"blockReward": "0x6f05b59d3b200000",
|
||||
"homesteadTransition": "0x30d40",
|
||||
"difficultyHardforkTransition": "0x59d9",
|
||||
"difficultyHardforkBoundDivisor": "0x0200",
|
||||
"bombDefuseTransition": "0x30d40",
|
||||
"eip100bTransition": "0xC3500",
|
||||
"metropolisDifficultyIncrementDivisor": "0x1E",
|
||||
"difficultyBombDelays": {
|
||||
"0xC3500": 3000000
|
||||
},
|
||||
"eip649Transition": "0xC3500",
|
||||
"eip649Reward": "0x3782DACE9D900000",
|
||||
"expip2Transition": "0xC3500",
|
||||
"expip2DurationLimit": "0x1E"
|
||||
}
|
||||
@@ -42,6 +38,7 @@
|
||||
"eip161abcTransition": "0x927C0",
|
||||
"eip161dTransition": "0x927C0",
|
||||
"eip98Transition": "0x7fffffffffffff",
|
||||
"eip86Transition": "0x7fffffffffffff",
|
||||
"eip155Transition": "0x927C0",
|
||||
"eip140Transition": "0xC3500",
|
||||
"eip211Transition": "0xC3500",
|
||||
@@ -68,7 +65,6 @@
|
||||
"enode://96d3919b903e7f5ad59ac2f73c43be9172d9d27e2771355db03fd194732b795829a31fe2ea6de109d0804786c39a807e155f065b4b94c6fce167becd0ac02383@45.55.22.34:42786",
|
||||
"enode://5f6c625bf287e3c08aad568de42d868781e961cbda805c8397cfb7be97e229419bef9a5a25a75f97632787106bba8a7caf9060fab3887ad2cfbeb182ab0f433f@46.101.182.53:42786",
|
||||
"enode://d33a8d4c2c38a08971ed975b750f21d54c927c0bf7415931e214465a8d01651ecffe4401e1db913f398383381413c78105656d665d83f385244ab302d6138414@128.199.183.48:42786",
|
||||
"enode://df872f81e25f72356152b44cab662caf1f2e57c3a156ecd20e9ac9246272af68a2031b4239a0bc831f2c6ab34733a041464d46b3ea36dce88d6c11714446e06b@178.62.208.109:42786",
|
||||
"enode://f6f0d6b9b7d02ec9e8e4a16e38675f3621ea5e69860c739a65c1597ca28aefb3cec7a6d84e471ac927d42a1b64c1cbdefad75e7ce8872d57548ddcece20afdd1@159.203.64.95:42786"
|
||||
],
|
||||
"accounts": {
|
||||
|
||||
@@ -7,10 +7,7 @@
|
||||
"minimumDifficulty": "0x020000",
|
||||
"difficultyBoundDivisor": "0x0800",
|
||||
"durationLimit": "0x0d",
|
||||
"blockReward": {
|
||||
"0": "0x4563918244F40000",
|
||||
"4370000": "0x29A2241AF62C0000"
|
||||
},
|
||||
"blockReward": "0x4563918244F40000",
|
||||
"homesteadTransition": "0x118c30",
|
||||
"daoHardforkTransition": "0x1d4c00",
|
||||
"daoHardforkBeneficiary": "0xbf4ed7b27f1d666546e30d74d50d173d20bca754",
|
||||
@@ -132,10 +129,9 @@
|
||||
"0xbb9bc244d798123fde783fcc1c72d3bb8c189413",
|
||||
"0x807640a13483f8ac783c557fcdf27be11ea4ac7a"
|
||||
],
|
||||
"eip649Reward": "0x29A2241AF62C0000",
|
||||
"eip100bTransition": 4370000,
|
||||
"difficultyBombDelays": {
|
||||
"4370000": 3000000
|
||||
}
|
||||
"eip649Transition": 4370000
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -154,6 +150,7 @@
|
||||
"eip161dTransition": 2675000,
|
||||
"eip155Transition": 2675000,
|
||||
"eip98Transition": "0x7fffffffffffff",
|
||||
"eip86Transition": "0x7fffffffffffff",
|
||||
"maxCodeSize": 24576,
|
||||
"maxCodeSizeTransition": 2675000,
|
||||
"eip140Transition": 4370000,
|
||||
|
||||
@@ -143,6 +143,7 @@
|
||||
"eip161abcTransition": "0x7fffffffffffffff",
|
||||
"eip161dTransition": "0x7fffffffffffffff",
|
||||
"eip98Transition": "0x7fffffffffffff",
|
||||
"eip86Transition": "0x7fffffffffffff",
|
||||
"eip155Transition": "0x7fffffffffffffff"
|
||||
},
|
||||
"genesis": {
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
"eip161abcTransition": "0x7fffffffffffffff",
|
||||
"eip161dTransition": "0x7fffffffffffffff",
|
||||
"eip98Transition": "0x7fffffffffffff",
|
||||
"eip86Transition": "0x7fffffffffffff",
|
||||
"eip155Transition": "0x7fffffffffffffff"
|
||||
},
|
||||
"genesis": {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"minGasLimit": "0x1388",
|
||||
"networkID" : "0x1",
|
||||
"eip98Transition": "0x7fffffffffffff",
|
||||
"eip86Transition": "0x7fffffffffffff",
|
||||
"eip155Transition": "0x7fffffffffffffff",
|
||||
"eip150Transition": "0x7fffffffffffffff",
|
||||
"eip160Transition": "0x7fffffffffffffff",
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"durationLimit":"0x0d",
|
||||
"homesteadTransition":"0x118c30",
|
||||
"eip100bTransition":"0x7fffffffffffff",
|
||||
"eip649Transition":"0x7fffffffffffff",
|
||||
"blockReward":"0x1105a0185b50a80000",
|
||||
"mcip3Transition":"0x00",
|
||||
"mcip3MinerReward":"0xd8d726b7177a80000",
|
||||
@@ -32,6 +33,7 @@
|
||||
"eip160Transition":"0x7fffffffffffff",
|
||||
"eip161abcTransition":"0x7fffffffffffff",
|
||||
"eip161dTransition":"0x7fffffffffffff",
|
||||
"eip86Transition":"0x7fffffffffffff",
|
||||
"eip98Transition":"0x7fffffffffffff",
|
||||
"eip140Transition":"0x7fffffffffffff",
|
||||
"eip155Transition":"0x7fffffffffffff",
|
||||
|
||||
@@ -1,159 +1,158 @@
|
||||
{
|
||||
"name": "Musicoin Byzantium Test",
|
||||
"dataDir": "mcip6test",
|
||||
"engine": {
|
||||
"Ethash": {
|
||||
"params": {
|
||||
"minimumDifficulty": "0x020000",
|
||||
"difficultyBoundDivisor": "0x0800",
|
||||
"durationLimit": "0x0d",
|
||||
"homesteadTransition": "0x17",
|
||||
"eip100bTransition": "0x2a",
|
||||
"blockReward": "0x1105a0185b50a80000",
|
||||
"mcip3Transition": "0x17",
|
||||
"mcip3MinerReward": "0xd8d726b7177a80000",
|
||||
"mcip3UbiReward": "0x2b5e3af16b1880000",
|
||||
"mcip3UbiContract": "0x00efdd5883ec628983e9063c7d969fe268bbf310",
|
||||
"mcip3DevReward": "0xc249fdd327780000",
|
||||
"mcip3DevContract": "0x00756cf8159095948496617f5fb17ed95059f536",
|
||||
"difficultyBombDelays": {
|
||||
"0x2a": 3000000
|
||||
}
|
||||
"name":"Musicoin Byzantium Test",
|
||||
"dataDir":"mcip6test",
|
||||
"engine":{
|
||||
"Ethash":{
|
||||
"params":{
|
||||
"minimumDifficulty":"0x020000",
|
||||
"difficultyBoundDivisor":"0x0800",
|
||||
"durationLimit":"0x0d",
|
||||
"homesteadTransition":"0x17",
|
||||
"eip100bTransition":"0x2a",
|
||||
"eip649Transition":"0x2a",
|
||||
"blockReward":"0x1105a0185b50a80000",
|
||||
"mcip3Transition":"0x17",
|
||||
"mcip3MinerReward":"0xd8d726b7177a80000",
|
||||
"mcip3UbiReward":"0x2b5e3af16b1880000",
|
||||
"mcip3UbiContract":"0x00efdd5883ec628983e9063c7d969fe268bbf310",
|
||||
"mcip3DevReward":"0xc249fdd327780000",
|
||||
"mcip3DevContract":"0x00756cf8159095948496617f5fb17ed95059f536"
|
||||
}
|
||||
}
|
||||
},
|
||||
"params": {
|
||||
"gasLimitBoundDivisor": "0x0400",
|
||||
"registrar": "0x5C271c4C9A67E7D73b7b3669d47504741354f21D",
|
||||
"accountStartNonce": "0x00",
|
||||
"maximumExtraDataSize": "0x20",
|
||||
"minGasLimit": "0x1388",
|
||||
"networkID": "0x76740c",
|
||||
"forkBlock": "0x2b",
|
||||
"forkCanonHash": "0x23c3171e864a5d513a3ef85e4cf86dac4cc36b89e5b8e63bf0ebcca68b9e43c9",
|
||||
"eip150Transition": "0x2a",
|
||||
"eip160Transition": "0x7fffffffffffff",
|
||||
"eip161abcTransition": "0x7fffffffffffff",
|
||||
"eip161dTransition": "0x7fffffffffffff",
|
||||
"eip98Transition": "0x7fffffffffffff",
|
||||
"eip140Transition": "0x2a",
|
||||
"eip155Transition": "0x2a",
|
||||
"eip211Transition": "0x2a",
|
||||
"eip214Transition": "0x2a",
|
||||
"eip658Transition": "0x2a",
|
||||
"maxCodeSize": "0x6000",
|
||||
"params":{
|
||||
"gasLimitBoundDivisor":"0x0400",
|
||||
"registrar":"0x5C271c4C9A67E7D73b7b3669d47504741354f21D",
|
||||
"accountStartNonce":"0x00",
|
||||
"maximumExtraDataSize":"0x20",
|
||||
"minGasLimit":"0x1388",
|
||||
"networkID":"0x76740c",
|
||||
"forkBlock":"0x2b",
|
||||
"forkCanonHash":"0x23c3171e864a5d513a3ef85e4cf86dac4cc36b89e5b8e63bf0ebcca68b9e43c9",
|
||||
"eip150Transition":"0x2a",
|
||||
"eip160Transition":"0x7fffffffffffff",
|
||||
"eip161abcTransition":"0x7fffffffffffff",
|
||||
"eip161dTransition":"0x7fffffffffffff",
|
||||
"eip86Transition":"0x7fffffffffffff",
|
||||
"eip98Transition":"0x7fffffffffffff",
|
||||
"eip140Transition":"0x2a",
|
||||
"eip155Transition":"0x2a",
|
||||
"eip211Transition":"0x2a",
|
||||
"eip214Transition":"0x2a",
|
||||
"eip658Transition":"0x2a",
|
||||
"maxCodeSize":"0x6000",
|
||||
"maxCodeSizeTransition": "0x7fffffffffffff"
|
||||
},
|
||||
"genesis": {
|
||||
"seal": {
|
||||
"ethereum": {
|
||||
"nonce": "0x000000000000002a",
|
||||
"mixHash": "0x00000000000000000000000000000000000000647572616c65787365646c6578"
|
||||
"genesis":{
|
||||
"seal":{
|
||||
"ethereum":{
|
||||
"nonce":"0x000000000000002a",
|
||||
"mixHash":"0x00000000000000000000000000000000000000647572616c65787365646c6578"
|
||||
}
|
||||
},
|
||||
"difficulty": "0x3d0900",
|
||||
"author": "0x0000000000000000000000000000000000000000",
|
||||
"timestamp": "0x00",
|
||||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"extraData": "",
|
||||
"gasLimit": "0x7a1200"
|
||||
"difficulty":"0x3d0900",
|
||||
"author":"0x0000000000000000000000000000000000000000",
|
||||
"timestamp":"0x00",
|
||||
"parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"extraData":"",
|
||||
"gasLimit":"0x7a1200"
|
||||
},
|
||||
"nodes": [
|
||||
"nodes":[
|
||||
"enode://5ddc110733f6d34101973cdef3f9b43484159acf6f816d3b1ee92bc3c98ea453e857bb1207edf0ec0242008ab3a0f9f05eeaee99d47bd414c08a5bdf4847de13@176.9.3.148:30303",
|
||||
"enode://38f074f4db8e64dfbaf87984bf290eef67772a901a7113d1b62f36216be152b8450c393d6fc562a5e38f04f99bc8f439a99010a230b1d92dc1df43bf0bd00615@176.9.3.148:30403"
|
||||
],
|
||||
"accounts": {
|
||||
"0000000000000000000000000000000000000001": {
|
||||
"balance": "1",
|
||||
"builtin": {
|
||||
"name": "ecrecover",
|
||||
"pricing": {
|
||||
"linear": {
|
||||
"base": 3000,
|
||||
"word": 0
|
||||
"accounts":{
|
||||
"0000000000000000000000000000000000000001":{
|
||||
"balance":"1",
|
||||
"builtin":{
|
||||
"name":"ecrecover",
|
||||
"pricing":{
|
||||
"linear":{
|
||||
"base":3000,
|
||||
"word":0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"0000000000000000000000000000000000000002": {
|
||||
"balance": "1",
|
||||
"builtin": {
|
||||
"name": "sha256",
|
||||
"pricing": {
|
||||
"linear": {
|
||||
"base": 60,
|
||||
"word": 12
|
||||
"0000000000000000000000000000000000000002":{
|
||||
"balance":"1",
|
||||
"builtin":{
|
||||
"name":"sha256",
|
||||
"pricing":{
|
||||
"linear":{
|
||||
"base":60,
|
||||
"word":12
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"0000000000000000000000000000000000000003": {
|
||||
"balance": "1",
|
||||
"builtin": {
|
||||
"name": "ripemd160",
|
||||
"pricing": {
|
||||
"linear": {
|
||||
"base": 600,
|
||||
"word": 120
|
||||
"0000000000000000000000000000000000000003":{
|
||||
"balance":"1",
|
||||
"builtin":{
|
||||
"name":"ripemd160",
|
||||
"pricing":{
|
||||
"linear":{
|
||||
"base":600,
|
||||
"word":120
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"0000000000000000000000000000000000000004": {
|
||||
"balance": "1",
|
||||
"builtin": {
|
||||
"name": "identity",
|
||||
"pricing": {
|
||||
"linear": {
|
||||
"base": 15,
|
||||
"word": 3
|
||||
"0000000000000000000000000000000000000004":{
|
||||
"balance":"1",
|
||||
"builtin":{
|
||||
"name":"identity",
|
||||
"pricing":{
|
||||
"linear":{
|
||||
"base":15,
|
||||
"word":3
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"0000000000000000000000000000000000000005": {
|
||||
"builtin": {
|
||||
"name": "modexp",
|
||||
"activate_at": "0x2a",
|
||||
"pricing": {
|
||||
"modexp": {
|
||||
"divisor": 20
|
||||
"0000000000000000000000000000000000000005":{
|
||||
"builtin":{
|
||||
"name":"modexp",
|
||||
"activate_at":"0x2a",
|
||||
"pricing":{
|
||||
"modexp":{
|
||||
"divisor":20
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"0000000000000000000000000000000000000006": {
|
||||
"builtin": {
|
||||
"name": "alt_bn128_add",
|
||||
"activate_at": "0x2a",
|
||||
"pricing": {
|
||||
"linear": {
|
||||
"base": 500,
|
||||
"word": 0
|
||||
"0000000000000000000000000000000000000006":{
|
||||
"builtin":{
|
||||
"name":"alt_bn128_add",
|
||||
"activate_at":"0x2a",
|
||||
"pricing":{
|
||||
"linear":{
|
||||
"base":500,
|
||||
"word":0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"0000000000000000000000000000000000000007": {
|
||||
"builtin": {
|
||||
"name": "alt_bn128_mul",
|
||||
"activate_at": "0x2a",
|
||||
"pricing": {
|
||||
"linear": {
|
||||
"base": 40000,
|
||||
"word": 0
|
||||
"0000000000000000000000000000000000000007":{
|
||||
"builtin":{
|
||||
"name":"alt_bn128_mul",
|
||||
"activate_at":"0x2a",
|
||||
"pricing":{
|
||||
"linear":{
|
||||
"base":40000,
|
||||
"word":0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"0000000000000000000000000000000000000008": {
|
||||
"builtin": {
|
||||
"name": "alt_bn128_pairing",
|
||||
"activate_at": "0x2a",
|
||||
"pricing": {
|
||||
"alt_bn128_pairing": {
|
||||
"base": 100000,
|
||||
"pair": 80000
|
||||
"0000000000000000000000000000000000000008":{
|
||||
"builtin":{
|
||||
"name":"alt_bn128_pairing",
|
||||
"activate_at":"0x2a",
|
||||
"pricing":{
|
||||
"alt_bn128_pairing":{
|
||||
"base":100000,
|
||||
"pair":80000
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,8 @@
|
||||
"eip161abcTransition": "0x7fffffffffffffff",
|
||||
"eip161dTransition": "0x7fffffffffffffff",
|
||||
"eip155Transition": 1915000,
|
||||
"eip98Transition": "0x7fffffffffffff"
|
||||
"eip98Transition": "0x7fffffffffffff",
|
||||
"eip86Transition": "0x7fffffffffffff"
|
||||
},
|
||||
"genesis": {
|
||||
"seal": {
|
||||
@@ -54,15 +55,7 @@
|
||||
"enode://fd008499e9c4662f384b3cff23438879d31ced24e2d19504c6389bc6da6c882f9c2f8dbed972f7058d7650337f54e4ba17bb49c7d11882dd1731d26a6e62e3cb@35.187.57.94:30304",
|
||||
"enode://30a1fd71f28aa6f66fe662af9ecc75f0a6980f06b71598f2b19d3dda04223fc0e53b47e40c9171d5014e9f5b59d9954de125782da592f5d95ea39066e2591d5d@104.237.131.102:30304",
|
||||
"enode://7909d51011d8a153351169f21d3a7bbedb3be1e17d38c1f2fad06504dd5aa07a00f00845835d535fe702bf379c4d7209a51f4d1b723e0ca8b8732bd21fba3b30@139.162.133.42:30303",
|
||||
"enode://a088dfb2f5305be9232e8071c5535f13718a4017e247a0b35074b807d43d99e022880c27302cdb5b1e98ad34c083dbbb483f2b17bdc66149bad037154d6ace96@139.162.127.72:30303",
|
||||
"enode://1fac84e8fe252d63764563f4f526323393b52aaaf832693f7a8a1637f6920311d7d04a7cb91945273e6c644d5c3b01a6bf8a172ae653c918e1bf8eb79e7e6baf@94.152.212.32:40404",
|
||||
"enode://3666177e0e2e56bebaef318c8ba4aed3d05ce788df1eb0e48b79fce40fcf3445feb4ccc4ce2fd4aadc3c146858e276bdef1cb63437215f17e6e5dd8c41403427@144.202.23.122:30303",
|
||||
"enode://3666177e0e2e56bebaef318c8ba4aed3d05ce788df1eb0e48b79fce40fcf3445feb4ccc4ce2fd4aadc3c146858e276bdef1cb63437215f17e6e5dd8c41403427@45.76.16.230:30303",
|
||||
"enode://78d8897b376e549c2b47664e4c81fd023b089d0a417275731760739b7f98dd639d632bb7b75e92606c7d6abbbe96f69f06d85e0a41a143f1f0a3c55ff2b1d732@144.202.101.214:30303",
|
||||
"enode://a329e2399e6d72009690faa15a82ae13ef2015bc5e72ffb22f92ea83cf3bfc9ce45d43c38b3c2289c148939d3911e9d1a9e940f41698dba54508b59489072b2a@5.135.157.4:30303",
|
||||
"enode://d79b12fc48a494ba7053bbc30cbe510060ebb3a2ce9bb4f88076303e97e31e2af263c61e797af0af20419b7268b2bfb2d2f196b57242a454035ecb6001cc69a2@94.23.49.75:30303",
|
||||
"enode://f4a1805a51cfdf5afdddf0b43b8d4b687657497311797464046dce65388b9e5a538b55bdb23ae4eac54485a81d47adad48731294efc9d73fbc9f297f625aec70@198.27.80.32:30303",
|
||||
"enode://f570df80b5589dfb0a7657adb62b93dc55e76d491694d8965c6382964e6f397ae0b8c3548ef0a108151f3b1485c75769ff203df2db7ace385ee98fdb2766ba3b@86.8.233.254:30303"
|
||||
"enode://a088dfb2f5305be9232e8071c5535f13718a4017e247a0b35074b807d43d99e022880c27302cdb5b1e98ad34c083dbbb483f2b17bdc66149bad037154d6ace96@139.162.127.72:30303"
|
||||
],
|
||||
"accounts": {
|
||||
"0000000000000000000000000000000000000001": { "balance": "1", "nonce": "1048576", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
|
||||
|
||||
@@ -9,16 +9,14 @@
|
||||
"durationLimit":"0x0d",
|
||||
"homesteadTransition":"0x118c30",
|
||||
"eip100bTransition":"0x21e88e",
|
||||
"eip649Transition":"0x21e88e",
|
||||
"blockReward":"0x1105a0185b50a80000",
|
||||
"mcip3Transition":"0x124f81",
|
||||
"mcip3MinerReward":"0xd8d726b7177a80000",
|
||||
"mcip3UbiReward":"0x2b5e3af16b1880000",
|
||||
"mcip3UbiContract":"0x00efdd5883ec628983e9063c7d969fe268bbf310",
|
||||
"mcip3DevReward":"0xc249fdd327780000",
|
||||
"mcip3DevContract":"0x00756cf8159095948496617f5fb17ed95059f536",
|
||||
"difficultyBombDelays": {
|
||||
"0x21e88e": 3000000
|
||||
}
|
||||
"mcip3DevContract":"0x00756cf8159095948496617f5fb17ed95059f536"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -35,6 +33,7 @@
|
||||
"eip160Transition":"0x21e88e",
|
||||
"eip161abcTransition":"0x21e88e",
|
||||
"eip161dTransition":"0x21e88e",
|
||||
"eip86Transition":"0x7fffffffffffff",
|
||||
"eip98Transition":"0x7fffffffffffff",
|
||||
"eip140Transition":"0x21e88e",
|
||||
"eip155Transition":"0x21e88e",
|
||||
@@ -63,15 +62,7 @@
|
||||
"enode://b58c0c71f08864c0cf7fa9dea2c4cbefae5ae7a36cc30d286603b24982d25f3ccc056b589119324c51768fc2054b8c529ecf682e06e1e9980170b93ff194ed7a@132.148.132.9:30303",
|
||||
"enode://d302f52c8789ad87ee528f1431a67f1aa646c9bec17babb4665dfb3d61de5b9119a70aa77b2147a5f28854092ba09769323c1c552a6ac6f6a34cbcf767e2d2fe@158.69.248.48:30303",
|
||||
"enode://c72564bce8331ae298fb8ece113a456e3927d7e5989c2be3e445678b3600579f722410ef9bbfe339335d676af77343cb21b5b1703b7bebc32be85fce937a2220@191.252.185.71:30303",
|
||||
"enode://e3ae4d25ee64791ff98bf17c37acf90933359f2505c00f65c84f6863231a32a94153cadb0a462e428f18f35ded6bd91cd91033d26576a28558c22678be9cfaee@5.63.158.137:35555",
|
||||
"enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@52.16.188.185:30303",
|
||||
"enode://3f1d12044546b76342d59d4a05532c14b85aa669704bfe1f864fe079415aa2c02d743e03218e57a33fb94523adb54032871a6c51b2cc5514cb7c7e35b3ed0a99@13.93.211.84:30303",
|
||||
"enode://78de8a0916848093c73790ead81d1928bec737d565119932b98c6b100d944b7a95e94f847f689fc723399d2e31129d182f7ef3863f2b4c820abbf3ab2722344d@191.235.84.50:30303",
|
||||
"enode://158f8aab45f6d19c6cbf4a089c2670541a8da11978a2f90dbf6a502a4a3bab80d288afdbeb7ec0ef6d92de563767f3b1ea9e8e334ca711e9f8e2df5a0385e8e6@13.75.154.138:30303",
|
||||
"enode://1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082@52.74.57.123:30303",
|
||||
"enode://979b7fa28feeb35a4741660a16076f1943202cb72b6af70d327f053e248bab9ba81760f39d0701ef1d8f89cc1fbd2cacba0710a12cd5314d5e0c9021aa3637f9@5.1.83.226:30303",
|
||||
"enode://d302f52c8789ad87ee528f1431a67f1aa646c9bec17babb4665dfb3d61de5b9119a70aa77b2147a5f28854092ba09769323c1c552a6ac6f6a34cbcf767e2d2fe@158.69.248.48:30303",
|
||||
"enode://c72564bce8331ae298fb8ece113a456e3927d7e5989c2be3e445678b3600579f722410ef9bbfe339335d676af77343cb21b5b1703b7bebc32be85fce937a2220@191.252.185.71:30303"
|
||||
"enode://e3ae4d25ee64791ff98bf17c37acf90933359f2505c00f65c84f6863231a32a94153cadb0a462e428f18f35ded6bd91cd91033d26576a28558c22678be9cfaee@5.63.158.137:35555"
|
||||
],
|
||||
"accounts":{
|
||||
"0000000000000000000000000000000000000001":{
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
"eip161abcTransition": "0x7fffffffffffffff",
|
||||
"eip161dTransition": "0x7fffffffffffffff",
|
||||
"eip98Transition": "0x7fffffffffffff",
|
||||
"eip86Transition": "0x7fffffffffffff",
|
||||
"eip155Transition": "0x7fffffffffffffff"
|
||||
},
|
||||
"genesis": {
|
||||
|
||||
@@ -7,15 +7,11 @@
|
||||
"minimumDifficulty": "0x020000",
|
||||
"difficultyBoundDivisor": "0x0800",
|
||||
"durationLimit": "0x0d",
|
||||
"blockReward": {
|
||||
"0": "0x4563918244F40000",
|
||||
"1700000": "0x29A2241AF62C0000"
|
||||
},
|
||||
"blockReward": "0x4563918244F40000",
|
||||
"homesteadTransition": 0,
|
||||
"eip649Reward": "0x29A2241AF62C0000",
|
||||
"eip100bTransition": 1700000,
|
||||
"difficultyBombDelays": {
|
||||
"1700000": 3000000
|
||||
}
|
||||
"eip649Transition": 1700000
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -36,6 +32,7 @@
|
||||
"eip161dTransition": 10,
|
||||
"eip155Transition": 10,
|
||||
"eip98Transition": "0x7fffffffffffff",
|
||||
"eip86Transition": "0x7fffffffffffff",
|
||||
"eip140Transition": 1700000,
|
||||
"eip211Transition": 1700000,
|
||||
"eip214Transition": 1700000,
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
"eip161abcTransition": "0x7fffffffffffffff",
|
||||
"eip161dTransition": "0x7fffffffffffffff",
|
||||
"eip155Transition": "0x0",
|
||||
"eip98Transition": "0x7fffffffffffff"
|
||||
"eip98Transition": "0x7fffffffffffff",
|
||||
"eip86Transition": "0x7fffffffffffff"
|
||||
},
|
||||
"genesis": {
|
||||
"seal": {
|
||||
|
||||
Submodule ethcore/res/ethereum/tests updated: b8a21c1936...b6011c3fb5
@@ -6,15 +6,11 @@
|
||||
"minimumDifficulty": "0x020000",
|
||||
"difficultyBoundDivisor": "0x0800",
|
||||
"durationLimit": "0x0d",
|
||||
"blockReward": {
|
||||
"0x0": "0x4563918244F40000",
|
||||
"0x5": "0x29A2241AF62C0000"
|
||||
},
|
||||
"blockReward": "0x4563918244F40000",
|
||||
"homesteadTransition": "0",
|
||||
"eip649Reward": "0x29A2241AF62C0000",
|
||||
"eip100bTransition": "5",
|
||||
"difficultyBombDelays": {
|
||||
"5": 3000000
|
||||
}
|
||||
"eip649Transition": "5"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
{
|
||||
"name": "DevelopmentChain",
|
||||
"engine": {
|
||||
"instantSeal": {
|
||||
"params": {}
|
||||
}
|
||||
"instantSeal": null
|
||||
},
|
||||
"params": {
|
||||
"gasLimitBoundDivisor": "0x0400",
|
||||
@@ -18,6 +16,7 @@
|
||||
"eip161dTransition": "0x0",
|
||||
"eip155Transition": "0x0",
|
||||
"eip98Transition": "0x7fffffffffffff",
|
||||
"eip86Transition": "0x7fffffffffffff",
|
||||
"maxCodeSize": 24576,
|
||||
"maxCodeSizeTransition": "0x0",
|
||||
"eip140Transition": "0x0",
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
"maximumExtraDataSize": "0x20",
|
||||
"minGasLimit": "0x1388",
|
||||
"networkID" : "0x2",
|
||||
"eip86Transition": "0x7fffffffffffff",
|
||||
"eip140Transition": "0x0",
|
||||
"eip211Transition": "0x0",
|
||||
"eip214Transition": "0x0",
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
"minGasLimit": "0x1388",
|
||||
"networkID" : "0x69",
|
||||
"gasLimitBoundDivisor": "0x0400",
|
||||
"transactionPermissionContract": "0x0000000000000000000000000000000000000005",
|
||||
"transactionPermissionContractTransition": "1"
|
||||
"transactionPermissionContract": "0x0000000000000000000000000000000000000005"
|
||||
},
|
||||
"genesis": {
|
||||
"seal": {
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
"minGasLimit": "0x1388",
|
||||
"networkID" : "0x69",
|
||||
"gasLimitBoundDivisor": "0x0400",
|
||||
"transactionPermissionContract": "0x0000000000000000000000000000000000000005",
|
||||
"transactionPermissionContractTransition": "1"
|
||||
"transactionPermissionContract": "0x0000000000000000000000000000000000000005"
|
||||
},
|
||||
"genesis": {
|
||||
"seal": {
|
||||
|
||||
Submodule ethcore/res/wasm-tests updated: d17bfb6962...474110de59
@@ -10,13 +10,12 @@ ethcore = { path = ".." }
|
||||
ethcore-io = { path = "../../util/io" }
|
||||
ethcore-private-tx = { path = "../private-tx" }
|
||||
ethcore-sync = { path = "../sync" }
|
||||
ethereum-types = "0.4"
|
||||
kvdb = "0.1"
|
||||
log = "0.4"
|
||||
kvdb = { git = "https://github.com/paritytech/parity-common" }
|
||||
log = "0.3"
|
||||
stop-guard = { path = "../../util/stop-guard" }
|
||||
trace-time = "0.1"
|
||||
trace-time = { path = "../../util/trace-time" }
|
||||
|
||||
[dev-dependencies]
|
||||
ethcore = { path = "..", features = ["test-helpers"] }
|
||||
tempdir = "0.3"
|
||||
kvdb-rocksdb = "0.1.3"
|
||||
kvdb-rocksdb = { git = "https://github.com/paritytech/parity-common" }
|
||||
|
||||
@@ -19,7 +19,6 @@ extern crate ethcore;
|
||||
extern crate ethcore_io as io;
|
||||
extern crate ethcore_private_tx;
|
||||
extern crate ethcore_sync as sync;
|
||||
extern crate ethereum_types;
|
||||
extern crate kvdb;
|
||||
extern crate stop_guard;
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ use std::path::Path;
|
||||
use std::time::Duration;
|
||||
|
||||
use ansi_term::Colour;
|
||||
use ethereum_types::H256;
|
||||
use io::{IoContext, TimerToken, IoHandler, IoService, IoError};
|
||||
use stop_guard::StopGuard;
|
||||
|
||||
@@ -55,24 +54,12 @@ impl PrivateTxService {
|
||||
}
|
||||
|
||||
impl PrivateTxHandler for PrivateTxService {
|
||||
fn import_private_transaction(&self, rlp: &[u8]) -> Result<H256, String> {
|
||||
match self.provider.import_private_transaction(rlp) {
|
||||
Ok(import_result) => Ok(import_result),
|
||||
Err(err) => {
|
||||
warn!(target: "privatetx", "Unable to import private transaction packet: {}", err);
|
||||
bail!(err.to_string())
|
||||
}
|
||||
}
|
||||
fn import_private_transaction(&self, rlp: &[u8]) -> Result<(), String> {
|
||||
self.provider.import_private_transaction(rlp).map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
fn import_signed_private_transaction(&self, rlp: &[u8]) -> Result<H256, String> {
|
||||
match self.provider.import_signed_private_transaction(rlp) {
|
||||
Ok(import_result) => Ok(import_result),
|
||||
Err(err) => {
|
||||
warn!(target: "privatetx", "Unable to import signed private transaction packet: {}", err);
|
||||
bail!(err.to_string())
|
||||
}
|
||||
}
|
||||
fn import_signed_private_transaction(&self, rlp: &[u8]) -> Result<(), String> {
|
||||
self.provider.import_signed_private_transaction(rlp).map_err(|e| e.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +95,6 @@ impl ClientService {
|
||||
let pruning = config.pruning;
|
||||
let client = Client::new(config, &spec, blockchain_db.clone(), miner.clone(), io_service.channel())?;
|
||||
miner.set_io_channel(io_service.channel());
|
||||
miner.set_in_chain_checker(&client.clone());
|
||||
|
||||
let snapshot_params = SnapServiceParams {
|
||||
engine: spec.engine.clone(),
|
||||
|
||||
@@ -14,22 +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/>.
|
||||
|
||||
//! Base data structure of this module is `Block`.
|
||||
//!
|
||||
//! Blocks can be produced by a local node or they may be received from the network.
|
||||
//!
|
||||
//! To create a block locally, we start with an `OpenBlock`. This block is mutable
|
||||
//! and can be appended to with transactions and uncles.
|
||||
//!
|
||||
//! When ready, `OpenBlock` can be closed and turned into a `ClosedBlock`. A `ClosedBlock` can
|
||||
//! be reopend again by a miner under certain circumstances. On block close, state commit is
|
||||
//! performed.
|
||||
//!
|
||||
//! `LockedBlock` is a version of a `ClosedBlock` that cannot be reopened. It can be sealed
|
||||
//! using an engine.
|
||||
//!
|
||||
//! `ExecutedBlock` is an underlaying data structure used by all structs above to store block
|
||||
//! related info.
|
||||
//! Blockchain block.
|
||||
|
||||
use std::cmp;
|
||||
use std::collections::HashSet;
|
||||
@@ -40,7 +25,7 @@ use engines::EthEngine;
|
||||
use error::{Error, BlockError};
|
||||
use ethereum_types::{H256, U256, Address, Bloom};
|
||||
use factory::Factories;
|
||||
use hash::keccak;
|
||||
use hash::{keccak, KECCAK_NULL_RLP, KECCAK_EMPTY_LIST_RLP};
|
||||
use header::{Header, ExtendedHeader};
|
||||
use receipt::{Receipt, TransactionOutcome};
|
||||
use rlp::{Rlp, RlpStream, Encodable, Decodable, DecoderError, encode_list};
|
||||
@@ -51,6 +36,7 @@ use transaction::{UnverifiedTransaction, SignedTransaction, Error as Transaction
|
||||
use triehash::ordered_trie_root;
|
||||
use unexpected::{Mismatch, OutOfBounds};
|
||||
use verification::PreverifiedBlock;
|
||||
use views::BlockView;
|
||||
use vm::{EnvInfo, LastHashes};
|
||||
|
||||
/// A block, encoded as it is on the block chain.
|
||||
@@ -65,6 +51,11 @@ pub struct Block {
|
||||
}
|
||||
|
||||
impl Block {
|
||||
/// Returns true if the given bytes form a valid encoding of a block in RLP.
|
||||
pub fn is_good(b: &[u8]) -> bool {
|
||||
Rlp::new(b).as_val::<Block>().is_ok()
|
||||
}
|
||||
|
||||
/// Get the RLP-encoding of the block with the seal.
|
||||
pub fn rlp_bytes(&self) -> Bytes {
|
||||
let mut block_rlp = RlpStream::new_list(3);
|
||||
@@ -94,22 +85,16 @@ impl Decodable for Block {
|
||||
/// An internal type for a block's common elements.
|
||||
#[derive(Clone)]
|
||||
pub struct ExecutedBlock {
|
||||
/// Executed block header.
|
||||
pub header: Header,
|
||||
/// Executed transactions.
|
||||
pub transactions: Vec<SignedTransaction>,
|
||||
/// Uncles.
|
||||
pub uncles: Vec<Header>,
|
||||
/// Transaction receipts.
|
||||
pub receipts: Vec<Receipt>,
|
||||
/// Hashes of already executed transactions.
|
||||
pub transactions_set: HashSet<H256>,
|
||||
/// Underlaying state.
|
||||
pub state: State<StateDB>,
|
||||
/// Transaction traces.
|
||||
pub traces: Tracing,
|
||||
/// Hashes of last 256 blocks.
|
||||
pub last_hashes: Arc<LastHashes>,
|
||||
header: Header,
|
||||
transactions: Vec<SignedTransaction>,
|
||||
uncles: Vec<Header>,
|
||||
receipts: Vec<Receipt>,
|
||||
transactions_set: HashSet<H256>,
|
||||
state: State<StateDB>,
|
||||
traces: Tracing,
|
||||
last_hashes: Arc<LastHashes>,
|
||||
is_finalized: bool,
|
||||
metadata: Option<Vec<u8>>,
|
||||
}
|
||||
|
||||
impl ExecutedBlock {
|
||||
@@ -128,6 +113,8 @@ impl ExecutedBlock {
|
||||
Tracing::Disabled
|
||||
},
|
||||
last_hashes: last_hashes,
|
||||
is_finalized: false,
|
||||
metadata: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,14 +169,20 @@ pub trait IsBlock {
|
||||
/// Get all information on receipts in this block.
|
||||
fn receipts(&self) -> &[Receipt] { &self.block().receipts }
|
||||
|
||||
/// Get all information concerning transaction tracing in this block.
|
||||
fn traces(&self) -> &Tracing { &self.block().traces }
|
||||
|
||||
/// Get all uncles in this block.
|
||||
fn uncles(&self) -> &[Header] { &self.block().uncles }
|
||||
|
||||
/// Get tracing enabled flag for this block.
|
||||
fn tracing_enabled(&self) -> bool { self.block().traces.is_enabled() }
|
||||
}
|
||||
|
||||
/// Trait for an object that owns an `ExecutedBlock`
|
||||
/// Trait for a object that has a state database.
|
||||
pub trait Drain {
|
||||
/// Returns `ExecutedBlock`
|
||||
fn drain(self) -> ExecutedBlock;
|
||||
/// Drop this object and return the underlying database.
|
||||
fn drain(self) -> StateDB;
|
||||
}
|
||||
|
||||
impl IsBlock for ExecutedBlock {
|
||||
@@ -216,6 +209,26 @@ impl ::parity_machine::Transactions for ExecutedBlock {
|
||||
}
|
||||
}
|
||||
|
||||
impl ::parity_machine::Finalizable for ExecutedBlock {
|
||||
fn is_finalized(&self) -> bool {
|
||||
self.is_finalized
|
||||
}
|
||||
|
||||
fn mark_finalized(&mut self) {
|
||||
self.is_finalized = true;
|
||||
}
|
||||
}
|
||||
|
||||
impl ::parity_machine::WithMetadata for ExecutedBlock {
|
||||
fn metadata(&self) -> Option<&[u8]> {
|
||||
self.metadata.as_ref().map(|v| v.as_ref())
|
||||
}
|
||||
|
||||
fn set_metadata(&mut self, value: Option<Vec<u8>>) {
|
||||
self.metadata = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// Block that is ready for transactions to be added.
|
||||
///
|
||||
/// It's a bit like a Vec<Transaction>, except that whenever a transaction is pushed, we execute it and
|
||||
@@ -232,7 +245,10 @@ pub struct OpenBlock<'x> {
|
||||
#[derive(Clone)]
|
||||
pub struct ClosedBlock {
|
||||
block: ExecutedBlock,
|
||||
uncle_bytes: Bytes,
|
||||
unclosed_state: State<StateDB>,
|
||||
unclosed_finalization_state: bool,
|
||||
unclosed_metadata: Option<Vec<u8>>,
|
||||
}
|
||||
|
||||
/// Just like `ClosedBlock` except that we can't reopen it and it's faster.
|
||||
@@ -241,6 +257,7 @@ pub struct ClosedBlock {
|
||||
#[derive(Clone)]
|
||||
pub struct LockedBlock {
|
||||
block: ExecutedBlock,
|
||||
uncle_bytes: Bytes,
|
||||
}
|
||||
|
||||
/// A block that has a valid seal.
|
||||
@@ -248,6 +265,7 @@ pub struct LockedBlock {
|
||||
/// The block's header has valid seal arguments. The block cannot be reversed into a `ClosedBlock` or `OpenBlock`.
|
||||
pub struct SealedBlock {
|
||||
block: ExecutedBlock,
|
||||
uncle_bytes: Bytes,
|
||||
}
|
||||
|
||||
impl<'x> OpenBlock<'x> {
|
||||
@@ -391,25 +409,22 @@ impl<'x> OpenBlock<'x> {
|
||||
}
|
||||
|
||||
/// Turn this into a `ClosedBlock`.
|
||||
pub fn close(self) -> Result<ClosedBlock, Error> {
|
||||
let unclosed_state = self.block.state.clone();
|
||||
let locked = self.close_and_lock()?;
|
||||
|
||||
Ok(ClosedBlock {
|
||||
block: locked.block,
|
||||
unclosed_state,
|
||||
})
|
||||
}
|
||||
|
||||
/// Turn this into a `LockedBlock`.
|
||||
pub fn close_and_lock(self) -> Result<LockedBlock, Error> {
|
||||
pub fn close(self) -> ClosedBlock {
|
||||
let mut s = self;
|
||||
|
||||
s.engine.on_close_block(&mut s.block)?;
|
||||
s.block.state.commit()?;
|
||||
let unclosed_state = s.block.state.clone();
|
||||
let unclosed_metadata = s.block.metadata.clone();
|
||||
let unclosed_finalization_state = s.block.is_finalized;
|
||||
|
||||
if let Err(e) = s.engine.on_close_block(&mut s.block) {
|
||||
warn!("Encountered error on closing the block: {}", e);
|
||||
}
|
||||
|
||||
if let Err(e) = s.block.state.commit() {
|
||||
warn!("Encountered error on state commit: {}", e);
|
||||
}
|
||||
s.block.header.set_transactions_root(ordered_trie_root(s.block.transactions.iter().map(|e| e.rlp_bytes())));
|
||||
let uncle_bytes = encode_list(&s.block.uncles);
|
||||
let uncle_bytes = encode_list(&s.block.uncles).into_vec();
|
||||
s.block.header.set_uncles_hash(keccak(&uncle_bytes));
|
||||
s.block.header.set_state_root(s.block.state.root().clone());
|
||||
s.block.header.set_receipts_root(ordered_trie_root(s.block.receipts.iter().map(|r| r.rlp_bytes())));
|
||||
@@ -419,9 +434,49 @@ impl<'x> OpenBlock<'x> {
|
||||
}));
|
||||
s.block.header.set_gas_used(s.block.receipts.last().map_or_else(U256::zero, |r| r.gas_used));
|
||||
|
||||
Ok(LockedBlock {
|
||||
ClosedBlock {
|
||||
block: s.block,
|
||||
})
|
||||
uncle_bytes,
|
||||
unclosed_state,
|
||||
unclosed_metadata,
|
||||
unclosed_finalization_state,
|
||||
}
|
||||
}
|
||||
|
||||
/// Turn this into a `LockedBlock`.
|
||||
pub fn close_and_lock(self) -> LockedBlock {
|
||||
let mut s = self;
|
||||
|
||||
if let Err(e) = s.engine.on_close_block(&mut s.block) {
|
||||
warn!("Encountered error on closing the block: {}", e);
|
||||
}
|
||||
|
||||
if let Err(e) = s.block.state.commit() {
|
||||
warn!("Encountered error on state commit: {}", e);
|
||||
}
|
||||
|
||||
if s.block.header.transactions_root().is_zero() || s.block.header.transactions_root() == &KECCAK_NULL_RLP {
|
||||
s.block.header.set_transactions_root(ordered_trie_root(s.block.transactions.iter().map(|e| e.rlp_bytes())));
|
||||
}
|
||||
let uncle_bytes = encode_list(&s.block.uncles).into_vec();
|
||||
if s.block.header.uncles_hash().is_zero() || s.block.header.uncles_hash() == &KECCAK_EMPTY_LIST_RLP {
|
||||
s.block.header.set_uncles_hash(keccak(&uncle_bytes));
|
||||
}
|
||||
if s.block.header.receipts_root().is_zero() || s.block.header.receipts_root() == &KECCAK_NULL_RLP {
|
||||
s.block.header.set_receipts_root(ordered_trie_root(s.block.receipts.iter().map(|r| r.rlp_bytes())));
|
||||
}
|
||||
|
||||
s.block.header.set_state_root(s.block.state.root().clone());
|
||||
s.block.header.set_log_bloom(s.block.receipts.iter().fold(Bloom::zero(), |mut b, r| {
|
||||
b.accrue_bloom(&r.log_bloom);
|
||||
b
|
||||
}));
|
||||
s.block.header.set_gas_used(s.block.receipts.last().map_or_else(U256::zero, |r| r.gas_used));
|
||||
|
||||
LockedBlock {
|
||||
block: s.block,
|
||||
uncle_bytes,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -433,11 +488,11 @@ impl<'x> IsBlock for OpenBlock<'x> {
|
||||
fn block(&self) -> &ExecutedBlock { &self.block }
|
||||
}
|
||||
|
||||
impl IsBlock for ClosedBlock {
|
||||
impl<'x> IsBlock for ClosedBlock {
|
||||
fn block(&self) -> &ExecutedBlock { &self.block }
|
||||
}
|
||||
|
||||
impl IsBlock for LockedBlock {
|
||||
impl<'x> IsBlock for LockedBlock {
|
||||
fn block(&self) -> &ExecutedBlock { &self.block }
|
||||
}
|
||||
|
||||
@@ -449,6 +504,7 @@ impl ClosedBlock {
|
||||
pub fn lock(self) -> LockedBlock {
|
||||
LockedBlock {
|
||||
block: self.block,
|
||||
uncle_bytes: self.uncle_bytes,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,6 +513,8 @@ impl ClosedBlock {
|
||||
// revert rewards (i.e. set state back at last transaction's state).
|
||||
let mut block = self.block;
|
||||
block.state = self.unclosed_state;
|
||||
block.metadata = self.unclosed_metadata;
|
||||
block.is_finalized = self.unclosed_finalization_state;
|
||||
OpenBlock {
|
||||
block: block,
|
||||
engine: engine,
|
||||
@@ -465,6 +523,7 @@ impl ClosedBlock {
|
||||
}
|
||||
|
||||
impl LockedBlock {
|
||||
|
||||
/// Removes outcomes from receipts and updates the receipt root.
|
||||
///
|
||||
/// This is done after the block is enacted for historical reasons.
|
||||
@@ -497,9 +556,7 @@ impl LockedBlock {
|
||||
}
|
||||
s.block.header.set_seal(seal);
|
||||
s.block.header.compute_hash();
|
||||
Ok(SealedBlock {
|
||||
block: s.block
|
||||
})
|
||||
Ok(SealedBlock { block: s.block, uncle_bytes: s.uncle_bytes })
|
||||
}
|
||||
|
||||
/// Provide a valid seal in order to turn this into a `SealedBlock`.
|
||||
@@ -509,22 +566,23 @@ impl LockedBlock {
|
||||
self,
|
||||
engine: &EthEngine,
|
||||
seal: Vec<Bytes>,
|
||||
) -> Result<SealedBlock, Error> {
|
||||
) -> Result<SealedBlock, (Error, LockedBlock)> {
|
||||
let mut s = self;
|
||||
s.block.header.set_seal(seal);
|
||||
s.block.header.compute_hash();
|
||||
|
||||
// TODO: passing state context to avoid engines owning it?
|
||||
engine.verify_local_seal(&s.block.header)?;
|
||||
Ok(SealedBlock {
|
||||
block: s.block
|
||||
})
|
||||
match engine.verify_local_seal(&s.block.header) {
|
||||
Err(e) => Err((e, s)),
|
||||
_ => Ok(SealedBlock { block: s.block, uncle_bytes: s.uncle_bytes }),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Drain for LockedBlock {
|
||||
fn drain(self) -> ExecutedBlock {
|
||||
self.block
|
||||
/// Drop this object and return the underlieing database.
|
||||
fn drain(self) -> StateDB {
|
||||
self.block.state.drop().1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -534,14 +592,15 @@ impl SealedBlock {
|
||||
let mut block_rlp = RlpStream::new_list(3);
|
||||
block_rlp.append(&self.block.header);
|
||||
block_rlp.append_list(&self.block.transactions);
|
||||
block_rlp.append_list(&self.block.uncles);
|
||||
block_rlp.append_raw(&self.uncle_bytes, 1);
|
||||
block_rlp.out()
|
||||
}
|
||||
}
|
||||
|
||||
impl Drain for SealedBlock {
|
||||
fn drain(self) -> ExecutedBlock {
|
||||
self.block
|
||||
/// Drop this object and return the underlieing database.
|
||||
fn drain(self) -> StateDB {
|
||||
self.block.state.drop().1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -564,7 +623,7 @@ fn enact(
|
||||
ancestry: &mut Iterator<Item=ExtendedHeader>,
|
||||
) -> Result<LockedBlock, Error> {
|
||||
{
|
||||
if ::log::max_level() >= ::log::Level::Trace {
|
||||
if ::log::max_log_level() >= ::log::LogLevel::Trace {
|
||||
let s = State::from_existing(db.boxed_clone(), parent.state_root().clone(), engine.account_start_nonce(parent.number() + 1), factories.clone())?;
|
||||
trace!(target: "enact", "num={}, root={}, author={}, author_balance={}\n",
|
||||
header.number(), s.root(), header.author(), s.balance(&header.author())?);
|
||||
@@ -592,7 +651,7 @@ fn enact(
|
||||
b.push_uncle(u)?;
|
||||
}
|
||||
|
||||
b.close_and_lock()
|
||||
Ok(b.close_and_lock())
|
||||
}
|
||||
|
||||
/// Enact the block given by `block_bytes` using `engine` on the database `db` with given `parent` block header
|
||||
@@ -607,11 +666,12 @@ pub fn enact_verified(
|
||||
is_epoch_begin: bool,
|
||||
ancestry: &mut Iterator<Item=ExtendedHeader>,
|
||||
) -> Result<LockedBlock, Error> {
|
||||
let view = view!(BlockView, &block.bytes);
|
||||
|
||||
enact(
|
||||
block.header,
|
||||
block.transactions,
|
||||
block.uncles,
|
||||
view.uncles(),
|
||||
engine,
|
||||
tracing,
|
||||
db,
|
||||
@@ -637,11 +697,10 @@ mod tests {
|
||||
use ethereum_types::Address;
|
||||
use std::sync::Arc;
|
||||
use transaction::SignedTransaction;
|
||||
use verification::queue::kind::blocks::Unverified;
|
||||
|
||||
/// Enact the block given by `block_bytes` using `engine` on the database `db` with given `parent` block header
|
||||
fn enact_bytes(
|
||||
block_bytes: Vec<u8>,
|
||||
block_bytes: &[u8],
|
||||
engine: &EthEngine,
|
||||
tracing: bool,
|
||||
db: StateDB,
|
||||
@@ -649,10 +708,10 @@ mod tests {
|
||||
last_hashes: Arc<LastHashes>,
|
||||
factories: Factories,
|
||||
) -> Result<LockedBlock, Error> {
|
||||
let block = Unverified::from_rlp(block_bytes)?;
|
||||
let header = block.header;
|
||||
let block = view!(BlockView, block_bytes);
|
||||
let header = block.header();
|
||||
let transactions: Result<Vec<_>, Error> = block
|
||||
.transactions
|
||||
.transactions()
|
||||
.into_iter()
|
||||
.map(SignedTransaction::new)
|
||||
.map(|r| r.map_err(Into::into))
|
||||
@@ -660,7 +719,7 @@ mod tests {
|
||||
let transactions = transactions?;
|
||||
|
||||
{
|
||||
if ::log::max_level() >= ::log::Level::Trace {
|
||||
if ::log::max_log_level() >= ::log::LogLevel::Trace {
|
||||
let s = State::from_existing(db.boxed_clone(), parent.state_root().clone(), engine.account_start_nonce(parent.number() + 1), factories.clone())?;
|
||||
trace!(target: "enact", "num={}, root={}, author={}, author_balance={}\n",
|
||||
header.number(), s.root(), header.author(), s.balance(&header.author())?);
|
||||
@@ -684,16 +743,16 @@ mod tests {
|
||||
b.populate_from(&header);
|
||||
b.push_transactions(transactions)?;
|
||||
|
||||
for u in block.uncles {
|
||||
b.push_uncle(u)?;
|
||||
for u in &block.uncles() {
|
||||
b.push_uncle(u.clone())?;
|
||||
}
|
||||
|
||||
b.close_and_lock()
|
||||
Ok(b.close_and_lock())
|
||||
}
|
||||
|
||||
/// Enact the block given by `block_bytes` using `engine` on the database `db` with given `parent` block header. Seal the block aferwards
|
||||
fn enact_and_seal(
|
||||
block_bytes: Vec<u8>,
|
||||
block_bytes: &[u8],
|
||||
engine: &EthEngine,
|
||||
tracing: bool,
|
||||
db: StateDB,
|
||||
@@ -701,9 +760,8 @@ mod tests {
|
||||
last_hashes: Arc<LastHashes>,
|
||||
factories: Factories,
|
||||
) -> Result<SealedBlock, Error> {
|
||||
let header = Unverified::from_rlp(block_bytes.clone())?.header;
|
||||
Ok(enact_bytes(block_bytes, engine, tracing, db, parent, last_hashes, factories)?
|
||||
.seal(engine, header.seal().to_vec())?)
|
||||
let header = view!(BlockView, block_bytes).header_view();
|
||||
Ok(enact_bytes(block_bytes, engine, tracing, db, parent, last_hashes, factories)?.seal(engine, header.seal())?)
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -714,7 +772,7 @@ mod tests {
|
||||
let db = spec.ensure_db_good(get_temp_state_db(), &Default::default()).unwrap();
|
||||
let last_hashes = Arc::new(vec![genesis_header.hash()]);
|
||||
let b = OpenBlock::new(&*spec.engine, Default::default(), false, db, &genesis_header, last_hashes, Address::zero(), (3141562.into(), 31415620.into()), vec![], false, &mut Vec::new().into_iter()).unwrap();
|
||||
let b = b.close_and_lock().unwrap();
|
||||
let b = b.close_and_lock();
|
||||
let _ = b.seal(&*spec.engine, vec![]);
|
||||
}
|
||||
|
||||
@@ -728,16 +786,16 @@ mod tests {
|
||||
let db = spec.ensure_db_good(get_temp_state_db(), &Default::default()).unwrap();
|
||||
let last_hashes = Arc::new(vec![genesis_header.hash()]);
|
||||
let b = OpenBlock::new(engine, Default::default(), false, db, &genesis_header, last_hashes.clone(), Address::zero(), (3141562.into(), 31415620.into()), vec![], false, &mut Vec::new().into_iter()).unwrap()
|
||||
.close_and_lock().unwrap().seal(engine, vec![]).unwrap();
|
||||
.close_and_lock().seal(engine, vec![]).unwrap();
|
||||
let orig_bytes = b.rlp_bytes();
|
||||
let orig_db = b.drain().state.drop().1;
|
||||
let orig_db = b.drain();
|
||||
|
||||
let db = spec.ensure_db_good(get_temp_state_db(), &Default::default()).unwrap();
|
||||
let e = enact_and_seal(orig_bytes.clone(), engine, false, db, &genesis_header, last_hashes, Default::default()).unwrap();
|
||||
let e = enact_and_seal(&orig_bytes, engine, false, db, &genesis_header, last_hashes, Default::default()).unwrap();
|
||||
|
||||
assert_eq!(e.rlp_bytes(), orig_bytes);
|
||||
|
||||
let db = e.drain().state.drop().1;
|
||||
let db = e.drain();
|
||||
assert_eq!(orig_db.journal_db().keys(), db.journal_db().keys());
|
||||
assert!(orig_db.journal_db().keys().iter().filter(|k| orig_db.journal_db().get(k.0) != db.journal_db().get(k.0)).next() == None);
|
||||
}
|
||||
@@ -758,20 +816,20 @@ mod tests {
|
||||
uncle2_header.set_extra_data(b"uncle2".to_vec());
|
||||
open_block.push_uncle(uncle1_header).unwrap();
|
||||
open_block.push_uncle(uncle2_header).unwrap();
|
||||
let b = open_block.close_and_lock().unwrap().seal(engine, vec![]).unwrap();
|
||||
let b = open_block.close_and_lock().seal(engine, vec![]).unwrap();
|
||||
|
||||
let orig_bytes = b.rlp_bytes();
|
||||
let orig_db = b.drain().state.drop().1;
|
||||
let orig_db = b.drain();
|
||||
|
||||
let db = spec.ensure_db_good(get_temp_state_db(), &Default::default()).unwrap();
|
||||
let e = enact_and_seal(orig_bytes.clone(), engine, false, db, &genesis_header, last_hashes, Default::default()).unwrap();
|
||||
let e = enact_and_seal(&orig_bytes, engine, false, db, &genesis_header, last_hashes, Default::default()).unwrap();
|
||||
|
||||
let bytes = e.rlp_bytes();
|
||||
assert_eq!(bytes, orig_bytes);
|
||||
let uncles = view!(BlockView, &bytes).uncles();
|
||||
assert_eq!(uncles[1].extra_data(), b"uncle2");
|
||||
|
||||
let db = e.drain().state.drop().1;
|
||||
let db = e.drain();
|
||||
assert_eq!(orig_db.journal_db().keys(), db.journal_db().keys());
|
||||
assert!(orig_db.journal_db().keys().iter().filter(|k| orig_db.journal_db().get(k.0) != db.journal_db().get(k.0)).next() == None);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ use encoded;
|
||||
use engines::epoch::{Transition as EpochTransition, PendingTransition as PendingEpochTransition};
|
||||
use engines::ForkChoice;
|
||||
use ethereum_types::{H256, Bloom, BloomRef, U256};
|
||||
use error::Error as EthcoreError;
|
||||
use header::*;
|
||||
use heapsize::HeapSizeOf;
|
||||
use itertools::Itertools;
|
||||
@@ -61,21 +60,6 @@ pub trait BlockChainDB: Send + Sync {
|
||||
|
||||
/// Trace blooms database.
|
||||
fn trace_blooms(&self) -> &blooms_db::Database;
|
||||
|
||||
/// Restore the DB from the given path
|
||||
fn restore(&self, new_db: &str) -> Result<(), EthcoreError> {
|
||||
// First, close the Blooms databases
|
||||
self.blooms().close()?;
|
||||
self.trace_blooms().close()?;
|
||||
|
||||
// Restore the key_value DB
|
||||
self.key_value().restore(new_db)?;
|
||||
|
||||
// Re-open the Blooms databases
|
||||
self.blooms().reopen()?;
|
||||
self.trace_blooms().reopen()?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Generic database handler. This trait contains one function `open`. When called, it opens database with a
|
||||
@@ -286,7 +270,7 @@ impl BlockProvider for BlockChain {
|
||||
|
||||
// Read from DB and populate cache
|
||||
let b = self.db.key_value().get(db::COL_HEADERS, hash)
|
||||
.expect("Low level database error when fetching block header data. Some issue with disk?")?;
|
||||
.expect("Low level database error. Some issue with disk?")?;
|
||||
|
||||
let header = encoded::Header::new(decompress(&b, blocks_swapper()).into_vec());
|
||||
let mut write = self.block_headers.write();
|
||||
@@ -316,7 +300,7 @@ impl BlockProvider for BlockChain {
|
||||
|
||||
// Read from DB and populate cache
|
||||
let b = self.db.key_value().get(db::COL_BODIES, hash)
|
||||
.expect("Low level database error when fetching block body data. Some issue with disk?")?;
|
||||
.expect("Low level database error. Some issue with disk?")?;
|
||||
|
||||
let body = encoded::Body::new(decompress(&b, blocks_swapper()).into_vec());
|
||||
let mut write = self.block_bodies.write();
|
||||
@@ -362,7 +346,7 @@ impl BlockProvider for BlockChain {
|
||||
I: Iterator<Item = B> {
|
||||
self.db.blooms()
|
||||
.filter(from_block, to_block, blooms)
|
||||
.expect("Low level database error when searching blooms. Some issue with disk?")
|
||||
.expect("Low level database error. Some issue with disk?")
|
||||
}
|
||||
|
||||
/// Returns logs matching given filter. The order of logs returned will be the same as the order of the blocks
|
||||
@@ -466,7 +450,9 @@ impl<'a> Iterator for AncestryWithMetadataIter<'a> {
|
||||
Some(ExtendedHeader {
|
||||
parent_total_difficulty: details.total_difficulty - *header.difficulty(),
|
||||
is_finalized: details.is_finalized,
|
||||
header,
|
||||
metadata: details.metadata,
|
||||
|
||||
header: header,
|
||||
})
|
||||
},
|
||||
_ => {
|
||||
@@ -550,9 +536,7 @@ impl BlockChain {
|
||||
};
|
||||
|
||||
// load best block
|
||||
let best_block_hash = match bc.db.key_value().get(db::COL_EXTRA, b"best")
|
||||
.expect("Low-level database error when fetching 'best' block. Some issue with disk?")
|
||||
{
|
||||
let best_block_hash = match bc.db.key_value().get(db::COL_EXTRA, b"best").unwrap() {
|
||||
Some(best) => {
|
||||
H256::from_slice(&best)
|
||||
}
|
||||
@@ -569,6 +553,7 @@ impl BlockChain {
|
||||
parent: header.parent_hash(),
|
||||
children: vec![],
|
||||
is_finalized: false,
|
||||
metadata: None,
|
||||
};
|
||||
|
||||
let mut batch = DBTransaction::new();
|
||||
@@ -579,18 +564,15 @@ impl BlockChain {
|
||||
batch.write(db::COL_EXTRA, &header.number(), &hash);
|
||||
|
||||
batch.put(db::COL_EXTRA, b"best", &hash);
|
||||
bc.db.key_value().write(batch).expect("Low level database error when fetching 'best' block. Some issue with disk?");
|
||||
bc.db.key_value().write(batch).expect("Low level database error. Some issue with disk?");
|
||||
hash
|
||||
}
|
||||
};
|
||||
|
||||
{
|
||||
// Fetch best block details
|
||||
let best_block_total_difficulty = bc.block_details(&best_block_hash)
|
||||
.expect("Best block is from a known block hash; a known block hash always comes with a known block detail; qed")
|
||||
.total_difficulty;
|
||||
let best_block_rlp = bc.block(&best_block_hash)
|
||||
.expect("Best block is from a known block hash; qed");
|
||||
let best_block_total_difficulty = bc.block_details(&best_block_hash).unwrap().total_difficulty;
|
||||
let best_block_rlp = bc.block(&best_block_hash).unwrap();
|
||||
|
||||
// and write them
|
||||
let mut best_block = bc.best_block.write();
|
||||
@@ -604,12 +586,8 @@ impl BlockChain {
|
||||
{
|
||||
let best_block_number = bc.best_block.read().header.number();
|
||||
// Fetch first and best ancient block details
|
||||
let raw_first = bc.db.key_value().get(db::COL_EXTRA, b"first")
|
||||
.expect("Low level database error when fetching 'first' block. Some issue with disk?")
|
||||
.map(|v| v.into_vec());
|
||||
let mut best_ancient = bc.db.key_value().get(db::COL_EXTRA, b"ancient")
|
||||
.expect("Low level database error when fetching 'best ancient' block. Some issue with disk?")
|
||||
.map(|h| H256::from_slice(&h));
|
||||
let raw_first = bc.db.key_value().get(db::COL_EXTRA, b"first").unwrap().map(|v| v.into_vec());
|
||||
let mut best_ancient = bc.db.key_value().get(db::COL_EXTRA, b"ancient").unwrap().map(|h| H256::from_slice(&h));
|
||||
let best_ancient_number;
|
||||
if best_ancient.is_none() && best_block_number > 1 && bc.block_hash(1).is_none() {
|
||||
best_ancient = Some(bc.genesis_hash());
|
||||
@@ -640,7 +618,7 @@ impl BlockChain {
|
||||
trace!("First block calculated: {:?}", hash);
|
||||
let mut batch = db.key_value().transaction();
|
||||
batch.put(db::COL_EXTRA, b"first", &hash);
|
||||
db.key_value().write(batch).expect("Low level database error when writing 'first' block. Some issue with disk?");
|
||||
db.key_value().write(batch).expect("Low level database error.");
|
||||
bc.first_block = Some(hash);
|
||||
}
|
||||
},
|
||||
@@ -772,11 +750,10 @@ impl BlockChain {
|
||||
/// `parent_td` is a parent total diffuculty
|
||||
/// Supply a dummy parent total difficulty when the parent block may not be in the chain.
|
||||
/// Returns true if the block is disconnected.
|
||||
pub fn insert_unordered_block(&self, batch: &mut DBTransaction, block: encoded::Block, receipts: Vec<Receipt>, parent_td: Option<U256>, is_best: bool, is_ancient: bool) -> bool {
|
||||
let block_number = block.header_view().number();
|
||||
let block_parent_hash = block.header_view().parent_hash();
|
||||
let block_difficulty = block.header_view().difficulty();
|
||||
let hash = block.header_view().hash();
|
||||
pub fn insert_unordered_block(&self, batch: &mut DBTransaction, bytes: &[u8], receipts: Vec<Receipt>, parent_td: Option<U256>, is_best: bool, is_ancient: bool) -> bool {
|
||||
let block = view!(BlockView, bytes);
|
||||
let header = block.header_view();
|
||||
let hash = header.hash();
|
||||
|
||||
if self.is_known(&hash) {
|
||||
return false;
|
||||
@@ -784,45 +761,45 @@ impl BlockChain {
|
||||
|
||||
assert!(self.pending_best_block.read().is_none());
|
||||
|
||||
let compressed_header = compress(block.header_view().rlp().as_raw(), blocks_swapper());
|
||||
let compressed_body = compress(&Self::block_to_body(block.raw()), blocks_swapper());
|
||||
let compressed_header = compress(block.header_rlp().as_raw(), blocks_swapper());
|
||||
let compressed_body = compress(&Self::block_to_body(bytes), blocks_swapper());
|
||||
|
||||
// store block in db
|
||||
batch.put(db::COL_HEADERS, &hash, &compressed_header);
|
||||
batch.put(db::COL_BODIES, &hash, &compressed_body);
|
||||
|
||||
let maybe_parent = self.block_details(&block_parent_hash);
|
||||
let maybe_parent = self.block_details(&header.parent_hash());
|
||||
|
||||
if let Some(parent_details) = maybe_parent {
|
||||
// parent known to be in chain.
|
||||
let info = BlockInfo {
|
||||
hash: hash,
|
||||
number: block_number,
|
||||
total_difficulty: parent_details.total_difficulty + block_difficulty,
|
||||
number: header.number(),
|
||||
total_difficulty: parent_details.total_difficulty + header.difficulty(),
|
||||
location: BlockLocation::CanonChain,
|
||||
};
|
||||
|
||||
self.prepare_update(batch, ExtrasUpdate {
|
||||
block_hashes: self.prepare_block_hashes_update(&info),
|
||||
block_details: self.prepare_block_details_update(block_parent_hash, &info, false),
|
||||
block_hashes: self.prepare_block_hashes_update(bytes, &info),
|
||||
block_details: self.prepare_block_details_update(bytes, &info, false, None),
|
||||
block_receipts: self.prepare_block_receipts_update(receipts, &info),
|
||||
blocks_blooms: self.prepare_block_blooms_update(block.header_view().log_bloom(), &info),
|
||||
transactions_addresses: self.prepare_transaction_addresses_update(block.view().transaction_hashes(), &info),
|
||||
blocks_blooms: self.prepare_block_blooms_update(bytes, &info),
|
||||
transactions_addresses: self.prepare_transaction_addresses_update(bytes, &info),
|
||||
info: info,
|
||||
block,
|
||||
block: bytes
|
||||
}, is_best);
|
||||
|
||||
if is_ancient {
|
||||
let mut best_ancient_block = self.best_ancient_block.write();
|
||||
let ancient_number = best_ancient_block.as_ref().map_or(0, |b| b.number);
|
||||
if self.block_hash(block_number + 1).is_some() {
|
||||
if self.block_hash(header.number() + 1).is_some() {
|
||||
batch.delete(db::COL_EXTRA, b"ancient");
|
||||
*best_ancient_block = None;
|
||||
} else if block_number > ancient_number {
|
||||
} else if header.number() > ancient_number {
|
||||
batch.put(db::COL_EXTRA, b"ancient", &hash);
|
||||
*best_ancient_block = Some(BestAncientBlock {
|
||||
hash: hash,
|
||||
number: block_number,
|
||||
number: header.number(),
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -835,31 +812,32 @@ impl BlockChain {
|
||||
|
||||
let info = BlockInfo {
|
||||
hash: hash,
|
||||
number: block_number,
|
||||
total_difficulty: d + block_difficulty,
|
||||
number: header.number(),
|
||||
total_difficulty: d + header.difficulty(),
|
||||
location: BlockLocation::CanonChain,
|
||||
};
|
||||
|
||||
// TODO [sorpaas] support warp sync insertion of finalization and metadata.
|
||||
let block_details = BlockDetails {
|
||||
number: block_number,
|
||||
number: header.number(),
|
||||
total_difficulty: info.total_difficulty,
|
||||
parent: block_parent_hash,
|
||||
parent: header.parent_hash(),
|
||||
children: Vec::new(),
|
||||
is_finalized: false,
|
||||
metadata: None,
|
||||
};
|
||||
|
||||
let mut update = HashMap::new();
|
||||
update.insert(hash, block_details);
|
||||
|
||||
self.prepare_update(batch, ExtrasUpdate {
|
||||
block_hashes: self.prepare_block_hashes_update(&info),
|
||||
block_hashes: self.prepare_block_hashes_update(bytes, &info),
|
||||
block_details: update,
|
||||
block_receipts: self.prepare_block_receipts_update(receipts, &info),
|
||||
blocks_blooms: self.prepare_block_blooms_update(block.header_view().log_bloom(), &info),
|
||||
transactions_addresses: self.prepare_transaction_addresses_update(block.view().transaction_hashes(), &info),
|
||||
blocks_blooms: self.prepare_block_blooms_update(bytes, &info),
|
||||
transactions_addresses: self.prepare_transaction_addresses_update(bytes, &info),
|
||||
info: info,
|
||||
block,
|
||||
block: bytes,
|
||||
}, is_best);
|
||||
true
|
||||
}
|
||||
@@ -971,36 +949,41 @@ impl BlockChain {
|
||||
/// Inserts the block into backing cache database.
|
||||
/// Expects the block to be valid and already verified.
|
||||
/// If the block is already known, does nothing.
|
||||
pub fn insert_block(&self, batch: &mut DBTransaction, block: encoded::Block, receipts: Vec<Receipt>, extras: ExtrasInsert) -> ImportRoute {
|
||||
let parent_hash = block.header_view().parent_hash();
|
||||
pub fn insert_block(&self, batch: &mut DBTransaction, bytes: &[u8], receipts: Vec<Receipt>, extras: ExtrasInsert) -> ImportRoute {
|
||||
let block = view!(BlockView, bytes);
|
||||
let header = block.header_view();
|
||||
|
||||
let parent_hash = header.parent_hash();
|
||||
let best_hash = self.best_block_hash();
|
||||
|
||||
let route = self.tree_route(best_hash, parent_hash).expect("forks are only kept when it has common ancestors; tree route from best to prospective's parent always exists; qed");
|
||||
|
||||
self.insert_block_with_route(batch, block, receipts, route, extras)
|
||||
self.insert_block_with_route(batch, bytes, receipts, route, extras)
|
||||
}
|
||||
|
||||
/// Inserts the block into backing cache database with already generated route information.
|
||||
/// Expects the block to be valid and already verified and route is tree route information from current best block to new block's parent.
|
||||
/// If the block is already known, does nothing.
|
||||
pub fn insert_block_with_route(&self, batch: &mut DBTransaction, block: encoded::Block, receipts: Vec<Receipt>, route: TreeRoute, extras: ExtrasInsert) -> ImportRoute {
|
||||
let hash = block.header_view().hash();
|
||||
let parent_hash = block.header_view().parent_hash();
|
||||
pub fn insert_block_with_route(&self, batch: &mut DBTransaction, bytes: &[u8], receipts: Vec<Receipt>, route: TreeRoute, extras: ExtrasInsert) -> ImportRoute {
|
||||
// create views onto rlp
|
||||
let block = view!(BlockView, bytes);
|
||||
let header = block.header_view();
|
||||
let hash = header.hash();
|
||||
|
||||
if self.is_known_child(&parent_hash, &hash) {
|
||||
if self.is_known_child(&header.parent_hash(), &hash) {
|
||||
return ImportRoute::none();
|
||||
}
|
||||
|
||||
assert!(self.pending_best_block.read().is_none());
|
||||
|
||||
let compressed_header = compress(block.header_view().rlp().as_raw(), blocks_swapper());
|
||||
let compressed_body = compress(&Self::block_to_body(block.raw()), blocks_swapper());
|
||||
let compressed_header = compress(block.header_rlp().as_raw(), blocks_swapper());
|
||||
let compressed_body = compress(&Self::block_to_body(bytes), blocks_swapper());
|
||||
|
||||
// store block in db
|
||||
batch.put(db::COL_HEADERS, &hash, &compressed_header);
|
||||
batch.put(db::COL_BODIES, &hash, &compressed_body);
|
||||
|
||||
let info = self.block_info(&block.header_view(), route, &extras);
|
||||
let info = self.block_info(&header, route, &extras);
|
||||
|
||||
if let BlockLocation::BranchBecomingCanonChain(ref d) = info.location {
|
||||
info!(target: "reorg", "Reorg to {} ({} {} {})",
|
||||
@@ -1012,13 +995,13 @@ impl BlockChain {
|
||||
}
|
||||
|
||||
self.prepare_update(batch, ExtrasUpdate {
|
||||
block_hashes: self.prepare_block_hashes_update(&info),
|
||||
block_details: self.prepare_block_details_update(parent_hash, &info, extras.is_finalized),
|
||||
block_hashes: self.prepare_block_hashes_update(bytes, &info),
|
||||
block_details: self.prepare_block_details_update(bytes, &info, extras.is_finalized, extras.metadata),
|
||||
block_receipts: self.prepare_block_receipts_update(receipts, &info),
|
||||
blocks_blooms: self.prepare_block_blooms_update(block.header_view().log_bloom(), &info),
|
||||
transactions_addresses: self.prepare_transaction_addresses_update(block.view().transaction_hashes(), &info),
|
||||
blocks_blooms: self.prepare_block_blooms_update(bytes, &info),
|
||||
transactions_addresses: self.prepare_transaction_addresses_update(bytes, &info),
|
||||
info: info.clone(),
|
||||
block,
|
||||
block: bytes,
|
||||
}, true);
|
||||
|
||||
ImportRoute::from(info)
|
||||
@@ -1089,7 +1072,7 @@ impl BlockChain {
|
||||
if let Some((block, blooms)) = update.blocks_blooms {
|
||||
self.db.blooms()
|
||||
.insert_blooms(block, blooms.iter())
|
||||
.expect("Low level database error when updating blooms. Some issue with disk?");
|
||||
.expect("Low level database error. Some issue with disk?");
|
||||
}
|
||||
|
||||
// These cached values must be updated last with all four locks taken to avoid
|
||||
@@ -1098,10 +1081,11 @@ impl BlockChain {
|
||||
let mut best_block = self.pending_best_block.write();
|
||||
if is_best && update.info.location != BlockLocation::Branch {
|
||||
batch.put(db::COL_EXTRA, b"best", &update.info.hash);
|
||||
let block = encoded::Block::new(update.block.to_vec());
|
||||
*best_block = Some(BestBlock {
|
||||
total_difficulty: update.info.total_difficulty,
|
||||
header: update.block.decode_header(),
|
||||
block: update.block,
|
||||
header: block.decode_header(),
|
||||
block,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1221,13 +1205,16 @@ impl BlockChain {
|
||||
}
|
||||
|
||||
/// This function returns modified block hashes.
|
||||
fn prepare_block_hashes_update(&self, info: &BlockInfo) -> HashMap<BlockNumber, H256> {
|
||||
fn prepare_block_hashes_update(&self, block_bytes: &[u8], info: &BlockInfo) -> HashMap<BlockNumber, H256> {
|
||||
let mut block_hashes = HashMap::new();
|
||||
let block = view!(BlockView, block_bytes);
|
||||
let header = block.header_view();
|
||||
let number = header.number();
|
||||
|
||||
match info.location {
|
||||
BlockLocation::Branch => (),
|
||||
BlockLocation::CanonChain => {
|
||||
block_hashes.insert(info.number, info.hash);
|
||||
block_hashes.insert(number, info.hash);
|
||||
},
|
||||
BlockLocation::BranchBecomingCanonChain(ref data) => {
|
||||
let ancestor_number = self.block_number(&data.ancestor).expect("Block number of ancestor is always in DB");
|
||||
@@ -1237,7 +1224,7 @@ impl BlockChain {
|
||||
block_hashes.insert(start_number + index as BlockNumber, hash);
|
||||
}
|
||||
|
||||
block_hashes.insert(info.number, info.hash);
|
||||
block_hashes.insert(number, info.hash);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1246,18 +1233,23 @@ impl BlockChain {
|
||||
|
||||
/// This function returns modified block details.
|
||||
/// Uses the given parent details or attempts to load them from the database.
|
||||
fn prepare_block_details_update(&self, parent_hash: H256, info: &BlockInfo, is_finalized: bool) -> HashMap<H256, BlockDetails> {
|
||||
fn prepare_block_details_update(&self, block_bytes: &[u8], info: &BlockInfo, is_finalized: bool, metadata: Option<Vec<u8>>) -> HashMap<H256, BlockDetails> {
|
||||
let block = view!(BlockView, block_bytes);
|
||||
let header = block.header_view();
|
||||
let parent_hash = header.parent_hash();
|
||||
|
||||
// update parent
|
||||
let mut parent_details = self.block_details(&parent_hash).unwrap_or_else(|| panic!("Invalid parent hash: {:?}", parent_hash));
|
||||
parent_details.children.push(info.hash);
|
||||
|
||||
// create current block details.
|
||||
let details = BlockDetails {
|
||||
number: info.number,
|
||||
number: header.number(),
|
||||
total_difficulty: info.total_difficulty,
|
||||
parent: parent_hash,
|
||||
children: vec![],
|
||||
is_finalized: is_finalized,
|
||||
metadata: metadata,
|
||||
};
|
||||
|
||||
// write to batch
|
||||
@@ -1275,7 +1267,10 @@ impl BlockChain {
|
||||
}
|
||||
|
||||
/// This function returns modified transaction addresses.
|
||||
fn prepare_transaction_addresses_update(&self, transaction_hashes: Vec<H256>, info: &BlockInfo) -> HashMap<H256, Option<TransactionAddress>> {
|
||||
fn prepare_transaction_addresses_update(&self, block_bytes: &[u8], info: &BlockInfo) -> HashMap<H256, Option<TransactionAddress>> {
|
||||
let block = view!(BlockView, block_bytes);
|
||||
let transaction_hashes = block.transaction_hashes();
|
||||
|
||||
match info.location {
|
||||
BlockLocation::CanonChain => {
|
||||
transaction_hashes.into_iter()
|
||||
@@ -1340,10 +1335,14 @@ impl BlockChain {
|
||||
/// Later, BloomIndexer is used to map bloom location on filter layer (BloomIndex)
|
||||
/// to bloom location in database (BlocksBloomLocation).
|
||||
///
|
||||
fn prepare_block_blooms_update(&self, log_bloom: Bloom, info: &BlockInfo) -> Option<(u64, Vec<Bloom>)> {
|
||||
fn prepare_block_blooms_update(&self, block_bytes: &[u8], info: &BlockInfo) -> Option<(u64, Vec<Bloom>)> {
|
||||
let block = view!(BlockView, block_bytes);
|
||||
let header = block.header_view();
|
||||
|
||||
match info.location {
|
||||
BlockLocation::Branch => None,
|
||||
BlockLocation::CanonChain => {
|
||||
let log_bloom = header.log_bloom();
|
||||
if log_bloom.is_zero() {
|
||||
None
|
||||
} else {
|
||||
@@ -1351,17 +1350,15 @@ impl BlockChain {
|
||||
}
|
||||
},
|
||||
BlockLocation::BranchBecomingCanonChain(ref data) => {
|
||||
let ancestor_number = self.block_number(&data.ancestor)
|
||||
.expect("hash belongs to an ancestor of an inserted block; this branch is only reachable for normal block insertion (non-ancient); ancestors of an inserted block are always available for normal block insertion; block number of an inserted block is always available; qed");
|
||||
let ancestor_number = self.block_number(&data.ancestor).unwrap();
|
||||
let start_number = ancestor_number + 1;
|
||||
|
||||
let mut blooms: Vec<Bloom> = data.enacted.iter()
|
||||
.map(|hash| self.block_header_data(hash)
|
||||
.expect("hash belongs to an inserted block; block header data of an inserted block is always available; qed"))
|
||||
.map(|hash| self.block_header_data(hash).unwrap())
|
||||
.map(|h| h.log_bloom())
|
||||
.collect();
|
||||
|
||||
blooms.push(log_bloom);
|
||||
blooms.push(header.log_bloom());
|
||||
Some((start_number, blooms))
|
||||
}
|
||||
}
|
||||
@@ -1497,19 +1494,18 @@ mod tests {
|
||||
use log_entry::{LogEntry, LocalizedLogEntry};
|
||||
use ethkey::Secret;
|
||||
use test_helpers::new_db;
|
||||
use encoded;
|
||||
|
||||
fn new_chain(genesis: encoded::Block, db: Arc<BlockChainDB>) -> BlockChain {
|
||||
BlockChain::new(Config::default(), genesis.raw(), db)
|
||||
fn new_chain(genesis: &[u8], db: Arc<BlockChainDB>) -> BlockChain {
|
||||
BlockChain::new(Config::default(), genesis, db)
|
||||
}
|
||||
|
||||
fn insert_block(db: &Arc<BlockChainDB>, bc: &BlockChain, block: encoded::Block, receipts: Vec<Receipt>) -> ImportRoute {
|
||||
insert_block_commit(db, bc, block, receipts, true)
|
||||
fn insert_block(db: &Arc<BlockChainDB>, bc: &BlockChain, bytes: &[u8], receipts: Vec<Receipt>) -> ImportRoute {
|
||||
insert_block_commit(db, bc, bytes, receipts, true)
|
||||
}
|
||||
|
||||
fn insert_block_commit(db: &Arc<BlockChainDB>, bc: &BlockChain, block: encoded::Block, receipts: Vec<Receipt>, commit: bool) -> ImportRoute {
|
||||
fn insert_block_commit(db: &Arc<BlockChainDB>, bc: &BlockChain, bytes: &[u8], receipts: Vec<Receipt>, commit: bool) -> ImportRoute {
|
||||
let mut batch = db.key_value().transaction();
|
||||
let res = insert_block_batch(&mut batch, bc, block, receipts);
|
||||
let res = insert_block_batch(&mut batch, bc, bytes, receipts);
|
||||
db.key_value().write(batch).unwrap();
|
||||
if commit {
|
||||
bc.commit();
|
||||
@@ -1517,24 +1513,25 @@ mod tests {
|
||||
res
|
||||
}
|
||||
|
||||
fn insert_block_batch(batch: &mut DBTransaction, bc: &BlockChain, block: encoded::Block, receipts: Vec<Receipt>) -> ImportRoute {
|
||||
fn insert_block_batch(batch: &mut DBTransaction, bc: &BlockChain, bytes: &[u8], receipts: Vec<Receipt>) -> ImportRoute {
|
||||
use views::BlockView;
|
||||
use blockchain::ExtrasInsert;
|
||||
|
||||
let fork_choice = {
|
||||
let header = block.header_view();
|
||||
let parent_hash = header.parent_hash();
|
||||
let parent_details = bc.block_details(&parent_hash).unwrap_or_else(|| panic!("Invalid parent hash: {:?}", parent_hash));
|
||||
let block_total_difficulty = parent_details.total_difficulty + header.difficulty();
|
||||
if block_total_difficulty > bc.best_block_total_difficulty() {
|
||||
::engines::ForkChoice::New
|
||||
} else {
|
||||
::engines::ForkChoice::Old
|
||||
}
|
||||
let block = view!(BlockView, bytes);
|
||||
let header = block.header_view();
|
||||
let parent_hash = header.parent_hash();
|
||||
let parent_details = bc.block_details(&parent_hash).unwrap_or_else(|| panic!("Invalid parent hash: {:?}", parent_hash));
|
||||
let block_total_difficulty = parent_details.total_difficulty + header.difficulty();
|
||||
let fork_choice = if block_total_difficulty > bc.best_block_total_difficulty() {
|
||||
::engines::ForkChoice::New
|
||||
} else {
|
||||
::engines::ForkChoice::Old
|
||||
};
|
||||
|
||||
bc.insert_block(batch, block, receipts, ExtrasInsert {
|
||||
bc.insert_block(batch, bytes, receipts, ExtrasInsert {
|
||||
fork_choice: fork_choice,
|
||||
is_finalized: false,
|
||||
metadata: None
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1545,11 +1542,11 @@ mod tests {
|
||||
let first = genesis.add_block();
|
||||
|
||||
let db = new_db();
|
||||
let bc = new_chain(genesis.last().encoded(), db.clone());
|
||||
let bc = new_chain(&genesis.last().encoded(), db.clone());
|
||||
assert_eq!(bc.best_block_number(), 0);
|
||||
|
||||
// when
|
||||
insert_block_commit(&db, &bc, first.last().encoded(), vec![], false);
|
||||
insert_block_commit(&db, &bc, &first.last().encoded(), vec![], false);
|
||||
assert_eq!(bc.best_block_number(), 0);
|
||||
bc.commit();
|
||||
// NOTE no db.write here (we want to check if best block is cached)
|
||||
@@ -1570,7 +1567,7 @@ mod tests {
|
||||
let first_hash = first.hash();
|
||||
|
||||
let db = new_db();
|
||||
let bc = new_chain(genesis.encoded(), db.clone());
|
||||
let bc = new_chain(&genesis.encoded(), db.clone());
|
||||
|
||||
assert_eq!(bc.genesis_hash(), genesis_hash);
|
||||
assert_eq!(bc.best_block_hash(), genesis_hash);
|
||||
@@ -1579,7 +1576,7 @@ mod tests {
|
||||
assert_eq!(bc.block_details(&genesis_hash).unwrap().children, vec![]);
|
||||
|
||||
let mut batch = db.key_value().transaction();
|
||||
insert_block_batch(&mut batch, &bc, first.encoded(), vec![]);
|
||||
insert_block_batch(&mut batch, &bc, &first.encoded(), vec![]);
|
||||
db.key_value().write(batch).unwrap();
|
||||
bc.commit();
|
||||
|
||||
@@ -1599,13 +1596,13 @@ mod tests {
|
||||
let generator = BlockGenerator::new(vec![first_10]);
|
||||
|
||||
let db = new_db();
|
||||
let bc = new_chain(genesis.last().encoded(), db.clone());
|
||||
let bc = new_chain(&genesis.last().encoded(), db.clone());
|
||||
|
||||
let mut block_hashes = vec![genesis.last().hash()];
|
||||
let mut batch = db.key_value().transaction();
|
||||
for block in generator {
|
||||
block_hashes.push(block.hash());
|
||||
insert_block_batch(&mut batch, &bc, block.encoded(), vec![]);
|
||||
insert_block_batch(&mut batch, &bc, &block.encoded(), vec![]);
|
||||
bc.commit();
|
||||
}
|
||||
db.key_value().write(batch).unwrap();
|
||||
@@ -1643,10 +1640,10 @@ mod tests {
|
||||
);
|
||||
|
||||
let db = new_db();
|
||||
let bc = new_chain(genesis.last().encoded(), db.clone());
|
||||
let bc = new_chain(&genesis.last().encoded(), db.clone());
|
||||
|
||||
for b in generator {
|
||||
insert_block(&db, &bc, b.encoded(), vec![]);
|
||||
insert_block(&db, &bc, &b.encoded(), vec![]);
|
||||
}
|
||||
|
||||
assert_eq!(uncle_headers, bc.find_uncle_headers(&b4a_hash, 3).unwrap());
|
||||
@@ -1679,12 +1676,12 @@ mod tests {
|
||||
let b2_hash = b2.last().hash();
|
||||
|
||||
let db = new_db();
|
||||
let bc = new_chain(genesis.last().encoded(), db.clone());
|
||||
let bc = new_chain(&genesis.last().encoded(), db.clone());
|
||||
|
||||
let mut batch = db.key_value().transaction();
|
||||
let _ = insert_block_batch(&mut batch, &bc, b1a.last().encoded(), vec![]);
|
||||
let _ = insert_block_batch(&mut batch, &bc, &b1a.last().encoded(), vec![]);
|
||||
bc.commit();
|
||||
let _ = insert_block_batch(&mut batch, &bc, b1b.last().encoded(), vec![]);
|
||||
let _ = insert_block_batch(&mut batch, &bc, &b1b.last().encoded(), vec![]);
|
||||
bc.commit();
|
||||
db.key_value().write(batch).unwrap();
|
||||
|
||||
@@ -1696,7 +1693,7 @@ mod tests {
|
||||
|
||||
// now let's make forked chain the canon chain
|
||||
let mut batch = db.key_value().transaction();
|
||||
let _ = insert_block_batch(&mut batch, &bc, b2.last().encoded(), vec![]);
|
||||
let _ = insert_block_batch(&mut batch, &bc, &b2.last().encoded(), vec![]);
|
||||
bc.commit();
|
||||
db.key_value().write(batch).unwrap();
|
||||
|
||||
@@ -1754,12 +1751,12 @@ mod tests {
|
||||
let t3_hash = t3.hash();
|
||||
|
||||
let db = new_db();
|
||||
let bc = new_chain(genesis.last().encoded(), db.clone());
|
||||
let bc = new_chain(&genesis.last().encoded(), db.clone());
|
||||
|
||||
let mut batch = db.key_value().transaction();
|
||||
let _ = insert_block_batch(&mut batch, &bc, b1a.last().encoded(), vec![]);
|
||||
let _ = insert_block_batch(&mut batch, &bc, &b1a.last().encoded(), vec![]);
|
||||
bc.commit();
|
||||
let _ = insert_block_batch(&mut batch, &bc, b1b.last().encoded(), vec![]);
|
||||
let _ = insert_block_batch(&mut batch, &bc, &b1b.last().encoded(), vec![]);
|
||||
bc.commit();
|
||||
db.key_value().write(batch).unwrap();
|
||||
|
||||
@@ -1775,7 +1772,7 @@ mod tests {
|
||||
|
||||
// now let's make forked chain the canon chain
|
||||
let mut batch = db.key_value().transaction();
|
||||
let _ = insert_block_batch(&mut batch, &bc, b2.last().encoded(), vec![]);
|
||||
let _ = insert_block_batch(&mut batch, &bc, &b2.last().encoded(), vec![]);
|
||||
bc.commit();
|
||||
db.key_value().write(batch).unwrap();
|
||||
|
||||
@@ -1812,19 +1809,19 @@ mod tests {
|
||||
let best_block_hash = b3a_hash;
|
||||
|
||||
let db = new_db();
|
||||
let bc = new_chain(genesis.last().encoded(), db.clone());
|
||||
let bc = new_chain(&genesis.last().encoded(), db.clone());
|
||||
|
||||
let mut batch = db.key_value().transaction();
|
||||
let ir1 = insert_block_batch(&mut batch, &bc, b1.last().encoded(), vec![]);
|
||||
let ir1 = insert_block_batch(&mut batch, &bc, &b1.last().encoded(), vec![]);
|
||||
bc.commit();
|
||||
let ir2 = insert_block_batch(&mut batch, &bc, b2.last().encoded(), vec![]);
|
||||
let ir2 = insert_block_batch(&mut batch, &bc, &b2.last().encoded(), vec![]);
|
||||
bc.commit();
|
||||
let ir3b = insert_block_batch(&mut batch, &bc, b3b.last().encoded(), vec![]);
|
||||
let ir3b = insert_block_batch(&mut batch, &bc, &b3b.last().encoded(), vec![]);
|
||||
bc.commit();
|
||||
db.key_value().write(batch).unwrap();
|
||||
assert_eq!(bc.block_hash(3).unwrap(), b3b_hash);
|
||||
let mut batch = db.key_value().transaction();
|
||||
let ir3a = insert_block_batch(&mut batch, &bc, b3a.last().encoded(), vec![]);
|
||||
let ir3a = insert_block_batch(&mut batch, &bc, &b3a.last().encoded(), vec![]);
|
||||
bc.commit();
|
||||
db.key_value().write(batch).unwrap();
|
||||
|
||||
@@ -1926,17 +1923,17 @@ mod tests {
|
||||
let db = new_db();
|
||||
|
||||
{
|
||||
let bc = new_chain(genesis.last().encoded(), db.clone());
|
||||
let bc = new_chain(&genesis.last().encoded(), db.clone());
|
||||
assert_eq!(bc.best_block_hash(), genesis_hash);
|
||||
let mut batch = db.key_value().transaction();
|
||||
insert_block_batch(&mut batch, &bc, first.last().encoded(), vec![]);
|
||||
insert_block_batch(&mut batch, &bc, &first.last().encoded(), vec![]);
|
||||
db.key_value().write(batch).unwrap();
|
||||
bc.commit();
|
||||
assert_eq!(bc.best_block_hash(), first_hash);
|
||||
}
|
||||
|
||||
{
|
||||
let bc = new_chain(genesis.last().encoded(), db.clone());
|
||||
let bc = new_chain(&genesis.last().encoded(), db.clone());
|
||||
|
||||
assert_eq!(bc.best_block_hash(), first_hash);
|
||||
}
|
||||
@@ -1986,9 +1983,9 @@ mod tests {
|
||||
let b1_hash: H256 = "f53f268d23a71e85c7d6d83a9504298712b84c1a2ba220441c86eeda0bf0b6e3".into();
|
||||
|
||||
let db = new_db();
|
||||
let bc = new_chain(encoded::Block::new(genesis), db.clone());
|
||||
let bc = new_chain(&genesis, db.clone());
|
||||
let mut batch = db.key_value().transaction();
|
||||
insert_block_batch(&mut batch, &bc, encoded::Block::new(b1), vec![]);
|
||||
insert_block_batch(&mut batch, &bc, &b1, vec![]);
|
||||
db.key_value().write(batch).unwrap();
|
||||
bc.commit();
|
||||
|
||||
@@ -2054,8 +2051,8 @@ mod tests {
|
||||
let b3_number = b3.last().number();
|
||||
|
||||
let db = new_db();
|
||||
let bc = new_chain(genesis.last().encoded(), db.clone());
|
||||
insert_block(&db, &bc, b1.last().encoded(), vec![Receipt {
|
||||
let bc = new_chain(&genesis.last().encoded(), db.clone());
|
||||
insert_block(&db, &bc, &b1.last().encoded(), vec![Receipt {
|
||||
outcome: TransactionOutcome::StateRoot(H256::default()),
|
||||
gas_used: 10_000.into(),
|
||||
log_bloom: Default::default(),
|
||||
@@ -2072,7 +2069,7 @@ mod tests {
|
||||
LogEntry { address: Default::default(), topics: vec![], data: vec![3], },
|
||||
],
|
||||
}]);
|
||||
insert_block(&db, &bc, b2.last().encoded(), vec![
|
||||
insert_block(&db, &bc, &b2.last().encoded(), vec![
|
||||
Receipt {
|
||||
outcome: TransactionOutcome::StateRoot(H256::default()),
|
||||
gas_used: 10_000.into(),
|
||||
@@ -2082,7 +2079,7 @@ mod tests {
|
||||
],
|
||||
}
|
||||
]);
|
||||
insert_block(&db, &bc, b3.last().encoded(), vec![
|
||||
insert_block(&db, &bc, &b3.last().encoded(), vec![
|
||||
Receipt {
|
||||
outcome: TransactionOutcome::StateRoot(H256::default()),
|
||||
gas_used: 10_000.into(),
|
||||
@@ -2182,27 +2179,27 @@ mod tests {
|
||||
let b2a = b1a.add_block_with_bloom(bloom_ba);
|
||||
|
||||
let db = new_db();
|
||||
let bc = new_chain(genesis.last().encoded(), db.clone());
|
||||
let bc = new_chain(&genesis.last().encoded(), db.clone());
|
||||
|
||||
let blocks_b1 = bc.blocks_with_bloom(Some(&bloom_b1), 0, 5);
|
||||
let blocks_b2 = bc.blocks_with_bloom(Some(&bloom_b2), 0, 5);
|
||||
assert!(blocks_b1.is_empty());
|
||||
assert!(blocks_b2.is_empty());
|
||||
|
||||
insert_block(&db, &bc, b1.last().encoded(), vec![]);
|
||||
insert_block(&db, &bc, &b1.last().encoded(), vec![]);
|
||||
let blocks_b1 = bc.blocks_with_bloom(Some(&bloom_b1), 0, 5);
|
||||
let blocks_b2 = bc.blocks_with_bloom(Some(&bloom_b2), 0, 5);
|
||||
assert_eq!(blocks_b1, vec![1]);
|
||||
assert!(blocks_b2.is_empty());
|
||||
|
||||
insert_block(&db, &bc, b2.last().encoded(), vec![]);
|
||||
insert_block(&db, &bc, &b2.last().encoded(), vec![]);
|
||||
let blocks_b1 = bc.blocks_with_bloom(Some(&bloom_b1), 0, 5);
|
||||
let blocks_b2 = bc.blocks_with_bloom(Some(&bloom_b2), 0, 5);
|
||||
assert_eq!(blocks_b1, vec![1]);
|
||||
assert_eq!(blocks_b2, vec![2]);
|
||||
|
||||
// hasn't been forked yet
|
||||
insert_block(&db, &bc, b1a.last().encoded(), vec![]);
|
||||
insert_block(&db, &bc, &b1a.last().encoded(), vec![]);
|
||||
let blocks_b1 = bc.blocks_with_bloom(Some(&bloom_b1), 0, 5);
|
||||
let blocks_b2 = bc.blocks_with_bloom(Some(&bloom_b2), 0, 5);
|
||||
let blocks_ba = bc.blocks_with_bloom(Some(&bloom_ba), 0, 5);
|
||||
@@ -2211,7 +2208,7 @@ mod tests {
|
||||
assert!(blocks_ba.is_empty());
|
||||
|
||||
// fork has happend
|
||||
insert_block(&db, &bc, b2a.last().encoded(), vec![]);
|
||||
insert_block(&db, &bc, &b2a.last().encoded(), vec![]);
|
||||
let blocks_b1 = bc.blocks_with_bloom(Some(&bloom_b1), 0, 5);
|
||||
let blocks_b2 = bc.blocks_with_bloom(Some(&bloom_b2), 0, 5);
|
||||
let blocks_ba = bc.blocks_with_bloom(Some(&bloom_ba), 0, 5);
|
||||
@@ -2220,7 +2217,7 @@ mod tests {
|
||||
assert_eq!(blocks_ba, vec![1, 2]);
|
||||
|
||||
// fork back
|
||||
insert_block(&db, &bc, b3.last().encoded(), vec![]);
|
||||
insert_block(&db, &bc, &b3.last().encoded(), vec![]);
|
||||
let blocks_b1 = bc.blocks_with_bloom(Some(&bloom_b1), 0, 5);
|
||||
let blocks_b2 = bc.blocks_with_bloom(Some(&bloom_b2), 0, 5);
|
||||
let blocks_ba = bc.blocks_with_bloom(Some(&bloom_ba), 0, 5);
|
||||
@@ -2244,13 +2241,13 @@ mod tests {
|
||||
let b1_total_difficulty = genesis.last().difficulty() + b1.last().difficulty();
|
||||
|
||||
let db = new_db();
|
||||
let bc = new_chain(genesis.last().encoded(), db.clone());
|
||||
let bc = new_chain(&genesis.last().encoded(), db.clone());
|
||||
let mut batch = db.key_value().transaction();
|
||||
bc.insert_unordered_block(&mut batch, b2.last().encoded(), vec![], Some(b1_total_difficulty), false, false);
|
||||
bc.insert_unordered_block(&mut batch, &b2.last().encoded(), vec![], Some(b1_total_difficulty), false, false);
|
||||
bc.commit();
|
||||
bc.insert_unordered_block(&mut batch, b3.last().encoded(), vec![], None, true, false);
|
||||
bc.insert_unordered_block(&mut batch, &b3.last().encoded(), vec![], None, true, false);
|
||||
bc.commit();
|
||||
bc.insert_unordered_block(&mut batch, b1.last().encoded(), vec![], None, false, false);
|
||||
bc.insert_unordered_block(&mut batch, &b1.last().encoded(), vec![], None, false, false);
|
||||
bc.commit();
|
||||
db.key_value().write(batch).unwrap();
|
||||
|
||||
@@ -2277,23 +2274,23 @@ mod tests {
|
||||
|
||||
let db = new_db();
|
||||
{
|
||||
let bc = new_chain(genesis.last().encoded(), db.clone());
|
||||
let bc = new_chain(&genesis.last().encoded(), db.clone());
|
||||
|
||||
let mut batch = db.key_value().transaction();
|
||||
// create a longer fork
|
||||
for block in generator {
|
||||
insert_block_batch(&mut batch, &bc, block.encoded(), vec![]);
|
||||
insert_block_batch(&mut batch, &bc, &block.encoded(), vec![]);
|
||||
bc.commit();
|
||||
}
|
||||
|
||||
assert_eq!(bc.best_block_number(), 5);
|
||||
insert_block_batch(&mut batch, &bc, uncle.last().encoded(), vec![]);
|
||||
insert_block_batch(&mut batch, &bc, &uncle.last().encoded(), vec![]);
|
||||
db.key_value().write(batch).unwrap();
|
||||
bc.commit();
|
||||
}
|
||||
|
||||
// re-loading the blockchain should load the correct best block.
|
||||
let bc = new_chain(genesis.last().encoded(), db);
|
||||
let bc = new_chain(&genesis.last().encoded(), db);
|
||||
assert_eq!(bc.best_block_number(), 5);
|
||||
}
|
||||
|
||||
@@ -2308,13 +2305,13 @@ mod tests {
|
||||
|
||||
let db = new_db();
|
||||
{
|
||||
let bc = new_chain(genesis.last().encoded(), db.clone());
|
||||
let bc = new_chain(&genesis.last().encoded(), db.clone());
|
||||
|
||||
let mut batch = db.key_value().transaction();
|
||||
// create a longer fork
|
||||
for (i, block) in generator.into_iter().enumerate() {
|
||||
|
||||
insert_block_batch(&mut batch, &bc, block.encoded(), vec![]);
|
||||
insert_block_batch(&mut batch, &bc, &block.encoded(), vec![]);
|
||||
bc.insert_epoch_transition(&mut batch, i as u64, EpochTransition {
|
||||
block_hash: block.hash(),
|
||||
block_number: i as u64 + 1,
|
||||
@@ -2325,7 +2322,7 @@ mod tests {
|
||||
|
||||
assert_eq!(bc.best_block_number(), 5);
|
||||
|
||||
insert_block_batch(&mut batch, &bc, uncle.last().encoded(), vec![]);
|
||||
insert_block_batch(&mut batch, &bc, &uncle.last().encoded(), vec![]);
|
||||
bc.insert_epoch_transition(&mut batch, 999, EpochTransition {
|
||||
block_hash: uncle.last().hash(),
|
||||
block_number: 1,
|
||||
@@ -2340,7 +2337,7 @@ mod tests {
|
||||
}
|
||||
|
||||
// re-loading the blockchain should load the correct best block.
|
||||
let bc = new_chain(genesis.last().encoded(), db);
|
||||
let bc = new_chain(&genesis.last().encoded(), db);
|
||||
|
||||
assert_eq!(bc.best_block_number(), 5);
|
||||
assert_eq!(bc.epoch_transitions().map(|(i, _)| i).collect::<Vec<_>>(), vec![0, 1, 2, 3, 4]);
|
||||
@@ -2361,7 +2358,7 @@ mod tests {
|
||||
|
||||
let db = new_db();
|
||||
|
||||
let bc = new_chain(genesis.last().encoded(), db.clone());
|
||||
let bc = new_chain(&genesis.last().encoded(), db.clone());
|
||||
|
||||
let mut batch = db.key_value().transaction();
|
||||
bc.insert_epoch_transition(&mut batch, 0, EpochTransition {
|
||||
@@ -2375,7 +2372,7 @@ mod tests {
|
||||
// and a non-canonical fork of 8 from genesis.
|
||||
let fork_hash = {
|
||||
for block in fork_generator {
|
||||
insert_block(&db, &bc, block.encoded(), vec![]);
|
||||
insert_block(&db, &bc, &block.encoded(), vec![]);
|
||||
}
|
||||
|
||||
assert_eq!(bc.best_block_number(), 7);
|
||||
@@ -2383,7 +2380,7 @@ mod tests {
|
||||
};
|
||||
|
||||
for block in next_generator {
|
||||
insert_block(&db, &bc, block.encoded(), vec![]);
|
||||
insert_block(&db, &bc, &block.encoded(), vec![]);
|
||||
}
|
||||
|
||||
assert_eq!(bc.best_block_number(), 10);
|
||||
|
||||
@@ -152,15 +152,17 @@ pub struct BlockDetails {
|
||||
pub children: Vec<H256>,
|
||||
/// Whether the block is considered finalized
|
||||
pub is_finalized: bool,
|
||||
/// Additional block metadata
|
||||
pub metadata: Option<Vec<u8>>,
|
||||
}
|
||||
|
||||
impl rlp::Encodable for BlockDetails {
|
||||
fn rlp_append(&self, stream: &mut rlp::RlpStream) {
|
||||
let use_short_version = !self.is_finalized;
|
||||
let use_short_version = self.metadata.is_none() && !self.is_finalized;
|
||||
|
||||
match use_short_version {
|
||||
true => { stream.begin_list(4); },
|
||||
false => { stream.begin_list(5); },
|
||||
false => { stream.begin_list(6); },
|
||||
}
|
||||
|
||||
stream.append(&self.number);
|
||||
@@ -169,6 +171,7 @@ impl rlp::Encodable for BlockDetails {
|
||||
stream.append_list(&self.children);
|
||||
if !use_short_version {
|
||||
stream.append(&self.is_finalized);
|
||||
stream.append(&self.metadata);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -177,7 +180,7 @@ impl rlp::Decodable for BlockDetails {
|
||||
fn decode(rlp: &rlp::Rlp) -> Result<Self, rlp::DecoderError> {
|
||||
let use_short_version = match rlp.item_count()? {
|
||||
4 => true,
|
||||
5 => false,
|
||||
6 => false,
|
||||
_ => return Err(rlp::DecoderError::RlpIncorrectListLen),
|
||||
};
|
||||
|
||||
@@ -191,6 +194,11 @@ impl rlp::Decodable for BlockDetails {
|
||||
} else {
|
||||
rlp.val_at(4)?
|
||||
},
|
||||
metadata: if use_short_version {
|
||||
None
|
||||
} else {
|
||||
rlp.val_at(5)?
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -244,7 +252,7 @@ pub struct EpochTransitions {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use rlp::*;
|
||||
|
||||
|
||||
use super::BlockReceipts;
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
use std::collections::VecDeque;
|
||||
use ethereum_types::{U256, H256, Bloom};
|
||||
|
||||
use bytes::Bytes;
|
||||
use header::Header;
|
||||
use rlp::encode;
|
||||
use transaction::SignedTransaction;
|
||||
use views::BlockView;
|
||||
use encoded;
|
||||
|
||||
/// Helper structure, used for encoding blocks.
|
||||
#[derive(Default, Clone, RlpEncodable)]
|
||||
@@ -41,7 +41,7 @@ impl Block {
|
||||
|
||||
#[inline]
|
||||
pub fn hash(&self) -> H256 {
|
||||
view!(BlockView, &self.encoded().raw()).header_view().hash()
|
||||
view!(BlockView, &self.encoded()).header_view().hash()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -50,8 +50,8 @@ impl Block {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn encoded(&self) -> encoded::Block {
|
||||
encoded::Block::new(encode(self).into_vec())
|
||||
pub fn encoded(&self) -> Bytes {
|
||||
encode(self).into_vec()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
||||
@@ -19,14 +19,13 @@ use ethereum_types::{H256, Bloom};
|
||||
use header::BlockNumber;
|
||||
use blockchain::block_info::BlockInfo;
|
||||
use blockchain::extras::{BlockDetails, BlockReceipts, TransactionAddress};
|
||||
use encoded::Block;
|
||||
|
||||
/// Block extras update info.
|
||||
pub struct ExtrasUpdate {
|
||||
pub struct ExtrasUpdate<'a> {
|
||||
/// Block info.
|
||||
pub info: BlockInfo,
|
||||
/// Current block uncompressed rlp bytes
|
||||
pub block: Block,
|
||||
pub block: &'a [u8],
|
||||
/// Modified block hashes.
|
||||
pub block_hashes: HashMap<BlockNumber, H256>,
|
||||
/// Modified block details.
|
||||
@@ -45,4 +44,6 @@ pub struct ExtrasInsert {
|
||||
pub fork_choice: ::engines::ForkChoice,
|
||||
/// Is the inserted block considered finalized.
|
||||
pub is_finalized: bool,
|
||||
/// New block local metadata.
|
||||
pub metadata: Option<Vec<u8>>,
|
||||
}
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Standard built-in contracts.
|
||||
|
||||
use std::cmp::{max, min};
|
||||
use std::io::{self, Read};
|
||||
|
||||
@@ -29,7 +27,6 @@ use bytes::BytesRef;
|
||||
use ethkey::{Signature, recover as ec_recover};
|
||||
use ethjson;
|
||||
|
||||
/// Execution error.
|
||||
#[derive(Debug)]
|
||||
pub struct Error(pub &'static str);
|
||||
|
||||
@@ -210,8 +207,8 @@ impl From<ethjson::spec::Builtin> for Builtin {
|
||||
}
|
||||
}
|
||||
|
||||
/// Ethereum built-in factory.
|
||||
pub fn ethereum_builtin(name: &str) -> Box<Impl> {
|
||||
// Ethereum builtin creator.
|
||||
fn ethereum_builtin(name: &str) -> Box<Impl> {
|
||||
match name {
|
||||
"identity" => Box::new(Identity) as Box<Impl>,
|
||||
"ecrecover" => Box::new(EcRecover) as Box<Impl>,
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
// Copyright 2015-2018 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/>.
|
||||
|
||||
//! Stores recently seen bad blocks.
|
||||
|
||||
use bytes::{Bytes, ToPretty};
|
||||
use ethereum_types::H256;
|
||||
use itertools::Itertools;
|
||||
use memory_cache::MemoryLruCache;
|
||||
use parking_lot::RwLock;
|
||||
use verification::queue::kind::blocks::Unverified;
|
||||
|
||||
/// Recently seen bad blocks.
|
||||
pub struct BadBlocks {
|
||||
last_blocks: RwLock<MemoryLruCache<H256, (Unverified, String)>>,
|
||||
}
|
||||
|
||||
impl Default for BadBlocks {
|
||||
fn default() -> Self {
|
||||
BadBlocks {
|
||||
last_blocks: RwLock::new(MemoryLruCache::new(8 * 1024 * 1024)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl BadBlocks {
|
||||
/// Reports given RLP as invalid block.
|
||||
pub fn report(&self, raw: Bytes, message: String) {
|
||||
match Unverified::from_rlp(raw) {
|
||||
Ok(unverified) => {
|
||||
error!(
|
||||
target: "client",
|
||||
"\nBad block detected: {}\nRLP: {}\nHeader: {:?}\nUncles: {}\nTransactions:{}\n",
|
||||
message,
|
||||
unverified.bytes.to_hex(),
|
||||
unverified.header,
|
||||
unverified.uncles
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(index, uncle)| format!("[Uncle {}] {:?}", index, uncle))
|
||||
.join("\n"),
|
||||
unverified.transactions
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(index, tx)| format!("[Tx {}] {:?}", index, tx))
|
||||
.join("\n"),
|
||||
);
|
||||
self.last_blocks.write().insert(unverified.header.hash(), (unverified, message));
|
||||
},
|
||||
Err(err) => {
|
||||
error!(target: "client", "Bad undecodable block detected: {}\n{:?}", message, err);
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns a list of recently detected bad blocks with error descriptions.
|
||||
pub fn bad_blocks(&self) -> Vec<(Unverified, String)> {
|
||||
self.last_blocks.read()
|
||||
.backstore()
|
||||
.iter()
|
||||
.map(|(_k, (unverified, message))| (
|
||||
Unverified::from_rlp(unverified.bytes.clone())
|
||||
.expect("Bytes coming from UnverifiedBlock so decodable; qed"),
|
||||
message.clone(),
|
||||
))
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
@@ -26,9 +26,9 @@ pub enum ChainMessageType {
|
||||
/// Consensus message
|
||||
Consensus(Vec<u8>),
|
||||
/// Message with private transaction
|
||||
PrivateTransaction(H256, Vec<u8>),
|
||||
PrivateTransaction(Vec<u8>),
|
||||
/// Message with signed private transaction
|
||||
SignedPrivateTransaction(H256, Vec<u8>),
|
||||
SignedPrivateTransaction(Vec<u8>),
|
||||
}
|
||||
|
||||
/// Route type to indicate whether it is enacted or retracted.
|
||||
|
||||
@@ -34,20 +34,20 @@ use ethereum_types::{H256, Address, U256};
|
||||
use block::{IsBlock, LockedBlock, Drain, ClosedBlock, OpenBlock, enact_verified, SealedBlock};
|
||||
use blockchain::{BlockChain, BlockChainDB, BlockProvider, TreeRoute, ImportRoute, TransactionAddress, ExtrasInsert};
|
||||
use client::ancient_import::AncientVerifier;
|
||||
use client::Error as ClientError;
|
||||
use client::{
|
||||
Nonce, Balance, ChainInfo, BlockInfo, CallContract, TransactionInfo,
|
||||
RegistryInfo, ReopenBlock, PrepareOpenBlock, ScheduleInfo, ImportSealedBlock,
|
||||
BroadcastProposalBlock, ImportBlock, StateOrBlock, StateInfo, StateClient, Call,
|
||||
AccountData, BlockChain as BlockChainTrait, BlockProducer, SealedBlockImporter,
|
||||
ClientIoMessage,
|
||||
ClientIoMessage
|
||||
};
|
||||
use client::{
|
||||
BlockId, TransactionId, UncleId, TraceId, ClientConfig, BlockChainClient,
|
||||
TraceFilter, CallAnalytics, BlockImportError, Mode,
|
||||
ChainNotify, ChainRoute, PruningInfo, ProvingBlockChainClient, EngineInfo, ChainMessageType,
|
||||
IoClient, BadBlocks,
|
||||
IoClient,
|
||||
};
|
||||
use client::bad_blocks;
|
||||
use encoded;
|
||||
use engines::{EthEngine, EpochTransition, ForkChoice};
|
||||
use error::{
|
||||
@@ -76,15 +76,16 @@ use transaction::{self, LocalizedTransaction, UnverifiedTransaction, SignedTrans
|
||||
use types::filter::Filter;
|
||||
use types::ancestry_action::AncestryAction;
|
||||
use verification;
|
||||
use verification::{PreverifiedBlock, Verifier, BlockQueue};
|
||||
use verification::queue::kind::blocks::Unverified;
|
||||
use verification::queue::kind::BlockLike;
|
||||
use verification::{PreverifiedBlock, Verifier};
|
||||
use verification::queue::BlockQueue;
|
||||
use views::BlockView;
|
||||
use parity_machine::{Finalizable, WithMetadata};
|
||||
|
||||
// re-export
|
||||
pub use types::blockchain_info::BlockChainInfo;
|
||||
pub use types::block_status::BlockStatus;
|
||||
pub use blockchain::CacheSize as BlockChainCacheSize;
|
||||
pub use verification::QueueInfo as BlockQueueInfo;
|
||||
pub use verification::queue::QueueInfo as BlockQueueInfo;
|
||||
|
||||
use_contract!(registry, "Registry", "res/contracts/registrar.json");
|
||||
|
||||
@@ -164,9 +165,6 @@ struct Importer {
|
||||
|
||||
/// Ethereum engine to be used during import
|
||||
pub engine: Arc<EthEngine>,
|
||||
|
||||
/// A lru cache of recently detected bad blocks
|
||||
pub bad_blocks: bad_blocks::BadBlocks,
|
||||
}
|
||||
|
||||
/// Blockchain database client backed by a persistent database. Owns and manages a blockchain and a block queue.
|
||||
@@ -217,7 +215,7 @@ pub struct Client {
|
||||
/// Queued ancient blocks, make sure they are imported in order.
|
||||
queued_ancient_blocks: Arc<RwLock<(
|
||||
HashSet<H256>,
|
||||
VecDeque<(Unverified, Bytes)>
|
||||
VecDeque<(Header, Bytes, Bytes)>
|
||||
)>>,
|
||||
ancient_blocks_import_lock: Arc<Mutex<()>>,
|
||||
/// Consensus messages import queue
|
||||
@@ -258,7 +256,6 @@ impl Importer {
|
||||
miner,
|
||||
ancient_verifier: AncientVerifier::new(engine.clone()),
|
||||
engine,
|
||||
bad_blocks: Default::default(),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -296,27 +293,22 @@ impl Importer {
|
||||
continue;
|
||||
}
|
||||
|
||||
let raw = block.bytes.clone();
|
||||
match self.check_and_lock_block(block, client) {
|
||||
Ok(closed_block) => {
|
||||
if self.engine.is_proposal(&header) {
|
||||
self.block_queue.mark_as_good(&[hash]);
|
||||
proposed_blocks.push(bytes);
|
||||
} else {
|
||||
imported_blocks.push(hash);
|
||||
if let Ok(closed_block) = self.check_and_close_block(block, client) {
|
||||
if self.engine.is_proposal(&header) {
|
||||
self.block_queue.mark_as_good(&[hash]);
|
||||
proposed_blocks.push(bytes);
|
||||
} else {
|
||||
imported_blocks.push(hash);
|
||||
|
||||
let transactions_len = closed_block.transactions().len();
|
||||
let transactions_len = closed_block.transactions().len();
|
||||
|
||||
let route = self.commit_block(closed_block, &header, encoded::Block::new(bytes), client);
|
||||
import_results.push(route);
|
||||
let route = self.commit_block(closed_block, &header, &bytes, client);
|
||||
import_results.push(route);
|
||||
|
||||
client.report.write().accrue_block(&header, transactions_len);
|
||||
}
|
||||
},
|
||||
Err(err) => {
|
||||
self.bad_blocks.report(raw, format!("{:?}", err));
|
||||
invalid_blocks.insert(header.hash());
|
||||
},
|
||||
client.report.write().accrue_block(&header, transactions_len);
|
||||
}
|
||||
} else {
|
||||
invalid_blocks.insert(header.hash());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -356,7 +348,7 @@ impl Importer {
|
||||
imported
|
||||
}
|
||||
|
||||
fn check_and_lock_block(&self, block: PreverifiedBlock, client: &Client) -> Result<LockedBlock, ()> {
|
||||
fn check_and_close_block(&self, block: PreverifiedBlock, client: &Client) -> Result<LockedBlock, ()> {
|
||||
let engine = &*self.engine;
|
||||
let header = block.header.clone();
|
||||
|
||||
@@ -383,7 +375,8 @@ impl Importer {
|
||||
&parent,
|
||||
engine,
|
||||
Some(verification::FullFamilyParams {
|
||||
block: &block,
|
||||
block_bytes: &block.bytes,
|
||||
transactions: &block.transactions,
|
||||
block_provider: &**chain,
|
||||
client
|
||||
}),
|
||||
@@ -443,53 +436,58 @@ impl Importer {
|
||||
///
|
||||
/// The block is guaranteed to be the next best blocks in the
|
||||
/// first block sequence. Does no sealing or transaction validation.
|
||||
fn import_old_block(&self, unverified: Unverified, receipts_bytes: &[u8], db: &KeyValueDB, chain: &BlockChain) -> Result<(), ::error::Error> {
|
||||
fn import_old_block(&self, header: &Header, block_bytes: &[u8], receipts_bytes: &[u8], db: &KeyValueDB, chain: &BlockChain) -> Result<H256, ::error::Error> {
|
||||
let receipts = ::rlp::decode_list(receipts_bytes);
|
||||
let hash = header.hash();
|
||||
let _import_lock = self.import_lock.lock();
|
||||
|
||||
{
|
||||
trace_time!("import_old_block");
|
||||
// verify the block, passing the chain for updating the epoch verifier.
|
||||
let mut rng = OsRng::new()?;
|
||||
self.ancient_verifier.verify(&mut rng, &unverified.header, &chain)?;
|
||||
self.ancient_verifier.verify(&mut rng, &header, &chain)?;
|
||||
|
||||
// Commit results
|
||||
let mut batch = DBTransaction::new();
|
||||
chain.insert_unordered_block(&mut batch, encoded::Block::new(unverified.bytes), receipts, None, false, true);
|
||||
chain.insert_unordered_block(&mut batch, block_bytes, receipts, None, false, true);
|
||||
// Final commit to the DB
|
||||
db.write_buffered(batch);
|
||||
chain.commit();
|
||||
}
|
||||
db.flush().expect("DB flush failed.");
|
||||
Ok(())
|
||||
Ok(hash)
|
||||
}
|
||||
|
||||
// NOTE: the header of the block passed here is not necessarily sealed, as
|
||||
// it is for reconstructing the state transition.
|
||||
//
|
||||
// The header passed is from the original block data and is sealed.
|
||||
fn commit_block<B>(&self, block: B, header: &Header, block_data: encoded::Block, client: &Client) -> ImportRoute where B: Drain {
|
||||
fn commit_block<B>(&self, block: B, header: &Header, block_data: &[u8], client: &Client) -> ImportRoute where B: IsBlock + Drain {
|
||||
let hash = &header.hash();
|
||||
let number = header.number();
|
||||
let parent = header.parent_hash();
|
||||
let chain = client.chain.read();
|
||||
let is_finalized = false;
|
||||
|
||||
// Commit results
|
||||
let block = block.drain();
|
||||
debug_assert_eq!(header.hash(), block_data.header_view().hash());
|
||||
let receipts = block.receipts().to_owned();
|
||||
let traces = block.traces().clone().drain();
|
||||
|
||||
assert_eq!(header.hash(), view!(BlockView, block_data).header_view().hash());
|
||||
|
||||
//let traces = From::from(block.traces().clone().unwrap_or_else(Vec::new));
|
||||
|
||||
let mut batch = DBTransaction::new();
|
||||
|
||||
let ancestry_actions = self.engine.ancestry_actions(&block, &mut chain.ancestry_with_metadata_iter(*parent));
|
||||
let ancestry_actions = self.engine.ancestry_actions(block.block(), &mut chain.ancestry_with_metadata_iter(*parent));
|
||||
|
||||
let receipts = block.receipts;
|
||||
let traces = block.traces.drain();
|
||||
let best_hash = chain.best_block_hash();
|
||||
let metadata = block.block().metadata().map(Into::into);
|
||||
let is_finalized = block.block().is_finalized();
|
||||
|
||||
let new = ExtendedHeader {
|
||||
header: header.clone(),
|
||||
is_finalized,
|
||||
is_finalized: is_finalized,
|
||||
metadata: metadata,
|
||||
parent_total_difficulty: chain.block_details(&parent).expect("Parent block is in the database; qed").total_difficulty
|
||||
};
|
||||
|
||||
@@ -505,6 +503,8 @@ impl Importer {
|
||||
ExtendedHeader {
|
||||
parent_total_difficulty: details.total_difficulty - *header.difficulty(),
|
||||
is_finalized: details.is_finalized,
|
||||
metadata: details.metadata,
|
||||
|
||||
header: header,
|
||||
}
|
||||
};
|
||||
@@ -519,13 +519,13 @@ impl Importer {
|
||||
// CHECK! I *think* this is fine, even if the state_root is equal to another
|
||||
// already-imported block of the same number.
|
||||
// TODO: Prove it with a test.
|
||||
let mut state = block.state.drop().1;
|
||||
let mut state = block.drain();
|
||||
|
||||
// check epoch end signal, potentially generating a proof on the current
|
||||
// state.
|
||||
self.check_epoch_end_signal(
|
||||
&header,
|
||||
block_data.raw(),
|
||||
block_data,
|
||||
&receipts,
|
||||
&state,
|
||||
&chain,
|
||||
@@ -542,7 +542,8 @@ impl Importer {
|
||||
|
||||
let route = chain.insert_block(&mut batch, block_data, receipts.clone(), ExtrasInsert {
|
||||
fork_choice: fork_choice,
|
||||
is_finalized,
|
||||
is_finalized: is_finalized,
|
||||
metadata: new.metadata,
|
||||
});
|
||||
|
||||
client.tracedb.read().import(&mut batch, TraceImportRequest {
|
||||
@@ -623,9 +624,7 @@ impl Importer {
|
||||
).expect("state known to be available for just-imported block; qed");
|
||||
|
||||
let options = TransactOptions::with_no_tracing().dont_check_nonce();
|
||||
let machine = self.engine.machine();
|
||||
let schedule = machine.schedule(env_info.number);
|
||||
let res = Executive::new(&mut state, &env_info, &machine, &schedule)
|
||||
let res = Executive::new(&mut state, &env_info, self.engine.machine())
|
||||
.transact(&transaction, options);
|
||||
|
||||
let res = match res {
|
||||
@@ -947,7 +946,7 @@ impl Client {
|
||||
}
|
||||
|
||||
// prune ancient states until below the memory limit or only the minimum amount remain.
|
||||
fn prune_ancient(&self, mut state_db: StateDB, chain: &BlockChain) -> Result<(), ::error::Error> {
|
||||
fn prune_ancient(&self, mut state_db: StateDB, chain: &BlockChain) -> Result<(), ClientError> {
|
||||
let number = match state_db.journal_db().latest_era() {
|
||||
Some(n) => n,
|
||||
None => return Ok(()),
|
||||
@@ -1153,8 +1152,7 @@ impl Client {
|
||||
},
|
||||
};
|
||||
|
||||
let processing_threads = self.config.snapshot.processing_threads;
|
||||
snapshot::take_snapshot(&*self.engine, &self.chain.read(), start_hash, db.as_hashdb(), writer, p, processing_threads)?;
|
||||
snapshot::take_snapshot(&*self.engine, &self.chain.read(), start_hash, db.as_hashdb(), writer, p)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -1242,9 +1240,8 @@ impl Client {
|
||||
.dont_check_nonce()
|
||||
.save_output_from_contract();
|
||||
let original_state = if state_diff { Some(state.clone()) } else { None };
|
||||
let schedule = machine.schedule(env_info.number);
|
||||
|
||||
let mut ret = Executive::new(state, env_info, &machine, &schedule).transact_virtual(transaction, options)?;
|
||||
let mut ret = Executive::new(state, env_info, machine).transact_virtual(transaction, options)?;
|
||||
|
||||
if let Some(original) = original_state {
|
||||
ret.state_diff = Some(state.diff_from(original).map_err(ExecutionError::from)?);
|
||||
@@ -1299,7 +1296,9 @@ impl snapshot::DatabaseRestore for Client {
|
||||
let mut tracedb = self.tracedb.write();
|
||||
self.importer.miner.clear();
|
||||
let db = self.db.write();
|
||||
db.restore(new_db)?;
|
||||
db.key_value().restore(new_db)?;
|
||||
db.blooms().reopen()?;
|
||||
db.trace_blooms().reopen()?;
|
||||
|
||||
let cache_size = state_db.cache_size();
|
||||
*state_db = StateDB::new(journaldb::new(db.key_value().clone(), self.pruning, ::db::COL_STATE), cache_size);
|
||||
@@ -1335,7 +1334,7 @@ impl ChainInfo for Client {
|
||||
}
|
||||
|
||||
impl BlockInfo for Client {
|
||||
fn block_header(&self, id: BlockId) -> Option<encoded::Header> {
|
||||
fn block_header(&self, id: BlockId) -> Option<::encoded::Header> {
|
||||
let chain = self.chain.read();
|
||||
|
||||
Self::block_hash(&chain, id).and_then(|hash| chain.block_header_data(&hash))
|
||||
@@ -1352,7 +1351,7 @@ impl BlockInfo for Client {
|
||||
}
|
||||
|
||||
fn code_hash(&self, address: &Address, id: BlockId) -> Option<H256> {
|
||||
self.state_at(id).and_then(|s| s.code_hash(address).unwrap_or(None))
|
||||
self.state_at(id).and_then(|s| s.code_hash(address).ok())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1395,26 +1394,23 @@ impl CallContract for Client {
|
||||
}
|
||||
|
||||
impl ImportBlock for Client {
|
||||
fn import_block(&self, unverified: Unverified) -> Result<H256, BlockImportError> {
|
||||
if self.chain.read().is_known(&unverified.hash()) {
|
||||
bail!(BlockImportErrorKind::Import(ImportErrorKind::AlreadyInChain));
|
||||
}
|
||||
fn import_block(&self, bytes: Bytes) -> Result<H256, BlockImportError> {
|
||||
use verification::queue::kind::BlockLike;
|
||||
use verification::queue::kind::blocks::Unverified;
|
||||
|
||||
let status = self.block_status(BlockId::Hash(unverified.parent_hash()));
|
||||
if status == BlockStatus::Unknown {
|
||||
bail!(BlockImportErrorKind::Block(BlockError::UnknownParent(unverified.parent_hash())));
|
||||
}
|
||||
// create unverified block here so the `keccak` calculation can be cached.
|
||||
let unverified = Unverified::from_rlp(bytes)?;
|
||||
|
||||
let raw = unverified.bytes.clone();
|
||||
match self.importer.block_queue.import(unverified).map_err(Into::into) {
|
||||
Ok(res) => Ok(res),
|
||||
// we only care about block errors (not import errors)
|
||||
Err(BlockImportError(BlockImportErrorKind::Block(err), _))=> {
|
||||
self.importer.bad_blocks.report(raw, format!("{:?}", err));
|
||||
bail!(BlockImportErrorKind::Block(err))
|
||||
},
|
||||
Err(e) => Err(e),
|
||||
{
|
||||
if self.chain.read().is_known(&unverified.hash()) {
|
||||
bail!(BlockImportErrorKind::Import(ImportErrorKind::AlreadyInChain));
|
||||
}
|
||||
let status = self.block_status(BlockId::Hash(unverified.parent_hash()));
|
||||
if status == BlockStatus::Unknown || status == BlockStatus::Pending {
|
||||
bail!(BlockImportErrorKind::Block(BlockError::UnknownParent(unverified.parent_hash())));
|
||||
}
|
||||
}
|
||||
Ok(self.importer.block_queue.import(unverified)?)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1498,9 +1494,7 @@ impl Call for Client {
|
||||
let tx = tx.fake_sign(sender);
|
||||
|
||||
let mut clone = state.clone();
|
||||
let machine = self.engine.machine();
|
||||
let schedule = machine.schedule(env_info.number);
|
||||
Ok(Executive::new(&mut clone, &env_info, &machine, &schedule)
|
||||
Ok(Executive::new(&mut clone, &env_info, self.engine.machine())
|
||||
.transact_virtual(&tx, options())
|
||||
.map(|r| r.exception.is_none())
|
||||
.unwrap_or(false))
|
||||
@@ -1527,7 +1521,7 @@ impl Call for Client {
|
||||
where F: FnMut(U256) -> Result<bool, E>
|
||||
{
|
||||
while upper - lower > 1.into() {
|
||||
let mid = (lower + upper) / 2;
|
||||
let mid = (lower + upper) / 2.into();
|
||||
trace!(target: "estimate_gas", "{} .. {} .. {}", lower, mid, upper);
|
||||
let c = cond(mid)?;
|
||||
match c {
|
||||
@@ -1551,12 +1545,6 @@ impl EngineInfo for Client {
|
||||
}
|
||||
}
|
||||
|
||||
impl BadBlocks for Client {
|
||||
fn bad_blocks(&self) -> Vec<(Unverified, String)> {
|
||||
self.importer.bad_blocks.bad_blocks()
|
||||
}
|
||||
}
|
||||
|
||||
impl BlockChainClient for Client {
|
||||
fn replay(&self, id: TransactionId, analytics: CallAnalytics) -> Result<Executed, CallError> {
|
||||
let address = self.transaction_address(id).ok_or(CallError::TransactionNotFound)?;
|
||||
@@ -1715,9 +1703,6 @@ impl BlockChainClient for Client {
|
||||
if let Some(after) = after {
|
||||
if let Err(e) = iter.seek(after) {
|
||||
trace!(target: "fatdb", "list_accounts: Couldn't seek the DB: {:?}", e);
|
||||
} else {
|
||||
// Position the iterator after the `after` element
|
||||
iter.next();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1761,10 +1746,7 @@ impl BlockChainClient for Client {
|
||||
|
||||
if let Some(after) = after {
|
||||
if let Err(e) = iter.seek(after) {
|
||||
trace!(target: "fatdb", "list_storage: Couldn't seek the DB: {:?}", e);
|
||||
} else {
|
||||
// Position the iterator after the `after` element
|
||||
iter.next();
|
||||
trace!(target: "fatdb", "list_accounts: Couldn't seek the DB: {:?}", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1840,100 +1822,76 @@ impl BlockChainClient for Client {
|
||||
self.engine.additional_params().into_iter().collect()
|
||||
}
|
||||
|
||||
fn logs(&self, filter: Filter) -> Result<Vec<LocalizedLogEntry>, BlockId> {
|
||||
let chain = self.chain.read();
|
||||
fn logs(&self, filter: Filter) -> Vec<LocalizedLogEntry> {
|
||||
// Wrap the logic inside a closure so that we can take advantage of question mark syntax.
|
||||
let fetch_logs = || {
|
||||
let chain = self.chain.read();
|
||||
|
||||
// First, check whether `filter.from_block` and `filter.to_block` is on the canon chain. If so, we can use the
|
||||
// optimized version.
|
||||
let is_canon = |id| {
|
||||
match id {
|
||||
// If it is referred by number, then it is always on the canon chain.
|
||||
&BlockId::Earliest | &BlockId::Latest | &BlockId::Number(_) => true,
|
||||
// If it is referred by hash, we see whether a hash -> number -> hash conversion gives us the same
|
||||
// result.
|
||||
&BlockId::Hash(ref hash) => chain.is_canon(hash),
|
||||
}
|
||||
};
|
||||
|
||||
let blocks = if is_canon(&filter.from_block) && is_canon(&filter.to_block) {
|
||||
// If we are on the canon chain, use bloom filter to fetch required hashes.
|
||||
//
|
||||
// If we are sure the block does not exist (where val > best_block_number), then return error. Note that we
|
||||
// don't need to care about pending blocks here because RPC query sets pending back to latest (or handled
|
||||
// pending logs themselves).
|
||||
let from = match self.block_number_ref(&filter.from_block) {
|
||||
Some(val) if val <= chain.best_block_number() => val,
|
||||
_ => return Err(filter.from_block.clone()),
|
||||
};
|
||||
let to = match self.block_number_ref(&filter.to_block) {
|
||||
Some(val) if val <= chain.best_block_number() => val,
|
||||
_ => return Err(filter.to_block.clone()),
|
||||
// First, check whether `filter.from_block` and `filter.to_block` is on the canon chain. If so, we can use the
|
||||
// optimized version.
|
||||
let is_canon = |id| {
|
||||
match id {
|
||||
// If it is referred by number, then it is always on the canon chain.
|
||||
&BlockId::Earliest | &BlockId::Latest | &BlockId::Number(_) => true,
|
||||
// If it is referred by hash, we see whether a hash -> number -> hash conversion gives us the same
|
||||
// result.
|
||||
&BlockId::Hash(ref hash) => chain.is_canon(hash),
|
||||
}
|
||||
};
|
||||
|
||||
// If from is greater than to, then the current bloom filter behavior is to just return empty
|
||||
// result. There's no point to continue here.
|
||||
if from > to {
|
||||
return Err(filter.to_block.clone());
|
||||
}
|
||||
let blocks = if is_canon(&filter.from_block) && is_canon(&filter.to_block) {
|
||||
// If we are on the canon chain, use bloom filter to fetch required hashes.
|
||||
let from = self.block_number_ref(&filter.from_block)?;
|
||||
let to = self.block_number_ref(&filter.to_block)?;
|
||||
|
||||
chain.blocks_with_bloom(&filter.bloom_possibilities(), from, to)
|
||||
.into_iter()
|
||||
.filter_map(|n| chain.block_hash(n))
|
||||
.collect::<Vec<H256>>()
|
||||
} else {
|
||||
// Otherwise, we use a slower version that finds a link between from_block and to_block.
|
||||
let from_hash = match Self::block_hash(&chain, filter.from_block) {
|
||||
Some(val) => val,
|
||||
None => return Err(filter.from_block.clone()),
|
||||
};
|
||||
let from_number = match chain.block_number(&from_hash) {
|
||||
Some(val) => val,
|
||||
None => return Err(BlockId::Hash(from_hash)),
|
||||
};
|
||||
let to_hash = match Self::block_hash(&chain, filter.to_block) {
|
||||
Some(val) => val,
|
||||
None => return Err(filter.to_block.clone()),
|
||||
};
|
||||
chain.blocks_with_bloom(&filter.bloom_possibilities(), from, to)
|
||||
.into_iter()
|
||||
.filter_map(|n| chain.block_hash(n))
|
||||
.collect::<Vec<H256>>()
|
||||
} else {
|
||||
// Otherwise, we use a slower version that finds a link between from_block and to_block.
|
||||
let from_hash = Self::block_hash(&chain, filter.from_block)?;
|
||||
let from_number = chain.block_number(&from_hash)?;
|
||||
let to_hash = Self::block_hash(&chain, filter.from_block)?;
|
||||
|
||||
let blooms = filter.bloom_possibilities();
|
||||
let bloom_match = |header: &encoded::Header| {
|
||||
blooms.iter().any(|bloom| header.log_bloom().contains_bloom(bloom))
|
||||
};
|
||||
let blooms = filter.bloom_possibilities();
|
||||
let bloom_match = |header: &encoded::Header| {
|
||||
blooms.iter().any(|bloom| header.log_bloom().contains_bloom(bloom))
|
||||
};
|
||||
|
||||
let (blocks, last_hash) = {
|
||||
let mut blocks = Vec::new();
|
||||
let mut current_hash = to_hash;
|
||||
let (blocks, last_hash) = {
|
||||
let mut blocks = Vec::new();
|
||||
let mut current_hash = to_hash;
|
||||
|
||||
loop {
|
||||
let header = match chain.block_header_data(¤t_hash) {
|
||||
Some(val) => val,
|
||||
None => return Err(BlockId::Hash(current_hash)),
|
||||
};
|
||||
if bloom_match(&header) {
|
||||
blocks.push(current_hash);
|
||||
loop {
|
||||
let header = chain.block_header_data(¤t_hash)?;
|
||||
if bloom_match(&header) {
|
||||
blocks.push(current_hash);
|
||||
}
|
||||
|
||||
// Stop if `from` block is reached.
|
||||
if header.number() <= from_number {
|
||||
break;
|
||||
}
|
||||
current_hash = header.parent_hash();
|
||||
}
|
||||
|
||||
// Stop if `from` block is reached.
|
||||
if header.number() <= from_number {
|
||||
break;
|
||||
}
|
||||
current_hash = header.parent_hash();
|
||||
blocks.reverse();
|
||||
(blocks, current_hash)
|
||||
};
|
||||
|
||||
// Check if we've actually reached the expected `from` block.
|
||||
if last_hash != from_hash || blocks.is_empty() {
|
||||
return None;
|
||||
}
|
||||
|
||||
blocks.reverse();
|
||||
(blocks, current_hash)
|
||||
blocks
|
||||
};
|
||||
|
||||
// Check if we've actually reached the expected `from` block.
|
||||
if last_hash != from_hash || blocks.is_empty() {
|
||||
// In this case, from_hash is the cause (for not matching last_hash).
|
||||
return Err(BlockId::Hash(from_hash));
|
||||
}
|
||||
|
||||
blocks
|
||||
Some(self.chain.read().logs(blocks, |entry| filter.matches(entry), filter.limit))
|
||||
};
|
||||
|
||||
Ok(self.chain.read().logs(blocks, |entry| filter.matches(entry), filter.limit))
|
||||
fetch_logs().unwrap_or_default()
|
||||
}
|
||||
|
||||
fn filter_traces(&self, filter: TraceFilter) -> Option<Vec<LocalizedTrace>> {
|
||||
@@ -2064,6 +2022,10 @@ impl BlockChainClient for Client {
|
||||
fn registrar_address(&self) -> Option<Address> {
|
||||
self.registrar_address.clone()
|
||||
}
|
||||
|
||||
fn eip86_transition(&self) -> u64 {
|
||||
self.engine().params().eip86_transition
|
||||
}
|
||||
}
|
||||
|
||||
impl IoClient for Client {
|
||||
@@ -2088,23 +2050,24 @@ impl IoClient for Client {
|
||||
});
|
||||
}
|
||||
|
||||
fn queue_ancient_block(&self, unverified: Unverified, receipts_bytes: Bytes) -> Result<H256, BlockImportError> {
|
||||
fn queue_ancient_block(&self, block_bytes: Bytes, receipts_bytes: Bytes) -> Result<H256, BlockImportError> {
|
||||
trace_time!("queue_ancient_block");
|
||||
let header: Header = ::rlp::Rlp::new(&block_bytes).val_at(0)?;
|
||||
let hash = header.hash();
|
||||
|
||||
let hash = unverified.hash();
|
||||
{
|
||||
// check block order
|
||||
if self.chain.read().is_known(&hash) {
|
||||
bail!(BlockImportErrorKind::Import(ImportErrorKind::AlreadyInChain));
|
||||
}
|
||||
let parent_hash = unverified.parent_hash();
|
||||
let parent_hash = header.parent_hash();
|
||||
// NOTE To prevent race condition with import, make sure to check queued blocks first
|
||||
// (and attempt to acquire lock)
|
||||
let is_parent_pending = self.queued_ancient_blocks.read().0.contains(&parent_hash);
|
||||
let is_parent_pending = self.queued_ancient_blocks.read().0.contains(parent_hash);
|
||||
if !is_parent_pending {
|
||||
let status = self.block_status(BlockId::Hash(parent_hash));
|
||||
if status == BlockStatus::Unknown {
|
||||
bail!(BlockImportErrorKind::Block(BlockError::UnknownParent(parent_hash)));
|
||||
let status = self.block_status(BlockId::Hash(*parent_hash));
|
||||
if status == BlockStatus::Unknown || status == BlockStatus::Pending {
|
||||
bail!(BlockImportErrorKind::Block(BlockError::UnknownParent(*parent_hash)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2113,7 +2076,7 @@ impl IoClient for Client {
|
||||
{
|
||||
let mut queued = self.queued_ancient_blocks.write();
|
||||
queued.0.insert(hash);
|
||||
queued.1.push_back((unverified, receipts_bytes));
|
||||
queued.1.push_back((header, block_bytes, receipts_bytes));
|
||||
}
|
||||
|
||||
let queued = self.queued_ancient_blocks.clone();
|
||||
@@ -2125,10 +2088,11 @@ impl IoClient for Client {
|
||||
let _lock = lock.lock();
|
||||
for _i in 0..MAX_ANCIENT_BLOCKS_TO_IMPORT {
|
||||
let first = queued.write().1.pop_front();
|
||||
if let Some((unverified, receipts_bytes)) = first {
|
||||
let hash = unverified.hash();
|
||||
if let Some((header, block_bytes, receipts_bytes)) = first {
|
||||
let hash = header.hash();
|
||||
let result = client.importer.import_old_block(
|
||||
unverified,
|
||||
&header,
|
||||
&block_bytes,
|
||||
&receipts_bytes,
|
||||
&**client.db.read().key_value(),
|
||||
&*client.chain.read(),
|
||||
@@ -2192,7 +2156,7 @@ impl ReopenBlock for Client {
|
||||
}
|
||||
|
||||
impl PrepareOpenBlock for Client {
|
||||
fn prepare_open_block(&self, author: Address, gas_range_target: (U256, U256), extra_data: Bytes) -> Result<OpenBlock, EthcoreError> {
|
||||
fn prepare_open_block(&self, author: Address, gas_range_target: (U256, U256), extra_data: Bytes) -> OpenBlock {
|
||||
let engine = &*self.engine;
|
||||
let chain = self.chain.read();
|
||||
let best_header = chain.best_block_header();
|
||||
@@ -2211,7 +2175,7 @@ impl PrepareOpenBlock for Client {
|
||||
extra_data,
|
||||
is_epoch_begin,
|
||||
&mut chain.ancestry_with_metadata_iter(best_header.hash()),
|
||||
)?;
|
||||
).expect("OpenBlock::new only fails if parent state root invalid; state root of best block's header is never invalid; qed");
|
||||
|
||||
// Add uncles
|
||||
chain
|
||||
@@ -2227,7 +2191,7 @@ impl PrepareOpenBlock for Client {
|
||||
qed");
|
||||
});
|
||||
|
||||
Ok(open_block)
|
||||
open_block
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2252,7 +2216,7 @@ impl ImportSealedBlock for Client {
|
||||
let block_data = block.rlp_bytes();
|
||||
let header = block.header().clone();
|
||||
|
||||
let route = self.importer.commit_block(block, &header, encoded::Block::new(block_data), self);
|
||||
let route = self.importer.commit_block(block, &header, &block_data, self);
|
||||
trace!(target: "client", "Imported sealed block #{} ({})", number, h);
|
||||
self.state_db.write().sync_cache(&route.enacted, &route.retracted, false);
|
||||
route
|
||||
@@ -2438,7 +2402,6 @@ mod tests {
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use kvdb::DBTransaction;
|
||||
use blockchain::ExtrasInsert;
|
||||
use encoded;
|
||||
|
||||
let client = generate_dummy_client(0);
|
||||
let genesis = client.chain_info().best_block_hash;
|
||||
@@ -2451,9 +2414,10 @@ mod tests {
|
||||
let another_client = client.clone();
|
||||
thread::spawn(move || {
|
||||
let mut batch = DBTransaction::new();
|
||||
another_client.chain.read().insert_block(&mut batch, encoded::Block::new(new_block), Vec::new(), ExtrasInsert {
|
||||
another_client.chain.read().insert_block(&mut batch, &new_block, Vec::new(), ExtrasInsert {
|
||||
fork_choice: ::engines::ForkChoice::New,
|
||||
is_finalized: false,
|
||||
metadata: None,
|
||||
});
|
||||
go_thread.store(true, Ordering::SeqCst);
|
||||
});
|
||||
@@ -2535,7 +2499,7 @@ mod tests {
|
||||
block_hash: block_hash,
|
||||
block_number: block_number,
|
||||
cumulative_gas_used: gas_used,
|
||||
gas_used: gas_used - 5,
|
||||
gas_used: gas_used - 5.into(),
|
||||
contract_address: None,
|
||||
logs: vec![LocalizedLogEntry {
|
||||
entry: logs[0].clone(),
|
||||
|
||||
@@ -19,7 +19,6 @@ use std::fmt::{Display, Formatter, Error as FmtError};
|
||||
|
||||
use verification::{VerifierType, QueueConfig};
|
||||
use journaldb;
|
||||
use snapshot::SnapshotConfiguration;
|
||||
|
||||
pub use std::time::Duration;
|
||||
pub use blockchain::Config as BlockChainConfig;
|
||||
@@ -121,8 +120,6 @@ pub struct ClientConfig {
|
||||
pub check_seal: bool,
|
||||
/// Maximal number of transactions queued for verification in a separate thread.
|
||||
pub transaction_verification_queue_size: usize,
|
||||
/// Snapshot configuration
|
||||
pub snapshot: SnapshotConfiguration,
|
||||
}
|
||||
|
||||
impl Default for ClientConfig {
|
||||
@@ -147,7 +144,6 @@ impl Default for ClientConfig {
|
||||
history_mem: 32 * mb,
|
||||
check_seal: true,
|
||||
transaction_verification_queue_size: 8192,
|
||||
snapshot: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user