diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 314a4279..697061cf 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -22,10 +22,12 @@ jobs: run: cargo install just - name: Run Docker Compose run: docker compose up lnd1 -d + - name: Set permissions for admin.macaroon + run: chmod -R +r ./data/lnd1 - name: Build run: cargo build --verbose - name: Run tests - run: cargo test --verbose + run: just run-tests - name: Run itests run: just run-itests coverage: diff --git a/Cargo.lock b/Cargo.lock index ac20a3f2..af805cf9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -320,13 +320,19 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" +[[package]] +name = "bech32" +version = "0.10.0-beta" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98f7eed2b2781a6f0b5c903471d48e15f56fb4e1165df8a9a2337fd1a59d45ea" + [[package]] name = "bitcoin" version = "0.29.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0694ea59225b0c5f3cb405ff3f670e4828358ed26aec49dc352f730f0cb1a8a3" dependencies = [ - "bech32", + "bech32 0.9.1", "bitcoin_hashes 0.11.0", "secp256k1 0.24.3", ] @@ -337,7 +343,7 @@ version = "0.30.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1945a5048598e4189e239d3f809b19bdad4845c4b2ba400d304d2dcf26d2c462" dependencies = [ - "bech32", + "bech32 0.9.1", "bitcoin-private", "bitcoin_hashes 0.12.0", "hex_lit", @@ -345,11 +351,29 @@ dependencies = [ "serde", ] +[[package]] +name = "bitcoin" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd00f3c09b5f21fb357abe32d29946eb8bb7a0862bae62c0b5e4a692acbbe73c" +dependencies = [ + "bech32 0.10.0-beta", + "bitcoin-internals", + "bitcoin_hashes 0.13.0", + "hex-conservative", + "hex_lit", + "secp256k1 0.28.2", + "serde", +] + [[package]] name = "bitcoin-internals" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb" +dependencies = [ + "serde", +] [[package]] name = "bitcoin-private" @@ -381,6 +405,31 @@ checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b" dependencies = [ "bitcoin-internals", "hex-conservative", + "serde", +] + +[[package]] +name = "bitcoincore-rpc" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eb70725a621848c83b3809913d5314c0d20ca84877d99dd909504b564edab00" +dependencies = [ + "bitcoincore-rpc-json", + "jsonrpc", + "log", + "serde", + "serde_json", +] + +[[package]] +name = "bitcoincore-rpc-json" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "856ffbee2e492c23bca715d72ea34aae80d58400f2bda26a82015d6bc2ec3662" +dependencies = [ + "bitcoin 0.31.1", + "serde", + "serde_json", ] [[package]] @@ -1445,6 +1494,31 @@ dependencies = [ "serde", ] +[[package]] +name = "integrationtests" +version = "0.2.1" +dependencies = [ + "anyhow", + "axum 0.7.4", + "bitcoin_hashes 0.12.0", + "bitcoincore-rpc", + "fedimint-tonic-lnd", + "lightning-invoice 0.29.0", + "moksha-core", + "moksha-mint", + "moksha-wallet", + "rand", + "reqwest", + "secp256k1 0.27.0", + "serde", + "tempfile", + "testcontainers", + "testcontainers-modules", + "tokio", + "tracing", + "url", +] + [[package]] name = "ipnet" version = "2.9.0" @@ -1493,6 +1567,17 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "jsonrpc" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8128f36b47411cd3f044be8c1f5cc0c9e24d1d1bfdc45f0a57897b32513053f2" +dependencies = [ + "base64 0.13.1", + "serde", + "serde_json", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -1561,7 +1646,7 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3eb24878b0f4ef75f020976c886d9ad1503867802329cc963e0ab4623ea3b25c" dependencies = [ - "bech32", + "bech32 0.9.1", "bitcoin 0.29.2", "bitcoin_hashes 0.11.0", "lightning 0.0.118", @@ -1575,7 +1660,7 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b186aca4a605d4db3b85979922be287b9ebd5dedd8132963bb9dbeb8f7d2a04" dependencies = [ - "bech32", + "bech32 0.9.1", "bitcoin 0.30.2", "lightning 0.0.121", "num-traits", @@ -2801,6 +2886,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25996b82292a7a57ed3508f052cfff8640d38d32018784acd714758b43da9c8f" dependencies = [ "bitcoin_hashes 0.12.0", + "rand", "secp256k1-sys 0.8.1", "serde", ] @@ -2811,6 +2897,7 @@ version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" dependencies = [ + "bitcoin_hashes 0.13.0", "rand", "secp256k1-sys 0.9.2", "serde", diff --git a/Cargo.toml b/Cargo.toml index 5ba05449..c19eb1f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,6 +6,7 @@ members = [ "moksha-cli", "moksha-wallet", "moksha-mint", + "integrationtests", ] [profile.dev] diff --git a/integrationtests/Cargo.toml b/integrationtests/Cargo.toml index c966f46b..fd0b904c 100644 --- a/integrationtests/Cargo.toml +++ b/integrationtests/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "moksha-integrationtests" +name = "integrationtests" version = "0.2.1" edition = "2021" repository = "https://github.com/ngutech21/moksha" @@ -43,5 +43,3 @@ moksha-mint = { path = "../moksha-mint" } moksha-wallet = { path = "../moksha-wallet" } moksha-core = { path = "../moksha-core" } tempfile = "3.9.0" - -[workspace] diff --git a/justfile b/justfile index a9ae7e6a..f8e687a0 100644 --- a/justfile +++ b/justfile @@ -14,6 +14,8 @@ clean: cargo clean + + # check code for typos [no-exit-message] typos: @@ -59,10 +61,13 @@ run-cli *ARGS: RUST_BACKTRACE=1 cargo run --bin moksha-cli -- -m http://127.0.0.1:3338 -d ./data/wallet {{ARGS}} +run-tests: + cargo test --workspace --exclude integrationtests + + # run integrationtests run-itests: - cd integrationtests && \ - cargo test + cargo test -p integrationtests # build the mint docker-image build-docker: