Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Deprecate account management #10213

Merged
merged 35 commits into from
Feb 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
644b208
Extract accounts from ethcore.
tomusdrw Dec 31, 2018
b44fd8d
Fix ethcore.
tomusdrw Dec 31, 2018
3f47857
Get rid of AccountProvider in test_helpers
tomusdrw Dec 31, 2018
52741b0
Fix rest of the code.
tomusdrw Dec 31, 2018
68f927b
Re-use EngineSigner, fix tests.
tomusdrw Jan 2, 2019
b98a96d
Simplify EngineSigner to always have an Address.
tomusdrw Jan 3, 2019
7a26457
Fix RPC tests.
tomusdrw Jan 3, 2019
81ff2e5
Add deprecation notice to RPCs.
tomusdrw Jan 7, 2019
42899bd
Feature to disable accounts.
tomusdrw Jan 15, 2019
ae1122b
extract accounts in RPC
tomusdrw Jan 15, 2019
dc44a7d
Run with accounts in tests.
tomusdrw Jan 15, 2019
44abb4b
Merge branch 'master' into td-accounts
tomusdrw Jan 16, 2019
623bb31
Fix RPC compilation and tests.
tomusdrw Jan 17, 2019
858c5d3
Fix compilation of the binary.
tomusdrw Jan 17, 2019
166fa46
Fix compilation of the binary.
tomusdrw Jan 17, 2019
2a2aedc
Fix compilation with accounts enabled.
tomusdrw Jan 18, 2019
b8709d7
Merge remote-tracking branch 'origin/td-accounts' into td-accounts
tomusdrw Jan 18, 2019
78511ee
Merge branch 'master' into td-accounts
tomusdrw Jan 18, 2019
f980762
Fix tests.
tomusdrw Jan 18, 2019
7f77577
Update submodule.
tomusdrw Jan 18, 2019
22a76c5
Remove android.
tomusdrw Jan 18, 2019
0729133
Use derive for Default
tomusdrw Jan 22, 2019
e8a07d8
Merge branch 'master' into td-accounts
tomusdrw Jan 22, 2019
ad77cdf
Don't build secretstore by default.
tomusdrw Jan 22, 2019
e9543e5
Add link to issue.
tomusdrw Jan 22, 2019
121e41b
Merge branch 'master' into td-accounts
tomusdrw Jan 24, 2019
f4283d0
Merge branch 'master' into td-accounts
tomusdrw Jan 28, 2019
c03d88b
Merge branch 'master' into td-accounts
tomusdrw Jan 29, 2019
ddc1e5f
Refresh Cargo.lock.
tomusdrw Jan 29, 2019
9e198e0
Fix miner tests.
tomusdrw Jan 29, 2019
fb57ec7
Update rpc/Cargo.toml
niklasad1 Jan 30, 2019
de59679
Merge branch 'master' into td-accounts
tomusdrw Jan 31, 2019
99c0fcf
Merge branch 'master' into td-accounts
tomusdrw Feb 7, 2019
c770172
Merge branch 'master' into td-accounts
tomusdrw Feb 7, 2019
bf127c0
Fix private tests.
tomusdrw Feb 7, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ futures = "0.1"
fdlimit = "0.1"
ctrlc = { git = "https://github.com/paritytech/rust-ctrlc.git" }
jsonrpc-core = "10.0.1"
ethcore = { path = "ethcore", features = ["parity"] }
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"}
ethcore-db = { path = "ethcore/db" }
Expand All @@ -44,10 +45,10 @@ ethcore-network = { path = "util/network" }
ethcore-private-tx = { path = "ethcore/private-tx" }
ethcore-service = { path = "ethcore/service" }
ethcore-sync = { path = "ethcore/sync" }
ethstore = { path = "accounts/ethstore" }
ethereum-types = "0.4"
node-filter = { path = "ethcore/node-filter" }
ethkey = { path = "accounts/ethkey" }
ethstore = { path = "accounts/ethstore" }
node-filter = { path = "ethcore/node-filter" }
rlp = { version = "0.3.0", features = ["ethereum"] }
cli-signer= { path = "cli-signer" }
parity-daemonize = "0.1.1"
Expand Down Expand Up @@ -86,14 +87,16 @@ lazy_static = "1.2.0"
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-issue = ["ethcore/ci-skip-issue"]
test-heavy = ["ethcore/test-heavy"]
evm-debug = ["ethcore/evm-debug"]
evm-debug-tests = ["ethcore/evm-debug-tests"]
slow-blocks = ["ethcore/slow-blocks"]
secretstore = ["ethcore-secretstore"]
secretstore = ["ethcore-secretstore", "ethcore-secretstore/accounts"]
final = ["parity-version/final"]
deadlock_detection = ["parking_lot/deadlock_detection"]
# to create a memory profile (requires nightly rust), use e.g.
Expand Down
28 changes: 28 additions & 0 deletions accounts/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[package]
description = "Account management for Parity Ethereum"
homepage = "http://parity.io"
license = "GPL-3.0"
name = "ethcore-accounts"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

[dependencies]
common-types = { path = "../ethcore/types" }
ethkey = { path = "ethkey" }
ethstore = { path = "ethstore" }
log = "0.4"
parking_lot = "0.7"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"

[target.'cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))'.dependencies]
hardware-wallet = { path = "hw" }

[target.'cfg(not(any(target_os = "linux", target_os = "macos", target_os = "windows")))'.dependencies]
fake-hardware-wallet = { path = "fake-hardware-wallet" }

[dev-dependencies]
ethereum-types = "0.4"
tempdir = "0.3"
47 changes: 44 additions & 3 deletions json/src/misc/account_meta.rs → accounts/src/account_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,35 @@
// You should have received a copy of the GNU General Public License
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.

//! Misc deserialization.
//! Account Metadata

use hash;
use std::{
collections::HashMap,
time::Instant,
};

use ethkey::{Address, Password};
use serde_derive::{Serialize, Deserialize};
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),
}

/// Data associated with account.
#[derive(Clone)]
pub struct AccountData {
pub unlock: Unlock,
pub password: Password,
}

/// Collected account metadata
#[derive(Default, Clone, Debug, PartialEq, Serialize, Deserialize)]
Expand All @@ -29,4 +55,19 @@ pub struct AccountMeta {
pub uuid: Option<String>,
}

impl_serialization!(hash::Address => AccountMeta);
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)
}

/// 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)
}
}

56 changes: 56 additions & 0 deletions accounts/src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
// This file is part of Parity.

// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.

use std::fmt;

use ethstore::{Error as SSError};
use hardware_wallet::{Error as HardwareError};

/// Signing error
#[derive(Debug)]
pub enum SignError {
/// Account is not unlocked
NotUnlocked,
/// Account does not exist.
NotFound,
/// Low-level hardware device error.
Hardware(HardwareError),
/// 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::Hardware(ref e) => write!(f, "{}", e),
SignError::SStore(ref e) => write!(f, "{}", e),
}
}
}

impl From<HardwareError> for SignError {
fn from(e: HardwareError) -> Self {
SignError::Hardware(e)
}
}

impl From<SSError> for SignError {
fn from(e: SSError) -> Self {
SignError::SStore(e)
}
}
Loading