Skip to content
This repository was archived by the owner on May 24, 2022. It is now read-only.

Commit a348842

Browse files
committed
Remove deprecated flags
1 parent 996b43e commit a348842

33 files changed

+63
-1457
lines changed

accounts/ethstore/cli/src/main.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,6 @@ fn main() {
166166

167167
fn key_dir(location: &str, password: Option<Password>) -> Result<Box<dyn KeyDirectory>, Error> {
168168
let dir: RootDiskDirectory = match location {
169-
"geth" => RootDiskDirectory::create(dir::geth(false))?,
170-
"geth-test" => RootDiskDirectory::create(dir::geth(true))?,
171169
path if path.starts_with("parity") => {
172170
let chain = path.split('-').nth(1).unwrap_or("ethereum");
173171
let path = dir::parity(chain);

accounts/ethstore/src/ethstore.rs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ use accounts_dir::{KeyDirectory, SetKeyError, VaultKey, VaultKeyDirectory};
2727
use ethkey::{
2828
self, Address, ExtendedKeyPair, KeyPair, Message, Password, Public, Secret, Signature,
2929
};
30-
use import;
3130
use json::{self, OpaqueKeyFile, Uuid};
3231
use presale::PresaleWallet;
3332
use random::Random;
@@ -330,38 +329,6 @@ impl SecretStore for EthStore {
330329
fn local_path(&self) -> PathBuf {
331330
self.store.dir.path().cloned().unwrap_or_else(PathBuf::new)
332331
}
333-
334-
fn list_geth_accounts(&self, testnet: bool) -> Vec<Address> {
335-
import::read_geth_accounts(testnet)
336-
}
337-
338-
fn import_geth_accounts(
339-
&self,
340-
vault: SecretVaultRef,
341-
desired: Vec<Address>,
342-
testnet: bool,
343-
) -> Result<Vec<StoreAccountRef>, Error> {
344-
let imported_addresses = match vault {
345-
SecretVaultRef::Root => import::import_geth_accounts(
346-
&*self.store.dir,
347-
desired.into_iter().collect(),
348-
testnet,
349-
),
350-
SecretVaultRef::Vault(vault_name) => {
351-
if let Some(vault) = self.store.vaults.lock().get(&vault_name) {
352-
import::import_geth_accounts(
353-
vault.as_key_directory(),
354-
desired.into_iter().collect(),
355-
testnet,
356-
)
357-
} else {
358-
Err(Error::VaultNotFound)
359-
}
360-
}
361-
};
362-
363-
imported_addresses.map(|a| a.into_iter().map(|a| StoreAccountRef::root(a)).collect())
364-
}
365332
}
366333

367334
/// Similar to `EthStore` but may store many accounts (with different passwords) for the same `Address`

accounts/ethstore/src/import.rs

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616

1717
use std::{collections::HashSet, fs, path::Path};
1818

19-
use accounts_dir::{DiskKeyFileManager, KeyDirectory, KeyFileManager, RootDiskDirectory};
20-
use dir;
19+
use accounts_dir::{DiskKeyFileManager, KeyDirectory, KeyFileManager};
2120
use ethkey::Address;
2221
use Error;
2322

@@ -66,37 +65,3 @@ pub fn import_accounts(
6665
})
6766
.collect()
6867
}
69-
70-
/// Provide a `HashSet` of all accounts available for import from the Geth keystore.
71-
pub fn read_geth_accounts(testnet: bool) -> Vec<Address> {
72-
RootDiskDirectory::at(dir::geth(testnet))
73-
.load()
74-
.map(|d| d.into_iter().map(|a| a.address).collect())
75-
.unwrap_or_else(|_| Vec::new())
76-
}
77-
78-
/// Import specific `desired` accounts from the Geth keystore into `dst`.
79-
pub fn import_geth_accounts(
80-
dst: &dyn KeyDirectory,
81-
desired: HashSet<Address>,
82-
testnet: bool,
83-
) -> Result<Vec<Address>, Error> {
84-
let src = RootDiskDirectory::at(dir::geth(testnet));
85-
let accounts = src.load()?;
86-
let existing_accounts = dst
87-
.load()?
88-
.into_iter()
89-
.map(|a| a.address)
90-
.collect::<HashSet<_>>();
91-
92-
accounts
93-
.into_iter()
94-
.filter(|a| !existing_accounts.contains(&a.address))
95-
.filter(|a| desired.contains(&a.address))
96-
.map(|a| {
97-
let address = a.address.clone();
98-
dst.insert(a)?;
99-
Ok(address)
100-
})
101-
.collect()
102-
}

accounts/ethstore/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub use self::{
6464
account::{Crypto, SafeAccount},
6565
error::Error,
6666
ethstore::{EthMultiStore, EthStore},
67-
import::{import_account, import_accounts, read_geth_accounts},
67+
import::{import_account, import_accounts},
6868
json::OpaqueKeyFile as KeyFile,
6969
parity_wordlist::random_phrase,
7070
presale::PresaleWallet,

accounts/ethstore/src/secret_store.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,6 @@ pub trait SecretStore: SimpleSecretStore {
221221

222222
/// Returns local path of the store.
223223
fn local_path(&self) -> PathBuf;
224-
/// Lists all found geth accounts.
225-
fn list_geth_accounts(&self, testnet: bool) -> Vec<Address>;
226-
/// Imports geth accounts to the store/vault.
227-
fn import_geth_accounts(
228-
&self,
229-
vault: SecretVaultRef,
230-
desired: Vec<Address>,
231-
testnet: bool,
232-
) -> Result<Vec<StoreAccountRef>, Error>;
233224
}
234225

235226
impl StoreAccountRef {

accounts/src/lib.rs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -572,27 +572,6 @@ impl AccountProvider {
572572
Ok(self.sstore.agree(&account, &password, other_public)?)
573573
}
574574

575-
/// Returns the underlying `SecretStore` reference if one exists.
576-
pub fn list_geth_accounts(&self, testnet: bool) -> Vec<Address> {
577-
self.sstore
578-
.list_geth_accounts(testnet)
579-
.into_iter()
580-
.map(|a| Address::from(a).into())
581-
.collect()
582-
}
583-
584-
/// Returns the underlying `SecretStore` reference if one exists.
585-
pub fn import_geth_accounts(
586-
&self,
587-
desired: Vec<Address>,
588-
testnet: bool,
589-
) -> Result<Vec<Address>, Error> {
590-
self.sstore
591-
.import_geth_accounts(SecretVaultRef::Root, desired, testnet)
592-
.map(|a| a.into_iter().map(|a| a.address).collect())
593-
.map_err(Into::into)
594-
}
595-
596575
/// Create new vault.
597576
pub fn create_vault(&self, name: &str, password: &Password) -> Result<(), Error> {
598577
self.sstore.create_vault(name, password).map_err(Into::into)

parity/account.rs

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ pub enum AccountCmd {
2222
New(NewAccount),
2323
List(ListAccounts),
2424
Import(ImportAccounts),
25-
ImportFromGeth(ImportFromGethAccounts),
2625
}
2726

2827
#[derive(Debug, PartialEq)]
@@ -46,16 +45,6 @@ pub struct ImportAccounts {
4645
pub spec: SpecType,
4746
}
4847

49-
/// Parameters for geth accounts' import
50-
#[derive(Debug, PartialEq)]
51-
pub struct ImportFromGethAccounts {
52-
/// import mainnet (false) or testnet (true) accounts
53-
pub testnet: bool,
54-
/// directory to import accounts to
55-
pub to: String,
56-
pub spec: SpecType,
57-
}
58-
5948
#[cfg(not(feature = "accounts"))]
6049
pub fn execute(_cmd: AccountCmd) -> Result<String, String> {
6150
Err("Account management is deprecated. Please see #9997 for alternatives:\nhttps://github.com/paritytech/parity-ethereum/issues/9997".into())
@@ -65,10 +54,7 @@ pub fn execute(_cmd: AccountCmd) -> Result<String, String> {
6554
mod command {
6655
use super::*;
6756
use accounts::{AccountProvider, AccountProviderSettings};
68-
use ethstore::{
69-
accounts_dir::RootDiskDirectory, import_account, import_accounts, read_geth_accounts,
70-
EthStore, SecretStore, SecretVaultRef,
71-
};
57+
use ethstore::{accounts_dir::RootDiskDirectory, import_account, import_accounts, EthStore};
7258
use helpers::{password_from_file, password_prompt};
7359
use std::path::PathBuf;
7460

@@ -77,7 +63,6 @@ mod command {
7763
AccountCmd::New(new_cmd) => new(new_cmd),
7864
AccountCmd::List(list_cmd) => list(list_cmd),
7965
AccountCmd::Import(import_cmd) => import(import_cmd),
80-
AccountCmd::ImportFromGeth(import_geth_cmd) => import_geth(import_geth_cmd),
8166
}
8267
}
8368

@@ -148,25 +133,6 @@ mod command {
148133

149134
Ok(format!("{} account(s) imported", imported))
150135
}
151-
152-
fn import_geth(i: ImportFromGethAccounts) -> Result<String, String> {
153-
use ethstore::Error;
154-
use std::io::ErrorKind;
155-
156-
let dir = Box::new(keys_dir(i.to, i.spec)?);
157-
let secret_store = Box::new(secret_store(dir, None)?);
158-
let geth_accounts = read_geth_accounts(i.testnet);
159-
match secret_store.import_geth_accounts(SecretVaultRef::Root, geth_accounts, i.testnet) {
160-
Ok(v) => Ok(format!(
161-
"Successfully imported {} account(s) from geth.",
162-
v.len()
163-
)),
164-
Err(Error::Io(ref io_err)) if io_err.kind() == ErrorKind::NotFound => {
165-
Err("Failed to find geth keys folder.".into())
166-
}
167-
Err(err) => Err(format!("Import geth accounts failed. {}", err)),
168-
}
169-
}
170136
}
171137

172138
#[cfg(feature = "accounts")]

0 commit comments

Comments
 (0)