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

windows_compatibility_tari_base_node #1414

Merged
merged 1 commit into from
Mar 9, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
14 changes: 13 additions & 1 deletion base_layer/wallet/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
# Tari Wallet
# Tari Wallet

Foreign Function interface for the Tari Android and Tari iOS Wallets.

This crate is part of the [Tari Cryptocurrency](https://tari.com) project.

## Build setup (Mac)

See README.md in wallet_ffi crate

## Setup (Windows)

See README.md in wallet_ffi crate
10 changes: 10 additions & 0 deletions base_layer/wallet_ffi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,13 @@ sh mobile_build.sh

The relevant libraries will then be built and placed in the appropriate directories of the Wallet-iOS and Wallet-Android repositories.

# Setup (Windows)

## Test

1. Download SQL Lite (https://www.sqlite.org/index.html - 64bit) and unzip
2. `sqlite3.dll` must be accessible via the session path

## Build

ToDo - Android only
31 changes: 19 additions & 12 deletions comms/dht/src/dht.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,7 @@ impl Dht {
let saf_storage = Arc::new(store_forward::SafStorage::new(
self.config.saf_msg_cache_storage_capacity,
));

ServiceBuilder::new()
let builder = ServiceBuilder::new()
.layer(inbound::DeserializeLayer::new())
.layer(inbound::ValidateLayer::new(
self.config.network,
Expand All @@ -174,7 +173,12 @@ impl Dht {
.layer(store_forward::ForwardLayer::new(
Arc::clone(&self.peer_manager),
self.outbound_requester(),
))
));

// FIXME: The store and forward layers are excluded for Windows builds due to an unresolved stack overflow
// (#1416)
#[cfg(not(target_os = "windows"))]
let builder = builder
.layer(store_forward::StoreLayer::new(
self.config.clone(),
Arc::clone(&self.peer_manager),
Expand All @@ -188,15 +192,16 @@ impl Dht {
Arc::clone(&self.node_identity),
Arc::clone(&self.peer_manager),
self.outbound_requester(),
))
.layer(inbound::DhtHandlerLayer::new(
self.config.clone(),
Arc::clone(&self.node_identity),
Arc::clone(&self.peer_manager),
self.discovery_service_requester(),
self.outbound_requester(),
))
.into_inner()
));

let builder = builder.layer(inbound::DhtHandlerLayer::new(
self.config.clone(),
Arc::clone(&self.node_identity),
Arc::clone(&self.peer_manager),
self.discovery_service_requester(),
self.outbound_requester(),
));
builder.into_inner()
}

/// Returns an the full DHT stack as a `tower::layer::Layer`. This can be composed with
Expand Down Expand Up @@ -363,6 +368,8 @@ mod test {
assert_eq!(msg, b"secret");
}

// FIXME: This test is excluded for Windows builds due to an unresolved stack overflow issue (#1416)
#[cfg(not(target_os = "windows"))]
#[tokio_macros::test_basic]
async fn stack_forward() {
let node_identity = make_node_identity();
Expand Down
23 changes: 15 additions & 8 deletions infrastructure/storage/tests/lmdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

use serde::{Deserialize, Serialize};
use std::{net::Ipv4Addr, path::PathBuf, str::FromStr, sync::Arc, thread};
use std::{
fs::File,
io::{BufRead, BufReader},
net::Ipv4Addr,
path::PathBuf,
str::FromStr,
sync::Arc,
thread,
};
use tari_storage::{
lmdb_store::{db, LMDBBuilder, LMDBDatabase, LMDBError, LMDBStore},
IterationResult,
Expand Down Expand Up @@ -94,16 +102,15 @@ fn clean_up(name: &str) {
std::fs::remove_dir_all(get_path(name)).unwrap();
}

#[cfg(windows)]
const LINE_ENDING: &str = "\r\n";
#[cfg(not(windows))]
const LINE_ENDING: &str = "\n";

fn load_users() -> Vec<User> {
let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
path.push("tests/users.csv");
let f = std::fs::read_to_string(path).unwrap();
f.split(LINE_ENDING).map(|s| User::new(s).unwrap()).collect()
let file = File::open(path).unwrap();
BufReader::new(file)
.lines() // `BufReader::lines` is platform agnostic, recognises both `\r\n` and `\n`
.map(|result| result.unwrap())
.map(|s| User::new(&s).unwrap())
.collect()
}

fn insert_all_users(name: &str) -> (Vec<User>, LMDBDatabase) {
Expand Down