Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: tokio 1 and other crate upgrades #3258

Merged
merged 2 commits into from
Aug 30, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
865 changes: 411 additions & 454 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;
sdbondi marked this conversation as resolved.
Show resolved Hide resolved

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
14 changes: 9 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,7 @@ features = ["transactions"]

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

[features]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shows that there is an incorrect abstraction. This library is meant to house common functionality between the two (and more) apps. If there is code specific to the wallet, it needs to be moved into that app specifically

Copy link
Member Author

@sdbondi sdbondi Aug 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah does need some sorting, I had finished the work with the base node but could not compile it because it depended on the wallet, so that's why these quick fixes exist - unfortunately because both the type and trait (From<T>) is foreign to tari_wallet we cannot just move the code. But we should sort this out.

# TODO: This crate is supposed to hold common logic. Move code from this feature into the crate that is more specific to the wallet
wallet = ["tari_wallet"]
sdbondi marked this conversation as resolved.
Show resolved Hide resolved
Loading