From a6863168464d2e87dca50342ee8ac6f596020dcf Mon Sep 17 00:00:00 2001 From: tompro Date: Mon, 17 Feb 2025 16:23:36 +0100 Subject: [PATCH 1/7] Lint fixes --- payday_core/src/events/publisher.rs | 2 +- payday_core/src/events/task.rs | 13 +++---------- rust-analyzer.json | 5 +++++ 3 files changed, 9 insertions(+), 11 deletions(-) create mode 100644 rust-analyzer.json diff --git a/payday_core/src/events/publisher.rs b/payday_core/src/events/publisher.rs index d2b8a7b..cc607df 100644 --- a/payday_core/src/events/publisher.rs +++ b/payday_core/src/events/publisher.rs @@ -1,7 +1,7 @@ use async_trait::async_trait; use super::{ - task::{RetryType, Task, TaskResult}, + task::{RetryType, Task}, Message, Result, }; diff --git a/payday_core/src/events/task.rs b/payday_core/src/events/task.rs index 2a4ef55..d188377 100644 --- a/payday_core/src/events/task.rs +++ b/payday_core/src/events/task.rs @@ -1,12 +1,9 @@ use std::time::Duration; -use async_trait::async_trait; -use serde::{de::DeserializeOwned, Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; use serde_json::Value; -use tokio::task::JoinHandle; -use crate::date::{date_after, now, DateTime}; -use crate::events::Result; +use crate::date::{now, DateTime}; use super::{Message, MessageType}; @@ -44,11 +41,7 @@ pub enum RetryType { impl RetryType { pub fn is_retry(&self) -> bool { - match self { - RetryType::Fixed(..) => true, - RetryType::Exponential(..) => true, - _ => false, - } + matches!(self, RetryType::Fixed(..) | RetryType::Exponential(..)) } pub fn next_retry(&self) -> Option { match self { diff --git a/rust-analyzer.json b/rust-analyzer.json new file mode 100644 index 0000000..b188acb --- /dev/null +++ b/rust-analyzer.json @@ -0,0 +1,5 @@ +{ + "rust-analyzer.procMacro": { + "enable": true + } +} From 95d0fec80f4f4e6062422ac9313b7ff14f90efe2 Mon Sep 17 00:00:00 2001 From: tompro Date: Mon, 17 Feb 2025 17:54:22 +0100 Subject: [PATCH 2/7] New test setup --- Cargo.lock | 1777 +++++++++++++++++++++----------- Cargo.toml | 2 +- payday_node_lnd/src/wrapper.rs | 16 +- src/main.rs | 100 +- 4 files changed, 1220 insertions(+), 675 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e2c2701..22ee114 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr" @@ -13,18 +13,18 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.22.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] [[package]] -name = "adler" -version = "1.0.2" +name = "adler2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "ahash" @@ -32,7 +32,7 @@ version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ - "getrandom", + "getrandom 0.2.15", "once_cell", "version_check", ] @@ -44,10 +44,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", - "getrandom", + "getrandom 0.2.15", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -61,9 +61,9 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.18" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "android-tzdata" @@ -88,9 +88,9 @@ checksum = "ea50b14b7a4b9343f8c627a7a53c52076482bd4bdad0a24fd3ec533ed616cc2c" [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[package]] name = "approx" @@ -103,9 +103,9 @@ dependencies = [ [[package]] name = "arbitrary" -version = "1.3.2" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" +checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" [[package]] name = "argon2" @@ -121,9 +121,9 @@ dependencies = [ [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "ascii-canvas" @@ -141,20 +141,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" dependencies = [ "concurrent-queue", - "event-listener", + "event-listener 2.5.3", "futures-core", ] [[package]] name = "async-executor" -version = "1.12.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8828ec6e544c02b0d6691d21ed9f9218d0384a82542855073c2a3f58304aaf0" +checksum = "30ca9a001c1e8ba5149f91a74362376cc6bc5b919d92d988668657bd570bdcec" dependencies = [ "async-task", "concurrent-queue", - "fastrand 2.1.0", - "futures-lite 2.3.0", + "fastrand", + "futures-lite", "slab", ] @@ -166,14 +166,14 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.98", ] [[package]] name = "async-stream" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" dependencies = [ "async-stream-impl", "futures-core", @@ -182,13 +182,13 @@ dependencies = [ [[package]] name = "async-stream-impl" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.98", ] [[package]] @@ -199,13 +199,13 @@ checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" [[package]] name = "async-trait" -version = "0.1.80" +version = "0.1.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" +checksum = "644dd749086bf3771a2fbc5f256fdb982d53f011c7d5d560304eafeecebce79d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.98", ] [[package]] @@ -239,9 +239,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "axum" @@ -290,17 +290,17 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.73" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", + "windows-targets 0.52.6", ] [[package]] @@ -339,7 +339,7 @@ checksum = "e65938ed058ef47d92cf8b346cc76ef48984572ade631927e9937b5ffc7662c7" dependencies = [ "base64 0.22.1", "blowfish", - "getrandom", + "getrandom 0.2.15", "subtle", "zeroize", ] @@ -376,9 +376,9 @@ checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" [[package]] name = "bitcoin" -version = "0.32.2" +version = "0.32.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea507acc1cd80fc084ace38544bbcf7ced7c2aa65b653b102de0ce718df668f6" +checksum = "ce6bc65742dea50536e35ad42492b234c27904a27f0abdcbce605015cb4ea026" dependencies = [ "base58ck", "bech32", @@ -399,15 +399,15 @@ checksum = "30bdbe14aa07b06e6cfeffc529a1f099e5fbe249524f8125358604df99a4bed2" [[package]] name = "bitcoin-io" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "340e09e8399c7bd8912f495af6aa58bea0c9214773417ffaa8f6460f93aaee56" +checksum = "0b47c4ab7a93edb0c7198c5535ed9b52b63095f4e9b45279c6736cec4b856baf" [[package]] name = "bitcoin-units" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb54da0b28892f3c52203a7191534033e051b6f4b52bc15480681b57b7e036f5" +checksum = "5285c8bcaa25876d07f37e3d30c303f2609179716e11d688f51e8f1fe70063e2" dependencies = [ "bitcoin-internals", ] @@ -430,9 +430,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" dependencies = [ "serde", ] @@ -479,9 +479,9 @@ dependencies = [ [[package]] name = "borsh" -version = "1.5.1" +version = "1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6362ed55def622cddc70a4746a68554d7b687713770de539e59a739b249f8ed" +checksum = "5430e3be710b68d984d1391c854eb431a9d548640711faa54eecb1df93db91cc" dependencies = [ "borsh-derive", "cfg_aliases", @@ -489,23 +489,22 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.5.1" +version = "1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ef8005764f53cd4dca619f5bf64cafd4664dada50ece25e4d81de54c80cc0b" +checksum = "f8b668d39970baad5356d7c83a86fee3a539e6f93bf6764c97368243e17a0487" dependencies = [ "once_cell", "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.66", - "syn_derive", + "syn 2.0.98", ] [[package]] name = "bumpalo" -version = "3.16.0" +version = "3.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" [[package]] name = "byte-slice-cast" @@ -537,9 +536,9 @@ dependencies = [ [[package]] name = "bytemuck" -version = "1.16.1" +version = "1.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e" +checksum = "ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3" [[package]] name = "byteorder" @@ -549,15 +548,18 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.6.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +checksum = "f61dac84819c6588b558454b194026eb1f09c293b9036ae9b159e74e73ab6cf9" [[package]] name = "cc" -version = "1.0.99" +version = "1.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695" +checksum = "0c3d1b2e905a3a7b00a6141adb0e4c0bb941d11caf55349d863942a1cc44e3c9" +dependencies = [ + "shlex", +] [[package]] name = "cedar-policy" @@ -573,7 +575,7 @@ dependencies = [ "serde", "serde_json", "smol_str", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -596,7 +598,7 @@ dependencies = [ "serde_with", "smol_str", "stacker", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -612,7 +614,7 @@ dependencies = [ "serde_with", "smol_str", "stacker", - "thiserror", + "thiserror 1.0.69", "unicode-security", ] @@ -630,9 +632,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "chrono" -version = "0.4.38" +version = "0.4.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" dependencies = [ "android-tzdata", "iana-time-zone", @@ -640,7 +642,7 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -668,6 +670,36 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" +[[package]] +name = "const_format" +version = "0.2.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126f97965c8ad46d6d9163268ff28432e8f6a1196a55578867832e3049df63dd" +dependencies = [ + "const_format_proc_macros", +] + +[[package]] +name = "const_format_proc_macros" +version = "0.2.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d57c2eccfb16dbac1f4e61e206105db5820c9d26c3c472bc17c774259ef7744" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "cordyceps" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec10f0a762d93c4498d2e97a333805cb6250d60bead623f71d8034f9a4152ba3" +dependencies = [ + "loom", + "tracing", +] + [[package]] name = "core-foundation" version = "0.9.4" @@ -680,29 +712,29 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ "libc", ] [[package]] name = "cqrs-es" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b907f0f950fdce9f3e6b1e38bb11dc70fc9d5b127cdf071750341e7f7f67ee4" +checksum = "5da025e9082adb74e8bb2b7e93feed51c711aa6c384cc18ad03b463ed776db64" dependencies = [ "async-trait", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", "tokio", ] @@ -723,30 +755,30 @@ checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" [[package]] name = "critical-section" -version = "1.1.2" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" +checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" [[package]] name = "crossbeam-queue" -version = "0.3.11" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" +checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.20" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crunchy" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" [[package]] name = "crypto-common" @@ -792,14 +824,14 @@ dependencies = [ "derive-syn-parse", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.98", ] [[package]] name = "darling" -version = "0.20.9" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83b2eb4d90d12bdda5ed17de686c2acb4c57914f8f921b8da7e112b5a36f3fe1" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ "darling_core", "darling_macro", @@ -807,34 +839,34 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.9" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622687fe0bac72a04e5599029151f5796111b90f1baaa9b544d807a5e31cd120" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", "strsim", - "syn 2.0.66", + "syn 2.0.98", ] [[package]] name = "darling_macro" -version = "0.20.9" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.66", + "syn 2.0.98", ] [[package]] name = "data-encoding" -version = "2.6.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" +checksum = "575f75dfd25738df5b91b8e43e14d44bda14637a58fae779fd2b064f8bf3e010" [[package]] name = "der" @@ -865,7 +897,7 @@ checksum = "d65d7ce8132b7c0e54497a4d9a55a1c2a0912a0d786cf894472ba818fba45762" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.98", ] [[package]] @@ -874,6 +906,12 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "339544cc9e2c4dc3fc7149fd630c5f22263a4fdf18a98afd0075784968b5cf00" +[[package]] +name = "diatomic-waker" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab03c107fafeb3ee9f5925686dbb7a73bc76e3932abb0d2b365cb64b169cf04c" + [[package]] name = "digest" version = "0.10.7" @@ -907,6 +945,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.98", +] + [[package]] name = "dmp" version = "0.2.0" @@ -940,9 +989,9 @@ dependencies = [ [[package]] name = "either" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" dependencies = [ "serde", ] @@ -958,9 +1007,9 @@ dependencies = [ [[package]] name = "encoding_rs" -version = "0.8.34" +version = "0.8.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" dependencies = [ "cfg-if", ] @@ -973,18 +1022,18 @@ checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" [[package]] name = "equivalent" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1005,19 +1054,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] -name = "fastrand" -version = "1.9.0" +name = "event-listener" +version = "5.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +checksum = "3492acde4c3fc54c845eaab3eed8bd00c7a7d881f78bfc801e43a93dec1331ae" dependencies = [ - "instant", + "concurrent-queue", + "parking", + "pin-project-lite", ] [[package]] name = "fastrand" -version = "2.1.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "fedimint-tonic-lnd" @@ -1030,8 +1081,8 @@ dependencies = [ "hyper", "hyper-rustls", "prost", - "rustls", - "rustls-pemfile", + "rustls 0.21.12", + "rustls-pemfile 1.0.4", "tokio", "tokio-stream", "tonic", @@ -1046,7 +1097,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" dependencies = [ "byteorder", - "rand", + "rand 0.8.5", "rustc-hex", "static_assertions", ] @@ -1057,6 +1108,12 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" +[[package]] +name = "fixedbitset" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" + [[package]] name = "float_next_after" version = "1.0.0" @@ -1065,9 +1122,9 @@ checksum = "8bf7cc16383c4b8d58b9905a8509f02926ce3058053c056376248d958c9df1e8" [[package]] name = "flume" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" dependencies = [ "futures-core", "futures-sink", @@ -1081,6 +1138,12 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -1104,9 +1167,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -1119,20 +1182,21 @@ dependencies = [ [[package]] name = "futures-buffered" -version = "0.2.6" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02dcae03ee5afa5ea17b1aebc793806b8ddfc6dc500e0b8e8e1eb30b9dad22c0" +checksum = "34acda8ae8b63fbe0b2195c998b180cff89a8212fb2622a78b572a9f1c6f7684" dependencies = [ + "cordyceps", + "diatomic-waker", "futures-core", - "futures-util", "pin-project-lite", ] [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -1140,14 +1204,14 @@ dependencies = [ [[package]] name = "futures-concurrency" -version = "7.6.1" +version = "7.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b14ac911e85d57c5ea6eef76d7b4d4a3177ecd15f4bea2e61927e9e3823e19f" +checksum = "0eb68017df91f2e477ed4bea586c59eaecaa47ed885a770d0444e21e62572cd2" dependencies = [ - "bitvec", + "fixedbitset 0.5.7", "futures-buffered", "futures-core", - "futures-lite 1.13.0", + "futures-lite", "pin-project", "slab", "smallvec", @@ -1155,15 +1219,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -1183,32 +1247,17 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" - -[[package]] -name = "futures-lite" -version = "1.13.0" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" -dependencies = [ - "fastrand 1.9.0", - "futures-core", - "futures-io", - "memchr", - "parking", - "pin-project-lite", - "waker-fn", -] +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-lite" -version = "2.3.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" +checksum = "f5edaec856126859abb19ed65f39e90fea3a9574b9707f13539acf4abf7eb532" dependencies = [ - "fastrand 2.1.0", + "fastrand", "futures-core", "futures-io", "parking", @@ -1217,32 +1266,32 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.98", ] [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -1265,6 +1314,19 @@ dependencies = [ "thread_local", ] +[[package]] +name = "generator" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e" +dependencies = [ + "cc", + "libc", + "log", + "rustversion", + "windows", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -1312,9 +1374,9 @@ dependencies = [ [[package]] name = "geo-types" -version = "0.7.13" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ff16065e5720f376fbced200a5ae0f47ace85fd70b7e54269790281353b6d61" +checksum = "3bd1157f0f936bf0cd68dec91e8f7c311afe60295574d62b70d4861a1bfdf2d9" dependencies = [ "approx", "arbitrary", @@ -1341,15 +1403,27 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "wasm-bindgen", ] +[[package]] +name = "getrandom" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.13.3+wasi-0.2.2", + "windows-targets 0.52.6", +] + [[package]] name = "gimli" -version = "0.29.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "h2" @@ -1363,7 +1437,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 2.2.6", + "indexmap 2.7.1", "slab", "tokio", "tokio-util", @@ -1398,13 +1472,24 @@ dependencies = [ "allocator-api2", ] +[[package]] +name = "hashbrown" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", +] + [[package]] name = "hashlink" -version = "0.8.4" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" +checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" dependencies = [ - "hashbrown 0.14.5", + "hashbrown 0.15.2", ] [[package]] @@ -1425,9 +1510,6 @@ name = "heck" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" -dependencies = [ - "unicode-segmentation", -] [[package]] name = "heck" @@ -1482,11 +1564,11 @@ dependencies = [ [[package]] name = "home" -version = "0.5.9" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1513,9 +1595,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.9.4" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" +checksum = "f2d708df4e7140240a16cd6ab0ab65c972d7433ab77819ea693fde9c43811e2a" [[package]] name = "httpdate" @@ -1531,9 +1613,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.29" +version = "0.14.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f361cde2f109281a220d4307746cdfd5ee3f410da58a70377762396775634b33" +checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" dependencies = [ "bytes", "futures-channel", @@ -1562,7 +1644,7 @@ dependencies = [ "futures-util", "http", "hyper", - "rustls", + "rustls 0.21.12", "tokio", "tokio-rustls", ] @@ -1581,9 +1663,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.60" +version = "0.1.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1602,6 +1684,124 @@ dependencies = [ "cc", ] +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.98", +] + [[package]] name = "ident_case" version = "1.0.1" @@ -1610,12 +1810,23 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.5.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", ] [[package]] @@ -1640,13 +1851,13 @@ dependencies = [ [[package]] name = "impl-trait-for-tuples" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.98", ] [[package]] @@ -1662,12 +1873,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.6" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652" dependencies = [ "equivalent", - "hashbrown 0.14.5", + "hashbrown 0.15.2", "serde", ] @@ -1680,15 +1891,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "instant" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" -dependencies = [ - "cfg-if", -] - [[package]] name = "integer-sqrt" version = "0.1.5" @@ -1700,9 +1902,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.9.0" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" [[package]] name = "itertools" @@ -1733,16 +1935,17 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.11" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ + "once_cell", "wasm-bindgen", ] @@ -1760,7 +1963,7 @@ dependencies = [ "petgraph", "pico-args", "regex", - "regex-syntax", + "regex-syntax 0.8.5", "string_cache", "term", "tiny-keccak", @@ -1774,7 +1977,7 @@ version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "507460a910eb7b32ee961886ff48539633b788a36b65692b95f225b844c82553" dependencies = [ - "regex-automata", + "regex-automata 0.4.9", ] [[package]] @@ -1797,15 +2000,15 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.155" +version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "libm" -version = "0.2.8" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" [[package]] name = "libredox" @@ -1813,26 +2016,31 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.8.0", "libc", ] [[package]] name = "libsqlite3-sys" -version = "0.27.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716" +checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" dependencies = [ - "cc", "pkg-config", "vcpkg", ] [[package]] name = "linux-raw-sys" -version = "0.4.14" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "litemap" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" [[package]] name = "lock_api" @@ -1846,9 +2054,31 @@ dependencies = [ [[package]] name = "log" -version = "0.4.21" +version = "0.4.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" + +[[package]] +name = "loom" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5" +dependencies = [ + "cfg-if", + "generator", + "scoped-tls", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "matchers" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] [[package]] name = "matchit" @@ -1880,7 +2110,7 @@ checksum = "59bb584eaeeab6bd0226ccf3509a69d7936d148cf3d036ad350abe35e8c6856e" dependencies = [ "miette-derive", "once_cell", - "thiserror", + "thiserror 1.0.69", "unicode-width", ] @@ -1892,7 +2122,7 @@ checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.98", ] [[package]] @@ -1919,22 +2149,22 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.4" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +checksum = "b3b1c9bd4fe1f0f8b387f6eb9eb3b4a1aa26185e5750efb9140301703f62cd1b" dependencies = [ - "adler", + "adler2", ] [[package]] name = "mio" -version = "0.8.11" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ "libc", - "wasi", - "windows-sys 0.48.0", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.52.0", ] [[package]] @@ -1949,7 +2179,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ffa00dec017b5b1a8b7cf5e2c008bfda1aa7e0697ac1508b491fdf2622fb4d8" dependencies = [ - "rand", + "rand 0.8.5", ] [[package]] @@ -1958,7 +2188,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" dependencies = [ - "getrandom", + "getrandom 0.2.15", ] [[package]] @@ -1986,6 +2216,16 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num-bigint" version = "0.4.6" @@ -2008,7 +2248,7 @@ dependencies = [ "num-integer", "num-iter", "num-traits", - "rand", + "rand 0.8.5", "smallvec", "zeroize", ] @@ -2061,9 +2301,9 @@ dependencies = [ [[package]] name = "object" -version = "0.36.0" +version = "0.36.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "576dfe1fc8f9df304abb159d767a29d0476f7750fbf8aa7ad07816004a207434" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" dependencies = [ "memchr", ] @@ -2091,41 +2331,49 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e" + +[[package]] +name = "overload" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "parity-scale-codec" -version = "3.6.12" +version = "3.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "306800abfa29c7f16596b5970a588435e3d5b3149683d00c12b699cc19f895ee" +checksum = "c9fde3d0718baf5bc92f577d652001da0f8d54cd03a7974e118d04fc888dc23d" dependencies = [ "arrayvec", "bitvec", "byte-slice-cast", + "const_format", "impl-trait-for-tuples", "parity-scale-codec-derive", + "rustversion", "serde", ] [[package]] name = "parity-scale-codec-derive" -version = "3.6.12" +version = "3.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d830939c76d294956402033aee57a6da7b438f2294eb94864c37b0569053a42c" +checksum = "581c837bb6b9541ce7faa9377c20616e4fb7650f6b0f68bc93c827ee504fb7b3" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.98", ] [[package]] name = "parking" -version = "2.2.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" [[package]] name = "parking_lot" @@ -2145,9 +2393,9 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.5.2", + "redox_syscall", "smallvec", - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -2157,16 +2405,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166" dependencies = [ "base64ct", - "rand_core", + "rand_core 0.6.4", "subtle", ] -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - [[package]] name = "path-clean" version = "1.0.1" @@ -2304,8 +2546,8 @@ version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ - "fixedbitset", - "indexmap 2.2.6", + "fixedbitset 0.4.2", + "indexmap 2.7.1", ] [[package]] @@ -2320,9 +2562,9 @@ dependencies = [ [[package]] name = "phf_shared" -version = "0.10.0" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" dependencies = [ "siphasher", ] @@ -2335,29 +2577,29 @@ checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" [[package]] name = "pin-project" -version = "1.1.5" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +checksum = "dfe2e71e1471fe07709406bf725f710b02927c9c54b2b5b2ec0e8087d97c327d" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.5" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +checksum = "f6e859e6e5bd50440ab63c47e3ebabc90f26251f7c73c3d3e837b74a1cc3fa67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.98", ] [[package]] name = "pin-project-lite" -version = "0.2.14" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" @@ -2388,15 +2630,15 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "postgres-es" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05fcd2f85b76ea7edb35f7d421c42b85f2a4964ce7a2f139851eb9a751929cc4" +checksum = "1a380c092ccb97e081e4e418b20f8a7f1a717a30dc38e4096f56a0dd8b0c077c" dependencies = [ "async-trait", "cqrs-es", @@ -2415,9 +2657,12 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy 0.7.35", +] [[package]] name = "precomputed-hash" @@ -2427,12 +2672,12 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] name = "prettyplease" -version = "0.2.20" +version = "0.2.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" +checksum = "6924ced06e1f7dfe3fa48d57b9f74f55d8915f5036121bef647ef4b204895fac" dependencies = [ "proc-macro2", - "syn 2.0.66", + "syn 2.0.98", ] [[package]] @@ -2449,9 +2694,9 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" dependencies = [ "toml_edit", ] @@ -2482,9 +2727,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.85" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" +checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" dependencies = [ "unicode-ident", ] @@ -2516,7 +2761,7 @@ dependencies = [ "prost", "prost-types", "regex", - "syn 2.0.66", + "syn 2.0.98", "tempfile", ] @@ -2530,7 +2775,7 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.98", ] [[package]] @@ -2550,9 +2795,9 @@ checksum = "33cb294fe86a74cbcf50d4445b37da762029549ebeea341421c7c70370f86cac" [[package]] name = "psm" -version = "0.1.21" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +checksum = "f58e5423e24c18cc840e1c98370b3993c6649cd1678b4d24318bcf0a083cbe88" dependencies = [ "cc", ] @@ -2579,9 +2824,9 @@ dependencies = [ [[package]] name = "quick_cache" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1380629287ed1247c1e0fcc6d43efdcec508b65382c9ab775cc8f3df7ca07b0" +checksum = "4a4b807ec70346b4fac3c13ae967634237847d49871f623fe0d455403346bad4" dependencies = [ "ahash 0.8.11", "equivalent", @@ -2591,9 +2836,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] @@ -2618,7 +2863,7 @@ checksum = "4650ac02d49dfd3384bbb5735251a2cd858402992df06f1eeb57cc89b4342d08" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.98", ] [[package]] @@ -2645,8 +2890,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.1", + "zerocopy 0.8.18", ] [[package]] @@ -2656,7 +2912,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.1", ] [[package]] @@ -2665,36 +2931,37 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom", + "getrandom 0.2.15", ] [[package]] -name = "redox_syscall" -version = "0.4.1" +name = "rand_core" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "a88e0da7a2c97baa202165137c158d0a2e824ac465d13d81046727b34cb247d3" dependencies = [ - "bitflags 1.3.2", + "getrandom 0.3.1", + "zerocopy 0.8.18", ] [[package]] name = "redox_syscall" -version = "0.5.2" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd" +checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.8.0", ] [[package]] name = "redox_users" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ - "getrandom", + "getrandom 0.2.15", "libredox", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -2714,37 +2981,52 @@ checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.98", ] [[package]] name = "regex" -version = "1.10.5" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", - "regex-automata", - "regex-syntax", + "regex-automata 0.4.9", + "regex-syntax 0.8.5", ] [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", - "regex-syntax", + "regex-syntax 0.8.5", ] [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.6.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "rend" @@ -2779,8 +3061,8 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls", - "rustls-pemfile", + "rustls 0.21.12", + "rustls-pemfile 1.0.4", "serde", "serde_json", "serde_urlencoded", @@ -2795,7 +3077,7 @@ dependencies = [ "wasm-bindgen-futures", "wasm-streams", "web-sys", - "webpki-roots", + "webpki-roots 0.25.4", "winreg", ] @@ -2813,7 +3095,7 @@ dependencies = [ "roaring", "rust_decimal", "serde", - "thiserror", + "thiserror 1.0.69", "uuid", ] @@ -2827,7 +3109,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.98", ] [[package]] @@ -2847,24 +3129,23 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.8" +version = "0.17.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +checksum = "e75ec5e92c4d8aede845126adc388046234541629e76029599ed35a003c7ed24" dependencies = [ "cc", "cfg-if", - "getrandom", + "getrandom 0.2.15", "libc", - "spin 0.9.8", "untrusted 0.9.0", "windows-sys 0.52.0", ] [[package]] name = "rkyv" -version = "0.7.44" +version = "0.7.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cba464629b3394fc4dbc6f940ff8f5b4ff5c7aef40f29166fd4ad12acbc99c0" +checksum = "9008cd6385b9e161d8229e1f6549dd23c3d022f132a2ea37ac3a10ac4935779b" dependencies = [ "bitvec", "bytecheck", @@ -2880,9 +3161,9 @@ dependencies = [ [[package]] name = "rkyv_derive" -version = "0.7.44" +version = "0.7.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7dddfff8de25e6f62b9d64e6e432bf1c6736c57d20323e15ee10435fbda7c65" +checksum = "503d1d27590a2b0a3a4ca4c94755aa2875657196ecbf401a42eff41d7de532c0" dependencies = [ "proc-macro2", "quote", @@ -2891,9 +3172,9 @@ dependencies = [ [[package]] name = "roaring" -version = "0.10.6" +version = "0.10.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4b84ba6e838ceb47b41de5194a60244fac43d9fe03b71dbe8c5a201081d6d1" +checksum = "a652edd001c53df0b3f96a36a8dc93fce6866988efc16808235653c6bcac8bf2" dependencies = [ "bytemuck", "byteorder", @@ -2908,9 +3189,9 @@ checksum = "cbf4a6aa5f6d6888f39e980649f3ad6b666acdce1d78e95b8a2cb076e687ae30" [[package]] name = "rsa" -version = "0.9.6" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc" +checksum = "47c75d7c5c6b673e58bf54d8544a9f432e3a925b0e80f7cd3602ab5c50c55519" dependencies = [ "const-oid", "digest", @@ -2919,7 +3200,7 @@ dependencies = [ "num-traits", "pkcs1", "pkcs8", - "rand_core", + "rand_core 0.6.4", "signature", "spki", "subtle", @@ -2949,15 +3230,15 @@ dependencies = [ [[package]] name = "rust_decimal" -version = "1.35.0" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1790d1c4c0ca81211399e0e0af16333276f375209e71a37b67698a373db5b47a" +checksum = "b082d80e3e3cc52b2ed634388d436fe1f4de6af5786cc2de9ba9737527bdf555" dependencies = [ "arrayvec", "borsh", "bytes", "num-traits", - "rand", + "rand 0.8.5", "rkyv", "serde", "serde_json", @@ -2986,24 +3267,24 @@ dependencies = [ [[package]] name = "rustc_version" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ "semver", ] [[package]] name = "rustix" -version = "0.38.34" +version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.8.0", "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3013,11 +3294,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" dependencies = [ "log", - "ring 0.17.8", - "rustls-webpki", + "ring 0.17.9", + "rustls-webpki 0.101.7", "sct", ] +[[package]] +name = "rustls" +version = "0.23.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47796c98c480fce5406ef69d1c76378375492c3b0a0de587be0c1d9feb12f395" +dependencies = [ + "once_cell", + "ring 0.17.9", + "rustls-pki-types", + "rustls-webpki 0.102.8", + "subtle", + "zeroize", +] + [[package]] name = "rustls-pemfile" version = "1.0.4" @@ -3027,27 +3322,53 @@ dependencies = [ "base64 0.21.7", ] +[[package]] +name = "rustls-pemfile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "917ce264624a4b4db1c364dcc35bfca9ded014d0a958cd47ad3e960e988ea51c" + [[package]] name = "rustls-webpki" version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring 0.17.8", + "ring 0.17.9", + "untrusted 0.9.0", +] + +[[package]] +name = "rustls-webpki" +version = "0.102.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" +dependencies = [ + "ring 0.17.9", + "rustls-pki-types", "untrusted 0.9.0", ] [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" [[package]] name = "ryu" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +checksum = "6ea1a2d0a644769cc99faa24c3ad26b379b786fe7c36fd3c546254801650e6dd" [[package]] name = "safe-string" @@ -3073,6 +3394,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + [[package]] name = "scopeguard" version = "1.2.0" @@ -3097,7 +3424,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring 0.17.8", + "ring 0.17.9", "untrusted 0.9.0", ] @@ -3109,9 +3436,9 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" [[package]] name = "secp256k1" -version = "0.29.0" +version = "0.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e0cc0f1cf93f4969faf3ea1c7d8a9faed25918d96affa959720823dfe86d4f3" +checksum = "9465315bc9d4566e1724f0fffcbcc446268cb522e60f9a27bcded6b19c108113" dependencies = [ "bitcoin_hashes", "secp256k1-sys", @@ -3119,18 +3446,18 @@ dependencies = [ [[package]] name = "secp256k1-sys" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1433bd67156263443f14d603720b082dd3121779323fce20cba2aa07b874bc1b" +checksum = "d4387882333d3aa8cb20530a17c69a3752e97837832f34f6dccc760e715001d9" dependencies = [ "cc", ] [[package]] name = "semver" -version = "1.0.23" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +checksum = "f79dfe2d285b0488816f30e700a7438c5a73d816b5b7d3ac72fbc48b0d185e03" dependencies = [ "serde", ] @@ -3143,32 +3470,33 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.203" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.203" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" +checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.98", ] [[package]] name = "serde_json" -version = "1.0.118" +version = "1.0.138" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d947f6b3163d8857ea16c4fa0dd4840d52f3041039a85decd46867eb1abef2e4" +checksum = "d434192e7da787e94a6ea7e9670b26a036d0ca41e0b7efb2676dd32bae872949" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.7.1", "itoa", + "memchr", "ryu", "serde", ] @@ -3187,15 +3515,15 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.8.2" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "079f3a42cd87588d924ed95b533f8d30a483388c4e400ab736a7058e34f16169" +checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa" dependencies = [ "base64 0.22.1", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.2.6", + "indexmap 2.7.1", "serde", "serde_derive", "serde_json", @@ -3205,14 +3533,14 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.8.2" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc03aad67c1d26b7de277d51c86892e7d9a0110a2fe44bf6b26cc569fba302d6" +checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.98", ] [[package]] @@ -3237,6 +3565,21 @@ dependencies = [ "digest", ] +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "signal-hook-registry" version = "1.4.2" @@ -3253,32 +3596,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ "digest", - "rand_core", + "rand_core 0.6.4", ] [[package]] name = "simdutf8" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" [[package]] name = "simple_asn1" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" +checksum = "297f631f50729c8c99b84667867963997ec0b50f32b2a7dbcab828ef0541e8bb" dependencies = [ "num-bigint", "num-traits", - "thiserror", + "thiserror 2.0.11", "time", ] [[package]] name = "siphasher" -version = "0.3.11" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" [[package]] name = "slab" @@ -3291,9 +3634,12 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.2" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" +dependencies = [ + "serde", +] [[package]] name = "smol_str" @@ -3334,9 +3680,9 @@ checksum = "1b6b67fb9a61334225b5b790716f609cd58395f895b3fe8b328786812a40bc3b" [[package]] name = "socket2" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" dependencies = [ "libc", "windows-sys 0.52.0", @@ -3344,9 +3690,9 @@ dependencies = [ [[package]] name = "spade" -version = "2.9.0" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f4ec45f91925e2c9ab3b6a857ee9ed36916990df76a1c475d783a328e247cc8" +checksum = "93f5ef1f863aca7d1d7dda7ccfc36a0a4279bd6d3c375176e5e0712e25cb4889" dependencies = [ "hashbrown 0.14.5", "num-traits", @@ -3379,21 +3725,11 @@ dependencies = [ "der", ] -[[package]] -name = "sqlformat" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f895e3734318cc55f1fe66258926c9b910c124d47520339efecbb6c59cec7c1f" -dependencies = [ - "nom", - "unicode_categories", -] - [[package]] name = "sqlx" -version = "0.7.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9a2ccff1a000a5a59cd33da541d9f2fdcd9e6e8229cc200565942bff36d0aaa" +checksum = "4410e73b3c0d8442c5f99b425d7a435b5ee0ae4167b3196771dd3f7a01be745f" dependencies = [ "sqlx-core", "sqlx-macros", @@ -3404,68 +3740,62 @@ dependencies = [ [[package]] name = "sqlx-core" -version = "0.7.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24ba59a9342a3d9bab6c56c118be528b27c9b60e490080e9711a04dccac83ef6" +checksum = "6a007b6936676aa9ab40207cde35daab0a04b823be8ae004368c0793b96a61e0" dependencies = [ - "ahash 0.8.11", - "atoi", - "byteorder", "bytes", "crc", "crossbeam-queue", "either", - "event-listener", - "futures-channel", + "event-listener 5.4.0", "futures-core", "futures-intrusive", "futures-io", "futures-util", + "hashbrown 0.15.2", "hashlink", - "hex", - "indexmap 2.2.6", + "indexmap 2.7.1", "log", "memchr", "once_cell", - "paste", "percent-encoding", - "rustls", - "rustls-pemfile", + "rustls 0.23.23", + "rustls-pemfile 2.2.0", "serde", "serde_json", "sha2", "smallvec", - "sqlformat", - "thiserror", + "thiserror 2.0.11", "tokio", "tokio-stream", "tracing", "url", - "webpki-roots", + "webpki-roots 0.26.8", ] [[package]] name = "sqlx-macros" -version = "0.7.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea40e2345eb2faa9e1e5e326db8c34711317d2b5e08d0d5741619048a803127" +checksum = "3112e2ad78643fef903618d78cf0aec1cb3134b019730edb039b69eaf531f310" dependencies = [ "proc-macro2", "quote", "sqlx-core", "sqlx-macros-core", - "syn 1.0.109", + "syn 2.0.98", ] [[package]] name = "sqlx-macros-core" -version = "0.7.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5833ef53aaa16d860e92123292f1f6a3d53c34ba8b1969f152ef1a7bb803f3c8" +checksum = "4e9f90acc5ab146a99bf5061a7eb4976b573f560bc898ef3bf8435448dd5e7ad" dependencies = [ "dotenvy", "either", - "heck 0.4.1", + "heck 0.5.0", "hex", "once_cell", "proc-macro2", @@ -3477,7 +3807,7 @@ dependencies = [ "sqlx-mysql", "sqlx-postgres", "sqlx-sqlite", - "syn 1.0.109", + "syn 2.0.98", "tempfile", "tokio", "url", @@ -3485,13 +3815,13 @@ dependencies = [ [[package]] name = "sqlx-mysql" -version = "0.7.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ed31390216d20e538e447a7a9b959e06ed9fc51c37b514b46eb758016ecd418" +checksum = "4560278f0e00ce64938540546f59f590d60beee33fffbd3b9cd47851e5fff233" dependencies = [ "atoi", - "base64 0.21.7", - "bitflags 2.5.0", + "base64 0.22.1", + "bitflags 2.8.0", "byteorder", "bytes", "crc", @@ -3512,7 +3842,7 @@ dependencies = [ "memchr", "once_cell", "percent-encoding", - "rand", + "rand 0.8.5", "rsa", "serde", "sha1", @@ -3520,27 +3850,26 @@ dependencies = [ "smallvec", "sqlx-core", "stringprep", - "thiserror", + "thiserror 2.0.11", "tracing", "whoami", ] [[package]] name = "sqlx-postgres" -version = "0.7.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c824eb80b894f926f89a0b9da0c7f435d27cdd35b8c655b114e58223918577e" +checksum = "c5b98a57f363ed6764d5b3a12bfedf62f07aa16e1856a7ddc2a0bb190a959613" dependencies = [ "atoi", - "base64 0.21.7", - "bitflags 2.5.0", + "base64 0.22.1", + "bitflags 2.8.0", "byteorder", "crc", "dotenvy", "etcetera", "futures-channel", "futures-core", - "futures-io", "futures-util", "hex", "hkdf", @@ -3551,23 +3880,23 @@ dependencies = [ "md-5", "memchr", "once_cell", - "rand", + "rand 0.8.5", "serde", "serde_json", "sha2", "smallvec", "sqlx-core", "stringprep", - "thiserror", + "thiserror 2.0.11", "tracing", "whoami", ] [[package]] name = "sqlx-sqlite" -version = "0.7.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b244ef0a8414da0bed4bb1910426e890b19e5e9bccc27ada6b797d05c55ae0aa" +checksum = "f85ca71d3a5b24e64e1d08dd8fe36c6c95c339a896cc33068148906784620540" dependencies = [ "atoi", "flume", @@ -3580,10 +3909,10 @@ dependencies = [ "log", "percent-encoding", "serde", + "serde_urlencoded", "sqlx-core", "tracing", "url", - "urlencoding", ] [[package]] @@ -3594,15 +3923,15 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "stacker" -version = "0.1.15" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c886bd4480155fd3ef527d45e9ac8dd7118a898a46530b7b94c3e21866259fce" +checksum = "1d08feb8f695b465baed819b03c128dc23f57a694510ab1f06c77f763975685e" dependencies = [ "cc", "cfg-if", "libc", "psm", - "winapi", + "windows-sys 0.59.0", ] [[package]] @@ -3620,17 +3949,16 @@ dependencies = [ "byteorder", "memchr", "serde", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "string_cache" -version = "0.8.7" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" +checksum = "938d512196766101d333398efde81bc1f37b00cb42c2f8350e5df639f040bbbe" dependencies = [ "new_debug_unreachable", - "once_cell", "parking_lot", "phf_shared", "precomputed-hash", @@ -3661,9 +3989,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "surrealdb" -version = "1.5.3" +version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31819be880ed2c134afc1350dc29c22b1f1d9b93715d25eac07ba65677235eed" +checksum = "dac5a27c63a05414c1c623e0a5e75969142c4fa157bbe59fa259c620df83d252" dependencies = [ "async-channel", "bincode", @@ -3673,20 +4001,20 @@ dependencies = [ "futures", "futures-concurrency", "geo 0.27.0", - "indexmap 2.2.6", + "indexmap 2.7.1", "once_cell", "path-clean", "pharos", "reqwest", "revision", - "ring 0.17.8", + "ring 0.17.9", "rust_decimal", - "rustls", + "rustls 0.21.12", "semver", "serde", "serde_json", "surrealdb-core", - "thiserror", + "thiserror 1.0.69", "tokio", "tokio-tungstenite", "tracing", @@ -3700,9 +4028,9 @@ dependencies = [ [[package]] name = "surrealdb-core" -version = "1.5.0" +version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d765dbd25b093d89242c4eef253f49d9f026a6acf47b6dee07f86209a78a4080" +checksum = "cd916d013234ff20ea94196a98a0f9d1f1cd85501a5b01c199cd24fa8168afb7" dependencies = [ "addr", "any_ascii", @@ -3737,10 +4065,10 @@ dependencies = [ "pin-project-lite", "quick_cache", "radix_trie", - "rand", + "rand 0.8.5", "regex", "revision", - "ring 0.17.8", + "ring 0.17.9", "roaring", "rust-stemmers", "rust_decimal", @@ -3754,7 +4082,7 @@ dependencies = [ "storekey", "surrealdb-derive", "surrealdb-jsonwebtoken", - "thiserror", + "thiserror 1.0.69", "tokio", "tracing", "trice", @@ -3783,10 +4111,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02d4f759c65df8a8cf2d83c99db7fdd3ae5b8fff05fa7fe69a8612f29dd5f99b" dependencies = [ "base64 0.21.7", - "getrandom", + "getrandom 0.2.15", "hmac", "pem", - "rand", + "rand 0.8.5", "ring 0.16.20", "rsa", "serde", @@ -3808,9 +4136,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.66" +version = "2.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" +checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1" dependencies = [ "proc-macro2", "quote", @@ -3818,23 +4146,22 @@ dependencies = [ ] [[package]] -name = "syn_derive" -version = "0.1.8" +name = "sync_wrapper" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ - "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.98", ] -[[package]] -name = "sync_wrapper" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" - [[package]] name = "system-configuration" version = "0.5.1" @@ -3864,14 +4191,16 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.10.1" +version = "3.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "a40f762a77d2afa88c2d919489e390a12bdd261ed568e60cfa7e48d4e20f0d33" dependencies = [ "cfg-if", - "fastrand 2.1.0", + "fastrand", + "getrandom 0.3.1", + "once_cell", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3887,22 +4216,42 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.61" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc" dependencies = [ - "thiserror-impl", + "thiserror-impl 2.0.11", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.98", ] [[package]] name = "thiserror-impl" -version = "1.0.61" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.98", ] [[package]] @@ -3917,9 +4266,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.36" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" dependencies = [ "deranged", "itoa", @@ -3938,9 +4287,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de" dependencies = [ "num-conv", "time-core", @@ -3955,11 +4304,21 @@ dependencies = [ "crunchy", ] +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + [[package]] name = "tinyvec" -version = "1.6.1" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c55115c6fbe2d2bef26eb09ad74bde02d8255476fc0c7b515ef09fbb35742d82" +checksum = "022db8904dfa342efe721985167e9fcd16c29b226db4397ed752a761cfce81e8" dependencies = [ "tinyvec_macros", ] @@ -3972,21 +4331,20 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.38.0" +version = "1.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" +checksum = "3d61fa4ffa3de412bfea335c6ecff681de2b609ba3c77ef3e00e521813a9ed9e" dependencies = [ "backtrace", "bytes", "libc", "mio", - "num_cpus", "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -4001,13 +4359,13 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.3.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.98", ] [[package]] @@ -4016,15 +4374,15 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls", + "rustls 0.21.12", "tokio", ] [[package]] name = "tokio-stream" -version = "0.1.15" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" dependencies = [ "futures-core", "pin-project-lite", @@ -4039,18 +4397,18 @@ checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" dependencies = [ "futures-util", "log", - "rustls", + "rustls 0.21.12", "tokio", "tokio-rustls", "tungstenite", - "webpki-roots", + "webpki-roots 0.25.4", ] [[package]] name = "tokio-util" -version = "0.7.11" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" dependencies = [ "bytes", "futures-core", @@ -4061,17 +4419,17 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.6" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" [[package]] name = "toml_edit" -version = "0.21.1" +version = "0.22.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" +checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.7.1", "toml_datetime", "winnow", ] @@ -4095,8 +4453,8 @@ dependencies = [ "percent-encoding", "pin-project", "prost", - "rustls", - "rustls-pemfile", + "rustls 0.21.12", + "rustls-pemfile 1.0.4", "tokio", "tokio-rustls", "tokio-stream", @@ -4116,7 +4474,7 @@ dependencies = [ "proc-macro2", "prost-build", "quote", - "syn 2.0.66", + "syn 2.0.98", ] [[package]] @@ -4130,7 +4488,7 @@ dependencies = [ "indexmap 1.9.3", "pin-project", "pin-project-lite", - "rand", + "rand 0.8.5", "slab", "tokio", "tokio-util", @@ -4141,21 +4499,21 @@ dependencies = [ [[package]] name = "tower-layer" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" [[package]] name = "tower-service" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "log", "pin-project-lite", @@ -4165,22 +4523,52 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.98", ] [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ + "matchers", + "nu-ansi-term", "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", ] [[package]] @@ -4212,10 +4600,10 @@ dependencies = [ "http", "httparse", "log", - "rand", - "rustls", + "rand 0.8.5", + "rustls 0.21.12", "sha1", - "thiserror", + "thiserror 1.0.69", "url", "utf-8", ] @@ -4240,91 +4628,75 @@ dependencies = [ [[package]] name = "ulid" -version = "1.1.2" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34778c17965aa2a08913b57e1f34db9b4a63f5de31768b55bf20d2795f921259" +checksum = "ab82fc73182c29b02e2926a6df32f2241dbadb5cfc111fd595515b3598f46bb3" dependencies = [ - "getrandom", - "rand", + "rand 0.9.0", "serde", "web-time", ] [[package]] name = "unicase" -version = "2.7.0" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" -dependencies = [ - "version_check", -] +checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" [[package]] name = "unicode-bidi" -version = "0.3.15" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "a210d160f08b701c8721ba1c726c11662f877ea6b7094007e1ca9a1041945034" [[package]] name = "unicode-normalization" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" dependencies = [ "tinyvec", ] [[package]] name = "unicode-properties" -version = "0.1.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4259d9d4425d9f0661581b804cb85fe66a4c631cadd8f490d1c13a35d5d9291" +checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" [[package]] name = "unicode-script" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad8d71f5726e5f285a935e9fe8edfd53f0491eb6e9a5774097fdabee7cd8c9cd" +checksum = "9fb421b350c9aff471779e262955939f565ec18b86c15364e6bdf0d662ca7c1f" [[package]] name = "unicode-security" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee9e13753df674873f3c4693b240ae5c03245ddc157dfccf7c26db9329af3a11" +checksum = "2e4ddba1535dd35ed8b61c52166b7155d7f4e4b8847cec6f48e71dc66d8b5e50" dependencies = [ "unicode-normalization", "unicode-script", ] -[[package]] -name = "unicode-segmentation" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" - [[package]] name = "unicode-width" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - -[[package]] -name = "unicode_categories" -version = "0.1.1" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" [[package]] name = "untrusted" @@ -4340,9 +4712,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.2" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", "idna", @@ -4361,17 +4733,36 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "uuid" -version = "1.9.1" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de17fd2f7da591098415cff336e12965a28061ddace43b59cb3c430179c9439" +checksum = "ced87ca4be083373936a67f8de945faa23b6b42384bd5b64434850802c6dccd0" dependencies = [ - "getrandom", + "getrandom 0.3.1", + "js-sys", "serde", "wasm-bindgen", ] +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + [[package]] name = "vcpkg" version = "0.2.15" @@ -4380,15 +4771,9 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "waker-fn" -version = "1.2.0" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "walkdir" @@ -4415,6 +4800,15 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasi" +version = "0.13.3+wasi-0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2" +dependencies = [ + "wit-bindgen-rt", +] + [[package]] name = "wasite" version = "0.1.0" @@ -4423,46 +4817,48 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", + "once_cell", + "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.98", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.42" +version = "0.4.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" +checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" dependencies = [ "cfg-if", "js-sys", + "once_cell", "wasm-bindgen", "web-sys", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4470,28 +4866,31 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.98", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] [[package]] name = "wasm-streams" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b65dc4c90b63b118468cf747d8bf3566c1913ef60be765b5730ead9e0a3ba129" +checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65" dependencies = [ "futures-util", "js-sys", @@ -4502,9 +4901,9 @@ dependencies = [ [[package]] name = "wasmtimer" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f656cd8858a5164932d8a90f936700860976ec21eb00e0fe2aa8cab13f6b4cf" +checksum = "c7ed9d8b15c7fb594d72bfb4b5a276f3d2029333cd93a932f376f5937f6f80ee" dependencies = [ "futures", "js-sys", @@ -4515,9 +4914,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.69" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" dependencies = [ "js-sys", "wasm-bindgen", @@ -4539,13 +4938,22 @@ version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" +[[package]] +name = "webpki-roots" +version = "0.26.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2210b291f7ea53617fbafcc4939f10914214ec15aace5ba62293a668f322c5c9" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "whoami" -version = "1.5.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44ab49fad634e88f55bf8f9bb3abd2f27d7204172a112c7c9987e01c1c94ea9" +checksum = "372d5b87f58ec45c384ba03563b03544dc5fadc3983e434b286913f5b4a9bb6d" dependencies = [ - "redox_syscall 0.4.1", + "redox_syscall", "wasite", ] @@ -4567,11 +4975,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -4580,13 +4988,22 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +dependencies = [ + "windows-targets 0.48.5", +] + [[package]] name = "windows-core" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -4604,7 +5021,16 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", ] [[package]] @@ -4624,18 +5050,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.5", - "windows_aarch64_msvc 0.52.5", - "windows_i686_gnu 0.52.5", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.5", - "windows_x86_64_gnu 0.52.5", - "windows_x86_64_gnullvm 0.52.5", - "windows_x86_64_msvc 0.52.5", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -4646,9 +5072,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -4658,9 +5084,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -4670,15 +5096,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -4688,9 +5114,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -4700,9 +5126,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -4712,9 +5138,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" @@ -4724,15 +5150,15 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.5.40" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +checksum = "59690dea168f2198d1a3b0cac23b8063efcd11012f10ae4698f284808c8ef603" dependencies = [ "memchr", ] @@ -4747,6 +5173,27 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "wit-bindgen-rt" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c" +dependencies = [ + "bitflags 2.8.0", +] + +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + [[package]] name = "ws_stream_wasm" version = "0.7.4" @@ -4760,7 +5207,7 @@ dependencies = [ "pharos", "rustc_version", "send_wrapper", - "thiserror", + "thiserror 1.0.69", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -4775,13 +5222,47 @@ dependencies = [ "tap", ] +[[package]] +name = "yoke" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.98", + "synstructure", +] + [[package]] name = "zerocopy" version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive", + "byteorder", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy" +version = "0.8.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79386d31a42a4996e3336b0919ddb90f81112af416270cff95b5f5af22b839c2" +dependencies = [ + "zerocopy-derive 0.8.18", ] [[package]] @@ -4792,7 +5273,39 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.98", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76331675d372f91bf8d17e13afbd5fe639200b73d01f0fc748bb059f9cca2db7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.98", +] + +[[package]] +name = "zerofrom" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.98", + "synstructure", ] [[package]] @@ -4800,3 +5313,25 @@ name = "zeroize" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.98", +] diff --git a/Cargo.toml b/Cargo.toml index 504e1c9..4130360 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,5 +34,5 @@ chrono = "0.4" currencies = "0.4.1" cqrs-es = "0.4.11" tokio = { version = "1.38.0", features = ["full"] } -sqlx = { version = "0.7", features = ["postgres", "json"] } +sqlx = { version = "0.8", features = ["postgres", "json"] } futures = "0.3.30" diff --git a/payday_node_lnd/src/wrapper.rs b/payday_node_lnd/src/wrapper.rs index 37905d8..c0599c8 100644 --- a/payday_node_lnd/src/wrapper.rs +++ b/payday_node_lnd/src/wrapper.rs @@ -4,7 +4,7 @@ //! handles connection and network checks, maps errors to project //! specific errors, and provides a convenient interface for the //! operations needed for invoicing. -use std::{collections::HashMap, sync::Arc}; +use std::{collections::HashMap, f32::consts::E, sync::Arc}; use bitcoin::{hex::DisplayHex, Address, Amount, Network}; use fedimint_tonic_lnd::{ @@ -52,8 +52,7 @@ impl LndRpcWrapper { .network .to_string(); - let network = Network::from_core_arg(network_info.as_str())?; - if config.network != network { + if config.network != network_from_str(&network_info)? { return Err(PaydayError::InvalidBitcoinNetwork(network_info)); } Ok(Self { @@ -257,3 +256,14 @@ impl LndRpcWrapper { .transactions) } } + +fn network_from_str(s: &str) -> PaydayResult { + let net = match s { + "mainnet" => Network::Bitcoin, + "testnet" => Network::Testnet, + "regtest" => Network::Regtest, + "signet" => Network::Signet, + _ => Err(PaydayError::InvalidBitcoinNetwork(s.to_string()))?, + }; + Ok(net) +} diff --git a/src/main.rs b/src/main.rs index 6b7c42e..ef5f098 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,13 +31,13 @@ struct TestPayload { sequence: u64, } -#[tokio::main(flavor = "multi_thread", worker_threads = 4)] +#[tokio::main] async fn main() -> PaydayResult<()> { let lnd_config = LndConfig { name: "payday".to_string(), - address: "https://localhost:10009".to_string(), - cert_path: "/home/protom/dev/btc/payday_rs/tls.cert".to_string(), - macaroon_file: "/home/protom/dev/btc/payday_rs/admin.macaroon".to_string(), + address: "https://tbc-mutiny.u.voltageapp.io:10009".to_string(), + cert_path: "tls.cert".to_string(), + macaroon_file: "admin.macaroon".to_string(), network: Network::Signet, }; let lnd = Lnd::new(lnd_config.clone()).await?; @@ -59,54 +59,54 @@ async fn main() -> PaydayResult<()> { let balance = lnd.get_onchain_balance().await?; println!("{:?}", balance); - let db = create_surreal_db("ws://localhost:8000", "payday", "payday").await?; - let block_height_store = BlockHeightStore::new(db.clone()); - let processor = OnChainTransactionProcessor::new( - "lnd", - Box::new(block_height_store), - Box::new(OnChainTransactionPrintHandler), - ); - let stream = - LndTransactionStream::new(lnd_config.clone(), Arc::new(Mutex::new(processor)), None); - let handle = stream.process_events().await?; + // let db = create_surreal_db("ws://localhost:8000", "payday", "payday").await?; + // let block_height_store = BlockHeightStore::new(db.clone()); + // let processor = OnChainTransactionProcessor::new( + // "lnd", + // Box::new(block_height_store), + // Box::new(OnChainTransactionPrintHandler), + // ); + // let stream = + // LndTransactionStream::new(lnd_config.clone(), Arc::new(Mutex::new(processor)), None); + // let handle = stream.process_events().await?; //let publisher = EventStream::new(db.clone(), "events"); - let publisher = SurrealTaskQueue::new(db.clone(), "tasks"); + // let publisher = SurrealTaskQueue::new(db.clone(), "tasks"); //let publish_handle = publisher.subscribe().await?; - tokio::time::sleep(Duration::from_secs(2)).await; - - let processor = SurrealTaskProcessor::new( - db.clone(), - "tasks", - vec![Arc::new(Mutex::new(PrintTaskHandler))], - ); - - let processor_handle = processor.process().await?; - - let task_payload = Task::new( - "anewone".to_owned(), - TestPayload { - name: "anothe test".to_string(), - processed: true, - sequence: 1, - }, - ); - - publisher.publish(task_payload).await?; - - let retry_task = Task::new( - "a retry task".to_owned(), - TestPayload { - name: "retry task".to_string(), - processed: false, - sequence: 2, - }, - ); - - publisher.publish(retry_task.clone()).await?; - publisher - .retry(retry_task, RetryType::Fixed(3, Duration::from_secs(5))) - .await?; + // tokio::time::sleep(Duration::from_secs(2)).await; + + // let processor = SurrealTaskProcessor::new( + // db.clone(), + // "tasks", + // vec![Arc::new(Mutex::new(PrintTaskHandler))], + // ); + // + // let processor_handle = processor.process().await?; + // + // let task_payload = Task::new( + // "anewone".to_owned(), + // TestPayload { + // name: "anothe test".to_string(), + // processed: true, + // sequence: 1, + // }, + // ); + // + // publisher.publish(task_payload).await?; + // + // let retry_task = Task::new( + // "a retry task".to_owned(), + // TestPayload { + // name: "retry task".to_string(), + // processed: false, + // sequence: 2, + // }, + // ); + // + // publisher.publish(retry_task.clone()).await?; + // publisher + // .retry(retry_task, RetryType::Fixed(3, Duration::from_secs(5))) + // .await?; //let outputs = HashMap::from([ // ( @@ -135,7 +135,7 @@ async fn main() -> PaydayResult<()> { //for event in pending { // println!("Pending: {:?}", event); //} - let (_, _) = tokio::join!(handle, processor_handle); + //let (_, _) = tokio::join!(handle, processor_handle); //handle.await.expect("could not subscribe to onchain stream"); //bind.await.expect("done subscriber"); println!("Done"); From 818fbcc5c53bd75807806c76b136bbf5a76d6ae6 Mon Sep 17 00:00:00 2001 From: tompro Date: Tue, 18 Feb 2025 11:24:15 +0100 Subject: [PATCH 3/7] Refactor types --- payday_btc/src/lib.rs | 5 +- payday_btc/src/on_chain_aggregate.rs | 9 ++- payday_btc/src/on_chain_processor.rs | 58 ++++------------ payday_core/src/api/lightining_api.rs | 22 +++++++ payday_core/src/api/mod.rs | 2 + .../src/api}/on_chain_api.rs | 66 ++++++++++++++----- payday_core/src/error.rs | 22 +++---- payday_core/src/lib.rs | 5 +- payday_core/src/payment/invoice.rs | 20 +++--- payday_core/src/persistence/block_height.rs | 6 +- payday_node_lnd/src/lnd.rs | 41 +++++------- payday_node_lnd/src/wrapper.rs | 56 ++++++++-------- payday_postgres/src/block_height.rs | 14 ++-- payday_postgres/src/btc_onchain.rs | 32 ++++----- payday_postgres/src/lib.rs | 8 +-- payday_surrealdb/src/block_height.rs | 14 ++-- payday_surrealdb/src/event_stream.rs | 7 +- payday_surrealdb/src/lib.rs | 12 ++-- payday_surrealdb/src/task.rs | 5 +- src/main.rs | 26 ++------ 20 files changed, 211 insertions(+), 219 deletions(-) create mode 100644 payday_core/src/api/lightining_api.rs create mode 100644 payday_core/src/api/mod.rs rename {payday_btc/src => payday_core/src/api}/on_chain_api.rs (51%) diff --git a/payday_btc/src/lib.rs b/payday_btc/src/lib.rs index 5ad7527..41a2315 100644 --- a/payday_btc/src/lib.rs +++ b/payday_btc/src/lib.rs @@ -1,14 +1,13 @@ pub mod on_chain_aggregate; -pub mod on_chain_api; pub mod on_chain_processor; use std::str::FromStr; use bitcoin::{Address, Network}; -use payday_core::PaydayResult; +use payday_core::Result; /// Given a Bitcoin address string and a network, parses and validates the address. /// Returns a checked address result. -pub fn to_address(addr: &str, network: Network) -> PaydayResult
{ +pub fn to_address(addr: &str, network: Network) -> Result
{ Ok(Address::from_str(addr)?.require_network(network)?) } diff --git a/payday_btc/src/on_chain_aggregate.rs b/payday_btc/src/on_chain_aggregate.rs index a46f259..990d96f 100644 --- a/payday_btc/src/on_chain_aggregate.rs +++ b/payday_btc/src/on_chain_aggregate.rs @@ -1,12 +1,11 @@ use async_trait::async_trait; use cqrs_es::{Aggregate, DomainEvent}; +use payday_core::api::on_chain_api::OnChainTransactionEvent; use payday_core::payment::amount::Amount; use payday_core::payment::currency::Currency; -use payday_core::payment::invoice::{InvoiceError, InvoiceId}; +use payday_core::payment::invoice::{Error, InvoiceId}; use serde::{Deserialize, Serialize}; -use crate::on_chain_processor::OnChainTransactionEvent; - #[derive(Debug, Clone, Serialize, Deserialize)] pub struct BtcOnChainInvoice { pub invoice_id: InvoiceId, @@ -143,7 +142,7 @@ impl DomainEvent for OnChainInvoiceEvent { impl Aggregate for BtcOnChainInvoice { type Command = OnChainInvoiceCommand; type Event = OnChainInvoiceEvent; - type Error = InvoiceError; + type Error = Error; type Services = (); fn aggregate_type() -> String { @@ -162,7 +161,7 @@ impl Aggregate for BtcOnChainInvoice { address, } => { if amount.currency != Currency::Btc { - return Err(InvoiceError::InvalidCurrency( + return Err(Error::InvalidCurrency( amount.currency.to_string(), Currency::Btc.to_string(), )); diff --git a/payday_btc/src/on_chain_processor.rs b/payday_btc/src/on_chain_processor.rs index ea58a10..77a3f5c 100644 --- a/payday_btc/src/on_chain_processor.rs +++ b/payday_btc/src/on_chain_processor.rs @@ -1,50 +1,16 @@ use std::sync::Arc; use async_trait::async_trait; -use bitcoin::{Address, Amount}; -use payday_core::{persistence::block_height::BlockHeightStoreApi, PaydayResult}; +use payday_core::{ + api::on_chain_api::{ + OnChainTransactionEvent, OnChainTransactionEventHandler, + OnChainTransactionEventProcessorApi, + }, + persistence::block_height::BlockHeightStoreApi, + Result, +}; use tokio::sync::Mutex; -#[async_trait] -pub trait OnChainTransactionEventProcessorApi: Send + Sync { - fn node_id(&self) -> String; - async fn get_block_height(&self) -> PaydayResult; - async fn set_block_height(&self, block_height: i32) -> PaydayResult<()>; - async fn process_event(&self, event: OnChainTransactionEvent) -> PaydayResult<()>; -} - -#[async_trait] -pub trait OnChainTransactionEventHandler: Send + Sync { - async fn process_event(&self, event: OnChainTransactionEvent) -> PaydayResult<()>; -} - -#[derive(Debug)] -pub enum OnChainTransactionEvent { - ReceivedUnconfirmed(OnChainTransaction), - ReceivedConfirmed(OnChainTransaction), - SentUnconfirmed(OnChainTransaction), - SentConfirmed(OnChainTransaction), -} - -impl OnChainTransactionEvent { - pub fn block_height(&self) -> Option { - match self { - OnChainTransactionEvent::ReceivedConfirmed(tx) => Some(tx.block_height), - OnChainTransactionEvent::SentConfirmed(tx) => Some(tx.block_height), - _ => None, - } - } -} - -#[derive(Debug, Clone)] -pub struct OnChainTransaction { - pub tx_id: String, - pub block_height: i32, - pub address: Address, - pub amount: Amount, - pub confirmations: i32, -} - pub struct OnChainTransactionProcessor { node_id: String, block_height_store: Box, @@ -72,7 +38,7 @@ impl OnChainTransactionEventProcessorApi for OnChainTransactionProcessor { fn node_id(&self) -> String { self.node_id.to_string() } - async fn get_block_height(&self) -> PaydayResult { + async fn get_block_height(&self) -> Result { let mut current_block_height = self.current_block_height.lock().await; if *current_block_height < 0 { *current_block_height = self @@ -83,7 +49,7 @@ impl OnChainTransactionEventProcessorApi for OnChainTransactionProcessor { } Ok(*current_block_height) } - async fn set_block_height(&self, block_height: i32) -> PaydayResult<()> { + async fn set_block_height(&self, block_height: i32) -> Result<()> { let mut current_block_height = self.current_block_height.lock().await; if *current_block_height < block_height { self.block_height_store @@ -93,7 +59,7 @@ impl OnChainTransactionEventProcessorApi for OnChainTransactionProcessor { } Ok(()) } - async fn process_event(&self, event: OnChainTransactionEvent) -> PaydayResult<()> { + async fn process_event(&self, event: OnChainTransactionEvent) -> Result<()> { let block_height = event.block_height(); self.handler.process_event(event).await?; if let Some(bh) = block_height { @@ -107,7 +73,7 @@ pub struct OnChainTransactionPrintHandler; #[async_trait] impl OnChainTransactionEventHandler for OnChainTransactionPrintHandler { - async fn process_event(&self, event: OnChainTransactionEvent) -> PaydayResult<()> { + async fn process_event(&self, event: OnChainTransactionEvent) -> Result<()> { println!("OnChainEventTransactionEvent: {:?}", event); Ok(()) } diff --git a/payday_core/src/api/lightining_api.rs b/payday_core/src/api/lightining_api.rs new file mode 100644 index 0000000..c12afe0 --- /dev/null +++ b/payday_core/src/api/lightining_api.rs @@ -0,0 +1,22 @@ +use crate::{payment::amount::Amount, Result}; +use async_trait::async_trait; + +#[async_trait] +pub trait GetLightningBalanceApi: Send + Sync { + /// Get the current OnChain balance of the wallet. + async fn get_onchain_balance(&self) -> Result; +} + +#[async_trait] +pub trait LightningInvoiceApi: Send + Sync { + /// Get a new onchain address for the wallet. + async fn create_invoice(&self) -> Result; +} + +pub struct LnInvoice; + +#[derive(Debug)] +pub struct ChannelBalance { + pub local_balance: Amount, + pub remote_balance: Amount, +} diff --git a/payday_core/src/api/mod.rs b/payday_core/src/api/mod.rs new file mode 100644 index 0000000..9684297 --- /dev/null +++ b/payday_core/src/api/mod.rs @@ -0,0 +1,2 @@ +pub mod lightining_api; +pub mod on_chain_api; diff --git a/payday_btc/src/on_chain_api.rs b/payday_core/src/api/on_chain_api.rs similarity index 51% rename from payday_btc/src/on_chain_api.rs rename to payday_core/src/api/on_chain_api.rs index 7a05390..f27c5e8 100644 --- a/payday_btc/src/on_chain_api.rs +++ b/payday_core/src/api/on_chain_api.rs @@ -1,36 +1,36 @@ use std::collections::HashMap; +use crate::Result; use async_trait::async_trait; use bitcoin::{Address, Amount}; -use payday_core::PaydayResult; use tokio::task::JoinHandle; -use crate::on_chain_processor::OnChainTransactionEvent; +use super::lightining_api::ChannelBalance; #[async_trait] pub trait GetOnChainBalanceApi: Send + Sync { /// Get the current OnChain balance of the wallet. - async fn get_onchain_balance(&self) -> PaydayResult; + async fn get_onchain_balance(&self) -> Result; } #[async_trait] pub trait OnChainInvoiceApi: Send + Sync { /// Get a new onchain address for the wallet. - async fn new_address(&self) -> PaydayResult
; + async fn new_address(&self) -> Result
; } #[async_trait] pub trait OnChainPaymentApi: Send + Sync { /// Given an onchain address string, parses and validates that it is a valid /// address for this nodes network. - fn validate_address(&self, address: &str) -> PaydayResult
; + fn validate_address(&self, address: &str) -> Result
; /// Estimate the fee for a transaction. async fn estimate_fee( &self, target_conf: i32, outputs: HashMap, - ) -> PaydayResult; + ) -> Result; /// Send coins to an address. async fn send( @@ -38,14 +38,14 @@ pub trait OnChainPaymentApi: Send + Sync { amount: Amount, address: String, sats_per_vbyte: Amount, - ) -> PaydayResult; + ) -> Result; /// Send coins to multiple addresses. async fn batch_send( &self, outputs: HashMap, sats_per_vbyte: Amount, - ) -> PaydayResult; + ) -> Result; } #[async_trait] @@ -55,12 +55,25 @@ pub trait OnChainTransactionApi: Send + Sync { &self, start_height: i32, end_height: i32, - ) -> PaydayResult>; + ) -> Result>; } #[async_trait] pub trait OnChainStreamApi: Send + Sync { - async fn process_events(&self) -> PaydayResult>; + async fn process_events(&self) -> Result>; +} + +#[async_trait] +pub trait OnChainTransactionEventProcessorApi: Send + Sync { + fn node_id(&self) -> String; + async fn get_block_height(&self) -> Result; + async fn set_block_height(&self, block_height: i32) -> Result<()>; + async fn process_event(&self, event: OnChainTransactionEvent) -> Result<()>; +} + +#[async_trait] +pub trait OnChainTransactionEventHandler: Send + Sync { + async fn process_event(&self, event: OnChainTransactionEvent) -> Result<()>; } #[derive(Debug)] @@ -70,12 +83,6 @@ pub struct OnChainBalance { pub confirmed_balance: Amount, } -#[derive(Debug)] -pub struct ChannelBalance { - pub local_balance: Amount, - pub remote_balance: Amount, -} - #[derive(Debug)] pub struct Balance { pub onchain: OnChainBalance, @@ -88,3 +95,30 @@ pub struct OnChainPaymentResult { pub amounts: HashMap, pub fee: Amount, } + +#[derive(Debug)] +pub enum OnChainTransactionEvent { + ReceivedUnconfirmed(OnChainTransaction), + ReceivedConfirmed(OnChainTransaction), + SentUnconfirmed(OnChainTransaction), + SentConfirmed(OnChainTransaction), +} + +impl OnChainTransactionEvent { + pub fn block_height(&self) -> Option { + match self { + OnChainTransactionEvent::ReceivedConfirmed(tx) => Some(tx.block_height), + OnChainTransactionEvent::SentConfirmed(tx) => Some(tx.block_height), + _ => None, + } + } +} + +#[derive(Debug, Clone)] +pub struct OnChainTransaction { + pub tx_id: String, + pub block_height: i32, + pub address: Address, + pub amount: Amount, + pub confirmations: i32, +} diff --git a/payday_core/src/error.rs b/payday_core/src/error.rs index a10c69e..9870554 100644 --- a/payday_core/src/error.rs +++ b/payday_core/src/error.rs @@ -5,7 +5,7 @@ use bitcoin::network::ParseNetworkError; use crate::events::MessageError; #[derive(Debug)] -pub enum PaydayError { +pub enum Error { NodeConnectError(String), NodeApiError(String), DbError(String), @@ -15,34 +15,34 @@ pub enum PaydayError { EventError(String), } -impl From for PaydayError { +impl From for Error { fn from(value: ParseNetworkError) -> Self { - PaydayError::InvalidBitcoinNetwork(value.to_string()) + Error::InvalidBitcoinNetwork(value.to_string()) } } -impl From for PaydayError { +impl From for Error { fn from(value: ParseError) -> Self { - PaydayError::InvalidBitcoinAddress(value.to_string()) + Error::InvalidBitcoinAddress(value.to_string()) } } -impl From for PaydayError { +impl From for Error { fn from(value: ParseAmountError) -> Self { - PaydayError::InvalidBitcoinAmount(value.to_string()) + Error::InvalidBitcoinAmount(value.to_string()) } } -impl From for PaydayError { +impl From for Error { fn from(value: MessageError) -> Self { match value { MessageError::PublishError(m) => { - PaydayError::EventError(format!("unable to publish event: {}", m)) + Error::EventError(format!("unable to publish event: {}", m)) } MessageError::SubscribeError(m) => { - PaydayError::EventError(format!("unable to subscribe event stream: {}", m)) + Error::EventError(format!("unable to subscribe event stream: {}", m)) } MessageError::ConfirmError(m) => { - PaydayError::EventError(format!("unable to confirm event processing: {}", m)) + Error::EventError(format!("unable to confirm event processing: {}", m)) } } } diff --git a/payday_core/src/lib.rs b/payday_core/src/lib.rs index 0d21654..4c3fe17 100644 --- a/payday_core/src/lib.rs +++ b/payday_core/src/lib.rs @@ -2,13 +2,14 @@ use std::pin::Pin; use tokio_stream::Stream; -pub use error::PaydayError; +pub use error::Error; +pub mod api; pub mod date; pub mod error; pub mod events; pub mod payment; pub mod persistence; -pub type PaydayResult = Result; +pub type Result = std::result::Result; pub type PaydayStream = Pin>>; diff --git a/payday_core/src/payment/invoice.rs b/payday_core/src/payment/invoice.rs index cd2befa..2aa1754 100644 --- a/payday_core/src/payment/invoice.rs +++ b/payday_core/src/payment/invoice.rs @@ -4,31 +4,31 @@ use async_trait::async_trait; use serde::{Deserialize, Serialize}; use serde_json::Value; -use crate::{payment::amount::Amount, PaydayResult}; +use crate::payment::amount::Amount; pub type InvoiceId = String; pub type PaymentType = String; -pub type InvoiceResult = Result; +pub type Result = std::result::Result; #[derive(Debug, Clone)] -pub enum InvoiceError { +pub enum Error { InvalidAmount(Amount), InvalidCurrency(String, String), ServiceError(String), } -impl std::error::Error for InvoiceError {} +impl std::error::Error for Error {} -impl Display for InvoiceError { +impl Display for Error { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { - InvoiceError::InvalidAmount(a) => write!(f, "Invoice invalid amount: {}", a), - InvoiceError::InvalidCurrency(required, received) => write!( + Error::InvalidAmount(a) => write!(f, "Invoice invalid amount: {}", a), + Error::InvalidCurrency(required, received) => write!( f, "Invoice invalid currency required: {} received: {}", required, received ), - InvoiceError::ServiceError(err) => write!(f, "Invoice service error: {}", err), + Error::ServiceError(err) => write!(f, "Invoice service error: {}", err), } } } @@ -56,10 +56,10 @@ pub trait PaymentProcessorApi: Send + Sync { invoice_id: InvoiceId, amount: Amount, memo: Option, - ) -> PaydayResult; + ) -> crate::Result; /// Processes payment events for this system. - async fn process_payment_events(&self) -> PaydayResult<()>; + async fn process_payment_events(&self) -> crate::Result<()>; } #[derive(Debug, Clone, Serialize, Deserialize)] diff --git a/payday_core/src/persistence/block_height.rs b/payday_core/src/persistence/block_height.rs index f522f72..d25da51 100644 --- a/payday_core/src/persistence/block_height.rs +++ b/payday_core/src/persistence/block_height.rs @@ -1,12 +1,12 @@ use async_trait::async_trait; use serde::{Deserialize, Serialize}; -use crate::PaydayResult; +use crate::Result; #[async_trait] pub trait BlockHeightStoreApi: Send + Sync { - async fn get_block_height(&self, node_id: &str) -> PaydayResult; - async fn set_block_height(&self, node_id: &str, block_height: u64) -> PaydayResult<()>; + async fn get_block_height(&self, node_id: &str) -> Result; + async fn set_block_height(&self, node_id: &str, block_height: u64) -> Result<()>; } #[derive(Debug, Clone, Serialize, Deserialize)] diff --git a/payday_node_lnd/src/lnd.rs b/payday_node_lnd/src/lnd.rs index 0091e48..c917e10 100644 --- a/payday_node_lnd/src/lnd.rs +++ b/payday_node_lnd/src/lnd.rs @@ -7,17 +7,15 @@ use fedimint_tonic_lnd::{ lnrpc::{GetTransactionsRequest, Transaction}, Client, }; -use payday_btc::{ - on_chain_api::{ +use payday_btc::to_address; +use payday_core::{ + api::on_chain_api::{ GetOnChainBalanceApi, OnChainBalance, OnChainInvoiceApi, OnChainPaymentApi, - OnChainPaymentResult, OnChainStreamApi, OnChainTransactionApi, + OnChainPaymentResult, OnChainStreamApi, OnChainTransaction, OnChainTransactionApi, + OnChainTransactionEvent, OnChainTransactionEventProcessorApi, }, - on_chain_processor::{ - OnChainTransaction, OnChainTransactionEvent, OnChainTransactionEventProcessorApi, - }, - to_address, + Result, }; -use payday_core::PaydayResult; use tokio::{sync::Mutex, task::JoinHandle}; use tokio_stream::StreamExt; @@ -29,7 +27,7 @@ pub struct Lnd { } impl Lnd { - pub async fn new(config: LndConfig) -> PaydayResult { + pub async fn new(config: LndConfig) -> Result { let client = LndRpcWrapper::new(config.clone()).await?; Ok(Self { config, client }) } @@ -37,7 +35,7 @@ impl Lnd { #[async_trait] impl GetOnChainBalanceApi for Lnd { - async fn get_onchain_balance(&self) -> PaydayResult { + async fn get_onchain_balance(&self) -> Result { let res = self.client.get_onchain_balance().await?; Ok(OnChainBalance { total_balance: to_amount(res.total_balance), @@ -49,14 +47,14 @@ impl GetOnChainBalanceApi for Lnd { #[async_trait] impl OnChainInvoiceApi for Lnd { - async fn new_address(&self) -> PaydayResult
{ + async fn new_address(&self) -> Result
{ self.client.new_address().await } } #[async_trait] impl OnChainPaymentApi for Lnd { - fn validate_address(&self, address: &str) -> PaydayResult
{ + fn validate_address(&self, address: &str) -> Result
{ to_address(address, self.config.network) } @@ -64,7 +62,7 @@ impl OnChainPaymentApi for Lnd { &self, target_conf: i32, outputs: HashMap, - ) -> PaydayResult { + ) -> Result { let out = outputs .iter() .map(|p| (p.0.to_owned(), p.1.to_sat() as i64)) @@ -78,7 +76,7 @@ impl OnChainPaymentApi for Lnd { amount: Amount, address: String, sats_per_vbyte: Amount, - ) -> PaydayResult { + ) -> Result { let tx_id = self .client .send_coins(amount, &address, sats_per_vbyte) @@ -95,7 +93,7 @@ impl OnChainPaymentApi for Lnd { &self, outputs: HashMap, sats_per_vbyte: Amount, - ) -> PaydayResult { + ) -> Result { let out = outputs .iter() .flat_map(|(k, v)| { @@ -122,7 +120,7 @@ impl OnChainTransactionApi for Lnd { &self, start_height: i32, end_height: i32, - ) -> PaydayResult> { + ) -> Result> { let result = self .client .get_transactions(start_height, end_height) @@ -154,10 +152,7 @@ fn to_amount(sats: i64) -> Amount { } /// Converts a Transaction to a list of OnChainTransactionEvents. -fn to_on_chain_events( - tx: &Transaction, - chain: Network, -) -> PaydayResult> { +fn to_on_chain_events(tx: &Transaction, chain: Network) -> Result> { let received = tx.amount > 0; let confirmed = tx.num_confirmations > 0; @@ -216,7 +211,7 @@ impl LndTransactionStream { } /// does fetch potential missing events from the current start_height - async fn start_subscription(&self) -> PaydayResult> { + async fn start_subscription(&self) -> Result> { let lnd = Lnd::new(self.config.clone()).await?; let start_height = match self.start_height { Some(start_height) => start_height, @@ -230,7 +225,7 @@ impl LndTransactionStream { #[async_trait] impl OnChainStreamApi for LndTransactionStream { - async fn process_events(&self) -> PaydayResult> { + async fn process_events(&self) -> Result> { let start_events = self.start_subscription().await.ok().unwrap_or(vec![]); for event in start_events { self.handler.lock().await.process_event(event).await?; @@ -286,7 +281,7 @@ impl OnChainStreamApi for LndTransactionStream { //} // //impl OnChainTransactionStreamSubscriber for LndOnChainPaymentEventStream { -// fn subscribe_events(&self) -> PaydayResult> { +// fn subscribe_events(&self) -> Result> { // let config = self.config.clone(); // let (tx, rx) = tokio::sync::mpsc::channel::(100); // diff --git a/payday_node_lnd/src/wrapper.rs b/payday_node_lnd/src/wrapper.rs index c0599c8..b3f059e 100644 --- a/payday_node_lnd/src/wrapper.rs +++ b/payday_node_lnd/src/wrapper.rs @@ -4,7 +4,7 @@ //! handles connection and network checks, maps errors to project //! specific errors, and provides a convenient interface for the //! operations needed for invoicing. -use std::{collections::HashMap, f32::consts::E, sync::Arc}; +use std::{collections::HashMap, sync::Arc}; use bitcoin::{hex::DisplayHex, Address, Amount, Network}; use fedimint_tonic_lnd::{ @@ -16,7 +16,7 @@ use fedimint_tonic_lnd::{ Client, }; use payday_btc::to_address; -use payday_core::{payment::invoice::LnInvoice, PaydayError, PaydayResult, PaydayStream}; +use payday_core::{payment::invoice::LnInvoice, Error, PaydayStream, Result}; use tokio::sync::{Mutex, MutexGuard}; use tokio_stream::StreamExt; @@ -31,20 +31,20 @@ pub struct LndRpcWrapper { impl LndRpcWrapper { /// Create a new LND RPC wrapper. Creates an RPC connection and /// checks whether the RPC server is serving the expected network. - pub async fn new(config: LndConfig) -> PaydayResult { + pub async fn new(config: LndConfig) -> Result { let mut lnd: Client = fedimint_tonic_lnd::connect( config.address.to_string(), config.cert_path.to_string(), config.macaroon_file.to_string(), ) .await - .map_err(|e| PaydayError::NodeConnectError(e.to_string()))?; + .map_err(|e| Error::NodeConnectError(e.to_string()))?; let network_info = lnd .lightning() .get_info(GetInfoRequest {}) .await - .map_err(|e| PaydayError::NodeApiError(e.to_string()))? + .map_err(|e| Error::NodeApiError(e.to_string()))? .into_inner() .chains .first() @@ -53,7 +53,7 @@ impl LndRpcWrapper { .to_string(); if config.network != network_from_str(&network_info)? { - return Err(PaydayError::InvalidBitcoinNetwork(network_info)); + return Err(Error::InvalidBitcoinNetwork(network_info)); } Ok(Self { config, @@ -71,30 +71,28 @@ impl LndRpcWrapper { self.client.lock().await } - pub async fn get_onchain_balance(&self) -> PaydayResult { + pub async fn get_onchain_balance(&self) -> Result { let mut lnd = self.client().await; Ok(lnd .lightning() .wallet_balance(WalletBalanceRequest {}) .await - .map_err(|e| PaydayError::NodeApiError(e.to_string()))? + .map_err(|e| Error::NodeApiError(e.to_string()))? .into_inner()) } - pub async fn get_channel_balance(&self) -> PaydayResult { + pub async fn get_channel_balance(&self) -> Result { let mut lnd = self.client().await; Ok(lnd .lightning() .channel_balance(ChannelBalanceRequest {}) .await - .map_err(|e| PaydayError::NodeApiError(e.to_string()))? + .map_err(|e| Error::NodeApiError(e.to_string()))? .into_inner()) } /// Get the current balances (onchain and lightning) of the wallet. - pub async fn get_balances( - &self, - ) -> PaydayResult<(WalletBalanceResponse, ChannelBalanceResponse)> { + pub async fn get_balances(&self) -> Result<(WalletBalanceResponse, ChannelBalanceResponse)> { let on_chain = self.get_onchain_balance().await?; let lightning = self.get_channel_balance().await?; Ok((on_chain, lightning)) @@ -102,7 +100,7 @@ impl LndRpcWrapper { /// Get a new onchain address for the wallet. Address is parsed and /// validated for the configure network. - pub async fn new_address(&self) -> PaydayResult
{ + pub async fn new_address(&self) -> Result
{ let addr = self .client() .await @@ -111,7 +109,7 @@ impl LndRpcWrapper { ..Default::default() }) .await - .map_err(|e| PaydayError::NodeApiError(e.to_string()))? + .map_err(|e| Error::NodeApiError(e.to_string()))? .into_inner() .address; let address = to_address(&addr, self.config.network)?; @@ -125,7 +123,7 @@ impl LndRpcWrapper { amount: Amount, address: &str, sats_per_vbyte: Amount, - ) -> PaydayResult { + ) -> Result { let checked_address = to_address(address, self.config.network)?; let txid = self .client() @@ -138,7 +136,7 @@ impl LndRpcWrapper { ..Default::default() }) .await - .map_err(|e| PaydayError::NodeApiError(e.to_string()))? + .map_err(|e| Error::NodeApiError(e.to_string()))? .into_inner() .txid; @@ -150,7 +148,7 @@ impl LndRpcWrapper { &self, outputs: HashMap, sats_per_vbyte: Amount, - ) -> PaydayResult { + ) -> Result { let out = outputs .iter() .map(|(k, v)| (k.to_string(), v.to_owned())) @@ -165,7 +163,7 @@ impl LndRpcWrapper { ..Default::default() }) .await - .map_err(|e| PaydayError::NodeApiError(e.to_string()))? + .map_err(|e| Error::NodeApiError(e.to_string()))? .into_inner() .txid; @@ -177,7 +175,7 @@ impl LndRpcWrapper { &self, target_conf: i32, outputs: HashMap, - ) -> PaydayResult { + ) -> Result { let fee = self .client() .await @@ -188,7 +186,7 @@ impl LndRpcWrapper { ..Default::default() }) .await - .map_err(|e| PaydayError::NodeApiError(e.to_string()))? + .map_err(|e| Error::NodeApiError(e.to_string()))? .into_inner() .sat_per_vbyte; @@ -200,7 +198,7 @@ impl LndRpcWrapper { amount: Amount, memo: Option, ttl: Option, - ) -> PaydayResult { + ) -> Result { let mut lnd = self.client().await; let invoice = lnd .lightning() @@ -211,7 +209,7 @@ impl LndRpcWrapper { ..Default::default() }) .await - .map_err(|e| PaydayError::NodeApiError(e.to_string()))? + .map_err(|e| Error::NodeApiError(e.to_string()))? .into_inner(); Ok(LnInvoice { @@ -223,13 +221,13 @@ impl LndRpcWrapper { /// Get a stream of onchain transactions relevant to the wallet. As LND RPC does not handle /// the request arguments, we do not provide any on this method to avoid confusion. - pub async fn subscribe_transactions(&self) -> PaydayResult> { + pub async fn subscribe_transactions(&self) -> Result> { let mut lnd = self.client().await; let stream = lnd .lightning() .subscribe_transactions(GetTransactionsRequest::default()) .await - .map_err(|e| PaydayError::NodeApiError(e.to_string()))? + .map_err(|e| Error::NodeApiError(e.to_string()))? .into_inner() .filter(|tx| tx.is_ok()) .map(|tx| tx.unwrap()); @@ -241,7 +239,7 @@ impl LndRpcWrapper { &self, start_height: i32, end_height: i32, - ) -> PaydayResult> { + ) -> Result> { let mut lnd = self.client().await; Ok(lnd .lightning() @@ -251,19 +249,19 @@ impl LndRpcWrapper { ..Default::default() }) .await - .map_err(|e| PaydayError::NodeApiError(e.to_string()))? + .map_err(|e| Error::NodeApiError(e.to_string()))? .into_inner() .transactions) } } -fn network_from_str(s: &str) -> PaydayResult { +fn network_from_str(s: &str) -> Result { let net = match s { "mainnet" => Network::Bitcoin, "testnet" => Network::Testnet, "regtest" => Network::Regtest, "signet" => Network::Signet, - _ => Err(PaydayError::InvalidBitcoinNetwork(s.to_string()))?, + _ => Err(Error::InvalidBitcoinNetwork(s.to_string()))?, }; Ok(net) } diff --git a/payday_postgres/src/block_height.rs b/payday_postgres/src/block_height.rs index 3b25731..090a6a0 100644 --- a/payday_postgres/src/block_height.rs +++ b/payday_postgres/src/block_height.rs @@ -1,7 +1,7 @@ use async_trait::async_trait; use payday_core::{ persistence::block_height::{BlockHeight, BlockHeightStoreApi}, - PaydayError, PaydayResult, + Error, Result, }; use sqlx::{Pool, Postgres, Row}; @@ -14,13 +14,13 @@ impl BlockHeightStore { Self { db } } - async fn get_block_height_internal(&self, node_id: &str) -> PaydayResult> { + async fn get_block_height_internal(&self, node_id: &str) -> Result> { let res: Option = sqlx::query("SELECT block_height FROM block_height WHERE node_id = $1") .bind(node_id) .fetch_optional(&self.db) .await - .map_err(|e| PaydayError::DbError(e.to_string()))? + .map_err(|e| Error::DbError(e.to_string()))? .map(|r| r.get("block_height")); Ok(res.and_then(|r| u64::try_from(r).ok())) } @@ -28,7 +28,7 @@ impl BlockHeightStore { #[async_trait] impl BlockHeightStoreApi for BlockHeightStore { - async fn get_block_height(&self, node_id: &str) -> PaydayResult { + async fn get_block_height(&self, node_id: &str) -> Result { let height: Option = self.get_block_height_internal(node_id).await?; match height { Some(height) => Ok(BlockHeight { @@ -42,7 +42,7 @@ impl BlockHeightStoreApi for BlockHeightStore { } } - async fn set_block_height(&self, node_id: &str, block_height: u64) -> PaydayResult<()> { + async fn set_block_height(&self, node_id: &str, block_height: u64) -> Result<()> { let existing: Option = self.get_block_height_internal(node_id).await?; if existing.is_some() { sqlx::query("UPDATE block_height SET block_height = $1 WHERE node_id = $2") @@ -50,14 +50,14 @@ impl BlockHeightStoreApi for BlockHeightStore { .bind(node_id) .execute(&self.db) .await - .map_err(|e| PaydayError::DbError(e.to_string()))?; + .map_err(|e| Error::DbError(e.to_string()))?; } else { sqlx::query("INSERT INTO block_height (node_id, block_height) VALUES ($1, $2)") .bind(node_id) .bind(block_height as i64) .execute(&self.db) .await - .map_err(|e| PaydayError::DbError(e.to_string()))?; + .map_err(|e| Error::DbError(e.to_string()))?; } Ok(()) diff --git a/payday_postgres/src/btc_onchain.rs b/payday_postgres/src/btc_onchain.rs index e64bd6d..e49d9f6 100644 --- a/payday_postgres/src/btc_onchain.rs +++ b/payday_postgres/src/btc_onchain.rs @@ -1,19 +1,15 @@ -use async_trait::async_trait; -use payday_btc::{ - on_chain_aggregate::{BtcOnChainInvoice, OnChainInvoiceCommand}, - on_chain_api::OnChainInvoiceApi, - on_chain_processor::OnChainTransactionEvent, -}; -use payday_core::{ - payment::{ - amount::Amount, - currency::Currency, - invoice::{Invoice, InvoiceId, PaymentProcessorApi, PaymentType}, - }, - PaydayError, PaydayResult, -}; -use postgres_es::PostgresCqrs; -use serde_json::Value; +// use async_trait::async_trait; +// use payday_btc::on_chain_aggregate::{BtcOnChainInvoice, OnChainInvoiceCommand}; +// use payday_core::{ +// payment::{ +// amount::Amount, +// currency::Currency, +// invoice::{Invoice, InvoiceId, PaymentProcessorApi, PaymentType}, +// }, +// Error, Result, +// }; +// use postgres_es::PostgresCqrs; +// use serde_json::Value; //pub struct OnChainProcessor { // name: String, @@ -56,7 +52,7 @@ use serde_json::Value; // invoice_id: InvoiceId, // amount: Amount, // _memo: Option, -// ) -> PaydayResult { +// ) -> Result { // let address = self.on_chain_api.new_address().await?; // self.cqrs // .execute( @@ -78,7 +74,7 @@ use serde_json::Value; // }) // } // -// async fn process_payment_events(&self) -> PaydayResult<()> { +// async fn process_payment_events(&self) -> Result<()> { // let mut subscriber = self.tx_stream.subscribe_events()?; // while let Some(event) = subscriber.recv().await { // let (aggregate_id, command) = match event { diff --git a/payday_postgres/src/lib.rs b/payday_postgres/src/lib.rs index e7dcd74..028a119 100644 --- a/payday_postgres/src/lib.rs +++ b/payday_postgres/src/lib.rs @@ -2,14 +2,14 @@ pub mod block_height; pub mod btc_onchain; use cqrs_es::{Aggregate, Query}; -use payday_core::{persistence::cqrs::Cqrs, PaydayError, PaydayResult}; +use payday_core::{persistence::cqrs::Cqrs, Error, Result}; use postgres_es::{postgres_cqrs, PostgresEventRepository}; use sqlx::{Pool, Postgres}; -pub async fn create_postgres_pool(connection_string: &str) -> PaydayResult> { +pub async fn create_postgres_pool(connection_string: &str) -> Result> { let pool = sqlx::PgPool::connect(connection_string) .await - .map_err(|e| PaydayError::DbError(e.to_string()))?; + .map_err(|e| Error::DbError(e.to_string()))?; Ok(pool) } @@ -17,7 +17,7 @@ pub async fn create_cqrs( pool: Pool, queries: Vec>>, services: A::Services, -) -> PaydayResult> +) -> Result> where A: Aggregate, { diff --git a/payday_surrealdb/src/block_height.rs b/payday_surrealdb/src/block_height.rs index 2daa483..f5865bd 100644 --- a/payday_surrealdb/src/block_height.rs +++ b/payday_surrealdb/src/block_height.rs @@ -1,7 +1,7 @@ use async_trait::async_trait; use payday_core::{ persistence::block_height::{BlockHeight, BlockHeightStoreApi}, - PaydayError, PaydayResult, + Error, Result, }; use surrealdb::{engine::any::Any, Surreal}; @@ -17,12 +17,12 @@ impl BlockHeightStore { #[async_trait] impl BlockHeightStoreApi for BlockHeightStore { - async fn get_block_height(&self, node_id: &str) -> PaydayResult { + async fn get_block_height(&self, node_id: &str) -> Result { let height: Option = self .db .select(("block_height", node_id)) .await - .map_err(|e| PaydayError::DbError(e.to_string()))?; + .map_err(|e| Error::DbError(e.to_string()))?; match height { Some(height) => Ok(height), None => Ok(BlockHeight { @@ -32,7 +32,7 @@ impl BlockHeightStoreApi for BlockHeightStore { } } - async fn set_block_height(&self, node_id: &str, block_height: u64) -> PaydayResult<()> { + async fn set_block_height(&self, node_id: &str, block_height: u64) -> Result<()> { let data = BlockHeight { node_id: node_id.to_string(), block_height, @@ -41,7 +41,7 @@ impl BlockHeightStoreApi for BlockHeightStore { .db .select(("block_height", node_id)) .await - .map_err(|e| PaydayError::DbError(e.to_string()))?; + .map_err(|e| Error::DbError(e.to_string()))?; if existing.is_some() { let _: Option = self @@ -49,14 +49,14 @@ impl BlockHeightStoreApi for BlockHeightStore { .update(("block_height", node_id)) .content(data) .await - .map_err(|e| PaydayError::DbError(e.to_string()))?; + .map_err(|e| Error::DbError(e.to_string()))?; } else { let _: Option = self .db .create(("block_height", node_id)) .content(data) .await - .map_err(|e| PaydayError::DbError(e.to_string()))?; + .map_err(|e| Error::DbError(e.to_string()))?; }; Ok(()) } diff --git a/payday_surrealdb/src/event_stream.rs b/payday_surrealdb/src/event_stream.rs index 9188c63..ade3481 100644 --- a/payday_surrealdb/src/event_stream.rs +++ b/payday_surrealdb/src/event_stream.rs @@ -1,8 +1,5 @@ use async_trait::async_trait; -use payday_core::{ - events::{publisher::Publisher, Message, MessageError, Result}, - PaydayResult, -}; +use payday_core::events::{publisher::Publisher, Message, MessageError, Result}; use surrealdb::{engine::any::Any, Notification, Surreal}; use tokio::task::JoinHandle; use tokio_stream::StreamExt; @@ -22,7 +19,7 @@ impl EventStream { } } - pub async fn subscribe(&self) -> PaydayResult> { + pub async fn subscribe(&self) -> Result> { let table = self.event_table.to_string(); let db = self.db.clone(); let handle = tokio::spawn(async move { diff --git a/payday_surrealdb/src/lib.rs b/payday_surrealdb/src/lib.rs index ca19127..6fe5c22 100644 --- a/payday_surrealdb/src/lib.rs +++ b/payday_surrealdb/src/lib.rs @@ -1,5 +1,5 @@ use chrono::Utc; -use payday_core::{PaydayError, PaydayResult}; +use payday_core::{Error, Result}; use serde::{Serialize, Serializer}; use surrealdb::{ engine::any::{self, Any}, @@ -14,21 +14,21 @@ pub async fn create_surreal_db( path: &str, namespace: &str, database: &str, -) -> PaydayResult> { +) -> Result> { let db = any::connect(path) .await - .map_err(|e| PaydayError::DbError(e.to_string()))?; + .map_err(|e| Error::DbError(e.to_string()))?; db.use_ns(namespace) .use_db(database) .await - .map_err(|e| PaydayError::DbError(e.to_string()))?; + .map_err(|e| Error::DbError(e.to_string()))?; Ok(db) } pub fn serialize_chrono_as_sql_datetime( x: &chrono::DateTime, s: S, -) -> Result +) -> std::result::Result where S: Serializer, { @@ -38,7 +38,7 @@ where pub fn serialize_chrono_as_sql_datetime_option( x: &Option>, s: S, -) -> Result +) -> std::result::Result where S: Serializer, { diff --git a/payday_surrealdb/src/task.rs b/payday_surrealdb/src/task.rs index 67ba31b..4a8f653 100644 --- a/payday_surrealdb/src/task.rs +++ b/payday_surrealdb/src/task.rs @@ -205,6 +205,7 @@ impl SurrealTaskProcessor { self.handlers.push(handler); } + #[allow(dead_code)] async fn query_batch(&self) -> Result> { let mut response = self .db @@ -215,9 +216,9 @@ impl SurrealTaskProcessor { )) .await .map_err(|e| MessageError::SubscribeError(e.to_string()))?; - Ok(response + response .take(0) - .map_err(|e| MessageError::SubscribeError(e.to_string()))?) + .map_err(|e| MessageError::SubscribeError(e.to_string())) } } diff --git a/src/main.rs b/src/main.rs index ef5f098..a2bfcec 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,28 +1,10 @@ -use std::{sync::Arc, time::Duration}; - use bitcoin::{Amount, Network}; -use payday_btc::{ - on_chain_api::{GetOnChainBalanceApi, OnChainInvoiceApi, OnChainStreamApi}, - on_chain_processor::{OnChainTransactionPrintHandler, OnChainTransactionProcessor}, -}; -use payday_core::{ - events::{ - handler::{MessageProcessorApi, PrintTaskHandler}, - publisher::{Publisher, TaskPublisher}, - task::{RetryType, Task}, - }, - PaydayResult, -}; -use payday_node_lnd::lnd::{Lnd, LndConfig, LndTransactionStream}; +use payday_core::api::on_chain_api::{GetOnChainBalanceApi, OnChainInvoiceApi}; +use payday_core::Result; +use payday_node_lnd::lnd::{Lnd, LndConfig}; use payday_node_lnd::wrapper::LndRpcWrapper; -use payday_surrealdb::{ - block_height::BlockHeightStore, - create_surreal_db, - task::{SurrealTaskProcessor, SurrealTaskQueue}, -}; use serde::{Deserialize, Serialize}; -use tokio::sync::Mutex; #[derive(Debug, Clone, Serialize, Deserialize)] struct TestPayload { @@ -32,7 +14,7 @@ struct TestPayload { } #[tokio::main] -async fn main() -> PaydayResult<()> { +async fn main() -> Result<()> { let lnd_config = LndConfig { name: "payday".to_string(), address: "https://tbc-mutiny.u.voltageapp.io:10009".to_string(), From 0a955b0119b2a68c34a629a0c60240c39376725d Mon Sep 17 00:00:00 2001 From: tompro Date: Tue, 18 Feb 2025 15:33:22 +0100 Subject: [PATCH 4/7] Basic lightning APIs --- Cargo.lock | 243 +++----------------------- Cargo.toml | 14 +- payday_core/Cargo.toml | 18 +- payday_core/src/api/lightining_api.rs | 40 ++++- payday_core/src/api/on_chain_api.rs | 14 +- payday_core/src/error.rs | 8 + payday_core/src/payment/amount.rs | 7 + payday_core/src/payment/invoice.rs | 7 - payday_node_lnd/Cargo.toml | 11 +- payday_node_lnd/src/lnd.rs | 94 ++++++++-- payday_node_lnd/src/wrapper.rs | 89 +++++++++- 11 files changed, 261 insertions(+), 284 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 22ee114..ab81288 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -506,12 +506,6 @@ version = "3.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" -[[package]] -name = "byte-slice-cast" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" - [[package]] name = "bytecheck" version = "0.6.12" @@ -670,26 +664,6 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" -[[package]] -name = "const_format" -version = "0.2.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126f97965c8ad46d6d9163268ff28432e8f6a1196a55578867832e3049df63dd" -dependencies = [ - "const_format_proc_macros", -] - -[[package]] -name = "const_format_proc_macros" -version = "0.2.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d57c2eccfb16dbac1f4e61e206105db5820c9d26c3c472bc17c774259ef7744" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] - [[package]] name = "cordyceps" version = "0.3.2" @@ -790,43 +764,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "currencies" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd7c646708cebc1cf55b5d61b76d8fe6c0f60f19248846f273eeefa2cf6ae5ea" -dependencies = [ - "currencies-core", - "currencies-macros", -] - -[[package]] -name = "currencies-core" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f8f810e7f90c24398e134b0dd1b2c780610c74b8da27cea4534b97eb52c6951" -dependencies = [ - "num-integer", - "num-traits", - "primitive-types", - "quoth", - "serde", - "uint", -] - -[[package]] -name = "currencies-macros" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ed3e0b6415514060cb3cb583dfd61b5fc3bba7ffe27dddcb63e2cd924dd2ff9" -dependencies = [ - "currencies-core", - "derive-syn-parse", - "proc-macro2", - "quote", - "syn 2.0.98", -] - [[package]] name = "darling" version = "0.20.10" @@ -889,17 +826,6 @@ dependencies = [ "serde", ] -[[package]] -name = "derive-syn-parse" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d65d7ce8132b7c0e54497a4d9a55a1c2a0912a0d786cf894472ba818fba45762" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.98", -] - [[package]] name = "deunicode" version = "1.6.0" @@ -1090,18 +1016,6 @@ dependencies = [ "tower", ] -[[package]] -name = "fixed-hash" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" -dependencies = [ - "byteorder", - "rand 0.8.5", - "rustc-hex", - "static_assertions", -] - [[package]] name = "fixedbitset" version = "0.4.2" @@ -1829,37 +1743,6 @@ dependencies = [ "icu_properties", ] -[[package]] -name = "impl-codec" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" -dependencies = [ - "parity-scale-codec", -] - -[[package]] -name = "impl-num-traits" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "951641f13f873bff03d4bf19ae8bec531935ac0ac2cc775f84d7edfdcfed3f17" -dependencies = [ - "integer-sqrt", - "num-traits", - "uint", -] - -[[package]] -name = "impl-trait-for-tuples" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.98", -] - [[package]] name = "indexmap" version = "1.9.3" @@ -1891,15 +1774,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "integer-sqrt" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "276ec31bcb4a9ee45f58bec6f9ec700ae4cf4f4f8f2fa7e06cb406bd5ffdd770" -dependencies = [ - "num-traits", -] - [[package]] name = "ipnet" version = "2.11.0" @@ -2030,6 +1904,27 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "lightning-invoice" +version = "0.33.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4254e7d05961a3728bc90737c522e7091735ba6f2f71014096d4b3eb4ee5d89" +dependencies = [ + "bech32", + "bitcoin", + "lightning-types", + "serde", +] + +[[package]] +name = "lightning-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2cd84d4e71472035903e43caded8ecc123066ce466329ccd5ae537a8d5488c7" +dependencies = [ + "bitcoin", +] + [[package]] name = "linux-raw-sys" version = "0.4.15" @@ -2341,34 +2236,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" -[[package]] -name = "parity-scale-codec" -version = "3.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9fde3d0718baf5bc92f577d652001da0f8d54cd03a7974e118d04fc888dc23d" -dependencies = [ - "arrayvec", - "bitvec", - "byte-slice-cast", - "const_format", - "impl-trait-for-tuples", - "parity-scale-codec-derive", - "rustversion", - "serde", -] - -[[package]] -name = "parity-scale-codec-derive" -version = "3.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581c837bb6b9541ce7faa9377c20616e4fb7650f6b0f68bc93c827ee504fb7b3" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.98", -] - [[package]] name = "parking" version = "2.2.1" @@ -2437,7 +2304,7 @@ dependencies = [ "bitcoin", "chrono", "cqrs-es", - "currencies", + "lightning-invoice", "serde", "serde_json", "tokio", @@ -2452,6 +2319,7 @@ dependencies = [ "bitcoin", "cqrs-es", "fedimint-tonic-lnd", + "lightning-invoice", "payday_btc", "payday_core", "tokio", @@ -2680,18 +2548,6 @@ dependencies = [ "syn 2.0.98", ] -[[package]] -name = "primitive-types" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" -dependencies = [ - "fixed-hash", - "impl-codec", - "impl-num-traits", - "uint", -] - [[package]] name = "proc-macro-crate" version = "3.2.0" @@ -2843,29 +2699,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "quoth" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d34a2f0b562fb243cc325142baeb7174e5e3fd89b1c2981fe4f2a28358dbe8f" -dependencies = [ - "quoth-macros", - "regex", - "rust_decimal", - "safe-string", -] - -[[package]] -name = "quoth-macros" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4650ac02d49dfd3384bbb5735251a2cd858402992df06f1eeb57cc89b4342d08" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.98", -] - [[package]] name = "radium" version = "0.7.0" @@ -3250,12 +3083,6 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" -[[package]] -name = "rustc-hex" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" - [[package]] name = "rustc_lexer" version = "0.1.0" @@ -3370,12 +3197,6 @@ version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ea1a2d0a644769cc99faa24c3ad26b379b786fe7c36fd3c546254801650e6dd" -[[package]] -name = "safe-string" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5740ac587c51203119cf82aa44ca9935b057a05635c9aaf104e5a0f064bcf845" - [[package]] name = "salsa20" version = "0.10.2" @@ -3934,12 +3755,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - [[package]] name = "storekey" version = "0.5.0" @@ -4614,18 +4429,6 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "uint" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" -dependencies = [ - "byteorder", - "crunchy", - "hex", - "static_assertions", -] - [[package]] name = "ulid" version = "1.2.0" diff --git a/Cargo.toml b/Cargo.toml index 4130360..441243e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,11 +9,11 @@ payday_node_lnd = { path = "./payday_node_lnd" } payday_btc = { path = "./payday_btc" } payday_surrealdb = { path = "./payday_surrealdb" } payday_postgres = { path = "./payday_postgres" } -tokio = { workspace = true } -bitcoin = { workspace = true } -serde = { workspace = true } -serde_json = { workspace = true } -tokio-stream = { workspace = true } +tokio.workspace = true +bitcoin.workspace = true +serde.workspace = true +serde_json.workspace = true +tokio-stream.workspace = true [workspace] members = [ @@ -25,14 +25,14 @@ members = [ ] [workspace.dependencies] -async-trait = "0.1.80" +async-trait = "0.1.86" bitcoin = "0.32.2" serde = { version = "1.0.203", features = ["derive"] } serde_json = "1.0.118" tokio-stream = "0.1.15" chrono = "0.4" -currencies = "0.4.1" cqrs-es = "0.4.11" tokio = { version = "1.38.0", features = ["full"] } sqlx = { version = "0.8", features = ["postgres", "json"] } futures = "0.3.30" +lightning-invoice = { version = "0.33.1", features = ["serde"] } diff --git a/payday_core/Cargo.toml b/payday_core/Cargo.toml index 733e623..2e46546 100644 --- a/payday_core/Cargo.toml +++ b/payday_core/Cargo.toml @@ -4,12 +4,12 @@ version = "0.1.0" edition = "2021" [dependencies] -async-trait = { workspace = true } -bitcoin = { workspace = true } -serde = { workspace = true } -serde_json = { workspace = true } -currencies = { workspace = true } -cqrs-es = { workspace = true } -tokio = { workspace = true } -tokio-stream = { workspace = true } -chrono = { workspace = true } +async-trait.workspace = true +bitcoin.workspace = true +serde.workspace = true +serde_json.workspace = true +cqrs-es.workspace = true +tokio.workspace = true +tokio-stream.workspace = true +chrono.workspace = true +lightning-invoice.workspace = true diff --git a/payday_core/src/api/lightining_api.rs b/payday_core/src/api/lightining_api.rs index c12afe0..413dadc 100644 --- a/payday_core/src/api/lightining_api.rs +++ b/payday_core/src/api/lightining_api.rs @@ -1,22 +1,54 @@ use crate::{payment::amount::Amount, Result}; use async_trait::async_trait; +use lightning_invoice::Bolt11Invoice; + +use super::on_chain_api::OnChainBalance; #[async_trait] pub trait GetLightningBalanceApi: Send + Sync { /// Get the current OnChain balance of the wallet. - async fn get_onchain_balance(&self) -> Result; + async fn get_channel_balance(&self) -> Result; + + /// Get the current OnChain and channel balances of the Lightning wallet. + async fn get_balances(&self) -> Result; } #[async_trait] pub trait LightningInvoiceApi: Send + Sync { /// Get a new onchain address for the wallet. - async fn create_invoice(&self) -> Result; + async fn create_ln_invoice( + &self, + amount: Amount, + memo: Option, + ttl: Option, + ) -> Result; } -pub struct LnInvoice; +#[async_trait] +pub trait LightningPaymentApi: Send + Sync { + /// Pays a given BOLT11 invoice. + async fn pay_invoice(&self, invoice: Bolt11Invoice) -> Result<()>; + + /// Pays the given amount to the given node public key. + async fn pay_to_node_pub_key(&self, pub_key: String, amount: Amount) -> Result<()>; +} -#[derive(Debug)] +#[derive(Debug, Clone)] +pub struct LnInvoice { + pub invoice: String, + pub r_hash: String, + pub add_index: u64, +} + +#[derive(Debug, Clone)] pub struct ChannelBalance { pub local_balance: Amount, pub remote_balance: Amount, } + +/// Lightning nodes have an onchain and channel balance. +#[derive(Debug, Clone)] +pub struct NodeBalance { + pub onchain: OnChainBalance, + pub channel: ChannelBalance, +} diff --git a/payday_core/src/api/on_chain_api.rs b/payday_core/src/api/on_chain_api.rs index f27c5e8..9b7d58e 100644 --- a/payday_core/src/api/on_chain_api.rs +++ b/payday_core/src/api/on_chain_api.rs @@ -5,8 +5,6 @@ use async_trait::async_trait; use bitcoin::{Address, Amount}; use tokio::task::JoinHandle; -use super::lightining_api::ChannelBalance; - #[async_trait] pub trait GetOnChainBalanceApi: Send + Sync { /// Get the current OnChain balance of the wallet. @@ -76,27 +74,21 @@ pub trait OnChainTransactionEventHandler: Send + Sync { async fn process_event(&self, event: OnChainTransactionEvent) -> Result<()>; } -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct OnChainBalance { pub total_balance: Amount, pub unconfirmed_balance: Amount, pub confirmed_balance: Amount, } -#[derive(Debug)] -pub struct Balance { - pub onchain: OnChainBalance, - pub channel: ChannelBalance, -} - -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct OnChainPaymentResult { pub tx_id: String, pub amounts: HashMap, pub fee: Amount, } -#[derive(Debug)] +#[derive(Debug, Clone)] pub enum OnChainTransactionEvent { ReceivedUnconfirmed(OnChainTransaction), ReceivedConfirmed(OnChainTransaction), diff --git a/payday_core/src/error.rs b/payday_core/src/error.rs index 9870554..1f7f135 100644 --- a/payday_core/src/error.rs +++ b/payday_core/src/error.rs @@ -8,6 +8,8 @@ use crate::events::MessageError; pub enum Error { NodeConnectError(String), NodeApiError(String), + LightningPaymentFailed(String), + PublicKey(String), DbError(String), InvalidBitcoinAddress(String), InvalidBitcoinNetwork(String), @@ -32,6 +34,12 @@ impl From for Error { } } +impl From for Error { + fn from(value: bitcoin::key::ParsePublicKeyError) -> Self { + Error::PublicKey(value.to_string()) + } +} + impl From for Error { fn from(value: MessageError) -> Self { match value { diff --git a/payday_core/src/payment/amount.rs b/payday_core/src/payment/amount.rs index 7bc37fa..11a5855 100644 --- a/payday_core/src/payment/amount.rs +++ b/payday_core/src/payment/amount.rs @@ -21,6 +21,13 @@ impl Amount { amount: 0, } } + + pub fn sats(sats: u64) -> Self { + Self { + currency: Currency::Btc, + amount: sats, + } + } } impl Default for Amount { diff --git a/payday_core/src/payment/invoice.rs b/payday_core/src/payment/invoice.rs index 2aa1754..b257c88 100644 --- a/payday_core/src/payment/invoice.rs +++ b/payday_core/src/payment/invoice.rs @@ -61,10 +61,3 @@ pub trait PaymentProcessorApi: Send + Sync { /// Processes payment events for this system. async fn process_payment_events(&self) -> crate::Result<()>; } - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct LnInvoice { - pub invoice: String, - pub r_hash: String, - pub add_index: u64, -} diff --git a/payday_node_lnd/Cargo.toml b/payday_node_lnd/Cargo.toml index 82ece50..58fe6d6 100644 --- a/payday_node_lnd/Cargo.toml +++ b/payday_node_lnd/Cargo.toml @@ -7,8 +7,9 @@ edition = "2021" payday_core = { path = "../payday_core" } payday_btc = { path = "../payday_btc" } fedimint-tonic-lnd = "0.2.0" -async-trait = { workspace = true } -bitcoin = { workspace = true } -tokio-stream = { workspace = true } -cqrs-es = { workspace = true } -tokio = { workspace = true } +async-trait.workspace = true +bitcoin.workspace = true +tokio-stream.workspace = true +cqrs-es.workspace = true +tokio.workspace = true +lightning-invoice.workspace = true diff --git a/payday_node_lnd/src/lnd.rs b/payday_node_lnd/src/lnd.rs index c917e10..857aa2e 100644 --- a/payday_node_lnd/src/lnd.rs +++ b/payday_node_lnd/src/lnd.rs @@ -1,19 +1,27 @@ use std::{collections::HashMap, sync::Arc}; use async_trait::async_trait; -use bitcoin::{Address, Amount, Network}; +use bitcoin::{Address, Network}; use fedimint_tonic_lnd::{ lnrpc::{GetTransactionsRequest, Transaction}, Client, }; +use lightning_invoice::Bolt11Invoice; use payday_btc::to_address; use payday_core::{ - api::on_chain_api::{ - GetOnChainBalanceApi, OnChainBalance, OnChainInvoiceApi, OnChainPaymentApi, - OnChainPaymentResult, OnChainStreamApi, OnChainTransaction, OnChainTransactionApi, - OnChainTransactionEvent, OnChainTransactionEventProcessorApi, + api::{ + lightining_api::{ + ChannelBalance, GetLightningBalanceApi, LightningInvoiceApi, LightningPaymentApi, + LnInvoice, NodeBalance, + }, + on_chain_api::{ + GetOnChainBalanceApi, OnChainBalance, OnChainInvoiceApi, OnChainPaymentApi, + OnChainPaymentResult, OnChainStreamApi, OnChainTransaction, OnChainTransactionApi, + OnChainTransactionEvent, OnChainTransactionEventProcessorApi, + }, }, + payment::amount::Amount, Result, }; use tokio::{sync::Mutex, task::JoinHandle}; @@ -45,6 +53,32 @@ impl GetOnChainBalanceApi for Lnd { } } +#[async_trait] +impl GetLightningBalanceApi for Lnd { + async fn get_channel_balance(&self) -> Result { + let res = self.client.get_channel_balance().await?; + + Ok(ChannelBalance { + local_balance: res + .local_balance + .map(|a| Amount::sats(a.sat)) + .get_or_insert(Amount::sats(0)) + .to_owned(), + remote_balance: res + .remote_balance + .map(|a| Amount::sats(a.sat)) + .get_or_insert(Amount::sats(0)) + .to_owned(), + }) + } + + async fn get_balances(&self) -> Result { + let onchain = self.get_onchain_balance().await?; + let channel = self.get_channel_balance().await?; + Ok(NodeBalance { onchain, channel }) + } +} + #[async_trait] impl OnChainInvoiceApi for Lnd { async fn new_address(&self) -> Result
{ @@ -52,6 +86,20 @@ impl OnChainInvoiceApi for Lnd { } } +#[async_trait] +impl LightningInvoiceApi for Lnd { + async fn create_ln_invoice( + &self, + amount: Amount, + memo: Option, + ttl: Option, + ) -> Result { + let amount = bitcoin::Amount::from_sat(amount.amount); + let invoice = self.client.create_invoice(amount, memo, ttl).await?; + Ok(invoice) + } +} + #[async_trait] impl OnChainPaymentApi for Lnd { fn validate_address(&self, address: &str) -> Result
{ @@ -61,8 +109,8 @@ impl OnChainPaymentApi for Lnd { async fn estimate_fee( &self, target_conf: i32, - outputs: HashMap, - ) -> Result { + outputs: HashMap, + ) -> Result { let out = outputs .iter() .map(|p| (p.0.to_owned(), p.1.to_sat() as i64)) @@ -73,9 +121,9 @@ impl OnChainPaymentApi for Lnd { async fn send( &self, - amount: Amount, + amount: bitcoin::Amount, address: String, - sats_per_vbyte: Amount, + sats_per_vbyte: bitcoin::Amount, ) -> Result { let tx_id = self .client @@ -91,8 +139,8 @@ impl OnChainPaymentApi for Lnd { async fn batch_send( &self, - outputs: HashMap, - sats_per_vbyte: Amount, + outputs: HashMap, + sats_per_vbyte: bitcoin::Amount, ) -> Result { let out = outputs .iter() @@ -114,6 +162,22 @@ impl OnChainPaymentApi for Lnd { } } +#[async_trait] +impl LightningPaymentApi for Lnd { + async fn pay_to_node_pub_key(&self, pub_key: String, amount: Amount) -> Result<()> { + let amt = bitcoin::Amount::from_sat(amount.amount); + self.client + .pay_to_node_id(pub_key.parse()?, amt, None) + .await?; + Ok(()) + } + + async fn pay_invoice(&self, invoice: Bolt11Invoice) -> Result<()> { + self.client.pay_invoice(invoice, None, None).await?; + Ok(()) + } +} + #[async_trait] impl OnChainTransactionApi for Lnd { async fn get_onchain_transactions( @@ -143,11 +207,11 @@ pub struct LndConfig { } /// Converts a satoshi amount to an Amount -fn to_amount(sats: i64) -> Amount { +fn to_amount(sats: i64) -> bitcoin::Amount { if sats < 0 { - Amount::ZERO + bitcoin::Amount::ZERO } else { - Amount::from_sat(sats.unsigned_abs()) + bitcoin::Amount::from_sat(sats.unsigned_abs()) } } @@ -173,7 +237,7 @@ fn to_on_chain_events(tx: &Transaction, chain: Network) -> Result Result { + let mut lnd = self.client().await; + let result = lnd + .router() + .send_payment_v2(request) + .await + .map_err(|e| Error::NodeApiError(e.to_string()))?; + + // subscribe until the first non-inflight payment is received + match result + .into_inner() + .filter_map(|r| match r.ok() { + Some(p) if p.status() != PaymentStatus::InFlight => Some(p), + _ => None, + }) + .next() + .await + { + Some(p) if p.status() == PaymentStatus::Succeeded => Ok(p), + Some(p) => Err(Error::LightningPaymentFailed(format!( + "Lightning payment failed: Status: {}, Reason:{}", + p.status().as_str_name(), + p.failure_reason().as_str_name() + ))), + _ => Err(Error::LightningPaymentFailed( + "Lightning payment failed without response".to_string(), + )), + } + } + + /// Pay a given bolt11 invoice. The fee limit is optional and defaults to 0 (no limit) the + /// optional timeout defaults to 60 seconds. + pub async fn pay_invoice( + &self, + invoice: Bolt11Invoice, + fee_limit_sat: Option, + timeout: Option, + ) -> Result { + let timeout_seconds = timeout.map(|t| t.as_secs() as i32).unwrap_or(60); + let result = self + .send_lightning_payment(fedimint_tonic_lnd::routerrpc::SendPaymentRequest { + payment_request: invoice.to_string(), + timeout_seconds, + fee_limit_sat: fee_limit_sat.unwrap_or(0), + no_inflight_updates: true, + ..Default::default() + }) + .await?; + Ok(result) + } + + /// Pay a specified amount to a node id. The optional timeout defaults to 60 seconds. + pub async fn pay_to_node_id( + &self, + node_id: PublicKey, + amount: Amount, + timeout: Option, + ) -> Result { + let timeout_seconds = timeout.map(|t| t.as_secs() as i32).unwrap_or(60); + let result = self + .send_lightning_payment(fedimint_tonic_lnd::routerrpc::SendPaymentRequest { + dest: node_id.to_bytes(), + amt: amount.to_sat() as i64, + timeout_seconds, + ..Default::default() + }) + .await?; + Ok(result) + } + /// Get a stream of onchain transactions relevant to the wallet. As LND RPC does not handle /// the request arguments, we do not provide any on this method to avoid confusion. pub async fn subscribe_transactions(&self) -> Result> { From 9cfa5f8f76c5bb685cdf258f73e123ef4a4f1ae8 Mon Sep 17 00:00:00 2001 From: tompro Date: Tue, 18 Feb 2025 18:03:52 +0100 Subject: [PATCH 5/7] New stream consumer --- .gitignore | 4 +- payday_btc/src/on_chain_aggregate.rs | 10 ++ payday_core/src/api/on_chain_api.rs | 12 ++- payday_node_lnd/src/lnd.rs | 135 +++++++++------------------ payday_node_lnd/src/wrapper.rs | 2 +- src/main.rs | 89 +++++++++++++----- 6 files changed, 137 insertions(+), 115 deletions(-) diff --git a/.gitignore b/.gitignore index 3be49cf..614c0cf 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ */target /data /docker-data -admin.macaroon -tls.cert +*.macaroon +*.cert .idea .supermaven diff --git a/payday_btc/src/on_chain_aggregate.rs b/payday_btc/src/on_chain_aggregate.rs index 990d96f..c17aae9 100644 --- a/payday_btc/src/on_chain_aggregate.rs +++ b/payday_btc/src/on_chain_aggregate.rs @@ -9,6 +9,7 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct BtcOnChainInvoice { pub invoice_id: InvoiceId, + pub node_id: String, pub address: String, pub amount: Amount, pub received_amount: Amount, @@ -23,6 +24,7 @@ impl Default for BtcOnChainInvoice { fn default() -> Self { Self { invoice_id: "".to_string(), + node_id: "".to_string(), address: "".to_string(), amount: Amount::zero(Currency::Btc), received_amount: Amount::zero(Currency::Btc), @@ -44,6 +46,7 @@ pub struct OnChainInvoiceServices {} pub enum OnChainInvoiceCommand { CreateInvoice { invoice_id: InvoiceId, + node_id: String, amount: Amount, address: String, }, @@ -106,6 +109,7 @@ impl From for OnChainCommand { pub enum OnChainInvoiceEvent { InvoiceCreated { invoice_id: InvoiceId, + node_id: String, amount: Amount, address: String, }, @@ -157,6 +161,7 @@ impl Aggregate for BtcOnChainInvoice { match command { OnChainInvoiceCommand::CreateInvoice { invoice_id, + node_id, amount, address, } => { @@ -169,6 +174,7 @@ impl Aggregate for BtcOnChainInvoice { Ok(vec![OnChainInvoiceEvent::InvoiceCreated { invoice_id, + node_id, amount, address: address.to_string(), }]) @@ -198,10 +204,12 @@ impl Aggregate for BtcOnChainInvoice { match event { OnChainInvoiceEvent::InvoiceCreated { invoice_id, + node_id, amount, address, } => { self.invoice_id = invoice_id; + self.node_id = node_id; self.amount = amount; self.address = address.to_string(); } @@ -248,6 +256,7 @@ mod aggregate_tests { .given_no_previous_events() .when(OnChainInvoiceCommand::CreateInvoice { invoice_id: "123".to_string(), + node_id: "node1".to_string(), amount: amount_fn(100_000), address: "tb1q6xm2qgh5r83lvmmu0v7c3d4wrd9k2uxu3sgcr4".to_string(), }) @@ -322,6 +331,7 @@ mod aggregate_tests { fn mock_created_event(amount: u64) -> OnChainInvoiceEvent { OnChainInvoiceEvent::InvoiceCreated { invoice_id: "123".to_string(), + node_id: "node1".to_string(), amount: amount_fn(amount), address: "tb1q6xm2qgh5r83lvmmu0v7c3d4wrd9k2uxu3sgcr4".to_string(), } diff --git a/payday_core/src/api/on_chain_api.rs b/payday_core/src/api/on_chain_api.rs index 9b7d58e..19da07b 100644 --- a/payday_core/src/api/on_chain_api.rs +++ b/payday_core/src/api/on_chain_api.rs @@ -3,7 +3,7 @@ use std::collections::HashMap; use crate::Result; use async_trait::async_trait; use bitcoin::{Address, Amount}; -use tokio::task::JoinHandle; +use tokio::{sync::mpsc::Sender, task::JoinHandle}; #[async_trait] pub trait GetOnChainBalanceApi: Send + Sync { @@ -74,6 +74,15 @@ pub trait OnChainTransactionEventHandler: Send + Sync { async fn process_event(&self, event: OnChainTransactionEvent) -> Result<()>; } +#[async_trait] +pub trait OnChainTransactionStreamApi: Send + Sync { + async fn subscribe_on_chain_transactions( + &self, + sender: Sender, + start_height: Option, + ) -> Result>; +} + #[derive(Debug, Clone)] pub struct OnChainBalance { pub total_balance: Amount, @@ -110,6 +119,7 @@ impl OnChainTransactionEvent { pub struct OnChainTransaction { pub tx_id: String, pub block_height: i32, + pub node_id: String, pub address: Address, pub amount: Amount, pub confirmations: i32, diff --git a/payday_node_lnd/src/lnd.rs b/payday_node_lnd/src/lnd.rs index 857aa2e..7bba38c 100644 --- a/payday_node_lnd/src/lnd.rs +++ b/payday_node_lnd/src/lnd.rs @@ -19,16 +19,21 @@ use payday_core::{ GetOnChainBalanceApi, OnChainBalance, OnChainInvoiceApi, OnChainPaymentApi, OnChainPaymentResult, OnChainStreamApi, OnChainTransaction, OnChainTransactionApi, OnChainTransactionEvent, OnChainTransactionEventProcessorApi, + OnChainTransactionStreamApi, }, }, payment::amount::Amount, Result, }; -use tokio::{sync::Mutex, task::JoinHandle}; +use tokio::{ + sync::{mpsc::Sender, Mutex}, + task::JoinHandle, +}; use tokio_stream::StreamExt; use crate::wrapper::LndRpcWrapper; +#[derive(Clone)] pub struct Lnd { config: LndConfig, client: LndRpcWrapper, @@ -190,7 +195,7 @@ impl OnChainTransactionApi for Lnd { .get_transactions(start_height, end_height) .await? .iter() - .flat_map(|tx| to_on_chain_events(tx, self.config.network)) + .flat_map(|tx| to_on_chain_events(tx, self.config.network, &self.config.node_id)) .flatten() .collect(); Ok(result) @@ -199,7 +204,7 @@ impl OnChainTransactionApi for Lnd { #[derive(Debug, Clone)] pub struct LndConfig { - pub name: String, + pub node_id: String, pub address: String, pub cert_path: String, pub macaroon_file: String, @@ -216,7 +221,11 @@ fn to_amount(sats: i64) -> bitcoin::Amount { } /// Converts a Transaction to a list of OnChainTransactionEvents. -fn to_on_chain_events(tx: &Transaction, chain: Network) -> Result> { +fn to_on_chain_events( + tx: &Transaction, + chain: Network, + node_id: &str, +) -> Result> { let received = tx.amount > 0; let confirmed = tx.num_confirmations > 0; @@ -236,6 +245,7 @@ fn to_on_chain_events(tx: &Transaction, chain: Network) -> Result Result>, - start_height: Option, } -impl LndTransactionStream { - pub fn new( - config: LndConfig, - handler: Arc>, - start_height: Option, - ) -> Self { - Self { - config, - handler, - start_height, - } +impl LndOnChainPaymentEventStream { + pub fn new(config: LndConfig) -> Self { + Self { config } } /// does fetch potential missing events from the current start_height - async fn start_subscription(&self) -> Result> { + async fn start_subscription(&self, start_height: i32) -> Result> { let lnd = Lnd::new(self.config.clone()).await?; - let start_height = match self.start_height { - Some(start_height) => start_height, - None => self.handler.lock().await.get_block_height().await?, - }; - let events = lnd.get_onchain_transactions(start_height, -1).await?; Ok(events) } } #[async_trait] -impl OnChainStreamApi for LndTransactionStream { - async fn process_events(&self) -> Result> { - let start_events = self.start_subscription().await.ok().unwrap_or(vec![]); - for event in start_events { - self.handler.lock().await.process_event(event).await?; - } - let service = self.handler.clone(); +impl OnChainTransactionStreamApi for LndOnChainPaymentEventStream { + async fn subscribe_on_chain_transactions( + &self, + sender: Sender, + start_height: Option, + ) -> Result> { let config = self.config.clone(); + let start_events = self + .start_subscription(start_height.unwrap_or_default()) + .await + .ok() + .unwrap_or(vec![]); + // catch up to from start height to now + for event in start_events { + if let Err(e) = sender.send(event).await { + println!( + "Failed to send historic on chain transaction event: {:?}", + e + ); + } + } let handle = tokio::spawn(async move { + let sender = sender.clone(); let mut lnd: Client = fedimint_tonic_lnd::connect( config.address.to_string(), config.cert_path.to_string(), @@ -316,67 +325,15 @@ impl OnChainStreamApi for LndTransactionStream { .map(|tx| tx.unwrap()); while let Some(event) = stream.next().await { - let events = to_on_chain_events(&event, config.network) - .expect("Failed to parse LND on-chain transaction"); - - for event in events { - service - .lock() - .await - .process_event(event) - .await - .expect("Failed to process LND on chain transaction event"); + if let Ok(events) = to_on_chain_events(&event, config.network, &config.node_id) { + for event in events { + if let Err(e) = sender.send(event).await { + println!("Failed to send on chain transaction event: {:?}", e); + } + } } } }); - Ok(handle) } } - -//pub struct LndOnChainPaymentEventStream { -// config: LndConfig, -//} -// -//impl LndOnChainPaymentEventStream { -// pub fn new(config: LndConfig) -> Self { -// Self { config } -// } -//} -// -//impl OnChainTransactionStreamSubscriber for LndOnChainPaymentEventStream { -// fn subscribe_events(&self) -> Result> { -// let config = self.config.clone(); -// let (tx, rx) = tokio::sync::mpsc::channel::(100); -// -// tokio::spawn(async move { -// let sender = tx.clone(); -// let mut lnd: Client = fedimint_tonic_lnd::connect( -// config.address.to_string(), -// config.cert_path.to_string(), -// config.macaroon_file.to_string(), -// ) -// .await -// .expect("Failed to connect to LND on-chain transaction stream"); -// -// let mut stream = lnd -// .lightning() -// .subscribe_transactions(GetTransactionsRequest::default()) -// .await -// .expect("Failed to subscribe to LND on-chain transaction events") -// .into_inner() -// .filter(|tx| tx.is_ok()) -// .map(|tx| tx.unwrap()); -// -// while let Some(event) = stream.next().await { -// let events = to_on_chain_events(&event, config.network) -// .expect("Failed to parse LND on-chain transaction"); -// -// for event in events { -// sender.send(event).await.expect("stream closed"); -// } -// } -// }); -// Ok(rx) -// } -//} diff --git a/payday_node_lnd/src/wrapper.rs b/payday_node_lnd/src/wrapper.rs index 2c66758..4c1c3e3 100644 --- a/payday_node_lnd/src/wrapper.rs +++ b/payday_node_lnd/src/wrapper.rs @@ -65,7 +65,7 @@ impl LndRpcWrapper { /// Get the unique name of the LND server. Names are used to /// identify the server in logs and associated addresses and invoices. pub fn get_name(&self) -> String { - self.config.name.to_string() + self.config.node_id.to_string() } async fn client(&self) -> MutexGuard { diff --git a/src/main.rs b/src/main.rs index a2bfcec..9641a4a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,10 +1,13 @@ -use bitcoin::{Amount, Network}; +use bitcoin::Network; -use payday_core::api::on_chain_api::{GetOnChainBalanceApi, OnChainInvoiceApi}; +use payday_core::api::lightining_api::{GetLightningBalanceApi, LightningInvoiceApi}; +use payday_core::api::on_chain_api::{ + GetOnChainBalanceApi, OnChainInvoiceApi, OnChainTransactionStreamApi, +}; use payday_core::Result; -use payday_node_lnd::lnd::{Lnd, LndConfig}; -use payday_node_lnd::wrapper::LndRpcWrapper; +use payday_node_lnd::lnd::{Lnd, LndConfig, LndOnChainPaymentEventStream}; use serde::{Deserialize, Serialize}; +use tokio::task::JoinSet; #[derive(Debug, Clone, Serialize, Deserialize)] struct TestPayload { @@ -16,30 +19,72 @@ struct TestPayload { #[tokio::main] async fn main() -> Result<()> { let lnd_config = LndConfig { - name: "payday".to_string(), + node_id: "node1".to_string(), address: "https://tbc-mutiny.u.voltageapp.io:10009".to_string(), cert_path: "tls.cert".to_string(), macaroon_file: "admin.macaroon".to_string(), network: Network::Signet, }; - let lnd = Lnd::new(lnd_config.clone()).await?; - let wrapper = LndRpcWrapper::new(lnd_config.clone()).await?; - - let invoice = wrapper - .create_invoice( - Amount::from_sat(300_000), - Some("test invoice".to_string()), - Some(31535000), - ) - .await?; - - println!("{:?}", invoice); - - let address = lnd.new_address().await?; - println!("{:?}", address); + let lnd_config2 = LndConfig { + node_id: "node2".to_string(), + address: "https://localhost:10009".to_string(), + cert_path: "tls2.cert".to_string(), + macaroon_file: "admin2.macaroon".to_string(), + network: Network::Signet, + }; - let balance = lnd.get_onchain_balance().await?; - println!("{:?}", balance); + // let lnd = Lnd::new(lnd_config.clone()).await?; + // + // let address = lnd.new_address().await?; + // println!("LND1 address: {:?}", address); + // + // let balance = lnd.get_onchain_balance().await?; + // println!("LND1 onchain balance {:?}", balance); + // + // let balances = lnd.get_balances().await?; + // println!("LND1 balances {:?}", balances); + // + // let ln_invoice = lnd + // .create_ln_invoice(payday_core::payment::amount::Amount::sats(1000), None, None) + // .await?; + // println!("LND1 invoice: {:?}", ln_invoice); + // + // let lnd2 = Lnd::new(lnd_config2.clone()).await?; + // + // let address2 = lnd2.new_address().await?; + // println!("LND2 address: {:?}", address2); + // + // let balance2 = lnd2.get_onchain_balance().await?; + // println!("LND2 onchain balance {:?}", balance2); + // + // let balances2 = lnd2.get_balances().await?; + // println!("LND2 balances {:?}", balances2); + // + // let ln_invoice2 = lnd2 + // .create_ln_invoice(payday_core::payment::amount::Amount::sats(1000), None, None) + // .await?; + // println!("LND2 invoice: {:?}", ln_invoice2); + + let (tx, mut rx) = tokio::sync::mpsc::channel(100); + let transactions_1 = LndOnChainPaymentEventStream::new(lnd_config.clone()); + let transactions_2 = LndOnChainPaymentEventStream::new(lnd_config2.clone()); + let handles = vec![ + transactions_1 + .subscribe_on_chain_transactions(tx.clone(), Some(1868219)) + .await + .unwrap(), + transactions_2 + .subscribe_on_chain_transactions(tx, Some(1868219)) + .await + .unwrap(), + ]; + let set = JoinSet::from_iter(handles); + + while let Some(event) = rx.recv().await { + println!("Event: {:?}", event); + } + + set.join_all().await; // let db = create_surreal_db("ws://localhost:8000", "payday", "payday").await?; // let block_height_store = BlockHeightStore::new(db.clone()); From c23dad82ba21b48e847f515c52861ae52a068431 Mon Sep 17 00:00:00 2001 From: tompro Date: Tue, 18 Feb 2025 18:08:52 +0100 Subject: [PATCH 6/7] CI and cleanup --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ justfile | 5 +++++ payday_node_lnd/src/lnd.rs | 12 ++++-------- src/main.rs | 7 ++----- 4 files changed, 36 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 justfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0322570 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: Rust continuous integration + +on: + workflow_call: + + pull_request: + branches: ["master"] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --verbose + - name: Run format check + run: cargo fmt --all -- --check + - name: Run clippy + run: cargo clippy -- -D warnings diff --git a/justfile b/justfile new file mode 100644 index 0000000..ada1315 --- /dev/null +++ b/justfile @@ -0,0 +1,5 @@ +check: + cargo test --all + cargo fmt + cargo clippy --all-targets --all-features -- -D warnings + diff --git a/payday_node_lnd/src/lnd.rs b/payday_node_lnd/src/lnd.rs index 7bba38c..162a061 100644 --- a/payday_node_lnd/src/lnd.rs +++ b/payday_node_lnd/src/lnd.rs @@ -1,4 +1,4 @@ -use std::{collections::HashMap, sync::Arc}; +use std::collections::HashMap; use async_trait::async_trait; use bitcoin::{Address, Network}; @@ -17,18 +17,14 @@ use payday_core::{ }, on_chain_api::{ GetOnChainBalanceApi, OnChainBalance, OnChainInvoiceApi, OnChainPaymentApi, - OnChainPaymentResult, OnChainStreamApi, OnChainTransaction, OnChainTransactionApi, - OnChainTransactionEvent, OnChainTransactionEventProcessorApi, - OnChainTransactionStreamApi, + OnChainPaymentResult, OnChainTransaction, OnChainTransactionApi, + OnChainTransactionEvent, OnChainTransactionStreamApi, }, }, payment::amount::Amount, Result, }; -use tokio::{ - sync::{mpsc::Sender, Mutex}, - task::JoinHandle, -}; +use tokio::{sync::mpsc::Sender, task::JoinHandle}; use tokio_stream::StreamExt; use crate::wrapper::LndRpcWrapper; diff --git a/src/main.rs b/src/main.rs index 9641a4a..2c3c092 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,11 +1,8 @@ use bitcoin::Network; -use payday_core::api::lightining_api::{GetLightningBalanceApi, LightningInvoiceApi}; -use payday_core::api::on_chain_api::{ - GetOnChainBalanceApi, OnChainInvoiceApi, OnChainTransactionStreamApi, -}; +use payday_core::api::on_chain_api::OnChainTransactionStreamApi; use payday_core::Result; -use payday_node_lnd::lnd::{Lnd, LndConfig, LndOnChainPaymentEventStream}; +use payday_node_lnd::lnd::{LndConfig, LndOnChainPaymentEventStream}; use serde::{Deserialize, Serialize}; use tokio::task::JoinSet; From 15ee8ba66f1a548e6b9af8b38759db7337ee1350 Mon Sep 17 00:00:00 2001 From: tompro Date: Tue, 18 Feb 2025 18:16:35 +0100 Subject: [PATCH 7/7] Fix ci --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0322570..10765ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,8 @@ jobs: steps: - uses: actions/checkout@v4 + - name: download protoc + run: sudo apt-get install -y protobuf-compiler - name: Build run: cargo build --verbose - name: Run tests