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

Commit 4a49a06

Browse files
committed
Replace tokio_core with tokio.
* Remove `tokio-core` and replace with `tokio` in - `ethcore/stratum` - `secret_store` - `util/fetch` - `util/reactor` * Bump hyper to 0.12 in - `miner` - `util/fake-fetch` - `util/fetch` * Bump `jsonrpc-***` to 0.9 in - `parity` - `ethcore/stratum` - `ipfs` - `rpc` - `rpc_client` - `whisper` * Bump `ring` to 0.13
1 parent 4784876 commit 4a49a06

File tree

49 files changed

+1296
-977
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1296
-977
lines changed

Cargo.lock

Lines changed: 522 additions & 412 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ futures = "0.1"
3131
futures-cpupool = "0.1"
3232
fdlimit = "0.1"
3333
ctrlc = { git = "https://github.com/paritytech/rust-ctrlc.git" }
34-
jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.11" }
34+
jsonrpc-core = { git = "https://github.com/c0gent/jsonrpc.git", branch = "c0gent-hyper" }
3535
ethcore = { path = "ethcore", features = ["parity"] }
3636
parity-bytes = "0.1"
3737
ethcore-io = { path = "util/io" }
@@ -137,7 +137,4 @@ members = [
137137
"util/keccak-hasher",
138138
"util/patricia-trie-ethereum",
139139
"util/fastmap",
140-
]
141-
142-
[patch.crates-io]
143-
ring = { git = "https://github.com/paritytech/ring" }
140+
]

ethcore/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ hashdb = "0.2.1"
2020
memorydb = "0.2.1"
2121
patricia-trie = "0.2"
2222
patricia-trie-ethereum = { path = "../util/patricia-trie-ethereum" }
23-
parity-crypto = "0.1"
23+
parity-crypto = "0.2"
2424
error-chain = { version = "0.12", default-features = false }
2525
ethcore-io = { path = "../util/io" }
2626
ethcore-logger = { path = "../logger" }

ethcore/private-tx/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ethabi-derive = "6.0"
1212
ethabi-contract = "6.0"
1313
ethcore = { path = ".." }
1414
parity-bytes = "0.1"
15-
parity-crypto = "0.1"
15+
parity-crypto = "0.2"
1616
ethcore-io = { path = "../../util/io" }
1717
ethcore-logger = { path = "../../logger" }
1818
ethcore-miner = { path = "../../miner" }

ethcore/private-tx/src/encryptor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ impl SecretStoreEncryptor {
125125

126126
// send HTTP request
127127
let method = if use_post {
128-
Method::Post
128+
Method::POST
129129
} else {
130-
Method::Get
130+
Method::GET
131131
};
132132

133133
let url = Url::from_str(&url).map_err(|e| ErrorKind::Encrypt(e.to_string()))?;

ethcore/res/ethereum/tests

Submodule tests updated 19584 files

ethcore/stratum/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ authors = ["Parity Technologies <[email protected]>"]
88
[dependencies]
99
ethereum-types = "0.4"
1010
keccak-hash = "0.1"
11-
jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.11" }
12-
jsonrpc-macros = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.11" }
13-
jsonrpc-tcp-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.11" }
11+
jsonrpc-core = { git = "https://github.com/c0gent/jsonrpc.git", branch = "c0gent-hyper" }
12+
jsonrpc-macros = { git = "https://github.com/c0gent/jsonrpc.git", branch = "c0gent-hyper" }
13+
jsonrpc-tcp-server = { git = "https://github.com/c0gent/jsonrpc.git", branch = "c0gent-hyper" }
1414
log = "0.4"
1515
parking_lot = "0.6"
1616

1717
[dev-dependencies]
1818
env_logger = "0.5"
19-
tokio-core = "0.1"
19+
tokio = "0.1"
2020
tokio-io = "0.1"
2121
ethcore-logger = { path = "../../logger" }

ethcore/stratum/src/lib.rs

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ extern crate parking_lot;
2525

2626
#[macro_use] extern crate log;
2727

28-
#[cfg(test)] extern crate tokio_core;
28+
#[cfg(test)] extern crate tokio;
2929
#[cfg(test)] extern crate tokio_io;
3030
#[cfg(test)] extern crate ethcore_logger;
3131

@@ -323,12 +323,10 @@ impl MetaExtractor<SocketMetadata> for PeerMetaExtractor {
323323
#[cfg(test)]
324324
mod tests {
325325
use super::*;
326-
use std::net::SocketAddr;
326+
use std::net::{SocketAddr, Shutdown};
327327
use std::sync::Arc;
328328

329-
use tokio_core::reactor::{Core, Timeout};
330-
use tokio_core::net::TcpStream;
331-
use tokio_io::io;
329+
use tokio::{io, runtime::Runtime, timer::timeout::{self, Timeout}, net::TcpStream};
332330
use jsonrpc_core::futures::{Future, future};
333331

334332
use ethcore_logger::init_log;
@@ -342,23 +340,23 @@ mod tests {
342340
}
343341

344342
fn dummy_request(addr: &SocketAddr, data: &str) -> Vec<u8> {
345-
let mut core = Core::new().expect("Tokio Core should be created with no errors");
346-
let mut buffer = vec![0u8; 2048];
343+
let mut runtime = Runtime::new().expect("Tokio Runtime should be created with no errors");
347344

348345
let mut data_vec = data.as_bytes().to_vec();
349346
data_vec.extend(b"\n");
350347

351-
let stream = TcpStream::connect(addr, &core.handle())
352-
.and_then(|stream| {
353-
io::write_all(stream, &data_vec)
348+
let stream = TcpStream::connect(addr)
349+
.and_then(move |stream| {
350+
io::write_all(stream, data_vec)
354351
})
355352
.and_then(|(stream, _)| {
356-
io::read(stream, &mut buffer)
353+
stream.shutdown(Shutdown::Write).unwrap();
354+
io::read_to_end(stream, Vec::with_capacity(2048))
357355
})
358-
.and_then(|(_, read_buf, len)| {
359-
future::ok(read_buf[0..len].to_vec())
356+
.and_then(|(_stream, read_buf)| {
357+
future::ok(read_buf)
360358
});
361-
let result = core.run(stream).expect("Core should run with no errors");
359+
let result = runtime.block_on(stream).expect("Runtime should run with no errors");
362360

363361
result
364362
}
@@ -417,7 +415,7 @@ mod tests {
417415
}
418416

419417
#[test]
420-
fn receives_initial_paylaod() {
418+
fn receives_initial_payload() {
421419
let addr = "127.0.0.1:19975".parse().unwrap();
422420
let _stratum = Stratum::start(&addr, DummyManager::new(), None).expect("There should be no error starting stratum");
423421
let request = r#"{"jsonrpc": "2.0", "method": "mining.subscribe", "params": [], "id": 2}"#;
@@ -460,40 +458,43 @@ mod tests {
460458
.to_vec();
461459
auth_request.extend(b"\n");
462460

463-
let mut core = Core::new().expect("Tokio Core should be created with no errors");
464-
let timeout1 = Timeout::new(::std::time::Duration::from_millis(100), &core.handle())
465-
.expect("There should be a timeout produced in message test");
466-
let timeout2 = Timeout::new(::std::time::Duration::from_millis(100), &core.handle())
467-
.expect("There should be a timeout produced in message test");
468-
let mut buffer = vec![0u8; 2048];
469-
let mut buffer2 = vec![0u8; 2048];
470-
let stream = TcpStream::connect(&addr, &core.handle())
471-
.and_then(|stream| {
472-
io::write_all(stream, &auth_request)
461+
let auth_response = "{\"jsonrpc\":\"2.0\",\"result\":true,\"id\":1}\n";
462+
463+
let mut runtime = Runtime::new().expect("Tokio Runtime should be created with no errors");
464+
let read_buf0 = vec![0u8; auth_response.len()];
465+
let read_buf1 = Vec::with_capacity(2048);
466+
let stream = TcpStream::connect(&addr)
467+
.and_then(move |stream| {
468+
io::write_all(stream, auth_request)
473469
})
474470
.and_then(|(stream, _)| {
475-
io::read(stream, &mut buffer)
471+
io::read_exact(stream, read_buf0)
476472
})
477-
.and_then(|(stream, _, _)| {
473+
.map_err(|err| panic!("{:?}", err))
474+
.and_then(move |(stream, read_buf0)| {
475+
assert_eq!(String::from_utf8(read_buf0).unwrap(), auth_response);
478476
trace!(target: "stratum", "Received authorization confirmation");
479-
timeout1.join(future::ok(stream))
477+
Timeout::new(future::ok(stream), ::std::time::Duration::from_millis(100))
480478
})
481-
.and_then(|(_, stream)| {
479+
.map_err(|err: timeout::Error<()>| panic!("Timeout: {:?}", err))
480+
.and_then(move |stream| {
482481
trace!(target: "stratum", "Pusing work to peers");
483482
stratum.push_work_all(r#"{ "00040008", "100500" }"#.to_owned())
484483
.expect("Pushing work should produce no errors");
485-
timeout2.join(future::ok(stream))
484+
Timeout::new(future::ok(stream), ::std::time::Duration::from_millis(100))
486485
})
487-
.and_then(|(_, stream)| {
486+
.map_err(|err: timeout::Error<()>| panic!("Timeout: {:?}", err))
487+
.and_then(|stream| {
488488
trace!(target: "stratum", "Ready to read work from server");
489-
io::read(stream, &mut buffer2)
489+
stream.shutdown(Shutdown::Write).unwrap();
490+
io::read_to_end(stream, read_buf1)
490491
})
491-
.and_then(|(_, read_buf, len)| {
492+
.and_then(|(_, read_buf1)| {
492493
trace!(target: "stratum", "Received work from server");
493-
future::ok(read_buf[0..len].to_vec())
494+
future::ok(read_buf1)
494495
});
495496
let response = String::from_utf8(
496-
core.run(stream).expect("Core should run with no errors")
497+
runtime.block_on(stream).expect("Runtime should run with no errors")
497498
).expect("Response should be utf-8");
498499

499500
assert_eq!(

ethkey/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ authors = ["Parity Technologies <[email protected]>"]
66
[dependencies]
77
byteorder = "1.0"
88
edit-distance = "2.0"
9-
parity-crypto = "0.1"
9+
parity-crypto = "0.2"
1010
eth-secp256k1 = { git = "https://github.com/paritytech/rust-secp256k1" }
1111
ethereum-types = "0.4"
1212
lazy_static = "1.0"

ethstore/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ tiny-keccak = "1.4"
1616
time = "0.1.34"
1717
itertools = "0.5"
1818
parking_lot = "0.6"
19-
parity-crypto = "0.1"
19+
parity-crypto = "0.2"
2020
ethereum-types = "0.4"
2121
dir = { path = "../util/dir" }
2222
smallvec = "0.6"

0 commit comments

Comments
 (0)