Merge branch 'master' into monero-wallet-refresh-fix

pull/1487/head
binarybaron 2 months ago committed by GitHub
commit 8eaf437d74
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -45,7 +45,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Checkout tagged commit - name: Checkout tagged commit
uses: actions/checkout@v4.1.1 uses: actions/checkout@v4.1.2
with: with:
ref: ${{ github.event.release.target_commitish }} ref: ${{ github.event.release.target_commitish }}
token: ${{ secrets.BOTTY_GITHUB_TOKEN }} token: ${{ secrets.BOTTY_GITHUB_TOKEN }}

@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout sources - name: Checkout sources
uses: actions/checkout@v4.1.1 uses: actions/checkout@v4.1.2
- uses: dtolnay/rust-toolchain@master - uses: dtolnay/rust-toolchain@master
with: with:
@ -35,7 +35,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout sources - name: Checkout sources
uses: actions/checkout@v4.1.1 uses: actions/checkout@v4.1.2
- uses: Swatinem/rust-cache@v2.7.3 - uses: Swatinem/rust-cache@v2.7.3
@ -49,12 +49,12 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout sources - name: Checkout sources
uses: actions/checkout@v4.1.1 uses: actions/checkout@v4.1.2
- uses: Swatinem/rust-cache@v2.7.3 - uses: Swatinem/rust-cache@v2.7.3
- name: Install sqlx-cli - name: Install sqlx-cli
run: cargo install sqlx-cli --locked run: cargo install --version 0.6.3 sqlx-cli
- name: Run sqlite_dev_setup.sh script - name: Run sqlite_dev_setup.sh script
run: | run: |
@ -76,7 +76,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Checkout sources - name: Checkout sources
uses: actions/checkout@v4.1.1 uses: actions/checkout@v4.1.2
- uses: Swatinem/rust-cache@v2.7.3 - uses: Swatinem/rust-cache@v2.7.3
@ -115,8 +115,21 @@ jobs:
os: [ubuntu-latest, macos-latest] os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: (Free disk space on Ubuntu)
if: matrix.os == 'ubuntu-latest'
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
with:
# removing all of these takes ~10 mins, so just do as needed
android: true
dotnet: true
haskell: true
docker-images: false
large-packages: false
swap-storage: false
tool-cache: false
- name: Checkout sources - name: Checkout sources
uses: actions/checkout@v4.1.1 uses: actions/checkout@v4.1.2
- uses: Swatinem/rust-cache@v2.7.3 - uses: Swatinem/rust-cache@v2.7.3
@ -153,7 +166,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout sources - name: Checkout sources
uses: actions/checkout@v4.1.1 uses: actions/checkout@v4.1.2
- uses: Swatinem/rust-cache@v2.7.3 - uses: Swatinem/rust-cache@v2.7.3

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

@ -12,7 +12,7 @@ jobs:
name: "Draft a new release" name: "Draft a new release"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4.1.1 - uses: actions/checkout@v4.1.2
with: with:
token: ${{ secrets.BOTTY_GITHUB_TOKEN }} token: ${{ secrets.BOTTY_GITHUB_TOKEN }}
@ -20,7 +20,7 @@ jobs:
run: git checkout -b release/${{ github.event.inputs.version }} run: git checkout -b release/${{ github.event.inputs.version }}
- name: Update changelog - name: Update changelog
uses: thomaseizinger/keep-a-changelog-new-release@1.3.0 uses: thomaseizinger/keep-a-changelog-new-release@2.0.0
with: with:
version: ${{ github.event.inputs.version }} version: ${{ github.event.inputs.version }}
changelogPath: CHANGELOG.md changelogPath: CHANGELOG.md

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

222
Cargo.lock generated

@ -98,9 +98,9 @@ dependencies = [
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.79" version = "1.0.81"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247"
[[package]] [[package]]
name = "arrayref" name = "arrayref"
@ -145,9 +145,9 @@ dependencies = [
[[package]] [[package]]
name = "async-trait" name = "async-trait"
version = "0.1.77" version = "0.1.78"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" checksum = "461abc97219de0eaaf81fe3ef974a540158f3d079c2ab200f891f1a2ef201e85"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -264,6 +264,12 @@ version = "0.21.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
[[package]]
name = "base64"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51"
[[package]] [[package]]
name = "bdk" name = "bdk"
version = "0.28.0" version = "0.28.0"
@ -366,7 +372,7 @@ dependencies = [
"reqwest", "reqwest",
"serde", "serde",
"serde_json", "serde_json",
"testcontainers 0.14.0", "testcontainers",
"thiserror", "thiserror",
"tokio", "tokio",
"tracing", "tracing",
@ -664,12 +670,6 @@ dependencies = [
"vec_map", "vec_map",
] ]
[[package]]
name = "color_quant"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
[[package]] [[package]]
name = "colored" name = "colored"
version = "2.0.4" version = "2.0.4"
@ -703,7 +703,7 @@ dependencies = [
"nom", "nom",
"pathdiff", "pathdiff",
"serde", "serde",
"toml 0.8.9", "toml 0.8.12",
] ]
[[package]] [[package]]
@ -896,16 +896,6 @@ dependencies = [
"subtle", "subtle",
] ]
[[package]]
name = "crypto-mac"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4857fd85a0c34b3c3297875b747c1e02e06b6a0ea32dd892d8192b9ce0813ea6"
dependencies = [
"generic-array",
"subtle",
]
[[package]] [[package]]
name = "crypto-mac" name = "crypto-mac"
version = "0.11.1" version = "0.11.1"
@ -1500,7 +1490,7 @@ dependencies = [
"futures-core", "futures-core",
"futures-sink", "futures-sink",
"futures-util", "futures-util",
"http 0.2.3", "http 0.2.11",
"indexmap 1.7.0", "indexmap 1.7.0",
"slab", "slab",
"tokio", "tokio",
@ -1598,16 +1588,6 @@ version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46"
[[package]]
name = "hmac"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15"
dependencies = [
"crypto-mac 0.10.0",
"digest 0.9.0",
]
[[package]] [[package]]
name = "hmac" name = "hmac"
version = "0.11.0" version = "0.11.0"
@ -1640,13 +1620,13 @@ dependencies = [
[[package]] [[package]]
name = "http" name = "http"
version = "0.2.3" version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7245cd7449cc792608c3c8a9eaf69bd4eabbabf802713748fd739c98b82f0747" checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb"
dependencies = [ dependencies = [
"bytes", "bytes",
"fnv", "fnv",
"itoa 0.4.7", "itoa",
] ]
[[package]] [[package]]
@ -1657,7 +1637,7 @@ checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea"
dependencies = [ dependencies = [
"bytes", "bytes",
"fnv", "fnv",
"itoa 1.0.1", "itoa",
] ]
[[package]] [[package]]
@ -1667,7 +1647,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2861bd27ee074e5ee891e8b539837a9430012e249d7f0ca2d795650f579c1994" checksum = "2861bd27ee074e5ee891e8b539837a9430012e249d7f0ca2d795650f579c1994"
dependencies = [ dependencies = [
"bytes", "bytes",
"http 0.2.3", "http 0.2.11",
] ]
[[package]] [[package]]
@ -1694,22 +1674,22 @@ checksum = "05842d0d43232b23ccb7060ecb0f0626922c21f30012e97b767b30afd4a5d4b9"
[[package]] [[package]]
name = "hyper" name = "hyper"
version = "0.14.27" version = "0.14.28"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80"
dependencies = [ dependencies = [
"bytes", "bytes",
"futures-channel", "futures-channel",
"futures-core", "futures-core",
"futures-util", "futures-util",
"h2", "h2",
"http 0.2.3", "http 0.2.11",
"http-body 0.4.0", "http-body 0.4.0",
"httparse", "httparse",
"httpdate", "httpdate",
"itoa 1.0.1", "itoa",
"pin-project-lite 0.2.13", "pin-project-lite 0.2.13",
"socket2 0.4.7", "socket2 0.5.5",
"tokio", "tokio",
"tower-service", "tower-service",
"tracing", "tracing",
@ -1718,14 +1698,13 @@ dependencies = [
[[package]] [[package]]
name = "hyper" name = "hyper"
version = "1.1.0" version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb5aa53871fc917b1a9ed87b683a5d86db645e23acb32c2e0785a353e522fb75" checksum = "186548d73ac615b32a73aafe38fb4f56c0d340e110e5a200bcadbaf2e199263a"
dependencies = [ dependencies = [
"bytes", "bytes",
"http 1.0.0", "http 1.0.0",
"http-body 1.0.0", "http-body 1.0.0",
"pin-project-lite 0.2.13",
"tokio", "tokio",
] ]
@ -1735,8 +1714,8 @@ version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0646026eb1b3eea4cd9ba47912ea5ce9cc07713d105b1a14698f4e6433d348b7" checksum = "0646026eb1b3eea4cd9ba47912ea5ce9cc07713d105b1a14698f4e6433d348b7"
dependencies = [ dependencies = [
"http 0.2.3", "http 0.2.11",
"hyper 0.14.27", "hyper 0.14.28",
"rustls 0.21.10", "rustls 0.21.10",
"tokio", "tokio",
"tokio-rustls 0.24.0", "tokio-rustls 0.24.0",
@ -1781,14 +1760,12 @@ dependencies = [
[[package]] [[package]]
name = "image" name = "image"
version = "0.24.7" version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f3dfdbdd72063086ff443e297b61695500514b1e41095b6fb9a5ab48a70a711" checksum = "a9b4f005360d32e9325029b38ba47ebd7a56f3316df09249368939562d518645"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"byteorder", "byteorder",
"color_quant",
"num-rational 0.4.1",
"num-traits", "num-traits",
] ]
@ -1868,12 +1845,6 @@ dependencies = [
"either", "either",
] ]
[[package]]
name = "itoa"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
[[package]] [[package]]
name = "itoa" name = "itoa"
version = "1.0.1" version = "1.0.1"
@ -1946,9 +1917,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.151" version = "0.2.153"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
[[package]] [[package]]
name = "libgit2-sys" name = "libgit2-sys"
@ -2417,14 +2388,14 @@ dependencies = [
[[package]] [[package]]
name = "mockito" name = "mockito"
version = "1.2.0" version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8d3038e23466858569c2d30a537f691fa0d53b51626630ae08262943e3bbb8b" checksum = "a8c84fe1f1d8c56dc157f79942056fad4b9efceebba374a01b222428b553facb"
dependencies = [ dependencies = [
"assert-json-diff", "assert-json-diff",
"colored", "colored",
"futures", "futures",
"hyper 0.14.27", "hyper 0.14.28",
"log", "log",
"rand 0.8.3", "rand 0.8.3",
"regex", "regex",
@ -2469,7 +2440,7 @@ dependencies = [
"monero-rpc", "monero-rpc",
"rand 0.7.3", "rand 0.7.3",
"spectral", "spectral",
"testcontainers 0.12.0", "testcontainers",
"tokio", "tokio",
"tracing", "tracing",
"tracing-subscriber 0.2.25", "tracing-subscriber 0.2.25",
@ -2505,7 +2476,7 @@ dependencies = [
"monero-harness", "monero-harness",
"monero-rpc", "monero-rpc",
"rand 0.7.3", "rand 0.7.3",
"testcontainers 0.12.0", "testcontainers",
"tokio", "tokio",
"tracing-subscriber 0.2.25", "tracing-subscriber 0.2.25",
] ]
@ -2612,7 +2583,7 @@ dependencies = [
"num-complex", "num-complex",
"num-integer", "num-integer",
"num-iter", "num-iter",
"num-rational 0.1.42", "num-rational",
"num-traits", "num-traits",
] ]
@ -2677,17 +2648,6 @@ dependencies = [
"rustc-serialize", "rustc-serialize",
] ]
[[package]]
name = "num-rational"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0"
dependencies = [
"autocfg",
"num-integer",
"num-traits",
]
[[package]] [[package]]
name = "num-traits" name = "num-traits"
version = "0.2.15" version = "0.2.15"
@ -2745,7 +2705,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f85842b073145726190373213c63f852020fb884c841a3a1f390637267a2fb8c" checksum = "f85842b073145726190373213c63f852020fb884c841a3a1f390637267a2fb8c"
dependencies = [ dependencies = [
"dtoa", "dtoa",
"itoa 1.0.1", "itoa",
"open-metrics-client-derive-text-encode", "open-metrics-client-derive-text-encode",
"owning_ref", "owning_ref",
] ]
@ -3138,9 +3098,9 @@ dependencies = [
[[package]] [[package]]
name = "qrcode" name = "qrcode"
version = "0.13.0" version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "166f136dfdb199f98186f3649cf7a0536534a61417a1a30221b492b4fb60ce3f" checksum = "23e719ca51966ff9f5a8436edb00d6115b3c606a0bb27c8f8ca74a38ff2b036d"
dependencies = [ dependencies = [
"image", "image",
] ]
@ -3316,15 +3276,6 @@ dependencies = [
"bitflags 1.3.2", "bitflags 1.3.2",
] ]
[[package]]
name = "redox_syscall"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
dependencies = [
"bitflags 1.3.2",
]
[[package]] [[package]]
name = "redox_users" name = "redox_users"
version = "0.4.0" version = "0.4.0"
@ -3379,9 +3330,9 @@ dependencies = [
[[package]] [[package]]
name = "reqwest" name = "reqwest"
version = "0.11.24" version = "0.11.27"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251" checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62"
dependencies = [ dependencies = [
"base64 0.21.7", "base64 0.21.7",
"bytes", "bytes",
@ -3389,9 +3340,9 @@ dependencies = [
"futures-core", "futures-core",
"futures-util", "futures-util",
"h2", "h2",
"http 0.2.3", "http 0.2.11",
"http-body 0.4.0", "http-body 0.4.0",
"hyper 0.14.27", "hyper 0.14.28",
"hyper-rustls", "hyper-rustls",
"ipnet", "ipnet",
"js-sys", "js-sys",
@ -3542,9 +3493,9 @@ dependencies = [
[[package]] [[package]]
name = "rustix" name = "rustix"
version = "0.38.28" version = "0.38.31"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949"
dependencies = [ dependencies = [
"bitflags 2.4.0", "bitflags 2.4.0",
"errno", "errno",
@ -3774,9 +3725,9 @@ dependencies = [
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.196" version = "1.0.197"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
@ -3803,9 +3754,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.196" version = "1.0.197"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -3814,11 +3765,11 @@ dependencies = [
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.113" version = "1.0.114"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0"
dependencies = [ dependencies = [
"itoa 1.0.1", "itoa",
"ryu", "ryu",
"serde", "serde",
] ]
@ -3839,7 +3790,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
dependencies = [ dependencies = [
"form_urlencoded", "form_urlencoded",
"itoa 1.0.1", "itoa",
"ryu", "ryu",
"serde", "serde",
] ]
@ -4152,7 +4103,7 @@ dependencies = [
"hashlink", "hashlink",
"hex", "hex",
"indexmap 1.7.0", "indexmap 1.7.0",
"itoa 1.0.1", "itoa",
"libc", "libc",
"libsqlite3-sys", "libsqlite3-sys",
"log", "log",
@ -4273,9 +4224,9 @@ checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125"
[[package]] [[package]]
name = "strum" name = "strum"
version = "0.26.1" version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "723b93e8addf9aa965ebe2d11da6d7540fa2283fcea14b3371ff055f7ba13f5f" checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29"
dependencies = [ dependencies = [
"strum_macros 0.26.1", "strum_macros 0.26.1",
] ]
@ -4327,7 +4278,7 @@ dependencies = [
"async-trait", "async-trait",
"atty", "atty",
"backoff", "backoff",
"base64 0.21.7", "base64 0.22.0",
"bdk", "bdk",
"big-bytes", "big-bytes",
"bitcoin", "bitcoin",
@ -4339,13 +4290,14 @@ dependencies = [
"curve25519-dalek-ng", "curve25519-dalek-ng",
"data-encoding", "data-encoding",
"dialoguer", "dialoguer",
"digest 0.10.7",
"directories-next", "directories-next",
"ecdsa_fun", "ecdsa_fun",
"ed25519-dalek", "ed25519-dalek",
"futures", "futures",
"get-port", "get-port",
"hex", "hex",
"hyper 1.1.0", "hyper 1.2.0",
"itertools 0.12.1", "itertools 0.12.1",
"libp2p", "libp2p",
"mockito", "mockito",
@ -4371,9 +4323,9 @@ dependencies = [
"spectral", "spectral",
"sqlx", "sqlx",
"structopt", "structopt",
"strum 0.26.1", "strum 0.26.2",
"tempfile", "tempfile",
"testcontainers 0.12.0", "testcontainers",
"thiserror", "thiserror",
"time 0.3.34", "time 0.3.34",
"tokio", "tokio",
@ -4381,7 +4333,7 @@ dependencies = [
"tokio-tar", "tokio-tar",
"tokio-tungstenite", "tokio-tungstenite",
"tokio-util", "tokio-util",
"toml 0.8.9", "toml 0.8.12",
"torut", "torut",
"tracing", "tracing",
"tracing-appender", "tracing-appender",
@ -4457,13 +4409,12 @@ dependencies = [
[[package]] [[package]]
name = "tempfile" name = "tempfile"
version = "3.9.0" version = "3.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"fastrand", "fastrand",
"redox_syscall 0.4.1",
"rustix", "rustix",
"windows-sys 0.52.0", "windows-sys 0.52.0",
] ]
@ -4478,21 +4429,6 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "testcontainers"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5e3ed6e3598dbf32cba8cb356b881c085e0adea57597f387723430dd94b4084"
dependencies = [
"hex",
"hmac 0.10.1",
"log",
"rand 0.8.3",
"serde",
"serde_json",
"sha2 0.9.8",
]
[[package]] [[package]]
name = "testcontainers" name = "testcontainers"
version = "0.14.0" version = "0.14.0"
@ -4521,18 +4457,18 @@ dependencies = [
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.56" version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297"
dependencies = [ dependencies = [
"thiserror-impl", "thiserror-impl",
] ]
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "1.0.56" version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -4565,7 +4501,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749"
dependencies = [ dependencies = [
"deranged", "deranged",
"itoa 1.0.1", "itoa",
"libc", "libc",
"num-conv", "num-conv",
"num_threads", "num_threads",
@ -4757,9 +4693,9 @@ dependencies = [
[[package]] [[package]]
name = "toml" name = "toml"
version = "0.8.9" version = "0.8.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6a4b9e8023eb94392d3dca65d717c53abc5dad49c07cb65bb8fcd87115fa325" checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3"
dependencies = [ dependencies = [
"serde", "serde",
"serde_spanned", "serde_spanned",
@ -4778,9 +4714,9 @@ dependencies = [
[[package]] [[package]]
name = "toml_edit" name = "toml_edit"
version = "0.21.1" version = "0.22.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" checksum = "c12219811e0c1ba077867254e5ad62ee2c9c190b0d957110750ac0cda1ae96cd"
dependencies = [ dependencies = [
"indexmap 2.1.0", "indexmap 2.1.0",
"serde", "serde",
@ -5000,7 +4936,7 @@ dependencies = [
"base64 0.13.1", "base64 0.13.1",
"byteorder", "byteorder",
"bytes", "bytes",
"http 0.2.3", "http 0.2.11",
"httparse", "httparse",
"log", "log",
"rand 0.8.3", "rand 0.8.3",
@ -5142,9 +5078,9 @@ checksum = "05e42f7c18b8f902290b009cde6d651262f956c98bc51bca4cd1d511c9cd85c7"
[[package]] [[package]]
name = "uuid" name = "uuid"
version = "1.7.0" version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0"
dependencies = [ dependencies = [
"getrandom 0.2.11", "getrandom 0.2.11",
"serde", "serde",
@ -5572,9 +5508,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
[[package]] [[package]]
name = "winnow" name = "winnow"
version = "0.5.28" version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c830786f7720c2fd27a1a0e27a709dbd3c4d009b56d098fc742d4f4eab91fe2" checksum = "dffa400e67ed5a4dd237983829e66475f0a4a26938c4b04c21baede6262215b8"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]

@ -11,7 +11,7 @@ futures = "0.3"
monero-rpc = { path = "../monero-rpc" } monero-rpc = { path = "../monero-rpc" }
rand = "0.7" rand = "0.7"
spectral = "0.6" spectral = "0.6"
testcontainers = "0.12" testcontainers = "0.14"
tokio = { version = "1", default-features = false, features = [ "rt-multi-thread", "time", "macros" ] } tokio = { version = "1", default-features = false, features = [ "rt-multi-thread", "time", "macros" ] }
tracing = "0.1" tracing = "0.1"
tracing-subscriber = { version = "0.2", default-features = false, features = [ "fmt", "ansi", "env-filter", "tracing-log" ] } tracing-subscriber = { version = "0.2", default-features = false, features = [ "fmt", "ansi", "env-filter", "tracing-log" ] }

@ -1,6 +1,4 @@
use std::collections::HashMap; use testcontainers::{core::WaitFor, Image, ImageArgs};
use testcontainers::core::{Container, Docker, WaitForMessage};
use testcontainers::Image;
pub const MONEROD_DAEMON_CONTAINER_NAME: &str = "monerod"; pub const MONEROD_DAEMON_CONTAINER_NAME: &str = "monerod";
pub const MONEROD_DEFAULT_NETWORK: &str = "monero_network"; pub const MONEROD_DEFAULT_NETWORK: &str = "monero_network";
@ -13,43 +11,22 @@ pub const MONEROD_DEFAULT_NETWORK: &str = "monero_network";
/// this doesn't matter. /// this doesn't matter.
pub const RPC_PORT: u16 = 18081; pub const RPC_PORT: u16 = 18081;
#[derive(Debug, Default)] #[derive(Clone, Copy, Debug, Default)]
pub struct Monerod { pub struct Monerod;
args: MonerodArgs,
}
impl Image for Monerod { impl Image for Monerod {
type Args = MonerodArgs; type Args = MonerodArgs;
type EnvVars = HashMap<String, String>;
type Volumes = HashMap<String, String>;
type EntryPoint = str;
fn descriptor(&self) -> String {
"rinocommunity/monero:v0.18.1.2".to_owned()
}
fn wait_until_ready<D: Docker>(&self, container: &Container<'_, D, Self>) {
container
.logs()
.stdout
.wait_for_message("RPC server started ok")
.unwrap();
}
fn args(&self) -> <Self as Image>::Args {
self.args.clone()
}
fn volumes(&self) -> Self::Volumes { fn name(&self) -> String {
HashMap::new() "rinocommunity/monero".into()
} }
fn env_vars(&self) -> Self::EnvVars { fn tag(&self) -> String {
HashMap::new() "v0.18.1.2".into()
} }
fn with_args(self, args: <Self as Image>::Args) -> Self { fn ready_conditions(&self) -> Vec<WaitFor> {
Self { args } vec![WaitFor::message_on_stdout("RPC server started ok")]
} }
fn entrypoint(&self) -> Option<String> { fn entrypoint(&self) -> Option<String> {
@ -58,43 +35,22 @@ impl Image for Monerod {
} }
} }
#[derive(Debug, Default)] #[derive(Clone, Copy, Debug)]
pub struct MoneroWalletRpc { pub struct MoneroWalletRpc;
args: MoneroWalletRpcArgs,
}
impl Image for MoneroWalletRpc { impl Image for MoneroWalletRpc {
type Args = MoneroWalletRpcArgs; type Args = MoneroWalletRpcArgs;
type EnvVars = HashMap<String, String>;
type Volumes = HashMap<String, String>;
type EntryPoint = str;
fn descriptor(&self) -> String {
"rinocommunity/monero:v0.18.1.2".to_owned()
}
fn wait_until_ready<D: Docker>(&self, container: &Container<'_, D, Self>) {
container
.logs()
.stdout
.wait_for_message("Run server thread name: RPC")
.unwrap();
}
fn args(&self) -> <Self as Image>::Args {
self.args.clone()
}
fn volumes(&self) -> Self::Volumes { fn name(&self) -> String {
HashMap::new() "rinocommunity/monero".into()
} }
fn env_vars(&self) -> Self::EnvVars { fn tag(&self) -> String {
HashMap::new() "v0.18.1.2".into()
} }
fn with_args(self, args: <Self as Image>::Args) -> Self { fn ready_conditions(&self) -> Vec<WaitFor> {
Self { args } vec![WaitFor::message_on_stdout("Run server thread name: RPC")]
} }
fn entrypoint(&self) -> Option<String> { fn entrypoint(&self) -> Option<String> {
@ -104,10 +60,9 @@ impl Image for MoneroWalletRpc {
} }
impl MoneroWalletRpc { impl MoneroWalletRpc {
pub fn new(name: &str, daemon_address: String) -> Self { pub fn new(name: &str, daemon_address: String) -> (Self, MoneroWalletRpcArgs) {
Self { let args = MoneroWalletRpcArgs::new(name, daemon_address);
args: MoneroWalletRpcArgs::new(name, daemon_address), (Self, args)
}
} }
} }
@ -191,6 +146,12 @@ impl IntoIterator for MonerodArgs {
} }
} }
impl ImageArgs for MonerodArgs {
fn into_iterator(self) -> Box<dyn Iterator<Item = String>> {
Box::new(self.into_iter())
}
}
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct MoneroWalletRpcArgs { pub struct MoneroWalletRpcArgs {
pub disable_rpc_login: bool, pub disable_rpc_login: bool,
@ -200,12 +161,6 @@ pub struct MoneroWalletRpcArgs {
pub daemon_address: String, pub daemon_address: String,
} }
impl Default for MoneroWalletRpcArgs {
fn default() -> Self {
unimplemented!("A default instance for `MoneroWalletRpc` doesn't make sense because we always need to connect to a node.")
}
}
impl MoneroWalletRpcArgs { impl MoneroWalletRpcArgs {
pub fn new(wallet_name: &str, daemon_address: String) -> Self { pub fn new(wallet_name: &str, daemon_address: String) -> Self {
Self { Self {
@ -247,3 +202,9 @@ impl IntoIterator for MoneroWalletRpcArgs {
args.into_iter() args.into_iter()
} }
} }
impl ImageArgs for MoneroWalletRpcArgs {
fn into_iterator(self) -> Box<dyn Iterator<Item = String>> {
Box::new(self.into_iter())
}
}

@ -20,17 +20,20 @@
//! every BLOCK_TIME_SECS seconds. //! every BLOCK_TIME_SECS seconds.
//! //!
//! Also provides standalone JSON RPC clients for monerod and monero-wallet-rpc. //! Also provides standalone JSON RPC clients for monerod and monero-wallet-rpc.
pub mod image; use std::time::Duration;
use crate::image::{MONEROD_DAEMON_CONTAINER_NAME, MONEROD_DEFAULT_NETWORK, RPC_PORT};
use anyhow::{anyhow, bail, Context, Result}; use anyhow::{anyhow, bail, Context, Result};
use testcontainers::clients::Cli;
use testcontainers::{Container, RunnableImage};
use tokio::time;
use monero_rpc::monerod; use monero_rpc::monerod;
use monero_rpc::monerod::MonerodRpc as _; use monero_rpc::monerod::MonerodRpc as _;
use monero_rpc::wallet::{self, GetAddress, MoneroWalletRpc as _, Refreshed, Transfer}; use monero_rpc::wallet::{self, GetAddress, MoneroWalletRpc as _, Refreshed, Transfer};
use std::time::Duration;
use testcontainers::clients::Cli; use crate::image::{MONEROD_DAEMON_CONTAINER_NAME, MONEROD_DEFAULT_NETWORK, RPC_PORT};
use testcontainers::{Container, Docker, RunArgs};
use tokio::time; pub mod image;
/// How often we mine a block. /// How often we mine a block.
const BLOCK_TIME_SECS: u64 = 1; const BLOCK_TIME_SECS: u64 = 1;
@ -56,8 +59,8 @@ impl<'c> Monero {
additional_wallets: Vec<&'static str>, additional_wallets: Vec<&'static str>,
) -> Result<( ) -> Result<(
Self, Self,
Container<'c, Cli, image::Monerod>, Container<'c, image::Monerod>,
Vec<Container<'c, Cli, image::MoneroWalletRpc>>, Vec<Container<'c, image::MoneroWalletRpc>>,
)> { )> {
let prefix = format!("{}_", random_prefix()); let prefix = format!("{}_", random_prefix());
let monerod_name = format!("{}{}", prefix, MONEROD_DAEMON_CONTAINER_NAME); let monerod_name = format!("{}{}", prefix, MONEROD_DAEMON_CONTAINER_NAME);
@ -221,15 +224,14 @@ impl<'c> Monerod {
cli: &'c Cli, cli: &'c Cli,
name: String, name: String,
network: String, network: String,
) -> Result<(Self, Container<'c, Cli, image::Monerod>)> { ) -> Result<(Self, Container<'c, image::Monerod>)> {
let image = image::Monerod::default(); let image = image::Monerod::default();
let run_args = RunArgs::default() let image: RunnableImage<image::Monerod> = RunnableImage::from(image)
.with_name(name.clone()) .with_container_name(name.clone())
.with_network(network.clone()); .with_network(network.clone());
let container = cli.run_with_args(image, run_args);
let monerod_rpc_port = container let container = cli.run(image);
.get_host_port(RPC_PORT) let monerod_rpc_port = container.get_host_port_ipv4(RPC_PORT);
.context("port not exposed")?;
Ok(( Ok((
Self { Self {
@ -262,19 +264,15 @@ impl<'c> MoneroWalletRpc {
name: &str, name: &str,
monerod: &Monerod, monerod: &Monerod,
prefix: String, prefix: String,
) -> Result<(Self, Container<'c, Cli, image::MoneroWalletRpc>)> { ) -> Result<(Self, Container<'c, image::MoneroWalletRpc>)> {
let daemon_address = format!("{}:{}", monerod.name, RPC_PORT); let daemon_address = format!("{}:{}", monerod.name, RPC_PORT);
let image = image::MoneroWalletRpc::new(name, daemon_address); let (image, args) = image::MoneroWalletRpc::new(name, daemon_address);
let image = RunnableImage::from((image, args))
.with_container_name(format!("{}{}", prefix, name))
.with_network(monerod.network.clone());
let network = monerod.network.clone(); let container = cli.run(image);
let run_args = RunArgs::default() let wallet_rpc_port = container.get_host_port_ipv4(RPC_PORT);
// prefix the container name so we can run multiple tests
.with_name(format!("{}{}", prefix, name))
.with_network(network.clone());
let container = cli.run_with_args(image, run_args);
let wallet_rpc_port = container
.get_host_port(RPC_PORT)
.context("port not exposed")?;
let client = wallet::Client::localhost(wallet_rpc_port)?; let client = wallet::Client::localhost(wallet_rpc_port)?;

@ -14,6 +14,6 @@ rand = "0.7"
curve25519-dalek = "3" curve25519-dalek = "3"
monero-harness = { path = "../monero-harness" } monero-harness = { path = "../monero-harness" }
rand = "0.7" rand = "0.7"
testcontainers = "0.12" testcontainers = "0.14"
tokio = { version = "1", features = [ "rt-multi-thread", "time", "macros", "sync", "process", "fs" ] } tokio = { version = "1", features = [ "rt-multi-thread", "time", "macros", "sync", "process", "fs" ] }
tracing-subscriber = { version = "0.2", default-features = false, features = [ "fmt", "ansi", "env-filter", "chrono", "tracing-log" ] } tracing-subscriber = { version = "0.2", default-features = false, features = [ "fmt", "ansi", "env-filter", "chrono", "tracing-log" ] }

@ -61,13 +61,12 @@ mod tests {
use monero_harness::image::Monerod; use monero_harness::image::Monerod;
use monero_rpc::monerod::{Client, GetOutputsOut}; use monero_rpc::monerod::{Client, GetOutputsOut};
use testcontainers::clients::Cli; use testcontainers::clients::Cli;
use testcontainers::Docker;
#[tokio::test] #[tokio::test]
async fn get_outs_for_key_offsets() { async fn get_outs_for_key_offsets() {
let cli = Cli::default(); let cli = Cli::default();
let container = cli.run(Monerod::default()); let container = cli.run(Monerod::default());
let rpc_client = Client::localhost(container.get_host_port(18081).unwrap()).unwrap(); let rpc_client = Client::localhost(container.get_host_port_ipv4(18081)).unwrap();
rpc_client.generateblocks(150, "498AVruCDWgP9Az9LjMm89VWjrBrSZ2W2K3HFBiyzzrRjUJWUcCVxvY1iitfuKoek2FdX6MKGAD9Qb1G1P8QgR5jPmmt3Vj".to_owned()).await.unwrap(); rpc_client.generateblocks(150, "498AVruCDWgP9Az9LjMm89VWjrBrSZ2W2K3HFBiyzzrRjUJWUcCVxvY1iitfuKoek2FdX6MKGAD9Qb1G1P8QgR5jPmmt3Vj".to_owned()).await.unwrap();
let wallet = Wallet { let wallet = Wallet {
client: rpc_client.clone(), client: rpc_client.clone(),

@ -14,7 +14,7 @@ async-compression = { version = "0.3", features = [ "bzip2", "tokio" ] }
async-trait = "0.1" async-trait = "0.1"
atty = "0.2" atty = "0.2"
backoff = { version = "0.4", features = [ "tokio" ] } backoff = { version = "0.4", features = [ "tokio" ] }
base64 = "0.21" base64 = "0.22"
bdk = "0.28" bdk = "0.28"
big-bytes = "1" big-bytes = "1"
bitcoin = { version = "0.29", features = [ "rand", "serde" ] } bitcoin = { version = "0.29", features = [ "rand", "serde" ] }
@ -25,6 +25,7 @@ conquer-once = "0.4"
curve25519-dalek = { package = "curve25519-dalek-ng", version = "4" } curve25519-dalek = { package = "curve25519-dalek-ng", version = "4" }
data-encoding = "2.5" data-encoding = "2.5"
dialoguer = "0.11" dialoguer = "0.11"
digest = "0.10.7"
directories-next = "2" directories-next = "2"
ecdsa_fun = { git = "https://github.com/LLFourn/secp256kfun", default-features = false, features = [ "libsecp_compat", "serde", "adaptor" ] } ecdsa_fun = { git = "https://github.com/LLFourn/secp256kfun", default-features = false, features = [ "libsecp_compat", "serde", "adaptor" ] }
ed25519-dalek = "1" ed25519-dalek = "1"
@ -36,7 +37,7 @@ monero = { version = "0.12", features = [ "serde_support" ] }
monero-rpc = { path = "../monero-rpc" } monero-rpc = { path = "../monero-rpc" }
pem = "3.0" pem = "3.0"
proptest = "1" proptest = "1"
qrcode = "0.13" qrcode = "0.14"
rand = "0.8" rand = "0.8"
rand_chacha = "0.3" rand_chacha = "0.3"
reqwest = { version = "0.11", features = [ "rustls-tls", "stream", "socks" ], default-features = false } reqwest = { version = "0.11", features = [ "rustls-tls", "stream", "socks" ], default-features = false }
@ -64,7 +65,7 @@ tracing-appender = "0.2"
tracing-futures = { version = "0.2", features = [ "std-future", "futures-03" ] } 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" ] } tracing-subscriber = { version = "0.3", default-features = false, features = [ "fmt", "ansi", "env-filter", "time", "tracing-log", "json" ] }
url = { version = "2", features = [ "serde" ] } url = { version = "2", features = [ "serde" ] }
uuid = { version = "1.7", features = [ "serde", "v4" ] } uuid = { version = "1.8", features = [ "serde", "v4" ] }
void = "1" void = "1"
[target.'cfg(not(windows))'.dependencies] [target.'cfg(not(windows))'.dependencies]
@ -76,8 +77,8 @@ zip = "0.5"
[dev-dependencies] [dev-dependencies]
bitcoin-harness = "0.2.2" bitcoin-harness = "0.2.2"
get-port = "3" get-port = "3"
hyper = "1.1" hyper = "1.2"
mockito = "1.2.0" mockito = "1.3.0"
monero-harness = { path = "../monero-harness" } monero-harness = { path = "../monero-harness" }
port_check = "0.1" port_check = "0.1"
proptest = "1" proptest = "1"
@ -85,7 +86,7 @@ serde_cbor = "0.11"
serial_test = "3.0" serial_test = "3.0"
spectral = "0.6" spectral = "0.6"
tempfile = "3" tempfile = "3"
testcontainers = "0.12" testcontainers = "0.14"
[build-dependencies] [build-dependencies]
anyhow = "1" anyhow = "1"

@ -1,11 +1,13 @@
use ::monero::Network; use ::monero::Network;
use anyhow::{bail, Context, Error, Result}; use anyhow::{bail, Context, Error, Result};
use big_bytes::BigByte; use big_bytes::BigByte;
use data_encoding::HEXLOWER;
use futures::{StreamExt, TryStreamExt}; use futures::{StreamExt, TryStreamExt};
use monero_rpc::wallet::{Client, MoneroWalletRpc as _}; use monero_rpc::wallet::{Client, MoneroWalletRpc as _};
use reqwest::header::CONTENT_LENGTH; use reqwest::header::CONTENT_LENGTH;
use reqwest::Url; use reqwest::Url;
use serde::Deserialize; use serde::Deserialize;
use sha2::{Digest, Sha256};
use std::fmt; use std::fmt;
use std::fmt::{Debug, Display, Formatter}; use std::fmt::{Debug, Display, Formatter};
use std::io::ErrorKind; use std::io::ErrorKind;
@ -45,19 +47,28 @@ compile_error!("unsupported operating system");
#[cfg(all(target_os = "macos", target_arch = "x86_64"))] #[cfg(all(target_os = "macos", target_arch = "x86_64"))]
const DOWNLOAD_URL: &str = "https://downloads.getmonero.org/cli/monero-mac-x64-v0.18.3.1.tar.bz2"; const DOWNLOAD_URL: &str = "https://downloads.getmonero.org/cli/monero-mac-x64-v0.18.3.1.tar.bz2";
#[cfg(all(target_os = "macos", target_arch = "x86_64"))]
const DOWNLOAD_HASH: &str = "7f8bd9364ef16482b418aa802a65be0e4cc660c794bb5d77b2d17bc84427883a";
#[cfg(all(target_os = "macos", target_arch = "aarch64"))] #[cfg(all(target_os = "macos", target_arch = "aarch64"))]
const DOWNLOAD_URL: &str = "https://downloads.getmonero.org/cli/monero-mac-armv8-v0.18.3.1.tar.bz2"; const DOWNLOAD_URL: &str = "https://downloads.getmonero.org/cli/monero-mac-armv8-v0.18.3.1.tar.bz2";
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
const DOWNLOAD_HASH: &str = "915288b023cb5811e626e10052adc6ac5323dd283c5a25b91059b0fb86a21fb6";
#[cfg(all(target_os = "linux", target_arch = "x86_64"))] #[cfg(all(target_os = "linux", target_arch = "x86_64"))]
const DOWNLOAD_URL: &str = "https://downloads.getmonero.org/cli/monero-linux-x64-v0.18.3.1.tar.bz2"; const DOWNLOAD_URL: &str = "https://downloads.getmonero.org/cli/monero-linux-x64-v0.18.3.1.tar.bz2";
#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
const DOWNLOAD_HASH: &str = "23af572fdfe3459b9ab97e2e9aa7e3c11021c955d6064b801a27d7e8c21ae09d";
#[cfg(all(target_os = "linux", target_arch = "arm"))] #[cfg(all(target_os = "linux", target_arch = "arm"))]
const DOWNLOAD_URL: &str = const DOWNLOAD_URL: &str = "https://downloads.getmonero.org/cli/monero-linux-armv7-v0.18.3.1.tar.bz2";
"https://downloads.getmonero.org/cli/monero-linux-armv7-v0.18.3.1.tar.bz2"; #[cfg(all(target_os = "linux", target_arch = "arm"))]
const DOWNLOAD_HASH: &str = "2ea2c8898cbab88f49423f4f6c15f2a94046cb4bbe827493dd061edc0fd5f1ca";
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
const DOWNLOAD_URL: &str = "https://downloads.getmonero.org/cli/monero-win-x64-v0.18.3.1.zip"; const DOWNLOAD_URL: &str = "https://downloads.getmonero.org/cli/monero-win-x64-v0.18.3.1.zip";
#[cfg(target_os = "windows")]
const DOWNLOAD_HASH: &str = "35dcc4bee4caad3442659d37837e0119e4649a77f2e3b5e80dd6d9b8fc4fb6ad";
#[cfg(any(target_os = "macos", target_os = "linux"))] #[cfg(any(target_os = "macos", target_os = "linux"))]
const PACKED_FILE: &str = "monero-wallet-rpc"; const PACKED_FILE: &str = "monero-wallet-rpc";
@ -227,8 +238,14 @@ impl WalletRpc {
"Downloading monero-wallet-rpc", "Downloading monero-wallet-rpc",
); );
let mut hasher = Sha256::new();
let byte_stream = response let byte_stream = response
.bytes_stream() .bytes_stream()
.map_ok(|bytes| {
hasher.update(&bytes);
bytes
})
.map_err(|err| std::io::Error::new(ErrorKind::Other, err)); .map_err(|err| std::io::Error::new(ErrorKind::Other, err));
#[cfg(not(target_os = "windows"))] #[cfg(not(target_os = "windows"))]
@ -269,6 +286,18 @@ impl WalletRpc {
"Downloading monero-wallet-rpc", "Downloading monero-wallet-rpc",
); );
let result = hasher.finalize();
let result_hash = HEXLOWER.encode(result.as_ref());
if result_hash != DOWNLOAD_HASH {
bail!(
"SHA256 of download ({}) does not match expected ({})!",
result_hash,
DOWNLOAD_HASH
);
} else {
tracing::debug!("Hashes match");
}
file.flush().await?; file.flush().await?;
tracing::debug!("Extracting archive"); tracing::debug!("Extracting archive");

@ -1,6 +1,5 @@
use std::collections::HashMap; use std::collections::BTreeMap;
use testcontainers::core::{Container, Docker, WaitForMessage}; use testcontainers::{core::WaitFor, Image, ImageArgs};
use testcontainers::Image;
pub const RPC_USER: &str = "admin"; pub const RPC_USER: &str = "admin";
pub const RPC_PASSWORD: &str = "123"; pub const RPC_PASSWORD: &str = "123";
@ -10,57 +9,27 @@ pub const DATADIR: &str = "/home/bdk";
#[derive(Debug)] #[derive(Debug)]
pub struct Bitcoind { pub struct Bitcoind {
args: BitcoindArgs,
entrypoint: Option<String>, entrypoint: Option<String>,
volume: Option<String>, volumes: BTreeMap<String, String>,
} }
impl Image for Bitcoind { impl Image for Bitcoind {
type Args = BitcoindArgs; type Args = BitcoindArgs;
type EnvVars = HashMap<String, String>;
type Volumes = HashMap<String, String>;
type EntryPoint = str;
fn descriptor(&self) -> String { fn name(&self) -> String {
"coblox/bitcoin-core:0.21.0".to_string() "coblox/bitcoin-core".into()
} }
fn wait_until_ready<D: Docker>(&self, container: &Container<'_, D, Self>) { fn tag(&self) -> String {
container "0.21.0".into()
.logs()
.stdout
.wait_for_message("init message: Done loading")
.unwrap();
} }
fn args(&self) -> <Self as Image>::Args { fn ready_conditions(&self) -> Vec<WaitFor> {
self.args.clone() vec![WaitFor::message_on_stdout("init message: Done loading")]
} }
fn volumes(&self) -> Self::Volumes { fn volumes(&self) -> Box<dyn Iterator<Item = (&String, &String)> + '_> {
let mut volumes = HashMap::new(); Box::new(self.volumes.iter())
match self.volume.clone() {
None => {}
Some(volume) => {
volumes.insert(volume, DATADIR.to_string());
}
}
volumes
}
fn env_vars(&self) -> Self::EnvVars {
HashMap::new()
}
fn with_args(self, args: <Self as Image>::Args) -> Self {
Bitcoind { args, ..self }
}
fn with_entrypoint(self, entrypoint: &Self::EntryPoint) -> Self {
Self {
entrypoint: Some(entrypoint.to_string()),
..self
}
} }
fn entrypoint(&self) -> Option<String> { fn entrypoint(&self) -> Option<String> {
@ -71,16 +40,15 @@ impl Image for Bitcoind {
impl Default for Bitcoind { impl Default for Bitcoind {
fn default() -> Self { fn default() -> Self {
Bitcoind { Bitcoind {
args: BitcoindArgs::default(),
entrypoint: Some("/usr/bin/bitcoind".into()), entrypoint: Some("/usr/bin/bitcoind".into()),
volume: None, volumes: BTreeMap::default(),
} }
} }
} }
impl Bitcoind { impl Bitcoind {
pub fn with_volume(mut self, volume: String) -> Self { pub fn with_volume(mut self, volume: String) -> Self {
self.volume = Some(volume); self.volumes.insert(volume, DATADIR.to_string());
self self
} }
} }
@ -109,7 +77,6 @@ impl IntoIterator for BitcoindArgs {
format!("-rpcuser={}", RPC_USER), format!("-rpcuser={}", RPC_USER),
format!("-rpcpassword={}", RPC_PASSWORD), format!("-rpcpassword={}", RPC_PASSWORD),
"-printtoconsole".to_string(), "-printtoconsole".to_string(),
"-rest".to_string(),
"-fallbackfee=0.0002".to_string(), "-fallbackfee=0.0002".to_string(),
format!("-datadir={}", DATADIR), format!("-datadir={}", DATADIR),
format!("-rpcport={}", RPC_PORT), format!("-rpcport={}", RPC_PORT),
@ -120,3 +87,9 @@ impl IntoIterator for BitcoindArgs {
args.into_iter() args.into_iter()
} }
} }
impl ImageArgs for BitcoindArgs {
fn into_iterator(self) -> Box<dyn Iterator<Item = String>> {
Box::new(self.into_iter())
}
}

@ -1,8 +1,8 @@
use std::collections::BTreeMap;
use crate::harness::bitcoind; use crate::harness::bitcoind;
use bitcoin::Network; use bitcoin::Network;
use std::collections::HashMap; use testcontainers::{core::WaitFor, Image, ImageArgs};
use testcontainers::core::{Container, Docker, WaitForMessage};
use testcontainers::Image;
pub const HTTP_PORT: u16 = 60401; pub const HTTP_PORT: u16 = 60401;
pub const RPC_PORT: u16 = 3002; pub const RPC_PORT: u16 = 3002;
@ -13,50 +13,25 @@ pub struct Electrs {
args: ElectrsArgs, args: ElectrsArgs,
entrypoint: Option<String>, entrypoint: Option<String>,
wait_for_message: String, wait_for_message: String,
volume: String, volumes: BTreeMap<String, String>,
} }
impl Image for Electrs { impl Image for Electrs {
type Args = ElectrsArgs; type Args = ElectrsArgs;
type EnvVars = HashMap<String, String>; fn name(&self) -> String {
type Volumes = HashMap<String, String>; "vulpemventures/electrs".into()
type EntryPoint = str;
fn descriptor(&self) -> String {
format!("vulpemventures/electrs:{}", self.tag)
}
fn wait_until_ready<D: Docker>(&self, container: &Container<'_, D, Self>) {
container
.logs()
.stderr
.wait_for_message(&self.wait_for_message)
.unwrap();
} }
fn args(&self) -> <Self as Image>::Args { fn tag(&self) -> String {
self.args.clone() self.tag.clone()
} }
fn volumes(&self) -> Self::Volumes { fn ready_conditions(&self) -> Vec<WaitFor> {
let mut volumes = HashMap::new(); vec![WaitFor::message_on_stderr(self.wait_for_message.clone())]
volumes.insert(self.volume.clone(), bitcoind::DATADIR.to_string());
volumes
} }
fn env_vars(&self) -> Self::EnvVars { fn volumes(&self) -> Box<dyn Iterator<Item = (&String, &String)> + '_> {
HashMap::new() Box::new(self.volumes.iter())
}
fn with_args(self, args: <Self as Image>::Args) -> Self {
Electrs { args, ..self }
}
fn with_entrypoint(self, entrypoint: &Self::EntryPoint) -> Self {
Self {
entrypoint: Some(entrypoint.to_string()),
..self
}
} }
fn entrypoint(&self) -> Option<String> { fn entrypoint(&self) -> Option<String> {
@ -71,7 +46,7 @@ impl Default for Electrs {
args: ElectrsArgs::default(), args: ElectrsArgs::default(),
entrypoint: Some("/build/electrs".into()), entrypoint: Some("/build/electrs".into()),
wait_for_message: "Running accept thread".to_string(), wait_for_message: "Running accept thread".to_string(),
volume: uuid::Uuid::new_v4().to_string(), volumes: BTreeMap::default(),
} }
} }
} }
@ -85,7 +60,7 @@ impl Electrs {
} }
pub fn with_volume(mut self, volume: String) -> Self { pub fn with_volume(mut self, volume: String) -> Self {
self.volume = volume; self.volumes.insert(volume, bitcoind::DATADIR.to_string());
self self
} }
@ -93,6 +68,11 @@ impl Electrs {
self.args.daemon_rpc_addr = name; self.args.daemon_rpc_addr = name;
self self
} }
pub fn self_and_args(self) -> (Self, ElectrsArgs) {
let args = self.args.clone();
(self, args)
}
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
@ -137,7 +117,7 @@ impl IntoIterator for ElectrsArgs {
} }
args.push("-vvvvv".to_string()); args.push("-vvvvv".to_string());
args.push(format!("--daemon-dir=={}", self.daemon_dir.as_str())); args.push(format!("--daemon-dir={}", self.daemon_dir.as_str()));
args.push(format!("--daemon-rpc-addr={}", self.daemon_rpc_addr)); args.push(format!("--daemon-rpc-addr={}", self.daemon_rpc_addr));
args.push(format!("--cookie={}", self.cookie)); args.push(format!("--cookie={}", self.cookie));
args.push(format!("--http-addr={}", self.http_addr)); args.push(format!("--http-addr={}", self.http_addr));
@ -147,3 +127,9 @@ impl IntoIterator for ElectrsArgs {
args.into_iter() args.into_iter()
} }
} }
impl ImageArgs for ElectrsArgs {
fn into_iterator(self) -> Box<dyn Iterator<Item = String>> {
Box::new(self.into_iter())
}
}

@ -28,7 +28,7 @@ use swap::seed::Seed;
use swap::{asb, bitcoin, cli, env, monero}; use swap::{asb, bitcoin, cli, env, monero};
use tempfile::{tempdir, NamedTempFile}; use tempfile::{tempdir, NamedTempFile};
use testcontainers::clients::Cli; use testcontainers::clients::Cli;
use testcontainers::{Container, Docker, RunArgs}; use testcontainers::{Container, RunnableImage};
use tokio::sync::mpsc; use tokio::sync::mpsc;
use tokio::sync::mpsc::Receiver; use tokio::sync::mpsc::Receiver;
use tokio::task::JoinHandle; use tokio::task::JoinHandle;
@ -61,10 +61,7 @@ where
let alice_starting_balances = let alice_starting_balances =
StartingBalances::new(bitcoin::Amount::ZERO, xmr_amount, Some(10)); StartingBalances::new(bitcoin::Amount::ZERO, xmr_amount, Some(10));
let electrs_rpc_port = containers let electrs_rpc_port = containers.electrs.get_host_port_ipv4(electrs::RPC_PORT);
.electrs
.get_host_port(electrs::RPC_PORT)
.expect("Could not map electrs rpc port");
let alice_seed = Seed::random().unwrap(); let alice_seed = Seed::random().unwrap();
let (alice_bitcoin_wallet, alice_monero_wallet) = init_test_wallets( let (alice_bitcoin_wallet, alice_monero_wallet) = init_test_wallets(
@ -146,14 +143,14 @@ where
async fn init_containers(cli: &Cli) -> (Monero, Containers<'_>) { async fn init_containers(cli: &Cli) -> (Monero, Containers<'_>) {
let prefix = random_prefix(); let prefix = random_prefix();
let bitcoind_name = format!("{}_{}", prefix, "bitcoind"); let bitcoind_name = format!("{}_{}", prefix, "bitcoind");
let (bitcoind, bitcoind_url) = let (_bitcoind, bitcoind_url, mapped_port) =
init_bitcoind_container(cli, prefix.clone(), bitcoind_name.clone(), prefix.clone()) init_bitcoind_container(cli, prefix.clone(), bitcoind_name.clone(), prefix.clone())
.await .await
.expect("could not init bitcoind"); .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, mapped_port)
.await .await
.expect("could not init electrs"); .expect("could not init electrs");
let (monero, monerod_container, monero_wallet_rpc_containers) = 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 .await
.unwrap(); .unwrap();
@ -162,9 +159,9 @@ async fn init_containers(cli: &Cli) -> (Monero, Containers<'_>) {
monero, monero,
Containers { Containers {
bitcoind_url, bitcoind_url,
bitcoind, _bitcoind,
monerod_container, _monerod_container,
monero_wallet_rpc_containers, _monero_wallet_rpc_containers,
electrs, electrs,
}, },
) )
@ -175,29 +172,28 @@ async fn init_bitcoind_container(
volume: String, volume: String,
name: String, name: String,
network: String, network: String,
) -> Result<(Container<'_, Cli, bitcoind::Bitcoind>, Url)> { ) -> Result<(Container<'_, bitcoind::Bitcoind>, Url, u16)> {
let image = bitcoind::Bitcoind::default().with_volume(volume); let image = bitcoind::Bitcoind::default().with_volume(volume);
let image = RunnableImage::from(image)
.with_container_name(name)
.with_network(network);
let run_args = RunArgs::default().with_name(name).with_network(network); let docker = cli.run(image);
let port = docker.get_host_port_ipv4(bitcoind::RPC_PORT);
let docker = cli.run_with_args(image, run_args);
let a = docker
.get_host_port(bitcoind::RPC_PORT)
.context("Could not map bitcoind rpc port")?;
let bitcoind_url = { let bitcoind_url = {
let input = format!( let input = format!(
"http://{}:{}@localhost:{}", "http://{}:{}@localhost:{}",
bitcoind::RPC_USER, bitcoind::RPC_USER,
bitcoind::RPC_PASSWORD, bitcoind::RPC_PASSWORD,
a port
); );
Url::parse(&input).unwrap() Url::parse(&input).unwrap()
}; };
init_bitcoind(bitcoind_url.clone(), 5).await?; init_bitcoind(bitcoind_url.clone(), 5).await?;
Ok((docker, bitcoind_url.clone())) Ok((docker, bitcoind_url.clone(), bitcoind::RPC_PORT))
} }
pub async fn init_electrs_container( pub async fn init_electrs_container(
@ -205,16 +201,18 @@ pub async fn init_electrs_container(
volume: String, volume: String,
bitcoind_container_name: String, bitcoind_container_name: String,
network: String, network: String,
) -> Result<Container<'_, Cli, electrs::Electrs>> { port: u16,
let bitcoind_rpc_addr = format!("{}:{}", bitcoind_container_name, bitcoind::RPC_PORT); ) -> Result<Container<'_, electrs::Electrs>> {
let bitcoind_rpc_addr = format!("{}:{}", bitcoind_container_name, port);
let image = electrs::Electrs::default() let image = electrs::Electrs::default()
.with_volume(volume) .with_volume(volume)
.with_daemon_rpc_addr(bitcoind_rpc_addr) .with_daemon_rpc_addr(bitcoind_rpc_addr)
.with_tag("latest"); .with_tag("latest");
let image = RunnableImage::from(image.self_and_args())
.with_network(network.clone())
.with_container_name(format!("{}_electrs", network));
let run_args = RunArgs::default().with_network(network); let docker = cli.run(image);
let docker = cli.run_with_args(image, run_args);
Ok(docker) Ok(docker)
} }
@ -952,13 +950,12 @@ pub async fn mint(node_url: Url, address: bitcoin::Address, amount: bitcoin::Amo
} }
// This is just to keep the containers alive // This is just to keep the containers alive
#[allow(dead_code)]
struct Containers<'a> { struct Containers<'a> {
bitcoind_url: Url, bitcoind_url: Url,
bitcoind: Container<'a, Cli, bitcoind::Bitcoind>, _bitcoind: Container<'a, bitcoind::Bitcoind>,
monerod_container: Container<'a, Cli, image::Monerod>, _monerod_container: Container<'a, image::Monerod>,
monero_wallet_rpc_containers: Vec<Container<'a, Cli, image::MoneroWalletRpc>>, _monero_wallet_rpc_containers: Vec<Container<'a, image::MoneroWalletRpc>>,
electrs: Container<'a, Cli, electrs::Electrs>, electrs: Container<'a, electrs::Electrs>,
} }
pub mod alice_run_until { pub mod alice_run_until {

Loading…
Cancel
Save