Skip to content

Commit 2f531fb

Browse files
committed
migrate from deprecated instant to web-time
Signed-off-by: onur-ozkan <work@onurozkan.dev>
1 parent e0d93b7 commit 2f531fb

File tree

22 files changed

+27
-35
lines changed

22 files changed

+27
-35
lines changed

Cargo.lock

+5-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mm2src/coins/Cargo.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ cfg-if = "1.0"
3333
chain = { path = "../mm2_bitcoin/chain" }
3434
chrono = { version = "0.4.23", "features" = ["serde"] }
3535
common = { path = "../common" }
36+
compatible-time = { version = "1.1.0", package = "web-time" }
3637
cosmrs = { version = "0.16", default-features = false }
3738
crossbeam = "0.8"
3839
crypto = { path = "../crypto" }
@@ -118,7 +119,6 @@ zcash_primitives = {features = ["transparent-inputs"], git = "https://github.co
118119
blake2b_simd = "0.5"
119120
ff = "0.8"
120121
futures-util = "0.3"
121-
instant = "0.1.12"
122122
jubjub = "0.5.1"
123123
js-sys = { version = "0.3.27" }
124124
mm2_db = { path = "../mm2_db" }
@@ -141,7 +141,6 @@ hyper = { version = "0.14.26", features = ["client", "http2", "server", "tcp"] }
141141
# using webpki-tokio to avoid rejecting valid certificates
142142
# got "invalid certificate: UnknownIssuer" for https://ropsten.infura.io on iOS using default-features
143143
hyper-rustls = { version = "0.24", default-features = false, features = ["http1", "http2", "webpki-tokio"] }
144-
instant = { version = "0.1.12", features = ["wasm-bindgen"] }
145144
lightning = "0.0.113"
146145
lightning-background-processor = "0.0.113"
147146
lightning-invoice = { version = "0.21.0", features = ["serde"] }

mm2src/coins/eth.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ use crypto::{Bip44Chain, CryptoCtx, CryptoCtxError, GlobalHDAccountArc, KeyPairP
6464
use derive_more::Display;
6565
use enum_derives::EnumFromStringify;
6666

67+
use compatible_time::Instant;
6768
use ethabi::{Contract, Function, Token};
6869
use ethcore_transaction::tx_builders::TxBuilderError;
6970
use ethcore_transaction::{Action, TransactionWrapper, TransactionWrapperBuilder as UnSignedEthTxBuilder,
@@ -76,7 +77,6 @@ use futures::compat::Future01CompatExt;
7677
use futures::future::{join, join_all, select_ok, try_join_all, Either, FutureExt, TryFutureExt};
7778
use futures01::Future;
7879
use http::Uri;
79-
use instant::Instant;
8080
use mm2_core::mm_ctx::{MmArc, MmWeak};
8181
use mm2_number::bigdecimal_custom::CheckedDivision;
8282
use mm2_number::{BigDecimal, BigUint, MmNumber};

mm2src/coins/eth/eth_balance_events.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ use mm2_event_stream::{Broadcaster, Event, EventStreamer, NoDataIn, StreamHandle
77
use mm2_number::BigDecimal;
88

99
use async_trait::async_trait;
10+
use compatible_time::Instant;
1011
use ethereum_types::Address;
1112
use futures::{channel::oneshot, stream::FuturesUnordered, StreamExt};
12-
use instant::Instant;
1313
use serde::Deserialize;
1414
use serde_json::Value as Json;
1515
use std::collections::{HashMap, HashSet};

mm2src/coins/eth/eth_rpc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use super::web3_transport::FeeHistoryResult;
66
use super::{web3_transport::Web3Transport, EthCoin};
77
use common::{custom_futures::timeout::FutureTimerExt, log::debug};
8-
use instant::Duration;
8+
use compatible_time::Duration;
99
use serde_json::Value;
1010
use web3::types::{Address, Block, BlockId, BlockNumber, Bytes, CallRequest, FeeHistory, Filter, Log, Proof, SyncState,
1111
Trace, TraceFilter, Transaction, TransactionId, TransactionReceipt, TransactionRequest, Work, H256,

mm2src/coins/eth/fee_estimation/eth_fee_events.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use common::executor::Timer;
44
use mm2_event_stream::{Broadcaster, Event, EventStreamer, NoDataIn, StreamHandlerInput};
55

66
use async_trait::async_trait;
7+
use compatible_time::Instant;
78
use futures::channel::oneshot;
8-
use instant::Instant;
99
use serde::Deserialize;
1010
use std::convert::TryFrom;
1111

mm2src/coins/eth/v2_activation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ use crate::nft::nft_errors::{GetNftInfoError, ParseChainTypeError};
88
use crate::nft::nft_structs::Chain;
99
#[cfg(target_arch = "wasm32")] use crate::EthMetamaskPolicy;
1010
use common::executor::AbortedError;
11+
use compatible_time::Instant;
1112
use crypto::{trezor::TrezorError, Bip32Error, CryptoCtxError, HwError};
1213
use enum_derives::EnumFromTrait;
13-
use instant::Instant;
1414
use mm2_err_handle::common_errors::WithInternal;
1515
#[cfg(target_arch = "wasm32")]
1616
use mm2_metamask::{from_metamask_error, MetamaskError, MetamaskRpcError, WithMetamaskRpcError};

mm2src/coins/eth/web3_transport/websocket_transport.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ use crate::eth::{EthCoin, RpcTransportEventHandlerShared};
1212
use crate::{MmCoin, RpcTransportEventHandler};
1313
use common::executor::{AbortSettings, SpawnAbortable, Timer};
1414
use common::log;
15+
use compatible_time::{Duration, Instant};
1516
use futures::channel::mpsc::{UnboundedReceiver, UnboundedSender};
1617
use futures::channel::oneshot;
1718
use futures::lock::Mutex as AsyncMutex;
1819
use futures_ticker::Ticker;
1920
use futures_util::{FutureExt, SinkExt, StreamExt};
20-
use instant::{Duration, Instant};
2121
use jsonrpc_core::Call;
2222
use mm2_p2p::Keypair;
2323
use proxy_signature::{ProxySign, RawMessage};

mm2src/coins/tendermint/tendermint_coin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ use common::executor::{abortable_queue::AbortableQueue, AbortableSystem};
3333
use common::executor::{AbortedError, Timer};
3434
use common::log::{debug, warn};
3535
use common::{get_utc_timestamp, now_sec, Future01CompatExt, PagingOptions, DEX_FEE_ADDR_PUBKEY};
36+
use compatible_time::Duration;
3637
use cosmrs::bank::MsgSend;
3738
use cosmrs::crypto::secp256k1::SigningKey;
3839
use cosmrs::distribution::MsgWithdrawDelegatorReward;
@@ -62,7 +63,6 @@ use futures::lock::Mutex as AsyncMutex;
6263
use futures::{FutureExt, TryFutureExt};
6364
use futures01::Future;
6465
use hex::FromHexError;
65-
use instant::Duration;
6666
use itertools::Itertools;
6767
use keys::{KeyPair, Public};
6868
use mm2_core::mm_ctx::{MmArc, MmWeak};

mm2src/coins/utxo/rpc_clients/electrum_rpc/connection.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use std::sync::atomic::{AtomicU64, Ordering as AtomicOrdering};
1818
use std::sync::{Arc, Mutex};
1919
use std::time::Duration;
2020

21+
use compatible_time::Instant;
2122
use futures::channel::oneshot as async_oneshot;
2223
use futures::compat::{Future01CompatExt, Stream01CompatExt};
2324
use futures::future::FutureExt;
@@ -27,7 +28,6 @@ use futures::stream::StreamExt;
2728
use futures01::sync::mpsc;
2829
use futures01::{Sink, Stream};
2930
use http::Uri;
30-
use instant::Instant;
3131
use serde::Serialize;
3232

3333
cfg_native! {

mm2src/common/Cargo.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ async-trait = "0.1"
1919
backtrace = "0.3"
2020
bytes = "1.1"
2121
cfg-if = "1.0"
22+
compatible-time = { version = "1.1.0", package = "web-time" }
2223
crossbeam = "0.8"
2324
env_logger = "0.9.3"
2425
derive_more = "0.99"
@@ -48,11 +49,9 @@ ser_error_derive = { path = "../derives/ser_error_derive" }
4849
sha2 = "0.10"
4950
shared_ref_counter = { path = "shared_ref_counter", optional = true }
5051
uuid = { version = "1.2.2", features = ["fast-rng", "serde", "v4"] }
51-
instant = { version = "0.1.12" }
5252

5353
[target.'cfg(target_arch = "wasm32")'.dependencies]
5454
chrono = { version = "0.4", features = ["wasmbind"] }
55-
instant = { version = "0.1.12", features = ["wasm-bindgen"] }
5655
js-sys = "0.3.27"
5756
serde_repr = "0.1.6"
5857
serde-wasm-bindgen = "0.4.3"

mm2src/mm2_core/Cargo.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ async-std = { version = "1.5", features = ["unstable"] }
1212
async-trait = "0.1"
1313
cfg-if = "1.0"
1414
common = { path = "../common" }
15+
compatible-time = { version = "1.1.0", package = "web-time" }
1516
db_common = { path = "../db_common" }
1617
derive_more = "0.99"
1718
futures = { version = "0.3", package = "futures", features = ["compat", "async-await", "thread-pool"] }
@@ -32,13 +33,11 @@ shared_ref_counter = { path = "../common/shared_ref_counter" }
3233
uuid = { version = "1.2.2", features = ["fast-rng", "serde", "v4"] }
3334

3435
[target.'cfg(target_arch = "wasm32")'.dependencies]
35-
instant = { version = "0.1.12", features = ["wasm-bindgen"] }
3636
mm2_rpc = { path = "../mm2_rpc", features = [ "rpc_facilities" ] }
3737
timed-map = { version = "1.3", features = ["rustc-hash", "wasm"] }
3838
wasm-bindgen-test = { version = "0.3.2" }
3939

4040
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
4141
rustls = { version = "0.21", default-features = false }
42-
instant = "0.1.12"
4342
tokio = { version = "1.20", features = ["io-util", "rt-multi-thread", "net"] }
4443
timed-map = { version = "1.3", features = ["rustc-hash"] }

mm2src/mm2_core/src/data_asker.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use common::custom_futures::timeout::FutureTimerExt;
22
use common::{HttpStatusCode, StatusCode};
3+
use compatible_time::Duration;
34
use derive_more::Display;
45
use futures::channel::oneshot;
56
use futures::lock::Mutex as AsyncMutex;
6-
use instant::Duration;
77
use mm2_err_handle::prelude::*;
88
use mm2_event_stream::Event;
99
use ser_error_derive::SerializeErrorType;
@@ -142,7 +142,7 @@ mod tests {
142142
use crate::mm_ctx::MmCtxBuilder;
143143
use common::block_on;
144144
use common::executor::Timer;
145-
use instant::Duration;
145+
use compatible_time::Duration;
146146
use serde::Deserialize;
147147
use serde_json::json;
148148
use std::thread;

mm2src/mm2_main/Cargo.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ cfg-if = "1.0"
3838
coins = { path = "../coins" }
3939
coins_activation = { path = "../coins_activation" }
4040
common = { path = "../common" }
41+
compatible-time = { version = "1.1.0", package = "web-time" }
4142
crc32fast = { version = "1.3.2", features = ["std", "nightly"] }
4243
crossbeam = "0.8"
4344
crypto = { path = "../crypto" }
@@ -55,7 +56,6 @@ hash-db = "0.15.2"
5556
hex = "0.4.2"
5657
http = "0.2"
5758
hw_common = { path = "../hw_common" }
58-
instant = { version = "0.1.12" }
5959
itertools = "0.10"
6060
keys = { path = "../mm2_bitcoin/keys" }
6161
lazy_static = "1.4"
@@ -101,7 +101,6 @@ trie-root = "0.16.0"
101101
uuid = { version = "1.2.2", features = ["fast-rng", "serde", "v4"] }
102102

103103
[target.'cfg(target_arch = "wasm32")'.dependencies]
104-
instant = { version = "0.1.12", features = ["wasm-bindgen"] }
105104
js-sys = { version = "0.3.27" }
106105
mm2_db = { path = "../mm2_db" }
107106
mm2_test_helpers = { path = "../mm2_test_helpers" }

mm2src/mm2_main/src/lp_healthcheck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ use async_std::prelude::FutureExt;
22
use chrono::Utc;
33
use common::executor::SpawnFuture;
44
use common::{log, HttpStatusCode, StatusCode};
5+
use compatible_time::{Duration, Instant};
56
use derive_more::Display;
67
use futures::channel::oneshot::{self, Receiver, Sender};
7-
use instant::{Duration, Instant};
88
use lazy_static::lazy_static;
99
use mm2_core::mm_ctx::MmArc;
1010
use mm2_err_handle::prelude::MmError;

mm2src/mm2_main/src/lp_network.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
use coins::lp_coinfind;
2424
use common::executor::SpawnFuture;
2525
use common::{log, Future01CompatExt};
26+
use compatible_time::Instant;
2627
use derive_more::Display;
2728
use futures::{channel::oneshot, StreamExt};
28-
use instant::Instant;
2929
use keys::KeyPair;
3030
use mm2_core::mm_ctx::{MmArc, MmWeak};
3131
use mm2_err_handle::prelude::*;

mm2src/mm2_main/src/lp_ordermatch/order_requests_tracker.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![allow(dead_code)]
2-
use instant::Instant;
2+
use compatible_time::Instant;
33
use std::{collections::hash_map::{HashMap, RawEntryMut},
44
num::NonZeroUsize,
55
time::Duration};

mm2src/mm2_main/src/lp_swap/swap_watcher.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ use coins::{CanRefundHtlc, ConfirmPaymentInput, FoundSwapTxSpend, MmCoinEnum, Re
1111
use common::executor::{AbortSettings, SpawnAbortable, Timer};
1212
use common::log::{debug, error, info};
1313
use common::{now_sec, DEX_FEE_ADDR_RAW_PUBKEY};
14+
use compatible_time::Duration;
1415
use futures::compat::Future01CompatExt;
15-
use instant::Duration;
1616
use mm2_core::mm_ctx::MmArc;
1717
use mm2_err_handle::prelude::MapToMmResult;
1818
use mm2_libp2p::{decode_signed, pub_sub_topic, TopicPrefix};

mm2src/mm2_main/tests/docker_tests/tendermint_tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -798,8 +798,8 @@ mod swap {
798798
use crate::integration_tests_common::enable_electrum;
799799
use common::executor::Timer;
800800
use common::log;
801+
use compatible_time::Duration;
801802
use ethereum_types::{Address, U256};
802-
use instant::Duration;
803803
use mm2_rpc::data::legacy::OrderbookResponse;
804804
use mm2_test_helpers::for_tests::{check_my_swap_status, check_recent_swaps, doc_conf, enable_eth_coin,
805805
iris_ibc_nucleus_testnet_conf, nucleus_testnet_conf,

mm2src/mm2_p2p/Cargo.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ doctest = false
1313
[dependencies]
1414
async-trait = "0.1"
1515
common = { path = "../common" }
16+
compatible-time = { version = "1.1.0", package = "web-time" }
1617
derive_more = "0.99"
1718
futures = { version = "0.3.1", default-features = false }
1819
futures-ticker = "0.0.3"
@@ -37,14 +38,12 @@ void = "1.0"
3738

3839
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
3940
futures-rustls = "0.24"
40-
instant = "0.1.12"
4141
libp2p = { git = "https://github.com/KomodoPlatform/rust-libp2p.git", tag = "k-0.52.12", default-features = false, features = ["dns", "identify", "floodsub", "gossipsub", "noise", "ping", "request-response", "secp256k1", "tcp", "tokio", "websocket", "macros", "yamux"] }
4242
timed-map = { version = "1.3", features = ["rustc-hash"] }
4343
tokio = { version = "1.20", default-features = false }
4444

4545
[target.'cfg(target_arch = "wasm32")'.dependencies]
4646
futures-rustls = "0.22"
47-
instant = { version = "0.1.12", features = ["wasm-bindgen"] }
4847
libp2p = { git = "https://github.com/KomodoPlatform/rust-libp2p.git", tag = "k-0.52.12", default-features = false, features = ["identify", "floodsub", "noise", "gossipsub", "ping", "request-response", "secp256k1", "wasm-ext", "wasm-ext-websocket", "macros", "yamux"] }
4948
timed-map = { version = "1.3", features = ["rustc-hash", "wasm"] }
5049

mm2src/mm2_p2p/src/behaviours/atomicdex.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
use common::executor::SpawnFuture;
2+
use compatible_time::Duration;
23
use derive_more::Display;
34
use futures::channel::mpsc::{channel, Receiver, Sender};
45
use futures::{channel::oneshot,
56
future::{join_all, poll_fn},
67
Future, FutureExt, SinkExt, StreamExt};
78
use futures_rustls::rustls;
89
use futures_ticker::Ticker;
9-
use instant::Duration;
1010
use lazy_static::lazy_static;
1111
use libp2p::core::transport::Boxed as BoxedTransport;
1212
use libp2p::core::{ConnectedPoint, Endpoint};

0 commit comments

Comments
 (0)