Skip to content

Commit

Permalink
ci: update msrv and github actions toolchains
Browse files Browse the repository at this point in the history
  • Loading branch information
delta1 committed Jan 10, 2023
1 parent ab5d4a1 commit 43088e5
Show file tree
Hide file tree
Showing 25 changed files with 57 additions and 50 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build-release-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ jobs:

- uses: Swatinem/rust-cache@v2.2.0

- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.63
targets: armv7-unknown-linux-gnueabihf

- name: Build ${{ matrix.target }} ${{ matrix.bin }} release binary
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ jobs:

- uses: Swatinem/rust-cache@v2.2.0

- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.63
targets: armv7-unknown-linux-gnueabihf

- name: Build binary
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Minimum Supported Rust Version (MSRV) bumped to 1.63

## [0.12.1] - 2023-01-09

### Changed
Expand Down Expand Up @@ -338,7 +342,7 @@ It is possible to migrate critical data from the old db to the sqlite but there
- Fixed an issue where Alice would not verify if Bob's Bitcoin lock transaction is semantically correct, i.e. pays the agreed upon amount to an output owned by both of them.
Fixing this required a **breaking change** on the network layer and hence old versions are not compatible with this version.

[Unreleased]: https://github.com/comit-network/xmr-btc-swap/compare/0.12.1...HEAD
[unreleased]: https://github.com/comit-network/xmr-btc-swap/compare/0.12.1...HEAD
[0.12.1]: https://github.com/comit-network/xmr-btc-swap/compare/0.12.0...0.12.1
[0.12.0]: https://github.com/comit-network/xmr-btc-swap/compare/0.11.0...0.12.0
[0.11.0]: https://github.com/comit-network/xmr-btc-swap/compare/0.10.2...0.11.0
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Please have a look at the [contribution guidelines](./CONTRIBUTING.md).
## Rust Version Support

Please note that only the latest stable Rust toolchain is supported.
All stable toolchains since 1.62 _should_ work.
All stable toolchains since 1.63 _should_ work.

## Contact

Expand Down
13 changes: 7 additions & 6 deletions monero-rpc/src/monerod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ impl Client {
}

pub async fn get_o_indexes(&self, txid: Hash) -> Result<GetOIndexesResponse> {
self.binary_request(self.get_o_indexes_bin_url.clone(), GetOIndexesPayload {
txid,
})
self.binary_request(
self.get_o_indexes_bin_url.clone(),
GetOIndexesPayload { txid },
)
.await
}

Expand Down Expand Up @@ -157,23 +158,23 @@ pub struct OutKey {
pub unlocked: bool,
}

#[derive(Clone, Debug, Deserialize, PartialEq)]
#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
pub struct BaseResponse {
pub credits: u64,
pub status: Status,
pub top_hash: String,
pub untrusted: bool,
}

#[derive(Clone, Debug, Deserialize, PartialEq)]
#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
pub struct GetOIndexesResponse {
#[serde(flatten)]
pub base: BaseResponse,
#[serde(default)]
pub o_indexes: Vec<u64>,
}

#[derive(Clone, Copy, Debug, Deserialize, PartialEq)]
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq)]
pub enum Status {
#[serde(rename = "OK")]
Ok,
Expand Down
2 changes: 1 addition & 1 deletion monero-rpc/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ pub struct Transfer {
pub unsigned_txset: String,
}

#[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq)]
#[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq, Eq)]
pub struct BlockHeight {
pub height: u32,
}
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "1.62"
channel = "1.63" # also update this in the readme, changelog, and github actions
components = ["clippy"]
targets = ["armv7-unknown-linux-gnueabihf"]
6 changes: 3 additions & 3 deletions swap/src/asb/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ fn env_config(is_testnet: bool) -> env::Config {
}
}

#[derive(thiserror::Error, Debug, Clone, Copy, PartialEq, Serialize)]
#[derive(thiserror::Error, Debug, Clone, Copy, PartialEq, Eq, Serialize)]
#[error("Invalid Bitcoin address provided, expected address on network {expected:?} but address provided is on {actual:?}")]
pub struct BitcoinAddressNetworkMismatch {
#[serde(with = "crate::bitcoin::network")]
Expand All @@ -180,7 +180,7 @@ pub struct BitcoinAddressNetworkMismatch {
actual: bitcoin::Network,
}

#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub struct Arguments {
pub testnet: bool,
pub json: bool,
Expand All @@ -190,7 +190,7 @@ pub struct Arguments {
pub cmd: Command,
}

#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub enum Command {
Start {
resume_only: bool,
Expand Down
14 changes: 7 additions & 7 deletions swap/src/asb/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const DEFAULT_MIN_BUY_AMOUNT: f64 = 0.002f64;
const DEFAULT_MAX_BUY_AMOUNT: f64 = 0.02f64;
const DEFAULT_SPREAD: f64 = 0.02f64;

#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, PartialEq)]
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq)]
#[serde(deny_unknown_fields)]
pub struct Config {
pub data: Data,
Expand Down Expand Up @@ -123,13 +123,13 @@ impl TryFrom<config::Config> for Config {
}
}

#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct Data {
pub dir: PathBuf,
}

#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct Network {
#[serde(deserialize_with = "addr_list::deserialize")]
Expand Down Expand Up @@ -181,7 +181,7 @@ mod addr_list {
}
}

#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct Bitcoin {
pub electrum_rpc_url: Url,
Expand All @@ -191,7 +191,7 @@ pub struct Bitcoin {
pub network: bitcoin::Network,
}

#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct Monero {
pub wallet_rpc_url: Url,
Expand All @@ -200,14 +200,14 @@ pub struct Monero {
pub network: monero::Network,
}

#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct TorConf {
pub control_port: u16,
pub socks5_port: u16,
}

#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct Maker {
#[serde(with = "::bitcoin::util::amount::serde::as_btc")]
Expand Down
2 changes: 1 addition & 1 deletion swap/src/asb/rate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use rust_decimal::Decimal;
use std::fmt::{Debug, Display, Formatter};

/// Represents the rate at which we are willing to trade 1 XMR.
#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Rate {
/// Represents the asking price from the market.
ask: bitcoin::Amount,
Expand Down
2 changes: 1 addition & 1 deletion swap/src/bitcoin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl SecretKey {
}
}

#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq)]
#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct PublicKey(Point);

impl PublicKey {
Expand Down
2 changes: 1 addition & 1 deletion swap/src/bitcoin/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize};
const SCRIPT_SIZE: usize = 34;
const TX_LOCK_WEIGHT: usize = 485;

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct TxLock {
inner: PartiallySignedTransaction,
pub(in crate::bitcoin) output_descriptor: Descriptor<::bitcoin::PublicKey>,
Expand Down
2 changes: 1 addition & 1 deletion swap/src/bitcoin/timelocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl Add<u32> for BlockHeight {
}
}

#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ExpiredTimelocks {
None,
Cancel,
Expand Down
4 changes: 2 additions & 2 deletions swap/src/bitcoin/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ impl EstimateFeeRate for Client {
}
}

#[derive(Debug, Copy, Clone, PartialEq)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum ScriptStatus {
Unseen,
InMempool,
Expand All @@ -893,7 +893,7 @@ impl ScriptStatus {
}
}

#[derive(Debug, Copy, Clone, PartialEq)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct Confirmed {
/// The depth of this transaction within the blockchain.
///
Expand Down
10 changes: 5 additions & 5 deletions swap/src/cli/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const DEFAULT_BITCOIN_CONFIRMATION_TARGET_TESTNET: usize = 1;

const DEFAULT_TOR_SOCKS5_PORT: &str = "9050";

#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub struct Arguments {
pub env_config: env::Config,
pub debug: bool,
Expand All @@ -38,7 +38,7 @@ pub struct Arguments {
}

/// Represents the result of parsing the command-line parameters.
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub enum ParseResult {
/// The arguments we were invoked in.
Arguments(Box<Arguments>),
Expand Down Expand Up @@ -246,7 +246,7 @@ where
Ok(ParseResult::Arguments(Box::new(arguments)))
}

#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub enum Command {
BuyXmr {
seller: Multiaddr,
Expand Down Expand Up @@ -610,14 +610,14 @@ fn parse_monero_address(s: &str) -> Result<monero::Address> {
})
}

#[derive(thiserror::Error, Debug, Clone, Copy, PartialEq)]
#[derive(thiserror::Error, Debug, Clone, Copy, PartialEq, Eq)]
#[error("Invalid monero address provided, expected address on network {expected:?} but address provided is on {actual:?}")]
pub struct MoneroAddressNetworkMismatch {
expected: monero::Network,
actual: monero::Network,
}

#[derive(thiserror::Error, Debug, Clone, Copy, PartialEq, Serialize)]
#[derive(thiserror::Error, Debug, Clone, Copy, PartialEq, Eq, Serialize)]
#[error("Invalid Bitcoin address provided, expected address on network {expected:?} but address provided is on {actual:?}")]
pub struct BitcoinAddressNetworkMismatch {
#[serde(with = "crate::bitcoin::network")]
Expand Down
2 changes: 1 addition & 1 deletion swap/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use anyhow::anyhow;

const LATEST_RELEASE_URL: &str = "https://github.com/comit-network/xmr-btc-swap/releases/latest";

#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum Version {
Current,
Available,
Expand Down
2 changes: 1 addition & 1 deletion swap/src/database/alice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub enum Alice {
Done(AliceEndState),
}

#[derive(Copy, Clone, strum::Display, Debug, Deserialize, Serialize, PartialEq)]
#[derive(Copy, Clone, strum::Display, Debug, Deserialize, Serialize, PartialEq, Eq)]
pub enum AliceEndState {
SafelyAborted,
BtcRedeemed,
Expand Down
2 changes: 1 addition & 1 deletion swap/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::cmp::max;
use std::time::Duration;
use time::ext::NumericalStdDuration;

#[derive(Debug, Copy, Clone, PartialEq, Serialize)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize)]
pub struct Config {
pub bitcoin_lock_mempool_timeout: Duration,
pub bitcoin_lock_confirmed_timeout: Duration,
Expand Down
2 changes: 1 addition & 1 deletion swap/src/kraken.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ mod wire {
use bitcoin::util::amount::ParseAmountError;
use serde_json::Value;

#[derive(Debug, Deserialize, PartialEq)]
#[derive(Debug, Deserialize, PartialEq, Eq)]
#[serde(tag = "event")]
pub enum Event {
#[serde(rename = "systemStatus")]
Expand Down
14 changes: 7 additions & 7 deletions swap/src/monero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub fn private_key_from_secp256k1_scalar(scalar: bitcoin::Scalar) -> PrivateKey
PrivateKey::from_scalar(Scalar::from_bytes_mod_order(bytes))
}

#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq)]
#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq, Eq)]
pub struct PrivateViewKey(#[serde(with = "monero_private_key")] PrivateKey);

impl PrivateViewKey {
Expand Down Expand Up @@ -78,7 +78,7 @@ impl From<PublicViewKey> for PublicKey {
#[derive(Clone, Copy, Debug)]
pub struct PublicViewKey(PublicKey);

#[derive(Debug, Copy, Clone, Deserialize, Serialize, PartialEq, PartialOrd)]
#[derive(Debug, Copy, Clone, Deserialize, Serialize, PartialEq, Eq, PartialOrd)]
pub struct Amount(u64);

// Median tx fees on Monero as found here: https://www.monero.how/monero-transaction-fees, XMR 0.000_008 * 2 (to be on the safe side)
Expand Down Expand Up @@ -185,7 +185,7 @@ impl fmt::Display for Amount {
}
}

#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
pub struct TransferProof {
tx_hash: TxHash,
#[serde(with = "monero_private_key")]
Expand All @@ -205,7 +205,7 @@ impl TransferProof {
}

// TODO: add constructor/ change String to fixed length byte array
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
pub struct TxHash(pub String);

impl From<TxHash> for String {
Expand All @@ -227,7 +227,7 @@ pub struct InsufficientFunds {
pub actual: Amount,
}

#[derive(thiserror::Error, Debug, Clone, PartialEq)]
#[derive(thiserror::Error, Debug, Clone, PartialEq, Eq)]
#[error("Overflow, cannot convert {0} to u64")]
pub struct OverflowError(pub String);

Expand Down Expand Up @@ -470,10 +470,10 @@ mod tests {
use rand::rngs::OsRng;
use serde::{Deserialize, Serialize};

#[derive(Debug, Serialize, Deserialize, PartialEq)]
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
pub struct MoneroPrivateKey(#[serde(with = "monero_private_key")] crate::monero::PrivateKey);

#[derive(Debug, Serialize, Deserialize, PartialEq)]
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
pub struct MoneroAmount(#[serde(with = "monero_amount")] crate::monero::Amount);

#[test]
Expand Down
2 changes: 1 addition & 1 deletion swap/src/network/rendezvous.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use libp2p::rendezvous::Namespace;
use std::fmt;

#[derive(Debug, PartialEq, Clone, Copy)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum XmrBtcNamespace {
Mainnet,
Testnet,
Expand Down
Loading

0 comments on commit 43088e5

Please sign in to comment.