Skip to content

Commit

Permalink
Downgrade back to Tokio 0.2 (#700)
Browse files Browse the repository at this point in the history
  • Loading branch information
romac authored Nov 24, 2020
1 parent 4c7e5d1 commit b159940
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 36 deletions.
8 changes: 0 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
## Unreleased

### BREAKING CHANGES

- `[tendermint-rpc, tendermint-light-client]` Upgrade Tokio to version 0.3.0 ([#683])
- Upgrade `hyper` to `v0.14-dev`
- Upgrade `async-tungstenite` to `v0.10`

### IMPROVEMENTS:

- `[light-client]` Only require Tokio when `rpc-client` feature is enabled ([#425])

[#425]: https://github.com/informalsystems/tendermint-rs/issues/425
[#683]: https://github.com/informalsystems/tendermint-rs/issues/683


## v0.17.0-rc3

Expand Down
2 changes: 1 addition & 1 deletion light-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ serde_derive = "1.0.106"
sled = "0.34.3"
static_assertions = "1.1.0"
thiserror = "1.0.15"
tokio = { version = "0.3", features = ["rt"], optional = true }
tokio = { version = "0.2", optional = true }

[dev-dependencies]
tendermint-testgen = { path = "../testgen"}
Expand Down
3 changes: 2 additions & 1 deletion light-client/src/utils/block_on.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ where
F::Output: Send,
{
std::thread::spawn(move || {
let rt = tokio::runtime::Builder::new_current_thread()
let mut rt = tokio::runtime::Builder::new()
.basic_scheduler()
.enable_all()
.build()
.map_err(|_| IoError::Runtime)?;
Expand Down
2 changes: 1 addition & 1 deletion light-node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ tendermint = { version = "0.17.0-rc3", path = "../tendermint" }
tendermint-light-client = { version = "0.17.0-rc3", path = "../light-client" }
tendermint-rpc = { version = "0.17.0-rc3", path = "../rpc", features = [ "http-client" ] }
thiserror = "1.0"
tokio = { version = "0.3", features = ["full"] }
tokio = { version = "0.2", features = ["full"] }

[dependencies.abscissa_core]
version = "0.5.0"
Expand Down
4 changes: 2 additions & 2 deletions rpc-probe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ description = """
all-features = true

[dependencies]
async-tungstenite = { version = "0.10", features = [ "tokio-runtime" ] }
async-tungstenite = { version = "0.9", features = [ "tokio-runtime" ] }
futures = "0.3"
getrandom = "0.1"
log = "0.4"
Expand All @@ -27,5 +27,5 @@ simple_logger = "1.11"
structopt = "0.3"
subtle-encoding = "0.5.1"
thiserror = "1.0"
tokio = { version = "0.3", features = [ "full" ] }
tokio = { version = "0.2", features = [ "full" ] }
uuid = "0.8"
4 changes: 2 additions & 2 deletions rpc-probe/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ impl From<async_tungstenite::tungstenite::Error> for Error {
}
}

impl From<tokio::time::error::Elapsed> for Error {
fn from(e: tokio::time::error::Elapsed) -> Self {
impl From<tokio::time::Elapsed> for Error {
fn from(e: tokio::time::Elapsed) -> Self {
Self::Timeout(e.to_string())
}
}
Expand Down
4 changes: 2 additions & 2 deletions rpc-probe/src/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ async fn execute_interaction(
info!("Executing interaction \"{}\"", inner_interaction.name);
if let Some(wait) = inner_interaction.pre_wait {
debug!("Sleeping for {} seconds", wait.as_secs_f64());
tokio::time::sleep(wait).await;
tokio::time::delay_for(wait).await;
}
if let Some(h) = inner_interaction.min_height {
debug!("Waiting for height {}", h);
Expand Down Expand Up @@ -419,7 +419,7 @@ async fn execute_subscription(
};
write_json(&config.in_path, name, &response_json).await?;

let mut timeout = tokio::time::sleep(subs.max_time);
let mut timeout = tokio::time::delay_for(subs.max_time);
let mut event_count = 0_usize;
loop {
tokio::select! {
Expand Down
13 changes: 3 additions & 10 deletions rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ websocket-client = [
"async-trait",
"async-tungstenite",
"futures",
"tokio/rt",
"tokio/rt-multi-thread",
"tokio/fs",
"tokio/macros",
"tokio/stream",
Expand All @@ -55,16 +53,11 @@ uuid = { version = "0.8", default-features = false }
subtle-encoding = { version = "0.5", features = ["bech32-preview"] }

async-trait = { version = "0.1", optional = true }
async-tungstenite = { version = "0.10", features = ["tokio-runtime"], optional = true }
async-tungstenite = { version = "0.9", features = ["tokio-runtime"], optional = true }
futures = { version = "0.3", optional = true }
http = { version = "0.2", optional = true }
tokio = { version = "0.3", optional = true }
hyper = { version = "0.13", optional = true }
tokio = { version = "0.2", optional = true }
tracing = { version = "0.1", optional = true }
pin-project = "1.0.1"

[dependencies.hyper]
version = "0.14.0-dev"
git = "https://github.com/hyperium/hyper/"
rev = "121c33132c0950aaa422848cdc43f6691ddf5785"
features = ["tcp", "client", "http1" ]
optional = true
4 changes: 2 additions & 2 deletions rpc/src/client/subscription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ mod test {
}

async fn must_recv<T>(ch: &mut ChannelRx<T>, timeout_ms: u64) -> T {
let mut delay = time::sleep(Duration::from_millis(timeout_ms));
let mut delay = time::delay_for(Duration::from_millis(timeout_ms));
tokio::select! {
_ = &mut delay, if !delay.is_elapsed() => panic!("timed out waiting for recv"),
Some(v) = ch.recv() => v,
Expand All @@ -526,7 +526,7 @@ mod test {
where
T: std::fmt::Debug,
{
let mut delay = time::sleep(Duration::from_millis(timeout_ms));
let mut delay = time::delay_for(Duration::from_millis(timeout_ms));
tokio::select! {
_ = &mut delay, if !delay.is_elapsed() => (),
Some(v) = ch.recv() => panic!("got unexpected result from channel: {:?}", v),
Expand Down
2 changes: 1 addition & 1 deletion rpc/src/client/transport/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use crate::client::transport::get_tcp_host_port;
use crate::{Client, Request, Response, Result};
use async_trait::async_trait;
use hyper::body::Buf;
use bytes::buf::ext::BufExt;
use hyper::header;
use tendermint::net;

Expand Down
2 changes: 1 addition & 1 deletion rpc/src/client/transport/websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ impl WebSocketClientDriver {
pub async fn run(mut self) -> Result<()> {
let mut ping_interval =
tokio::time::interval_at(Instant::now().add(PING_INTERVAL), PING_INTERVAL);
let mut recv_timeout = tokio::time::sleep(PING_INTERVAL);
let mut recv_timeout = tokio::time::delay_for(PING_INTERVAL);
loop {
tokio::select! {
Some(res) = self.stream.next() => match res {
Expand Down
4 changes: 2 additions & 2 deletions tendermint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ k256 = { version = "0.5", optional = true, features = ["ecdsa"] }
ripemd160 = { version = "0.9", optional = true }

[dev-dependencies]
tendermint-rpc = { path = "../rpc", features = ["http-client", "websocket-client"] }
tokio = { version = "0.3", features = ["macros"] }
tendermint-rpc = { path = "../rpc", features = [ "http-client", "websocket-client" ] }
tokio = { version = "0.2", features = [ "macros" ] }

[features]
secp256k1 = ["k256", "ripemd160"]
6 changes: 3 additions & 3 deletions tendermint/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ mod rpc {
let mut cur_tx_id = 0_u32;

while !expected_tx_values.is_empty() {
let mut delay = tokio::time::sleep(Duration::from_secs(3));
let mut delay = tokio::time::delay_for(Duration::from_secs(3));
tokio::select! {
Some(res) = subs.next() => {
let ev = res.unwrap();
Expand Down Expand Up @@ -314,7 +314,7 @@ mod rpc {
.broadcast_tx_async(Transaction::from(tx.into_bytes()))
.await
.unwrap();
tokio::time::sleep(Duration::from_millis(100)).await;
tokio::time::delay_for(Duration::from_millis(100)).await;
}
});

Expand All @@ -327,7 +327,7 @@ mod rpc {
);

while expected_new_blocks > 0 && !expected_tx_values.is_empty() {
let mut timeout = tokio::time::sleep(Duration::from_secs(3));
let mut timeout = tokio::time::delay_for(Duration::from_secs(3));
tokio::select! {
Some(res) = combined_subs.next() => {
let ev: Event = res.unwrap();
Expand Down

0 comments on commit b159940

Please sign in to comment.