Compare commits
81 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94a784bfe9 | ||
|
|
2072341eca | ||
|
|
36d250a420 | ||
|
|
6f7548f596 | ||
|
|
1ccbe5cfd4 | ||
|
|
a8242ffef9 | ||
|
|
fb071acb09 | ||
|
|
51817baecd | ||
|
|
15ebc98877 | ||
|
|
b6a25ba30a | ||
|
|
abceaf3832 | ||
|
|
25c2f7e7fd | ||
|
|
27a0142af1 | ||
|
|
698fa6e8f6 | ||
|
|
ae312bcb01 | ||
|
|
d17ee979b8 | ||
|
|
4fb4ef6d24 | ||
|
|
1c82a0733f | ||
|
|
b54ddd027d | ||
|
|
61e56aba41 | ||
|
|
aecc6fc862 | ||
|
|
dd38573a28 | ||
|
|
c84d82580a | ||
|
|
506cee52e8 | ||
|
|
c58b52c21c | ||
|
|
f8326b6e27 | ||
|
|
ea0c13c0a4 | ||
|
|
a8668b371c | ||
|
|
32ea4d69a3 | ||
|
|
defd24c40e | ||
|
|
194101ed00 | ||
|
|
2ab8c72ce3 | ||
|
|
a75ba3620c | ||
|
|
54afb33333 | ||
|
|
3f42b6178f | ||
|
|
1460f6cc27 | ||
|
|
751210c963 | ||
|
|
7dfa57999b | ||
|
|
11fb967c6a | ||
|
|
c270599a23 | ||
|
|
412d0307cb | ||
|
|
33b5b36f44 | ||
|
|
ef7a82835a | ||
|
|
ac8f65dbbf | ||
|
|
725073a683 | ||
|
|
c5aed5bab1 | ||
|
|
cacbf256fe | ||
|
|
0cd972326c | ||
|
|
239cf91594 | ||
|
|
1700873f48 | ||
|
|
4adb44155d | ||
|
|
82b37bfa0d | ||
|
|
544725a018 | ||
|
|
26e253e554 | ||
|
|
610d9baba4 | ||
|
|
253ff3f37b | ||
|
|
54c2d6167f | ||
|
|
29ebddc64f | ||
|
|
fc129b4a26 | ||
|
|
a071d81fe9 | ||
|
|
9f94473eaf | ||
|
|
42437fbc57 | ||
|
|
f3cdd7bf21 | ||
|
|
5ee54b7298 | ||
|
|
06c7096054 | ||
|
|
b2277f65e4 | ||
|
|
c52a6c8fb7 | ||
|
|
7c7b181ca0 | ||
|
|
24a4fdf405 | ||
|
|
45f27cec34 | ||
|
|
6bd7db96fe | ||
|
|
ff398fe7ff | ||
|
|
3ebc769757 | ||
|
|
d60e6384d7 | ||
|
|
3fd58bdcbd | ||
|
|
ecbafb2390 | ||
|
|
adabd8198c | ||
|
|
c2487cfe07 | ||
|
|
e0141f8324 | ||
|
|
b52ac20660 | ||
|
|
3c85f29f11 |
@@ -1,30 +1,3 @@
|
||||
# NOTE: if you make changes here, remember to also update:
|
||||
# scripts/test-linux.sh
|
||||
# scripts/build-linux.sh
|
||||
# scripts/build-windows.sh
|
||||
|
||||
# Using 'cfg` is broken, see https://github.com/rust-lang/cargo/issues/6858
|
||||
#[target.'cfg(target_arch = "x86_64")']
|
||||
#rustflags = ["-Ctarget-feature=+aes,+sse2,+ssse3"]
|
||||
|
||||
# …so instead we list all target triples (Tier 1 64-bit platforms)
|
||||
[target.x86_64-unknown-linux-gnu]
|
||||
# Enables the aes-ni instructions for RustCrypto dependency.
|
||||
rustflags = ["-Ctarget-feature=+aes,+sse2,+ssse3"]
|
||||
|
||||
[target.x86_64-pc-windows-gnu]
|
||||
# Enables the aes-ni instructions for RustCrypto dependency.
|
||||
rustflags = ["-Ctarget-feature=+aes,+sse2,+ssse3"]
|
||||
|
||||
[target.x86_64-pc-windows-msvc]
|
||||
# Enables the aes-ni instructions for RustCrypto dependency.
|
||||
# Link the C runtime statically ; https://github.com/openethereum/openethereum/issues/6643
|
||||
rustflags = ["-Ctarget-feature=+aes,+sse2,+ssse3", "-Ctarget-feature=+crt-static"]
|
||||
|
||||
[target.x86_64-apple-darwin]
|
||||
# Enables the aes-ni instructions for RustCrypto dependency.
|
||||
rustflags = ["-Ctarget-feature=+aes,+sse2,+ssse3"]
|
||||
|
||||
[target.x86_64-unknown-linux-musl]
|
||||
# Enables the aes-ni instructions for RustCrypto dependency.
|
||||
rustflags = ["-Ctarget-feature=+aes,+sse2,+ssse3"]
|
||||
rustflags = ["-Ctarget-feature=+crt-static"]
|
||||
|
||||
@@ -16,7 +16,7 @@ target
|
||||
# idea ide
|
||||
.idea
|
||||
|
||||
# git folder is not ignored so vergen library can get the commit hash and date for the build
|
||||
#.git
|
||||
# git stuff
|
||||
.git
|
||||
|
||||
ethcore/res/ethereum/tests
|
||||
|
||||
2
.git-blame-ignore-revs
Normal file
2
.git-blame-ignore-revs
Normal file
@@ -0,0 +1,2 @@
|
||||
# Reformat the source code
|
||||
610d9baba4af83b5767c659ca2ccfed337af1056
|
||||
6
.github/CODE_OF_CONDUCT.md
vendored
6
.github/CODE_OF_CONDUCT.md
vendored
@@ -2,7 +2,7 @@
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
A primary goal of OpenEthereum project is to be inclusive to the largest number of contributors, with the most varied and diverse backgrounds possible. As such, we are committed to providing a friendly, safe and welcoming environment for all, regardless of gender, sexual orientation, ability, ethnicity, socioeconomic status, and religion (or lack thereof).
|
||||
A primary goal of OpenEthereum is to be inclusive to the largest number of contributors, with the most varied and diverse backgrounds possible. As such, we are committed to providing a friendly, safe and welcoming environment for all, regardless of gender, sexual orientation, ability, ethnicity, socioeconomic status, and religion (or lack thereof).
|
||||
|
||||
This code of conduct outlines our expectations for all those who participate in our community, as well as the consequences for unacceptable behavior.
|
||||
|
||||
@@ -63,7 +63,7 @@ Additionally, community organizers are available to help community members engag
|
||||
|
||||
## 7. Addressing Grievances
|
||||
|
||||
If you feel you have been falsely or unfairly accused of violating this Code of Conduct, you should notify Parity Technologies with a concise description of your grievance. Your grievance will be handled in accordance with our existing governing policies.
|
||||
If you feel you have been falsely or unfairly accused of violating this Code of Conduct, you should notify OpenEthereum Technologies with a concise description of your grievance. Your grievance will be handled in accordance with our existing governing policies.
|
||||
|
||||
## 8. Scope
|
||||
|
||||
@@ -73,7 +73,7 @@ This code of conduct and its related procedures also applies to unacceptable beh
|
||||
|
||||
## 9. Contact info
|
||||
|
||||
You can contact Parity via Email: community@parity.io
|
||||
You can contact OpenEthereum via Email: community@parity.io
|
||||
|
||||
## 10. License and attribution
|
||||
|
||||
|
||||
10
.github/CONTRIBUTING.md
vendored
10
.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://openethereum.github.io/wiki/Basic-Usage), [Configuration](https://openethereum.github.io/wiki/Configuring-OpenEthereum), and [FAQ](https://openethereum.github.io/wiki/FAQ) articles on our [wiki](https://openethereum.github.io/wiki)!
|
||||
|
||||
See also frequently asked questions [tagged with `parity`](https://ethereum.stackexchange.com/questions/tagged/parity?sort=votes&pageSize=50) on Stack Exchange.
|
||||
|
||||
@@ -35,11 +35,11 @@ There are a few basic ground-rules for contributors (including the maintainer(s)
|
||||
* **No pushing directly to the master branch**.
|
||||
* **All modifications** must be made in a **pull-request** to solicit feedback from other contributors.
|
||||
* Pull-requests cannot be merged before CI runs green and two reviewers have given their approval.
|
||||
* Contributors should adhere to the [Parity Ethereum Style Guide](https://wiki.parity.io/Parity-Ethereum-Style-Guide).
|
||||
* Contributors should adhere to the [Parity Ethereum Style Guide](https://openethereum.github.io/wiki/Parity-Ethereum-Style-Guide).
|
||||
|
||||
### Recommendations
|
||||
|
||||
* **Non-master branch names** *should* be prefixed with a short name moniker, followed by the associated Github Issue ID (if any), and a brief description of the task using the format `<GITHUB_USERNAME>-<ISSUE_ID>-<BRIEF_DESCRIPTION>` (e.g. `gavin-123-readme`). The name moniker helps people to inquiry about their unfinished work, and the GitHub Issue ID helps your future self and other developers (particularly those who are onboarding) find out about and understand the original scope of the task, and where it fits into OpenEthereum [Projects](https://github.com/openethereum/openethereum/projects).
|
||||
* **Non-master branch names** *should* be prefixed with a short name moniker, followed by the associated Github Issue ID (if any), and a brief description of the task using the format `<GITHUB_USERNAME>-<ISSUE_ID>-<BRIEF_DESCRIPTION>` (e.g. `gavin-123-readme`). The name moniker helps people to inquiry about their unfinished work, and the GitHub Issue ID helps your future self and other developers (particularly those who are onboarding) find out about and understand the original scope of the task, and where it fits into Parity Ethereum [Projects](https://github.com/openethereum/openethereum/projects).
|
||||
* **Remove stale branches periodically**
|
||||
|
||||
### Preparing Pull Requests
|
||||
@@ -63,4 +63,6 @@ When doing a review, make sure to look for any:
|
||||
|
||||
## License.
|
||||
|
||||
By contributing to OpenEthereum, you agree that your contributions will be licensed under the [GPLv3 License](../LICENSE).
|
||||
By contributing to Parity Ethereum, 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.
|
||||
|
||||
7
.github/ISSUE_TEMPLATE.md
vendored
7
.github/ISSUE_TEMPLATE.md
vendored
@@ -1,14 +1,11 @@
|
||||
_Before filing a new issue, please **provide the following information**._
|
||||
|
||||
_If you think that your issue is an exploitable security vulnerability, please mail your bugreport to security@parity.io instead; your submission might be eligible for our Bug Bounty._
|
||||
_You can find mode info on the reporting process in [SECURITY.md](https://github.com/openethereum/openethereum/blob/master/SECURITY.md)_
|
||||
|
||||
|
||||
- **OpenEthereum version**: 0.0.0
|
||||
- **Operating system**: Windows / MacOS / Linux
|
||||
- **Installation**: homebrew / one-line installer / built from source
|
||||
- **Fully synchronized**: no / yes
|
||||
- **Network**: ethereum / ropsten / goerli / ...
|
||||
- **Network**: ethereum / ropsten / kovan / ...
|
||||
- **Restarted**: no / yes
|
||||
|
||||
_Your issue description goes here below. Try to include **actual** vs. **expected behavior** and **steps to reproduce** the issue._
|
||||
|
||||
|
||||
21
.github/PULL_REQUEST_TEMPLATE.md
vendored
21
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,21 +0,0 @@
|
||||
Thank you for your Pull Request!
|
||||
|
||||
Before you submitting, please check that:
|
||||
|
||||
- [ ] You added a brief description of the PR, e.g.:
|
||||
- What does it do?
|
||||
- What important points reviewers should know?
|
||||
- Is there something left for follow-up PRs?
|
||||
- [ ] You labeled the PR with appropriate labels if you have permissions to do so.
|
||||
- [ ] You mentioned a related issue if this PR related to it, e.g. `Fixes #228` or `Related #1337`.
|
||||
- [ ] You asked any particular reviewers to review. If you aren't sure, start with GH suggestions.
|
||||
- [ ] Your PR adheres [the style guide](https://wiki.parity.io/Coding-guide)
|
||||
- In particular, mind the maximal line length.
|
||||
- There is no commented code checked in unless necessary.
|
||||
- Any panickers have a proof or removed.
|
||||
- [ ] You updated any rustdocs which may have changed
|
||||
|
||||
After you've read this notice feel free to remove it.
|
||||
Thank you!
|
||||
|
||||
✄ -----------------------------------------------------------------------------
|
||||
18
.github/workflows/audit.yml
vendored
18
.github/workflows/audit.yml
vendored
@@ -1,18 +0,0 @@
|
||||
name: Security audit
|
||||
on:
|
||||
pull_request:
|
||||
paths: Cargo.lock
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
jobs:
|
||||
security_audit:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v1
|
||||
with:
|
||||
fetch-depth: 50
|
||||
- name: Run cargo audit
|
||||
uses: actions-rs/audit-check@v1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
8
.github/workflows/build-test.yml
vendored
8
.github/workflows/build-test.yml
vendored
@@ -4,7 +4,7 @@ on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
- stable
|
||||
jobs:
|
||||
build-tests:
|
||||
@@ -23,13 +23,9 @@ jobs:
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@master
|
||||
uses: actions/checkout@main
|
||||
with:
|
||||
submodules: true
|
||||
# https://github.com/actions/cache/issues/133
|
||||
- name: Fixup the owner of ~/.cargo/
|
||||
if: matrix.platform == 'ubuntu-16.04'
|
||||
run: sudo chown -R $(whoami):$(id -ng) ~/.cargo/
|
||||
- name: Install toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
|
||||
282
.github/workflows/build.yml
vendored
282
.github/workflows/build.yml
vendored
@@ -7,6 +7,11 @@ on:
|
||||
tags:
|
||||
- v*
|
||||
|
||||
# Global vars
|
||||
env:
|
||||
AWS_REGION: "us-east-1"
|
||||
AWS_S3_ARTIFACTS_BUCKET: "openethereum-releases"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Release
|
||||
@@ -24,11 +29,7 @@ jobs:
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@master
|
||||
# https://github.com/actions/cache/issues/133
|
||||
- name: Fixup the owner of ~/.cargo/
|
||||
if: matrix.platform == 'ubuntu-16.04'
|
||||
run: sudo chown -R $(whoami):$(id -ng) ~/.cargo/
|
||||
uses: actions/checkout@main
|
||||
- name: Install toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
@@ -36,60 +37,305 @@ jobs:
|
||||
profile: minimal
|
||||
override: true
|
||||
- name: Cache cargo registry
|
||||
uses: actions/cache@v1.1.2
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.cargo/registry
|
||||
key: ${{ runner.os }}-cargo-registry-build-${{ hashFiles('**/Cargo.lock') }}
|
||||
- name: Cache cargo index
|
||||
uses: actions/cache@v1.1.2
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.cargo/git
|
||||
key: ${{ runner.os }}-cargo-git-build-${{ hashFiles('**/Cargo.lock') }}
|
||||
- name: Cache cargo build
|
||||
uses: actions/cache@v1.1.2
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: target
|
||||
key: ${{ runner.os }}-cargo-build-target-build-${{ hashFiles('**/Cargo.lock') }}
|
||||
- name: Cache sccache linux
|
||||
if: matrix.platform == 'ubuntu-16.04'
|
||||
uses: actions/cache@v1.1.2
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: "/home/runner/.cache/sccache"
|
||||
key: ${{ runner.os }}-sccache-build-${{ hashFiles('**/Cargo.lock') }}
|
||||
- name: Cache sccache MacOS
|
||||
if: matrix.platform == 'macos-latest'
|
||||
uses: actions/cache@v1.1.2
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: "/Users/runner/Library/Caches/Mozilla.sccache"
|
||||
key: ${{ runner.os }}-sccache-build-${{ hashFiles('**/Cargo.lock') }}
|
||||
- name: Cache sccache Windows
|
||||
if: matrix.platform == 'windows-latest'
|
||||
uses: actions/cache@v1.1.2
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: "C:\\Users\\runneradmin\\AppData\\Local\\Mozilla\\sccache\\cache"
|
||||
key: ${{ runner.os }}-sccache-build-${{ hashFiles('**/Cargo.lock') }}
|
||||
- name: Install sccache for ${{ matrix.platform }}
|
||||
shell: pwsh
|
||||
run: pwsh scripts/actions/install-sccache.ps1 ${{ runner.os}}
|
||||
|
||||
# ==============================
|
||||
# Windows Build
|
||||
# ==============================
|
||||
|
||||
- name: Install LLVM for Windows
|
||||
if: matrix.platform == 'windows-latest'
|
||||
run: choco install llvm
|
||||
|
||||
- name: Sccache statistics
|
||||
run: sccache --show-stats
|
||||
- name: Build OpenEthereum for windows
|
||||
|
||||
- name: Build OpenEthereum for Windows
|
||||
if: matrix.platform == 'windows-latest'
|
||||
run: sh scripts/actions/build-windows.sh ${{matrix.platform}}
|
||||
|
||||
- name: Upload Windows build
|
||||
uses: actions/upload-artifact@v2
|
||||
if: matrix.platform == 'windows-latest'
|
||||
with:
|
||||
name: windows-artifacts
|
||||
path: artifacts
|
||||
|
||||
# ==============================
|
||||
# Linux/Macos Build
|
||||
# ==============================
|
||||
|
||||
- name: Build OpenEthereum for ${{matrix.platform}}
|
||||
if: matrix.platform != 'windows-latest'
|
||||
run: sh scripts/actions/build-linux.sh ${{matrix.platform}}
|
||||
|
||||
- name: Upload Linux build
|
||||
uses: actions/upload-artifact@v2
|
||||
if: matrix.platform == 'ubuntu-16.04'
|
||||
with:
|
||||
name: linux-artifacts
|
||||
path: artifacts
|
||||
|
||||
- name: Upload MacOS build
|
||||
uses: actions/upload-artifact@v2
|
||||
if: matrix.platform == 'macos-latest'
|
||||
with:
|
||||
name: macos-artifacts
|
||||
path: artifacts
|
||||
|
||||
# ==============================
|
||||
# End builds
|
||||
# ==============================
|
||||
|
||||
- name: Stop sccache
|
||||
if: always()
|
||||
run: sccache --stop-server
|
||||
- name: Download artifact
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: ${{matrix.platform}}.artifacts.zip
|
||||
path: artifacts/
|
||||
|
||||
- name: Prepare build directory for cache
|
||||
shell: bash
|
||||
shell: bash
|
||||
run: bash scripts/actions/clean-target.sh
|
||||
|
||||
zip-artifacts-creator:
|
||||
name: Create zip artifacts
|
||||
needs: build
|
||||
runs-on: ubuntu-16.04
|
||||
steps:
|
||||
- name: Set env
|
||||
run: echo ::set-env name=RELEASE_VERSION::${GITHUB_REF#refs/*/}
|
||||
|
||||
# ==============================
|
||||
# Create ZIP files
|
||||
# ==============================
|
||||
|
||||
- name: Download Windows artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: windows-artifacts
|
||||
path: windows-artifacts
|
||||
|
||||
- name: Download Linux artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: linux-artifacts
|
||||
path: linux-artifacts
|
||||
|
||||
- name: Download MacOS artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: macos-artifacts
|
||||
path: macos-artifacts
|
||||
|
||||
- name: Display structure of downloaded files
|
||||
run: ls
|
||||
|
||||
- name: Create zip Linux
|
||||
id: create_zip_linux
|
||||
run: |
|
||||
cd linux-artifacts/
|
||||
zip -rT openethereum-linux-${{ env.RELEASE_VERSION }}.zip *
|
||||
ls openethereum-linux-${{ env.RELEASE_VERSION }}.zip
|
||||
cd ..
|
||||
mv linux-artifacts/openethereum-linux-${{ env.RELEASE_VERSION }}.zip .
|
||||
|
||||
echo "Setting outputs..."
|
||||
echo ::set-output name=LINUX_ARTIFACT::openethereum-linux-${{ env.RELEASE_VERSION }}.zip
|
||||
echo ::set-output name=LINUX_SHASUM::$(shasum -a 256 openethereum-linux-${{ env.RELEASE_VERSION }}.zip | awk '{print $1}')
|
||||
|
||||
- name: Create zip MacOS
|
||||
id: create_zip_macos
|
||||
run: |
|
||||
cd macos-artifacts/
|
||||
zip -rT openethereum-macos-${{ env.RELEASE_VERSION }}.zip *
|
||||
ls openethereum-macos-${{ env.RELEASE_VERSION }}.zip
|
||||
cd ..
|
||||
mv macos-artifacts/openethereum-macos-${{ env.RELEASE_VERSION }}.zip .
|
||||
|
||||
echo "Setting outputs..."
|
||||
echo ::set-output name=MACOS_ARTIFACT::openethereum-macos-${{ env.RELEASE_VERSION }}.zip
|
||||
echo ::set-output name=MACOS_SHASUM::$(shasum -a 256 openethereum-macos-${{ env.RELEASE_VERSION }}.zip | awk '{print $1}')
|
||||
|
||||
- name: Create zip Windows
|
||||
id: create_zip_windows
|
||||
run: |
|
||||
cd windows-artifacts/
|
||||
zip -rT openethereum-windows-${{ env.RELEASE_VERSION }}.zip *
|
||||
ls openethereum-windows-${{ env.RELEASE_VERSION }}.zip
|
||||
cd ..
|
||||
mv windows-artifacts/openethereum-windows-${{ env.RELEASE_VERSION }}.zip .
|
||||
|
||||
echo "Setting outputs..."
|
||||
echo ::set-output name=WINDOWS_ARTIFACT::openethereum-windows-${{ env.RELEASE_VERSION }}.zip
|
||||
echo ::set-output name=WINDOWS_SHASUM::$(shasum -a 256 openethereum-windows-${{ env.RELEASE_VERSION }}.zip | awk '{print $1}')
|
||||
|
||||
# =======================================================================
|
||||
# Upload artifacts
|
||||
# This is required to share artifacts between different jobs
|
||||
# =======================================================================
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: openethereum-linux-${{ env.RELEASE_VERSION }}.zip
|
||||
path: openethereum-linux-${{ env.RELEASE_VERSION }}.zip
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: openethereum-macos-${{ env.RELEASE_VERSION }}.zip
|
||||
path: openethereum-macos-${{ env.RELEASE_VERSION }}.zip
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: openethereum-windows-${{ env.RELEASE_VERSION }}.zip
|
||||
path: openethereum-windows-${{ env.RELEASE_VERSION }}.zip
|
||||
|
||||
# =======================================================================
|
||||
# Upload artifacts to S3
|
||||
# This is required by some software distribution systems which require
|
||||
# artifacts to be downloadable, like Brew on MacOS.
|
||||
# =======================================================================
|
||||
- name: Configure AWS credentials
|
||||
uses: aws-actions/configure-aws-credentials@v1
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
aws-region: ${{ env.AWS_REGION }}
|
||||
|
||||
- name: Copy files to S3 with the AWS CLI
|
||||
run: |
|
||||
# Deploy zip artifacts to S3 bucket to a directory whose name is the tagged release version.
|
||||
# Deploy macos binary artifact (if required, add more `aws s3 cp` commands to deploy specific OS versions)
|
||||
aws s3 cp macos-artifacts/openethereum s3://${{ env.AWS_S3_ARTIFACTS_BUCKET }}/${{ env.RELEASE_VERSION }}/macos/ --region ${{ env.AWS_REGION }}
|
||||
|
||||
outputs:
|
||||
linux-artifact: ${{ steps.create_zip_linux.outputs.LINUX_ARTIFACT }}
|
||||
linux-shasum: ${{ steps.create_zip_linux.outputs.LINUX_SHASUM }}
|
||||
macos-artifact: ${{ steps.create_zip_macos.outputs.MACOS_ARTIFACT }}
|
||||
macos-shasum: ${{ steps.create_zip_macos.outputs.MACOS_SHASUM }}
|
||||
windows-artifact: ${{ steps.create_zip_windows.outputs.WINDOWS_ARTIFACT }}
|
||||
windows-shasum: ${{ steps.create_zip_windows.outputs.WINDOWS_SHASUM }}
|
||||
|
||||
draft-release:
|
||||
name: Draft Release
|
||||
needs: zip-artifacts-creator
|
||||
runs-on: ubuntu-16.04
|
||||
steps:
|
||||
- name: Set env
|
||||
run: echo ::set-env name=RELEASE_VERSION::${GITHUB_REF#refs/*/}
|
||||
|
||||
# ==============================
|
||||
# Download artifacts
|
||||
# ==============================
|
||||
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: openethereum-linux-${{ env.RELEASE_VERSION }}.zip
|
||||
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: openethereum-macos-${{ env.RELEASE_VERSION }}.zip
|
||||
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: openethereum-windows-${{ env.RELEASE_VERSION }}.zip
|
||||
|
||||
- name: Display structure of downloaded files
|
||||
run: ls
|
||||
|
||||
# ==============================
|
||||
# Create release draft
|
||||
# ==============================
|
||||
|
||||
- name: Create Release Draft
|
||||
id: create_release_draft
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: OpenEthereum ${{ github.ref }}
|
||||
body: |
|
||||
This release contains <ADD_TEXT>
|
||||
|
||||
| System | Architecture | Binary | Sha256 Checksum |
|
||||
|:---:|:---:|:---:|:---|
|
||||
| <img src="https://gist.github.com/5chdn/1fce888fde1d773761f809b607757f76/raw/44c4f0fc63f1ea8e61a9513af5131ef65eaa6c75/apple.png" alt="Apple Icon by Pixel Perfect from https://www.flaticon.com/authors/pixel-perfect" style="width: 32px;"/> | x64 | [${{ needs.zip-artifacts-creator.outputs.macos-artifact }}](https://github.com/openethereum/openethereum/releases/download/${{ env.RELEASE_VERSION }}/${{ needs.zip-artifacts-creator.outputs.macos-artifact }}) | `${{ needs.zip-artifacts-creator.outputs.macos-shasum }}` |
|
||||
| <img src="https://gist.github.com/5chdn/1fce888fde1d773761f809b607757f76/raw/44c4f0fc63f1ea8e61a9513af5131ef65eaa6c75/linux.png" alt="Linux Icon by Pixel Perfect from https://www.flaticon.com/authors/pixel-perfect" style="width: 32px;"/> | x64 | [${{ needs.zip-artifacts-creator.outputs.linux-artifact }}](https://github.com/openethereum/openethereum/releases/download/${{ env.RELEASE_VERSION }}/${{ needs.zip-artifacts-creator.outputs.linux-artifact }}) | `${{ needs.zip-artifacts-creator.outputs.linux-shasum }}` |
|
||||
| <img src="https://gist.github.com/5chdn/1fce888fde1d773761f809b607757f76/raw/44c4f0fc63f1ea8e61a9513af5131ef65eaa6c75/windows.png" alt="Windows Icon by Pixel Perfect from https://www.flaticon.com/authors/pixel-perfect" style="width: 32px;"/> | x64 | [${{ needs.zip-artifacts-creator.outputs.windows-artifact }}](https://github.com/openethereum/openethereum/releases/download/${{ env.RELEASE_VERSION }}/${{ needs.zip-artifacts-creator.outputs.windows-artifact }}) | `${{ needs.zip-artifacts-creator.outputs.windows-shasum }}` |
|
||||
| | | | |
|
||||
| **System** | **Option** | - | **Resource** |
|
||||
| <img src="https://gist.github.com/5chdn/1fce888fde1d773761f809b607757f76/raw/44c4f0fc63f1ea8e61a9513af5131ef65eaa6c75/settings.png" alt="Settings Icon by Pixel Perfect from https://www.flaticon.com/authors/pixel-perfect" style="width: 32px;"/> | Docker | - | [hub.docker.com/r/openethereum/openethereum](https://hub.docker.com/r/openethereum/openethereum) |
|
||||
|
||||
draft: true
|
||||
prerelease: true
|
||||
|
||||
- name: Upload Release Asset - Linux
|
||||
id: upload_release_asset_linux
|
||||
uses: actions/upload-release-asset@v1.0.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release_draft.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
|
||||
asset_path: ./openethereum-linux-${{ env.RELEASE_VERSION }}.zip
|
||||
asset_name: openethereum-linux-${{ env.RELEASE_VERSION }}.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
- name: Upload Release Asset - MacOS
|
||||
id: upload_release_asset_macos
|
||||
uses: actions/upload-release-asset@v1.0.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release_draft.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
|
||||
asset_path: ./openethereum-macos-${{ env.RELEASE_VERSION }}.zip
|
||||
asset_name: openethereum-macos-${{ env.RELEASE_VERSION }}.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
- name: Upload Release Asset - Windows
|
||||
id: upload_release_asset_windows
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release_draft.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
|
||||
asset_path: ./openethereum-windows-${{ env.RELEASE_VERSION }}.zip
|
||||
asset_name: openethereum-windows-${{ env.RELEASE_VERSION }}.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
16
.github/workflows/check.yml
vendored
16
.github/workflows/check.yml
vendored
@@ -4,7 +4,7 @@ on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
- stable
|
||||
jobs:
|
||||
check:
|
||||
@@ -15,12 +15,9 @@ jobs:
|
||||
SCCACHE_IDLE_TIMEOUT: 0
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@master
|
||||
uses: actions/checkout@main
|
||||
with:
|
||||
submodules: true
|
||||
# https://github.com/actions/cache/issues/133
|
||||
- name: Fixup the owner of ~/.cargo/
|
||||
run: sudo chown -R $(whoami):$(id -ng) ~/.cargo/
|
||||
- name: Install stable toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
@@ -28,23 +25,23 @@ jobs:
|
||||
profile: minimal
|
||||
override: true
|
||||
- name: Cache cargo registry
|
||||
uses: actions/cache@v1.1.2
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.cargo/registry
|
||||
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
||||
- name: Cache cargo index
|
||||
uses: actions/cache@v1.1.2
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.cargo/git
|
||||
key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
|
||||
- name: Cache cargo build
|
||||
uses: actions/cache@v1.1.2
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: target
|
||||
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
||||
# Install sccache based on https://github.com/denoland/rusty_v8/blob/master/.github/workflows/ci.yml#L69
|
||||
- name: Cache sccache
|
||||
uses: actions/cache@v1.1.2
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: "/home/runner/.cache/sccache"
|
||||
key: ${{ runner.os }}-sccache-check-${{ hashFiles('**/Cargo.lock') }}
|
||||
@@ -83,6 +80,7 @@ jobs:
|
||||
- name: Stop sccache
|
||||
if: always()
|
||||
run: sccache --stop-server
|
||||
continue-on-error: true
|
||||
- name: Prepare build directory for cache
|
||||
shell: bash
|
||||
run: bash scripts/actions/clean-target.sh
|
||||
|
||||
2
.github/workflows/deploy-docker.yml
vendored
2
.github/workflows/deploy-docker.yml
vendored
@@ -3,7 +3,7 @@ name: Docker Image Release
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
tags:
|
||||
- v*
|
||||
|
||||
|
||||
20
.github/workflows/fmt.yml
vendored
Normal file
20
.github/workflows/fmt.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
on: [push, pull_request]
|
||||
|
||||
name: rustfmt
|
||||
|
||||
jobs:
|
||||
fmt:
|
||||
name: Rustfmt
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
- run: rustup component add rustfmt
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: fmt
|
||||
args: --all -- --check --config merge_imports=true
|
||||
6
.gitignore
vendored
6
.gitignore
vendored
@@ -38,8 +38,10 @@ node_modules
|
||||
|
||||
# Build artifacts
|
||||
out/
|
||||
parity-clib-examples/cpp/build/
|
||||
|
||||
.vscode
|
||||
rls/
|
||||
/openethereum.*
|
||||
/parity.*
|
||||
|
||||
# cargo remote artifacts
|
||||
remote-target
|
||||
|
||||
2
.gitmodules
vendored
2
.gitmodules
vendored
@@ -4,4 +4,4 @@
|
||||
branch = develop
|
||||
[submodule "ethcore/res/wasm-tests"]
|
||||
path = ethcore/res/wasm-tests
|
||||
url = https://github.com/openethereum/wasm-tests
|
||||
url = https://github.com/paritytech/wasm-tests
|
||||
|
||||
143
CHANGELOG.md
143
CHANGELOG.md
@@ -1,119 +1,34 @@
|
||||
## OpenEthereum [v3.0.0](https://github.com/openethereum/openethereum/releases/tag/v3.0.0)
|
||||
## OpenEthereum v3.1RC1
|
||||
|
||||
OpenEthereum v3.0.0 is the first release of OpenEthereum client as part of OpenEthereum project, divested from Parity Technologies.
|
||||
OpenEthereum 3.1rc1 is a candidate release based on v2.5.13 which is the last stable version known of the client that does not include any of the issues introduced in v2.7.
|
||||
It removes non core features like Ethereum Classic, Private Transactions, Light Client, Updater, IPFS and Swarm support, currently deprecated flags such as expanse, kotti, mordor testnets.
|
||||
|
||||
This release marks the transition from Parity Technologies infrastructure and bootnodes to the one managed by OpenEthereum project.
|
||||
Database migration utility currently in beta: https://github.com/openethereum/3.1-db-upgrade-tool
|
||||
|
||||
Parity-Ethereum v2.7 users can continue using their existing data folders. Command-line interface has also stayed identical.
|
||||
Unless specified otherwise, OpenEthereum v3.0.0 will detect if the user's database in the old Parity-Ethereum default path,
|
||||
and only if it's not found will write to the new default location.
|
||||
The full list of included changes from v2.5.13 to v3.1:
|
||||
|
||||
This release includes several major improvements to network and database stack:
|
||||
- Support for `eth/64` protocol and Node Discovery v4 `Ethereum Node Records` extension.
|
||||
- Accounts bloom is removed which should decrease the database size.
|
||||
- Remove classic, kotti, mordor, expanse (#52)
|
||||
- Added bad block header hash for ropsten (#49)
|
||||
- Remove accounts bloom (#33)
|
||||
- Bump jsonrpc-- to v15
|
||||
- Implement eth/64, remove eth/62 (#46)
|
||||
- No snapshotting by default (#11814)
|
||||
- Update Ellaism chainspec
|
||||
- Prometheus, heavy memory calls removed (#27)
|
||||
- Update ethereum/tests
|
||||
- Implement JSON test suite (#11801)
|
||||
- Fix issues during block sync (#11265)
|
||||
- Fix race same block (#11400)
|
||||
- EIP-2537: Precompile for BLS12-381 curve operations (#11707)
|
||||
- Remove private transactions
|
||||
- Remove GetNodeData
|
||||
- Remove IPFS integration (#11532)
|
||||
- Remove updater
|
||||
- Remove light client
|
||||
- Remove C and Java bindings (#11346)
|
||||
- Remove whisper (#10855)
|
||||
- EIP-2315: Simple Subroutines for the EVM (#11629)
|
||||
- Remove deprecated flags (removal of --geth flag)
|
||||
- Remove support for hardware wallets (#10678)
|
||||
- Update bootnodes
|
||||
|
||||
**Due to database changes this is a one-way upgrade. Please back up your database if you plan to continue using Parity-Ethereum v2.7.2.**
|
||||
|
||||
Note that this release drops support for IPFS and `eth/62` protocol. Additionally, it marks light client, private transactions and updater as deprecated features which may be removed in a future release.
|
||||
|
||||
The full list of included changes:
|
||||
- Add deprecation warnings (#11682)
|
||||
- Add Curl to Docker image (#11687)
|
||||
- v3 release version strings and track stable (#11680)
|
||||
- Fix sccache server errors (#11675)
|
||||
- Don't delete old db after migration (#11662)
|
||||
- rename inject to drain_transaction_overlay (#11657)
|
||||
- Drain the transaction overlay (#11654)
|
||||
- vergen library seems to depend not only on the .git folder content but also on the git binary (#11651)
|
||||
- New default paths (#11641)
|
||||
- Update EWF's chains with Istanbul transition block numbers (#11482)
|
||||
- add openethereum supplementary bootnodes, those are not active right now, but will be in case the network needs more power (#11650)
|
||||
- Remove Parity bootnodes (#11644)
|
||||
- Remove accounts bloom (#11589)
|
||||
- Deploy docker images on master (#11640)
|
||||
- Fix some compiler warnings (#11632)
|
||||
- Add support for non-fork side of Phoenix (#11627)
|
||||
- validate mainnet specs against all forks (#11625)
|
||||
- Fix ecrecover builtin (#11623)
|
||||
- Update .gitmodules (#11628)
|
||||
- ethcore/res: activate ecip-1088 phoenix on classic (#11598)
|
||||
- Upgrade parity-common deps to latest (#11620)
|
||||
- Fix Goerli syncing (#11604)
|
||||
- deps: switch to upstream ctrlc (#11617)
|
||||
- Deduplicating crate dependencies (part 3 of n) (#11614)
|
||||
- Deduplicating crate dependencies (part 2 of n, `slab`) (#11613)
|
||||
- Actually save ENR on creation and modification (#11602)
|
||||
- Activate POSDAO on xDai chain and update bootnodes (#11610)
|
||||
- Activate on-chain randomness in POA Core (#11609)
|
||||
- Deduplicating crate dependencies (part 1 of n) (#11606)
|
||||
- Update enodes for POA Sokol (#11611)
|
||||
- Remove .git folder from dogerignore file so vergen library can get build date and commit hash in the binary generatio vergen library can get build date and commit hash in the binary generation (#11608)
|
||||
- Reduced gas cost for static calls made to precompiles EIP2046/1352 (#11583)
|
||||
- `ethcore-bloom-journal` was renamed to `accounts-bloom` (#11605)
|
||||
- Use serde_json to export hardcoded sync (#11601)
|
||||
- Node Discovery v4 ENR Extension (EIP-868) (#11540)
|
||||
- Fix compile warnings (#11595)
|
||||
- Update version to 3.0.0-alpha.1 (#11592)
|
||||
- ethcore/res: bump canon fork hash for mordor and kotti testnets (#11584)
|
||||
- Update on push tags (#11590)
|
||||
- Replace deprecated tempdir dependency with tempfile (#11588)
|
||||
- Fix project name, links, rename the binaries (#11580)
|
||||
- Update Cargo.lock (#11573)
|
||||
- ci: workaround for the cache bug on Linux (#11568)
|
||||
- Increase the default pruning parameters (#11558)
|
||||
- Add Docker build and push to github actions (#11555)
|
||||
- Update README (#11578)
|
||||
- informant: display I/O stats (#11523)
|
||||
- [devp2p discovery]: remove `deprecated_echo_hash` (#11564)
|
||||
- [secretstore] create db_version file when database doesn't exist (#11570)
|
||||
- Remove Parity's Security Policy (#11565)
|
||||
- ethcore/res: enable ecip-1088 phoenix upgrade for kotti and mordor testnets (#11529)
|
||||
- Misc docs and renames …and one less clone (#11556)
|
||||
- [secretstore]: don't sign message with only zeroes (#11561)
|
||||
- [devp2p discovery]: cleanup (#11547)
|
||||
- Code cleanup in the sync module (#11552)
|
||||
- initial cleanup (#11542)
|
||||
- Warn if genesis constructor revert (#11550)
|
||||
- ethcore: cleanup after #11531 (#11546)
|
||||
- license update (#11543)
|
||||
- Less cloning when importing blocks (#11531)
|
||||
- Github Actions (#11528)
|
||||
- Fix Alpine Dockerfile (#11538)
|
||||
- Remove AuxiliaryData/AuxiliaryRequest (#11533)
|
||||
- [journaldb]: cleanup (#11534)
|
||||
- Remove references to parity-ethereum (#11525)
|
||||
- Drop IPFS support (#11532)
|
||||
- chain-supplier: fix warning reporting for GetNodeData request (#11530)
|
||||
- Faster kill_garbage (#11514)
|
||||
- [EngineSigner]: don't sign message with only zeroes (#11524)
|
||||
- fix compilation warnings (#11522)
|
||||
- [ethcore cleanup]: various unrelated fixes from `#11493` (#11507)
|
||||
- Add benchmark for transaction execution (#11509)
|
||||
- Add Smart Contract License v1.0
|
||||
- Misc fixes (#11510)
|
||||
- [dependencies]: unify `rustc-hex` (#11506)
|
||||
- Activate on-chain randomness in POA Sokol (#11505)
|
||||
- Grab bag of cleanup (#11504)
|
||||
- Implement eth/64 (EIP-2364) and drop support for eth/62 (#11472)
|
||||
- [dependencies]: remove `util/macros` (#11501)
|
||||
- OpenEthereum bootnodes are added (#11499)
|
||||
- [ci benches]: use `all-features` (#11496)
|
||||
- [verification]: make test-build compile standalone (#11495)
|
||||
- complete null-signatures removal (#11491)
|
||||
- Include the seal when populating the header for a new block (#11475)
|
||||
- fix compilation warnings (#11492)
|
||||
- cargo update -p cmake (#11490)
|
||||
- update to published rlp-derive (#11489)
|
||||
- Switch usage of Secret Store to the external lib (#11487)
|
||||
- Switch from the internal runtime lib to external one from crates.io (#11480)
|
||||
- Update params.rs (#11474)
|
||||
- weak_counts has been stabilized (#11476)
|
||||
- sync: remove broken eth_protocol_version method (#11473)
|
||||
- Use parity-crypto updated to use upstream rust-secp256k1 (#11406)
|
||||
- Cleanup some code in Aura (#11466)
|
||||
- upgrade some of the dependencies (#11467)
|
||||
- Some more release track changes to README.md (#11465)
|
||||
- Update simple one-line installer due to switching to a single stable release track (#11463)
|
||||
- update Dockerfile (#11461)
|
||||
- Implement EIP-2124 (#11456)
|
||||
- [eth classic chainspec]: remove `balance = 1` (#11459)
|
||||
|
||||
3697
Cargo.lock
generated
3697
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
125
Cargo.toml
125
Cargo.toml
@@ -2,7 +2,7 @@
|
||||
description = "OpenEthereum"
|
||||
name = "openethereum"
|
||||
# NOTE Make sure to update util/version/Cargo.toml as well
|
||||
version = "3.0.0"
|
||||
version = "3.1.0"
|
||||
license = "GPL-3.0"
|
||||
authors = [
|
||||
"OpenEthereum developers",
|
||||
@@ -10,75 +10,69 @@ authors = [
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
ansi_term = "0.11"
|
||||
atty = "0.2.8"
|
||||
blooms-db = { path = "util/blooms-db" }
|
||||
clap = "2"
|
||||
cli-signer= { path = "cli-signer" }
|
||||
client-traits = { path = "ethcore/client-traits" }
|
||||
common-types = { path = "ethcore/types" }
|
||||
ctrlc = { version = "3.1.4", features = ["termination"] }
|
||||
dir = { path = "util/dir" }
|
||||
log = "0.4"
|
||||
rustc-hex = "1.0"
|
||||
docopt = "1.0"
|
||||
engine = { path = "ethcore/engine" }
|
||||
ethabi = { version = "12.0", optional = true }
|
||||
clap = "2"
|
||||
term_size = "0.3"
|
||||
textwrap = "0.9"
|
||||
num_cpus = "1.2"
|
||||
number_prefix = "0.2"
|
||||
rpassword = "1.0"
|
||||
semver = "0.9"
|
||||
ansi_term = "0.10"
|
||||
parking_lot = "0.7"
|
||||
regex = "1.0"
|
||||
atty = "0.2.8"
|
||||
toml = "0.4"
|
||||
serde = "1.0"
|
||||
serde_json = "1.0"
|
||||
serde_derive = "1.0"
|
||||
futures = "0.1"
|
||||
hyper = { version = "0.12" }
|
||||
fdlimit = "0.1"
|
||||
ctrlc = { git = "https://github.com/paritytech/rust-ctrlc.git" }
|
||||
jsonrpc-core = "15.0.0"
|
||||
parity-bytes = "0.1"
|
||||
common-types = { path = "ethcore/types" }
|
||||
ethcore = { path = "ethcore", features = ["parity"] }
|
||||
ethcore-accounts = { path = "accounts", optional = true }
|
||||
ethcore-blockchain = { path = "ethcore/blockchain" }
|
||||
ethcore-call-contract = { path = "ethcore/call-contract", optional = true }
|
||||
ethcore-call-contract = { path = "ethcore/call-contract"}
|
||||
ethcore-db = { path = "ethcore/db" }
|
||||
ethcore-io = { path = "util/io" }
|
||||
ethcore-light = { path = "ethcore/light" }
|
||||
ethcore-logger = { path = "parity/logger" }
|
||||
ethcore-miner = { path = "miner" }
|
||||
ethcore-network = { path = "util/network" }
|
||||
ethcore-private-tx = { path = "ethcore/private-tx" }
|
||||
ethcore-service = { path = "ethcore/service" }
|
||||
ethcore-sync = { path = "ethcore/sync" }
|
||||
ethereum-types = "0.9.0"
|
||||
ethereum-types = "0.4"
|
||||
ethkey = { path = "accounts/ethkey" }
|
||||
ethstore = { path = "accounts/ethstore" }
|
||||
fdlimit = "0.1"
|
||||
futures = "0.1"
|
||||
journaldb = { path = "util/journaldb" }
|
||||
jsonrpc-core = "14.0.3"
|
||||
keccak-hash = "0.5.0"
|
||||
kvdb = "0.5.0"
|
||||
kvdb-rocksdb = "0.7.0"
|
||||
log = "0.4"
|
||||
migration-rocksdb = { path = "util/migration-rocksdb" }
|
||||
fetch = { path = "util/fetch" }
|
||||
node-filter = { path = "ethcore/node-filter" }
|
||||
num_cpus = "1.2"
|
||||
number_prefix = "0.2"
|
||||
panic_hook = { path = "util/panic-hook" }
|
||||
parity-bytes = "0.1"
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
rlp = { version = "0.3.0", features = ["ethereum"] }
|
||||
cli-signer= { path = "cli-signer" }
|
||||
parity-daemonize = "0.3"
|
||||
parity-hash-fetch = { path = "updater/hash-fetch" }
|
||||
parity-local-store = { path = "miner/local-store" }
|
||||
parity-path = "0.1"
|
||||
parity-runtime = { path = "util/runtime" }
|
||||
parity-rpc = { path = "rpc" }
|
||||
parity-runtime = "0.1.1"
|
||||
parity-secretstore = { git = "https://github.com/paritytech/secret-store", branch = "v1.x", optional = true }
|
||||
parity-updater = { path = "updater" }
|
||||
parity-util-mem = { version = "0.6.0", features = ["jemalloc-global"] }
|
||||
parity-version = { path = "util/version" }
|
||||
parking_lot = "0.10.0"
|
||||
regex = "1.0"
|
||||
parity-path = "0.1"
|
||||
dir = { path = "util/dir" }
|
||||
panic_hook = { path = "util/panic-hook" }
|
||||
keccak-hash = "0.1"
|
||||
migration-rocksdb = { path = "util/migration-rocksdb" }
|
||||
kvdb = "0.1"
|
||||
kvdb-rocksdb = "0.1.3"
|
||||
journaldb = { path = "util/journaldb" }
|
||||
stats = { path = "util/stats" }
|
||||
prometheus = "0.9.0"
|
||||
|
||||
ethcore-secretstore = { path = "secret-store", optional = true }
|
||||
|
||||
registrar = { path = "util/registrar" }
|
||||
rlp = "0.4.5"
|
||||
rpassword = "1.0"
|
||||
rustc-hex = "2.1.0"
|
||||
semver = "0.9"
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
serde_json = "1.0"
|
||||
snapshot = { path = "ethcore/snapshot" }
|
||||
spec = { path = "ethcore/spec" }
|
||||
term_size = "0.3"
|
||||
textwrap = "0.11.0"
|
||||
toml = "0.5.6"
|
||||
verification = { path = "ethcore/verification" }
|
||||
|
||||
[build-dependencies]
|
||||
rustc_version = "0.2"
|
||||
@@ -86,28 +80,33 @@ rustc_version = "0.2"
|
||||
[dev-dependencies]
|
||||
pretty_assertions = "0.1"
|
||||
ipnetwork = "0.12.6"
|
||||
tempfile = "3.1"
|
||||
tempdir = "0.3"
|
||||
fake-fetch = { path = "util/fake-fetch" }
|
||||
lazy_static = "1.2.0"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
winapi = { version = "0.3.8", features = ["winsock2", "winuser", "shellapi"] }
|
||||
winapi = { version = "0.3.4", features = ["winsock2", "winuser", "shellapi"] }
|
||||
|
||||
[features]
|
||||
default = ["accounts"]
|
||||
accounts = ["ethcore-accounts", "parity-rpc/accounts"]
|
||||
miner-debug = ["ethcore/miner-debug"]
|
||||
json-tests = ["ethcore/json-tests"]
|
||||
ci-skip-tests = ["ethcore/ci-skip-tests"]
|
||||
test-heavy = ["ethcore/test-heavy"]
|
||||
evm-debug = ["ethcore/evm-debug"]
|
||||
evm-debug-tests = ["ethcore/evm-debug-tests"]
|
||||
slow-blocks = ["ethcore/slow-blocks"]
|
||||
secretstore = ["parity-secretstore", "accounts", "ethabi", "ethcore-call-contract"]
|
||||
secretstore = ["ethcore-secretstore", "ethcore-secretstore/accounts"]
|
||||
final = ["parity-version/final"]
|
||||
deadlock_detection = ["parking_lot/deadlock_detection"]
|
||||
# hardcode version number 1.3.7 of parity to force an update
|
||||
# in order to manually test that parity fall-over to the local version
|
||||
# in case of invalid or deprecated command line arguments are entered
|
||||
test-updater = ["parity-updater/test-updater"]
|
||||
# to create a memory profile (requires nightly rust), use e.g.
|
||||
# `heaptrack /path/to/parity <parity params>`,
|
||||
# to visualize a memory profile, use `heaptrack_gui`
|
||||
# or
|
||||
# `valgrind --tool=massif /path/to/parity <parity params>`
|
||||
# and `massif-visualizer` for visualization
|
||||
memory_profiling = []
|
||||
|
||||
[lib]
|
||||
path = "parity/lib.rs"
|
||||
@@ -116,6 +115,10 @@ path = "parity/lib.rs"
|
||||
path = "parity/main.rs"
|
||||
name = "openethereum"
|
||||
|
||||
[profile.test]
|
||||
lto = false
|
||||
opt-level = 3 # makes tests slower to compile, but faster to run
|
||||
|
||||
[profile.release]
|
||||
debug = false
|
||||
lto = true
|
||||
@@ -130,4 +133,12 @@ members = [
|
||||
"chainspec",
|
||||
"ethcore/wasm/run",
|
||||
"evmbin",
|
||||
"util/triehash-ethereum",
|
||||
"util/keccak-hasher",
|
||||
"util/patricia-trie-ethereum",
|
||||
"util/fastmap",
|
||||
"util/time-utils"
|
||||
]
|
||||
|
||||
[patch.crates-io]
|
||||
heapsize = { git = "https://github.com/cheme/heapsize.git", branch = "ec-macfix" }
|
||||
|
||||
10
README.md
10
README.md
@@ -46,7 +46,7 @@ OpenEthereum's goal is to be the fastest, lightest, and most secure Ethereum cli
|
||||
|
||||
By default, OpenEthereum 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 OpenEthereum, check out the [old wiki for documentation](https://wiki.parity.io/), feel free to [file an issue in this repository](https://github.com/openethereum/openethereum/issues/new), or hop on our [Discord](https://discord.io/openethereum) chat room to ask a question. We are glad to help!
|
||||
If you run into problems while using OpenEthereum, check out the [old wiki for documentation](https://openethereum.github.io/wiki/), feel free to [file an issue in this repository](https://github.com/openethereum/openethereum/issues/new), or hop on our [Discord](https://discord.io/openethereum) chat room to ask a question. We are glad to help!
|
||||
|
||||
You can download OpenEthereum's latest release at [the releases page](https://github.com/openethereum/openethereum/releases) or follow the instructions below to build from source. Read the [CHANGELOG.md](CHANGELOG.md) for a list of all changes between different versions.
|
||||
|
||||
@@ -135,7 +135,7 @@ To start OpenEthereum as a regular user using `systemd` init:
|
||||
1. Copy `./scripts/openethereum.service` to your
|
||||
`systemd` user directory (usually `~/.config/systemd/user`).
|
||||
2. Copy release to bin folder, write `sudo install ./target/release/openethereum /usr/bin/openethereum`
|
||||
3. To configure OpenEthereum, see [our old wiki](https://paritytech.github.io/wiki/Configuring-Parity) for details.
|
||||
3. To configure OpenEthereum, see [our old wiki](https://openethereum.github.io/wiki/Configuring-OpenEthereum) for details.
|
||||
|
||||
## 4. Testing <a id="chapter-004"></a>
|
||||
|
||||
@@ -157,7 +157,7 @@ You can show your logs in the test output by passing `--nocapture` (i.e. `cargo
|
||||
|
||||
## 5. Documentation <a id="chapter-005"></a>
|
||||
|
||||
Be sure to [check out our old wiki](https://wiki.parity.io) for more information.
|
||||
Be sure to [check out our old wiki](https://openethereum.github.io/wiki/) for more information.
|
||||
|
||||
### Viewing documentation for OpenEthereum packages
|
||||
|
||||
@@ -230,10 +230,6 @@ Caching, Importing Blocks, and Block Information
|
||||
```bash
|
||||
node-filter
|
||||
```
|
||||
* Private Transactions
|
||||
```bash
|
||||
ethcore-private-tx
|
||||
```
|
||||
* OpenEthereum Client & Network Service Creation & Registration with the I/O Subsystem
|
||||
```bash
|
||||
ethcore-service
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
SMART CONTRACT LICENSE v1.0
|
||||
|
||||
|
||||
Anyone may run, modify, publicly perform, distribute and redistribute this
|
||||
software, and create derivative works based on it in each case in compliance
|
||||
with the permissions granted by the document (“Permissions Document”) whose
|
||||
**KECCAK256 HASH** equals the value found in the PUBLICLY READABLE VARIABLE
|
||||
named permissionsDocumentHash on the **ETHEREUM MAINNET** **SMART CONTRACT
|
||||
ACCOUNT** with the following ADDRESS 0x5a88CA36Fd58Efde3b955758285E8e3347D1eAe3
|
||||
which is deemed incorporated into this license by reference. In case of any
|
||||
conflicts between this license and the Permissions Document, this license shall
|
||||
prevail.
|
||||
|
||||
|
||||
Where:
|
||||
- KECCAK256 HASH is the cryptographic hash algorithm that may take any document,
|
||||
expressed as a series of bytes, and convert it to a single value which may be
|
||||
expressed as a number from 0 to `2**256`;
|
||||
- ETHEREUM MAINNET is the peer-to-peer blockchain network and shared account
|
||||
ledger initiated and recognised by the Ethereum Foundation as "Ethereum";
|
||||
- SMART CONTRACT ACCOUNT is a single account to be found on the ETHEREUM MAINNET
|
||||
identified by an ADDRESS and which represents the combination of a computer
|
||||
programme and some associated values;
|
||||
- ADDRESS is a number between 0 and `2**160`, which is the primary means of
|
||||
identifying a single account on the ETHEREUM MAINNET;
|
||||
- PUBLICLY READABLE VARIABLE is an item in a smart contract storage, publicly
|
||||
accessible via the smart contract’s ABI using a getter function matching its
|
||||
name.
|
||||
|
||||
This license supplements and does not replace any other license pertaining to
|
||||
this software.
|
||||
|
||||
No permissions are granted if no **KECCAK256 HASH** appears in the *ETHEREUM
|
||||
MAINNET** **SMART CONTRACT ACCOUNT**.
|
||||
|
||||
This license takes effect as a bare licence, and has the effect of granting
|
||||
rights to each licensee (which may be subject to conditions), BUT IMPOSES NO
|
||||
OBLIGATIONS OR LIABILITY ON ANY LICENSOR, ANY OWNER OF RIGHTS IN THE SOFTWARE,
|
||||
OR ANY PERSON INVOLVED IN THE DESIGN, DEVELOPMENT AND CODING OF THE SOFTWARE
|
||||
(“GRANTOR”).
|
||||
|
||||
Each Grantor shall, to the maximum extent permitted by law, have no liability
|
||||
for direct, indirect, special, incidental, consequential, exemplary, punitive or
|
||||
other damages of any character including, without limitation, procurement of
|
||||
substitute software or services, loss of use, data or profits, or business
|
||||
interruption, however caused and on any theory of contract, warranty, tort
|
||||
(including negligence), product liability or otherwise, arising in any way in
|
||||
relation to the supply, licensing or operation of the software, even if advised
|
||||
of the possibility of such damages.
|
||||
@@ -1,5 +1,6 @@
|
||||
[package]
|
||||
description = "OpenEthereum Account Management"
|
||||
homepage = "https://github.com/openethereum/openethereum"
|
||||
license = "GPL-3.0"
|
||||
name = "ethcore-accounts"
|
||||
version = "0.1.0"
|
||||
@@ -7,15 +8,15 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
common-types = { path = "../ethcore/types" }
|
||||
ethkey = { path = "ethkey" }
|
||||
ethstore = { path = "ethstore" }
|
||||
log = "0.4"
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
parking_lot = "0.10.0"
|
||||
parking_lot = "0.7"
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
serde_json = "1.0"
|
||||
|
||||
[dev-dependencies]
|
||||
ethereum-types = "0.9.0"
|
||||
tempfile = "3.1"
|
||||
ethereum-types = "0.4"
|
||||
tempdir = "0.3"
|
||||
|
||||
@@ -1,13 +1,21 @@
|
||||
[package]
|
||||
description = "OpenEthereum Keys Generator"
|
||||
description = "Parity Ethereum Keys Generator"
|
||||
name = "ethkey"
|
||||
version = "0.4.0"
|
||||
version = "0.3.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
|
||||
[dependencies]
|
||||
edit-distance = "2.0"
|
||||
parity-crypto = "0.3.0"
|
||||
eth-secp256k1 = { git = "https://github.com/paritytech/rust-secp256k1", rev = "ccc06e7480148b723eb44ac56cf4d20eec380b6f" }
|
||||
ethereum-types = "0.4"
|
||||
lazy_static = "1.0"
|
||||
log = "0.4"
|
||||
memzero = { path = "../../util/memzero" }
|
||||
parity-wordlist = "1.3"
|
||||
quick-error = "1.2.2"
|
||||
rand = "0.4"
|
||||
rustc-hex = "1.0"
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
parity-wordlist = "1.3.1"
|
||||
tiny-keccak = "1.4"
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
## ethkey-cli
|
||||
|
||||
OpenEthereum keys generator.
|
||||
Parity Ethereum keys generator.
|
||||
|
||||
### Usage
|
||||
|
||||
```
|
||||
OpenEthereum Keys Generator.
|
||||
Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
Parity Ethereum Keys Generator.
|
||||
Copyright 2015-2019 Parity Technologies (UK) Ltd.
|
||||
|
||||
Usage:
|
||||
ethkey info <secret-or-phrase> [options]
|
||||
@@ -211,11 +211,10 @@ public: 4e19a5fdae82596e1485c69b687c9cc52b5078e5b0668ef3ce8543cd90e712cb00df822
|
||||
address: 00cf3711cbd3a1512570639280758118ba0b2bcb
|
||||
```
|
||||
|
||||
## OpenEthereum toolchain
|
||||
_This project is a part of the OpenEthereum toolchain._
|
||||
## Parity Ethereum toolchain
|
||||
_This project is a part of the Parity Ethereum toolchain._
|
||||
|
||||
- [evmbin](https://github.com/openethereum/openethereum/blob/master/evmbin/) - EVM implementation for OpenEthereum.
|
||||
- [ethabi](https://github.com/OpenEthereum/ethabi) - OpenEthereum function calls encoding.
|
||||
- [ethstore](https://github.com/openethereum/openethereum/blob/master/accounts/ethstore) - OpenEthereum key management.
|
||||
- [ethkey](https://github.com/openethereum/openethereum/blob/master/accounts/ethkey) - OpenEthereum keys generator.
|
||||
- [whisper](https://github.com/OpenEthereum/whisper) - Implementation of Whisper-v2 PoC.
|
||||
- [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/accounts/ethstore) - Parity Ethereum key management.
|
||||
- [ethkey](https://github.com/paritytech/parity-ethereum/blob/master/accounts/ethkey) - Parity Ethereum keys generator.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
description = "OpenEthereum Keys Generator CLI"
|
||||
description = "Parity Ethereum Keys Generator CLI"
|
||||
name = "ethkey-cli"
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
@@ -9,9 +9,8 @@ docopt = "1.0"
|
||||
env_logger = "0.5"
|
||||
ethkey = { path = "../" }
|
||||
panic_hook = { path = "../../../util/panic-hook" }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
parity-wordlist= "1.3.1"
|
||||
rustc-hex = "2.1.0"
|
||||
parity-wordlist="1.3"
|
||||
rustc-hex = "1.0"
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
threadpool = "1.7"
|
||||
|
||||
@@ -1,25 +1,24 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
extern crate docopt;
|
||||
extern crate env_logger;
|
||||
extern crate ethkey;
|
||||
extern crate panic_hook;
|
||||
extern crate parity_wordlist;
|
||||
extern crate parity_crypto;
|
||||
extern crate rustc_hex;
|
||||
extern crate serde;
|
||||
extern crate threadpool;
|
||||
@@ -27,17 +26,18 @@ extern crate threadpool;
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
|
||||
use std::num::ParseIntError;
|
||||
use std::{env, fmt, process, io, sync};
|
||||
use std::{env, fmt, io, num::ParseIntError, process, sync};
|
||||
|
||||
use docopt::Docopt;
|
||||
use ethkey::{Brain, BrainPrefix, Prefix, brain_recover};
|
||||
use parity_crypto::publickey::{KeyPair, Random, Error as EthkeyError, Generator, sign, verify_public, verify_address};
|
||||
use ethkey::{
|
||||
brain_recover, sign, verify_address, verify_public, Brain, BrainPrefix, Error as EthkeyError,
|
||||
Generator, KeyPair, Prefix, Random,
|
||||
};
|
||||
use rustc_hex::{FromHex, FromHexError};
|
||||
|
||||
const USAGE: &'static str = r#"
|
||||
OpenEthereum keys generator.
|
||||
Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
Parity Ethereum keys generator.
|
||||
Copyright 2015-2019 Parity Technologies (UK) Ltd.
|
||||
|
||||
Usage:
|
||||
ethkey info <secret-or-phrase> [options]
|
||||
@@ -67,387 +67,428 @@ Commands:
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct Args {
|
||||
cmd_info: bool,
|
||||
cmd_generate: bool,
|
||||
cmd_random: bool,
|
||||
cmd_prefix: bool,
|
||||
cmd_sign: bool,
|
||||
cmd_verify: bool,
|
||||
cmd_public: bool,
|
||||
cmd_address: bool,
|
||||
cmd_recover: bool,
|
||||
arg_prefix: String,
|
||||
arg_secret: String,
|
||||
arg_secret_or_phrase: String,
|
||||
arg_known_phrase: String,
|
||||
arg_message: String,
|
||||
arg_public: String,
|
||||
arg_address: String,
|
||||
arg_signature: String,
|
||||
flag_secret: bool,
|
||||
flag_public: bool,
|
||||
flag_address: bool,
|
||||
flag_brain: bool,
|
||||
cmd_info: bool,
|
||||
cmd_generate: bool,
|
||||
cmd_random: bool,
|
||||
cmd_prefix: bool,
|
||||
cmd_sign: bool,
|
||||
cmd_verify: bool,
|
||||
cmd_public: bool,
|
||||
cmd_address: bool,
|
||||
cmd_recover: bool,
|
||||
arg_prefix: String,
|
||||
arg_secret: String,
|
||||
arg_secret_or_phrase: String,
|
||||
arg_known_phrase: String,
|
||||
arg_message: String,
|
||||
arg_public: String,
|
||||
arg_address: String,
|
||||
arg_signature: String,
|
||||
flag_secret: bool,
|
||||
flag_public: bool,
|
||||
flag_address: bool,
|
||||
flag_brain: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
enum Error {
|
||||
Ethkey(EthkeyError),
|
||||
FromHex(FromHexError),
|
||||
ParseInt(ParseIntError),
|
||||
Docopt(docopt::Error),
|
||||
Io(io::Error),
|
||||
Ethkey(EthkeyError),
|
||||
FromHex(FromHexError),
|
||||
ParseInt(ParseIntError),
|
||||
Docopt(docopt::Error),
|
||||
Io(io::Error),
|
||||
}
|
||||
|
||||
impl From<EthkeyError> for Error {
|
||||
fn from(err: EthkeyError) -> Self {
|
||||
Error::Ethkey(err)
|
||||
}
|
||||
fn from(err: EthkeyError) -> Self {
|
||||
Error::Ethkey(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<FromHexError> for Error {
|
||||
fn from(err: FromHexError) -> Self {
|
||||
Error::FromHex(err)
|
||||
}
|
||||
fn from(err: FromHexError) -> Self {
|
||||
Error::FromHex(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ParseIntError> for Error {
|
||||
fn from(err: ParseIntError) -> Self {
|
||||
Error::ParseInt(err)
|
||||
}
|
||||
fn from(err: ParseIntError) -> Self {
|
||||
Error::ParseInt(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<docopt::Error> for Error {
|
||||
fn from(err: docopt::Error) -> Self {
|
||||
Error::Docopt(err)
|
||||
}
|
||||
fn from(err: docopt::Error) -> Self {
|
||||
Error::Docopt(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<io::Error> for Error {
|
||||
fn from(err: io::Error) -> Self {
|
||||
Error::Io(err)
|
||||
}
|
||||
fn from(err: io::Error) -> Self {
|
||||
Error::Io(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Error {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
match *self {
|
||||
Error::Ethkey(ref e) => write!(f, "{}", e),
|
||||
Error::FromHex(ref e) => write!(f, "{}", e),
|
||||
Error::ParseInt(ref e) => write!(f, "{}", e),
|
||||
Error::Docopt(ref e) => write!(f, "{}", e),
|
||||
Error::Io(ref e) => write!(f, "{}", e),
|
||||
}
|
||||
}
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
match *self {
|
||||
Error::Ethkey(ref e) => write!(f, "{}", e),
|
||||
Error::FromHex(ref e) => write!(f, "{}", e),
|
||||
Error::ParseInt(ref e) => write!(f, "{}", e),
|
||||
Error::Docopt(ref e) => write!(f, "{}", e),
|
||||
Error::Io(ref e) => write!(f, "{}", e),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum DisplayMode {
|
||||
KeyPair,
|
||||
Secret,
|
||||
Public,
|
||||
Address,
|
||||
KeyPair,
|
||||
Secret,
|
||||
Public,
|
||||
Address,
|
||||
}
|
||||
|
||||
impl DisplayMode {
|
||||
fn new(args: &Args) -> Self {
|
||||
if args.flag_secret {
|
||||
DisplayMode::Secret
|
||||
} else if args.flag_public {
|
||||
DisplayMode::Public
|
||||
} else if args.flag_address {
|
||||
DisplayMode::Address
|
||||
} else {
|
||||
DisplayMode::KeyPair
|
||||
}
|
||||
}
|
||||
fn new(args: &Args) -> Self {
|
||||
if args.flag_secret {
|
||||
DisplayMode::Secret
|
||||
} else if args.flag_public {
|
||||
DisplayMode::Public
|
||||
} else if args.flag_address {
|
||||
DisplayMode::Address
|
||||
} else {
|
||||
DisplayMode::KeyPair
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
panic_hook::set_abort();
|
||||
env_logger::try_init().expect("Logger initialized only once.");
|
||||
panic_hook::set_abort();
|
||||
env_logger::try_init().expect("Logger initialized only once.");
|
||||
|
||||
match execute(env::args()) {
|
||||
Ok(ok) => println!("{}", ok),
|
||||
Err(Error::Docopt(ref e)) => e.exit(),
|
||||
Err(err) => {
|
||||
eprintln!("{}", err);
|
||||
process::exit(1);
|
||||
}
|
||||
}
|
||||
match execute(env::args()) {
|
||||
Ok(ok) => println!("{}", ok),
|
||||
Err(Error::Docopt(ref e)) => e.exit(),
|
||||
Err(err) => {
|
||||
eprintln!("{}", err);
|
||||
process::exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn display(result: (KeyPair, Option<String>), mode: DisplayMode) -> String {
|
||||
let keypair = result.0;
|
||||
match mode {
|
||||
DisplayMode::KeyPair => match result.1 {
|
||||
Some(extra_data) => format!("{}\n{}", extra_data, keypair),
|
||||
None => format!("{}", keypair)
|
||||
},
|
||||
DisplayMode::Secret => format!("{:x}", keypair.secret()),
|
||||
DisplayMode::Public => format!("{:x}", keypair.public()),
|
||||
DisplayMode::Address => format!("{:x}", keypair.address()),
|
||||
}
|
||||
let keypair = result.0;
|
||||
match mode {
|
||||
DisplayMode::KeyPair => match result.1 {
|
||||
Some(extra_data) => format!("{}\n{}", extra_data, keypair),
|
||||
None => format!("{}", keypair),
|
||||
},
|
||||
DisplayMode::Secret => format!("{:x}", keypair.secret()),
|
||||
DisplayMode::Public => format!("{:x}", keypair.public()),
|
||||
DisplayMode::Address => format!("{:x}", keypair.address()),
|
||||
}
|
||||
}
|
||||
|
||||
fn execute<S, I>(command: I) -> Result<String, Error> where I: IntoIterator<Item=S>, S: AsRef<str> {
|
||||
let args: Args = Docopt::new(USAGE)
|
||||
.and_then(|d| d.argv(command).deserialize())?;
|
||||
fn execute<S, I>(command: I) -> Result<String, Error>
|
||||
where
|
||||
I: IntoIterator<Item = S>,
|
||||
S: AsRef<str>,
|
||||
{
|
||||
let args: Args = Docopt::new(USAGE).and_then(|d| d.argv(command).deserialize())?;
|
||||
|
||||
return if args.cmd_info {
|
||||
let display_mode = DisplayMode::new(&args);
|
||||
return if args.cmd_info {
|
||||
let display_mode = DisplayMode::new(&args);
|
||||
|
||||
let result = if args.flag_brain {
|
||||
let phrase = args.arg_secret_or_phrase;
|
||||
let phrase_info = validate_phrase(&phrase);
|
||||
let keypair = Brain::new(phrase).generate();
|
||||
(keypair, Some(phrase_info))
|
||||
} else {
|
||||
let secret = args.arg_secret_or_phrase.parse().map_err(|_| EthkeyError::InvalidSecretKey)?;
|
||||
(KeyPair::from_secret(secret)?, None)
|
||||
};
|
||||
Ok(display(result, display_mode))
|
||||
} else if args.cmd_generate {
|
||||
let display_mode = DisplayMode::new(&args);
|
||||
let result = if args.cmd_random {
|
||||
if args.flag_brain {
|
||||
let mut brain = BrainPrefix::new(vec![0], usize::max_value(), BRAIN_WORDS);
|
||||
let keypair = brain.generate()?;
|
||||
let phrase = format!("recovery phrase: {}", brain.phrase());
|
||||
(keypair, Some(phrase))
|
||||
} else {
|
||||
(Random.generate(), None)
|
||||
}
|
||||
} else if args.cmd_prefix {
|
||||
let prefix: Vec<_> = args.arg_prefix.from_hex()?;
|
||||
let brain = args.flag_brain;
|
||||
in_threads(move || {
|
||||
let iterations = 1024;
|
||||
let prefix = prefix.clone();
|
||||
move || {
|
||||
let prefix = prefix.clone();
|
||||
let res = if brain {
|
||||
let mut brain = BrainPrefix::new(prefix, iterations, BRAIN_WORDS);
|
||||
let result = brain.generate();
|
||||
let phrase = format!("recovery phrase: {}", brain.phrase());
|
||||
result.map(|keypair| (keypair, Some(phrase)))
|
||||
} else {
|
||||
let result = Prefix::new(prefix, iterations).generate();
|
||||
result.map(|res| (res, None))
|
||||
};
|
||||
let result = if args.flag_brain {
|
||||
let phrase = args.arg_secret_or_phrase;
|
||||
let phrase_info = validate_phrase(&phrase);
|
||||
let keypair = Brain::new(phrase)
|
||||
.generate()
|
||||
.expect("Brain wallet generator is infallible; qed");
|
||||
(keypair, Some(phrase_info))
|
||||
} else {
|
||||
let secret = args
|
||||
.arg_secret_or_phrase
|
||||
.parse()
|
||||
.map_err(|_| EthkeyError::InvalidSecret)?;
|
||||
(KeyPair::from_secret(secret)?, None)
|
||||
};
|
||||
Ok(display(result, display_mode))
|
||||
} else if args.cmd_generate {
|
||||
let display_mode = DisplayMode::new(&args);
|
||||
let result = if args.cmd_random {
|
||||
if args.flag_brain {
|
||||
let mut brain = BrainPrefix::new(vec![0], usize::max_value(), BRAIN_WORDS);
|
||||
let keypair = brain.generate()?;
|
||||
let phrase = format!("recovery phrase: {}", brain.phrase());
|
||||
(keypair, Some(phrase))
|
||||
} else {
|
||||
(Random.generate()?, None)
|
||||
}
|
||||
} else if args.cmd_prefix {
|
||||
let prefix = args.arg_prefix.from_hex()?;
|
||||
let brain = args.flag_brain;
|
||||
in_threads(move || {
|
||||
let iterations = 1024;
|
||||
let prefix = prefix.clone();
|
||||
move || {
|
||||
let prefix = prefix.clone();
|
||||
let res = if brain {
|
||||
let mut brain = BrainPrefix::new(prefix, iterations, BRAIN_WORDS);
|
||||
let result = brain.generate();
|
||||
let phrase = format!("recovery phrase: {}", brain.phrase());
|
||||
result.map(|keypair| (keypair, Some(phrase)))
|
||||
} else {
|
||||
let result = Prefix::new(prefix, iterations).generate();
|
||||
result.map(|res| (res, None))
|
||||
};
|
||||
|
||||
Ok(res.map(Some).unwrap_or(None))
|
||||
}
|
||||
})?
|
||||
} else {
|
||||
return Ok(format!("{}", USAGE))
|
||||
};
|
||||
Ok(display(result, display_mode))
|
||||
} else if args.cmd_sign {
|
||||
let secret = args.arg_secret.parse().map_err(|_| EthkeyError::InvalidSecretKey)?;
|
||||
let message = args.arg_message.parse().map_err(|_| EthkeyError::InvalidMessage)?;
|
||||
let signature = sign(&secret, &message)?;
|
||||
Ok(format!("{}", signature))
|
||||
} else if args.cmd_verify {
|
||||
let signature = args.arg_signature.parse().map_err(|_| EthkeyError::InvalidSignature)?;
|
||||
let message = args.arg_message.parse().map_err(|_| EthkeyError::InvalidMessage)?;
|
||||
let ok = if args.cmd_public {
|
||||
let public = args.arg_public.parse().map_err(|_| EthkeyError::InvalidPublicKey)?;
|
||||
verify_public(&public, &signature, &message)?
|
||||
} else if args.cmd_address {
|
||||
let address = args.arg_address.parse().map_err(|_| EthkeyError::InvalidAddress)?;
|
||||
verify_address(&address, &signature, &message)?
|
||||
} else {
|
||||
return Ok(format!("{}", USAGE))
|
||||
};
|
||||
Ok(format!("{}", ok))
|
||||
} else if args.cmd_recover {
|
||||
let display_mode = DisplayMode::new(&args);
|
||||
let known_phrase = args.arg_known_phrase;
|
||||
let address = args.arg_address.parse().map_err(|_| EthkeyError::InvalidAddress)?;
|
||||
let (phrase, keypair) = in_threads(move || {
|
||||
let mut it = brain_recover::PhrasesIterator::from_known_phrase(&known_phrase, BRAIN_WORDS);
|
||||
move || {
|
||||
let mut i = 0;
|
||||
while let Some(phrase) = it.next() {
|
||||
i += 1;
|
||||
Ok(res.map(Some).unwrap_or(None))
|
||||
}
|
||||
})?
|
||||
} else {
|
||||
return Ok(format!("{}", USAGE));
|
||||
};
|
||||
Ok(display(result, display_mode))
|
||||
} else if args.cmd_sign {
|
||||
let secret = args
|
||||
.arg_secret
|
||||
.parse()
|
||||
.map_err(|_| EthkeyError::InvalidSecret)?;
|
||||
let message = args
|
||||
.arg_message
|
||||
.parse()
|
||||
.map_err(|_| EthkeyError::InvalidMessage)?;
|
||||
let signature = sign(&secret, &message)?;
|
||||
Ok(format!("{}", signature))
|
||||
} else if args.cmd_verify {
|
||||
let signature = args
|
||||
.arg_signature
|
||||
.parse()
|
||||
.map_err(|_| EthkeyError::InvalidSignature)?;
|
||||
let message = args
|
||||
.arg_message
|
||||
.parse()
|
||||
.map_err(|_| EthkeyError::InvalidMessage)?;
|
||||
let ok = if args.cmd_public {
|
||||
let public = args
|
||||
.arg_public
|
||||
.parse()
|
||||
.map_err(|_| EthkeyError::InvalidPublic)?;
|
||||
verify_public(&public, &signature, &message)?
|
||||
} else if args.cmd_address {
|
||||
let address = args
|
||||
.arg_address
|
||||
.parse()
|
||||
.map_err(|_| EthkeyError::InvalidAddress)?;
|
||||
verify_address(&address, &signature, &message)?
|
||||
} else {
|
||||
return Ok(format!("{}", USAGE));
|
||||
};
|
||||
Ok(format!("{}", ok))
|
||||
} else if args.cmd_recover {
|
||||
let display_mode = DisplayMode::new(&args);
|
||||
let known_phrase = args.arg_known_phrase;
|
||||
let address = args
|
||||
.arg_address
|
||||
.parse()
|
||||
.map_err(|_| EthkeyError::InvalidAddress)?;
|
||||
let (phrase, keypair) = in_threads(move || {
|
||||
let mut it =
|
||||
brain_recover::PhrasesIterator::from_known_phrase(&known_phrase, BRAIN_WORDS);
|
||||
move || {
|
||||
let mut i = 0;
|
||||
while let Some(phrase) = it.next() {
|
||||
i += 1;
|
||||
|
||||
let keypair = Brain::new(phrase.clone()).generate();
|
||||
if keypair.address() == address {
|
||||
return Ok(Some((phrase, keypair)))
|
||||
}
|
||||
let keypair = Brain::new(phrase.clone()).generate().unwrap();
|
||||
if keypair.address() == address {
|
||||
return Ok(Some((phrase, keypair)));
|
||||
}
|
||||
|
||||
if i >= 1024 {
|
||||
return Ok(None)
|
||||
}
|
||||
}
|
||||
if i >= 1024 {
|
||||
return Ok(None);
|
||||
}
|
||||
}
|
||||
|
||||
Err(EthkeyError::Custom("Couldn't find any results.".into()))
|
||||
}
|
||||
})?;
|
||||
Ok(display((keypair, Some(phrase)), display_mode))
|
||||
} else {
|
||||
Ok(format!("{}", USAGE))
|
||||
}
|
||||
Err(EthkeyError::Custom("Couldn't find any results.".into()))
|
||||
}
|
||||
})?;
|
||||
Ok(display((keypair, Some(phrase)), display_mode))
|
||||
} else {
|
||||
Ok(format!("{}", USAGE))
|
||||
};
|
||||
}
|
||||
|
||||
const BRAIN_WORDS: usize = 12;
|
||||
|
||||
fn validate_phrase(phrase: &str) -> String {
|
||||
match Brain::validate_phrase(phrase, BRAIN_WORDS) {
|
||||
Ok(()) => format!("The recovery phrase looks correct.\n"),
|
||||
Err(err) => format!("The recover phrase was not generated by Parity: {}", err)
|
||||
}
|
||||
match Brain::validate_phrase(phrase, BRAIN_WORDS) {
|
||||
Ok(()) => format!("The recovery phrase looks correct.\n"),
|
||||
Err(err) => format!("The recover phrase was not generated by Parity: {}", err),
|
||||
}
|
||||
}
|
||||
|
||||
fn in_threads<F, X, O>(prepare: F) -> Result<O, EthkeyError> where
|
||||
O: Send + 'static,
|
||||
X: Send + 'static,
|
||||
F: Fn() -> X,
|
||||
X: FnMut() -> Result<Option<O>, EthkeyError>,
|
||||
fn in_threads<F, X, O>(prepare: F) -> Result<O, EthkeyError>
|
||||
where
|
||||
O: Send + 'static,
|
||||
X: Send + 'static,
|
||||
F: Fn() -> X,
|
||||
X: FnMut() -> Result<Option<O>, EthkeyError>,
|
||||
{
|
||||
let pool = threadpool::Builder::new().build();
|
||||
let pool = threadpool::Builder::new().build();
|
||||
|
||||
let (tx, rx) = sync::mpsc::sync_channel(1);
|
||||
let is_done = sync::Arc::new(sync::atomic::AtomicBool::default());
|
||||
let (tx, rx) = sync::mpsc::sync_channel(1);
|
||||
let is_done = sync::Arc::new(sync::atomic::AtomicBool::default());
|
||||
|
||||
for _ in 0..pool.max_count() {
|
||||
let is_done = is_done.clone();
|
||||
let tx = tx.clone();
|
||||
let mut task = prepare();
|
||||
pool.execute(move || {
|
||||
loop {
|
||||
if is_done.load(sync::atomic::Ordering::SeqCst) {
|
||||
return;
|
||||
}
|
||||
for _ in 0..pool.max_count() {
|
||||
let is_done = is_done.clone();
|
||||
let tx = tx.clone();
|
||||
let mut task = prepare();
|
||||
pool.execute(move || {
|
||||
loop {
|
||||
if is_done.load(sync::atomic::Ordering::SeqCst) {
|
||||
return;
|
||||
}
|
||||
|
||||
let res = match task() {
|
||||
Ok(None) => continue,
|
||||
Ok(Some(v)) => Ok(v),
|
||||
Err(err) => Err(err),
|
||||
};
|
||||
let res = match task() {
|
||||
Ok(None) => continue,
|
||||
Ok(Some(v)) => Ok(v),
|
||||
Err(err) => Err(err),
|
||||
};
|
||||
|
||||
// We are interested only in the first response.
|
||||
let _ = tx.send(res);
|
||||
}
|
||||
});
|
||||
}
|
||||
// We are interested only in the first response.
|
||||
let _ = tx.send(res);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if let Ok(solution) = rx.recv() {
|
||||
is_done.store(true, sync::atomic::Ordering::SeqCst);
|
||||
return solution;
|
||||
}
|
||||
if let Ok(solution) = rx.recv() {
|
||||
is_done.store(true, sync::atomic::Ordering::SeqCst);
|
||||
return solution;
|
||||
}
|
||||
|
||||
Err(EthkeyError::Custom("No results found.".into()))
|
||||
Err(EthkeyError::Custom("No results found.".into()))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::execute;
|
||||
use super::execute;
|
||||
|
||||
#[test]
|
||||
fn info() {
|
||||
let command = vec!["ethkey", "info", "17d08f5fe8c77af811caa0c9a187e668ce3b74a99acc3f6d976f075fa8e0be55"]
|
||||
.into_iter()
|
||||
.map(Into::into)
|
||||
.collect::<Vec<String>>();
|
||||
#[test]
|
||||
fn info() {
|
||||
let command = vec![
|
||||
"ethkey",
|
||||
"info",
|
||||
"17d08f5fe8c77af811caa0c9a187e668ce3b74a99acc3f6d976f075fa8e0be55",
|
||||
]
|
||||
.into_iter()
|
||||
.map(Into::into)
|
||||
.collect::<Vec<String>>();
|
||||
|
||||
let expected =
|
||||
let expected =
|
||||
"secret: 17d08f5fe8c77af811caa0c9a187e668ce3b74a99acc3f6d976f075fa8e0be55
|
||||
public: 689268c0ff57a20cd299fa60d3fb374862aff565b20b5f1767906a99e6e09f3ff04ca2b2a5cd22f62941db103c0356df1a8ed20ce322cab2483db67685afd124
|
||||
address: 26d1ec50b4e62c1d1a40d16e7cacc6a6580757d5".to_owned();
|
||||
assert_eq!(execute(command).unwrap(), expected);
|
||||
}
|
||||
assert_eq!(execute(command).unwrap(), expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn brain() {
|
||||
let command = vec!["ethkey", "info", "--brain", "this is sparta"]
|
||||
.into_iter()
|
||||
.map(Into::into)
|
||||
.collect::<Vec<String>>();
|
||||
#[test]
|
||||
fn brain() {
|
||||
let command = vec!["ethkey", "info", "--brain", "this is sparta"]
|
||||
.into_iter()
|
||||
.map(Into::into)
|
||||
.collect::<Vec<String>>();
|
||||
|
||||
let expected =
|
||||
let expected =
|
||||
"The recover phrase was not generated by Parity: The word 'this' does not come from the dictionary.
|
||||
|
||||
secret: aa22b54c0cb43ee30a014afe5ef3664b1cde299feabca46cd3167a85a57c39f2
|
||||
public: c4c5398da6843632c123f543d714d2d2277716c11ff612b2a2f23c6bda4d6f0327c31cd58c55a9572c3cc141dade0c32747a13b7ef34c241b26c84adbb28fcf4
|
||||
address: 006e27b6a72e1f34c626762f3c4761547aff1421".to_owned();
|
||||
assert_eq!(execute(command).unwrap(), expected);
|
||||
}
|
||||
assert_eq!(execute(command).unwrap(), expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn secret() {
|
||||
let command = vec!["ethkey", "info", "--brain", "this is sparta", "--secret"]
|
||||
#[test]
|
||||
fn secret() {
|
||||
let command = vec!["ethkey", "info", "--brain", "this is sparta", "--secret"]
|
||||
.into_iter()
|
||||
.map(Into::into)
|
||||
.collect::<Vec<String>>();
|
||||
|
||||
let expected =
|
||||
"aa22b54c0cb43ee30a014afe5ef3664b1cde299feabca46cd3167a85a57c39f2".to_owned();
|
||||
assert_eq!(execute(command).unwrap(), expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn public() {
|
||||
let command = vec!["ethkey", "info", "--brain", "this is sparta", "--public"]
|
||||
.into_iter()
|
||||
.map(Into::into)
|
||||
.collect::<Vec<String>>();
|
||||
|
||||
let expected = "c4c5398da6843632c123f543d714d2d2277716c11ff612b2a2f23c6bda4d6f0327c31cd58c55a9572c3cc141dade0c32747a13b7ef34c241b26c84adbb28fcf4".to_owned();
|
||||
assert_eq!(execute(command).unwrap(), expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn address() {
|
||||
let command = vec!["ethkey", "info", "-b", "this is sparta", "--address"]
|
||||
.into_iter()
|
||||
.map(Into::into)
|
||||
.collect::<Vec<String>>();
|
||||
|
||||
let expected = "006e27b6a72e1f34c626762f3c4761547aff1421".to_owned();
|
||||
assert_eq!(execute(command).unwrap(), expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sign() {
|
||||
let command = vec![
|
||||
"ethkey",
|
||||
"sign",
|
||||
"17d08f5fe8c77af811caa0c9a187e668ce3b74a99acc3f6d976f075fa8e0be55",
|
||||
"bd50b7370c3f96733b31744c6c45079e7ae6c8d299613246d28ebcef507ec987",
|
||||
]
|
||||
.into_iter()
|
||||
.map(Into::into)
|
||||
.collect::<Vec<String>>();
|
||||
|
||||
let expected = "c1878cf60417151c766a712653d26ef350c8c75393458b7a9be715f053215af63dfd3b02c2ae65a8677917a8efa3172acb71cb90196e42106953ea0363c5aaf200".to_owned();
|
||||
assert_eq!(execute(command).unwrap(), expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn verify_valid_public() {
|
||||
let command = vec!["ethkey", "verify", "public", "689268c0ff57a20cd299fa60d3fb374862aff565b20b5f1767906a99e6e09f3ff04ca2b2a5cd22f62941db103c0356df1a8ed20ce322cab2483db67685afd124", "c1878cf60417151c766a712653d26ef350c8c75393458b7a9be715f053215af63dfd3b02c2ae65a8677917a8efa3172acb71cb90196e42106953ea0363c5aaf200", "bd50b7370c3f96733b31744c6c45079e7ae6c8d299613246d28ebcef507ec987"]
|
||||
.into_iter()
|
||||
.map(Into::into)
|
||||
.collect::<Vec<String>>();
|
||||
|
||||
let expected = "aa22b54c0cb43ee30a014afe5ef3664b1cde299feabca46cd3167a85a57c39f2".to_owned();
|
||||
assert_eq!(execute(command).unwrap(), expected);
|
||||
}
|
||||
let expected = "true".to_owned();
|
||||
assert_eq!(execute(command).unwrap(), expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn public() {
|
||||
let command = vec!["ethkey", "info", "--brain", "this is sparta", "--public"]
|
||||
#[test]
|
||||
fn verify_valid_address() {
|
||||
let command = vec!["ethkey", "verify", "address", "26d1ec50b4e62c1d1a40d16e7cacc6a6580757d5", "c1878cf60417151c766a712653d26ef350c8c75393458b7a9be715f053215af63dfd3b02c2ae65a8677917a8efa3172acb71cb90196e42106953ea0363c5aaf200", "bd50b7370c3f96733b31744c6c45079e7ae6c8d299613246d28ebcef507ec987"]
|
||||
.into_iter()
|
||||
.map(Into::into)
|
||||
.collect::<Vec<String>>();
|
||||
|
||||
let expected = "c4c5398da6843632c123f543d714d2d2277716c11ff612b2a2f23c6bda4d6f0327c31cd58c55a9572c3cc141dade0c32747a13b7ef34c241b26c84adbb28fcf4".to_owned();
|
||||
assert_eq!(execute(command).unwrap(), expected);
|
||||
}
|
||||
let expected = "true".to_owned();
|
||||
assert_eq!(execute(command).unwrap(), expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn address() {
|
||||
let command = vec!["ethkey", "info", "-b", "this is sparta", "--address"]
|
||||
#[test]
|
||||
fn verify_invalid() {
|
||||
let command = vec!["ethkey", "verify", "public", "689268c0ff57a20cd299fa60d3fb374862aff565b20b5f1767906a99e6e09f3ff04ca2b2a5cd22f62941db103c0356df1a8ed20ce322cab2483db67685afd124", "c1878cf60417151c766a712653d26ef350c8c75393458b7a9be715f053215af63dfd3b02c2ae65a8677917a8efa3172acb71cb90196e42106953ea0363c5aaf200", "bd50b7370c3f96733b31744c6c45079e7ae6c8d299613246d28ebcef507ec986"]
|
||||
.into_iter()
|
||||
.map(Into::into)
|
||||
.collect::<Vec<String>>();
|
||||
|
||||
let expected = "006e27b6a72e1f34c626762f3c4761547aff1421".to_owned();
|
||||
assert_eq!(execute(command).unwrap(), expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sign() {
|
||||
let command = vec!["ethkey", "sign", "17d08f5fe8c77af811caa0c9a187e668ce3b74a99acc3f6d976f075fa8e0be55", "bd50b7370c3f96733b31744c6c45079e7ae6c8d299613246d28ebcef507ec987"]
|
||||
.into_iter()
|
||||
.map(Into::into)
|
||||
.collect::<Vec<String>>();
|
||||
|
||||
let expected = "c1878cf60417151c766a712653d26ef350c8c75393458b7a9be715f053215af63dfd3b02c2ae65a8677917a8efa3172acb71cb90196e42106953ea0363c5aaf200".to_owned();
|
||||
assert_eq!(execute(command).unwrap(), expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn verify_valid_public() {
|
||||
let command = vec!["ethkey", "verify", "public", "689268c0ff57a20cd299fa60d3fb374862aff565b20b5f1767906a99e6e09f3ff04ca2b2a5cd22f62941db103c0356df1a8ed20ce322cab2483db67685afd124", "c1878cf60417151c766a712653d26ef350c8c75393458b7a9be715f053215af63dfd3b02c2ae65a8677917a8efa3172acb71cb90196e42106953ea0363c5aaf200", "bd50b7370c3f96733b31744c6c45079e7ae6c8d299613246d28ebcef507ec987"]
|
||||
.into_iter()
|
||||
.map(Into::into)
|
||||
.collect::<Vec<String>>();
|
||||
|
||||
let expected = "true".to_owned();
|
||||
assert_eq!(execute(command).unwrap(), expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn verify_valid_address() {
|
||||
let command = vec!["ethkey", "verify", "address", "26d1ec50b4e62c1d1a40d16e7cacc6a6580757d5", "c1878cf60417151c766a712653d26ef350c8c75393458b7a9be715f053215af63dfd3b02c2ae65a8677917a8efa3172acb71cb90196e42106953ea0363c5aaf200", "bd50b7370c3f96733b31744c6c45079e7ae6c8d299613246d28ebcef507ec987"]
|
||||
.into_iter()
|
||||
.map(Into::into)
|
||||
.collect::<Vec<String>>();
|
||||
|
||||
let expected = "true".to_owned();
|
||||
assert_eq!(execute(command).unwrap(), expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn verify_invalid() {
|
||||
let command = vec!["ethkey", "verify", "public", "689268c0ff57a20cd299fa60d3fb374862aff565b20b5f1767906a99e6e09f3ff04ca2b2a5cd22f62941db103c0356df1a8ed20ce322cab2483db67685afd124", "c1878cf60417151c766a712653d26ef350c8c75393458b7a9be715f053215af63dfd3b02c2ae65a8677917a8efa3172acb71cb90196e42106953ea0363c5aaf200", "bd50b7370c3f96733b31744c6c45079e7ae6c8d299613246d28ebcef507ec986"]
|
||||
.into_iter()
|
||||
.map(Into::into)
|
||||
.collect::<Vec<String>>();
|
||||
|
||||
let expected = "false".to_owned();
|
||||
assert_eq!(execute(command).unwrap(), expected);
|
||||
}
|
||||
let expected = "false".to_owned();
|
||||
assert_eq!(execute(command).unwrap(), expected);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,72 +1,74 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use parity_crypto::publickey::{KeyPair, Generator, Secret};
|
||||
use parity_crypto::Keccak256;
|
||||
use super::{Generator, KeyPair, Secret};
|
||||
use keccak::Keccak256;
|
||||
use parity_wordlist;
|
||||
|
||||
/// Simple brainwallet.
|
||||
pub struct Brain(String);
|
||||
|
||||
impl Brain {
|
||||
pub fn new(s: String) -> Self {
|
||||
Brain(s)
|
||||
}
|
||||
pub fn new(s: String) -> Self {
|
||||
Brain(s)
|
||||
}
|
||||
|
||||
pub fn validate_phrase(phrase: &str, expected_words: usize) -> Result<(), ::WordlistError> {
|
||||
parity_wordlist::validate_phrase(phrase, expected_words)
|
||||
}
|
||||
pub fn validate_phrase(phrase: &str, expected_words: usize) -> Result<(), ::WordlistError> {
|
||||
parity_wordlist::validate_phrase(phrase, expected_words)
|
||||
}
|
||||
}
|
||||
|
||||
impl Generator for Brain {
|
||||
fn generate(&mut self) -> KeyPair {
|
||||
let seed = self.0.clone();
|
||||
let mut secret = seed.into_bytes().keccak256();
|
||||
type Error = ::Void;
|
||||
|
||||
let mut i = 0;
|
||||
loop {
|
||||
secret = secret.keccak256();
|
||||
fn generate(&mut self) -> Result<KeyPair, Self::Error> {
|
||||
let seed = self.0.clone();
|
||||
let mut secret = seed.into_bytes().keccak256();
|
||||
|
||||
match i > 16384 {
|
||||
false => i += 1,
|
||||
true => {
|
||||
if let Ok(pair) = Secret::import_key(&secret)
|
||||
.and_then(KeyPair::from_secret)
|
||||
{
|
||||
if pair.address()[0] == 0 {
|
||||
trace!("Testing: {}, got: {:?}", self.0, pair.address());
|
||||
return pair
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
let mut i = 0;
|
||||
loop {
|
||||
secret = secret.keccak256();
|
||||
|
||||
match i > 16384 {
|
||||
false => i += 1,
|
||||
true => {
|
||||
if let Ok(pair) =
|
||||
Secret::from_unsafe_slice(&secret).and_then(KeyPair::from_secret)
|
||||
{
|
||||
if pair.address()[0] == 0 {
|
||||
trace!("Testing: {}, got: {:?}", self.0, pair.address());
|
||||
return Ok(pair);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use Brain;
|
||||
use parity_crypto::publickey::Generator;
|
||||
use Brain;
|
||||
use Generator;
|
||||
|
||||
#[test]
|
||||
fn test_brain() {
|
||||
let words = "this is sparta!".to_owned();
|
||||
let first_keypair = Brain::new(words.clone()).generate();
|
||||
let second_keypair = Brain::new(words.clone()).generate();
|
||||
assert_eq!(first_keypair.secret(), second_keypair.secret());
|
||||
}
|
||||
#[test]
|
||||
fn test_brain() {
|
||||
let words = "this is sparta!".to_owned();
|
||||
let first_keypair = Brain::new(words.clone()).generate().unwrap();
|
||||
let second_keypair = Brain::new(words.clone()).generate().unwrap();
|
||||
assert_eq!(first_keypair.secret(), second_keypair.secret());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,67 +1,73 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use super::Brain;
|
||||
use parity_crypto::publickey::{Generator, KeyPair, Error};
|
||||
use super::{Brain, Error, Generator, KeyPair};
|
||||
use parity_wordlist as wordlist;
|
||||
|
||||
/// Tries to find brain-seed keypair with address starting with given prefix.
|
||||
pub struct BrainPrefix {
|
||||
prefix: Vec<u8>,
|
||||
iterations: usize,
|
||||
no_of_words: usize,
|
||||
last_phrase: String,
|
||||
prefix: Vec<u8>,
|
||||
iterations: usize,
|
||||
no_of_words: usize,
|
||||
last_phrase: String,
|
||||
}
|
||||
|
||||
impl BrainPrefix {
|
||||
pub fn new(prefix: Vec<u8>, iterations: usize, no_of_words: usize) -> Self {
|
||||
BrainPrefix {
|
||||
prefix,
|
||||
iterations,
|
||||
no_of_words,
|
||||
last_phrase: String::new(),
|
||||
}
|
||||
}
|
||||
pub fn new(prefix: Vec<u8>, iterations: usize, no_of_words: usize) -> Self {
|
||||
BrainPrefix {
|
||||
prefix,
|
||||
iterations,
|
||||
no_of_words,
|
||||
last_phrase: String::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn phrase(&self) -> &str {
|
||||
&self.last_phrase
|
||||
}
|
||||
pub fn phrase(&self) -> &str {
|
||||
&self.last_phrase
|
||||
}
|
||||
}
|
||||
|
||||
pub fn generate(&mut self) -> Result<KeyPair, Error> {
|
||||
for _ in 0..self.iterations {
|
||||
let phrase = wordlist::random_phrase(self.no_of_words);
|
||||
let keypair = Brain::new(phrase.clone()).generate();
|
||||
if keypair.address().as_ref().starts_with(&self.prefix) {
|
||||
self.last_phrase = phrase;
|
||||
return Ok(keypair)
|
||||
}
|
||||
}
|
||||
impl Generator for BrainPrefix {
|
||||
type Error = Error;
|
||||
|
||||
Err(Error::Custom("Could not find keypair".into()))
|
||||
}
|
||||
fn generate(&mut self) -> Result<KeyPair, Error> {
|
||||
for _ in 0..self.iterations {
|
||||
let phrase = wordlist::random_phrase(self.no_of_words);
|
||||
let keypair = Brain::new(phrase.clone()).generate().unwrap();
|
||||
if keypair.address().starts_with(&self.prefix) {
|
||||
self.last_phrase = phrase;
|
||||
return Ok(keypair);
|
||||
}
|
||||
}
|
||||
|
||||
Err(Error::Custom("Could not find keypair".into()))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use BrainPrefix;
|
||||
use BrainPrefix;
|
||||
use Generator;
|
||||
|
||||
#[test]
|
||||
fn prefix_generator() {
|
||||
let prefix = vec![0x00u8];
|
||||
let keypair = BrainPrefix::new(prefix.clone(), usize::max_value(), 12).generate().unwrap();
|
||||
assert!(keypair.address().as_bytes().starts_with(&prefix));
|
||||
}
|
||||
#[test]
|
||||
fn prefix_generator() {
|
||||
let prefix = vec![0x00u8];
|
||||
let keypair = BrainPrefix::new(prefix.clone(), usize::max_value(), 12)
|
||||
.generate()
|
||||
.unwrap();
|
||||
assert!(keypair.address().starts_with(&prefix));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,174 +1,178 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::collections::HashSet;
|
||||
|
||||
use edit_distance::edit_distance;
|
||||
use parity_wordlist;
|
||||
|
||||
use super::Brain;
|
||||
use parity_crypto::publickey::{Address, Generator};
|
||||
use super::{Address, Brain, Generator};
|
||||
|
||||
/// Tries to find a phrase for address, given the number
|
||||
/// of expected words and a partial phrase.
|
||||
///
|
||||
/// Returns `None` if phrase couldn't be found.
|
||||
pub fn brain_recover(
|
||||
address: &Address,
|
||||
known_phrase: &str,
|
||||
expected_words: usize,
|
||||
address: &Address,
|
||||
known_phrase: &str,
|
||||
expected_words: usize,
|
||||
) -> Option<String> {
|
||||
let it = PhrasesIterator::from_known_phrase(known_phrase, expected_words);
|
||||
for phrase in it {
|
||||
let keypair = Brain::new(phrase.clone()).generate();
|
||||
trace!("Testing: {}, got: {:?}", phrase, keypair.address());
|
||||
if &keypair.address() == address {
|
||||
return Some(phrase);
|
||||
}
|
||||
}
|
||||
let it = PhrasesIterator::from_known_phrase(known_phrase, expected_words);
|
||||
for phrase in it {
|
||||
let keypair = Brain::new(phrase.clone())
|
||||
.generate()
|
||||
.expect("Brain wallets are infallible; qed");
|
||||
trace!("Testing: {}, got: {:?}", phrase, keypair.address());
|
||||
if &keypair.address() == address {
|
||||
return Some(phrase);
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
None
|
||||
}
|
||||
|
||||
fn generate_substitutions(word: &str) -> Vec<&'static str> {
|
||||
let mut words = parity_wordlist::WORDS.iter().cloned()
|
||||
.map(|w| (edit_distance(w, word), w))
|
||||
.collect::<Vec<_>>();
|
||||
words.sort_by(|a, b| a.0.cmp(&b.0));
|
||||
let mut words = parity_wordlist::WORDS
|
||||
.iter()
|
||||
.cloned()
|
||||
.map(|w| (edit_distance(w, word), w))
|
||||
.collect::<Vec<_>>();
|
||||
words.sort_by(|a, b| a.0.cmp(&b.0));
|
||||
|
||||
words.into_iter()
|
||||
.map(|pair| pair.1)
|
||||
.collect()
|
||||
words.into_iter().map(|pair| pair.1).collect()
|
||||
}
|
||||
|
||||
/// Iterator over possible
|
||||
pub struct PhrasesIterator {
|
||||
words: Vec<Vec<&'static str>>,
|
||||
combinations: u64,
|
||||
indexes: Vec<usize>,
|
||||
has_next: bool,
|
||||
words: Vec<Vec<&'static str>>,
|
||||
combinations: u64,
|
||||
indexes: Vec<usize>,
|
||||
has_next: bool,
|
||||
}
|
||||
|
||||
impl PhrasesIterator {
|
||||
pub fn from_known_phrase(known_phrase: &str, expected_words: usize) -> Self {
|
||||
let known_words = parity_wordlist::WORDS.iter().cloned().collect::<HashSet<_>>();
|
||||
let mut words = known_phrase.split(' ')
|
||||
.map(|word| match known_words.get(word) {
|
||||
None => {
|
||||
info!("Invalid word '{}', looking for potential substitutions.", word);
|
||||
let substitutions = generate_substitutions(word);
|
||||
info!("Closest words: {:?}", &substitutions[..10]);
|
||||
substitutions
|
||||
},
|
||||
Some(word) => vec![*word],
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
pub fn from_known_phrase(known_phrase: &str, expected_words: usize) -> Self {
|
||||
let known_words = parity_wordlist::WORDS
|
||||
.iter()
|
||||
.cloned()
|
||||
.collect::<HashSet<_>>();
|
||||
let mut words = known_phrase
|
||||
.split(' ')
|
||||
.map(|word| match known_words.get(word) {
|
||||
None => {
|
||||
info!(
|
||||
"Invalid word '{}', looking for potential substitutions.",
|
||||
word
|
||||
);
|
||||
let substitutions = generate_substitutions(word);
|
||||
info!("Closest words: {:?}", &substitutions[..10]);
|
||||
substitutions
|
||||
}
|
||||
Some(word) => vec![*word],
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
// add missing words
|
||||
if words.len() < expected_words {
|
||||
let to_add = expected_words - words.len();
|
||||
info!("Number of words is insuficcient adding {} more.", to_add);
|
||||
for _ in 0..to_add {
|
||||
words.push(parity_wordlist::WORDS.iter().cloned().collect());
|
||||
}
|
||||
}
|
||||
// add missing words
|
||||
if words.len() < expected_words {
|
||||
let to_add = expected_words - words.len();
|
||||
info!("Number of words is insuficcient adding {} more.", to_add);
|
||||
for _ in 0..to_add {
|
||||
words.push(parity_wordlist::WORDS.iter().cloned().collect());
|
||||
}
|
||||
}
|
||||
|
||||
// start searching
|
||||
PhrasesIterator::new(words)
|
||||
}
|
||||
// start searching
|
||||
PhrasesIterator::new(words)
|
||||
}
|
||||
|
||||
pub fn new(words: Vec<Vec<&'static str>>) -> Self {
|
||||
let combinations = words.iter().fold(1u64, |acc, x| acc * x.len() as u64);
|
||||
let indexes = words.iter().map(|_| 0).collect();
|
||||
info!("Starting to test {} possible combinations.", combinations);
|
||||
pub fn new(words: Vec<Vec<&'static str>>) -> Self {
|
||||
let combinations = words.iter().fold(1u64, |acc, x| acc * x.len() as u64);
|
||||
let indexes = words.iter().map(|_| 0).collect();
|
||||
info!("Starting to test {} possible combinations.", combinations);
|
||||
|
||||
PhrasesIterator {
|
||||
words,
|
||||
combinations,
|
||||
indexes,
|
||||
has_next: combinations > 0,
|
||||
}
|
||||
}
|
||||
PhrasesIterator {
|
||||
words,
|
||||
combinations,
|
||||
indexes,
|
||||
has_next: combinations > 0,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn combinations(&self) -> u64 {
|
||||
self.combinations
|
||||
}
|
||||
pub fn combinations(&self) -> u64 {
|
||||
self.combinations
|
||||
}
|
||||
|
||||
fn current(&self) -> String {
|
||||
let mut s = self.words[0][self.indexes[0]].to_owned();
|
||||
for i in 1..self.indexes.len() {
|
||||
s.push(' ');
|
||||
s.push_str(self.words[i][self.indexes[i]]);
|
||||
}
|
||||
s
|
||||
}
|
||||
fn current(&self) -> String {
|
||||
let mut s = self.words[0][self.indexes[0]].to_owned();
|
||||
for i in 1..self.indexes.len() {
|
||||
s.push(' ');
|
||||
s.push_str(self.words[i][self.indexes[i]]);
|
||||
}
|
||||
s
|
||||
}
|
||||
|
||||
fn next_index(&mut self) -> bool {
|
||||
let mut pos = self.indexes.len();
|
||||
while pos > 0 {
|
||||
pos -= 1;
|
||||
self.indexes[pos] += 1;
|
||||
if self.indexes[pos] >= self.words[pos].len() {
|
||||
self.indexes[pos] = 0;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
fn next_index(&mut self) -> bool {
|
||||
let mut pos = self.indexes.len();
|
||||
while pos > 0 {
|
||||
pos -= 1;
|
||||
self.indexes[pos] += 1;
|
||||
if self.indexes[pos] >= self.words[pos].len() {
|
||||
self.indexes[pos] = 0;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
impl Iterator for PhrasesIterator {
|
||||
type Item = String;
|
||||
type Item = String;
|
||||
|
||||
fn next(&mut self) -> Option<String> {
|
||||
if !self.has_next {
|
||||
return None;
|
||||
}
|
||||
fn next(&mut self) -> Option<String> {
|
||||
if !self.has_next {
|
||||
return None;
|
||||
}
|
||||
|
||||
let phrase = self.current();
|
||||
self.has_next = self.next_index();
|
||||
Some(phrase)
|
||||
}
|
||||
let phrase = self.current();
|
||||
self.has_next = self.next_index();
|
||||
Some(phrase)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::PhrasesIterator;
|
||||
use super::PhrasesIterator;
|
||||
|
||||
#[test]
|
||||
fn should_generate_possible_combinations() {
|
||||
let mut it = PhrasesIterator::new(vec![
|
||||
vec!["1", "2", "3"],
|
||||
vec!["test"],
|
||||
vec!["a", "b", "c"],
|
||||
]);
|
||||
|
||||
assert_eq!(it.combinations(), 9);
|
||||
assert_eq!(it.next(), Some("1 test a".to_owned()));
|
||||
assert_eq!(it.next(), Some("1 test b".to_owned()));
|
||||
assert_eq!(it.next(), Some("1 test c".to_owned()));
|
||||
assert_eq!(it.next(), Some("2 test a".to_owned()));
|
||||
assert_eq!(it.next(), Some("2 test b".to_owned()));
|
||||
assert_eq!(it.next(), Some("2 test c".to_owned()));
|
||||
assert_eq!(it.next(), Some("3 test a".to_owned()));
|
||||
assert_eq!(it.next(), Some("3 test b".to_owned()));
|
||||
assert_eq!(it.next(), Some("3 test c".to_owned()));
|
||||
assert_eq!(it.next(), None);
|
||||
}
|
||||
#[test]
|
||||
fn should_generate_possible_combinations() {
|
||||
let mut it =
|
||||
PhrasesIterator::new(vec![vec!["1", "2", "3"], vec!["test"], vec!["a", "b", "c"]]);
|
||||
|
||||
assert_eq!(it.combinations(), 9);
|
||||
assert_eq!(it.next(), Some("1 test a".to_owned()));
|
||||
assert_eq!(it.next(), Some("1 test b".to_owned()));
|
||||
assert_eq!(it.next(), Some("1 test c".to_owned()));
|
||||
assert_eq!(it.next(), Some("2 test a".to_owned()));
|
||||
assert_eq!(it.next(), Some("2 test b".to_owned()));
|
||||
assert_eq!(it.next(), Some("2 test c".to_owned()));
|
||||
assert_eq!(it.next(), Some("3 test a".to_owned()));
|
||||
assert_eq!(it.next(), Some("3 test b".to_owned()));
|
||||
assert_eq!(it.next(), Some("3 test c".to_owned()));
|
||||
assert_eq!(it.next(), None);
|
||||
}
|
||||
}
|
||||
|
||||
202
accounts/ethkey/src/crypto.rs
Normal file
202
accounts/ethkey/src/crypto.rs
Normal file
@@ -0,0 +1,202 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// OpenEthereum 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.
|
||||
|
||||
// OpenEthereum 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 OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#![allow(deprecated)]
|
||||
|
||||
use parity_crypto::error::SymmError;
|
||||
use secp256k1;
|
||||
use std::io;
|
||||
|
||||
quick_error! {
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
Secp(e: secp256k1::Error) {
|
||||
display("secp256k1 error: {}", e)
|
||||
cause(e)
|
||||
from()
|
||||
}
|
||||
Io(e: io::Error) {
|
||||
display("i/o error: {}", e)
|
||||
cause(e)
|
||||
from()
|
||||
}
|
||||
InvalidMessage {
|
||||
display("invalid message")
|
||||
}
|
||||
Symm(e: SymmError) {
|
||||
cause(e)
|
||||
from()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// ECDH functions
|
||||
pub mod ecdh {
|
||||
use super::Error;
|
||||
use secp256k1::{self, ecdh, key};
|
||||
use Public;
|
||||
use Secret;
|
||||
use SECP256K1;
|
||||
|
||||
/// Agree on a shared secret
|
||||
pub fn agree(secret: &Secret, public: &Public) -> Result<Secret, Error> {
|
||||
let context = &SECP256K1;
|
||||
let pdata = {
|
||||
let mut temp = [4u8; 65];
|
||||
(&mut temp[1..65]).copy_from_slice(&public[0..64]);
|
||||
temp
|
||||
};
|
||||
|
||||
let publ = key::PublicKey::from_slice(context, &pdata)?;
|
||||
let sec = key::SecretKey::from_slice(context, &secret)?;
|
||||
let shared = ecdh::SharedSecret::new_raw(context, &publ, &sec);
|
||||
|
||||
Secret::from_unsafe_slice(&shared[0..32])
|
||||
.map_err(|_| Error::Secp(secp256k1::Error::InvalidSecretKey))
|
||||
}
|
||||
}
|
||||
|
||||
/// ECIES function
|
||||
pub mod ecies {
|
||||
use super::{ecdh, Error};
|
||||
use ethereum_types::H128;
|
||||
use parity_crypto::{aes, digest, hmac, is_equal};
|
||||
use Generator;
|
||||
use Public;
|
||||
use Random;
|
||||
use Secret;
|
||||
|
||||
/// Encrypt a message with a public key, writing an HMAC covering both
|
||||
/// the plaintext and authenticated data.
|
||||
///
|
||||
/// Authenticated data may be empty.
|
||||
pub fn encrypt(public: &Public, auth_data: &[u8], plain: &[u8]) -> Result<Vec<u8>, Error> {
|
||||
let r = Random.generate()?;
|
||||
let z = ecdh::agree(r.secret(), public)?;
|
||||
let mut key = [0u8; 32];
|
||||
kdf(&z, &[0u8; 0], &mut key);
|
||||
|
||||
let ekey = &key[0..16];
|
||||
let mkey = hmac::SigKey::sha256(&digest::sha256(&key[16..32]));
|
||||
|
||||
let mut msg = vec![0u8; 1 + 64 + 16 + plain.len() + 32];
|
||||
msg[0] = 0x04u8;
|
||||
{
|
||||
let msgd = &mut msg[1..];
|
||||
msgd[0..64].copy_from_slice(r.public());
|
||||
let iv = H128::random();
|
||||
msgd[64..80].copy_from_slice(&iv);
|
||||
{
|
||||
let cipher = &mut msgd[(64 + 16)..(64 + 16 + plain.len())];
|
||||
aes::encrypt_128_ctr(ekey, &iv, plain, cipher)?;
|
||||
}
|
||||
let mut hmac = hmac::Signer::with(&mkey);
|
||||
{
|
||||
let cipher_iv = &msgd[64..(64 + 16 + plain.len())];
|
||||
hmac.update(cipher_iv);
|
||||
}
|
||||
hmac.update(auth_data);
|
||||
let sig = hmac.sign();
|
||||
msgd[(64 + 16 + plain.len())..].copy_from_slice(&sig);
|
||||
}
|
||||
Ok(msg)
|
||||
}
|
||||
|
||||
/// Decrypt a message with a secret key, checking HMAC for ciphertext
|
||||
/// and authenticated data validity.
|
||||
pub fn decrypt(secret: &Secret, auth_data: &[u8], encrypted: &[u8]) -> Result<Vec<u8>, Error> {
|
||||
let meta_len = 1 + 64 + 16 + 32;
|
||||
if encrypted.len() < meta_len || encrypted[0] < 2 || encrypted[0] > 4 {
|
||||
return Err(Error::InvalidMessage); //invalid message: publickey
|
||||
}
|
||||
|
||||
let e = &encrypted[1..];
|
||||
let p = Public::from_slice(&e[0..64]);
|
||||
let z = ecdh::agree(secret, &p)?;
|
||||
let mut key = [0u8; 32];
|
||||
kdf(&z, &[0u8; 0], &mut key);
|
||||
|
||||
let ekey = &key[0..16];
|
||||
let mkey = hmac::SigKey::sha256(&digest::sha256(&key[16..32]));
|
||||
|
||||
let clen = encrypted.len() - meta_len;
|
||||
let cipher_with_iv = &e[64..(64 + 16 + clen)];
|
||||
let cipher_iv = &cipher_with_iv[0..16];
|
||||
let cipher_no_iv = &cipher_with_iv[16..];
|
||||
let msg_mac = &e[(64 + 16 + clen)..];
|
||||
|
||||
// Verify tag
|
||||
let mut hmac = hmac::Signer::with(&mkey);
|
||||
hmac.update(cipher_with_iv);
|
||||
hmac.update(auth_data);
|
||||
let mac = hmac.sign();
|
||||
|
||||
if !is_equal(&mac.as_ref()[..], msg_mac) {
|
||||
return Err(Error::InvalidMessage);
|
||||
}
|
||||
|
||||
let mut msg = vec![0u8; clen];
|
||||
aes::decrypt_128_ctr(ekey, cipher_iv, cipher_no_iv, &mut msg[..])?;
|
||||
Ok(msg)
|
||||
}
|
||||
|
||||
fn kdf(secret: &Secret, s1: &[u8], dest: &mut [u8]) {
|
||||
// SEC/ISO/Shoup specify counter size SHOULD be equivalent
|
||||
// to size of hash output, however, it also notes that
|
||||
// the 4 bytes is okay. NIST specifies 4 bytes.
|
||||
let mut ctr = 1u32;
|
||||
let mut written = 0usize;
|
||||
while written < dest.len() {
|
||||
let mut hasher = digest::Hasher::sha256();
|
||||
let ctrs = [
|
||||
(ctr >> 24) as u8,
|
||||
(ctr >> 16) as u8,
|
||||
(ctr >> 8) as u8,
|
||||
ctr as u8,
|
||||
];
|
||||
hasher.update(&ctrs);
|
||||
hasher.update(secret);
|
||||
hasher.update(s1);
|
||||
let d = hasher.finish();
|
||||
&mut dest[written..(written + 32)].copy_from_slice(&d);
|
||||
written += 32;
|
||||
ctr += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::ecies;
|
||||
use Generator;
|
||||
use Random;
|
||||
|
||||
#[test]
|
||||
fn ecies_shared() {
|
||||
let kp = Random.generate().unwrap();
|
||||
let message = b"So many books, so little time";
|
||||
|
||||
let shared = b"shared";
|
||||
let wrong_shared = b"incorrect";
|
||||
let encrypted = ecies::encrypt(kp.public(), shared, message).unwrap();
|
||||
assert!(encrypted[..] != message[..]);
|
||||
assert_eq!(encrypted[0], 0x04);
|
||||
|
||||
assert!(ecies::decrypt(kp.secret(), wrong_shared, &encrypted).is_err());
|
||||
let decrypted = ecies::decrypt(kp.secret(), shared, &encrypted).unwrap();
|
||||
assert_eq!(decrypted[..message.len()], message[..]);
|
||||
}
|
||||
}
|
||||
81
accounts/ethkey/src/error.rs
Normal file
81
accounts/ethkey/src/error.rs
Normal file
@@ -0,0 +1,81 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// OpenEthereum 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.
|
||||
|
||||
// OpenEthereum 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 OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::{error, fmt};
|
||||
|
||||
#[derive(Debug)]
|
||||
/// Crypto error
|
||||
pub enum Error {
|
||||
/// Invalid secret key
|
||||
InvalidSecret,
|
||||
/// Invalid public key
|
||||
InvalidPublic,
|
||||
/// Invalid address
|
||||
InvalidAddress,
|
||||
/// Invalid EC signature
|
||||
InvalidSignature,
|
||||
/// Invalid AES message
|
||||
InvalidMessage,
|
||||
/// IO Error
|
||||
Io(::std::io::Error),
|
||||
/// Custom
|
||||
Custom(String),
|
||||
}
|
||||
|
||||
impl fmt::Display for Error {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let msg = match *self {
|
||||
Error::InvalidSecret => "Invalid secret".into(),
|
||||
Error::InvalidPublic => "Invalid public".into(),
|
||||
Error::InvalidAddress => "Invalid address".into(),
|
||||
Error::InvalidSignature => "Invalid EC signature".into(),
|
||||
Error::InvalidMessage => "Invalid AES message".into(),
|
||||
Error::Io(ref err) => format!("I/O error: {}", err),
|
||||
Error::Custom(ref s) => s.clone(),
|
||||
};
|
||||
|
||||
f.write_fmt(format_args!("Crypto error ({})", msg))
|
||||
}
|
||||
}
|
||||
|
||||
impl error::Error for Error {
|
||||
fn description(&self) -> &str {
|
||||
"Crypto error"
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<String> for Error {
|
||||
fn into(self) -> String {
|
||||
format!("{}", self)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<::secp256k1::Error> for Error {
|
||||
fn from(e: ::secp256k1::Error) -> Error {
|
||||
match e {
|
||||
::secp256k1::Error::InvalidMessage => Error::InvalidMessage,
|
||||
::secp256k1::Error::InvalidPublicKey => Error::InvalidPublic,
|
||||
::secp256k1::Error::InvalidSecretKey => Error::InvalidSecret,
|
||||
_ => Error::InvalidSignature,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<::std::io::Error> for Error {
|
||||
fn from(err: ::std::io::Error) -> Error {
|
||||
Error::Io(err)
|
||||
}
|
||||
}
|
||||
589
accounts/ethkey/src/extended.rs
Normal file
589
accounts/ethkey/src/extended.rs
Normal file
@@ -0,0 +1,589 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// OpenEthereum 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.
|
||||
|
||||
// OpenEthereum 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 OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Extended keys
|
||||
|
||||
pub use self::derivation::Error as DerivationError;
|
||||
use ethereum_types::H256;
|
||||
use secret::Secret;
|
||||
use Public;
|
||||
|
||||
/// Represents label that can be stored as a part of key derivation
|
||||
pub trait Label {
|
||||
/// Length of the data that label occupies
|
||||
fn len() -> usize;
|
||||
|
||||
/// Store label data to the key derivation sequence
|
||||
/// Must not use more than `len()` bytes from slice
|
||||
fn store(&self, target: &mut [u8]);
|
||||
}
|
||||
|
||||
impl Label for u32 {
|
||||
fn len() -> usize {
|
||||
4
|
||||
}
|
||||
|
||||
fn store(&self, target: &mut [u8]) {
|
||||
let bytes = self.to_be_bytes();
|
||||
target[0..4].copy_from_slice(&bytes);
|
||||
}
|
||||
}
|
||||
|
||||
/// Key derivation over generic label `T`
|
||||
pub enum Derivation<T: Label> {
|
||||
/// Soft key derivation (allow proof of parent)
|
||||
Soft(T),
|
||||
/// Hard key derivation (does not allow proof of parent)
|
||||
Hard(T),
|
||||
}
|
||||
|
||||
impl From<u32> for Derivation<u32> {
|
||||
fn from(index: u32) -> Self {
|
||||
if index < (2 << 30) {
|
||||
Derivation::Soft(index)
|
||||
} else {
|
||||
Derivation::Hard(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Label for H256 {
|
||||
fn len() -> usize {
|
||||
32
|
||||
}
|
||||
|
||||
fn store(&self, target: &mut [u8]) {
|
||||
self.copy_to(&mut target[0..32]);
|
||||
}
|
||||
}
|
||||
|
||||
/// Extended secret key, allows deterministic derivation of subsequent keys.
|
||||
pub struct ExtendedSecret {
|
||||
secret: Secret,
|
||||
chain_code: H256,
|
||||
}
|
||||
|
||||
impl ExtendedSecret {
|
||||
/// New extended key from given secret and chain code.
|
||||
pub fn with_code(secret: Secret, chain_code: H256) -> ExtendedSecret {
|
||||
ExtendedSecret {
|
||||
secret: secret,
|
||||
chain_code: chain_code,
|
||||
}
|
||||
}
|
||||
|
||||
/// New extended key from given secret with the random chain code.
|
||||
pub fn new_random(secret: Secret) -> ExtendedSecret {
|
||||
ExtendedSecret::with_code(secret, H256::random())
|
||||
}
|
||||
|
||||
/// New extended key from given secret.
|
||||
/// Chain code will be derived from the secret itself (in a deterministic way).
|
||||
pub fn new(secret: Secret) -> ExtendedSecret {
|
||||
let chain_code = derivation::chain_code(*secret);
|
||||
ExtendedSecret::with_code(secret, chain_code)
|
||||
}
|
||||
|
||||
/// Derive new private key
|
||||
pub fn derive<T>(&self, index: Derivation<T>) -> ExtendedSecret
|
||||
where
|
||||
T: Label,
|
||||
{
|
||||
let (derived_key, next_chain_code) =
|
||||
derivation::private(*self.secret, self.chain_code, index);
|
||||
|
||||
let derived_secret = Secret::from(derived_key.0);
|
||||
|
||||
ExtendedSecret::with_code(derived_secret, next_chain_code)
|
||||
}
|
||||
|
||||
/// Private key component of the extended key.
|
||||
pub fn as_raw(&self) -> &Secret {
|
||||
&self.secret
|
||||
}
|
||||
}
|
||||
|
||||
/// Extended public key, allows deterministic derivation of subsequent keys.
|
||||
pub struct ExtendedPublic {
|
||||
public: Public,
|
||||
chain_code: H256,
|
||||
}
|
||||
|
||||
impl ExtendedPublic {
|
||||
/// New extended public key from known parent and chain code
|
||||
pub fn new(public: Public, chain_code: H256) -> Self {
|
||||
ExtendedPublic {
|
||||
public: public,
|
||||
chain_code: chain_code,
|
||||
}
|
||||
}
|
||||
|
||||
/// Create new extended public key from known secret
|
||||
pub fn from_secret(secret: &ExtendedSecret) -> Result<Self, DerivationError> {
|
||||
Ok(ExtendedPublic::new(
|
||||
derivation::point(**secret.as_raw())?,
|
||||
secret.chain_code.clone(),
|
||||
))
|
||||
}
|
||||
|
||||
/// Derive new public key
|
||||
/// Operation is defined only for index belongs [0..2^31)
|
||||
pub fn derive<T>(&self, index: Derivation<T>) -> Result<Self, DerivationError>
|
||||
where
|
||||
T: Label,
|
||||
{
|
||||
let (derived_key, next_chain_code) =
|
||||
derivation::public(self.public, self.chain_code, index)?;
|
||||
Ok(ExtendedPublic::new(derived_key, next_chain_code))
|
||||
}
|
||||
|
||||
pub fn public(&self) -> &Public {
|
||||
&self.public
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ExtendedKeyPair {
|
||||
secret: ExtendedSecret,
|
||||
public: ExtendedPublic,
|
||||
}
|
||||
|
||||
impl ExtendedKeyPair {
|
||||
pub fn new(secret: Secret) -> Self {
|
||||
let extended_secret = ExtendedSecret::new(secret);
|
||||
let extended_public = ExtendedPublic::from_secret(&extended_secret)
|
||||
.expect("Valid `Secret` always produces valid public; qed");
|
||||
ExtendedKeyPair {
|
||||
secret: extended_secret,
|
||||
public: extended_public,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_code(secret: Secret, public: Public, chain_code: H256) -> Self {
|
||||
ExtendedKeyPair {
|
||||
secret: ExtendedSecret::with_code(secret, chain_code.clone()),
|
||||
public: ExtendedPublic::new(public, chain_code),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_secret(secret: Secret, chain_code: H256) -> Self {
|
||||
let extended_secret = ExtendedSecret::with_code(secret, chain_code);
|
||||
let extended_public = ExtendedPublic::from_secret(&extended_secret)
|
||||
.expect("Valid `Secret` always produces valid public; qed");
|
||||
ExtendedKeyPair {
|
||||
secret: extended_secret,
|
||||
public: extended_public,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_seed(seed: &[u8]) -> Result<ExtendedKeyPair, DerivationError> {
|
||||
let (master_key, chain_code) = derivation::seed_pair(seed);
|
||||
Ok(ExtendedKeyPair::with_secret(
|
||||
Secret::from_unsafe_slice(&*master_key).map_err(|_| DerivationError::InvalidSeed)?,
|
||||
chain_code,
|
||||
))
|
||||
}
|
||||
|
||||
pub fn secret(&self) -> &ExtendedSecret {
|
||||
&self.secret
|
||||
}
|
||||
|
||||
pub fn public(&self) -> &ExtendedPublic {
|
||||
&self.public
|
||||
}
|
||||
|
||||
pub fn derive<T>(&self, index: Derivation<T>) -> Result<Self, DerivationError>
|
||||
where
|
||||
T: Label,
|
||||
{
|
||||
let derived = self.secret.derive(index);
|
||||
|
||||
Ok(ExtendedKeyPair {
|
||||
public: ExtendedPublic::from_secret(&derived)?,
|
||||
secret: derived,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Derivation functions for private and public keys
|
||||
// Work is based on BIP0032
|
||||
// https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
|
||||
mod derivation {
|
||||
use super::{Derivation, Label};
|
||||
use ethereum_types::{H256, H512, U256, U512};
|
||||
use keccak;
|
||||
use math::curve_order;
|
||||
use parity_crypto::hmac;
|
||||
use secp256k1::key::{PublicKey, SecretKey};
|
||||
use SECP256K1;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
InvalidHardenedUse,
|
||||
InvalidPoint,
|
||||
MissingIndex,
|
||||
InvalidSeed,
|
||||
}
|
||||
|
||||
// Deterministic derivation of the key using secp256k1 elliptic curve.
|
||||
// Derivation can be either hardened or not.
|
||||
// For hardened derivation, pass u32 index at least 2^31 or custom Derivation::Hard(T) enum
|
||||
//
|
||||
// Can panic if passed `private_key` is not a valid secp256k1 private key
|
||||
// (outside of (0..curve_order()]) field
|
||||
pub fn private<T>(private_key: H256, chain_code: H256, index: Derivation<T>) -> (H256, H256)
|
||||
where
|
||||
T: Label,
|
||||
{
|
||||
match index {
|
||||
Derivation::Soft(index) => private_soft(private_key, chain_code, index),
|
||||
Derivation::Hard(index) => private_hard(private_key, chain_code, index),
|
||||
}
|
||||
}
|
||||
|
||||
fn hmac_pair(data: &[u8], private_key: H256, chain_code: H256) -> (H256, H256) {
|
||||
let private: U256 = private_key.into();
|
||||
|
||||
// produces 512-bit derived hmac (I)
|
||||
let skey = hmac::SigKey::sha512(&*chain_code);
|
||||
let i_512 = hmac::sign(&skey, &data[..]);
|
||||
|
||||
// left most 256 bits are later added to original private key
|
||||
let hmac_key: U256 = H256::from_slice(&i_512[0..32]).into();
|
||||
// right most 256 bits are new chain code for later derivations
|
||||
let next_chain_code = H256::from(&i_512[32..64]);
|
||||
|
||||
let child_key = private_add(hmac_key, private).into();
|
||||
(child_key, next_chain_code)
|
||||
}
|
||||
|
||||
// Can panic if passed `private_key` is not a valid secp256k1 private key
|
||||
// (outside of (0..curve_order()]) field
|
||||
fn private_soft<T>(private_key: H256, chain_code: H256, index: T) -> (H256, H256)
|
||||
where
|
||||
T: Label,
|
||||
{
|
||||
let mut data = vec![0u8; 33 + T::len()];
|
||||
|
||||
let sec_private = SecretKey::from_slice(&SECP256K1, &*private_key)
|
||||
.expect("Caller should provide valid private key");
|
||||
let sec_public = PublicKey::from_secret_key(&SECP256K1, &sec_private)
|
||||
.expect("Caller should provide valid private key");
|
||||
let public_serialized = sec_public.serialize_vec(&SECP256K1, true);
|
||||
|
||||
// curve point (compressed public key) -- index
|
||||
// 0.33 -- 33..end
|
||||
data[0..33].copy_from_slice(&public_serialized);
|
||||
index.store(&mut data[33..]);
|
||||
|
||||
hmac_pair(&data, private_key, chain_code)
|
||||
}
|
||||
|
||||
// Deterministic derivation of the key using secp256k1 elliptic curve
|
||||
// This is hardened derivation and does not allow to associate
|
||||
// corresponding public keys of the original and derived private keys
|
||||
fn private_hard<T>(private_key: H256, chain_code: H256, index: T) -> (H256, H256)
|
||||
where
|
||||
T: Label,
|
||||
{
|
||||
let mut data: Vec<u8> = vec![0u8; 33 + T::len()];
|
||||
let private: U256 = private_key.into();
|
||||
|
||||
// 0x00 (padding) -- private_key -- index
|
||||
// 0 -- 1..33 -- 33..end
|
||||
private.to_big_endian(&mut data[1..33]);
|
||||
index.store(&mut data[33..(33 + T::len())]);
|
||||
|
||||
hmac_pair(&data, private_key, chain_code)
|
||||
}
|
||||
|
||||
fn private_add(k1: U256, k2: U256) -> U256 {
|
||||
let sum = U512::from(k1) + U512::from(k2);
|
||||
modulo(sum, curve_order())
|
||||
}
|
||||
|
||||
// todo: surely can be optimized
|
||||
fn modulo(u1: U512, u2: U256) -> U256 {
|
||||
let dv = u1 / U512::from(u2);
|
||||
let md = u1 - (dv * U512::from(u2));
|
||||
md.into()
|
||||
}
|
||||
|
||||
pub fn public<T>(
|
||||
public_key: H512,
|
||||
chain_code: H256,
|
||||
derivation: Derivation<T>,
|
||||
) -> Result<(H512, H256), Error>
|
||||
where
|
||||
T: Label,
|
||||
{
|
||||
let index = match derivation {
|
||||
Derivation::Soft(index) => index,
|
||||
Derivation::Hard(_) => {
|
||||
return Err(Error::InvalidHardenedUse);
|
||||
}
|
||||
};
|
||||
|
||||
let mut public_sec_raw = [0u8; 65];
|
||||
public_sec_raw[0] = 4;
|
||||
public_sec_raw[1..65].copy_from_slice(&*public_key);
|
||||
let public_sec =
|
||||
PublicKey::from_slice(&SECP256K1, &public_sec_raw).map_err(|_| Error::InvalidPoint)?;
|
||||
let public_serialized = public_sec.serialize_vec(&SECP256K1, true);
|
||||
|
||||
let mut data = vec![0u8; 33 + T::len()];
|
||||
// curve point (compressed public key) -- index
|
||||
// 0.33 -- 33..end
|
||||
data[0..33].copy_from_slice(&public_serialized);
|
||||
index.store(&mut data[33..(33 + T::len())]);
|
||||
|
||||
// HMAC512SHA produces [derived private(256); new chain code(256)]
|
||||
let skey = hmac::SigKey::sha512(&*chain_code);
|
||||
let i_512 = hmac::sign(&skey, &data[..]);
|
||||
|
||||
let new_private = H256::from(&i_512[0..32]);
|
||||
let new_chain_code = H256::from(&i_512[32..64]);
|
||||
|
||||
// Generated private key can (extremely rarely) be out of secp256k1 key field
|
||||
if curve_order() <= new_private.clone().into() {
|
||||
return Err(Error::MissingIndex);
|
||||
}
|
||||
let new_private_sec = SecretKey::from_slice(&SECP256K1, &*new_private)
|
||||
.expect("Private key belongs to the field [0..CURVE_ORDER) (checked above); So initializing can never fail; qed");
|
||||
let mut new_public = PublicKey::from_secret_key(&SECP256K1, &new_private_sec)
|
||||
.expect("Valid private key produces valid public key");
|
||||
|
||||
// Adding two points on the elliptic curves (combining two public keys)
|
||||
new_public
|
||||
.add_assign(&SECP256K1, &public_sec)
|
||||
.expect("Addition of two valid points produce valid point");
|
||||
|
||||
let serialized = new_public.serialize_vec(&SECP256K1, false);
|
||||
|
||||
Ok((H512::from(&serialized[1..65]), new_chain_code))
|
||||
}
|
||||
|
||||
fn sha3(slc: &[u8]) -> H256 {
|
||||
keccak::Keccak256::keccak256(slc).into()
|
||||
}
|
||||
|
||||
pub fn chain_code(secret: H256) -> H256 {
|
||||
// 10,000 rounds of sha3
|
||||
let mut running_sha3 = sha3(&*secret);
|
||||
for _ in 0..99999 {
|
||||
running_sha3 = sha3(&*running_sha3);
|
||||
}
|
||||
running_sha3
|
||||
}
|
||||
|
||||
pub fn point(secret: H256) -> Result<H512, Error> {
|
||||
let sec = SecretKey::from_slice(&SECP256K1, &*secret).map_err(|_| Error::InvalidPoint)?;
|
||||
let public_sec =
|
||||
PublicKey::from_secret_key(&SECP256K1, &sec).map_err(|_| Error::InvalidPoint)?;
|
||||
let serialized = public_sec.serialize_vec(&SECP256K1, false);
|
||||
Ok(H512::from(&serialized[1..65]))
|
||||
}
|
||||
|
||||
pub fn seed_pair(seed: &[u8]) -> (H256, H256) {
|
||||
let skey = hmac::SigKey::sha512(b"Bitcoin seed");
|
||||
let i_512 = hmac::sign(&skey, seed);
|
||||
|
||||
let master_key = H256::from_slice(&i_512[0..32]);
|
||||
let chain_code = H256::from_slice(&i_512[32..64]);
|
||||
|
||||
(master_key, chain_code)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{derivation, Derivation, ExtendedKeyPair, ExtendedPublic, ExtendedSecret};
|
||||
use ethereum_types::{H128, H256};
|
||||
use secret::Secret;
|
||||
use std::str::FromStr;
|
||||
|
||||
fn master_chain_basic() -> (H256, H256) {
|
||||
let seed = H128::from_str("000102030405060708090a0b0c0d0e0f")
|
||||
.expect("Seed should be valid H128")
|
||||
.to_vec();
|
||||
|
||||
derivation::seed_pair(&*seed)
|
||||
}
|
||||
|
||||
fn test_extended<F>(f: F, test_private: H256)
|
||||
where
|
||||
F: Fn(ExtendedSecret) -> ExtendedSecret,
|
||||
{
|
||||
let (private_seed, chain_code) = master_chain_basic();
|
||||
let extended_secret = ExtendedSecret::with_code(Secret::from(private_seed.0), chain_code);
|
||||
let derived = f(extended_secret);
|
||||
assert_eq!(**derived.as_raw(), test_private);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn smoky() {
|
||||
let secret =
|
||||
Secret::from_str("a100df7a048e50ed308ea696dc600215098141cb391e9527329df289f9383f65")
|
||||
.unwrap();
|
||||
let extended_secret = ExtendedSecret::with_code(secret.clone(), 0u64.into());
|
||||
|
||||
// hardened
|
||||
assert_eq!(&**extended_secret.as_raw(), &*secret);
|
||||
assert_eq!(
|
||||
&**extended_secret.derive(2147483648.into()).as_raw(),
|
||||
&"0927453daed47839608e414a3738dfad10aed17c459bbd9ab53f89b026c834b6".into()
|
||||
);
|
||||
assert_eq!(
|
||||
&**extended_secret.derive(2147483649.into()).as_raw(),
|
||||
&"44238b6a29c6dcbe9b401364141ba11e2198c289a5fed243a1c11af35c19dc0f".into()
|
||||
);
|
||||
|
||||
// normal
|
||||
assert_eq!(
|
||||
&**extended_secret.derive(0.into()).as_raw(),
|
||||
&"bf6a74e3f7b36fc4c96a1e12f31abc817f9f5904f5a8fc27713163d1f0b713f6".into()
|
||||
);
|
||||
assert_eq!(
|
||||
&**extended_secret.derive(1.into()).as_raw(),
|
||||
&"bd4fca9eb1f9c201e9448c1eecd66e302d68d4d313ce895b8c134f512205c1bc".into()
|
||||
);
|
||||
assert_eq!(
|
||||
&**extended_secret.derive(2.into()).as_raw(),
|
||||
&"86932b542d6cab4d9c65490c7ef502d89ecc0e2a5f4852157649e3251e2a3268".into()
|
||||
);
|
||||
|
||||
let extended_public = ExtendedPublic::from_secret(&extended_secret)
|
||||
.expect("Extended public should be created");
|
||||
let derived_public = extended_public
|
||||
.derive(0.into())
|
||||
.expect("First derivation of public should succeed");
|
||||
assert_eq!(&*derived_public.public(), &"f7b3244c96688f92372bfd4def26dc4151529747bab9f188a4ad34e141d47bd66522ff048bc6f19a0a4429b04318b1a8796c000265b4fa200dae5f6dda92dd94".into());
|
||||
|
||||
let keypair = ExtendedKeyPair::with_secret(
|
||||
Secret::from_str("a100df7a048e50ed308ea696dc600215098141cb391e9527329df289f9383f65")
|
||||
.unwrap(),
|
||||
064.into(),
|
||||
);
|
||||
assert_eq!(
|
||||
&**keypair
|
||||
.derive(2147483648u32.into())
|
||||
.expect("Derivation of keypair should succeed")
|
||||
.secret()
|
||||
.as_raw(),
|
||||
&"edef54414c03196557cf73774bc97a645c9a1df2164ed34f0c2a78d1375a930c".into()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn h256_soft_match() {
|
||||
let secret =
|
||||
Secret::from_str("a100df7a048e50ed308ea696dc600215098141cb391e9527329df289f9383f65")
|
||||
.unwrap();
|
||||
let derivation_secret =
|
||||
H256::from_str("51eaf04f9dbbc1417dc97e789edd0c37ecda88bac490434e367ea81b71b7b015")
|
||||
.unwrap();
|
||||
|
||||
let extended_secret = ExtendedSecret::with_code(secret.clone(), 0u64.into());
|
||||
let extended_public = ExtendedPublic::from_secret(&extended_secret)
|
||||
.expect("Extended public should be created");
|
||||
|
||||
let derived_secret0 = extended_secret.derive(Derivation::Soft(derivation_secret));
|
||||
let derived_public0 = extended_public
|
||||
.derive(Derivation::Soft(derivation_secret))
|
||||
.expect("First derivation of public should succeed");
|
||||
|
||||
let public_from_secret0 = ExtendedPublic::from_secret(&derived_secret0)
|
||||
.expect("Extended public should be created");
|
||||
|
||||
assert_eq!(public_from_secret0.public(), derived_public0.public());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn h256_hard() {
|
||||
let secret =
|
||||
Secret::from_str("a100df7a048e50ed308ea696dc600215098141cb391e9527329df289f9383f65")
|
||||
.unwrap();
|
||||
let derivation_secret =
|
||||
H256::from_str("51eaf04f9dbbc1417dc97e789edd0c37ecda88bac490434e367ea81b71b7b015")
|
||||
.unwrap();
|
||||
let extended_secret = ExtendedSecret::with_code(secret.clone(), 1u64.into());
|
||||
|
||||
assert_eq!(
|
||||
&**extended_secret
|
||||
.derive(Derivation::Hard(derivation_secret))
|
||||
.as_raw(),
|
||||
&"2bc2d696fb744d77ff813b4a1ef0ad64e1e5188b622c54ba917acc5ebc7c5486".into()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn match_() {
|
||||
let secret =
|
||||
Secret::from_str("a100df7a048e50ed308ea696dc600215098141cb391e9527329df289f9383f65")
|
||||
.unwrap();
|
||||
let extended_secret = ExtendedSecret::with_code(secret.clone(), 1.into());
|
||||
let extended_public = ExtendedPublic::from_secret(&extended_secret)
|
||||
.expect("Extended public should be created");
|
||||
|
||||
let derived_secret0 = extended_secret.derive(0.into());
|
||||
let derived_public0 = extended_public
|
||||
.derive(0.into())
|
||||
.expect("First derivation of public should succeed");
|
||||
|
||||
let public_from_secret0 = ExtendedPublic::from_secret(&derived_secret0)
|
||||
.expect("Extended public should be created");
|
||||
|
||||
assert_eq!(public_from_secret0.public(), derived_public0.public());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_seeds() {
|
||||
let seed = H128::from_str("000102030405060708090a0b0c0d0e0f")
|
||||
.expect("Seed should be valid H128")
|
||||
.to_vec();
|
||||
|
||||
// private key from bitcoin test vector
|
||||
// xprv9wTYmMFdV23N2TdNG573QoEsfRrWKQgWeibmLntzniatZvR9BmLnvSxqu53Kw1UmYPxLgboyZQaXwTCg8MSY3H2EU4pWcQDnRnrVA1xe8fs
|
||||
let test_private =
|
||||
H256::from_str("e8f32e723decf4051aefac8e2c93c9c5b214313817cdb01a1494b917c8436b35")
|
||||
.expect("Private should be decoded ok");
|
||||
|
||||
let (private_seed, _) = derivation::seed_pair(&*seed);
|
||||
|
||||
assert_eq!(private_seed, test_private);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_vector_1() {
|
||||
// xprv9uHRZZhk6KAJC1avXpDAp4MDc3sQKNxDiPvvkX8Br5ngLNv1TxvUxt4cV1rGL5hj6KCesnDYUhd7oWgT11eZG7XnxHrnYeSvkzY7d2bhkJ7
|
||||
// H(0)
|
||||
test_extended(
|
||||
|secret| secret.derive(2147483648.into()),
|
||||
H256::from_str("edb2e14f9ee77d26dd93b4ecede8d16ed408ce149b6cd80b0715a2d911a0afea")
|
||||
.expect("Private should be decoded ok"),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_vector_2() {
|
||||
// xprv9wTYmMFdV23N2TdNG573QoEsfRrWKQgWeibmLntzniatZvR9BmLnvSxqu53Kw1UmYPxLgboyZQaXwTCg8MSY3H2EU4pWcQDnRnrVA1xe8fs
|
||||
// H(0)/1
|
||||
test_extended(
|
||||
|secret| secret.derive(2147483648.into()).derive(1.into()),
|
||||
H256::from_str("3c6cb8d0f6a264c91ea8b5030fadaa8e538b020f0a387421a12de9319dc93368")
|
||||
.expect("Private should be decoded ok"),
|
||||
);
|
||||
}
|
||||
}
|
||||
33
accounts/ethkey/src/keccak.rs
Normal file
33
accounts/ethkey/src/keccak.rs
Normal file
@@ -0,0 +1,33 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// OpenEthereum 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.
|
||||
|
||||
// OpenEthereum 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 OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use tiny_keccak::Keccak;
|
||||
|
||||
pub trait Keccak256<T> {
|
||||
fn keccak256(&self) -> T
|
||||
where
|
||||
T: Sized;
|
||||
}
|
||||
|
||||
impl Keccak256<[u8; 32]> for [u8] {
|
||||
fn keccak256(&self) -> [u8; 32] {
|
||||
let mut keccak = Keccak::new_keccak256();
|
||||
let mut result = [0u8; 32];
|
||||
keccak.update(self);
|
||||
keccak.finalize(&mut result);
|
||||
result
|
||||
}
|
||||
}
|
||||
120
accounts/ethkey/src/keypair.rs
Normal file
120
accounts/ethkey/src/keypair.rs
Normal file
@@ -0,0 +1,120 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// OpenEthereum 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.
|
||||
|
||||
// OpenEthereum 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 OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use super::{Address, Error, Public, Secret, SECP256K1};
|
||||
use keccak::Keccak256;
|
||||
use rustc_hex::ToHex;
|
||||
use secp256k1::key;
|
||||
use std::fmt;
|
||||
|
||||
pub fn public_to_address(public: &Public) -> Address {
|
||||
let hash = public.keccak256();
|
||||
let mut result = Address::default();
|
||||
result.copy_from_slice(&hash[12..]);
|
||||
result
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
/// secp256k1 key pair
|
||||
pub struct KeyPair {
|
||||
secret: Secret,
|
||||
public: Public,
|
||||
}
|
||||
|
||||
impl fmt::Display for KeyPair {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
writeln!(f, "secret: {}", self.secret.to_hex())?;
|
||||
writeln!(f, "public: {}", self.public.to_hex())?;
|
||||
write!(f, "address: {}", self.address().to_hex())
|
||||
}
|
||||
}
|
||||
|
||||
impl KeyPair {
|
||||
/// Create a pair from secret key
|
||||
pub fn from_secret(secret: Secret) -> Result<KeyPair, Error> {
|
||||
let context = &SECP256K1;
|
||||
let s: key::SecretKey = key::SecretKey::from_slice(context, &secret[..])?;
|
||||
let pub_key = key::PublicKey::from_secret_key(context, &s)?;
|
||||
let serialized = pub_key.serialize_vec(context, false);
|
||||
|
||||
let mut public = Public::default();
|
||||
public.copy_from_slice(&serialized[1..65]);
|
||||
|
||||
let keypair = KeyPair {
|
||||
secret: secret,
|
||||
public: public,
|
||||
};
|
||||
|
||||
Ok(keypair)
|
||||
}
|
||||
|
||||
pub fn from_secret_slice(slice: &[u8]) -> Result<KeyPair, Error> {
|
||||
Self::from_secret(Secret::from_unsafe_slice(slice)?)
|
||||
}
|
||||
|
||||
pub fn from_keypair(sec: key::SecretKey, publ: key::PublicKey) -> Self {
|
||||
let context = &SECP256K1;
|
||||
let serialized = publ.serialize_vec(context, false);
|
||||
let secret = Secret::from(sec);
|
||||
let mut public = Public::default();
|
||||
public.copy_from_slice(&serialized[1..65]);
|
||||
|
||||
KeyPair {
|
||||
secret: secret,
|
||||
public: public,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn secret(&self) -> &Secret {
|
||||
&self.secret
|
||||
}
|
||||
|
||||
pub fn public(&self) -> &Public {
|
||||
&self.public
|
||||
}
|
||||
|
||||
pub fn address(&self) -> Address {
|
||||
public_to_address(&self.public)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::str::FromStr;
|
||||
use KeyPair;
|
||||
use Secret;
|
||||
|
||||
#[test]
|
||||
fn from_secret() {
|
||||
let secret =
|
||||
Secret::from_str("a100df7a048e50ed308ea696dc600215098141cb391e9527329df289f9383f65")
|
||||
.unwrap();
|
||||
let _ = KeyPair::from_secret(secret).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keypair_display() {
|
||||
let expected =
|
||||
"secret: a100df7a048e50ed308ea696dc600215098141cb391e9527329df289f9383f65
|
||||
public: 8ce0db0b0359ffc5866ba61903cc2518c3675ef2cf380a7e54bde7ea20e6fa1ab45b7617346cd11b7610001ee6ae5b0155c41cad9527cbcdff44ec67848943a4
|
||||
address: 5b073e9233944b5e729e46d618f0d8edf3d9c34a".to_owned();
|
||||
let secret =
|
||||
Secret::from_str("a100df7a048e50ed308ea696dc600215098141cb391e9527329df289f9383f65")
|
||||
.unwrap();
|
||||
let kp = KeyPair::from_secret(secret).unwrap();
|
||||
assert_eq!(format!("{}", kp), expected);
|
||||
}
|
||||
}
|
||||
@@ -1,26 +1,36 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// #![warn(missing_docs)]
|
||||
|
||||
extern crate edit_distance;
|
||||
extern crate ethereum_types;
|
||||
extern crate memzero;
|
||||
extern crate parity_crypto;
|
||||
extern crate parity_wordlist;
|
||||
#[macro_use]
|
||||
extern crate quick_error;
|
||||
extern crate rand;
|
||||
extern crate rustc_hex;
|
||||
extern crate secp256k1;
|
||||
extern crate serde;
|
||||
extern crate tiny_keccak;
|
||||
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
#[macro_use]
|
||||
@@ -28,13 +38,52 @@ extern crate serde_derive;
|
||||
|
||||
mod brain;
|
||||
mod brain_prefix;
|
||||
mod error;
|
||||
mod extended;
|
||||
mod keccak;
|
||||
mod keypair;
|
||||
mod password;
|
||||
mod prefix;
|
||||
mod random;
|
||||
mod secret;
|
||||
mod signature;
|
||||
|
||||
pub mod brain_recover;
|
||||
pub mod crypto;
|
||||
pub mod math;
|
||||
|
||||
pub use self::parity_wordlist::Error as WordlistError;
|
||||
pub use self::brain::Brain;
|
||||
pub use self::brain_prefix::BrainPrefix;
|
||||
pub use self::password::Password;
|
||||
pub use self::prefix::Prefix;
|
||||
pub use self::{
|
||||
brain::Brain,
|
||||
brain_prefix::BrainPrefix,
|
||||
error::Error,
|
||||
extended::{Derivation, DerivationError, ExtendedKeyPair, ExtendedPublic, ExtendedSecret},
|
||||
keypair::{public_to_address, KeyPair},
|
||||
math::public_is_valid,
|
||||
parity_wordlist::Error as WordlistError,
|
||||
password::Password,
|
||||
prefix::Prefix,
|
||||
random::Random,
|
||||
secret::Secret,
|
||||
signature::{recover, sign, verify_address, verify_public, Signature},
|
||||
};
|
||||
|
||||
use ethereum_types::H256;
|
||||
|
||||
pub use ethereum_types::{Address, Public};
|
||||
pub type Message = H256;
|
||||
|
||||
lazy_static! {
|
||||
pub static ref SECP256K1: secp256k1::Secp256k1 = secp256k1::Secp256k1::new();
|
||||
}
|
||||
|
||||
/// Uninstantiatable error type for infallible generators.
|
||||
#[derive(Debug)]
|
||||
pub enum Void {}
|
||||
|
||||
/// Generates new keypair.
|
||||
pub trait Generator {
|
||||
type Error;
|
||||
|
||||
/// Should be called to generate new keypair.
|
||||
fn generate(&mut self) -> Result<KeyPair, Self::Error>;
|
||||
}
|
||||
|
||||
134
accounts/ethkey/src/math.rs
Normal file
134
accounts/ethkey/src/math.rs
Normal file
@@ -0,0 +1,134 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// OpenEthereum 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.
|
||||
|
||||
// OpenEthereum 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 OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use super::{Error, Public, Secret, SECP256K1};
|
||||
use ethereum_types::{H256, U256};
|
||||
use secp256k1::{
|
||||
constants::{CURVE_ORDER, GENERATOR_X, GENERATOR_Y},
|
||||
key,
|
||||
};
|
||||
|
||||
/// Whether the public key is valid.
|
||||
pub fn public_is_valid(public: &Public) -> bool {
|
||||
to_secp256k1_public(public)
|
||||
.ok()
|
||||
.map_or(false, |p| p.is_valid())
|
||||
}
|
||||
|
||||
/// Inplace multiply public key by secret key (EC point * scalar)
|
||||
pub fn public_mul_secret(public: &mut Public, secret: &Secret) -> Result<(), Error> {
|
||||
let key_secret = secret.to_secp256k1_secret()?;
|
||||
let mut key_public = to_secp256k1_public(public)?;
|
||||
key_public.mul_assign(&SECP256K1, &key_secret)?;
|
||||
set_public(public, &key_public);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Inplace add one public key to another (EC point + EC point)
|
||||
pub fn public_add(public: &mut Public, other: &Public) -> Result<(), Error> {
|
||||
let mut key_public = to_secp256k1_public(public)?;
|
||||
let other_public = to_secp256k1_public(other)?;
|
||||
key_public.add_assign(&SECP256K1, &other_public)?;
|
||||
set_public(public, &key_public);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Inplace sub one public key from another (EC point - EC point)
|
||||
pub fn public_sub(public: &mut Public, other: &Public) -> Result<(), Error> {
|
||||
let mut key_neg_other = to_secp256k1_public(other)?;
|
||||
key_neg_other.mul_assign(&SECP256K1, &key::MINUS_ONE_KEY)?;
|
||||
|
||||
let mut key_public = to_secp256k1_public(public)?;
|
||||
key_public.add_assign(&SECP256K1, &key_neg_other)?;
|
||||
set_public(public, &key_public);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Replace public key with its negation (EC point = - EC point)
|
||||
pub fn public_negate(public: &mut Public) -> Result<(), Error> {
|
||||
let mut key_public = to_secp256k1_public(public)?;
|
||||
key_public.mul_assign(&SECP256K1, &key::MINUS_ONE_KEY)?;
|
||||
set_public(public, &key_public);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Return base point of secp256k1
|
||||
pub fn generation_point() -> Public {
|
||||
let mut public_sec_raw = [0u8; 65];
|
||||
public_sec_raw[0] = 4;
|
||||
public_sec_raw[1..33].copy_from_slice(&GENERATOR_X);
|
||||
public_sec_raw[33..65].copy_from_slice(&GENERATOR_Y);
|
||||
|
||||
let public_key = key::PublicKey::from_slice(&SECP256K1, &public_sec_raw)
|
||||
.expect("constructing using predefined constants; qed");
|
||||
let mut public = Public::default();
|
||||
set_public(&mut public, &public_key);
|
||||
public
|
||||
}
|
||||
|
||||
/// Return secp256k1 elliptic curve order
|
||||
pub fn curve_order() -> U256 {
|
||||
H256::from_slice(&CURVE_ORDER).into()
|
||||
}
|
||||
|
||||
fn to_secp256k1_public(public: &Public) -> Result<key::PublicKey, Error> {
|
||||
let public_data = {
|
||||
let mut temp = [4u8; 65];
|
||||
(&mut temp[1..65]).copy_from_slice(&public[0..64]);
|
||||
temp
|
||||
};
|
||||
|
||||
Ok(key::PublicKey::from_slice(&SECP256K1, &public_data)?)
|
||||
}
|
||||
|
||||
fn set_public(public: &mut Public, key_public: &key::PublicKey) {
|
||||
let key_public_serialized = key_public.serialize_vec(&SECP256K1, false);
|
||||
public.copy_from_slice(&key_public_serialized[1..65]);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{
|
||||
super::{Generator, Random},
|
||||
public_add, public_sub,
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn public_addition_is_commutative() {
|
||||
let public1 = Random.generate().unwrap().public().clone();
|
||||
let public2 = Random.generate().unwrap().public().clone();
|
||||
|
||||
let mut left = public1.clone();
|
||||
public_add(&mut left, &public2).unwrap();
|
||||
|
||||
let mut right = public2.clone();
|
||||
public_add(&mut right, &public1).unwrap();
|
||||
|
||||
assert_eq!(left, right);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn public_addition_is_reversible_with_subtraction() {
|
||||
let public1 = Random.generate().unwrap().public().clone();
|
||||
let public2 = Random.generate().unwrap().public().clone();
|
||||
|
||||
let mut sum = public1.clone();
|
||||
public_add(&mut sum, &public2).unwrap();
|
||||
public_sub(&mut sum, &public2).unwrap();
|
||||
|
||||
assert_eq!(sum, public1);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::{fmt, ptr};
|
||||
|
||||
@@ -20,40 +20,40 @@ use std::{fmt, ptr};
|
||||
pub struct Password(String);
|
||||
|
||||
impl fmt::Debug for Password {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "Password(******)")
|
||||
}
|
||||
}
|
||||
|
||||
impl Password {
|
||||
pub fn as_bytes(&self) -> &[u8] {
|
||||
self.0.as_bytes()
|
||||
}
|
||||
pub fn as_bytes(&self) -> &[u8] {
|
||||
self.0.as_bytes()
|
||||
}
|
||||
|
||||
pub fn as_str(&self) -> &str {
|
||||
self.0.as_str()
|
||||
}
|
||||
pub fn as_str(&self) -> &str {
|
||||
self.0.as_str()
|
||||
}
|
||||
}
|
||||
|
||||
// Custom drop impl to zero out memory.
|
||||
impl Drop for Password {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
for byte_ref in self.0.as_mut_vec() {
|
||||
ptr::write_volatile(byte_ref, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
for byte_ref in self.0.as_mut_vec() {
|
||||
ptr::write_volatile(byte_ref, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<String> for Password {
|
||||
fn from(s: String) -> Password {
|
||||
Password(s)
|
||||
}
|
||||
fn from(s: String) -> Password {
|
||||
Password(s)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a str> for Password {
|
||||
fn from(s: &'a str) -> Password {
|
||||
Password::from(String::from(s))
|
||||
}
|
||||
fn from(s: &'a str) -> Password {
|
||||
Password::from(String::from(s))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,52 +1,62 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use parity_crypto::publickey::{Random, Generator, KeyPair, Error};
|
||||
use super::{Error, Generator, KeyPair, Random};
|
||||
|
||||
/// Tries to find keypair with address starting with given prefix.
|
||||
pub struct Prefix {
|
||||
prefix: Vec<u8>,
|
||||
iterations: usize,
|
||||
prefix: Vec<u8>,
|
||||
iterations: usize,
|
||||
}
|
||||
|
||||
impl Prefix {
|
||||
pub fn new(prefix: Vec<u8>, iterations: usize) -> Self {
|
||||
Prefix { prefix, iterations }
|
||||
}
|
||||
pub fn new(prefix: Vec<u8>, iterations: usize) -> Self {
|
||||
Prefix {
|
||||
prefix: prefix,
|
||||
iterations: iterations,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn generate(&mut self) -> Result<KeyPair, Error> {
|
||||
for _ in 0..self.iterations {
|
||||
let keypair = Random.generate();
|
||||
if keypair.address().as_ref().starts_with(&self.prefix) {
|
||||
return Ok(keypair)
|
||||
}
|
||||
}
|
||||
impl Generator for Prefix {
|
||||
type Error = Error;
|
||||
|
||||
Err(Error::Custom("Could not find keypair".into()))
|
||||
}
|
||||
fn generate(&mut self) -> Result<KeyPair, Error> {
|
||||
for _ in 0..self.iterations {
|
||||
let keypair = Random.generate()?;
|
||||
if keypair.address().starts_with(&self.prefix) {
|
||||
return Ok(keypair);
|
||||
}
|
||||
}
|
||||
|
||||
Err(Error::Custom("Could not find keypair".into()))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use Prefix;
|
||||
use Generator;
|
||||
use Prefix;
|
||||
|
||||
#[test]
|
||||
fn prefix_generator() {
|
||||
let prefix = vec![0xffu8];
|
||||
let keypair = Prefix::new(prefix.clone(), usize::max_value()).generate().unwrap();
|
||||
assert!(keypair.address().as_bytes().starts_with(&prefix));
|
||||
}
|
||||
#[test]
|
||||
fn prefix_generator() {
|
||||
let prefix = vec![0xffu8];
|
||||
let keypair = Prefix::new(prefix.clone(), usize::max_value())
|
||||
.generate()
|
||||
.unwrap();
|
||||
assert!(keypair.address().starts_with(&prefix));
|
||||
}
|
||||
}
|
||||
|
||||
45
accounts/ethkey/src/random.rs
Normal file
45
accounts/ethkey/src/random.rs
Normal file
@@ -0,0 +1,45 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// OpenEthereum 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.
|
||||
|
||||
// OpenEthereum 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 OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use super::{Generator, KeyPair, SECP256K1};
|
||||
use rand::os::OsRng;
|
||||
|
||||
/// Randomly generates new keypair, instantiating the RNG each time.
|
||||
pub struct Random;
|
||||
|
||||
impl Generator for Random {
|
||||
type Error = ::std::io::Error;
|
||||
|
||||
fn generate(&mut self) -> Result<KeyPair, Self::Error> {
|
||||
let mut rng = OsRng::new()?;
|
||||
match rng.generate() {
|
||||
Ok(pair) => Ok(pair),
|
||||
Err(void) => match void {}, // LLVM unreachable
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Generator for OsRng {
|
||||
type Error = ::Void;
|
||||
|
||||
fn generate(&mut self) -> Result<KeyPair, Self::Error> {
|
||||
let (sec, publ) = SECP256K1
|
||||
.generate_keypair(self)
|
||||
.expect("context always created with full capabilities; qed");
|
||||
|
||||
Ok(KeyPair::from_keypair(sec, publ))
|
||||
}
|
||||
}
|
||||
322
accounts/ethkey/src/secret.rs
Normal file
322
accounts/ethkey/src/secret.rs
Normal file
@@ -0,0 +1,322 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// OpenEthereum 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.
|
||||
|
||||
// OpenEthereum 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 OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use ethereum_types::H256;
|
||||
use memzero::Memzero;
|
||||
use rustc_hex::ToHex;
|
||||
use secp256k1::{constants::SECRET_KEY_SIZE as SECP256K1_SECRET_KEY_SIZE, key};
|
||||
use std::{fmt, ops::Deref, str::FromStr};
|
||||
use Error;
|
||||
use SECP256K1;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
pub struct Secret {
|
||||
inner: Memzero<H256>,
|
||||
}
|
||||
|
||||
impl ToHex for Secret {
|
||||
fn to_hex(&self) -> String {
|
||||
format!("{:x}", *self.inner)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::LowerHex for Secret {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
self.inner.fmt(fmt)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for Secret {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
self.inner.fmt(fmt)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Secret {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(
|
||||
fmt,
|
||||
"Secret: 0x{:x}{:x}..{:x}{:x}",
|
||||
self.inner[0], self.inner[1], self.inner[30], self.inner[31]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl Secret {
|
||||
/// Creates a `Secret` from the given slice, returning `None` if the slice length != 32.
|
||||
pub fn from_slice(key: &[u8]) -> Option<Self> {
|
||||
if key.len() != 32 {
|
||||
return None;
|
||||
}
|
||||
let mut h = H256::default();
|
||||
h.copy_from_slice(&key[0..32]);
|
||||
Some(Secret {
|
||||
inner: Memzero::from(h),
|
||||
})
|
||||
}
|
||||
|
||||
/// Creates zero key, which is invalid for crypto operations, but valid for math operation.
|
||||
pub fn zero() -> Self {
|
||||
Secret {
|
||||
inner: Memzero::from(H256::default()),
|
||||
}
|
||||
}
|
||||
|
||||
/// Imports and validates the key.
|
||||
pub fn from_unsafe_slice(key: &[u8]) -> Result<Self, Error> {
|
||||
let secret = key::SecretKey::from_slice(&super::SECP256K1, key)?;
|
||||
Ok(secret.into())
|
||||
}
|
||||
|
||||
/// Checks validity of this key.
|
||||
pub fn check_validity(&self) -> Result<(), Error> {
|
||||
self.to_secp256k1_secret().map(|_| ())
|
||||
}
|
||||
|
||||
/// Inplace add one secret key to another (scalar + scalar)
|
||||
pub fn add(&mut self, other: &Secret) -> Result<(), Error> {
|
||||
match (self.is_zero(), other.is_zero()) {
|
||||
(true, true) | (false, true) => Ok(()),
|
||||
(true, false) => {
|
||||
*self = other.clone();
|
||||
Ok(())
|
||||
}
|
||||
(false, false) => {
|
||||
let mut key_secret = self.to_secp256k1_secret()?;
|
||||
let other_secret = other.to_secp256k1_secret()?;
|
||||
key_secret.add_assign(&SECP256K1, &other_secret)?;
|
||||
|
||||
*self = key_secret.into();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Inplace subtract one secret key from another (scalar - scalar)
|
||||
pub fn sub(&mut self, other: &Secret) -> Result<(), Error> {
|
||||
match (self.is_zero(), other.is_zero()) {
|
||||
(true, true) | (false, true) => Ok(()),
|
||||
(true, false) => {
|
||||
*self = other.clone();
|
||||
self.neg()
|
||||
}
|
||||
(false, false) => {
|
||||
let mut key_secret = self.to_secp256k1_secret()?;
|
||||
let mut other_secret = other.to_secp256k1_secret()?;
|
||||
other_secret.mul_assign(&SECP256K1, &key::MINUS_ONE_KEY)?;
|
||||
key_secret.add_assign(&SECP256K1, &other_secret)?;
|
||||
|
||||
*self = key_secret.into();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Inplace decrease secret key (scalar - 1)
|
||||
pub fn dec(&mut self) -> Result<(), Error> {
|
||||
match self.is_zero() {
|
||||
true => {
|
||||
*self = key::MINUS_ONE_KEY.into();
|
||||
Ok(())
|
||||
}
|
||||
false => {
|
||||
let mut key_secret = self.to_secp256k1_secret()?;
|
||||
key_secret.add_assign(&SECP256K1, &key::MINUS_ONE_KEY)?;
|
||||
|
||||
*self = key_secret.into();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Inplace multiply one secret key to another (scalar * scalar)
|
||||
pub fn mul(&mut self, other: &Secret) -> Result<(), Error> {
|
||||
match (self.is_zero(), other.is_zero()) {
|
||||
(true, true) | (true, false) => Ok(()),
|
||||
(false, true) => {
|
||||
*self = Self::zero();
|
||||
Ok(())
|
||||
}
|
||||
(false, false) => {
|
||||
let mut key_secret = self.to_secp256k1_secret()?;
|
||||
let other_secret = other.to_secp256k1_secret()?;
|
||||
key_secret.mul_assign(&SECP256K1, &other_secret)?;
|
||||
|
||||
*self = key_secret.into();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Inplace negate secret key (-scalar)
|
||||
pub fn neg(&mut self) -> Result<(), Error> {
|
||||
match self.is_zero() {
|
||||
true => Ok(()),
|
||||
false => {
|
||||
let mut key_secret = self.to_secp256k1_secret()?;
|
||||
key_secret.mul_assign(&SECP256K1, &key::MINUS_ONE_KEY)?;
|
||||
|
||||
*self = key_secret.into();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Inplace inverse secret key (1 / scalar)
|
||||
pub fn inv(&mut self) -> Result<(), Error> {
|
||||
let mut key_secret = self.to_secp256k1_secret()?;
|
||||
key_secret.inv_assign(&SECP256K1)?;
|
||||
|
||||
*self = key_secret.into();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Compute power of secret key inplace (secret ^ pow).
|
||||
/// This function is not intended to be used with large powers.
|
||||
pub fn pow(&mut self, pow: usize) -> Result<(), Error> {
|
||||
if self.is_zero() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
match pow {
|
||||
0 => *self = key::ONE_KEY.into(),
|
||||
1 => (),
|
||||
_ => {
|
||||
let c = self.clone();
|
||||
for _ in 1..pow {
|
||||
self.mul(&c)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Create `secp256k1::key::SecretKey` based on this secret
|
||||
pub fn to_secp256k1_secret(&self) -> Result<key::SecretKey, Error> {
|
||||
Ok(key::SecretKey::from_slice(&SECP256K1, &self[..])?)
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for Secret {
|
||||
type Err = Error;
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
Ok(H256::from_str(s)
|
||||
.map_err(|e| Error::Custom(format!("{:?}", e)))?
|
||||
.into())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<[u8; 32]> for Secret {
|
||||
fn from(k: [u8; 32]) -> Self {
|
||||
Secret {
|
||||
inner: Memzero::from(H256(k)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<H256> for Secret {
|
||||
fn from(s: H256) -> Self {
|
||||
s.0.into()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&'static str> for Secret {
|
||||
fn from(s: &'static str) -> Self {
|
||||
s.parse().expect(&format!(
|
||||
"invalid string literal for {}: '{}'",
|
||||
stringify!(Self),
|
||||
s
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<key::SecretKey> for Secret {
|
||||
fn from(key: key::SecretKey) -> Self {
|
||||
let mut a = [0; SECP256K1_SECRET_KEY_SIZE];
|
||||
a.copy_from_slice(&key[0..SECP256K1_SECRET_KEY_SIZE]);
|
||||
a.into()
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for Secret {
|
||||
type Target = H256;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.inner
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{
|
||||
super::{Generator, Random},
|
||||
Secret,
|
||||
};
|
||||
use std::str::FromStr;
|
||||
|
||||
#[test]
|
||||
fn multiplicating_secret_inversion_with_secret_gives_one() {
|
||||
let secret = Random.generate().unwrap().secret().clone();
|
||||
let mut inversion = secret.clone();
|
||||
inversion.inv().unwrap();
|
||||
inversion.mul(&secret).unwrap();
|
||||
assert_eq!(
|
||||
inversion,
|
||||
Secret::from_str("0000000000000000000000000000000000000000000000000000000000000001")
|
||||
.unwrap()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn secret_inversion_is_reversible_with_inversion() {
|
||||
let secret = Random.generate().unwrap().secret().clone();
|
||||
let mut inversion = secret.clone();
|
||||
inversion.inv().unwrap();
|
||||
inversion.inv().unwrap();
|
||||
assert_eq!(inversion, secret);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn secret_pow() {
|
||||
let secret = Random.generate().unwrap().secret().clone();
|
||||
|
||||
let mut pow0 = secret.clone();
|
||||
pow0.pow(0).unwrap();
|
||||
assert_eq!(
|
||||
pow0,
|
||||
Secret::from_str("0000000000000000000000000000000000000000000000000000000000000001")
|
||||
.unwrap()
|
||||
);
|
||||
|
||||
let mut pow1 = secret.clone();
|
||||
pow1.pow(1).unwrap();
|
||||
assert_eq!(pow1, secret);
|
||||
|
||||
let mut pow2 = secret.clone();
|
||||
pow2.pow(2).unwrap();
|
||||
let mut pow2_expected = secret.clone();
|
||||
pow2_expected.mul(&secret).unwrap();
|
||||
assert_eq!(pow2, pow2_expected);
|
||||
|
||||
let mut pow3 = secret.clone();
|
||||
pow3.pow(3).unwrap();
|
||||
let mut pow3_expected = secret.clone();
|
||||
pow3_expected.mul(&secret).unwrap();
|
||||
pow3_expected.mul(&secret).unwrap();
|
||||
assert_eq!(pow3, pow3_expected);
|
||||
}
|
||||
}
|
||||
325
accounts/ethkey/src/signature.rs
Normal file
325
accounts/ethkey/src/signature.rs
Normal file
@@ -0,0 +1,325 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// OpenEthereum 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.
|
||||
|
||||
// OpenEthereum 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 OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use ethereum_types::{H256, H520};
|
||||
use public_to_address;
|
||||
use rustc_hex::{FromHex, ToHex};
|
||||
use secp256k1::{
|
||||
key::{PublicKey, SecretKey},
|
||||
Error as SecpError, Message as SecpMessage, RecoverableSignature, RecoveryId,
|
||||
};
|
||||
use std::{
|
||||
cmp::PartialEq,
|
||||
fmt,
|
||||
hash::{Hash, Hasher},
|
||||
ops::{Deref, DerefMut},
|
||||
str::FromStr,
|
||||
};
|
||||
use Address;
|
||||
use Error;
|
||||
use Message;
|
||||
use Public;
|
||||
use Secret;
|
||||
use SECP256K1;
|
||||
|
||||
/// Signature encoded as RSV components
|
||||
#[repr(C)]
|
||||
pub struct Signature([u8; 65]);
|
||||
|
||||
impl Signature {
|
||||
/// Get a slice into the 'r' portion of the data.
|
||||
pub fn r(&self) -> &[u8] {
|
||||
&self.0[0..32]
|
||||
}
|
||||
|
||||
/// Get a slice into the 's' portion of the data.
|
||||
pub fn s(&self) -> &[u8] {
|
||||
&self.0[32..64]
|
||||
}
|
||||
|
||||
/// Get the recovery byte.
|
||||
pub fn v(&self) -> u8 {
|
||||
self.0[64]
|
||||
}
|
||||
|
||||
/// Encode the signature into RSV array (V altered to be in "Electrum" notation).
|
||||
pub fn into_electrum(mut self) -> [u8; 65] {
|
||||
self.0[64] += 27;
|
||||
self.0
|
||||
}
|
||||
|
||||
/// Parse bytes as a signature encoded as RSV (V in "Electrum" notation).
|
||||
/// May return empty (invalid) signature if given data has invalid length.
|
||||
pub fn from_electrum(data: &[u8]) -> Self {
|
||||
if data.len() != 65 || data[64] < 27 {
|
||||
// fallback to empty (invalid) signature
|
||||
return Signature::default();
|
||||
}
|
||||
|
||||
let mut sig = [0u8; 65];
|
||||
sig.copy_from_slice(data);
|
||||
sig[64] -= 27;
|
||||
Signature(sig)
|
||||
}
|
||||
|
||||
/// Create a signature object from the sig.
|
||||
pub fn from_rsv(r: &H256, s: &H256, v: u8) -> Self {
|
||||
let mut sig = [0u8; 65];
|
||||
sig[0..32].copy_from_slice(&r);
|
||||
sig[32..64].copy_from_slice(&s);
|
||||
sig[64] = v;
|
||||
Signature(sig)
|
||||
}
|
||||
|
||||
/// Check if this is a "low" signature.
|
||||
pub fn is_low_s(&self) -> bool {
|
||||
H256::from_slice(self.s())
|
||||
<= "7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0".into()
|
||||
}
|
||||
|
||||
/// Check if each component of the signature is in range.
|
||||
pub fn is_valid(&self) -> bool {
|
||||
self.v() <= 1
|
||||
&& H256::from_slice(self.r())
|
||||
< "fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141".into()
|
||||
&& H256::from_slice(self.r()) >= 1.into()
|
||||
&& H256::from_slice(self.s())
|
||||
< "fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141".into()
|
||||
&& H256::from_slice(self.s()) >= 1.into()
|
||||
}
|
||||
}
|
||||
|
||||
// manual implementation large arrays don't have trait impls by default.
|
||||
// remove when integer generics exist
|
||||
impl PartialEq for Signature {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
&self.0[..] == &other.0[..]
|
||||
}
|
||||
}
|
||||
|
||||
// manual implementation required in Rust 1.13+, see `std::cmp::AssertParamIsEq`.
|
||||
impl Eq for Signature {}
|
||||
|
||||
// also manual for the same reason, but the pretty printing might be useful.
|
||||
impl fmt::Debug for Signature {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
f.debug_struct("Signature")
|
||||
.field("r", &self.0[0..32].to_hex())
|
||||
.field("s", &self.0[32..64].to_hex())
|
||||
.field("v", &self.0[64..65].to_hex())
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Signature {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
write!(f, "{}", self.to_hex())
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for Signature {
|
||||
type Err = Error;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
match s.from_hex() {
|
||||
Ok(ref hex) if hex.len() == 65 => {
|
||||
let mut data = [0; 65];
|
||||
data.copy_from_slice(&hex[0..65]);
|
||||
Ok(Signature(data))
|
||||
}
|
||||
_ => Err(Error::InvalidSignature),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Signature {
|
||||
fn default() -> Self {
|
||||
Signature([0; 65])
|
||||
}
|
||||
}
|
||||
|
||||
impl Hash for Signature {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
H520::from(self.0).hash(state);
|
||||
}
|
||||
}
|
||||
|
||||
impl Clone for Signature {
|
||||
fn clone(&self) -> Self {
|
||||
Signature(self.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<[u8; 65]> for Signature {
|
||||
fn from(s: [u8; 65]) -> Self {
|
||||
Signature(s)
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<[u8; 65]> for Signature {
|
||||
fn into(self) -> [u8; 65] {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Signature> for H520 {
|
||||
fn from(s: Signature) -> Self {
|
||||
H520::from(s.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<H520> for Signature {
|
||||
fn from(bytes: H520) -> Self {
|
||||
Signature(bytes.into())
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for Signature {
|
||||
type Target = [u8; 65];
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl DerefMut for Signature {
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
&mut self.0
|
||||
}
|
||||
}
|
||||
|
||||
pub fn sign(secret: &Secret, message: &Message) -> Result<Signature, Error> {
|
||||
let context = &SECP256K1;
|
||||
let sec = SecretKey::from_slice(context, &secret)?;
|
||||
let s = context.sign_recoverable(&SecpMessage::from_slice(&message[..])?, &sec)?;
|
||||
let (rec_id, data) = s.serialize_compact(context);
|
||||
let mut data_arr = [0; 65];
|
||||
|
||||
// no need to check if s is low, it always is
|
||||
data_arr[0..64].copy_from_slice(&data[0..64]);
|
||||
data_arr[64] = rec_id.to_i32() as u8;
|
||||
Ok(Signature(data_arr))
|
||||
}
|
||||
|
||||
pub fn verify_public(
|
||||
public: &Public,
|
||||
signature: &Signature,
|
||||
message: &Message,
|
||||
) -> Result<bool, Error> {
|
||||
let context = &SECP256K1;
|
||||
let rsig = RecoverableSignature::from_compact(
|
||||
context,
|
||||
&signature[0..64],
|
||||
RecoveryId::from_i32(signature[64] as i32)?,
|
||||
)?;
|
||||
let sig = rsig.to_standard(context);
|
||||
|
||||
let pdata: [u8; 65] = {
|
||||
let mut temp = [4u8; 65];
|
||||
temp[1..65].copy_from_slice(&**public);
|
||||
temp
|
||||
};
|
||||
|
||||
let publ = PublicKey::from_slice(context, &pdata)?;
|
||||
match context.verify(&SecpMessage::from_slice(&message[..])?, &sig, &publ) {
|
||||
Ok(_) => Ok(true),
|
||||
Err(SecpError::IncorrectSignature) => Ok(false),
|
||||
Err(x) => Err(Error::from(x)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn verify_address(
|
||||
address: &Address,
|
||||
signature: &Signature,
|
||||
message: &Message,
|
||||
) -> Result<bool, Error> {
|
||||
let public = recover(signature, message)?;
|
||||
let recovered_address = public_to_address(&public);
|
||||
Ok(address == &recovered_address)
|
||||
}
|
||||
|
||||
pub fn recover(signature: &Signature, message: &Message) -> Result<Public, Error> {
|
||||
let context = &SECP256K1;
|
||||
let rsig = RecoverableSignature::from_compact(
|
||||
context,
|
||||
&signature[0..64],
|
||||
RecoveryId::from_i32(signature[64] as i32)?,
|
||||
)?;
|
||||
let pubkey = context.recover(&SecpMessage::from_slice(&message[..])?, &rsig)?;
|
||||
let serialized = pubkey.serialize_vec(context, false);
|
||||
|
||||
let mut public = Public::default();
|
||||
public.copy_from_slice(&serialized[1..65]);
|
||||
Ok(public)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{recover, sign, verify_address, verify_public, Signature};
|
||||
use std::str::FromStr;
|
||||
use Generator;
|
||||
use Message;
|
||||
use Random;
|
||||
|
||||
#[test]
|
||||
fn vrs_conversion() {
|
||||
// given
|
||||
let keypair = Random.generate().unwrap();
|
||||
let message = Message::default();
|
||||
let signature = sign(keypair.secret(), &message).unwrap();
|
||||
|
||||
// when
|
||||
let vrs = signature.clone().into_electrum();
|
||||
let from_vrs = Signature::from_electrum(&vrs);
|
||||
|
||||
// then
|
||||
assert_eq!(signature, from_vrs);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn signature_to_and_from_str() {
|
||||
let keypair = Random.generate().unwrap();
|
||||
let message = Message::default();
|
||||
let signature = sign(keypair.secret(), &message).unwrap();
|
||||
let string = format!("{}", signature);
|
||||
let deserialized = Signature::from_str(&string).unwrap();
|
||||
assert_eq!(signature, deserialized);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sign_and_recover_public() {
|
||||
let keypair = Random.generate().unwrap();
|
||||
let message = Message::default();
|
||||
let signature = sign(keypair.secret(), &message).unwrap();
|
||||
assert_eq!(keypair.public(), &recover(&signature, &message).unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sign_and_verify_public() {
|
||||
let keypair = Random.generate().unwrap();
|
||||
let message = Message::default();
|
||||
let signature = sign(keypair.secret(), &message).unwrap();
|
||||
assert!(verify_public(keypair.public(), &signature, &message).unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sign_and_verify_address() {
|
||||
let keypair = Random.generate().unwrap();
|
||||
let message = Message::default();
|
||||
let signature = sign(keypair.secret(), &message).unwrap();
|
||||
assert!(verify_address(&keypair.address(), &signature, &message).unwrap());
|
||||
}
|
||||
}
|
||||
@@ -1,28 +1,29 @@
|
||||
[package]
|
||||
description = "OpenEthereum Key Management"
|
||||
description = "Parity Ethereum Key Management"
|
||||
name = "ethstore"
|
||||
version = "0.2.1"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
repository = "https://github.com/openethereum/openethereum"
|
||||
|
||||
[dependencies]
|
||||
log = "0.4"
|
||||
libc = "0.2"
|
||||
rand = "0.7.3"
|
||||
rand = "0.4"
|
||||
ethkey = { path = "../ethkey" }
|
||||
serde = "1.0"
|
||||
serde_json = "1.0"
|
||||
serde_derive = "1.0"
|
||||
rustc-hex = "2.1.0"
|
||||
tiny-keccak = "2.0.2"
|
||||
rustc-hex = "1.0"
|
||||
tiny-keccak = "1.4"
|
||||
time = "0.1.34"
|
||||
parking_lot = "0.10.0"
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
ethereum-types = "0.9.0"
|
||||
itertools = "0.5"
|
||||
parking_lot = "0.7"
|
||||
parity-crypto = "0.3.0"
|
||||
ethereum-types = "0.4"
|
||||
dir = { path = "../../util/dir" }
|
||||
smallvec = "1.2.0"
|
||||
parity-wordlist = "1.3.1"
|
||||
tempfile = "3.1"
|
||||
smallvec = "0.6"
|
||||
parity-wordlist = "1.3"
|
||||
tempdir = "0.3"
|
||||
lazy_static = "1.2.0"
|
||||
|
||||
[dev-dependencies]
|
||||
matches = "0.1"
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
## ethstore-cli
|
||||
|
||||
OpenEthereum key management.
|
||||
Parity Ethereum key management.
|
||||
|
||||
### Usage
|
||||
|
||||
```
|
||||
OpenEthereum key management tool.
|
||||
Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
Parity Ethereum key management tool.
|
||||
Copyright 2015-2019 Parity Technologies (UK) Ltd.
|
||||
|
||||
Usage:
|
||||
ethstore insert <secret> <password> [--dir DIR] [--vault VAULT] [--vault-pwd VAULTPWD]
|
||||
@@ -330,11 +330,10 @@ ethstore move-from-vault 00e63fdb87ceb815ec96ae185b8f7381a0b4a5ea vault1 vault1_
|
||||
OK
|
||||
```
|
||||
|
||||
## OpenEthereum toolchain
|
||||
_This project is a part of the OpenEthereum toolchain._
|
||||
## Parity Ethereum toolchain
|
||||
_This project is a part of the Parity Ethereum toolchain._
|
||||
|
||||
- [evmbin](https://github.com/openethereum/openethereum/blob/master/evmbin/) - EVM implementation for OpenEthereum.
|
||||
- [ethabi](https://github.com/OpenEthereum/ethabi) - OpenEthereum function calls encoding.
|
||||
- [ethstore](https://github.com/openethereum/openethereum/blob/master/accounts/ethstore) - OpenEthereum key management.
|
||||
- [ethkey](https://github.com/openethereum/openethereum/blob/master/accounts/ethkey) - OpenEthereum keys generator.
|
||||
- [whisper](https://github.com/OpenEthereum/whisper) - Implementation of Whisper-v2 PoC.
|
||||
- [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/accounts/ethstore) - Parity Ethereum key management.
|
||||
- [ethkey](https://github.com/paritytech/parity-ethereum/blob/master/accounts/ethkey) - Parity Ethereum keys generator.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
description = "OpenEthereum Key Management CLI"
|
||||
description = "Parity Ethereum Key Management CLI"
|
||||
name = "ethstore-cli"
|
||||
version = "0.1.1"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
@@ -8,13 +8,11 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
||||
docopt = "1.0"
|
||||
env_logger = "0.5"
|
||||
num_cpus = "1.6"
|
||||
rustc-hex = "2.1.0"
|
||||
rustc-hex = "1.0"
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
parking_lot = "0.10.0"
|
||||
parking_lot = "0.7"
|
||||
ethstore = { path = "../" }
|
||||
ethkey = { path = "../../ethkey" }
|
||||
parity-crypto = { version = "0.6.1", features = ["publickey"] }
|
||||
dir = { path = '../../../util/dir' }
|
||||
panic_hook = { path = "../../../util/panic-hook" }
|
||||
|
||||
@@ -24,4 +22,4 @@ path = "src/main.rs"
|
||||
doc = false
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3.1"
|
||||
tempdir = "0.3.5"
|
||||
|
||||
@@ -1,67 +1,66 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::{cmp, thread};
|
||||
use std::sync::Arc;
|
||||
use std::collections::VecDeque;
|
||||
use parking_lot::Mutex;
|
||||
use std::{cmp, collections::VecDeque, sync::Arc, thread};
|
||||
|
||||
use ethstore::{PresaleWallet, Error};
|
||||
use ethkey::Password;
|
||||
use ethstore::{ethkey::Password, Error, PresaleWallet};
|
||||
use num_cpus;
|
||||
|
||||
pub fn run(passwords: VecDeque<Password>, wallet_path: &str) -> Result<(), Error> {
|
||||
let passwords = Arc::new(Mutex::new(passwords));
|
||||
let passwords = Arc::new(Mutex::new(passwords));
|
||||
|
||||
let mut handles = Vec::new();
|
||||
let mut handles = Vec::new();
|
||||
|
||||
for _ in 0..num_cpus::get() {
|
||||
let passwords = passwords.clone();
|
||||
let wallet = PresaleWallet::open(&wallet_path)?;
|
||||
handles.push(thread::spawn(move || {
|
||||
look_for_password(passwords, wallet);
|
||||
}));
|
||||
}
|
||||
for _ in 0..num_cpus::get() {
|
||||
let passwords = passwords.clone();
|
||||
let wallet = PresaleWallet::open(&wallet_path)?;
|
||||
handles.push(thread::spawn(move || {
|
||||
look_for_password(passwords, wallet);
|
||||
}));
|
||||
}
|
||||
|
||||
for handle in handles {
|
||||
handle.join().map_err(|err| Error::Custom(format!("Error finishing thread: {:?}", err)))?;
|
||||
}
|
||||
for handle in handles {
|
||||
handle
|
||||
.join()
|
||||
.map_err(|err| Error::Custom(format!("Error finishing thread: {:?}", err)))?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn look_for_password(passwords: Arc<Mutex<VecDeque<Password>>>, wallet: PresaleWallet) {
|
||||
let mut counter = 0;
|
||||
while !passwords.lock().is_empty() {
|
||||
let package = {
|
||||
let mut passwords = passwords.lock();
|
||||
let len = passwords.len();
|
||||
passwords.split_off(cmp::min(len, 32))
|
||||
};
|
||||
for pass in package {
|
||||
counter += 1;
|
||||
match wallet.decrypt(&pass) {
|
||||
Ok(_) => {
|
||||
println!("Found password: {}", pass.as_str());
|
||||
passwords.lock().clear();
|
||||
return;
|
||||
},
|
||||
_ if counter % 100 == 0 => print!("."),
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
}
|
||||
let mut counter = 0;
|
||||
while !passwords.lock().is_empty() {
|
||||
let package = {
|
||||
let mut passwords = passwords.lock();
|
||||
let len = passwords.len();
|
||||
passwords.split_off(cmp::min(len, 32))
|
||||
};
|
||||
for pass in package {
|
||||
counter += 1;
|
||||
match wallet.decrypt(&pass) {
|
||||
Ok(_) => {
|
||||
println!("Found password: {}", pass.as_str());
|
||||
passwords.lock().clear();
|
||||
return;
|
||||
}
|
||||
_ if counter % 100 == 0 => print!("."),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,25 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
extern crate dir;
|
||||
extern crate docopt;
|
||||
extern crate ethstore;
|
||||
extern crate ethkey;
|
||||
extern crate num_cpus;
|
||||
extern crate panic_hook;
|
||||
extern crate parking_lot;
|
||||
extern crate parity_crypto;
|
||||
extern crate rustc_hex;
|
||||
extern crate serde;
|
||||
|
||||
@@ -30,21 +28,21 @@ extern crate env_logger;
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
|
||||
use std::collections::VecDeque;
|
||||
use std::io::Read;
|
||||
use std::{env, process, fs, fmt};
|
||||
use std::{collections::VecDeque, env, fmt, fs, io::Read, process};
|
||||
|
||||
use docopt::Docopt;
|
||||
use ethstore::accounts_dir::{KeyDirectory, RootDiskDirectory};
|
||||
use ethkey::Password;
|
||||
use parity_crypto::publickey::Address;
|
||||
use ethstore::{EthStore, SimpleSecretStore, SecretStore, import_accounts, PresaleWallet, SecretVaultRef, StoreAccountRef};
|
||||
use ethstore::{
|
||||
accounts_dir::{KeyDirectory, RootDiskDirectory},
|
||||
ethkey::{Address, Password},
|
||||
import_accounts, EthStore, PresaleWallet, SecretStore, SecretVaultRef, SimpleSecretStore,
|
||||
StoreAccountRef,
|
||||
};
|
||||
|
||||
mod crack;
|
||||
|
||||
pub const USAGE: &'static str = r#"
|
||||
OpenEthereum key management tool.
|
||||
Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
Parity Ethereum key management tool.
|
||||
Copyright 2015-2019 Parity Technologies (UK) Ltd.
|
||||
|
||||
Usage:
|
||||
ethstore insert <secret> <password> [--dir DIR] [--vault VAULT] [--vault-pwd VAULTPWD]
|
||||
@@ -95,228 +93,271 @@ Commands:
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct Args {
|
||||
cmd_insert: bool,
|
||||
cmd_change_pwd: bool,
|
||||
cmd_list: bool,
|
||||
cmd_import: bool,
|
||||
cmd_import_wallet: bool,
|
||||
cmd_find_wallet_pass: bool,
|
||||
cmd_remove: bool,
|
||||
cmd_sign: bool,
|
||||
cmd_public: bool,
|
||||
cmd_list_vaults: bool,
|
||||
cmd_create_vault: bool,
|
||||
cmd_change_vault_pwd: bool,
|
||||
cmd_move_to_vault: bool,
|
||||
cmd_move_from_vault: bool,
|
||||
arg_secret: String,
|
||||
arg_password: String,
|
||||
arg_old_pwd: String,
|
||||
arg_new_pwd: String,
|
||||
arg_address: String,
|
||||
arg_message: String,
|
||||
arg_path: String,
|
||||
arg_vault: String,
|
||||
flag_src: String,
|
||||
flag_dir: String,
|
||||
flag_vault: String,
|
||||
flag_vault_pwd: String,
|
||||
cmd_insert: bool,
|
||||
cmd_change_pwd: bool,
|
||||
cmd_list: bool,
|
||||
cmd_import: bool,
|
||||
cmd_import_wallet: bool,
|
||||
cmd_find_wallet_pass: bool,
|
||||
cmd_remove: bool,
|
||||
cmd_sign: bool,
|
||||
cmd_public: bool,
|
||||
cmd_list_vaults: bool,
|
||||
cmd_create_vault: bool,
|
||||
cmd_change_vault_pwd: bool,
|
||||
cmd_move_to_vault: bool,
|
||||
cmd_move_from_vault: bool,
|
||||
arg_secret: String,
|
||||
arg_password: String,
|
||||
arg_old_pwd: String,
|
||||
arg_new_pwd: String,
|
||||
arg_address: String,
|
||||
arg_message: String,
|
||||
arg_path: String,
|
||||
arg_vault: String,
|
||||
flag_src: String,
|
||||
flag_dir: String,
|
||||
flag_vault: String,
|
||||
flag_vault_pwd: String,
|
||||
}
|
||||
|
||||
enum Error {
|
||||
Ethstore(ethstore::Error),
|
||||
Docopt(docopt::Error),
|
||||
Ethstore(ethstore::Error),
|
||||
Docopt(docopt::Error),
|
||||
}
|
||||
|
||||
impl From<ethstore::Error> for Error {
|
||||
fn from(err: ethstore::Error) -> Self {
|
||||
Error::Ethstore(err)
|
||||
}
|
||||
fn from(err: ethstore::Error) -> Self {
|
||||
Error::Ethstore(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<docopt::Error> for Error {
|
||||
fn from(err: docopt::Error) -> Self {
|
||||
Error::Docopt(err)
|
||||
}
|
||||
fn from(err: docopt::Error) -> Self {
|
||||
Error::Docopt(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Error {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
Error::Ethstore(ref err) => fmt::Display::fmt(err, f),
|
||||
Error::Docopt(ref err) => fmt::Display::fmt(err, f),
|
||||
}
|
||||
}
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
Error::Ethstore(ref err) => fmt::Display::fmt(err, f),
|
||||
Error::Docopt(ref err) => fmt::Display::fmt(err, f),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
panic_hook::set_abort();
|
||||
if env::var("RUST_LOG").is_err() {
|
||||
env::set_var("RUST_LOG", "warn")
|
||||
}
|
||||
env_logger::try_init().expect("Logger initialized only once.");
|
||||
panic_hook::set_abort();
|
||||
if env::var("RUST_LOG").is_err() {
|
||||
env::set_var("RUST_LOG", "warn")
|
||||
}
|
||||
env_logger::try_init().expect("Logger initialized only once.");
|
||||
|
||||
match execute(env::args()) {
|
||||
Ok(result) => println!("{}", result),
|
||||
Err(Error::Docopt(ref e)) => e.exit(),
|
||||
Err(err) => {
|
||||
eprintln!("{}", err);
|
||||
process::exit(1);
|
||||
}
|
||||
}
|
||||
match execute(env::args()) {
|
||||
Ok(result) => println!("{}", result),
|
||||
Err(Error::Docopt(ref e)) => e.exit(),
|
||||
Err(err) => {
|
||||
eprintln!("{}", err);
|
||||
process::exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn key_dir(location: &str, password: Option<Password>) -> Result<Box<dyn KeyDirectory>, Error> {
|
||||
let dir: RootDiskDirectory = match location {
|
||||
"geth" => RootDiskDirectory::create(dir::geth(false))?,
|
||||
"geth-test" => RootDiskDirectory::create(dir::geth(true))?,
|
||||
path if path.starts_with("parity") => {
|
||||
let chain = path.split('-').nth(1).unwrap_or("ethereum");
|
||||
let mut path = dir::default_data_pathbuf();
|
||||
path.push("keys");
|
||||
path.push(chain);
|
||||
RootDiskDirectory::create(path)?
|
||||
},
|
||||
path => RootDiskDirectory::create(path)?,
|
||||
};
|
||||
let dir: RootDiskDirectory = match location {
|
||||
path if path.starts_with("parity") => {
|
||||
let chain = path.split('-').nth(1).unwrap_or("ethereum");
|
||||
let mut path = dir::default_data_pathbuf();
|
||||
path.push("keys");
|
||||
path.push(chain);
|
||||
RootDiskDirectory::create(path)?
|
||||
}
|
||||
path => RootDiskDirectory::create(path)?,
|
||||
};
|
||||
|
||||
Ok(Box::new(dir.with_password(password)))
|
||||
Ok(Box::new(dir.with_password(password)))
|
||||
}
|
||||
|
||||
fn open_args_vault(store: &EthStore, args: &Args) -> Result<SecretVaultRef, Error> {
|
||||
if args.flag_vault.is_empty() {
|
||||
return Ok(SecretVaultRef::Root);
|
||||
}
|
||||
if args.flag_vault.is_empty() {
|
||||
return Ok(SecretVaultRef::Root);
|
||||
}
|
||||
|
||||
let vault_pwd = load_password(&args.flag_vault_pwd)?;
|
||||
store.open_vault(&args.flag_vault, &vault_pwd)?;
|
||||
Ok(SecretVaultRef::Vault(args.flag_vault.clone()))
|
||||
let vault_pwd = load_password(&args.flag_vault_pwd)?;
|
||||
store.open_vault(&args.flag_vault, &vault_pwd)?;
|
||||
Ok(SecretVaultRef::Vault(args.flag_vault.clone()))
|
||||
}
|
||||
|
||||
fn open_args_vault_account(store: &EthStore, address: Address, args: &Args) -> Result<StoreAccountRef, Error> {
|
||||
match open_args_vault(store, args)? {
|
||||
SecretVaultRef::Root => Ok(StoreAccountRef::root(address)),
|
||||
SecretVaultRef::Vault(name) => Ok(StoreAccountRef::vault(&name, address)),
|
||||
}
|
||||
fn open_args_vault_account(
|
||||
store: &EthStore,
|
||||
address: Address,
|
||||
args: &Args,
|
||||
) -> Result<StoreAccountRef, Error> {
|
||||
match open_args_vault(store, args)? {
|
||||
SecretVaultRef::Root => Ok(StoreAccountRef::root(address)),
|
||||
SecretVaultRef::Vault(name) => Ok(StoreAccountRef::vault(&name, address)),
|
||||
}
|
||||
}
|
||||
|
||||
fn format_accounts(accounts: &[Address]) -> String {
|
||||
accounts.iter()
|
||||
.enumerate()
|
||||
.map(|(i, a)| format!("{:2}: 0x{:x}", i, a))
|
||||
.collect::<Vec<String>>()
|
||||
.join("\n")
|
||||
accounts
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(i, a)| format!("{:2}: 0x{:x}", i, a))
|
||||
.collect::<Vec<String>>()
|
||||
.join("\n")
|
||||
}
|
||||
|
||||
fn format_vaults(vaults: &[String]) -> String {
|
||||
vaults.join("\n")
|
||||
vaults.join("\n")
|
||||
}
|
||||
|
||||
fn load_password(path: &str) -> Result<Password, Error> {
|
||||
let mut file = fs::File::open(path).map_err(|e| ethstore::Error::Custom(format!("Error opening password file '{}': {}", path, e)))?;
|
||||
let mut password = String::new();
|
||||
file.read_to_string(&mut password).map_err(|e| ethstore::Error::Custom(format!("Error reading password file '{}': {}", path, e)))?;
|
||||
// drop EOF
|
||||
let _ = password.pop();
|
||||
Ok(password.into())
|
||||
let mut file = fs::File::open(path).map_err(|e| {
|
||||
ethstore::Error::Custom(format!("Error opening password file '{}': {}", path, e))
|
||||
})?;
|
||||
let mut password = String::new();
|
||||
file.read_to_string(&mut password).map_err(|e| {
|
||||
ethstore::Error::Custom(format!("Error reading password file '{}': {}", path, e))
|
||||
})?;
|
||||
// drop EOF
|
||||
let _ = password.pop();
|
||||
Ok(password.into())
|
||||
}
|
||||
|
||||
fn execute<S, I>(command: I) -> Result<String, Error> where I: IntoIterator<Item=S>, S: AsRef<str> {
|
||||
let args: Args = Docopt::new(USAGE)
|
||||
.and_then(|d| d.argv(command).deserialize())?;
|
||||
fn execute<S, I>(command: I) -> Result<String, Error>
|
||||
where
|
||||
I: IntoIterator<Item = S>,
|
||||
S: AsRef<str>,
|
||||
{
|
||||
let args: Args = Docopt::new(USAGE).and_then(|d| d.argv(command).deserialize())?;
|
||||
|
||||
let store = EthStore::open(key_dir(&args.flag_dir, None)?)?;
|
||||
let store = EthStore::open(key_dir(&args.flag_dir, None)?)?;
|
||||
|
||||
return if args.cmd_insert {
|
||||
let secret = args.arg_secret.parse().map_err(|_| ethstore::Error::InvalidSecret)?;
|
||||
let password = load_password(&args.arg_password)?;
|
||||
let vault_ref = open_args_vault(&store, &args)?;
|
||||
let account_ref = store.insert_account(vault_ref, secret, &password)?;
|
||||
Ok(format!("0x{:x}", account_ref.address))
|
||||
} else if args.cmd_change_pwd {
|
||||
let address = args.arg_address.parse().map_err(|_| ethstore::Error::InvalidAccount)?;
|
||||
let old_pwd = load_password(&args.arg_old_pwd)?;
|
||||
let new_pwd = load_password(&args.arg_new_pwd)?;
|
||||
let account_ref = open_args_vault_account(&store, address, &args)?;
|
||||
let ok = store.change_password(&account_ref, &old_pwd, &new_pwd).is_ok();
|
||||
Ok(format!("{}", ok))
|
||||
} else if args.cmd_list {
|
||||
let vault_ref = open_args_vault(&store, &args)?;
|
||||
let accounts = store.accounts()?;
|
||||
let accounts: Vec<_> = accounts
|
||||
.into_iter()
|
||||
.filter(|a| &a.vault == &vault_ref)
|
||||
.map(|a| a.address)
|
||||
.collect();
|
||||
Ok(format_accounts(&accounts))
|
||||
} else if args.cmd_import {
|
||||
let password = match args.arg_password.as_ref() {
|
||||
"" => None,
|
||||
_ => Some(load_password(&args.arg_password)?)
|
||||
};
|
||||
let src = key_dir(&args.flag_src, password)?;
|
||||
let dst = key_dir(&args.flag_dir, None)?;
|
||||
return if args.cmd_insert {
|
||||
let secret = args
|
||||
.arg_secret
|
||||
.parse()
|
||||
.map_err(|_| ethstore::Error::InvalidSecret)?;
|
||||
let password = load_password(&args.arg_password)?;
|
||||
let vault_ref = open_args_vault(&store, &args)?;
|
||||
let account_ref = store.insert_account(vault_ref, secret, &password)?;
|
||||
Ok(format!("0x{:x}", account_ref.address))
|
||||
} else if args.cmd_change_pwd {
|
||||
let address = args
|
||||
.arg_address
|
||||
.parse()
|
||||
.map_err(|_| ethstore::Error::InvalidAccount)?;
|
||||
let old_pwd = load_password(&args.arg_old_pwd)?;
|
||||
let new_pwd = load_password(&args.arg_new_pwd)?;
|
||||
let account_ref = open_args_vault_account(&store, address, &args)?;
|
||||
let ok = store
|
||||
.change_password(&account_ref, &old_pwd, &new_pwd)
|
||||
.is_ok();
|
||||
Ok(format!("{}", ok))
|
||||
} else if args.cmd_list {
|
||||
let vault_ref = open_args_vault(&store, &args)?;
|
||||
let accounts = store.accounts()?;
|
||||
let accounts: Vec<_> = accounts
|
||||
.into_iter()
|
||||
.filter(|a| &a.vault == &vault_ref)
|
||||
.map(|a| a.address)
|
||||
.collect();
|
||||
Ok(format_accounts(&accounts))
|
||||
} else if args.cmd_import {
|
||||
let password = match args.arg_password.as_ref() {
|
||||
"" => None,
|
||||
_ => Some(load_password(&args.arg_password)?),
|
||||
};
|
||||
let src = key_dir(&args.flag_src, password)?;
|
||||
let dst = key_dir(&args.flag_dir, None)?;
|
||||
|
||||
let accounts = import_accounts(&*src, &*dst)?;
|
||||
Ok(format_accounts(&accounts))
|
||||
} else if args.cmd_import_wallet {
|
||||
let wallet = PresaleWallet::open(&args.arg_path)?;
|
||||
let password = load_password(&args.arg_password)?;
|
||||
let kp = wallet.decrypt(&password)?;
|
||||
let vault_ref = open_args_vault(&store, &args)?;
|
||||
let account_ref = store.insert_account(vault_ref, kp.secret().clone(), &password)?;
|
||||
Ok(format!("0x{:x}", account_ref.address))
|
||||
} else if args.cmd_find_wallet_pass {
|
||||
let passwords = load_password(&args.arg_password)?;
|
||||
let passwords = passwords.as_str().lines().map(|line| str::to_owned(line).into()).collect::<VecDeque<_>>();
|
||||
crack::run(passwords, &args.arg_path)?;
|
||||
Ok(format!("Password not found."))
|
||||
} else if args.cmd_remove {
|
||||
let address = args.arg_address.parse().map_err(|_| ethstore::Error::InvalidAccount)?;
|
||||
let password = load_password(&args.arg_password)?;
|
||||
let account_ref = open_args_vault_account(&store, address, &args)?;
|
||||
let ok = store.remove_account(&account_ref, &password).is_ok();
|
||||
Ok(format!("{}", ok))
|
||||
} else if args.cmd_sign {
|
||||
let address = args.arg_address.parse().map_err(|_| ethstore::Error::InvalidAccount)?;
|
||||
let message = args.arg_message.parse().map_err(|_| ethstore::Error::InvalidMessage)?;
|
||||
let password = load_password(&args.arg_password)?;
|
||||
let account_ref = open_args_vault_account(&store, address, &args)?;
|
||||
let signature = store.sign(&account_ref, &password, &message)?;
|
||||
Ok(format!("0x{}", signature))
|
||||
} else if args.cmd_public {
|
||||
let address = args.arg_address.parse().map_err(|_| ethstore::Error::InvalidAccount)?;
|
||||
let password = load_password(&args.arg_password)?;
|
||||
let account_ref = open_args_vault_account(&store, address, &args)?;
|
||||
let public = store.public(&account_ref, &password)?;
|
||||
Ok(format!("0x{:x}", public))
|
||||
} else if args.cmd_list_vaults {
|
||||
let vaults = store.list_vaults()?;
|
||||
Ok(format_vaults(&vaults))
|
||||
} else if args.cmd_create_vault {
|
||||
let password = load_password(&args.arg_password)?;
|
||||
store.create_vault(&args.arg_vault, &password)?;
|
||||
Ok("OK".to_owned())
|
||||
} else if args.cmd_change_vault_pwd {
|
||||
let old_pwd = load_password(&args.arg_old_pwd)?;
|
||||
let new_pwd = load_password(&args.arg_new_pwd)?;
|
||||
store.open_vault(&args.arg_vault, &old_pwd)?;
|
||||
store.change_vault_password(&args.arg_vault, &new_pwd)?;
|
||||
Ok("OK".to_owned())
|
||||
} else if args.cmd_move_to_vault {
|
||||
let address = args.arg_address.parse().map_err(|_| ethstore::Error::InvalidAccount)?;
|
||||
let password = load_password(&args.arg_password)?;
|
||||
let account_ref = open_args_vault_account(&store, address, &args)?;
|
||||
store.open_vault(&args.arg_vault, &password)?;
|
||||
store.change_account_vault(SecretVaultRef::Vault(args.arg_vault), account_ref)?;
|
||||
Ok("OK".to_owned())
|
||||
} else if args.cmd_move_from_vault {
|
||||
let address = args.arg_address.parse().map_err(|_| ethstore::Error::InvalidAccount)?;
|
||||
let password = load_password(&args.arg_password)?;
|
||||
store.open_vault(&args.arg_vault, &password)?;
|
||||
store.change_account_vault(SecretVaultRef::Root, StoreAccountRef::vault(&args.arg_vault, address))?;
|
||||
Ok("OK".to_owned())
|
||||
} else {
|
||||
Ok(format!("{}", USAGE))
|
||||
}
|
||||
let accounts = import_accounts(&*src, &*dst)?;
|
||||
Ok(format_accounts(&accounts))
|
||||
} else if args.cmd_import_wallet {
|
||||
let wallet = PresaleWallet::open(&args.arg_path)?;
|
||||
let password = load_password(&args.arg_password)?;
|
||||
let kp = wallet.decrypt(&password)?;
|
||||
let vault_ref = open_args_vault(&store, &args)?;
|
||||
let account_ref = store.insert_account(vault_ref, kp.secret().clone(), &password)?;
|
||||
Ok(format!("0x{:x}", account_ref.address))
|
||||
} else if args.cmd_find_wallet_pass {
|
||||
let passwords = load_password(&args.arg_password)?;
|
||||
let passwords = passwords
|
||||
.as_str()
|
||||
.lines()
|
||||
.map(|line| str::to_owned(line).into())
|
||||
.collect::<VecDeque<_>>();
|
||||
crack::run(passwords, &args.arg_path)?;
|
||||
Ok(format!("Password not found."))
|
||||
} else if args.cmd_remove {
|
||||
let address = args
|
||||
.arg_address
|
||||
.parse()
|
||||
.map_err(|_| ethstore::Error::InvalidAccount)?;
|
||||
let password = load_password(&args.arg_password)?;
|
||||
let account_ref = open_args_vault_account(&store, address, &args)?;
|
||||
let ok = store.remove_account(&account_ref, &password).is_ok();
|
||||
Ok(format!("{}", ok))
|
||||
} else if args.cmd_sign {
|
||||
let address = args
|
||||
.arg_address
|
||||
.parse()
|
||||
.map_err(|_| ethstore::Error::InvalidAccount)?;
|
||||
let message = args
|
||||
.arg_message
|
||||
.parse()
|
||||
.map_err(|_| ethstore::Error::InvalidMessage)?;
|
||||
let password = load_password(&args.arg_password)?;
|
||||
let account_ref = open_args_vault_account(&store, address, &args)?;
|
||||
let signature = store.sign(&account_ref, &password, &message)?;
|
||||
Ok(format!("0x{}", signature))
|
||||
} else if args.cmd_public {
|
||||
let address = args
|
||||
.arg_address
|
||||
.parse()
|
||||
.map_err(|_| ethstore::Error::InvalidAccount)?;
|
||||
let password = load_password(&args.arg_password)?;
|
||||
let account_ref = open_args_vault_account(&store, address, &args)?;
|
||||
let public = store.public(&account_ref, &password)?;
|
||||
Ok(format!("0x{:x}", public))
|
||||
} else if args.cmd_list_vaults {
|
||||
let vaults = store.list_vaults()?;
|
||||
Ok(format_vaults(&vaults))
|
||||
} else if args.cmd_create_vault {
|
||||
let password = load_password(&args.arg_password)?;
|
||||
store.create_vault(&args.arg_vault, &password)?;
|
||||
Ok("OK".to_owned())
|
||||
} else if args.cmd_change_vault_pwd {
|
||||
let old_pwd = load_password(&args.arg_old_pwd)?;
|
||||
let new_pwd = load_password(&args.arg_new_pwd)?;
|
||||
store.open_vault(&args.arg_vault, &old_pwd)?;
|
||||
store.change_vault_password(&args.arg_vault, &new_pwd)?;
|
||||
Ok("OK".to_owned())
|
||||
} else if args.cmd_move_to_vault {
|
||||
let address = args
|
||||
.arg_address
|
||||
.parse()
|
||||
.map_err(|_| ethstore::Error::InvalidAccount)?;
|
||||
let password = load_password(&args.arg_password)?;
|
||||
let account_ref = open_args_vault_account(&store, address, &args)?;
|
||||
store.open_vault(&args.arg_vault, &password)?;
|
||||
store.change_account_vault(SecretVaultRef::Vault(args.arg_vault), account_ref)?;
|
||||
Ok("OK".to_owned())
|
||||
} else if args.cmd_move_from_vault {
|
||||
let address = args
|
||||
.arg_address
|
||||
.parse()
|
||||
.map_err(|_| ethstore::Error::InvalidAccount)?;
|
||||
let password = load_password(&args.arg_password)?;
|
||||
store.open_vault(&args.arg_vault, &password)?;
|
||||
store.change_account_vault(
|
||||
SecretVaultRef::Root,
|
||||
StoreAccountRef::vault(&args.arg_vault, address),
|
||||
)?;
|
||||
Ok("OK".to_owned())
|
||||
} else {
|
||||
Ok(format!("{}", USAGE))
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
|
||||
// Open Ethereum 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.
|
||||
|
||||
// Open Ethereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
extern crate tempfile;
|
||||
use std::process::Command;
|
||||
use tempfile::Builder;
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
|
||||
fn run(args: &[&str]) -> String {
|
||||
let output = Command::new("cargo")
|
||||
.args(&["run", "--"])
|
||||
.args(args)
|
||||
.output()
|
||||
.unwrap();
|
||||
assert!(output.status.success());
|
||||
String::from_utf8(output.stdout).unwrap()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cli_cmd() {
|
||||
Command::new("cargo")
|
||||
.arg("build")
|
||||
.output()
|
||||
.unwrap();
|
||||
|
||||
let dir = Builder::new().prefix("test-vault").tempdir().unwrap();
|
||||
|
||||
let mut passwd = File::create(dir.path().join("test-password")).unwrap();
|
||||
writeln!(passwd, "password").unwrap();
|
||||
|
||||
let mut passwd2 = File::create(dir.path().join("test-vault-addr")).unwrap();
|
||||
writeln!(passwd2, "password2").unwrap();
|
||||
|
||||
let test_password_buf = dir.path().join("test-password");
|
||||
let test_password: &str = test_password_buf.to_str().unwrap();
|
||||
let dir_str: &str = dir.path().to_str().unwrap();
|
||||
let test_vault_addr_buf = dir.path().join("test-vault-addr");
|
||||
let test_vault_addr = test_vault_addr_buf.to_str().unwrap();
|
||||
|
||||
run(&["create-vault", "test-vault", test_password, "--dir", dir_str]);
|
||||
|
||||
let output = run(&["insert", "7d29fab185a33e2cd955812397354c472d2b84615b645aa135ff539f6b0d70d5",
|
||||
test_vault_addr,
|
||||
"--dir", dir_str,
|
||||
"--vault", "test-vault",
|
||||
"--vault-pwd", test_password]);
|
||||
let address = output.trim();
|
||||
|
||||
let output = run(&["list",
|
||||
"--dir", dir_str,
|
||||
"--vault", "test-vault",
|
||||
"--vault-pwd", test_password]);
|
||||
assert_eq!(output, " 0: 0xa8fa5dd30a87bb9e3288d604eb74949c515ab66e\n");
|
||||
|
||||
let output = run(&["sign", &address[2..],
|
||||
test_vault_addr,
|
||||
"7d29fab185a33e2cd955812397354c472d2b84615b645aa135ff539f6b0d70d5",
|
||||
"--dir", dir_str,
|
||||
"--vault", "test-vault",
|
||||
"--vault-pwd", test_password]);
|
||||
assert_eq!(output, "0x54ab6e5cf0c5cb40043fdca5d15d611a3a94285414a076dafecc8dc9c04183f413296a3defff61092c0bb478dc9887ec01070e1275234211208fb8f4be4a9b0101\n");
|
||||
|
||||
let output = run(&["public", &address[2..], test_vault_addr,
|
||||
"--dir", dir_str,
|
||||
"--vault", "test-vault",
|
||||
"--vault-pwd", test_password]);
|
||||
assert_eq!(output, "0x35f222d88b80151857a2877826d940104887376a94c1cbd2c8c7c192eb701df88a18a4ecb8b05b1466c5b3706042027b5e079fe3a3683e66d822b0e047aa3418\n");
|
||||
}
|
||||
@@ -1,59 +1,57 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use json;
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub struct Aes128Ctr {
|
||||
pub iv: [u8; 16],
|
||||
pub iv: [u8; 16],
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub enum Cipher {
|
||||
Aes128Ctr(Aes128Ctr),
|
||||
Aes128Ctr(Aes128Ctr),
|
||||
}
|
||||
|
||||
impl From<json::Aes128Ctr> for Aes128Ctr {
|
||||
fn from(json: json::Aes128Ctr) -> Self {
|
||||
Aes128Ctr {
|
||||
iv: json.iv.into()
|
||||
}
|
||||
}
|
||||
fn from(json: json::Aes128Ctr) -> Self {
|
||||
Aes128Ctr { iv: json.iv.into() }
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<json::Aes128Ctr> for Aes128Ctr {
|
||||
fn into(self) -> json::Aes128Ctr {
|
||||
json::Aes128Ctr {
|
||||
iv: From::from(self.iv)
|
||||
}
|
||||
}
|
||||
fn into(self) -> json::Aes128Ctr {
|
||||
json::Aes128Ctr {
|
||||
iv: From::from(self.iv),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<json::Cipher> for Cipher {
|
||||
fn from(json: json::Cipher) -> Self {
|
||||
match json {
|
||||
json::Cipher::Aes128Ctr(params) => Cipher::Aes128Ctr(From::from(params)),
|
||||
}
|
||||
}
|
||||
fn from(json: json::Cipher) -> Self {
|
||||
match json {
|
||||
json::Cipher::Aes128Ctr(params) => Cipher::Aes128Ctr(From::from(params)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<json::Cipher> for Cipher {
|
||||
fn into(self) -> json::Cipher {
|
||||
match self {
|
||||
Cipher::Aes128Ctr(params) => json::Cipher::Aes128Ctr(params.into()),
|
||||
}
|
||||
}
|
||||
fn into(self) -> json::Cipher {
|
||||
match self {
|
||||
Cipher::Aes128Ctr(params) => json::Cipher::Aes128Ctr(params.into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,207 +1,234 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::str;
|
||||
use crypto::publickey::Secret;
|
||||
use ethkey::Password;
|
||||
use {json, Error, crypto};
|
||||
use crypto::Keccak256;
|
||||
use account::{Aes128Ctr, Cipher, Kdf, Pbkdf2, Prf};
|
||||
use crypto::{self, Keccak256};
|
||||
use ethkey::{Password, Secret};
|
||||
use json;
|
||||
use random::Random;
|
||||
use smallvec::SmallVec;
|
||||
use account::{Cipher, Kdf, Aes128Ctr, Pbkdf2, Prf};
|
||||
use std::{num::NonZeroU32, str};
|
||||
use Error;
|
||||
|
||||
/// Encrypted data
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub struct Crypto {
|
||||
/// Encryption parameters
|
||||
pub cipher: Cipher,
|
||||
/// Encrypted data buffer
|
||||
pub ciphertext: Vec<u8>,
|
||||
/// Key derivation function parameters
|
||||
pub kdf: Kdf,
|
||||
/// Message authentication code
|
||||
pub mac: [u8; 32],
|
||||
/// Encryption parameters
|
||||
pub cipher: Cipher,
|
||||
/// Encrypted data buffer
|
||||
pub ciphertext: Vec<u8>,
|
||||
/// Key derivation function parameters
|
||||
pub kdf: Kdf,
|
||||
/// Message authentication code
|
||||
pub mac: [u8; 32],
|
||||
}
|
||||
|
||||
impl From<json::Crypto> for Crypto {
|
||||
fn from(json: json::Crypto) -> Self {
|
||||
Crypto {
|
||||
cipher: json.cipher.into(),
|
||||
ciphertext: json.ciphertext.into(),
|
||||
kdf: json.kdf.into(),
|
||||
mac: json.mac.into(),
|
||||
}
|
||||
}
|
||||
fn from(json: json::Crypto) -> Self {
|
||||
Crypto {
|
||||
cipher: json.cipher.into(),
|
||||
ciphertext: json.ciphertext.into(),
|
||||
kdf: json.kdf.into(),
|
||||
mac: json.mac.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Crypto> for json::Crypto {
|
||||
fn from(c: Crypto) -> Self {
|
||||
json::Crypto {
|
||||
cipher: c.cipher.into(),
|
||||
ciphertext: c.ciphertext.into(),
|
||||
kdf: c.kdf.into(),
|
||||
mac: c.mac.into(),
|
||||
}
|
||||
}
|
||||
fn from(c: Crypto) -> Self {
|
||||
json::Crypto {
|
||||
cipher: c.cipher.into(),
|
||||
ciphertext: c.ciphertext.into(),
|
||||
kdf: c.kdf.into(),
|
||||
mac: c.mac.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl str::FromStr for Crypto {
|
||||
type Err = <json::Crypto as str::FromStr>::Err;
|
||||
type Err = <json::Crypto as str::FromStr>::Err;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
s.parse::<json::Crypto>().map(Into::into)
|
||||
}
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
s.parse::<json::Crypto>().map(Into::into)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Crypto> for String {
|
||||
fn from(c: Crypto) -> Self {
|
||||
json::Crypto::from(c).into()
|
||||
}
|
||||
fn from(c: Crypto) -> Self {
|
||||
json::Crypto::from(c).into()
|
||||
}
|
||||
}
|
||||
|
||||
impl Crypto {
|
||||
/// Encrypt account secret
|
||||
pub fn with_secret(secret: &Secret, password: &Password, iterations: u32) -> Result<Self, crypto::Error> {
|
||||
Crypto::with_plain(secret.as_ref(), password, iterations)
|
||||
}
|
||||
/// Encrypt account secret
|
||||
pub fn with_secret(
|
||||
secret: &Secret,
|
||||
password: &Password,
|
||||
iterations: NonZeroU32,
|
||||
) -> Result<Self, crypto::Error> {
|
||||
Crypto::with_plain(&*secret, password, iterations)
|
||||
}
|
||||
|
||||
/// Encrypt custom plain data
|
||||
pub fn with_plain(plain: &[u8], password: &Password, iterations: u32) -> Result<Self, crypto::Error> {
|
||||
let salt: [u8; 32] = Random::random();
|
||||
let iv: [u8; 16] = Random::random();
|
||||
/// Encrypt custom plain data
|
||||
pub fn with_plain(
|
||||
plain: &[u8],
|
||||
password: &Password,
|
||||
iterations: NonZeroU32,
|
||||
) -> Result<Self, crypto::Error> {
|
||||
let salt: [u8; 32] = Random::random();
|
||||
let iv: [u8; 16] = Random::random();
|
||||
|
||||
// two parts of derived key
|
||||
// DK = [ DK[0..15] DK[16..31] ] = [derived_left_bits, derived_right_bits]
|
||||
let (derived_left_bits, derived_right_bits) =
|
||||
crypto::derive_key_iterations(password.as_bytes(), &salt, iterations);
|
||||
// two parts of derived key
|
||||
// DK = [ DK[0..15] DK[16..31] ] = [derived_left_bits, derived_right_bits]
|
||||
let (derived_left_bits, derived_right_bits) =
|
||||
crypto::derive_key_iterations(password.as_bytes(), &salt, iterations);
|
||||
|
||||
// preallocated (on-stack in case of `Secret`) buffer to hold cipher
|
||||
// length = length(plain) as we are using CTR-approach
|
||||
let plain_len = plain.len();
|
||||
let mut ciphertext: SmallVec<[u8; 32]> = SmallVec::from_vec(vec![0; plain_len]);
|
||||
// preallocated (on-stack in case of `Secret`) buffer to hold cipher
|
||||
// length = length(plain) as we are using CTR-approach
|
||||
let plain_len = plain.len();
|
||||
let mut ciphertext: SmallVec<[u8; 32]> = SmallVec::from_vec(vec![0; plain_len]);
|
||||
|
||||
// aes-128-ctr with initial vector of iv
|
||||
crypto::aes::encrypt_128_ctr(&derived_left_bits, &iv, plain, &mut *ciphertext)?;
|
||||
// aes-128-ctr with initial vector of iv
|
||||
crypto::aes::encrypt_128_ctr(&derived_left_bits, &iv, plain, &mut *ciphertext)?;
|
||||
|
||||
// KECCAK(DK[16..31] ++ <ciphertext>), where DK[16..31] - derived_right_bits
|
||||
let mac = crypto::derive_mac(&derived_right_bits, &*ciphertext).keccak256();
|
||||
// KECCAK(DK[16..31] ++ <ciphertext>), where DK[16..31] - derived_right_bits
|
||||
let mac = crypto::derive_mac(&derived_right_bits, &*ciphertext).keccak256();
|
||||
|
||||
Ok(Crypto {
|
||||
cipher: Cipher::Aes128Ctr(Aes128Ctr {
|
||||
iv: iv,
|
||||
}),
|
||||
ciphertext: ciphertext.into_vec(),
|
||||
kdf: Kdf::Pbkdf2(Pbkdf2 {
|
||||
dklen: crypto::KEY_LENGTH as u32,
|
||||
salt: salt.to_vec(),
|
||||
c: iterations,
|
||||
prf: Prf::HmacSha256,
|
||||
}),
|
||||
mac: mac,
|
||||
})
|
||||
}
|
||||
Ok(Crypto {
|
||||
cipher: Cipher::Aes128Ctr(Aes128Ctr { iv: iv }),
|
||||
ciphertext: ciphertext.into_vec(),
|
||||
kdf: Kdf::Pbkdf2(Pbkdf2 {
|
||||
dklen: crypto::KEY_LENGTH as u32,
|
||||
salt: salt.to_vec(),
|
||||
c: iterations,
|
||||
prf: Prf::HmacSha256,
|
||||
}),
|
||||
mac: mac,
|
||||
})
|
||||
}
|
||||
|
||||
/// Try to decrypt and convert result to account secret
|
||||
pub fn secret(&self, password: &Password) -> Result<Secret, Error> {
|
||||
if self.ciphertext.len() > 32 {
|
||||
return Err(Error::InvalidSecret);
|
||||
}
|
||||
/// Try to decrypt and convert result to account secret
|
||||
pub fn secret(&self, password: &Password) -> Result<Secret, Error> {
|
||||
if self.ciphertext.len() > 32 {
|
||||
return Err(Error::InvalidSecret);
|
||||
}
|
||||
|
||||
let secret = self.do_decrypt(password, 32)?;
|
||||
Ok(Secret::import_key(&secret)?)
|
||||
}
|
||||
let secret = self.do_decrypt(password, 32)?;
|
||||
Ok(Secret::from_unsafe_slice(&secret)?)
|
||||
}
|
||||
|
||||
/// Try to decrypt and return result as is
|
||||
pub fn decrypt(&self, password: &Password) -> Result<Vec<u8>, Error> {
|
||||
let expected_len = self.ciphertext.len();
|
||||
self.do_decrypt(password, expected_len)
|
||||
}
|
||||
/// Try to decrypt and return result as is
|
||||
pub fn decrypt(&self, password: &Password) -> Result<Vec<u8>, Error> {
|
||||
let expected_len = self.ciphertext.len();
|
||||
self.do_decrypt(password, expected_len)
|
||||
}
|
||||
|
||||
fn do_decrypt(&self, password: &Password, expected_len: usize) -> Result<Vec<u8>, Error> {
|
||||
let (derived_left_bits, derived_right_bits) = match self.kdf {
|
||||
Kdf::Pbkdf2(ref params) => crypto::derive_key_iterations(password.as_bytes(), ¶ms.salt, params.c),
|
||||
Kdf::Scrypt(ref params) => crypto::scrypt::derive_key(password.as_bytes(), ¶ms.salt, params.n, params.p, params.r)?,
|
||||
};
|
||||
fn do_decrypt(&self, password: &Password, expected_len: usize) -> Result<Vec<u8>, Error> {
|
||||
let (derived_left_bits, derived_right_bits) = match self.kdf {
|
||||
Kdf::Pbkdf2(ref params) => {
|
||||
crypto::derive_key_iterations(password.as_bytes(), ¶ms.salt, params.c)
|
||||
}
|
||||
Kdf::Scrypt(ref params) => crypto::scrypt::derive_key(
|
||||
password.as_bytes(),
|
||||
¶ms.salt,
|
||||
params.n,
|
||||
params.p,
|
||||
params.r,
|
||||
)?,
|
||||
};
|
||||
|
||||
let mac = crypto::derive_mac(&derived_right_bits, &self.ciphertext).keccak256();
|
||||
let mac = crypto::derive_mac(&derived_right_bits, &self.ciphertext).keccak256();
|
||||
|
||||
if !crypto::is_equal(&mac, &self.mac) {
|
||||
return Err(Error::InvalidPassword)
|
||||
}
|
||||
if !crypto::is_equal(&mac, &self.mac) {
|
||||
return Err(Error::InvalidPassword);
|
||||
}
|
||||
|
||||
let mut plain: SmallVec<[u8; 32]> = SmallVec::from_vec(vec![0; expected_len]);
|
||||
let mut plain: SmallVec<[u8; 32]> = SmallVec::from_vec(vec![0; expected_len]);
|
||||
|
||||
match self.cipher {
|
||||
Cipher::Aes128Ctr(ref params) => {
|
||||
// checker by callers
|
||||
debug_assert!(expected_len >= self.ciphertext.len());
|
||||
match self.cipher {
|
||||
Cipher::Aes128Ctr(ref params) => {
|
||||
// checker by callers
|
||||
debug_assert!(expected_len >= self.ciphertext.len());
|
||||
|
||||
let from = expected_len - self.ciphertext.len();
|
||||
crypto::aes::decrypt_128_ctr(&derived_left_bits, ¶ms.iv, &self.ciphertext, &mut plain[from..])?;
|
||||
Ok(plain.into_iter().collect())
|
||||
},
|
||||
}
|
||||
}
|
||||
let from = expected_len - self.ciphertext.len();
|
||||
crypto::aes::decrypt_128_ctr(
|
||||
&derived_left_bits,
|
||||
¶ms.iv,
|
||||
&self.ciphertext,
|
||||
&mut plain[from..],
|
||||
)?;
|
||||
Ok(plain.into_iter().collect())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crypto::publickey::{Generator, Random};
|
||||
use super::{Crypto, Error};
|
||||
use super::{Crypto, Error, NonZeroU32};
|
||||
use ethkey::{Generator, Random};
|
||||
|
||||
#[test]
|
||||
fn crypto_with_secret_create() {
|
||||
let keypair = Random.generate();
|
||||
let passwd = "this is sparta".into();
|
||||
let crypto = Crypto::with_secret(keypair.secret(), &passwd, 10240).unwrap();
|
||||
let secret = crypto.secret(&passwd).unwrap();
|
||||
assert_eq!(keypair.secret(), &secret);
|
||||
}
|
||||
lazy_static! {
|
||||
static ref ITERATIONS: NonZeroU32 = NonZeroU32::new(10240).expect("10240 > 0; qed");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn crypto_with_secret_invalid_password() {
|
||||
let keypair = Random.generate();
|
||||
let crypto = Crypto::with_secret(keypair.secret(), &"this is sparta".into(), 10240).unwrap();
|
||||
assert_matches!(crypto.secret(&"this is sparta!".into()), Err(Error::InvalidPassword))
|
||||
}
|
||||
#[test]
|
||||
fn crypto_with_secret_create() {
|
||||
let keypair = Random.generate().unwrap();
|
||||
let passwd = "this is sparta".into();
|
||||
let crypto = Crypto::with_secret(keypair.secret(), &passwd, *ITERATIONS).unwrap();
|
||||
let secret = crypto.secret(&passwd).unwrap();
|
||||
assert_eq!(keypair.secret(), &secret);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn crypto_with_null_plain_data() {
|
||||
let original_data = b"";
|
||||
let passwd = "this is sparta".into();
|
||||
let crypto = Crypto::with_plain(&original_data[..], &passwd, 10240).unwrap();
|
||||
let decrypted_data = crypto.decrypt(&passwd).unwrap();
|
||||
assert_eq!(original_data[..], *decrypted_data);
|
||||
}
|
||||
#[test]
|
||||
fn crypto_with_secret_invalid_password() {
|
||||
let keypair = Random.generate().unwrap();
|
||||
let crypto =
|
||||
Crypto::with_secret(keypair.secret(), &"this is sparta".into(), *ITERATIONS).unwrap();
|
||||
assert_matches!(
|
||||
crypto.secret(&"this is sparta!".into()),
|
||||
Err(Error::InvalidPassword)
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn crypto_with_tiny_plain_data() {
|
||||
let original_data = b"{}";
|
||||
let passwd = "this is sparta".into();
|
||||
let crypto = Crypto::with_plain(&original_data[..], &passwd, 10240).unwrap();
|
||||
let decrypted_data = crypto.decrypt(&passwd).unwrap();
|
||||
assert_eq!(original_data[..], *decrypted_data);
|
||||
}
|
||||
#[test]
|
||||
fn crypto_with_null_plain_data() {
|
||||
let original_data = b"";
|
||||
let passwd = "this is sparta".into();
|
||||
let crypto = Crypto::with_plain(&original_data[..], &passwd, *ITERATIONS).unwrap();
|
||||
let decrypted_data = crypto.decrypt(&passwd).unwrap();
|
||||
assert_eq!(original_data[..], *decrypted_data);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn crypto_with_huge_plain_data() {
|
||||
let original_data: Vec<_> = (1..65536).map(|i| (i % 256) as u8).collect();
|
||||
let passwd = "this is sparta".into();
|
||||
let crypto = Crypto::with_plain(&original_data, &passwd, 10240).unwrap();
|
||||
let decrypted_data = crypto.decrypt(&passwd).unwrap();
|
||||
assert_eq!(&original_data, &decrypted_data);
|
||||
}
|
||||
#[test]
|
||||
fn crypto_with_tiny_plain_data() {
|
||||
let original_data = b"{}";
|
||||
let passwd = "this is sparta".into();
|
||||
let crypto = Crypto::with_plain(&original_data[..], &passwd, *ITERATIONS).unwrap();
|
||||
let decrypted_data = crypto.decrypt(&passwd).unwrap();
|
||||
assert_eq!(original_data[..], *decrypted_data);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn crypto_with_huge_plain_data() {
|
||||
let original_data: Vec<_> = (1..65536).map(|i| (i % 256) as u8).collect();
|
||||
let passwd = "this is sparta".into();
|
||||
let crypto = Crypto::with_plain(&original_data, &passwd, *ITERATIONS).unwrap();
|
||||
let decrypted_data = crypto.decrypt(&passwd).unwrap();
|
||||
assert_eq!(&original_data, &decrypted_data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,125 +1,126 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use json;
|
||||
use std::num::NonZeroU32;
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub enum Prf {
|
||||
HmacSha256,
|
||||
HmacSha256,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub struct Pbkdf2 {
|
||||
pub c: u32,
|
||||
pub dklen: u32,
|
||||
pub prf: Prf,
|
||||
pub salt: Vec<u8>,
|
||||
pub c: NonZeroU32,
|
||||
pub dklen: u32,
|
||||
pub prf: Prf,
|
||||
pub salt: Vec<u8>,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub struct Scrypt {
|
||||
pub dklen: u32,
|
||||
pub p: u32,
|
||||
pub n: u32,
|
||||
pub r: u32,
|
||||
pub salt: Vec<u8>,
|
||||
pub dklen: u32,
|
||||
pub p: u32,
|
||||
pub n: u32,
|
||||
pub r: u32,
|
||||
pub salt: Vec<u8>,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub enum Kdf {
|
||||
Pbkdf2(Pbkdf2),
|
||||
Scrypt(Scrypt),
|
||||
Pbkdf2(Pbkdf2),
|
||||
Scrypt(Scrypt),
|
||||
}
|
||||
|
||||
impl From<json::Prf> for Prf {
|
||||
fn from(json: json::Prf) -> Self {
|
||||
match json {
|
||||
json::Prf::HmacSha256 => Prf::HmacSha256,
|
||||
}
|
||||
}
|
||||
fn from(json: json::Prf) -> Self {
|
||||
match json {
|
||||
json::Prf::HmacSha256 => Prf::HmacSha256,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<json::Prf> for Prf {
|
||||
fn into(self) -> json::Prf {
|
||||
match self {
|
||||
Prf::HmacSha256 => json::Prf::HmacSha256,
|
||||
}
|
||||
}
|
||||
fn into(self) -> json::Prf {
|
||||
match self {
|
||||
Prf::HmacSha256 => json::Prf::HmacSha256,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<json::Pbkdf2> for Pbkdf2 {
|
||||
fn from(json: json::Pbkdf2) -> Self {
|
||||
Pbkdf2 {
|
||||
c: json.c,
|
||||
dklen: json.dklen,
|
||||
prf: From::from(json.prf),
|
||||
salt: json.salt.into(),
|
||||
}
|
||||
}
|
||||
fn from(json: json::Pbkdf2) -> Self {
|
||||
Pbkdf2 {
|
||||
c: json.c,
|
||||
dklen: json.dklen,
|
||||
prf: From::from(json.prf),
|
||||
salt: json.salt.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<json::Pbkdf2> for Pbkdf2 {
|
||||
fn into(self) -> json::Pbkdf2 {
|
||||
json::Pbkdf2 {
|
||||
c: self.c,
|
||||
dklen: self.dklen,
|
||||
prf: self.prf.into(),
|
||||
salt: From::from(self.salt),
|
||||
}
|
||||
}
|
||||
fn into(self) -> json::Pbkdf2 {
|
||||
json::Pbkdf2 {
|
||||
c: self.c,
|
||||
dklen: self.dklen,
|
||||
prf: self.prf.into(),
|
||||
salt: From::from(self.salt),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<json::Scrypt> for Scrypt {
|
||||
fn from(json: json::Scrypt) -> Self {
|
||||
Scrypt {
|
||||
dklen: json.dklen,
|
||||
p: json.p,
|
||||
n: json.n,
|
||||
r: json.r,
|
||||
salt: json.salt.into(),
|
||||
}
|
||||
}
|
||||
fn from(json: json::Scrypt) -> Self {
|
||||
Scrypt {
|
||||
dklen: json.dklen,
|
||||
p: json.p,
|
||||
n: json.n,
|
||||
r: json.r,
|
||||
salt: json.salt.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<json::Scrypt> for Scrypt {
|
||||
fn into(self) -> json::Scrypt {
|
||||
json::Scrypt {
|
||||
dklen: self.dklen,
|
||||
p: self.p,
|
||||
n: self.n,
|
||||
r: self.r,
|
||||
salt: From::from(self.salt),
|
||||
}
|
||||
}
|
||||
fn into(self) -> json::Scrypt {
|
||||
json::Scrypt {
|
||||
dklen: self.dklen,
|
||||
p: self.p,
|
||||
n: self.n,
|
||||
r: self.r,
|
||||
salt: From::from(self.salt),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<json::Kdf> for Kdf {
|
||||
fn from(json: json::Kdf) -> Self {
|
||||
match json {
|
||||
json::Kdf::Pbkdf2(params) => Kdf::Pbkdf2(From::from(params)),
|
||||
json::Kdf::Scrypt(params) => Kdf::Scrypt(From::from(params)),
|
||||
}
|
||||
}
|
||||
fn from(json: json::Kdf) -> Self {
|
||||
match json {
|
||||
json::Kdf::Pbkdf2(params) => Kdf::Pbkdf2(From::from(params)),
|
||||
json::Kdf::Scrypt(params) => Kdf::Scrypt(From::from(params)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<json::Kdf> for Kdf {
|
||||
fn into(self) -> json::Kdf {
|
||||
match self {
|
||||
Kdf::Pbkdf2(params) => json::Kdf::Pbkdf2(params.into()),
|
||||
Kdf::Scrypt(params) => json::Kdf::Scrypt(params.into()),
|
||||
}
|
||||
}
|
||||
fn into(self) -> json::Kdf {
|
||||
match self {
|
||||
Kdf::Pbkdf2(params) => json::Kdf::Pbkdf2(params.into()),
|
||||
Kdf::Scrypt(params) => json::Kdf::Scrypt(params.into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
mod cipher;
|
||||
mod crypto;
|
||||
@@ -20,8 +20,10 @@ mod kdf;
|
||||
mod safe_account;
|
||||
mod version;
|
||||
|
||||
pub use self::cipher::{Cipher, Aes128Ctr};
|
||||
pub use self::crypto::Crypto;
|
||||
pub use self::kdf::{Kdf, Pbkdf2, Scrypt, Prf};
|
||||
pub use self::safe_account::SafeAccount;
|
||||
pub use self::version::Version;
|
||||
pub use self::{
|
||||
cipher::{Aes128Ctr, Cipher},
|
||||
crypto::Crypto,
|
||||
kdf::{Kdf, Pbkdf2, Prf, Scrypt},
|
||||
safe_account::SafeAccount,
|
||||
version::Version,
|
||||
};
|
||||
|
||||
@@ -1,230 +1,286 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use crypto::publickey::{KeyPair, sign, Address, Signature, Message, Public, Secret};
|
||||
use ethkey::Password;
|
||||
use crypto::publickey::ecdh::agree;
|
||||
use {json, Error};
|
||||
use super::crypto::Crypto;
|
||||
use account::Version;
|
||||
use crypto;
|
||||
use super::crypto::Crypto;
|
||||
use ethkey::{
|
||||
self, crypto::ecdh::agree, sign, Address, KeyPair, Message, Password, Public, Secret, Signature,
|
||||
};
|
||||
use json;
|
||||
use std::num::NonZeroU32;
|
||||
use Error;
|
||||
|
||||
/// Account representation.
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub struct SafeAccount {
|
||||
/// Account ID
|
||||
pub id: [u8; 16],
|
||||
/// Account version
|
||||
pub version: Version,
|
||||
/// Account address
|
||||
pub address: Address,
|
||||
/// Account private key derivation definition.
|
||||
pub crypto: Crypto,
|
||||
/// Account filename
|
||||
pub filename: Option<String>,
|
||||
/// Account name
|
||||
pub name: String,
|
||||
/// Account metadata
|
||||
pub meta: String,
|
||||
/// Account ID
|
||||
pub id: [u8; 16],
|
||||
/// Account version
|
||||
pub version: Version,
|
||||
/// Account address
|
||||
pub address: Address,
|
||||
/// Account private key derivation definition.
|
||||
pub crypto: Crypto,
|
||||
/// Account filename
|
||||
pub filename: Option<String>,
|
||||
/// Account name
|
||||
pub name: String,
|
||||
/// Account metadata
|
||||
pub meta: String,
|
||||
}
|
||||
|
||||
impl Into<json::KeyFile> for SafeAccount {
|
||||
fn into(self) -> json::KeyFile {
|
||||
json::KeyFile {
|
||||
id: From::from(self.id),
|
||||
version: self.version.into(),
|
||||
address: Some(self.address.into()),
|
||||
crypto: self.crypto.into(),
|
||||
name: Some(self.name.into()),
|
||||
meta: Some(self.meta.into()),
|
||||
}
|
||||
}
|
||||
fn into(self) -> json::KeyFile {
|
||||
json::KeyFile {
|
||||
id: From::from(self.id),
|
||||
version: self.version.into(),
|
||||
address: Some(self.address.into()),
|
||||
crypto: self.crypto.into(),
|
||||
name: Some(self.name.into()),
|
||||
meta: Some(self.meta.into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl SafeAccount {
|
||||
/// Create a new account
|
||||
pub fn create(
|
||||
keypair: &KeyPair,
|
||||
id: [u8; 16],
|
||||
password: &Password,
|
||||
iterations: u32,
|
||||
name: String,
|
||||
meta: String
|
||||
) -> Result<Self, crypto::Error> {
|
||||
Ok(SafeAccount {
|
||||
id: id,
|
||||
version: Version::V3,
|
||||
crypto: Crypto::with_secret(keypair.secret(), password, iterations)?,
|
||||
address: keypair.address(),
|
||||
filename: None,
|
||||
name: name,
|
||||
meta: meta,
|
||||
})
|
||||
}
|
||||
/// Create a new account
|
||||
pub fn create(
|
||||
keypair: &KeyPair,
|
||||
id: [u8; 16],
|
||||
password: &Password,
|
||||
iterations: NonZeroU32,
|
||||
name: String,
|
||||
meta: String,
|
||||
) -> Result<Self, crypto::Error> {
|
||||
Ok(SafeAccount {
|
||||
id: id,
|
||||
version: Version::V3,
|
||||
crypto: Crypto::with_secret(keypair.secret(), password, iterations)?,
|
||||
address: keypair.address(),
|
||||
filename: None,
|
||||
name: name,
|
||||
meta: meta,
|
||||
})
|
||||
}
|
||||
|
||||
/// Create a new `SafeAccount` from the given `json`; if it was read from a
|
||||
/// file, the `filename` should be `Some` name. If it is as yet anonymous, then it
|
||||
/// can be left `None`.
|
||||
/// In case `password` is provided, we will attempt to read the secret from the keyfile
|
||||
/// and derive the address from it instead of reading it directly.
|
||||
/// Providing password is required for `json::KeyFile`s with no address.
|
||||
pub fn from_file(json: json::KeyFile, filename: Option<String>, password: &Option<Password>) -> Result<Self, Error> {
|
||||
let crypto = Crypto::from(json.crypto);
|
||||
let address = match (password, &json.address) {
|
||||
(None, Some(json_address)) => json_address.into(),
|
||||
(None, None) => Err(Error::Custom(
|
||||
"This keystore does not contain address. You need to provide password to import it".into()))?,
|
||||
(Some(password), json_address) => {
|
||||
let derived_address = KeyPair::from_secret(
|
||||
crypto.secret(&password).map_err(|_| Error::InvalidPassword)?
|
||||
)?.address();
|
||||
/// Create a new `SafeAccount` from the given `json`; if it was read from a
|
||||
/// file, the `filename` should be `Some` name. If it is as yet anonymous, then it
|
||||
/// can be left `None`.
|
||||
/// In case `password` is provided, we will attempt to read the secret from the keyfile
|
||||
/// and derive the address from it instead of reading it directly.
|
||||
/// Providing password is required for `json::KeyFile`s with no address.
|
||||
pub fn from_file(
|
||||
json: json::KeyFile,
|
||||
filename: Option<String>,
|
||||
password: &Option<Password>,
|
||||
) -> Result<Self, Error> {
|
||||
let crypto = Crypto::from(json.crypto);
|
||||
let address = match (password, &json.address) {
|
||||
(None, Some(json_address)) => json_address.into(),
|
||||
(None, None) => Err(Error::Custom(
|
||||
"This keystore does not contain address. You need to provide password to import it"
|
||||
.into(),
|
||||
))?,
|
||||
(Some(password), json_address) => {
|
||||
let derived_address = KeyPair::from_secret(
|
||||
crypto
|
||||
.secret(&password)
|
||||
.map_err(|_| Error::InvalidPassword)?,
|
||||
)?
|
||||
.address();
|
||||
|
||||
match json_address {
|
||||
Some(json_address) => {
|
||||
let json_address = json_address.into();
|
||||
if derived_address != json_address {
|
||||
warn!("Detected address mismatch when opening an account. Derived: {:?}, in json got: {:?}",
|
||||
match json_address {
|
||||
Some(json_address) => {
|
||||
let json_address = json_address.into();
|
||||
if derived_address != json_address {
|
||||
warn!("Detected address mismatch when opening an account. Derived: {:?}, in json got: {:?}",
|
||||
derived_address, json_address);
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
derived_address
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
derived_address
|
||||
}
|
||||
};
|
||||
|
||||
Ok(SafeAccount {
|
||||
id: json.id.into(),
|
||||
version: json.version.into(),
|
||||
address,
|
||||
crypto,
|
||||
filename,
|
||||
name: json.name.unwrap_or(String::new()),
|
||||
meta: json.meta.unwrap_or("{}".to_owned()),
|
||||
})
|
||||
}
|
||||
Ok(SafeAccount {
|
||||
id: json.id.into(),
|
||||
version: json.version.into(),
|
||||
address,
|
||||
crypto,
|
||||
filename,
|
||||
name: json.name.unwrap_or(String::new()),
|
||||
meta: json.meta.unwrap_or("{}".to_owned()),
|
||||
})
|
||||
}
|
||||
|
||||
/// Create a new `SafeAccount` from the given vault `json`; if it was read from a
|
||||
/// file, the `filename` should be `Some` name. If it is as yet anonymous, then it
|
||||
/// can be left `None`.
|
||||
pub fn from_vault_file(password: &Password, json: json::VaultKeyFile, filename: Option<String>) -> Result<Self, Error> {
|
||||
let meta_crypto: Crypto = json.metacrypto.into();
|
||||
let meta_plain = meta_crypto.decrypt(password)?;
|
||||
let meta_plain = json::VaultKeyMeta::load(&meta_plain).map_err(|e| Error::Custom(format!("{:?}", e)))?;
|
||||
/// Create a new `SafeAccount` from the given vault `json`; if it was read from a
|
||||
/// file, the `filename` should be `Some` name. If it is as yet anonymous, then it
|
||||
/// can be left `None`.
|
||||
pub fn from_vault_file(
|
||||
password: &Password,
|
||||
json: json::VaultKeyFile,
|
||||
filename: Option<String>,
|
||||
) -> Result<Self, Error> {
|
||||
let meta_crypto: Crypto = json.metacrypto.into();
|
||||
let meta_plain = meta_crypto.decrypt(password)?;
|
||||
let meta_plain =
|
||||
json::VaultKeyMeta::load(&meta_plain).map_err(|e| Error::Custom(format!("{:?}", e)))?;
|
||||
|
||||
SafeAccount::from_file(json::KeyFile {
|
||||
id: json.id,
|
||||
version: json.version,
|
||||
crypto: json.crypto,
|
||||
address: Some(meta_plain.address),
|
||||
name: meta_plain.name,
|
||||
meta: meta_plain.meta,
|
||||
}, filename, &None)
|
||||
}
|
||||
SafeAccount::from_file(
|
||||
json::KeyFile {
|
||||
id: json.id,
|
||||
version: json.version,
|
||||
crypto: json.crypto,
|
||||
address: Some(meta_plain.address),
|
||||
name: meta_plain.name,
|
||||
meta: meta_plain.meta,
|
||||
},
|
||||
filename,
|
||||
&None,
|
||||
)
|
||||
}
|
||||
|
||||
/// Create a new `VaultKeyFile` from the given `self`
|
||||
pub fn into_vault_file(self, iterations: u32, password: &Password) -> Result<json::VaultKeyFile, Error> {
|
||||
let meta_plain = json::VaultKeyMeta {
|
||||
address: self.address.into(),
|
||||
name: Some(self.name),
|
||||
meta: Some(self.meta),
|
||||
};
|
||||
let meta_plain = meta_plain.write().map_err(|e| Error::Custom(format!("{:?}", e)))?;
|
||||
let meta_crypto = Crypto::with_plain(&meta_plain, password, iterations)?;
|
||||
/// Create a new `VaultKeyFile` from the given `self`
|
||||
pub fn into_vault_file(
|
||||
self,
|
||||
iterations: NonZeroU32,
|
||||
password: &Password,
|
||||
) -> Result<json::VaultKeyFile, Error> {
|
||||
let meta_plain = json::VaultKeyMeta {
|
||||
address: self.address.into(),
|
||||
name: Some(self.name),
|
||||
meta: Some(self.meta),
|
||||
};
|
||||
let meta_plain = meta_plain
|
||||
.write()
|
||||
.map_err(|e| Error::Custom(format!("{:?}", e)))?;
|
||||
let meta_crypto = Crypto::with_plain(&meta_plain, password, iterations)?;
|
||||
|
||||
Ok(json::VaultKeyFile {
|
||||
id: self.id.into(),
|
||||
version: self.version.into(),
|
||||
crypto: self.crypto.into(),
|
||||
metacrypto: meta_crypto.into(),
|
||||
})
|
||||
}
|
||||
Ok(json::VaultKeyFile {
|
||||
id: self.id.into(),
|
||||
version: self.version.into(),
|
||||
crypto: self.crypto.into(),
|
||||
metacrypto: meta_crypto.into(),
|
||||
})
|
||||
}
|
||||
|
||||
/// Sign a message.
|
||||
pub fn sign(&self, password: &Password, message: &Message) -> Result<Signature, Error> {
|
||||
let secret = self.crypto.secret(password)?;
|
||||
sign(&secret, message).map_err(From::from)
|
||||
}
|
||||
/// Sign a message.
|
||||
pub fn sign(&self, password: &Password, message: &Message) -> Result<Signature, Error> {
|
||||
let secret = self.crypto.secret(password)?;
|
||||
sign(&secret, message).map_err(From::from)
|
||||
}
|
||||
|
||||
/// Decrypt a message.
|
||||
pub fn decrypt(&self, password: &Password, shared_mac: &[u8], message: &[u8]) -> Result<Vec<u8>, Error> {
|
||||
let secret = self.crypto.secret(password)?;
|
||||
crypto::publickey::ecies::decrypt(&secret, shared_mac, message).map_err(From::from)
|
||||
}
|
||||
/// Decrypt a message.
|
||||
pub fn decrypt(
|
||||
&self,
|
||||
password: &Password,
|
||||
shared_mac: &[u8],
|
||||
message: &[u8],
|
||||
) -> Result<Vec<u8>, Error> {
|
||||
let secret = self.crypto.secret(password)?;
|
||||
ethkey::crypto::ecies::decrypt(&secret, shared_mac, message).map_err(From::from)
|
||||
}
|
||||
|
||||
/// Agree on shared key.
|
||||
pub fn agree(&self, password: &Password, other: &Public) -> Result<Secret, Error> {
|
||||
let secret = self.crypto.secret(password)?;
|
||||
agree(&secret, other).map_err(From::from)
|
||||
}
|
||||
/// Agree on shared key.
|
||||
pub fn agree(&self, password: &Password, other: &Public) -> Result<Secret, Error> {
|
||||
let secret = self.crypto.secret(password)?;
|
||||
agree(&secret, other).map_err(From::from)
|
||||
}
|
||||
|
||||
/// Derive public key.
|
||||
pub fn public(&self, password: &Password) -> Result<Public, Error> {
|
||||
let secret = self.crypto.secret(password)?;
|
||||
Ok(KeyPair::from_secret(secret)?.public().clone())
|
||||
}
|
||||
/// Derive public key.
|
||||
pub fn public(&self, password: &Password) -> Result<Public, Error> {
|
||||
let secret = self.crypto.secret(password)?;
|
||||
Ok(KeyPair::from_secret(secret)?.public().clone())
|
||||
}
|
||||
|
||||
/// Change account's password.
|
||||
pub fn change_password(&self, old_password: &Password, new_password: &Password, iterations: u32) -> Result<Self, Error> {
|
||||
let secret = self.crypto.secret(old_password)?;
|
||||
let result = SafeAccount {
|
||||
id: self.id.clone(),
|
||||
version: self.version.clone(),
|
||||
crypto: Crypto::with_secret(&secret, new_password, iterations)?,
|
||||
address: self.address.clone(),
|
||||
filename: self.filename.clone(),
|
||||
name: self.name.clone(),
|
||||
meta: self.meta.clone(),
|
||||
};
|
||||
Ok(result)
|
||||
}
|
||||
/// Change account's password.
|
||||
pub fn change_password(
|
||||
&self,
|
||||
old_password: &Password,
|
||||
new_password: &Password,
|
||||
iterations: NonZeroU32,
|
||||
) -> Result<Self, Error> {
|
||||
let secret = self.crypto.secret(old_password)?;
|
||||
let result = SafeAccount {
|
||||
id: self.id.clone(),
|
||||
version: self.version.clone(),
|
||||
crypto: Crypto::with_secret(&secret, new_password, iterations)?,
|
||||
address: self.address.clone(),
|
||||
filename: self.filename.clone(),
|
||||
name: self.name.clone(),
|
||||
meta: self.meta.clone(),
|
||||
};
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
/// Check if password matches the account.
|
||||
pub fn check_password(&self, password: &Password) -> bool {
|
||||
self.crypto.secret(password).is_ok()
|
||||
}
|
||||
/// Check if password matches the account.
|
||||
pub fn check_password(&self, password: &Password) -> bool {
|
||||
self.crypto.secret(password).is_ok()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crypto::publickey::{Generator, Random, verify_public};
|
||||
use super::SafeAccount;
|
||||
use super::{NonZeroU32, SafeAccount};
|
||||
use ethkey::{verify_public, Generator, Message, Random};
|
||||
|
||||
#[test]
|
||||
fn sign_and_verify_public() {
|
||||
let keypair = Random.generate();
|
||||
let password = "hello world".into();
|
||||
let message = [1u8; 32].into();
|
||||
let account = SafeAccount::create(&keypair, [0u8; 16], &password, 10240, "Test".to_owned(), "{}".to_owned());
|
||||
let signature = account.unwrap().sign(&password, &message).unwrap();
|
||||
assert!(verify_public(keypair.public(), &signature, &message).unwrap());
|
||||
}
|
||||
lazy_static! {
|
||||
static ref ITERATIONS: NonZeroU32 = NonZeroU32::new(10240).expect("10240 > 0; qed");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn change_password() {
|
||||
let keypair = Random.generate();
|
||||
let first_password = "hello world".into();
|
||||
let sec_password = "this is sparta".into();
|
||||
let i = 10240;
|
||||
let message = [1u8; 32].into();
|
||||
let account = SafeAccount::create(&keypair, [0u8; 16], &first_password, i, "Test".to_owned(), "{}".to_owned()).unwrap();
|
||||
let new_account = account.change_password(&first_password, &sec_password, i).unwrap();
|
||||
assert!(account.sign(&first_password, &message).is_ok());
|
||||
assert!(account.sign(&sec_password, &message).is_err());
|
||||
assert!(new_account.sign(&first_password, &message).is_err());
|
||||
assert!(new_account.sign(&sec_password, &message).is_ok());
|
||||
}
|
||||
#[test]
|
||||
fn sign_and_verify_public() {
|
||||
let keypair = Random.generate().unwrap();
|
||||
let password = "hello world".into();
|
||||
let message = Message::default();
|
||||
let account = SafeAccount::create(
|
||||
&keypair,
|
||||
[0u8; 16],
|
||||
&password,
|
||||
*ITERATIONS,
|
||||
"Test".to_owned(),
|
||||
"{}".to_owned(),
|
||||
);
|
||||
let signature = account.unwrap().sign(&password, &message).unwrap();
|
||||
assert!(verify_public(keypair.public(), &signature, &message).unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn change_password() {
|
||||
let keypair = Random.generate().unwrap();
|
||||
let first_password = "hello world".into();
|
||||
let sec_password = "this is sparta".into();
|
||||
let message = Message::default();
|
||||
let account = SafeAccount::create(
|
||||
&keypair,
|
||||
[0u8; 16],
|
||||
&first_password,
|
||||
*ITERATIONS,
|
||||
"Test".to_owned(),
|
||||
"{}".to_owned(),
|
||||
)
|
||||
.unwrap();
|
||||
let new_account = account
|
||||
.change_password(&first_password, &sec_password, *ITERATIONS)
|
||||
.unwrap();
|
||||
assert!(account.sign(&first_password, &message).is_ok());
|
||||
assert!(account.sign(&sec_password, &message).is_err());
|
||||
assert!(new_account.sign(&first_password, &message).is_err());
|
||||
assert!(new_account.sign(&sec_password, &message).is_ok());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use json;
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub enum Version {
|
||||
V3,
|
||||
V3,
|
||||
}
|
||||
|
||||
impl From<json::Version> for Version {
|
||||
fn from(json: json::Version) -> Self {
|
||||
match json {
|
||||
json::Version::V3 => Version::V3,
|
||||
}
|
||||
}
|
||||
fn from(json: json::Version) -> Self {
|
||||
match json {
|
||||
json::Version::V3 => Version::V3,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<json::Version> for Version {
|
||||
fn into(self) -> json::Version {
|
||||
match self {
|
||||
Version::V3 => json::Version::V3,
|
||||
}
|
||||
}
|
||||
fn into(self) -> json::Version {
|
||||
match self {
|
||||
Version::V3 => json::Version::V3,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,101 +1,112 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::{fs, io};
|
||||
use std::io::Write;
|
||||
use std::path::{PathBuf, Path};
|
||||
use std::collections::HashMap;
|
||||
use time;
|
||||
use {json, SafeAccount, Error};
|
||||
use json::Uuid;
|
||||
use super::{KeyDirectory, VaultKeyDirectory, VaultKeyDirectoryProvider, VaultKey};
|
||||
use super::vault::{VAULT_FILE_NAME, VaultDiskDirectory};
|
||||
use super::{
|
||||
vault::{VaultDiskDirectory, VAULT_FILE_NAME},
|
||||
KeyDirectory, VaultKey, VaultKeyDirectory, VaultKeyDirectoryProvider,
|
||||
};
|
||||
use ethkey::Password;
|
||||
use json::{self, Uuid};
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
fs, io,
|
||||
io::Write,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
use time;
|
||||
use Error;
|
||||
use SafeAccount;
|
||||
|
||||
const IGNORED_FILES: &'static [&'static str] = &[
|
||||
"thumbs.db",
|
||||
"address_book.json",
|
||||
"dapps_policy.json",
|
||||
"dapps_accounts.json",
|
||||
"dapps_history.json",
|
||||
"vault.json",
|
||||
"thumbs.db",
|
||||
"address_book.json",
|
||||
"dapps_policy.json",
|
||||
"dapps_accounts.json",
|
||||
"dapps_history.json",
|
||||
"vault.json",
|
||||
];
|
||||
|
||||
/// Find a unique filename that does not exist using four-letter random suffix.
|
||||
pub fn find_unique_filename_using_random_suffix(parent_path: &Path, original_filename: &str) -> io::Result<String> {
|
||||
let mut path = parent_path.join(original_filename);
|
||||
let mut deduped_filename = original_filename.to_string();
|
||||
pub fn find_unique_filename_using_random_suffix(
|
||||
parent_path: &Path,
|
||||
original_filename: &str,
|
||||
) -> io::Result<String> {
|
||||
let mut path = parent_path.join(original_filename);
|
||||
let mut deduped_filename = original_filename.to_string();
|
||||
|
||||
if path.exists() {
|
||||
const MAX_RETRIES: usize = 500;
|
||||
let mut retries = 0;
|
||||
if path.exists() {
|
||||
const MAX_RETRIES: usize = 500;
|
||||
let mut retries = 0;
|
||||
|
||||
while path.exists() {
|
||||
if retries >= MAX_RETRIES {
|
||||
return Err(io::Error::new(io::ErrorKind::Other, "Exceeded maximum retries when deduplicating filename."));
|
||||
}
|
||||
while path.exists() {
|
||||
if retries >= MAX_RETRIES {
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::Other,
|
||||
"Exceeded maximum retries when deduplicating filename.",
|
||||
));
|
||||
}
|
||||
|
||||
let suffix = ::random::random_string(4);
|
||||
deduped_filename = format!("{}-{}", original_filename, suffix);
|
||||
path.set_file_name(&deduped_filename);
|
||||
retries += 1;
|
||||
}
|
||||
}
|
||||
let suffix = ::random::random_string(4);
|
||||
deduped_filename = format!("{}-{}", original_filename, suffix);
|
||||
path.set_file_name(&deduped_filename);
|
||||
retries += 1;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(deduped_filename)
|
||||
Ok(deduped_filename)
|
||||
}
|
||||
|
||||
/// Create a new file and restrict permissions to owner only. It errors if the file already exists.
|
||||
#[cfg(unix)]
|
||||
pub fn create_new_file_with_permissions_to_owner(file_path: &Path) -> io::Result<fs::File> {
|
||||
use std::os::unix::fs::OpenOptionsExt;
|
||||
use std::os::unix::fs::OpenOptionsExt;
|
||||
|
||||
fs::OpenOptions::new()
|
||||
.write(true)
|
||||
.create_new(true)
|
||||
.mode((libc::S_IWUSR | libc::S_IRUSR) as u32)
|
||||
.open(file_path)
|
||||
fs::OpenOptions::new()
|
||||
.write(true)
|
||||
.create_new(true)
|
||||
.mode((libc::S_IWUSR | libc::S_IRUSR) as u32)
|
||||
.open(file_path)
|
||||
}
|
||||
|
||||
/// Create a new file and restrict permissions to owner only. It errors if the file already exists.
|
||||
#[cfg(not(unix))]
|
||||
pub fn create_new_file_with_permissions_to_owner(file_path: &Path) -> io::Result<fs::File> {
|
||||
fs::OpenOptions::new()
|
||||
.write(true)
|
||||
.create_new(true)
|
||||
.open(file_path)
|
||||
fs::OpenOptions::new()
|
||||
.write(true)
|
||||
.create_new(true)
|
||||
.open(file_path)
|
||||
}
|
||||
|
||||
/// Create a new file and restrict permissions to owner only. It replaces the existing file if it already exists.
|
||||
#[cfg(unix)]
|
||||
pub fn replace_file_with_permissions_to_owner(file_path: &Path) -> io::Result<fs::File> {
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
|
||||
let file = fs::File::create(file_path)?;
|
||||
let mut permissions = file.metadata()?.permissions();
|
||||
permissions.set_mode((libc::S_IWUSR | libc::S_IRUSR) as u32);
|
||||
file.set_permissions(permissions)?;
|
||||
let file = fs::File::create(file_path)?;
|
||||
let mut permissions = file.metadata()?.permissions();
|
||||
permissions.set_mode((libc::S_IWUSR | libc::S_IRUSR) as u32);
|
||||
file.set_permissions(permissions)?;
|
||||
|
||||
Ok(file)
|
||||
Ok(file)
|
||||
}
|
||||
|
||||
/// Create a new file and restrict permissions to owner only. It replaces the existing file if it already exists.
|
||||
#[cfg(not(unix))]
|
||||
pub fn replace_file_with_permissions_to_owner(file_path: &Path) -> io::Result<fs::File> {
|
||||
fs::File::create(file_path)
|
||||
fs::File::create(file_path)
|
||||
}
|
||||
|
||||
/// Root keys directory implementation
|
||||
@@ -103,382 +114,495 @@ pub type RootDiskDirectory = DiskDirectory<DiskKeyFileManager>;
|
||||
|
||||
/// Disk directory key file manager
|
||||
pub trait KeyFileManager: Send + Sync {
|
||||
/// Read `SafeAccount` from given key file stream
|
||||
fn read<T>(&self, filename: Option<String>, reader: T) -> Result<SafeAccount, Error> where T: io::Read;
|
||||
/// Read `SafeAccount` from given key file stream
|
||||
fn read<T>(&self, filename: Option<String>, reader: T) -> Result<SafeAccount, Error>
|
||||
where
|
||||
T: io::Read;
|
||||
|
||||
/// Write `SafeAccount` to given key file stream
|
||||
fn write<T>(&self, account: SafeAccount, writer: &mut T) -> Result<(), Error> where T: io::Write;
|
||||
/// Write `SafeAccount` to given key file stream
|
||||
fn write<T>(&self, account: SafeAccount, writer: &mut T) -> Result<(), Error>
|
||||
where
|
||||
T: io::Write;
|
||||
}
|
||||
|
||||
/// Disk-based keys directory implementation
|
||||
pub struct DiskDirectory<T> where T: KeyFileManager {
|
||||
path: PathBuf,
|
||||
key_manager: T,
|
||||
pub struct DiskDirectory<T>
|
||||
where
|
||||
T: KeyFileManager,
|
||||
{
|
||||
path: PathBuf,
|
||||
key_manager: T,
|
||||
}
|
||||
|
||||
/// Keys file manager for root keys directory
|
||||
#[derive(Default)]
|
||||
pub struct DiskKeyFileManager {
|
||||
password: Option<Password>,
|
||||
password: Option<Password>,
|
||||
}
|
||||
|
||||
impl RootDiskDirectory {
|
||||
pub fn create<P>(path: P) -> Result<Self, Error> where P: AsRef<Path> {
|
||||
fs::create_dir_all(&path)?;
|
||||
Ok(Self::at(path))
|
||||
}
|
||||
pub fn create<P>(path: P) -> Result<Self, Error>
|
||||
where
|
||||
P: AsRef<Path>,
|
||||
{
|
||||
fs::create_dir_all(&path)?;
|
||||
Ok(Self::at(path))
|
||||
}
|
||||
|
||||
/// allows to read keyfiles with given password (needed for keyfiles w/o address)
|
||||
pub fn with_password(&self, password: Option<Password>) -> Self {
|
||||
DiskDirectory::new(&self.path, DiskKeyFileManager { password })
|
||||
}
|
||||
/// allows to read keyfiles with given password (needed for keyfiles w/o address)
|
||||
pub fn with_password(&self, password: Option<Password>) -> Self {
|
||||
DiskDirectory::new(&self.path, DiskKeyFileManager { password })
|
||||
}
|
||||
|
||||
pub fn at<P>(path: P) -> Self where P: AsRef<Path> {
|
||||
DiskDirectory::new(path, DiskKeyFileManager::default())
|
||||
}
|
||||
pub fn at<P>(path: P) -> Self
|
||||
where
|
||||
P: AsRef<Path>,
|
||||
{
|
||||
DiskDirectory::new(path, DiskKeyFileManager::default())
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> DiskDirectory<T> where T: KeyFileManager {
|
||||
/// Create new disk directory instance
|
||||
pub fn new<P>(path: P, key_manager: T) -> Self where P: AsRef<Path> {
|
||||
DiskDirectory {
|
||||
path: path.as_ref().to_path_buf(),
|
||||
key_manager: key_manager,
|
||||
}
|
||||
}
|
||||
impl<T> DiskDirectory<T>
|
||||
where
|
||||
T: KeyFileManager,
|
||||
{
|
||||
/// Create new disk directory instance
|
||||
pub fn new<P>(path: P, key_manager: T) -> Self
|
||||
where
|
||||
P: AsRef<Path>,
|
||||
{
|
||||
DiskDirectory {
|
||||
path: path.as_ref().to_path_buf(),
|
||||
key_manager: key_manager,
|
||||
}
|
||||
}
|
||||
|
||||
fn files(&self) -> Result<Vec<PathBuf>, Error> {
|
||||
Ok(fs::read_dir(&self.path)?
|
||||
.flat_map(Result::ok)
|
||||
.filter(|entry| {
|
||||
let metadata = entry.metadata().ok();
|
||||
let file_name = entry.file_name();
|
||||
let name = file_name.to_string_lossy();
|
||||
// filter directories
|
||||
metadata.map_or(false, |m| !m.is_dir()) &&
|
||||
fn files(&self) -> Result<Vec<PathBuf>, Error> {
|
||||
Ok(fs::read_dir(&self.path)?
|
||||
.flat_map(Result::ok)
|
||||
.filter(|entry| {
|
||||
let metadata = entry.metadata().ok();
|
||||
let file_name = entry.file_name();
|
||||
let name = file_name.to_string_lossy();
|
||||
// filter directories
|
||||
metadata.map_or(false, |m| !m.is_dir()) &&
|
||||
// hidden files
|
||||
!name.starts_with(".") &&
|
||||
// other ignored files
|
||||
!IGNORED_FILES.contains(&&*name)
|
||||
})
|
||||
.map(|entry| entry.path())
|
||||
.collect::<Vec<PathBuf>>()
|
||||
)
|
||||
}
|
||||
})
|
||||
.map(|entry| entry.path())
|
||||
.collect::<Vec<PathBuf>>())
|
||||
}
|
||||
|
||||
pub fn files_hash(&self) -> Result<u64, Error> {
|
||||
use std::collections::hash_map::DefaultHasher;
|
||||
use std::hash::Hasher;
|
||||
pub fn files_hash(&self) -> Result<u64, Error> {
|
||||
use std::{collections::hash_map::DefaultHasher, hash::Hasher};
|
||||
|
||||
let mut hasher = DefaultHasher::new();
|
||||
let files = self.files()?;
|
||||
for file in files {
|
||||
hasher.write(file.to_str().unwrap_or("").as_bytes())
|
||||
}
|
||||
let mut hasher = DefaultHasher::new();
|
||||
let files = self.files()?;
|
||||
for file in files {
|
||||
hasher.write(file.to_str().unwrap_or("").as_bytes())
|
||||
}
|
||||
|
||||
Ok(hasher.finish())
|
||||
}
|
||||
Ok(hasher.finish())
|
||||
}
|
||||
|
||||
fn last_modification_date(&self) -> Result<u64, Error> {
|
||||
use std::time::{Duration, UNIX_EPOCH};
|
||||
let duration = fs::metadata(&self.path)?.modified()?.duration_since(UNIX_EPOCH).unwrap_or(Duration::default());
|
||||
let timestamp = duration.as_secs() ^ (duration.subsec_nanos() as u64);
|
||||
Ok(timestamp)
|
||||
}
|
||||
fn last_modification_date(&self) -> Result<u64, Error> {
|
||||
use std::time::{Duration, UNIX_EPOCH};
|
||||
let duration = fs::metadata(&self.path)?
|
||||
.modified()?
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.unwrap_or(Duration::default());
|
||||
let timestamp = duration.as_secs() ^ (duration.subsec_nanos() as u64);
|
||||
Ok(timestamp)
|
||||
}
|
||||
|
||||
/// all accounts found in keys directory
|
||||
fn files_content(&self) -> Result<HashMap<PathBuf, SafeAccount>, Error> {
|
||||
// it's not done using one iterator cause
|
||||
// there is an issue with rustc and it takes tooo much time to compile
|
||||
let paths = self.files()?;
|
||||
Ok(paths
|
||||
.into_iter()
|
||||
.filter_map(|path| {
|
||||
let filename = Some(path.file_name().and_then(|n| n.to_str()).expect("Keys have valid UTF8 names only.").to_owned());
|
||||
fs::File::open(path.clone())
|
||||
.map_err(Into::into)
|
||||
.and_then(|file| self.key_manager.read(filename, file))
|
||||
.map_err(|err| {
|
||||
warn!("Invalid key file: {:?} ({})", path, err);
|
||||
err
|
||||
})
|
||||
.map(|account| (path, account))
|
||||
.ok()
|
||||
})
|
||||
.collect()
|
||||
)
|
||||
}
|
||||
/// all accounts found in keys directory
|
||||
fn files_content(&self) -> Result<HashMap<PathBuf, SafeAccount>, Error> {
|
||||
// it's not done using one iterator cause
|
||||
// there is an issue with rustc and it takes tooo much time to compile
|
||||
let paths = self.files()?;
|
||||
Ok(paths
|
||||
.into_iter()
|
||||
.filter_map(|path| {
|
||||
let filename = Some(
|
||||
path.file_name()
|
||||
.and_then(|n| n.to_str())
|
||||
.expect("Keys have valid UTF8 names only.")
|
||||
.to_owned(),
|
||||
);
|
||||
fs::File::open(path.clone())
|
||||
.map_err(Into::into)
|
||||
.and_then(|file| self.key_manager.read(filename, file))
|
||||
.map_err(|err| {
|
||||
warn!("Invalid key file: {:?} ({})", path, err);
|
||||
err
|
||||
})
|
||||
.map(|account| (path, account))
|
||||
.ok()
|
||||
})
|
||||
.collect())
|
||||
}
|
||||
|
||||
/// insert account with given filename. if the filename is a duplicate of any stored account and dedup is set to
|
||||
/// true, a random suffix is appended to the filename.
|
||||
pub fn insert_with_filename(&self, account: SafeAccount, mut filename: String, dedup: bool) -> Result<SafeAccount, Error> {
|
||||
if dedup {
|
||||
filename = find_unique_filename_using_random_suffix(&self.path, &filename)?;
|
||||
}
|
||||
/// insert account with given filename. if the filename is a duplicate of any stored account and dedup is set to
|
||||
/// true, a random suffix is appended to the filename.
|
||||
pub fn insert_with_filename(
|
||||
&self,
|
||||
account: SafeAccount,
|
||||
mut filename: String,
|
||||
dedup: bool,
|
||||
) -> Result<SafeAccount, Error> {
|
||||
if dedup {
|
||||
filename = find_unique_filename_using_random_suffix(&self.path, &filename)?;
|
||||
}
|
||||
|
||||
// path to keyfile
|
||||
let keyfile_path = self.path.join(filename.as_str());
|
||||
// path to keyfile
|
||||
let keyfile_path = self.path.join(filename.as_str());
|
||||
|
||||
// update account filename
|
||||
let original_account = account.clone();
|
||||
let mut account = account;
|
||||
account.filename = Some(filename);
|
||||
// update account filename
|
||||
let original_account = account.clone();
|
||||
let mut account = account;
|
||||
account.filename = Some(filename);
|
||||
|
||||
{
|
||||
// save the file
|
||||
let mut file = if dedup {
|
||||
create_new_file_with_permissions_to_owner(&keyfile_path)?
|
||||
} else {
|
||||
replace_file_with_permissions_to_owner(&keyfile_path)?
|
||||
};
|
||||
{
|
||||
// save the file
|
||||
let mut file = if dedup {
|
||||
create_new_file_with_permissions_to_owner(&keyfile_path)?
|
||||
} else {
|
||||
replace_file_with_permissions_to_owner(&keyfile_path)?
|
||||
};
|
||||
|
||||
// write key content
|
||||
self.key_manager.write(original_account, &mut file).map_err(|e| Error::Custom(format!("{:?}", e)))?;
|
||||
// write key content
|
||||
self.key_manager
|
||||
.write(original_account, &mut file)
|
||||
.map_err(|e| Error::Custom(format!("{:?}", e)))?;
|
||||
|
||||
file.flush()?;
|
||||
file.sync_all()?;
|
||||
}
|
||||
file.flush()?;
|
||||
file.sync_all()?;
|
||||
}
|
||||
|
||||
Ok(account)
|
||||
}
|
||||
Ok(account)
|
||||
}
|
||||
|
||||
/// Get key file manager referece
|
||||
pub fn key_manager(&self) -> &T {
|
||||
&self.key_manager
|
||||
}
|
||||
/// Get key file manager referece
|
||||
pub fn key_manager(&self) -> &T {
|
||||
&self.key_manager
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> KeyDirectory for DiskDirectory<T> where T: KeyFileManager {
|
||||
fn load(&self) -> Result<Vec<SafeAccount>, Error> {
|
||||
let accounts = self.files_content()?
|
||||
.into_iter()
|
||||
.map(|(_, account)| account)
|
||||
.collect();
|
||||
Ok(accounts)
|
||||
}
|
||||
impl<T> KeyDirectory for DiskDirectory<T>
|
||||
where
|
||||
T: KeyFileManager,
|
||||
{
|
||||
fn load(&self) -> Result<Vec<SafeAccount>, Error> {
|
||||
let accounts = self
|
||||
.files_content()?
|
||||
.into_iter()
|
||||
.map(|(_, account)| account)
|
||||
.collect();
|
||||
Ok(accounts)
|
||||
}
|
||||
|
||||
fn update(&self, account: SafeAccount) -> Result<SafeAccount, Error> {
|
||||
// Disk store handles updates correctly iff filename is the same
|
||||
let filename = account_filename(&account);
|
||||
self.insert_with_filename(account, filename, false)
|
||||
}
|
||||
fn update(&self, account: SafeAccount) -> Result<SafeAccount, Error> {
|
||||
// Disk store handles updates correctly iff filename is the same
|
||||
let filename = account_filename(&account);
|
||||
self.insert_with_filename(account, filename, false)
|
||||
}
|
||||
|
||||
fn insert(&self, account: SafeAccount) -> Result<SafeAccount, Error> {
|
||||
let filename = account_filename(&account);
|
||||
self.insert_with_filename(account, filename, true)
|
||||
}
|
||||
fn insert(&self, account: SafeAccount) -> Result<SafeAccount, Error> {
|
||||
let filename = account_filename(&account);
|
||||
self.insert_with_filename(account, filename, true)
|
||||
}
|
||||
|
||||
fn remove(&self, account: &SafeAccount) -> Result<(), Error> {
|
||||
// enumerate all entries in keystore
|
||||
// and find entry with given address
|
||||
let to_remove = self.files_content()?
|
||||
.into_iter()
|
||||
.find(|&(_, ref acc)| acc.id == account.id && acc.address == account.address);
|
||||
fn remove(&self, account: &SafeAccount) -> Result<(), Error> {
|
||||
// enumerate all entries in keystore
|
||||
// and find entry with given address
|
||||
let to_remove = self
|
||||
.files_content()?
|
||||
.into_iter()
|
||||
.find(|&(_, ref acc)| acc.id == account.id && acc.address == account.address);
|
||||
|
||||
// remove it
|
||||
match to_remove {
|
||||
None => Err(Error::InvalidAccount),
|
||||
Some((path, _)) => fs::remove_file(path).map_err(From::from)
|
||||
}
|
||||
}
|
||||
// remove it
|
||||
match to_remove {
|
||||
None => Err(Error::InvalidAccount),
|
||||
Some((path, _)) => fs::remove_file(path).map_err(From::from),
|
||||
}
|
||||
}
|
||||
|
||||
fn path(&self) -> Option<&PathBuf> { Some(&self.path) }
|
||||
fn path(&self) -> Option<&PathBuf> {
|
||||
Some(&self.path)
|
||||
}
|
||||
|
||||
fn as_vault_provider(&self) -> Option<&dyn VaultKeyDirectoryProvider> {
|
||||
Some(self)
|
||||
}
|
||||
fn as_vault_provider(&self) -> Option<&dyn VaultKeyDirectoryProvider> {
|
||||
Some(self)
|
||||
}
|
||||
|
||||
fn unique_repr(&self) -> Result<u64, Error> {
|
||||
self.last_modification_date()
|
||||
}
|
||||
fn unique_repr(&self) -> Result<u64, Error> {
|
||||
self.last_modification_date()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> VaultKeyDirectoryProvider for DiskDirectory<T> where T: KeyFileManager {
|
||||
fn create(&self, name: &str, key: VaultKey) -> Result<Box<dyn VaultKeyDirectory>, Error> {
|
||||
let vault_dir = VaultDiskDirectory::create(&self.path, name, key)?;
|
||||
Ok(Box::new(vault_dir))
|
||||
}
|
||||
impl<T> VaultKeyDirectoryProvider for DiskDirectory<T>
|
||||
where
|
||||
T: KeyFileManager,
|
||||
{
|
||||
fn create(&self, name: &str, key: VaultKey) -> Result<Box<dyn VaultKeyDirectory>, Error> {
|
||||
let vault_dir = VaultDiskDirectory::create(&self.path, name, key)?;
|
||||
Ok(Box::new(vault_dir))
|
||||
}
|
||||
|
||||
fn open(&self, name: &str, key: VaultKey) -> Result<Box<dyn VaultKeyDirectory>, Error> {
|
||||
let vault_dir = VaultDiskDirectory::at(&self.path, name, key)?;
|
||||
Ok(Box::new(vault_dir))
|
||||
}
|
||||
fn open(&self, name: &str, key: VaultKey) -> Result<Box<dyn VaultKeyDirectory>, Error> {
|
||||
let vault_dir = VaultDiskDirectory::at(&self.path, name, key)?;
|
||||
Ok(Box::new(vault_dir))
|
||||
}
|
||||
|
||||
fn list_vaults(&self) -> Result<Vec<String>, Error> {
|
||||
Ok(fs::read_dir(&self.path)?
|
||||
.filter_map(|e| e.ok().map(|e| e.path()))
|
||||
.filter_map(|path| {
|
||||
let mut vault_file_path = path.clone();
|
||||
vault_file_path.push(VAULT_FILE_NAME);
|
||||
if vault_file_path.is_file() {
|
||||
path.file_name().and_then(|f| f.to_str()).map(|f| f.to_owned())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.collect())
|
||||
}
|
||||
fn list_vaults(&self) -> Result<Vec<String>, Error> {
|
||||
Ok(fs::read_dir(&self.path)?
|
||||
.filter_map(|e| e.ok().map(|e| e.path()))
|
||||
.filter_map(|path| {
|
||||
let mut vault_file_path = path.clone();
|
||||
vault_file_path.push(VAULT_FILE_NAME);
|
||||
if vault_file_path.is_file() {
|
||||
path.file_name()
|
||||
.and_then(|f| f.to_str())
|
||||
.map(|f| f.to_owned())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.collect())
|
||||
}
|
||||
|
||||
fn vault_meta(&self, name: &str) -> Result<String, Error> {
|
||||
VaultDiskDirectory::meta_at(&self.path, name)
|
||||
}
|
||||
fn vault_meta(&self, name: &str) -> Result<String, Error> {
|
||||
VaultDiskDirectory::meta_at(&self.path, name)
|
||||
}
|
||||
}
|
||||
|
||||
impl KeyFileManager for DiskKeyFileManager {
|
||||
fn read<T>(&self, filename: Option<String>, reader: T) -> Result<SafeAccount, Error> where T: io::Read {
|
||||
let key_file = json::KeyFile::load(reader).map_err(|e| Error::Custom(format!("{:?}", e)))?;
|
||||
SafeAccount::from_file(key_file, filename, &self.password)
|
||||
}
|
||||
fn read<T>(&self, filename: Option<String>, reader: T) -> Result<SafeAccount, Error>
|
||||
where
|
||||
T: io::Read,
|
||||
{
|
||||
let key_file =
|
||||
json::KeyFile::load(reader).map_err(|e| Error::Custom(format!("{:?}", e)))?;
|
||||
SafeAccount::from_file(key_file, filename, &self.password)
|
||||
}
|
||||
|
||||
fn write<T>(&self, mut account: SafeAccount, writer: &mut T) -> Result<(), Error> where T: io::Write {
|
||||
// when account is moved back to root directory from vault
|
||||
// => remove vault field from meta
|
||||
account.meta = json::remove_vault_name_from_json_meta(&account.meta)
|
||||
.map_err(|err| Error::Custom(format!("{:?}", err)))?;
|
||||
fn write<T>(&self, mut account: SafeAccount, writer: &mut T) -> Result<(), Error>
|
||||
where
|
||||
T: io::Write,
|
||||
{
|
||||
// when account is moved back to root directory from vault
|
||||
// => remove vault field from meta
|
||||
account.meta = json::remove_vault_name_from_json_meta(&account.meta)
|
||||
.map_err(|err| Error::Custom(format!("{:?}", err)))?;
|
||||
|
||||
let key_file: json::KeyFile = account.into();
|
||||
key_file.write(writer).map_err(|e| Error::Custom(format!("{:?}", e)))
|
||||
}
|
||||
let key_file: json::KeyFile = account.into();
|
||||
key_file
|
||||
.write(writer)
|
||||
.map_err(|e| Error::Custom(format!("{:?}", e)))
|
||||
}
|
||||
}
|
||||
|
||||
fn account_filename(account: &SafeAccount) -> String {
|
||||
// build file path
|
||||
account.filename.clone().unwrap_or_else(|| {
|
||||
let timestamp = time::strftime("%Y-%m-%dT%H-%M-%S", &time::now_utc()).expect("Time-format string is valid.");
|
||||
format!("UTC--{}Z--{}", timestamp, Uuid::from(account.id))
|
||||
})
|
||||
// build file path
|
||||
account.filename.clone().unwrap_or_else(|| {
|
||||
let timestamp = time::strftime("%Y-%m-%dT%H-%M-%S", &time::now_utc())
|
||||
.expect("Time-format string is valid.");
|
||||
format!("UTC--{}Z--{}", timestamp, Uuid::from(account.id))
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
extern crate tempfile;
|
||||
extern crate tempdir;
|
||||
|
||||
use std::{env, fs};
|
||||
use super::{KeyDirectory, RootDiskDirectory, VaultKey};
|
||||
use account::SafeAccount;
|
||||
use crypto::publickey::{Random, Generator};
|
||||
use self::tempfile::TempDir;
|
||||
use self::tempdir::TempDir;
|
||||
use super::{KeyDirectory, RootDiskDirectory, VaultKey};
|
||||
use account::SafeAccount;
|
||||
use ethkey::{Generator, Random};
|
||||
use std::{env, fs, num::NonZeroU32};
|
||||
|
||||
#[test]
|
||||
fn should_create_new_account() {
|
||||
// given
|
||||
let mut dir = env::temp_dir();
|
||||
dir.push("ethstore_should_create_new_account");
|
||||
let keypair = Random.generate();
|
||||
let password = "hello world".into();
|
||||
let directory = RootDiskDirectory::create(dir.clone()).unwrap();
|
||||
lazy_static! {
|
||||
static ref ITERATIONS: NonZeroU32 = NonZeroU32::new(1024).expect("1024 > 0; qed");
|
||||
}
|
||||
|
||||
// when
|
||||
let account = SafeAccount::create(&keypair, [0u8; 16], &password, 1024, "Test".to_owned(), "{}".to_owned());
|
||||
let res = directory.insert(account.unwrap());
|
||||
#[test]
|
||||
fn should_create_new_account() {
|
||||
// given
|
||||
let mut dir = env::temp_dir();
|
||||
dir.push("ethstore_should_create_new_account");
|
||||
let keypair = Random.generate().unwrap();
|
||||
let password = "hello world".into();
|
||||
let directory = RootDiskDirectory::create(dir.clone()).unwrap();
|
||||
|
||||
// then
|
||||
assert!(res.is_ok(), "Should save account succesfuly.");
|
||||
assert!(res.unwrap().filename.is_some(), "Filename has been assigned.");
|
||||
// when
|
||||
let account = SafeAccount::create(
|
||||
&keypair,
|
||||
[0u8; 16],
|
||||
&password,
|
||||
*ITERATIONS,
|
||||
"Test".to_owned(),
|
||||
"{}".to_owned(),
|
||||
);
|
||||
let res = directory.insert(account.unwrap());
|
||||
|
||||
// cleanup
|
||||
let _ = fs::remove_dir_all(dir);
|
||||
}
|
||||
// then
|
||||
assert!(res.is_ok(), "Should save account succesfuly.");
|
||||
assert!(
|
||||
res.unwrap().filename.is_some(),
|
||||
"Filename has been assigned."
|
||||
);
|
||||
|
||||
#[test]
|
||||
fn should_handle_duplicate_filenames() {
|
||||
// given
|
||||
let mut dir = env::temp_dir();
|
||||
dir.push("ethstore_should_handle_duplicate_filenames");
|
||||
let keypair = Random.generate();
|
||||
let password = "hello world".into();
|
||||
let directory = RootDiskDirectory::create(dir.clone()).unwrap();
|
||||
// cleanup
|
||||
let _ = fs::remove_dir_all(dir);
|
||||
}
|
||||
|
||||
// when
|
||||
let account = SafeAccount::create(&keypair, [0u8; 16], &password, 1024, "Test".to_owned(), "{}".to_owned()).unwrap();
|
||||
let filename = "test".to_string();
|
||||
let dedup = true;
|
||||
#[test]
|
||||
fn should_handle_duplicate_filenames() {
|
||||
// given
|
||||
let mut dir = env::temp_dir();
|
||||
dir.push("ethstore_should_handle_duplicate_filenames");
|
||||
let keypair = Random.generate().unwrap();
|
||||
let password = "hello world".into();
|
||||
let directory = RootDiskDirectory::create(dir.clone()).unwrap();
|
||||
|
||||
directory.insert_with_filename(account.clone(), "foo".to_string(), dedup).unwrap();
|
||||
let file1 = directory.insert_with_filename(account.clone(), filename.clone(), dedup).unwrap().filename.unwrap();
|
||||
let file2 = directory.insert_with_filename(account.clone(), filename.clone(), dedup).unwrap().filename.unwrap();
|
||||
let file3 = directory.insert_with_filename(account.clone(), filename.clone(), dedup).unwrap().filename.unwrap();
|
||||
// when
|
||||
let account = SafeAccount::create(
|
||||
&keypair,
|
||||
[0u8; 16],
|
||||
&password,
|
||||
*ITERATIONS,
|
||||
"Test".to_owned(),
|
||||
"{}".to_owned(),
|
||||
)
|
||||
.unwrap();
|
||||
let filename = "test".to_string();
|
||||
let dedup = true;
|
||||
|
||||
// then
|
||||
// the first file should have the original names
|
||||
assert_eq!(file1, filename);
|
||||
directory
|
||||
.insert_with_filename(account.clone(), "foo".to_string(), dedup)
|
||||
.unwrap();
|
||||
let file1 = directory
|
||||
.insert_with_filename(account.clone(), filename.clone(), dedup)
|
||||
.unwrap()
|
||||
.filename
|
||||
.unwrap();
|
||||
let file2 = directory
|
||||
.insert_with_filename(account.clone(), filename.clone(), dedup)
|
||||
.unwrap()
|
||||
.filename
|
||||
.unwrap();
|
||||
let file3 = directory
|
||||
.insert_with_filename(account.clone(), filename.clone(), dedup)
|
||||
.unwrap()
|
||||
.filename
|
||||
.unwrap();
|
||||
|
||||
// the following duplicate files should have a suffix appended
|
||||
assert!(file2 != file3);
|
||||
assert_eq!(file2.len(), filename.len() + 5);
|
||||
assert_eq!(file3.len(), filename.len() + 5);
|
||||
// then
|
||||
// the first file should have the original names
|
||||
assert_eq!(file1, filename);
|
||||
|
||||
// cleanup
|
||||
let _ = fs::remove_dir_all(dir);
|
||||
}
|
||||
// the following duplicate files should have a suffix appended
|
||||
assert!(file2 != file3);
|
||||
assert_eq!(file2.len(), filename.len() + 5);
|
||||
assert_eq!(file3.len(), filename.len() + 5);
|
||||
|
||||
#[test]
|
||||
fn should_manage_vaults() {
|
||||
// given
|
||||
let mut dir = env::temp_dir();
|
||||
dir.push("should_create_new_vault");
|
||||
let directory = RootDiskDirectory::create(dir.clone()).unwrap();
|
||||
let vault_name = "vault";
|
||||
let password = "password".into();
|
||||
// cleanup
|
||||
let _ = fs::remove_dir_all(dir);
|
||||
}
|
||||
|
||||
// then
|
||||
assert!(directory.as_vault_provider().is_some());
|
||||
#[test]
|
||||
fn should_manage_vaults() {
|
||||
// given
|
||||
let mut dir = env::temp_dir();
|
||||
dir.push("should_create_new_vault");
|
||||
let directory = RootDiskDirectory::create(dir.clone()).unwrap();
|
||||
let vault_name = "vault";
|
||||
let password = "password".into();
|
||||
|
||||
// and when
|
||||
let before_root_items_count = fs::read_dir(&dir).unwrap().count();
|
||||
let vault = directory.as_vault_provider().unwrap().create(vault_name, VaultKey::new(&password, 1024));
|
||||
// then
|
||||
assert!(directory.as_vault_provider().is_some());
|
||||
|
||||
// then
|
||||
assert!(vault.is_ok());
|
||||
let after_root_items_count = fs::read_dir(&dir).unwrap().count();
|
||||
assert!(after_root_items_count > before_root_items_count);
|
||||
// and when
|
||||
let before_root_items_count = fs::read_dir(&dir).unwrap().count();
|
||||
let vault = directory
|
||||
.as_vault_provider()
|
||||
.unwrap()
|
||||
.create(vault_name, VaultKey::new(&password, *ITERATIONS));
|
||||
|
||||
// and when
|
||||
let vault = directory.as_vault_provider().unwrap().open(vault_name, VaultKey::new(&password, 1024));
|
||||
// then
|
||||
assert!(vault.is_ok());
|
||||
let after_root_items_count = fs::read_dir(&dir).unwrap().count();
|
||||
assert!(after_root_items_count > before_root_items_count);
|
||||
|
||||
// then
|
||||
assert!(vault.is_ok());
|
||||
let after_root_items_count2 = fs::read_dir(&dir).unwrap().count();
|
||||
assert!(after_root_items_count == after_root_items_count2);
|
||||
// and when
|
||||
let vault = directory
|
||||
.as_vault_provider()
|
||||
.unwrap()
|
||||
.open(vault_name, VaultKey::new(&password, *ITERATIONS));
|
||||
|
||||
// cleanup
|
||||
let _ = fs::remove_dir_all(dir);
|
||||
}
|
||||
// then
|
||||
assert!(vault.is_ok());
|
||||
let after_root_items_count2 = fs::read_dir(&dir).unwrap().count();
|
||||
assert!(after_root_items_count == after_root_items_count2);
|
||||
|
||||
#[test]
|
||||
fn should_list_vaults() {
|
||||
// given
|
||||
let temp_path = TempDir::new().unwrap();
|
||||
let directory = RootDiskDirectory::create(&temp_path).unwrap();
|
||||
let vault_provider = directory.as_vault_provider().unwrap();
|
||||
vault_provider.create("vault1", VaultKey::new(&"password1".into(), 1)).unwrap();
|
||||
vault_provider.create("vault2", VaultKey::new(&"password2".into(), 1)).unwrap();
|
||||
// cleanup
|
||||
let _ = fs::remove_dir_all(dir);
|
||||
}
|
||||
|
||||
// then
|
||||
let vaults = vault_provider.list_vaults().unwrap();
|
||||
assert_eq!(vaults.len(), 2);
|
||||
assert!(vaults.iter().any(|v| &*v == "vault1"));
|
||||
assert!(vaults.iter().any(|v| &*v == "vault2"));
|
||||
}
|
||||
#[test]
|
||||
fn should_list_vaults() {
|
||||
// given
|
||||
let temp_path = TempDir::new("").unwrap();
|
||||
let directory = RootDiskDirectory::create(&temp_path).unwrap();
|
||||
let vault_provider = directory.as_vault_provider().unwrap();
|
||||
let iter = NonZeroU32::new(1).expect("1 > 0; qed");
|
||||
vault_provider
|
||||
.create("vault1", VaultKey::new(&"password1".into(), iter))
|
||||
.unwrap();
|
||||
vault_provider
|
||||
.create("vault2", VaultKey::new(&"password2".into(), iter))
|
||||
.unwrap();
|
||||
|
||||
#[test]
|
||||
fn hash_of_files() {
|
||||
let temp_path = TempDir::new().unwrap();
|
||||
let directory = RootDiskDirectory::create(&temp_path).unwrap();
|
||||
// then
|
||||
let vaults = vault_provider.list_vaults().unwrap();
|
||||
assert_eq!(vaults.len(), 2);
|
||||
assert!(vaults.iter().any(|v| &*v == "vault1"));
|
||||
assert!(vaults.iter().any(|v| &*v == "vault2"));
|
||||
}
|
||||
|
||||
let hash = directory.files_hash().expect("Files hash should be calculated ok");
|
||||
assert_eq!(
|
||||
hash,
|
||||
15130871412783076140
|
||||
);
|
||||
#[test]
|
||||
fn hash_of_files() {
|
||||
let temp_path = TempDir::new("").unwrap();
|
||||
let directory = RootDiskDirectory::create(&temp_path).unwrap();
|
||||
|
||||
let keypair = Random.generate();
|
||||
let password = "test pass".into();
|
||||
let account = SafeAccount::create(&keypair, [0u8; 16], &password, 1024, "Test".to_owned(), "{}".to_owned());
|
||||
directory.insert(account.unwrap()).expect("Account should be inserted ok");
|
||||
let hash = directory
|
||||
.files_hash()
|
||||
.expect("Files hash should be calculated ok");
|
||||
assert_eq!(hash, 15130871412783076140);
|
||||
|
||||
let new_hash = directory.files_hash().expect("New files hash should be calculated ok");
|
||||
let keypair = Random.generate().unwrap();
|
||||
let password = "test pass".into();
|
||||
let account = SafeAccount::create(
|
||||
&keypair,
|
||||
[0u8; 16],
|
||||
&password,
|
||||
*ITERATIONS,
|
||||
"Test".to_owned(),
|
||||
"{}".to_owned(),
|
||||
);
|
||||
directory
|
||||
.insert(account.unwrap())
|
||||
.expect("Account should be inserted ok");
|
||||
|
||||
assert!(new_hash != hash, "hash of the file list should change once directory content changed");
|
||||
}
|
||||
let new_hash = directory
|
||||
.files_hash()
|
||||
.expect("New files hash should be calculated ok");
|
||||
|
||||
assert!(
|
||||
new_hash != hash,
|
||||
"hash of the file list should change once directory content changed"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,73 +1,77 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::collections::HashMap;
|
||||
use ethkey::Address;
|
||||
use itertools;
|
||||
use parking_lot::RwLock;
|
||||
use crypto::publickey::Address;
|
||||
use std::collections::HashMap;
|
||||
|
||||
use {SafeAccount, Error};
|
||||
use super::KeyDirectory;
|
||||
use Error;
|
||||
use SafeAccount;
|
||||
|
||||
/// Accounts in-memory storage.
|
||||
#[derive(Default)]
|
||||
pub struct MemoryDirectory {
|
||||
accounts: RwLock<HashMap<Address, Vec<SafeAccount>>>,
|
||||
accounts: RwLock<HashMap<Address, Vec<SafeAccount>>>,
|
||||
}
|
||||
|
||||
impl KeyDirectory for MemoryDirectory {
|
||||
fn load(&self) -> Result<Vec<SafeAccount>, Error> {
|
||||
Ok(self.accounts.read().values().cloned().flatten().collect())
|
||||
}
|
||||
fn load(&self) -> Result<Vec<SafeAccount>, Error> {
|
||||
Ok(itertools::Itertools::flatten(self.accounts.read().values().cloned()).collect())
|
||||
}
|
||||
|
||||
fn update(&self, account: SafeAccount) -> Result<SafeAccount, Error> {
|
||||
let mut lock = self.accounts.write();
|
||||
let accounts = lock.entry(account.address.clone()).or_insert_with(Vec::new);
|
||||
// If the filename is the same we just need to replace the entry
|
||||
accounts.retain(|acc| acc.filename != account.filename);
|
||||
accounts.push(account.clone());
|
||||
Ok(account)
|
||||
}
|
||||
fn update(&self, account: SafeAccount) -> Result<SafeAccount, Error> {
|
||||
let mut lock = self.accounts.write();
|
||||
let accounts = lock.entry(account.address.clone()).or_insert_with(Vec::new);
|
||||
// If the filename is the same we just need to replace the entry
|
||||
accounts.retain(|acc| acc.filename != account.filename);
|
||||
accounts.push(account.clone());
|
||||
Ok(account)
|
||||
}
|
||||
|
||||
fn insert(&self, account: SafeAccount) -> Result<SafeAccount, Error> {
|
||||
let mut lock = self.accounts.write();
|
||||
let accounts = lock.entry(account.address.clone()).or_insert_with(Vec::new);
|
||||
accounts.push(account.clone());
|
||||
Ok(account)
|
||||
}
|
||||
fn insert(&self, account: SafeAccount) -> Result<SafeAccount, Error> {
|
||||
let mut lock = self.accounts.write();
|
||||
let accounts = lock.entry(account.address.clone()).or_insert_with(Vec::new);
|
||||
accounts.push(account.clone());
|
||||
Ok(account)
|
||||
}
|
||||
|
||||
fn remove(&self, account: &SafeAccount) -> Result<(), Error> {
|
||||
let mut accounts = self.accounts.write();
|
||||
let is_empty = if let Some(accounts) = accounts.get_mut(&account.address) {
|
||||
if let Some(position) = accounts.iter().position(|acc| acc == account) {
|
||||
accounts.remove(position);
|
||||
}
|
||||
accounts.is_empty()
|
||||
} else {
|
||||
false
|
||||
};
|
||||
if is_empty {
|
||||
accounts.remove(&account.address);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
fn remove(&self, account: &SafeAccount) -> Result<(), Error> {
|
||||
let mut accounts = self.accounts.write();
|
||||
let is_empty = if let Some(accounts) = accounts.get_mut(&account.address) {
|
||||
if let Some(position) = accounts.iter().position(|acc| acc == account) {
|
||||
accounts.remove(position);
|
||||
}
|
||||
accounts.is_empty()
|
||||
} else {
|
||||
false
|
||||
};
|
||||
if is_empty {
|
||||
accounts.remove(&account.address);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn unique_repr(&self) -> Result<u64, Error> {
|
||||
let mut val = 0u64;
|
||||
let accounts = self.accounts.read();
|
||||
for acc in accounts.keys() { val = val ^ acc.to_low_u64_be() }
|
||||
Ok(val)
|
||||
}
|
||||
fn unique_repr(&self) -> Result<u64, Error> {
|
||||
let mut val = 0u64;
|
||||
let accounts = self.accounts.read();
|
||||
for acc in accounts.keys() {
|
||||
val = val ^ acc.low_u64()
|
||||
}
|
||||
Ok(val)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Accounts Directory
|
||||
|
||||
use ethkey::Password;
|
||||
use std::path::{PathBuf};
|
||||
use {SafeAccount, Error};
|
||||
use std::{num::NonZeroU32, path::PathBuf};
|
||||
use Error;
|
||||
use SafeAccount;
|
||||
|
||||
mod disk;
|
||||
mod memory;
|
||||
@@ -27,79 +28,85 @@ mod vault;
|
||||
/// `VaultKeyDirectory::set_key` error
|
||||
#[derive(Debug)]
|
||||
pub enum SetKeyError {
|
||||
/// Error is fatal and directory is probably in inconsistent state
|
||||
Fatal(Error),
|
||||
/// Error is non fatal, directory is reverted to pre-operation state
|
||||
NonFatalOld(Error),
|
||||
/// Error is non fatal, directory is consistent with new key
|
||||
NonFatalNew(Error),
|
||||
/// Error is fatal and directory is probably in inconsistent state
|
||||
Fatal(Error),
|
||||
/// Error is non fatal, directory is reverted to pre-operation state
|
||||
NonFatalOld(Error),
|
||||
/// Error is non fatal, directory is consistent with new key
|
||||
NonFatalNew(Error),
|
||||
}
|
||||
|
||||
/// Vault key
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
pub struct VaultKey {
|
||||
/// Vault password
|
||||
pub password: Password,
|
||||
/// Number of iterations to produce a derived key from password
|
||||
pub iterations: u32,
|
||||
/// Vault password
|
||||
pub password: Password,
|
||||
/// Number of iterations to produce a derived key from password
|
||||
pub iterations: NonZeroU32,
|
||||
}
|
||||
|
||||
/// Keys directory
|
||||
pub trait KeyDirectory: Send + Sync {
|
||||
/// Read keys from directory
|
||||
fn load(&self) -> Result<Vec<SafeAccount>, Error>;
|
||||
/// Insert new key to directory
|
||||
fn insert(&self, account: SafeAccount) -> Result<SafeAccount, Error>;
|
||||
/// Update key in the directory
|
||||
fn update(&self, account: SafeAccount) -> Result<SafeAccount, Error>;
|
||||
/// Remove key from directory
|
||||
fn remove(&self, account: &SafeAccount) -> Result<(), Error>;
|
||||
/// Get directory filesystem path, if available
|
||||
fn path(&self) -> Option<&PathBuf> { None }
|
||||
/// Return vault provider, if available
|
||||
fn as_vault_provider(&self) -> Option<&dyn VaultKeyDirectoryProvider> { None }
|
||||
/// Unique representation of directory account collection
|
||||
fn unique_repr(&self) -> Result<u64, Error>;
|
||||
/// Read keys from directory
|
||||
fn load(&self) -> Result<Vec<SafeAccount>, Error>;
|
||||
/// Insert new key to directory
|
||||
fn insert(&self, account: SafeAccount) -> Result<SafeAccount, Error>;
|
||||
/// Update key in the directory
|
||||
fn update(&self, account: SafeAccount) -> Result<SafeAccount, Error>;
|
||||
/// Remove key from directory
|
||||
fn remove(&self, account: &SafeAccount) -> Result<(), Error>;
|
||||
/// Get directory filesystem path, if available
|
||||
fn path(&self) -> Option<&PathBuf> {
|
||||
None
|
||||
}
|
||||
/// Return vault provider, if available
|
||||
fn as_vault_provider(&self) -> Option<&dyn VaultKeyDirectoryProvider> {
|
||||
None
|
||||
}
|
||||
/// Unique representation of directory account collection
|
||||
fn unique_repr(&self) -> Result<u64, Error>;
|
||||
}
|
||||
|
||||
/// Vaults provider
|
||||
pub trait VaultKeyDirectoryProvider {
|
||||
/// Create new vault with given key
|
||||
fn create(&self, name: &str, key: VaultKey) -> Result<Box<dyn VaultKeyDirectory>, Error>;
|
||||
/// Open existing vault with given key
|
||||
fn open(&self, name: &str, key: VaultKey) -> Result<Box<dyn VaultKeyDirectory>, Error>;
|
||||
/// List all vaults
|
||||
fn list_vaults(&self) -> Result<Vec<String>, Error>;
|
||||
/// Get vault meta
|
||||
fn vault_meta(&self, name: &str) -> Result<String, Error>;
|
||||
/// Create new vault with given key
|
||||
fn create(&self, name: &str, key: VaultKey) -> Result<Box<dyn VaultKeyDirectory>, Error>;
|
||||
/// Open existing vault with given key
|
||||
fn open(&self, name: &str, key: VaultKey) -> Result<Box<dyn VaultKeyDirectory>, Error>;
|
||||
/// List all vaults
|
||||
fn list_vaults(&self) -> Result<Vec<String>, Error>;
|
||||
/// Get vault meta
|
||||
fn vault_meta(&self, name: &str) -> Result<String, Error>;
|
||||
}
|
||||
|
||||
/// Vault directory
|
||||
pub trait VaultKeyDirectory: KeyDirectory {
|
||||
/// Cast to `KeyDirectory`
|
||||
fn as_key_directory(&self) -> &dyn KeyDirectory;
|
||||
/// Vault name
|
||||
fn name(&self) -> &str;
|
||||
/// Get vault key
|
||||
fn key(&self) -> VaultKey;
|
||||
/// Set new key for vault
|
||||
fn set_key(&self, key: VaultKey) -> Result<(), SetKeyError>;
|
||||
/// Get vault meta
|
||||
fn meta(&self) -> String;
|
||||
/// Set vault meta
|
||||
fn set_meta(&self, meta: &str) -> Result<(), Error>;
|
||||
/// Cast to `KeyDirectory`
|
||||
fn as_key_directory(&self) -> &dyn KeyDirectory;
|
||||
/// Vault name
|
||||
fn name(&self) -> &str;
|
||||
/// Get vault key
|
||||
fn key(&self) -> VaultKey;
|
||||
/// Set new key for vault
|
||||
fn set_key(&self, key: VaultKey) -> Result<(), SetKeyError>;
|
||||
/// Get vault meta
|
||||
fn meta(&self) -> String;
|
||||
/// Set vault meta
|
||||
fn set_meta(&self, meta: &str) -> Result<(), Error>;
|
||||
}
|
||||
|
||||
pub use self::disk::{RootDiskDirectory, DiskKeyFileManager, KeyFileManager};
|
||||
pub use self::memory::MemoryDirectory;
|
||||
pub use self::vault::VaultDiskDirectory;
|
||||
pub use self::{
|
||||
disk::{DiskKeyFileManager, KeyFileManager, RootDiskDirectory},
|
||||
memory::MemoryDirectory,
|
||||
vault::VaultDiskDirectory,
|
||||
};
|
||||
|
||||
impl VaultKey {
|
||||
/// Create new vault key
|
||||
pub fn new(password: &Password, iterations: u32) -> Self {
|
||||
VaultKey {
|
||||
password: password.clone(),
|
||||
iterations: iterations,
|
||||
}
|
||||
}
|
||||
/// Create new vault key
|
||||
pub fn new(password: &Password, iterations: NonZeroU32) -> Self {
|
||||
VaultKey {
|
||||
password: password.clone(),
|
||||
iterations: iterations,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,33 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::{fs, io};
|
||||
use std::path::{PathBuf, Path};
|
||||
use parking_lot::Mutex;
|
||||
use {json, SafeAccount, Error};
|
||||
use super::{
|
||||
super::account::Crypto,
|
||||
disk::{self, DiskDirectory, KeyFileManager},
|
||||
KeyDirectory, SetKeyError, VaultKey, VaultKeyDirectory,
|
||||
};
|
||||
use crypto::Keccak256;
|
||||
use super::super::account::Crypto;
|
||||
use super::{KeyDirectory, VaultKeyDirectory, VaultKey, SetKeyError};
|
||||
use super::disk::{self, DiskDirectory, KeyFileManager};
|
||||
use json;
|
||||
use parking_lot::Mutex;
|
||||
use std::{
|
||||
fs, io,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
use Error;
|
||||
use SafeAccount;
|
||||
|
||||
/// Name of vault metadata file
|
||||
pub const VAULT_FILE_NAME: &'static str = "vault.json";
|
||||
@@ -33,411 +39,489 @@ pub type VaultDiskDirectory = DiskDirectory<VaultKeyFileManager>;
|
||||
|
||||
/// Vault key file manager
|
||||
pub struct VaultKeyFileManager {
|
||||
name: String,
|
||||
key: VaultKey,
|
||||
meta: Mutex<String>,
|
||||
name: String,
|
||||
key: VaultKey,
|
||||
meta: Mutex<String>,
|
||||
}
|
||||
|
||||
impl VaultDiskDirectory {
|
||||
/// Create new vault directory with given key
|
||||
pub fn create<P>(root: P, name: &str, key: VaultKey) -> Result<Self, Error> where P: AsRef<Path> {
|
||||
// check that vault directory does not exists
|
||||
let vault_dir_path = make_vault_dir_path(root, name, true)?;
|
||||
if vault_dir_path.exists() {
|
||||
return Err(Error::CreationFailed);
|
||||
}
|
||||
/// Create new vault directory with given key
|
||||
pub fn create<P>(root: P, name: &str, key: VaultKey) -> Result<Self, Error>
|
||||
where
|
||||
P: AsRef<Path>,
|
||||
{
|
||||
// check that vault directory does not exists
|
||||
let vault_dir_path = make_vault_dir_path(root, name, true)?;
|
||||
if vault_dir_path.exists() {
|
||||
return Err(Error::CreationFailed);
|
||||
}
|
||||
|
||||
// create vault && vault file
|
||||
let vault_meta = "{}";
|
||||
fs::create_dir_all(&vault_dir_path)?;
|
||||
if let Err(err) = create_vault_file(&vault_dir_path, &key, vault_meta) {
|
||||
let _ = fs::remove_dir_all(&vault_dir_path); // can't do anything with this
|
||||
return Err(err);
|
||||
}
|
||||
// create vault && vault file
|
||||
let vault_meta = "{}";
|
||||
fs::create_dir_all(&vault_dir_path)?;
|
||||
if let Err(err) = create_vault_file(&vault_dir_path, &key, vault_meta) {
|
||||
let _ = fs::remove_dir_all(&vault_dir_path); // can't do anything with this
|
||||
return Err(err);
|
||||
}
|
||||
|
||||
Ok(DiskDirectory::new(vault_dir_path, VaultKeyFileManager::new(name, key, vault_meta)))
|
||||
}
|
||||
Ok(DiskDirectory::new(
|
||||
vault_dir_path,
|
||||
VaultKeyFileManager::new(name, key, vault_meta),
|
||||
))
|
||||
}
|
||||
|
||||
/// Open existing vault directory with given key
|
||||
pub fn at<P>(root: P, name: &str, key: VaultKey) -> Result<Self, Error> where P: AsRef<Path> {
|
||||
// check that vault directory exists
|
||||
let vault_dir_path = make_vault_dir_path(root, name, true)?;
|
||||
if !vault_dir_path.is_dir() {
|
||||
return Err(Error::CreationFailed);
|
||||
}
|
||||
/// Open existing vault directory with given key
|
||||
pub fn at<P>(root: P, name: &str, key: VaultKey) -> Result<Self, Error>
|
||||
where
|
||||
P: AsRef<Path>,
|
||||
{
|
||||
// check that vault directory exists
|
||||
let vault_dir_path = make_vault_dir_path(root, name, true)?;
|
||||
if !vault_dir_path.is_dir() {
|
||||
return Err(Error::CreationFailed);
|
||||
}
|
||||
|
||||
// check that passed key matches vault file
|
||||
let meta = read_vault_file(&vault_dir_path, Some(&key))?;
|
||||
// check that passed key matches vault file
|
||||
let meta = read_vault_file(&vault_dir_path, Some(&key))?;
|
||||
|
||||
Ok(DiskDirectory::new(vault_dir_path, VaultKeyFileManager::new(name, key, &meta)))
|
||||
}
|
||||
Ok(DiskDirectory::new(
|
||||
vault_dir_path,
|
||||
VaultKeyFileManager::new(name, key, &meta),
|
||||
))
|
||||
}
|
||||
|
||||
/// Read vault meta without actually opening the vault
|
||||
pub fn meta_at<P>(root: P, name: &str) -> Result<String, Error> where P: AsRef<Path> {
|
||||
// check that vault directory exists
|
||||
let vault_dir_path = make_vault_dir_path(root, name, true)?;
|
||||
if !vault_dir_path.is_dir() {
|
||||
return Err(Error::VaultNotFound);
|
||||
}
|
||||
/// Read vault meta without actually opening the vault
|
||||
pub fn meta_at<P>(root: P, name: &str) -> Result<String, Error>
|
||||
where
|
||||
P: AsRef<Path>,
|
||||
{
|
||||
// check that vault directory exists
|
||||
let vault_dir_path = make_vault_dir_path(root, name, true)?;
|
||||
if !vault_dir_path.is_dir() {
|
||||
return Err(Error::VaultNotFound);
|
||||
}
|
||||
|
||||
// check that passed key matches vault file
|
||||
read_vault_file(&vault_dir_path, None)
|
||||
}
|
||||
// check that passed key matches vault file
|
||||
read_vault_file(&vault_dir_path, None)
|
||||
}
|
||||
|
||||
fn create_temp_vault(&self, key: VaultKey) -> Result<VaultDiskDirectory, Error> {
|
||||
let original_path = self.path().expect("self is instance of DiskDirectory; DiskDirectory always returns path; qed");
|
||||
let mut path: PathBuf = original_path.clone();
|
||||
let name = self.name();
|
||||
fn create_temp_vault(&self, key: VaultKey) -> Result<VaultDiskDirectory, Error> {
|
||||
let original_path = self
|
||||
.path()
|
||||
.expect("self is instance of DiskDirectory; DiskDirectory always returns path; qed");
|
||||
let mut path: PathBuf = original_path.clone();
|
||||
let name = self.name();
|
||||
|
||||
path.push(name); // to jump to the next level
|
||||
path.push(name); // to jump to the next level
|
||||
|
||||
let mut index = 0;
|
||||
loop {
|
||||
let name = format!("{}_temp_{}", name, index);
|
||||
path.set_file_name(&name);
|
||||
if !path.exists() {
|
||||
return VaultDiskDirectory::create(original_path, &name, key);
|
||||
}
|
||||
let mut index = 0;
|
||||
loop {
|
||||
let name = format!("{}_temp_{}", name, index);
|
||||
path.set_file_name(&name);
|
||||
if !path.exists() {
|
||||
return VaultDiskDirectory::create(original_path, &name, key);
|
||||
}
|
||||
|
||||
index += 1;
|
||||
}
|
||||
}
|
||||
index += 1;
|
||||
}
|
||||
}
|
||||
|
||||
fn copy_to_vault(&self, vault: &VaultDiskDirectory) -> Result<(), Error> {
|
||||
for account in self.load()? {
|
||||
let filename = account.filename.clone().expect("self is instance of DiskDirectory; DiskDirectory fills filename in load; qed");
|
||||
vault.insert_with_filename(account, filename, true)?;
|
||||
}
|
||||
fn copy_to_vault(&self, vault: &VaultDiskDirectory) -> Result<(), Error> {
|
||||
for account in self.load()? {
|
||||
let filename = account.filename.clone().expect(
|
||||
"self is instance of DiskDirectory; DiskDirectory fills filename in load; qed",
|
||||
);
|
||||
vault.insert_with_filename(account, filename, true)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn delete(&self) -> Result<(), Error> {
|
||||
let path = self.path().expect("self is instance of DiskDirectory; DiskDirectory always returns path; qed");
|
||||
fs::remove_dir_all(path).map_err(Into::into)
|
||||
}
|
||||
fn delete(&self) -> Result<(), Error> {
|
||||
let path = self
|
||||
.path()
|
||||
.expect("self is instance of DiskDirectory; DiskDirectory always returns path; qed");
|
||||
fs::remove_dir_all(path).map_err(Into::into)
|
||||
}
|
||||
}
|
||||
|
||||
impl VaultKeyDirectory for VaultDiskDirectory {
|
||||
fn as_key_directory(&self) -> &dyn KeyDirectory {
|
||||
self
|
||||
}
|
||||
fn as_key_directory(&self) -> &dyn KeyDirectory {
|
||||
self
|
||||
}
|
||||
|
||||
fn name(&self) -> &str {
|
||||
&self.key_manager().name
|
||||
}
|
||||
fn name(&self) -> &str {
|
||||
&self.key_manager().name
|
||||
}
|
||||
|
||||
fn key(&self) -> VaultKey {
|
||||
self.key_manager().key.clone()
|
||||
}
|
||||
fn key(&self) -> VaultKey {
|
||||
self.key_manager().key.clone()
|
||||
}
|
||||
|
||||
fn set_key(&self, new_key: VaultKey) -> Result<(), SetKeyError> {
|
||||
let temp_vault = VaultDiskDirectory::create_temp_vault(self, new_key.clone()).map_err(|err| SetKeyError::NonFatalOld(err))?;
|
||||
let mut source_path = temp_vault.path().expect("temp_vault is instance of DiskDirectory; DiskDirectory always returns path; qed").clone();
|
||||
let mut target_path = self.path().expect("self is instance of DiskDirectory; DiskDirectory always returns path; qed").clone();
|
||||
fn set_key(&self, new_key: VaultKey) -> Result<(), SetKeyError> {
|
||||
let temp_vault = VaultDiskDirectory::create_temp_vault(self, new_key.clone())
|
||||
.map_err(|err| SetKeyError::NonFatalOld(err))?;
|
||||
let mut source_path = temp_vault
|
||||
.path()
|
||||
.expect(
|
||||
"temp_vault is instance of DiskDirectory; DiskDirectory always returns path; qed",
|
||||
)
|
||||
.clone();
|
||||
let mut target_path = self
|
||||
.path()
|
||||
.expect("self is instance of DiskDirectory; DiskDirectory always returns path; qed")
|
||||
.clone();
|
||||
|
||||
// preserve meta
|
||||
temp_vault.set_meta(&self.meta()).map_err(SetKeyError::NonFatalOld)?;
|
||||
// preserve meta
|
||||
temp_vault
|
||||
.set_meta(&self.meta())
|
||||
.map_err(SetKeyError::NonFatalOld)?;
|
||||
|
||||
// jump to next fs level
|
||||
source_path.push("next");
|
||||
target_path.push("next");
|
||||
// jump to next fs level
|
||||
source_path.push("next");
|
||||
target_path.push("next");
|
||||
|
||||
let temp_accounts = self.copy_to_vault(&temp_vault)
|
||||
.and_then(|_| temp_vault.load())
|
||||
.map_err(|err| {
|
||||
// ignore error, as we already processing error
|
||||
let _ = temp_vault.delete();
|
||||
SetKeyError::NonFatalOld(err)
|
||||
})?;
|
||||
let temp_accounts = self
|
||||
.copy_to_vault(&temp_vault)
|
||||
.and_then(|_| temp_vault.load())
|
||||
.map_err(|err| {
|
||||
// ignore error, as we already processing error
|
||||
let _ = temp_vault.delete();
|
||||
SetKeyError::NonFatalOld(err)
|
||||
})?;
|
||||
|
||||
// we can't just delete temp vault until all files moved, because
|
||||
// original vault content has already been partially replaced
|
||||
// => when error or crash happens here, we can't do anything
|
||||
for temp_account in temp_accounts {
|
||||
let filename = temp_account.filename.expect("self is instance of DiskDirectory; DiskDirectory fills filename in load; qed");
|
||||
source_path.set_file_name(&filename);
|
||||
target_path.set_file_name(&filename);
|
||||
fs::rename(&source_path, &target_path).map_err(|err| SetKeyError::Fatal(err.into()))?;
|
||||
}
|
||||
source_path.set_file_name(VAULT_FILE_NAME);
|
||||
target_path.set_file_name(VAULT_FILE_NAME);
|
||||
fs::rename(source_path, target_path).map_err(|err| SetKeyError::Fatal(err.into()))?;
|
||||
// we can't just delete temp vault until all files moved, because
|
||||
// original vault content has already been partially replaced
|
||||
// => when error or crash happens here, we can't do anything
|
||||
for temp_account in temp_accounts {
|
||||
let filename = temp_account.filename.expect(
|
||||
"self is instance of DiskDirectory; DiskDirectory fills filename in load; qed",
|
||||
);
|
||||
source_path.set_file_name(&filename);
|
||||
target_path.set_file_name(&filename);
|
||||
fs::rename(&source_path, &target_path).map_err(|err| SetKeyError::Fatal(err.into()))?;
|
||||
}
|
||||
source_path.set_file_name(VAULT_FILE_NAME);
|
||||
target_path.set_file_name(VAULT_FILE_NAME);
|
||||
fs::rename(source_path, target_path).map_err(|err| SetKeyError::Fatal(err.into()))?;
|
||||
|
||||
temp_vault.delete().map_err(|err| SetKeyError::NonFatalNew(err))
|
||||
}
|
||||
temp_vault
|
||||
.delete()
|
||||
.map_err(|err| SetKeyError::NonFatalNew(err))
|
||||
}
|
||||
|
||||
fn meta(&self) -> String {
|
||||
self.key_manager().meta.lock().clone()
|
||||
}
|
||||
fn meta(&self) -> String {
|
||||
self.key_manager().meta.lock().clone()
|
||||
}
|
||||
|
||||
fn set_meta(&self, meta: &str) -> Result<(), Error> {
|
||||
let key_manager = self.key_manager();
|
||||
let vault_path = self.path().expect("self is instance of DiskDirectory; DiskDirectory always returns path; qed");
|
||||
create_vault_file(vault_path, &key_manager.key, meta)?;
|
||||
*key_manager.meta.lock() = meta.to_owned();
|
||||
Ok(())
|
||||
}
|
||||
fn set_meta(&self, meta: &str) -> Result<(), Error> {
|
||||
let key_manager = self.key_manager();
|
||||
let vault_path = self
|
||||
.path()
|
||||
.expect("self is instance of DiskDirectory; DiskDirectory always returns path; qed");
|
||||
create_vault_file(vault_path, &key_manager.key, meta)?;
|
||||
*key_manager.meta.lock() = meta.to_owned();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl VaultKeyFileManager {
|
||||
pub fn new(name: &str, key: VaultKey, meta: &str) -> Self {
|
||||
VaultKeyFileManager {
|
||||
name: name.into(),
|
||||
key: key,
|
||||
meta: Mutex::new(meta.to_owned()),
|
||||
}
|
||||
}
|
||||
pub fn new(name: &str, key: VaultKey, meta: &str) -> Self {
|
||||
VaultKeyFileManager {
|
||||
name: name.into(),
|
||||
key: key,
|
||||
meta: Mutex::new(meta.to_owned()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl KeyFileManager for VaultKeyFileManager {
|
||||
fn read<T>(&self, filename: Option<String>, reader: T) -> Result<SafeAccount, Error> where T: io::Read {
|
||||
let vault_file = json::VaultKeyFile::load(reader).map_err(|e| Error::Custom(format!("{:?}", e)))?;
|
||||
let mut safe_account = SafeAccount::from_vault_file(&self.key.password, vault_file, filename.clone())?;
|
||||
fn read<T>(&self, filename: Option<String>, reader: T) -> Result<SafeAccount, Error>
|
||||
where
|
||||
T: io::Read,
|
||||
{
|
||||
let vault_file =
|
||||
json::VaultKeyFile::load(reader).map_err(|e| Error::Custom(format!("{:?}", e)))?;
|
||||
let mut safe_account =
|
||||
SafeAccount::from_vault_file(&self.key.password, vault_file, filename.clone())?;
|
||||
|
||||
safe_account.meta = json::insert_vault_name_to_json_meta(&safe_account.meta, &self.name)
|
||||
.map_err(|err| Error::Custom(format!("{:?}", err)))?;
|
||||
Ok(safe_account)
|
||||
}
|
||||
safe_account.meta = json::insert_vault_name_to_json_meta(&safe_account.meta, &self.name)
|
||||
.map_err(|err| Error::Custom(format!("{:?}", err)))?;
|
||||
Ok(safe_account)
|
||||
}
|
||||
|
||||
fn write<T>(&self, mut account: SafeAccount, writer: &mut T) -> Result<(), Error> where T: io::Write {
|
||||
account.meta = json::remove_vault_name_from_json_meta(&account.meta)
|
||||
.map_err(|err| Error::Custom(format!("{:?}", err)))?;
|
||||
fn write<T>(&self, mut account: SafeAccount, writer: &mut T) -> Result<(), Error>
|
||||
where
|
||||
T: io::Write,
|
||||
{
|
||||
account.meta = json::remove_vault_name_from_json_meta(&account.meta)
|
||||
.map_err(|err| Error::Custom(format!("{:?}", err)))?;
|
||||
|
||||
let vault_file: json::VaultKeyFile = account.into_vault_file(self.key.iterations, &self.key.password)?;
|
||||
vault_file.write(writer).map_err(|e| Error::Custom(format!("{:?}", e)))
|
||||
}
|
||||
let vault_file: json::VaultKeyFile =
|
||||
account.into_vault_file(self.key.iterations, &self.key.password)?;
|
||||
vault_file
|
||||
.write(writer)
|
||||
.map_err(|e| Error::Custom(format!("{:?}", e)))
|
||||
}
|
||||
}
|
||||
|
||||
/// Makes path to vault directory, checking that vault name is appropriate
|
||||
fn make_vault_dir_path<P>(root: P, name: &str, check_name: bool) -> Result<PathBuf, Error> where P: AsRef<Path> {
|
||||
// check vault name
|
||||
if check_name && !check_vault_name(name) {
|
||||
return Err(Error::InvalidVaultName);
|
||||
}
|
||||
fn make_vault_dir_path<P>(root: P, name: &str, check_name: bool) -> Result<PathBuf, Error>
|
||||
where
|
||||
P: AsRef<Path>,
|
||||
{
|
||||
// check vault name
|
||||
if check_name && !check_vault_name(name) {
|
||||
return Err(Error::InvalidVaultName);
|
||||
}
|
||||
|
||||
let mut vault_dir_path: PathBuf = root.as_ref().into();
|
||||
vault_dir_path.push(name);
|
||||
Ok(vault_dir_path)
|
||||
let mut vault_dir_path: PathBuf = root.as_ref().into();
|
||||
vault_dir_path.push(name);
|
||||
Ok(vault_dir_path)
|
||||
}
|
||||
|
||||
/// Every vault must have unique name => we rely on filesystem to check this
|
||||
/// => vault name must not contain any fs-special characters to avoid directory traversal
|
||||
/// => we only allow alphanumeric + separator characters in vault name.
|
||||
fn check_vault_name(name: &str) -> bool {
|
||||
!name.is_empty()
|
||||
&& name.chars()
|
||||
.all(|c| c.is_alphanumeric()
|
||||
|| c.is_whitespace()
|
||||
|| c == '-' || c == '_')
|
||||
!name.is_empty()
|
||||
&& name
|
||||
.chars()
|
||||
.all(|c| c.is_alphanumeric() || c.is_whitespace() || c == '-' || c == '_')
|
||||
}
|
||||
|
||||
/// Vault can be empty, but still must be pluggable => we store vault password in separate file
|
||||
fn create_vault_file<P>(vault_dir_path: P, key: &VaultKey, meta: &str) -> Result<(), Error> where P: AsRef<Path> {
|
||||
let password_hash = key.password.as_bytes().keccak256();
|
||||
let crypto = Crypto::with_plain(&password_hash, &key.password, key.iterations)?;
|
||||
fn create_vault_file<P>(vault_dir_path: P, key: &VaultKey, meta: &str) -> Result<(), Error>
|
||||
where
|
||||
P: AsRef<Path>,
|
||||
{
|
||||
let password_hash = key.password.as_bytes().keccak256();
|
||||
let crypto = Crypto::with_plain(&password_hash, &key.password, key.iterations)?;
|
||||
|
||||
let vault_file_path = vault_dir_path.as_ref().join(VAULT_FILE_NAME);
|
||||
let temp_vault_file_name = disk::find_unique_filename_using_random_suffix(vault_dir_path.as_ref(), &VAULT_TEMP_FILE_NAME)?;
|
||||
let temp_vault_file_path = vault_dir_path.as_ref().join(&temp_vault_file_name);
|
||||
let vault_file_path = vault_dir_path.as_ref().join(VAULT_FILE_NAME);
|
||||
let temp_vault_file_name = disk::find_unique_filename_using_random_suffix(
|
||||
vault_dir_path.as_ref(),
|
||||
&VAULT_TEMP_FILE_NAME,
|
||||
)?;
|
||||
let temp_vault_file_path = vault_dir_path.as_ref().join(&temp_vault_file_name);
|
||||
|
||||
// this method is used to rewrite existing vault file
|
||||
// => write to temporary file first, then rename temporary file to vault file
|
||||
let mut vault_file = disk::create_new_file_with_permissions_to_owner(&temp_vault_file_path)?;
|
||||
let vault_file_contents = json::VaultFile {
|
||||
crypto: crypto.into(),
|
||||
meta: Some(meta.to_owned()),
|
||||
};
|
||||
vault_file_contents.write(&mut vault_file).map_err(|e| Error::Custom(format!("{:?}", e)))?;
|
||||
drop(vault_file);
|
||||
fs::rename(&temp_vault_file_path, &vault_file_path)?;
|
||||
// this method is used to rewrite existing vault file
|
||||
// => write to temporary file first, then rename temporary file to vault file
|
||||
let mut vault_file = disk::create_new_file_with_permissions_to_owner(&temp_vault_file_path)?;
|
||||
let vault_file_contents = json::VaultFile {
|
||||
crypto: crypto.into(),
|
||||
meta: Some(meta.to_owned()),
|
||||
};
|
||||
vault_file_contents
|
||||
.write(&mut vault_file)
|
||||
.map_err(|e| Error::Custom(format!("{:?}", e)))?;
|
||||
drop(vault_file);
|
||||
fs::rename(&temp_vault_file_path, &vault_file_path)?;
|
||||
|
||||
Ok(())
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// When vault is opened => we must check that password matches && read metadata
|
||||
fn read_vault_file<P>(vault_dir_path: P, key: Option<&VaultKey>) -> Result<String, Error> where P: AsRef<Path> {
|
||||
let mut vault_file_path: PathBuf = vault_dir_path.as_ref().into();
|
||||
vault_file_path.push(VAULT_FILE_NAME);
|
||||
fn read_vault_file<P>(vault_dir_path: P, key: Option<&VaultKey>) -> Result<String, Error>
|
||||
where
|
||||
P: AsRef<Path>,
|
||||
{
|
||||
let mut vault_file_path: PathBuf = vault_dir_path.as_ref().into();
|
||||
vault_file_path.push(VAULT_FILE_NAME);
|
||||
|
||||
let vault_file = fs::File::open(vault_file_path)?;
|
||||
let vault_file_contents = json::VaultFile::load(vault_file).map_err(|e| Error::Custom(format!("{:?}", e)))?;
|
||||
let vault_file_meta = vault_file_contents.meta.unwrap_or("{}".to_owned());
|
||||
let vault_file_crypto: Crypto = vault_file_contents.crypto.into();
|
||||
let vault_file = fs::File::open(vault_file_path)?;
|
||||
let vault_file_contents =
|
||||
json::VaultFile::load(vault_file).map_err(|e| Error::Custom(format!("{:?}", e)))?;
|
||||
let vault_file_meta = vault_file_contents.meta.unwrap_or("{}".to_owned());
|
||||
let vault_file_crypto: Crypto = vault_file_contents.crypto.into();
|
||||
|
||||
if let Some(key) = key {
|
||||
let password_bytes = vault_file_crypto.decrypt(&key.password)?;
|
||||
let password_hash = key.password.as_bytes().keccak256();
|
||||
if password_hash != password_bytes.as_slice() {
|
||||
return Err(Error::InvalidPassword);
|
||||
}
|
||||
}
|
||||
if let Some(key) = key {
|
||||
let password_bytes = vault_file_crypto.decrypt(&key.password)?;
|
||||
let password_hash = key.password.as_bytes().keccak256();
|
||||
if password_hash != password_bytes.as_slice() {
|
||||
return Err(Error::InvalidPassword);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(vault_file_meta)
|
||||
Ok(vault_file_meta)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
extern crate tempfile;
|
||||
extern crate tempdir;
|
||||
|
||||
use std::fs;
|
||||
use std::io::Write;
|
||||
use std::path::PathBuf;
|
||||
use super::VaultKey;
|
||||
use super::{VAULT_FILE_NAME, check_vault_name, make_vault_dir_path, create_vault_file, read_vault_file, VaultDiskDirectory};
|
||||
use self::tempfile::TempDir;
|
||||
use self::tempdir::TempDir;
|
||||
use super::{
|
||||
check_vault_name, create_vault_file, make_vault_dir_path, read_vault_file,
|
||||
VaultDiskDirectory, VaultKey, VAULT_FILE_NAME,
|
||||
};
|
||||
use std::{fs, io::Write, num::NonZeroU32, path::PathBuf};
|
||||
|
||||
#[test]
|
||||
fn check_vault_name_succeeds() {
|
||||
assert!(check_vault_name("vault"));
|
||||
assert!(check_vault_name("vault with spaces"));
|
||||
assert!(check_vault_name("vault with tabs"));
|
||||
assert!(check_vault_name("vault_with_underscores"));
|
||||
assert!(check_vault_name("vault-with-dashes"));
|
||||
assert!(check_vault_name("vault-with-digits-123"));
|
||||
assert!(check_vault_name("vault中文名字"));
|
||||
}
|
||||
lazy_static! {
|
||||
static ref ITERATIONS: NonZeroU32 = NonZeroU32::new(1024).expect("1024 > 0; qed");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn check_vault_name_fails() {
|
||||
assert!(!check_vault_name(""));
|
||||
assert!(!check_vault_name("."));
|
||||
assert!(!check_vault_name("*"));
|
||||
assert!(!check_vault_name("../.bash_history"));
|
||||
assert!(!check_vault_name("/etc/passwd"));
|
||||
assert!(!check_vault_name("c:\\windows"));
|
||||
}
|
||||
#[test]
|
||||
fn check_vault_name_succeeds() {
|
||||
assert!(check_vault_name("vault"));
|
||||
assert!(check_vault_name("vault with spaces"));
|
||||
assert!(check_vault_name("vault with tabs"));
|
||||
assert!(check_vault_name("vault_with_underscores"));
|
||||
assert!(check_vault_name("vault-with-dashes"));
|
||||
assert!(check_vault_name("vault-with-digits-123"));
|
||||
assert!(check_vault_name("vault中文名字"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn make_vault_dir_path_succeeds() {
|
||||
use std::path::Path;
|
||||
#[test]
|
||||
fn check_vault_name_fails() {
|
||||
assert!(!check_vault_name(""));
|
||||
assert!(!check_vault_name("."));
|
||||
assert!(!check_vault_name("*"));
|
||||
assert!(!check_vault_name("../.bash_history"));
|
||||
assert!(!check_vault_name("/etc/passwd"));
|
||||
assert!(!check_vault_name("c:\\windows"));
|
||||
}
|
||||
|
||||
assert_eq!(&make_vault_dir_path("/home/user/parity", "vault", true).unwrap(), &Path::new("/home/user/parity/vault"));
|
||||
assert_eq!(&make_vault_dir_path("/home/user/parity", "*bad-name*", false).unwrap(), &Path::new("/home/user/parity/*bad-name*"));
|
||||
}
|
||||
#[test]
|
||||
fn make_vault_dir_path_succeeds() {
|
||||
use std::path::Path;
|
||||
|
||||
#[test]
|
||||
fn make_vault_dir_path_fails() {
|
||||
assert!(make_vault_dir_path("/home/user/parity", "*bad-name*", true).is_err());
|
||||
}
|
||||
assert_eq!(
|
||||
&make_vault_dir_path("/home/user/parity", "vault", true).unwrap(),
|
||||
&Path::new("/home/user/parity/vault")
|
||||
);
|
||||
assert_eq!(
|
||||
&make_vault_dir_path("/home/user/parity", "*bad-name*", false).unwrap(),
|
||||
&Path::new("/home/user/parity/*bad-name*")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn create_vault_file_succeeds() {
|
||||
// given
|
||||
let temp_path = TempDir::new().unwrap();
|
||||
let key = VaultKey::new(&"password".into(), 1024);
|
||||
let mut vault_dir: PathBuf = temp_path.path().into();
|
||||
vault_dir.push("vault");
|
||||
fs::create_dir_all(&vault_dir).unwrap();
|
||||
#[test]
|
||||
fn make_vault_dir_path_fails() {
|
||||
assert!(make_vault_dir_path("/home/user/parity", "*bad-name*", true).is_err());
|
||||
}
|
||||
|
||||
// when
|
||||
let result = create_vault_file(&vault_dir, &key, "{}");
|
||||
#[test]
|
||||
fn create_vault_file_succeeds() {
|
||||
// given
|
||||
let temp_path = TempDir::new("").unwrap();
|
||||
let key = VaultKey::new(&"password".into(), *ITERATIONS);
|
||||
let mut vault_dir: PathBuf = temp_path.path().into();
|
||||
vault_dir.push("vault");
|
||||
fs::create_dir_all(&vault_dir).unwrap();
|
||||
|
||||
// then
|
||||
assert!(result.is_ok());
|
||||
let mut vault_file_path = vault_dir.clone();
|
||||
vault_file_path.push(VAULT_FILE_NAME);
|
||||
assert!(vault_file_path.exists() && vault_file_path.is_file());
|
||||
}
|
||||
// when
|
||||
let result = create_vault_file(&vault_dir, &key, "{}");
|
||||
|
||||
#[test]
|
||||
fn read_vault_file_succeeds() {
|
||||
// given
|
||||
let temp_path = TempDir::new().unwrap();
|
||||
let key = VaultKey::new(&"password".into(), 1024);
|
||||
let vault_file_contents = r#"{"crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"758696c8dc6378ab9b25bb42790da2f5"},"ciphertext":"54eb50683717d41caaeb12ea969f2c159daada5907383f26f327606a37dc7168","kdf":"pbkdf2","kdfparams":{"c":1024,"dklen":32,"prf":"hmac-sha256","salt":"3c320fa566a1a7963ac8df68a19548d27c8f40bf92ef87c84594dcd5bbc402b6"},"mac":"9e5c2314c2a0781962db85611417c614bd6756666b6b1e93840f5b6ed895f003"}}"#;
|
||||
let dir: PathBuf = temp_path.path().into();
|
||||
let mut vault_file_path: PathBuf = dir.clone();
|
||||
vault_file_path.push(VAULT_FILE_NAME);
|
||||
{
|
||||
let mut vault_file = fs::File::create(vault_file_path).unwrap();
|
||||
vault_file.write_all(vault_file_contents.as_bytes()).unwrap();
|
||||
}
|
||||
// then
|
||||
assert!(result.is_ok());
|
||||
let mut vault_file_path = vault_dir.clone();
|
||||
vault_file_path.push(VAULT_FILE_NAME);
|
||||
assert!(vault_file_path.exists() && vault_file_path.is_file());
|
||||
}
|
||||
|
||||
// when
|
||||
let result = read_vault_file(&dir, Some(&key));
|
||||
#[test]
|
||||
fn read_vault_file_succeeds() {
|
||||
// given
|
||||
let temp_path = TempDir::new("").unwrap();
|
||||
let key = VaultKey::new(&"password".into(), *ITERATIONS);
|
||||
let vault_file_contents = r#"{"crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"758696c8dc6378ab9b25bb42790da2f5"},"ciphertext":"54eb50683717d41caaeb12ea969f2c159daada5907383f26f327606a37dc7168","kdf":"pbkdf2","kdfparams":{"c":1024,"dklen":32,"prf":"hmac-sha256","salt":"3c320fa566a1a7963ac8df68a19548d27c8f40bf92ef87c84594dcd5bbc402b6"},"mac":"9e5c2314c2a0781962db85611417c614bd6756666b6b1e93840f5b6ed895f003"}}"#;
|
||||
let dir: PathBuf = temp_path.path().into();
|
||||
let mut vault_file_path: PathBuf = dir.clone();
|
||||
vault_file_path.push(VAULT_FILE_NAME);
|
||||
{
|
||||
let mut vault_file = fs::File::create(vault_file_path).unwrap();
|
||||
vault_file
|
||||
.write_all(vault_file_contents.as_bytes())
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
// then
|
||||
assert!(result.is_ok());
|
||||
}
|
||||
// when
|
||||
let result = read_vault_file(&dir, Some(&key));
|
||||
|
||||
#[test]
|
||||
fn read_vault_file_fails() {
|
||||
// given
|
||||
let temp_path = TempDir::new().unwrap();
|
||||
let key = VaultKey::new(&"password1".into(), 1024);
|
||||
let dir: PathBuf = temp_path.path().into();
|
||||
let mut vault_file_path: PathBuf = dir.clone();
|
||||
vault_file_path.push(VAULT_FILE_NAME);
|
||||
// then
|
||||
assert!(result.is_ok());
|
||||
}
|
||||
|
||||
// when
|
||||
let result = read_vault_file(&dir, Some(&key));
|
||||
#[test]
|
||||
fn read_vault_file_fails() {
|
||||
// given
|
||||
let temp_path = TempDir::new("").unwrap();
|
||||
let key = VaultKey::new(&"password1".into(), *ITERATIONS);
|
||||
let dir: PathBuf = temp_path.path().into();
|
||||
let mut vault_file_path: PathBuf = dir.clone();
|
||||
vault_file_path.push(VAULT_FILE_NAME);
|
||||
|
||||
// then
|
||||
assert!(result.is_err());
|
||||
// when
|
||||
let result = read_vault_file(&dir, Some(&key));
|
||||
|
||||
// and when given
|
||||
let vault_file_contents = r#"{"crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"0155e3690be19fbfbecabcd440aa284b"},"ciphertext":"4d6938a1f49b7782","kdf":"pbkdf2","kdfparams":{"c":1024,"dklen":32,"prf":"hmac-sha256","salt":"b6a9338a7ccd39288a86dba73bfecd9101b4f3db9c9830e7c76afdbd4f6872e5"},"mac":"16381463ea11c6eb2239a9f339c2e780516d29d234ce30ac5f166f9080b5a262"}}"#;
|
||||
{
|
||||
let mut vault_file = fs::File::create(vault_file_path).unwrap();
|
||||
vault_file.write_all(vault_file_contents.as_bytes()).unwrap();
|
||||
}
|
||||
// then
|
||||
assert!(result.is_err());
|
||||
|
||||
// when
|
||||
let result = read_vault_file(&dir, Some(&key));
|
||||
// and when given
|
||||
let vault_file_contents = r#"{"crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"0155e3690be19fbfbecabcd440aa284b"},"ciphertext":"4d6938a1f49b7782","kdf":"pbkdf2","kdfparams":{"c":1024,"dklen":32,"prf":"hmac-sha256","salt":"b6a9338a7ccd39288a86dba73bfecd9101b4f3db9c9830e7c76afdbd4f6872e5"},"mac":"16381463ea11c6eb2239a9f339c2e780516d29d234ce30ac5f166f9080b5a262"}}"#;
|
||||
{
|
||||
let mut vault_file = fs::File::create(vault_file_path).unwrap();
|
||||
vault_file
|
||||
.write_all(vault_file_contents.as_bytes())
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
// then
|
||||
assert!(result.is_err());
|
||||
}
|
||||
// when
|
||||
let result = read_vault_file(&dir, Some(&key));
|
||||
|
||||
#[test]
|
||||
fn vault_directory_can_be_created() {
|
||||
// given
|
||||
let temp_path = TempDir::new().unwrap();
|
||||
let key = VaultKey::new(&"password".into(), 1024);
|
||||
let dir: PathBuf = temp_path.path().into();
|
||||
// then
|
||||
assert!(result.is_err());
|
||||
}
|
||||
|
||||
// when
|
||||
let vault = VaultDiskDirectory::create(&dir, "vault", key.clone());
|
||||
#[test]
|
||||
fn vault_directory_can_be_created() {
|
||||
// given
|
||||
let temp_path = TempDir::new("").unwrap();
|
||||
let key = VaultKey::new(&"password".into(), *ITERATIONS);
|
||||
let dir: PathBuf = temp_path.path().into();
|
||||
|
||||
// then
|
||||
assert!(vault.is_ok());
|
||||
// when
|
||||
let vault = VaultDiskDirectory::create(&dir, "vault", key.clone());
|
||||
|
||||
// and when
|
||||
let vault = VaultDiskDirectory::at(&dir, "vault", key);
|
||||
// then
|
||||
assert!(vault.is_ok());
|
||||
|
||||
// then
|
||||
assert!(vault.is_ok());
|
||||
}
|
||||
// and when
|
||||
let vault = VaultDiskDirectory::at(&dir, "vault", key);
|
||||
|
||||
#[test]
|
||||
fn vault_directory_cannot_be_created_if_already_exists() {
|
||||
// given
|
||||
let temp_path = TempDir::new().unwrap();
|
||||
let key = VaultKey::new(&"password".into(), 1024);
|
||||
let dir: PathBuf = temp_path.path().into();
|
||||
let mut vault_dir = dir.clone();
|
||||
vault_dir.push("vault");
|
||||
fs::create_dir_all(&vault_dir).unwrap();
|
||||
// then
|
||||
assert!(vault.is_ok());
|
||||
}
|
||||
|
||||
// when
|
||||
let vault = VaultDiskDirectory::create(&dir, "vault", key);
|
||||
#[test]
|
||||
fn vault_directory_cannot_be_created_if_already_exists() {
|
||||
// given
|
||||
let temp_path = TempDir::new("").unwrap();
|
||||
let key = VaultKey::new(&"password".into(), *ITERATIONS);
|
||||
let dir: PathBuf = temp_path.path().into();
|
||||
let mut vault_dir = dir.clone();
|
||||
vault_dir.push("vault");
|
||||
fs::create_dir_all(&vault_dir).unwrap();
|
||||
|
||||
// then
|
||||
assert!(vault.is_err());
|
||||
}
|
||||
// when
|
||||
let vault = VaultDiskDirectory::create(&dir, "vault", key);
|
||||
|
||||
#[test]
|
||||
fn vault_directory_cannot_be_opened_if_not_exists() {
|
||||
// given
|
||||
let temp_path = TempDir::new().unwrap();
|
||||
let key = VaultKey::new(&"password".into(), 1024);
|
||||
let dir: PathBuf = temp_path.path().into();
|
||||
// then
|
||||
assert!(vault.is_err());
|
||||
}
|
||||
|
||||
// when
|
||||
let vault = VaultDiskDirectory::at(&dir, "vault", key);
|
||||
#[test]
|
||||
fn vault_directory_cannot_be_opened_if_not_exists() {
|
||||
// given
|
||||
let temp_path = TempDir::new("").unwrap();
|
||||
let key = VaultKey::new(&"password".into(), *ITERATIONS);
|
||||
let dir: PathBuf = temp_path.path().into();
|
||||
|
||||
// then
|
||||
assert!(vault.is_err());
|
||||
}
|
||||
// when
|
||||
let vault = VaultDiskDirectory::at(&dir, "vault", key);
|
||||
|
||||
// then
|
||||
assert!(vault.is_err());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,118 +1,126 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::fmt;
|
||||
use std::io::Error as IoError;
|
||||
use crypto::{self, Error as EthCryptoError};
|
||||
use crypto::publickey::{Error as EthPublicKeyCryptoError, DerivationError};
|
||||
use ethkey::{self, DerivationError, Error as EthKeyError};
|
||||
use std::{fmt, io::Error as IoError};
|
||||
|
||||
/// Account-related errors.
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
/// IO error
|
||||
Io(IoError),
|
||||
/// Invalid Password
|
||||
InvalidPassword,
|
||||
/// Account's secret is invalid.
|
||||
InvalidSecret,
|
||||
/// Invalid Vault Crypto meta.
|
||||
InvalidCryptoMeta,
|
||||
/// Invalid Account.
|
||||
InvalidAccount,
|
||||
/// Invalid Message.
|
||||
InvalidMessage,
|
||||
/// Invalid Key File
|
||||
InvalidKeyFile(String),
|
||||
/// Vaults are not supported.
|
||||
VaultsAreNotSupported,
|
||||
/// Unsupported vault
|
||||
UnsupportedVault,
|
||||
/// Invalid vault name
|
||||
InvalidVaultName,
|
||||
/// Vault not found
|
||||
VaultNotFound,
|
||||
/// Account creation failed.
|
||||
CreationFailed,
|
||||
/// `EthCrypto` error
|
||||
EthCrypto(EthCryptoError),
|
||||
/// `EthPublicKeyCryptoError` error
|
||||
EthPublicKeyCrypto(EthPublicKeyCryptoError),
|
||||
/// Derivation error
|
||||
Derivation(DerivationError),
|
||||
/// Custom error
|
||||
Custom(String),
|
||||
/// IO error
|
||||
Io(IoError),
|
||||
/// Invalid Password
|
||||
InvalidPassword,
|
||||
/// Account's secret is invalid.
|
||||
InvalidSecret,
|
||||
/// Invalid Vault Crypto meta.
|
||||
InvalidCryptoMeta,
|
||||
/// Invalid Account.
|
||||
InvalidAccount,
|
||||
/// Invalid Message.
|
||||
InvalidMessage,
|
||||
/// Invalid Key File
|
||||
InvalidKeyFile(String),
|
||||
/// Vaults are not supported.
|
||||
VaultsAreNotSupported,
|
||||
/// Unsupported vault
|
||||
UnsupportedVault,
|
||||
/// Invalid vault name
|
||||
InvalidVaultName,
|
||||
/// Vault not found
|
||||
VaultNotFound,
|
||||
/// Account creation failed.
|
||||
CreationFailed,
|
||||
/// `EthKey` error
|
||||
EthKey(EthKeyError),
|
||||
/// `ethkey::crypto::Error`
|
||||
EthKeyCrypto(ethkey::crypto::Error),
|
||||
/// `EthCrypto` error
|
||||
EthCrypto(EthCryptoError),
|
||||
/// Derivation error
|
||||
Derivation(DerivationError),
|
||||
/// Custom error
|
||||
Custom(String),
|
||||
}
|
||||
|
||||
impl fmt::Display for Error {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
let s = match *self {
|
||||
Error::Io(ref err) => err.to_string(),
|
||||
Error::InvalidPassword => "Invalid password".into(),
|
||||
Error::InvalidSecret => "Invalid secret".into(),
|
||||
Error::InvalidCryptoMeta => "Invalid crypted metadata".into(),
|
||||
Error::InvalidAccount => "Invalid account".into(),
|
||||
Error::InvalidMessage => "Invalid message".into(),
|
||||
Error::InvalidKeyFile(ref reason) => format!("Invalid key file: {}", reason),
|
||||
Error::VaultsAreNotSupported => "Vaults are not supported".into(),
|
||||
Error::UnsupportedVault => "Vault is not supported for this operation".into(),
|
||||
Error::InvalidVaultName => "Invalid vault name".into(),
|
||||
Error::VaultNotFound => "Vault not found".into(),
|
||||
Error::CreationFailed => "Account creation failed".into(),
|
||||
Error::EthCrypto(ref err) => err.to_string(),
|
||||
Error::EthPublicKeyCrypto(ref err) => err.to_string(),
|
||||
Error::Derivation(ref err) => format!("Derivation error: {:?}", err),
|
||||
Error::Custom(ref s) => s.clone(),
|
||||
};
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
let s = match *self {
|
||||
Error::Io(ref err) => err.to_string(),
|
||||
Error::InvalidPassword => "Invalid password".into(),
|
||||
Error::InvalidSecret => "Invalid secret".into(),
|
||||
Error::InvalidCryptoMeta => "Invalid crypted metadata".into(),
|
||||
Error::InvalidAccount => "Invalid account".into(),
|
||||
Error::InvalidMessage => "Invalid message".into(),
|
||||
Error::InvalidKeyFile(ref reason) => format!("Invalid key file: {}", reason),
|
||||
Error::VaultsAreNotSupported => "Vaults are not supported".into(),
|
||||
Error::UnsupportedVault => "Vault is not supported for this operation".into(),
|
||||
Error::InvalidVaultName => "Invalid vault name".into(),
|
||||
Error::VaultNotFound => "Vault not found".into(),
|
||||
Error::CreationFailed => "Account creation failed".into(),
|
||||
Error::EthKey(ref err) => err.to_string(),
|
||||
Error::EthKeyCrypto(ref err) => err.to_string(),
|
||||
Error::EthCrypto(ref err) => err.to_string(),
|
||||
Error::Derivation(ref err) => format!("Derivation error: {:?}", err),
|
||||
Error::Custom(ref s) => s.clone(),
|
||||
};
|
||||
|
||||
write!(f, "{}", s)
|
||||
}
|
||||
write!(f, "{}", s)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<IoError> for Error {
|
||||
fn from(err: IoError) -> Self {
|
||||
Error::Io(err)
|
||||
}
|
||||
fn from(err: IoError) -> Self {
|
||||
Error::Io(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<EthPublicKeyCryptoError> for Error {
|
||||
fn from(err: EthPublicKeyCryptoError) -> Self {
|
||||
Error::EthPublicKeyCrypto(err)
|
||||
}
|
||||
impl From<EthKeyError> for Error {
|
||||
fn from(err: EthKeyError) -> Self {
|
||||
Error::EthKey(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ethkey::crypto::Error> for Error {
|
||||
fn from(err: ethkey::crypto::Error) -> Self {
|
||||
Error::EthKeyCrypto(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<EthCryptoError> for Error {
|
||||
fn from(err: EthCryptoError) -> Self {
|
||||
Error::EthCrypto(err)
|
||||
}
|
||||
fn from(err: EthCryptoError) -> Self {
|
||||
Error::EthCrypto(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<crypto::error::ScryptError> for Error {
|
||||
fn from(err: crypto::error::ScryptError) -> Self {
|
||||
Error::EthCrypto(err.into())
|
||||
}
|
||||
fn from(err: crypto::error::ScryptError) -> Self {
|
||||
Error::EthCrypto(err.into())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<crypto::error::SymmError> for Error {
|
||||
fn from(err: crypto::error::SymmError) -> Self {
|
||||
Error::EthCrypto(err.into())
|
||||
}
|
||||
fn from(err: crypto::error::SymmError) -> Self {
|
||||
Error::EthCrypto(err.into())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<DerivationError> for Error {
|
||||
fn from(err: DerivationError) -> Self {
|
||||
Error::Derivation(err)
|
||||
}
|
||||
fn from(err: DerivationError) -> Self {
|
||||
Error::Derivation(err)
|
||||
}
|
||||
}
|
||||
|
||||
41
accounts/ethstore/src/ethkey.rs
Normal file
41
accounts/ethstore/src/ethkey.rs
Normal file
@@ -0,0 +1,41 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// OpenEthereum 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.
|
||||
|
||||
// OpenEthereum 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 OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! ethkey reexport to make documentation look pretty.
|
||||
pub use _ethkey::*;
|
||||
use json;
|
||||
|
||||
impl Into<json::H160> for Address {
|
||||
fn into(self) -> json::H160 {
|
||||
let a: [u8; 20] = self.into();
|
||||
From::from(a)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<json::H160> for Address {
|
||||
fn from(json: json::H160) -> Self {
|
||||
let a: [u8; 20] = json.into();
|
||||
From::from(a)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a json::H160> for Address {
|
||||
fn from(json: &'a json::H160) -> Self {
|
||||
let mut a = [0u8; 20];
|
||||
a.copy_from_slice(json);
|
||||
From::from(a)
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,80 +1,67 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::collections::HashSet;
|
||||
use std::path::Path;
|
||||
use std::fs;
|
||||
use std::{collections::HashSet, fs, path::Path};
|
||||
|
||||
use crypto::publickey::Address;
|
||||
use accounts_dir::{KeyDirectory, RootDiskDirectory, DiskKeyFileManager, KeyFileManager};
|
||||
use dir;
|
||||
use accounts_dir::{DiskKeyFileManager, KeyDirectory, KeyFileManager};
|
||||
use ethkey::Address;
|
||||
use Error;
|
||||
|
||||
/// Import an account from a file.
|
||||
pub fn import_account(path: &Path, dst: &dyn KeyDirectory) -> Result<Address, Error> {
|
||||
let key_manager = DiskKeyFileManager::default();
|
||||
let existing_accounts = dst.load()?.into_iter().map(|a| a.address).collect::<HashSet<_>>();
|
||||
let filename = path.file_name().and_then(|n| n.to_str()).map(|f| f.to_owned());
|
||||
let account = fs::File::open(&path)
|
||||
.map_err(Into::into)
|
||||
.and_then(|file| key_manager.read(filename, file))?;
|
||||
let key_manager = DiskKeyFileManager::default();
|
||||
let existing_accounts = dst
|
||||
.load()?
|
||||
.into_iter()
|
||||
.map(|a| a.address)
|
||||
.collect::<HashSet<_>>();
|
||||
let filename = path
|
||||
.file_name()
|
||||
.and_then(|n| n.to_str())
|
||||
.map(|f| f.to_owned());
|
||||
let account = fs::File::open(&path)
|
||||
.map_err(Into::into)
|
||||
.and_then(|file| key_manager.read(filename, file))?;
|
||||
|
||||
let address = account.address.clone();
|
||||
if !existing_accounts.contains(&address) {
|
||||
dst.insert(account)?;
|
||||
}
|
||||
Ok(address)
|
||||
let address = account.address.clone();
|
||||
if !existing_accounts.contains(&address) {
|
||||
dst.insert(account)?;
|
||||
}
|
||||
Ok(address)
|
||||
}
|
||||
|
||||
/// Import all accounts from one directory to the other.
|
||||
pub fn import_accounts(src: &dyn KeyDirectory, dst: &dyn KeyDirectory) -> Result<Vec<Address>, Error> {
|
||||
let accounts = src.load()?;
|
||||
let existing_accounts = dst.load()?.into_iter()
|
||||
.map(|a| a.address)
|
||||
.collect::<HashSet<_>>();
|
||||
pub fn import_accounts(
|
||||
src: &dyn KeyDirectory,
|
||||
dst: &dyn KeyDirectory,
|
||||
) -> Result<Vec<Address>, Error> {
|
||||
let accounts = src.load()?;
|
||||
let existing_accounts = dst
|
||||
.load()?
|
||||
.into_iter()
|
||||
.map(|a| a.address)
|
||||
.collect::<HashSet<_>>();
|
||||
|
||||
accounts.into_iter()
|
||||
.filter(|a| !existing_accounts.contains(&a.address))
|
||||
.map(|a| {
|
||||
let address = a.address.clone();
|
||||
dst.insert(a)?;
|
||||
Ok(address)
|
||||
}).collect()
|
||||
}
|
||||
|
||||
/// Provide a `HashSet` of all accounts available for import from the Geth keystore.
|
||||
pub fn read_geth_accounts(testnet: bool) -> Vec<Address> {
|
||||
RootDiskDirectory::at(dir::geth(testnet))
|
||||
.load()
|
||||
.map(|d| d.into_iter().map(|a| a.address).collect())
|
||||
.unwrap_or_else(|_| Vec::new())
|
||||
}
|
||||
|
||||
/// Import specific `desired` accounts from the Geth keystore into `dst`.
|
||||
pub fn import_geth_accounts(dst: &dyn KeyDirectory, desired: HashSet<Address>, testnet: bool) -> Result<Vec<Address>, Error> {
|
||||
let src = RootDiskDirectory::at(dir::geth(testnet));
|
||||
let accounts = src.load()?;
|
||||
let existing_accounts = dst.load()?.into_iter().map(|a| a.address).collect::<HashSet<_>>();
|
||||
|
||||
accounts.into_iter()
|
||||
.filter(|a| !existing_accounts.contains(&a.address))
|
||||
.filter(|a| desired.contains(&a.address))
|
||||
.map(|a| {
|
||||
let address = a.address.clone();
|
||||
dst.insert(a)?;
|
||||
Ok(address)
|
||||
}).collect()
|
||||
accounts
|
||||
.into_iter()
|
||||
.filter(|a| !existing_accounts.contains(&a.address))
|
||||
.map(|a| {
|
||||
let address = a.address.clone();
|
||||
dst.insert(a)?;
|
||||
Ok(address)
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
@@ -1,74 +1,82 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use rustc_hex::{FromHex, FromHexError, ToHex};
|
||||
use serde::{de::Error, Deserialize, Deserializer, Serialize, Serializer};
|
||||
use std::{ops, str};
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
use serde::de::Error;
|
||||
use rustc_hex::{ToHex, FromHex, FromHexError};
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct Bytes(Vec<u8>);
|
||||
|
||||
impl ops::Deref for Bytes {
|
||||
type Target = [u8];
|
||||
type Target = [u8];
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.0
|
||||
}
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Deserialize<'a> for Bytes {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where D: Deserializer<'a>
|
||||
{
|
||||
let s = String::deserialize(deserializer)?;
|
||||
let data = s.from_hex().map_err(|e| Error::custom(format!("Invalid hex value {}", e)))?;
|
||||
Ok(Bytes(data))
|
||||
}
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: Deserializer<'a>,
|
||||
{
|
||||
let s = String::deserialize(deserializer)?;
|
||||
let data = s
|
||||
.from_hex()
|
||||
.map_err(|e| Error::custom(format!("Invalid hex value {}", e)))?;
|
||||
Ok(Bytes(data))
|
||||
}
|
||||
}
|
||||
|
||||
impl Serialize for Bytes {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where S: Serializer {
|
||||
serializer.serialize_str(&self.0.to_hex::<String>())
|
||||
}
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
serializer.serialize_str(&self.0.to_hex())
|
||||
}
|
||||
}
|
||||
|
||||
impl str::FromStr for Bytes {
|
||||
type Err = FromHexError;
|
||||
type Err = FromHexError;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
s.from_hex().map(Bytes)
|
||||
}
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
s.from_hex().map(Bytes)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&'static str> for Bytes {
|
||||
fn from(s: &'static str) -> Self {
|
||||
s.parse().expect(&format!("invalid string literal for {}: '{}'", stringify!(Self), s))
|
||||
}
|
||||
fn from(s: &'static str) -> Self {
|
||||
s.parse().expect(&format!(
|
||||
"invalid string literal for {}: '{}'",
|
||||
stringify!(Self),
|
||||
s
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Vec<u8>> for Bytes {
|
||||
fn from(v: Vec<u8>) -> Self {
|
||||
Bytes(v)
|
||||
}
|
||||
fn from(v: Vec<u8>) -> Self {
|
||||
Bytes(v)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Bytes> for Vec<u8> {
|
||||
fn from(b: Bytes) -> Self {
|
||||
b.0
|
||||
}
|
||||
fn from(b: Bytes) -> Self {
|
||||
b.0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,96 +1,112 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::fmt;
|
||||
use serde::{Serialize, Serializer, Deserialize, Deserializer};
|
||||
use serde::de::{Visitor, Error as SerdeError};
|
||||
use super::{Error, H128};
|
||||
use serde::{
|
||||
de::{Error as SerdeError, Visitor},
|
||||
Deserialize, Deserializer, Serialize, Serializer,
|
||||
};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum CipherSer {
|
||||
Aes128Ctr,
|
||||
Aes128Ctr,
|
||||
}
|
||||
|
||||
impl Serialize for CipherSer {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where S: Serializer {
|
||||
match *self {
|
||||
CipherSer::Aes128Ctr => serializer.serialize_str("aes-128-ctr"),
|
||||
}
|
||||
}
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
match *self {
|
||||
CipherSer::Aes128Ctr => serializer.serialize_str("aes-128-ctr"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Deserialize<'a> for CipherSer {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where D: Deserializer<'a> {
|
||||
deserializer.deserialize_any(CipherSerVisitor)
|
||||
}
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: Deserializer<'a>,
|
||||
{
|
||||
deserializer.deserialize_any(CipherSerVisitor)
|
||||
}
|
||||
}
|
||||
|
||||
struct CipherSerVisitor;
|
||||
|
||||
impl<'a> Visitor<'a> for CipherSerVisitor {
|
||||
type Value = CipherSer;
|
||||
type Value = CipherSer;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(formatter, "a valid cipher identifier")
|
||||
}
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(formatter, "a valid cipher identifier")
|
||||
}
|
||||
|
||||
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> where E: SerdeError {
|
||||
match value {
|
||||
"aes-128-ctr" => Ok(CipherSer::Aes128Ctr),
|
||||
_ => Err(SerdeError::custom(Error::UnsupportedCipher))
|
||||
}
|
||||
}
|
||||
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
|
||||
where
|
||||
E: SerdeError,
|
||||
{
|
||||
match value {
|
||||
"aes-128-ctr" => Ok(CipherSer::Aes128Ctr),
|
||||
_ => Err(SerdeError::custom(Error::UnsupportedCipher)),
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_string<E>(self, value: String) -> Result<Self::Value, E> where E: SerdeError {
|
||||
self.visit_str(value.as_ref())
|
||||
}
|
||||
fn visit_string<E>(self, value: String) -> Result<Self::Value, E>
|
||||
where
|
||||
E: SerdeError,
|
||||
{
|
||||
self.visit_str(value.as_ref())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Aes128Ctr {
|
||||
pub iv: H128,
|
||||
pub iv: H128,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum CipherSerParams {
|
||||
Aes128Ctr(Aes128Ctr),
|
||||
Aes128Ctr(Aes128Ctr),
|
||||
}
|
||||
|
||||
impl Serialize for CipherSerParams {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where S: Serializer {
|
||||
match *self {
|
||||
CipherSerParams::Aes128Ctr(ref params) => params.serialize(serializer),
|
||||
}
|
||||
}
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
match *self {
|
||||
CipherSerParams::Aes128Ctr(ref params) => params.serialize(serializer),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Deserialize<'a> for CipherSerParams {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where D: Deserializer<'a> {
|
||||
Aes128Ctr::deserialize(deserializer)
|
||||
.map(CipherSerParams::Aes128Ctr)
|
||||
.map_err(|_| Error::InvalidCipherParams)
|
||||
.map_err(SerdeError::custom)
|
||||
}
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: Deserializer<'a>,
|
||||
{
|
||||
Aes128Ctr::deserialize(deserializer)
|
||||
.map(CipherSerParams::Aes128Ctr)
|
||||
.map_err(|_| Error::InvalidCipherParams)
|
||||
.map_err(SerdeError::custom)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum Cipher {
|
||||
Aes128Ctr(Aes128Ctr),
|
||||
Aes128Ctr(Aes128Ctr),
|
||||
}
|
||||
|
||||
@@ -1,194 +1,218 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::{fmt, str};
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
use serde::ser::SerializeStruct;
|
||||
use serde::de::{Visitor, MapAccess, Error};
|
||||
use super::{Bytes, Cipher, CipherSer, CipherSerParams, Kdf, KdfSer, KdfSerParams, H256};
|
||||
use serde::{
|
||||
de::{Error, MapAccess, Visitor},
|
||||
ser::SerializeStruct,
|
||||
Deserialize, Deserializer, Serialize, Serializer,
|
||||
};
|
||||
use serde_json;
|
||||
use super::{Cipher, CipherSer, CipherSerParams, Kdf, KdfSer, KdfSerParams, H256, Bytes};
|
||||
use std::{fmt, str};
|
||||
|
||||
pub type CipherText = Bytes;
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct Crypto {
|
||||
pub cipher: Cipher,
|
||||
pub ciphertext: CipherText,
|
||||
pub kdf: Kdf,
|
||||
pub mac: H256,
|
||||
pub cipher: Cipher,
|
||||
pub ciphertext: CipherText,
|
||||
pub kdf: Kdf,
|
||||
pub mac: H256,
|
||||
}
|
||||
|
||||
impl str::FromStr for Crypto {
|
||||
type Err = serde_json::error::Error;
|
||||
type Err = serde_json::error::Error;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
serde_json::from_str(s)
|
||||
}
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
serde_json::from_str(s)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Crypto> for String {
|
||||
fn from(c: Crypto) -> Self {
|
||||
serde_json::to_string(&c).expect("Serialization cannot fail, because all crypto keys are strings")
|
||||
}
|
||||
fn from(c: Crypto) -> Self {
|
||||
serde_json::to_string(&c)
|
||||
.expect("serialization cannot fail, cause all crypto keys are strings")
|
||||
}
|
||||
}
|
||||
|
||||
enum CryptoField {
|
||||
Cipher,
|
||||
CipherParams,
|
||||
CipherText,
|
||||
Kdf,
|
||||
KdfParams,
|
||||
Mac,
|
||||
Version,
|
||||
Cipher,
|
||||
CipherParams,
|
||||
CipherText,
|
||||
Kdf,
|
||||
KdfParams,
|
||||
Mac,
|
||||
Version,
|
||||
}
|
||||
|
||||
impl<'a> Deserialize<'a> for CryptoField {
|
||||
fn deserialize<D>(deserializer: D) -> Result<CryptoField, D::Error>
|
||||
where D: Deserializer<'a>
|
||||
{
|
||||
deserializer.deserialize_any(CryptoFieldVisitor)
|
||||
}
|
||||
fn deserialize<D>(deserializer: D) -> Result<CryptoField, D::Error>
|
||||
where
|
||||
D: Deserializer<'a>,
|
||||
{
|
||||
deserializer.deserialize_any(CryptoFieldVisitor)
|
||||
}
|
||||
}
|
||||
|
||||
struct CryptoFieldVisitor;
|
||||
|
||||
impl<'a> Visitor<'a> for CryptoFieldVisitor {
|
||||
type Value = CryptoField;
|
||||
type Value = CryptoField;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(formatter, "a valid crypto struct description")
|
||||
}
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(formatter, "a valid crypto struct description")
|
||||
}
|
||||
|
||||
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
|
||||
where E: Error
|
||||
{
|
||||
match value {
|
||||
"cipher" => Ok(CryptoField::Cipher),
|
||||
"cipherparams" => Ok(CryptoField::CipherParams),
|
||||
"ciphertext" => Ok(CryptoField::CipherText),
|
||||
"kdf" => Ok(CryptoField::Kdf),
|
||||
"kdfparams" => Ok(CryptoField::KdfParams),
|
||||
"mac" => Ok(CryptoField::Mac),
|
||||
"version" => Ok(CryptoField::Version),
|
||||
_ => Err(Error::custom(format!("Unknown field: '{}'", value))),
|
||||
}
|
||||
}
|
||||
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
|
||||
where
|
||||
E: Error,
|
||||
{
|
||||
match value {
|
||||
"cipher" => Ok(CryptoField::Cipher),
|
||||
"cipherparams" => Ok(CryptoField::CipherParams),
|
||||
"ciphertext" => Ok(CryptoField::CipherText),
|
||||
"kdf" => Ok(CryptoField::Kdf),
|
||||
"kdfparams" => Ok(CryptoField::KdfParams),
|
||||
"mac" => Ok(CryptoField::Mac),
|
||||
"version" => Ok(CryptoField::Version),
|
||||
_ => Err(Error::custom(format!("Unknown field: '{}'", value))),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Deserialize<'a> for Crypto {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Crypto, D::Error>
|
||||
where D: Deserializer<'a>
|
||||
{
|
||||
static FIELDS: &'static [&'static str] = &["id", "version", "crypto", "Crypto", "address"];
|
||||
deserializer.deserialize_struct("Crypto", FIELDS, CryptoVisitor)
|
||||
}
|
||||
fn deserialize<D>(deserializer: D) -> Result<Crypto, D::Error>
|
||||
where
|
||||
D: Deserializer<'a>,
|
||||
{
|
||||
static FIELDS: &'static [&'static str] = &["id", "version", "crypto", "Crypto", "address"];
|
||||
deserializer.deserialize_struct("Crypto", FIELDS, CryptoVisitor)
|
||||
}
|
||||
}
|
||||
|
||||
struct CryptoVisitor;
|
||||
|
||||
impl<'a> Visitor<'a> for CryptoVisitor {
|
||||
type Value = Crypto;
|
||||
type Value = Crypto;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(formatter, "a valid vault crypto object")
|
||||
}
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(formatter, "a valid vault crypto object")
|
||||
}
|
||||
|
||||
fn visit_map<V>(self, mut visitor: V) -> Result<Self::Value, V::Error>
|
||||
where V: MapAccess<'a>
|
||||
{
|
||||
let mut cipher = None;
|
||||
let mut cipherparams = None;
|
||||
let mut ciphertext = None;
|
||||
let mut kdf = None;
|
||||
let mut kdfparams = None;
|
||||
let mut mac = None;
|
||||
fn visit_map<V>(self, mut visitor: V) -> Result<Self::Value, V::Error>
|
||||
where
|
||||
V: MapAccess<'a>,
|
||||
{
|
||||
let mut cipher = None;
|
||||
let mut cipherparams = None;
|
||||
let mut ciphertext = None;
|
||||
let mut kdf = None;
|
||||
let mut kdfparams = None;
|
||||
let mut mac = None;
|
||||
|
||||
loop {
|
||||
match visitor.next_key()? {
|
||||
Some(CryptoField::Cipher) => { cipher = Some(visitor.next_value()?); }
|
||||
Some(CryptoField::CipherParams) => { cipherparams = Some(visitor.next_value()?); }
|
||||
Some(CryptoField::CipherText) => { ciphertext = Some(visitor.next_value()?); }
|
||||
Some(CryptoField::Kdf) => { kdf = Some(visitor.next_value()?); }
|
||||
Some(CryptoField::KdfParams) => { kdfparams = Some(visitor.next_value()?); }
|
||||
Some(CryptoField::Mac) => { mac = Some(visitor.next_value()?); }
|
||||
// skip not required version field (it appears in pyethereum generated keystores)
|
||||
Some(CryptoField::Version) => { visitor.next_value().unwrap_or(()) }
|
||||
None => { break; }
|
||||
}
|
||||
}
|
||||
loop {
|
||||
match visitor.next_key()? {
|
||||
Some(CryptoField::Cipher) => {
|
||||
cipher = Some(visitor.next_value()?);
|
||||
}
|
||||
Some(CryptoField::CipherParams) => {
|
||||
cipherparams = Some(visitor.next_value()?);
|
||||
}
|
||||
Some(CryptoField::CipherText) => {
|
||||
ciphertext = Some(visitor.next_value()?);
|
||||
}
|
||||
Some(CryptoField::Kdf) => {
|
||||
kdf = Some(visitor.next_value()?);
|
||||
}
|
||||
Some(CryptoField::KdfParams) => {
|
||||
kdfparams = Some(visitor.next_value()?);
|
||||
}
|
||||
Some(CryptoField::Mac) => {
|
||||
mac = Some(visitor.next_value()?);
|
||||
}
|
||||
// skip not required version field (it appears in pyethereum generated keystores)
|
||||
Some(CryptoField::Version) => visitor.next_value().unwrap_or(()),
|
||||
None => {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let cipher = match (cipher, cipherparams) {
|
||||
(Some(CipherSer::Aes128Ctr), Some(CipherSerParams::Aes128Ctr(params))) => Cipher::Aes128Ctr(params),
|
||||
(None, _) => return Err(V::Error::missing_field("cipher")),
|
||||
(Some(_), None) => return Err(V::Error::missing_field("cipherparams")),
|
||||
};
|
||||
let cipher = match (cipher, cipherparams) {
|
||||
(Some(CipherSer::Aes128Ctr), Some(CipherSerParams::Aes128Ctr(params))) => {
|
||||
Cipher::Aes128Ctr(params)
|
||||
}
|
||||
(None, _) => return Err(V::Error::missing_field("cipher")),
|
||||
(Some(_), None) => return Err(V::Error::missing_field("cipherparams")),
|
||||
};
|
||||
|
||||
let ciphertext = match ciphertext {
|
||||
Some(ciphertext) => ciphertext,
|
||||
None => return Err(V::Error::missing_field("ciphertext")),
|
||||
};
|
||||
let ciphertext = match ciphertext {
|
||||
Some(ciphertext) => ciphertext,
|
||||
None => return Err(V::Error::missing_field("ciphertext")),
|
||||
};
|
||||
|
||||
let kdf = match (kdf, kdfparams) {
|
||||
(Some(KdfSer::Pbkdf2), Some(KdfSerParams::Pbkdf2(params))) => Kdf::Pbkdf2(params),
|
||||
(Some(KdfSer::Scrypt), Some(KdfSerParams::Scrypt(params))) => Kdf::Scrypt(params),
|
||||
(Some(_), Some(_)) => return Err(V::Error::custom("Invalid cipherparams")),
|
||||
(None, _) => return Err(V::Error::missing_field("kdf")),
|
||||
(Some(_), None) => return Err(V::Error::missing_field("kdfparams")),
|
||||
};
|
||||
let kdf = match (kdf, kdfparams) {
|
||||
(Some(KdfSer::Pbkdf2), Some(KdfSerParams::Pbkdf2(params))) => Kdf::Pbkdf2(params),
|
||||
(Some(KdfSer::Scrypt), Some(KdfSerParams::Scrypt(params))) => Kdf::Scrypt(params),
|
||||
(Some(_), Some(_)) => return Err(V::Error::custom("Invalid cipherparams")),
|
||||
(None, _) => return Err(V::Error::missing_field("kdf")),
|
||||
(Some(_), None) => return Err(V::Error::missing_field("kdfparams")),
|
||||
};
|
||||
|
||||
let mac = match mac {
|
||||
Some(mac) => mac,
|
||||
None => return Err(V::Error::missing_field("mac")),
|
||||
};
|
||||
let mac = match mac {
|
||||
Some(mac) => mac,
|
||||
None => return Err(V::Error::missing_field("mac")),
|
||||
};
|
||||
|
||||
let result = Crypto {
|
||||
cipher: cipher,
|
||||
ciphertext: ciphertext,
|
||||
kdf: kdf,
|
||||
mac: mac,
|
||||
};
|
||||
let result = Crypto {
|
||||
cipher: cipher,
|
||||
ciphertext: ciphertext,
|
||||
kdf: kdf,
|
||||
mac: mac,
|
||||
};
|
||||
|
||||
Ok(result)
|
||||
}
|
||||
Ok(result)
|
||||
}
|
||||
}
|
||||
|
||||
impl Serialize for Crypto {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where S: Serializer
|
||||
{
|
||||
let mut crypto = serializer.serialize_struct("Crypto", 6)?;
|
||||
match self.cipher {
|
||||
Cipher::Aes128Ctr(ref params) => {
|
||||
crypto.serialize_field("cipher", &CipherSer::Aes128Ctr)?;
|
||||
crypto.serialize_field("cipherparams", params)?;
|
||||
},
|
||||
}
|
||||
crypto.serialize_field("ciphertext", &self.ciphertext)?;
|
||||
match self.kdf {
|
||||
Kdf::Pbkdf2(ref params) => {
|
||||
crypto.serialize_field("kdf", &KdfSer::Pbkdf2)?;
|
||||
crypto.serialize_field("kdfparams", params)?;
|
||||
},
|
||||
Kdf::Scrypt(ref params) => {
|
||||
crypto.serialize_field("kdf", &KdfSer::Scrypt)?;
|
||||
crypto.serialize_field("kdfparams", params)?;
|
||||
},
|
||||
}
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
let mut crypto = serializer.serialize_struct("Crypto", 6)?;
|
||||
match self.cipher {
|
||||
Cipher::Aes128Ctr(ref params) => {
|
||||
crypto.serialize_field("cipher", &CipherSer::Aes128Ctr)?;
|
||||
crypto.serialize_field("cipherparams", params)?;
|
||||
}
|
||||
}
|
||||
crypto.serialize_field("ciphertext", &self.ciphertext)?;
|
||||
match self.kdf {
|
||||
Kdf::Pbkdf2(ref params) => {
|
||||
crypto.serialize_field("kdf", &KdfSer::Pbkdf2)?;
|
||||
crypto.serialize_field("kdfparams", params)?;
|
||||
}
|
||||
Kdf::Scrypt(ref params) => {
|
||||
crypto.serialize_field("kdf", &KdfSer::Scrypt)?;
|
||||
crypto.serialize_field("kdfparams", params)?;
|
||||
}
|
||||
}
|
||||
|
||||
crypto.serialize_field("mac", &self.mac)?;
|
||||
crypto.end()
|
||||
}
|
||||
crypto.serialize_field("mac", &self.mac)?;
|
||||
crypto.end()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,50 +1,50 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum Error {
|
||||
UnsupportedCipher,
|
||||
InvalidCipherParams,
|
||||
UnsupportedKdf,
|
||||
InvalidUuid,
|
||||
UnsupportedVersion,
|
||||
InvalidCiphertext,
|
||||
InvalidH256,
|
||||
InvalidPrf,
|
||||
UnsupportedCipher,
|
||||
InvalidCipherParams,
|
||||
UnsupportedKdf,
|
||||
InvalidUuid,
|
||||
UnsupportedVersion,
|
||||
InvalidCiphertext,
|
||||
InvalidH256,
|
||||
InvalidPrf,
|
||||
}
|
||||
|
||||
impl fmt::Display for Error {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
match *self {
|
||||
Error::InvalidUuid => write!(f, "Invalid Uuid"),
|
||||
Error::UnsupportedVersion => write!(f, "Unsupported version"),
|
||||
Error::UnsupportedKdf => write!(f, "Unsupported kdf"),
|
||||
Error::InvalidCiphertext => write!(f, "Invalid ciphertext"),
|
||||
Error::UnsupportedCipher => write!(f, "Unsupported cipher"),
|
||||
Error::InvalidCipherParams => write!(f, "Invalid cipher params"),
|
||||
Error::InvalidH256 => write!(f, "Invalid hash"),
|
||||
Error::InvalidPrf => write!(f, "Invalid prf"),
|
||||
}
|
||||
}
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
match *self {
|
||||
Error::InvalidUuid => write!(f, "Invalid Uuid"),
|
||||
Error::UnsupportedVersion => write!(f, "Unsupported version"),
|
||||
Error::UnsupportedKdf => write!(f, "Unsupported kdf"),
|
||||
Error::InvalidCiphertext => write!(f, "Invalid ciphertext"),
|
||||
Error::UnsupportedCipher => write!(f, "Unsupported cipher"),
|
||||
Error::InvalidCipherParams => write!(f, "Invalid cipher params"),
|
||||
Error::InvalidH256 => write!(f, "Invalid hash"),
|
||||
Error::InvalidPrf => write!(f, "Invalid prf"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<String> for Error {
|
||||
fn into(self) -> String {
|
||||
format!("{}", self)
|
||||
}
|
||||
fn into(self) -> String {
|
||||
format!("{}", self)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,118 +1,133 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::{ops, fmt, str};
|
||||
use rustc_hex::{FromHex, ToHex};
|
||||
use serde::{Serialize, Serializer, Deserialize, Deserializer};
|
||||
use serde::de::{Visitor, Error as SerdeError};
|
||||
use super::Error;
|
||||
use rustc_hex::{FromHex, ToHex};
|
||||
use serde::{
|
||||
de::{Error as SerdeError, Visitor},
|
||||
Deserialize, Deserializer, Serialize, Serializer,
|
||||
};
|
||||
use std::{fmt, ops, str};
|
||||
|
||||
macro_rules! impl_hash {
|
||||
($name: ident, $size: expr) => {
|
||||
pub struct $name([u8; $size]);
|
||||
($name: ident, $size: expr) => {
|
||||
pub struct $name([u8; $size]);
|
||||
|
||||
impl fmt::Debug for $name {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
let self_ref: &[u8] = &self.0;
|
||||
write!(f, "{:?}", self_ref)
|
||||
}
|
||||
}
|
||||
impl fmt::Debug for $name {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
let self_ref: &[u8] = &self.0;
|
||||
write!(f, "{:?}", self_ref)
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq for $name {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
let self_ref: &[u8] = &self.0;
|
||||
let other_ref: &[u8] = &other.0;
|
||||
self_ref == other_ref
|
||||
}
|
||||
}
|
||||
impl PartialEq for $name {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
let self_ref: &[u8] = &self.0;
|
||||
let other_ref: &[u8] = &other.0;
|
||||
self_ref == other_ref
|
||||
}
|
||||
}
|
||||
|
||||
impl ops::Deref for $name {
|
||||
type Target = [u8];
|
||||
impl ops::Deref for $name {
|
||||
type Target = [u8];
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl Serialize for $name {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where S: Serializer
|
||||
{
|
||||
serializer.serialize_str(&self.0.to_hex::<String>())
|
||||
}
|
||||
}
|
||||
impl Serialize for $name {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
serializer.serialize_str(&self.0.to_hex())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Deserialize<'a> for $name {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where D: Deserializer<'a> {
|
||||
struct HashVisitor;
|
||||
impl<'a> Deserialize<'a> for $name {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: Deserializer<'a>,
|
||||
{
|
||||
struct HashVisitor;
|
||||
|
||||
impl<'b> Visitor<'b> for HashVisitor {
|
||||
type Value = $name;
|
||||
impl<'b> Visitor<'b> for HashVisitor {
|
||||
type Value = $name;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(formatter, "a hex-encoded {}", stringify!($name))
|
||||
}
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(formatter, "a hex-encoded {}", stringify!($name))
|
||||
}
|
||||
|
||||
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> where E: SerdeError {
|
||||
value.parse().map_err(SerdeError::custom)
|
||||
}
|
||||
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
|
||||
where
|
||||
E: SerdeError,
|
||||
{
|
||||
value.parse().map_err(SerdeError::custom)
|
||||
}
|
||||
|
||||
fn visit_string<E>(self, value: String) -> Result<Self::Value, E> where E: SerdeError {
|
||||
self.visit_str(value.as_ref())
|
||||
}
|
||||
}
|
||||
fn visit_string<E>(self, value: String) -> Result<Self::Value, E>
|
||||
where
|
||||
E: SerdeError,
|
||||
{
|
||||
self.visit_str(value.as_ref())
|
||||
}
|
||||
}
|
||||
|
||||
deserializer.deserialize_any(HashVisitor)
|
||||
}
|
||||
}
|
||||
deserializer.deserialize_any(HashVisitor)
|
||||
}
|
||||
}
|
||||
|
||||
impl str::FromStr for $name {
|
||||
type Err = Error;
|
||||
impl str::FromStr for $name {
|
||||
type Err = Error;
|
||||
|
||||
fn from_str(value: &str) -> Result<Self, Self::Err> {
|
||||
match value.from_hex::<Vec<u8>>() {
|
||||
Ok(ref hex) if hex.len() == $size => {
|
||||
let mut hash = [0u8; $size];
|
||||
hash.clone_from_slice(hex);
|
||||
Ok($name(hash))
|
||||
}
|
||||
_ => Err(Error::InvalidH256),
|
||||
}
|
||||
}
|
||||
}
|
||||
fn from_str(value: &str) -> Result<Self, Self::Err> {
|
||||
match value.from_hex() {
|
||||
Ok(ref hex) if hex.len() == $size => {
|
||||
let mut hash = [0u8; $size];
|
||||
hash.clone_from_slice(hex);
|
||||
Ok($name(hash))
|
||||
}
|
||||
_ => Err(Error::InvalidH256),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&'static str> for $name {
|
||||
fn from(s: &'static str) -> Self {
|
||||
s.parse().expect(&format!("invalid string literal for {}: '{}'", stringify!($name), s))
|
||||
}
|
||||
}
|
||||
impl From<&'static str> for $name {
|
||||
fn from(s: &'static str) -> Self {
|
||||
s.parse().expect(&format!(
|
||||
"invalid string literal for {}: '{}'",
|
||||
stringify!($name),
|
||||
s
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<[u8; $size]> for $name {
|
||||
fn from(bytes: [u8; $size]) -> Self {
|
||||
$name(bytes)
|
||||
}
|
||||
}
|
||||
impl From<[u8; $size]> for $name {
|
||||
fn from(bytes: [u8; $size]) -> Self {
|
||||
$name(bytes)
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<[u8; $size]> for $name {
|
||||
fn into(self) -> [u8; $size] {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
}
|
||||
impl Into<[u8; $size]> for $name {
|
||||
fn into(self) -> [u8; $size] {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
impl_hash!(H128, 16);
|
||||
|
||||
@@ -1,154 +1,179 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Universaly unique identifier.
|
||||
|
||||
use std::{fmt, str};
|
||||
use rustc_hex::{ToHex, FromHex};
|
||||
use serde::{Deserialize, Serialize, Deserializer, Serializer};
|
||||
use serde::de::{Visitor, Error as SerdeError};
|
||||
use super::Error;
|
||||
use rustc_hex::{FromHex, ToHex};
|
||||
use serde::{
|
||||
de::{Error as SerdeError, Visitor},
|
||||
Deserialize, Deserializer, Serialize, Serializer,
|
||||
};
|
||||
use std::{fmt, str};
|
||||
|
||||
/// Universaly unique identifier.
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct Uuid([u8; 16]);
|
||||
|
||||
impl From<[u8; 16]> for Uuid {
|
||||
fn from(uuid: [u8; 16]) -> Self {
|
||||
Uuid(uuid)
|
||||
}
|
||||
fn from(uuid: [u8; 16]) -> Self {
|
||||
Uuid(uuid)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Into<String> for &'a Uuid {
|
||||
fn into(self) -> String {
|
||||
let d1 = &self.0[0..4];
|
||||
let d2 = &self.0[4..6];
|
||||
let d3 = &self.0[6..8];
|
||||
let d4 = &self.0[8..10];
|
||||
let d5 = &self.0[10..16];
|
||||
[d1, d2, d3, d4, d5].iter().map(|d| d.to_hex()).collect::<Vec<String>>().join("-")
|
||||
}
|
||||
fn into(self) -> String {
|
||||
let d1 = &self.0[0..4];
|
||||
let d2 = &self.0[4..6];
|
||||
let d3 = &self.0[6..8];
|
||||
let d4 = &self.0[8..10];
|
||||
let d5 = &self.0[10..16];
|
||||
[d1, d2, d3, d4, d5]
|
||||
.iter()
|
||||
.map(|d| d.to_hex())
|
||||
.collect::<Vec<String>>()
|
||||
.join("-")
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<String> for Uuid {
|
||||
fn into(self) -> String {
|
||||
Into::into(&self)
|
||||
}
|
||||
fn into(self) -> String {
|
||||
Into::into(&self)
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<[u8; 16]> for Uuid {
|
||||
fn into(self) -> [u8; 16] {
|
||||
self.0
|
||||
}
|
||||
fn into(self) -> [u8; 16] {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Uuid {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
let s: String = (self as &Uuid).into();
|
||||
write!(f, "{}", s)
|
||||
}
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
let s: String = (self as &Uuid).into();
|
||||
write!(f, "{}", s)
|
||||
}
|
||||
}
|
||||
|
||||
fn copy_into(from: &str, into: &mut [u8]) -> Result<(), Error> {
|
||||
let from: Vec<u8> = from.from_hex().map_err(|_| Error::InvalidUuid)?;
|
||||
let from = from.from_hex().map_err(|_| Error::InvalidUuid)?;
|
||||
|
||||
if from.len() != into.len() {
|
||||
return Err(Error::InvalidUuid);
|
||||
}
|
||||
if from.len() != into.len() {
|
||||
return Err(Error::InvalidUuid);
|
||||
}
|
||||
|
||||
into.copy_from_slice(&from);
|
||||
Ok(())
|
||||
into.copy_from_slice(&from);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
impl str::FromStr for Uuid {
|
||||
type Err = Error;
|
||||
type Err = Error;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let parts: Vec<&str> = s.split("-").collect();
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let parts: Vec<&str> = s.split("-").collect();
|
||||
|
||||
if parts.len() != 5 {
|
||||
return Err(Error::InvalidUuid);
|
||||
}
|
||||
if parts.len() != 5 {
|
||||
return Err(Error::InvalidUuid);
|
||||
}
|
||||
|
||||
let mut uuid = [0u8; 16];
|
||||
let mut uuid = [0u8; 16];
|
||||
|
||||
copy_into(parts[0], &mut uuid[0..4])?;
|
||||
copy_into(parts[1], &mut uuid[4..6])?;
|
||||
copy_into(parts[2], &mut uuid[6..8])?;
|
||||
copy_into(parts[3], &mut uuid[8..10])?;
|
||||
copy_into(parts[4], &mut uuid[10..16])?;
|
||||
copy_into(parts[0], &mut uuid[0..4])?;
|
||||
copy_into(parts[1], &mut uuid[4..6])?;
|
||||
copy_into(parts[2], &mut uuid[6..8])?;
|
||||
copy_into(parts[3], &mut uuid[8..10])?;
|
||||
copy_into(parts[4], &mut uuid[10..16])?;
|
||||
|
||||
Ok(Uuid(uuid))
|
||||
}
|
||||
Ok(Uuid(uuid))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&'static str> for Uuid {
|
||||
fn from(s: &'static str) -> Self {
|
||||
s.parse().expect(&format!("invalid string literal for {}: '{}'", stringify!(Self), s))
|
||||
}
|
||||
fn from(s: &'static str) -> Self {
|
||||
s.parse().expect(&format!(
|
||||
"invalid string literal for {}: '{}'",
|
||||
stringify!(Self),
|
||||
s
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
impl Serialize for Uuid {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where S: Serializer {
|
||||
let s: String = self.into();
|
||||
serializer.serialize_str(&s)
|
||||
}
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
let s: String = self.into();
|
||||
serializer.serialize_str(&s)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Deserialize<'a> for Uuid {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where D: Deserializer<'a> {
|
||||
deserializer.deserialize_any(UuidVisitor)
|
||||
}
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: Deserializer<'a>,
|
||||
{
|
||||
deserializer.deserialize_any(UuidVisitor)
|
||||
}
|
||||
}
|
||||
|
||||
struct UuidVisitor;
|
||||
|
||||
impl<'a> Visitor<'a> for UuidVisitor {
|
||||
type Value = Uuid;
|
||||
type Value = Uuid;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(formatter, "a valid hex-encoded UUID")
|
||||
}
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(formatter, "a valid hex-encoded UUID")
|
||||
}
|
||||
|
||||
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> where E: SerdeError {
|
||||
value.parse().map_err(SerdeError::custom)
|
||||
}
|
||||
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
|
||||
where
|
||||
E: SerdeError,
|
||||
{
|
||||
value.parse().map_err(SerdeError::custom)
|
||||
}
|
||||
|
||||
fn visit_string<E>(self, value: String) -> Result<Self::Value, E> where E: SerdeError {
|
||||
self.visit_str(value.as_ref())
|
||||
}
|
||||
fn visit_string<E>(self, value: String) -> Result<Self::Value, E>
|
||||
where
|
||||
E: SerdeError,
|
||||
{
|
||||
self.visit_str(value.as_ref())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::Uuid;
|
||||
use super::Uuid;
|
||||
|
||||
#[test]
|
||||
fn uuid_from_str() {
|
||||
let uuid: Uuid = "3198bc9c-6672-5ab3-d995-4942343ae5b6".into();
|
||||
assert_eq!(uuid, Uuid::from([0x31, 0x98, 0xbc, 0x9c, 0x66, 0x72, 0x5a, 0xb3, 0xd9, 0x95, 0x49, 0x42, 0x34, 0x3a, 0xe5, 0xb6]));
|
||||
}
|
||||
#[test]
|
||||
fn uuid_from_str() {
|
||||
let uuid: Uuid = "3198bc9c-6672-5ab3-d995-4942343ae5b6".into();
|
||||
assert_eq!(
|
||||
uuid,
|
||||
Uuid::from([
|
||||
0x31, 0x98, 0xbc, 0x9c, 0x66, 0x72, 0x5a, 0xb3, 0xd9, 0x95, 0x49, 0x42, 0x34, 0x3a,
|
||||
0xe5, 0xb6
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn uuid_from_and_to_str() {
|
||||
let from = "3198bc9c-6672-5ab3-d995-4942343ae5b6";
|
||||
let uuid: Uuid = from.into();
|
||||
let to: String = uuid.into();
|
||||
assert_eq!(from, &to);
|
||||
}
|
||||
#[test]
|
||||
fn uuid_from_and_to_str() {
|
||||
let from = "3198bc9c-6672-5ab3-d995-4942343ae5b6";
|
||||
let uuid: Uuid = from.into();
|
||||
let to: String = uuid.into();
|
||||
assert_eq!(from, &to);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,159 +1,186 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::fmt;
|
||||
use serde::{Serialize, Serializer, Deserialize, Deserializer};
|
||||
use serde::de::{Visitor, Error as SerdeError};
|
||||
use super::{Error, Bytes};
|
||||
use super::{Bytes, Error};
|
||||
use serde::{
|
||||
de::{Error as SerdeError, Visitor},
|
||||
Deserialize, Deserializer, Serialize, Serializer,
|
||||
};
|
||||
use std::{fmt, num::NonZeroU32};
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum KdfSer {
|
||||
Pbkdf2,
|
||||
Scrypt,
|
||||
Pbkdf2,
|
||||
Scrypt,
|
||||
}
|
||||
|
||||
impl Serialize for KdfSer {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where S: Serializer {
|
||||
match *self {
|
||||
KdfSer::Pbkdf2 => serializer.serialize_str("pbkdf2"),
|
||||
KdfSer::Scrypt => serializer.serialize_str("scrypt"),
|
||||
}
|
||||
}
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
match *self {
|
||||
KdfSer::Pbkdf2 => serializer.serialize_str("pbkdf2"),
|
||||
KdfSer::Scrypt => serializer.serialize_str("scrypt"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Deserialize<'a> for KdfSer {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where D: Deserializer<'a> {
|
||||
deserializer.deserialize_any(KdfSerVisitor)
|
||||
}
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: Deserializer<'a>,
|
||||
{
|
||||
deserializer.deserialize_any(KdfSerVisitor)
|
||||
}
|
||||
}
|
||||
|
||||
struct KdfSerVisitor;
|
||||
|
||||
impl<'a> Visitor<'a> for KdfSerVisitor {
|
||||
type Value = KdfSer;
|
||||
type Value = KdfSer;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(formatter, "a kdf algorithm identifier")
|
||||
}
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(formatter, "a kdf algorithm identifier")
|
||||
}
|
||||
|
||||
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> where E: SerdeError {
|
||||
match value {
|
||||
"pbkdf2" => Ok(KdfSer::Pbkdf2),
|
||||
"scrypt" => Ok(KdfSer::Scrypt),
|
||||
_ => Err(SerdeError::custom(Error::UnsupportedKdf))
|
||||
}
|
||||
}
|
||||
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
|
||||
where
|
||||
E: SerdeError,
|
||||
{
|
||||
match value {
|
||||
"pbkdf2" => Ok(KdfSer::Pbkdf2),
|
||||
"scrypt" => Ok(KdfSer::Scrypt),
|
||||
_ => Err(SerdeError::custom(Error::UnsupportedKdf)),
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_string<E>(self, value: String) -> Result<Self::Value, E> where E: SerdeError {
|
||||
self.visit_str(value.as_ref())
|
||||
}
|
||||
fn visit_string<E>(self, value: String) -> Result<Self::Value, E>
|
||||
where
|
||||
E: SerdeError,
|
||||
{
|
||||
self.visit_str(value.as_ref())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum Prf {
|
||||
HmacSha256,
|
||||
HmacSha256,
|
||||
}
|
||||
|
||||
impl Serialize for Prf {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where S: Serializer {
|
||||
match *self {
|
||||
Prf::HmacSha256 => serializer.serialize_str("hmac-sha256"),
|
||||
}
|
||||
}
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
match *self {
|
||||
Prf::HmacSha256 => serializer.serialize_str("hmac-sha256"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Deserialize<'a> for Prf {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where D: Deserializer<'a> {
|
||||
deserializer.deserialize_any(PrfVisitor)
|
||||
}
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: Deserializer<'a>,
|
||||
{
|
||||
deserializer.deserialize_any(PrfVisitor)
|
||||
}
|
||||
}
|
||||
|
||||
struct PrfVisitor;
|
||||
|
||||
impl<'a> Visitor<'a> for PrfVisitor {
|
||||
type Value = Prf;
|
||||
type Value = Prf;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(formatter, "a prf algorithm identifier")
|
||||
}
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(formatter, "a prf algorithm identifier")
|
||||
}
|
||||
|
||||
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> where E: SerdeError {
|
||||
match value {
|
||||
"hmac-sha256" => Ok(Prf::HmacSha256),
|
||||
_ => Err(SerdeError::custom(Error::InvalidPrf)),
|
||||
}
|
||||
}
|
||||
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
|
||||
where
|
||||
E: SerdeError,
|
||||
{
|
||||
match value {
|
||||
"hmac-sha256" => Ok(Prf::HmacSha256),
|
||||
_ => Err(SerdeError::custom(Error::InvalidPrf)),
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_string<E>(self, value: String) -> Result<Self::Value, E> where E: SerdeError {
|
||||
self.visit_str(value.as_ref())
|
||||
}
|
||||
fn visit_string<E>(self, value: String) -> Result<Self::Value, E>
|
||||
where
|
||||
E: SerdeError,
|
||||
{
|
||||
self.visit_str(value.as_ref())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Pbkdf2 {
|
||||
pub c: u32,
|
||||
pub dklen: u32,
|
||||
pub prf: Prf,
|
||||
pub salt: Bytes,
|
||||
pub c: NonZeroU32,
|
||||
pub dklen: u32,
|
||||
pub prf: Prf,
|
||||
pub salt: Bytes,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Scrypt {
|
||||
pub dklen: u32,
|
||||
pub p: u32,
|
||||
pub n: u32,
|
||||
pub r: u32,
|
||||
pub salt: Bytes,
|
||||
pub dklen: u32,
|
||||
pub p: u32,
|
||||
pub n: u32,
|
||||
pub r: u32,
|
||||
pub salt: Bytes,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum KdfSerParams {
|
||||
Pbkdf2(Pbkdf2),
|
||||
Scrypt(Scrypt),
|
||||
Pbkdf2(Pbkdf2),
|
||||
Scrypt(Scrypt),
|
||||
}
|
||||
|
||||
impl Serialize for KdfSerParams {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where S: Serializer {
|
||||
match *self {
|
||||
KdfSerParams::Pbkdf2(ref params) => params.serialize(serializer),
|
||||
KdfSerParams::Scrypt(ref params) => params.serialize(serializer),
|
||||
}
|
||||
}
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
match *self {
|
||||
KdfSerParams::Pbkdf2(ref params) => params.serialize(serializer),
|
||||
KdfSerParams::Scrypt(ref params) => params.serialize(serializer),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Deserialize<'a> for KdfSerParams {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where D: Deserializer<'a> {
|
||||
use serde_json::{Value, from_value};
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: Deserializer<'a>,
|
||||
{
|
||||
use serde_json::{from_value, Value};
|
||||
|
||||
let v: Value = Deserialize::deserialize(deserializer)?;
|
||||
let v: Value = Deserialize::deserialize(deserializer)?;
|
||||
|
||||
from_value(v.clone()).map(KdfSerParams::Pbkdf2)
|
||||
.or_else(|_| from_value(v).map(KdfSerParams::Scrypt))
|
||||
.map_err(|_| D::Error::custom("Invalid KDF algorithm"))
|
||||
}
|
||||
from_value(v.clone())
|
||||
.map(KdfSerParams::Pbkdf2)
|
||||
.or_else(|_| from_value(v).map(KdfSerParams::Scrypt))
|
||||
.map_err(|_| D::Error::custom("Invalid KDF algorithm"))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum Kdf {
|
||||
Pbkdf2(Pbkdf2),
|
||||
Scrypt(Scrypt),
|
||||
Pbkdf2(Pbkdf2),
|
||||
Scrypt(Scrypt),
|
||||
}
|
||||
|
||||
@@ -1,195 +1,227 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::fmt;
|
||||
use std::io::{Read, Write};
|
||||
use serde::{Serialize, Serializer, Deserialize, Deserializer};
|
||||
use serde::de::{Error, Visitor, MapAccess, DeserializeOwned};
|
||||
use super::{Crypto, Uuid, Version, H160};
|
||||
use serde::{
|
||||
de::{DeserializeOwned, Error, MapAccess, Visitor},
|
||||
Deserialize, Deserializer, Serialize, Serializer,
|
||||
};
|
||||
use serde_json;
|
||||
use super::{Uuid, Version, Crypto, H160};
|
||||
use std::{
|
||||
fmt,
|
||||
io::{Read, Write},
|
||||
};
|
||||
|
||||
/// Public opaque type representing serializable `KeyFile`.
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct OpaqueKeyFile {
|
||||
key_file: KeyFile
|
||||
key_file: KeyFile,
|
||||
}
|
||||
|
||||
impl Serialize for OpaqueKeyFile {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
|
||||
S: Serializer,
|
||||
{
|
||||
self.key_file.serialize(serializer)
|
||||
}
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
self.key_file.serialize(serializer)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> From<T> for OpaqueKeyFile where T: Into<KeyFile> {
|
||||
fn from(val: T) -> Self {
|
||||
OpaqueKeyFile { key_file: val.into() }
|
||||
}
|
||||
impl<T> From<T> for OpaqueKeyFile
|
||||
where
|
||||
T: Into<KeyFile>,
|
||||
{
|
||||
fn from(val: T) -> Self {
|
||||
OpaqueKeyFile {
|
||||
key_file: val.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize)]
|
||||
pub struct KeyFile {
|
||||
pub id: Uuid,
|
||||
pub version: Version,
|
||||
pub crypto: Crypto,
|
||||
pub address: Option<H160>,
|
||||
pub name: Option<String>,
|
||||
pub meta: Option<String>,
|
||||
pub id: Uuid,
|
||||
pub version: Version,
|
||||
pub crypto: Crypto,
|
||||
pub address: Option<H160>,
|
||||
pub name: Option<String>,
|
||||
pub meta: Option<String>,
|
||||
}
|
||||
|
||||
enum KeyFileField {
|
||||
Id,
|
||||
Version,
|
||||
Crypto,
|
||||
Address,
|
||||
Name,
|
||||
Meta,
|
||||
Id,
|
||||
Version,
|
||||
Crypto,
|
||||
Address,
|
||||
Name,
|
||||
Meta,
|
||||
}
|
||||
|
||||
impl<'a> Deserialize<'a> for KeyFileField {
|
||||
fn deserialize<D>(deserializer: D) -> Result<KeyFileField, D::Error>
|
||||
where D: Deserializer<'a>
|
||||
{
|
||||
deserializer.deserialize_any(KeyFileFieldVisitor)
|
||||
}
|
||||
fn deserialize<D>(deserializer: D) -> Result<KeyFileField, D::Error>
|
||||
where
|
||||
D: Deserializer<'a>,
|
||||
{
|
||||
deserializer.deserialize_any(KeyFileFieldVisitor)
|
||||
}
|
||||
}
|
||||
|
||||
struct KeyFileFieldVisitor;
|
||||
|
||||
impl<'a> Visitor<'a> for KeyFileFieldVisitor {
|
||||
type Value = KeyFileField;
|
||||
type Value = KeyFileField;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(formatter, "a valid key file field")
|
||||
}
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(formatter, "a valid key file field")
|
||||
}
|
||||
|
||||
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
|
||||
where E: Error
|
||||
{
|
||||
match value {
|
||||
"id" => Ok(KeyFileField::Id),
|
||||
"version" => Ok(KeyFileField::Version),
|
||||
"crypto" => Ok(KeyFileField::Crypto),
|
||||
"Crypto" => Ok(KeyFileField::Crypto),
|
||||
"address" => Ok(KeyFileField::Address),
|
||||
"name" => Ok(KeyFileField::Name),
|
||||
"meta" => Ok(KeyFileField::Meta),
|
||||
_ => Err(Error::custom(format!("Unknown field: '{}'", value))),
|
||||
}
|
||||
}
|
||||
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
|
||||
where
|
||||
E: Error,
|
||||
{
|
||||
match value {
|
||||
"id" => Ok(KeyFileField::Id),
|
||||
"version" => Ok(KeyFileField::Version),
|
||||
"crypto" => Ok(KeyFileField::Crypto),
|
||||
"Crypto" => Ok(KeyFileField::Crypto),
|
||||
"address" => Ok(KeyFileField::Address),
|
||||
"name" => Ok(KeyFileField::Name),
|
||||
"meta" => Ok(KeyFileField::Meta),
|
||||
_ => Err(Error::custom(format!("Unknown field: '{}'", value))),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Deserialize<'a> for KeyFile {
|
||||
fn deserialize<D>(deserializer: D) -> Result<KeyFile, D::Error>
|
||||
where D: Deserializer<'a>
|
||||
{
|
||||
static FIELDS: &'static [&'static str] = &["id", "version", "crypto", "Crypto", "address"];
|
||||
deserializer.deserialize_struct("KeyFile", FIELDS, KeyFileVisitor)
|
||||
}
|
||||
fn deserialize<D>(deserializer: D) -> Result<KeyFile, D::Error>
|
||||
where
|
||||
D: Deserializer<'a>,
|
||||
{
|
||||
static FIELDS: &'static [&'static str] = &["id", "version", "crypto", "Crypto", "address"];
|
||||
deserializer.deserialize_struct("KeyFile", FIELDS, KeyFileVisitor)
|
||||
}
|
||||
}
|
||||
|
||||
fn none_if_empty<'a, T>(v: Option<serde_json::Value>) -> Option<T> where
|
||||
T: DeserializeOwned
|
||||
fn none_if_empty<'a, T>(v: Option<serde_json::Value>) -> Option<T>
|
||||
where
|
||||
T: DeserializeOwned,
|
||||
{
|
||||
v.and_then(|v| if v.is_null() {
|
||||
None
|
||||
} else {
|
||||
serde_json::from_value(v).ok()
|
||||
})
|
||||
|
||||
v.and_then(|v| {
|
||||
if v.is_null() {
|
||||
None
|
||||
} else {
|
||||
serde_json::from_value(v).ok()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
struct KeyFileVisitor;
|
||||
impl<'a> Visitor<'a> for KeyFileVisitor {
|
||||
type Value = KeyFile;
|
||||
type Value = KeyFile;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(formatter, "a valid key object")
|
||||
}
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(formatter, "a valid key object")
|
||||
}
|
||||
|
||||
fn visit_map<V>(self, mut visitor: V) -> Result<Self::Value, V::Error>
|
||||
where V: MapAccess<'a>
|
||||
{
|
||||
let mut id = None;
|
||||
let mut version = None;
|
||||
let mut crypto = None;
|
||||
let mut address = None;
|
||||
let mut name = None;
|
||||
let mut meta = None;
|
||||
fn visit_map<V>(self, mut visitor: V) -> Result<Self::Value, V::Error>
|
||||
where
|
||||
V: MapAccess<'a>,
|
||||
{
|
||||
let mut id = None;
|
||||
let mut version = None;
|
||||
let mut crypto = None;
|
||||
let mut address = None;
|
||||
let mut name = None;
|
||||
let mut meta = None;
|
||||
|
||||
loop {
|
||||
match visitor.next_key()? {
|
||||
Some(KeyFileField::Id) => { id = Some(visitor.next_value()?); }
|
||||
Some(KeyFileField::Version) => { version = Some(visitor.next_value()?); }
|
||||
Some(KeyFileField::Crypto) => { crypto = Some(visitor.next_value()?); }
|
||||
Some(KeyFileField::Address) => { address = Some(visitor.next_value()?); }
|
||||
Some(KeyFileField::Name) => { name = none_if_empty(visitor.next_value().ok()) }
|
||||
Some(KeyFileField::Meta) => { meta = none_if_empty(visitor.next_value().ok()) }
|
||||
None => { break; }
|
||||
}
|
||||
}
|
||||
loop {
|
||||
match visitor.next_key()? {
|
||||
Some(KeyFileField::Id) => {
|
||||
id = Some(visitor.next_value()?);
|
||||
}
|
||||
Some(KeyFileField::Version) => {
|
||||
version = Some(visitor.next_value()?);
|
||||
}
|
||||
Some(KeyFileField::Crypto) => {
|
||||
crypto = Some(visitor.next_value()?);
|
||||
}
|
||||
Some(KeyFileField::Address) => {
|
||||
address = Some(visitor.next_value()?);
|
||||
}
|
||||
Some(KeyFileField::Name) => name = none_if_empty(visitor.next_value().ok()),
|
||||
Some(KeyFileField::Meta) => meta = none_if_empty(visitor.next_value().ok()),
|
||||
None => {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let id = match id {
|
||||
Some(id) => id,
|
||||
None => return Err(V::Error::missing_field("id")),
|
||||
};
|
||||
let id = match id {
|
||||
Some(id) => id,
|
||||
None => return Err(V::Error::missing_field("id")),
|
||||
};
|
||||
|
||||
let version = match version {
|
||||
Some(version) => version,
|
||||
None => return Err(V::Error::missing_field("version")),
|
||||
};
|
||||
let version = match version {
|
||||
Some(version) => version,
|
||||
None => return Err(V::Error::missing_field("version")),
|
||||
};
|
||||
|
||||
let crypto = match crypto {
|
||||
Some(crypto) => crypto,
|
||||
None => return Err(V::Error::missing_field("crypto")),
|
||||
};
|
||||
let crypto = match crypto {
|
||||
Some(crypto) => crypto,
|
||||
None => return Err(V::Error::missing_field("crypto")),
|
||||
};
|
||||
|
||||
let result = KeyFile {
|
||||
id: id,
|
||||
version: version,
|
||||
crypto: crypto,
|
||||
address: address,
|
||||
name: name,
|
||||
meta: meta,
|
||||
};
|
||||
let result = KeyFile {
|
||||
id: id,
|
||||
version: version,
|
||||
crypto: crypto,
|
||||
address: address,
|
||||
name: name,
|
||||
meta: meta,
|
||||
};
|
||||
|
||||
Ok(result)
|
||||
}
|
||||
Ok(result)
|
||||
}
|
||||
}
|
||||
|
||||
impl KeyFile {
|
||||
pub fn load<R>(reader: R) -> Result<Self, serde_json::Error> where R: Read {
|
||||
serde_json::from_reader(reader)
|
||||
}
|
||||
pub fn load<R>(reader: R) -> Result<Self, serde_json::Error>
|
||||
where
|
||||
R: Read,
|
||||
{
|
||||
serde_json::from_reader(reader)
|
||||
}
|
||||
|
||||
pub fn write<W>(&self, writer: &mut W) -> Result<(), serde_json::Error> where W: Write {
|
||||
serde_json::to_writer(writer, self)
|
||||
}
|
||||
pub fn write<W>(&self, writer: &mut W) -> Result<(), serde_json::Error>
|
||||
where
|
||||
W: Write,
|
||||
{
|
||||
serde_json::to_writer(writer, self)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::str::FromStr;
|
||||
use serde_json;
|
||||
use json::{KeyFile, Uuid, Version, Crypto, Cipher, Aes128Ctr, Kdf, Scrypt};
|
||||
use json::{Aes128Ctr, Cipher, Crypto, Kdf, KeyFile, Scrypt, Uuid, Version};
|
||||
use serde_json;
|
||||
use std::str::FromStr;
|
||||
|
||||
#[test]
|
||||
fn basic_keyfile() {
|
||||
let json = r#"
|
||||
#[test]
|
||||
fn basic_keyfile() {
|
||||
let json = r#"
|
||||
{
|
||||
"address": "6edddfc6349aff20bc6467ccf276c5b52487f7a8",
|
||||
"crypto": {
|
||||
@@ -214,35 +246,36 @@ mod tests {
|
||||
"meta": "{}"
|
||||
}"#;
|
||||
|
||||
let expected = KeyFile {
|
||||
id: Uuid::from_str("8777d9f6-7860-4b9b-88b7-0b57ee6b3a73").unwrap(),
|
||||
version: Version::V3,
|
||||
address: Some("6edddfc6349aff20bc6467ccf276c5b52487f7a8".into()),
|
||||
crypto: Crypto {
|
||||
cipher: Cipher::Aes128Ctr(Aes128Ctr {
|
||||
iv: "b5a7ec855ec9e2c405371356855fec83".into(),
|
||||
}),
|
||||
ciphertext: "7203da0676d141b138cd7f8e1a4365f59cc1aa6978dc5443f364ca943d7cb4bc".into(),
|
||||
kdf: Kdf::Scrypt(Scrypt {
|
||||
n: 262144,
|
||||
dklen: 32,
|
||||
p: 1,
|
||||
r: 8,
|
||||
salt: "1e8642fdf1f87172492c1412fc62f8db75d796cdfa9c53c3f2b11e44a2a1b209".into(),
|
||||
}),
|
||||
mac: "46325c5d4e8c991ad2683d525c7854da387138b6ca45068985aa4959fa2b8c8f".into(),
|
||||
},
|
||||
name: Some("Test".to_owned()),
|
||||
meta: Some("{}".to_owned()),
|
||||
};
|
||||
let expected = KeyFile {
|
||||
id: Uuid::from_str("8777d9f6-7860-4b9b-88b7-0b57ee6b3a73").unwrap(),
|
||||
version: Version::V3,
|
||||
address: Some("6edddfc6349aff20bc6467ccf276c5b52487f7a8".into()),
|
||||
crypto: Crypto {
|
||||
cipher: Cipher::Aes128Ctr(Aes128Ctr {
|
||||
iv: "b5a7ec855ec9e2c405371356855fec83".into(),
|
||||
}),
|
||||
ciphertext: "7203da0676d141b138cd7f8e1a4365f59cc1aa6978dc5443f364ca943d7cb4bc"
|
||||
.into(),
|
||||
kdf: Kdf::Scrypt(Scrypt {
|
||||
n: 262144,
|
||||
dklen: 32,
|
||||
p: 1,
|
||||
r: 8,
|
||||
salt: "1e8642fdf1f87172492c1412fc62f8db75d796cdfa9c53c3f2b11e44a2a1b209".into(),
|
||||
}),
|
||||
mac: "46325c5d4e8c991ad2683d525c7854da387138b6ca45068985aa4959fa2b8c8f".into(),
|
||||
},
|
||||
name: Some("Test".to_owned()),
|
||||
meta: Some("{}".to_owned()),
|
||||
};
|
||||
|
||||
let keyfile: KeyFile = serde_json::from_str(json).unwrap();
|
||||
assert_eq!(keyfile, expected);
|
||||
}
|
||||
let keyfile: KeyFile = serde_json::from_str(json).unwrap();
|
||||
assert_eq!(keyfile, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn capital_crypto_keyfile() {
|
||||
let json = r#"
|
||||
#[test]
|
||||
fn capital_crypto_keyfile() {
|
||||
let json = r#"
|
||||
{
|
||||
"address": "6edddfc6349aff20bc6467ccf276c5b52487f7a8",
|
||||
"Crypto": {
|
||||
@@ -265,60 +298,62 @@ mod tests {
|
||||
"version": 3
|
||||
}"#;
|
||||
|
||||
let expected = KeyFile {
|
||||
id: "8777d9f6-7860-4b9b-88b7-0b57ee6b3a73".into(),
|
||||
version: Version::V3,
|
||||
address: Some("6edddfc6349aff20bc6467ccf276c5b52487f7a8".into()),
|
||||
crypto: Crypto {
|
||||
cipher: Cipher::Aes128Ctr(Aes128Ctr {
|
||||
iv: "b5a7ec855ec9e2c405371356855fec83".into(),
|
||||
}),
|
||||
ciphertext: "7203da0676d141b138cd7f8e1a4365f59cc1aa6978dc5443f364ca943d7cb4bc".into(),
|
||||
kdf: Kdf::Scrypt(Scrypt {
|
||||
n: 262144,
|
||||
dklen: 32,
|
||||
p: 1,
|
||||
r: 8,
|
||||
salt: "1e8642fdf1f87172492c1412fc62f8db75d796cdfa9c53c3f2b11e44a2a1b209".into(),
|
||||
}),
|
||||
mac: "46325c5d4e8c991ad2683d525c7854da387138b6ca45068985aa4959fa2b8c8f".into(),
|
||||
},
|
||||
name: None,
|
||||
meta: None,
|
||||
};
|
||||
let expected = KeyFile {
|
||||
id: "8777d9f6-7860-4b9b-88b7-0b57ee6b3a73".into(),
|
||||
version: Version::V3,
|
||||
address: Some("6edddfc6349aff20bc6467ccf276c5b52487f7a8".into()),
|
||||
crypto: Crypto {
|
||||
cipher: Cipher::Aes128Ctr(Aes128Ctr {
|
||||
iv: "b5a7ec855ec9e2c405371356855fec83".into(),
|
||||
}),
|
||||
ciphertext: "7203da0676d141b138cd7f8e1a4365f59cc1aa6978dc5443f364ca943d7cb4bc"
|
||||
.into(),
|
||||
kdf: Kdf::Scrypt(Scrypt {
|
||||
n: 262144,
|
||||
dklen: 32,
|
||||
p: 1,
|
||||
r: 8,
|
||||
salt: "1e8642fdf1f87172492c1412fc62f8db75d796cdfa9c53c3f2b11e44a2a1b209".into(),
|
||||
}),
|
||||
mac: "46325c5d4e8c991ad2683d525c7854da387138b6ca45068985aa4959fa2b8c8f".into(),
|
||||
},
|
||||
name: None,
|
||||
meta: None,
|
||||
};
|
||||
|
||||
let keyfile: KeyFile = serde_json::from_str(json).unwrap();
|
||||
assert_eq!(keyfile, expected);
|
||||
}
|
||||
let keyfile: KeyFile = serde_json::from_str(json).unwrap();
|
||||
assert_eq!(keyfile, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn to_and_from_json() {
|
||||
let file = KeyFile {
|
||||
id: "8777d9f6-7860-4b9b-88b7-0b57ee6b3a73".into(),
|
||||
version: Version::V3,
|
||||
address: Some("6edddfc6349aff20bc6467ccf276c5b52487f7a8".into()),
|
||||
crypto: Crypto {
|
||||
cipher: Cipher::Aes128Ctr(Aes128Ctr {
|
||||
iv: "b5a7ec855ec9e2c405371356855fec83".into(),
|
||||
}),
|
||||
ciphertext: "7203da0676d141b138cd7f8e1a4365f59cc1aa6978dc5443f364ca943d7cb4bc".into(),
|
||||
kdf: Kdf::Scrypt(Scrypt {
|
||||
n: 262144,
|
||||
dklen: 32,
|
||||
p: 1,
|
||||
r: 8,
|
||||
salt: "1e8642fdf1f87172492c1412fc62f8db75d796cdfa9c53c3f2b11e44a2a1b209".into(),
|
||||
}),
|
||||
mac: "46325c5d4e8c991ad2683d525c7854da387138b6ca45068985aa4959fa2b8c8f".into(),
|
||||
},
|
||||
name: Some("Test".to_owned()),
|
||||
meta: None,
|
||||
};
|
||||
#[test]
|
||||
fn to_and_from_json() {
|
||||
let file = KeyFile {
|
||||
id: "8777d9f6-7860-4b9b-88b7-0b57ee6b3a73".into(),
|
||||
version: Version::V3,
|
||||
address: Some("6edddfc6349aff20bc6467ccf276c5b52487f7a8".into()),
|
||||
crypto: Crypto {
|
||||
cipher: Cipher::Aes128Ctr(Aes128Ctr {
|
||||
iv: "b5a7ec855ec9e2c405371356855fec83".into(),
|
||||
}),
|
||||
ciphertext: "7203da0676d141b138cd7f8e1a4365f59cc1aa6978dc5443f364ca943d7cb4bc"
|
||||
.into(),
|
||||
kdf: Kdf::Scrypt(Scrypt {
|
||||
n: 262144,
|
||||
dklen: 32,
|
||||
p: 1,
|
||||
r: 8,
|
||||
salt: "1e8642fdf1f87172492c1412fc62f8db75d796cdfa9c53c3f2b11e44a2a1b209".into(),
|
||||
}),
|
||||
mac: "46325c5d4e8c991ad2683d525c7854da387138b6ca45068985aa4959fa2b8c8f".into(),
|
||||
},
|
||||
name: Some("Test".to_owned()),
|
||||
meta: None,
|
||||
};
|
||||
|
||||
let serialized = serde_json::to_string(&file).unwrap();
|
||||
println!("{}", serialized);
|
||||
let deserialized = serde_json::from_str(&serialized).unwrap();
|
||||
let serialized = serde_json::to_string(&file).unwrap();
|
||||
println!("{}", serialized);
|
||||
let deserialized = serde_json::from_str(&serialized).unwrap();
|
||||
|
||||
assert_eq!(file, deserialized);
|
||||
}
|
||||
assert_eq!(file, deserialized);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Contract interface specification.
|
||||
|
||||
@@ -29,15 +29,20 @@ mod vault_file;
|
||||
mod vault_key_file;
|
||||
mod version;
|
||||
|
||||
pub use self::bytes::Bytes;
|
||||
pub use self::cipher::{Cipher, CipherSer, CipherSerParams, Aes128Ctr};
|
||||
pub use self::crypto::{Crypto, CipherText};
|
||||
pub use self::error::Error;
|
||||
pub use self::hash::{H128, H160, H256};
|
||||
pub use self::id::Uuid;
|
||||
pub use self::kdf::{Kdf, KdfSer, Prf, Pbkdf2, Scrypt, KdfSerParams};
|
||||
pub use self::key_file::{KeyFile, OpaqueKeyFile};
|
||||
pub use self::presale::{PresaleWallet, Encseed};
|
||||
pub use self::vault_file::VaultFile;
|
||||
pub use self::vault_key_file::{VaultKeyFile, VaultKeyMeta, insert_vault_name_to_json_meta, remove_vault_name_from_json_meta};
|
||||
pub use self::version::Version;
|
||||
pub use self::{
|
||||
bytes::Bytes,
|
||||
cipher::{Aes128Ctr, Cipher, CipherSer, CipherSerParams},
|
||||
crypto::{CipherText, Crypto},
|
||||
error::Error,
|
||||
hash::{H128, H160, H256},
|
||||
id::Uuid,
|
||||
kdf::{Kdf, KdfSer, KdfSerParams, Pbkdf2, Prf, Scrypt},
|
||||
key_file::{KeyFile, OpaqueKeyFile},
|
||||
presale::{Encseed, PresaleWallet},
|
||||
vault_file::VaultFile,
|
||||
vault_key_file::{
|
||||
insert_vault_name_to_json_meta, remove_vault_name_from_json_meta, VaultKeyFile,
|
||||
VaultKeyMeta,
|
||||
},
|
||||
version::Version,
|
||||
};
|
||||
|
||||
@@ -1,47 +1,50 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::io::Read;
|
||||
use super::{Bytes, H160};
|
||||
use serde_json;
|
||||
use super::{H160, Bytes};
|
||||
use std::io::Read;
|
||||
|
||||
pub type Encseed = Bytes;
|
||||
|
||||
#[derive(Debug, PartialEq, Deserialize)]
|
||||
pub struct PresaleWallet {
|
||||
pub encseed: Encseed,
|
||||
#[serde(rename = "ethaddr")]
|
||||
pub address: H160,
|
||||
pub encseed: Encseed,
|
||||
#[serde(rename = "ethaddr")]
|
||||
pub address: H160,
|
||||
}
|
||||
|
||||
impl PresaleWallet {
|
||||
pub fn load<R>(reader: R) -> Result<Self, serde_json::Error> where R: Read {
|
||||
serde_json::from_reader(reader)
|
||||
}
|
||||
pub fn load<R>(reader: R) -> Result<Self, serde_json::Error>
|
||||
where
|
||||
R: Read,
|
||||
{
|
||||
serde_json::from_reader(reader)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::str::FromStr;
|
||||
use serde_json;
|
||||
use json::{PresaleWallet, H160};
|
||||
use json::{PresaleWallet, H160};
|
||||
use serde_json;
|
||||
use std::str::FromStr;
|
||||
|
||||
#[test]
|
||||
fn presale_wallet() {
|
||||
let json = r#"
|
||||
#[test]
|
||||
fn presale_wallet() {
|
||||
let json = r#"
|
||||
{
|
||||
"encseed": "137103c28caeebbcea5d7f95edb97a289ded151b72159137cb7b2671f394f54cff8c121589dcb373e267225547b3c71cbdb54f6e48ec85cd549f96cf0dedb3bc0a9ac6c79b9c426c5878ca2c9d06ff42a23cb648312fc32ba83649de0928e066",
|
||||
"ethaddr": "ede84640d1a1d3e06902048e67aa7db8d52c2ce1",
|
||||
@@ -49,18 +52,18 @@ mod tests {
|
||||
"btcaddr": "1JvqEc6WLhg6GnyrLBe2ztPAU28KRfuseH"
|
||||
} "#;
|
||||
|
||||
let expected = PresaleWallet {
|
||||
let expected = PresaleWallet {
|
||||
encseed: "137103c28caeebbcea5d7f95edb97a289ded151b72159137cb7b2671f394f54cff8c121589dcb373e267225547b3c71cbdb54f6e48ec85cd549f96cf0dedb3bc0a9ac6c79b9c426c5878ca2c9d06ff42a23cb648312fc32ba83649de0928e066".into(),
|
||||
address: H160::from_str("ede84640d1a1d3e06902048e67aa7db8d52c2ce1").unwrap(),
|
||||
};
|
||||
|
||||
let wallet: PresaleWallet = serde_json::from_str(json).unwrap();
|
||||
assert_eq!(expected, wallet);
|
||||
}
|
||||
let wallet: PresaleWallet = serde_json::from_str(json).unwrap();
|
||||
assert_eq!(expected, wallet);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn long_presale_wallet() {
|
||||
let json = r#"
|
||||
#[test]
|
||||
fn long_presale_wallet() {
|
||||
let json = r#"
|
||||
{
|
||||
"encseed":
|
||||
"137103c28caeebbcea5d7f95edb97a289ded151b72159137cb7b2671f394f54cff8c121589dcb373e267225547b3c71cbdb54f6e48ec85cd549f96cf0dedb3bc0a9ac6c79b9c426c5878ca2c9d06ff42a23cb648312fc32ba83649de0928e066137103c28caeebbcea5d7f95edb97a289ded151b72159137cb7b2671f394f54cff8c121589dcb373e267225547b3c71cbdb54f6e48ec85cd549f96cf0dedb3bc0a9ac6c79b9c426c5878ca2c9d06ff42a23cb648312fc32ba83649de0928e066137103c28caeebbcea5d7f95edb97a289ded151b72159137cb7b2671f394f54cff8c121589dcb373e267225547b3c71cbdb54f6e48ec85cd549f96cf0dedb3bc0a9ac6c79b9c426c5878ca2c9d06ff42a23cb648312fc32ba83649de0928e066137103c28caeebbcea5d7f95edb97a289ded151b72159137cb7b2671f394f54cff8c121589dcb373e267225547b3c71cbdb54f6e48ec85cd549f96cf0dedb3bc0a9ac6c79b9c426c5878ca2c9d06ff42a23cb648312fc32ba83649de0928e066137103c28caeebbcea5d7f95edb97a289ded151b72159137cb7b2671f394f54cff8c121589dcb373e267225547b3c71cbdb54f6e48ec85cd549f96cf0dedb3bc0a9ac6c79b9c426c5878ca2c9d06ff42a23cb648312fc32ba83649de0928e066137103c28caeebbcea5d7f95edb97a289ded151b72159137cb7b2671f394f54cff8c121589dcb373e267225547b3c71cbdb54f6e48ec85cd549f96cf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0d",
|
||||
@@ -69,12 +72,12 @@ mod tests {
|
||||
"btcaddr": "1JvqEc6WLhg6GnyrLBe2ztPAU28KRfuseH"
|
||||
} "#;
|
||||
|
||||
let expected = PresaleWallet {
|
||||
let expected = PresaleWallet {
|
||||
encseed: "137103c28caeebbcea5d7f95edb97a289ded151b72159137cb7b2671f394f54cff8c121589dcb373e267225547b3c71cbdb54f6e48ec85cd549f96cf0dedb3bc0a9ac6c79b9c426c5878ca2c9d06ff42a23cb648312fc32ba83649de0928e066137103c28caeebbcea5d7f95edb97a289ded151b72159137cb7b2671f394f54cff8c121589dcb373e267225547b3c71cbdb54f6e48ec85cd549f96cf0dedb3bc0a9ac6c79b9c426c5878ca2c9d06ff42a23cb648312fc32ba83649de0928e066137103c28caeebbcea5d7f95edb97a289ded151b72159137cb7b2671f394f54cff8c121589dcb373e267225547b3c71cbdb54f6e48ec85cd549f96cf0dedb3bc0a9ac6c79b9c426c5878ca2c9d06ff42a23cb648312fc32ba83649de0928e066137103c28caeebbcea5d7f95edb97a289ded151b72159137cb7b2671f394f54cff8c121589dcb373e267225547b3c71cbdb54f6e48ec85cd549f96cf0dedb3bc0a9ac6c79b9c426c5878ca2c9d06ff42a23cb648312fc32ba83649de0928e066137103c28caeebbcea5d7f95edb97a289ded151b72159137cb7b2671f394f54cff8c121589dcb373e267225547b3c71cbdb54f6e48ec85cd549f96cf0dedb3bc0a9ac6c79b9c426c5878ca2c9d06ff42a23cb648312fc32ba83649de0928e066137103c28caeebbcea5d7f95edb97a289ded151b72159137cb7b2671f394f54cff8c121589dcb373e267225547b3c71cbdb54f6e48ec85cd549f96cf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0dcf0d".into(),
|
||||
address: H160::from_str("ede84640d1a1d3e06902048e67aa7db8d52c2ce1").unwrap(),
|
||||
};
|
||||
|
||||
let wallet: PresaleWallet = serde_json::from_str(json).unwrap();
|
||||
assert_eq!(expected, wallet);
|
||||
}
|
||||
let wallet: PresaleWallet = serde_json::from_str(json).unwrap();
|
||||
assert_eq!(expected, wallet);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,94 +1,105 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::io::{Read, Write};
|
||||
use serde_json;
|
||||
use super::Crypto;
|
||||
use serde_json;
|
||||
use std::io::{Read, Write};
|
||||
|
||||
/// Vault meta file
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct VaultFile {
|
||||
/// Vault password, encrypted with vault password
|
||||
pub crypto: Crypto,
|
||||
/// Vault metadata string
|
||||
pub meta: Option<String>,
|
||||
/// Vault password, encrypted with vault password
|
||||
pub crypto: Crypto,
|
||||
/// Vault metadata string
|
||||
pub meta: Option<String>,
|
||||
}
|
||||
|
||||
impl VaultFile {
|
||||
pub fn load<R>(reader: R) -> Result<Self, serde_json::Error> where R: Read {
|
||||
serde_json::from_reader(reader)
|
||||
}
|
||||
pub fn load<R>(reader: R) -> Result<Self, serde_json::Error>
|
||||
where
|
||||
R: Read,
|
||||
{
|
||||
serde_json::from_reader(reader)
|
||||
}
|
||||
|
||||
pub fn write<W>(&self, writer: &mut W) -> Result<(), serde_json::Error> where W: Write {
|
||||
serde_json::to_writer(writer, self)
|
||||
}
|
||||
pub fn write<W>(&self, writer: &mut W) -> Result<(), serde_json::Error>
|
||||
where
|
||||
W: Write,
|
||||
{
|
||||
serde_json::to_writer(writer, self)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use serde_json;
|
||||
use json::{VaultFile, Crypto, Cipher, Aes128Ctr, Kdf, Pbkdf2, Prf};
|
||||
use json::{Aes128Ctr, Cipher, Crypto, Kdf, Pbkdf2, Prf, VaultFile};
|
||||
use serde_json;
|
||||
use std::num::NonZeroU32;
|
||||
|
||||
#[test]
|
||||
fn to_and_from_json() {
|
||||
let file = VaultFile {
|
||||
crypto: Crypto {
|
||||
cipher: Cipher::Aes128Ctr(Aes128Ctr {
|
||||
iv: "0155e3690be19fbfbecabcd440aa284b".into(),
|
||||
}),
|
||||
ciphertext: "4d6938a1f49b7782".into(),
|
||||
kdf: Kdf::Pbkdf2(Pbkdf2 {
|
||||
c: 1024,
|
||||
dklen: 32,
|
||||
prf: Prf::HmacSha256,
|
||||
salt: "b6a9338a7ccd39288a86dba73bfecd9101b4f3db9c9830e7c76afdbd4f6872e5".into(),
|
||||
}),
|
||||
mac: "16381463ea11c6eb2239a9f339c2e780516d29d234ce30ac5f166f9080b5a262".into(),
|
||||
},
|
||||
meta: Some("{}".into()),
|
||||
};
|
||||
lazy_static! {
|
||||
static ref ITERATIONS: NonZeroU32 = NonZeroU32::new(1024).expect("1024 > 0; qed");
|
||||
}
|
||||
|
||||
let serialized = serde_json::to_string(&file).unwrap();
|
||||
let deserialized = serde_json::from_str(&serialized).unwrap();
|
||||
#[test]
|
||||
fn to_and_from_json() {
|
||||
let file = VaultFile {
|
||||
crypto: Crypto {
|
||||
cipher: Cipher::Aes128Ctr(Aes128Ctr {
|
||||
iv: "0155e3690be19fbfbecabcd440aa284b".into(),
|
||||
}),
|
||||
ciphertext: "4d6938a1f49b7782".into(),
|
||||
kdf: Kdf::Pbkdf2(Pbkdf2 {
|
||||
c: *ITERATIONS,
|
||||
dklen: 32,
|
||||
prf: Prf::HmacSha256,
|
||||
salt: "b6a9338a7ccd39288a86dba73bfecd9101b4f3db9c9830e7c76afdbd4f6872e5".into(),
|
||||
}),
|
||||
mac: "16381463ea11c6eb2239a9f339c2e780516d29d234ce30ac5f166f9080b5a262".into(),
|
||||
},
|
||||
meta: Some("{}".into()),
|
||||
};
|
||||
|
||||
assert_eq!(file, deserialized);
|
||||
}
|
||||
let serialized = serde_json::to_string(&file).unwrap();
|
||||
let deserialized = serde_json::from_str(&serialized).unwrap();
|
||||
|
||||
#[test]
|
||||
fn to_and_from_json_no_meta() {
|
||||
let file = VaultFile {
|
||||
crypto: Crypto {
|
||||
cipher: Cipher::Aes128Ctr(Aes128Ctr {
|
||||
iv: "0155e3690be19fbfbecabcd440aa284b".into(),
|
||||
}),
|
||||
ciphertext: "4d6938a1f49b7782".into(),
|
||||
kdf: Kdf::Pbkdf2(Pbkdf2 {
|
||||
c: 1024,
|
||||
dklen: 32,
|
||||
prf: Prf::HmacSha256,
|
||||
salt: "b6a9338a7ccd39288a86dba73bfecd9101b4f3db9c9830e7c76afdbd4f6872e5".into(),
|
||||
}),
|
||||
mac: "16381463ea11c6eb2239a9f339c2e780516d29d234ce30ac5f166f9080b5a262".into(),
|
||||
},
|
||||
meta: None,
|
||||
};
|
||||
assert_eq!(file, deserialized);
|
||||
}
|
||||
|
||||
let serialized = serde_json::to_string(&file).unwrap();
|
||||
let deserialized = serde_json::from_str(&serialized).unwrap();
|
||||
#[test]
|
||||
fn to_and_from_json_no_meta() {
|
||||
let file = VaultFile {
|
||||
crypto: Crypto {
|
||||
cipher: Cipher::Aes128Ctr(Aes128Ctr {
|
||||
iv: "0155e3690be19fbfbecabcd440aa284b".into(),
|
||||
}),
|
||||
ciphertext: "4d6938a1f49b7782".into(),
|
||||
kdf: Kdf::Pbkdf2(Pbkdf2 {
|
||||
c: *ITERATIONS,
|
||||
dklen: 32,
|
||||
prf: Prf::HmacSha256,
|
||||
salt: "b6a9338a7ccd39288a86dba73bfecd9101b4f3db9c9830e7c76afdbd4f6872e5".into(),
|
||||
}),
|
||||
mac: "16381463ea11c6eb2239a9f339c2e780516d29d234ce30ac5f166f9080b5a262".into(),
|
||||
},
|
||||
meta: None,
|
||||
};
|
||||
|
||||
assert_eq!(file, deserialized);
|
||||
}
|
||||
let serialized = serde_json::to_string(&file).unwrap();
|
||||
let deserialized = serde_json::from_str(&serialized).unwrap();
|
||||
|
||||
assert_eq!(file, deserialized);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,23 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::io::{Read, Write};
|
||||
use super::{Crypto, Uuid, Version, H160};
|
||||
use serde::de::Error;
|
||||
use serde_json;
|
||||
use serde_json::value::Value;
|
||||
use serde_json::error;
|
||||
use super::{Uuid, Version, Crypto, H160};
|
||||
use serde_json::{self, error, value::Value};
|
||||
use std::io::{Read, Write};
|
||||
|
||||
/// Meta key name for vault field
|
||||
const VAULT_NAME_META_KEY: &'static str = "vault";
|
||||
@@ -27,89 +25,112 @@ const VAULT_NAME_META_KEY: &'static str = "vault";
|
||||
/// Key file as stored in vaults
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct VaultKeyFile {
|
||||
/// Key id
|
||||
pub id: Uuid,
|
||||
/// Key version
|
||||
pub version: Version,
|
||||
/// Secret, encrypted with account password
|
||||
pub crypto: Crypto,
|
||||
/// Serialized `VaultKeyMeta`, encrypted with vault password
|
||||
pub metacrypto: Crypto,
|
||||
/// Key id
|
||||
pub id: Uuid,
|
||||
/// Key version
|
||||
pub version: Version,
|
||||
/// Secret, encrypted with account password
|
||||
pub crypto: Crypto,
|
||||
/// Serialized `VaultKeyMeta`, encrypted with vault password
|
||||
pub metacrypto: Crypto,
|
||||
}
|
||||
|
||||
/// Data, stored in `VaultKeyFile::metacrypto`
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct VaultKeyMeta {
|
||||
/// Key address
|
||||
pub address: H160,
|
||||
/// Key name
|
||||
pub name: Option<String>,
|
||||
/// Key metadata
|
||||
pub meta: Option<String>,
|
||||
/// Key address
|
||||
pub address: H160,
|
||||
/// Key name
|
||||
pub name: Option<String>,
|
||||
/// Key metadata
|
||||
pub meta: Option<String>,
|
||||
}
|
||||
|
||||
/// Insert vault name to the JSON meta field
|
||||
pub fn insert_vault_name_to_json_meta(meta: &str, vault_name: &str) -> Result<String, error::Error> {
|
||||
let mut meta = if meta.is_empty() {
|
||||
Value::Object(serde_json::Map::new())
|
||||
} else {
|
||||
serde_json::from_str(meta)?
|
||||
};
|
||||
pub fn insert_vault_name_to_json_meta(
|
||||
meta: &str,
|
||||
vault_name: &str,
|
||||
) -> Result<String, error::Error> {
|
||||
let mut meta = if meta.is_empty() {
|
||||
Value::Object(serde_json::Map::new())
|
||||
} else {
|
||||
serde_json::from_str(meta)?
|
||||
};
|
||||
|
||||
if let Some(meta_obj) = meta.as_object_mut() {
|
||||
meta_obj.insert(VAULT_NAME_META_KEY.to_owned(), Value::String(vault_name.to_owned()));
|
||||
serde_json::to_string(meta_obj)
|
||||
} else {
|
||||
Err(error::Error::custom("Meta is expected to be a serialized JSON object"))
|
||||
}
|
||||
if let Some(meta_obj) = meta.as_object_mut() {
|
||||
meta_obj.insert(
|
||||
VAULT_NAME_META_KEY.to_owned(),
|
||||
Value::String(vault_name.to_owned()),
|
||||
);
|
||||
serde_json::to_string(meta_obj)
|
||||
} else {
|
||||
Err(error::Error::custom(
|
||||
"Meta is expected to be a serialized JSON object",
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
/// Remove vault name from the JSON meta field
|
||||
pub fn remove_vault_name_from_json_meta(meta: &str) -> Result<String, error::Error> {
|
||||
let mut meta = if meta.is_empty() {
|
||||
Value::Object(serde_json::Map::new())
|
||||
} else {
|
||||
serde_json::from_str(meta)?
|
||||
};
|
||||
let mut meta = if meta.is_empty() {
|
||||
Value::Object(serde_json::Map::new())
|
||||
} else {
|
||||
serde_json::from_str(meta)?
|
||||
};
|
||||
|
||||
if let Some(meta_obj) = meta.as_object_mut() {
|
||||
meta_obj.remove(VAULT_NAME_META_KEY);
|
||||
serde_json::to_string(meta_obj)
|
||||
} else {
|
||||
Err(error::Error::custom("Meta is expected to be a serialized JSON object"))
|
||||
}
|
||||
if let Some(meta_obj) = meta.as_object_mut() {
|
||||
meta_obj.remove(VAULT_NAME_META_KEY);
|
||||
serde_json::to_string(meta_obj)
|
||||
} else {
|
||||
Err(error::Error::custom(
|
||||
"Meta is expected to be a serialized JSON object",
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
impl VaultKeyFile {
|
||||
pub fn load<R>(reader: R) -> Result<Self, serde_json::Error> where R: Read {
|
||||
serde_json::from_reader(reader)
|
||||
}
|
||||
pub fn load<R>(reader: R) -> Result<Self, serde_json::Error>
|
||||
where
|
||||
R: Read,
|
||||
{
|
||||
serde_json::from_reader(reader)
|
||||
}
|
||||
|
||||
pub fn write<W>(&self, writer: &mut W) -> Result<(), serde_json::Error> where W: Write {
|
||||
serde_json::to_writer(writer, self)
|
||||
}
|
||||
pub fn write<W>(&self, writer: &mut W) -> Result<(), serde_json::Error>
|
||||
where
|
||||
W: Write,
|
||||
{
|
||||
serde_json::to_writer(writer, self)
|
||||
}
|
||||
}
|
||||
|
||||
impl VaultKeyMeta {
|
||||
pub fn load(bytes: &[u8]) -> Result<Self, serde_json::Error> {
|
||||
serde_json::from_slice(&bytes)
|
||||
}
|
||||
pub fn load(bytes: &[u8]) -> Result<Self, serde_json::Error> {
|
||||
serde_json::from_slice(&bytes)
|
||||
}
|
||||
|
||||
pub fn write(&self) -> Result<Vec<u8>, serde_json::Error> {
|
||||
let s = serde_json::to_string(self)?;
|
||||
Ok(s.as_bytes().into())
|
||||
}
|
||||
pub fn write(&self) -> Result<Vec<u8>, serde_json::Error> {
|
||||
let s = serde_json::to_string(self)?;
|
||||
Ok(s.as_bytes().into())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use serde_json;
|
||||
use json::{VaultKeyFile, Version, Crypto, Cipher, Aes128Ctr, Kdf, Pbkdf2, Prf,
|
||||
insert_vault_name_to_json_meta, remove_vault_name_from_json_meta};
|
||||
use json::{
|
||||
insert_vault_name_to_json_meta, remove_vault_name_from_json_meta, Aes128Ctr, Cipher,
|
||||
Crypto, Kdf, Pbkdf2, Prf, VaultKeyFile, Version,
|
||||
};
|
||||
use serde_json;
|
||||
use std::num::NonZeroU32;
|
||||
|
||||
#[test]
|
||||
fn to_and_from_json() {
|
||||
let file = VaultKeyFile {
|
||||
lazy_static! {
|
||||
static ref ITERATIONS: NonZeroU32 = NonZeroU32::new(10240).expect("10240 > 0; qed");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn to_and_from_json() {
|
||||
let file = VaultKeyFile {
|
||||
id: "08d82c39-88e3-7a71-6abb-89c8f36c3ceb".into(),
|
||||
version: Version::V3,
|
||||
crypto: Crypto {
|
||||
@@ -118,7 +139,7 @@ mod test {
|
||||
}),
|
||||
ciphertext: "4befe0a66d9a4b6fec8e39eb5c90ac5dafdeaab005fff1af665fd1f9af925c91".into(),
|
||||
kdf: Kdf::Pbkdf2(Pbkdf2 {
|
||||
c: 10240,
|
||||
c: *ITERATIONS,
|
||||
dklen: 32,
|
||||
prf: Prf::HmacSha256,
|
||||
salt: "f17731e84ecac390546692dbd4ccf6a3a2720dc9652984978381e61c28a471b2".into(),
|
||||
@@ -131,7 +152,7 @@ mod test {
|
||||
}),
|
||||
ciphertext: "fef0d113d7576c1702daf380ad6f4c5408389e57991cae2a174facd74bd549338e1014850bddbab7eb486ff5f5c9c5532800c6a6d4db2be2212cd5cd3769244ab230e1f369e8382a9e6d7c0a".into(),
|
||||
kdf: Kdf::Pbkdf2(Pbkdf2 {
|
||||
c: 10240,
|
||||
c: *ITERATIONS,
|
||||
dklen: 32,
|
||||
prf: Prf::HmacSha256,
|
||||
salt: "aca82865174a82249a198814b263f43a631f272cbf7ed329d0f0839d259c652a".into(),
|
||||
@@ -140,33 +161,45 @@ mod test {
|
||||
}
|
||||
};
|
||||
|
||||
let serialized = serde_json::to_string(&file).unwrap();
|
||||
let deserialized = serde_json::from_str(&serialized).unwrap();
|
||||
let serialized = serde_json::to_string(&file).unwrap();
|
||||
let deserialized = serde_json::from_str(&serialized).unwrap();
|
||||
|
||||
assert_eq!(file, deserialized);
|
||||
}
|
||||
assert_eq!(file, deserialized);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn vault_name_inserted_to_json_meta() {
|
||||
assert_eq!(insert_vault_name_to_json_meta(r#""#, "MyVault").unwrap(), r#"{"vault":"MyVault"}"#);
|
||||
assert_eq!(insert_vault_name_to_json_meta(r#"{"tags":["kalabala"]}"#, "MyVault").unwrap(), r#"{"tags":["kalabala"],"vault":"MyVault"}"#);
|
||||
}
|
||||
#[test]
|
||||
fn vault_name_inserted_to_json_meta() {
|
||||
assert_eq!(
|
||||
insert_vault_name_to_json_meta(r#""#, "MyVault").unwrap(),
|
||||
r#"{"vault":"MyVault"}"#
|
||||
);
|
||||
assert_eq!(
|
||||
insert_vault_name_to_json_meta(r#"{"tags":["kalabala"]}"#, "MyVault").unwrap(),
|
||||
r#"{"tags":["kalabala"],"vault":"MyVault"}"#
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn vault_name_not_inserted_to_json_meta() {
|
||||
assert!(insert_vault_name_to_json_meta(r#"///3533"#, "MyVault").is_err());
|
||||
assert!(insert_vault_name_to_json_meta(r#""string""#, "MyVault").is_err());
|
||||
}
|
||||
#[test]
|
||||
fn vault_name_not_inserted_to_json_meta() {
|
||||
assert!(insert_vault_name_to_json_meta(r#"///3533"#, "MyVault").is_err());
|
||||
assert!(insert_vault_name_to_json_meta(r#""string""#, "MyVault").is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn vault_name_removed_from_json_meta() {
|
||||
assert_eq!(remove_vault_name_from_json_meta(r#"{"vault":"MyVault"}"#).unwrap(), r#"{}"#);
|
||||
assert_eq!(remove_vault_name_from_json_meta(r#"{"tags":["kalabala"],"vault":"MyVault"}"#).unwrap(), r#"{"tags":["kalabala"]}"#);
|
||||
}
|
||||
#[test]
|
||||
fn vault_name_removed_from_json_meta() {
|
||||
assert_eq!(
|
||||
remove_vault_name_from_json_meta(r#"{"vault":"MyVault"}"#).unwrap(),
|
||||
r#"{}"#
|
||||
);
|
||||
assert_eq!(
|
||||
remove_vault_name_from_json_meta(r#"{"tags":["kalabala"],"vault":"MyVault"}"#).unwrap(),
|
||||
r#"{"tags":["kalabala"]}"#
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn vault_name_not_removed_from_json_meta() {
|
||||
assert!(remove_vault_name_from_json_meta(r#"///3533"#).is_err());
|
||||
assert!(remove_vault_name_from_json_meta(r#""string""#).is_err());
|
||||
}
|
||||
#[test]
|
||||
fn vault_name_not_removed_from_json_meta() {
|
||||
assert!(remove_vault_name_from_json_meta(r#"///3533"#).is_err());
|
||||
assert!(remove_vault_name_from_json_meta(r#""string""#).is_err());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,58 +1,67 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::fmt;
|
||||
use serde::{Serialize, Serializer, Deserialize, Deserializer};
|
||||
use serde::de::{Error as SerdeError, Visitor};
|
||||
use super::Error;
|
||||
use serde::{
|
||||
de::{Error as SerdeError, Visitor},
|
||||
Deserialize, Deserializer, Serialize, Serializer,
|
||||
};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum Version {
|
||||
V3,
|
||||
V3,
|
||||
}
|
||||
|
||||
impl Serialize for Version {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where S: Serializer {
|
||||
match *self {
|
||||
Version::V3 => serializer.serialize_u64(3)
|
||||
}
|
||||
}
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
match *self {
|
||||
Version::V3 => serializer.serialize_u64(3),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Deserialize<'a> for Version {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Version, D::Error>
|
||||
where D: Deserializer<'a> {
|
||||
deserializer.deserialize_any(VersionVisitor)
|
||||
}
|
||||
fn deserialize<D>(deserializer: D) -> Result<Version, D::Error>
|
||||
where
|
||||
D: Deserializer<'a>,
|
||||
{
|
||||
deserializer.deserialize_any(VersionVisitor)
|
||||
}
|
||||
}
|
||||
|
||||
struct VersionVisitor;
|
||||
|
||||
impl<'a> Visitor<'a> for VersionVisitor {
|
||||
type Value = Version;
|
||||
type Value = Version;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(formatter, "a valid key version identifier")
|
||||
}
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(formatter, "a valid key version identifier")
|
||||
}
|
||||
|
||||
fn visit_u64<E>(self, value: u64) -> Result<Self::Value, E> where E: SerdeError {
|
||||
match value {
|
||||
3 => Ok(Version::V3),
|
||||
_ => Err(SerdeError::custom(Error::UnsupportedVersion))
|
||||
}
|
||||
}
|
||||
fn visit_u64<E>(self, value: u64) -> Result<Self::Value, E>
|
||||
where
|
||||
E: SerdeError,
|
||||
{
|
||||
match value {
|
||||
3 => Ok(Version::V3),
|
||||
_ => Err(SerdeError::custom(Error::UnsupportedVersion)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Ethereum key-management.
|
||||
|
||||
#![warn(missing_docs)]
|
||||
|
||||
extern crate dir;
|
||||
extern crate itertools;
|
||||
extern crate libc;
|
||||
extern crate parking_lot;
|
||||
extern crate rand;
|
||||
@@ -26,15 +27,17 @@ extern crate rustc_hex;
|
||||
extern crate serde;
|
||||
extern crate serde_json;
|
||||
extern crate smallvec;
|
||||
extern crate tempdir;
|
||||
extern crate time;
|
||||
extern crate tiny_keccak;
|
||||
extern crate tempfile;
|
||||
|
||||
extern crate parity_crypto as crypto;
|
||||
extern crate ethereum_types;
|
||||
extern crate ethkey as ethkey;
|
||||
extern crate ethkey as _ethkey;
|
||||
extern crate parity_crypto as crypto;
|
||||
extern crate parity_wordlist;
|
||||
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
#[macro_use]
|
||||
@@ -45,6 +48,7 @@ extern crate serde_derive;
|
||||
extern crate matches;
|
||||
|
||||
pub mod accounts_dir;
|
||||
pub mod ethkey;
|
||||
|
||||
mod account;
|
||||
mod json;
|
||||
@@ -56,43 +60,20 @@ mod presale;
|
||||
mod random;
|
||||
mod secret_store;
|
||||
|
||||
pub use self::account::{SafeAccount, Crypto};
|
||||
pub use self::error::Error;
|
||||
pub use self::ethstore::{EthStore, EthMultiStore};
|
||||
pub use self::import::{import_account, import_accounts, read_geth_accounts};
|
||||
pub use self::json::OpaqueKeyFile as KeyFile;
|
||||
pub use self::presale::PresaleWallet;
|
||||
pub use self::secret_store::{
|
||||
SecretVaultRef, StoreAccountRef, SimpleSecretStore, SecretStore,
|
||||
Derivation, IndexDerivation,
|
||||
pub use self::{
|
||||
account::{Crypto, SafeAccount},
|
||||
error::Error,
|
||||
ethstore::{EthMultiStore, EthStore},
|
||||
import::{import_account, import_accounts},
|
||||
json::OpaqueKeyFile as KeyFile,
|
||||
parity_wordlist::random_phrase,
|
||||
presale::PresaleWallet,
|
||||
random::random_string,
|
||||
secret_store::{
|
||||
Derivation, IndexDerivation, SecretStore, SecretVaultRef, SimpleSecretStore,
|
||||
StoreAccountRef,
|
||||
},
|
||||
};
|
||||
pub use self::random::random_string;
|
||||
pub use self::parity_wordlist::random_phrase;
|
||||
|
||||
/// An opaque wrapper for secret.
|
||||
pub struct OpaqueSecret(crypto::publickey::Secret);
|
||||
|
||||
// Additional converters for Address
|
||||
use crypto::publickey::Address;
|
||||
|
||||
impl Into<json::H160> for Address {
|
||||
fn into(self) -> json::H160 {
|
||||
let a: [u8; 20] = self.into();
|
||||
From::from(a)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<json::H160> for Address {
|
||||
fn from(json: json::H160) -> Self {
|
||||
let a: [u8; 20] = json.into();
|
||||
From::from(a)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a json::H160> for Address {
|
||||
fn from(json: &'a json::H160) -> Self {
|
||||
let mut a = [0u8; 20];
|
||||
a.copy_from_slice(json);
|
||||
From::from(a)
|
||||
}
|
||||
}
|
||||
pub struct OpaqueSecret(::ethkey::Secret);
|
||||
|
||||
@@ -1,90 +1,93 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use crypto::{self, pbkdf2, Keccak256};
|
||||
use ethkey::{Address, KeyPair, Password, Secret};
|
||||
use json;
|
||||
use crypto::publickey::{Address, Secret, KeyPair};
|
||||
use ethkey::Password;
|
||||
use crypto::{Keccak256, pbkdf2};
|
||||
use {crypto, Error};
|
||||
use std::{fs, num::NonZeroU32, path::Path};
|
||||
use Error;
|
||||
|
||||
/// Pre-sale wallet.
|
||||
pub struct PresaleWallet {
|
||||
iv: [u8; 16],
|
||||
ciphertext: Vec<u8>,
|
||||
address: Address,
|
||||
iv: [u8; 16],
|
||||
ciphertext: Vec<u8>,
|
||||
address: Address,
|
||||
}
|
||||
|
||||
impl From<json::PresaleWallet> for PresaleWallet {
|
||||
fn from(wallet: json::PresaleWallet) -> Self {
|
||||
let mut iv = [0u8; 16];
|
||||
iv.copy_from_slice(&wallet.encseed[..16]);
|
||||
fn from(wallet: json::PresaleWallet) -> Self {
|
||||
let mut iv = [0u8; 16];
|
||||
iv.copy_from_slice(&wallet.encseed[..16]);
|
||||
|
||||
let mut ciphertext = vec![];
|
||||
ciphertext.extend_from_slice(&wallet.encseed[16..]);
|
||||
let mut ciphertext = vec![];
|
||||
ciphertext.extend_from_slice(&wallet.encseed[16..]);
|
||||
|
||||
PresaleWallet {
|
||||
iv: iv,
|
||||
ciphertext: ciphertext,
|
||||
address: Address::from(wallet.address),
|
||||
}
|
||||
}
|
||||
PresaleWallet {
|
||||
iv: iv,
|
||||
ciphertext: ciphertext,
|
||||
address: Address::from(wallet.address),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl PresaleWallet {
|
||||
/// Open a pre-sale wallet.
|
||||
pub fn open<P>(path: P) -> Result<Self, Error> where P: AsRef<Path> {
|
||||
let file = fs::File::open(path)?;
|
||||
let presale = json::PresaleWallet::load(file)
|
||||
.map_err(|e| Error::InvalidKeyFile(format!("{}", e)))?;
|
||||
Ok(PresaleWallet::from(presale))
|
||||
}
|
||||
/// Open a pre-sale wallet.
|
||||
pub fn open<P>(path: P) -> Result<Self, Error>
|
||||
where
|
||||
P: AsRef<Path>,
|
||||
{
|
||||
let file = fs::File::open(path)?;
|
||||
let presale =
|
||||
json::PresaleWallet::load(file).map_err(|e| Error::InvalidKeyFile(format!("{}", e)))?;
|
||||
Ok(PresaleWallet::from(presale))
|
||||
}
|
||||
|
||||
/// Decrypt the wallet.
|
||||
pub fn decrypt(&self, password: &Password) -> Result<KeyPair, Error> {
|
||||
let mut derived_key = [0u8; 32];
|
||||
let salt = pbkdf2::Salt(password.as_bytes());
|
||||
let sec = pbkdf2::Secret(password.as_bytes());
|
||||
pbkdf2::sha256(2000, salt, sec, &mut derived_key);
|
||||
/// Decrypt the wallet.
|
||||
pub fn decrypt(&self, password: &Password) -> Result<KeyPair, Error> {
|
||||
let mut derived_key = [0u8; 32];
|
||||
let salt = pbkdf2::Salt(password.as_bytes());
|
||||
let sec = pbkdf2::Secret(password.as_bytes());
|
||||
let iter = NonZeroU32::new(2000).expect("2000 > 0; qed");
|
||||
pbkdf2::sha256(iter, salt, sec, &mut derived_key);
|
||||
|
||||
let mut key = vec![0; self.ciphertext.len()];
|
||||
let len = crypto::aes::decrypt_128_cbc(&derived_key[0..16], &self.iv, &self.ciphertext, &mut key)
|
||||
.map_err(|_| Error::InvalidPassword)?;
|
||||
let unpadded = &key[..len];
|
||||
let mut key = vec![0; self.ciphertext.len()];
|
||||
let len =
|
||||
crypto::aes::decrypt_128_cbc(&derived_key[0..16], &self.iv, &self.ciphertext, &mut key)
|
||||
.map_err(|_| Error::InvalidPassword)?;
|
||||
let unpadded = &key[..len];
|
||||
|
||||
let secret = Secret::import_key(&unpadded.keccak256())?;
|
||||
if let Ok(kp) = KeyPair::from_secret(secret) {
|
||||
if kp.address() == self.address {
|
||||
return Ok(kp)
|
||||
}
|
||||
}
|
||||
let secret = Secret::from_unsafe_slice(&unpadded.keccak256())?;
|
||||
if let Ok(kp) = KeyPair::from_secret(secret) {
|
||||
if kp.address() == self.address {
|
||||
return Ok(kp);
|
||||
}
|
||||
}
|
||||
|
||||
Err(Error::InvalidPassword)
|
||||
}
|
||||
Err(Error::InvalidPassword)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::PresaleWallet;
|
||||
use json;
|
||||
use super::PresaleWallet;
|
||||
use json;
|
||||
|
||||
#[test]
|
||||
fn test() {
|
||||
let json = r#"
|
||||
#[test]
|
||||
fn test() {
|
||||
let json = r#"
|
||||
{
|
||||
"encseed": "137103c28caeebbcea5d7f95edb97a289ded151b72159137cb7b2671f394f54cff8c121589dcb373e267225547b3c71cbdb54f6e48ec85cd549f96cf0dedb3bc0a9ac6c79b9c426c5878ca2c9d06ff42a23cb648312fc32ba83649de0928e066",
|
||||
"ethaddr": "ede84640d1a1d3e06902048e67aa7db8d52c2ce1",
|
||||
@@ -92,9 +95,9 @@ mod tests {
|
||||
"btcaddr": "1JvqEc6WLhg6GnyrLBe2ztPAU28KRfuseH"
|
||||
} "#;
|
||||
|
||||
let wallet = json::PresaleWallet::load(json.as_bytes()).unwrap();
|
||||
let wallet = PresaleWallet::from(wallet);
|
||||
assert!(wallet.decrypt(&"123".into()).is_ok());
|
||||
assert!(wallet.decrypt(&"124".into()).is_err());
|
||||
}
|
||||
let wallet = json::PresaleWallet::load(json.as_bytes()).unwrap();
|
||||
let wallet = PresaleWallet::from(wallet);
|
||||
assert!(wallet.decrypt(&"123".into()).is_ok());
|
||||
assert!(wallet.decrypt(&"124".into()).is_err());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,45 +1,47 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use rand::{Rng, RngCore, rngs::OsRng, distributions::Alphanumeric};
|
||||
use rand::{OsRng, Rng};
|
||||
|
||||
pub trait Random {
|
||||
fn random() -> Self where Self: Sized;
|
||||
fn random() -> Self
|
||||
where
|
||||
Self: Sized;
|
||||
}
|
||||
|
||||
impl Random for [u8; 16] {
|
||||
fn random() -> Self {
|
||||
let mut result = [0u8; 16];
|
||||
let mut rng = OsRng;
|
||||
rng.fill_bytes(&mut result);
|
||||
result
|
||||
}
|
||||
fn random() -> Self {
|
||||
let mut result = [0u8; 16];
|
||||
let mut rng = OsRng::new().unwrap();
|
||||
rng.fill_bytes(&mut result);
|
||||
result
|
||||
}
|
||||
}
|
||||
|
||||
impl Random for [u8; 32] {
|
||||
fn random() -> Self {
|
||||
let mut result = [0u8; 32];
|
||||
let mut rng = OsRng;
|
||||
rng.fill_bytes(&mut result);
|
||||
result
|
||||
}
|
||||
fn random() -> Self {
|
||||
let mut result = [0u8; 32];
|
||||
let mut rng = OsRng::new().unwrap();
|
||||
rng.fill_bytes(&mut result);
|
||||
result
|
||||
}
|
||||
}
|
||||
|
||||
/// Generate a random string of given length.
|
||||
pub fn random_string(length: usize) -> String {
|
||||
let rng = OsRng;
|
||||
rng.sample_iter(&Alphanumeric).take(length).collect()
|
||||
let mut rng = OsRng::new().expect("Not able to operate without random source.");
|
||||
rng.gen_ascii_chars().take(length).collect()
|
||||
}
|
||||
|
||||
@@ -1,191 +1,268 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::path::PathBuf;
|
||||
use std::cmp::Ordering;
|
||||
use crypto::publickey::{Address, Message, Signature, Secret, Public};
|
||||
use ethkey::Password;
|
||||
use Error;
|
||||
use json::{Uuid, OpaqueKeyFile};
|
||||
use ethereum_types::H256;
|
||||
use ethkey::{Address, Message, Password, Public, Secret, Signature};
|
||||
use json::{OpaqueKeyFile, Uuid};
|
||||
use std::{
|
||||
cmp::Ordering,
|
||||
hash::{Hash, Hasher},
|
||||
path::PathBuf,
|
||||
};
|
||||
use Error;
|
||||
use OpaqueSecret;
|
||||
|
||||
/// Key directory reference
|
||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub enum SecretVaultRef {
|
||||
/// Reference to key in root directory
|
||||
Root,
|
||||
/// Referenc to key in specific vault
|
||||
Vault(String),
|
||||
/// Reference to key in root directory
|
||||
Root,
|
||||
/// Referenc to key in specific vault
|
||||
Vault(String),
|
||||
}
|
||||
|
||||
/// Stored account reference
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Ord)]
|
||||
pub struct StoreAccountRef {
|
||||
/// Account address
|
||||
pub address: Address,
|
||||
/// Vault reference
|
||||
pub vault: SecretVaultRef,
|
||||
/// Account address
|
||||
pub address: Address,
|
||||
/// Vault reference
|
||||
pub vault: SecretVaultRef,
|
||||
}
|
||||
|
||||
impl PartialOrd for StoreAccountRef {
|
||||
fn partial_cmp(&self, other: &StoreAccountRef) -> Option<Ordering> {
|
||||
Some(self.address.cmp(&other.address).then_with(|| self.vault.cmp(&other.vault)))
|
||||
}
|
||||
fn partial_cmp(&self, other: &StoreAccountRef) -> Option<Ordering> {
|
||||
Some(
|
||||
self.address
|
||||
.cmp(&other.address)
|
||||
.then_with(|| self.vault.cmp(&other.vault)),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::borrow::Borrow<Address> for StoreAccountRef {
|
||||
fn borrow(&self) -> &Address {
|
||||
&self.address
|
||||
}
|
||||
fn borrow(&self) -> &Address {
|
||||
&self.address
|
||||
}
|
||||
}
|
||||
|
||||
/// Simple Secret Store API
|
||||
pub trait SimpleSecretStore: Send + Sync {
|
||||
/// Inserts new accounts to the store (or vault) with given password.
|
||||
fn insert_account(&self, vault: SecretVaultRef, secret: Secret, password: &Password) -> Result<StoreAccountRef, Error>;
|
||||
/// Inserts new derived account to the store (or vault) with given password.
|
||||
fn insert_derived(&self, vault: SecretVaultRef, account_ref: &StoreAccountRef, password: &Password, derivation: Derivation) -> Result<StoreAccountRef, Error>;
|
||||
/// Changes accounts password.
|
||||
fn change_password(&self, account: &StoreAccountRef, old_password: &Password, new_password: &Password) -> Result<(), Error>;
|
||||
/// Exports key details for account.
|
||||
fn export_account(&self, account: &StoreAccountRef, password: &Password) -> Result<OpaqueKeyFile, Error>;
|
||||
/// Entirely removes account from the store and underlying storage.
|
||||
fn remove_account(&self, account: &StoreAccountRef, password: &Password) -> Result<(), Error>;
|
||||
/// Generates new derived account.
|
||||
fn generate_derived(&self, account_ref: &StoreAccountRef, password: &Password, derivation: Derivation) -> Result<Address, Error>;
|
||||
/// Sign a message with given account.
|
||||
fn sign(&self, account: &StoreAccountRef, password: &Password, message: &Message) -> Result<Signature, Error>;
|
||||
/// Sign a message with derived account.
|
||||
fn sign_derived(&self, account_ref: &StoreAccountRef, password: &Password, derivation: Derivation, message: &Message) -> Result<Signature, Error>;
|
||||
/// Decrypt a messages with given account.
|
||||
fn decrypt(&self, account: &StoreAccountRef, password: &Password, shared_mac: &[u8], message: &[u8]) -> Result<Vec<u8>, Error>;
|
||||
/// Agree on shared key.
|
||||
fn agree(&self, account: &StoreAccountRef, password: &Password, other: &Public) -> Result<Secret, Error>;
|
||||
/// Inserts new accounts to the store (or vault) with given password.
|
||||
fn insert_account(
|
||||
&self,
|
||||
vault: SecretVaultRef,
|
||||
secret: Secret,
|
||||
password: &Password,
|
||||
) -> Result<StoreAccountRef, Error>;
|
||||
/// Inserts new derived account to the store (or vault) with given password.
|
||||
fn insert_derived(
|
||||
&self,
|
||||
vault: SecretVaultRef,
|
||||
account_ref: &StoreAccountRef,
|
||||
password: &Password,
|
||||
derivation: Derivation,
|
||||
) -> Result<StoreAccountRef, Error>;
|
||||
/// Changes accounts password.
|
||||
fn change_password(
|
||||
&self,
|
||||
account: &StoreAccountRef,
|
||||
old_password: &Password,
|
||||
new_password: &Password,
|
||||
) -> Result<(), Error>;
|
||||
/// Exports key details for account.
|
||||
fn export_account(
|
||||
&self,
|
||||
account: &StoreAccountRef,
|
||||
password: &Password,
|
||||
) -> Result<OpaqueKeyFile, Error>;
|
||||
/// Entirely removes account from the store and underlying storage.
|
||||
fn remove_account(&self, account: &StoreAccountRef, password: &Password) -> Result<(), Error>;
|
||||
/// Generates new derived account.
|
||||
fn generate_derived(
|
||||
&self,
|
||||
account_ref: &StoreAccountRef,
|
||||
password: &Password,
|
||||
derivation: Derivation,
|
||||
) -> Result<Address, Error>;
|
||||
/// Sign a message with given account.
|
||||
fn sign(
|
||||
&self,
|
||||
account: &StoreAccountRef,
|
||||
password: &Password,
|
||||
message: &Message,
|
||||
) -> Result<Signature, Error>;
|
||||
/// Sign a message with derived account.
|
||||
fn sign_derived(
|
||||
&self,
|
||||
account_ref: &StoreAccountRef,
|
||||
password: &Password,
|
||||
derivation: Derivation,
|
||||
message: &Message,
|
||||
) -> Result<Signature, Error>;
|
||||
/// Decrypt a messages with given account.
|
||||
fn decrypt(
|
||||
&self,
|
||||
account: &StoreAccountRef,
|
||||
password: &Password,
|
||||
shared_mac: &[u8],
|
||||
message: &[u8],
|
||||
) -> Result<Vec<u8>, Error>;
|
||||
/// Agree on shared key.
|
||||
fn agree(
|
||||
&self,
|
||||
account: &StoreAccountRef,
|
||||
password: &Password,
|
||||
other: &Public,
|
||||
) -> Result<Secret, Error>;
|
||||
|
||||
/// Returns all accounts in this secret store.
|
||||
fn accounts(&self) -> Result<Vec<StoreAccountRef>, Error>;
|
||||
/// Get reference to some account with given address.
|
||||
/// This method could be removed if we will guarantee that there is max(1) account for given address.
|
||||
fn account_ref(&self, address: &Address) -> Result<StoreAccountRef, Error>;
|
||||
/// Returns all accounts in this secret store.
|
||||
fn accounts(&self) -> Result<Vec<StoreAccountRef>, Error>;
|
||||
/// Get reference to some account with given address.
|
||||
/// This method could be removed if we will guarantee that there is max(1) account for given address.
|
||||
fn account_ref(&self, address: &Address) -> Result<StoreAccountRef, Error>;
|
||||
|
||||
/// Create new vault with given password
|
||||
fn create_vault(&self, name: &str, password: &Password) -> Result<(), Error>;
|
||||
/// Open vault with given password
|
||||
fn open_vault(&self, name: &str, password: &Password) -> Result<(), Error>;
|
||||
/// Close vault
|
||||
fn close_vault(&self, name: &str) -> Result<(), Error>;
|
||||
/// List all vaults
|
||||
fn list_vaults(&self) -> Result<Vec<String>, Error>;
|
||||
/// List all currently opened vaults
|
||||
fn list_opened_vaults(&self) -> Result<Vec<String>, Error>;
|
||||
/// Change vault password
|
||||
fn change_vault_password(&self, name: &str, new_password: &Password) -> Result<(), Error>;
|
||||
/// Cnage account' vault
|
||||
fn change_account_vault(&self, vault: SecretVaultRef, account: StoreAccountRef) -> Result<StoreAccountRef, Error>;
|
||||
/// Get vault metadata string.
|
||||
fn get_vault_meta(&self, name: &str) -> Result<String, Error>;
|
||||
/// Set vault metadata string.
|
||||
fn set_vault_meta(&self, name: &str, meta: &str) -> Result<(), Error>;
|
||||
/// Create new vault with given password
|
||||
fn create_vault(&self, name: &str, password: &Password) -> Result<(), Error>;
|
||||
/// Open vault with given password
|
||||
fn open_vault(&self, name: &str, password: &Password) -> Result<(), Error>;
|
||||
/// Close vault
|
||||
fn close_vault(&self, name: &str) -> Result<(), Error>;
|
||||
/// List all vaults
|
||||
fn list_vaults(&self) -> Result<Vec<String>, Error>;
|
||||
/// List all currently opened vaults
|
||||
fn list_opened_vaults(&self) -> Result<Vec<String>, Error>;
|
||||
/// Change vault password
|
||||
fn change_vault_password(&self, name: &str, new_password: &Password) -> Result<(), Error>;
|
||||
/// Cnage account' vault
|
||||
fn change_account_vault(
|
||||
&self,
|
||||
vault: SecretVaultRef,
|
||||
account: StoreAccountRef,
|
||||
) -> Result<StoreAccountRef, Error>;
|
||||
/// Get vault metadata string.
|
||||
fn get_vault_meta(&self, name: &str) -> Result<String, Error>;
|
||||
/// Set vault metadata string.
|
||||
fn set_vault_meta(&self, name: &str, meta: &str) -> Result<(), Error>;
|
||||
}
|
||||
|
||||
/// Secret Store API
|
||||
pub trait SecretStore: SimpleSecretStore {
|
||||
/// Returns a raw opaque Secret that can be later used to sign a message.
|
||||
fn raw_secret(
|
||||
&self,
|
||||
account: &StoreAccountRef,
|
||||
password: &Password,
|
||||
) -> Result<OpaqueSecret, Error>;
|
||||
|
||||
/// Returns a raw opaque Secret that can be later used to sign a message.
|
||||
fn raw_secret(&self, account: &StoreAccountRef, password: &Password) -> Result<OpaqueSecret, Error>;
|
||||
/// Signs a message with raw secret.
|
||||
fn sign_with_secret(
|
||||
&self,
|
||||
secret: &OpaqueSecret,
|
||||
message: &Message,
|
||||
) -> Result<Signature, Error> {
|
||||
Ok(::ethkey::sign(&secret.0, message)?)
|
||||
}
|
||||
|
||||
/// Signs a message with raw secret.
|
||||
fn sign_with_secret(&self, secret: &OpaqueSecret, message: &Message) -> Result<Signature, Error> {
|
||||
Ok(crypto::publickey::sign(&secret.0, message)?)
|
||||
}
|
||||
/// Imports presale wallet
|
||||
fn import_presale(
|
||||
&self,
|
||||
vault: SecretVaultRef,
|
||||
json: &[u8],
|
||||
password: &Password,
|
||||
) -> Result<StoreAccountRef, Error>;
|
||||
/// Imports existing JSON wallet
|
||||
fn import_wallet(
|
||||
&self,
|
||||
vault: SecretVaultRef,
|
||||
json: &[u8],
|
||||
password: &Password,
|
||||
gen_id: bool,
|
||||
) -> Result<StoreAccountRef, Error>;
|
||||
/// Copies account between stores and vaults.
|
||||
fn copy_account(
|
||||
&self,
|
||||
new_store: &dyn SimpleSecretStore,
|
||||
new_vault: SecretVaultRef,
|
||||
account: &StoreAccountRef,
|
||||
password: &Password,
|
||||
new_password: &Password,
|
||||
) -> Result<(), Error>;
|
||||
/// Checks if password matches given account.
|
||||
fn test_password(&self, account: &StoreAccountRef, password: &Password) -> Result<bool, Error>;
|
||||
|
||||
/// Imports presale wallet
|
||||
fn import_presale(&self, vault: SecretVaultRef, json: &[u8], password: &Password) -> Result<StoreAccountRef, Error>;
|
||||
/// Imports existing JSON wallet
|
||||
fn import_wallet(&self, vault: SecretVaultRef, json: &[u8], password: &Password, gen_id: bool) -> Result<StoreAccountRef, Error>;
|
||||
/// Copies account between stores and vaults.
|
||||
fn copy_account(&self, new_store: &dyn SimpleSecretStore, new_vault: SecretVaultRef, account: &StoreAccountRef, password: &Password, new_password: &Password) -> Result<(), Error>;
|
||||
/// Checks if password matches given account.
|
||||
fn test_password(&self, account: &StoreAccountRef, password: &Password) -> Result<bool, Error>;
|
||||
/// Returns a public key for given account.
|
||||
fn public(&self, account: &StoreAccountRef, password: &Password) -> Result<Public, Error>;
|
||||
|
||||
/// Returns a public key for given account.
|
||||
fn public(&self, account: &StoreAccountRef, password: &Password) -> Result<Public, Error>;
|
||||
/// Returns uuid of an account.
|
||||
fn uuid(&self, account: &StoreAccountRef) -> Result<Uuid, Error>;
|
||||
/// Returns account's name.
|
||||
fn name(&self, account: &StoreAccountRef) -> Result<String, Error>;
|
||||
/// Returns account's metadata.
|
||||
fn meta(&self, account: &StoreAccountRef) -> Result<String, Error>;
|
||||
|
||||
/// Returns uuid of an account.
|
||||
fn uuid(&self, account: &StoreAccountRef) -> Result<Uuid, Error>;
|
||||
/// Returns account's name.
|
||||
fn name(&self, account: &StoreAccountRef) -> Result<String, Error>;
|
||||
/// Returns account's metadata.
|
||||
fn meta(&self, account: &StoreAccountRef) -> Result<String, Error>;
|
||||
/// Modifies account metadata.
|
||||
fn set_name(&self, account: &StoreAccountRef, name: String) -> Result<(), Error>;
|
||||
/// Modifies account name.
|
||||
fn set_meta(&self, account: &StoreAccountRef, meta: String) -> Result<(), Error>;
|
||||
|
||||
/// Modifies account metadata.
|
||||
fn set_name(&self, account: &StoreAccountRef, name: String) -> Result<(), Error>;
|
||||
/// Modifies account name.
|
||||
fn set_meta(&self, account: &StoreAccountRef, meta: String) -> Result<(), Error>;
|
||||
|
||||
/// Returns local path of the store.
|
||||
fn local_path(&self) -> PathBuf;
|
||||
/// Lists all found geth accounts.
|
||||
fn list_geth_accounts(&self, testnet: bool) -> Vec<Address>;
|
||||
/// Imports geth accounts to the store/vault.
|
||||
fn import_geth_accounts(&self, vault: SecretVaultRef, desired: Vec<Address>, testnet: bool) -> Result<Vec<StoreAccountRef>, Error>;
|
||||
/// Returns local path of the store.
|
||||
fn local_path(&self) -> PathBuf;
|
||||
}
|
||||
|
||||
impl StoreAccountRef {
|
||||
/// Create reference to root account with given address
|
||||
pub fn root(address: Address) -> Self {
|
||||
StoreAccountRef::new(SecretVaultRef::Root, address)
|
||||
}
|
||||
/// Create reference to root account with given address
|
||||
pub fn root(address: Address) -> Self {
|
||||
StoreAccountRef::new(SecretVaultRef::Root, address)
|
||||
}
|
||||
|
||||
/// Create reference to vault account with given address
|
||||
pub fn vault(vault_name: &str, address: Address) -> Self {
|
||||
StoreAccountRef::new(SecretVaultRef::Vault(vault_name.to_owned()), address)
|
||||
}
|
||||
/// Create reference to vault account with given address
|
||||
pub fn vault(vault_name: &str, address: Address) -> Self {
|
||||
StoreAccountRef::new(SecretVaultRef::Vault(vault_name.to_owned()), address)
|
||||
}
|
||||
|
||||
/// Create new account reference
|
||||
pub fn new(vault_ref: SecretVaultRef, address: Address) -> Self {
|
||||
StoreAccountRef {
|
||||
vault: vault_ref,
|
||||
address: address,
|
||||
}
|
||||
}
|
||||
/// Create new account reference
|
||||
pub fn new(vault_ref: SecretVaultRef, address: Address) -> Self {
|
||||
StoreAccountRef {
|
||||
vault: vault_ref,
|
||||
address: address,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Hash for StoreAccountRef {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
self.address.hash(state);
|
||||
}
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
self.address.hash(state);
|
||||
}
|
||||
}
|
||||
|
||||
/// Node in hierarchical derivation.
|
||||
pub struct IndexDerivation {
|
||||
/// Node is soft (allows proof of parent from parent node).
|
||||
pub soft: bool,
|
||||
/// Index sequence of the node.
|
||||
pub index: u32,
|
||||
/// Node is soft (allows proof of parent from parent node).
|
||||
pub soft: bool,
|
||||
/// Index sequence of the node.
|
||||
pub index: u32,
|
||||
}
|
||||
|
||||
/// Derivation scheme for keys
|
||||
pub enum Derivation {
|
||||
/// Hierarchical derivation
|
||||
Hierarchical(Vec<IndexDerivation>),
|
||||
/// Hash derivation, soft.
|
||||
SoftHash(H256),
|
||||
/// Hash derivation, hard.
|
||||
HardHash(H256),
|
||||
/// Hierarchical derivation
|
||||
Hierarchical(Vec<IndexDerivation>),
|
||||
/// Hash derivation, soft.
|
||||
SoftHash(H256),
|
||||
/// Hash derivation, hard.
|
||||
HardHash(H256),
|
||||
}
|
||||
|
||||
@@ -1,160 +1,197 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
extern crate rand;
|
||||
extern crate ethstore;
|
||||
extern crate ethereum_types;
|
||||
extern crate parity_crypto;
|
||||
extern crate rand;
|
||||
|
||||
mod util;
|
||||
|
||||
use ethstore::{EthStore, SimpleSecretStore, SecretVaultRef, StoreAccountRef};
|
||||
use parity_crypto::publickey::{Random, Generator, Secret, KeyPair, verify_address};
|
||||
use ethstore::accounts_dir::RootDiskDirectory;
|
||||
use ethstore::{
|
||||
accounts_dir::RootDiskDirectory,
|
||||
ethkey::{verify_address, Generator, KeyPair, Random, Secret},
|
||||
EthStore, SecretVaultRef, SimpleSecretStore, StoreAccountRef,
|
||||
};
|
||||
use util::TransientDir;
|
||||
use ethereum_types::Address;
|
||||
use std::str::FromStr;
|
||||
|
||||
#[test]
|
||||
fn secret_store_create() {
|
||||
let dir = TransientDir::create().unwrap();
|
||||
let _ = EthStore::open(Box::new(dir)).unwrap();
|
||||
let dir = TransientDir::create().unwrap();
|
||||
let _ = EthStore::open(Box::new(dir)).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn secret_store_open_not_existing() {
|
||||
let dir = TransientDir::open();
|
||||
let _ = EthStore::open(Box::new(dir)).unwrap();
|
||||
let dir = TransientDir::open();
|
||||
let _ = EthStore::open(Box::new(dir)).unwrap();
|
||||
}
|
||||
|
||||
fn random_secret() -> Secret {
|
||||
Random.generate().secret().clone()
|
||||
Random.generate().unwrap().secret().clone()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn secret_store_create_account() {
|
||||
let dir = TransientDir::create().unwrap();
|
||||
let store = EthStore::open(Box::new(dir)).unwrap();
|
||||
assert_eq!(store.accounts().unwrap().len(), 0);
|
||||
assert!(store.insert_account(SecretVaultRef::Root, random_secret(), &"".into()).is_ok());
|
||||
assert_eq!(store.accounts().unwrap().len(), 1);
|
||||
assert!(store.insert_account(SecretVaultRef::Root, random_secret(), &"".into()).is_ok());
|
||||
assert_eq!(store.accounts().unwrap().len(), 2);
|
||||
let dir = TransientDir::create().unwrap();
|
||||
let store = EthStore::open(Box::new(dir)).unwrap();
|
||||
assert_eq!(store.accounts().unwrap().len(), 0);
|
||||
assert!(store
|
||||
.insert_account(SecretVaultRef::Root, random_secret(), &"".into())
|
||||
.is_ok());
|
||||
assert_eq!(store.accounts().unwrap().len(), 1);
|
||||
assert!(store
|
||||
.insert_account(SecretVaultRef::Root, random_secret(), &"".into())
|
||||
.is_ok());
|
||||
assert_eq!(store.accounts().unwrap().len(), 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn secret_store_sign() {
|
||||
let dir = TransientDir::create().unwrap();
|
||||
let store = EthStore::open(Box::new(dir)).unwrap();
|
||||
assert!(store.insert_account(SecretVaultRef::Root, random_secret(), &"".into()).is_ok());
|
||||
let accounts = store.accounts().unwrap();
|
||||
let message = [1u8; 32].into();
|
||||
assert_eq!(accounts.len(), 1);
|
||||
assert!(store.sign(&accounts[0], &"".into(), &message).is_ok());
|
||||
assert!(store.sign(&accounts[0], &"1".into(), &message).is_err());
|
||||
let dir = TransientDir::create().unwrap();
|
||||
let store = EthStore::open(Box::new(dir)).unwrap();
|
||||
assert!(store
|
||||
.insert_account(SecretVaultRef::Root, random_secret(), &"".into())
|
||||
.is_ok());
|
||||
let accounts = store.accounts().unwrap();
|
||||
assert_eq!(accounts.len(), 1);
|
||||
assert!(store
|
||||
.sign(&accounts[0], &"".into(), &Default::default())
|
||||
.is_ok());
|
||||
assert!(store
|
||||
.sign(&accounts[0], &"1".into(), &Default::default())
|
||||
.is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn secret_store_change_password() {
|
||||
let dir = TransientDir::create().unwrap();
|
||||
let store = EthStore::open(Box::new(dir)).unwrap();
|
||||
assert!(store.insert_account(SecretVaultRef::Root, random_secret(), &"".into()).is_ok());
|
||||
let accounts = store.accounts().unwrap();
|
||||
let message = [1u8; 32].into();
|
||||
assert_eq!(accounts.len(), 1);
|
||||
assert!(store.sign(&accounts[0], &"".into(), &message).is_ok());
|
||||
assert!(store.change_password(&accounts[0], &"".into(), &"1".into()).is_ok());
|
||||
assert!(store.sign(&accounts[0], &"".into(), &message).is_err());
|
||||
assert!(store.sign(&accounts[0], &"1".into(), &message).is_ok());
|
||||
let dir = TransientDir::create().unwrap();
|
||||
let store = EthStore::open(Box::new(dir)).unwrap();
|
||||
assert!(store
|
||||
.insert_account(SecretVaultRef::Root, random_secret(), &"".into())
|
||||
.is_ok());
|
||||
let accounts = store.accounts().unwrap();
|
||||
assert_eq!(accounts.len(), 1);
|
||||
assert!(store
|
||||
.sign(&accounts[0], &"".into(), &Default::default())
|
||||
.is_ok());
|
||||
assert!(store
|
||||
.change_password(&accounts[0], &"".into(), &"1".into())
|
||||
.is_ok());
|
||||
assert!(store
|
||||
.sign(&accounts[0], &"".into(), &Default::default())
|
||||
.is_err());
|
||||
assert!(store
|
||||
.sign(&accounts[0], &"1".into(), &Default::default())
|
||||
.is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn secret_store_remove_account() {
|
||||
let dir = TransientDir::create().unwrap();
|
||||
let store = EthStore::open(Box::new(dir)).unwrap();
|
||||
assert!(store.insert_account(SecretVaultRef::Root, random_secret(), &"".into()).is_ok());
|
||||
let accounts = store.accounts().unwrap();
|
||||
assert_eq!(accounts.len(), 1);
|
||||
assert!(store.remove_account(&accounts[0], &"".into()).is_ok());
|
||||
assert_eq!(store.accounts().unwrap().len(), 0);
|
||||
assert!(store.remove_account(&accounts[0], &"".into()).is_err());
|
||||
let dir = TransientDir::create().unwrap();
|
||||
let store = EthStore::open(Box::new(dir)).unwrap();
|
||||
assert!(store
|
||||
.insert_account(SecretVaultRef::Root, random_secret(), &"".into())
|
||||
.is_ok());
|
||||
let accounts = store.accounts().unwrap();
|
||||
assert_eq!(accounts.len(), 1);
|
||||
assert!(store.remove_account(&accounts[0], &"".into()).is_ok());
|
||||
assert_eq!(store.accounts().unwrap().len(), 0);
|
||||
assert!(store.remove_account(&accounts[0], &"".into()).is_err());
|
||||
}
|
||||
|
||||
fn test_path() -> &'static str {
|
||||
match ::std::fs::metadata("ethstore") {
|
||||
Ok(_) => "ethstore/tests/res/geth_keystore",
|
||||
Err(_) => "tests/res/geth_keystore",
|
||||
}
|
||||
match ::std::fs::metadata("ethstore") {
|
||||
Ok(_) => "ethstore/tests/res/geth_keystore",
|
||||
Err(_) => "tests/res/geth_keystore",
|
||||
}
|
||||
}
|
||||
|
||||
fn pat_path() -> &'static str {
|
||||
match ::std::fs::metadata("ethstore") {
|
||||
Ok(_) => "ethstore/tests/res/pat",
|
||||
Err(_) => "tests/res/pat",
|
||||
}
|
||||
match ::std::fs::metadata("ethstore") {
|
||||
Ok(_) => "ethstore/tests/res/pat",
|
||||
Err(_) => "tests/res/pat",
|
||||
}
|
||||
}
|
||||
|
||||
fn ciphertext_path() -> &'static str {
|
||||
match ::std::fs::metadata("ethstore") {
|
||||
Ok(_) => "ethstore/tests/res/ciphertext",
|
||||
Err(_) => "tests/res/ciphertext",
|
||||
}
|
||||
match ::std::fs::metadata("ethstore") {
|
||||
Ok(_) => "ethstore/tests/res/ciphertext",
|
||||
Err(_) => "tests/res/ciphertext",
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn secret_store_laod_geth_files() {
|
||||
let dir = RootDiskDirectory::at(test_path());
|
||||
let store = EthStore::open(Box::new(dir)).unwrap();
|
||||
assert_eq!(store.accounts().unwrap(), vec![
|
||||
StoreAccountRef::root(Address::from_str("3f49624084b67849c7b4e805c5988c21a430f9d9").unwrap()),
|
||||
StoreAccountRef::root(Address::from_str("5ba4dcf897e97c2bdf8315b9ef26c13c085988cf").unwrap()),
|
||||
StoreAccountRef::root(Address::from_str("63121b431a52f8043c16fcf0d1df9cb7b5f66649").unwrap()),
|
||||
]);
|
||||
let dir = RootDiskDirectory::at(test_path());
|
||||
let store = EthStore::open(Box::new(dir)).unwrap();
|
||||
assert_eq!(
|
||||
store.accounts().unwrap(),
|
||||
vec![
|
||||
StoreAccountRef::root("3f49624084b67849c7b4e805c5988c21a430f9d9".into()),
|
||||
StoreAccountRef::root("5ba4dcf897e97c2bdf8315b9ef26c13c085988cf".into()),
|
||||
StoreAccountRef::root("63121b431a52f8043c16fcf0d1df9cb7b5f66649".into()),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn secret_store_load_pat_files() {
|
||||
let dir = RootDiskDirectory::at(pat_path());
|
||||
let store = EthStore::open(Box::new(dir)).unwrap();
|
||||
assert_eq!(store.accounts().unwrap(), vec![
|
||||
StoreAccountRef::root(Address::from_str("3f49624084b67849c7b4e805c5988c21a430f9d9").unwrap()),
|
||||
StoreAccountRef::root(Address::from_str("5ba4dcf897e97c2bdf8315b9ef26c13c085988cf").unwrap()),
|
||||
]);
|
||||
let dir = RootDiskDirectory::at(pat_path());
|
||||
let store = EthStore::open(Box::new(dir)).unwrap();
|
||||
assert_eq!(
|
||||
store.accounts().unwrap(),
|
||||
vec![
|
||||
StoreAccountRef::root("3f49624084b67849c7b4e805c5988c21a430f9d9".into()),
|
||||
StoreAccountRef::root("5ba4dcf897e97c2bdf8315b9ef26c13c085988cf".into()),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_decrypting_files_with_short_ciphertext() {
|
||||
// 31e9d1e6d844bd3a536800ef8d8be6a9975db509, 30
|
||||
let kp1 = KeyPair::from_secret("000081c29e8142bb6a81bef5a92bda7a8328a5c85bb2f9542e76f9b0f94fc018".parse().unwrap()).unwrap();
|
||||
// d1e64e5480bfaf733ba7d48712decb8227797a4e , 31
|
||||
let kp2 = KeyPair::from_secret("00fa7b3db73dc7dfdf8c5fbdb796d741e4488628c41fc4febd9160a866ba0f35".parse().unwrap()).unwrap();
|
||||
let dir = RootDiskDirectory::at(ciphertext_path());
|
||||
let store = EthStore::open(Box::new(dir)).unwrap();
|
||||
let accounts = store.accounts().unwrap();
|
||||
assert_eq!(accounts, vec![
|
||||
StoreAccountRef::root(Address::from_str("31e9d1e6d844bd3a536800ef8d8be6a9975db509").unwrap()),
|
||||
StoreAccountRef::root(Address::from_str("d1e64e5480bfaf733ba7d48712decb8227797a4e").unwrap()),
|
||||
]);
|
||||
// 31e9d1e6d844bd3a536800ef8d8be6a9975db509, 30
|
||||
let kp1 = KeyPair::from_secret(
|
||||
"000081c29e8142bb6a81bef5a92bda7a8328a5c85bb2f9542e76f9b0f94fc018"
|
||||
.parse()
|
||||
.unwrap(),
|
||||
)
|
||||
.unwrap();
|
||||
// d1e64e5480bfaf733ba7d48712decb8227797a4e , 31
|
||||
let kp2 = KeyPair::from_secret(
|
||||
"00fa7b3db73dc7dfdf8c5fbdb796d741e4488628c41fc4febd9160a866ba0f35"
|
||||
.parse()
|
||||
.unwrap(),
|
||||
)
|
||||
.unwrap();
|
||||
let dir = RootDiskDirectory::at(ciphertext_path());
|
||||
let store = EthStore::open(Box::new(dir)).unwrap();
|
||||
let accounts = store.accounts().unwrap();
|
||||
assert_eq!(
|
||||
accounts,
|
||||
vec![
|
||||
StoreAccountRef::root("31e9d1e6d844bd3a536800ef8d8be6a9975db509".into()),
|
||||
StoreAccountRef::root("d1e64e5480bfaf733ba7d48712decb8227797a4e".into()),
|
||||
]
|
||||
);
|
||||
|
||||
let message = [1u8; 32].into();
|
||||
let message = Default::default();
|
||||
|
||||
let s1 = store.sign(&accounts[0], &"foo".into(), &message).unwrap();
|
||||
let s2 = store.sign(&accounts[1], &"foo".into(), &message).unwrap();
|
||||
assert!(verify_address(&accounts[0].address, &s1, &message).unwrap());
|
||||
assert!(verify_address(&kp1.address(), &s1, &message).unwrap());
|
||||
assert!(verify_address(&kp2.address(), &s2, &message).unwrap());
|
||||
let s1 = store.sign(&accounts[0], &"foo".into(), &message).unwrap();
|
||||
let s2 = store.sign(&accounts[1], &"foo".into(), &message).unwrap();
|
||||
assert!(verify_address(&accounts[0].address, &s1, &message).unwrap());
|
||||
assert!(verify_address(&kp1.address(), &s1, &message).unwrap());
|
||||
assert!(verify_address(&kp2.address(), &s2, &message).unwrap());
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
mod transient_dir;
|
||||
|
||||
|
||||
@@ -1,81 +1,82 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::path::PathBuf;
|
||||
use std::{env, fs};
|
||||
use rand::{RngCore, rngs::OsRng};
|
||||
use ethstore::accounts_dir::{KeyDirectory, RootDiskDirectory};
|
||||
use ethstore::{Error, SafeAccount};
|
||||
use ethstore::{
|
||||
accounts_dir::{KeyDirectory, RootDiskDirectory},
|
||||
Error, SafeAccount,
|
||||
};
|
||||
use rand::{OsRng, Rng};
|
||||
use std::{env, fs, path::PathBuf};
|
||||
|
||||
pub fn random_dir() -> PathBuf {
|
||||
let mut rng = OsRng;
|
||||
let mut dir = env::temp_dir();
|
||||
dir.push(format!("{:x}-{:x}", rng.next_u64(), rng.next_u64()));
|
||||
dir
|
||||
let mut rng = OsRng::new().unwrap();
|
||||
let mut dir = env::temp_dir();
|
||||
dir.push(format!("{:x}-{:x}", rng.next_u64(), rng.next_u64()));
|
||||
dir
|
||||
}
|
||||
|
||||
pub struct TransientDir {
|
||||
dir: RootDiskDirectory,
|
||||
path: PathBuf,
|
||||
dir: RootDiskDirectory,
|
||||
path: PathBuf,
|
||||
}
|
||||
|
||||
impl TransientDir {
|
||||
pub fn create() -> Result<Self, Error> {
|
||||
let path = random_dir();
|
||||
let result = TransientDir {
|
||||
dir: RootDiskDirectory::create(&path)?,
|
||||
path: path,
|
||||
};
|
||||
pub fn create() -> Result<Self, Error> {
|
||||
let path = random_dir();
|
||||
let result = TransientDir {
|
||||
dir: RootDiskDirectory::create(&path)?,
|
||||
path: path,
|
||||
};
|
||||
|
||||
Ok(result)
|
||||
}
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
pub fn open() -> Self {
|
||||
let path = random_dir();
|
||||
TransientDir {
|
||||
dir: RootDiskDirectory::at(&path),
|
||||
path: path,
|
||||
}
|
||||
}
|
||||
pub fn open() -> Self {
|
||||
let path = random_dir();
|
||||
TransientDir {
|
||||
dir: RootDiskDirectory::at(&path),
|
||||
path: path,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for TransientDir {
|
||||
fn drop(&mut self) {
|
||||
fs::remove_dir_all(&self.path).expect("Expected to remove temp dir");
|
||||
}
|
||||
fn drop(&mut self) {
|
||||
fs::remove_dir_all(&self.path).expect("Expected to remove temp dir");
|
||||
}
|
||||
}
|
||||
|
||||
impl KeyDirectory for TransientDir {
|
||||
fn load(&self) -> Result<Vec<SafeAccount>, Error> {
|
||||
self.dir.load()
|
||||
}
|
||||
fn load(&self) -> Result<Vec<SafeAccount>, Error> {
|
||||
self.dir.load()
|
||||
}
|
||||
|
||||
fn update(&self, account: SafeAccount) -> Result<SafeAccount, Error> {
|
||||
self.dir.update(account)
|
||||
}
|
||||
fn update(&self, account: SafeAccount) -> Result<SafeAccount, Error> {
|
||||
self.dir.update(account)
|
||||
}
|
||||
|
||||
fn insert(&self, account: SafeAccount) -> Result<SafeAccount, Error> {
|
||||
self.dir.insert(account)
|
||||
}
|
||||
fn insert(&self, account: SafeAccount) -> Result<SafeAccount, Error> {
|
||||
self.dir.insert(account)
|
||||
}
|
||||
|
||||
fn remove(&self, account: &SafeAccount) -> Result<(), Error> {
|
||||
self.dir.remove(account)
|
||||
}
|
||||
fn remove(&self, account: &SafeAccount) -> Result<(), Error> {
|
||||
self.dir.remove(account)
|
||||
}
|
||||
|
||||
fn unique_repr(&self) -> Result<u64, Error> {
|
||||
self.dir.unique_repr()
|
||||
}
|
||||
fn unique_repr(&self) -> Result<u64, Error> {
|
||||
self.dir.unique_repr()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,73 +1,71 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Account Metadata
|
||||
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
time::Instant,
|
||||
};
|
||||
use std::{collections::HashMap, time::Instant};
|
||||
|
||||
use parity_crypto::publickey::Address;
|
||||
use ethkey::Password;
|
||||
use serde_derive::{Serialize, Deserialize};
|
||||
use ethkey::{Address, Password};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use serde_json;
|
||||
|
||||
/// Type of unlock.
|
||||
#[derive(Clone, PartialEq)]
|
||||
pub enum Unlock {
|
||||
/// If account is unlocked temporarily, it should be locked after first usage.
|
||||
OneTime,
|
||||
/// Account unlocked permanently can always sign message.
|
||||
/// Use with caution.
|
||||
Perm,
|
||||
/// Account unlocked with a timeout
|
||||
Timed(Instant),
|
||||
/// If account is unlocked temporarily, it should be locked after first usage.
|
||||
OneTime,
|
||||
/// Account unlocked permanently can always sign message.
|
||||
/// Use with caution.
|
||||
Perm,
|
||||
/// Account unlocked with a timeout
|
||||
Timed(Instant),
|
||||
}
|
||||
|
||||
/// Data associated with account.
|
||||
#[derive(Clone)]
|
||||
pub struct AccountData {
|
||||
pub unlock: Unlock,
|
||||
pub password: Password,
|
||||
pub unlock: Unlock,
|
||||
pub password: Password,
|
||||
}
|
||||
|
||||
/// Collected account metadata
|
||||
#[derive(Default, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct AccountMeta {
|
||||
/// The name of the account.
|
||||
pub name: String,
|
||||
/// The rest of the metadata of the account.
|
||||
pub meta: String,
|
||||
/// The 128-bit Uuid of the account, if it has one (brain-wallets don't).
|
||||
pub uuid: Option<String>,
|
||||
/// The name of the account.
|
||||
pub name: String,
|
||||
/// The rest of the metadata of the account.
|
||||
pub meta: String,
|
||||
/// The 128-bit Uuid of the account, if it has one (brain-wallets don't).
|
||||
pub uuid: Option<String>,
|
||||
}
|
||||
|
||||
impl AccountMeta {
|
||||
/// Read a hash map of Address -> AccountMeta
|
||||
pub fn read<R>(reader: R) -> Result<HashMap<Address, Self>, serde_json::Error> where
|
||||
R: ::std::io::Read,
|
||||
{
|
||||
serde_json::from_reader(reader)
|
||||
}
|
||||
/// Read a hash map of Address -> AccountMeta
|
||||
pub fn read<R>(reader: R) -> Result<HashMap<Address, Self>, serde_json::Error>
|
||||
where
|
||||
R: ::std::io::Read,
|
||||
{
|
||||
serde_json::from_reader(reader)
|
||||
}
|
||||
|
||||
/// Write a hash map of Address -> AccountMeta
|
||||
pub fn write<W>(m: &HashMap<Address, Self>, writer: &mut W) -> Result<(), serde_json::Error> where
|
||||
W: ::std::io::Write,
|
||||
{
|
||||
serde_json::to_writer(writer, m)
|
||||
}
|
||||
/// Write a hash map of Address -> AccountMeta
|
||||
pub fn write<W>(m: &HashMap<Address, Self>, writer: &mut W) -> Result<(), serde_json::Error>
|
||||
where
|
||||
W: ::std::io::Write,
|
||||
{
|
||||
serde_json::to_writer(writer, m)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,46 +1,46 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::fmt;
|
||||
|
||||
use ethstore::{Error as SSError};
|
||||
use ethstore::Error as SSError;
|
||||
|
||||
/// Signing error
|
||||
#[derive(Debug)]
|
||||
pub enum SignError {
|
||||
/// Account is not unlocked
|
||||
NotUnlocked,
|
||||
/// Account does not exist.
|
||||
NotFound,
|
||||
/// Low-level error from store
|
||||
SStore(SSError),
|
||||
/// Account is not unlocked
|
||||
NotUnlocked,
|
||||
/// Account does not exist.
|
||||
NotFound,
|
||||
/// Low-level error from store
|
||||
SStore(SSError),
|
||||
}
|
||||
|
||||
impl fmt::Display for SignError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
match *self {
|
||||
SignError::NotUnlocked => write!(f, "Account is locked"),
|
||||
SignError::NotFound => write!(f, "Account does not exist"),
|
||||
SignError::SStore(ref e) => write!(f, "{}", e),
|
||||
}
|
||||
}
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
match *self {
|
||||
SignError::NotUnlocked => write!(f, "Account is locked"),
|
||||
SignError::NotFound => write!(f, "Account does not exist"),
|
||||
SignError::SStore(ref e) => write!(f, "{}", e),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<SSError> for SignError {
|
||||
fn from(e: SSError) -> Self {
|
||||
SignError::SStore(e)
|
||||
}
|
||||
fn from(e: SSError) -> Self {
|
||||
SignError::SStore(e)
|
||||
}
|
||||
}
|
||||
|
||||
1248
accounts/src/lib.rs
1248
accounts/src/lib.rs
File diff suppressed because it is too large
Load Diff
@@ -1,189 +1,237 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Address Book Store
|
||||
|
||||
use std::{fs, fmt, hash, ops};
|
||||
use std::collections::HashMap;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
fmt, fs, hash, ops,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use parity_crypto::publickey::Address;
|
||||
use ethkey::Address;
|
||||
use log::{trace, warn};
|
||||
|
||||
use crate::AccountMeta;
|
||||
|
||||
/// Disk-backed map from Address to String. Uses JSON.
|
||||
pub struct AddressBook {
|
||||
cache: DiskMap<Address, AccountMeta>,
|
||||
cache: DiskMap<Address, AccountMeta>,
|
||||
}
|
||||
|
||||
impl AddressBook {
|
||||
/// Creates new address book at given directory.
|
||||
pub fn new(path: &Path) -> Self {
|
||||
let mut r = AddressBook {
|
||||
cache: DiskMap::new(path, "address_book.json")
|
||||
};
|
||||
r.cache.revert(AccountMeta::read);
|
||||
r
|
||||
}
|
||||
/// Creates new address book at given directory.
|
||||
pub fn new(path: &Path) -> Self {
|
||||
let mut r = AddressBook {
|
||||
cache: DiskMap::new(path, "address_book.json"),
|
||||
};
|
||||
r.cache.revert(AccountMeta::read);
|
||||
r
|
||||
}
|
||||
|
||||
/// Creates transient address book (no changes are saved to disk).
|
||||
pub fn transient() -> Self {
|
||||
AddressBook {
|
||||
cache: DiskMap::transient()
|
||||
}
|
||||
}
|
||||
/// Creates transient address book (no changes are saved to disk).
|
||||
pub fn transient() -> Self {
|
||||
AddressBook {
|
||||
cache: DiskMap::transient(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the address book.
|
||||
pub fn get(&self) -> HashMap<Address, AccountMeta> {
|
||||
self.cache.clone()
|
||||
}
|
||||
/// Get the address book.
|
||||
pub fn get(&self) -> HashMap<Address, AccountMeta> {
|
||||
self.cache.clone()
|
||||
}
|
||||
|
||||
fn save(&self) {
|
||||
self.cache.save(AccountMeta::write)
|
||||
}
|
||||
fn save(&self) {
|
||||
self.cache.save(AccountMeta::write)
|
||||
}
|
||||
|
||||
/// Sets new name for given address.
|
||||
pub fn set_name(&mut self, a: Address, name: String) {
|
||||
{
|
||||
let x = self.cache.entry(a)
|
||||
.or_insert_with(|| AccountMeta {name: Default::default(), meta: "{}".to_owned(), uuid: None});
|
||||
x.name = name;
|
||||
}
|
||||
self.save();
|
||||
}
|
||||
/// Sets new name for given address.
|
||||
pub fn set_name(&mut self, a: Address, name: String) {
|
||||
{
|
||||
let x = self.cache.entry(a).or_insert_with(|| AccountMeta {
|
||||
name: Default::default(),
|
||||
meta: "{}".to_owned(),
|
||||
uuid: None,
|
||||
});
|
||||
x.name = name;
|
||||
}
|
||||
self.save();
|
||||
}
|
||||
|
||||
/// Sets new meta for given address.
|
||||
pub fn set_meta(&mut self, a: Address, meta: String) {
|
||||
{
|
||||
let x = self.cache.entry(a)
|
||||
.or_insert_with(|| AccountMeta {name: "Anonymous".to_owned(), meta: Default::default(), uuid: None});
|
||||
x.meta = meta;
|
||||
}
|
||||
self.save();
|
||||
}
|
||||
/// Sets new meta for given address.
|
||||
pub fn set_meta(&mut self, a: Address, meta: String) {
|
||||
{
|
||||
let x = self.cache.entry(a).or_insert_with(|| AccountMeta {
|
||||
name: "Anonymous".to_owned(),
|
||||
meta: Default::default(),
|
||||
uuid: None,
|
||||
});
|
||||
x.meta = meta;
|
||||
}
|
||||
self.save();
|
||||
}
|
||||
|
||||
/// Removes an entry
|
||||
pub fn remove(&mut self, a: Address) {
|
||||
self.cache.remove(&a);
|
||||
self.save();
|
||||
}
|
||||
/// Removes an entry
|
||||
pub fn remove(&mut self, a: Address) {
|
||||
self.cache.remove(&a);
|
||||
self.save();
|
||||
}
|
||||
}
|
||||
|
||||
/// Disk-serializable HashMap
|
||||
#[derive(Debug)]
|
||||
struct DiskMap<K: hash::Hash + Eq, V> {
|
||||
path: PathBuf,
|
||||
cache: HashMap<K, V>,
|
||||
transient: bool,
|
||||
path: PathBuf,
|
||||
cache: HashMap<K, V>,
|
||||
transient: bool,
|
||||
}
|
||||
|
||||
impl<K: hash::Hash + Eq, V> ops::Deref for DiskMap<K, V> {
|
||||
type Target = HashMap<K, V>;
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.cache
|
||||
}
|
||||
type Target = HashMap<K, V>;
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.cache
|
||||
}
|
||||
}
|
||||
|
||||
impl<K: hash::Hash + Eq, V> ops::DerefMut for DiskMap<K, V> {
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
&mut self.cache
|
||||
}
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
&mut self.cache
|
||||
}
|
||||
}
|
||||
|
||||
impl<K: hash::Hash + Eq, V> DiskMap<K, V> {
|
||||
pub fn new(path: &Path, file_name: &str) -> Self {
|
||||
let mut path = path.to_owned();
|
||||
path.push(file_name);
|
||||
trace!(target: "diskmap", "path={:?}", path);
|
||||
DiskMap {
|
||||
path: path,
|
||||
cache: HashMap::new(),
|
||||
transient: false,
|
||||
}
|
||||
}
|
||||
pub fn new(path: &Path, file_name: &str) -> Self {
|
||||
let mut path = path.to_owned();
|
||||
path.push(file_name);
|
||||
trace!(target: "diskmap", "path={:?}", path);
|
||||
DiskMap {
|
||||
path: path,
|
||||
cache: HashMap::new(),
|
||||
transient: false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn transient() -> Self {
|
||||
let mut map = DiskMap::new(&PathBuf::new(), "diskmap.json".into());
|
||||
map.transient = true;
|
||||
map
|
||||
}
|
||||
pub fn transient() -> Self {
|
||||
let mut map = DiskMap::new(&PathBuf::new(), "diskmap.json".into());
|
||||
map.transient = true;
|
||||
map
|
||||
}
|
||||
|
||||
fn revert<F, E>(&mut self, read: F) where
|
||||
F: Fn(fs::File) -> Result<HashMap<K, V>, E>,
|
||||
E: fmt::Display,
|
||||
{
|
||||
if self.transient { return; }
|
||||
trace!(target: "diskmap", "revert {:?}", self.path);
|
||||
let _ = fs::File::open(self.path.clone())
|
||||
.map_err(|e| trace!(target: "diskmap", "Couldn't open disk map: {}", e))
|
||||
.and_then(|f| read(f).map_err(|e| warn!(target: "diskmap", "Couldn't read disk map at: {:?} {}", self.path, e)))
|
||||
.and_then(|m| {
|
||||
self.cache = m;
|
||||
Ok(())
|
||||
});
|
||||
}
|
||||
fn revert<F, E>(&mut self, read: F)
|
||||
where
|
||||
F: Fn(fs::File) -> Result<HashMap<K, V>, E>,
|
||||
E: fmt::Display,
|
||||
{
|
||||
if self.transient {
|
||||
return;
|
||||
}
|
||||
trace!(target: "diskmap", "revert {:?}", self.path);
|
||||
let _ = fs::File::open(self.path.clone())
|
||||
.map_err(|e| trace!(target: "diskmap", "Couldn't open disk map: {}", e))
|
||||
.and_then(|f| {
|
||||
read(f).map_err(|e| warn!(target: "diskmap", "Couldn't read disk map: {}", e))
|
||||
})
|
||||
.and_then(|m| {
|
||||
self.cache = m;
|
||||
Ok(())
|
||||
});
|
||||
}
|
||||
|
||||
fn save<F, E>(&self, write: F) where
|
||||
F: Fn(&HashMap<K, V>, &mut fs::File) -> Result<(), E>,
|
||||
E: fmt::Display,
|
||||
{
|
||||
if self.transient { return; }
|
||||
trace!(target: "diskmap", "save {:?}", self.path);
|
||||
let _ = fs::File::create(self.path.clone())
|
||||
.map_err(|e| warn!(target: "diskmap", "Couldn't open disk map for writing at: {:?} {}", self.path, e))
|
||||
.and_then(|mut f| {
|
||||
write(&self.cache, &mut f).map_err(|e| warn!(target: "diskmap", "Couldn't write to disk map at: {:?} {}", self.path, e))
|
||||
});
|
||||
}
|
||||
fn save<F, E>(&self, write: F)
|
||||
where
|
||||
F: Fn(&HashMap<K, V>, &mut fs::File) -> Result<(), E>,
|
||||
E: fmt::Display,
|
||||
{
|
||||
if self.transient {
|
||||
return;
|
||||
}
|
||||
trace!(target: "diskmap", "save {:?}", self.path);
|
||||
let _ = fs::File::create(self.path.clone())
|
||||
.map_err(|e| warn!(target: "diskmap", "Couldn't open disk map for writing: {}", e))
|
||||
.and_then(|mut f| {
|
||||
write(&self.cache, &mut f)
|
||||
.map_err(|e| warn!(target: "diskmap", "Couldn't write to disk map: {}", e))
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{AddressBook, Address};
|
||||
use std::collections::HashMap;
|
||||
use tempfile::TempDir;
|
||||
use crate::account_data::AccountMeta;
|
||||
use super::AddressBook;
|
||||
use crate::account_data::AccountMeta;
|
||||
use std::collections::HashMap;
|
||||
use tempdir::TempDir;
|
||||
|
||||
#[test]
|
||||
fn should_save_and_reload_address_book() {
|
||||
let tempdir = TempDir::new().unwrap();
|
||||
let mut b = AddressBook::new(tempdir.path());
|
||||
b.set_name(Address::from_low_u64_be(1), "One".to_owned());
|
||||
b.set_meta(Address::from_low_u64_be(1), "{1:1}".to_owned());
|
||||
let b = AddressBook::new(tempdir.path());
|
||||
assert_eq!(b.get(), vec![
|
||||
(Address::from_low_u64_be(1), AccountMeta {name: "One".to_owned(), meta: "{1:1}".to_owned(), uuid: None})
|
||||
].into_iter().collect::<HashMap<_, _>>());
|
||||
}
|
||||
#[test]
|
||||
fn should_save_and_reload_address_book() {
|
||||
let tempdir = TempDir::new("").unwrap();
|
||||
let mut b = AddressBook::new(tempdir.path());
|
||||
b.set_name(1.into(), "One".to_owned());
|
||||
b.set_meta(1.into(), "{1:1}".to_owned());
|
||||
let b = AddressBook::new(tempdir.path());
|
||||
assert_eq!(
|
||||
b.get(),
|
||||
vec![(
|
||||
1,
|
||||
AccountMeta {
|
||||
name: "One".to_owned(),
|
||||
meta: "{1:1}".to_owned(),
|
||||
uuid: None
|
||||
}
|
||||
)]
|
||||
.into_iter()
|
||||
.map(|(a, b)| (a.into(), b))
|
||||
.collect::<HashMap<_, _>>()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_remove_address() {
|
||||
let tempdir = TempDir::new().unwrap();
|
||||
let mut b = AddressBook::new(tempdir.path());
|
||||
#[test]
|
||||
fn should_remove_address() {
|
||||
let tempdir = TempDir::new("").unwrap();
|
||||
let mut b = AddressBook::new(tempdir.path());
|
||||
|
||||
b.set_name(Address::from_low_u64_be(1), "One".to_owned());
|
||||
b.set_name(Address::from_low_u64_be(2), "Two".to_owned());
|
||||
b.set_name(Address::from_low_u64_be(3), "Three".to_owned());
|
||||
b.remove(Address::from_low_u64_be(2).into());
|
||||
b.set_name(1.into(), "One".to_owned());
|
||||
b.set_name(2.into(), "Two".to_owned());
|
||||
b.set_name(3.into(), "Three".to_owned());
|
||||
b.remove(2.into());
|
||||
|
||||
let b = AddressBook::new(tempdir.path());
|
||||
assert_eq!(b.get(), vec![
|
||||
(Address::from_low_u64_be(1), AccountMeta{name: "One".to_owned(), meta: "{}".to_owned(), uuid: None}),
|
||||
(Address::from_low_u64_be(3), AccountMeta{name: "Three".to_owned(), meta: "{}".to_owned(), uuid: None}),
|
||||
].into_iter().collect::<HashMap<_, _>>());
|
||||
}
|
||||
let b = AddressBook::new(tempdir.path());
|
||||
assert_eq!(
|
||||
b.get(),
|
||||
vec![
|
||||
(
|
||||
1,
|
||||
AccountMeta {
|
||||
name: "One".to_owned(),
|
||||
meta: "{}".to_owned(),
|
||||
uuid: None
|
||||
}
|
||||
),
|
||||
(
|
||||
3,
|
||||
AccountMeta {
|
||||
name: "Three".to_owned(),
|
||||
meta: "{}".to_owned(),
|
||||
uuid: None
|
||||
}
|
||||
),
|
||||
]
|
||||
.into_iter()
|
||||
.map(|(a, b)| (a.into(), b))
|
||||
.collect::<HashMap<_, _>>()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
description = "OpenEthereum Chain Specification"
|
||||
description = "Parity Ethereum Chain Specification"
|
||||
name = "chainspec"
|
||||
version = "0.1.0"
|
||||
authors = ["Marek Kotewicz <marek@parity.io>"]
|
||||
|
||||
@@ -1,49 +1,51 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
extern crate serde_json;
|
||||
extern crate ethjson;
|
||||
extern crate serde_json;
|
||||
|
||||
use std::{fs, env, process};
|
||||
use ethjson::spec::Spec;
|
||||
use std::{env, fs, process};
|
||||
|
||||
fn quit(s: &str) -> ! {
|
||||
println!("{}", s);
|
||||
process::exit(1);
|
||||
println!("{}", s);
|
||||
process::exit(1);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut args = env::args();
|
||||
if args.len() != 2 {
|
||||
quit("You need to specify chainspec.json\n\
|
||||
let mut args = env::args();
|
||||
if args.len() != 2 {
|
||||
quit(
|
||||
"You need to specify chainspec.json\n\
|
||||
\n\
|
||||
./chainspec <chainspec.json>");
|
||||
}
|
||||
./chainspec <chainspec.json>",
|
||||
);
|
||||
}
|
||||
|
||||
let path = args.nth(1).expect("args.len() == 2; qed");
|
||||
let file = match fs::File::open(&path) {
|
||||
Ok(file) => file,
|
||||
Err(_) => quit(&format!("{} could not be opened", path)),
|
||||
};
|
||||
let path = args.nth(1).expect("args.len() == 2; qed");
|
||||
let file = match fs::File::open(&path) {
|
||||
Ok(file) => file,
|
||||
Err(_) => quit(&format!("{} could not be opened", path)),
|
||||
};
|
||||
|
||||
let spec: Result<Spec, _> = serde_json::from_reader(file);
|
||||
let spec: Result<Spec, _> = serde_json::from_reader(file);
|
||||
|
||||
if let Err(err) = spec {
|
||||
quit(&format!("{} {}", path, err.to_string()));
|
||||
}
|
||||
if let Err(err) = spec {
|
||||
quit(&format!("{} {}", path, err.to_string()));
|
||||
}
|
||||
|
||||
println!("{} is valid", path);
|
||||
println!("{} is valid", path);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
[package]
|
||||
description = "OpenEthereum CLI Signer Tool"
|
||||
repository = "https://github.com/openethereum/openethereum"
|
||||
homepage = "https://github.com/openethereum/openethereum"
|
||||
license = "GPL-3.0"
|
||||
name = "cli-signer"
|
||||
version = "1.4.0"
|
||||
authors = ["Parity <admin@parity.io>"]
|
||||
|
||||
[dependencies]
|
||||
ethereum-types = "0.9.0"
|
||||
ethereum-types = "0.4"
|
||||
futures = "0.1"
|
||||
rpassword = "1.0"
|
||||
parity-rpc = { path = "../rpc" }
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
[package]
|
||||
description = "OpenEthereum RPC Client"
|
||||
repository = "https://github.com/openethereum/openethereum"
|
||||
homepage = "https://github.com/openethereum/openethereum"
|
||||
license = "GPL-3.0"
|
||||
name = "parity-rpc-client"
|
||||
version = "1.4.0"
|
||||
authors = ["Parity <admin@parity.io>"]
|
||||
|
||||
[dependencies]
|
||||
ethereum-types = "0.9.0"
|
||||
ethereum-types = "0.4"
|
||||
futures = "0.1"
|
||||
log = "0.4"
|
||||
serde = "1.0"
|
||||
serde_json = "1.0"
|
||||
url = "2.1.1"
|
||||
url = "2"
|
||||
matches = "0.1"
|
||||
parking_lot = "0.10.0"
|
||||
jsonrpc-core = "14.0.3"
|
||||
jsonrpc-ws-server = "14.0.3"
|
||||
parking_lot = "0.9"
|
||||
jsonrpc-core = "15.0.0"
|
||||
jsonrpc-ws-server = "15.0.0"
|
||||
parity-rpc = { path = "../../rpc" }
|
||||
keccak-hash = "0.5.0"
|
||||
keccak-hash = "0.1"
|
||||
|
||||
@@ -1,347 +1,327 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::fmt::{Debug, Formatter, Error as FmtError};
|
||||
use std::io::{BufReader, BufRead};
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::collections::BTreeMap;
|
||||
use std::thread;
|
||||
use std::time;
|
||||
use std::{
|
||||
collections::BTreeMap,
|
||||
fmt::{Debug, Error as FmtError, Formatter},
|
||||
io::{BufRead, BufReader},
|
||||
sync::{
|
||||
atomic::{AtomicUsize, Ordering},
|
||||
Arc,
|
||||
},
|
||||
thread, time,
|
||||
};
|
||||
|
||||
use std::path::PathBuf;
|
||||
use hash::keccak;
|
||||
use parking_lot::Mutex;
|
||||
use std::{fs::File, path::PathBuf};
|
||||
use url::Url;
|
||||
use std::fs::File;
|
||||
|
||||
use ws::ws::{
|
||||
self,
|
||||
Request,
|
||||
Handler,
|
||||
Sender,
|
||||
Handshake,
|
||||
Error as WsError,
|
||||
ErrorKind as WsErrorKind,
|
||||
Message,
|
||||
Result as WsResult,
|
||||
self, Error as WsError, ErrorKind as WsErrorKind, Handler, Handshake, Message, Request,
|
||||
Result as WsResult, Sender,
|
||||
};
|
||||
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde_json::{
|
||||
self as json,
|
||||
Value as JsonValue,
|
||||
Error as JsonError,
|
||||
use serde_json::{self as json, Error as JsonError, Value as JsonValue};
|
||||
|
||||
use futures::{done, oneshot, Canceled, Complete, Future};
|
||||
|
||||
use jsonrpc_core::{
|
||||
request::MethodCall,
|
||||
response::{Failure, Output, Success},
|
||||
Error as JsonRpcError, Id, Params, Version,
|
||||
};
|
||||
|
||||
use futures::{Canceled, Complete, Future, oneshot, done};
|
||||
|
||||
use jsonrpc_core::{Id, Version, Params, Error as JsonRpcError};
|
||||
use jsonrpc_core::request::MethodCall;
|
||||
use jsonrpc_core::response::{Output, Success, Failure};
|
||||
|
||||
use BoxFuture;
|
||||
|
||||
/// The actual websocket connection handler, passed into the
|
||||
/// event loop of ws-rs
|
||||
struct RpcHandler {
|
||||
pending: Pending,
|
||||
// Option is used here as temporary storage until connection
|
||||
// is setup and the values are moved into the new `Rpc`
|
||||
complete: Option<Complete<Result<Rpc, RpcError>>>,
|
||||
auth_code: String,
|
||||
out: Option<Sender>,
|
||||
pending: Pending,
|
||||
// Option is used here as temporary storage until connection
|
||||
// is setup and the values are moved into the new `Rpc`
|
||||
complete: Option<Complete<Result<Rpc, RpcError>>>,
|
||||
auth_code: String,
|
||||
out: Option<Sender>,
|
||||
}
|
||||
|
||||
impl RpcHandler {
|
||||
fn new(
|
||||
out: Sender,
|
||||
auth_code: String,
|
||||
complete: Complete<Result<Rpc, RpcError>>
|
||||
) -> Self {
|
||||
RpcHandler {
|
||||
out: Some(out),
|
||||
auth_code: auth_code,
|
||||
pending: Pending::new(),
|
||||
complete: Some(complete),
|
||||
}
|
||||
}
|
||||
fn new(out: Sender, auth_code: String, complete: Complete<Result<Rpc, RpcError>>) -> Self {
|
||||
RpcHandler {
|
||||
out: Some(out),
|
||||
auth_code: auth_code,
|
||||
pending: Pending::new(),
|
||||
complete: Some(complete),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Handler for RpcHandler {
|
||||
fn build_request(&mut self, url: &Url) -> WsResult<Request> {
|
||||
match Request::from_url(url) {
|
||||
Ok(mut r) => {
|
||||
let timestamp = time::UNIX_EPOCH.elapsed().map_err(|err| {
|
||||
WsError::new(WsErrorKind::Internal, format!("{}", err))
|
||||
})?;
|
||||
let secs = timestamp.as_secs();
|
||||
let hashed = keccak(format!("{}:{}", self.auth_code, secs));
|
||||
let proto = format!("{:x}_{}", hashed, secs);
|
||||
r.add_protocol(&proto);
|
||||
Ok(r)
|
||||
},
|
||||
Err(e) =>
|
||||
Err(WsError::new(WsErrorKind::Internal, format!("{}", e))),
|
||||
}
|
||||
}
|
||||
fn on_error(&mut self, err: WsError) {
|
||||
match self.complete.take() {
|
||||
Some(c) => match c.send(Err(RpcError::WsError(err))) {
|
||||
Ok(_) => {},
|
||||
Err(_) => warn!(target: "rpc-client", "Unable to notify about error."),
|
||||
},
|
||||
None => warn!(target: "rpc-client", "unexpected error: {}", err),
|
||||
}
|
||||
}
|
||||
fn on_open(&mut self, _: Handshake) -> WsResult<()> {
|
||||
match (self.complete.take(), self.out.take()) {
|
||||
(Some(c), Some(out)) => {
|
||||
let res = c.send(Ok(Rpc {
|
||||
out: out,
|
||||
counter: AtomicUsize::new(0),
|
||||
pending: self.pending.clone(),
|
||||
}));
|
||||
if let Err(_) = res {
|
||||
warn!(target: "rpc-client", "Unable to open a connection.")
|
||||
}
|
||||
Ok(())
|
||||
},
|
||||
_ => {
|
||||
let msg = format!("on_open called twice");
|
||||
Err(WsError::new(WsErrorKind::Internal, msg))
|
||||
}
|
||||
}
|
||||
}
|
||||
fn on_message(&mut self, msg: Message) -> WsResult<()> {
|
||||
let ret: Result<JsonValue, JsonRpcError>;
|
||||
let response_id;
|
||||
let string = &msg.to_string();
|
||||
match json::from_str::<Output>(&string) {
|
||||
Ok(Output::Success(Success { result, id: Id::Num(id), .. })) =>
|
||||
{
|
||||
ret = Ok(result);
|
||||
response_id = id as usize;
|
||||
}
|
||||
Ok(Output::Failure(Failure { error, id: Id::Num(id), .. })) => {
|
||||
ret = Err(error);
|
||||
response_id = id as usize;
|
||||
}
|
||||
Err(e) => {
|
||||
warn!(
|
||||
target: "rpc-client",
|
||||
"recieved invalid message: {}\n {:?}",
|
||||
string,
|
||||
e
|
||||
);
|
||||
return Ok(())
|
||||
},
|
||||
_ => {
|
||||
warn!(
|
||||
target: "rpc-client",
|
||||
"recieved invalid message: {}",
|
||||
string
|
||||
);
|
||||
return Ok(())
|
||||
}
|
||||
}
|
||||
fn build_request(&mut self, url: &Url) -> WsResult<Request> {
|
||||
match Request::from_url(url) {
|
||||
Ok(mut r) => {
|
||||
let timestamp = time::UNIX_EPOCH
|
||||
.elapsed()
|
||||
.map_err(|err| WsError::new(WsErrorKind::Internal, format!("{}", err)))?;
|
||||
let secs = timestamp.as_secs();
|
||||
let hashed = keccak(format!("{}:{}", self.auth_code, secs));
|
||||
let proto = format!("{:x}_{}", hashed, secs);
|
||||
r.add_protocol(&proto);
|
||||
Ok(r)
|
||||
}
|
||||
Err(e) => Err(WsError::new(WsErrorKind::Internal, format!("{}", e))),
|
||||
}
|
||||
}
|
||||
fn on_error(&mut self, err: WsError) {
|
||||
match self.complete.take() {
|
||||
Some(c) => match c.send(Err(RpcError::WsError(err))) {
|
||||
Ok(_) => {}
|
||||
Err(_) => warn!(target: "rpc-client", "Unable to notify about error."),
|
||||
},
|
||||
None => warn!(target: "rpc-client", "unexpected error: {}", err),
|
||||
}
|
||||
}
|
||||
fn on_open(&mut self, _: Handshake) -> WsResult<()> {
|
||||
match (self.complete.take(), self.out.take()) {
|
||||
(Some(c), Some(out)) => {
|
||||
let res = c.send(Ok(Rpc {
|
||||
out: out,
|
||||
counter: AtomicUsize::new(0),
|
||||
pending: self.pending.clone(),
|
||||
}));
|
||||
if let Err(_) = res {
|
||||
warn!(target: "rpc-client", "Unable to open a connection.")
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
_ => {
|
||||
let msg = format!("on_open called twice");
|
||||
Err(WsError::new(WsErrorKind::Internal, msg))
|
||||
}
|
||||
}
|
||||
}
|
||||
fn on_message(&mut self, msg: Message) -> WsResult<()> {
|
||||
let ret: Result<JsonValue, JsonRpcError>;
|
||||
let response_id;
|
||||
let string = &msg.to_string();
|
||||
match json::from_str::<Output>(&string) {
|
||||
Ok(Output::Success(Success {
|
||||
result,
|
||||
id: Id::Num(id),
|
||||
..
|
||||
})) => {
|
||||
ret = Ok(result);
|
||||
response_id = id as usize;
|
||||
}
|
||||
Ok(Output::Failure(Failure {
|
||||
error,
|
||||
id: Id::Num(id),
|
||||
..
|
||||
})) => {
|
||||
ret = Err(error);
|
||||
response_id = id as usize;
|
||||
}
|
||||
Err(e) => {
|
||||
warn!(
|
||||
target: "rpc-client",
|
||||
"recieved invalid message: {}\n {:?}",
|
||||
string,
|
||||
e
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
_ => {
|
||||
warn!(
|
||||
target: "rpc-client",
|
||||
"recieved invalid message: {}",
|
||||
string
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
||||
match self.pending.remove(response_id) {
|
||||
Some(c) => if let Err(_) = c.send(ret.map_err(|err| RpcError::JsonRpc(err))) {
|
||||
warn!(target: "rpc-client", "Unable to send response.")
|
||||
},
|
||||
None => warn!(
|
||||
target: "rpc-client",
|
||||
"warning: unexpected id: {}",
|
||||
response_id
|
||||
),
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
match self.pending.remove(response_id) {
|
||||
Some(c) => {
|
||||
if let Err(_) = c.send(ret.map_err(|err| RpcError::JsonRpc(err))) {
|
||||
warn!(target: "rpc-client", "Unable to send response.")
|
||||
}
|
||||
}
|
||||
None => warn!(
|
||||
target: "rpc-client",
|
||||
"warning: unexpected id: {}",
|
||||
response_id
|
||||
),
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Keeping track of issued requests to be matched up with responses
|
||||
#[derive(Clone)]
|
||||
struct Pending(
|
||||
Arc<Mutex<BTreeMap<usize, Complete<Result<JsonValue, RpcError>>>>>
|
||||
);
|
||||
struct Pending(Arc<Mutex<BTreeMap<usize, Complete<Result<JsonValue, RpcError>>>>>);
|
||||
|
||||
impl Pending {
|
||||
fn new() -> Self {
|
||||
Pending(Arc::new(Mutex::new(BTreeMap::new())))
|
||||
}
|
||||
fn insert(&mut self, k: usize, v: Complete<Result<JsonValue, RpcError>>) {
|
||||
self.0.lock().insert(k, v);
|
||||
}
|
||||
fn remove(
|
||||
&mut self,
|
||||
k: usize
|
||||
) -> Option<Complete<Result<JsonValue, RpcError>>> {
|
||||
self.0.lock().remove(&k)
|
||||
}
|
||||
fn new() -> Self {
|
||||
Pending(Arc::new(Mutex::new(BTreeMap::new())))
|
||||
}
|
||||
fn insert(&mut self, k: usize, v: Complete<Result<JsonValue, RpcError>>) {
|
||||
self.0.lock().insert(k, v);
|
||||
}
|
||||
fn remove(&mut self, k: usize) -> Option<Complete<Result<JsonValue, RpcError>>> {
|
||||
self.0.lock().remove(&k)
|
||||
}
|
||||
}
|
||||
|
||||
fn get_authcode(path: &PathBuf) -> Result<String, RpcError> {
|
||||
if let Ok(fd) = File::open(path) {
|
||||
if let Some(Ok(line)) = BufReader::new(fd).lines().next() {
|
||||
let mut parts = line.split(';');
|
||||
let token = parts.next();
|
||||
if let Ok(fd) = File::open(path) {
|
||||
if let Some(Ok(line)) = BufReader::new(fd).lines().next() {
|
||||
let mut parts = line.split(';');
|
||||
let token = parts.next();
|
||||
|
||||
if let Some(code) = token {
|
||||
return Ok(code.into());
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(RpcError::NoAuthCode)
|
||||
if let Some(code) = token {
|
||||
return Ok(code.into());
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(RpcError::NoAuthCode)
|
||||
}
|
||||
|
||||
/// The handle to the connection
|
||||
pub struct Rpc {
|
||||
out: Sender,
|
||||
counter: AtomicUsize,
|
||||
pending: Pending,
|
||||
out: Sender,
|
||||
counter: AtomicUsize,
|
||||
pending: Pending,
|
||||
}
|
||||
|
||||
impl Rpc {
|
||||
/// Blocking, returns a new initialized connection or RpcError
|
||||
pub fn new(url: &str, authpath: &PathBuf) -> Result<Self, RpcError> {
|
||||
let rpc = Self::connect(url, authpath).map(|rpc| rpc).wait()?;
|
||||
rpc
|
||||
}
|
||||
/// Blocking, returns a new initialized connection or RpcError
|
||||
pub fn new(url: &str, authpath: &PathBuf) -> Result<Self, RpcError> {
|
||||
let rpc = Self::connect(url, authpath).map(|rpc| rpc).wait()?;
|
||||
rpc
|
||||
}
|
||||
|
||||
/// Non-blocking, returns a future
|
||||
pub fn connect(
|
||||
url: &str, authpath: &PathBuf
|
||||
) -> BoxFuture<Result<Self, RpcError>, Canceled> {
|
||||
let (c, p) = oneshot::<Result<Self, RpcError>>();
|
||||
match get_authcode(authpath) {
|
||||
Err(e) => return Box::new(done(Ok(Err(e)))),
|
||||
Ok(code) => {
|
||||
let url = String::from(url);
|
||||
// The ws::connect takes a FnMut closure, which means c cannot
|
||||
// be moved into it, since it's consumed on complete.
|
||||
// Therefore we wrap it in an option and pick it out once.
|
||||
let mut once = Some(c);
|
||||
thread::spawn(move || {
|
||||
let conn = ws::connect(url, |out| {
|
||||
// this will panic if the closure is called twice,
|
||||
// which it should never be.
|
||||
let c = once.take()
|
||||
.expect("connection closure called only once");
|
||||
RpcHandler::new(out, code.clone(), c)
|
||||
});
|
||||
match conn {
|
||||
Err(err) => {
|
||||
// since ws::connect is only called once, it cannot
|
||||
// both fail and succeed.
|
||||
let c = once.take()
|
||||
.expect("connection closure called only once");
|
||||
let _ = c.send(Err(RpcError::WsError(err)));
|
||||
},
|
||||
// c will complete on the `on_open` event in the Handler
|
||||
_ => ()
|
||||
}
|
||||
});
|
||||
Box::new(p)
|
||||
}
|
||||
}
|
||||
}
|
||||
/// Non-blocking, returns a future
|
||||
pub fn connect(url: &str, authpath: &PathBuf) -> BoxFuture<Result<Self, RpcError>, Canceled> {
|
||||
let (c, p) = oneshot::<Result<Self, RpcError>>();
|
||||
match get_authcode(authpath) {
|
||||
Err(e) => return Box::new(done(Ok(Err(e)))),
|
||||
Ok(code) => {
|
||||
let url = String::from(url);
|
||||
// The ws::connect takes a FnMut closure, which means c cannot
|
||||
// be moved into it, since it's consumed on complete.
|
||||
// Therefore we wrap it in an option and pick it out once.
|
||||
let mut once = Some(c);
|
||||
thread::spawn(move || {
|
||||
let conn = ws::connect(url, |out| {
|
||||
// this will panic if the closure is called twice,
|
||||
// which it should never be.
|
||||
let c = once.take().expect("connection closure called only once");
|
||||
RpcHandler::new(out, code.clone(), c)
|
||||
});
|
||||
match conn {
|
||||
Err(err) => {
|
||||
// since ws::connect is only called once, it cannot
|
||||
// both fail and succeed.
|
||||
let c = once.take().expect("connection closure called only once");
|
||||
let _ = c.send(Err(RpcError::WsError(err)));
|
||||
}
|
||||
// c will complete on the `on_open` event in the Handler
|
||||
_ => (),
|
||||
}
|
||||
});
|
||||
Box::new(p)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Non-blocking, returns a future of the request response
|
||||
pub fn request<T>(
|
||||
&mut self, method: &'static str, params: Vec<JsonValue>
|
||||
) -> BoxFuture<Result<T, RpcError>, Canceled>
|
||||
where T: DeserializeOwned + Send + Sized {
|
||||
/// Non-blocking, returns a future of the request response
|
||||
pub fn request<T>(
|
||||
&mut self,
|
||||
method: &'static str,
|
||||
params: Vec<JsonValue>,
|
||||
) -> BoxFuture<Result<T, RpcError>, Canceled>
|
||||
where
|
||||
T: DeserializeOwned + Send + Sized,
|
||||
{
|
||||
let (c, p) = oneshot::<Result<JsonValue, RpcError>>();
|
||||
|
||||
let (c, p) = oneshot::<Result<JsonValue, RpcError>>();
|
||||
let id = self.counter.fetch_add(1, Ordering::Relaxed);
|
||||
self.pending.insert(id, c);
|
||||
|
||||
let id = self.counter.fetch_add(1, Ordering::Relaxed);
|
||||
self.pending.insert(id, c);
|
||||
let request = MethodCall {
|
||||
jsonrpc: Some(Version::V2),
|
||||
method: method.to_owned(),
|
||||
params: Params::Array(params),
|
||||
id: Id::Num(id as u64),
|
||||
};
|
||||
|
||||
let request = MethodCall {
|
||||
jsonrpc: Some(Version::V2),
|
||||
method: method.to_owned(),
|
||||
params: Params::Array(params),
|
||||
id: Id::Num(id as u64),
|
||||
};
|
||||
let serialized = json::to_string(&request).expect("request is serializable");
|
||||
let _ = self.out.send(serialized);
|
||||
|
||||
let serialized = json::to_string(&request)
|
||||
.expect("request is serializable");
|
||||
let _ = self.out.send(serialized);
|
||||
|
||||
Box::new(p.map(|result| {
|
||||
match result {
|
||||
Ok(json) => {
|
||||
let t: T = json::from_value(json)?;
|
||||
Ok(t)
|
||||
},
|
||||
Err(err) => Err(err)
|
||||
}
|
||||
}))
|
||||
}
|
||||
Box::new(p.map(|result| match result {
|
||||
Ok(json) => {
|
||||
let t: T = json::from_value(json)?;
|
||||
Ok(t)
|
||||
}
|
||||
Err(err) => Err(err),
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
pub enum RpcError {
|
||||
WrongVersion(String),
|
||||
ParseError(JsonError),
|
||||
MalformedResponse(String),
|
||||
JsonRpc(JsonRpcError),
|
||||
WsError(WsError),
|
||||
Canceled(Canceled),
|
||||
UnexpectedId,
|
||||
NoAuthCode,
|
||||
WrongVersion(String),
|
||||
ParseError(JsonError),
|
||||
MalformedResponse(String),
|
||||
JsonRpc(JsonRpcError),
|
||||
WsError(WsError),
|
||||
Canceled(Canceled),
|
||||
UnexpectedId,
|
||||
NoAuthCode,
|
||||
}
|
||||
|
||||
impl Debug for RpcError {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
|
||||
match *self {
|
||||
RpcError::WrongVersion(ref s)
|
||||
=> write!(f, "Expected version 2.0, got {}", s),
|
||||
RpcError::ParseError(ref err)
|
||||
=> write!(f, "ParseError: {}", err),
|
||||
RpcError::MalformedResponse(ref s)
|
||||
=> write!(f, "Malformed response: {}", s),
|
||||
RpcError::JsonRpc(ref json)
|
||||
=> write!(f, "JsonRpc error: {:?}", json),
|
||||
RpcError::WsError(ref s)
|
||||
=> write!(f, "Websocket error: {}", s),
|
||||
RpcError::Canceled(ref s)
|
||||
=> write!(f, "Futures error: {:?}", s),
|
||||
RpcError::UnexpectedId
|
||||
=> write!(f, "Unexpected response id"),
|
||||
RpcError::NoAuthCode
|
||||
=> write!(f, "No authcodes available"),
|
||||
}
|
||||
}
|
||||
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
|
||||
match *self {
|
||||
RpcError::WrongVersion(ref s) => write!(f, "Expected version 2.0, got {}", s),
|
||||
RpcError::ParseError(ref err) => write!(f, "ParseError: {}", err),
|
||||
RpcError::MalformedResponse(ref s) => write!(f, "Malformed response: {}", s),
|
||||
RpcError::JsonRpc(ref json) => write!(f, "JsonRpc error: {:?}", json),
|
||||
RpcError::WsError(ref s) => write!(f, "Websocket error: {}", s),
|
||||
RpcError::Canceled(ref s) => write!(f, "Futures error: {:?}", s),
|
||||
RpcError::UnexpectedId => write!(f, "Unexpected response id"),
|
||||
RpcError::NoAuthCode => write!(f, "No authcodes available"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<JsonError> for RpcError {
|
||||
fn from(err: JsonError) -> RpcError {
|
||||
RpcError::ParseError(err)
|
||||
}
|
||||
fn from(err: JsonError) -> RpcError {
|
||||
RpcError::ParseError(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<WsError> for RpcError {
|
||||
fn from(err: WsError) -> RpcError {
|
||||
RpcError::WsError(err)
|
||||
}
|
||||
fn from(err: WsError) -> RpcError {
|
||||
RpcError::WsError(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Canceled> for RpcError {
|
||||
fn from(err: Canceled) -> RpcError {
|
||||
RpcError::Canceled(err)
|
||||
}
|
||||
fn from(err: Canceled) -> RpcError {
|
||||
RpcError::Canceled(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
pub mod client;
|
||||
pub mod signer_client;
|
||||
@@ -21,12 +21,12 @@ extern crate ethereum_types;
|
||||
extern crate futures;
|
||||
extern crate jsonrpc_core;
|
||||
extern crate jsonrpc_ws_server as ws;
|
||||
extern crate keccak_hash as hash;
|
||||
extern crate parity_rpc as rpc;
|
||||
extern crate parking_lot;
|
||||
extern crate serde;
|
||||
extern crate serde_json;
|
||||
extern crate url;
|
||||
extern crate keccak_hash as hash;
|
||||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
@@ -36,56 +36,55 @@ extern crate log;
|
||||
extern crate matches;
|
||||
|
||||
/// Boxed future response.
|
||||
pub type BoxFuture<T, E> = Box<dyn futures::Future<Item=T, Error=E> + Send>;
|
||||
pub type BoxFuture<T, E> = Box<dyn futures::Future<Item = T, Error = E> + Send>;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use futures::Future;
|
||||
use std::path::PathBuf;
|
||||
use client::{Rpc, RpcError};
|
||||
use rpc;
|
||||
use client::{Rpc, RpcError};
|
||||
use futures::Future;
|
||||
use rpc;
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[test]
|
||||
fn test_connection_refused() {
|
||||
let (_srv, port, mut authcodes) = rpc::tests::ws::serve();
|
||||
#[test]
|
||||
fn test_connection_refused() {
|
||||
let (_srv, port, mut authcodes) = rpc::tests::ws::serve();
|
||||
|
||||
let _ = authcodes.generate_new();
|
||||
authcodes.to_file(&authcodes.path).unwrap();
|
||||
let _ = authcodes.generate_new();
|
||||
authcodes.to_file(&authcodes.path).unwrap();
|
||||
|
||||
let connect = Rpc::connect(&format!("ws://127.0.0.1:{}", port - 1),
|
||||
&authcodes.path);
|
||||
let connect = Rpc::connect(&format!("ws://127.0.0.1:{}", port - 1), &authcodes.path);
|
||||
|
||||
let _ = connect.map(|conn| {
|
||||
assert!(matches!(&conn, &Err(RpcError::WsError(_))));
|
||||
}).wait();
|
||||
}
|
||||
let _ = connect
|
||||
.map(|conn| {
|
||||
assert!(matches!(&conn, &Err(RpcError::WsError(_))));
|
||||
})
|
||||
.wait();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_authcode_fail() {
|
||||
let (_srv, port, _) = rpc::tests::ws::serve();
|
||||
let path = PathBuf::from("nonexist");
|
||||
#[test]
|
||||
fn test_authcode_fail() {
|
||||
let (_srv, port, _) = rpc::tests::ws::serve();
|
||||
let path = PathBuf::from("nonexist");
|
||||
|
||||
let connect = Rpc::connect(&format!("ws://127.0.0.1:{}", port), &path);
|
||||
let connect = Rpc::connect(&format!("ws://127.0.0.1:{}", port), &path);
|
||||
|
||||
let _ = connect.map(|conn| {
|
||||
assert!(matches!(&conn, &Err(RpcError::NoAuthCode)));
|
||||
}).wait();
|
||||
}
|
||||
let _ = connect
|
||||
.map(|conn| {
|
||||
assert!(matches!(&conn, &Err(RpcError::NoAuthCode)));
|
||||
})
|
||||
.wait();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_authcode_correct() {
|
||||
let (_srv, port, mut authcodes) = rpc::tests::ws::serve();
|
||||
#[test]
|
||||
fn test_authcode_correct() {
|
||||
let (_srv, port, mut authcodes) = rpc::tests::ws::serve();
|
||||
|
||||
let _ = authcodes.generate_new();
|
||||
authcodes.to_file(&authcodes.path).unwrap();
|
||||
let _ = authcodes.generate_new();
|
||||
authcodes.to_file(&authcodes.path).unwrap();
|
||||
|
||||
let connect = Rpc::connect(&format!("ws://127.0.0.1:{}", port),
|
||||
&authcodes.path);
|
||||
|
||||
let _ = connect.map(|conn| {
|
||||
assert!(conn.is_ok())
|
||||
}).wait();
|
||||
}
|
||||
let connect = Rpc::connect(&format!("ws://127.0.0.1:{}", port), &authcodes.path);
|
||||
|
||||
let _ = connect.map(|conn| assert!(conn.is_ok())).wait();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,63 +1,76 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use client::{Rpc, RpcError};
|
||||
use ethereum_types::U256;
|
||||
use rpc::signer::{ConfirmationRequest, TransactionModification, TransactionCondition};
|
||||
use futures::Canceled;
|
||||
use rpc::signer::{ConfirmationRequest, TransactionCondition, TransactionModification};
|
||||
use serde;
|
||||
use serde_json::{Value as JsonValue, to_value};
|
||||
use serde_json::{to_value, Value as JsonValue};
|
||||
use std::path::PathBuf;
|
||||
use futures::{Canceled};
|
||||
use {BoxFuture};
|
||||
use BoxFuture;
|
||||
|
||||
pub struct SignerRpc {
|
||||
rpc: Rpc,
|
||||
rpc: Rpc,
|
||||
}
|
||||
|
||||
impl SignerRpc {
|
||||
pub fn new(url: &str, authfile: &PathBuf) -> Result<Self, RpcError> {
|
||||
Ok(SignerRpc { rpc: Rpc::new(&url, authfile)? })
|
||||
}
|
||||
pub fn new(url: &str, authfile: &PathBuf) -> Result<Self, RpcError> {
|
||||
Ok(SignerRpc {
|
||||
rpc: Rpc::new(&url, authfile)?,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn requests_to_confirm(&mut self) -> BoxFuture<Result<Vec<ConfirmationRequest>, RpcError>, Canceled> {
|
||||
self.rpc.request("signer_requestsToConfirm", vec![])
|
||||
}
|
||||
pub fn requests_to_confirm(
|
||||
&mut self,
|
||||
) -> BoxFuture<Result<Vec<ConfirmationRequest>, RpcError>, Canceled> {
|
||||
self.rpc.request("signer_requestsToConfirm", vec![])
|
||||
}
|
||||
|
||||
pub fn confirm_request(
|
||||
&mut self,
|
||||
id: U256,
|
||||
new_gas: Option<U256>,
|
||||
new_gas_price: Option<U256>,
|
||||
new_condition: Option<Option<TransactionCondition>>,
|
||||
pwd: &str
|
||||
) -> BoxFuture<Result<U256, RpcError>, Canceled> {
|
||||
self.rpc.request("signer_confirmRequest", vec![
|
||||
Self::to_value(&format!("{:#x}", id)),
|
||||
Self::to_value(&TransactionModification { sender: None, gas_price: new_gas_price, gas: new_gas, condition: new_condition }),
|
||||
Self::to_value(&pwd),
|
||||
])
|
||||
}
|
||||
pub fn confirm_request(
|
||||
&mut self,
|
||||
id: U256,
|
||||
new_gas: Option<U256>,
|
||||
new_gas_price: Option<U256>,
|
||||
new_condition: Option<Option<TransactionCondition>>,
|
||||
pwd: &str,
|
||||
) -> BoxFuture<Result<U256, RpcError>, Canceled> {
|
||||
self.rpc.request(
|
||||
"signer_confirmRequest",
|
||||
vec![
|
||||
Self::to_value(&format!("{:#x}", id)),
|
||||
Self::to_value(&TransactionModification {
|
||||
sender: None,
|
||||
gas_price: new_gas_price,
|
||||
gas: new_gas,
|
||||
condition: new_condition,
|
||||
}),
|
||||
Self::to_value(&pwd),
|
||||
],
|
||||
)
|
||||
}
|
||||
|
||||
pub fn reject_request(&mut self, id: U256) -> BoxFuture<Result<bool, RpcError>, Canceled> {
|
||||
self.rpc.request("signer_rejectRequest", vec![
|
||||
JsonValue::String(format!("{:#x}", id))
|
||||
])
|
||||
}
|
||||
pub fn reject_request(&mut self, id: U256) -> BoxFuture<Result<bool, RpcError>, Canceled> {
|
||||
self.rpc.request(
|
||||
"signer_rejectRequest",
|
||||
vec![JsonValue::String(format!("{:#x}", id))],
|
||||
)
|
||||
}
|
||||
|
||||
fn to_value<T: serde::Serialize>(v: &T) -> JsonValue {
|
||||
to_value(v).expect("Our types are always serializable; qed")
|
||||
}
|
||||
fn to_value<T: serde::Serialize>(v: &T) -> JsonValue {
|
||||
to_value(v).expect("Our types are always serializable; qed")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Open Ethereum.
|
||||
// This file is part of OpenEthereum.
|
||||
|
||||
// Open Ethereum is free software: you can redistribute it and/or modify
|
||||
// OpenEthereum 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.
|
||||
|
||||
// Open Ethereum is distributed in the hope that it will be useful,
|
||||
// OpenEthereum 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 Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
extern crate ethereum_types;
|
||||
extern crate futures;
|
||||
@@ -21,177 +21,142 @@ extern crate rpassword;
|
||||
extern crate parity_rpc as rpc;
|
||||
extern crate parity_rpc_client as client;
|
||||
|
||||
use client::signer_client::SignerRpc;
|
||||
use ethereum_types::U256;
|
||||
use rpc::signer::ConfirmationRequest;
|
||||
use client::signer_client::SignerRpc;
|
||||
use std::io::{Write, BufRead, BufReader, stdout, stdin};
|
||||
use std::path::PathBuf;
|
||||
use std::fs::File;
|
||||
use std::{
|
||||
fs::File,
|
||||
io::{stdin, stdout, BufRead, BufReader, Write},
|
||||
path::PathBuf,
|
||||
};
|
||||
|
||||
use futures::Future;
|
||||
|
||||
fn sign_interactive(
|
||||
signer: &mut SignerRpc,
|
||||
password: &str,
|
||||
request: ConfirmationRequest
|
||||
) {
|
||||
print!("\n{}\nSign this transaction? (y)es/(N)o/(r)eject: ", request);
|
||||
let _ = stdout().flush();
|
||||
match BufReader::new(stdin()).lines().next() {
|
||||
Some(Ok(line)) => {
|
||||
match line.to_lowercase().chars().nth(0) {
|
||||
Some('y') => {
|
||||
match sign_transaction(signer, request.id, password) {
|
||||
Ok(s) | Err(s) => println!("{}", s),
|
||||
}
|
||||
}
|
||||
Some('r') => {
|
||||
match reject_transaction(signer, request.id) {
|
||||
Ok(s) | Err(s) => println!("{}", s),
|
||||
}
|
||||
}
|
||||
_ => ()
|
||||
}
|
||||
}
|
||||
_ => println!("Could not read from stdin")
|
||||
}
|
||||
fn sign_interactive(signer: &mut SignerRpc, password: &str, request: ConfirmationRequest) {
|
||||
print!(
|
||||
"\n{}\nSign this transaction? (y)es/(N)o/(r)eject: ",
|
||||
request
|
||||
);
|
||||
let _ = stdout().flush();
|
||||
match BufReader::new(stdin()).lines().next() {
|
||||
Some(Ok(line)) => match line.to_lowercase().chars().nth(0) {
|
||||
Some('y') => match sign_transaction(signer, request.id, password) {
|
||||
Ok(s) | Err(s) => println!("{}", s),
|
||||
},
|
||||
Some('r') => match reject_transaction(signer, request.id) {
|
||||
Ok(s) | Err(s) => println!("{}", s),
|
||||
},
|
||||
_ => (),
|
||||
},
|
||||
_ => println!("Could not read from stdin"),
|
||||
}
|
||||
}
|
||||
|
||||
fn sign_transactions(
|
||||
signer: &mut SignerRpc,
|
||||
password: String
|
||||
) -> Result<String, String> {
|
||||
signer.requests_to_confirm().map(|reqs| {
|
||||
match reqs {
|
||||
Ok(ref reqs) if reqs.is_empty() => {
|
||||
Ok("No transactions in signing queue".to_owned())
|
||||
}
|
||||
Ok(reqs) => {
|
||||
for r in reqs {
|
||||
sign_interactive(signer, &password, r)
|
||||
}
|
||||
Ok("".to_owned())
|
||||
}
|
||||
Err(err) => {
|
||||
Err(format!("error: {:?}", err))
|
||||
}
|
||||
}
|
||||
}).map_err(|err| {
|
||||
format!("{:?}", err)
|
||||
}).wait()?
|
||||
fn sign_transactions(signer: &mut SignerRpc, password: String) -> Result<String, String> {
|
||||
signer
|
||||
.requests_to_confirm()
|
||||
.map(|reqs| match reqs {
|
||||
Ok(ref reqs) if reqs.is_empty() => Ok("No transactions in signing queue".to_owned()),
|
||||
Ok(reqs) => {
|
||||
for r in reqs {
|
||||
sign_interactive(signer, &password, r)
|
||||
}
|
||||
Ok("".to_owned())
|
||||
}
|
||||
Err(err) => Err(format!("error: {:?}", err)),
|
||||
})
|
||||
.map_err(|err| format!("{:?}", err))
|
||||
.wait()?
|
||||
}
|
||||
|
||||
fn list_transactions(signer: &mut SignerRpc) -> Result<String, String> {
|
||||
signer.requests_to_confirm().map(|reqs| {
|
||||
match reqs {
|
||||
Ok(ref reqs) if reqs.is_empty() => {
|
||||
Ok("No transactions in signing queue".to_owned())
|
||||
}
|
||||
Ok(ref reqs) => {
|
||||
Ok(format!("Transaction queue:\n{}", reqs
|
||||
.iter()
|
||||
.map(|r| format!("{}", r))
|
||||
.collect::<Vec<String>>()
|
||||
.join("\n")))
|
||||
}
|
||||
Err(err) => {
|
||||
Err(format!("error: {:?}", err))
|
||||
}
|
||||
}
|
||||
}).map_err(|err| {
|
||||
format!("{:?}", err)
|
||||
}).wait()?
|
||||
signer
|
||||
.requests_to_confirm()
|
||||
.map(|reqs| match reqs {
|
||||
Ok(ref reqs) if reqs.is_empty() => Ok("No transactions in signing queue".to_owned()),
|
||||
Ok(ref reqs) => Ok(format!(
|
||||
"Transaction queue:\n{}",
|
||||
reqs.iter()
|
||||
.map(|r| format!("{}", r))
|
||||
.collect::<Vec<String>>()
|
||||
.join("\n")
|
||||
)),
|
||||
Err(err) => Err(format!("error: {:?}", err)),
|
||||
})
|
||||
.map_err(|err| format!("{:?}", err))
|
||||
.wait()?
|
||||
}
|
||||
|
||||
fn sign_transaction(
|
||||
signer: &mut SignerRpc, id: U256, password: &str
|
||||
) -> Result<String, String> {
|
||||
signer.confirm_request(id, None, None, None, password).map(|res| {
|
||||
match res {
|
||||
Ok(u) => Ok(format!("Signed transaction id: {:#x}", u)),
|
||||
Err(e) => Err(format!("{:?}", e)),
|
||||
}
|
||||
}).map_err(|err| {
|
||||
format!("{:?}", err)
|
||||
}).wait()?
|
||||
fn sign_transaction(signer: &mut SignerRpc, id: U256, password: &str) -> Result<String, String> {
|
||||
signer
|
||||
.confirm_request(id, None, None, None, password)
|
||||
.map(|res| match res {
|
||||
Ok(u) => Ok(format!("Signed transaction id: {:#x}", u)),
|
||||
Err(e) => Err(format!("{:?}", e)),
|
||||
})
|
||||
.map_err(|err| format!("{:?}", err))
|
||||
.wait()?
|
||||
}
|
||||
|
||||
fn reject_transaction(
|
||||
signer: &mut SignerRpc, id: U256) -> Result<String, String>
|
||||
{
|
||||
signer.reject_request(id).map(|res| {
|
||||
match res {
|
||||
Ok(true) => Ok(format!("Rejected transaction id {:#x}", id)),
|
||||
Ok(false) => Err(format!("No such request")),
|
||||
Err(e) => Err(format!("{:?}", e)),
|
||||
}
|
||||
}).map_err(|err| {
|
||||
format!("{:?}", err)
|
||||
}).wait()?
|
||||
fn reject_transaction(signer: &mut SignerRpc, id: U256) -> Result<String, String> {
|
||||
signer
|
||||
.reject_request(id)
|
||||
.map(|res| match res {
|
||||
Ok(true) => Ok(format!("Rejected transaction id {:#x}", id)),
|
||||
Ok(false) => Err(format!("No such request")),
|
||||
Err(e) => Err(format!("{:?}", e)),
|
||||
})
|
||||
.map_err(|err| format!("{:?}", err))
|
||||
.wait()?
|
||||
}
|
||||
|
||||
// cmds
|
||||
|
||||
pub fn signer_list(
|
||||
signerport: u16, authfile: PathBuf
|
||||
) -> Result<String, String> {
|
||||
let addr = &format!("ws://127.0.0.1:{}", signerport);
|
||||
let mut signer = SignerRpc::new(addr, &authfile).map_err(|err| {
|
||||
format!("{:?}", err)
|
||||
})?;
|
||||
list_transactions(&mut signer)
|
||||
pub fn signer_list(signerport: u16, authfile: PathBuf) -> Result<String, String> {
|
||||
let addr = &format!("ws://127.0.0.1:{}", signerport);
|
||||
let mut signer = SignerRpc::new(addr, &authfile).map_err(|err| format!("{:?}", err))?;
|
||||
list_transactions(&mut signer)
|
||||
}
|
||||
|
||||
pub fn signer_reject(
|
||||
id: Option<usize>, signerport: u16, authfile: PathBuf
|
||||
id: Option<usize>,
|
||||
signerport: u16,
|
||||
authfile: PathBuf,
|
||||
) -> Result<String, String> {
|
||||
let id = id.ok_or(format!("id required for signer reject"))?;
|
||||
let addr = &format!("ws://127.0.0.1:{}", signerport);
|
||||
let mut signer = SignerRpc::new(addr, &authfile).map_err(|err| {
|
||||
format!("{:?}", err)
|
||||
})?;
|
||||
reject_transaction(&mut signer, U256::from(id))
|
||||
let id = id.ok_or(format!("id required for signer reject"))?;
|
||||
let addr = &format!("ws://127.0.0.1:{}", signerport);
|
||||
let mut signer = SignerRpc::new(addr, &authfile).map_err(|err| format!("{:?}", err))?;
|
||||
reject_transaction(&mut signer, U256::from(id))
|
||||
}
|
||||
|
||||
pub fn signer_sign(
|
||||
id: Option<usize>,
|
||||
pwfile: Option<PathBuf>,
|
||||
signerport: u16,
|
||||
authfile: PathBuf
|
||||
id: Option<usize>,
|
||||
pwfile: Option<PathBuf>,
|
||||
signerport: u16,
|
||||
authfile: PathBuf,
|
||||
) -> Result<String, String> {
|
||||
let password;
|
||||
match pwfile {
|
||||
Some(pwfile) => {
|
||||
match File::open(pwfile) {
|
||||
Ok(fd) => {
|
||||
match BufReader::new(fd).lines().next() {
|
||||
Some(Ok(line)) => password = line,
|
||||
_ => return Err(format!("No password in file"))
|
||||
}
|
||||
},
|
||||
Err(e) =>
|
||||
return Err(format!("Could not open password file: {}", e))
|
||||
}
|
||||
}
|
||||
None => {
|
||||
password = match rpassword::prompt_password_stdout("Password: ") {
|
||||
Ok(p) => p,
|
||||
Err(e) => return Err(format!("{}", e)),
|
||||
}
|
||||
}
|
||||
}
|
||||
let password;
|
||||
match pwfile {
|
||||
Some(pwfile) => match File::open(pwfile) {
|
||||
Ok(fd) => match BufReader::new(fd).lines().next() {
|
||||
Some(Ok(line)) => password = line,
|
||||
_ => return Err(format!("No password in file")),
|
||||
},
|
||||
Err(e) => return Err(format!("Could not open password file: {}", e)),
|
||||
},
|
||||
None => {
|
||||
password = match rpassword::prompt_password_stdout("Password: ") {
|
||||
Ok(p) => p,
|
||||
Err(e) => return Err(format!("{}", e)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let addr = &format!("ws://127.0.0.1:{}", signerport);
|
||||
let mut signer = SignerRpc::new(addr, &authfile).map_err(|err| {
|
||||
format!("{:?}", err)
|
||||
})?;
|
||||
let addr = &format!("ws://127.0.0.1:{}", signerport);
|
||||
let mut signer = SignerRpc::new(addr, &authfile).map_err(|err| format!("{:?}", err))?;
|
||||
|
||||
match id {
|
||||
Some(id) => {
|
||||
sign_transaction(&mut signer, U256::from(id), &password)
|
||||
},
|
||||
None => {
|
||||
sign_transactions(&mut signer, password)
|
||||
}
|
||||
}
|
||||
match id {
|
||||
Some(id) => sign_transaction(&mut signer, U256::from(id), &password),
|
||||
None => sign_transactions(&mut signer, password),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,228 +1,228 @@
|
||||
Note: Parity 0.9 reached End-of-Life on 2016-05-02 (EOL).
|
||||
|
||||
## Parity [beta-0.9.1](https://github.com/openethereum/openethereum/releases/tag/beta-0.9.1) (2016-02-16)
|
||||
## Parity [beta-0.9.1](https://github.com/paritytech/parity/releases/tag/beta-0.9.1) (2016-02-16)
|
||||
|
||||
Homestead transition block changed to 1100000.
|
||||
|
||||
- Beta patch to 0.9.1 [#445](https://github.com/openethereum/openethereum/pull/445)
|
||||
- Delay homestead transition [#430](https://github.com/openethereum/openethereum/pull/430)
|
||||
- (BETA) https link in the installer (?) [#392](https://github.com/openethereum/openethereum/pull/392)
|
||||
- beta: Check for handshake expiration before attempting replace [#377](https://github.com/openethereum/openethereum/pull/377)
|
||||
- Beta patch to 0.9.1 [#445](https://github.com/paritytech/parity/pull/445)
|
||||
- Delay homestead transition [#430](https://github.com/paritytech/parity/pull/430)
|
||||
- (BETA) https link in the installer (?) [#392](https://github.com/paritytech/parity/pull/392)
|
||||
- beta: Check for handshake expiration before attempting replace [#377](https://github.com/paritytech/parity/pull/377)
|
||||
|
||||
## Parity [beta-0.9](https://github.com/openethereum/openethereum/releases/tag/beta-0.9) (2016-02-08)
|
||||
## Parity [beta-0.9](https://github.com/paritytech/parity/releases/tag/beta-0.9) (2016-02-08)
|
||||
|
||||
First Parity Beta 0.9 released.
|
||||
|
||||
- Panic on missing counters; Client cleanup [#368](https://github.com/openethereum/openethereum/pull/368)
|
||||
- Update README for new PPAs. [#369](https://github.com/openethereum/openethereum/pull/369)
|
||||
- block_queue::clear should be more thorough [#365](https://github.com/openethereum/openethereum/pull/365)
|
||||
- Fixed an issue with forked counters [#363](https://github.com/openethereum/openethereum/pull/363)
|
||||
- Install parity [#362](https://github.com/openethereum/openethereum/pull/362)
|
||||
- DB directory versioning [#358](https://github.com/openethereum/openethereum/pull/358)
|
||||
- Raise FD limit for MacOS [#357](https://github.com/openethereum/openethereum/pull/357)
|
||||
- Travis slack integration. [#356](https://github.com/openethereum/openethereum/pull/356)
|
||||
- SignedTransaction structure [#350](https://github.com/openethereum/openethereum/pull/350)
|
||||
- License [#354](https://github.com/openethereum/openethereum/pull/354)
|
||||
- Performance optimizations [#353](https://github.com/openethereum/openethereum/pull/353)
|
||||
- Gitter in README. [#355](https://github.com/openethereum/openethereum/pull/355)
|
||||
- test efforts, receipt requests [#352](https://github.com/openethereum/openethereum/pull/352)
|
||||
- sync tests setup & local module coverage [#348](https://github.com/openethereum/openethereum/pull/348)
|
||||
- install parity script [#347](https://github.com/openethereum/openethereum/pull/347)
|
||||
- evmjit homestead merge [#342](https://github.com/openethereum/openethereum/pull/342)
|
||||
- Fixed sync stalling on fork [#343](https://github.com/openethereum/openethereum/pull/343)
|
||||
- Remerge 264 [#334](https://github.com/openethereum/openethereum/pull/334)
|
||||
- Ethsync tests bfix [#339](https://github.com/openethereum/openethereum/pull/339)
|
||||
- Fix default options. [#335](https://github.com/openethereum/openethereum/pull/335)
|
||||
- sync queue limit hotfix [#338](https://github.com/openethereum/openethereum/pull/338)
|
||||
- Network tests, separate local coverage for utils [#333](https://github.com/openethereum/openethereum/pull/333)
|
||||
- fix parity version so netstats can parse it [#332](https://github.com/openethereum/openethereum/pull/332)
|
||||
- reveal surprise [#331](https://github.com/openethereum/openethereum/pull/331)
|
||||
- Revert removal of `new_code`. [#330](https://github.com/openethereum/openethereum/pull/330)
|
||||
- Network mod tests first part [#329](https://github.com/openethereum/openethereum/pull/329)
|
||||
- Look ma no `dead_code` [#323](https://github.com/openethereum/openethereum/pull/323)
|
||||
- Fixing JIT, Updating hook to run `ethcore` tests. [#326](https://github.com/openethereum/openethereum/pull/326)
|
||||
- Final docs [#327](https://github.com/openethereum/openethereum/pull/327)
|
||||
- update install-deps.sh [#316](https://github.com/openethereum/openethereum/pull/316)
|
||||
- Finish all my docs. Fix previous test compilation. [#320](https://github.com/openethereum/openethereum/pull/320)
|
||||
- Additional evm tests (extops, call, jumps) and some docs [#317](https://github.com/openethereum/openethereum/pull/317)
|
||||
- More documentation. [#318](https://github.com/openethereum/openethereum/pull/318)
|
||||
- Additional documentation. [#315](https://github.com/openethereum/openethereum/pull/315)
|
||||
- unused functions cleanup [#310](https://github.com/openethereum/openethereum/pull/310)
|
||||
- update ethcore.github.io documentation automatically [#311](https://github.com/openethereum/openethereum/pull/311)
|
||||
- Another try with travis ci credentials [#314](https://github.com/openethereum/openethereum/pull/314)
|
||||
- Document some stuff. [#309](https://github.com/openethereum/openethereum/pull/309)
|
||||
- Check block parent on import; Peer timeouts [#303](https://github.com/openethereum/openethereum/pull/303)
|
||||
- Increasing coverage for evm. [#306](https://github.com/openethereum/openethereum/pull/306)
|
||||
- ethcore docs [#301](https://github.com/openethereum/openethereum/pull/301)
|
||||
- Replacing secure token for deployment [#305](https://github.com/openethereum/openethereum/pull/305)
|
||||
- doc.sh [#299](https://github.com/openethereum/openethereum/pull/299)
|
||||
- Building beta-* and stable-* tags [#302](https://github.com/openethereum/openethereum/pull/302)
|
||||
- Deploying artifacts for tags (release/beta) [#300](https://github.com/openethereum/openethereum/pull/300)
|
||||
- cov.sh to show coverage locally [#298](https://github.com/openethereum/openethereum/pull/298)
|
||||
- benchmark fixes [#297](https://github.com/openethereum/openethereum/pull/297)
|
||||
- Include JSONRPC CLI options. [#296](https://github.com/openethereum/openethereum/pull/296)
|
||||
- travis.yml fixes [#293](https://github.com/openethereum/openethereum/pull/293)
|
||||
- Improve version string. [#295](https://github.com/openethereum/openethereum/pull/295)
|
||||
- Fixed block queue test [#294](https://github.com/openethereum/openethereum/pull/294)
|
||||
- Util docs [#292](https://github.com/openethereum/openethereum/pull/292)
|
||||
- fixed building docs [#289](https://github.com/openethereum/openethereum/pull/289)
|
||||
- update travis to build PRs only against master [#290](https://github.com/openethereum/openethereum/pull/290)
|
||||
- Coverage effort [#272](https://github.com/openethereum/openethereum/pull/272)
|
||||
- updated docker containers [#288](https://github.com/openethereum/openethereum/pull/288)
|
||||
- rpc module fixes [#287](https://github.com/openethereum/openethereum/pull/287)
|
||||
- Test for Receipt RLP. [#282](https://github.com/openethereum/openethereum/pull/282)
|
||||
- Building from source guide [#284](https://github.com/openethereum/openethereum/pull/284)
|
||||
- Fixed neted empty list RLP encoding [#283](https://github.com/openethereum/openethereum/pull/283)
|
||||
- Fix CALLDATACOPY (and bonus CODECOPY, too!). [#279](https://github.com/openethereum/openethereum/pull/279)
|
||||
- added travis && coveralls badge to README.md [#280](https://github.com/openethereum/openethereum/pull/280)
|
||||
- coveralls coverage [#277](https://github.com/openethereum/openethereum/pull/277)
|
||||
- Travis [in progress] [#257](https://github.com/openethereum/openethereum/pull/257)
|
||||
- Travis on reorganized repo [#276](https://github.com/openethereum/openethereum/pull/276)
|
||||
- umbrella project [#275](https://github.com/openethereum/openethereum/pull/275)
|
||||
- Ethash disk cache [#273](https://github.com/openethereum/openethereum/pull/273)
|
||||
- Parity executable name and version [#274](https://github.com/openethereum/openethereum/pull/274)
|
||||
- Dockerfile [#195](https://github.com/openethereum/openethereum/pull/195)
|
||||
- Garbage collection test fix [#267](https://github.com/openethereum/openethereum/pull/267)
|
||||
- Fix stCallCreateCallCodeTest, add more tests [#271](https://github.com/openethereum/openethereum/pull/271)
|
||||
- Moved sync out of ethcore crate; Added block validation [#265](https://github.com/openethereum/openethereum/pull/265)
|
||||
- RLP encoder refactoring [#252](https://github.com/openethereum/openethereum/pull/252)
|
||||
- Chain sync tests and minor refactoring [#264](https://github.com/openethereum/openethereum/pull/264)
|
||||
- Common log init function [#263](https://github.com/openethereum/openethereum/pull/263)
|
||||
- changed max vm depth from 128 to 64, change homestead block to 1_000_000 [#262](https://github.com/openethereum/openethereum/pull/262)
|
||||
- fixed blockchain tests crash on log init [#261](https://github.com/openethereum/openethereum/pull/261)
|
||||
- Blockchain tests and some helpers for guarding temp directory [#256](https://github.com/openethereum/openethereum/pull/256)
|
||||
- Fix logging and random tests. [#260](https://github.com/openethereum/openethereum/pull/260)
|
||||
- Fix difficulty calculation algo. [#259](https://github.com/openethereum/openethereum/pull/259)
|
||||
- fix submodule version [#258](https://github.com/openethereum/openethereum/pull/258)
|
||||
- temp dir spawn refactoring [#246](https://github.com/openethereum/openethereum/pull/246)
|
||||
- fixed tests submodule branch [#254](https://github.com/openethereum/openethereum/pull/254)
|
||||
- rpc net methods returns real peer count && protocol version [#253](https://github.com/openethereum/openethereum/pull/253)
|
||||
- Add homestead & random tests. [#245](https://github.com/openethereum/openethereum/pull/245)
|
||||
- Fixing suicide with self-refund to be consistent with CPP. [#247](https://github.com/openethereum/openethereum/pull/247)
|
||||
- stubs for rpc methods [#251](https://github.com/openethereum/openethereum/pull/251)
|
||||
- clippy, missing docs, renaming etc. [#244](https://github.com/openethereum/openethereum/pull/244)
|
||||
- impl missing methods in tests [#243](https://github.com/openethereum/openethereum/pull/243)
|
||||
- General tests and some helpers [#239](https://github.com/openethereum/openethereum/pull/239)
|
||||
- Note additional tests are fixed, fix doc test. [#242](https://github.com/openethereum/openethereum/pull/242)
|
||||
- jsonrpc http server [#193](https://github.com/openethereum/openethereum/pull/193)
|
||||
- Ethash nonce is H64 not a u64 [#240](https://github.com/openethereum/openethereum/pull/240)
|
||||
- Fix import for bcMultiChainTest [#236](https://github.com/openethereum/openethereum/pull/236)
|
||||
- Client basic tests [#232](https://github.com/openethereum/openethereum/pull/232)
|
||||
- Fix ensure_db_good() and flush_queue(), block refactoring, check block format, be strict. [#231](https://github.com/openethereum/openethereum/pull/231)
|
||||
- Rlp [#207](https://github.com/openethereum/openethereum/pull/207)
|
||||
- Schedule documentation [#219](https://github.com/openethereum/openethereum/pull/219)
|
||||
- U256<->H256 Conversion [#206](https://github.com/openethereum/openethereum/pull/206)
|
||||
- Spawning new thread when we are reaching stack limit [#217](https://github.com/openethereum/openethereum/pull/217)
|
||||
- Blockchain tests [#211](https://github.com/openethereum/openethereum/pull/211)
|
||||
- fixed failing sync test [#218](https://github.com/openethereum/openethereum/pull/218)
|
||||
- Removing println [#216](https://github.com/openethereum/openethereum/pull/216)
|
||||
- Cleaning readme [#212](https://github.com/openethereum/openethereum/pull/212)
|
||||
- Fixing delegatecall [#196](https://github.com/openethereum/openethereum/pull/196)
|
||||
- Autogenerate the Args from the docopt macro. [#205](https://github.com/openethereum/openethereum/pull/205)
|
||||
- Networking fixes [#202](https://github.com/openethereum/openethereum/pull/202)
|
||||
- Argument parsing from CLI [#204](https://github.com/openethereum/openethereum/pull/204)
|
||||
- Removed wildcard from clippy version [#203](https://github.com/openethereum/openethereum/pull/203)
|
||||
- Fixed tests and tweaked sync progress report [#201](https://github.com/openethereum/openethereum/pull/201)
|
||||
- Heavy tests [#199](https://github.com/openethereum/openethereum/pull/199)
|
||||
- Mutithreaded IO [#198](https://github.com/openethereum/openethereum/pull/198)
|
||||
- Populating last_hashes [#197](https://github.com/openethereum/openethereum/pull/197)
|
||||
- Fixing clippy stuff [#170](https://github.com/openethereum/openethereum/pull/170)
|
||||
- basic .travis.yml [#194](https://github.com/openethereum/openethereum/pull/194)
|
||||
- Generating coverage reports. [#190](https://github.com/openethereum/openethereum/pull/190)
|
||||
- Adding doc requests comments [#192](https://github.com/openethereum/openethereum/pull/192)
|
||||
- moved src/bin/client.rs -> src/bin/client/main.rs [#185](https://github.com/openethereum/openethereum/pull/185)
|
||||
- removed overflowing_shr [#188](https://github.com/openethereum/openethereum/pull/188)
|
||||
- fixed wrapping ops on latest nightly [#187](https://github.com/openethereum/openethereum/pull/187)
|
||||
- Pruned state DB [#176](https://github.com/openethereum/openethereum/pull/176)
|
||||
- Memory management for cache [#180](https://github.com/openethereum/openethereum/pull/180)
|
||||
- Implement signs having low-s. [#183](https://github.com/openethereum/openethereum/pull/183)
|
||||
- Introduce sha3 crate and use it in ethash [#178](https://github.com/openethereum/openethereum/pull/178)
|
||||
- Multithreaded block queue [#173](https://github.com/openethereum/openethereum/pull/173)
|
||||
- Iterator for NibbleSlice and TrieDB. [#171](https://github.com/openethereum/openethereum/pull/171)
|
||||
- Handling all possible overflows [#145](https://github.com/openethereum/openethereum/pull/145)
|
||||
- Global secp256k1 context [#164](https://github.com/openethereum/openethereum/pull/164)
|
||||
- Ethash [#152](https://github.com/openethereum/openethereum/pull/152)
|
||||
- Move util into here [#153](https://github.com/openethereum/openethereum/pull/153)
|
||||
- EVM Interpreter [#103](https://github.com/openethereum/openethereum/pull/103)
|
||||
- Homestead transition support, maybe. [#141](https://github.com/openethereum/openethereum/pull/141)
|
||||
- externalities refactor [#131](https://github.com/openethereum/openethereum/pull/131)
|
||||
- More open files. [#140](https://github.com/openethereum/openethereum/pull/140)
|
||||
- Single array for logs output. [#133](https://github.com/openethereum/openethereum/pull/133)
|
||||
- Client app event handler [#132](https://github.com/openethereum/openethereum/pull/132)
|
||||
- Various consensus fixes. [#130](https://github.com/openethereum/openethereum/pull/130)
|
||||
- callcode builtins tests pass [#127](https://github.com/openethereum/openethereum/pull/127)
|
||||
- Client state syncing [#119](https://github.com/openethereum/openethereum/pull/119)
|
||||
- Split externalities from executive. [#126](https://github.com/openethereum/openethereum/pull/126)
|
||||
- executive error on not enoguh base gas [#124](https://github.com/openethereum/openethereum/pull/124)
|
||||
- Gav [#125](https://github.com/openethereum/openethereum/pull/125)
|
||||
- builtin sets excepted to true [#123](https://github.com/openethereum/openethereum/pull/123)
|
||||
- More state tests. [#122](https://github.com/openethereum/openethereum/pull/122)
|
||||
- updated to rocksdb wrapper version 0.3 [#121](https://github.com/openethereum/openethereum/pull/121)
|
||||
- out_of_gas -> excepted [#120](https://github.com/openethereum/openethereum/pull/120)
|
||||
- Parametrizing evm::Factory [#111](https://github.com/openethereum/openethereum/pull/111)
|
||||
- stLogs tests passing [#118](https://github.com/openethereum/openethereum/pull/118)
|
||||
- Fix executive. [#117](https://github.com/openethereum/openethereum/pull/117)
|
||||
- Fixes for marek's shooting from the hip. [#116](https://github.com/openethereum/openethereum/pull/116)
|
||||
- Executive revert fix [#115](https://github.com/openethereum/openethereum/pull/115)
|
||||
- Fix storage/account and add butress test. [#114](https://github.com/openethereum/openethereum/pull/114)
|
||||
- Refactored Pod & Diff types into separate files, JSON infrastructure revamp. [#113](https://github.com/openethereum/openethereum/pull/113)
|
||||
- Fix storage stuff and introduce per-item dirty-tracking. [#112](https://github.com/openethereum/openethereum/pull/112)
|
||||
- Check logs in state tests. [#109](https://github.com/openethereum/openethereum/pull/109)
|
||||
- executive gas calculation fixes [#108](https://github.com/openethereum/openethereum/pull/108)
|
||||
- proper gas calculation in executive [#107](https://github.com/openethereum/openethereum/pull/107)
|
||||
- Fixing MaxDepth param for executive [#105](https://github.com/openethereum/openethereum/pull/105)
|
||||
- Fix determination of state roots. [#106](https://github.com/openethereum/openethereum/pull/106)
|
||||
- transact substracts tx_gas [#104](https://github.com/openethereum/openethereum/pull/104)
|
||||
- Pretty-print and fix for state. [#102](https://github.com/openethereum/openethereum/pull/102)
|
||||
- Tier step price. [#101](https://github.com/openethereum/openethereum/pull/101)
|
||||
- Refactor Diff datastructures. [#100](https://github.com/openethereum/openethereum/pull/100)
|
||||
- externalities use u256 instead of u64 for gas calculation [#99](https://github.com/openethereum/openethereum/pull/99)
|
||||
- Executive tests [#97](https://github.com/openethereum/openethereum/pull/97)
|
||||
- State conensus tests now print mismatching diff on fail. [#98](https://github.com/openethereum/openethereum/pull/98)
|
||||
- State testing framework. First test is failing. [#96](https://github.com/openethereum/openethereum/pull/96)
|
||||
- executive tests [#95](https://github.com/openethereum/openethereum/pull/95)
|
||||
- Use U512s for ether cost calculation, complete transaction API [#94](https://github.com/openethereum/openethereum/pull/94)
|
||||
- Utils for consensus test decoding and better layout. [#93](https://github.com/openethereum/openethereum/pull/93)
|
||||
- executive fixes + tests [#89](https://github.com/openethereum/openethereum/pull/89)
|
||||
- All transaction tests pass. Nicer testing framework. [#92](https://github.com/openethereum/openethereum/pull/92)
|
||||
- Block verification tests; BlockProvider blockchain trait for testing [#88](https://github.com/openethereum/openethereum/pull/88)
|
||||
- State::exists, docs and tests. [#87](https://github.com/openethereum/openethereum/pull/87)
|
||||
- Add tests module, add two more transaction tests. [#86](https://github.com/openethereum/openethereum/pull/86)
|
||||
- bring back removed tests, removed build warnings [#82](https://github.com/openethereum/openethereum/pull/82)
|
||||
- Nicer transaction validation API. Nicer OutOfBounds API in general. [#85](https://github.com/openethereum/openethereum/pull/85)
|
||||
- Transaction fixes and consensus tests (all passing) [#84](https://github.com/openethereum/openethereum/pull/84)
|
||||
- fixed getting block info in evmjit + tests [#81](https://github.com/openethereum/openethereum/pull/81)
|
||||
- evm tests cleanup [#80](https://github.com/openethereum/openethereum/pull/80)
|
||||
- renamed VmFactory -> Factory [#77](https://github.com/openethereum/openethereum/pull/77)
|
||||
- fixed rust-evmjit description of improper_ctypes usage [#76](https://github.com/openethereum/openethereum/pull/76)
|
||||
- jit feature enabled by default [#75](https://github.com/openethereum/openethereum/pull/75)
|
||||
- evm [#52](https://github.com/openethereum/openethereum/pull/52)
|
||||
- state clone [#74](https://github.com/openethereum/openethereum/pull/74)
|
||||
- Block Verification (no tests yet) [#72](https://github.com/openethereum/openethereum/pull/72)
|
||||
- Improvements to LogEntry and Transaction [#73](https://github.com/openethereum/openethereum/pull/73)
|
||||
- Use getter in header in preparation for a Header trait; additional testing in enact_block(). [#64](https://github.com/openethereum/openethereum/pull/64)
|
||||
- BlockChain sync and Client app [#55](https://github.com/openethereum/openethereum/pull/55)
|
||||
- Block enactment (including test) [#63](https://github.com/openethereum/openethereum/pull/63)
|
||||
- Block complete. Needs tests. [#62](https://github.com/openethereum/openethereum/pull/62)
|
||||
- More on OpenBlock::close; State::kill_account added [#61](https://github.com/openethereum/openethereum/pull/61)
|
||||
- Remove genesis module, add more chain specs and separate out ethereum-specific stuff [#60](https://github.com/openethereum/openethereum/pull/60)
|
||||
- State::new_contract, camelCase engine params, missing param [#59](https://github.com/openethereum/openethereum/pull/59)
|
||||
- Use reorganisation [#58](https://github.com/openethereum/openethereum/pull/58)
|
||||
- Initial Ethash/Block skeleton implementations. [#57](https://github.com/openethereum/openethereum/pull/57)
|
||||
- Spec with tested Morden genesis decoder and builtins. [#54](https://github.com/openethereum/openethereum/pull/54)
|
||||
- Move all chain parameters into `engine_params` [#50](https://github.com/openethereum/openethereum/pull/50)
|
||||
- jit ffi improvements [please review] [#51](https://github.com/openethereum/openethereum/pull/51)
|
||||
- blockchain [please review] [#34](https://github.com/openethereum/openethereum/pull/34)
|
||||
- Move information from networkparams.rs into spec.rs [#48](https://github.com/openethereum/openethereum/pull/48)
|
||||
- Move bulking out in Engine/Params. [#47](https://github.com/openethereum/openethereum/pull/47)
|
||||
- Removed need for mutation in State. [#46](https://github.com/openethereum/openethereum/pull/46)
|
||||
- State::code and State::storage_at + tests. [#45](https://github.com/openethereum/openethereum/pull/45)
|
||||
- State functions for balance and nonce operations [#44](https://github.com/openethereum/openethereum/pull/44)
|
||||
- Account::storage_at, Account::ensure_cached and tests. [#43](https://github.com/openethereum/openethereum/pull/43)
|
||||
- Additional tests. [#42](https://github.com/openethereum/openethereum/pull/42)
|
||||
- seal todo done [#41](https://github.com/openethereum/openethereum/pull/41)
|
||||
- missing rustc_serialize crate && rlp `as_list` function [#40](https://github.com/openethereum/openethereum/pull/40)
|
||||
- More methods in Account, documentation and tests. [#39](https://github.com/openethereum/openethereum/pull/39)
|
||||
- Minor reworking of Account. [#38](https://github.com/openethereum/openethereum/pull/38)
|
||||
- Add Account and State classes. [#37](https://github.com/openethereum/openethereum/pull/37)
|
||||
- Revert regressions [#36](https://github.com/openethereum/openethereum/pull/36)
|
||||
- Panic on missing counters; Client cleanup [#368](https://github.com/paritytech/parity/pull/368)
|
||||
- Update README for new PPAs. [#369](https://github.com/paritytech/parity/pull/369)
|
||||
- block_queue::clear should be more thorough [#365](https://github.com/paritytech/parity/pull/365)
|
||||
- Fixed an issue with forked counters [#363](https://github.com/paritytech/parity/pull/363)
|
||||
- Install parity [#362](https://github.com/paritytech/parity/pull/362)
|
||||
- DB directory versioning [#358](https://github.com/paritytech/parity/pull/358)
|
||||
- Raise FD limit for MacOS [#357](https://github.com/paritytech/parity/pull/357)
|
||||
- Travis slack integration. [#356](https://github.com/paritytech/parity/pull/356)
|
||||
- SignedTransaction structure [#350](https://github.com/paritytech/parity/pull/350)
|
||||
- License [#354](https://github.com/paritytech/parity/pull/354)
|
||||
- Performance optimizations [#353](https://github.com/paritytech/parity/pull/353)
|
||||
- Gitter in README. [#355](https://github.com/paritytech/parity/pull/355)
|
||||
- test efforts, receipt requests [#352](https://github.com/paritytech/parity/pull/352)
|
||||
- sync tests setup & local module coverage [#348](https://github.com/paritytech/parity/pull/348)
|
||||
- install parity script [#347](https://github.com/paritytech/parity/pull/347)
|
||||
- evmjit homestead merge [#342](https://github.com/paritytech/parity/pull/342)
|
||||
- Fixed sync stalling on fork [#343](https://github.com/paritytech/parity/pull/343)
|
||||
- Remerge 264 [#334](https://github.com/paritytech/parity/pull/334)
|
||||
- Ethsync tests bfix [#339](https://github.com/paritytech/parity/pull/339)
|
||||
- Fix default options. [#335](https://github.com/paritytech/parity/pull/335)
|
||||
- sync queue limit hotfix [#338](https://github.com/paritytech/parity/pull/338)
|
||||
- Network tests, separate local coverage for utils [#333](https://github.com/paritytech/parity/pull/333)
|
||||
- fix parity version so netstats can parse it [#332](https://github.com/paritytech/parity/pull/332)
|
||||
- reveal surprise [#331](https://github.com/paritytech/parity/pull/331)
|
||||
- Revert removal of `new_code`. [#330](https://github.com/paritytech/parity/pull/330)
|
||||
- Network mod tests first part [#329](https://github.com/paritytech/parity/pull/329)
|
||||
- Look ma no `dead_code` [#323](https://github.com/paritytech/parity/pull/323)
|
||||
- Fixing JIT, Updating hook to run `ethcore` tests. [#326](https://github.com/paritytech/parity/pull/326)
|
||||
- Final docs [#327](https://github.com/paritytech/parity/pull/327)
|
||||
- update install-deps.sh [#316](https://github.com/paritytech/parity/pull/316)
|
||||
- Finish all my docs. Fix previous test compilation. [#320](https://github.com/paritytech/parity/pull/320)
|
||||
- Additional evm tests (extops, call, jumps) and some docs [#317](https://github.com/paritytech/parity/pull/317)
|
||||
- More documentation. [#318](https://github.com/paritytech/parity/pull/318)
|
||||
- Additional documentation. [#315](https://github.com/paritytech/parity/pull/315)
|
||||
- unused functions cleanup [#310](https://github.com/paritytech/parity/pull/310)
|
||||
- update ethcore.github.io documentation automatically [#311](https://github.com/paritytech/parity/pull/311)
|
||||
- Another try with travis ci credentials [#314](https://github.com/paritytech/parity/pull/314)
|
||||
- Document some stuff. [#309](https://github.com/paritytech/parity/pull/309)
|
||||
- Check block parent on import; Peer timeouts [#303](https://github.com/paritytech/parity/pull/303)
|
||||
- Increasing coverage for evm. [#306](https://github.com/paritytech/parity/pull/306)
|
||||
- ethcore docs [#301](https://github.com/paritytech/parity/pull/301)
|
||||
- Replacing secure token for deployment [#305](https://github.com/paritytech/parity/pull/305)
|
||||
- doc.sh [#299](https://github.com/paritytech/parity/pull/299)
|
||||
- Building beta-* and stable-* tags [#302](https://github.com/paritytech/parity/pull/302)
|
||||
- Deploying artifacts for tags (release/beta) [#300](https://github.com/paritytech/parity/pull/300)
|
||||
- cov.sh to show coverage locally [#298](https://github.com/paritytech/parity/pull/298)
|
||||
- benchmark fixes [#297](https://github.com/paritytech/parity/pull/297)
|
||||
- Include JSONRPC CLI options. [#296](https://github.com/paritytech/parity/pull/296)
|
||||
- travis.yml fixes [#293](https://github.com/paritytech/parity/pull/293)
|
||||
- Improve version string. [#295](https://github.com/paritytech/parity/pull/295)
|
||||
- Fixed block queue test [#294](https://github.com/paritytech/parity/pull/294)
|
||||
- Util docs [#292](https://github.com/paritytech/parity/pull/292)
|
||||
- fixed building docs [#289](https://github.com/paritytech/parity/pull/289)
|
||||
- update travis to build PRs only against master [#290](https://github.com/paritytech/parity/pull/290)
|
||||
- Coverage effort [#272](https://github.com/paritytech/parity/pull/272)
|
||||
- updated docker containers [#288](https://github.com/paritytech/parity/pull/288)
|
||||
- rpc module fixes [#287](https://github.com/paritytech/parity/pull/287)
|
||||
- Test for Receipt RLP. [#282](https://github.com/paritytech/parity/pull/282)
|
||||
- Building from source guide [#284](https://github.com/paritytech/parity/pull/284)
|
||||
- Fixed neted empty list RLP encoding [#283](https://github.com/paritytech/parity/pull/283)
|
||||
- Fix CALLDATACOPY (and bonus CODECOPY, too!). [#279](https://github.com/paritytech/parity/pull/279)
|
||||
- added travis && coveralls badge to README.md [#280](https://github.com/paritytech/parity/pull/280)
|
||||
- coveralls coverage [#277](https://github.com/paritytech/parity/pull/277)
|
||||
- Travis [in progress] [#257](https://github.com/paritytech/parity/pull/257)
|
||||
- Travis on reorganized repo [#276](https://github.com/paritytech/parity/pull/276)
|
||||
- umbrella project [#275](https://github.com/paritytech/parity/pull/275)
|
||||
- Ethash disk cache [#273](https://github.com/paritytech/parity/pull/273)
|
||||
- Parity executable name and version [#274](https://github.com/paritytech/parity/pull/274)
|
||||
- Dockerfile [#195](https://github.com/paritytech/parity/pull/195)
|
||||
- Garbage collection test fix [#267](https://github.com/paritytech/parity/pull/267)
|
||||
- Fix stCallCreateCallCodeTest, add more tests [#271](https://github.com/paritytech/parity/pull/271)
|
||||
- Moved sync out of ethcore crate; Added block validation [#265](https://github.com/paritytech/parity/pull/265)
|
||||
- RLP encoder refactoring [#252](https://github.com/paritytech/parity/pull/252)
|
||||
- Chain sync tests and minor refactoring [#264](https://github.com/paritytech/parity/pull/264)
|
||||
- Common log init function [#263](https://github.com/paritytech/parity/pull/263)
|
||||
- changed max vm depth from 128 to 64, change homestead block to 1_000_000 [#262](https://github.com/paritytech/parity/pull/262)
|
||||
- fixed blockchain tests crash on log init [#261](https://github.com/paritytech/parity/pull/261)
|
||||
- Blockchain tests and some helpers for guarding temp directory [#256](https://github.com/paritytech/parity/pull/256)
|
||||
- Fix logging and random tests. [#260](https://github.com/paritytech/parity/pull/260)
|
||||
- Fix difficulty calculation algo. [#259](https://github.com/paritytech/parity/pull/259)
|
||||
- fix submodule version [#258](https://github.com/paritytech/parity/pull/258)
|
||||
- temp dir spawn refactoring [#246](https://github.com/paritytech/parity/pull/246)
|
||||
- fixed tests submodule branch [#254](https://github.com/paritytech/parity/pull/254)
|
||||
- rpc net methods returns real peer count && protocol version [#253](https://github.com/paritytech/parity/pull/253)
|
||||
- Add homestead & random tests. [#245](https://github.com/paritytech/parity/pull/245)
|
||||
- Fixing suicide with self-refund to be consistent with CPP. [#247](https://github.com/paritytech/parity/pull/247)
|
||||
- stubs for rpc methods [#251](https://github.com/paritytech/parity/pull/251)
|
||||
- clippy, missing docs, renaming etc. [#244](https://github.com/paritytech/parity/pull/244)
|
||||
- impl missing methods in tests [#243](https://github.com/paritytech/parity/pull/243)
|
||||
- General tests and some helpers [#239](https://github.com/paritytech/parity/pull/239)
|
||||
- Note additional tests are fixed, fix doc test. [#242](https://github.com/paritytech/parity/pull/242)
|
||||
- jsonrpc http server [#193](https://github.com/paritytech/parity/pull/193)
|
||||
- Ethash nonce is H64 not a u64 [#240](https://github.com/paritytech/parity/pull/240)
|
||||
- Fix import for bcMultiChainTest [#236](https://github.com/paritytech/parity/pull/236)
|
||||
- Client basic tests [#232](https://github.com/paritytech/parity/pull/232)
|
||||
- Fix ensure_db_good() and flush_queue(), block refactoring, check block format, be strict. [#231](https://github.com/paritytech/parity/pull/231)
|
||||
- Rlp [#207](https://github.com/paritytech/parity/pull/207)
|
||||
- Schedule documentation [#219](https://github.com/paritytech/parity/pull/219)
|
||||
- U256<->H256 Conversion [#206](https://github.com/paritytech/parity/pull/206)
|
||||
- Spawning new thread when we are reaching stack limit [#217](https://github.com/paritytech/parity/pull/217)
|
||||
- Blockchain tests [#211](https://github.com/paritytech/parity/pull/211)
|
||||
- fixed failing sync test [#218](https://github.com/paritytech/parity/pull/218)
|
||||
- Removing println [#216](https://github.com/paritytech/parity/pull/216)
|
||||
- Cleaning readme [#212](https://github.com/paritytech/parity/pull/212)
|
||||
- Fixing delegatecall [#196](https://github.com/paritytech/parity/pull/196)
|
||||
- Autogenerate the Args from the docopt macro. [#205](https://github.com/paritytech/parity/pull/205)
|
||||
- Networking fixes [#202](https://github.com/paritytech/parity/pull/202)
|
||||
- Argument parsing from CLI [#204](https://github.com/paritytech/parity/pull/204)
|
||||
- Removed wildcard from clippy version [#203](https://github.com/paritytech/parity/pull/203)
|
||||
- Fixed tests and tweaked sync progress report [#201](https://github.com/paritytech/parity/pull/201)
|
||||
- Heavy tests [#199](https://github.com/paritytech/parity/pull/199)
|
||||
- Mutithreaded IO [#198](https://github.com/paritytech/parity/pull/198)
|
||||
- Populating last_hashes [#197](https://github.com/paritytech/parity/pull/197)
|
||||
- Fixing clippy stuff [#170](https://github.com/paritytech/parity/pull/170)
|
||||
- basic .travis.yml [#194](https://github.com/paritytech/parity/pull/194)
|
||||
- Generating coverage reports. [#190](https://github.com/paritytech/parity/pull/190)
|
||||
- Adding doc requests comments [#192](https://github.com/paritytech/parity/pull/192)
|
||||
- moved src/bin/client.rs -> src/bin/client/main.rs [#185](https://github.com/paritytech/parity/pull/185)
|
||||
- removed overflowing_shr [#188](https://github.com/paritytech/parity/pull/188)
|
||||
- fixed wrapping ops on latest nightly [#187](https://github.com/paritytech/parity/pull/187)
|
||||
- Pruned state DB [#176](https://github.com/paritytech/parity/pull/176)
|
||||
- Memory management for cache [#180](https://github.com/paritytech/parity/pull/180)
|
||||
- Implement signs having low-s. [#183](https://github.com/paritytech/parity/pull/183)
|
||||
- Introduce sha3 crate and use it in ethash [#178](https://github.com/paritytech/parity/pull/178)
|
||||
- Multithreaded block queue [#173](https://github.com/paritytech/parity/pull/173)
|
||||
- Iterator for NibbleSlice and TrieDB. [#171](https://github.com/paritytech/parity/pull/171)
|
||||
- Handling all possible overflows [#145](https://github.com/paritytech/parity/pull/145)
|
||||
- Global secp256k1 context [#164](https://github.com/paritytech/parity/pull/164)
|
||||
- Ethash [#152](https://github.com/paritytech/parity/pull/152)
|
||||
- Move util into here [#153](https://github.com/paritytech/parity/pull/153)
|
||||
- EVM Interpreter [#103](https://github.com/paritytech/parity/pull/103)
|
||||
- Homestead transition support, maybe. [#141](https://github.com/paritytech/parity/pull/141)
|
||||
- externalities refactor [#131](https://github.com/paritytech/parity/pull/131)
|
||||
- More open files. [#140](https://github.com/paritytech/parity/pull/140)
|
||||
- Single array for logs output. [#133](https://github.com/paritytech/parity/pull/133)
|
||||
- Client app event handler [#132](https://github.com/paritytech/parity/pull/132)
|
||||
- Various consensus fixes. [#130](https://github.com/paritytech/parity/pull/130)
|
||||
- callcode builtins tests pass [#127](https://github.com/paritytech/parity/pull/127)
|
||||
- Client state syncing [#119](https://github.com/paritytech/parity/pull/119)
|
||||
- Split externalities from executive. [#126](https://github.com/paritytech/parity/pull/126)
|
||||
- executive error on not enoguh base gas [#124](https://github.com/paritytech/parity/pull/124)
|
||||
- Gav [#125](https://github.com/paritytech/parity/pull/125)
|
||||
- builtin sets excepted to true [#123](https://github.com/paritytech/parity/pull/123)
|
||||
- More state tests. [#122](https://github.com/paritytech/parity/pull/122)
|
||||
- updated to rocksdb wrapper version 0.3 [#121](https://github.com/paritytech/parity/pull/121)
|
||||
- out_of_gas -> excepted [#120](https://github.com/paritytech/parity/pull/120)
|
||||
- Parametrizing evm::Factory [#111](https://github.com/paritytech/parity/pull/111)
|
||||
- stLogs tests passing [#118](https://github.com/paritytech/parity/pull/118)
|
||||
- Fix executive. [#117](https://github.com/paritytech/parity/pull/117)
|
||||
- Fixes for marek's shooting from the hip. [#116](https://github.com/paritytech/parity/pull/116)
|
||||
- Executive revert fix [#115](https://github.com/paritytech/parity/pull/115)
|
||||
- Fix storage/account and add butress test. [#114](https://github.com/paritytech/parity/pull/114)
|
||||
- Refactored Pod & Diff types into separate files, JSON infrastructure revamp. [#113](https://github.com/paritytech/parity/pull/113)
|
||||
- Fix storage stuff and introduce per-item dirty-tracking. [#112](https://github.com/paritytech/parity/pull/112)
|
||||
- Check logs in state tests. [#109](https://github.com/paritytech/parity/pull/109)
|
||||
- executive gas calculation fixes [#108](https://github.com/paritytech/parity/pull/108)
|
||||
- proper gas calculation in executive [#107](https://github.com/paritytech/parity/pull/107)
|
||||
- Fixing MaxDepth param for executive [#105](https://github.com/paritytech/parity/pull/105)
|
||||
- Fix determination of state roots. [#106](https://github.com/paritytech/parity/pull/106)
|
||||
- transact substracts tx_gas [#104](https://github.com/paritytech/parity/pull/104)
|
||||
- Pretty-print and fix for state. [#102](https://github.com/paritytech/parity/pull/102)
|
||||
- Tier step price. [#101](https://github.com/paritytech/parity/pull/101)
|
||||
- Refactor Diff datastructures. [#100](https://github.com/paritytech/parity/pull/100)
|
||||
- externalities use u256 instead of u64 for gas calculation [#99](https://github.com/paritytech/parity/pull/99)
|
||||
- Executive tests [#97](https://github.com/paritytech/parity/pull/97)
|
||||
- State conensus tests now print mismatching diff on fail. [#98](https://github.com/paritytech/parity/pull/98)
|
||||
- State testing framework. First test is failing. [#96](https://github.com/paritytech/parity/pull/96)
|
||||
- executive tests [#95](https://github.com/paritytech/parity/pull/95)
|
||||
- Use U512s for ether cost calculation, complete transaction API [#94](https://github.com/paritytech/parity/pull/94)
|
||||
- Utils for consensus test decoding and better layout. [#93](https://github.com/paritytech/parity/pull/93)
|
||||
- executive fixes + tests [#89](https://github.com/paritytech/parity/pull/89)
|
||||
- All transaction tests pass. Nicer testing framework. [#92](https://github.com/paritytech/parity/pull/92)
|
||||
- Block verification tests; BlockProvider blockchain trait for testing [#88](https://github.com/paritytech/parity/pull/88)
|
||||
- State::exists, docs and tests. [#87](https://github.com/paritytech/parity/pull/87)
|
||||
- Add tests module, add two more transaction tests. [#86](https://github.com/paritytech/parity/pull/86)
|
||||
- bring back removed tests, removed build warnings [#82](https://github.com/paritytech/parity/pull/82)
|
||||
- Nicer transaction validation API. Nicer OutOfBounds API in general. [#85](https://github.com/paritytech/parity/pull/85)
|
||||
- Transaction fixes and consensus tests (all passing) [#84](https://github.com/paritytech/parity/pull/84)
|
||||
- fixed getting block info in evmjit + tests [#81](https://github.com/paritytech/parity/pull/81)
|
||||
- evm tests cleanup [#80](https://github.com/paritytech/parity/pull/80)
|
||||
- renamed VmFactory -> Factory [#77](https://github.com/paritytech/parity/pull/77)
|
||||
- fixed rust-evmjit description of improper_ctypes usage [#76](https://github.com/paritytech/parity/pull/76)
|
||||
- jit feature enabled by default [#75](https://github.com/paritytech/parity/pull/75)
|
||||
- evm [#52](https://github.com/paritytech/parity/pull/52)
|
||||
- state clone [#74](https://github.com/paritytech/parity/pull/74)
|
||||
- Block Verification (no tests yet) [#72](https://github.com/paritytech/parity/pull/72)
|
||||
- Improvements to LogEntry and Transaction [#73](https://github.com/paritytech/parity/pull/73)
|
||||
- Use getter in header in preparation for a Header trait; additional testing in enact_block(). [#64](https://github.com/paritytech/parity/pull/64)
|
||||
- BlockChain sync and Client app [#55](https://github.com/paritytech/parity/pull/55)
|
||||
- Block enactment (including test) [#63](https://github.com/paritytech/parity/pull/63)
|
||||
- Block complete. Needs tests. [#62](https://github.com/paritytech/parity/pull/62)
|
||||
- More on OpenBlock::close; State::kill_account added [#61](https://github.com/paritytech/parity/pull/61)
|
||||
- Remove genesis module, add more chain specs and separate out ethereum-specific stuff [#60](https://github.com/paritytech/parity/pull/60)
|
||||
- State::new_contract, camelCase engine params, missing param [#59](https://github.com/paritytech/parity/pull/59)
|
||||
- Use reorganisation [#58](https://github.com/paritytech/parity/pull/58)
|
||||
- Initial Ethash/Block skeleton implementations. [#57](https://github.com/paritytech/parity/pull/57)
|
||||
- Spec with tested Morden genesis decoder and builtins. [#54](https://github.com/paritytech/parity/pull/54)
|
||||
- Move all chain parameters into `engine_params` [#50](https://github.com/paritytech/parity/pull/50)
|
||||
- jit ffi improvements [please review] [#51](https://github.com/paritytech/parity/pull/51)
|
||||
- blockchain [please review] [#34](https://github.com/paritytech/parity/pull/34)
|
||||
- Move information from networkparams.rs into spec.rs [#48](https://github.com/paritytech/parity/pull/48)
|
||||
- Move bulking out in Engine/Params. [#47](https://github.com/paritytech/parity/pull/47)
|
||||
- Removed need for mutation in State. [#46](https://github.com/paritytech/parity/pull/46)
|
||||
- State::code and State::storage_at + tests. [#45](https://github.com/paritytech/parity/pull/45)
|
||||
- State functions for balance and nonce operations [#44](https://github.com/paritytech/parity/pull/44)
|
||||
- Account::storage_at, Account::ensure_cached and tests. [#43](https://github.com/paritytech/parity/pull/43)
|
||||
- Additional tests. [#42](https://github.com/paritytech/parity/pull/42)
|
||||
- seal todo done [#41](https://github.com/paritytech/parity/pull/41)
|
||||
- missing rustc_serialize crate && rlp `as_list` function [#40](https://github.com/paritytech/parity/pull/40)
|
||||
- More methods in Account, documentation and tests. [#39](https://github.com/paritytech/parity/pull/39)
|
||||
- Minor reworking of Account. [#38](https://github.com/paritytech/parity/pull/38)
|
||||
- Add Account and State classes. [#37](https://github.com/paritytech/parity/pull/37)
|
||||
- Revert regressions [#36](https://github.com/paritytech/parity/pull/36)
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
Note: Parity 1.0 reached End-of-Life on 2016-06-24 (EOL).
|
||||
|
||||
## Parity [v1.0.2](https://github.com/openethereum/openethereum/releases/tag/v1.0.2) (2016-04-11)
|
||||
## Parity [v1.0.2](https://github.com/paritytech/parity/releases/tag/v1.0.2) (2016-04-11)
|
||||
|
||||
Parity 1.0.2 release improves Json RPC compatibility and fixes a number of stability issues.
|
||||
|
||||
- Flush password prompt [#1031](https://github.com/openethereum/openethereum/pull/1031)
|
||||
- [beta] dependencies update [#949](https://github.com/openethereum/openethereum/pull/949)
|
||||
- Master to beta v1.0.2 [#922](https://github.com/openethereum/openethereum/pull/922)
|
||||
- Master to beta 1.0.2 [#908](https://github.com/openethereum/openethereum/pull/908)
|
||||
- Flush password prompt [#1031](https://github.com/paritytech/parity/pull/1031)
|
||||
- [beta] dependencies update [#949](https://github.com/paritytech/parity/pull/949)
|
||||
- Master to beta v1.0.2 [#922](https://github.com/paritytech/parity/pull/922)
|
||||
- Master to beta 1.0.2 [#908](https://github.com/paritytech/parity/pull/908)
|
||||
|
||||
## Parity [v1.0.1](https://github.com/openethereum/openethereum/releases/tag/v1.0.1) (2016-03-28)
|
||||
## Parity [v1.0.1](https://github.com/paritytech/parity/releases/tag/v1.0.1) (2016-03-28)
|
||||
|
||||
Parity 1.0.1 update fixes a number of issues with Json RPC, transaction propagation and syncing.
|
||||
|
||||
- Imporved sync error handling [#905](https://github.com/openethereum/openethereum/pull/905)
|
||||
- Publish locally-made transactions to peers. [#851](https://github.com/openethereum/openethereum/pull/851)
|
||||
- Merge fixes from master to beta [#845](https://github.com/openethereum/openethereum/pull/845)
|
||||
- Full sync restart on bad block [#844](https://github.com/openethereum/openethereum/pull/844)
|
||||
- Make BlockNumber optional, fix eth_call [#828](https://github.com/openethereum/openethereum/pull/828)
|
||||
- Web3sha3 beta [#826](https://github.com/openethereum/openethereum/pull/826)
|
||||
- Use network id for the web3_net_version return. [#821](https://github.com/openethereum/openethereum/pull/821)
|
||||
- Fix mining from spinning [#806](https://github.com/openethereum/openethereum/pull/806)
|
||||
- Merge master to beta [#796](https://github.com/openethereum/openethereum/pull/796)
|
||||
- Imporved sync error handling [#905](https://github.com/paritytech/parity/pull/905)
|
||||
- Publish locally-made transactions to peers. [#851](https://github.com/paritytech/parity/pull/851)
|
||||
- Merge fixes from master to beta [#845](https://github.com/paritytech/parity/pull/845)
|
||||
- Full sync restart on bad block [#844](https://github.com/paritytech/parity/pull/844)
|
||||
- Make BlockNumber optional, fix eth_call [#828](https://github.com/paritytech/parity/pull/828)
|
||||
- Web3sha3 beta [#826](https://github.com/paritytech/parity/pull/826)
|
||||
- Use network id for the web3_net_version return. [#821](https://github.com/paritytech/parity/pull/821)
|
||||
- Fix mining from spinning [#806](https://github.com/paritytech/parity/pull/806)
|
||||
- Merge master to beta [#796](https://github.com/paritytech/parity/pull/796)
|
||||
|
||||
## Parity [v1.0.0](https://github.com/openethereum/openethereum/releases/tag/v1.0.0) (2016-03-24)
|
||||
## Parity [v1.0.0](https://github.com/paritytech/parity/releases/tag/v1.0.0) (2016-03-24)
|
||||
|
||||
Parity 1.0.0 release adds the following features:
|
||||
|
||||
@@ -41,277 +41,277 @@ Parity 1.0.0 release adds the following features:
|
||||
|
||||
Note that in this release the state database is in archive (full) mode by default. Run with one of the `--pruning` options to enable pruning.
|
||||
|
||||
- First part of multi-mining support [#804](https://github.com/openethereum/openethereum/pull/804)
|
||||
- Fixing future-current transactions clash [#802](https://github.com/openethereum/openethereum/pull/802)
|
||||
- Increase threads to num_cpus & fix author reporting [#800](https://github.com/openethereum/openethereum/pull/800)
|
||||
- another batch of rpc improvements [#798](https://github.com/openethereum/openethereum/pull/798)
|
||||
- Avoid tracing DELEGATECALL and CALLCODE. Plus tests for it. [#794](https://github.com/openethereum/openethereum/pull/794)
|
||||
- complete getting started steps for OS X [#793](https://github.com/openethereum/openethereum/pull/793)
|
||||
- Auto detect available port (with fixed test) [#788](https://github.com/openethereum/openethereum/pull/788)
|
||||
- eth_getTransactionReceipt [#792](https://github.com/openethereum/openethereum/pull/792)
|
||||
- Comprehensive tests for tracing transactions [#791](https://github.com/openethereum/openethereum/pull/791)
|
||||
- Disable preparing work package if miners don't ask for it. [#771](https://github.com/openethereum/openethereum/pull/771)
|
||||
- Listen on all interfaces for JSONRPC by default. [#786](https://github.com/openethereum/openethereum/pull/786)
|
||||
- eth_call [#783](https://github.com/openethereum/openethereum/pull/783)
|
||||
- Revert "Auto detect available port" [#789](https://github.com/openethereum/openethereum/pull/789)
|
||||
- added output to execution result [#777](https://github.com/openethereum/openethereum/pull/777)
|
||||
- Auto detect available port [#782](https://github.com/openethereum/openethereum/pull/782)
|
||||
- Allow 0x prefix for --author. [#785](https://github.com/openethereum/openethereum/pull/785)
|
||||
- updated dependencies, moved rpctest to its own submodule [#784](https://github.com/openethereum/openethereum/pull/784)
|
||||
- use ethjson module to load chain json tests [#778](https://github.com/openethereum/openethereum/pull/778)
|
||||
- Tracing implemented. [#772](https://github.com/openethereum/openethereum/pull/772)
|
||||
- test ethjson module on travis [#780](https://github.com/openethereum/openethereum/pull/780)
|
||||
- batch of rpc fixes [#775](https://github.com/openethereum/openethereum/pull/775)
|
||||
- rpctest executable [#757](https://github.com/openethereum/openethereum/pull/757)
|
||||
- Refactoring error transaction_queue error handling and `update_sealing` method. [#753](https://github.com/openethereum/openethereum/pull/753)
|
||||
- Avoid importing transactions with gas above 1.1*block_gas_limit to transaction queue [#760](https://github.com/openethereum/openethereum/pull/760)
|
||||
- Removing transactions that failed to be pushed to block. [#752](https://github.com/openethereum/openethereum/pull/752)
|
||||
- Updating clippy [#766](https://github.com/openethereum/openethereum/pull/766)
|
||||
- Attempting to add all transactions to mined block [#754](https://github.com/openethereum/openethereum/pull/754)
|
||||
- Prettier version w/o git dir; Use rustc compile time version [#761](https://github.com/openethereum/openethereum/pull/761)
|
||||
- Stop adding transactions to queue while not fully synced [#751](https://github.com/openethereum/openethereum/pull/751)
|
||||
- Verify sender's balance before importing transaction to queue [#746](https://github.com/openethereum/openethereum/pull/746)
|
||||
- Returning number of transactions pending in block not queue [#750](https://github.com/openethereum/openethereum/pull/750)
|
||||
- Speeding up build [#733](https://github.com/openethereum/openethereum/pull/733)
|
||||
- adding check for a sync when giving work to miner [#742](https://github.com/openethereum/openethereum/pull/742)
|
||||
- json deserialization module [#745](https://github.com/openethereum/openethereum/pull/745)
|
||||
- Update install-parity.sh [#749](https://github.com/openethereum/openethereum/pull/749)
|
||||
- Restart sync on getting old unknown header [#747](https://github.com/openethereum/openethereum/pull/747)
|
||||
- Missing return for #737 [#744](https://github.com/openethereum/openethereum/pull/744)
|
||||
- Enact block with uncles test [#741](https://github.com/openethereum/openethereum/pull/741)
|
||||
- Fix outdated libc version on dependency [#740](https://github.com/openethereum/openethereum/pull/740)
|
||||
- Fixing possible race in transaction queue [#735](https://github.com/openethereum/openethereum/pull/735)
|
||||
- Sync fixed again [#737](https://github.com/openethereum/openethereum/pull/737)
|
||||
- Don't change best block until extras is committed. [#734](https://github.com/openethereum/openethereum/pull/734)
|
||||
- stable only until travis speedup [#736](https://github.com/openethereum/openethereum/pull/736)
|
||||
- Optimizing uint operations (architecture independent) [#629](https://github.com/openethereum/openethereum/pull/629)
|
||||
- Add RLP, not a data item. [#725](https://github.com/openethereum/openethereum/pull/725)
|
||||
- PV63 receipts response [#687](https://github.com/openethereum/openethereum/pull/687)
|
||||
- another batch of rpc tests [#723](https://github.com/openethereum/openethereum/pull/723)
|
||||
- dockerfiles update [#726](https://github.com/openethereum/openethereum/pull/726)
|
||||
- Lock reports to avoid out of order badness. [#721](https://github.com/openethereum/openethereum/pull/721)
|
||||
- Fixed handshake leak [#722](https://github.com/openethereum/openethereum/pull/722)
|
||||
- Allow configuration of target gas limit. [#719](https://github.com/openethereum/openethereum/pull/719)
|
||||
- Version 1.1 in master [#714](https://github.com/openethereum/openethereum/pull/714)
|
||||
- Silence UDP warnings [#720](https://github.com/openethereum/openethereum/pull/720)
|
||||
- Rpc personal tests [#715](https://github.com/openethereum/openethereum/pull/715)
|
||||
- Fixing warnings [#704](https://github.com/openethereum/openethereum/pull/704)
|
||||
- docopts cleanups [#713](https://github.com/openethereum/openethereum/pull/713)
|
||||
- Removed rocksdb build dependency [#717](https://github.com/openethereum/openethereum/pull/717)
|
||||
- Fixed splitting Neighbours packet [#710](https://github.com/openethereum/openethereum/pull/710)
|
||||
- management of account expiration & memory [#701](https://github.com/openethereum/openethereum/pull/701)
|
||||
- Remove EarlyMerge from user docs. [#708](https://github.com/openethereum/openethereum/pull/708)
|
||||
- Fixes and traces for refcountdb. [#705](https://github.com/openethereum/openethereum/pull/705)
|
||||
- Check for NULL_RLP in AccountDB [#706](https://github.com/openethereum/openethereum/pull/706)
|
||||
- ethminer as crate [#700](https://github.com/openethereum/openethereum/pull/700)
|
||||
- Old ref-counted DB code [#692](https://github.com/openethereum/openethereum/pull/692)
|
||||
- next batch of rpc tests and fixes [#699](https://github.com/openethereum/openethereum/pull/699)
|
||||
- implemented eth_geStorageAt rpc method, added more tests for rpc [#695](https://github.com/openethereum/openethereum/pull/695)
|
||||
- Fix JournalDB era marker [#690](https://github.com/openethereum/openethereum/pull/690)
|
||||
- More sync fixes [#685](https://github.com/openethereum/openethereum/pull/685)
|
||||
- mark some key tests as heavy [#694](https://github.com/openethereum/openethereum/pull/694)
|
||||
- Limit incoming connections [#693](https://github.com/openethereum/openethereum/pull/693)
|
||||
- Updating clippy [#688](https://github.com/openethereum/openethereum/pull/688)
|
||||
- eth_accounts, eth_getBalance rpc functions && tests [#691](https://github.com/openethereum/openethereum/pull/691)
|
||||
- state query for archive jdb [#683](https://github.com/openethereum/openethereum/pull/683)
|
||||
- Fix for option 1 of JournalDB [#658](https://github.com/openethereum/openethereum/pull/658)
|
||||
- Rename into something that is a little more descriptive. [#689](https://github.com/openethereum/openethereum/pull/689)
|
||||
- JournalDB with in-memory overlay (option2) [#634](https://github.com/openethereum/openethereum/pull/634)
|
||||
- additional (failing) SecretStore test [#682](https://github.com/openethereum/openethereum/pull/682)
|
||||
- Updating clippy & fixing warnings. [#670](https://github.com/openethereum/openethereum/pull/670)
|
||||
- rpc web3 tests [#681](https://github.com/openethereum/openethereum/pull/681)
|
||||
- Making personal json-rpc configurable via cli [#677](https://github.com/openethereum/openethereum/pull/677)
|
||||
- RPC Pending Transactions Filter [#661](https://github.com/openethereum/openethereum/pull/661)
|
||||
- Rearrange journaldb infrastructure to make more extensible [#678](https://github.com/openethereum/openethereum/pull/678)
|
||||
- JournalDB -> Box<JournalDB>, and it's a trait. [#673](https://github.com/openethereum/openethereum/pull/673)
|
||||
- fix warning for transaction_queue.add usage [#676](https://github.com/openethereum/openethereum/pull/676)
|
||||
- Adding std::mem back (only for asm) [#680](https://github.com/openethereum/openethereum/pull/680)
|
||||
- update readme to exclude beta step (stable is ok) [#679](https://github.com/openethereum/openethereum/pull/679)
|
||||
- fixed U256 and transaction request deserialization [#675](https://github.com/openethereum/openethereum/pull/675)
|
||||
- More geth compatibility. [#666](https://github.com/openethereum/openethereum/pull/666)
|
||||
- Removing running clippy by default on nightly. [#671](https://github.com/openethereum/openethereum/pull/671)
|
||||
- rpc net submodule tests [#667](https://github.com/openethereum/openethereum/pull/667)
|
||||
- Client module overhaul [#665](https://github.com/openethereum/openethereum/pull/665)
|
||||
- Rpc transaction signing [#587](https://github.com/openethereum/openethereum/pull/587)
|
||||
- Transaction queue exposed via JSON rpc. [#652](https://github.com/openethereum/openethereum/pull/652)
|
||||
- Remove unneeded locking [#499](https://github.com/openethereum/openethereum/pull/499)
|
||||
- extend sync status interface to sync provider [#664](https://github.com/openethereum/openethereum/pull/664)
|
||||
- --archive is default. --pruning is option. [#663](https://github.com/openethereum/openethereum/pull/663)
|
||||
- jsonrpc uses client and sync interfaces [#641](https://github.com/openethereum/openethereum/pull/641)
|
||||
- Expose transaction insertion in sync lib [#609](https://github.com/openethereum/openethereum/pull/609)
|
||||
- Removing get prefix from poll_info [#660](https://github.com/openethereum/openethereum/pull/660)
|
||||
- Tx queue update height bug [#657](https://github.com/openethereum/openethereum/pull/657)
|
||||
- Tx_queue_docs -> To master [#651](https://github.com/openethereum/openethereum/pull/651)
|
||||
- blockchain import_route [#645](https://github.com/openethereum/openethereum/pull/645)
|
||||
- Stop workers before stopping event loop [#655](https://github.com/openethereum/openethereum/pull/655)
|
||||
- Validate sender before importing to queue [#650](https://github.com/openethereum/openethereum/pull/650)
|
||||
- Gas price threshold for transactions [#640](https://github.com/openethereum/openethereum/pull/640)
|
||||
- `dev` feature enabled when compiling without `--release` [#627](https://github.com/openethereum/openethereum/pull/627)
|
||||
- Don't call mark_as_bad needlessly [#648](https://github.com/openethereum/openethereum/pull/648)
|
||||
- Fixed sync handling large forks [#647](https://github.com/openethereum/openethereum/pull/647)
|
||||
- Additional documentation for transaction queue [#631](https://github.com/openethereum/openethereum/pull/631)
|
||||
- Transaction Queue Integration [#607](https://github.com/openethereum/openethereum/pull/607)
|
||||
- Keys cli [#639](https://github.com/openethereum/openethereum/pull/639)
|
||||
- fix build warning [#643](https://github.com/openethereum/openethereum/pull/643)
|
||||
- updated jsonrpc-core and http-server libs [#642](https://github.com/openethereum/openethereum/pull/642)
|
||||
- jsonrpc panics gracefully shutdown client [#638](https://github.com/openethereum/openethereum/pull/638)
|
||||
- Fixing CLI parameters [#633](https://github.com/openethereum/openethereum/pull/633)
|
||||
- Normal CLI options with geth. [#628](https://github.com/openethereum/openethereum/pull/628)
|
||||
- Do not remove the peer immediatelly on send error [#626](https://github.com/openethereum/openethereum/pull/626)
|
||||
- Jsonrpc block behind [#622](https://github.com/openethereum/openethereum/pull/622)
|
||||
- Remove println!s. [#624](https://github.com/openethereum/openethereum/pull/624)
|
||||
- JournalDB option 1 fix [#613](https://github.com/openethereum/openethereum/pull/613)
|
||||
- Network tracing cleanup [#611](https://github.com/openethereum/openethereum/pull/611)
|
||||
- Revert "Transaction Queue integration" [#602](https://github.com/openethereum/openethereum/pull/602)
|
||||
- fix benches compilation [#601](https://github.com/openethereum/openethereum/pull/601)
|
||||
- Transaction Queue integration [#595](https://github.com/openethereum/openethereum/pull/595)
|
||||
- verifier trait improvements [#597](https://github.com/openethereum/openethereum/pull/597)
|
||||
- build on rust stable [#600](https://github.com/openethereum/openethereum/pull/600)
|
||||
- Geth import silent if no geth [#599](https://github.com/openethereum/openethereum/pull/599)
|
||||
- Additional journaldb logging and assert [#593](https://github.com/openethereum/openethereum/pull/593)
|
||||
- Uncle inclusion in block authoring. [#578](https://github.com/openethereum/openethereum/pull/578)
|
||||
- Fixed potential deadlock on startup [#592](https://github.com/openethereum/openethereum/pull/592)
|
||||
- Fixing an overflow panic [#591](https://github.com/openethereum/openethereum/pull/591)
|
||||
- Fixed one more case of sync stalling [#590](https://github.com/openethereum/openethereum/pull/590)
|
||||
- JournalDB can now operate in "archive" mode [#589](https://github.com/openethereum/openethereum/pull/589)
|
||||
- Secret store integration with client [#586](https://github.com/openethereum/openethereum/pull/586)
|
||||
- fix build on nightly rust [#588](https://github.com/openethereum/openethereum/pull/588)
|
||||
- deserialization for uint generic [#585](https://github.com/openethereum/openethereum/pull/585)
|
||||
- TransactionsQueue implementation [#559](https://github.com/openethereum/openethereum/pull/559)
|
||||
- JSON-RPC personal service (follows #582) [#583](https://github.com/openethereum/openethereum/pull/583)
|
||||
- making key directory thread-safe [#582](https://github.com/openethereum/openethereum/pull/582)
|
||||
- verifier trait [#581](https://github.com/openethereum/openethereum/pull/581)
|
||||
- shrink_to_fit after removing hashes. [#580](https://github.com/openethereum/openethereum/pull/580)
|
||||
- support for rpc polling [#504](https://github.com/openethereum/openethereum/pull/504)
|
||||
- limit serde codegen only to rpc types submodule [#569](https://github.com/openethereum/openethereum/pull/569)
|
||||
- fork test for Issue test/568 [#573](https://github.com/openethereum/openethereum/pull/573)
|
||||
- Fixing clippy warnings = small refactoring of `request_blocks` [#560](https://github.com/openethereum/openethereum/pull/560)
|
||||
- Improved journaldb logging [#571](https://github.com/openethereum/openethereum/pull/571)
|
||||
- Additional check to ancient enactments. [#570](https://github.com/openethereum/openethereum/pull/570)
|
||||
- chainfilter shouldnt exclude to_block from results [#564](https://github.com/openethereum/openethereum/pull/564)
|
||||
- Fix coverage test run [#567](https://github.com/openethereum/openethereum/pull/567)
|
||||
- Mining [#547](https://github.com/openethereum/openethereum/pull/547)
|
||||
- fix uint warnings [#565](https://github.com/openethereum/openethereum/pull/565)
|
||||
- Finished blockchain generator. [#562](https://github.com/openethereum/openethereum/pull/562)
|
||||
- fixed broken master [#563](https://github.com/openethereum/openethereum/pull/563)
|
||||
- uint to separate crate [#544](https://github.com/openethereum/openethereum/pull/544)
|
||||
- improved test chain generator [#554](https://github.com/openethereum/openethereum/pull/554)
|
||||
- Fixing spelling in propagade->propagate [#558](https://github.com/openethereum/openethereum/pull/558)
|
||||
- Changing RefCell to Cell in transaction. [#557](https://github.com/openethereum/openethereum/pull/557)
|
||||
- Fix for morden consensus. [#556](https://github.com/openethereum/openethereum/pull/556)
|
||||
- blockchain generator [#550](https://github.com/openethereum/openethereum/pull/550)
|
||||
- Sparse Table Implementation (Row, Col) -> Val [#545](https://github.com/openethereum/openethereum/pull/545)
|
||||
- fixup install script [#548](https://github.com/openethereum/openethereum/pull/548)
|
||||
- Fixing clippy warnings [#546](https://github.com/openethereum/openethereum/pull/546)
|
||||
- ignore out directory [#543](https://github.com/openethereum/openethereum/pull/543)
|
||||
- u256 full multiplication [#539](https://github.com/openethereum/openethereum/pull/539)
|
||||
- Fix panic when downloading stales, update homestead transition [#537](https://github.com/openethereum/openethereum/pull/537)
|
||||
- changing x64 asm config [#534](https://github.com/openethereum/openethereum/pull/534)
|
||||
- uncomment state transition tests [#533](https://github.com/openethereum/openethereum/pull/533)
|
||||
- jsonrpc uses weak pointers to client [#532](https://github.com/openethereum/openethereum/pull/532)
|
||||
- Morden switch to Homestead rules at #494,000. [#531](https://github.com/openethereum/openethereum/pull/531)
|
||||
- Blockchain module cleanup [#524](https://github.com/openethereum/openethereum/pull/524)
|
||||
- Multiplication issue + very exhaustive tests for it [#528](https://github.com/openethereum/openethereum/pull/528)
|
||||
- EIP-8 [#498](https://github.com/openethereum/openethereum/pull/498)
|
||||
- Make "random" trie tests fully deterministic. [#527](https://github.com/openethereum/openethereum/pull/527)
|
||||
- udpated serde to version 0.7.0 [#526](https://github.com/openethereum/openethereum/pull/526)
|
||||
- Better memory management [#516](https://github.com/openethereum/openethereum/pull/516)
|
||||
- Typo [#523](https://github.com/openethereum/openethereum/pull/523)
|
||||
- U512 add/sub optimize [#521](https://github.com/openethereum/openethereum/pull/521)
|
||||
- Account management + geth keystore import (no utility crate added) [#509](https://github.com/openethereum/openethereum/pull/509)
|
||||
- Delayed UPnP initialization [#505](https://github.com/openethereum/openethereum/pull/505)
|
||||
- Fixing marking blocks as bad & SyncMessage bugs + small client refactoring. [#503](https://github.com/openethereum/openethereum/pull/503)
|
||||
- optimization of U256 [#515](https://github.com/openethereum/openethereum/pull/515)
|
||||
- Removed rocksdb from build scripts and instructions [#520](https://github.com/openethereum/openethereum/pull/520)
|
||||
- RocksDB abstraction layer + Hash index for state DB [#464](https://github.com/openethereum/openethereum/pull/464)
|
||||
- bloomfilter [#418](https://github.com/openethereum/openethereum/pull/418)
|
||||
- Fixed a race condition when connecting peer disconnects immediately [#519](https://github.com/openethereum/openethereum/pull/519)
|
||||
- ignore intellij idea project files as well [#518](https://github.com/openethereum/openethereum/pull/518)
|
||||
- updated version of unicase [#517](https://github.com/openethereum/openethereum/pull/517)
|
||||
- jsonrpc security, cors headers, fixed #359 [#493](https://github.com/openethereum/openethereum/pull/493)
|
||||
- Rust implementations to replace data tables (#161) [#482](https://github.com/openethereum/openethereum/pull/482)
|
||||
- fix issue with starting requested block number was not included itself [#512](https://github.com/openethereum/openethereum/pull/512)
|
||||
- fixed travis --org GH_TOKEN [#510](https://github.com/openethereum/openethereum/pull/510)
|
||||
- Improved log format [#506](https://github.com/openethereum/openethereum/pull/506)
|
||||
- Log address on failed connection attempt [#502](https://github.com/openethereum/openethereum/pull/502)
|
||||
- Bumping clippy and fixing warnings. [#501](https://github.com/openethereum/openethereum/pull/501)
|
||||
- Bumping versions. Fixes #496 [#500](https://github.com/openethereum/openethereum/pull/500)
|
||||
- Manage final user-input errors. [#494](https://github.com/openethereum/openethereum/pull/494)
|
||||
- Remove unneeded code, fix minor potential issue with length. [#495](https://github.com/openethereum/openethereum/pull/495)
|
||||
- Remove "unknown" from version string. [#488](https://github.com/openethereum/openethereum/pull/488)
|
||||
- Include git commit date & hash. [#486](https://github.com/openethereum/openethereum/pull/486)
|
||||
- Use proper version string. [#485](https://github.com/openethereum/openethereum/pull/485)
|
||||
- Networking fixes [#480](https://github.com/openethereum/openethereum/pull/480)
|
||||
- Fix potential deadlock on node table update [#484](https://github.com/openethereum/openethereum/pull/484)
|
||||
- Squash more warnings [#481](https://github.com/openethereum/openethereum/pull/481)
|
||||
- dev/test/build tools to separate crate [#477](https://github.com/openethereum/openethereum/pull/477)
|
||||
- Back to original slab crate [#479](https://github.com/openethereum/openethereum/pull/479)
|
||||
- Better user errors. [#476](https://github.com/openethereum/openethereum/pull/476)
|
||||
- UDP Discovery [#440](https://github.com/openethereum/openethereum/pull/440)
|
||||
- update readme with rust override [#475](https://github.com/openethereum/openethereum/pull/475)
|
||||
- fixed warnings on rust beta [#474](https://github.com/openethereum/openethereum/pull/474)
|
||||
- Secret store (part2 - encrypted key/value svc) [#449](https://github.com/openethereum/openethereum/pull/449)
|
||||
- Kill bad test. [#473](https://github.com/openethereum/openethereum/pull/473)
|
||||
- Make clippy an optional dependency [#422](https://github.com/openethereum/openethereum/pull/422)
|
||||
- parity compiling fine [#469](https://github.com/openethereum/openethereum/pull/469)
|
||||
- compiling ethcore on beta [#468](https://github.com/openethereum/openethereum/pull/468)
|
||||
- Utils compiling in beta [#467](https://github.com/openethereum/openethereum/pull/467)
|
||||
- Get rid of lru_cache dependency [#466](https://github.com/openethereum/openethereum/pull/466)
|
||||
- Add daemonization. [#459](https://github.com/openethereum/openethereum/pull/459)
|
||||
- Master upgrade [#448](https://github.com/openethereum/openethereum/pull/448)
|
||||
- Remove contributing stuff now that we have CLA bot. [#447](https://github.com/openethereum/openethereum/pull/447)
|
||||
- Add Morden bootnode. [#446](https://github.com/openethereum/openethereum/pull/446)
|
||||
- beta fixes to master [#441](https://github.com/openethereum/openethereum/pull/441)
|
||||
- Secret store (part1 - key management) [#423](https://github.com/openethereum/openethereum/pull/423)
|
||||
- Use 1100000 as the homestead transition, fix build instructions. [#438](https://github.com/openethereum/openethereum/pull/438)
|
||||
- More sync and propagation fixes [#420](https://github.com/openethereum/openethereum/pull/420)
|
||||
- back to cargo crates [#436](https://github.com/openethereum/openethereum/pull/436)
|
||||
- Fixing clippy warnings [#435](https://github.com/openethereum/openethereum/pull/435)
|
||||
- preserving root cargo lock [#434](https://github.com/openethereum/openethereum/pull/434)
|
||||
- Nightly fix [#432](https://github.com/openethereum/openethereum/pull/432)
|
||||
- nightly fixes [#431](https://github.com/openethereum/openethereum/pull/431)
|
||||
- Delay Homestead transition from 1,000,000. [#429](https://github.com/openethereum/openethereum/pull/429)
|
||||
- Nightly fix effort (still should fail) [#428](https://github.com/openethereum/openethereum/pull/428)
|
||||
- clippy version update, docopt-macro moving to fork [#425](https://github.com/openethereum/openethereum/pull/425)
|
||||
- Network/Sync fixes and optimizations [#416](https://github.com/openethereum/openethereum/pull/416)
|
||||
- Use latest era instead of end era as journal marker [#414](https://github.com/openethereum/openethereum/pull/414)
|
||||
- api changes [#402](https://github.com/openethereum/openethereum/pull/402)
|
||||
- Option for no init nodes. [#408](https://github.com/openethereum/openethereum/pull/408)
|
||||
- Fixed block_bodies not returning a list [#406](https://github.com/openethereum/openethereum/pull/406)
|
||||
- Fix test. [#405](https://github.com/openethereum/openethereum/pull/405)
|
||||
- Allow path to be configured. [#404](https://github.com/openethereum/openethereum/pull/404)
|
||||
- Upnp [#400](https://github.com/openethereum/openethereum/pull/400)
|
||||
- eth_syncing, fixed #397 [#398](https://github.com/openethereum/openethereum/pull/398)
|
||||
- Using modified version of ctrlc that catches SIGTERM [#399](https://github.com/openethereum/openethereum/pull/399)
|
||||
- Catching panics. [#396](https://github.com/openethereum/openethereum/pull/396)
|
||||
- jsonrpc [#391](https://github.com/openethereum/openethereum/pull/391)
|
||||
- Externalities tests (still clumsy) [#394](https://github.com/openethereum/openethereum/pull/394)
|
||||
- excluding test code itself from coverage [#395](https://github.com/openethereum/openethereum/pull/395)
|
||||
- Additional tweaks to options. [#390](https://github.com/openethereum/openethereum/pull/390)
|
||||
- --chain option for setting which network to go on. [#388](https://github.com/openethereum/openethereum/pull/388)
|
||||
- Ethash unit tests final [#387](https://github.com/openethereum/openethereum/pull/387)
|
||||
- jsonrpc [#374](https://github.com/openethereum/openethereum/pull/374)
|
||||
- Editorconfig file. [#384](https://github.com/openethereum/openethereum/pull/384)
|
||||
- Coverage effort [in progress] [#382](https://github.com/openethereum/openethereum/pull/382)
|
||||
- making root kcov runner simular to the one running on CI [#380](https://github.com/openethereum/openethereum/pull/380)
|
||||
- add gcc as a dependency to dockerfiles [#381](https://github.com/openethereum/openethereum/pull/381)
|
||||
- Check for handshake expiration before attempting connection replace [#375](https://github.com/openethereum/openethereum/pull/375)
|
||||
- Blocks propagation [#364](https://github.com/openethereum/openethereum/pull/364)
|
||||
- Network params. [#376](https://github.com/openethereum/openethereum/pull/376)
|
||||
- Add parity-node-zero to bootnodes. [#373](https://github.com/openethereum/openethereum/pull/373)
|
||||
- kcov uses travis_job_id instead of coveralls token [#370](https://github.com/openethereum/openethereum/pull/370)
|
||||
- Add parity-node-zero.ethcore.io to boot nodes. [#371](https://github.com/openethereum/openethereum/pull/371)
|
||||
- First part of multi-mining support [#804](https://github.com/paritytech/parity/pull/804)
|
||||
- Fixing future-current transactions clash [#802](https://github.com/paritytech/parity/pull/802)
|
||||
- Increase threads to num_cpus & fix author reporting [#800](https://github.com/paritytech/parity/pull/800)
|
||||
- another batch of rpc improvements [#798](https://github.com/paritytech/parity/pull/798)
|
||||
- Avoid tracing DELEGATECALL and CALLCODE. Plus tests for it. [#794](https://github.com/paritytech/parity/pull/794)
|
||||
- complete getting started steps for OS X [#793](https://github.com/paritytech/parity/pull/793)
|
||||
- Auto detect available port (with fixed test) [#788](https://github.com/paritytech/parity/pull/788)
|
||||
- eth_getTransactionReceipt [#792](https://github.com/paritytech/parity/pull/792)
|
||||
- Comprehensive tests for tracing transactions [#791](https://github.com/paritytech/parity/pull/791)
|
||||
- Disable preparing work package if miners don't ask for it. [#771](https://github.com/paritytech/parity/pull/771)
|
||||
- Listen on all interfaces for JSONRPC by default. [#786](https://github.com/paritytech/parity/pull/786)
|
||||
- eth_call [#783](https://github.com/paritytech/parity/pull/783)
|
||||
- Revert "Auto detect available port" [#789](https://github.com/paritytech/parity/pull/789)
|
||||
- added output to execution result [#777](https://github.com/paritytech/parity/pull/777)
|
||||
- Auto detect available port [#782](https://github.com/paritytech/parity/pull/782)
|
||||
- Allow 0x prefix for --author. [#785](https://github.com/paritytech/parity/pull/785)
|
||||
- updated dependencies, moved rpctest to its own submodule [#784](https://github.com/paritytech/parity/pull/784)
|
||||
- use ethjson module to load chain json tests [#778](https://github.com/paritytech/parity/pull/778)
|
||||
- Tracing implemented. [#772](https://github.com/paritytech/parity/pull/772)
|
||||
- test ethjson module on travis [#780](https://github.com/paritytech/parity/pull/780)
|
||||
- batch of rpc fixes [#775](https://github.com/paritytech/parity/pull/775)
|
||||
- rpctest executable [#757](https://github.com/paritytech/parity/pull/757)
|
||||
- Refactoring error transaction_queue error handling and `update_sealing` method. [#753](https://github.com/paritytech/parity/pull/753)
|
||||
- Avoid importing transactions with gas above 1.1*block_gas_limit to transaction queue [#760](https://github.com/paritytech/parity/pull/760)
|
||||
- Removing transactions that failed to be pushed to block. [#752](https://github.com/paritytech/parity/pull/752)
|
||||
- Updating clippy [#766](https://github.com/paritytech/parity/pull/766)
|
||||
- Attempting to add all transactions to mined block [#754](https://github.com/paritytech/parity/pull/754)
|
||||
- Prettier version w/o git dir; Use rustc compile time version [#761](https://github.com/paritytech/parity/pull/761)
|
||||
- Stop adding transactions to queue while not fully synced [#751](https://github.com/paritytech/parity/pull/751)
|
||||
- Verify sender's balance before importing transaction to queue [#746](https://github.com/paritytech/parity/pull/746)
|
||||
- Returning number of transactions pending in block not queue [#750](https://github.com/paritytech/parity/pull/750)
|
||||
- Speeding up build [#733](https://github.com/paritytech/parity/pull/733)
|
||||
- adding check for a sync when giving work to miner [#742](https://github.com/paritytech/parity/pull/742)
|
||||
- json deserialization module [#745](https://github.com/paritytech/parity/pull/745)
|
||||
- Update install-parity.sh [#749](https://github.com/paritytech/parity/pull/749)
|
||||
- Restart sync on getting old unknown header [#747](https://github.com/paritytech/parity/pull/747)
|
||||
- Missing return for #737 [#744](https://github.com/paritytech/parity/pull/744)
|
||||
- Enact block with uncles test [#741](https://github.com/paritytech/parity/pull/741)
|
||||
- Fix outdated libc version on dependency [#740](https://github.com/paritytech/parity/pull/740)
|
||||
- Fixing possible race in transaction queue [#735](https://github.com/paritytech/parity/pull/735)
|
||||
- Sync fixed again [#737](https://github.com/paritytech/parity/pull/737)
|
||||
- Don't change best block until extras is committed. [#734](https://github.com/paritytech/parity/pull/734)
|
||||
- stable only until travis speedup [#736](https://github.com/paritytech/parity/pull/736)
|
||||
- Optimizing uint operations (architecture independent) [#629](https://github.com/paritytech/parity/pull/629)
|
||||
- Add RLP, not a data item. [#725](https://github.com/paritytech/parity/pull/725)
|
||||
- PV63 receipts response [#687](https://github.com/paritytech/parity/pull/687)
|
||||
- another batch of rpc tests [#723](https://github.com/paritytech/parity/pull/723)
|
||||
- dockerfiles update [#726](https://github.com/paritytech/parity/pull/726)
|
||||
- Lock reports to avoid out of order badness. [#721](https://github.com/paritytech/parity/pull/721)
|
||||
- Fixed handshake leak [#722](https://github.com/paritytech/parity/pull/722)
|
||||
- Allow configuration of target gas limit. [#719](https://github.com/paritytech/parity/pull/719)
|
||||
- Version 1.1 in master [#714](https://github.com/paritytech/parity/pull/714)
|
||||
- Silence UDP warnings [#720](https://github.com/paritytech/parity/pull/720)
|
||||
- Rpc personal tests [#715](https://github.com/paritytech/parity/pull/715)
|
||||
- Fixing warnings [#704](https://github.com/paritytech/parity/pull/704)
|
||||
- docopts cleanups [#713](https://github.com/paritytech/parity/pull/713)
|
||||
- Removed rocksdb build dependency [#717](https://github.com/paritytech/parity/pull/717)
|
||||
- Fixed splitting Neighbours packet [#710](https://github.com/paritytech/parity/pull/710)
|
||||
- management of account expiration & memory [#701](https://github.com/paritytech/parity/pull/701)
|
||||
- Remove EarlyMerge from user docs. [#708](https://github.com/paritytech/parity/pull/708)
|
||||
- Fixes and traces for refcountdb. [#705](https://github.com/paritytech/parity/pull/705)
|
||||
- Check for NULL_RLP in AccountDB [#706](https://github.com/paritytech/parity/pull/706)
|
||||
- ethminer as crate [#700](https://github.com/paritytech/parity/pull/700)
|
||||
- Old ref-counted DB code [#692](https://github.com/paritytech/parity/pull/692)
|
||||
- next batch of rpc tests and fixes [#699](https://github.com/paritytech/parity/pull/699)
|
||||
- implemented eth_geStorageAt rpc method, added more tests for rpc [#695](https://github.com/paritytech/parity/pull/695)
|
||||
- Fix JournalDB era marker [#690](https://github.com/paritytech/parity/pull/690)
|
||||
- More sync fixes [#685](https://github.com/paritytech/parity/pull/685)
|
||||
- mark some key tests as heavy [#694](https://github.com/paritytech/parity/pull/694)
|
||||
- Limit incoming connections [#693](https://github.com/paritytech/parity/pull/693)
|
||||
- Updating clippy [#688](https://github.com/paritytech/parity/pull/688)
|
||||
- eth_accounts, eth_getBalance rpc functions && tests [#691](https://github.com/paritytech/parity/pull/691)
|
||||
- state query for archive jdb [#683](https://github.com/paritytech/parity/pull/683)
|
||||
- Fix for option 1 of JournalDB [#658](https://github.com/paritytech/parity/pull/658)
|
||||
- Rename into something that is a little more descriptive. [#689](https://github.com/paritytech/parity/pull/689)
|
||||
- JournalDB with in-memory overlay (option2) [#634](https://github.com/paritytech/parity/pull/634)
|
||||
- additional (failing) SecretStore test [#682](https://github.com/paritytech/parity/pull/682)
|
||||
- Updating clippy & fixing warnings. [#670](https://github.com/paritytech/parity/pull/670)
|
||||
- rpc web3 tests [#681](https://github.com/paritytech/parity/pull/681)
|
||||
- Making personal json-rpc configurable via cli [#677](https://github.com/paritytech/parity/pull/677)
|
||||
- RPC Pending Transactions Filter [#661](https://github.com/paritytech/parity/pull/661)
|
||||
- Rearrange journaldb infrastructure to make more extensible [#678](https://github.com/paritytech/parity/pull/678)
|
||||
- JournalDB -> Box<JournalDB>, and it's a trait. [#673](https://github.com/paritytech/parity/pull/673)
|
||||
- fix warning for transaction_queue.add usage [#676](https://github.com/paritytech/parity/pull/676)
|
||||
- Adding std::mem back (only for asm) [#680](https://github.com/paritytech/parity/pull/680)
|
||||
- update readme to exclude beta step (stable is ok) [#679](https://github.com/paritytech/parity/pull/679)
|
||||
- fixed U256 and transaction request deserialization [#675](https://github.com/paritytech/parity/pull/675)
|
||||
- More geth compatibility. [#666](https://github.com/paritytech/parity/pull/666)
|
||||
- Removing running clippy by default on nightly. [#671](https://github.com/paritytech/parity/pull/671)
|
||||
- rpc net submodule tests [#667](https://github.com/paritytech/parity/pull/667)
|
||||
- Client module overhaul [#665](https://github.com/paritytech/parity/pull/665)
|
||||
- Rpc transaction signing [#587](https://github.com/paritytech/parity/pull/587)
|
||||
- Transaction queue exposed via JSON rpc. [#652](https://github.com/paritytech/parity/pull/652)
|
||||
- Remove unneeded locking [#499](https://github.com/paritytech/parity/pull/499)
|
||||
- extend sync status interface to sync provider [#664](https://github.com/paritytech/parity/pull/664)
|
||||
- --archive is default. --pruning is option. [#663](https://github.com/paritytech/parity/pull/663)
|
||||
- jsonrpc uses client and sync interfaces [#641](https://github.com/paritytech/parity/pull/641)
|
||||
- Expose transaction insertion in sync lib [#609](https://github.com/paritytech/parity/pull/609)
|
||||
- Removing get prefix from poll_info [#660](https://github.com/paritytech/parity/pull/660)
|
||||
- Tx queue update height bug [#657](https://github.com/paritytech/parity/pull/657)
|
||||
- Tx_queue_docs -> To master [#651](https://github.com/paritytech/parity/pull/651)
|
||||
- blockchain import_route [#645](https://github.com/paritytech/parity/pull/645)
|
||||
- Stop workers before stopping event loop [#655](https://github.com/paritytech/parity/pull/655)
|
||||
- Validate sender before importing to queue [#650](https://github.com/paritytech/parity/pull/650)
|
||||
- Gas price threshold for transactions [#640](https://github.com/paritytech/parity/pull/640)
|
||||
- `dev` feature enabled when compiling without `--release` [#627](https://github.com/paritytech/parity/pull/627)
|
||||
- Don't call mark_as_bad needlessly [#648](https://github.com/paritytech/parity/pull/648)
|
||||
- Fixed sync handling large forks [#647](https://github.com/paritytech/parity/pull/647)
|
||||
- Additional documentation for transaction queue [#631](https://github.com/paritytech/parity/pull/631)
|
||||
- Transaction Queue Integration [#607](https://github.com/paritytech/parity/pull/607)
|
||||
- Keys cli [#639](https://github.com/paritytech/parity/pull/639)
|
||||
- fix build warning [#643](https://github.com/paritytech/parity/pull/643)
|
||||
- updated jsonrpc-core and http-server libs [#642](https://github.com/paritytech/parity/pull/642)
|
||||
- jsonrpc panics gracefully shutdown client [#638](https://github.com/paritytech/parity/pull/638)
|
||||
- Fixing CLI parameters [#633](https://github.com/paritytech/parity/pull/633)
|
||||
- Normal CLI options with geth. [#628](https://github.com/paritytech/parity/pull/628)
|
||||
- Do not remove the peer immediatelly on send error [#626](https://github.com/paritytech/parity/pull/626)
|
||||
- Jsonrpc block behind [#622](https://github.com/paritytech/parity/pull/622)
|
||||
- Remove println!s. [#624](https://github.com/paritytech/parity/pull/624)
|
||||
- JournalDB option 1 fix [#613](https://github.com/paritytech/parity/pull/613)
|
||||
- Network tracing cleanup [#611](https://github.com/paritytech/parity/pull/611)
|
||||
- Revert "Transaction Queue integration" [#602](https://github.com/paritytech/parity/pull/602)
|
||||
- fix benches compilation [#601](https://github.com/paritytech/parity/pull/601)
|
||||
- Transaction Queue integration [#595](https://github.com/paritytech/parity/pull/595)
|
||||
- verifier trait improvements [#597](https://github.com/paritytech/parity/pull/597)
|
||||
- build on rust stable [#600](https://github.com/paritytech/parity/pull/600)
|
||||
- Geth import silent if no geth [#599](https://github.com/paritytech/parity/pull/599)
|
||||
- Additional journaldb logging and assert [#593](https://github.com/paritytech/parity/pull/593)
|
||||
- Uncle inclusion in block authoring. [#578](https://github.com/paritytech/parity/pull/578)
|
||||
- Fixed potential deadlock on startup [#592](https://github.com/paritytech/parity/pull/592)
|
||||
- Fixing an overflow panic [#591](https://github.com/paritytech/parity/pull/591)
|
||||
- Fixed one more case of sync stalling [#590](https://github.com/paritytech/parity/pull/590)
|
||||
- JournalDB can now operate in "archive" mode [#589](https://github.com/paritytech/parity/pull/589)
|
||||
- Secret store integration with client [#586](https://github.com/paritytech/parity/pull/586)
|
||||
- fix build on nightly rust [#588](https://github.com/paritytech/parity/pull/588)
|
||||
- deserialization for uint generic [#585](https://github.com/paritytech/parity/pull/585)
|
||||
- TransactionsQueue implementation [#559](https://github.com/paritytech/parity/pull/559)
|
||||
- JSON-RPC personal service (follows #582) [#583](https://github.com/paritytech/parity/pull/583)
|
||||
- making key directory thread-safe [#582](https://github.com/paritytech/parity/pull/582)
|
||||
- verifier trait [#581](https://github.com/paritytech/parity/pull/581)
|
||||
- shrink_to_fit after removing hashes. [#580](https://github.com/paritytech/parity/pull/580)
|
||||
- support for rpc polling [#504](https://github.com/paritytech/parity/pull/504)
|
||||
- limit serde codegen only to rpc types submodule [#569](https://github.com/paritytech/parity/pull/569)
|
||||
- fork test for Issue test/568 [#573](https://github.com/paritytech/parity/pull/573)
|
||||
- Fixing clippy warnings = small refactoring of `request_blocks` [#560](https://github.com/paritytech/parity/pull/560)
|
||||
- Improved journaldb logging [#571](https://github.com/paritytech/parity/pull/571)
|
||||
- Additional check to ancient enactments. [#570](https://github.com/paritytech/parity/pull/570)
|
||||
- chainfilter shouldnt exclude to_block from results [#564](https://github.com/paritytech/parity/pull/564)
|
||||
- Fix coverage test run [#567](https://github.com/paritytech/parity/pull/567)
|
||||
- Mining [#547](https://github.com/paritytech/parity/pull/547)
|
||||
- fix uint warnings [#565](https://github.com/paritytech/parity/pull/565)
|
||||
- Finished blockchain generator. [#562](https://github.com/paritytech/parity/pull/562)
|
||||
- fixed broken master [#563](https://github.com/paritytech/parity/pull/563)
|
||||
- uint to separate crate [#544](https://github.com/paritytech/parity/pull/544)
|
||||
- improved test chain generator [#554](https://github.com/paritytech/parity/pull/554)
|
||||
- Fixing spelling in propagade->propagate [#558](https://github.com/paritytech/parity/pull/558)
|
||||
- Changing RefCell to Cell in transaction. [#557](https://github.com/paritytech/parity/pull/557)
|
||||
- Fix for morden consensus. [#556](https://github.com/paritytech/parity/pull/556)
|
||||
- blockchain generator [#550](https://github.com/paritytech/parity/pull/550)
|
||||
- Sparse Table Implementation (Row, Col) -> Val [#545](https://github.com/paritytech/parity/pull/545)
|
||||
- fixup install script [#548](https://github.com/paritytech/parity/pull/548)
|
||||
- Fixing clippy warnings [#546](https://github.com/paritytech/parity/pull/546)
|
||||
- ignore out directory [#543](https://github.com/paritytech/parity/pull/543)
|
||||
- u256 full multiplication [#539](https://github.com/paritytech/parity/pull/539)
|
||||
- Fix panic when downloading stales, update homestead transition [#537](https://github.com/paritytech/parity/pull/537)
|
||||
- changing x64 asm config [#534](https://github.com/paritytech/parity/pull/534)
|
||||
- uncomment state transition tests [#533](https://github.com/paritytech/parity/pull/533)
|
||||
- jsonrpc uses weak pointers to client [#532](https://github.com/paritytech/parity/pull/532)
|
||||
- Morden switch to Homestead rules at #494,000. [#531](https://github.com/paritytech/parity/pull/531)
|
||||
- Blockchain module cleanup [#524](https://github.com/paritytech/parity/pull/524)
|
||||
- Multiplication issue + very exhaustive tests for it [#528](https://github.com/paritytech/parity/pull/528)
|
||||
- EIP-8 [#498](https://github.com/paritytech/parity/pull/498)
|
||||
- Make "random" trie tests fully deterministic. [#527](https://github.com/paritytech/parity/pull/527)
|
||||
- udpated serde to version 0.7.0 [#526](https://github.com/paritytech/parity/pull/526)
|
||||
- Better memory management [#516](https://github.com/paritytech/parity/pull/516)
|
||||
- Typo [#523](https://github.com/paritytech/parity/pull/523)
|
||||
- U512 add/sub optimize [#521](https://github.com/paritytech/parity/pull/521)
|
||||
- Account management + geth keystore import (no utility crate added) [#509](https://github.com/paritytech/parity/pull/509)
|
||||
- Delayed UPnP initialization [#505](https://github.com/paritytech/parity/pull/505)
|
||||
- Fixing marking blocks as bad & SyncMessage bugs + small client refactoring. [#503](https://github.com/paritytech/parity/pull/503)
|
||||
- optimization of U256 [#515](https://github.com/paritytech/parity/pull/515)
|
||||
- Removed rocksdb from build scripts and instructions [#520](https://github.com/paritytech/parity/pull/520)
|
||||
- RocksDB abstraction layer + Hash index for state DB [#464](https://github.com/paritytech/parity/pull/464)
|
||||
- bloomfilter [#418](https://github.com/paritytech/parity/pull/418)
|
||||
- Fixed a race condition when connecting peer disconnects immediately [#519](https://github.com/paritytech/parity/pull/519)
|
||||
- ignore intellij idea project files as well [#518](https://github.com/paritytech/parity/pull/518)
|
||||
- updated version of unicase [#517](https://github.com/paritytech/parity/pull/517)
|
||||
- jsonrpc security, cors headers, fixed #359 [#493](https://github.com/paritytech/parity/pull/493)
|
||||
- Rust implementations to replace data tables (#161) [#482](https://github.com/paritytech/parity/pull/482)
|
||||
- fix issue with starting requested block number was not included itself [#512](https://github.com/paritytech/parity/pull/512)
|
||||
- fixed travis --org GH_TOKEN [#510](https://github.com/paritytech/parity/pull/510)
|
||||
- Improved log format [#506](https://github.com/paritytech/parity/pull/506)
|
||||
- Log address on failed connection attempt [#502](https://github.com/paritytech/parity/pull/502)
|
||||
- Bumping clippy and fixing warnings. [#501](https://github.com/paritytech/parity/pull/501)
|
||||
- Bumping versions. Fixes #496 [#500](https://github.com/paritytech/parity/pull/500)
|
||||
- Manage final user-input errors. [#494](https://github.com/paritytech/parity/pull/494)
|
||||
- Remove unneeded code, fix minor potential issue with length. [#495](https://github.com/paritytech/parity/pull/495)
|
||||
- Remove "unknown" from version string. [#488](https://github.com/paritytech/parity/pull/488)
|
||||
- Include git commit date & hash. [#486](https://github.com/paritytech/parity/pull/486)
|
||||
- Use proper version string. [#485](https://github.com/paritytech/parity/pull/485)
|
||||
- Networking fixes [#480](https://github.com/paritytech/parity/pull/480)
|
||||
- Fix potential deadlock on node table update [#484](https://github.com/paritytech/parity/pull/484)
|
||||
- Squash more warnings [#481](https://github.com/paritytech/parity/pull/481)
|
||||
- dev/test/build tools to separate crate [#477](https://github.com/paritytech/parity/pull/477)
|
||||
- Back to original slab crate [#479](https://github.com/paritytech/parity/pull/479)
|
||||
- Better user errors. [#476](https://github.com/paritytech/parity/pull/476)
|
||||
- UDP Discovery [#440](https://github.com/paritytech/parity/pull/440)
|
||||
- update readme with rust override [#475](https://github.com/paritytech/parity/pull/475)
|
||||
- fixed warnings on rust beta [#474](https://github.com/paritytech/parity/pull/474)
|
||||
- Secret store (part2 - encrypted key/value svc) [#449](https://github.com/paritytech/parity/pull/449)
|
||||
- Kill bad test. [#473](https://github.com/paritytech/parity/pull/473)
|
||||
- Make clippy an optional dependency [#422](https://github.com/paritytech/parity/pull/422)
|
||||
- parity compiling fine [#469](https://github.com/paritytech/parity/pull/469)
|
||||
- compiling ethcore on beta [#468](https://github.com/paritytech/parity/pull/468)
|
||||
- Utils compiling in beta [#467](https://github.com/paritytech/parity/pull/467)
|
||||
- Get rid of lru_cache dependency [#466](https://github.com/paritytech/parity/pull/466)
|
||||
- Add daemonization. [#459](https://github.com/paritytech/parity/pull/459)
|
||||
- Master upgrade [#448](https://github.com/paritytech/parity/pull/448)
|
||||
- Remove contributing stuff now that we have CLA bot. [#447](https://github.com/paritytech/parity/pull/447)
|
||||
- Add Morden bootnode. [#446](https://github.com/paritytech/parity/pull/446)
|
||||
- beta fixes to master [#441](https://github.com/paritytech/parity/pull/441)
|
||||
- Secret store (part1 - key management) [#423](https://github.com/paritytech/parity/pull/423)
|
||||
- Use 1100000 as the homestead transition, fix build instructions. [#438](https://github.com/paritytech/parity/pull/438)
|
||||
- More sync and propagation fixes [#420](https://github.com/paritytech/parity/pull/420)
|
||||
- back to cargo crates [#436](https://github.com/paritytech/parity/pull/436)
|
||||
- Fixing clippy warnings [#435](https://github.com/paritytech/parity/pull/435)
|
||||
- preserving root cargo lock [#434](https://github.com/paritytech/parity/pull/434)
|
||||
- Nightly fix [#432](https://github.com/paritytech/parity/pull/432)
|
||||
- nightly fixes [#431](https://github.com/paritytech/parity/pull/431)
|
||||
- Delay Homestead transition from 1,000,000. [#429](https://github.com/paritytech/parity/pull/429)
|
||||
- Nightly fix effort (still should fail) [#428](https://github.com/paritytech/parity/pull/428)
|
||||
- clippy version update, docopt-macro moving to fork [#425](https://github.com/paritytech/parity/pull/425)
|
||||
- Network/Sync fixes and optimizations [#416](https://github.com/paritytech/parity/pull/416)
|
||||
- Use latest era instead of end era as journal marker [#414](https://github.com/paritytech/parity/pull/414)
|
||||
- api changes [#402](https://github.com/paritytech/parity/pull/402)
|
||||
- Option for no init nodes. [#408](https://github.com/paritytech/parity/pull/408)
|
||||
- Fixed block_bodies not returning a list [#406](https://github.com/paritytech/parity/pull/406)
|
||||
- Fix test. [#405](https://github.com/paritytech/parity/pull/405)
|
||||
- Allow path to be configured. [#404](https://github.com/paritytech/parity/pull/404)
|
||||
- Upnp [#400](https://github.com/paritytech/parity/pull/400)
|
||||
- eth_syncing, fixed #397 [#398](https://github.com/paritytech/parity/pull/398)
|
||||
- Using modified version of ctrlc that catches SIGTERM [#399](https://github.com/paritytech/parity/pull/399)
|
||||
- Catching panics. [#396](https://github.com/paritytech/parity/pull/396)
|
||||
- jsonrpc [#391](https://github.com/paritytech/parity/pull/391)
|
||||
- Externalities tests (still clumsy) [#394](https://github.com/paritytech/parity/pull/394)
|
||||
- excluding test code itself from coverage [#395](https://github.com/paritytech/parity/pull/395)
|
||||
- Additional tweaks to options. [#390](https://github.com/paritytech/parity/pull/390)
|
||||
- --chain option for setting which network to go on. [#388](https://github.com/paritytech/parity/pull/388)
|
||||
- Ethash unit tests final [#387](https://github.com/paritytech/parity/pull/387)
|
||||
- jsonrpc [#374](https://github.com/paritytech/parity/pull/374)
|
||||
- Editorconfig file. [#384](https://github.com/paritytech/parity/pull/384)
|
||||
- Coverage effort [in progress] [#382](https://github.com/paritytech/parity/pull/382)
|
||||
- making root kcov runner simular to the one running on CI [#380](https://github.com/paritytech/parity/pull/380)
|
||||
- add gcc as a dependency to dockerfiles [#381](https://github.com/paritytech/parity/pull/381)
|
||||
- Check for handshake expiration before attempting connection replace [#375](https://github.com/paritytech/parity/pull/375)
|
||||
- Blocks propagation [#364](https://github.com/paritytech/parity/pull/364)
|
||||
- Network params. [#376](https://github.com/paritytech/parity/pull/376)
|
||||
- Add parity-node-zero to bootnodes. [#373](https://github.com/paritytech/parity/pull/373)
|
||||
- kcov uses travis_job_id instead of coveralls token [#370](https://github.com/paritytech/parity/pull/370)
|
||||
- Add parity-node-zero.ethcore.io to boot nodes. [#371](https://github.com/paritytech/parity/pull/371)
|
||||
|
||||
## Parity [v1.0.0-rc1](https://github.com/openethereum/openethereum/releases/tag/v1.0.0-rc1) (2016-03-15)
|
||||
## Parity [v1.0.0-rc1](https://github.com/paritytech/parity/releases/tag/v1.0.0-rc1) (2016-03-15)
|
||||
|
||||
First Parity 1.0.0 release candidate.
|
||||
|
||||
- Version 1.0 in beta [#712](https://github.com/openethereum/openethereum/pull/712)
|
||||
- Fix test for beta [#617](https://github.com/openethereum/openethereum/pull/617)
|
||||
- JournalDB fix option 1 for beta [#614](https://github.com/openethereum/openethereum/pull/614)
|
||||
- Failing test. [#606](https://github.com/openethereum/openethereum/pull/606)
|
||||
- Fix transition points [#604](https://github.com/openethereum/openethereum/pull/604)
|
||||
- (BETA) Update README.md [#549](https://github.com/openethereum/openethereum/pull/549)
|
||||
- (BETA) instructions for beta release channel [#456](https://github.com/openethereum/openethereum/pull/456)
|
||||
- (BETA) fix nightly - remerge [#454](https://github.com/openethereum/openethereum/pull/454)
|
||||
- (BETA) fixing nightly version for beta [#452](https://github.com/openethereum/openethereum/pull/452)
|
||||
- Version 1.0 in beta [#712](https://github.com/paritytech/parity/pull/712)
|
||||
- Fix test for beta [#617](https://github.com/paritytech/parity/pull/617)
|
||||
- JournalDB fix option 1 for beta [#614](https://github.com/paritytech/parity/pull/614)
|
||||
- Failing test. [#606](https://github.com/paritytech/parity/pull/606)
|
||||
- Fix transition points [#604](https://github.com/paritytech/parity/pull/604)
|
||||
- (BETA) Update README.md [#549](https://github.com/paritytech/parity/pull/549)
|
||||
- (BETA) instructions for beta release channel [#456](https://github.com/paritytech/parity/pull/456)
|
||||
- (BETA) fix nightly - remerge [#454](https://github.com/paritytech/parity/pull/454)
|
||||
- (BETA) fixing nightly version for beta [#452](https://github.com/paritytech/parity/pull/452)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Note: Parity 1.1 reached End-of-Life on 2016-08-12 (EOL).
|
||||
|
||||
## Parity [v1.1.0](https://github.com/openethereum/openethereum/releases/tag/v1.1.0) (2016-05-02)
|
||||
## Parity [v1.1.0](https://github.com/paritytech/parity/releases/tag/v1.1.0) (2016-05-02)
|
||||
|
||||
Parity 1.1.0 introduces:
|
||||
|
||||
@@ -12,143 +12,143 @@ Parity 1.1.0 introduces:
|
||||
|
||||
Full Changes:
|
||||
|
||||
- Exposing default extra data via ethcore RPC [#1032](https://github.com/openethereum/openethereum/pull/1032)
|
||||
- Net etiquette [#1028](https://github.com/openethereum/openethereum/pull/1028)
|
||||
- Bumping clippy & fixing warnings [#1024](https://github.com/openethereum/openethereum/pull/1024)
|
||||
- Tracedb interface && cli [#997](https://github.com/openethereum/openethereum/pull/997)
|
||||
- Switching to geth-attach supporting version of rpc core and server [#1022](https://github.com/openethereum/openethereum/pull/1022)
|
||||
- Fixing status page displaying homestead [#1020](https://github.com/openethereum/openethereum/pull/1020)
|
||||
- Core tracedb functionality. [#996](https://github.com/openethereum/openethereum/pull/996)
|
||||
- RPC method for supported modules [#1019](https://github.com/openethereum/openethereum/pull/1019)
|
||||
- Updating status page [#1015](https://github.com/openethereum/openethereum/pull/1015)
|
||||
- Disabling wallet [#1017](https://github.com/openethereum/openethereum/pull/1017)
|
||||
- More detailed fatal error reporting [#1016](https://github.com/openethereum/openethereum/pull/1016)
|
||||
- Support 'pending' block in RPC [#1007](https://github.com/openethereum/openethereum/pull/1007)
|
||||
- Enable pending block when there is local transaction pending. [#1005](https://github.com/openethereum/openethereum/pull/1005)
|
||||
- updating key files permissions on save [#1010](https://github.com/openethereum/openethereum/pull/1010)
|
||||
- IPC JSON RPC (for external interface) [#1009](https://github.com/openethereum/openethereum/pull/1009)
|
||||
- Fixing Firefox authorization issues [#1013](https://github.com/openethereum/openethereum/pull/1013)
|
||||
- cargo update [#1012](https://github.com/openethereum/openethereum/pull/1012)
|
||||
- Switching to rust-url@1.0.0 [#1011](https://github.com/openethereum/openethereum/pull/1011)
|
||||
- Exception handling in RPC & WebApps [#988](https://github.com/openethereum/openethereum/pull/988)
|
||||
- Fixed uint deserialization from hex [#1008](https://github.com/openethereum/openethereum/pull/1008)
|
||||
- Tweak timeout and packet size to handle slow networks better [#1004](https://github.com/openethereum/openethereum/pull/1004)
|
||||
- db key is generic and can be made smaller [#1006](https://github.com/openethereum/openethereum/pull/1006)
|
||||
- IPC with new serialization [#998](https://github.com/openethereum/openethereum/pull/998)
|
||||
- make jsonrpc api engine agnostic [#1001](https://github.com/openethereum/openethereum/pull/1001)
|
||||
- updated cargo.lock [#1002](https://github.com/openethereum/openethereum/pull/1002)
|
||||
- updated parity dependencies [#993](https://github.com/openethereum/openethereum/pull/993)
|
||||
- Auto (with codegen) binary serializer [#980](https://github.com/openethereum/openethereum/pull/980)
|
||||
- Fixing transaction queue last_nonces update [#995](https://github.com/openethereum/openethereum/pull/995)
|
||||
- import route contains ommited blocks [#994](https://github.com/openethereum/openethereum/pull/994)
|
||||
- fixed encoding 0u8 [#992](https://github.com/openethereum/openethereum/pull/992)
|
||||
- Use latest netstats [#989](https://github.com/openethereum/openethereum/pull/989)
|
||||
- RPC shared external miner [#984](https://github.com/openethereum/openethereum/pull/984)
|
||||
- Additional RPC methods for settings [#983](https://github.com/openethereum/openethereum/pull/983)
|
||||
- Fixing transaction_queue deadlock [#985](https://github.com/openethereum/openethereum/pull/985)
|
||||
- Refactoring of `parity/main.rs` [#981](https://github.com/openethereum/openethereum/pull/981)
|
||||
- Fixing clippy warnings. [#982](https://github.com/openethereum/openethereum/pull/982)
|
||||
- Bumping status page [#977](https://github.com/openethereum/openethereum/pull/977)
|
||||
- querying extras separated to its own module [#972](https://github.com/openethereum/openethereum/pull/972)
|
||||
- Exposing application logs via RPC. [#976](https://github.com/openethereum/openethereum/pull/976)
|
||||
- Addressing binary serialization for db types [#966](https://github.com/openethereum/openethereum/pull/966)
|
||||
- removed redundant unwraps [#935](https://github.com/openethereum/openethereum/pull/935)
|
||||
- fixed transaction queue merge conflict [#975](https://github.com/openethereum/openethereum/pull/975)
|
||||
- Configurable limit for transaction queue (CLI & Ethcore-RPC) [#974](https://github.com/openethereum/openethereum/pull/974)
|
||||
- Enforce limit caused `last_nonce` to return incorrect values. [#973](https://github.com/openethereum/openethereum/pull/973)
|
||||
- Even more detailed errors for transaction queue [#969](https://github.com/openethereum/openethereum/pull/969)
|
||||
- temporary fix of panic in blockchain garbage collection [#970](https://github.com/openethereum/openethereum/pull/970)
|
||||
- IPC codegen - some minor fixes & enhancements [#967](https://github.com/openethereum/openethereum/pull/967)
|
||||
- Additional logging for transactions [#968](https://github.com/openethereum/openethereum/pull/968)
|
||||
- refactored blockchain extras keys building [#963](https://github.com/openethereum/openethereum/pull/963)
|
||||
- Using hyper-mio branch in webapps. [#957](https://github.com/openethereum/openethereum/pull/957)
|
||||
- Remove nanomsg from build-dependencies [#965](https://github.com/openethereum/openethereum/pull/965)
|
||||
- Fix build for --target=armv7-unknown-linux-gnueabihf [#964](https://github.com/openethereum/openethereum/pull/964)
|
||||
- IPC RPC codegen extra feature [#962](https://github.com/openethereum/openethereum/pull/962)
|
||||
- IPC RPC codegen for generic implementation [#961](https://github.com/openethereum/openethereum/pull/961)
|
||||
- using db_path directory when upgrading [#960](https://github.com/openethereum/openethereum/pull/960)
|
||||
- IPC hypervisor [#958](https://github.com/openethereum/openethereum/pull/958)
|
||||
- Removing a transaction from queue now removes all from this sender with lower nonces. [#950](https://github.com/openethereum/openethereum/pull/950)
|
||||
- bump status page version 0.1.7 [#955](https://github.com/openethereum/openethereum/pull/955)
|
||||
- Changing cors header to be optional [#956](https://github.com/openethereum/openethereum/pull/956)
|
||||
- Update ARM Dockerfile [#959](https://github.com/openethereum/openethereum/pull/959)
|
||||
- Sensible gas limits for eth_sendTransaction [#953](https://github.com/openethereum/openethereum/pull/953)
|
||||
- Fix upgrade script and make parity run when no .parity dir. [#954](https://github.com/openethereum/openethereum/pull/954)
|
||||
- Tracing and docs for --pruning=auto. [#952](https://github.com/openethereum/openethereum/pull/952)
|
||||
- IPC serialization for custom parameters [#946](https://github.com/openethereum/openethereum/pull/946)
|
||||
- default filter from block should be Latest, not Earliest [#948](https://github.com/openethereum/openethereum/pull/948)
|
||||
- README.md: removes sudo from multirust installation [#943](https://github.com/openethereum/openethereum/pull/943)
|
||||
- Disable long lines formatting + ethash example. [#939](https://github.com/openethereum/openethereum/pull/939)
|
||||
- Ethcore-specific RPC methods for altering miner parameters. [#934](https://github.com/openethereum/openethereum/pull/934)
|
||||
- Use ethcore nanomsg bindings [#941](https://github.com/openethereum/openethereum/pull/941)
|
||||
- Update IPC codegen to latest syntax libs [#938](https://github.com/openethereum/openethereum/pull/938)
|
||||
- IPC documentation [#937](https://github.com/openethereum/openethereum/pull/937)
|
||||
- Bumping clippy and fixing warnings. [#936](https://github.com/openethereum/openethereum/pull/936)
|
||||
- Pruning auto [#927](https://github.com/openethereum/openethereum/pull/927)
|
||||
- IPC persistent client link [#933](https://github.com/openethereum/openethereum/pull/933)
|
||||
- IPC persistent client link [#930](https://github.com/openethereum/openethereum/pull/930)
|
||||
- IPC handshake (negotiating protocol/api version) [#928](https://github.com/openethereum/openethereum/pull/928)
|
||||
- Upgrade logic between versions [#914](https://github.com/openethereum/openethereum/pull/914)
|
||||
- executive tracing cleanup [#903](https://github.com/openethereum/openethereum/pull/903)
|
||||
- Ethcore-specific RPC methods [#923](https://github.com/openethereum/openethereum/pull/923)
|
||||
- Parameter to allow user to force the sealing mechanism [#918](https://github.com/openethereum/openethereum/pull/918)
|
||||
- updated dependencies [#921](https://github.com/openethereum/openethereum/pull/921)
|
||||
- Fixed send transaction deadlock [#920](https://github.com/openethereum/openethereum/pull/920)
|
||||
- --unlock is comma-delimited. [#916](https://github.com/openethereum/openethereum/pull/916)
|
||||
- fixed eth_getLogs [#915](https://github.com/openethereum/openethereum/pull/915)
|
||||
- create provided custom dir for keys if none [#912](https://github.com/openethereum/openethereum/pull/912)
|
||||
- spec loading cleanup [#858](https://github.com/openethereum/openethereum/pull/858)
|
||||
- WebApps HTTP Basic Auth Support [#906](https://github.com/openethereum/openethereum/pull/906)
|
||||
- Removing match on constant [#888](https://github.com/openethereum/openethereum/pull/888)
|
||||
- Update auth.rs [#907](https://github.com/openethereum/openethereum/pull/907)
|
||||
- Enabling webapps compilation by default [#904](https://github.com/openethereum/openethereum/pull/904)
|
||||
- fixed #895 [#898](https://github.com/openethereum/openethereum/pull/898)
|
||||
- Support for compile-time included WebApplications. [#899](https://github.com/openethereum/openethereum/pull/899)
|
||||
- Propagate transaction queue [#894](https://github.com/openethereum/openethereum/pull/894)
|
||||
- Use new json RPC server [#901](https://github.com/openethereum/openethereum/pull/901)
|
||||
- Gracefully dying when trying to enable RPC and app is compiled without it. [#900](https://github.com/openethereum/openethereum/pull/900)
|
||||
- Additional logging and friendlier error messages [#893](https://github.com/openethereum/openethereum/pull/893)
|
||||
- Avoid signalling readiness when app is about to be closed. [#897](https://github.com/openethereum/openethereum/pull/897)
|
||||
- fixed #875 and added tests for eth_sendTransaction [#890](https://github.com/openethereum/openethereum/pull/890)
|
||||
- passing key path to all invocations [#891](https://github.com/openethereum/openethereum/pull/891)
|
||||
- Fixed eth_call nonce and gas handling [#892](https://github.com/openethereum/openethereum/pull/892)
|
||||
- ipc rpc with nano transport (simple duplex) [#886](https://github.com/openethereum/openethereum/pull/886)
|
||||
- Bumping clippy and fixing warnings [#889](https://github.com/openethereum/openethereum/pull/889)
|
||||
- More descriptive expectations to transaction queue consistency. [#878](https://github.com/openethereum/openethereum/pull/878)
|
||||
- uint bug - replace add with or [#879](https://github.com/openethereum/openethereum/pull/879)
|
||||
- Fixing typo in bigint [#877](https://github.com/openethereum/openethereum/pull/877)
|
||||
- update misleading cli help msg for author [#874](https://github.com/openethereum/openethereum/pull/874)
|
||||
- Find geth data store cross-platform. [#871](https://github.com/openethereum/openethereum/pull/871)
|
||||
- Import geth 1.4.0 keys [#872](https://github.com/openethereum/openethereum/pull/872)
|
||||
- Syntax helpers for IPC RPC (part 2) [#854](https://github.com/openethereum/openethereum/pull/854)
|
||||
- Fixed bootnode URL and error message [#870](https://github.com/openethereum/openethereum/pull/870)
|
||||
- replace popcnt with mov (861) [#867](https://github.com/openethereum/openethereum/pull/867)
|
||||
- weekly dependencies update [#865](https://github.com/openethereum/openethereum/pull/865)
|
||||
- Remove unused mut [#866](https://github.com/openethereum/openethereum/pull/866)
|
||||
- fixed #855 [#864](https://github.com/openethereum/openethereum/pull/864)
|
||||
- simplified trace from functions, removed clippy warnings [#862](https://github.com/openethereum/openethereum/pull/862)
|
||||
- Update deprecated HashDB methods in docs. [#857](https://github.com/openethereum/openethereum/pull/857)
|
||||
- refactored loading transaction json tests [#853](https://github.com/openethereum/openethereum/pull/853)
|
||||
- reorganised price info lookup [#852](https://github.com/openethereum/openethereum/pull/852)
|
||||
- Publish locally-made transactions to peers. [#850](https://github.com/openethereum/openethereum/pull/850)
|
||||
- Add generalbeck's token [#847](https://github.com/openethereum/openethereum/pull/847)
|
||||
- Fix response for mining. [#846](https://github.com/openethereum/openethereum/pull/846)
|
||||
- USD-based pricing of gas. [#843](https://github.com/openethereum/openethereum/pull/843)
|
||||
- Parity can accept older work packages [#811](https://github.com/openethereum/openethereum/pull/811)
|
||||
- Caching for computing seed hashes (#541) [#841](https://github.com/openethereum/openethereum/pull/841)
|
||||
- checking transaction queue for pending transaction [#838](https://github.com/openethereum/openethereum/pull/838)
|
||||
- refactored loading of state tests [#817](https://github.com/openethereum/openethereum/pull/817)
|
||||
- tests for deserialization of transaction from issue #835 [#837](https://github.com/openethereum/openethereum/pull/837)
|
||||
- unlocks with no expiration [on top of 833] [#834](https://github.com/openethereum/openethereum/pull/834)
|
||||
- Unlock accounts on CLI. [#833](https://github.com/openethereum/openethereum/pull/833)
|
||||
- Make BlockNumber optional, fix eth_call [#829](https://github.com/openethereum/openethereum/pull/829)
|
||||
- Test socket to common test code (ethcore-devtools) [#831](https://github.com/openethereum/openethereum/pull/831)
|
||||
- Use network id for the web3_net_version return. [#822](https://github.com/openethereum/openethereum/pull/822)
|
||||
- json-rpc web3_sha3 [#824](https://github.com/openethereum/openethereum/pull/824)
|
||||
- remove some unused files [#819](https://github.com/openethereum/openethereum/pull/819)
|
||||
- debug symbols for master/beta [#818](https://github.com/openethereum/openethereum/pull/818)
|
||||
- Syntax helpers for IPC RPC [#809](https://github.com/openethereum/openethereum/pull/809)
|
||||
- refactored loading of execution tests [#803](https://github.com/openethereum/openethereum/pull/803)
|
||||
- Rustfmt.toml [#805](https://github.com/openethereum/openethereum/pull/805)
|
||||
- install-partiy runs brew reinstall parity on osx [#810](https://github.com/openethereum/openethereum/pull/810)
|
||||
- Fix mining from spinning [#807](https://github.com/openethereum/openethereum/pull/807)
|
||||
- Exposing default extra data via ethcore RPC [#1032](https://github.com/paritytech/parity/pull/1032)
|
||||
- Net etiquette [#1028](https://github.com/paritytech/parity/pull/1028)
|
||||
- Bumping clippy & fixing warnings [#1024](https://github.com/paritytech/parity/pull/1024)
|
||||
- Tracedb interface && cli [#997](https://github.com/paritytech/parity/pull/997)
|
||||
- Switching to geth-attach supporting version of rpc core and server [#1022](https://github.com/paritytech/parity/pull/1022)
|
||||
- Fixing status page displaying homestead [#1020](https://github.com/paritytech/parity/pull/1020)
|
||||
- Core tracedb functionality. [#996](https://github.com/paritytech/parity/pull/996)
|
||||
- RPC method for supported modules [#1019](https://github.com/paritytech/parity/pull/1019)
|
||||
- Updating status page [#1015](https://github.com/paritytech/parity/pull/1015)
|
||||
- Disabling wallet [#1017](https://github.com/paritytech/parity/pull/1017)
|
||||
- More detailed fatal error reporting [#1016](https://github.com/paritytech/parity/pull/1016)
|
||||
- Support 'pending' block in RPC [#1007](https://github.com/paritytech/parity/pull/1007)
|
||||
- Enable pending block when there is local transaction pending. [#1005](https://github.com/paritytech/parity/pull/1005)
|
||||
- updating key files permissions on save [#1010](https://github.com/paritytech/parity/pull/1010)
|
||||
- IPC JSON RPC (for external interface) [#1009](https://github.com/paritytech/parity/pull/1009)
|
||||
- Fixing Firefox authorization issues [#1013](https://github.com/paritytech/parity/pull/1013)
|
||||
- cargo update [#1012](https://github.com/paritytech/parity/pull/1012)
|
||||
- Switching to rust-url@1.0.0 [#1011](https://github.com/paritytech/parity/pull/1011)
|
||||
- Exception handling in RPC & WebApps [#988](https://github.com/paritytech/parity/pull/988)
|
||||
- Fixed uint deserialization from hex [#1008](https://github.com/paritytech/parity/pull/1008)
|
||||
- Tweak timeout and packet size to handle slow networks better [#1004](https://github.com/paritytech/parity/pull/1004)
|
||||
- db key is generic and can be made smaller [#1006](https://github.com/paritytech/parity/pull/1006)
|
||||
- IPC with new serialization [#998](https://github.com/paritytech/parity/pull/998)
|
||||
- make jsonrpc api engine agnostic [#1001](https://github.com/paritytech/parity/pull/1001)
|
||||
- updated cargo.lock [#1002](https://github.com/paritytech/parity/pull/1002)
|
||||
- updated parity dependencies [#993](https://github.com/paritytech/parity/pull/993)
|
||||
- Auto (with codegen) binary serializer [#980](https://github.com/paritytech/parity/pull/980)
|
||||
- Fixing transaction queue last_nonces update [#995](https://github.com/paritytech/parity/pull/995)
|
||||
- import route contains ommited blocks [#994](https://github.com/paritytech/parity/pull/994)
|
||||
- fixed encoding 0u8 [#992](https://github.com/paritytech/parity/pull/992)
|
||||
- Use latest netstats [#989](https://github.com/paritytech/parity/pull/989)
|
||||
- RPC shared external miner [#984](https://github.com/paritytech/parity/pull/984)
|
||||
- Additional RPC methods for settings [#983](https://github.com/paritytech/parity/pull/983)
|
||||
- Fixing transaction_queue deadlock [#985](https://github.com/paritytech/parity/pull/985)
|
||||
- Refactoring of `parity/main.rs` [#981](https://github.com/paritytech/parity/pull/981)
|
||||
- Fixing clippy warnings. [#982](https://github.com/paritytech/parity/pull/982)
|
||||
- Bumping status page [#977](https://github.com/paritytech/parity/pull/977)
|
||||
- querying extras separated to its own module [#972](https://github.com/paritytech/parity/pull/972)
|
||||
- Exposing application logs via RPC. [#976](https://github.com/paritytech/parity/pull/976)
|
||||
- Addressing binary serialization for db types [#966](https://github.com/paritytech/parity/pull/966)
|
||||
- removed redundant unwraps [#935](https://github.com/paritytech/parity/pull/935)
|
||||
- fixed transaction queue merge conflict [#975](https://github.com/paritytech/parity/pull/975)
|
||||
- Configurable limit for transaction queue (CLI & Ethcore-RPC) [#974](https://github.com/paritytech/parity/pull/974)
|
||||
- Enforce limit caused `last_nonce` to return incorrect values. [#973](https://github.com/paritytech/parity/pull/973)
|
||||
- Even more detailed errors for transaction queue [#969](https://github.com/paritytech/parity/pull/969)
|
||||
- temporary fix of panic in blockchain garbage collection [#970](https://github.com/paritytech/parity/pull/970)
|
||||
- IPC codegen - some minor fixes & enhancements [#967](https://github.com/paritytech/parity/pull/967)
|
||||
- Additional logging for transactions [#968](https://github.com/paritytech/parity/pull/968)
|
||||
- refactored blockchain extras keys building [#963](https://github.com/paritytech/parity/pull/963)
|
||||
- Using hyper-mio branch in webapps. [#957](https://github.com/paritytech/parity/pull/957)
|
||||
- Remove nanomsg from build-dependencies [#965](https://github.com/paritytech/parity/pull/965)
|
||||
- Fix build for --target=armv7-unknown-linux-gnueabihf [#964](https://github.com/paritytech/parity/pull/964)
|
||||
- IPC RPC codegen extra feature [#962](https://github.com/paritytech/parity/pull/962)
|
||||
- IPC RPC codegen for generic implementation [#961](https://github.com/paritytech/parity/pull/961)
|
||||
- using db_path directory when upgrading [#960](https://github.com/paritytech/parity/pull/960)
|
||||
- IPC hypervisor [#958](https://github.com/paritytech/parity/pull/958)
|
||||
- Removing a transaction from queue now removes all from this sender with lower nonces. [#950](https://github.com/paritytech/parity/pull/950)
|
||||
- bump status page version 0.1.7 [#955](https://github.com/paritytech/parity/pull/955)
|
||||
- Changing cors header to be optional [#956](https://github.com/paritytech/parity/pull/956)
|
||||
- Update ARM Dockerfile [#959](https://github.com/paritytech/parity/pull/959)
|
||||
- Sensible gas limits for eth_sendTransaction [#953](https://github.com/paritytech/parity/pull/953)
|
||||
- Fix upgrade script and make parity run when no .parity dir. [#954](https://github.com/paritytech/parity/pull/954)
|
||||
- Tracing and docs for --pruning=auto. [#952](https://github.com/paritytech/parity/pull/952)
|
||||
- IPC serialization for custom parameters [#946](https://github.com/paritytech/parity/pull/946)
|
||||
- default filter from block should be Latest, not Earliest [#948](https://github.com/paritytech/parity/pull/948)
|
||||
- README.md: removes sudo from multirust installation [#943](https://github.com/paritytech/parity/pull/943)
|
||||
- Disable long lines formatting + ethash example. [#939](https://github.com/paritytech/parity/pull/939)
|
||||
- Ethcore-specific RPC methods for altering miner parameters. [#934](https://github.com/paritytech/parity/pull/934)
|
||||
- Use ethcore nanomsg bindings [#941](https://github.com/paritytech/parity/pull/941)
|
||||
- Update IPC codegen to latest syntax libs [#938](https://github.com/paritytech/parity/pull/938)
|
||||
- IPC documentation [#937](https://github.com/paritytech/parity/pull/937)
|
||||
- Bumping clippy and fixing warnings. [#936](https://github.com/paritytech/parity/pull/936)
|
||||
- Pruning auto [#927](https://github.com/paritytech/parity/pull/927)
|
||||
- IPC persistent client link [#933](https://github.com/paritytech/parity/pull/933)
|
||||
- IPC persistent client link [#930](https://github.com/paritytech/parity/pull/930)
|
||||
- IPC handshake (negotiating protocol/api version) [#928](https://github.com/paritytech/parity/pull/928)
|
||||
- Upgrade logic between versions [#914](https://github.com/paritytech/parity/pull/914)
|
||||
- executive tracing cleanup [#903](https://github.com/paritytech/parity/pull/903)
|
||||
- Ethcore-specific RPC methods [#923](https://github.com/paritytech/parity/pull/923)
|
||||
- Parameter to allow user to force the sealing mechanism [#918](https://github.com/paritytech/parity/pull/918)
|
||||
- updated dependencies [#921](https://github.com/paritytech/parity/pull/921)
|
||||
- Fixed send transaction deadlock [#920](https://github.com/paritytech/parity/pull/920)
|
||||
- --unlock is comma-delimited. [#916](https://github.com/paritytech/parity/pull/916)
|
||||
- fixed eth_getLogs [#915](https://github.com/paritytech/parity/pull/915)
|
||||
- create provided custom dir for keys if none [#912](https://github.com/paritytech/parity/pull/912)
|
||||
- spec loading cleanup [#858](https://github.com/paritytech/parity/pull/858)
|
||||
- WebApps HTTP Basic Auth Support [#906](https://github.com/paritytech/parity/pull/906)
|
||||
- Removing match on constant [#888](https://github.com/paritytech/parity/pull/888)
|
||||
- Update auth.rs [#907](https://github.com/paritytech/parity/pull/907)
|
||||
- Enabling webapps compilation by default [#904](https://github.com/paritytech/parity/pull/904)
|
||||
- fixed #895 [#898](https://github.com/paritytech/parity/pull/898)
|
||||
- Support for compile-time included WebApplications. [#899](https://github.com/paritytech/parity/pull/899)
|
||||
- Propagate transaction queue [#894](https://github.com/paritytech/parity/pull/894)
|
||||
- Use new json RPC server [#901](https://github.com/paritytech/parity/pull/901)
|
||||
- Gracefully dying when trying to enable RPC and app is compiled without it. [#900](https://github.com/paritytech/parity/pull/900)
|
||||
- Additional logging and friendlier error messages [#893](https://github.com/paritytech/parity/pull/893)
|
||||
- Avoid signalling readiness when app is about to be closed. [#897](https://github.com/paritytech/parity/pull/897)
|
||||
- fixed #875 and added tests for eth_sendTransaction [#890](https://github.com/paritytech/parity/pull/890)
|
||||
- passing key path to all invocations [#891](https://github.com/paritytech/parity/pull/891)
|
||||
- Fixed eth_call nonce and gas handling [#892](https://github.com/paritytech/parity/pull/892)
|
||||
- ipc rpc with nano transport (simple duplex) [#886](https://github.com/paritytech/parity/pull/886)
|
||||
- Bumping clippy and fixing warnings [#889](https://github.com/paritytech/parity/pull/889)
|
||||
- More descriptive expectations to transaction queue consistency. [#878](https://github.com/paritytech/parity/pull/878)
|
||||
- uint bug - replace add with or [#879](https://github.com/paritytech/parity/pull/879)
|
||||
- Fixing typo in bigint [#877](https://github.com/paritytech/parity/pull/877)
|
||||
- update misleading cli help msg for author [#874](https://github.com/paritytech/parity/pull/874)
|
||||
- Find geth data store cross-platform. [#871](https://github.com/paritytech/parity/pull/871)
|
||||
- Import geth 1.4.0 keys [#872](https://github.com/paritytech/parity/pull/872)
|
||||
- Syntax helpers for IPC RPC (part 2) [#854](https://github.com/paritytech/parity/pull/854)
|
||||
- Fixed bootnode URL and error message [#870](https://github.com/paritytech/parity/pull/870)
|
||||
- replace popcnt with mov (861) [#867](https://github.com/paritytech/parity/pull/867)
|
||||
- weekly dependencies update [#865](https://github.com/paritytech/parity/pull/865)
|
||||
- Remove unused mut [#866](https://github.com/paritytech/parity/pull/866)
|
||||
- fixed #855 [#864](https://github.com/paritytech/parity/pull/864)
|
||||
- simplified trace from functions, removed clippy warnings [#862](https://github.com/paritytech/parity/pull/862)
|
||||
- Update deprecated HashDB methods in docs. [#857](https://github.com/paritytech/parity/pull/857)
|
||||
- refactored loading transaction json tests [#853](https://github.com/paritytech/parity/pull/853)
|
||||
- reorganised price info lookup [#852](https://github.com/paritytech/parity/pull/852)
|
||||
- Publish locally-made transactions to peers. [#850](https://github.com/paritytech/parity/pull/850)
|
||||
- Add generalbeck's token [#847](https://github.com/paritytech/parity/pull/847)
|
||||
- Fix response for mining. [#846](https://github.com/paritytech/parity/pull/846)
|
||||
- USD-based pricing of gas. [#843](https://github.com/paritytech/parity/pull/843)
|
||||
- Parity can accept older work packages [#811](https://github.com/paritytech/parity/pull/811)
|
||||
- Caching for computing seed hashes (#541) [#841](https://github.com/paritytech/parity/pull/841)
|
||||
- checking transaction queue for pending transaction [#838](https://github.com/paritytech/parity/pull/838)
|
||||
- refactored loading of state tests [#817](https://github.com/paritytech/parity/pull/817)
|
||||
- tests for deserialization of transaction from issue #835 [#837](https://github.com/paritytech/parity/pull/837)
|
||||
- unlocks with no expiration [on top of 833] [#834](https://github.com/paritytech/parity/pull/834)
|
||||
- Unlock accounts on CLI. [#833](https://github.com/paritytech/parity/pull/833)
|
||||
- Make BlockNumber optional, fix eth_call [#829](https://github.com/paritytech/parity/pull/829)
|
||||
- Test socket to common test code (ethcore-devtools) [#831](https://github.com/paritytech/parity/pull/831)
|
||||
- Use network id for the web3_net_version return. [#822](https://github.com/paritytech/parity/pull/822)
|
||||
- json-rpc web3_sha3 [#824](https://github.com/paritytech/parity/pull/824)
|
||||
- remove some unused files [#819](https://github.com/paritytech/parity/pull/819)
|
||||
- debug symbols for master/beta [#818](https://github.com/paritytech/parity/pull/818)
|
||||
- Syntax helpers for IPC RPC [#809](https://github.com/paritytech/parity/pull/809)
|
||||
- refactored loading of execution tests [#803](https://github.com/paritytech/parity/pull/803)
|
||||
- Rustfmt.toml [#805](https://github.com/paritytech/parity/pull/805)
|
||||
- install-partiy runs brew reinstall parity on osx [#810](https://github.com/paritytech/parity/pull/810)
|
||||
- Fix mining from spinning [#807](https://github.com/paritytech/parity/pull/807)
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
Note: Parity 1.10 reached End-of-Life on 2018-07-18 (EOL).
|
||||
|
||||
## Parity [v1.10.9](https://github.com/openethereum/openethereum/releases/tag/v1.10.9) (2018-07-07)
|
||||
## 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.
|
||||
|
||||
The full list of included changes:
|
||||
|
||||
- Stable: 1.10.9 backports ([#9016](https://github.com/openethereum/openethereum/pull/9016))
|
||||
- Stable: 1.10.9 backports ([#9016](https://github.com/paritytech/parity/pull/9016))
|
||||
- Parity-version: bump stable to 1.10.9
|
||||
- Scripts: remove md5 checksums ([#8884](https://github.com/openethereum/openethereum/pull/8884))
|
||||
- Add support for --chain tobalaba ([#8870](https://github.com/openethereum/openethereum/pull/8870))
|
||||
- Scripts: remove md5 checksums ([#8884](https://github.com/paritytech/parity/pull/8884))
|
||||
- Add support for --chain tobalaba ([#8870](https://github.com/paritytech/parity/pull/8870))
|
||||
- Add support for --chain tobalaba
|
||||
- Only return error log for rustls ([#9025](https://github.com/openethereum/openethereum/pull/9025))
|
||||
- Fixes for misbehavior reporting in AuthorityRound ([#8998](https://github.com/openethereum/openethereum/pull/8998))
|
||||
- Only return error log for rustls ([#9025](https://github.com/paritytech/parity/pull/9025))
|
||||
- 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
|
||||
@@ -26,62 +26,62 @@ The full list of included changes:
|
||||
- Aura: let reporting fail on verify_block_basic
|
||||
- Aura: add comment about possible failure of reporting
|
||||
|
||||
## Parity [v1.10.8](https://github.com/openethereum/openethereum/releases/tag/v1.10.8) (2018-06-29)
|
||||
## Parity [v1.10.8](https://github.com/paritytech/parity/releases/tag/v1.10.8) (2018-06-29)
|
||||
|
||||
Parity 1.10.8 is a bug-fix release to improve performance and stability.
|
||||
|
||||
The full list of included changes:
|
||||
|
||||
- Backports ([#8986](https://github.com/openethereum/openethereum/pull/8986))
|
||||
- Snap: downgrade rust to revision 1.26.2, ref snapcraft/+bug/1778530 ([#8984](https://github.com/openethereum/openethereum/pull/8984))
|
||||
- Backports ([#8986](https://github.com/paritytech/parity/pull/8986))
|
||||
- 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/openethereum/openethereum/pull/8977))
|
||||
- Fix deadlock in blockchain. ([#8977](https://github.com/paritytech/parity/pull/8977))
|
||||
- Remove js-glue from workspace
|
||||
- Bump stable to 1.10.8 ([#8951](https://github.com/openethereum/openethereum/pull/8951))
|
||||
- Bump stable to 1.10.8 ([#8951](https://github.com/paritytech/parity/pull/8951))
|
||||
- Parity-version: bump stable to 1.10.8
|
||||
- Update ropsten.json ([#8926](https://github.com/openethereum/openethereum/pull/8926))
|
||||
- Scripts: minor improvements ([#8930](https://github.com/openethereum/openethereum/pull/8930))
|
||||
- Update ropsten.json ([#8926](https://github.com/paritytech/parity/pull/8926))
|
||||
- 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: remove whisper target not available in stable
|
||||
- Scripts: fix gitlab strip binaries
|
||||
- Scripts: fix docker build tag on latest using master ([#8952](https://github.com/openethereum/openethereum/pull/8952))
|
||||
- Rpc: cap gas limit of local calls ([#8943](https://github.com/openethereum/openethereum/pull/8943))
|
||||
- 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))
|
||||
|
||||
## Parity [v1.10.7](https://github.com/openethereum/openethereum/releases/tag/v1.10.7) (2018-06-20)
|
||||
## Parity [v1.10.7](https://github.com/paritytech/parity/releases/tag/v1.10.7) (2018-06-20)
|
||||
|
||||
Parity 1.10.7 is a bug-fix release to improve performance and stability.
|
||||
|
||||
The full list of included changes:
|
||||
|
||||
- Backports ([#8919](https://github.com/openethereum/openethereum/pull/8919))
|
||||
- Fixed AuthorityRound deadlock on shutdown, closes [#8088](https://github.com/openethereum/openethereum/issues/8088) ([#8803](https://github.com/openethereum/openethereum/pull/8803))
|
||||
- CI: Fix docker tags ([#8822](https://github.com/openethereum/openethereum/pull/8822))
|
||||
- Backports ([#8919](https://github.com/paritytech/parity/pull/8919))
|
||||
- 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
|
||||
- Fix concurrent access to signer queue ([#8854](https://github.com/openethereum/openethereum/pull/8854))
|
||||
- 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"
|
||||
- Add new ovh bootnodes and fix port for foundation bootnode 3.2 ([#8886](https://github.com/openethereum/openethereum/pull/8886))
|
||||
- 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/openethereum/openethereum/pull/8891))
|
||||
- Update jsonrpc libs, fixed ipc leak, closes [#8774](https://github.com/openethereum/openethereum/issues/8774) ([#8876](https://github.com/openethereum/openethereum/pull/8876))
|
||||
- Add ETC Cooperative-run load balanced parity node ([#8892](https://github.com/openethereum/openethereum/pull/8892))
|
||||
- Minor fix in chain supplier and light provider ([#8906](https://github.com/openethereum/openethereum/pull/8906))
|
||||
- Block 0 is valid in queries ([#8891](https://github.com/paritytech/parity/pull/8891))
|
||||
- Update jsonrpc libs, fixed ipc leak, closes [#8774](https://github.com/paritytech/parity/issues/8774) ([#8876](https://github.com/paritytech/parity/pull/8876))
|
||||
- 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
|
||||
- Parity-version: stable release 1.10.7 ([#8855](https://github.com/openethereum/openethereum/pull/8855))
|
||||
- Cherry-pick network-specific release flag ([#8821](https://github.com/openethereum/openethereum/pull/8821))
|
||||
- Parity-version: stable release 1.10.7 ([#8855](https://github.com/paritytech/parity/pull/8855))
|
||||
- Cherry-pick network-specific release flag ([#8821](https://github.com/paritytech/parity/pull/8821))
|
||||
- Parity-version: bump stable to 1.10.7
|
||||
|
||||
## Parity [v1.10.6](https://github.com/openethereum/openethereum/releases/tag/v1.10.6) (2018-06-05)
|
||||
## Parity [v1.10.6](https://github.com/paritytech/parity/releases/tag/v1.10.6) (2018-06-05)
|
||||
|
||||
Parity 1.10.6 is a security-relevant release. Please upgrade your nodes as soon as possible.
|
||||
|
||||
@@ -93,66 +93,66 @@ If you can not upgrade to 1.10+ yet, please use the following branches and build
|
||||
|
||||
The full list of included changes:
|
||||
|
||||
- Parity-version: bump stable to 1.10.6 ([#8805](https://github.com/openethereum/openethereum/pull/8805))
|
||||
- Parity-version: bump stable to 1.10.6 ([#8805](https://github.com/paritytech/parity/pull/8805))
|
||||
- Parity-version: bump stable to 1.10.6
|
||||
- Disallow unsigned transactions in case EIP-86 is disabled ([#8802](https://github.com/openethereum/openethereum/pull/8802))
|
||||
- Update shell32-sys to fix windows build ([#8793](https://github.com/openethereum/openethereum/pull/8793))
|
||||
- Backports ([#8782](https://github.com/openethereum/openethereum/pull/8782))
|
||||
- Fix light sync with initial validator-set contract ([#8528](https://github.com/openethereum/openethereum/pull/8528))
|
||||
- Disallow unsigned transactions in case EIP-86 is disabled ([#8802](https://github.com/paritytech/parity/pull/8802))
|
||||
- Update shell32-sys to fix windows build ([#8793](https://github.com/paritytech/parity/pull/8793))
|
||||
- Backports ([#8782](https://github.com/paritytech/parity/pull/8782))
|
||||
- Fix light sync with initial validator-set contract ([#8528](https://github.com/paritytech/parity/pull/8528))
|
||||
- Fix #8468
|
||||
- Use U256::max_value() instead
|
||||
- Fix again
|
||||
- Also change initial transaction gas
|
||||
- Don't open Browser post-install on Mac ([#8641](https://github.com/openethereum/openethereum/pull/8641))
|
||||
- Don't open Browser post-install on Mac ([#8641](https://github.com/paritytech/parity/pull/8641))
|
||||
- Prefix uint fmt with `0x` with alternate flag
|
||||
- Set the request index to that of the current request ([#8683](https://github.com/openethereum/openethereum/pull/8683))
|
||||
- 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
|
||||
- Node table sorting according to last contact data ([#8541](https://github.com/openethereum/openethereum/pull/8541))
|
||||
- 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
|
||||
- Network-devp2p: handle UselessPeer disconnect ([#8686](https://github.com/openethereum/openethereum/pull/8686))
|
||||
- Parity: bump stable version to 1.10.5 ([#8749](https://github.com/openethereum/openethereum/pull/8749))
|
||||
- Network-devp2p: handle UselessPeer disconnect ([#8686](https://github.com/paritytech/parity/pull/8686))
|
||||
- Parity: bump stable version to 1.10.5 ([#8749](https://github.com/paritytech/parity/pull/8749))
|
||||
- Parity: bump stable version to 1.10.5
|
||||
- Fix failing doc tests running on non-code
|
||||
|
||||
## Parity [v1.10.4](https://github.com/openethereum/openethereum/releases/tag/v1.10.4) (2018-05-15)
|
||||
## Parity [v1.10.4](https://github.com/paritytech/parity/releases/tag/v1.10.4) (2018-05-15)
|
||||
|
||||
Parity 1.10.4 is a bug-fix release to improve performance and stability.
|
||||
|
||||
The full list of included changes:
|
||||
|
||||
- Backports ([#8623](https://github.com/openethereum/openethereum/pull/8623))
|
||||
- Fix account list double 0x display ([#8596](https://github.com/openethereum/openethereum/pull/8596))
|
||||
- Backports ([#8623](https://github.com/paritytech/parity/pull/8623))
|
||||
- Fix account list double 0x display ([#8596](https://github.com/paritytech/parity/pull/8596))
|
||||
- Remove unused self import
|
||||
- Fix account list double 0x display
|
||||
- Trace precompiled contracts when the transfer value is not zero ([#8486](https://github.com/openethereum/openethereum/pull/8486))
|
||||
- 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 precompileds
|
||||
- Use is_transferred instead of transferred
|
||||
- Gitlab test script fixes ([#8573](https://github.com/openethereum/openethereum/pull/8573))
|
||||
- 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 stable to 1.10.4 ([#8626](https://github.com/openethereum/openethereum/pull/8626))
|
||||
- Allow stable snaps to be stable. ([#8582](https://github.com/openethereum/openethereum/pull/8582))
|
||||
- Bump stable to 1.10.4 ([#8626](https://github.com/paritytech/parity/pull/8626))
|
||||
- Allow stable snaps to be stable. ([#8582](https://github.com/paritytech/parity/pull/8582))
|
||||
|
||||
## Parity [v1.10.3](https://github.com/openethereum/openethereum/releases/tag/v1.10.3) (2018-05-08)
|
||||
## Parity [v1.10.3](https://github.com/paritytech/parity/releases/tag/v1.10.3) (2018-05-08)
|
||||
|
||||
Parity 1.10.3 marks the first stable release on the 1.10 track. Among others, it improves performance and stability.
|
||||
|
||||
The full list of included changes:
|
||||
|
||||
- Backports ([#8557](https://github.com/openethereum/openethereum/pull/8557))
|
||||
- Update wasmi and pwasm-utils ([#8493](https://github.com/openethereum/openethereum/pull/8493))
|
||||
- Backports ([#8557](https://github.com/paritytech/parity/pull/8557))
|
||||
- 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
|
||||
- Fetching logs by hash in blockchain database ([#8463](https://github.com/openethereum/openethereum/pull/8463))
|
||||
- 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
|
||||
@@ -165,7 +165,7 @@ The full list of included changes:
|
||||
- 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/openethereum/openethereum/pull/8491))
|
||||
- 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 `to_pod_diff` builds both `touched_addresses` merge and storage keys merge.
|
||||
- Fix tests
|
||||
@@ -175,86 +175,86 @@ The full list of included changes:
|
||||
- Address grumbles
|
||||
- typo: remove unwanted empty line
|
||||
- ensure_cached compiles with the original signature
|
||||
- Enable WebAssembly and Byzantium for Ellaism ([#8520](https://github.com/openethereum/openethereum/pull/8520))
|
||||
- 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
|
||||
- Fix compilation.
|
||||
- Stabilize 1.10.3 ([#8474](https://github.com/openethereum/openethereum/pull/8474))
|
||||
- Stabilize 1.10.3 ([#8474](https://github.com/paritytech/parity/pull/8474))
|
||||
- Stabelize 1.10
|
||||
- Bump stable to 1.10.3
|
||||
- Update Gitlab scripts
|
||||
- Fix snap builds ([#8483](https://github.com/openethereum/openethereum/pull/8483))
|
||||
- Fix docker build ([#8462](https://github.com/openethereum/openethereum/pull/8462))
|
||||
- Fix snap builds ([#8483](https://github.com/paritytech/parity/pull/8483))
|
||||
- Fix docker build ([#8462](https://github.com/paritytech/parity/pull/8462))
|
||||
- Use `master` as Docker's `latest` (`beta-release` is not used anymore)
|
||||
|
||||
## Parity [v1.10.2](https://github.com/openethereum/openethereum/releases/tag/v1.10.2) (2018-04-24)
|
||||
## Parity [v1.10.2](https://github.com/paritytech/parity/releases/tag/v1.10.2) (2018-04-24)
|
||||
|
||||
Parity 1.10.2 is a bug-fix release to improve performance and stability.
|
||||
|
||||
The full list of included changes:
|
||||
|
||||
- Update Parity beta to 1.10.2 + Backports ([#8455](https://github.com/openethereum/openethereum/pull/8455))
|
||||
- Update Parity beta to 1.10.2 + Backports ([#8455](https://github.com/paritytech/parity/pull/8455))
|
||||
- Update Parity beta to 1.10.2
|
||||
- Allow 32-bit pipelines to fail ([#8454](https://github.com/openethereum/openethereum/pull/8454))
|
||||
- Allow 32-bit pipelines to fail ([#8454](https://github.com/paritytech/parity/pull/8454))
|
||||
- Disable 32-bit targets for Gitlab
|
||||
- Rename Linux pipelines
|
||||
- Update wasmi ([#8452](https://github.com/openethereum/openethereum/pull/8452))
|
||||
- Update wasmi ([#8452](https://github.com/paritytech/parity/pull/8452))
|
||||
- Fix Cargo.lock
|
||||
- Backports ([#8450](https://github.com/openethereum/openethereum/pull/8450))
|
||||
- Use forked app_dirs crate for reverted Windows dir behavior ([#8438](https://github.com/openethereum/openethereum/pull/8438))
|
||||
- Backports ([#8450](https://github.com/paritytech/parity/pull/8450))
|
||||
- Use forked app_dirs crate for reverted Windows dir behavior ([#8438](https://github.com/paritytech/parity/pull/8438))
|
||||
- Remove unused app_dirs dependency in CLI
|
||||
- Use forked app_dirs crate for reverted Windows dir behavior
|
||||
- Remove Tendermint extra_info due to seal inconsistencies ([#8367](https://github.com/openethereum/openethereum/pull/8367))
|
||||
- Handle queue import errors a bit more gracefully ([#8385](https://github.com/openethereum/openethereum/pull/8385))
|
||||
- Improve VM executor stack size estimation rules ([#8439](https://github.com/openethereum/openethereum/pull/8439))
|
||||
- Remove Tendermint extra_info due to seal inconsistencies ([#8367](https://github.com/paritytech/parity/pull/8367))
|
||||
- Handle queue import errors a bit more gracefully ([#8385](https://github.com/paritytech/parity/pull/8385))
|
||||
- Improve VM executor stack size estimation rules ([#8439](https://github.com/paritytech/parity/pull/8439))
|
||||
- Improve VM executor stack size estimation rules
|
||||
- Typo: docs add "(Debug build)" comment
|
||||
- Fix an off by one typo and set minimal stack size
|
||||
- Use saturating_sub to avoid potential overflow
|
||||
|
||||
## Parity [v1.10.1](https://github.com/openethereum/openethereum/releases/tag/v1.10.1) (2018-04-17)
|
||||
## Parity [v1.10.1](https://github.com/paritytech/parity/releases/tag/v1.10.1) (2018-04-17)
|
||||
|
||||
Parity 1.10.1 is a bug-fix release to improve performance and stability. Among other changes, you can now use `--warp-barrier [BLOCK]` to specify a minimum block number to `--warp` to. This is useful in cases where clients restore to outdated snapshots far behind the latest chain head.
|
||||
|
||||
The full list of included changes:
|
||||
|
||||
- Bump beta to 1.10.1 ([#8350](https://github.com/openethereum/openethereum/pull/8350))
|
||||
- Bump beta to 1.10.1 ([#8350](https://github.com/paritytech/parity/pull/8350))
|
||||
- Bump beta to 1.10.1
|
||||
- Unflag critical release
|
||||
- Backports ([#8346](https://github.com/openethereum/openethereum/pull/8346))
|
||||
- Warp-only sync with warp-barrier [blocknumber] flag. ([#8228](https://github.com/openethereum/openethereum/pull/8228))
|
||||
- Backports ([#8346](https://github.com/paritytech/parity/pull/8346))
|
||||
- Warp-only sync with warp-barrier [blocknumber] flag. ([#8228](https://github.com/paritytech/parity/pull/8228))
|
||||
- Warp-only sync with warp-after [blocknumber] flag.
|
||||
- Fix tests.
|
||||
- Fix configuration tests.
|
||||
- Rename to warp barrier.
|
||||
- Allow unsafe js eval on Parity Wallet. ([#8204](https://github.com/openethereum/openethereum/pull/8204))
|
||||
- Update musicoin spec in line with gmc v2.6.2 ([#8242](https://github.com/openethereum/openethereum/pull/8242))
|
||||
- Supress TemporaryInvalid verification failures. ([#8256](https://github.com/openethereum/openethereum/pull/8256))
|
||||
- Include suicided accounts in state diff ([#8297](https://github.com/openethereum/openethereum/pull/8297))
|
||||
- Allow unsafe js eval on Parity Wallet. ([#8204](https://github.com/paritytech/parity/pull/8204))
|
||||
- Update musicoin spec in line with gmc v2.6.2 ([#8242](https://github.com/paritytech/parity/pull/8242))
|
||||
- Supress TemporaryInvalid verification failures. ([#8256](https://github.com/paritytech/parity/pull/8256))
|
||||
- Include suicided accounts in state diff ([#8297](https://github.com/paritytech/parity/pull/8297))
|
||||
- Include suicided accounts in state diff
|
||||
- Shorten form match -> if let
|
||||
- Test suicide trace diff in State
|
||||
- Replace_home for password_files, reserved_peers and log_file ([#8324](https://github.com/openethereum/openethereum/pull/8324))
|
||||
- Replace_home for password_files, reserved_peers and log_file ([#8324](https://github.com/paritytech/parity/pull/8324))
|
||||
- Replace_home for password_files, reserved_peers and log_file
|
||||
- Typo: arg_log_file is Option
|
||||
- Enable UI by default, but only display info page.
|
||||
- Fix test.
|
||||
- Fix naming and remove old todo.
|
||||
- Change "wallet" with "browser UI"
|
||||
- Change name Wallet -> UI ([#8164](https://github.com/openethereum/openethereum/pull/8164)) ([#8205](https://github.com/openethereum/openethereum/pull/8205))
|
||||
- Change name Wallet -> UI ([#8164](https://github.com/paritytech/parity/pull/8164)) ([#8205](https://github.com/paritytech/parity/pull/8205))
|
||||
- Change name Wallet -> UI
|
||||
- Make warning bold
|
||||
- Backport [#8099](https://github.com/openethereum/openethereum/pull/8099) ([#8132](https://github.com/openethereum/openethereum/pull/8132))
|
||||
- WASM libs ([#8220](https://github.com/openethereum/openethereum/pull/8220))
|
||||
- Bump wasm libs ([#8171](https://github.com/openethereum/openethereum/pull/8171))
|
||||
- Bump wasmi version ([#8209](https://github.com/openethereum/openethereum/pull/8209))
|
||||
- Update hyper to 0.11.24 ([#8203](https://github.com/openethereum/openethereum/pull/8203))
|
||||
- Updated jsonrpc to include latest backports (beta) ([#8181](https://github.com/openethereum/openethereum/pull/8181))
|
||||
- Backport [#8099](https://github.com/paritytech/parity/pull/8099) ([#8132](https://github.com/paritytech/parity/pull/8132))
|
||||
- WASM libs ([#8220](https://github.com/paritytech/parity/pull/8220))
|
||||
- Bump wasm libs ([#8171](https://github.com/paritytech/parity/pull/8171))
|
||||
- Bump wasmi version ([#8209](https://github.com/paritytech/parity/pull/8209))
|
||||
- Update hyper to 0.11.24 ([#8203](https://github.com/paritytech/parity/pull/8203))
|
||||
- Updated jsonrpc to include latest backports (beta) ([#8181](https://github.com/paritytech/parity/pull/8181))
|
||||
- Updated jsonrpc to include latest backports
|
||||
- Update dependencies.
|
||||
|
||||
## Parity [v1.10.0](https://github.com/openethereum/openethereum/releases/tag/v1.10.0) (2018-03-22)
|
||||
## Parity [v1.10.0](https://github.com/paritytech/parity/releases/tag/v1.10.0) (2018-03-22)
|
||||
|
||||
This is the Parity 1.10.0-beta release! Cool!
|
||||
|
||||
@@ -292,7 +292,7 @@ To enable empty step messages, set the `emptyStepsTransition` to your favorite b
|
||||
|
||||
We removed the old database migrations from 2016. In case you upgrade Parity from a really, really old version, you will have to reset your database manually first with `parity <options> db kill`.
|
||||
|
||||
We fixed DELEGATECALL `from` and `to` fields, see [#7166](https://github.com/openethereum/openethereum/issues/7166).
|
||||
We fixed DELEGATECALL `from` and `to` fields, see [#7166](https://github.com/paritytech/parity/issues/7166).
|
||||
|
||||
We reduced the default USD per transaction value to 0.0001. Thanks, @MysticRyuujin!
|
||||
|
||||
@@ -302,60 +302,60 @@ The Musicoin chain is now enabled with Byzantium features starting at block `2_2
|
||||
|
||||
The full list of included changes:
|
||||
|
||||
- Re-enable signer, even with no UI. ([#8167](https://github.com/openethereum/openethereum/pull/8167)) ([#8168](https://github.com/openethereum/openethereum/pull/8168))
|
||||
- Re-enable signer, even with no UI. ([#8167](https://github.com/paritytech/parity/pull/8167)) ([#8168](https://github.com/paritytech/parity/pull/8168))
|
||||
- Re-enable signer, even with no UI.
|
||||
- Fix message.
|
||||
- Beta Backports ([#8136](https://github.com/openethereum/openethereum/pull/8136))
|
||||
- Support parity protocol. ([#8035](https://github.com/openethereum/openethereum/pull/8035))
|
||||
- updater: apply exponential backoff after download failure ([#8059](https://github.com/openethereum/openethereum/pull/8059))
|
||||
- Beta Backports ([#8136](https://github.com/paritytech/parity/pull/8136))
|
||||
- Support parity protocol. ([#8035](https://github.com/paritytech/parity/pull/8035))
|
||||
- updater: apply exponential backoff after download failure ([#8059](https://github.com/paritytech/parity/pull/8059))
|
||||
- updater: apply exponential backoff after download failure
|
||||
- updater: reset backoff on new release
|
||||
- Max code size on Kovan ([#8067](https://github.com/openethereum/openethereum/pull/8067))
|
||||
- Max code size on Kovan ([#8067](https://github.com/paritytech/parity/pull/8067))
|
||||
- Enable code size limit on kovan
|
||||
- Fix formatting.
|
||||
- Limit incoming connections. ([#8060](https://github.com/openethereum/openethereum/pull/8060))
|
||||
- Limit incoming connections. ([#8060](https://github.com/paritytech/parity/pull/8060))
|
||||
- Limit ingress connections
|
||||
- Optimized handshakes logging
|
||||
- WASM libraries bump ([#7970](https://github.com/openethereum/openethereum/pull/7970))
|
||||
- WASM libraries bump ([#7970](https://github.com/paritytech/parity/pull/7970))
|
||||
- update wasmi, parity-wasm, wasm-utils to latest version
|
||||
- Update to new wasmi & error handling
|
||||
- also utilize new stack limiter
|
||||
- fix typo
|
||||
- replace dependency url
|
||||
- Cargo.lock update
|
||||
- add some dos protection ([#8084](https://github.com/openethereum/openethereum/pull/8084))
|
||||
- revert removing blooms ([#8066](https://github.com/openethereum/openethereum/pull/8066))
|
||||
- Revert "fix traces, removed bloomchain crate, closes [#7228](https://github.com/openethereum/openethereum/issues/7228), closes [#7167](https://github.com/openethereum/openethereum/issues/7167)"
|
||||
- Revert "fixed broken logs ([#7934](https://github.com/openethereum/openethereum/pull/7934))"
|
||||
- add some dos protection ([#8084](https://github.com/paritytech/parity/pull/8084))
|
||||
- revert removing blooms ([#8066](https://github.com/paritytech/parity/pull/8066))
|
||||
- Revert "fix traces, removed bloomchain crate, closes [#7228](https://github.com/paritytech/parity/issues/7228), closes [#7167](https://github.com/paritytech/parity/issues/7167)"
|
||||
- Revert "fixed broken logs ([#7934](https://github.com/paritytech/parity/pull/7934))"
|
||||
- fixed broken logs
|
||||
- bring back old lock order
|
||||
- remove migration v13
|
||||
- revert CURRENT_VERSION to 12 in migration.rs
|
||||
- more dos protection ([#8104](https://github.com/openethereum/openethereum/pull/8104))
|
||||
- Const time comparison ([#8113](https://github.com/openethereum/openethereum/pull/8113))
|
||||
- more dos protection ([#8104](https://github.com/paritytech/parity/pull/8104))
|
||||
- Const time comparison ([#8113](https://github.com/paritytech/parity/pull/8113))
|
||||
- Use `subtle::slices_equal` for constant time comparison.
|
||||
- Also update the existing version of subtle in `ethcrypto` from 0.1 to 0.5
|
||||
- Test specifically for InvalidPassword error.
|
||||
- fix trace filter returning returning unrelated reward calls, closes #8070 ([#8098](https://github.com/openethereum/openethereum/pull/8098))
|
||||
- network: init discovery using healthy nodes ([#8061](https://github.com/openethereum/openethereum/pull/8061))
|
||||
- fix trace filter returning returning unrelated reward calls, closes #8070 ([#8098](https://github.com/paritytech/parity/pull/8098))
|
||||
- network: init discovery using healthy nodes ([#8061](https://github.com/paritytech/parity/pull/8061))
|
||||
- network: init discovery using healthy nodes
|
||||
- network: fix style grumble
|
||||
- network: fix typo
|
||||
- Postpone Kovan hard fork ([#8137](https://github.com/openethereum/openethereum/pull/8137))
|
||||
- Postpone Kovan hard fork ([#8137](https://github.com/paritytech/parity/pull/8137))
|
||||
- ethcore: postpone Kovan hard fork
|
||||
- util: update version fork metadata
|
||||
- Disable UI by default. ([#8105](https://github.com/openethereum/openethereum/pull/8105))
|
||||
- dapps: update parity-ui dependencies ([#8160](https://github.com/openethereum/openethereum/pull/8160))
|
||||
- Probe changes one step deeper ([#8134](https://github.com/openethereum/openethereum/pull/8134)) ([#8135](https://github.com/openethereum/openethereum/pull/8135))
|
||||
- Beta backports ([#8053](https://github.com/openethereum/openethereum/pull/8053))
|
||||
- CI: Fix cargo cache ([#7968](https://github.com/openethereum/openethereum/pull/7968))
|
||||
- Disable UI by default. ([#8105](https://github.com/paritytech/parity/pull/8105))
|
||||
- dapps: update parity-ui dependencies ([#8160](https://github.com/paritytech/parity/pull/8160))
|
||||
- Probe changes one step deeper ([#8134](https://github.com/paritytech/parity/pull/8134)) ([#8135](https://github.com/paritytech/parity/pull/8135))
|
||||
- Beta backports ([#8053](https://github.com/paritytech/parity/pull/8053))
|
||||
- CI: Fix cargo cache ([#7968](https://github.com/paritytech/parity/pull/7968))
|
||||
- Fix cache
|
||||
- Only clean locked cargo cache on windows
|
||||
- fixed ethstore sign ([#8026](https://github.com/openethereum/openethereum/pull/8026))
|
||||
- fixed parsing ethash seals and verify_block_undordered ([#8031](https://github.com/openethereum/openethereum/pull/8031))
|
||||
- fix for verify_block_basic crashing on invalid transaction rlp ([#8032](https://github.com/openethereum/openethereum/pull/8032))
|
||||
- fix cache & snapcraft CI build ([#8052](https://github.com/openethereum/openethereum/pull/8052))
|
||||
- Add MCIP-6 Byzyantium transition to Musicoin spec ([#7841](https://github.com/openethereum/openethereum/pull/7841))
|
||||
- fixed ethstore sign ([#8026](https://github.com/paritytech/parity/pull/8026))
|
||||
- fixed parsing ethash seals and verify_block_undordered ([#8031](https://github.com/paritytech/parity/pull/8031))
|
||||
- fix for verify_block_basic crashing on invalid transaction rlp ([#8032](https://github.com/paritytech/parity/pull/8032))
|
||||
- fix cache & snapcraft CI build ([#8052](https://github.com/paritytech/parity/pull/8052))
|
||||
- Add MCIP-6 Byzyantium transition to Musicoin spec ([#7841](https://github.com/paritytech/parity/pull/7841))
|
||||
- Add test chain spec for musicoin byzantium testnet
|
||||
- Add MCIP-6 Byzyantium transition to Musicoin spec
|
||||
- Update mcip6_byz.json
|
||||
@@ -363,96 +363,96 @@ The full list of included changes:
|
||||
- ethcore: update musicoin bootnodes
|
||||
- Update musicoin.json
|
||||
- More bootnodes.
|
||||
- Make 1.10 beta ([#8022](https://github.com/openethereum/openethereum/pull/8022))
|
||||
- Make 1.10 beta ([#8022](https://github.com/paritytech/parity/pull/8022))
|
||||
- Make 1.10 beta
|
||||
- Fix gitlab builds
|
||||
- SecretStore: secretstore_generateDocumentKey RPC ([#7864](https://github.com/openethereum/openethereum/pull/7864))
|
||||
- SecretStore: ECDSA session for cases when 2*t < N ([#7739](https://github.com/openethereum/openethereum/pull/7739))
|
||||
- bump tiny-keccak ([#8019](https://github.com/openethereum/openethereum/pull/8019))
|
||||
- Remove un-necessary comment ([#8014](https://github.com/openethereum/openethereum/pull/8014))
|
||||
- clean up account fmt::Debug ([#7983](https://github.com/openethereum/openethereum/pull/7983))
|
||||
- improve quality of vote_collector module ([#7984](https://github.com/openethereum/openethereum/pull/7984))
|
||||
- ExecutedBlock cleanup ([#7991](https://github.com/openethereum/openethereum/pull/7991))
|
||||
- Hardware-wallet/usb-subscribe-refactor ([#7860](https://github.com/openethereum/openethereum/pull/7860))
|
||||
- remove wildcard imports from views, make tests more idiomatic ([#7986](https://github.com/openethereum/openethereum/pull/7986))
|
||||
- moved PerfTimer to a separate crate - "trace-time" ([#7985](https://github.com/openethereum/openethereum/pull/7985))
|
||||
- clean up ethcore::spec module imports ([#7990](https://github.com/openethereum/openethereum/pull/7990))
|
||||
- rpc: don't include current block in new_block_filter ([#7982](https://github.com/openethereum/openethereum/pull/7982))
|
||||
- fix traces, removed bloomchain crate ([#7979](https://github.com/openethereum/openethereum/pull/7979))
|
||||
- simplify compression and move it out of rlp crate ([#7957](https://github.com/openethereum/openethereum/pull/7957))
|
||||
- removed old migrations ([#7974](https://github.com/openethereum/openethereum/pull/7974))
|
||||
- Reject too large packets in snapshot sync. ([#7977](https://github.com/openethereum/openethereum/pull/7977))
|
||||
- fixed broken logs ([#7934](https://github.com/openethereum/openethereum/pull/7934))
|
||||
- Increase max download limit to 128MB ([#7965](https://github.com/openethereum/openethereum/pull/7965))
|
||||
- Calculate proper keccak256/sha3 using parity. ([#7953](https://github.com/openethereum/openethereum/pull/7953))
|
||||
- Add changelog for 1.8.10 stable and 1.9.3 beta ([#7947](https://github.com/openethereum/openethereum/pull/7947))
|
||||
- kvdb-rocksdb: remove buffered operations when committing transaction ([#7950](https://github.com/openethereum/openethereum/pull/7950))
|
||||
- Bump WebSockets ([#7952](https://github.com/openethereum/openethereum/pull/7952))
|
||||
- removed redundant Bloom conversions ([#7932](https://github.com/openethereum/openethereum/pull/7932))
|
||||
- simplify RefInfo fmt ([#7929](https://github.com/openethereum/openethereum/pull/7929))
|
||||
- Kovan WASM fork code ([#7849](https://github.com/openethereum/openethereum/pull/7849))
|
||||
- bring back trie and triehash benches ([#7926](https://github.com/openethereum/openethereum/pull/7926))
|
||||
- removed redundant PodAccount::new method ([#7928](https://github.com/openethereum/openethereum/pull/7928))
|
||||
- removed dummy wrapper structure - LogGroupPosition ([#7922](https://github.com/openethereum/openethereum/pull/7922))
|
||||
- spec: Validate required divisor fields are not 0 ([#7933](https://github.com/openethereum/openethereum/pull/7933))
|
||||
- simplify Client::filter_traces method ([#7936](https://github.com/openethereum/openethereum/pull/7936))
|
||||
- gitlab cache ([#7921](https://github.com/openethereum/openethereum/pull/7921))
|
||||
- Fix a division by zero in light client RPC handler ([#7917](https://github.com/openethereum/openethereum/pull/7917))
|
||||
- triehash optimisations ([#7920](https://github.com/openethereum/openethereum/pull/7920))
|
||||
- removed redundant Blockchain::db method ([#7919](https://github.com/openethereum/openethereum/pull/7919))
|
||||
- removed redundant Blockchain::rewind method ([#7918](https://github.com/openethereum/openethereum/pull/7918))
|
||||
- Pending transactions subscription ([#7906](https://github.com/openethereum/openethereum/pull/7906))
|
||||
- removed redundant otry! macro from ethcore ([#7916](https://github.com/openethereum/openethereum/pull/7916))
|
||||
- Make block generator easier to use ([#7888](https://github.com/openethereum/openethereum/pull/7888))
|
||||
- ECIP 1041 - Remove Difficulty Bomb ([#7905](https://github.com/openethereum/openethereum/pull/7905))
|
||||
- Fix CSP for dapps that require eval. ([#7867](https://github.com/openethereum/openethereum/pull/7867))
|
||||
- Fix gitlab ([#7901](https://github.com/openethereum/openethereum/pull/7901))
|
||||
- Gitlb snap master patch ([#7900](https://github.com/openethereum/openethereum/pull/7900))
|
||||
- fix snap build master ([#7896](https://github.com/openethereum/openethereum/pull/7896))
|
||||
- Fix wallet import ([#7873](https://github.com/openethereum/openethereum/pull/7873))
|
||||
- Fix snapcraft nightly ([#7884](https://github.com/openethereum/openethereum/pull/7884))
|
||||
- Add a timeout for light client sync requests ([#7848](https://github.com/openethereum/openethereum/pull/7848))
|
||||
- SecretStore: fixed test ([#7878](https://github.com/openethereum/openethereum/pull/7878))
|
||||
- Fix checksums and auto-update push ([#7846](https://github.com/openethereum/openethereum/pull/7846))
|
||||
- Forward-port snap fixes ([#7831](https://github.com/openethereum/openethereum/pull/7831))
|
||||
- Update gitlab-test.sh ([#7883](https://github.com/openethereum/openethereum/pull/7883))
|
||||
- Fix installer binary names for macos and windows ([#7881](https://github.com/openethereum/openethereum/pull/7881))
|
||||
- Fix string typo: "develoopment" -> "development" ([#7874](https://github.com/openethereum/openethereum/pull/7874))
|
||||
- Update the instructions to install the stable snap ([#7876](https://github.com/openethereum/openethereum/pull/7876))
|
||||
- SecretStore: 'broadcast' decryption session ([#7843](https://github.com/openethereum/openethereum/pull/7843))
|
||||
- Flush keyfiles. Resolves #7632 ([#7868](https://github.com/openethereum/openethereum/pull/7868))
|
||||
- Read registry_address from given block ([#7866](https://github.com/openethereum/openethereum/pull/7866))
|
||||
- Clean up docs formatting for Wasm runtime ([#7869](https://github.com/openethereum/openethereum/pull/7869))
|
||||
- WASM: Disable internal memory ([#7842](https://github.com/openethereum/openethereum/pull/7842))
|
||||
- Update gitlab-build.sh ([#7855](https://github.com/openethereum/openethereum/pull/7855))
|
||||
- ethabi version 5 ([#7723](https://github.com/openethereum/openethereum/pull/7723))
|
||||
- Light client: randomize the peer we dispatch requests to ([#7844](https://github.com/openethereum/openethereum/pull/7844))
|
||||
- Store updater metadata in a single place ([#7832](https://github.com/openethereum/openethereum/pull/7832))
|
||||
- Add new EF ropstens nodes. ([#7824](https://github.com/openethereum/openethereum/pull/7824))
|
||||
- refactor stratum to remove retain cycle ([#7827](https://github.com/openethereum/openethereum/pull/7827))
|
||||
- Bump jsonrpc. ([#7828](https://github.com/openethereum/openethereum/pull/7828))
|
||||
- Add binary identifiers and sha256sum to builds ([#7830](https://github.com/openethereum/openethereum/pull/7830))
|
||||
- Update references to UI shell & wallet ([#7808](https://github.com/openethereum/openethereum/pull/7808))
|
||||
- Adjust storage update evm-style ([#7812](https://github.com/openethereum/openethereum/pull/7812))
|
||||
- Updated WASM Runtime & new interpreter (wasmi) ([#7796](https://github.com/openethereum/openethereum/pull/7796))
|
||||
- SecretStore: ignore removed authorities when running auto-migration ([#7674](https://github.com/openethereum/openethereum/pull/7674))
|
||||
- Fix build ([#7807](https://github.com/openethereum/openethereum/pull/7807))
|
||||
- Move js & js-old code to github.com/parity-js ([#7685](https://github.com/openethereum/openethereum/pull/7685))
|
||||
- More changelogs :) ([#7782](https://github.com/openethereum/openethereum/pull/7782))
|
||||
- Actualized API set in help ([#7790](https://github.com/openethereum/openethereum/pull/7790))
|
||||
- Removed obsolete file ([#7788](https://github.com/openethereum/openethereum/pull/7788))
|
||||
- Update ropsten bootnodes ([#7776](https://github.com/openethereum/openethereum/pull/7776))
|
||||
- CHANGELOG for 1.9.1 and 1.8.8 ([#7775](https://github.com/openethereum/openethereum/pull/7775))
|
||||
- Enable byzantium features on non-ethash chains ([#7753](https://github.com/openethereum/openethereum/pull/7753))
|
||||
- Fix client not being dropped on shutdown ([#7695](https://github.com/openethereum/openethereum/pull/7695))
|
||||
- Filter-out nodes.json ([#7716](https://github.com/openethereum/openethereum/pull/7716))
|
||||
- Removes redundant parentheses ([#7721](https://github.com/openethereum/openethereum/pull/7721))
|
||||
- Transaction-pool fixes ([#7741](https://github.com/openethereum/openethereum/pull/7741))
|
||||
- More visible download link in README.md ([#7707](https://github.com/openethereum/openethereum/pull/7707))
|
||||
- Changelog for 1.9.0 ([#7664](https://github.com/openethereum/openethereum/pull/7664))
|
||||
- Add scroll when too many accounts ([#7677](https://github.com/openethereum/openethereum/pull/7677))
|
||||
- SecretStore: return HTTP 403 (access denied) if consensus is unreachable ([#7656](https://github.com/openethereum/openethereum/pull/7656))
|
||||
- Moved StopGaurd to it's own crate ([#7635](https://github.com/openethereum/openethereum/pull/7635))
|
||||
- SecretStore: secretstore_generateDocumentKey RPC ([#7864](https://github.com/paritytech/parity/pull/7864))
|
||||
- SecretStore: ECDSA session for cases when 2*t < N ([#7739](https://github.com/paritytech/parity/pull/7739))
|
||||
- bump tiny-keccak ([#8019](https://github.com/paritytech/parity/pull/8019))
|
||||
- Remove un-necessary comment ([#8014](https://github.com/paritytech/parity/pull/8014))
|
||||
- clean up account fmt::Debug ([#7983](https://github.com/paritytech/parity/pull/7983))
|
||||
- improve quality of vote_collector module ([#7984](https://github.com/paritytech/parity/pull/7984))
|
||||
- ExecutedBlock cleanup ([#7991](https://github.com/paritytech/parity/pull/7991))
|
||||
- Hardware-wallet/usb-subscribe-refactor ([#7860](https://github.com/paritytech/parity/pull/7860))
|
||||
- remove wildcard imports from views, make tests more idiomatic ([#7986](https://github.com/paritytech/parity/pull/7986))
|
||||
- moved PerfTimer to a separate crate - "trace-time" ([#7985](https://github.com/paritytech/parity/pull/7985))
|
||||
- clean up ethcore::spec module imports ([#7990](https://github.com/paritytech/parity/pull/7990))
|
||||
- rpc: don't include current block in new_block_filter ([#7982](https://github.com/paritytech/parity/pull/7982))
|
||||
- fix traces, removed bloomchain crate ([#7979](https://github.com/paritytech/parity/pull/7979))
|
||||
- simplify compression and move it out of rlp crate ([#7957](https://github.com/paritytech/parity/pull/7957))
|
||||
- removed old migrations ([#7974](https://github.com/paritytech/parity/pull/7974))
|
||||
- Reject too large packets in snapshot sync. ([#7977](https://github.com/paritytech/parity/pull/7977))
|
||||
- fixed broken logs ([#7934](https://github.com/paritytech/parity/pull/7934))
|
||||
- Increase max download limit to 128MB ([#7965](https://github.com/paritytech/parity/pull/7965))
|
||||
- Calculate proper keccak256/sha3 using parity. ([#7953](https://github.com/paritytech/parity/pull/7953))
|
||||
- Add changelog for 1.8.10 stable and 1.9.3 beta ([#7947](https://github.com/paritytech/parity/pull/7947))
|
||||
- kvdb-rocksdb: remove buffered operations when committing transaction ([#7950](https://github.com/paritytech/parity/pull/7950))
|
||||
- Bump WebSockets ([#7952](https://github.com/paritytech/parity/pull/7952))
|
||||
- removed redundant Bloom conversions ([#7932](https://github.com/paritytech/parity/pull/7932))
|
||||
- simplify RefInfo fmt ([#7929](https://github.com/paritytech/parity/pull/7929))
|
||||
- Kovan WASM fork code ([#7849](https://github.com/paritytech/parity/pull/7849))
|
||||
- bring back trie and triehash benches ([#7926](https://github.com/paritytech/parity/pull/7926))
|
||||
- removed redundant PodAccount::new method ([#7928](https://github.com/paritytech/parity/pull/7928))
|
||||
- removed dummy wrapper structure - LogGroupPosition ([#7922](https://github.com/paritytech/parity/pull/7922))
|
||||
- spec: Validate required divisor fields are not 0 ([#7933](https://github.com/paritytech/parity/pull/7933))
|
||||
- simplify Client::filter_traces method ([#7936](https://github.com/paritytech/parity/pull/7936))
|
||||
- gitlab cache ([#7921](https://github.com/paritytech/parity/pull/7921))
|
||||
- Fix a division by zero in light client RPC handler ([#7917](https://github.com/paritytech/parity/pull/7917))
|
||||
- triehash optimisations ([#7920](https://github.com/paritytech/parity/pull/7920))
|
||||
- removed redundant Blockchain::db method ([#7919](https://github.com/paritytech/parity/pull/7919))
|
||||
- removed redundant Blockchain::rewind method ([#7918](https://github.com/paritytech/parity/pull/7918))
|
||||
- Pending transactions subscription ([#7906](https://github.com/paritytech/parity/pull/7906))
|
||||
- removed redundant otry! macro from ethcore ([#7916](https://github.com/paritytech/parity/pull/7916))
|
||||
- Make block generator easier to use ([#7888](https://github.com/paritytech/parity/pull/7888))
|
||||
- ECIP 1041 - Remove Difficulty Bomb ([#7905](https://github.com/paritytech/parity/pull/7905))
|
||||
- Fix CSP for dapps that require eval. ([#7867](https://github.com/paritytech/parity/pull/7867))
|
||||
- Fix gitlab ([#7901](https://github.com/paritytech/parity/pull/7901))
|
||||
- Gitlb snap master patch ([#7900](https://github.com/paritytech/parity/pull/7900))
|
||||
- fix snap build master ([#7896](https://github.com/paritytech/parity/pull/7896))
|
||||
- Fix wallet import ([#7873](https://github.com/paritytech/parity/pull/7873))
|
||||
- Fix snapcraft nightly ([#7884](https://github.com/paritytech/parity/pull/7884))
|
||||
- Add a timeout for light client sync requests ([#7848](https://github.com/paritytech/parity/pull/7848))
|
||||
- SecretStore: fixed test ([#7878](https://github.com/paritytech/parity/pull/7878))
|
||||
- Fix checksums and auto-update push ([#7846](https://github.com/paritytech/parity/pull/7846))
|
||||
- Forward-port snap fixes ([#7831](https://github.com/paritytech/parity/pull/7831))
|
||||
- Update gitlab-test.sh ([#7883](https://github.com/paritytech/parity/pull/7883))
|
||||
- Fix installer binary names for macos and windows ([#7881](https://github.com/paritytech/parity/pull/7881))
|
||||
- Fix string typo: "develoopment" -> "development" ([#7874](https://github.com/paritytech/parity/pull/7874))
|
||||
- Update the instructions to install the stable snap ([#7876](https://github.com/paritytech/parity/pull/7876))
|
||||
- SecretStore: 'broadcast' decryption session ([#7843](https://github.com/paritytech/parity/pull/7843))
|
||||
- Flush keyfiles. Resolves #7632 ([#7868](https://github.com/paritytech/parity/pull/7868))
|
||||
- Read registry_address from given block ([#7866](https://github.com/paritytech/parity/pull/7866))
|
||||
- Clean up docs formatting for Wasm runtime ([#7869](https://github.com/paritytech/parity/pull/7869))
|
||||
- WASM: Disable internal memory ([#7842](https://github.com/paritytech/parity/pull/7842))
|
||||
- Update gitlab-build.sh ([#7855](https://github.com/paritytech/parity/pull/7855))
|
||||
- ethabi version 5 ([#7723](https://github.com/paritytech/parity/pull/7723))
|
||||
- Light client: randomize the peer we dispatch requests to ([#7844](https://github.com/paritytech/parity/pull/7844))
|
||||
- Store updater metadata in a single place ([#7832](https://github.com/paritytech/parity/pull/7832))
|
||||
- Add new EF ropstens nodes. ([#7824](https://github.com/paritytech/parity/pull/7824))
|
||||
- refactor stratum to remove retain cycle ([#7827](https://github.com/paritytech/parity/pull/7827))
|
||||
- Bump jsonrpc. ([#7828](https://github.com/paritytech/parity/pull/7828))
|
||||
- Add binary identifiers and sha256sum to builds ([#7830](https://github.com/paritytech/parity/pull/7830))
|
||||
- Update references to UI shell & wallet ([#7808](https://github.com/paritytech/parity/pull/7808))
|
||||
- Adjust storage update evm-style ([#7812](https://github.com/paritytech/parity/pull/7812))
|
||||
- Updated WASM Runtime & new interpreter (wasmi) ([#7796](https://github.com/paritytech/parity/pull/7796))
|
||||
- SecretStore: ignore removed authorities when running auto-migration ([#7674](https://github.com/paritytech/parity/pull/7674))
|
||||
- Fix build ([#7807](https://github.com/paritytech/parity/pull/7807))
|
||||
- Move js & js-old code to github.com/parity-js ([#7685](https://github.com/paritytech/parity/pull/7685))
|
||||
- More changelogs :) ([#7782](https://github.com/paritytech/parity/pull/7782))
|
||||
- Actualized API set in help ([#7790](https://github.com/paritytech/parity/pull/7790))
|
||||
- Removed obsolete file ([#7788](https://github.com/paritytech/parity/pull/7788))
|
||||
- Update ropsten bootnodes ([#7776](https://github.com/paritytech/parity/pull/7776))
|
||||
- CHANGELOG for 1.9.1 and 1.8.8 ([#7775](https://github.com/paritytech/parity/pull/7775))
|
||||
- Enable byzantium features on non-ethash chains ([#7753](https://github.com/paritytech/parity/pull/7753))
|
||||
- Fix client not being dropped on shutdown ([#7695](https://github.com/paritytech/parity/pull/7695))
|
||||
- Filter-out nodes.json ([#7716](https://github.com/paritytech/parity/pull/7716))
|
||||
- Removes redundant parentheses ([#7721](https://github.com/paritytech/parity/pull/7721))
|
||||
- Transaction-pool fixes ([#7741](https://github.com/paritytech/parity/pull/7741))
|
||||
- More visible download link in README.md ([#7707](https://github.com/paritytech/parity/pull/7707))
|
||||
- Changelog for 1.9.0 ([#7664](https://github.com/paritytech/parity/pull/7664))
|
||||
- Add scroll when too many accounts ([#7677](https://github.com/paritytech/parity/pull/7677))
|
||||
- SecretStore: return HTTP 403 (access denied) if consensus is unreachable ([#7656](https://github.com/paritytech/parity/pull/7656))
|
||||
- Moved StopGaurd to it's own crate ([#7635](https://github.com/paritytech/parity/pull/7635))
|
||||
|
||||
## Previous releases
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,14 +1,14 @@
|
||||
Note: Parity 1.2 reached End-of-Life on 2016-11-07 (EOL).
|
||||
|
||||
## Parity [v1.2.4](https://github.com/openethereum/openethereum/releases/tag/v1.2.4) (2016-08-09)
|
||||
## Parity [v1.2.4](https://github.com/paritytech/parity/releases/tag/v1.2.4) (2016-08-09)
|
||||
|
||||
Parity 1.2.4 Is a maintenance release that fixes a [few](https://github.com/openethereum/openethereum/pull/1888/commits) issues related to mining and peer synchronization.
|
||||
Parity 1.2.4 Is a maintenance release that fixes a [few](https://github.com/paritytech/parity/pull/1888/commits) issues related to mining and peer synchronization.
|
||||
This release is marked as stable.
|
||||
|
||||
- Backports for beta [#1888](https://github.com/openethereum/openethereum/pull/1888)
|
||||
- BETA: fixed trace_transaction crash when block contained suicide [#1782](https://github.com/openethereum/openethereum/pull/1782)
|
||||
- Backports for beta [#1888](https://github.com/paritytech/parity/pull/1888)
|
||||
- BETA: fixed trace_transaction crash when block contained suicide [#1782](https://github.com/paritytech/parity/pull/1782)
|
||||
|
||||
## Parity [v1.2.3](https://github.com/openethereum/openethereum/releases/tag/v1.2.3) (2016-07-31)
|
||||
## Parity [v1.2.3](https://github.com/paritytech/parity/releases/tag/v1.2.3) (2016-07-31)
|
||||
|
||||
Parity 1.2.3 is a patch release that addresses network stability issues for both Ethereum HF and Ethereum classic chains and brings a few changes to the transaction tracing API.
|
||||
|
||||
@@ -19,14 +19,14 @@ Parity 1.2.3 is a patch release that addresses network stability issues for both
|
||||
|
||||
Note that to continue using tracing features in this version you need to re-sync the blockchain. This can be done by using `parity export $HOME/ethereum-chain-backup.rlp` , deleting the database usually located at `~/.parity/906a34e69aec8c0d` followed by `parity import $HOME/ethereum-chain-backup.rlp`.
|
||||
|
||||
- [beta] Updating UI [#1778](https://github.com/openethereum/openethereum/pull/1778)
|
||||
- tracing backport [#1770](https://github.com/openethereum/openethereum/pull/1770)
|
||||
- Backport commits to beta [#1763](https://github.com/openethereum/openethereum/pull/1763)
|
||||
- Deadlock on incoming connection (#1672) [#1675](https://github.com/openethereum/openethereum/pull/1675)
|
||||
- [BETA] Removed DAO soft fork traces [#1640](https://github.com/openethereum/openethereum/pull/1640)
|
||||
- [beta] Updating UI [#1778](https://github.com/paritytech/parity/pull/1778)
|
||||
- tracing backport [#1770](https://github.com/paritytech/parity/pull/1770)
|
||||
- Backport commits to beta [#1763](https://github.com/paritytech/parity/pull/1763)
|
||||
- Deadlock on incoming connection (#1672) [#1675](https://github.com/paritytech/parity/pull/1675)
|
||||
- [BETA] Removed DAO soft fork traces [#1640](https://github.com/paritytech/parity/pull/1640)
|
||||
|
||||
|
||||
## Parity [v1.2.2](https://github.com/openethereum/openethereum/releases/tag/v1.2.2) (2016-07-16)
|
||||
## Parity [v1.2.2](https://github.com/paritytech/parity/releases/tag/v1.2.2) (2016-07-16)
|
||||
|
||||
#### New
|
||||
- DAO hard-fork.
|
||||
@@ -47,17 +47,17 @@ DAO hard-fork implementation conforms to the [specification](https://blog.slock.
|
||||
|
||||
Full changelog
|
||||
|
||||
- DAO hard-fork (#1483) [#1636](https://github.com/openethereum/openethereum/pull/1636)
|
||||
- Backports for beta [#1628](https://github.com/openethereum/openethereum/pull/1628)
|
||||
- don't batch best block for branches (#1623) [#1626](https://github.com/openethereum/openethereum/pull/1626)
|
||||
- Merge bugfixes from master to beta [#1605](https://github.com/openethereum/openethereum/pull/1605)
|
||||
- (BETA) using block options cache instead of general cache for rocksdb [#1613](https://github.com/openethereum/openethereum/pull/1613)
|
||||
- Backport sealing fixes to beta [#1583](https://github.com/openethereum/openethereum/pull/1583)
|
||||
- v1.2.2 in beta [#1581](https://github.com/openethereum/openethereum/pull/1581)
|
||||
- Skipping transactions with invalid nonces when pushing to block. (#1545) [#1547](https://github.com/openethereum/openethereum/pull/1547)
|
||||
- DAO hard-fork (#1483) [#1636](https://github.com/paritytech/parity/pull/1636)
|
||||
- Backports for beta [#1628](https://github.com/paritytech/parity/pull/1628)
|
||||
- don't batch best block for branches (#1623) [#1626](https://github.com/paritytech/parity/pull/1626)
|
||||
- Merge bugfixes from master to beta [#1605](https://github.com/paritytech/parity/pull/1605)
|
||||
- (BETA) using block options cache instead of general cache for rocksdb [#1613](https://github.com/paritytech/parity/pull/1613)
|
||||
- Backport sealing fixes to beta [#1583](https://github.com/paritytech/parity/pull/1583)
|
||||
- v1.2.2 in beta [#1581](https://github.com/paritytech/parity/pull/1581)
|
||||
- Skipping transactions with invalid nonces when pushing to block. (#1545) [#1547](https://github.com/paritytech/parity/pull/1547)
|
||||
|
||||
|
||||
## Parity [v1.2.1](https://github.com/openethereum/openethereum/releases/tag/v1.2.1) (2016-07-01)
|
||||
## Parity [v1.2.1](https://github.com/paritytech/parity/releases/tag/v1.2.1) (2016-07-01)
|
||||
|
||||
#### New
|
||||
- Options for more precise mining tuning (see below).
|
||||
@@ -86,10 +86,10 @@ DAO soft-fork control options have been replaced by the single `--fork` option w
|
||||
|
||||
#### Changes
|
||||
|
||||
- v1.2.1 in beta [#1492](https://github.com/openethereum/openethereum/pull/1492)
|
||||
- (BETA) add artifacts [#1420](https://github.com/openethereum/openethereum/pull/1420)
|
||||
- v1.2.1 in beta [#1492](https://github.com/paritytech/parity/pull/1492)
|
||||
- (BETA) add artifacts [#1420](https://github.com/paritytech/parity/pull/1420)
|
||||
|
||||
## Parity [v1.2.0: "Security"](https://github.com/openethereum/openethereum/releases/tag/v1.2.0) (2016-06-24)
|
||||
## Parity [v1.2.0: "Security"](https://github.com/paritytech/parity/releases/tag/v1.2.0) (2016-06-24)
|
||||
|
||||
[Blog post](https://blog.parity.io/announcing-parity-1-2/)
|
||||
|
||||
@@ -139,238 +139,238 @@ By default, nodes vote "for" the DAO soft-fork (and try to reduce the gas limit
|
||||
|
||||
Full changes:
|
||||
|
||||
- Signer enabled by default for UI [#1417](https://github.com/openethereum/openethereum/pull/1417)
|
||||
- Remove experimental pruning options. [#1415](https://github.com/openethereum/openethereum/pull/1415)
|
||||
- Fixing interface and port for parity ui [#1414](https://github.com/openethereum/openethereum/pull/1414)
|
||||
- Configurable gas limit cap. [#1405](https://github.com/openethereum/openethereum/pull/1405)
|
||||
- Bumping TopBar, Minimal SignerUI and wallet [#1413](https://github.com/openethereum/openethereum/pull/1413)
|
||||
- Sync: Update highest block for progress reporting [#1411](https://github.com/openethereum/openethereum/pull/1411)
|
||||
- Tweaked CLI options for the release [#1407](https://github.com/openethereum/openethereum/pull/1407)
|
||||
- Further rocksdb tuning [#1409](https://github.com/openethereum/openethereum/pull/1409)
|
||||
- Fixing jit compilation [#1406](https://github.com/openethereum/openethereum/pull/1406)
|
||||
- Bump clippy [#1403](https://github.com/openethereum/openethereum/pull/1403)
|
||||
- Shortcut SF condition when canon known [#1401](https://github.com/openethereum/openethereum/pull/1401)
|
||||
- Additional assertions for internal state of queue [#1402](https://github.com/openethereum/openethereum/pull/1402)
|
||||
- Replace deprecated hashdb trait names [#1394](https://github.com/openethereum/openethereum/pull/1394)
|
||||
- rpc api by default for ipc [#1400](https://github.com/openethereum/openethereum/pull/1400)
|
||||
- Ensure judging the SF trigger by relative branch [#1399](https://github.com/openethereum/openethereum/pull/1399)
|
||||
- Signer with unlocked account working as expected. [#1398](https://github.com/openethereum/openethereum/pull/1398)
|
||||
- Make --signer default. [#1392](https://github.com/openethereum/openethereum/pull/1392)
|
||||
- Presale wallet [#1376](https://github.com/openethereum/openethereum/pull/1376)
|
||||
- Removing signer connection limit [#1396](https://github.com/openethereum/openethereum/pull/1396)
|
||||
- Optional gas price in transactions come from statistics [#1388](https://github.com/openethereum/openethereum/pull/1388)
|
||||
- Update README.md with cargo install [ci-skip] [#1389](https://github.com/openethereum/openethereum/pull/1389)
|
||||
- Fixing possible overflow during multiplication [#1381](https://github.com/openethereum/openethereum/pull/1381)
|
||||
- Update SF to latest spec [#1386](https://github.com/openethereum/openethereum/pull/1386)
|
||||
- Sync optimization [#1385](https://github.com/openethereum/openethereum/pull/1385)
|
||||
- Fixing order of if statements to avoid overflows. [#1384](https://github.com/openethereum/openethereum/pull/1384)
|
||||
- New topbar & signer UI [#1383](https://github.com/openethereum/openethereum/pull/1383)
|
||||
- Install trigger for DAO-rescue soft-fork. [#1329](https://github.com/openethereum/openethereum/pull/1329)
|
||||
- Rocksdb flush/compact limit [#1375](https://github.com/openethereum/openethereum/pull/1375)
|
||||
- CentOS Dockerfile [#1377](https://github.com/openethereum/openethereum/pull/1377)
|
||||
- RPC method to return number of unconfirmed transactions... [#1371](https://github.com/openethereum/openethereum/pull/1371)
|
||||
- bump jsonrpc-http-server [#1369](https://github.com/openethereum/openethereum/pull/1369)
|
||||
- Fix lock order when updating sealing [#1364](https://github.com/openethereum/openethereum/pull/1364)
|
||||
- Update sealing on new transactions [#1365](https://github.com/openethereum/openethereum/pull/1365)
|
||||
- Fixed panic on aborted connection [#1370](https://github.com/openethereum/openethereum/pull/1370)
|
||||
- importing presale wallet [#1368](https://github.com/openethereum/openethereum/pull/1368)
|
||||
- Set default database file size large enough [#1363](https://github.com/openethereum/openethereum/pull/1363)
|
||||
- Reserved peers rpc API [#1360](https://github.com/openethereum/openethereum/pull/1360)
|
||||
- Fixing replacing transaction with lower gas_price result. [#1343](https://github.com/openethereum/openethereum/pull/1343)
|
||||
- fixed migration of empty pruning dir [#1362](https://github.com/openethereum/openethereum/pull/1362)
|
||||
- Transaction processing queue [#1335](https://github.com/openethereum/openethereum/pull/1335)
|
||||
- Fixing last nonce values in case transaction is replaced [#1359](https://github.com/openethereum/openethereum/pull/1359)
|
||||
- docopt is an optional dependency of ethkey and ethstore [#1358](https://github.com/openethereum/openethereum/pull/1358)
|
||||
- Fixing clippy warnings [#1354](https://github.com/openethereum/openethereum/pull/1354)
|
||||
- Reduce locking when syncing [#1357](https://github.com/openethereum/openethereum/pull/1357)
|
||||
- removed unnecessary logs [#1356](https://github.com/openethereum/openethereum/pull/1356)
|
||||
- Updating parity-dapps [#1353](https://github.com/openethereum/openethereum/pull/1353)
|
||||
- moved keystore tests files from util to ethstore [#1352](https://github.com/openethereum/openethereum/pull/1352)
|
||||
- removed redundant bigint deps [#1351](https://github.com/openethereum/openethereum/pull/1351)
|
||||
- Reopen "reserved peers and reserved-only flag" [#1350](https://github.com/openethereum/openethereum/pull/1350)
|
||||
- Configurable rocksdb cache size [#1348](https://github.com/openethereum/openethereum/pull/1348)
|
||||
- Fixing future order and errors when reaching limit. [#1346](https://github.com/openethereum/openethereum/pull/1346)
|
||||
- Removing priority on local transactions [#1342](https://github.com/openethereum/openethereum/pull/1342)
|
||||
- Revert "Reserved peers, reserved-only flag" [#1349](https://github.com/openethereum/openethereum/pull/1349)
|
||||
- Sync attack defense: Deactivate peers on invalid block bodies [#1345](https://github.com/openethereum/openethereum/pull/1345)
|
||||
- Reserved peers, reserved-only flag [#1347](https://github.com/openethereum/openethereum/pull/1347)
|
||||
- CI for ethkey and ethstore [#1341](https://github.com/openethereum/openethereum/pull/1341)
|
||||
- Fixed empty block body composition [#1340](https://github.com/openethereum/openethereum/pull/1340)
|
||||
- Provide a signer UI token by default. [#1334](https://github.com/openethereum/openethereum/pull/1334)
|
||||
- docker uses rustup, fixes #1337 [#1344](https://github.com/openethereum/openethereum/pull/1344)
|
||||
- Fixed network service dispose [#1339](https://github.com/openethereum/openethereum/pull/1339)
|
||||
- Sync: Cache last sync round block parents [#1331](https://github.com/openethereum/openethereum/pull/1331)
|
||||
- secret store separated from util [#1304](https://github.com/openethereum/openethereum/pull/1304)
|
||||
- --geth prevent getTransactionReceipt from using pending. [#1325](https://github.com/openethereum/openethereum/pull/1325)
|
||||
- Fixing locks order in miner. [#1328](https://github.com/openethereum/openethereum/pull/1328)
|
||||
- Update default gas limit, rename field [#1324](https://github.com/openethereum/openethereum/pull/1324)
|
||||
- Use constants for DatabaseConfig [#1318](https://github.com/openethereum/openethereum/pull/1318)
|
||||
- Fixing clippy warnings [#1321](https://github.com/openethereum/openethereum/pull/1321)
|
||||
- Bumping topbar. Fixing ws server closing when suspending [#1312](https://github.com/openethereum/openethereum/pull/1312)
|
||||
- Syncing fix [#1320](https://github.com/openethereum/openethereum/pull/1320)
|
||||
- Filling-in optional fields of TransactionRequest... [#1305](https://github.com/openethereum/openethereum/pull/1305)
|
||||
- Removing MakerOTC and DAO dapps [#1319](https://github.com/openethereum/openethereum/pull/1319)
|
||||
- Disabling ethcore_set* APIs by default (+ Status page update) [#1315](https://github.com/openethereum/openethereum/pull/1315)
|
||||
- fixed #1180 [#1282](https://github.com/openethereum/openethereum/pull/1282)
|
||||
- Network start/stop [#1313](https://github.com/openethereum/openethereum/pull/1313)
|
||||
- Additional logging for own transactions in queue [#1311](https://github.com/openethereum/openethereum/pull/1311)
|
||||
- DAO Rescue soft fork [#1309](https://github.com/openethereum/openethereum/pull/1309)
|
||||
- Appveyor config for windows build+installer [#1302](https://github.com/openethereum/openethereum/pull/1302)
|
||||
- Key load avoid warning [#1303](https://github.com/openethereum/openethereum/pull/1303)
|
||||
- More meaningful errors when sending transaction [#1290](https://github.com/openethereum/openethereum/pull/1290)
|
||||
- Gas price statistics. [#1291](https://github.com/openethereum/openethereum/pull/1291)
|
||||
- Fix read-ahead bug. [#1298](https://github.com/openethereum/openethereum/pull/1298)
|
||||
- firewall rules for windows installer [#1297](https://github.com/openethereum/openethereum/pull/1297)
|
||||
- x64 program files path for installer [#1296](https://github.com/openethereum/openethereum/pull/1296)
|
||||
- Fixed loosing peers on incoming connections. [#1293](https://github.com/openethereum/openethereum/pull/1293)
|
||||
- fixed #1261, overflow when calculating work [#1283](https://github.com/openethereum/openethereum/pull/1283)
|
||||
- snappy and minor block compression [#1286](https://github.com/openethereum/openethereum/pull/1286)
|
||||
- clarify build instructions [#1287](https://github.com/openethereum/openethereum/pull/1287)
|
||||
- fixed #1255 [#1280](https://github.com/openethereum/openethereum/pull/1280)
|
||||
- bump rust-crypto [#1289](https://github.com/openethereum/openethereum/pull/1289)
|
||||
- Security audit issues fixed [#1279](https://github.com/openethereum/openethereum/pull/1279)
|
||||
- Fixing origin/host validation [#1273](https://github.com/openethereum/openethereum/pull/1273)
|
||||
- windows installer + parity start ui cli option [#1284](https://github.com/openethereum/openethereum/pull/1284)
|
||||
- ipc lib version bump [#1285](https://github.com/openethereum/openethereum/pull/1285)
|
||||
- Syncing improvements [#1274](https://github.com/openethereum/openethereum/pull/1274)
|
||||
- removed redundant if condition [#1270](https://github.com/openethereum/openethereum/pull/1270)
|
||||
- Naive chunk creation, snapshotting [#1263](https://github.com/openethereum/openethereum/pull/1263)
|
||||
- Fixing generating new token while another parity instance is running. [#1272](https://github.com/openethereum/openethereum/pull/1272)
|
||||
- README: rustup and windows instructions [#1266](https://github.com/openethereum/openethereum/pull/1266)
|
||||
- Windows build [#1253](https://github.com/openethereum/openethereum/pull/1253)
|
||||
- removed try_seal from MiningBlockChainClient [#1262](https://github.com/openethereum/openethereum/pull/1262)
|
||||
- simplified block opening [#1232](https://github.com/openethereum/openethereum/pull/1232)
|
||||
- Clippy bump [#1259](https://github.com/openethereum/openethereum/pull/1259)
|
||||
- Fixing uint ASM macros compilation [#1258](https://github.com/openethereum/openethereum/pull/1258)
|
||||
- Signer port returned from RPC + Topbar showing count of unconfirmed transactions. [#1252](https://github.com/openethereum/openethereum/pull/1252)
|
||||
- codegen - avoid unwraps leading to compilation crash [#1250](https://github.com/openethereum/openethereum/pull/1250)
|
||||
- Dapps bump [#1257](https://github.com/openethereum/openethereum/pull/1257)
|
||||
- Windows named pipes [#1254](https://github.com/openethereum/openethereum/pull/1254)
|
||||
- remove unsafety from util/hash.rs and util/bigint/uint.rs [#1236](https://github.com/openethereum/openethereum/pull/1236)
|
||||
- Fixing CORS settings for special values: * & null. [#1247](https://github.com/openethereum/openethereum/pull/1247)
|
||||
- JSONRPC test strings avoid using \ char [#1246](https://github.com/openethereum/openethereum/pull/1246)
|
||||
- Tests for JSON serialisation of statediff/vmtrace [#1241](https://github.com/openethereum/openethereum/pull/1241)
|
||||
- Bumping Dapps & TopBar to newest version. [#1245](https://github.com/openethereum/openethereum/pull/1245)
|
||||
- keys import [#1240](https://github.com/openethereum/openethereum/pull/1240)
|
||||
- Splitting RPC Apis into more fine-grained sets [#1234](https://github.com/openethereum/openethereum/pull/1234)
|
||||
- Refactor triedb constructors to error on invalid state root [#1230](https://github.com/openethereum/openethereum/pull/1230)
|
||||
- Signer RPC method to check if signer is enabled [#1238](https://github.com/openethereum/openethereum/pull/1238)
|
||||
- Fixing signer behaviour when confirming transaction with wrong password. [#1237](https://github.com/openethereum/openethereum/pull/1237)
|
||||
- SystemUIs authorization [#1233](https://github.com/openethereum/openethereum/pull/1233)
|
||||
- IPC path for tesetnet with --geth compatibility [#1231](https://github.com/openethereum/openethereum/pull/1231)
|
||||
- Transaction tracing for eth_call [#1210](https://github.com/openethereum/openethereum/pull/1210)
|
||||
- Removing compilation warnings [#1227](https://github.com/openethereum/openethereum/pull/1227)
|
||||
- Allowing connections only from chrome-extension and self-hosted client [#1226](https://github.com/openethereum/openethereum/pull/1226)
|
||||
- Clippy bump & fixing warnings [#1219](https://github.com/openethereum/openethereum/pull/1219)
|
||||
- Bumping serde & syntex [#1216](https://github.com/openethereum/openethereum/pull/1216)
|
||||
- Minimal Signer UI (System UI) exposed over websockets. [#1211](https://github.com/openethereum/openethereum/pull/1211)
|
||||
- Switch RPC namespace form ethcore_ to trace_ [#1208](https://github.com/openethereum/openethereum/pull/1208)
|
||||
- Verify the state root exists before creating a State [#1217](https://github.com/openethereum/openethereum/pull/1217)
|
||||
- Integrate state diffing into the ethcore JSONRPC [#1206](https://github.com/openethereum/openethereum/pull/1206)
|
||||
- Updating topbar to latest version [#1220](https://github.com/openethereum/openethereum/pull/1220)
|
||||
- Loading local Dapps from FS. [#1214](https://github.com/openethereum/openethereum/pull/1214)
|
||||
- Ipc serialization & protocol fixes [#1188](https://github.com/openethereum/openethereum/pull/1188)
|
||||
- Have Ext::ret take self by value [#1187](https://github.com/openethereum/openethereum/pull/1187)
|
||||
- Simple WebSockets notification about new request [#1202](https://github.com/openethereum/openethereum/pull/1202)
|
||||
- Removing leftovers of ethminer [#1207](https://github.com/openethereum/openethereum/pull/1207)
|
||||
- fixed #1204 [#1205](https://github.com/openethereum/openethereum/pull/1205)
|
||||
- VM tracing and JSON RPC endpoint for it. [#1169](https://github.com/openethereum/openethereum/pull/1169)
|
||||
- devtools helpers extended [#1186](https://github.com/openethereum/openethereum/pull/1186)
|
||||
- Networking refactoring [#1172](https://github.com/openethereum/openethereum/pull/1172)
|
||||
- Client & Miner refactoring [#1195](https://github.com/openethereum/openethereum/pull/1195)
|
||||
- update readme [#1201](https://github.com/openethereum/openethereum/pull/1201)
|
||||
- Simple signing queue, confirmation APIs exposed in signer WebSockets. [#1182](https://github.com/openethereum/openethereum/pull/1182)
|
||||
- Using ordered hashmap to keep the order of dapps on home screen [#1199](https://github.com/openethereum/openethereum/pull/1199)
|
||||
- Disabling `ethcore` by default, adding x-frame-options header to dapps. [#1197](https://github.com/openethereum/openethereum/pull/1197)
|
||||
- transaction count verifier tests [#1196](https://github.com/openethereum/openethereum/pull/1196)
|
||||
- expunge x! and xx! from the codebase [#1192](https://github.com/openethereum/openethereum/pull/1192)
|
||||
- Database service upgrade (from the ipc branch) [#1185](https://github.com/openethereum/openethereum/pull/1185)
|
||||
- stop eth_syncing from returning true forever [#1181](https://github.com/openethereum/openethereum/pull/1181)
|
||||
- Sync fixes and tweaks [#1164](https://github.com/openethereum/openethereum/pull/1164)
|
||||
- Exposing RPC over Signer WebSockets [#1167](https://github.com/openethereum/openethereum/pull/1167)
|
||||
- implement missing rpc methods and tests [#1171](https://github.com/openethereum/openethereum/pull/1171)
|
||||
- json ipc server version bump [#1170](https://github.com/openethereum/openethereum/pull/1170)
|
||||
- Updated dependencies for windows build [#1173](https://github.com/openethereum/openethereum/pull/1173)
|
||||
- Framework for improved RPC unit tests [#1141](https://github.com/openethereum/openethereum/pull/1141)
|
||||
- remove all possible unsafe code in crypto [#1168](https://github.com/openethereum/openethereum/pull/1168)
|
||||
- Base for Signer Websockets server [#1158](https://github.com/openethereum/openethereum/pull/1158)
|
||||
- Write queue to speed-up db ipc [#1160](https://github.com/openethereum/openethereum/pull/1160)
|
||||
- Fixing few clippy warnings [#1163](https://github.com/openethereum/openethereum/pull/1163)
|
||||
- Change eth_signAndSendTransaction to personal_SignAndSendTransaction [#1154](https://github.com/openethereum/openethereum/pull/1154)
|
||||
- Support "earliest" and specific block parameters in RPC where possible [#1149](https://github.com/openethereum/openethereum/pull/1149)
|
||||
- migration fixes [#1155](https://github.com/openethereum/openethereum/pull/1155)
|
||||
- Empty trusted signer crate with it's general purpose described. [#1150](https://github.com/openethereum/openethereum/pull/1150)
|
||||
- More bootnodes for morden. [#1153](https://github.com/openethereum/openethereum/pull/1153)
|
||||
- move existing rpc tests into mocked module [#1151](https://github.com/openethereum/openethereum/pull/1151)
|
||||
- Bloomchain [#1014](https://github.com/openethereum/openethereum/pull/1014)
|
||||
- Renaming dapps repos. Updating dapps [#1142](https://github.com/openethereum/openethereum/pull/1142)
|
||||
- fixed pending transactions [#1147](https://github.com/openethereum/openethereum/pull/1147)
|
||||
- Basic benches to provide metrics for ipc optimizations [#1145](https://github.com/openethereum/openethereum/pull/1145)
|
||||
- Fixing clippy warnings [#1148](https://github.com/openethereum/openethereum/pull/1148)
|
||||
- correct signature of SecTrieDB::raw_mut [#1143](https://github.com/openethereum/openethereum/pull/1143)
|
||||
- Merge to master and start hypervisor for import/export [#1138](https://github.com/openethereum/openethereum/pull/1138)
|
||||
- Bumping clippy. Fixing warnings [#1139](https://github.com/openethereum/openethereum/pull/1139)
|
||||
- Display progress when importing [#1136](https://github.com/openethereum/openethereum/pull/1136)
|
||||
- foundation of simple db migration [#1128](https://github.com/openethereum/openethereum/pull/1128)
|
||||
- Fixpending [#1074](https://github.com/openethereum/openethereum/pull/1074)
|
||||
- Sync: Propagate uncles and fix status reporting [#1134](https://github.com/openethereum/openethereum/pull/1134)
|
||||
- Coloured, padding logging. [#1133](https://github.com/openethereum/openethereum/pull/1133)
|
||||
- Importing [#1132](https://github.com/openethereum/openethereum/pull/1132)
|
||||
- Have `die_with_error` use `fmt::Display` rather than Debug [#1116](https://github.com/openethereum/openethereum/pull/1116)
|
||||
- Exporting [#1129](https://github.com/openethereum/openethereum/pull/1129)
|
||||
- Sign and send transaction [#1124](https://github.com/openethereum/openethereum/pull/1124)
|
||||
- Fixing unused imports warnings [#1125](https://github.com/openethereum/openethereum/pull/1125)
|
||||
- Adding info messages on mined blocks [#1127](https://github.com/openethereum/openethereum/pull/1127)
|
||||
- Fix styling - don't mix spaces with tabs!!! [#1123](https://github.com/openethereum/openethereum/pull/1123)
|
||||
- Fix is_syncing so it's false as long as the update is trivial. [#1122](https://github.com/openethereum/openethereum/pull/1122)
|
||||
- Relock unlocked accounts after first use [#1120](https://github.com/openethereum/openethereum/pull/1120)
|
||||
- Avoid importing keys into wrong place. [#1119](https://github.com/openethereum/openethereum/pull/1119)
|
||||
- Implement receipt's gasUsed field [#1118](https://github.com/openethereum/openethereum/pull/1118)
|
||||
- New dapps & query parameter handling [#1113](https://github.com/openethereum/openethereum/pull/1113)
|
||||
- pretty print trace error [#1098](https://github.com/openethereum/openethereum/pull/1098)
|
||||
- New syncing strategy [#1095](https://github.com/openethereum/openethereum/pull/1095)
|
||||
- ethcore-db crate [#1097](https://github.com/openethereum/openethereum/pull/1097)
|
||||
- Fix the default for pruning. [#1107](https://github.com/openethereum/openethereum/pull/1107)
|
||||
- Make Id/ID and db/Db/DB usage consistent [#1105](https://github.com/openethereum/openethereum/pull/1105)
|
||||
- Miner holds it's own copy of spec/engine [#1091](https://github.com/openethereum/openethereum/pull/1091)
|
||||
- Apps listing API & Home webapp. [#1101](https://github.com/openethereum/openethereum/pull/1101)
|
||||
- CLI option for using JITEVM [#1103](https://github.com/openethereum/openethereum/pull/1103)
|
||||
- Fix up the seal fields in RPC output [#1096](https://github.com/openethereum/openethereum/pull/1096)
|
||||
- Fixing some warnings [#1102](https://github.com/openethereum/openethereum/pull/1102)
|
||||
- fixed incorrect decoding of header seal_fields. added tests. #1090 [#1094](https://github.com/openethereum/openethereum/pull/1094)
|
||||
- Bumping Clippy [#1093](https://github.com/openethereum/openethereum/pull/1093)
|
||||
- Injectable topbar support. [#1092](https://github.com/openethereum/openethereum/pull/1092)
|
||||
- New syncing part 1: Block collection [#1088](https://github.com/openethereum/openethereum/pull/1088)
|
||||
- Moving all Client public API types to separate mod & binary serialization codegen for that mod [#1051](https://github.com/openethereum/openethereum/pull/1051)
|
||||
- Subdomains support in content server (webapps server). [#1082](https://github.com/openethereum/openethereum/pull/1082)
|
||||
- Fix uncle getter [#1087](https://github.com/openethereum/openethereum/pull/1087)
|
||||
- Provide fallback for usd-per-eth option when offline. [#1085](https://github.com/openethereum/openethereum/pull/1085)
|
||||
- path centralized [#1083](https://github.com/openethereum/openethereum/pull/1083)
|
||||
- Limiting result of the execution to execution-specific errors [#1071](https://github.com/openethereum/openethereum/pull/1071)
|
||||
- Configurable keys security [#1080](https://github.com/openethereum/openethereum/pull/1080)
|
||||
- comma delimeting multiple cors headers [#1078](https://github.com/openethereum/openethereum/pull/1078)
|
||||
- Update error message [#1081](https://github.com/openethereum/openethereum/pull/1081)
|
||||
- Updating dapp-wallet [#1076](https://github.com/openethereum/openethereum/pull/1076)
|
||||
- Fixed connecting to local nodes on startup [#1070](https://github.com/openethereum/openethereum/pull/1070)
|
||||
- Validate signature in Tx queue [#1068](https://github.com/openethereum/openethereum/pull/1068)
|
||||
- moving deps to ethcore/hyper and bumping jsonrpc-http-server version [#1067](https://github.com/openethereum/openethereum/pull/1067)
|
||||
- Updating status page. Bringing back wallet [#1064](https://github.com/openethereum/openethereum/pull/1064)
|
||||
- Fix --geth IPC for MacOS. [#1062](https://github.com/openethereum/openethereum/pull/1062)
|
||||
- Fixing formatter for defaultExtraData [#1060](https://github.com/openethereum/openethereum/pull/1060)
|
||||
- --geth IPC compatibility [#1059](https://github.com/openethereum/openethereum/pull/1059)
|
||||
- Moving dependencies to ethcore & uniforming syntax libs through all crates [#1050](https://github.com/openethereum/openethereum/pull/1050)
|
||||
- update hyper branch mio [#1054](https://github.com/openethereum/openethereum/pull/1054)
|
||||
- IPC lib update [#1047](https://github.com/openethereum/openethereum/pull/1047)
|
||||
- Updating hyper-mio revision [#1048](https://github.com/openethereum/openethereum/pull/1048)
|
||||
- Bump ipc-lib version [#1046](https://github.com/openethereum/openethereum/pull/1046)
|
||||
- Tidy up CLI options and make JSONRPC & webapps on by default. [#1045](https://github.com/openethereum/openethereum/pull/1045)
|
||||
- Fixing clippy warnings [#1044](https://github.com/openethereum/openethereum/pull/1044)
|
||||
- Fixing RPC modules compatibility [#1041](https://github.com/openethereum/openethereum/pull/1041)
|
||||
- Fixing hyper-mio revision [#1043](https://github.com/openethereum/openethereum/pull/1043)
|
||||
- Updating locations of webapp stuff [#1040](https://github.com/openethereum/openethereum/pull/1040)
|
||||
- JSON-RPC over IPC [#1039](https://github.com/openethereum/openethereum/pull/1039)
|
||||
- Update nix/mio for ARM [#1036](https://github.com/openethereum/openethereum/pull/1036)
|
||||
- Basic Authority [#991](https://github.com/openethereum/openethereum/pull/991)
|
||||
- Prioritizing of local transaction [#1023](https://github.com/openethereum/openethereum/pull/1023)
|
||||
- Version 1.2 [#1030](https://github.com/openethereum/openethereum/pull/1030)
|
||||
- Bumping status page [#1033](https://github.com/openethereum/openethereum/pull/1033)
|
||||
- Signer enabled by default for UI [#1417](https://github.com/paritytech/parity/pull/1417)
|
||||
- Remove experimental pruning options. [#1415](https://github.com/paritytech/parity/pull/1415)
|
||||
- Fixing interface and port for parity ui [#1414](https://github.com/paritytech/parity/pull/1414)
|
||||
- Configurable gas limit cap. [#1405](https://github.com/paritytech/parity/pull/1405)
|
||||
- Bumping TopBar, Minimal SignerUI and wallet [#1413](https://github.com/paritytech/parity/pull/1413)
|
||||
- Sync: Update highest block for progress reporting [#1411](https://github.com/paritytech/parity/pull/1411)
|
||||
- Tweaked CLI options for the release [#1407](https://github.com/paritytech/parity/pull/1407)
|
||||
- Further rocksdb tuning [#1409](https://github.com/paritytech/parity/pull/1409)
|
||||
- Fixing jit compilation [#1406](https://github.com/paritytech/parity/pull/1406)
|
||||
- Bump clippy [#1403](https://github.com/paritytech/parity/pull/1403)
|
||||
- Shortcut SF condition when canon known [#1401](https://github.com/paritytech/parity/pull/1401)
|
||||
- Additional assertions for internal state of queue [#1402](https://github.com/paritytech/parity/pull/1402)
|
||||
- Replace deprecated hashdb trait names [#1394](https://github.com/paritytech/parity/pull/1394)
|
||||
- rpc api by default for ipc [#1400](https://github.com/paritytech/parity/pull/1400)
|
||||
- Ensure judging the SF trigger by relative branch [#1399](https://github.com/paritytech/parity/pull/1399)
|
||||
- Signer with unlocked account working as expected. [#1398](https://github.com/paritytech/parity/pull/1398)
|
||||
- Make --signer default. [#1392](https://github.com/paritytech/parity/pull/1392)
|
||||
- Presale wallet [#1376](https://github.com/paritytech/parity/pull/1376)
|
||||
- Removing signer connection limit [#1396](https://github.com/paritytech/parity/pull/1396)
|
||||
- Optional gas price in transactions come from statistics [#1388](https://github.com/paritytech/parity/pull/1388)
|
||||
- Update README.md with cargo install [ci-skip] [#1389](https://github.com/paritytech/parity/pull/1389)
|
||||
- Fixing possible overflow during multiplication [#1381](https://github.com/paritytech/parity/pull/1381)
|
||||
- Update SF to latest spec [#1386](https://github.com/paritytech/parity/pull/1386)
|
||||
- Sync optimization [#1385](https://github.com/paritytech/parity/pull/1385)
|
||||
- Fixing order of if statements to avoid overflows. [#1384](https://github.com/paritytech/parity/pull/1384)
|
||||
- New topbar & signer UI [#1383](https://github.com/paritytech/parity/pull/1383)
|
||||
- Install trigger for DAO-rescue soft-fork. [#1329](https://github.com/paritytech/parity/pull/1329)
|
||||
- Rocksdb flush/compact limit [#1375](https://github.com/paritytech/parity/pull/1375)
|
||||
- CentOS Dockerfile [#1377](https://github.com/paritytech/parity/pull/1377)
|
||||
- RPC method to return number of unconfirmed transactions... [#1371](https://github.com/paritytech/parity/pull/1371)
|
||||
- bump jsonrpc-http-server [#1369](https://github.com/paritytech/parity/pull/1369)
|
||||
- Fix lock order when updating sealing [#1364](https://github.com/paritytech/parity/pull/1364)
|
||||
- Update sealing on new transactions [#1365](https://github.com/paritytech/parity/pull/1365)
|
||||
- Fixed panic on aborted connection [#1370](https://github.com/paritytech/parity/pull/1370)
|
||||
- importing presale wallet [#1368](https://github.com/paritytech/parity/pull/1368)
|
||||
- Set default database file size large enough [#1363](https://github.com/paritytech/parity/pull/1363)
|
||||
- Reserved peers rpc API [#1360](https://github.com/paritytech/parity/pull/1360)
|
||||
- Fixing replacing transaction with lower gas_price result. [#1343](https://github.com/paritytech/parity/pull/1343)
|
||||
- fixed migration of empty pruning dir [#1362](https://github.com/paritytech/parity/pull/1362)
|
||||
- Transaction processing queue [#1335](https://github.com/paritytech/parity/pull/1335)
|
||||
- Fixing last nonce values in case transaction is replaced [#1359](https://github.com/paritytech/parity/pull/1359)
|
||||
- docopt is an optional dependency of ethkey and ethstore [#1358](https://github.com/paritytech/parity/pull/1358)
|
||||
- Fixing clippy warnings [#1354](https://github.com/paritytech/parity/pull/1354)
|
||||
- Reduce locking when syncing [#1357](https://github.com/paritytech/parity/pull/1357)
|
||||
- removed unnecessary logs [#1356](https://github.com/paritytech/parity/pull/1356)
|
||||
- Updating parity-dapps [#1353](https://github.com/paritytech/parity/pull/1353)
|
||||
- moved keystore tests files from util to ethstore [#1352](https://github.com/paritytech/parity/pull/1352)
|
||||
- removed redundant bigint deps [#1351](https://github.com/paritytech/parity/pull/1351)
|
||||
- Reopen "reserved peers and reserved-only flag" [#1350](https://github.com/paritytech/parity/pull/1350)
|
||||
- Configurable rocksdb cache size [#1348](https://github.com/paritytech/parity/pull/1348)
|
||||
- Fixing future order and errors when reaching limit. [#1346](https://github.com/paritytech/parity/pull/1346)
|
||||
- Removing priority on local transactions [#1342](https://github.com/paritytech/parity/pull/1342)
|
||||
- Revert "Reserved peers, reserved-only flag" [#1349](https://github.com/paritytech/parity/pull/1349)
|
||||
- Sync attack defense: Deactivate peers on invalid block bodies [#1345](https://github.com/paritytech/parity/pull/1345)
|
||||
- Reserved peers, reserved-only flag [#1347](https://github.com/paritytech/parity/pull/1347)
|
||||
- CI for ethkey and ethstore [#1341](https://github.com/paritytech/parity/pull/1341)
|
||||
- Fixed empty block body composition [#1340](https://github.com/paritytech/parity/pull/1340)
|
||||
- Provide a signer UI token by default. [#1334](https://github.com/paritytech/parity/pull/1334)
|
||||
- docker uses rustup, fixes #1337 [#1344](https://github.com/paritytech/parity/pull/1344)
|
||||
- Fixed network service dispose [#1339](https://github.com/paritytech/parity/pull/1339)
|
||||
- Sync: Cache last sync round block parents [#1331](https://github.com/paritytech/parity/pull/1331)
|
||||
- secret store separated from util [#1304](https://github.com/paritytech/parity/pull/1304)
|
||||
- --geth prevent getTransactionReceipt from using pending. [#1325](https://github.com/paritytech/parity/pull/1325)
|
||||
- Fixing locks order in miner. [#1328](https://github.com/paritytech/parity/pull/1328)
|
||||
- Update default gas limit, rename field [#1324](https://github.com/paritytech/parity/pull/1324)
|
||||
- Use constants for DatabaseConfig [#1318](https://github.com/paritytech/parity/pull/1318)
|
||||
- Fixing clippy warnings [#1321](https://github.com/paritytech/parity/pull/1321)
|
||||
- Bumping topbar. Fixing ws server closing when suspending [#1312](https://github.com/paritytech/parity/pull/1312)
|
||||
- Syncing fix [#1320](https://github.com/paritytech/parity/pull/1320)
|
||||
- Filling-in optional fields of TransactionRequest... [#1305](https://github.com/paritytech/parity/pull/1305)
|
||||
- Removing MakerOTC and DAO dapps [#1319](https://github.com/paritytech/parity/pull/1319)
|
||||
- Disabling ethcore_set* APIs by default (+ Status page update) [#1315](https://github.com/paritytech/parity/pull/1315)
|
||||
- fixed #1180 [#1282](https://github.com/paritytech/parity/pull/1282)
|
||||
- Network start/stop [#1313](https://github.com/paritytech/parity/pull/1313)
|
||||
- Additional logging for own transactions in queue [#1311](https://github.com/paritytech/parity/pull/1311)
|
||||
- DAO Rescue soft fork [#1309](https://github.com/paritytech/parity/pull/1309)
|
||||
- Appveyor config for windows build+installer [#1302](https://github.com/paritytech/parity/pull/1302)
|
||||
- Key load avoid warning [#1303](https://github.com/paritytech/parity/pull/1303)
|
||||
- More meaningful errors when sending transaction [#1290](https://github.com/paritytech/parity/pull/1290)
|
||||
- Gas price statistics. [#1291](https://github.com/paritytech/parity/pull/1291)
|
||||
- Fix read-ahead bug. [#1298](https://github.com/paritytech/parity/pull/1298)
|
||||
- firewall rules for windows installer [#1297](https://github.com/paritytech/parity/pull/1297)
|
||||
- x64 program files path for installer [#1296](https://github.com/paritytech/parity/pull/1296)
|
||||
- Fixed loosing peers on incoming connections. [#1293](https://github.com/paritytech/parity/pull/1293)
|
||||
- fixed #1261, overflow when calculating work [#1283](https://github.com/paritytech/parity/pull/1283)
|
||||
- snappy and minor block compression [#1286](https://github.com/paritytech/parity/pull/1286)
|
||||
- clarify build instructions [#1287](https://github.com/paritytech/parity/pull/1287)
|
||||
- fixed #1255 [#1280](https://github.com/paritytech/parity/pull/1280)
|
||||
- bump rust-crypto [#1289](https://github.com/paritytech/parity/pull/1289)
|
||||
- Security audit issues fixed [#1279](https://github.com/paritytech/parity/pull/1279)
|
||||
- Fixing origin/host validation [#1273](https://github.com/paritytech/parity/pull/1273)
|
||||
- windows installer + parity start ui cli option [#1284](https://github.com/paritytech/parity/pull/1284)
|
||||
- ipc lib version bump [#1285](https://github.com/paritytech/parity/pull/1285)
|
||||
- Syncing improvements [#1274](https://github.com/paritytech/parity/pull/1274)
|
||||
- removed redundant if condition [#1270](https://github.com/paritytech/parity/pull/1270)
|
||||
- Naive chunk creation, snapshotting [#1263](https://github.com/paritytech/parity/pull/1263)
|
||||
- Fixing generating new token while another parity instance is running. [#1272](https://github.com/paritytech/parity/pull/1272)
|
||||
- README: rustup and windows instructions [#1266](https://github.com/paritytech/parity/pull/1266)
|
||||
- Windows build [#1253](https://github.com/paritytech/parity/pull/1253)
|
||||
- removed try_seal from MiningBlockChainClient [#1262](https://github.com/paritytech/parity/pull/1262)
|
||||
- simplified block opening [#1232](https://github.com/paritytech/parity/pull/1232)
|
||||
- Clippy bump [#1259](https://github.com/paritytech/parity/pull/1259)
|
||||
- Fixing uint ASM macros compilation [#1258](https://github.com/paritytech/parity/pull/1258)
|
||||
- Signer port returned from RPC + Topbar showing count of unconfirmed transactions. [#1252](https://github.com/paritytech/parity/pull/1252)
|
||||
- codegen - avoid unwraps leading to compilation crash [#1250](https://github.com/paritytech/parity/pull/1250)
|
||||
- Dapps bump [#1257](https://github.com/paritytech/parity/pull/1257)
|
||||
- Windows named pipes [#1254](https://github.com/paritytech/parity/pull/1254)
|
||||
- remove unsafety from util/hash.rs and util/bigint/uint.rs [#1236](https://github.com/paritytech/parity/pull/1236)
|
||||
- Fixing CORS settings for special values: * & null. [#1247](https://github.com/paritytech/parity/pull/1247)
|
||||
- JSONRPC test strings avoid using \ char [#1246](https://github.com/paritytech/parity/pull/1246)
|
||||
- Tests for JSON serialisation of statediff/vmtrace [#1241](https://github.com/paritytech/parity/pull/1241)
|
||||
- Bumping Dapps & TopBar to newest version. [#1245](https://github.com/paritytech/parity/pull/1245)
|
||||
- keys import [#1240](https://github.com/paritytech/parity/pull/1240)
|
||||
- Splitting RPC Apis into more fine-grained sets [#1234](https://github.com/paritytech/parity/pull/1234)
|
||||
- Refactor triedb constructors to error on invalid state root [#1230](https://github.com/paritytech/parity/pull/1230)
|
||||
- Signer RPC method to check if signer is enabled [#1238](https://github.com/paritytech/parity/pull/1238)
|
||||
- Fixing signer behaviour when confirming transaction with wrong password. [#1237](https://github.com/paritytech/parity/pull/1237)
|
||||
- SystemUIs authorization [#1233](https://github.com/paritytech/parity/pull/1233)
|
||||
- IPC path for tesetnet with --geth compatibility [#1231](https://github.com/paritytech/parity/pull/1231)
|
||||
- Transaction tracing for eth_call [#1210](https://github.com/paritytech/parity/pull/1210)
|
||||
- Removing compilation warnings [#1227](https://github.com/paritytech/parity/pull/1227)
|
||||
- Allowing connections only from chrome-extension and self-hosted client [#1226](https://github.com/paritytech/parity/pull/1226)
|
||||
- Clippy bump & fixing warnings [#1219](https://github.com/paritytech/parity/pull/1219)
|
||||
- Bumping serde & syntex [#1216](https://github.com/paritytech/parity/pull/1216)
|
||||
- Minimal Signer UI (System UI) exposed over websockets. [#1211](https://github.com/paritytech/parity/pull/1211)
|
||||
- Switch RPC namespace form ethcore_ to trace_ [#1208](https://github.com/paritytech/parity/pull/1208)
|
||||
- Verify the state root exists before creating a State [#1217](https://github.com/paritytech/parity/pull/1217)
|
||||
- Integrate state diffing into the ethcore JSONRPC [#1206](https://github.com/paritytech/parity/pull/1206)
|
||||
- Updating topbar to latest version [#1220](https://github.com/paritytech/parity/pull/1220)
|
||||
- Loading local Dapps from FS. [#1214](https://github.com/paritytech/parity/pull/1214)
|
||||
- Ipc serialization & protocol fixes [#1188](https://github.com/paritytech/parity/pull/1188)
|
||||
- Have Ext::ret take self by value [#1187](https://github.com/paritytech/parity/pull/1187)
|
||||
- Simple WebSockets notification about new request [#1202](https://github.com/paritytech/parity/pull/1202)
|
||||
- Removing leftovers of ethminer [#1207](https://github.com/paritytech/parity/pull/1207)
|
||||
- fixed #1204 [#1205](https://github.com/paritytech/parity/pull/1205)
|
||||
- VM tracing and JSON RPC endpoint for it. [#1169](https://github.com/paritytech/parity/pull/1169)
|
||||
- devtools helpers extended [#1186](https://github.com/paritytech/parity/pull/1186)
|
||||
- Networking refactoring [#1172](https://github.com/paritytech/parity/pull/1172)
|
||||
- Client & Miner refactoring [#1195](https://github.com/paritytech/parity/pull/1195)
|
||||
- update readme [#1201](https://github.com/paritytech/parity/pull/1201)
|
||||
- Simple signing queue, confirmation APIs exposed in signer WebSockets. [#1182](https://github.com/paritytech/parity/pull/1182)
|
||||
- Using ordered hashmap to keep the order of dapps on home screen [#1199](https://github.com/paritytech/parity/pull/1199)
|
||||
- Disabling `ethcore` by default, adding x-frame-options header to dapps. [#1197](https://github.com/paritytech/parity/pull/1197)
|
||||
- transaction count verifier tests [#1196](https://github.com/paritytech/parity/pull/1196)
|
||||
- expunge x! and xx! from the codebase [#1192](https://github.com/paritytech/parity/pull/1192)
|
||||
- Database service upgrade (from the ipc branch) [#1185](https://github.com/paritytech/parity/pull/1185)
|
||||
- stop eth_syncing from returning true forever [#1181](https://github.com/paritytech/parity/pull/1181)
|
||||
- Sync fixes and tweaks [#1164](https://github.com/paritytech/parity/pull/1164)
|
||||
- Exposing RPC over Signer WebSockets [#1167](https://github.com/paritytech/parity/pull/1167)
|
||||
- implement missing rpc methods and tests [#1171](https://github.com/paritytech/parity/pull/1171)
|
||||
- json ipc server version bump [#1170](https://github.com/paritytech/parity/pull/1170)
|
||||
- Updated dependencies for windows build [#1173](https://github.com/paritytech/parity/pull/1173)
|
||||
- Framework for improved RPC unit tests [#1141](https://github.com/paritytech/parity/pull/1141)
|
||||
- remove all possible unsafe code in crypto [#1168](https://github.com/paritytech/parity/pull/1168)
|
||||
- Base for Signer Websockets server [#1158](https://github.com/paritytech/parity/pull/1158)
|
||||
- Write queue to speed-up db ipc [#1160](https://github.com/paritytech/parity/pull/1160)
|
||||
- Fixing few clippy warnings [#1163](https://github.com/paritytech/parity/pull/1163)
|
||||
- Change eth_signAndSendTransaction to personal_SignAndSendTransaction [#1154](https://github.com/paritytech/parity/pull/1154)
|
||||
- Support "earliest" and specific block parameters in RPC where possible [#1149](https://github.com/paritytech/parity/pull/1149)
|
||||
- migration fixes [#1155](https://github.com/paritytech/parity/pull/1155)
|
||||
- Empty trusted signer crate with it's general purpose described. [#1150](https://github.com/paritytech/parity/pull/1150)
|
||||
- More bootnodes for morden. [#1153](https://github.com/paritytech/parity/pull/1153)
|
||||
- move existing rpc tests into mocked module [#1151](https://github.com/paritytech/parity/pull/1151)
|
||||
- Bloomchain [#1014](https://github.com/paritytech/parity/pull/1014)
|
||||
- Renaming dapps repos. Updating dapps [#1142](https://github.com/paritytech/parity/pull/1142)
|
||||
- fixed pending transactions [#1147](https://github.com/paritytech/parity/pull/1147)
|
||||
- Basic benches to provide metrics for ipc optimizations [#1145](https://github.com/paritytech/parity/pull/1145)
|
||||
- Fixing clippy warnings [#1148](https://github.com/paritytech/parity/pull/1148)
|
||||
- correct signature of SecTrieDB::raw_mut [#1143](https://github.com/paritytech/parity/pull/1143)
|
||||
- Merge to master and start hypervisor for import/export [#1138](https://github.com/paritytech/parity/pull/1138)
|
||||
- Bumping clippy. Fixing warnings [#1139](https://github.com/paritytech/parity/pull/1139)
|
||||
- Display progress when importing [#1136](https://github.com/paritytech/parity/pull/1136)
|
||||
- foundation of simple db migration [#1128](https://github.com/paritytech/parity/pull/1128)
|
||||
- Fixpending [#1074](https://github.com/paritytech/parity/pull/1074)
|
||||
- Sync: Propagate uncles and fix status reporting [#1134](https://github.com/paritytech/parity/pull/1134)
|
||||
- Coloured, padding logging. [#1133](https://github.com/paritytech/parity/pull/1133)
|
||||
- Importing [#1132](https://github.com/paritytech/parity/pull/1132)
|
||||
- Have `die_with_error` use `fmt::Display` rather than Debug [#1116](https://github.com/paritytech/parity/pull/1116)
|
||||
- Exporting [#1129](https://github.com/paritytech/parity/pull/1129)
|
||||
- Sign and send transaction [#1124](https://github.com/paritytech/parity/pull/1124)
|
||||
- Fixing unused imports warnings [#1125](https://github.com/paritytech/parity/pull/1125)
|
||||
- Adding info messages on mined blocks [#1127](https://github.com/paritytech/parity/pull/1127)
|
||||
- Fix styling - don't mix spaces with tabs!!! [#1123](https://github.com/paritytech/parity/pull/1123)
|
||||
- Fix is_syncing so it's false as long as the update is trivial. [#1122](https://github.com/paritytech/parity/pull/1122)
|
||||
- Relock unlocked accounts after first use [#1120](https://github.com/paritytech/parity/pull/1120)
|
||||
- Avoid importing keys into wrong place. [#1119](https://github.com/paritytech/parity/pull/1119)
|
||||
- Implement receipt's gasUsed field [#1118](https://github.com/paritytech/parity/pull/1118)
|
||||
- New dapps & query parameter handling [#1113](https://github.com/paritytech/parity/pull/1113)
|
||||
- pretty print trace error [#1098](https://github.com/paritytech/parity/pull/1098)
|
||||
- New syncing strategy [#1095](https://github.com/paritytech/parity/pull/1095)
|
||||
- ethcore-db crate [#1097](https://github.com/paritytech/parity/pull/1097)
|
||||
- Fix the default for pruning. [#1107](https://github.com/paritytech/parity/pull/1107)
|
||||
- Make Id/ID and db/Db/DB usage consistent [#1105](https://github.com/paritytech/parity/pull/1105)
|
||||
- Miner holds it's own copy of spec/engine [#1091](https://github.com/paritytech/parity/pull/1091)
|
||||
- Apps listing API & Home webapp. [#1101](https://github.com/paritytech/parity/pull/1101)
|
||||
- CLI option for using JITEVM [#1103](https://github.com/paritytech/parity/pull/1103)
|
||||
- Fix up the seal fields in RPC output [#1096](https://github.com/paritytech/parity/pull/1096)
|
||||
- Fixing some warnings [#1102](https://github.com/paritytech/parity/pull/1102)
|
||||
- fixed incorrect decoding of header seal_fields. added tests. #1090 [#1094](https://github.com/paritytech/parity/pull/1094)
|
||||
- Bumping Clippy [#1093](https://github.com/paritytech/parity/pull/1093)
|
||||
- Injectable topbar support. [#1092](https://github.com/paritytech/parity/pull/1092)
|
||||
- New syncing part 1: Block collection [#1088](https://github.com/paritytech/parity/pull/1088)
|
||||
- Moving all Client public API types to separate mod & binary serialization codegen for that mod [#1051](https://github.com/paritytech/parity/pull/1051)
|
||||
- Subdomains support in content server (webapps server). [#1082](https://github.com/paritytech/parity/pull/1082)
|
||||
- Fix uncle getter [#1087](https://github.com/paritytech/parity/pull/1087)
|
||||
- Provide fallback for usd-per-eth option when offline. [#1085](https://github.com/paritytech/parity/pull/1085)
|
||||
- path centralized [#1083](https://github.com/paritytech/parity/pull/1083)
|
||||
- Limiting result of the execution to execution-specific errors [#1071](https://github.com/paritytech/parity/pull/1071)
|
||||
- Configurable keys security [#1080](https://github.com/paritytech/parity/pull/1080)
|
||||
- comma delimeting multiple cors headers [#1078](https://github.com/paritytech/parity/pull/1078)
|
||||
- Update error message [#1081](https://github.com/paritytech/parity/pull/1081)
|
||||
- Updating dapp-wallet [#1076](https://github.com/paritytech/parity/pull/1076)
|
||||
- Fixed connecting to local nodes on startup [#1070](https://github.com/paritytech/parity/pull/1070)
|
||||
- Validate signature in Tx queue [#1068](https://github.com/paritytech/parity/pull/1068)
|
||||
- moving deps to ethcore/hyper and bumping jsonrpc-http-server version [#1067](https://github.com/paritytech/parity/pull/1067)
|
||||
- Updating status page. Bringing back wallet [#1064](https://github.com/paritytech/parity/pull/1064)
|
||||
- Fix --geth IPC for MacOS. [#1062](https://github.com/paritytech/parity/pull/1062)
|
||||
- Fixing formatter for defaultExtraData [#1060](https://github.com/paritytech/parity/pull/1060)
|
||||
- --geth IPC compatibility [#1059](https://github.com/paritytech/parity/pull/1059)
|
||||
- Moving dependencies to ethcore & uniforming syntax libs through all crates [#1050](https://github.com/paritytech/parity/pull/1050)
|
||||
- update hyper branch mio [#1054](https://github.com/paritytech/parity/pull/1054)
|
||||
- IPC lib update [#1047](https://github.com/paritytech/parity/pull/1047)
|
||||
- Updating hyper-mio revision [#1048](https://github.com/paritytech/parity/pull/1048)
|
||||
- Bump ipc-lib version [#1046](https://github.com/paritytech/parity/pull/1046)
|
||||
- Tidy up CLI options and make JSONRPC & webapps on by default. [#1045](https://github.com/paritytech/parity/pull/1045)
|
||||
- Fixing clippy warnings [#1044](https://github.com/paritytech/parity/pull/1044)
|
||||
- Fixing RPC modules compatibility [#1041](https://github.com/paritytech/parity/pull/1041)
|
||||
- Fixing hyper-mio revision [#1043](https://github.com/paritytech/parity/pull/1043)
|
||||
- Updating locations of webapp stuff [#1040](https://github.com/paritytech/parity/pull/1040)
|
||||
- JSON-RPC over IPC [#1039](https://github.com/paritytech/parity/pull/1039)
|
||||
- Update nix/mio for ARM [#1036](https://github.com/paritytech/parity/pull/1036)
|
||||
- Basic Authority [#991](https://github.com/paritytech/parity/pull/991)
|
||||
- Prioritizing of local transaction [#1023](https://github.com/paritytech/parity/pull/1023)
|
||||
- Version 1.2 [#1030](https://github.com/paritytech/parity/pull/1030)
|
||||
- Bumping status page [#1033](https://github.com/paritytech/parity/pull/1033)
|
||||
|
||||
@@ -1,69 +1,69 @@
|
||||
Note: Parity 1.3 reached End-of-Life on 2017-01-19 (EOL).
|
||||
|
||||
## Parity [v1.3.15](https://github.com/openethereum/openethereum/releases/tag/v1.3.15) (2016-12-10)
|
||||
## Parity [v1.3.15](https://github.com/paritytech/parity/releases/tag/v1.3.15) (2016-12-10)
|
||||
|
||||
This patch release fixes an issue with syncing on the Ropsten test network.
|
||||
|
||||
- Backporting to stable [#3793](https://github.com/openethereum/openethereum/pull/3793)
|
||||
- Backporting to stable [#3793](https://github.com/paritytech/parity/pull/3793)
|
||||
|
||||
## Parity [v1.3.14](https://github.com/openethereum/openethereum/releases/tag/v1.3.14) (2016-11-25)
|
||||
## Parity [v1.3.14](https://github.com/paritytech/parity/releases/tag/v1.3.14) (2016-11-25)
|
||||
|
||||
Parity 1.3.14 fixes a few stability issues and adds support for the Ropsten testnet.
|
||||
|
||||
- Backporting to stable [#3616](https://github.com/openethereum/openethereum/pull/3616)
|
||||
- Backporting to stable [#3616](https://github.com/paritytech/parity/pull/3616)
|
||||
|
||||
## Parity [v1.3.13](https://github.com/openethereum/openethereum/releases/tag/v1.3.13) (2016-11-18)
|
||||
## Parity [v1.3.13](https://github.com/paritytech/parity/releases/tag/v1.3.13) (2016-11-18)
|
||||
|
||||
This release fixes an issue with EIP-155 transactions being allowed into the transaction pool.
|
||||
|
||||
- [stable] Check tx signatures before adding to the queue. [#3521](https://github.com/openethereum/openethereum/pull/3521)
|
||||
- Fix Stable Docker Build [#3479](https://github.com/openethereum/openethereum/pull/3479)
|
||||
- [stable] Check tx signatures before adding to the queue. [#3521](https://github.com/paritytech/parity/pull/3521)
|
||||
- Fix Stable Docker Build [#3479](https://github.com/paritytech/parity/pull/3479)
|
||||
|
||||
## Parity [v1.3.12](https://github.com/openethereum/openethereum/releases/tag/v1.3.12) (2016-11-16)
|
||||
## Parity [v1.3.12](https://github.com/paritytech/parity/releases/tag/v1.3.12) (2016-11-16)
|
||||
|
||||
This stable release enables EIP-155/160/161/170 hardfork at block 2675000 (1885000 for test network).
|
||||
|
||||
- [stable] EIP-170 [#3462](https://github.com/openethereum/openethereum/pull/3462)
|
||||
- #3035 Backport to stable [#3441](https://github.com/openethereum/openethereum/pull/3441)
|
||||
- [stable] EIP-170 [#3462](https://github.com/paritytech/parity/pull/3462)
|
||||
- #3035 Backport to stable [#3441](https://github.com/paritytech/parity/pull/3441)
|
||||
|
||||
## Parity [v1.3.11](https://github.com/openethereum/openethereum/releases/tag/v1.3.11) (2016-11-11)
|
||||
## Parity [v1.3.11](https://github.com/paritytech/parity/releases/tag/v1.3.11) (2016-11-11)
|
||||
|
||||
This is a maintenance release for the stable series to delay the EIP-155/160/161 hard fork transition. **Update from 1.3.10 is mandatory**. It also deprecates and disables the old Parity UI.
|
||||
|
||||
- [stable] Disable HF and UI [#3372](https://github.com/openethereum/openethereum/pull/3372)
|
||||
- [stable] EIP-155 update with Vitalik's new test vectors (#3166) [#3190](https://github.com/openethereum/openethereum/pull/3190)
|
||||
- Backport EIP-150 to stable [#2672](https://github.com/openethereum/openethereum/pull/2672)
|
||||
- Create gitlab-ci.yml for stable [#2517](https://github.com/openethereum/openethereum/pull/2517)
|
||||
- [stable] Disable HF and UI [#3372](https://github.com/paritytech/parity/pull/3372)
|
||||
- [stable] EIP-155 update with Vitalik's new test vectors (#3166) [#3190](https://github.com/paritytech/parity/pull/3190)
|
||||
- Backport EIP-150 to stable [#2672](https://github.com/paritytech/parity/pull/2672)
|
||||
- Create gitlab-ci.yml for stable [#2517](https://github.com/paritytech/parity/pull/2517)
|
||||
|
||||
## Parity [v1.3.10](https://github.com/openethereum/openethereum/releases/tag/v1.3.10) (2016-11-04)
|
||||
## Parity [v1.3.10](https://github.com/paritytech/parity/releases/tag/v1.3.10) (2016-11-04)
|
||||
|
||||
The latest 1.3 series release, now considered stable.
|
||||
|
||||
This includes several additional optimisations and fixes together with provisional support for the upcoming hard fork for EIP155/160/161.
|
||||
|
||||
- Stable branch reset to 1.3.10 [#3156](https://github.com/openethereum/openethereum/pull/3156)
|
||||
- Backporting to beta [#3149](https://github.com/openethereum/openethereum/pull/3149)
|
||||
- apply post-consolidation migrations after consolidating (BETA) [#3048](https://github.com/openethereum/openethereum/pull/3048)
|
||||
- [beta] Fix the brainwallet functionality. (#2994) [#3005](https://github.com/openethereum/openethereum/pull/3005)
|
||||
- Bumping json-ipc-server [#2989](https://github.com/openethereum/openethereum/pull/2989)
|
||||
- Backports for 1.3.10 [#2987](https://github.com/openethereum/openethereum/pull/2987)
|
||||
- Stable branch reset to 1.3.10 [#3156](https://github.com/paritytech/parity/pull/3156)
|
||||
- Backporting to beta [#3149](https://github.com/paritytech/parity/pull/3149)
|
||||
- apply post-consolidation migrations after consolidating (BETA) [#3048](https://github.com/paritytech/parity/pull/3048)
|
||||
- [beta] Fix the brainwallet functionality. (#2994) [#3005](https://github.com/paritytech/parity/pull/3005)
|
||||
- Bumping json-ipc-server [#2989](https://github.com/paritytech/parity/pull/2989)
|
||||
- Backports for 1.3.10 [#2987](https://github.com/paritytech/parity/pull/2987)
|
||||
|
||||
## Parity [v1.3.9](https://github.com/openethereum/openethereum/releases/tag/v1.3.9) (2016-10-21)
|
||||
## Parity [v1.3.9](https://github.com/paritytech/parity/releases/tag/v1.3.9) (2016-10-21)
|
||||
|
||||
This release enables EIP-150 hard fork for Ethereum Classic chain and resolves a few stability and performance issues, such as:
|
||||
- Interrupted syncing on the test network.
|
||||
- Block import delays caused by a large number of incoming transactions. A full re-sync is recommended for performance improvement to take effect.
|
||||
|
||||
Full changes:
|
||||
- [beta] Resolve morden fork [#2776](https://github.com/openethereum/openethereum/pull/2776)
|
||||
- Fixing botched merge [#2767](https://github.com/openethereum/openethereum/pull/2767)
|
||||
- Backports for beta [#2764](https://github.com/openethereum/openethereum/pull/2764)
|
||||
- Introduce EIP150 hardfork block for ETC [#2736](https://github.com/openethereum/openethereum/pull/2736)
|
||||
- [beta] fix issues with no test dir present (#2659) [#2724](https://github.com/openethereum/openethereum/pull/2724)
|
||||
- [beta] Bumping jsonrpc-http-server [#2715](https://github.com/openethereum/openethereum/pull/2715)
|
||||
- [beta] Fix migration system, better errors [#2661](https://github.com/openethereum/openethereum/pull/2661)
|
||||
- [beta] Resolve morden fork [#2776](https://github.com/paritytech/parity/pull/2776)
|
||||
- Fixing botched merge [#2767](https://github.com/paritytech/parity/pull/2767)
|
||||
- Backports for beta [#2764](https://github.com/paritytech/parity/pull/2764)
|
||||
- Introduce EIP150 hardfork block for ETC [#2736](https://github.com/paritytech/parity/pull/2736)
|
||||
- [beta] fix issues with no test dir present (#2659) [#2724](https://github.com/paritytech/parity/pull/2724)
|
||||
- [beta] Bumping jsonrpc-http-server [#2715](https://github.com/paritytech/parity/pull/2715)
|
||||
- [beta] Fix migration system, better errors [#2661](https://github.com/paritytech/parity/pull/2661)
|
||||
|
||||
## Parity [v1.3.8](https://github.com/openethereum/openethereum/releases/tag/v1.3.8) (2016-10-15)
|
||||
## Parity [v1.3.8](https://github.com/paritytech/parity/releases/tag/v1.3.8) (2016-10-15)
|
||||
|
||||
Parity 1.3.8 is our EIP150 hard-fork compliant release.
|
||||
|
||||
@@ -83,37 +83,37 @@ The key related to homestead transition has been renamed from `frontierCompatibi
|
||||
|
||||
#### Full changes
|
||||
|
||||
- [beta] EIP150.1c [#2599](https://github.com/openethereum/openethereum/pull/2599)
|
||||
- Remove count limit for local transactions [#2634](https://github.com/openethereum/openethereum/pull/2634)
|
||||
- Tweak DB and mining defaults [#2598](https://github.com/openethereum/openethereum/pull/2598)
|
||||
- Revert "Bloom upgrade in beta" [#2635](https://github.com/openethereum/openethereum/pull/2635)
|
||||
- Bloom upgrade in beta [#2609](https://github.com/openethereum/openethereum/pull/2609)
|
||||
- Backports to beta [#2628](https://github.com/openethereum/openethereum/pull/2628)
|
||||
- [beta] EIP150.1c [#2599](https://github.com/paritytech/parity/pull/2599)
|
||||
- Remove count limit for local transactions [#2634](https://github.com/paritytech/parity/pull/2634)
|
||||
- Tweak DB and mining defaults [#2598](https://github.com/paritytech/parity/pull/2598)
|
||||
- Revert "Bloom upgrade in beta" [#2635](https://github.com/paritytech/parity/pull/2635)
|
||||
- Bloom upgrade in beta [#2609](https://github.com/paritytech/parity/pull/2609)
|
||||
- Backports to beta [#2628](https://github.com/paritytech/parity/pull/2628)
|
||||
|
||||
## Parity [v1.3.7](https://github.com/openethereum/openethereum/releases/tag/v1.3.7) (2016-10-12)
|
||||
## Parity [v1.3.7](https://github.com/paritytech/parity/releases/tag/v1.3.7) (2016-10-12)
|
||||
|
||||
This release contains fixes to reduce memory usage under the DoS attack and improve transaction relay.
|
||||
|
||||
- Configurable history size in beta [#2587](https://github.com/openethereum/openethereum/pull/2587)
|
||||
- Backports to beta [#2592](https://github.com/openethereum/openethereum/pull/2592)
|
||||
- Configurable history size in beta [#2587](https://github.com/paritytech/parity/pull/2587)
|
||||
- Backports to beta [#2592](https://github.com/paritytech/parity/pull/2592)
|
||||
|
||||
|
||||
## Parity [v1.3.6](https://github.com/openethereum/openethereum/releases/tag/v1.3.6) (2016-10-11)
|
||||
## Parity [v1.3.6](https://github.com/paritytech/parity/releases/tag/v1.3.6) (2016-10-11)
|
||||
|
||||
Parity 1.3.6 is another hotfix release to address transaction spam and deal with stability issues. With this release transaction pool gas limit no longer applies to local transactions. Full list of changes is available here:
|
||||
|
||||
- Backports to beta v1.3.6 [#2571](https://github.com/openethereum/openethereum/pull/2571)
|
||||
- Use global state cache when mining [#2529](https://github.com/openethereum/openethereum/pull/2529)
|
||||
- Transaction queue limited by gas [#2528](https://github.com/openethereum/openethereum/pull/2528)
|
||||
- Backports to beta v1.3.6 [#2571](https://github.com/paritytech/parity/pull/2571)
|
||||
- Use global state cache when mining [#2529](https://github.com/paritytech/parity/pull/2529)
|
||||
- Transaction queue limited by gas [#2528](https://github.com/paritytech/parity/pull/2528)
|
||||
|
||||
## Parity [v1.3.5](https://github.com/openethereum/openethereum/releases/tag/v1.3.5) (2016-10-08)
|
||||
## Parity [v1.3.5](https://github.com/paritytech/parity/releases/tag/v1.3.5) (2016-10-08)
|
||||
|
||||
1.3.5 is a hotfix release for the transaction propagation issue. Transaction pool limit is now calculated based on the block gas limit.
|
||||
|
||||
- Update appveyor rustc [beta] [#2521](https://github.com/openethereum/openethereum/pull/2521)
|
||||
- Increase size of transaction queue by default [#2519](https://github.com/openethereum/openethereum/pull/2519)
|
||||
- Update appveyor rustc [beta] [#2521](https://github.com/paritytech/parity/pull/2521)
|
||||
- Increase size of transaction queue by default [#2519](https://github.com/paritytech/parity/pull/2519)
|
||||
|
||||
## Parity [v1.3.4](https://github.com/openethereum/openethereum/releases/tag/v1.3.4) (2016-10-07)
|
||||
## Parity [v1.3.4](https://github.com/paritytech/parity/releases/tag/v1.3.4) (2016-10-07)
|
||||
|
||||
Parity 1.3.4 release contains more optimizations to internal caching as well as stability improvements.
|
||||
|
||||
@@ -126,59 +126,59 @@ It also introduces an ability for miners to choose a transaction ordering strate
|
||||
gas_factor - Prioritize txs using gas price
|
||||
and gas limit ratio [default: gas_factor].
|
||||
|
||||
- Backport to beta [#2518](https://github.com/openethereum/openethereum/pull/2518)
|
||||
- [beta] Fixing RPC Filter conversion to EthFilter [#2501](https://github.com/openethereum/openethereum/pull/2501)
|
||||
- [beta] Using pending block only if is not old [#2515](https://github.com/openethereum/openethereum/pull/2515)
|
||||
- Backports into beta [#2512](https://github.com/openethereum/openethereum/pull/2512)
|
||||
- CLI to specify queue ordering strategy [#2494](https://github.com/openethereum/openethereum/pull/2494)
|
||||
- Fix ethstore opening all key files in the directory at once (BETA) [#2472](https://github.com/openethereum/openethereum/pull/2472)
|
||||
- Beta backports [#2465](https://github.com/openethereum/openethereum/pull/2465)
|
||||
- IPC-library dependency fork & bump for beta [#2455](https://github.com/openethereum/openethereum/pull/2455)
|
||||
- Backport to beta [#2518](https://github.com/paritytech/parity/pull/2518)
|
||||
- [beta] Fixing RPC Filter conversion to EthFilter [#2501](https://github.com/paritytech/parity/pull/2501)
|
||||
- [beta] Using pending block only if is not old [#2515](https://github.com/paritytech/parity/pull/2515)
|
||||
- Backports into beta [#2512](https://github.com/paritytech/parity/pull/2512)
|
||||
- CLI to specify queue ordering strategy [#2494](https://github.com/paritytech/parity/pull/2494)
|
||||
- Fix ethstore opening all key files in the directory at once (BETA) [#2472](https://github.com/paritytech/parity/pull/2472)
|
||||
- Beta backports [#2465](https://github.com/paritytech/parity/pull/2465)
|
||||
- IPC-library dependency fork & bump for beta [#2455](https://github.com/paritytech/parity/pull/2455)
|
||||
|
||||
## Parity [v1.3.3](https://github.com/openethereum/openethereum/releases/tag/v1.3.3) (2016-10-04)
|
||||
## Parity [v1.3.3](https://github.com/paritytech/parity/releases/tag/v1.3.3) (2016-10-04)
|
||||
|
||||
1.3.3 is another hotfix release for the DoS attack
|
||||
|
||||
- Jumptable cache [#2435](https://github.com/openethereum/openethereum/pull/2435)
|
||||
- fix broken beta compilation (backport to beta) [#2414](https://github.com/openethereum/openethereum/pull/2414)
|
||||
- Run inplace upgrades after version update [#2411](https://github.com/openethereum/openethereum/pull/2411)
|
||||
- Jumptable cache [#2435](https://github.com/paritytech/parity/pull/2435)
|
||||
- fix broken beta compilation (backport to beta) [#2414](https://github.com/paritytech/parity/pull/2414)
|
||||
- Run inplace upgrades after version update [#2411](https://github.com/paritytech/parity/pull/2411)
|
||||
|
||||
## Parity [v1.3.2](https://github.com/openethereum/openethereum/releases/tag/v1.3.2) (2016-09-29)
|
||||
## Parity [v1.3.2](https://github.com/paritytech/parity/releases/tag/v1.3.2) (2016-09-29)
|
||||
|
||||
This is a hotfix release to address stability and performance issues uncovered during the network DoS attack. Full list of changes is available [here](https://github.com/paritytech/parity/compare/v1.3.1...v1.3.2)
|
||||
|
||||
- Beta Backports [#2396](https://github.com/openethereum/openethereum/pull/2396)
|
||||
- Fixing penalization in future [#2493](https://github.com/openethereum/openethereum/pull/2493)
|
||||
- A quick fix for missing tree route blocks [#2400](https://github.com/openethereum/openethereum/pull/2400)
|
||||
- Cache the fork block header after snapshot restoration [#2391](https://github.com/openethereum/openethereum/pull/2391)
|
||||
- correct sync memory usage calculation (BETA) [#2386](https://github.com/openethereum/openethereum/pull/2386)
|
||||
- Accounts bloom [#2357](https://github.com/openethereum/openethereum/pull/2357)
|
||||
- Disable colors when generating signer token. [#2379](https://github.com/openethereum/openethereum/pull/2379)
|
||||
- Fixing jit feature compilation [#2376](https://github.com/openethereum/openethereum/pull/2376)
|
||||
- Clear state cache on sealed block import [#2377](https://github.com/openethereum/openethereum/pull/2377)
|
||||
- DIV optimization (beta) [#2353](https://github.com/openethereum/openethereum/pull/2353)
|
||||
- Canonical state cache [#2308](https://github.com/openethereum/openethereum/pull/2308)
|
||||
- Reorder transaction_by_hash to favour canon search [#2331](https://github.com/openethereum/openethereum/pull/2331)
|
||||
- Lenient bytes deserialization [#2340](https://github.com/openethereum/openethereum/pull/2340)
|
||||
- Penalize transactions with gas above gas limit [#2271](https://github.com/openethereum/openethereum/pull/2271)
|
||||
- Peek transaction queue via RPC [#2270](https://github.com/openethereum/openethereum/pull/2270)
|
||||
- Handle RLP to string UTF-8 decoding errors (#2217) [#2226](https://github.com/openethereum/openethereum/pull/2226)
|
||||
- Fixing compilation without default features [beta] [#2207](https://github.com/openethereum/openethereum/pull/2207)
|
||||
- Avoid cloning clean stuff [beta backport] [#2173](https://github.com/openethereum/openethereum/pull/2173)
|
||||
- v1.3.2 in beta [#2200](https://github.com/openethereum/openethereum/pull/2200)
|
||||
- Beta Backports [#2396](https://github.com/paritytech/parity/pull/2396)
|
||||
- Fixing penalization in future [#2493](https://github.com/paritytech/parity/pull/2493)
|
||||
- A quick fix for missing tree route blocks [#2400](https://github.com/paritytech/parity/pull/2400)
|
||||
- Cache the fork block header after snapshot restoration [#2391](https://github.com/paritytech/parity/pull/2391)
|
||||
- correct sync memory usage calculation (BETA) [#2386](https://github.com/paritytech/parity/pull/2386)
|
||||
- Accounts bloom [#2357](https://github.com/paritytech/parity/pull/2357)
|
||||
- Disable colors when generating signer token. [#2379](https://github.com/paritytech/parity/pull/2379)
|
||||
- Fixing jit feature compilation [#2376](https://github.com/paritytech/parity/pull/2376)
|
||||
- Clear state cache on sealed block import [#2377](https://github.com/paritytech/parity/pull/2377)
|
||||
- DIV optimization (beta) [#2353](https://github.com/paritytech/parity/pull/2353)
|
||||
- Canonical state cache [#2308](https://github.com/paritytech/parity/pull/2308)
|
||||
- Reorder transaction_by_hash to favour canon search [#2331](https://github.com/paritytech/parity/pull/2331)
|
||||
- Lenient bytes deserialization [#2340](https://github.com/paritytech/parity/pull/2340)
|
||||
- Penalize transactions with gas above gas limit [#2271](https://github.com/paritytech/parity/pull/2271)
|
||||
- Peek transaction queue via RPC [#2270](https://github.com/paritytech/parity/pull/2270)
|
||||
- Handle RLP to string UTF-8 decoding errors (#2217) [#2226](https://github.com/paritytech/parity/pull/2226)
|
||||
- Fixing compilation without default features [beta] [#2207](https://github.com/paritytech/parity/pull/2207)
|
||||
- Avoid cloning clean stuff [beta backport] [#2173](https://github.com/paritytech/parity/pull/2173)
|
||||
- v1.3.2 in beta [#2200](https://github.com/paritytech/parity/pull/2200)
|
||||
|
||||
## Parity [v1.3.1](https://github.com/openethereum/openethereum/releases/tag/v1.3.1) (2016-09-11)
|
||||
## Parity [v1.3.1](https://github.com/paritytech/parity/releases/tag/v1.3.1) (2016-09-11)
|
||||
|
||||
1.3.1 includes many [bugfixes](https://github.com/paritytech/parity/commit/2a82fa0a47b00bedfec520a2fdd3cc31aa4ccd8c). Critical ones:
|
||||
- **Chain reorganisation fix** Transaction receipts / traces were sometimes linked with incorrect block hash. Fixed in https://github.com/paritytech/parity/commit/a9587f8965a32c84973c35ce1c8d51d07044143f
|
||||
- **Trace overflow fix** Overflow which occurred during tracing. Fixed in https://github.com/openethereum/openethereum/pull/1979
|
||||
- **Trace overflow fix** Overflow which occurred during tracing. Fixed in https://github.com/paritytech/parity/pull/1979
|
||||
|
||||
- Backports to beta [#2068](https://github.com/openethereum/openethereum/pull/2068)
|
||||
- Fixing serde overflow error (#1977) [#2030](https://github.com/openethereum/openethereum/pull/2030)
|
||||
- Simplified db pruning detection in beta [#1924](https://github.com/openethereum/openethereum/pull/1924)
|
||||
- Backports to beta [#1919](https://github.com/openethereum/openethereum/pull/1919)
|
||||
- Backports to beta [#2068](https://github.com/paritytech/parity/pull/2068)
|
||||
- Fixing serde overflow error (#1977) [#2030](https://github.com/paritytech/parity/pull/2030)
|
||||
- Simplified db pruning detection in beta [#1924](https://github.com/paritytech/parity/pull/1924)
|
||||
- Backports to beta [#1919](https://github.com/paritytech/parity/pull/1919)
|
||||
|
||||
## Parity [v1.3.0: "Acuity"](https://github.com/openethereum/openethereum/releases/tag/v1.3.0) (2016-08-12)
|
||||
## Parity [v1.3.0: "Acuity"](https://github.com/paritytech/parity/releases/tag/v1.3.0) (2016-08-12)
|
||||
|
||||
As well as many bug fixes, 1.3.0 includes a number of important improvements including:
|
||||
- **Optimisations** Heavily optimised block/transaction processing core - up to 2x faster than 1.2 series.
|
||||
@@ -197,306 +197,306 @@ Incremental improvements include:
|
||||
- Various improvements to the miner including [HTTP push work notification](https://github.com/ethcoreparitytech/parity/wiki/Mining#starting-it).
|
||||
|
||||
Full changes:
|
||||
- Bumping Parity UI [#1920](https://github.com/openethereum/openethereum/pull/1920)
|
||||
- Adding entrypoints to docker images [#1909](https://github.com/openethereum/openethereum/pull/1909)
|
||||
- Save nodes removed from backing_overlay until commit [#1917](https://github.com/openethereum/openethereum/pull/1917)
|
||||
- RPC for importing geth keys [#1916](https://github.com/openethereum/openethereum/pull/1916)
|
||||
- Peers RPC + UI displaying active/connected/max peers [#1915](https://github.com/openethereum/openethereum/pull/1915)
|
||||
- RPC for deriving address from phrase. [#1912](https://github.com/openethereum/openethereum/pull/1912)
|
||||
- adjust polling & connection timeouts for ipc [#1910](https://github.com/openethereum/openethereum/pull/1910)
|
||||
- Don't return deleted nodes that are not yet flushed [#1908](https://github.com/openethereum/openethereum/pull/1908)
|
||||
- Wallet rpcs [#1898](https://github.com/openethereum/openethereum/pull/1898)
|
||||
- Fix binary serialization bug [#1907](https://github.com/openethereum/openethereum/pull/1907)
|
||||
- fixed #1889, .DS_Store is no longer treated as key file [#1892](https://github.com/openethereum/openethereum/pull/1892)
|
||||
- Purging .derefs, fixing clippy warnings. [#1890](https://github.com/openethereum/openethereum/pull/1890)
|
||||
- RocksDB version bump [#1904](https://github.com/openethereum/openethereum/pull/1904)
|
||||
- Fix ipc compilation and add ipc feature to test targets [#1902](https://github.com/openethereum/openethereum/pull/1902)
|
||||
- Autocreating geth dir if none and geth mode on [#1896](https://github.com/openethereum/openethereum/pull/1896)
|
||||
- v1.4.0 in master [#1886](https://github.com/openethereum/openethereum/pull/1886)
|
||||
- Adding more details to miner log [#1891](https://github.com/openethereum/openethereum/pull/1891)
|
||||
- moved hash.rs to bigint library [#1827](https://github.com/openethereum/openethereum/pull/1827)
|
||||
- fixed cache_manager lock order [#1877](https://github.com/openethereum/openethereum/pull/1877)
|
||||
- Fixing miner deadlock [#1885](https://github.com/openethereum/openethereum/pull/1885)
|
||||
- Updating WS + Increasing token validity [#1882](https://github.com/openethereum/openethereum/pull/1882)
|
||||
- take snapshot at specified block and slightly better informants [#1873](https://github.com/openethereum/openethereum/pull/1873)
|
||||
- RPC errors & logs [#1845](https://github.com/openethereum/openethereum/pull/1845)
|
||||
- Reduce max open files [#1876](https://github.com/openethereum/openethereum/pull/1876)
|
||||
- Send new block hashes to all peers [#1875](https://github.com/openethereum/openethereum/pull/1875)
|
||||
- Use UntrustedRlp for block verification [#1872](https://github.com/openethereum/openethereum/pull/1872)
|
||||
- Update cache usage on commiting block info [#1871](https://github.com/openethereum/openethereum/pull/1871)
|
||||
- Validating conversion U256->usize when doing gas calculation (for 32bits) [#1870](https://github.com/openethereum/openethereum/pull/1870)
|
||||
- Sync to peers with confirmed fork block only [#1863](https://github.com/openethereum/openethereum/pull/1863)
|
||||
- miner and client take spec reference [#1853](https://github.com/openethereum/openethereum/pull/1853)
|
||||
- Unlock account with timeout for geth compatibility [#1854](https://github.com/openethereum/openethereum/pull/1854)
|
||||
- Fixed reported max height and transaction propagation [#1852](https://github.com/openethereum/openethereum/pull/1852)
|
||||
- Snapshot creation and restoration [#1679](https://github.com/openethereum/openethereum/pull/1679)
|
||||
- fix deprecated typo [#1850](https://github.com/openethereum/openethereum/pull/1850)
|
||||
- Split IO and network crates [#1828](https://github.com/openethereum/openethereum/pull/1828)
|
||||
- updated classic JSON spec with classic bootnodes, fixes #1842 [#1847](https://github.com/openethereum/openethereum/pull/1847)
|
||||
- protect unsafety in plainhasher; get more unique hashes [#1841](https://github.com/openethereum/openethereum/pull/1841)
|
||||
- use mutex in dbtransaction [#1843](https://github.com/openethereum/openethereum/pull/1843)
|
||||
- Fix state not using "account_starting_nonce" [#1830](https://github.com/openethereum/openethereum/pull/1830)
|
||||
- Supporting blockid in eth_call and trace_call/trace_raw [#1837](https://github.com/openethereum/openethereum/pull/1837)
|
||||
- eth_checkTransaction renamed to eth_checkRequest [#1817](https://github.com/openethereum/openethereum/pull/1817)
|
||||
- Bump json-ipc-server again [#1839](https://github.com/openethereum/openethereum/pull/1839)
|
||||
- Fixing another deadlock in trace db [#1833](https://github.com/openethereum/openethereum/pull/1833)
|
||||
- Fix up the VM trace. [#1829](https://github.com/openethereum/openethereum/pull/1829)
|
||||
- fixed parsing export params, fixes #1826 [#1834](https://github.com/openethereum/openethereum/pull/1834)
|
||||
- More performance optimizations [#1814](https://github.com/openethereum/openethereum/pull/1814)
|
||||
- Bumping clippy & fixing warnings [#1823](https://github.com/openethereum/openethereum/pull/1823)
|
||||
- removed unused code from util and unnecessary dependency of FixedHash [#1824](https://github.com/openethereum/openethereum/pull/1824)
|
||||
- Remove (almost all) panickers from trie module [#1776](https://github.com/openethereum/openethereum/pull/1776)
|
||||
- Fixing account naming [#1810](https://github.com/openethereum/openethereum/pull/1810)
|
||||
- JournalDB inject [#1806](https://github.com/openethereum/openethereum/pull/1806)
|
||||
- No block number in get work while in geth-compat mode. [#1821](https://github.com/openethereum/openethereum/pull/1821)
|
||||
- Import wallet fix [#1820](https://github.com/openethereum/openethereum/pull/1820)
|
||||
- Supporting eth_sign in Signer [#1787](https://github.com/openethereum/openethereum/pull/1787)
|
||||
- Fixing cache update after chain reorg [#1816](https://github.com/openethereum/openethereum/pull/1816)
|
||||
- Development mode for Signer UI [#1788](https://github.com/openethereum/openethereum/pull/1788)
|
||||
- Miner tweaks [#1797](https://github.com/openethereum/openethereum/pull/1797)
|
||||
- Util & ipc clenup [#1807](https://github.com/openethereum/openethereum/pull/1807)
|
||||
- Fixing unlock parsing [#1802](https://github.com/openethereum/openethereum/pull/1802)
|
||||
- fixed importing presale wallet with encseed longer than 96 bytes [#1801](https://github.com/openethereum/openethereum/pull/1801)
|
||||
- DRYing build scripts [#1795](https://github.com/openethereum/openethereum/pull/1795)
|
||||
- Allow code from spec json [#1790](https://github.com/openethereum/openethereum/pull/1790)
|
||||
- nano-tests (ipc transport) to the CI [#1793](https://github.com/openethereum/openethereum/pull/1793)
|
||||
- Commit best block after closing transaction [#1791](https://github.com/openethereum/openethereum/pull/1791)
|
||||
- Place thread name in the log output [#1792](https://github.com/openethereum/openethereum/pull/1792)
|
||||
- Fix ipc tests and bring to CI [#1789](https://github.com/openethereum/openethereum/pull/1789)
|
||||
- dynamic keys pickup [#1779](https://github.com/openethereum/openethereum/pull/1779)
|
||||
- ipc version bump [#1783](https://github.com/openethereum/openethereum/pull/1783)
|
||||
- Prevent deadlock on trace GC [#1780](https://github.com/openethereum/openethereum/pull/1780)
|
||||
- fixed trace_transaction crash when block contained suicide [#1781](https://github.com/openethereum/openethereum/pull/1781)
|
||||
- Fix block body migration [#1777](https://github.com/openethereum/openethereum/pull/1777)
|
||||
- cache manager and clearing tracing cache [#1769](https://github.com/openethereum/openethereum/pull/1769)
|
||||
- Return storage as H256 from RPC. [#1774](https://github.com/openethereum/openethereum/pull/1774)
|
||||
- Instant sealing engine [#1767](https://github.com/openethereum/openethereum/pull/1767)
|
||||
- fix state unsafety with a mostly-guaranteed handle [#1755](https://github.com/openethereum/openethereum/pull/1755)
|
||||
- Gas for mem optimization [#1768](https://github.com/openethereum/openethereum/pull/1768)
|
||||
- Min and Max peers setting [#1771](https://github.com/openethereum/openethereum/pull/1771)
|
||||
- Disable WAL [#1765](https://github.com/openethereum/openethereum/pull/1765)
|
||||
- Add new line when printing start strings [#1766](https://github.com/openethereum/openethereum/pull/1766)
|
||||
- Log tweak [#1764](https://github.com/openethereum/openethereum/pull/1764)
|
||||
- Remove update_sealing call on importing own block [#1762](https://github.com/openethereum/openethereum/pull/1762)
|
||||
- Single DB [#1741](https://github.com/openethereum/openethereum/pull/1741)
|
||||
- Tweak format of log so it's not so verbose. [#1758](https://github.com/openethereum/openethereum/pull/1758)
|
||||
- Combine mining queue and enabled into single locked datum [#1749](https://github.com/openethereum/openethereum/pull/1749)
|
||||
- Collect consensus/null engines into a single module [#1754](https://github.com/openethereum/openethereum/pull/1754)
|
||||
- Fix failing deserialization test [#1756](https://github.com/openethereum/openethereum/pull/1756)
|
||||
- Stackoverflow fix [#1742](https://github.com/openethereum/openethereum/pull/1742)
|
||||
- compaction profile used during migration, fixes #1750 [#1751](https://github.com/openethereum/openethereum/pull/1751)
|
||||
- Splitting documentation into separate build job [#1752](https://github.com/openethereum/openethereum/pull/1752)
|
||||
- handle keys deserialization errors, fixes #1592 [#1701](https://github.com/openethereum/openethereum/pull/1701)
|
||||
- add gitlab-ci yaml [#1753](https://github.com/openethereum/openethereum/pull/1753)
|
||||
- Better handling of multiple migrations [#1747](https://github.com/openethereum/openethereum/pull/1747)
|
||||
- Disconnect peers on a fork [#1738](https://github.com/openethereum/openethereum/pull/1738)
|
||||
- Add RPC & client call to replay a transaction. [#1734](https://github.com/openethereum/openethereum/pull/1734)
|
||||
- another version bump for jsonrpc-ipc [#1744](https://github.com/openethereum/openethereum/pull/1744)
|
||||
- Trace other types of calls [#1727](https://github.com/openethereum/openethereum/pull/1727)
|
||||
- Fixing compilation on latest nightly [#1736](https://github.com/openethereum/openethereum/pull/1736)
|
||||
- Blocks and snapshot compression [#1687](https://github.com/openethereum/openethereum/pull/1687)
|
||||
- bump json-ipc-server version [#1739](https://github.com/openethereum/openethereum/pull/1739)
|
||||
- Use std::sync::Condvar [#1732](https://github.com/openethereum/openethereum/pull/1732)
|
||||
- Bump json-ipc-server version [#1733](https://github.com/openethereum/openethereum/pull/1733)
|
||||
- bump json-ipc-server version [#1731](https://github.com/openethereum/openethereum/pull/1731)
|
||||
- Fixing some clippy warnings [#1728](https://github.com/openethereum/openethereum/pull/1728)
|
||||
- Bumping Parity UI [#1682](https://github.com/openethereum/openethereum/pull/1682)
|
||||
- Various improvements to tracing & diagnostics. [#1707](https://github.com/openethereum/openethereum/pull/1707)
|
||||
- Fixed reading chunked EIP8 handshake [#1712](https://github.com/openethereum/openethereum/pull/1712)
|
||||
- Fix for importing blocks from a pipe file [#1724](https://github.com/openethereum/openethereum/pull/1724)
|
||||
- Proper errors for binary serializer [#1714](https://github.com/openethereum/openethereum/pull/1714)
|
||||
- Use a transaction for writing blocks [#1718](https://github.com/openethereum/openethereum/pull/1718)
|
||||
- Exclude generated code from coverage [#1720](https://github.com/openethereum/openethereum/pull/1720)
|
||||
- Use single binary for ipc modules [#1710](https://github.com/openethereum/openethereum/pull/1710)
|
||||
- Log a chain-reorg. [#1715](https://github.com/openethereum/openethereum/pull/1715)
|
||||
- Restore new block informant message [#1716](https://github.com/openethereum/openethereum/pull/1716)
|
||||
- Parallel block body download [#1659](https://github.com/openethereum/openethereum/pull/1659)
|
||||
- Rotate blockchain cache [#1709](https://github.com/openethereum/openethereum/pull/1709)
|
||||
- Fix broken internal names. [#1711](https://github.com/openethereum/openethereum/pull/1711)
|
||||
- cli overhaul [#1600](https://github.com/openethereum/openethereum/pull/1600)
|
||||
- Key files include timestamp in name. [#1700](https://github.com/openethereum/openethereum/pull/1700)
|
||||
- Fixing warnings [#1705](https://github.com/openethereum/openethereum/pull/1705)
|
||||
- Ethereum classic [#1706](https://github.com/openethereum/openethereum/pull/1706)
|
||||
- Docker Arguments [#1703](https://github.com/openethereum/openethereum/pull/1703)
|
||||
- Informant tidyup. [#1699](https://github.com/openethereum/openethereum/pull/1699)
|
||||
- Name and meta in accounts [#1695](https://github.com/openethereum/openethereum/pull/1695)
|
||||
- Stackoverflow #1686 [#1698](https://github.com/openethereum/openethereum/pull/1698)
|
||||
- filtering transactions toAddress includes contract creation [#1697](https://github.com/openethereum/openethereum/pull/1697)
|
||||
- Prevent syncing to ancient blocks [#1693](https://github.com/openethereum/openethereum/pull/1693)
|
||||
- Enable WAL and disable DB repair [#1696](https://github.com/openethereum/openethereum/pull/1696)
|
||||
- Returning error when transaction is rejected (for consistency) [#1667](https://github.com/openethereum/openethereum/pull/1667)
|
||||
- Disabling signer when in geth-compatibility mode [#1676](https://github.com/openethereum/openethereum/pull/1676)
|
||||
- Suicides tracing [#1688](https://github.com/openethereum/openethereum/pull/1688)
|
||||
- small cleanup of substate.rs [#1685](https://github.com/openethereum/openethereum/pull/1685)
|
||||
- resolve #411: remove install scripts [#1684](https://github.com/openethereum/openethereum/pull/1684)
|
||||
- IPC (feature-gated) [#1654](https://github.com/openethereum/openethereum/pull/1654)
|
||||
- Bumping JSONRPC-http-server [#1678](https://github.com/openethereum/openethereum/pull/1678)
|
||||
- Fixing hash deserialisation [#1674](https://github.com/openethereum/openethereum/pull/1674)
|
||||
- Ping discovery nodes gradually [#1671](https://github.com/openethereum/openethereum/pull/1671)
|
||||
- Fixing the deadlock on incoming connection [#1672](https://github.com/openethereum/openethereum/pull/1672)
|
||||
- Fixing errors returned by sendTransaction* method family [#1665](https://github.com/openethereum/openethereum/pull/1665)
|
||||
- Moved syncing log out of the client [#1670](https://github.com/openethereum/openethereum/pull/1670)
|
||||
- Host validation (again) [#1666](https://github.com/openethereum/openethereum/pull/1666)
|
||||
- Update install-deps.sh [ci skip] [#1664](https://github.com/openethereum/openethereum/pull/1664)
|
||||
- fix typos [#1644](https://github.com/openethereum/openethereum/pull/1644)
|
||||
- Size for blocks [#1668](https://github.com/openethereum/openethereum/pull/1668)
|
||||
- Revert "Validating Host headers in RPC requests" [#1663](https://github.com/openethereum/openethereum/pull/1663)
|
||||
- Validating Host headers in RPC requests [#1658](https://github.com/openethereum/openethereum/pull/1658)
|
||||
- fixed failing master [#1662](https://github.com/openethereum/openethereum/pull/1662)
|
||||
- Fixing clippy warnings [#1660](https://github.com/openethereum/openethereum/pull/1660)
|
||||
- Don't ping all nodes on start [#1656](https://github.com/openethereum/openethereum/pull/1656)
|
||||
- More performance optimizations [#1649](https://github.com/openethereum/openethereum/pull/1649)
|
||||
- Removing unused client code [#1645](https://github.com/openethereum/openethereum/pull/1645)
|
||||
- Asynchronous transactions (polling based for now). [#1652](https://github.com/openethereum/openethereum/pull/1652)
|
||||
- Sync stand-alone binary and feature-gated dependencies refactoring [#1637](https://github.com/openethereum/openethereum/pull/1637)
|
||||
- Re-enabling Parity UI [#1627](https://github.com/openethereum/openethereum/pull/1627)
|
||||
- Blockchain repair on missing state root [#1646](https://github.com/openethereum/openethereum/pull/1646)
|
||||
- Multi-mode logging. [#1643](https://github.com/openethereum/openethereum/pull/1643)
|
||||
- Pro paths [#1650](https://github.com/openethereum/openethereum/pull/1650)
|
||||
- Performance optimizations [#1642](https://github.com/openethereum/openethereum/pull/1642)
|
||||
- Removed DAO soft fork traces [#1639](https://github.com/openethereum/openethereum/pull/1639)
|
||||
- Compiler version update for windows [#1638](https://github.com/openethereum/openethereum/pull/1638)
|
||||
- Delete values immediately from DB overlay [#1631](https://github.com/openethereum/openethereum/pull/1631)
|
||||
- DAO hard-fork [#1483](https://github.com/openethereum/openethereum/pull/1483)
|
||||
- fix network_start regression [#1629](https://github.com/openethereum/openethereum/pull/1629)
|
||||
- Die if the DB is newer than the one supported. [#1630](https://github.com/openethereum/openethereum/pull/1630)
|
||||
- Cleanup of colour code. Use is_a_tty. [#1621](https://github.com/openethereum/openethereum/pull/1621)
|
||||
- don't batch best block for branches [#1623](https://github.com/openethereum/openethereum/pull/1623)
|
||||
- In-memory trie operations [#1408](https://github.com/openethereum/openethereum/pull/1408)
|
||||
- Fix "pending" parameter on RPC block requests [#1602](https://github.com/openethereum/openethereum/pull/1602)
|
||||
- Allow RPC to use solc to compile solidity [#1607](https://github.com/openethereum/openethereum/pull/1607)
|
||||
- IPC RPC deriving for traits [#1599](https://github.com/openethereum/openethereum/pull/1599)
|
||||
- Utilize cached kcov if exists [#1619](https://github.com/openethereum/openethereum/pull/1619)
|
||||
- Fixing no-ui feature [#1618](https://github.com/openethereum/openethereum/pull/1618)
|
||||
- Couple of rocksdb optimizations [#1614](https://github.com/openethereum/openethereum/pull/1614)
|
||||
- Miner tests [#1597](https://github.com/openethereum/openethereum/pull/1597)
|
||||
- Sync IPC interface [#1584](https://github.com/openethereum/openethereum/pull/1584)
|
||||
- Make sure reserved peers are in the node table [#1616](https://github.com/openethereum/openethereum/pull/1616)
|
||||
- Fix bloomchain on blockchain repair [#1610](https://github.com/openethereum/openethereum/pull/1610)
|
||||
- fixed broken tracing [#1615](https://github.com/openethereum/openethereum/pull/1615)
|
||||
- fix benchmark compilation [#1612](https://github.com/openethereum/openethereum/pull/1612)
|
||||
- Updating jsonrpc-http-server [#1611](https://github.com/openethereum/openethereum/pull/1611)
|
||||
- replace synchronization primitives with those from parking_lot [#1593](https://github.com/openethereum/openethereum/pull/1593)
|
||||
- ui compilation feature [#1604](https://github.com/openethereum/openethereum/pull/1604)
|
||||
- is_zero() and pow() optimisations for uint [#1608](https://github.com/openethereum/openethereum/pull/1608)
|
||||
- Optimizing & Cleaning the build [#1591](https://github.com/openethereum/openethereum/pull/1591)
|
||||
- Fix logging [#1590](https://github.com/openethereum/openethereum/pull/1590)
|
||||
- remove unnecessary mutex in logging [#1601](https://github.com/openethereum/openethereum/pull/1601)
|
||||
- Using streamlined parity-ui repository [#1566](https://github.com/openethereum/openethereum/pull/1566)
|
||||
- Optimizing InstructionInfo access. [#1595](https://github.com/openethereum/openethereum/pull/1595)
|
||||
- V7 Migration progress indicator [#1594](https://github.com/openethereum/openethereum/pull/1594)
|
||||
- bring snapshotting work into master [#1577](https://github.com/openethereum/openethereum/pull/1577)
|
||||
- Bump clippy [#1587](https://github.com/openethereum/openethereum/pull/1587)
|
||||
- refactoring of handshake messages serialization in ipc [#1586](https://github.com/openethereum/openethereum/pull/1586)
|
||||
- expunge &Vec<T> pattern [#1579](https://github.com/openethereum/openethereum/pull/1579)
|
||||
- EVM gas for memory tiny optimization [#1578](https://github.com/openethereum/openethereum/pull/1578)
|
||||
- cleaned up parity/signer [#1551](https://github.com/openethereum/openethereum/pull/1551)
|
||||
- Major sync <-> client interactions refactoring [#1572](https://github.com/openethereum/openethereum/pull/1572)
|
||||
- failing test with overlayrecent pruning [#1567](https://github.com/openethereum/openethereum/pull/1567)
|
||||
- Enable state queries for OverlayRecent DB [#1575](https://github.com/openethereum/openethereum/pull/1575)
|
||||
- have AccountDB use address hash for uniqueness [#1533](https://github.com/openethereum/openethereum/pull/1533)
|
||||
- Very basic EVM binary. [#1574](https://github.com/openethereum/openethereum/pull/1574)
|
||||
- Some obvious evm & uint optimizations [#1576](https://github.com/openethereum/openethereum/pull/1576)
|
||||
- Fixing clippy warnings [#1568](https://github.com/openethereum/openethereum/pull/1568)
|
||||
- Miner's gas price gets updated dynamically [#1570](https://github.com/openethereum/openethereum/pull/1570)
|
||||
- bringing hypervisor as a crate in ipc dir [#1565](https://github.com/openethereum/openethereum/pull/1565)
|
||||
- Init public interface with IO message [#1573](https://github.com/openethereum/openethereum/pull/1573)
|
||||
- Uncommenting simple Miner tests [#1571](https://github.com/openethereum/openethereum/pull/1571)
|
||||
- Kill lock unwraps [#1558](https://github.com/openethereum/openethereum/pull/1558)
|
||||
- Fixing deadlock in miner [#1569](https://github.com/openethereum/openethereum/pull/1569)
|
||||
- Idealpeers in log [#1563](https://github.com/openethereum/openethereum/pull/1563)
|
||||
- Simple style fix. [#1561](https://github.com/openethereum/openethereum/pull/1561)
|
||||
- Enum variants serialisation test&fix [#1559](https://github.com/openethereum/openethereum/pull/1559)
|
||||
- Supporting /api/ping for dapps server [#1543](https://github.com/openethereum/openethereum/pull/1543)
|
||||
- Client IPC Interface [#1493](https://github.com/openethereum/openethereum/pull/1493)
|
||||
- Kill timers when removing IO handler [#1554](https://github.com/openethereum/openethereum/pull/1554)
|
||||
- Fix and add info messages [#1552](https://github.com/openethereum/openethereum/pull/1552)
|
||||
- Fix indent of #1541 [#1555](https://github.com/openethereum/openethereum/pull/1555)
|
||||
- Update sealing just once when externally importing many blocks [#1541](https://github.com/openethereum/openethereum/pull/1541)
|
||||
- Remove soft-fork stuff. [#1548](https://github.com/openethereum/openethereum/pull/1548)
|
||||
- fix codegen warning [#1550](https://github.com/openethereum/openethereum/pull/1550)
|
||||
- Extend migration framework [#1546](https://github.com/openethereum/openethereum/pull/1546)
|
||||
- Refactoring dapps to support API endpoints. [#1542](https://github.com/openethereum/openethereum/pull/1542)
|
||||
- serde is no longer util dependency [#1534](https://github.com/openethereum/openethereum/pull/1534)
|
||||
- mention wiki in README [#1549](https://github.com/openethereum/openethereum/pull/1549)
|
||||
- Skipping transactions with invalid nonces when pushing to block. [#1545](https://github.com/openethereum/openethereum/pull/1545)
|
||||
- Silent running operating modes [#1477](https://github.com/openethereum/openethereum/pull/1477)
|
||||
- util cleanup [#1474](https://github.com/openethereum/openethereum/pull/1474)
|
||||
- Calculating gas using usize (if supplied gaslimit fits in usize) [#1518](https://github.com/openethereum/openethereum/pull/1518)
|
||||
- add owning NibbleVec [#1536](https://github.com/openethereum/openethereum/pull/1536)
|
||||
- Attempt to fix blochchain/extras DBs sync [#1538](https://github.com/openethereum/openethereum/pull/1538)
|
||||
- Client API refactoring - limiting errors to crate-level error types [#1525](https://github.com/openethereum/openethereum/pull/1525)
|
||||
- IPC codegen enhancement - allow void methods [#1540](https://github.com/openethereum/openethereum/pull/1540)
|
||||
- Fixing serving nested files for dapps. [#1539](https://github.com/openethereum/openethereum/pull/1539)
|
||||
- Fixed public address config [#1537](https://github.com/openethereum/openethereum/pull/1537)
|
||||
- Fixing compilation&clippy warnings [#1531](https://github.com/openethereum/openethereum/pull/1531)
|
||||
- creating ethereum dir while in geth mode [#1530](https://github.com/openethereum/openethereum/pull/1530)
|
||||
- Bumping clippy [#1532](https://github.com/openethereum/openethereum/pull/1532)
|
||||
- Make signer default as long as --unlock isn't used. [#1524](https://github.com/openethereum/openethereum/pull/1524)
|
||||
- add client timeout when requesting usd price for gas [#1526](https://github.com/openethereum/openethereum/pull/1526)
|
||||
- Fix gitter-url link in README.md [#1528](https://github.com/openethereum/openethereum/pull/1528)
|
||||
- Fix error message. [#1527](https://github.com/openethereum/openethereum/pull/1527)
|
||||
- BTreeMap binary serialization [#1489](https://github.com/openethereum/openethereum/pull/1489)
|
||||
- Save block reference in the queue on notification [#1501](https://github.com/openethereum/openethereum/pull/1501)
|
||||
- bigint tests to run on CI [#1522](https://github.com/openethereum/openethereum/pull/1522)
|
||||
- Client api cleaning - uncles are returned as rlp [#1516](https://github.com/openethereum/openethereum/pull/1516)
|
||||
- Fatdb integration with CLI [#1464](https://github.com/openethereum/openethereum/pull/1464)
|
||||
- Optimizing/simplifying shr [#1517](https://github.com/openethereum/openethereum/pull/1517)
|
||||
- change IPC codegen to allow attributes [#1500](https://github.com/openethereum/openethereum/pull/1500)
|
||||
- Fix warnings [#1514](https://github.com/openethereum/openethereum/pull/1514)
|
||||
- FatDB [#1452](https://github.com/openethereum/openethereum/pull/1452)
|
||||
- Fix the reseal mechanism. [#1513](https://github.com/openethereum/openethereum/pull/1513)
|
||||
- Update Dockerfile ubuntu-aarch64 [#1509](https://github.com/openethereum/openethereum/pull/1509)
|
||||
- Update Ubuntu-arm Dockerfile [#1510](https://github.com/openethereum/openethereum/pull/1510)
|
||||
- Update Ubuntu-jit Dockerfile [#1511](https://github.com/openethereum/openethereum/pull/1511)
|
||||
- Update Ubuntu Dockerfile [#1512](https://github.com/openethereum/openethereum/pull/1512)
|
||||
- Update CentOS Dockerfile [#1508](https://github.com/openethereum/openethereum/pull/1508)
|
||||
- bump status page v0.5.1 [#1502](https://github.com/openethereum/openethereum/pull/1502)
|
||||
- Update CentOS Dockerfile [#1507](https://github.com/openethereum/openethereum/pull/1507)
|
||||
- Update Dockerfile ubuntu-aarch64 [#1506](https://github.com/openethereum/openethereum/pull/1506)
|
||||
- Update Ubuntu-arm Dockerfile [#1505](https://github.com/openethereum/openethereum/pull/1505)
|
||||
- Update Ubuntu-jit Dockerfile [#1504](https://github.com/openethereum/openethereum/pull/1504)
|
||||
- Update Ubuntu Dockerfile [#1503](https://github.com/openethereum/openethereum/pull/1503)
|
||||
- Optionally clone block behind work-package [#1497](https://github.com/openethereum/openethereum/pull/1497)
|
||||
- Fix no colour on windows. [#1498](https://github.com/openethereum/openethereum/pull/1498)
|
||||
- Workaround for hyper panic [#1495](https://github.com/openethereum/openethereum/pull/1495)
|
||||
- Colourful notification on mine [#1488](https://github.com/openethereum/openethereum/pull/1488)
|
||||
- Quick fix for max open files error [#1494](https://github.com/openethereum/openethereum/pull/1494)
|
||||
- Work notification over HTTP [#1491](https://github.com/openethereum/openethereum/pull/1491)
|
||||
- Sealed block importing and propagation optimization [#1478](https://github.com/openethereum/openethereum/pull/1478)
|
||||
- vm factory to mining client [#1487](https://github.com/openethereum/openethereum/pull/1487)
|
||||
- topbar dialog fix [#1479](https://github.com/openethereum/openethereum/pull/1479)
|
||||
- Minor additions to allow resetting of code. [#1482](https://github.com/openethereum/openethereum/pull/1482)
|
||||
- Introduce options for fine-grained management of work queue. [#1484](https://github.com/openethereum/openethereum/pull/1484)
|
||||
- Snapshot state restoration [#1308](https://github.com/openethereum/openethereum/pull/1308)
|
||||
- Merge master into pv64 branch [#1486](https://github.com/openethereum/openethereum/pull/1486)
|
||||
- Ensure we don't reject our own transactions for gasprice. [#1485](https://github.com/openethereum/openethereum/pull/1485)
|
||||
- Signing parity executable & windows installer in appveyor [#1481](https://github.com/openethereum/openethereum/pull/1481)
|
||||
- Rearrange fork CLI options. [#1476](https://github.com/openethereum/openethereum/pull/1476)
|
||||
- give appveyor some breath [#1475](https://github.com/openethereum/openethereum/pull/1475)
|
||||
- Ensure we always get the latest work when mining on submitted. [#1469](https://github.com/openethereum/openethereum/pull/1469)
|
||||
- Tests for views [#1471](https://github.com/openethereum/openethereum/pull/1471)
|
||||
- json ipc version bump [#1470](https://github.com/openethereum/openethereum/pull/1470)
|
||||
- verifier is no longer a template type of client [#1467](https://github.com/openethereum/openethereum/pull/1467)
|
||||
- Allow configuration of when to reseal blocks. [#1460](https://github.com/openethereum/openethereum/pull/1460)
|
||||
- removed unsafe code [#1466](https://github.com/openethereum/openethereum/pull/1466)
|
||||
- WS bump + Adding default for value [#1465](https://github.com/openethereum/openethereum/pull/1465)
|
||||
- Attempt DB repair if corrupted [#1461](https://github.com/openethereum/openethereum/pull/1461)
|
||||
- Database configuration extended [#1454](https://github.com/openethereum/openethereum/pull/1454)
|
||||
- Updating WS-RS server [#1459](https://github.com/openethereum/openethereum/pull/1459)
|
||||
- Reduced IO messages; removed panics on IO notifications [#1457](https://github.com/openethereum/openethereum/pull/1457)
|
||||
- Handle errors when starting parity --signer [#1451](https://github.com/openethereum/openethereum/pull/1451)
|
||||
- Fixed losing queued blocks on error [#1453](https://github.com/openethereum/openethereum/pull/1453)
|
||||
- Updated to latest hyper with patched mio [#1450](https://github.com/openethereum/openethereum/pull/1450)
|
||||
- Retweak BASE and MULTIPLIER in rocksdb config. [#1445](https://github.com/openethereum/openethereum/pull/1445)
|
||||
- Removing Miner::default. [#1410](https://github.com/openethereum/openethereum/pull/1410)
|
||||
- Don't mine without --author [#1436](https://github.com/openethereum/openethereum/pull/1436)
|
||||
- Revert the rescuedao extradata. [#1437](https://github.com/openethereum/openethereum/pull/1437)
|
||||
- More conservative settings for rocksdb. [#1440](https://github.com/openethereum/openethereum/pull/1440)
|
||||
- v1.3.0 in master [#1421](https://github.com/openethereum/openethereum/pull/1421)
|
||||
- Update Ubuntu-arm Dockerfile [#1429](https://github.com/openethereum/openethereum/pull/1429)
|
||||
- Create Dockerfile ubuntu-aarch64 [#1430](https://github.com/openethereum/openethereum/pull/1430)
|
||||
- Update CentOS Dockerfile [#1424](https://github.com/openethereum/openethereum/pull/1424)
|
||||
- Update Ubuntu Dockerfile [#1426](https://github.com/openethereum/openethereum/pull/1426)
|
||||
- Update Ubuntu-jit Dockerfile [#1427](https://github.com/openethereum/openethereum/pull/1427)
|
||||
- Update SF blocknumber to 1800000. [#1418](https://github.com/openethereum/openethereum/pull/1418)
|
||||
- Bumping Parity UI [#1920](https://github.com/paritytech/parity/pull/1920)
|
||||
- Adding entrypoints to docker images [#1909](https://github.com/paritytech/parity/pull/1909)
|
||||
- Save nodes removed from backing_overlay until commit [#1917](https://github.com/paritytech/parity/pull/1917)
|
||||
- RPC for importing geth keys [#1916](https://github.com/paritytech/parity/pull/1916)
|
||||
- Peers RPC + UI displaying active/connected/max peers [#1915](https://github.com/paritytech/parity/pull/1915)
|
||||
- RPC for deriving address from phrase. [#1912](https://github.com/paritytech/parity/pull/1912)
|
||||
- adjust polling & connection timeouts for ipc [#1910](https://github.com/paritytech/parity/pull/1910)
|
||||
- Don't return deleted nodes that are not yet flushed [#1908](https://github.com/paritytech/parity/pull/1908)
|
||||
- Wallet rpcs [#1898](https://github.com/paritytech/parity/pull/1898)
|
||||
- Fix binary serialization bug [#1907](https://github.com/paritytech/parity/pull/1907)
|
||||
- fixed #1889, .DS_Store is no longer treated as key file [#1892](https://github.com/paritytech/parity/pull/1892)
|
||||
- Purging .derefs, fixing clippy warnings. [#1890](https://github.com/paritytech/parity/pull/1890)
|
||||
- RocksDB version bump [#1904](https://github.com/paritytech/parity/pull/1904)
|
||||
- Fix ipc compilation and add ipc feature to test targets [#1902](https://github.com/paritytech/parity/pull/1902)
|
||||
- Autocreating geth dir if none and geth mode on [#1896](https://github.com/paritytech/parity/pull/1896)
|
||||
- v1.4.0 in master [#1886](https://github.com/paritytech/parity/pull/1886)
|
||||
- Adding more details to miner log [#1891](https://github.com/paritytech/parity/pull/1891)
|
||||
- moved hash.rs to bigint library [#1827](https://github.com/paritytech/parity/pull/1827)
|
||||
- fixed cache_manager lock order [#1877](https://github.com/paritytech/parity/pull/1877)
|
||||
- Fixing miner deadlock [#1885](https://github.com/paritytech/parity/pull/1885)
|
||||
- Updating WS + Increasing token validity [#1882](https://github.com/paritytech/parity/pull/1882)
|
||||
- take snapshot at specified block and slightly better informants [#1873](https://github.com/paritytech/parity/pull/1873)
|
||||
- RPC errors & logs [#1845](https://github.com/paritytech/parity/pull/1845)
|
||||
- Reduce max open files [#1876](https://github.com/paritytech/parity/pull/1876)
|
||||
- Send new block hashes to all peers [#1875](https://github.com/paritytech/parity/pull/1875)
|
||||
- Use UntrustedRlp for block verification [#1872](https://github.com/paritytech/parity/pull/1872)
|
||||
- Update cache usage on commiting block info [#1871](https://github.com/paritytech/parity/pull/1871)
|
||||
- Validating conversion U256->usize when doing gas calculation (for 32bits) [#1870](https://github.com/paritytech/parity/pull/1870)
|
||||
- Sync to peers with confirmed fork block only [#1863](https://github.com/paritytech/parity/pull/1863)
|
||||
- miner and client take spec reference [#1853](https://github.com/paritytech/parity/pull/1853)
|
||||
- Unlock account with timeout for geth compatibility [#1854](https://github.com/paritytech/parity/pull/1854)
|
||||
- Fixed reported max height and transaction propagation [#1852](https://github.com/paritytech/parity/pull/1852)
|
||||
- Snapshot creation and restoration [#1679](https://github.com/paritytech/parity/pull/1679)
|
||||
- fix deprecated typo [#1850](https://github.com/paritytech/parity/pull/1850)
|
||||
- Split IO and network crates [#1828](https://github.com/paritytech/parity/pull/1828)
|
||||
- updated classic JSON spec with classic bootnodes, fixes #1842 [#1847](https://github.com/paritytech/parity/pull/1847)
|
||||
- protect unsafety in plainhasher; get more unique hashes [#1841](https://github.com/paritytech/parity/pull/1841)
|
||||
- use mutex in dbtransaction [#1843](https://github.com/paritytech/parity/pull/1843)
|
||||
- Fix state not using "account_starting_nonce" [#1830](https://github.com/paritytech/parity/pull/1830)
|
||||
- Supporting blockid in eth_call and trace_call/trace_raw [#1837](https://github.com/paritytech/parity/pull/1837)
|
||||
- eth_checkTransaction renamed to eth_checkRequest [#1817](https://github.com/paritytech/parity/pull/1817)
|
||||
- Bump json-ipc-server again [#1839](https://github.com/paritytech/parity/pull/1839)
|
||||
- Fixing another deadlock in trace db [#1833](https://github.com/paritytech/parity/pull/1833)
|
||||
- Fix up the VM trace. [#1829](https://github.com/paritytech/parity/pull/1829)
|
||||
- fixed parsing export params, fixes #1826 [#1834](https://github.com/paritytech/parity/pull/1834)
|
||||
- More performance optimizations [#1814](https://github.com/paritytech/parity/pull/1814)
|
||||
- Bumping clippy & fixing warnings [#1823](https://github.com/paritytech/parity/pull/1823)
|
||||
- removed unused code from util and unnecessary dependency of FixedHash [#1824](https://github.com/paritytech/parity/pull/1824)
|
||||
- Remove (almost all) panickers from trie module [#1776](https://github.com/paritytech/parity/pull/1776)
|
||||
- Fixing account naming [#1810](https://github.com/paritytech/parity/pull/1810)
|
||||
- JournalDB inject [#1806](https://github.com/paritytech/parity/pull/1806)
|
||||
- No block number in get work while in geth-compat mode. [#1821](https://github.com/paritytech/parity/pull/1821)
|
||||
- Import wallet fix [#1820](https://github.com/paritytech/parity/pull/1820)
|
||||
- Supporting eth_sign in Signer [#1787](https://github.com/paritytech/parity/pull/1787)
|
||||
- Fixing cache update after chain reorg [#1816](https://github.com/paritytech/parity/pull/1816)
|
||||
- Development mode for Signer UI [#1788](https://github.com/paritytech/parity/pull/1788)
|
||||
- Miner tweaks [#1797](https://github.com/paritytech/parity/pull/1797)
|
||||
- Util & ipc clenup [#1807](https://github.com/paritytech/parity/pull/1807)
|
||||
- Fixing unlock parsing [#1802](https://github.com/paritytech/parity/pull/1802)
|
||||
- fixed importing presale wallet with encseed longer than 96 bytes [#1801](https://github.com/paritytech/parity/pull/1801)
|
||||
- DRYing build scripts [#1795](https://github.com/paritytech/parity/pull/1795)
|
||||
- Allow code from spec json [#1790](https://github.com/paritytech/parity/pull/1790)
|
||||
- nano-tests (ipc transport) to the CI [#1793](https://github.com/paritytech/parity/pull/1793)
|
||||
- Commit best block after closing transaction [#1791](https://github.com/paritytech/parity/pull/1791)
|
||||
- Place thread name in the log output [#1792](https://github.com/paritytech/parity/pull/1792)
|
||||
- Fix ipc tests and bring to CI [#1789](https://github.com/paritytech/parity/pull/1789)
|
||||
- dynamic keys pickup [#1779](https://github.com/paritytech/parity/pull/1779)
|
||||
- ipc version bump [#1783](https://github.com/paritytech/parity/pull/1783)
|
||||
- Prevent deadlock on trace GC [#1780](https://github.com/paritytech/parity/pull/1780)
|
||||
- fixed trace_transaction crash when block contained suicide [#1781](https://github.com/paritytech/parity/pull/1781)
|
||||
- Fix block body migration [#1777](https://github.com/paritytech/parity/pull/1777)
|
||||
- cache manager and clearing tracing cache [#1769](https://github.com/paritytech/parity/pull/1769)
|
||||
- Return storage as H256 from RPC. [#1774](https://github.com/paritytech/parity/pull/1774)
|
||||
- Instant sealing engine [#1767](https://github.com/paritytech/parity/pull/1767)
|
||||
- fix state unsafety with a mostly-guaranteed handle [#1755](https://github.com/paritytech/parity/pull/1755)
|
||||
- Gas for mem optimization [#1768](https://github.com/paritytech/parity/pull/1768)
|
||||
- Min and Max peers setting [#1771](https://github.com/paritytech/parity/pull/1771)
|
||||
- Disable WAL [#1765](https://github.com/paritytech/parity/pull/1765)
|
||||
- Add new line when printing start strings [#1766](https://github.com/paritytech/parity/pull/1766)
|
||||
- Log tweak [#1764](https://github.com/paritytech/parity/pull/1764)
|
||||
- Remove update_sealing call on importing own block [#1762](https://github.com/paritytech/parity/pull/1762)
|
||||
- Single DB [#1741](https://github.com/paritytech/parity/pull/1741)
|
||||
- Tweak format of log so it's not so verbose. [#1758](https://github.com/paritytech/parity/pull/1758)
|
||||
- Combine mining queue and enabled into single locked datum [#1749](https://github.com/paritytech/parity/pull/1749)
|
||||
- Collect consensus/null engines into a single module [#1754](https://github.com/paritytech/parity/pull/1754)
|
||||
- Fix failing deserialization test [#1756](https://github.com/paritytech/parity/pull/1756)
|
||||
- Stackoverflow fix [#1742](https://github.com/paritytech/parity/pull/1742)
|
||||
- compaction profile used during migration, fixes #1750 [#1751](https://github.com/paritytech/parity/pull/1751)
|
||||
- Splitting documentation into separate build job [#1752](https://github.com/paritytech/parity/pull/1752)
|
||||
- handle keys deserialization errors, fixes #1592 [#1701](https://github.com/paritytech/parity/pull/1701)
|
||||
- add gitlab-ci yaml [#1753](https://github.com/paritytech/parity/pull/1753)
|
||||
- Better handling of multiple migrations [#1747](https://github.com/paritytech/parity/pull/1747)
|
||||
- Disconnect peers on a fork [#1738](https://github.com/paritytech/parity/pull/1738)
|
||||
- Add RPC & client call to replay a transaction. [#1734](https://github.com/paritytech/parity/pull/1734)
|
||||
- another version bump for jsonrpc-ipc [#1744](https://github.com/paritytech/parity/pull/1744)
|
||||
- Trace other types of calls [#1727](https://github.com/paritytech/parity/pull/1727)
|
||||
- Fixing compilation on latest nightly [#1736](https://github.com/paritytech/parity/pull/1736)
|
||||
- Blocks and snapshot compression [#1687](https://github.com/paritytech/parity/pull/1687)
|
||||
- bump json-ipc-server version [#1739](https://github.com/paritytech/parity/pull/1739)
|
||||
- Use std::sync::Condvar [#1732](https://github.com/paritytech/parity/pull/1732)
|
||||
- Bump json-ipc-server version [#1733](https://github.com/paritytech/parity/pull/1733)
|
||||
- bump json-ipc-server version [#1731](https://github.com/paritytech/parity/pull/1731)
|
||||
- Fixing some clippy warnings [#1728](https://github.com/paritytech/parity/pull/1728)
|
||||
- Bumping Parity UI [#1682](https://github.com/paritytech/parity/pull/1682)
|
||||
- Various improvements to tracing & diagnostics. [#1707](https://github.com/paritytech/parity/pull/1707)
|
||||
- Fixed reading chunked EIP8 handshake [#1712](https://github.com/paritytech/parity/pull/1712)
|
||||
- Fix for importing blocks from a pipe file [#1724](https://github.com/paritytech/parity/pull/1724)
|
||||
- Proper errors for binary serializer [#1714](https://github.com/paritytech/parity/pull/1714)
|
||||
- Use a transaction for writing blocks [#1718](https://github.com/paritytech/parity/pull/1718)
|
||||
- Exclude generated code from coverage [#1720](https://github.com/paritytech/parity/pull/1720)
|
||||
- Use single binary for ipc modules [#1710](https://github.com/paritytech/parity/pull/1710)
|
||||
- Log a chain-reorg. [#1715](https://github.com/paritytech/parity/pull/1715)
|
||||
- Restore new block informant message [#1716](https://github.com/paritytech/parity/pull/1716)
|
||||
- Parallel block body download [#1659](https://github.com/paritytech/parity/pull/1659)
|
||||
- Rotate blockchain cache [#1709](https://github.com/paritytech/parity/pull/1709)
|
||||
- Fix broken internal names. [#1711](https://github.com/paritytech/parity/pull/1711)
|
||||
- cli overhaul [#1600](https://github.com/paritytech/parity/pull/1600)
|
||||
- Key files include timestamp in name. [#1700](https://github.com/paritytech/parity/pull/1700)
|
||||
- Fixing warnings [#1705](https://github.com/paritytech/parity/pull/1705)
|
||||
- Ethereum classic [#1706](https://github.com/paritytech/parity/pull/1706)
|
||||
- Docker Arguments [#1703](https://github.com/paritytech/parity/pull/1703)
|
||||
- Informant tidyup. [#1699](https://github.com/paritytech/parity/pull/1699)
|
||||
- Name and meta in accounts [#1695](https://github.com/paritytech/parity/pull/1695)
|
||||
- Stackoverflow #1686 [#1698](https://github.com/paritytech/parity/pull/1698)
|
||||
- filtering transactions toAddress includes contract creation [#1697](https://github.com/paritytech/parity/pull/1697)
|
||||
- Prevent syncing to ancient blocks [#1693](https://github.com/paritytech/parity/pull/1693)
|
||||
- Enable WAL and disable DB repair [#1696](https://github.com/paritytech/parity/pull/1696)
|
||||
- Returning error when transaction is rejected (for consistency) [#1667](https://github.com/paritytech/parity/pull/1667)
|
||||
- Disabling signer when in geth-compatibility mode [#1676](https://github.com/paritytech/parity/pull/1676)
|
||||
- Suicides tracing [#1688](https://github.com/paritytech/parity/pull/1688)
|
||||
- small cleanup of substate.rs [#1685](https://github.com/paritytech/parity/pull/1685)
|
||||
- resolve #411: remove install scripts [#1684](https://github.com/paritytech/parity/pull/1684)
|
||||
- IPC (feature-gated) [#1654](https://github.com/paritytech/parity/pull/1654)
|
||||
- Bumping JSONRPC-http-server [#1678](https://github.com/paritytech/parity/pull/1678)
|
||||
- Fixing hash deserialisation [#1674](https://github.com/paritytech/parity/pull/1674)
|
||||
- Ping discovery nodes gradually [#1671](https://github.com/paritytech/parity/pull/1671)
|
||||
- Fixing the deadlock on incoming connection [#1672](https://github.com/paritytech/parity/pull/1672)
|
||||
- Fixing errors returned by sendTransaction* method family [#1665](https://github.com/paritytech/parity/pull/1665)
|
||||
- Moved syncing log out of the client [#1670](https://github.com/paritytech/parity/pull/1670)
|
||||
- Host validation (again) [#1666](https://github.com/paritytech/parity/pull/1666)
|
||||
- Update install-deps.sh [ci skip] [#1664](https://github.com/paritytech/parity/pull/1664)
|
||||
- fix typos [#1644](https://github.com/paritytech/parity/pull/1644)
|
||||
- Size for blocks [#1668](https://github.com/paritytech/parity/pull/1668)
|
||||
- Revert "Validating Host headers in RPC requests" [#1663](https://github.com/paritytech/parity/pull/1663)
|
||||
- Validating Host headers in RPC requests [#1658](https://github.com/paritytech/parity/pull/1658)
|
||||
- fixed failing master [#1662](https://github.com/paritytech/parity/pull/1662)
|
||||
- Fixing clippy warnings [#1660](https://github.com/paritytech/parity/pull/1660)
|
||||
- Don't ping all nodes on start [#1656](https://github.com/paritytech/parity/pull/1656)
|
||||
- More performance optimizations [#1649](https://github.com/paritytech/parity/pull/1649)
|
||||
- Removing unused client code [#1645](https://github.com/paritytech/parity/pull/1645)
|
||||
- Asynchronous transactions (polling based for now). [#1652](https://github.com/paritytech/parity/pull/1652)
|
||||
- Sync stand-alone binary and feature-gated dependencies refactoring [#1637](https://github.com/paritytech/parity/pull/1637)
|
||||
- Re-enabling Parity UI [#1627](https://github.com/paritytech/parity/pull/1627)
|
||||
- Blockchain repair on missing state root [#1646](https://github.com/paritytech/parity/pull/1646)
|
||||
- Multi-mode logging. [#1643](https://github.com/paritytech/parity/pull/1643)
|
||||
- Pro paths [#1650](https://github.com/paritytech/parity/pull/1650)
|
||||
- Performance optimizations [#1642](https://github.com/paritytech/parity/pull/1642)
|
||||
- Removed DAO soft fork traces [#1639](https://github.com/paritytech/parity/pull/1639)
|
||||
- Compiler version update for windows [#1638](https://github.com/paritytech/parity/pull/1638)
|
||||
- Delete values immediately from DB overlay [#1631](https://github.com/paritytech/parity/pull/1631)
|
||||
- DAO hard-fork [#1483](https://github.com/paritytech/parity/pull/1483)
|
||||
- fix network_start regression [#1629](https://github.com/paritytech/parity/pull/1629)
|
||||
- Die if the DB is newer than the one supported. [#1630](https://github.com/paritytech/parity/pull/1630)
|
||||
- Cleanup of colour code. Use is_a_tty. [#1621](https://github.com/paritytech/parity/pull/1621)
|
||||
- don't batch best block for branches [#1623](https://github.com/paritytech/parity/pull/1623)
|
||||
- In-memory trie operations [#1408](https://github.com/paritytech/parity/pull/1408)
|
||||
- Fix "pending" parameter on RPC block requests [#1602](https://github.com/paritytech/parity/pull/1602)
|
||||
- Allow RPC to use solc to compile solidity [#1607](https://github.com/paritytech/parity/pull/1607)
|
||||
- IPC RPC deriving for traits [#1599](https://github.com/paritytech/parity/pull/1599)
|
||||
- Utilize cached kcov if exists [#1619](https://github.com/paritytech/parity/pull/1619)
|
||||
- Fixing no-ui feature [#1618](https://github.com/paritytech/parity/pull/1618)
|
||||
- Couple of rocksdb optimizations [#1614](https://github.com/paritytech/parity/pull/1614)
|
||||
- Miner tests [#1597](https://github.com/paritytech/parity/pull/1597)
|
||||
- Sync IPC interface [#1584](https://github.com/paritytech/parity/pull/1584)
|
||||
- Make sure reserved peers are in the node table [#1616](https://github.com/paritytech/parity/pull/1616)
|
||||
- Fix bloomchain on blockchain repair [#1610](https://github.com/paritytech/parity/pull/1610)
|
||||
- fixed broken tracing [#1615](https://github.com/paritytech/parity/pull/1615)
|
||||
- fix benchmark compilation [#1612](https://github.com/paritytech/parity/pull/1612)
|
||||
- Updating jsonrpc-http-server [#1611](https://github.com/paritytech/parity/pull/1611)
|
||||
- replace synchronization primitives with those from parking_lot [#1593](https://github.com/paritytech/parity/pull/1593)
|
||||
- ui compilation feature [#1604](https://github.com/paritytech/parity/pull/1604)
|
||||
- is_zero() and pow() optimisations for uint [#1608](https://github.com/paritytech/parity/pull/1608)
|
||||
- Optimizing & Cleaning the build [#1591](https://github.com/paritytech/parity/pull/1591)
|
||||
- Fix logging [#1590](https://github.com/paritytech/parity/pull/1590)
|
||||
- remove unnecessary mutex in logging [#1601](https://github.com/paritytech/parity/pull/1601)
|
||||
- Using streamlined parity-ui repository [#1566](https://github.com/paritytech/parity/pull/1566)
|
||||
- Optimizing InstructionInfo access. [#1595](https://github.com/paritytech/parity/pull/1595)
|
||||
- V7 Migration progress indicator [#1594](https://github.com/paritytech/parity/pull/1594)
|
||||
- bring snapshotting work into master [#1577](https://github.com/paritytech/parity/pull/1577)
|
||||
- Bump clippy [#1587](https://github.com/paritytech/parity/pull/1587)
|
||||
- refactoring of handshake messages serialization in ipc [#1586](https://github.com/paritytech/parity/pull/1586)
|
||||
- expunge &Vec<T> pattern [#1579](https://github.com/paritytech/parity/pull/1579)
|
||||
- EVM gas for memory tiny optimization [#1578](https://github.com/paritytech/parity/pull/1578)
|
||||
- cleaned up parity/signer [#1551](https://github.com/paritytech/parity/pull/1551)
|
||||
- Major sync <-> client interactions refactoring [#1572](https://github.com/paritytech/parity/pull/1572)
|
||||
- failing test with overlayrecent pruning [#1567](https://github.com/paritytech/parity/pull/1567)
|
||||
- Enable state queries for OverlayRecent DB [#1575](https://github.com/paritytech/parity/pull/1575)
|
||||
- have AccountDB use address hash for uniqueness [#1533](https://github.com/paritytech/parity/pull/1533)
|
||||
- Very basic EVM binary. [#1574](https://github.com/paritytech/parity/pull/1574)
|
||||
- Some obvious evm & uint optimizations [#1576](https://github.com/paritytech/parity/pull/1576)
|
||||
- Fixing clippy warnings [#1568](https://github.com/paritytech/parity/pull/1568)
|
||||
- Miner's gas price gets updated dynamically [#1570](https://github.com/paritytech/parity/pull/1570)
|
||||
- bringing hypervisor as a crate in ipc dir [#1565](https://github.com/paritytech/parity/pull/1565)
|
||||
- Init public interface with IO message [#1573](https://github.com/paritytech/parity/pull/1573)
|
||||
- Uncommenting simple Miner tests [#1571](https://github.com/paritytech/parity/pull/1571)
|
||||
- Kill lock unwraps [#1558](https://github.com/paritytech/parity/pull/1558)
|
||||
- Fixing deadlock in miner [#1569](https://github.com/paritytech/parity/pull/1569)
|
||||
- Idealpeers in log [#1563](https://github.com/paritytech/parity/pull/1563)
|
||||
- Simple style fix. [#1561](https://github.com/paritytech/parity/pull/1561)
|
||||
- Enum variants serialisation test&fix [#1559](https://github.com/paritytech/parity/pull/1559)
|
||||
- Supporting /api/ping for dapps server [#1543](https://github.com/paritytech/parity/pull/1543)
|
||||
- Client IPC Interface [#1493](https://github.com/paritytech/parity/pull/1493)
|
||||
- Kill timers when removing IO handler [#1554](https://github.com/paritytech/parity/pull/1554)
|
||||
- Fix and add info messages [#1552](https://github.com/paritytech/parity/pull/1552)
|
||||
- Fix indent of #1541 [#1555](https://github.com/paritytech/parity/pull/1555)
|
||||
- Update sealing just once when externally importing many blocks [#1541](https://github.com/paritytech/parity/pull/1541)
|
||||
- Remove soft-fork stuff. [#1548](https://github.com/paritytech/parity/pull/1548)
|
||||
- fix codegen warning [#1550](https://github.com/paritytech/parity/pull/1550)
|
||||
- Extend migration framework [#1546](https://github.com/paritytech/parity/pull/1546)
|
||||
- Refactoring dapps to support API endpoints. [#1542](https://github.com/paritytech/parity/pull/1542)
|
||||
- serde is no longer util dependency [#1534](https://github.com/paritytech/parity/pull/1534)
|
||||
- mention wiki in README [#1549](https://github.com/paritytech/parity/pull/1549)
|
||||
- Skipping transactions with invalid nonces when pushing to block. [#1545](https://github.com/paritytech/parity/pull/1545)
|
||||
- Silent running operating modes [#1477](https://github.com/paritytech/parity/pull/1477)
|
||||
- util cleanup [#1474](https://github.com/paritytech/parity/pull/1474)
|
||||
- Calculating gas using usize (if supplied gaslimit fits in usize) [#1518](https://github.com/paritytech/parity/pull/1518)
|
||||
- add owning NibbleVec [#1536](https://github.com/paritytech/parity/pull/1536)
|
||||
- Attempt to fix blochchain/extras DBs sync [#1538](https://github.com/paritytech/parity/pull/1538)
|
||||
- Client API refactoring - limiting errors to crate-level error types [#1525](https://github.com/paritytech/parity/pull/1525)
|
||||
- IPC codegen enhancement - allow void methods [#1540](https://github.com/paritytech/parity/pull/1540)
|
||||
- Fixing serving nested files for dapps. [#1539](https://github.com/paritytech/parity/pull/1539)
|
||||
- Fixed public address config [#1537](https://github.com/paritytech/parity/pull/1537)
|
||||
- Fixing compilation&clippy warnings [#1531](https://github.com/paritytech/parity/pull/1531)
|
||||
- creating ethereum dir while in geth mode [#1530](https://github.com/paritytech/parity/pull/1530)
|
||||
- Bumping clippy [#1532](https://github.com/paritytech/parity/pull/1532)
|
||||
- Make signer default as long as --unlock isn't used. [#1524](https://github.com/paritytech/parity/pull/1524)
|
||||
- add client timeout when requesting usd price for gas [#1526](https://github.com/paritytech/parity/pull/1526)
|
||||
- Fix gitter-url link in README.md [#1528](https://github.com/paritytech/parity/pull/1528)
|
||||
- Fix error message. [#1527](https://github.com/paritytech/parity/pull/1527)
|
||||
- BTreeMap binary serialization [#1489](https://github.com/paritytech/parity/pull/1489)
|
||||
- Save block reference in the queue on notification [#1501](https://github.com/paritytech/parity/pull/1501)
|
||||
- bigint tests to run on CI [#1522](https://github.com/paritytech/parity/pull/1522)
|
||||
- Client api cleaning - uncles are returned as rlp [#1516](https://github.com/paritytech/parity/pull/1516)
|
||||
- Fatdb integration with CLI [#1464](https://github.com/paritytech/parity/pull/1464)
|
||||
- Optimizing/simplifying shr [#1517](https://github.com/paritytech/parity/pull/1517)
|
||||
- change IPC codegen to allow attributes [#1500](https://github.com/paritytech/parity/pull/1500)
|
||||
- Fix warnings [#1514](https://github.com/paritytech/parity/pull/1514)
|
||||
- FatDB [#1452](https://github.com/paritytech/parity/pull/1452)
|
||||
- Fix the reseal mechanism. [#1513](https://github.com/paritytech/parity/pull/1513)
|
||||
- Update Dockerfile ubuntu-aarch64 [#1509](https://github.com/paritytech/parity/pull/1509)
|
||||
- Update Ubuntu-arm Dockerfile [#1510](https://github.com/paritytech/parity/pull/1510)
|
||||
- Update Ubuntu-jit Dockerfile [#1511](https://github.com/paritytech/parity/pull/1511)
|
||||
- Update Ubuntu Dockerfile [#1512](https://github.com/paritytech/parity/pull/1512)
|
||||
- Update CentOS Dockerfile [#1508](https://github.com/paritytech/parity/pull/1508)
|
||||
- bump status page v0.5.1 [#1502](https://github.com/paritytech/parity/pull/1502)
|
||||
- Update CentOS Dockerfile [#1507](https://github.com/paritytech/parity/pull/1507)
|
||||
- Update Dockerfile ubuntu-aarch64 [#1506](https://github.com/paritytech/parity/pull/1506)
|
||||
- Update Ubuntu-arm Dockerfile [#1505](https://github.com/paritytech/parity/pull/1505)
|
||||
- Update Ubuntu-jit Dockerfile [#1504](https://github.com/paritytech/parity/pull/1504)
|
||||
- Update Ubuntu Dockerfile [#1503](https://github.com/paritytech/parity/pull/1503)
|
||||
- Optionally clone block behind work-package [#1497](https://github.com/paritytech/parity/pull/1497)
|
||||
- Fix no colour on windows. [#1498](https://github.com/paritytech/parity/pull/1498)
|
||||
- Workaround for hyper panic [#1495](https://github.com/paritytech/parity/pull/1495)
|
||||
- Colourful notification on mine [#1488](https://github.com/paritytech/parity/pull/1488)
|
||||
- Quick fix for max open files error [#1494](https://github.com/paritytech/parity/pull/1494)
|
||||
- Work notification over HTTP [#1491](https://github.com/paritytech/parity/pull/1491)
|
||||
- Sealed block importing and propagation optimization [#1478](https://github.com/paritytech/parity/pull/1478)
|
||||
- vm factory to mining client [#1487](https://github.com/paritytech/parity/pull/1487)
|
||||
- topbar dialog fix [#1479](https://github.com/paritytech/parity/pull/1479)
|
||||
- Minor additions to allow resetting of code. [#1482](https://github.com/paritytech/parity/pull/1482)
|
||||
- Introduce options for fine-grained management of work queue. [#1484](https://github.com/paritytech/parity/pull/1484)
|
||||
- Snapshot state restoration [#1308](https://github.com/paritytech/parity/pull/1308)
|
||||
- Merge master into pv64 branch [#1486](https://github.com/paritytech/parity/pull/1486)
|
||||
- Ensure we don't reject our own transactions for gasprice. [#1485](https://github.com/paritytech/parity/pull/1485)
|
||||
- Signing parity executable & windows installer in appveyor [#1481](https://github.com/paritytech/parity/pull/1481)
|
||||
- Rearrange fork CLI options. [#1476](https://github.com/paritytech/parity/pull/1476)
|
||||
- give appveyor some breath [#1475](https://github.com/paritytech/parity/pull/1475)
|
||||
- Ensure we always get the latest work when mining on submitted. [#1469](https://github.com/paritytech/parity/pull/1469)
|
||||
- Tests for views [#1471](https://github.com/paritytech/parity/pull/1471)
|
||||
- json ipc version bump [#1470](https://github.com/paritytech/parity/pull/1470)
|
||||
- verifier is no longer a template type of client [#1467](https://github.com/paritytech/parity/pull/1467)
|
||||
- Allow configuration of when to reseal blocks. [#1460](https://github.com/paritytech/parity/pull/1460)
|
||||
- removed unsafe code [#1466](https://github.com/paritytech/parity/pull/1466)
|
||||
- WS bump + Adding default for value [#1465](https://github.com/paritytech/parity/pull/1465)
|
||||
- Attempt DB repair if corrupted [#1461](https://github.com/paritytech/parity/pull/1461)
|
||||
- Database configuration extended [#1454](https://github.com/paritytech/parity/pull/1454)
|
||||
- Updating WS-RS server [#1459](https://github.com/paritytech/parity/pull/1459)
|
||||
- Reduced IO messages; removed panics on IO notifications [#1457](https://github.com/paritytech/parity/pull/1457)
|
||||
- Handle errors when starting parity --signer [#1451](https://github.com/paritytech/parity/pull/1451)
|
||||
- Fixed losing queued blocks on error [#1453](https://github.com/paritytech/parity/pull/1453)
|
||||
- Updated to latest hyper with patched mio [#1450](https://github.com/paritytech/parity/pull/1450)
|
||||
- Retweak BASE and MULTIPLIER in rocksdb config. [#1445](https://github.com/paritytech/parity/pull/1445)
|
||||
- Removing Miner::default. [#1410](https://github.com/paritytech/parity/pull/1410)
|
||||
- Don't mine without --author [#1436](https://github.com/paritytech/parity/pull/1436)
|
||||
- Revert the rescuedao extradata. [#1437](https://github.com/paritytech/parity/pull/1437)
|
||||
- More conservative settings for rocksdb. [#1440](https://github.com/paritytech/parity/pull/1440)
|
||||
- v1.3.0 in master [#1421](https://github.com/paritytech/parity/pull/1421)
|
||||
- Update Ubuntu-arm Dockerfile [#1429](https://github.com/paritytech/parity/pull/1429)
|
||||
- Create Dockerfile ubuntu-aarch64 [#1430](https://github.com/paritytech/parity/pull/1430)
|
||||
- Update CentOS Dockerfile [#1424](https://github.com/paritytech/parity/pull/1424)
|
||||
- Update Ubuntu Dockerfile [#1426](https://github.com/paritytech/parity/pull/1426)
|
||||
- Update Ubuntu-jit Dockerfile [#1427](https://github.com/paritytech/parity/pull/1427)
|
||||
- Update SF blocknumber to 1800000. [#1418](https://github.com/paritytech/parity/pull/1418)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user