Bump to Rust 1.58

feature/libp2p-release
Thomas Eizinger 2 years ago
parent 50ae541412
commit 641274019d
No known key found for this signature in database
GPG Key ID: 651AC83A6C6C8B96

@ -13,7 +13,7 @@ pub const MONEROD_DEFAULT_NETWORK: &str = "monero_network";
/// this doesn't matter.
pub const RPC_PORT: u16 = 18081;
#[derive(Debug)]
#[derive(Default, Debug)]
pub struct Monerod {
args: MonerodArgs,
}
@ -58,15 +58,7 @@ impl Image for Monerod {
}
}
impl Default for Monerod {
fn default() -> Self {
Self {
args: MonerodArgs::default(),
}
}
}
#[derive(Debug)]
#[derive(Default, Debug)]
pub struct MoneroWalletRpc {
args: MoneroWalletRpcArgs,
}
@ -111,14 +103,6 @@ impl Image for MoneroWalletRpc {
}
}
impl Default for MoneroWalletRpc {
fn default() -> Self {
Self {
args: MoneroWalletRpcArgs::default(),
}
}
}
impl MoneroWalletRpc {
pub fn new(name: &str, daemon_address: String) -> Self {
Self {

@ -71,7 +71,7 @@ impl<'c> Monero {
let miner = "miner";
tracing::info!("Starting miner wallet: {}", miner);
let (miner_wallet, miner_container) =
MoneroWalletRpc::new(cli, &miner, &monerod, prefix.clone()).await?;
MoneroWalletRpc::new(cli, miner, &monerod, prefix.clone()).await?;
wallets.push(miner_wallet);
containers.push(miner_container);
@ -83,7 +83,7 @@ impl<'c> Monero {
// trying for 5 minutes
let (wallet, container) = tokio::time::timeout(Duration::from_secs(300), async {
loop {
let result = MoneroWalletRpc::new(cli, &wallet, &monerod, prefix.clone()).await;
let result = MoneroWalletRpc::new(cli, wallet, &monerod, prefix.clone()).await;
match result {
Ok(tuple) => { return tuple; }
@ -188,7 +188,6 @@ fn random_prefix() -> String {
#[derive(Clone, Debug)]
pub struct Monerod {
rpc_port: u16,
name: String,
network: String,
client: monerod::Client,
@ -196,9 +195,7 @@ pub struct Monerod {
#[derive(Clone, Debug)]
pub struct MoneroWalletRpc {
rpc_port: u16,
name: String,
network: String,
client: wallet::Client,
}
@ -220,7 +217,6 @@ impl<'c> Monerod {
Ok((
Self {
rpc_port: monerod_rpc_port,
name,
network,
client: monerod::Client::localhost(monerod_rpc_port)?,
@ -252,7 +248,7 @@ impl<'c> MoneroWalletRpc {
prefix: String,
) -> Result<(Self, Container<'c, Cli, image::MoneroWalletRpc>)> {
let daemon_address = format!("{}:{}", monerod.name, RPC_PORT);
let image = image::MoneroWalletRpc::new(&name, daemon_address);
let image = image::MoneroWalletRpc::new(name, daemon_address);
let network = monerod.network.clone();
let run_args = RunArgs::default()
@ -272,9 +268,7 @@ impl<'c> MoneroWalletRpc {
Ok((
Self {
rpc_port: wallet_rpc_port,
name: name.to_string(),
network,
client,
},
container,

@ -184,12 +184,7 @@ pub struct Refreshed {
#[derive(Debug, Clone, Deserialize)]
pub struct SweepAll {
amount_list: Vec<u64>,
fee_list: Vec<u64>,
multisig_txset: String,
pub tx_hash_list: Vec<String>,
unsigned_txset: String,
weight_list: Vec<u32>,
}
#[derive(Debug, Copy, Clone, Deserialize)]
@ -244,7 +239,7 @@ mod tests {
}
}"#;
let _: Response<SweepAll> = serde_json::from_str(&response).unwrap();
let _: Response<SweepAll> = serde_json::from_str(response).unwrap();
}
#[test]
@ -256,6 +251,6 @@ mod tests {
}
}"#;
let _: Response<WalletCreated> = serde_json::from_str(&response).unwrap();
let _: Response<WalletCreated> = serde_json::from_str(response).unwrap();
}
}

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

@ -95,7 +95,7 @@ async fn main() -> Result<()> {
tracing::debug!(peer_id = %swarm.local_peer_id(), "Network layer initialized");
let (event_loop, mut event_loop_handle) =
EventLoop::new(swap_id, swarm, seller_peer_id, env_config)?;
EventLoop::new(swap_id, swarm, seller_peer_id)?;
let event_loop = tokio::spawn(event_loop.run());
let max_givable = || bitcoin_wallet.max_giveable(TxLock::script_size());
@ -268,7 +268,7 @@ async fn main() -> Result<()> {
}
let (event_loop, event_loop_handle) =
EventLoop::new(swap_id, swarm, seller_peer_id, env_config)?;
EventLoop::new(swap_id, swarm, seller_peer_id)?;
let handle = tokio::spawn(event_loop.run());
let monero_receive_address = db.get_monero_address(swap_id).await?;

@ -171,7 +171,7 @@ pub fn verify_sig(
) -> Result<()> {
let ecdsa = ECDSA::verify_only();
if ecdsa.verify(&verification_key.0, &transaction_sighash.into_inner(), &sig) {
if ecdsa.verify(&verification_key.0, &transaction_sighash.into_inner(), sig) {
Ok(())
} else {
bail!(InvalidSignature)
@ -194,7 +194,7 @@ pub fn verify_encsig(
&verification_key.0,
&encryption_key.0,
&digest.into_inner(),
&encsig,
encsig,
) {
Ok(())
} else {

@ -262,7 +262,7 @@ mod tests {
amount: Amount,
) -> PartiallySignedTransaction {
let change = wallet.new_address().await.unwrap();
TxLock::new(&wallet, amount, A, B, change)
TxLock::new(wallet, amount, A, B, change)
.await
.unwrap()
.into()

@ -128,7 +128,7 @@ impl TxRedeem {
let sig = sigs
.into_iter()
.find(|sig| verify_sig(&B, &self.digest(), &sig).is_ok())
.find(|sig| verify_sig(&B, &self.digest(), sig).is_ok())
.context("Neither signature on witness stack verifies against B")?;
Ok(sig)

@ -132,7 +132,7 @@ impl TxRefund {
let sig = sigs
.into_iter()
.find(|sig| verify_sig(&B, &self.digest(), &sig).is_ok())
.find(|sig| verify_sig(&B, &self.digest(), sig).is_ok())
.context("Neither signature on witness stack verifies against B")?;
Ok(sig)

@ -38,6 +38,7 @@ pub struct Arguments {
}
/// Represents the result of parsing the command-line parameters.
#[allow(clippy::large_enum_variant)]
#[derive(Debug, PartialEq)]
pub enum ParseResult {
/// The arguments we were invoked in.

@ -4,7 +4,7 @@ use crate::network::encrypted_signature;
use crate::network::quote::BidQuote;
use crate::network::swap_setup::bob::NewSwap;
use crate::protocol::bob::State2;
use crate::{env, monero};
use crate::{monero};
use anyhow::{Context, Result};
use futures::future::{BoxFuture, OptionFuture};
use futures::{FutureExt, StreamExt};
@ -50,7 +50,6 @@ impl EventLoop {
swap_id: Uuid,
swarm: Swarm<Behaviour>,
alice_peer_id: PeerId,
env_config: env::Config,
) -> Result<(Self, EventLoopHandle)> {
let execution_setup = bmrng::channel_with_timeout(1, Duration::from_secs(60));
let transfer_proof = bmrng::channel_with_timeout(1, Duration::from_secs(60));
@ -75,8 +74,7 @@ impl EventLoop {
swap_setup: execution_setup.0,
transfer_proof: transfer_proof.1,
encrypted_signature: encrypted_signature.0,
quote: quote.0,
env_config,
quote: quote.0
};
Ok((event_loop, handle))
@ -220,7 +218,6 @@ pub struct EventLoopHandle {
transfer_proof: bmrng::RequestReceiver<monero::TransferProof, ()>,
encrypted_signature: bmrng::RequestSender<EncryptedSignature, ()>,
quote: bmrng::RequestSender<(), BidQuote>,
env_config: env::Config,
}
impl EventLoopHandle {

@ -271,7 +271,7 @@ impl EventLoop {
QuoteStatus::Received(Status::Online(quote)) => {
let address = self
.reachable_asb_address
.get(&peer_id)
.get(peer_id)
.expect("if we got a quote we must have stored an address");
Ok(Seller {
@ -282,7 +282,7 @@ impl EventLoop {
QuoteStatus::Received(Status::Unreachable) => {
let address = self
.unreachable_asb_address
.get(&peer_id)
.get(peer_id)
.expect("if we got a quote we must have stored an address");
Ok(Seller {

@ -138,7 +138,7 @@ mod monero_network {
Network::Stagenet => "stagenet",
Network::Testnet => "testnet",
};
s.serialize_str(&str)
s.serialize_str(str)
}
}

@ -274,9 +274,7 @@ mod wire {
#[derive(Debug, Deserialize)]
pub struct TickerData {
#[serde(rename = "a")]
ask: Vec<RateElement>,
#[serde(rename = "b")]
bid: Vec<RateElement>,
ask: Vec<RateElement>
}
#[derive(Debug, Deserialize)]

@ -6,7 +6,7 @@ pub mod ecdsa_fun {
use ::ecdsa_fun::fun::{Point, Scalar, G};
pub fn point() -> impl Strategy<Value = Point> {
scalar().prop_map(|mut scalar| Point::from_scalar_mul(&G, &mut scalar).mark::<Normal>())
scalar().prop_map(|mut scalar| Point::from_scalar_mul(G, &mut scalar).mark::<Normal>())
}
pub fn scalar() -> impl Strategy<Value = Scalar> {

@ -29,7 +29,7 @@ impl Image for Bitcoind {
container
.logs()
.stdout
.wait_for_message(&"init message: Done loading")
.wait_for_message("init message: Done loading")
.unwrap();
}

@ -14,7 +14,6 @@ pub struct Electrs {
entrypoint: Option<String>,
wait_for_message: String,
volume: String,
bitcoind_container_name: String,
}
impl Image for Electrs {
@ -73,7 +72,6 @@ impl Default for Electrs {
entrypoint: Some("/build/electrs".into()),
wait_for_message: "Running accept thread".to_string(),
volume: uuid::Uuid::new_v4().to_string(),
bitcoind_container_name: uuid::Uuid::new_v4().to_string(),
}
}
}

@ -146,14 +146,14 @@ async fn init_containers(cli: &Cli) -> (Monero, Containers<'_>) {
let prefix = random_prefix();
let bitcoind_name = format!("{}_{}", prefix, "bitcoind");
let (bitcoind, bitcoind_url) =
init_bitcoind_container(&cli, prefix.clone(), bitcoind_name.clone(), prefix.clone())
init_bitcoind_container(cli, prefix.clone(), bitcoind_name.clone(), prefix.clone())
.await
.expect("could not init bitcoind");
let electrs = init_electrs_container(&cli, prefix.clone(), bitcoind_name, prefix)
let electrs = init_electrs_container(cli, prefix.clone(), bitcoind_name, prefix)
.await
.expect("could not init electrs");
let (monero, monerod_container, monero_wallet_rpc_containers) =
Monero::new(&cli, vec![MONERO_WALLET_NAME_ALICE, MONERO_WALLET_NAME_BOB])
Monero::new(cli, vec![MONERO_WALLET_NAME_ALICE, MONERO_WALLET_NAME_BOB])
.await
.unwrap();
@ -237,7 +237,7 @@ async fn start_alice(
let resume_only = false;
let mut swarm = swarm::asb(
&seed,
seed,
min_buy,
max_buy,
latest_rate,
@ -485,7 +485,7 @@ impl BobParams {
.behaviour_mut()
.add_address(self.alice_peer_id, self.alice_address.clone());
cli::EventLoop::new(swap_id, swarm, self.alice_peer_id, self.env_config)
cli::EventLoop::new(swap_id, swarm, self.alice_peer_id)
}
}

Loading…
Cancel
Save