Skip to content

Commit 7e3e559

Browse files
authored
Merge pull request #269 from freedomlayer/real/feat/cross-compile
Cross compile preparations
2 parents 86475f1 + 14860d1 commit 7e3e559

File tree

14 files changed

+31
-27
lines changed

14 files changed

+31
-27
lines changed

components/capnp_conv/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ edition = "2018"
1010
log = "0.4"
1111
pretty_env_logger = "0.2"
1212

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

1515
capnp = "0.10.0"
1616
derive_more = "0.15.0"

components/capnp_conv/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
clippy::new_without_default
99
)]
1010

11+
// Workaround for issue: https://github.com/rust-lang/rust/issues/64450
12+
extern crate offst_capnp_conv_derive as capnp_conv_derive;
13+
1114
use std::io;
1215

1316
use capnp;

components/common/src/int_convert.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::u32;
66
target_pointer_width = "32"
77
))]
88
pub fn usize_to_u32(num: usize) -> Option<u32> {
9-
Some(a as u32)
9+
Some(num as u32)
1010
}
1111

1212
#[cfg(target_pointer_width = "64")]

components/proto/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ edition = "2018"
99
[dependencies]
1010

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

1515
capnp = "0.10.0"

components/proto/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
#[macro_use]
1111
extern crate quickcheck_derive;
1212

13+
// Workaround for issue: https://github.com/rust-lang/rust/issues/64450
14+
extern crate offst_mutual_from as mutual_from;
15+
1316
#[macro_use]
1417
pub mod macros;
1518
pub mod app_server;

components/stctrl/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ path = "src/bin/stverify.rs"
2222

2323
route = { path = "../route", version = "0.1.0", package = "offst-route" }
2424
app = { path = "../app", version = "0.1.0", package = "offst-app" }
25-
mutual_from = { path = "../mutual_from", version = "0.1.0", package = "offst-mutual-from" }
25+
offst-mutual-from = { path = "../mutual_from", version = "0.1.0"}
2626

2727
log = "0.4"
2828

components/stctrl/src/buyer.rs

+9-12
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,16 @@ use std::path::PathBuf;
55

66
use derive_more::From;
77

8-
use futures::future::select_all;
98
use futures::sink::SinkExt;
109
use futures::stream::StreamExt;
1110

1211
use structopt::StructOpt;
1312

1413
use app::common::{
15-
Commit, Currency, InvoiceId, MultiRoute, PaymentId, PaymentStatus, PaymentStatusSuccess,
16-
PublicKey, Uid,
14+
Currency, InvoiceId, MultiRoute, PaymentId, PaymentStatus, PaymentStatusSuccess, PublicKey, Uid,
1715
};
1816
use app::conn::{
19-
self, buyer, routes, AppServerToApp, AppToAppServer, ConnPairApp, RequestResult,
20-
ResponseRoutesResult,
17+
self, AppServerToApp, AppToAppServer, ConnPairApp, RequestResult, ResponseRoutesResult,
2118
};
2219
use app::gen::{gen_payment_id, gen_uid};
2320
use app::report::NodeReport;
@@ -122,7 +119,7 @@ async fn request_routes(
122119
.sender
123120
.send(app_to_app_server)
124121
.await
125-
.map_err(|_| BuyerError::AppRoutesError);
122+
.map_err(|_| BuyerError::AppRoutesError)?;
126123

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

168165
while let Some(app_server_to_app) = conn_pair.receiver.next().await {
169166
if let AppServerToApp::ReportMutations(report_mutations) = app_server_to_app {
@@ -196,7 +193,7 @@ async fn request_close_payment_nowait(
196193
.sender
197194
.send(app_to_app_server)
198195
.await
199-
.map_err(|_| BuyerError::RequestClosePaymentError);
196+
.map_err(|_| BuyerError::RequestClosePaymentError)?;
200197

201198
while let Some(app_server_to_app) = conn_pair.receiver.next().await {
202199
if let AppServerToApp::ReportMutations(report_mutations) = app_server_to_app {
@@ -229,7 +226,7 @@ async fn request_close_payment(
229226
.sender
230227
.send(app_to_app_server)
231228
.await
232-
.map_err(|_| BuyerError::RequestClosePaymentError);
229+
.map_err(|_| BuyerError::RequestClosePaymentError)?;
233230

234231
while let Some(app_server_to_app) = conn_pair.receiver.next().await {
235232
if let AppServerToApp::ResponseClosePayment(response_close_payment) = app_server_to_app {
@@ -261,7 +258,7 @@ async fn ack_close_payment(
261258
.sender
262259
.send(app_to_app_server)
263260
.await
264-
.map_err(|_| BuyerError::AckClosePaymentError);
261+
.map_err(|_| BuyerError::AckClosePaymentError)?;
265262

266263
while let Some(app_server_to_app) = conn_pair.receiver.next().await {
267264
if let AppServerToApp::ReportMutations(report_mutations) = app_server_to_app {
@@ -377,7 +374,7 @@ async fn buyer_pay_invoice(
377374
.sender
378375
.send(app_to_app_server)
379376
.await
380-
.map_err(|_| BuyerError::CreateTransactionFailed);
377+
.map_err(|_| BuyerError::CreateTransactionFailed)?;
381378
}
382379

383380
// Signal that no new transactions will be created:
@@ -482,7 +479,7 @@ async fn buyer_payment_status(
482479
pub async fn buyer(
483480
buyer_cmd: BuyerCmd,
484481
node_report: &NodeReport,
485-
mut conn_pair: ConnPairApp,
482+
conn_pair: ConnPairApp,
486483
writer: &mut impl io::Write,
487484
) -> Result<(), BuyerError> {
488485
// Get our local public key:

components/stctrl/src/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ async fn config_request(
272272
.sender
273273
.send(app_to_app_server)
274274
.await
275-
.map_err(|_| ConfigError::AppConfigError);
275+
.map_err(|_| ConfigError::AppConfigError)?;
276276

277277
// Wait until we get an ack for our request:
278278
while let Some(app_server_to_app) = conn_pair.receiver.next().await {

components/stctrl/src/file.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use app::common::{
55
RandValue, Receipt, Signature,
66
};
77
use app::report::{MoveTokenHashedReport, TokenInfo};
8-
use app::ser_utils::serialize_to_string;
98

109
use mutual_from::mutual_from;
1110

@@ -93,6 +92,7 @@ mod test {
9392
use std::convert::TryFrom;
9493

9594
use app::report::{BalanceInfo, CountersInfo, CurrencyBalanceInfo, McInfo};
95+
use app::ser_utils::serialize_to_string;
9696

9797
#[test]
9898
fn test_serialize_invoice_file() {

components/stctrl/src/info.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ use derive_more::From;
1010
use app::common::RelayAddress;
1111
use app::report::{
1212
ChannelStatusReport, CurrencyReport, FriendReport, FriendStatusReport, NodeReport,
13-
RequestsStatusReport,
1413
};
1514
use app::ser_utils::public_key_to_string;
1615

17-
use app::conn::ConnPairApp;
18-
use app::file::{FriendAddressFile, FriendFile, RelayAddressFile};
16+
use app::file::{FriendAddressFile, RelayAddressFile};
1917
use app::ser_utils::{serialize_to_string, StringSerdeError};
2018

2119
use crate::file::TokenFile;
@@ -190,6 +188,7 @@ pub async fn info_index(
190188
Ok(())
191189
}
192190

191+
/*
193192
/// Return a string that represents requests status.
194193
/// "+" means open, "-" means closed
195194
fn requests_status_str(requests_status_report: &RequestsStatusReport) -> String {
@@ -200,6 +199,7 @@ fn requests_status_str(requests_status_report: &RequestsStatusReport) -> String
200199
}
201200
.to_owned()
202201
}
202+
*/
203203

204204
/*
205205
/// Check if a friend state is consistent

components/stctrl/src/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
clippy::module_inception,
77
clippy::new_without_default
88
)]
9-
// TODO; Remove this hint:
10-
#![allow(unused)]
9+
10+
// Workaround for issue: https://github.com/rust-lang/rust/issues/64450
11+
extern crate offst_mutual_from as mutual_from;
1112

1213
#[macro_use]
1314
extern crate prettytable;

components/stctrl/src/seller.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ async fn seller_request(
100100
.sender
101101
.send(app_to_app_server)
102102
.await
103-
.map_err(|_| SellerError::SellerRequestError);
103+
.map_err(|_| SellerError::SellerRequestError)?;
104104

105105
// Wait until we get an ack for our request:
106106
while let Some(app_server_to_app) = conn_pair.receiver.next().await {

components/stctrl/src/stctrllib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub struct StCtrlCmd {
6969
}
7070

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

7474
let StCtrlCmd {
7575
idfile,

components/stctrl/src/stverifylib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::fs;
2-
use std::io::{self, Write};
2+
use std::io;
33
use std::path::PathBuf;
44

55
use derive_more::From;
@@ -109,7 +109,7 @@ fn stverify_verify_token(
109109
)
110110
.map_err(|_| StVerifyError::WriteError)?;
111111

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

114114
for currency_balance_info in move_token_hashed_report.token_info.mc.balances {
115115
let balance_info = &currency_balance_info.balance_info;

0 commit comments

Comments
 (0)