Merge branch 'master' into simplified_block_opening
This commit is contained in:
commit
12a76597d4
43
Cargo.lock
generated
43
Cargo.lock
generated
@ -3,7 +3,7 @@ name = "parity"
|
||||
version = "1.2.0"
|
||||
dependencies = [
|
||||
"ansi_term 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clippy 0.0.71 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clippy 0.0.76 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ctrlc 1.1.1 (git+https://github.com/ethcore/rust-ctrlc.git)",
|
||||
"daemonize 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"docopt 0.6.80 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -130,23 +130,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clippy"
|
||||
version = "0.0.71"
|
||||
version = "0.0.76"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"clippy_lints 0.0.71 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quine-mc_cluskey 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex-syntax 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"semver 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"toml 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clippy_lints 0.0.76 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clippy_lints"
|
||||
version = "0.0.71"
|
||||
version = "0.0.76"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quine-mc_cluskey 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex-syntax 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -256,7 +251,7 @@ name = "ethcore"
|
||||
version = "1.2.0"
|
||||
dependencies = [
|
||||
"bloomchain 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clippy 0.0.71 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clippy 0.0.76 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"crossbeam 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ethash 1.2.0",
|
||||
@ -280,7 +275,7 @@ dependencies = [
|
||||
name = "ethcore-dapps"
|
||||
version = "1.2.0"
|
||||
dependencies = [
|
||||
"clippy 0.0.71 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clippy 0.0.76 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ethcore-rpc 1.2.0",
|
||||
"ethcore-util 1.2.0",
|
||||
"hyper 0.9.3 (git+https://github.com/ethcore/hyper)",
|
||||
@ -293,7 +288,7 @@ dependencies = [
|
||||
"parity-dapps-dao 0.4.0 (git+https://github.com/ethcore/parity-dapps-dao-rs.git)",
|
||||
"parity-dapps-makerotc 0.3.0 (git+https://github.com/ethcore/parity-dapps-makerotc-rs.git)",
|
||||
"parity-dapps-status 0.5.0 (git+https://github.com/ethcore/parity-dapps-status-rs.git)",
|
||||
"parity-dapps-wallet 0.6.0 (git+https://github.com/ethcore/parity-dapps-wallet-rs.git)",
|
||||
"parity-dapps-wallet 0.6.1 (git+https://github.com/ethcore/parity-dapps-wallet-rs.git)",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_codegen 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -344,7 +339,7 @@ dependencies = [
|
||||
name = "ethcore-rpc"
|
||||
version = "1.2.0"
|
||||
dependencies = [
|
||||
"clippy 0.0.71 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clippy 0.0.76 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ethash 1.2.0",
|
||||
"ethcore 1.2.0",
|
||||
"ethcore-devtools 1.2.0",
|
||||
@ -367,7 +362,7 @@ dependencies = [
|
||||
name = "ethcore-signer"
|
||||
version = "1.2.0"
|
||||
dependencies = [
|
||||
"clippy 0.0.71 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clippy 0.0.76 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ethcore-rpc 1.2.0",
|
||||
"ethcore-util 1.2.0",
|
||||
@ -386,7 +381,7 @@ dependencies = [
|
||||
"arrayvec 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bigint 0.1.0",
|
||||
"chrono 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clippy 0.0.71 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clippy 0.0.76 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"crossbeam 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"elastic-array 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -431,7 +426,7 @@ dependencies = [
|
||||
name = "ethsync"
|
||||
version = "1.2.0"
|
||||
dependencies = [
|
||||
"clippy 0.0.71 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clippy 0.0.76 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ethcore 1.2.0",
|
||||
"ethcore-util 1.2.0",
|
||||
@ -606,7 +601,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "jsonrpc-http-server"
|
||||
version = "5.1.0"
|
||||
source = "git+https://github.com/ethcore/jsonrpc-http-server.git#77dcac785c02c3a7622d36aa635ee80d63d0b20c"
|
||||
source = "git+https://github.com/ethcore/jsonrpc-http-server.git#6117b1d77b5a60d6fa2dc884f12aa7f5fd4585ca"
|
||||
dependencies = [
|
||||
"hyper 0.9.3 (git+https://github.com/ethcore/hyper)",
|
||||
"jsonrpc-core 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -901,7 +896,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "parity-dapps-builtins"
|
||||
version = "0.5.1"
|
||||
source = "git+https://github.com/ethcore/parity-dapps-builtins-rs.git#d3c95d62ffaa57016b162a9a9f0e6dd629dab423"
|
||||
source = "git+https://github.com/ethcore/parity-dapps-builtins-rs.git#b3970ff4686a12321365cfafba6552bfaa2e7874"
|
||||
dependencies = [
|
||||
"parity-dapps 0.3.0 (git+https://github.com/ethcore/parity-dapps-rs.git)",
|
||||
]
|
||||
@ -909,7 +904,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "parity-dapps-dao"
|
||||
version = "0.4.0"
|
||||
source = "git+https://github.com/ethcore/parity-dapps-dao-rs.git#18f4b839b20fbdf8e0d163e14d25aafee603ac4b"
|
||||
source = "git+https://github.com/ethcore/parity-dapps-dao-rs.git#dd6b9ca7c18fbfa714183a4f570bd75b8391c13d"
|
||||
dependencies = [
|
||||
"parity-dapps 0.3.0 (git+https://github.com/ethcore/parity-dapps-rs.git)",
|
||||
]
|
||||
@ -917,7 +912,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "parity-dapps-makerotc"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/ethcore/parity-dapps-makerotc-rs.git#7b771f217a3eefeb9a976c7ed470ca49fd9a9daa"
|
||||
source = "git+https://github.com/ethcore/parity-dapps-makerotc-rs.git#33568ac7209aa765c498bb2322e848f552656303"
|
||||
dependencies = [
|
||||
"parity-dapps 0.3.0 (git+https://github.com/ethcore/parity-dapps-rs.git)",
|
||||
]
|
||||
@ -932,8 +927,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "parity-dapps-wallet"
|
||||
version = "0.6.0"
|
||||
source = "git+https://github.com/ethcore/parity-dapps-wallet-rs.git#ad23b093d47527333a262c95e6fb20a97d15d6e6"
|
||||
version = "0.6.1"
|
||||
source = "git+https://github.com/ethcore/parity-dapps-wallet-rs.git#8923d4c73359c75ce04f0639bbcde46adb846b81"
|
||||
dependencies = [
|
||||
"parity-dapps 0.3.0 (git+https://github.com/ethcore/parity-dapps-rs.git)",
|
||||
]
|
||||
@ -941,7 +936,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "parity-minimal-sysui"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/ethcore/parity-dapps-minimal-sysui-rs.git#cb27ae09ee18773ccca6ba2ac74fa3128047a652"
|
||||
source = "git+https://github.com/ethcore/parity-dapps-minimal-sysui-rs.git#4c704913f671060bb0e43b5ce4a68d02281115d5"
|
||||
|
||||
[[package]]
|
||||
name = "phf"
|
||||
|
@ -23,7 +23,7 @@ daemonize = "0.2"
|
||||
num_cpus = "0.2"
|
||||
number_prefix = "0.2"
|
||||
rpassword = "0.2.1"
|
||||
clippy = { version = "0.0.71", optional = true}
|
||||
clippy = { version = "0.0.76", optional = true}
|
||||
ethcore = { path = "ethcore" }
|
||||
ethcore-util = { path = "util" }
|
||||
ethsync = { path = "sync" }
|
||||
|
@ -28,7 +28,7 @@ parity-dapps-wallet = { git = "https://github.com/ethcore/parity-dapps-wallet-rs
|
||||
parity-dapps-dao = { git = "https://github.com/ethcore/parity-dapps-dao-rs.git", version = "0.4.0", optional = true }
|
||||
parity-dapps-makerotc = { git = "https://github.com/ethcore/parity-dapps-makerotc-rs.git", version = "0.3.0", optional = true }
|
||||
mime_guess = { version = "1.6.1" }
|
||||
clippy = { version = "0.0.71", optional = true}
|
||||
clippy = { version = "0.0.76", optional = true}
|
||||
|
||||
[build-dependencies]
|
||||
serde_codegen = { version = "0.7.0", optional = true }
|
||||
|
@ -22,7 +22,7 @@ ethcore-util = { path = "../util" }
|
||||
evmjit = { path = "../evmjit", optional = true }
|
||||
ethash = { path = "../ethash" }
|
||||
num_cpus = "0.2"
|
||||
clippy = { version = "0.0.71", optional = true}
|
||||
clippy = { version = "0.0.76", optional = true}
|
||||
crossbeam = "0.2.9"
|
||||
lazy_static = "0.1"
|
||||
ethcore-devtools = { path = "../devtools" }
|
||||
|
@ -15,7 +15,7 @@ with-syntex = ["quasi/with-syntex", "quasi_codegen", "quasi_codegen/with-syntex"
|
||||
|
||||
[build-dependencies]
|
||||
quasi_codegen = { version = "0.11", optional = true }
|
||||
syntex = { version = "*", optional = true }
|
||||
syntex = { version = "0.33", optional = true }
|
||||
|
||||
[dependencies]
|
||||
aster = { version = "0.17", default-features = false }
|
||||
|
@ -89,7 +89,7 @@ fn serialize_item(
|
||||
let (size_expr, read_expr, write_expr) =
|
||||
(binary_expressions.size, binary_expressions.read, binary_expressions.write);
|
||||
|
||||
Ok(quote_item!(cx,
|
||||
match quote_item!(cx,
|
||||
impl $generics ::ipc::BinaryConvertable for $ty $where_clause {
|
||||
fn size(&self) -> usize {
|
||||
$size_expr
|
||||
@ -106,8 +106,16 @@ fn serialize_item(
|
||||
fn len_params() -> usize {
|
||||
1
|
||||
}
|
||||
})
|
||||
{
|
||||
Some(item) => Ok(item),
|
||||
None => {
|
||||
cx.span_err(
|
||||
item.span,
|
||||
"syntax error expanding serialization implementation");
|
||||
Err(Error)
|
||||
}
|
||||
}
|
||||
).unwrap())
|
||||
}
|
||||
|
||||
#[allow(unreachable_code)]
|
||||
|
@ -19,20 +19,20 @@ extern crate ethcore_ipc_codegen as codegen;
|
||||
|
||||
use std::env;
|
||||
use std::path::Path;
|
||||
use std::process::exit;
|
||||
|
||||
pub fn main() {
|
||||
let out_dir = env::var_os("OUT_DIR").unwrap();
|
||||
|
||||
// ipc pass
|
||||
{
|
||||
// rpc pass
|
||||
if {
|
||||
let src = Path::new("nested.rs.in");
|
||||
let dst = Path::new(&out_dir).join("nested_ipc.rs");
|
||||
let mut registry = syntex::Registry::new();
|
||||
codegen::register(&mut registry);
|
||||
registry.expand("", &src, &dst).unwrap();
|
||||
registry.expand("", &src, &dst).is_ok()
|
||||
}
|
||||
|
||||
// serde pass
|
||||
// serialization pass
|
||||
{
|
||||
let src = Path::new(&out_dir).join("nested_ipc.rs");
|
||||
let dst = Path::new(&out_dir).join("nested_cg.rs");
|
||||
@ -41,16 +41,15 @@ pub fn main() {
|
||||
registry.expand("", &src, &dst).unwrap();
|
||||
}
|
||||
|
||||
// ipc pass
|
||||
{
|
||||
// rpc pass
|
||||
if {
|
||||
let src = Path::new("service.rs.in");
|
||||
let dst = Path::new(&out_dir).join("service_ipc.rs");
|
||||
let mut registry = syntex::Registry::new();
|
||||
codegen::register(&mut registry);
|
||||
registry.expand("", &src, &dst).unwrap();
|
||||
registry.expand("", &src, &dst).is_ok()
|
||||
}
|
||||
|
||||
// serde pass
|
||||
// serialization pass
|
||||
{
|
||||
let src = Path::new(&out_dir).join("service_ipc.rs");
|
||||
let dst = Path::new(&out_dir).join("service_cg.rs");
|
||||
@ -59,13 +58,15 @@ pub fn main() {
|
||||
registry.expand("", &src, &dst).unwrap();
|
||||
}
|
||||
|
||||
|
||||
// ipc pass
|
||||
// rpc pass
|
||||
{
|
||||
let src = Path::new("binary.rs.in");
|
||||
let dst = Path::new(&out_dir).join("binary.rs");
|
||||
let mut registry = syntex::Registry::new();
|
||||
codegen::register(&mut registry);
|
||||
registry.expand("", &src, &dst).unwrap();
|
||||
if let Err(err_msg) = registry.expand("", &src, &dst) {
|
||||
println!("error: {}", err_msg);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ rustc-serialize = "0.3"
|
||||
serde = "0.7.0"
|
||||
serde_json = "0.7.0"
|
||||
serde_macros = { version = "0.7.0", optional = true }
|
||||
clippy = { version = "0.0.71", optional = true}
|
||||
clippy = { version = "0.0.76", optional = true}
|
||||
|
||||
[build-dependencies]
|
||||
serde_codegen = { version = "0.7.0", optional = true }
|
||||
|
@ -360,6 +360,14 @@ impl Configuration {
|
||||
if self.args.flag_geth { self.geth_ipc_path() }
|
||||
else { Configuration::replace_home(&self.args.flag_ipcpath.clone().unwrap_or(self.args.flag_ipc_path.clone())) }
|
||||
}
|
||||
|
||||
pub fn signer_port(&self) -> Option<u16> {
|
||||
if self.args.flag_signer {
|
||||
Some(self.args.flag_signer_port)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
@ -201,7 +201,7 @@ fn execute_client(conf: Configuration, spec: Spec, client_config: ClientConfig)
|
||||
let sync = EthSync::register(service.network(), sync_config, client.clone());
|
||||
|
||||
let deps_for_rpc_apis = Arc::new(rpc_apis::Dependencies {
|
||||
signer_enabled: conf.args.flag_signer,
|
||||
signer_port: conf.signer_port(),
|
||||
signer_queue: Arc::new(rpc_apis::ConfirmationsQueue::default()),
|
||||
client: client.clone(),
|
||||
sync: sync.clone(),
|
||||
@ -244,7 +244,7 @@ fn execute_client(conf: Configuration, spec: Spec, client_config: ClientConfig)
|
||||
|
||||
// Set up a signer
|
||||
let signer_server = signer::start(signer::Configuration {
|
||||
enabled: deps_for_rpc_apis.signer_enabled,
|
||||
enabled: deps_for_rpc_apis.signer_port.is_some(),
|
||||
port: conf.args.flag_signer_port,
|
||||
signer_path: conf.directories().signer,
|
||||
}, signer::Dependencies {
|
||||
|
@ -79,7 +79,7 @@ impl FromStr for Api {
|
||||
}
|
||||
|
||||
pub struct Dependencies {
|
||||
pub signer_enabled: bool,
|
||||
pub signer_port: Option<u16>,
|
||||
pub signer_queue: Arc<ConfirmationsQueue>,
|
||||
pub client: Arc<Client>,
|
||||
pub sync: Arc<EthSync>,
|
||||
@ -146,14 +146,14 @@ pub fn setup_rpc<T: Extendable>(server: T, deps: Arc<Dependencies>, apis: ApiSet
|
||||
server.add_delegate(EthClient::new(&deps.client, &deps.sync, &deps.secret_store, &deps.miner, &deps.external_miner).to_delegate());
|
||||
server.add_delegate(EthFilterClient::new(&deps.client, &deps.miner).to_delegate());
|
||||
|
||||
if deps.signer_enabled {
|
||||
if deps.signer_port.is_some() {
|
||||
server.add_delegate(EthSigningQueueClient::new(&deps.signer_queue).to_delegate());
|
||||
} else {
|
||||
server.add_delegate(EthSigningUnsafeClient::new(&deps.client, &deps.secret_store, &deps.miner).to_delegate());
|
||||
}
|
||||
},
|
||||
Api::Personal => {
|
||||
server.add_delegate(PersonalClient::new(&deps.secret_store, &deps.client, &deps.miner, deps.signer_enabled).to_delegate());
|
||||
server.add_delegate(PersonalClient::new(&deps.secret_store, &deps.client, &deps.miner, deps.signer_port).to_delegate());
|
||||
},
|
||||
Api::Signer => {
|
||||
server.add_delegate(SignerClient::new(&deps.secret_store, &deps.client, &deps.miner, &deps.signer_queue).to_delegate());
|
||||
|
@ -23,7 +23,7 @@ ethcore-devtools = { path = "../devtools" }
|
||||
rustc-serialize = "0.3"
|
||||
transient-hashmap = "0.1"
|
||||
serde_macros = { version = "0.7.0", optional = true }
|
||||
clippy = { version = "0.0.71", optional = true}
|
||||
clippy = { version = "0.0.76", optional = true}
|
||||
json-ipc-server = { git = "https://github.com/ethcore/json-ipc-server.git" }
|
||||
|
||||
[build-dependencies]
|
||||
|
@ -75,7 +75,11 @@ impl RpcServer {
|
||||
/// Start http server asynchronously and returns result with `Server` handle on success or an error.
|
||||
pub fn start_http(&self, addr: &SocketAddr, cors_domains: Vec<String>) -> Result<Server, RpcServerError> {
|
||||
let cors_domains = cors_domains.into_iter()
|
||||
.map(jsonrpc_http_server::AccessControlAllowOrigin::Value)
|
||||
.map(|v| match v.as_str() {
|
||||
"*" => jsonrpc_http_server::AccessControlAllowOrigin::Any,
|
||||
"null" => jsonrpc_http_server::AccessControlAllowOrigin::Null,
|
||||
v => jsonrpc_http_server::AccessControlAllowOrigin::Value(v.into()),
|
||||
})
|
||||
.collect();
|
||||
Server::start(addr, self.handler.clone(), cors_domains)
|
||||
}
|
||||
|
@ -31,18 +31,18 @@ pub struct PersonalClient<A, C, M>
|
||||
accounts: Weak<A>,
|
||||
client: Weak<C>,
|
||||
miner: Weak<M>,
|
||||
signer_enabled: bool,
|
||||
signer_port: Option<u16>,
|
||||
}
|
||||
|
||||
impl<A, C, M> PersonalClient<A, C, M>
|
||||
where A: AccountProvider, C: MiningBlockChainClient, M: MinerService {
|
||||
/// Creates new PersonalClient
|
||||
pub fn new(store: &Arc<A>, client: &Arc<C>, miner: &Arc<M>, signer_enabled: bool) -> Self {
|
||||
pub fn new(store: &Arc<A>, client: &Arc<C>, miner: &Arc<M>, signer_port: Option<u16>) -> Self {
|
||||
PersonalClient {
|
||||
accounts: Arc::downgrade(store),
|
||||
client: Arc::downgrade(client),
|
||||
miner: Arc::downgrade(miner),
|
||||
signer_enabled: signer_enabled,
|
||||
signer_port: signer_port,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -51,7 +51,9 @@ impl<A: 'static, C: 'static, M: 'static> Personal for PersonalClient<A, C, M>
|
||||
where A: AccountProvider, C: MiningBlockChainClient, M: MinerService {
|
||||
|
||||
fn signer_enabled(&self, _: Params) -> Result<Value, Error> {
|
||||
to_value(&self.signer_enabled)
|
||||
self.signer_port
|
||||
.map(|v| to_value(&v))
|
||||
.unwrap_or_else(|| to_value(&false))
|
||||
}
|
||||
|
||||
fn accounts(&self, _: Params) -> Result<Value, Error> {
|
||||
|
@ -49,11 +49,11 @@ fn miner_service() -> Arc<TestMinerService> {
|
||||
Arc::new(TestMinerService::default())
|
||||
}
|
||||
|
||||
fn setup() -> PersonalTester {
|
||||
fn setup(signer: Option<u16>) -> PersonalTester {
|
||||
let accounts = accounts_provider();
|
||||
let client = blockchain_client();
|
||||
let miner = miner_service();
|
||||
let personal = PersonalClient::new(&accounts, &client, &miner, false);
|
||||
let personal = PersonalClient::new(&accounts, &client, &miner, signer);
|
||||
|
||||
let io = IoHandler::new();
|
||||
io.add_delegate(personal.to_delegate());
|
||||
@ -71,7 +71,7 @@ fn setup() -> PersonalTester {
|
||||
#[test]
|
||||
fn should_return_false_if_signer_is_disabled() {
|
||||
// given
|
||||
let tester = setup();
|
||||
let tester = setup(None);
|
||||
|
||||
// when
|
||||
let request = r#"{"jsonrpc": "2.0", "method": "personal_signerEnabled", "params": [], "id": 1}"#;
|
||||
@ -82,9 +82,23 @@ fn should_return_false_if_signer_is_disabled() {
|
||||
assert_eq!(tester.io.handle_request(request), Some(response.to_owned()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_return_port_number_if_signer_is_enabled() {
|
||||
// given
|
||||
let tester = setup(Some(8180));
|
||||
|
||||
// when
|
||||
let request = r#"{"jsonrpc": "2.0", "method": "personal_signerEnabled", "params": [], "id": 1}"#;
|
||||
let response = r#"{"jsonrpc":"2.0","result":8180,"id":1}"#;
|
||||
|
||||
|
||||
// then
|
||||
assert_eq!(tester.io.handle_request(request), Some(response.to_owned()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn accounts() {
|
||||
let tester = setup();
|
||||
let tester = setup(None);
|
||||
tester.accounts.accounts
|
||||
.write()
|
||||
.unwrap()
|
||||
@ -98,7 +112,7 @@ fn accounts() {
|
||||
|
||||
#[test]
|
||||
fn new_account() {
|
||||
let tester = setup();
|
||||
let tester = setup(None);
|
||||
let request = r#"{"jsonrpc": "2.0", "method": "personal_newAccount", "params": ["pass"], "id": 1}"#;
|
||||
|
||||
let res = tester.io.handle_request(request);
|
||||
@ -122,7 +136,7 @@ fn sign_and_send_transaction_with_invalid_password() {
|
||||
let account = TestAccount::new("password123");
|
||||
let address = account.address();
|
||||
|
||||
let tester = setup();
|
||||
let tester = setup(None);
|
||||
tester.accounts.accounts.write().unwrap().insert(address.clone(), account);
|
||||
let request = r#"{
|
||||
"jsonrpc": "2.0",
|
||||
@ -148,7 +162,7 @@ fn sign_and_send_transaction() {
|
||||
let address = account.address();
|
||||
let secret = account.secret.clone();
|
||||
|
||||
let tester = setup();
|
||||
let tester = setup(None);
|
||||
tester.accounts.accounts.write().unwrap().insert(address.clone(), account);
|
||||
let request = r#"{
|
||||
"jsonrpc": "2.0",
|
||||
|
@ -20,7 +20,7 @@ ethcore-util = { path = "../util" }
|
||||
ethcore-rpc = { path = "../rpc" }
|
||||
parity-minimal-sysui = { git = "https://github.com/ethcore/parity-dapps-minimal-sysui-rs.git" }
|
||||
|
||||
clippy = { version = "0.0.71", optional = true}
|
||||
clippy = { version = "0.0.76", optional = true}
|
||||
|
||||
[features]
|
||||
dev = ["clippy"]
|
||||
|
@ -10,7 +10,7 @@ authors = ["Ethcore <admin@ethcore.io"]
|
||||
[dependencies]
|
||||
ethcore-util = { path = "../util" }
|
||||
ethcore = { path = "../ethcore" }
|
||||
clippy = { version = "0.0.71", optional = true}
|
||||
clippy = { version = "0.0.76", optional = true}
|
||||
log = "0.3"
|
||||
env_logger = "0.3"
|
||||
time = "0.1.34"
|
||||
|
@ -28,7 +28,7 @@ crossbeam = "0.2"
|
||||
slab = "0.2"
|
||||
sha3 = { path = "sha3" }
|
||||
serde = "0.7.0"
|
||||
clippy = { version = "0.0.71", optional = true}
|
||||
clippy = { version = "0.0.76", optional = true}
|
||||
json-tests = { path = "json-tests" }
|
||||
igd = "0.4.2"
|
||||
ethcore-devtools = { path = "../devtools" }
|
||||
|
@ -91,9 +91,9 @@ macro_rules! uint_overflowing_add_reg {
|
||||
#[cfg(all(asm_available, target_arch="x86_64"))]
|
||||
macro_rules! uint_overflowing_add {
|
||||
(U256, $n_words: expr, $self_expr: expr, $other: expr) => ({
|
||||
let mut result: [u64; 4] = unsafe { mem::uninitialized() };
|
||||
let self_t: &[u64; 4] = unsafe { &mem::transmute($self_expr) };
|
||||
let other_t: &[u64; 4] = unsafe { &mem::transmute($other) };
|
||||
let mut result: [u64; $n_words] = unsafe { mem::uninitialized() };
|
||||
let self_t: &[u64; $n_words] = &$self_expr.0;
|
||||
let other_t: &[u64; $n_words] = &$other.0;
|
||||
|
||||
let overflow: u8;
|
||||
unsafe {
|
||||
@ -114,9 +114,9 @@ macro_rules! uint_overflowing_add {
|
||||
(U256(result), overflow != 0)
|
||||
});
|
||||
(U512, $n_words: expr, $self_expr: expr, $other: expr) => ({
|
||||
let mut result: [u64; 8] = unsafe { mem::uninitialized() };
|
||||
let self_t: &[u64; 8] = unsafe { &mem::transmute($self_expr) };
|
||||
let other_t: &[u64; 8] = unsafe { &mem::transmute($other) };
|
||||
let mut result: [u64; $n_words] = unsafe { mem::uninitialized() };
|
||||
let self_t: &[u64; $n_words] = &$self_expr.0;
|
||||
let other_t: &[u64; $n_words] = &$other.0;
|
||||
|
||||
let overflow: u8;
|
||||
|
||||
@ -195,9 +195,9 @@ macro_rules! uint_overflowing_sub_reg {
|
||||
#[cfg(all(asm_available, target_arch="x86_64"))]
|
||||
macro_rules! uint_overflowing_sub {
|
||||
(U256, $n_words: expr, $self_expr: expr, $other: expr) => ({
|
||||
let mut result: [u64; 4] = unsafe { mem::uninitialized() };
|
||||
let self_t: &[u64; 4] = unsafe { &mem::transmute($self_expr) };
|
||||
let other_t: &[u64; 4] = unsafe { &mem::transmute($other) };
|
||||
let mut result: [u64; $n_words] = unsafe { mem::uninitialized() };
|
||||
let self_t: &[u64; $n_words] = &$self_expr.0;
|
||||
let other_t: &[u64; $n_words] = &$other.0;
|
||||
|
||||
let overflow: u8;
|
||||
unsafe {
|
||||
@ -217,9 +217,9 @@ macro_rules! uint_overflowing_sub {
|
||||
(U256(result), overflow != 0)
|
||||
});
|
||||
(U512, $n_words: expr, $self_expr: expr, $other: expr) => ({
|
||||
let mut result: [u64; 8] = unsafe { mem::uninitialized() };
|
||||
let self_t: &[u64; 8] = unsafe { &mem::transmute($self_expr) };
|
||||
let other_t: &[u64; 8] = unsafe { &mem::transmute($other) };
|
||||
let mut result: [u64; $n_words] = unsafe { mem::uninitialized() };
|
||||
let self_t: &[u64; $n_words] = &$self_expr.0;
|
||||
let other_t: &[u64; $n_words] = &$other.0;
|
||||
|
||||
let overflow: u8;
|
||||
|
||||
@ -269,9 +269,9 @@ macro_rules! uint_overflowing_sub {
|
||||
#[cfg(all(asm_available, target_arch="x86_64"))]
|
||||
macro_rules! uint_overflowing_mul {
|
||||
(U256, $n_words: expr, $self_expr: expr, $other: expr) => ({
|
||||
let mut result: [u64; 4] = unsafe { mem::uninitialized() };
|
||||
let self_t: &[u64; 4] = unsafe { &mem::transmute($self_expr) };
|
||||
let other_t: &[u64; 4] = unsafe { &mem::transmute($other) };
|
||||
let mut result: [u64; $n_words] = unsafe { mem::uninitialized() };
|
||||
let self_t: &[u64; $n_words] = &$self_expr.0;
|
||||
let other_t: &[u64; $n_words] = &$other.0;
|
||||
|
||||
let overflow: u64;
|
||||
unsafe {
|
||||
@ -548,6 +548,7 @@ pub trait Uint: Sized + Default + FromStr + From<u64> + fmt::Debug + fmt::Displa
|
||||
macro_rules! construct_uint {
|
||||
($name:ident, $n_words:expr) => (
|
||||
/// Little-endian large integer type
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Eq, PartialEq)]
|
||||
pub struct $name(pub [u64; $n_words]);
|
||||
|
||||
@ -1132,8 +1133,8 @@ impl U256 {
|
||||
/// No overflow possible
|
||||
#[cfg(all(asm_available, target_arch="x86_64"))]
|
||||
pub fn full_mul(self, other: U256) -> U512 {
|
||||
let self_t: &[u64; 4] = unsafe { &mem::transmute(self) };
|
||||
let other_t: &[u64; 4] = unsafe { &mem::transmute(other) };
|
||||
let self_t: &[u64; 4] = &self.0;
|
||||
let other_t: &[u64; 4] = &other.0;
|
||||
let mut result: [u64; 8] = unsafe { mem::uninitialized() };
|
||||
unsafe {
|
||||
asm!("
|
||||
|
@ -143,6 +143,7 @@ macro_rules! impl_hash {
|
||||
}
|
||||
min
|
||||
}
|
||||
|
||||
fn from_slice(src: &[u8]) -> Self {
|
||||
let mut r = Self::new();
|
||||
r.clone_from_slice(src);
|
||||
@ -150,24 +151,15 @@ macro_rules! impl_hash {
|
||||
}
|
||||
|
||||
fn copy_to(&self, dest: &mut[u8]) {
|
||||
unsafe {
|
||||
let min = ::std::cmp::min($size, dest.len());
|
||||
::std::ptr::copy(self.0.as_ptr(), dest.as_mut_ptr(), min);
|
||||
}
|
||||
dest[..min].copy_from_slice(&self.0[..min]);
|
||||
}
|
||||
|
||||
fn shift_bloomed<'a, T>(&'a mut self, b: &T) -> &'a mut Self where T: FixedHash {
|
||||
let bp: Self = b.bloom_part($size);
|
||||
let new_self = &bp | self;
|
||||
|
||||
// impl |= instead
|
||||
// TODO: that's done now!
|
||||
|
||||
unsafe {
|
||||
use std::{mem, ptr};
|
||||
ptr::copy(new_self.0.as_ptr(), self.0.as_mut_ptr(), mem::size_of::<Self>());
|
||||
}
|
||||
|
||||
self.0 = new_self.0;
|
||||
self
|
||||
}
|
||||
|
||||
@ -179,7 +171,6 @@ macro_rules! impl_hash {
|
||||
let bloom_bits = m * 8;
|
||||
let mask = bloom_bits - 1;
|
||||
let bloom_bytes = (log2(bloom_bits) + 7) / 8;
|
||||
//println!("bb: {}", bloom_bytes);
|
||||
|
||||
// must be a power of 2
|
||||
assert_eq!(m & (m - 1), 0);
|
||||
@ -316,14 +307,11 @@ macro_rules! impl_hash {
|
||||
#[cfg_attr(feature="dev", allow(expl_impl_clone_on_copy))]
|
||||
impl Clone for $from {
|
||||
fn clone(&self) -> $from {
|
||||
unsafe {
|
||||
use std::{mem, ptr};
|
||||
let mut ret: $from = mem::uninitialized();
|
||||
ptr::copy(self.0.as_ptr(), ret.0.as_mut_ptr(), mem::size_of::<$from>());
|
||||
let mut ret = $from::new();
|
||||
ret.0.copy_from_slice(&self.0);
|
||||
ret
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq for $from {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
@ -404,16 +392,13 @@ macro_rules! impl_hash {
|
||||
type Output = $from;
|
||||
|
||||
fn bitor(self, rhs: Self) -> Self::Output {
|
||||
unsafe {
|
||||
use std::mem;
|
||||
let mut ret: $from = mem::uninitialized();
|
||||
let mut ret: $from = $from::default();
|
||||
for i in 0..$size {
|
||||
ret.0[i] = self.0[i] | rhs.0[i];
|
||||
}
|
||||
ret
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Moving `BitOr`
|
||||
impl BitOr for $from {
|
||||
@ -429,16 +414,13 @@ macro_rules! impl_hash {
|
||||
type Output = $from;
|
||||
|
||||
fn bitand(self, rhs: Self) -> Self::Output {
|
||||
unsafe {
|
||||
use std::mem;
|
||||
let mut ret: $from = mem::uninitialized();
|
||||
let mut ret: $from = $from::default();
|
||||
for i in 0..$size {
|
||||
ret.0[i] = self.0[i] & rhs.0[i];
|
||||
}
|
||||
ret
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Moving `BitAnd`
|
||||
impl BitAnd for $from {
|
||||
@ -454,16 +436,13 @@ macro_rules! impl_hash {
|
||||
type Output = $from;
|
||||
|
||||
fn bitxor(self, rhs: Self) -> Self::Output {
|
||||
unsafe {
|
||||
use std::mem;
|
||||
let mut ret: $from = mem::uninitialized();
|
||||
let mut ret: $from = $from::default();
|
||||
for i in 0..$size {
|
||||
ret.0[i] = self.0[i] ^ rhs.0[i];
|
||||
}
|
||||
ret
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Moving `BitXor`
|
||||
impl BitXor for $from {
|
||||
@ -516,23 +495,19 @@ macro_rules! impl_hash {
|
||||
|
||||
impl From<U256> for H256 {
|
||||
fn from(value: U256) -> H256 {
|
||||
unsafe {
|
||||
let mut ret: H256 = ::std::mem::uninitialized();
|
||||
let mut ret = H256::new();
|
||||
value.to_raw_bytes(&mut ret);
|
||||
ret
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a U256> for H256 {
|
||||
fn from(value: &'a U256) -> H256 {
|
||||
unsafe {
|
||||
let mut ret: H256 = ::std::mem::uninitialized();
|
||||
let mut ret: H256 = H256::new();
|
||||
value.to_raw_bytes(&mut ret);
|
||||
ret
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<H256> for U256 {
|
||||
fn from(value: H256) -> U256 {
|
||||
@ -548,53 +523,46 @@ impl<'a> From<&'a H256> for U256 {
|
||||
|
||||
impl From<H256> for Address {
|
||||
fn from(value: H256) -> Address {
|
||||
unsafe {
|
||||
let mut ret: Address = ::std::mem::uninitialized();
|
||||
::std::ptr::copy(value.as_ptr().offset(12), ret.as_mut_ptr(), 20);
|
||||
let mut ret = Address::new();
|
||||
ret.0.copy_from_slice(&value[12..32]);
|
||||
ret
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<H256> for H64 {
|
||||
fn from(value: H256) -> H64 {
|
||||
unsafe {
|
||||
let mut ret: H64 = ::std::mem::uninitialized();
|
||||
::std::ptr::copy(value.as_ptr().offset(20), ret.as_mut_ptr(), 8);
|
||||
let mut ret = H64::new();
|
||||
ret.0.copy_from_slice(&value[20..28]);
|
||||
ret
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
impl<'a> From<&'a H256> for Address {
|
||||
fn from(value: &'a H256) -> Address {
|
||||
unsafe {
|
||||
let mut ret: Address = ::std::mem::uninitialized();
|
||||
::std::ptr::copy(value.as_ptr().offset(12), ret.as_mut_ptr(), 20);
|
||||
let mut ret = Address::new();
|
||||
ret.0.copy_from_slice(&value[12..32]);
|
||||
ret
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
impl From<Address> for H256 {
|
||||
fn from(value: Address) -> H256 {
|
||||
unsafe {
|
||||
let mut ret = H256::new();
|
||||
::std::ptr::copy(value.as_ptr(), ret.as_mut_ptr().offset(12), 20);
|
||||
ret.0[12..32].copy_from_slice(&value);
|
||||
ret
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a Address> for H256 {
|
||||
fn from(value: &'a Address) -> H256 {
|
||||
unsafe {
|
||||
let mut ret = H256::new();
|
||||
::std::ptr::copy(value.as_ptr(), ret.as_mut_ptr().offset(12), 20);
|
||||
ret.0[12..32].copy_from_slice(value);
|
||||
ret
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert string `s` to an `H256`. Will panic if `s` is not 64 characters long or if any of
|
||||
/// those characters are not 0-9, a-z or A-Z.
|
||||
|
Loading…
Reference in New Issue
Block a user