Merge branch 'master' into bugfix/asb-sync-startup

This commit is contained in:
Byron Hambly 2023-12-16 16:50:21 +02:00 committed by GitHub
commit 8280389495
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 521 additions and 379 deletions

View File

@ -45,16 +45,16 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout tagged commit
uses: actions/checkout@v4.0.0
uses: actions/checkout@v4.1.1
with:
ref: ${{ github.event.release.target_commitish }}
token: ${{ secrets.BOTTY_GITHUB_TOKEN }}
- uses: Swatinem/rust-cache@v2.6.2
- uses: Swatinem/rust-cache@v2.7.1
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.67
toolchain: "1.70"
targets: armv7-unknown-linux-gnueabihf
- name: Build ${{ matrix.target }} ${{ matrix.bin }} release binary
@ -69,7 +69,7 @@ jobs:
run: target/${{ matrix.target }}/release/${{ matrix.bin }} --help
# Remove once python 3 is the default
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"

View File

@ -4,8 +4,6 @@ on:
pull_request: # Need to run on pull-requests, otherwise PRs from forks don't run
push:
branches:
- "staging" # Bors uses this branch
- "trying" # Bors uses this branch
- "master" # Always build head of master for the badge in the README
jobs:
@ -13,14 +11,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4.0.0
uses: actions/checkout@v4.1.1
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.67
toolchain: "1.70"
components: clippy,rustfmt
- uses: Swatinem/rust-cache@v2.6.2
- uses: Swatinem/rust-cache@v2.7.1
- name: Check formatting
uses: dprint/check@v2.2
@ -37,9 +35,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4.0.0
uses: actions/checkout@v4.1.1
- uses: Swatinem/rust-cache@v2.6.2
- uses: Swatinem/rust-cache@v2.7.1
- name: Build swap
run: cargo build --bin swap
@ -51,9 +49,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4.0.0
uses: actions/checkout@v4.1.1
- uses: Swatinem/rust-cache@v2.6.2
- uses: Swatinem/rust-cache@v2.7.1
- name: Install sqlx-cli
run: cargo install sqlx-cli --locked
@ -78,13 +76,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4.0.0
uses: actions/checkout@v4.1.1
- uses: Swatinem/rust-cache@v2.6.2
- uses: Swatinem/rust-cache@v2.7.1
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.67
toolchain: "1.70"
targets: armv7-unknown-linux-gnueabihf
- name: Build binary
@ -100,13 +98,13 @@ jobs:
run: cross build -p swap --target ${{ matrix.target }}
- name: Upload swap binary
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: swap-${{ matrix.target }}
path: target/${{ matrix.target }}/debug/swap
- name: Upload asb binary
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: asb-${{ matrix.target }}
path: target/${{ matrix.target }}/debug/asb
@ -118,9 +116,9 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4.0.0
uses: actions/checkout@v4.1.1
- uses: Swatinem/rust-cache@v2.6.2
- uses: Swatinem/rust-cache@v2.7.1
- name: Build tests
run: cargo build --tests --workspace --all-features
@ -155,9 +153,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4.0.0
uses: actions/checkout@v4.1.1
- uses: Swatinem/rust-cache@v2.6.2
- uses: Swatinem/rust-cache@v2.7.1
- name: Run test ${{ matrix.test_name }}
run: cargo test --package swap --all-features --test ${{ matrix.test_name }} -- --nocapture

View File

@ -11,7 +11,7 @@ jobs:
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.0.0
- uses: actions/checkout@v4.1.1
- name: Extract version from branch name
id: extract-version

View File

@ -12,7 +12,7 @@ jobs:
name: "Draft a new release"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.0.0
- uses: actions/checkout@v4.1.1
with:
token: ${{ secrets.BOTTY_GITHUB_TOKEN }}
@ -43,7 +43,7 @@ jobs:
id: make-commit
env:
DPRINT_VERSION: 0.39.1
RUST_TOOLCHAIN: 1.67
RUST_TOOLCHAIN: 1.70
run: |
rustup component add rustfmt --toolchain "$RUST_TOOLCHAIN-x86_64-unknown-linux-gnu"
curl -fsSL https://dprint.dev/install.sh | sh -s $DPRINT_VERSION

View File

@ -10,7 +10,7 @@ jobs:
name: Create preview release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.0.0
- uses: actions/checkout@v4.1.1
- name: Delete 'preview' release
uses: larryjoelane/delete-release-action@v1.0.24

View File

@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
- Minimum Supported Rust Version (MSRV) bumped to 1.70
## [0.12.3] - 2023-09-20
- Swap: If no Monero daemon is manually specified, we will automatically choose one from a list of public daemons by connecting to each and checking their availability.

776
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -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.67 _should_ work.
All stable toolchains since 1.70 _should_ work.
## Contact

View File

@ -1,25 +0,0 @@
status = [
"static_analysis",
"bdk_test",
"sqlx_test",
"build (x86_64-unknown-linux-gnu, ubuntu-latest)",
"build (armv7-unknown-linux-gnueabihf, ubuntu-latest)",
"build (x86_64-apple-darwin, macos-latest)",
"build (x86_64-pc-windows-msvc, windows-latest)",
"test (ubuntu-latest)",
"test (macos-latest)",
"docker_tests (happy_path)",
"docker_tests (happy_path_restart_bob_after_xmr_locked)",
"docker_tests (happy_path_restart_alice_after_xmr_locked)",
"docker_tests (happy_path_restart_bob_before_xmr_locked)",
"docker_tests (alice_and_bob_refund_using_cancel_and_refund_command)",
"docker_tests (alice_and_bob_refund_using_cancel_then_refund_command)",
"docker_tests (alice_and_bob_refund_using_cancel_and_refund_command_timelock_not_expired)",
"docker_tests (punish)",
"docker_tests (alice_punishes_after_restart_bob_dead)",
"docker_tests (alice_manually_punishes_after_bob_dead)",
"docker_tests (alice_refunds_after_restart_bob_refunded)",
"docker_tests (ensure_same_swap_id)",
"docker_tests (concurrent_bobs_before_xmr_lock_proof_sent)",
"docker_tests (alice_manually_redeems_after_enc_sig_learned)"
]

View File

@ -1,4 +1,4 @@
[toolchain]
channel = "1.67" # also update this in the readme, changelog, and github actions
channel = "1.70" # also update this in the readme, changelog, and github actions
components = ["clippy"]
targets = ["armv7-unknown-linux-gnueabihf"]

View File

@ -19,11 +19,11 @@ bdk = "0.28"
big-bytes = "1"
bitcoin = { version = "0.29", features = [ "rand", "serde" ] }
bmrng = "0.5"
comfy-table = "6.1"
comfy-table = "7.1"
config = { version = "0.13", default-features = false, features = [ "toml" ] }
conquer-once = "0.4"
curve25519-dalek = { package = "curve25519-dalek-ng", version = "4" }
data-encoding = "2.4"
data-encoding = "2.5"
dialoguer = "0.10"
directories-next = "2"
ecdsa_fun = { git = "https://github.com/LLFourn/secp256kfun", default-features = false, features = [ "libsecp_compat", "serde", "adaptor" ] }
@ -34,9 +34,9 @@ itertools = "0.10"
libp2p = { version = "0.42.2", default-features = false, features = [ "tcp-tokio", "yamux", "mplex", "dns-tokio", "noise", "request-response", "websocket", "ping", "rendezvous", "identify" ] }
monero = { version = "0.12", features = [ "serde_support" ] }
monero-rpc = { path = "../monero-rpc" }
pem = "1.1"
pem = "3.0"
proptest = "1"
qrcode = "0.12"
qrcode = "0.13"
rand = "0.8"
rand_chacha = "0.3"
reqwest = { version = "0.11", features = [ "rustls-tls", "stream", "socks" ], default-features = false }
@ -50,21 +50,21 @@ sha2 = "0.10"
sigma_fun = { git = "https://github.com/LLFourn/secp256kfun", default-features = false, features = [ "ed25519", "serde", "secp256k1", "alloc" ] }
sqlx = { version = "0.6", features = [ "sqlite", "runtime-tokio-rustls", "offline" ] }
structopt = "0.3"
strum = { version = "0.24", features = [ "derive" ] }
strum = { version = "0.25", features = [ "derive" ] }
thiserror = "1"
time = "0.3"
tokio = { version = "1", features = [ "rt-multi-thread", "time", "macros", "sync", "process", "fs", "net" ] }
tokio-socks = "0.5"
tokio-tungstenite = { version = "0.15", features = [ "rustls-tls" ] }
tokio-util = { version = "0.7", features = [ "io", "codec" ] }
toml = "0.5"
toml = "0.7"
torut = { version = "0.2", default-features = false, features = [ "v3", "control" ] }
tracing = { version = "0.1", features = [ "attributes" ] }
tracing-appender = "0.2"
tracing-futures = { version = "0.2", features = [ "std-future", "futures-03" ] }
tracing-subscriber = { version = "0.3", default-features = false, features = [ "fmt", "ansi", "env-filter", "time", "tracing-log", "json" ] }
url = { version = "2", features = [ "serde" ] }
uuid = { version = "1.4", features = [ "serde", "v4" ] }
uuid = { version = "1.6", features = [ "serde", "v4" ] }
void = "1"
[target.'cfg(not(windows))'.dependencies]
@ -76,8 +76,8 @@ zip = "0.5"
[dev-dependencies]
bitcoin-harness = "0.2.2"
get-port = "3"
hyper = "0.14"
mockito = "1.1.0"
hyper = "1.0"
mockito = "1.2.0"
monero-harness = { path = "../monero-harness" }
port_check = "0.1"
proptest = "1"

View File

@ -46,7 +46,7 @@ pub struct Regtest;
impl GetConfig for Mainnet {
fn get_config() -> Config {
Config {
bitcoin_lock_mempool_timeout: 3.std_minutes(),
bitcoin_lock_mempool_timeout: 10.std_minutes(),
bitcoin_lock_confirmed_timeout: 2.std_hours(),
bitcoin_finality_confirmations: 1,
bitcoin_avg_block_time: 10.std_minutes(),
@ -63,7 +63,7 @@ impl GetConfig for Mainnet {
impl GetConfig for Testnet {
fn get_config() -> Config {
Config {
bitcoin_lock_mempool_timeout: 3.std_minutes(),
bitcoin_lock_mempool_timeout: 10.std_minutes(),
bitcoin_lock_confirmed_timeout: 1.std_hours(),
bitcoin_finality_confirmations: 1,
bitcoin_avg_block_time: 10.std_minutes(),

View File

@ -106,11 +106,12 @@ impl Seed {
}
fn from_pem(pem: pem::Pem) -> Result<Self, Error> {
if pem.contents.len() != SEED_LENGTH {
Err(Error::IncorrectLength(pem.contents.len()))
let contents = pem.contents();
if contents.len() != SEED_LENGTH {
Err(Error::IncorrectLength(contents.len()))
} else {
let mut array = [0; SEED_LENGTH];
for (i, b) in pem.contents.iter().enumerate() {
for (i, b) in contents.iter().enumerate() {
array[i] = *b;
}
@ -122,10 +123,7 @@ impl Seed {
ensure_directory_exists(&seed_file)?;
let data = self.bytes();
let pem = Pem {
tag: String::from("SEED"),
contents: data.to_vec(),
};
let pem = Pem::new("SEED", data);
let pem_string = encode(&pem);
@ -224,19 +222,20 @@ VnZUNFZ4dlY=
}
#[test]
#[should_panic]
fn seed_from_pem_fails_for_long_seed() {
let long = "-----BEGIN SEED-----
mbKANv2qKGmNVg1qtquj6Hx1pFPelpqOfE2JaJJAMEg1FlFhNRNlFlE=
mbKANv2qKGmNVg1qtquj6Hx1pFPelpqOfE2JaJJAMEg1FlFhNRNlFlE=
MIIBPQIBAAJBAOsfi5AGYhdRs/x6q5H7kScxA0Kzzqe6WI6gf6+tc6IvKQJo5rQc
dWWSQ0nRGt2hOPDO+35NKhQEjBQxPh/v7n0CAwEAAQJBAOGaBAyuw0ICyENy5NsO
-----END SEED-----
";
let pem = pem::parse(long).unwrap();
assert_eq!(pem.contents().len(), 96);
match Seed::from_pem(pem) {
Ok(_) => panic!("should fail for long payload"),
Err(e) => {
match e {
Error::IncorrectLength(_) => {} // pass
Error::IncorrectLength(len) => assert_eq!(len, 96), // pass
_ => panic!("should fail with IncorrectLength error"),
}
}