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

refactor: enable compile without sqlite, move emoji id and common types to tari_common_types #3266

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
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
6 changes: 5 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion applications/tari_app_grpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ edition = "2018"
tari_common_types = { version = "^0.9", path = "../../base_layer/common_types"}
tari_core = { path = "../../base_layer/core"}
tari_wallet = { path = "../../base_layer/wallet", optional = true}
tari_crypto = "0.11.1"
tari_comms = { path = "../../comms"}

chrono = "0.4.6"
Expand All @@ -22,4 +23,4 @@ tonic = "0.5.2"
tonic-build = "0.5.2"

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

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 @@ -24,7 +24,7 @@ use std::convert::TryFrom;
use tari_core::crypto::tari_utilities::ByteArray;

use crate::tari_rpc as grpc;
use tari_core::transactions::types::{ComSignature, Commitment, PrivateKey};
use tari_common_types::types::{ComSignature, Commitment, PrivateKey};

impl TryFrom<grpc::ComSignature> for ComSignature {
type Error = String;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@

use crate::tari_rpc as grpc;
use std::convert::{TryFrom, TryInto};
use tari_common_types::types::BlindingFactor;
use tari_core::{
blocks::{NewBlockHeaderTemplate, NewBlockTemplate},
crypto::tari_utilities::ByteArray,
proof_of_work::ProofOfWork,
transactions::types::BlindingFactor,
};
impl From<NewBlockTemplate> for grpc::NewBlockTemplate {
fn from(block: NewBlockTemplate) -> 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 @@ -24,7 +24,7 @@ use std::convert::TryFrom;
use tari_core::crypto::tari_utilities::ByteArray;

use crate::tari_rpc as grpc;
use tari_core::transactions::types::{PrivateKey, PublicKey, Signature};
use tari_common_types::types::{PrivateKey, PublicKey, Signature};

impl TryFrom<grpc::Signature> for Signature {
type Error = String;
Expand Down
14 changes: 5 additions & 9 deletions applications/tari_app_grpc/src/conversions/transaction_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@

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

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

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

impl TryFrom<grpc::TransactionKernel> for TransactionKernel {
type Error = String;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,13 @@

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

impl TryFrom<grpc::TransactionOutput> for TransactionOutput {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,13 @@

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

impl From<UnblindedOutput> for grpc::UnblindedOutput {
Expand Down
1 change: 1 addition & 0 deletions applications/tari_app_utilities/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ edition = "2018"
tari_comms = { path = "../../comms"}
tari_crypto = "0.11.1"
tari_common = { path = "../../common" }
tari_common_types ={ path ="../../base_layer/common_types"}
tari_p2p = { path = "../../base_layer/p2p", features = ["auto-update"] }
tari_wallet = { path = "../../base_layer/wallet", optional = true }

Expand Down
2 changes: 1 addition & 1 deletion applications/tari_app_utilities/src/identity_management.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ use log::*;
use rand::rngs::OsRng;
use std::{clone::Clone, fs, path::Path, string::ToString, sync::Arc};
use tari_common::configuration::bootstrap::prompt;
use tari_common_types::types::PrivateKey;
use tari_comms::{multiaddr::Multiaddr, peer_manager::PeerFeatures, NodeIdentity};
use tari_core::transactions::types::PrivateKey;
use tari_crypto::{
keys::SecretKey,
tari_utilities::{hex::Hex, message_format::MessageFormat},
Expand Down
11 changes: 7 additions & 4 deletions applications/tari_app_utilities/src/utilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

use crate::identity_management::load_from_json;
use futures::future::Either;
use log::*;
use thiserror::Error;
use tokio::{runtime, runtime::Runtime};

use tari_common::{CommsTransport, GlobalConfig, SocksAuthentication, TorControlAuthentication};
use tari_comms::{
connectivity::ConnectivityError,
Expand All @@ -35,10 +37,11 @@ use tari_comms::{
types::CommsPublicKey,
utils::multiaddr::multiaddr_to_socketaddr,
};
use tari_core::{tari_utilities::hex::Hex, transactions::emoji::EmojiId};
use tari_core::tari_utilities::hex::Hex;
use tari_p2p::transport::{TorConfig, TransportType};
use thiserror::Error;
use tokio::{runtime, runtime::Runtime};

use crate::identity_management::load_from_json;
use tari_common_types::emoji::EmojiId;

pub const LOG_TARGET: &str = "tari::application";

Expand Down
3 changes: 2 additions & 1 deletion applications/tari_base_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ tari_app_grpc = { path = "../tari_app_grpc" }
tari_app_utilities = { path = "../tari_app_utilities" }
tari_common = { path = "../../common" }
tari_comms = { path = "../../comms", features = ["rpc"] }
tari_common_types = {path = "../../base_layer/common_types"}
tari_comms_dht = { path = "../../comms/dht" }
tari_core = { path = "../../base_layer/core", default-features = false, features = ["transactions"] }
tari_crypto = "0.11.1"
Expand Down Expand Up @@ -43,7 +44,7 @@ opentelemetry = { version = "0.16", default-features = false, features = ["trace
opentelemetry-jaeger = { version="0.15", features=["rt-tokio"]}

[features]
avx2 = ["tari_core/avx2", "tari_crypto/avx2", "tari_p2p/avx2", "tari_comms/avx2", "tari_comms_dht/avx2"]
avx2 = ["tari_core/avx2", "tari_crypto/avx2", "tari_p2p/avx2", "tari_comms/avx2", "tari_comms_dht/avx2"]
safe = []


6 changes: 4 additions & 2 deletions applications/tari_base_node/src/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

use std::{cmp, fs, str::FromStr, sync::Arc, time::Duration};

use anyhow::anyhow;
use log::*;
use std::{cmp, fs, str::FromStr, sync::Arc, time::Duration};

use tari_app_utilities::{consts, identity_management, utilities::create_transport_type};
use tari_common::{configuration::bootstrap::ApplicationType, GlobalConfig};
use tari_comms::{peer_manager::Peer, protocol::rpc::RpcServer, NodeIdentity, UnspawnedCommsNode};
Expand All @@ -47,7 +49,7 @@ use tari_core::{
MempoolServiceInitializer,
MempoolSyncInitializer,
},
transactions::types::CryptoFactories,
transactions::CryptoFactories,
};
use tari_p2p::{
auto_update::{AutoUpdateConfig, SoftwareUpdaterService},
Expand Down
11 changes: 7 additions & 4 deletions applications/tari_base_node/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

use crate::bootstrap::BaseNodeBootstrapper;
use log::*;
use std::sync::Arc;

sdbondi marked this conversation as resolved.
Show resolved Hide resolved
use log::*;
use tokio::sync::watch;

use tari_common::{configuration::Network, DatabaseType, GlobalConfig};
use tari_comms::{peer_manager::NodeIdentity, protocol::rpc::RpcServerHandle, CommsNode};
use tari_comms_dht::Dht;
Expand All @@ -32,7 +34,7 @@ use tari_core::{
consensus::ConsensusManager,
mempool::{service::LocalMempoolService, Mempool, MempoolConfig},
proof_of_work::randomx_factory::RandomXFactory,
transactions::types::CryptoFactories,
transactions::CryptoFactories,
validation::{
block_validators::{BodyOnlyValidator, OrphanBlockValidator},
header_validator::HeaderValidator,
Expand All @@ -48,7 +50,8 @@ use tari_core::{
use tari_p2p::{auto_update::SoftwareUpdaterHandle, services::liveness::LivenessHandle};
use tari_service_framework::ServiceHandles;
use tari_shutdown::ShutdownSignal;
use tokio::sync::watch;

use crate::bootstrap::BaseNodeBootstrapper;

const LOG_TARGET: &str = "c::bn::initialization";

Expand Down
8 changes: 4 additions & 4 deletions applications/tari_base_node/src/command_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ use std::{
};
use tari_app_utilities::consts;
use tari_common::GlobalConfig;
use tari_common_types::{
emoji::EmojiId,
types::{Commitment, HashOutput, Signature},
};
use tari_comms::{
connectivity::ConnectivityRequester,
peer_manager::{NodeId, Peer, PeerFeatures, PeerManager, PeerManagerError, PeerQuery},
Expand All @@ -53,10 +57,6 @@ use tari_core::{
mempool::service::LocalMempoolService,
proof_of_work::PowAlgorithm,
tari_utilities::{hex::Hex, message_format::MessageFormat},
transactions::{
emoji::EmojiId,
types::{Commitment, HashOutput, Signature},
},
};
use tari_crypto::{ristretto::RistrettoPublicKey, tari_utilities::Hashable};
use tari_p2p::auto_update::SoftwareUpdaterHandle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ use tari_app_grpc::{
tari_rpc::{CalcType, Sorting},
};
use tari_app_utilities::consts;
use tari_common_types::types::Signature;
use tari_comms::{Bytes, CommsNode};
use tari_core::{
base_node::{
Expand All @@ -50,7 +51,7 @@ use tari_core::{
crypto::tari_utilities::{hex::Hex, ByteArray},
mempool::{service::LocalMempoolService, TxStorageResponse},
proof_of_work::PowAlgorithm,
transactions::{transaction::Transaction, types::Signature},
transactions::transaction::Transaction,
};
use tari_crypto::tari_utilities::{message_format::MessageFormat, Hashable};
use tari_p2p::{auto_update::SoftwareUpdaterHandle, services::liveness::LivenessHandle};
Expand Down
8 changes: 2 additions & 6 deletions applications/tari_base_node/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,8 @@ use tari_app_utilities::utilities::{
parse_emoji_id_or_public_key,
parse_emoji_id_or_public_key_or_node_id,
};
use tari_core::{
crypto::tari_utilities::hex::from_hex,
proof_of_work::PowAlgorithm,
tari_utilities::hex::Hex,
transactions::types::{Commitment, PrivateKey, PublicKey, Signature},
};
use tari_common_types::types::{Commitment, PrivateKey, PublicKey, Signature};
use tari_core::{crypto::tari_utilities::hex::from_hex, proof_of_work::PowAlgorithm, tari_utilities::hex::Hex};
use tari_shutdown::Shutdown;

/// Enum representing commands used by the basenode
Expand Down
8 changes: 5 additions & 3 deletions applications/tari_base_node/src/recovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//

use anyhow::anyhow;
use log::*;
use std::{
fs,
io::{self, Write},
path::Path,
sync::Arc,
};

use anyhow::anyhow;
use log::*;

use tari_app_utilities::utilities::ExitCodes;
use tari_common::{configuration::Network, DatabaseType, GlobalConfig};
use tari_core::{
Expand All @@ -43,7 +45,7 @@ use tari_core::{
},
consensus::ConsensusManager,
proof_of_work::randomx_factory::RandomXFactory,
transactions::types::CryptoFactories,
transactions::CryptoFactories,
validation::{
block_validators::{BodyOnlyValidator, OrphanBlockValidator},
header_validator::HeaderValidator,
Expand Down
Loading