576: Bump to Rust 1.53 r=thomaseizinger a=thomaseizinger



Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
This commit is contained in:
bors[bot] 2021-06-23 03:17:17 +00:00 committed by GitHub
commit 858c6d85ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 72 additions and 108 deletions

View File

@ -1,4 +1,4 @@
[toolchain]
channel = "1.52"
channel = "1.53"
components = ["clippy"]
targets = ["armv7-unknown-linux-gnueabihf"]

View File

@ -55,56 +55,54 @@ where
env_config: env_config(is_testnet),
cmd: Command::Balance,
},
RawCommand::ManualRecovery(manual_recovery) => match manual_recovery {
ManualRecovery::Redeem {
redeem_params: RecoverCommandParams { swap_id, force },
RawCommand::ManualRecovery(ManualRecovery::Redeem {
redeem_params: RecoverCommandParams { swap_id, force },
do_not_await_finality,
}) => Arguments {
testnet: is_testnet,
json: is_json,
config_path: config_path(config, is_testnet)?,
env_config: env_config(is_testnet),
cmd: Command::Redeem {
swap_id,
force,
do_not_await_finality,
} => Arguments {
testnet: is_testnet,
json: is_json,
config_path: config_path(config, is_testnet)?,
env_config: env_config(is_testnet),
cmd: Command::Redeem {
swap_id,
force,
do_not_await_finality,
},
},
ManualRecovery::Cancel {
cancel_params: RecoverCommandParams { swap_id, force },
} => Arguments {
testnet: is_testnet,
json: is_json,
config_path: config_path(config, is_testnet)?,
env_config: env_config(is_testnet),
cmd: Command::Cancel { swap_id, force },
},
ManualRecovery::Refund {
refund_params: RecoverCommandParams { swap_id, force },
} => Arguments {
testnet: is_testnet,
json: is_json,
config_path: config_path(config, is_testnet)?,
env_config: env_config(is_testnet),
cmd: Command::Refund { swap_id, force },
},
ManualRecovery::Punish {
punish_params: RecoverCommandParams { swap_id, force },
} => Arguments {
testnet: is_testnet,
json: is_json,
config_path: config_path(config, is_testnet)?,
env_config: env_config(is_testnet),
cmd: Command::Punish { swap_id, force },
},
ManualRecovery::SafelyAbort { swap_id } => Arguments {
testnet: is_testnet,
json: is_json,
config_path: config_path(config, is_testnet)?,
env_config: env_config(is_testnet),
cmd: Command::SafelyAbort { swap_id },
},
},
RawCommand::ManualRecovery(ManualRecovery::Cancel {
cancel_params: RecoverCommandParams { swap_id, force },
}) => Arguments {
testnet: is_testnet,
json: is_json,
config_path: config_path(config, is_testnet)?,
env_config: env_config(is_testnet),
cmd: Command::Cancel { swap_id, force },
},
RawCommand::ManualRecovery(ManualRecovery::Refund {
refund_params: RecoverCommandParams { swap_id, force },
}) => Arguments {
testnet: is_testnet,
json: is_json,
config_path: config_path(config, is_testnet)?,
env_config: env_config(is_testnet),
cmd: Command::Refund { swap_id, force },
},
RawCommand::ManualRecovery(ManualRecovery::Punish {
punish_params: RecoverCommandParams { swap_id, force },
}) => Arguments {
testnet: is_testnet,
json: is_json,
config_path: config_path(config, is_testnet)?,
env_config: env_config(is_testnet),
cmd: Command::Punish { swap_id, force },
},
RawCommand::ManualRecovery(ManualRecovery::SafelyAbort { swap_id }) => Arguments {
testnet: is_testnet,
json: is_json,
config_path: config_path(config, is_testnet)?,
env_config: env_config(is_testnet),
cmd: Command::SafelyAbort { swap_id },
},
};
Ok(arguments)

View File

@ -343,7 +343,7 @@ async fn determine_btc_to_swap<FB, TB, FMG, TMG, FS, TS>(
bid_quote: impl Future<Output = Result<BidQuote>>,
get_new_address: impl Future<Output = Result<bitcoin::Address>>,
balance: FB,
max_giveable: FMG,
max_giveable_fn: FMG,
sync: FS,
) -> Result<(bitcoin::Amount, bitcoin::Amount)>
where
@ -363,11 +363,9 @@ where
"Received quote: 1 XMR ~ ",
);
let mut current_maximum_giveable = max_giveable().await?;
let mut max_giveable = max_giveable_fn().await?;
let max_giveable = if current_maximum_giveable == bitcoin::Amount::ZERO
|| current_maximum_giveable < bid_quote.min_quantity
{
if max_giveable == bitcoin::Amount::ZERO || max_giveable < bid_quote.min_quantity {
let deposit_address = get_new_address.await?;
let minimum_amount = bid_quote.min_quantity;
let maximum_amount = bid_quote.max_quantity;
@ -378,7 +376,7 @@ where
info!(
%deposit_address,
%current_maximum_giveable,
%max_giveable,
%minimum_amount,
%maximum_amount,
"Please deposit BTC you want to swap to",
@ -387,19 +385,19 @@ where
loop {
sync().await?;
let new_max_givable = max_giveable().await?;
let new_max_givable = max_giveable_fn().await?;
if new_max_givable != current_maximum_giveable {
current_maximum_giveable = new_max_givable;
if new_max_givable != max_giveable {
max_giveable = new_max_givable;
let new_balance = balance().await?;
tracing::info!(
%new_balance,
%current_maximum_giveable,
%max_giveable,
"Received BTC",
);
if current_maximum_giveable >= bid_quote.min_quantity {
if max_giveable >= bid_quote.min_quantity {
break;
} else {
tracing::info!(
@ -412,10 +410,6 @@ where
tokio::time::sleep(Duration::from_secs(1)).await;
}
current_maximum_giveable
} else {
current_maximum_giveable
};
let balance = balance().await?;

View File

@ -55,12 +55,7 @@ where
Ok(matches) => RawArguments::from_clap(&matches),
Err(clap::Error {
message,
kind: clap::ErrorKind::HelpDisplayed,
..
})
| Err(clap::Error {
message,
kind: clap::ErrorKind::VersionDisplayed,
kind: clap::ErrorKind::HelpDisplayed | clap::ErrorKind::VersionDisplayed,
..
}) => return Ok(ParseResult::PrintAndExitZero { message }),
Err(e) => anyhow::bail!(e),

View File

@ -77,14 +77,12 @@ fn fmt_as_address_string(multi: Multiaddr) -> Result<String, TransportError<io::
// Deal with non-onion addresses
Some(Protocol::Ip4(addr)) => format!("{}", addr),
Some(Protocol::Ip6(addr)) => format!("{}", addr),
Some(Protocol::Dns(addr)) => format!("{}", addr),
Some(Protocol::Dns4(addr)) => format!("{}", addr),
Some(Protocol::Dns(addr) | Protocol::Dns4(addr)) => format!("{}", addr),
_ => return Err(TransportError::MultiaddrNotSupported(multi)),
};
let port = match protocols.next() {
Some(Protocol::Tcp(port)) => port,
Some(Protocol::Udp(port)) => port,
Some(Protocol::Tcp(port) | Protocol::Udp(port)) => port,
_ => return Err(TransportError::MultiaddrNotSupported(multi)),
};

View File

@ -3,7 +3,6 @@ use crate::database::Database;
use crate::env::Config;
use crate::network::quote::BidQuote;
use crate::network::transfer_proof;
use crate::protocol::alice::spot_price::Error;
use crate::protocol::alice::{AliceState, Behaviour, OutEvent, State0, State3, Swap};
use crate::{bitcoin, kraken, monero};
use anyhow::{Context, Result};
@ -208,19 +207,7 @@ where
self.swarm.behaviour_mut().execution_setup.run(peer, state0);
}
SwarmEvent::Behaviour(OutEvent::SwapRequestDeclined { peer, error }) => {
match error {
Error::ResumeOnlyMode
| Error::AmountBelowMinimum { .. }
| Error::AmountAboveMaximum { .. }
| Error::BlockchainNetworkMismatch { .. } => {
tracing::warn!(%peer, "Ignoring spot price request because: {}", error);
}
Error::BalanceTooLow { .. }
| Error::LatestRateFetchFailed(_)
| Error::SellQuoteCalculationFailed(_) => {
tracing::error!(%peer, "Ignoring spot price request because: {}", error);
}
}
tracing::warn!(%peer, "Ignoring spot price request because: {}", error);
}
SwarmEvent::Behaviour(OutEvent::QuoteRequested { channel, peer }) => {
// TODO: Move the spot-price update into dedicated update stream to decouple it from quote requests
@ -324,15 +311,11 @@ where
SwarmEvent::IncomingConnectionError { send_back_addr: address, error, .. } => {
tracing::warn!(%address, "Failed to set up connection with peer. Error {:#}", error);
}
SwarmEvent::ConnectionClosed { peer_id: peer, num_established, endpoint, cause } if num_established == 0 => {
match cause {
Some(error) => {
tracing::warn!(%peer, address = %endpoint.get_remote_address(), "Lost connection. Error {:#}", error);
},
None => {
tracing::info!(%peer, address = %endpoint.get_remote_address(), "Successfully closed connection");
}
}
SwarmEvent::ConnectionClosed { peer_id: peer, num_established, endpoint, cause: Some(error) } if num_established == 0 => {
tracing::warn!(%peer, address = %endpoint.get_remote_address(), "Lost connection. Error {:#}", error);
}
SwarmEvent::ConnectionClosed { peer_id: peer, num_established, endpoint, cause: None } if num_established == 0 => {
tracing::info!(%peer, address = %endpoint.get_remote_address(), "Successfully closed connection");
}
SwarmEvent::NewListenAddr(address) => {
tracing::info!(%address, "New listen address detected");

View File

@ -176,17 +176,13 @@ impl EventLoop {
SwarmEvent::Dialing(peer_id) if peer_id == self.alice_peer_id => {
tracing::debug!("Dialling Alice at {}", peer_id);
}
SwarmEvent::ConnectionClosed { peer_id, endpoint, num_established, cause } if peer_id == self.alice_peer_id && num_established == 0 => {
match cause {
Some(error) => {
tracing::warn!("Lost connection to Alice at {}, cause: {}", endpoint.get_remote_address(), error);
},
None => {
// no error means the disconnection was requested
tracing::info!("Successfully closed connection to Alice");
return;
}
}
SwarmEvent::ConnectionClosed { peer_id, endpoint, num_established, cause: Some(error) } if peer_id == self.alice_peer_id && num_established == 0 => {
tracing::warn!("Lost connection to Alice at {}, cause: {}", endpoint.get_remote_address(), error);
}
SwarmEvent::ConnectionClosed { peer_id, num_established, cause: None, .. } if peer_id == self.alice_peer_id && num_established == 0 => {
// no error means the disconnection was requested
tracing::info!("Successfully closed connection to Alice");
return;
}
SwarmEvent::UnreachableAddr { peer_id, address, attempts_remaining, error } if peer_id == self.alice_peer_id && attempts_remaining == 0 => {
tracing::warn!(%address, "Failed to dial Alice: {}", error);

View File

@ -157,7 +157,7 @@ impl State0 {
let valid = CROSS_CURVE_PROOF_SYSTEM.verify(
&msg.dleq_proof_s_a,
(
msg.S_a_bitcoin.clone().into(),
msg.S_a_bitcoin.into(),
msg.S_a_monero
.point
.decompress()