Skip to content

Cross compile preparations #269

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

Merged
merged 3 commits into from
Mar 5, 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
2 changes: 1 addition & 1 deletion components/capnp_conv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ edition = "2018"
log = "0.4"
pretty_env_logger = "0.2"

capnp_conv_derive = { path = "capnp_conv_derive", version = "0.1.0", package = "offst-capnp-conv-derive" }
offst-capnp-conv-derive = { path = "capnp_conv_derive", version = "0.1.0" }

capnp = "0.10.0"
derive_more = "0.15.0"
Expand Down
3 changes: 3 additions & 0 deletions components/capnp_conv/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
clippy::new_without_default
)]

// Workaround for issue: https://github.com/rust-lang/rust/issues/64450
extern crate offst_capnp_conv_derive as capnp_conv_derive;

use std::io;

use capnp;
Expand Down
2 changes: 1 addition & 1 deletion components/common/src/int_convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::u32;
target_pointer_width = "32"
))]
pub fn usize_to_u32(num: usize) -> Option<u32> {
Some(a as u32)
Some(num as u32)
}

#[cfg(target_pointer_width = "64")]
Expand Down
2 changes: 1 addition & 1 deletion components/proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ edition = "2018"
[dependencies]

common = { path = "../common", version = "0.1.0", package = "offst-common" }
mutual_from = { path = "../mutual_from", version = "0.1.0", package = "offst-mutual-from" }
offst-mutual-from = { path = "../mutual_from", version = "0.1.0"}
capnp_conv = { path = "../capnp_conv", version = "0.1.0", package = "offst-capnp-conv" }

capnp = "0.10.0"
Expand Down
3 changes: 3 additions & 0 deletions components/proto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
#[macro_use]
extern crate quickcheck_derive;

// Workaround for issue: https://github.com/rust-lang/rust/issues/64450
extern crate offst_mutual_from as mutual_from;

#[macro_use]
pub mod macros;
pub mod app_server;
Expand Down
2 changes: 1 addition & 1 deletion components/stctrl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ path = "src/bin/stverify.rs"

route = { path = "../route", version = "0.1.0", package = "offst-route" }
app = { path = "../app", version = "0.1.0", package = "offst-app" }
mutual_from = { path = "../mutual_from", version = "0.1.0", package = "offst-mutual-from" }
offst-mutual-from = { path = "../mutual_from", version = "0.1.0"}

log = "0.4"

Expand Down
21 changes: 9 additions & 12 deletions components/stctrl/src/buyer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,16 @@ use std::path::PathBuf;

use derive_more::From;

use futures::future::select_all;
use futures::sink::SinkExt;
use futures::stream::StreamExt;

use structopt::StructOpt;

use app::common::{
Commit, Currency, InvoiceId, MultiRoute, PaymentId, PaymentStatus, PaymentStatusSuccess,
PublicKey, Uid,
Currency, InvoiceId, MultiRoute, PaymentId, PaymentStatus, PaymentStatusSuccess, PublicKey, Uid,
};
use app::conn::{
self, buyer, routes, AppServerToApp, AppToAppServer, ConnPairApp, RequestResult,
ResponseRoutesResult,
self, AppServerToApp, AppToAppServer, ConnPairApp, RequestResult, ResponseRoutesResult,
};
use app::gen::{gen_payment_id, gen_uid};
use app::report::NodeReport;
Expand Down Expand Up @@ -122,7 +119,7 @@ async fn request_routes(
.sender
.send(app_to_app_server)
.await
.map_err(|_| BuyerError::AppRoutesError);
.map_err(|_| BuyerError::AppRoutesError)?;

// Wait until we get back response routes:
while let Some(app_server_to_app) = conn_pair.receiver.next().await {
Expand Down Expand Up @@ -163,7 +160,7 @@ async fn create_payment(
.sender
.send(app_to_app_server)
.await
.map_err(|_| BuyerError::CreatePaymentFailed);
.map_err(|_| BuyerError::CreatePaymentFailed)?;

while let Some(app_server_to_app) = conn_pair.receiver.next().await {
if let AppServerToApp::ReportMutations(report_mutations) = app_server_to_app {
Expand Down Expand Up @@ -196,7 +193,7 @@ async fn request_close_payment_nowait(
.sender
.send(app_to_app_server)
.await
.map_err(|_| BuyerError::RequestClosePaymentError);
.map_err(|_| BuyerError::RequestClosePaymentError)?;

while let Some(app_server_to_app) = conn_pair.receiver.next().await {
if let AppServerToApp::ReportMutations(report_mutations) = app_server_to_app {
Expand Down Expand Up @@ -229,7 +226,7 @@ async fn request_close_payment(
.sender
.send(app_to_app_server)
.await
.map_err(|_| BuyerError::RequestClosePaymentError);
.map_err(|_| BuyerError::RequestClosePaymentError)?;

while let Some(app_server_to_app) = conn_pair.receiver.next().await {
if let AppServerToApp::ResponseClosePayment(response_close_payment) = app_server_to_app {
Expand Down Expand Up @@ -261,7 +258,7 @@ async fn ack_close_payment(
.sender
.send(app_to_app_server)
.await
.map_err(|_| BuyerError::AckClosePaymentError);
.map_err(|_| BuyerError::AckClosePaymentError)?;

while let Some(app_server_to_app) = conn_pair.receiver.next().await {
if let AppServerToApp::ReportMutations(report_mutations) = app_server_to_app {
Expand Down Expand Up @@ -377,7 +374,7 @@ async fn buyer_pay_invoice(
.sender
.send(app_to_app_server)
.await
.map_err(|_| BuyerError::CreateTransactionFailed);
.map_err(|_| BuyerError::CreateTransactionFailed)?;
}

// Signal that no new transactions will be created:
Expand Down Expand Up @@ -482,7 +479,7 @@ async fn buyer_payment_status(
pub async fn buyer(
buyer_cmd: BuyerCmd,
node_report: &NodeReport,
mut conn_pair: ConnPairApp,
conn_pair: ConnPairApp,
writer: &mut impl io::Write,
) -> Result<(), BuyerError> {
// Get our local public key:
Expand Down
2 changes: 1 addition & 1 deletion components/stctrl/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ async fn config_request(
.sender
.send(app_to_app_server)
.await
.map_err(|_| ConfigError::AppConfigError);
.map_err(|_| ConfigError::AppConfigError)?;

// Wait until we get an ack for our request:
while let Some(app_server_to_app) = conn_pair.receiver.next().await {
Expand Down
2 changes: 1 addition & 1 deletion components/stctrl/src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use app::common::{
RandValue, Receipt, Signature,
};
use app::report::{MoveTokenHashedReport, TokenInfo};
use app::ser_utils::serialize_to_string;

use mutual_from::mutual_from;

Expand Down Expand Up @@ -93,6 +92,7 @@ mod test {
use std::convert::TryFrom;

use app::report::{BalanceInfo, CountersInfo, CurrencyBalanceInfo, McInfo};
use app::ser_utils::serialize_to_string;

#[test]
fn test_serialize_invoice_file() {
Expand Down
6 changes: 3 additions & 3 deletions components/stctrl/src/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ use derive_more::From;
use app::common::RelayAddress;
use app::report::{
ChannelStatusReport, CurrencyReport, FriendReport, FriendStatusReport, NodeReport,
RequestsStatusReport,
};
use app::ser_utils::public_key_to_string;

use app::conn::ConnPairApp;
use app::file::{FriendAddressFile, FriendFile, RelayAddressFile};
use app::file::{FriendAddressFile, RelayAddressFile};
use app::ser_utils::{serialize_to_string, StringSerdeError};

use crate::file::TokenFile;
Expand Down Expand Up @@ -190,6 +188,7 @@ pub async fn info_index(
Ok(())
}

/*
/// Return a string that represents requests status.
/// "+" means open, "-" means closed
fn requests_status_str(requests_status_report: &RequestsStatusReport) -> String {
Expand All @@ -200,6 +199,7 @@ fn requests_status_str(requests_status_report: &RequestsStatusReport) -> String
}
.to_owned()
}
*/

/*
/// Check if a friend state is consistent
Expand Down
5 changes: 3 additions & 2 deletions components/stctrl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
clippy::module_inception,
clippy::new_without_default
)]
// TODO; Remove this hint:
#![allow(unused)]

// Workaround for issue: https://github.com/rust-lang/rust/issues/64450
extern crate offst_mutual_from as mutual_from;

#[macro_use]
extern crate prettytable;
Expand Down
2 changes: 1 addition & 1 deletion components/stctrl/src/seller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ async fn seller_request(
.sender
.send(app_to_app_server)
.await
.map_err(|_| SellerError::SellerRequestError);
.map_err(|_| SellerError::SellerRequestError)?;

// Wait until we get an ack for our request:
while let Some(app_server_to_app) = conn_pair.receiver.next().await {
Expand Down
2 changes: 1 addition & 1 deletion components/stctrl/src/stctrllib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub struct StCtrlCmd {
}

pub fn stctrl(st_ctrl_cmd: StCtrlCmd, writer: &mut impl io::Write) -> Result<(), StCtrlError> {
let mut thread_pool = ThreadPool::new().map_err(|_| StCtrlError::CreateThreadPoolError)?;
let thread_pool = ThreadPool::new().map_err(|_| StCtrlError::CreateThreadPoolError)?;

let StCtrlCmd {
idfile,
Expand Down
4 changes: 2 additions & 2 deletions components/stctrl/src/stverifylib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::fs;
use std::io::{self, Write};
use std::io;
use std::path::PathBuf;

use derive_more::From;
Expand Down Expand Up @@ -109,7 +109,7 @@ fn stverify_verify_token(
)
.map_err(|_| StVerifyError::WriteError)?;

writeln!(writer, "balances:\n");
writeln!(writer, "balances:\n").map_err(|_| StVerifyError::WriteError)?;

for currency_balance_info in move_token_hashed_report.token_info.mc.balances {
let balance_info = &currency_balance_info.balance_info;
Expand Down