Skip to content

Commit

Permalink
chore: tokio 1 and other crate upgrades
Browse files Browse the repository at this point in the history
- upgrades to tokio 1.10
- upgrade multiaddr to 1.13
- updates select loops to use tokio::select!
- updates to use tokio mpsc and oneshot channels
- remove max_threads config
- removed tari_wallet dependency from tari base node
- moved emoji id library out of tari wallet into tari core (in order to
  remove dependency on `tari_wallet` for tari base node)
- Wait for bootstrap with mempool sync moved to the initializer

Include changes from #3237

fix: add periodic connection check to wallet connectivity service
- Adds a periodic check of the connection status and attempts a
  reconnect if no longer connected. Previously it was assumed that this
  can be done lazily because some caller will always call
  `obtain_base_node_wallet_rpc_client`, but this may not be the case. A
  periodic check is added.
- Clean up some state checking to use the wallet connectivity service.
  • Loading branch information
sdbondi committed Aug 30, 2021
1 parent 5dc10c2 commit cdd94e7
Show file tree
Hide file tree
Showing 297 changed files with 5,993 additions and 5,860 deletions.
1,397 changes: 668 additions & 729 deletions Cargo.lock

Large diffs are not rendered by default.

14 changes: 8 additions & 6 deletions applications/tari_app_grpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ edition = "2018"
[dependencies]
tari_common_types = { version = "^0.9", path = "../../base_layer/common_types"}
tari_core = { path = "../../base_layer/core"}
tari_wallet = { path = "../../base_layer/wallet"}
tari_crypto = "0.11.1"
tari_wallet = { path = "../../base_layer/wallet", optional = true}
tari_comms = { path = "../../comms"}

chrono = "0.4.6"
prost = "0.6"
prost-types = "0.6.1"
tonic = "0.2"
prost = "0.8"
prost-types = "0.8"
tonic = "0.5.2"

[build-dependencies]
tonic-build = "0.2"
tonic-build = "0.5.2"

[features]
wallet = ["tari_wallet"]
8 changes: 6 additions & 2 deletions applications/tari_app_grpc/src/conversions/block_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ use crate::{
tari_rpc as grpc,
};
use std::convert::TryFrom;
use tari_core::{blocks::BlockHeader, proof_of_work::ProofOfWork, transactions::types::BlindingFactor};
use tari_crypto::tari_utilities::{ByteArray, Hashable};
use tari_core::{
blocks::BlockHeader,
crypto::tari_utilities::{ByteArray, Hashable},
proof_of_work::ProofOfWork,
transactions::types::BlindingFactor,
};

impl From<BlockHeader> for grpc::BlockHeader {
fn from(h: BlockHeader) -> Self {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

use std::convert::TryFrom;
use tari_crypto::tari_utilities::ByteArray;
use tari_core::crypto::tari_utilities::ByteArray;

use crate::tari_rpc as grpc;
use tari_core::transactions::types::{ComSignature, Commitment, PrivateKey};
Expand Down
2 changes: 1 addition & 1 deletion applications/tari_app_grpc/src/conversions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub use self::{

use crate::{tari_rpc as grpc, tari_rpc::BlockGroupRequest};
use prost_types::Timestamp;
use tari_crypto::tari_utilities::epoch_time::EpochTime;
use tari_core::crypto::tari_utilities::epoch_time::EpochTime;

/// Utility function that converts a `EpochTime` to a `prost::Timestamp`
pub fn datetime_to_timestamp(datetime: EpochTime) -> Timestamp {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ use crate::tari_rpc as grpc;
use std::convert::{TryFrom, TryInto};
use tari_core::{
blocks::{NewBlockHeaderTemplate, NewBlockTemplate},
crypto::tari_utilities::ByteArray,
proof_of_work::ProofOfWork,
transactions::types::BlindingFactor,
};
use tari_crypto::tari_utilities::ByteArray;
impl From<NewBlockTemplate> for grpc::NewBlockTemplate {
fn from(block: NewBlockTemplate) -> Self {
let header = grpc::NewBlockHeaderTemplate {
Expand Down
2 changes: 1 addition & 1 deletion applications/tari_app_grpc/src/conversions/peer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

use crate::{conversions::datetime_to_timestamp, tari_rpc as grpc};
use tari_comms::{connectivity::ConnectivityStatus, net_address::MutliaddrWithStats, peer_manager::Peer};
use tari_crypto::tari_utilities::ByteArray;
use tari_core::crypto::tari_utilities::ByteArray;

impl From<Peer> for grpc::Peer {
fn from(peer: Peer) -> Self {
Expand Down
2 changes: 1 addition & 1 deletion applications/tari_app_grpc/src/conversions/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

use std::convert::TryFrom;
use tari_crypto::tari_utilities::ByteArray;
use tari_core::crypto::tari_utilities::ByteArray;

use crate::tari_rpc as grpc;
use tari_core::transactions::types::{PrivateKey, PublicKey, Signature};
Expand Down
65 changes: 36 additions & 29 deletions applications/tari_app_grpc/src/conversions/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@

use crate::tari_rpc as grpc;
use std::convert::{TryFrom, TryInto};
use tari_core::transactions::transaction::Transaction;
use tari_crypto::{ristretto::RistrettoSecretKey, tari_utilities::ByteArray};
use tari_wallet::{output_manager_service::TxId, transaction_service::storage::models};
use tari_core::{
crypto::{ristretto::RistrettoSecretKey, tari_utilities::ByteArray},
transactions::transaction::Transaction,
};

impl From<Transaction> for grpc::Transaction {
fn from(source: Transaction) -> Self {
Expand Down Expand Up @@ -53,38 +54,44 @@ impl TryFrom<grpc::Transaction> for Transaction {
}
}

impl From<models::TransactionStatus> for grpc::TransactionStatus {
fn from(status: models::TransactionStatus) -> Self {
use models::TransactionStatus::*;
match status {
Completed => grpc::TransactionStatus::Completed,
Broadcast => grpc::TransactionStatus::Broadcast,
MinedUnconfirmed => grpc::TransactionStatus::MinedUnconfirmed,
MinedConfirmed => grpc::TransactionStatus::MinedConfirmed,
Imported => grpc::TransactionStatus::Imported,
Pending => grpc::TransactionStatus::Pending,
Coinbase => grpc::TransactionStatus::Coinbase,
#[cfg(feature = "wallet")]
mod wallet {
use super::*;
use tari_wallet::{output_manager_service::TxId, transaction_service::storage::models};

impl From<models::TransactionStatus> for grpc::TransactionStatus {
fn from(status: models::TransactionStatus) -> Self {
use models::TransactionStatus::*;
match status {
Completed => grpc::TransactionStatus::Completed,
Broadcast => grpc::TransactionStatus::Broadcast,
MinedUnconfirmed => grpc::TransactionStatus::MinedUnconfirmed,
MinedConfirmed => grpc::TransactionStatus::MinedConfirmed,
Imported => grpc::TransactionStatus::Imported,
Pending => grpc::TransactionStatus::Pending,
Coinbase => grpc::TransactionStatus::Coinbase,
}
}
}
}

impl From<models::TransactionDirection> for grpc::TransactionDirection {
fn from(status: models::TransactionDirection) -> Self {
use models::TransactionDirection::*;
match status {
Unknown => grpc::TransactionDirection::Unknown,
Inbound => grpc::TransactionDirection::Inbound,
Outbound => grpc::TransactionDirection::Outbound,
impl From<models::TransactionDirection> for grpc::TransactionDirection {
fn from(status: models::TransactionDirection) -> Self {
use models::TransactionDirection::*;
match status {
Unknown => grpc::TransactionDirection::Unknown,
Inbound => grpc::TransactionDirection::Inbound,
Outbound => grpc::TransactionDirection::Outbound,
}
}
}
}

impl grpc::TransactionInfo {
pub fn not_found(tx_id: TxId) -> Self {
Self {
tx_id,
status: grpc::TransactionStatus::NotFound as i32,
..Default::default()
impl grpc::TransactionInfo {
pub fn not_found(tx_id: TxId) -> Self {
Self {
tx_id,
status: grpc::TransactionStatus::NotFound as i32,
..Default::default()
}
}
}
}
16 changes: 9 additions & 7 deletions applications/tari_app_grpc/src/conversions/transaction_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@

use crate::tari_rpc as grpc;
use std::convert::{TryFrom, TryInto};
use tari_core::transactions::{
transaction::TransactionInput,
types::{Commitment, PublicKey},
};
use tari_crypto::{
script::{ExecutionStack, TariScript},
tari_utilities::{ByteArray, Hashable},
use tari_core::{
crypto::{
script::{ExecutionStack, TariScript},
tari_utilities::{ByteArray, Hashable},
},
transactions::{
transaction::TransactionInput,
types::{Commitment, PublicKey},
},
};

impl TryFrom<grpc::TransactionInput> for TransactionInput {
Expand Down
12 changes: 7 additions & 5 deletions applications/tari_app_grpc/src/conversions/transaction_kernel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@

use crate::tari_rpc as grpc;
use std::convert::{TryFrom, TryInto};
use tari_core::transactions::{
tari_amount::MicroTari,
transaction::{KernelFeatures, TransactionKernel},
types::Commitment,
use tari_core::{
crypto::tari_utilities::{ByteArray, Hashable},
transactions::{
tari_amount::MicroTari,
transaction::{KernelFeatures, TransactionKernel},
types::Commitment,
},
};
use tari_crypto::tari_utilities::{ByteArray, Hashable};

impl TryFrom<grpc::TransactionKernel> for TransactionKernel {
type Error = String;
Expand Down
18 changes: 10 additions & 8 deletions applications/tari_app_grpc/src/conversions/transaction_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@

use crate::tari_rpc as grpc;
use std::convert::{TryFrom, TryInto};
use tari_core::transactions::{
bullet_rangeproofs::BulletRangeProof,
transaction::TransactionOutput,
types::{Commitment, PublicKey},
};
use tari_crypto::{
script::TariScript,
tari_utilities::{ByteArray, Hashable},
use tari_core::{
crypto::{
script::TariScript,
tari_utilities::{ByteArray, Hashable},
},
transactions::{
bullet_rangeproofs::BulletRangeProof,
transaction::TransactionOutput,
types::{Commitment, PublicKey},
},
};

impl TryFrom<grpc::TransactionOutput> for TransactionOutput {
Expand Down
18 changes: 10 additions & 8 deletions applications/tari_app_grpc/src/conversions/unblinded_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@

use crate::tari_rpc as grpc;
use std::convert::{TryFrom, TryInto};
use tari_core::transactions::{
tari_amount::MicroTari,
transaction::UnblindedOutput,
types::{PrivateKey, PublicKey},
};
use tari_crypto::{
script::{ExecutionStack, TariScript},
tari_utilities::ByteArray,
use tari_core::{
crypto::{
script::{ExecutionStack, TariScript},
tari_utilities::ByteArray,
},
transactions::{
tari_amount::MicroTari,
transaction::UnblindedOutput,
types::{PrivateKey, PublicKey},
},
};

impl From<UnblindedOutput> for grpc::UnblindedOutput {
Expand Down
13 changes: 8 additions & 5 deletions applications/tari_app_utilities/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ tari_comms = { path = "../../comms"}
tari_crypto = "0.11.1"
tari_common = { path = "../../common" }
tari_p2p = { path = "../../base_layer/p2p", features = ["auto-update"] }
tari_wallet = { path = "../../base_layer/wallet" }
tari_wallet = { path = "../../base_layer/wallet", optional = true }

config = { version = "0.9.3" }
futures = { version = "^0.3.1", default-features = false, features = ["alloc"]}
futures = { version = "^0.3.16", default-features = false, features = ["alloc"]}
qrcode = { version = "0.12" }
dirs-next = "1.0.2"
serde_json = "1.0"
log = { version = "0.4.8", features = ["std"] }
rand = "0.8"
tokio = { version="0.2.10", features = ["signal"] }
tokio = { version="^1.10", features = ["signal"] }
structopt = { version = "0.3.13", default_features = false }
strum = "^0.19"
strum_macros = "^0.19"
thiserror = "^1.0.20"
tonic = "0.2"
thiserror = "^1.0.26"
tonic = "0.5.2"

[dependencies.tari_core]
path = "../../base_layer/core"
Expand All @@ -33,3 +33,6 @@ features = ["transactions"]

[build-dependencies]
tari_common = { path = "../../common", features = ["build", "static-application-info"] }

[features]
wallet = ["tari_wallet"]
Loading

0 comments on commit cdd94e7

Please sign in to comment.