depolymerization

wire gateway for Bitcoin/Ethereum
Log | Files | Refs | Submodules | README | LICENSE

commit 9e917164e24d5b7d7e6461d5f21c3efd0e35963c
parent 2e56f6960161ae30758dd44ff2181c54f8ed2c10
Author: Antoine A <>
Date:   Tue,  7 Jan 2025 16:44:49 +0100

update utils

Diffstat:
MCargo.lock | 435+++++++++++++++++++++++++++++++++++++++----------------------------------------
MCargo.toml | 2+-
Mbtc-wire/src/bin/segwit-demo.rs | 10++--------
Mbtc-wire/src/loops/worker.rs | 37+++++++++++++++++++++++++------------
Mbtc-wire/src/taler_utils.rs | 2+-
Mcommon/Cargo.toml | 2--
Mcommon/src/lib.rs | 1-
Meth-wire/src/loops/worker.rs | 20+++++++++++---------
Meth-wire/src/taler_util.rs | 2+-
Minstrumentation/src/gateway.rs | 10++++++----
Minstrumentation/src/utils.rs | 6++----
Mwire-gateway/src/main.rs | 2+-
12 files changed, 266 insertions(+), 263 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock @@ -18,18 +18,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] -name = "ahash" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy", -] - -[[package]] name = "aho-corasick" version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -116,13 +104,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.83" +version = "0.1.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" +checksum = "3f934833b4b7233644e5848f235df3f57ed8c80f1528a26c3dfa13d2147fa056" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.95", ] [[package]] @@ -142,13 +130,13 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "axum" -version = "0.7.9" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" +checksum = "6d6fd624c75e18b3b4c6b9caf42b1afe24437daaee904069137d8bab077be8b8" dependencies = [ - "async-trait", "axum-core", "bytes", + "form_urlencoded", "futures-util", "http", "http-body", @@ -176,11 +164,10 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.4.5" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199" +checksum = "df1362f362fd16024ae199c1970ce98f9661bf5ef94b9808fee734bc3698b733" dependencies = [ - "async-trait", "bytes", "futures-util", "http", @@ -211,12 +198,6 @@ dependencies = [ ] [[package]] -name = "base32" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "022dfe9eb35f19ebbcb51e0b40a5ab759f46ad60cadf7297e0bd085afb50e076" - -[[package]] name = "base64" version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -308,7 +289,7 @@ dependencies = [ "serde", "serde_json", "serde_repr", - "thiserror 2.0.7", + "thiserror", ] [[package]] @@ -337,9 +318,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.2.4" +version = "1.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9157bbaa6b165880c27a4293a474c91cdcf265cc68cc829bf10be0964a391caf" +checksum = "a012a0df96dd6d06ba9a1b29d6402d1a5d77c6befd2566afdc26e10603dc93d7" dependencies = [ "shlex", ] @@ -421,7 +402,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.95", ] [[package]] @@ -432,9 +413,9 @@ checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "clap_mangen" -version = "0.2.24" +version = "0.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbae9cbfdc5d4fa8711c09bd7b83f644cb48281ac35bf97af3e47b0675864bdf" +checksum = "acbfe6ac42a2438d0968beba18e3c35cacf16b0c25310bc22b1f5f3cffff09f4" dependencies = [ "clap", "roff", @@ -460,7 +441,6 @@ checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" name = "common" version = "0.1.0" dependencies = [ - "base32", "exponential-backoff", "flexi_logger", "log", @@ -472,7 +452,7 @@ dependencies = [ "serde_with", "sqlx", "taler-common", - "thiserror 2.0.7", + "thiserror", "uri-pack", "url", "zeroize", @@ -686,6 +666,32 @@ dependencies = [ ] [[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version", + "subtle", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.95", +] + +[[package]] name = "darling" version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -706,7 +712,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.90", + "syn 2.0.95", ] [[package]] @@ -717,7 +723,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.90", + "syn 2.0.95", ] [[package]] @@ -781,7 +787,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.95", ] [[package]] @@ -800,6 +806,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" [[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" +dependencies = [ + "curve25519-dalek", + "ed25519", + "sha2", + "subtle", +] + +[[package]] name = "either" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -862,7 +889,7 @@ dependencies = [ "serde", "serde_json", "serde_repr", - "thiserror 2.0.7", + "thiserror", ] [[package]] @@ -923,6 +950,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + +[[package]] name = "fixed-hash" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -945,13 +978,13 @@ dependencies = [ [[package]] name = "flexi_logger" -version = "0.29.7" +version = "0.29.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4613c3fa90ebf91dff72ff383a9324329c017819711bda86142be81368ac6fad" +checksum = "88a5a6882b2e137c4f2664562995865084eb5a00611fba30c582ef10354c4ad8" dependencies = [ "chrono", "log", - "thiserror 2.0.7", + "thiserror", ] [[package]] @@ -972,6 +1005,12 @@ 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" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1032,7 +1071,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.95", ] [[package]] @@ -1092,6 +1131,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] +name = "glob" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" + +[[package]] name = "half" version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1112,24 +1157,25 @@ name = "hashbrown" version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" -dependencies = [ - "ahash", - "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.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" +checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" dependencies = [ - "hashbrown 0.14.5", + "hashbrown 0.15.2", ] [[package]] @@ -1408,7 +1454,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.95", ] [[package]] @@ -1540,27 +1586,14 @@ checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "jiff" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db69f08d4fb10524cacdb074c10b296299d71274ddbc830a8ee65666867002e9" -dependencies = [ - "jiff-tzdb-platform", - "windows-sys 0.59.0", -] - -[[package]] -name = "jiff-tzdb" -version = "0.1.1" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91335e575850c5c4c673b9bd467b0e025f164ca59d0564f69d0c2ee0ffad4653" - -[[package]] -name = "jiff-tzdb-platform" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9835f0060a626fe59f160437bc725491a6af23133ea906500027d1bd2f8f4329" +checksum = "ed0ce60560149333a8e41ca7dc78799c47c5fd435e2bc18faf6a054382eec037" dependencies = [ - "jiff-tzdb", + "log", + "portable-atomic", + "portable-atomic-util", + "serde", ] [[package]] @@ -1584,24 +1617,24 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.168" +version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" +checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "libdeflate-sys" -version = "1.22.0" +version = "1.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f4ae7b48098016dc3bc64a35605668f0af4425ec1a4a175ce2d0c1129067932" +checksum = "413b667c8a795fcbe6287a75a8ce92b1dae928172c716fe95044cb2ec7877941" dependencies = [ "cc", ] [[package]] name = "libdeflater" -version = "1.22.0" +version = "1.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567ff5eb948d34d3f93d8da568e72db0f5a12c89efb6c3913e4d6b142cc7ec34" +checksum = "d78376c917eec0550b9c56c858de50e1b7ebf303116487562e624e63ce51453a" dependencies = [ "libdeflate-sys", ] @@ -1618,7 +1651,6 @@ version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" dependencies = [ - "cc", "pkg-config", "vcpkg", ] @@ -1673,9 +1705,9 @@ dependencies = [ [[package]] name = "matchit" -version = "0.7.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" [[package]] name = "md-5" @@ -1700,12 +1732,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - -[[package]] name = "miniz_oxide" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1726,16 +1752,6 @@ dependencies = [ ] [[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] name = "nu-ansi-term" version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1806,9 +1822,9 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "object" -version = "0.36.5" +version = "0.36.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" dependencies = [ "memchr", ] @@ -1877,12 +1893,6 @@ dependencies = [ ] [[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - -[[package]] name = "pem-rfc7468" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1899,27 +1909,27 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "phf" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" dependencies = [ "phf_shared", ] [[package]] name = "phf_shared" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" dependencies = [ "siphasher", ] [[package]] name = "pin-project-lite" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" @@ -1989,6 +1999,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" [[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + +[[package]] name = "postgres" version = "0.19.9" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2106,9 +2125,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] @@ -2290,6 +2309,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" [[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] name = "rustix" version = "0.38.42" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2345,9 +2373,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" [[package]] name = "ryu" @@ -2391,30 +2419,36 @@ dependencies = [ ] [[package]] +name = "semver" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" + +[[package]] name = "serde" -version = "1.0.216" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" +checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.216" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" +checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.95", ] [[package]] name = "serde_json" -version = "1.0.133" +version = "1.0.135" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" +checksum = "2b0d7ba2887406110130a978386c4e1befb98c674b4fba677954e4db976630d9" dependencies = [ "itoa", "memchr", @@ -2440,7 +2474,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.95", ] [[package]] @@ -2457,9 +2491,9 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.11.0" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e28bdad6db2b8340e449f7108f020b3b092e8583a9e3fb82713e1d4e71fe817" +checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa" dependencies = [ "base64", "chrono", @@ -2475,14 +2509,14 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.11.0" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d846214a9854ef724f3da161b426242d8de7c1fc7de2f89bb1efcb154dca79d" +checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.95", ] [[package]] @@ -2549,9 +2583,9 @@ dependencies = [ [[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" @@ -2601,20 +2635,10 @@ dependencies = [ ] [[package]] -name = "sqlformat" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bba3a93db0cc4f7bdece8bb09e77e2e785c20bfebf79eb8340ed80708048790" -dependencies = [ - "nom", - "unicode_categories", -] - -[[package]] name = "sqlx" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93334716a037193fac19df402f8571269c84a00852f6a7066b5d2616dcd64d3e" +checksum = "4410e73b3c0d8442c5f99b425d7a435b5ee0ae4167b3196771dd3f7a01be745f" dependencies = [ "sqlx-core", "sqlx-macros", @@ -2625,30 +2649,25 @@ dependencies = [ [[package]] name = "sqlx-core" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4d8060b456358185f7d50c55d9b5066ad956956fddec42ee2e8567134a8936e" +checksum = "6a007b6936676aa9ab40207cde35daab0a04b823be8ae004368c0793b96a61e0" dependencies = [ - "atoi", - "byteorder", "bytes", "crc", "crossbeam-queue", "either", "event-listener", - "futures-channel", "futures-core", "futures-intrusive", "futures-io", "futures-util", - "hashbrown 0.14.5", + "hashbrown 0.15.2", "hashlink", - "hex", "indexmap 2.7.0", "log", "memchr", "once_cell", - "paste", "percent-encoding", "rustls", "rustls-pemfile", @@ -2656,8 +2675,7 @@ dependencies = [ "serde_json", "sha2", "smallvec", - "sqlformat", - "thiserror 1.0.69", + "thiserror", "time", "tokio", "tokio-stream", @@ -2668,22 +2686,22 @@ dependencies = [ [[package]] name = "sqlx-macros" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cac0692bcc9de3b073e8d747391827297e075c7710ff6276d9f7a1f3d58c6657" +checksum = "3112e2ad78643fef903618d78cf0aec1cb3134b019730edb039b69eaf531f310" dependencies = [ "proc-macro2", "quote", "sqlx-core", "sqlx-macros-core", - "syn 2.0.90", + "syn 2.0.95", ] [[package]] name = "sqlx-macros-core" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1804e8a7c7865599c9c79be146dc8a9fd8cc86935fa641d3ea58e5f0688abaa5" +checksum = "4e9f90acc5ab146a99bf5061a7eb4976b573f560bc898ef3bf8435448dd5e7ad" dependencies = [ "dotenvy", "either", @@ -2699,7 +2717,7 @@ dependencies = [ "sqlx-mysql", "sqlx-postgres", "sqlx-sqlite", - "syn 2.0.90", + "syn 2.0.95", "tempfile", "tokio", "url", @@ -2707,9 +2725,9 @@ dependencies = [ [[package]] name = "sqlx-mysql" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64bb4714269afa44aef2755150a0fc19d756fb580a67db8885608cf02f47d06a" +checksum = "4560278f0e00ce64938540546f59f590d60beee33fffbd3b9cd47851e5fff233" dependencies = [ "atoi", "base64", @@ -2742,7 +2760,7 @@ dependencies = [ "smallvec", "sqlx-core", "stringprep", - "thiserror 1.0.69", + "thiserror", "time", "tracing", "whoami", @@ -2750,9 +2768,9 @@ dependencies = [ [[package]] name = "sqlx-postgres" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fa91a732d854c5d7726349bb4bb879bb9478993ceb764247660aee25f67c2f8" +checksum = "c5b98a57f363ed6764d5b3a12bfedf62f07aa16e1856a7ddc2a0bb190a959613" dependencies = [ "atoi", "base64", @@ -2763,7 +2781,6 @@ dependencies = [ "etcetera", "futures-channel", "futures-core", - "futures-io", "futures-util", "hex", "hkdf", @@ -2781,7 +2798,7 @@ dependencies = [ "smallvec", "sqlx-core", "stringprep", - "thiserror 1.0.69", + "thiserror", "time", "tracing", "whoami", @@ -2789,9 +2806,9 @@ dependencies = [ [[package]] name = "sqlx-sqlite" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5b2cf34a45953bfd3daaf3db0f7a7878ab9b7a6b91b422d24a7a9e4c857b680" +checksum = "f85ca71d3a5b24e64e1d08dd8fe36c6c95c339a896cc33068148906784620540" dependencies = [ "atoi", "flume", @@ -2859,9 +2876,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.90" +version = "2.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" +checksum = "46f71c0377baf4ef1cc3e3402ded576dccc315800fbc62dfc7fe04b009773b4a" dependencies = [ "proc-macro2", "quote", @@ -2882,16 +2899,17 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.95", ] [[package]] name = "taler-api" version = "0.1.0" -source = "git+https://git.taler.net/taler-rust.git/#95f68d984566240e7606df863ec61460e1b8ae93" +source = "git+https://git.taler.net/taler-rust.git/#517e6d3e02180b4f9a58fc74716fa96c96c9b9fb" dependencies = [ "axum", "dashmap", + "ed25519-dalek", "http-body-util", "libdeflater", "listenfd", @@ -2899,6 +2917,7 @@ dependencies = [ "serde_json", "sqlx", "taler-common", + "thiserror", "tokio", "tracing", "tracing-subscriber", @@ -2909,10 +2928,11 @@ dependencies = [ [[package]] name = "taler-common" version = "0.1.0" -source = "git+https://git.taler.net/taler-rust.git/#95f68d984566240e7606df863ec61460e1b8ae93" +source = "git+https://git.taler.net/taler-rust.git/#517e6d3e02180b4f9a58fc74716fa96c96c9b9fb" dependencies = [ - "base32", "fastrand", + "glob", + "indexmap 2.7.0", "jiff", "rand", "serde", @@ -2920,18 +2940,21 @@ dependencies = [ "serde_urlencoded", "serde_with", "sqlx", - "thiserror 2.0.7", + "tempfile", + "thiserror", + "tracing", "url", ] [[package]] name = "tempfile" -version = "3.14.0" +version = "3.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" +checksum = "9a8a559c81686f576e8cd0290cd2a24a2a9ad80c98b3478856500fcbd7acd704" dependencies = [ "cfg-if", "fastrand", + "getrandom", "once_cell", "rustix", "windows-sys 0.59.0", @@ -2948,42 +2971,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.69" +version = "2.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +checksum = "f072643fd0190df67a8bab670c20ef5d8737177d6ac6b2e9a236cb096206b2cc" dependencies = [ - "thiserror-impl 1.0.69", -] - -[[package]] -name = "thiserror" -version = "2.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93605438cbd668185516ab499d589afb7ee1859ea3d5fc8f6b0755e1c7443767" -dependencies = [ - "thiserror-impl 2.0.7", + "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.69" +version = "2.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +checksum = "7b50fa271071aae2e6ee85f842e2e28ba8cd2c5fb67f11fcb1fd70b276f9e7d4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", -] - -[[package]] -name = "thiserror-impl" -version = "2.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d8749b4531af2117677a5fcd12b1348a3fe2b81e36e61ffeac5c4aa3273e36" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.90", + "syn 2.0.95", ] [[package]] @@ -3064,9 +3067,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +checksum = "022db8904dfa342efe721985167e9fcd16c29b226db4397ed752a761cfce81e8" dependencies = [ "tinyvec_macros", ] @@ -3102,7 +3105,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.95", ] [[package]] @@ -3203,7 +3206,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.95", ] [[package]] @@ -3263,7 +3266,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04659ddb06c87d233c566112c1c9c5b9e98256d9af50ec3bc9c8327f873a7568" dependencies = [ "quote", - "syn 2.0.90", + "syn 2.0.95", ] [[package]] @@ -3330,12 +3333,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" [[package]] -name = "unicode_categories" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" - -[[package]] name = "untrusted" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3369,7 +3366,7 @@ dependencies = [ "quickcheck", "quickcheck_macros", "serde_json", - "thiserror 2.0.7", + "thiserror", "url", ] @@ -3470,7 +3467,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.95", "wasm-bindgen-shared", ] @@ -3492,7 +3489,7 @@ checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.95", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3744,7 +3741,7 @@ dependencies = [ "sqlx", "taler-api", "taler-common", - "thiserror 2.0.7", + "thiserror", "time", "tokio", ] @@ -3781,7 +3778,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.95", "synstructure", ] @@ -3803,7 +3800,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.95", ] [[package]] @@ -3823,7 +3820,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.95", "synstructure", ] @@ -3852,5 +3849,5 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.95", ] diff --git a/Cargo.toml b/Cargo.toml @@ -17,7 +17,7 @@ thiserror = "2.0.4" serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } tokio = { version = "1.42", features = ["macros"] } -axum = "0.7.9" +axum = "0.8.1" sqlx = { version = "0.8", features = [ "postgres", "runtime-tokio-rustls", diff --git a/btc-wire/src/bin/segwit-demo.rs b/btc-wire/src/bin/segwit-demo.rs @@ -4,10 +4,7 @@ use bech32::Hrp; use bitcoin::{Address, Amount, Network}; use btc_wire::segwit::decode_segwit_msg; use btc_wire::{rpc_utils, segwit::encode_segwit_addr}; -use common::{ - base32::{self, Alphabet}, - rand_slice, -}; +use common::{rand_slice, taler_common::types::base32}; pub fn main() { let address = Address::from_str("tb1qhxrhccqexg0dv4nltgkuw4fg2ce7muplmjsn0v") @@ -28,10 +25,7 @@ pub fn main() { ); println!("\nⅡ - Generate fake segwit addresses"); - let decoded: [u8; 32] = base32::decode(Alphabet::Crockford, reserve_pub) - .unwrap() - .try_into() - .unwrap(); + let decoded: [u8; 32] = base32::decode(reserve_pub.as_bytes()).unwrap(); println!("Decode reserve public key: 0x{}", hex::encode(&decoded[..])); let prefix: [u8; 4] = rand_slice(); println!("Generate random prefix 0x{}", hex::encode(prefix)); diff --git a/btc-wire/src/loops/worker.rs b/btc-wire/src/loops/worker.rs @@ -32,8 +32,7 @@ use common::{ reconnect::AutoReconnectDb, sql::{sql_array, sql_url}, status::{BounceStatus, DebitStatus}, - taler_common::api_common::base32, - taler_common::types::timestamp::Timestamp, + taler_common::types::{base32::Base32, timestamp::Timestamp}, }; use postgres::{fallible_iterator::FallibleIterator, Client}; @@ -117,9 +116,11 @@ pub fn worker(mut rpc: AutoRpcWallet, mut db: AutoReconnectDb, mut state: WireSt &id.as_byte_array().as_slice(), ], )?; + let wtid: &[u8] = row.get(0); + let wtid: [u8; 32] = wtid.try_into().unwrap(); info!( ">> (bump) {} replace {} with {}", - base32(row.get(0)), + Base32::from(wtid), id, bump.txid ); @@ -306,7 +307,7 @@ fn sync_chain_removed( write!( &mut buf, "\n\tcredit {} in {} from {}", - base32(&key), + Base32::from(key), id, addr ) @@ -336,13 +337,13 @@ fn sync_chain_incoming_confirmed( let credit_addr = full.details[0].address.clone().unwrap().assume_checked(); let amount = btc_to_taler(&full.amount, state.currency); let nb = db.execute("INSERT INTO tx_in (received, amount, reserve_pub, debit_acc, credit_acc) VALUES ($1, ($2, $3)::taler_amount, $4, $5, $6) ON CONFLICT (reserve_pub) DO NOTHING ", &[ - &((full.time * 1000000) as i64), &(amount.decimal.val as i64), &(amount.decimal.frac as i32), &reserve_pub.as_slice(), &btc_payto_url(&debit_addr).raw(), &btc_payto_url(&credit_addr).raw() + &((full.time * 1000000) as i64), &(amount.val as i64), &(amount.frac as i32), &reserve_pub.as_slice(), &btc_payto_url(&debit_addr).raw(), &btc_payto_url(&credit_addr).raw() ])?; if nb > 0 { info!( "<< {} {} in {} from {}", amount, - base32(&reserve_pub), + Base32::from(reserve_pub), id, debit_addr ); @@ -386,7 +387,10 @@ fn sync_chain_debit( ], )?; if nb_row > 0 { - warn!(">> (conflict) {} in {id} to {credit_addr}", base32(wtid)); + warn!( + ">> (conflict) {} in {id} to {credit_addr}", + Base32::from(*wtid) + ); } } } else { @@ -413,7 +417,7 @@ fn sync_chain_debit( if nb_row > 0 { warn!( ">> (recovered) {amount} {} in {id} to {credit_addr}", - base32(wtid) + Base32::from(*wtid) ); } } @@ -429,7 +433,10 @@ fn sync_chain_debit( ], )?; if nb_row > 0 { - info!(">> (recovered) {} replace {txid} with {id}", base32(wtid),); + info!( + ">> (recovered) {} replace {txid} with {id}", + Base32::from(*wtid) + ); } } } @@ -440,12 +447,12 @@ fn sync_chain_debit( let debit_addr = sender_address(rpc, full)?; let nb = db.execute( "INSERT INTO tx_out (created, amount, wtid, debit_acc, credit_acc, exchange_url, status, txid, request_uid) VALUES ($1, ($2, $3)::taler_amount, $4, $5, $6, $7, $8, $9, $10) ON CONFLICT (wtid) DO NOTHING", - &[&((full.time*1000000) as i64), &(amount.decimal.val as i64), &(amount.decimal.frac as i32), &wtid.as_slice(), &btc_payto_url(&debit_addr).raw(), &btc_payto_url(&credit_addr).raw(), &state.base_url.as_ref(), &(DebitStatus::Sent as i16), &id.as_byte_array().as_slice(), &None::<&[u8]>], + &[&((full.time*1000000) as i64), &(amount.val as i64), &(amount.frac as i32), &wtid.as_slice(), &btc_payto_url(&debit_addr).raw(), &btc_payto_url(&credit_addr).raw(), &state.base_url.as_ref(), &(DebitStatus::Sent as i16), &id.as_byte_array().as_slice(), &None::<&[u8]>], )?; if nb > 0 { warn!( ">> (onchain) {amount} {} in {id} to {credit_addr}", - base32(wtid) + Base32::from(*wtid) ); } } @@ -591,7 +598,13 @@ fn debit(db: &mut Client, rpc: &mut Rpc, state: &WireState) -> LoopResult<bool> ], )?; let amount = btc_to_taler(&amount.to_signed().unwrap(), state.currency); - info!(">> {} {} in {} to {}", amount, base32(&wtid), tx_id, addr); + info!( + ">> {} {} in {} to {}", + amount, + Base32::from(wtid), + tx_id, + addr + ); } Ok(row.is_some()) } diff --git a/btc-wire/src/taler_utils.rs b/btc-wire/src/taler_utils.rs @@ -65,6 +65,6 @@ pub fn taler_to_btc(amount: &Amount, currency: CurrencyBtc) -> Result<BtcAmount, )); } - let sat = amount.decimal.val * FRAC_BASE as u64 + amount.decimal.frac as u64; + let sat = amount.val * FRAC_BASE as u64 + amount.frac as u64; Ok(BtcAmount::from_sat(sat)) } diff --git a/common/Cargo.toml b/common/Cargo.toml @@ -16,8 +16,6 @@ serde_with = "3.3.0" serde_json.workspace = true # Url format url.workspace = true -# Crockford’s base32 -base32 = "0.5.0" # Error macros thiserror.workspace = true # Ini files diff --git a/common/src/lib.rs b/common/src/lib.rs @@ -19,7 +19,6 @@ use ::log::error; use rand::{rngs::OsRng, RngCore}; use zeroize::Zeroizing; -pub use base32; pub use postgres; pub use rand; pub use taler_common; diff --git a/eth-wire/src/loops/worker.rs b/eth-wire/src/loops/worker.rs @@ -22,7 +22,7 @@ use common::{ reconnect::AutoReconnectDb, sql::{sql_array, sql_url}, status::{BounceStatus, DebitStatus}, - taler_common::{api_common::base32, types::timestamp::Timestamp}, + taler_common::types::{base32::Base32, timestamp::Timestamp}, }; use eth_wire::{ rpc::{self, AutoRpcWallet, Rpc, RpcClient, Transaction, TransactionRequest}, @@ -245,7 +245,7 @@ fn sync_chain_removed( write!( &mut buf, "\n\tcredit {} in {} from {}", - base32(&key), + Base32::from(key), hex::encode(id), hex::encode(addr) ) @@ -279,13 +279,13 @@ fn sync_chain_incoming_confirmed( let amount = eth_to_taler(&tx.value, state.currency); let credit_addr = tx.from.expect("Not coinbase"); let nb = db.execute("INSERT INTO tx_in (received, amount, reserve_pub, debit_acc, credit_acc) VALUES ($1, ($2, $3)::taler_amount, $4, $5, $6) ON CONFLICT (reserve_pub) DO NOTHING ", &[ - &Timestamp::now().as_sql_micros(), &(amount.decimal.val as i64), &(amount.decimal.frac as i32), &reserve_pub.as_ref(), &eth_payto_url(&credit_addr).raw(), &state.payto.raw() + &Timestamp::now().as_sql_micros(), &(amount.val as i64), &(amount.frac as i32), &reserve_pub.as_ref(), &eth_payto_url(&credit_addr).raw(), &state.payto.raw() ])?; if nb > 0 { info!( "<< {} {} in {} from {}", amount, - base32(&reserve_pub), + Base32::from(reserve_pub), hex::encode(tx.hash), hex::encode(credit_addr), ); @@ -340,7 +340,7 @@ fn sync_chain_outgoing(tx: &SyncTransaction, db: &mut Client, state: &WireState) warn!( ">> (recovered) {} {} in {} to {}", amount, - base32(&wtid), + Base32::from(wtid), hex::encode(tx.hash), hex::encode(credit_addr) ); @@ -353,13 +353,13 @@ fn sync_chain_outgoing(tx: &SyncTransaction, db: &mut Client, state: &WireState) // Else add to database let nb = db.execute( "INSERT INTO tx_out (created, amount, wtid, debit_acc, credit_acc, exchange_url, status, txid, request_uid) VALUES ($1, ($2, $3)::taler_amount, $4, $5, $6, $7, $8, $9, $10) ON CONFLICT (wtid) DO NOTHING", - &[&Timestamp::now().as_sql_micros(), &(amount.decimal.val as i64), &(amount.decimal.frac as i32), &wtid.as_ref(), &eth_payto_url(&state.address).raw(), &eth_payto_url(&credit_addr).raw(), &state.base_url.as_ref(), &(DebitStatus::Sent as i16), &tx.hash.as_ref(), &None::<&[u8]>], + &[&Timestamp::now().as_sql_micros(), &(amount.val as i64), &(amount.frac as i32), &wtid.as_ref(), &eth_payto_url(&state.address).raw(), &eth_payto_url(&credit_addr).raw(), &state.base_url.as_ref(), &(DebitStatus::Sent as i16), &tx.hash.as_ref(), &None::<&[u8]>], )?; if nb > 0 { warn!( ">> (onchain) {} {} in {} to {}", amount, - base32(&wtid), + Base32::from(wtid), hex::encode(tx.hash), hex::encode(credit_addr) ); @@ -453,7 +453,7 @@ fn debit(db: &mut Client, rpc: &mut Rpc, state: &WireState) -> LoopResult<bool> info!( ">> {} {} in {} to {}", amount, - base32(&wtid), + Base32::from(wtid), hex::encode(tx_id), hex::encode(addr) ); @@ -487,7 +487,9 @@ fn bump(db: &mut Client, rpc: &mut Rpc, state: &WireState) -> LoopResult<bool> { "UPDATE tx_out SET sent=$1 WHERE id=$2 RETURNING wtid", &[&now.as_sql_micros(), &id], )?; - info!(">> (bump) {} in {}", base32(row.get(0)), hex::encode(txid)); + let wtid: &[u8] = row.get(0); + let wtid: [u8; 32] = wtid.try_into().unwrap(); + info!(">> (bump) {} in {}", Base32::from(wtid), hex::encode(txid)); } Ok(row.is_some()) } else { diff --git a/eth-wire/src/taler_util.rs b/eth-wire/src/taler_util.rs @@ -68,5 +68,5 @@ pub fn taler_to_eth(amount: &Amount, currency: CurrencyEth) -> Result<U256, Stri )); } - Ok(U256::from(amount.decimal.val) * WEI + U256::from(amount.decimal.frac) * TRUNC) + Ok(U256::from(amount.val) * WEI + U256::from(amount.frac) * TRUNC) } diff --git a/instrumentation/src/gateway.rs b/instrumentation/src/gateway.rs @@ -20,10 +20,12 @@ use btc_wire::taler_utils::btc_payto_url; use common::{ rand_slice, taler_common::{ - api_common::Base32, api_wire::TransferRequest, - types::amount::Amount as TalerAmount, - types::payto::{payto, Payto}, + types::{ + amount::Amount as TalerAmount, + base32::Base32, + payto::{payto, Payto}, + }, }, }; use libdeflater::{CompressionLvl, Compressor}; @@ -165,7 +167,7 @@ pub fn api(ctx: TestCtx) { 200 ); // Collision - request.amount.decimal.frac += 42; + request.amount.frac += 42; assert_eq!( http_code(ureq::post(&format!("{}transfer", ctx.gateway_url)).send_json(&request)), 409 diff --git a/instrumentation/src/utils.rs b/instrumentation/src/utils.rs @@ -31,10 +31,8 @@ use common::{ config::TalerConfig, rand_slice, taler_common::{ - api_common::Base32, api_wire::{IncomingBankTransaction, IncomingHistory, OutgoingHistory, TransferRequest}, - types::amount::Amount, - types::payto::Payto, + types::{amount::Amount, base32::Base32, payto::Payto}, }, url::Url, }; @@ -65,7 +63,7 @@ pub fn check_incoming(base_url: &str, txs: &[([u8; 32], Amount)]) -> bool { history.incoming_transactions.iter().any(|h| { matches!( h, - IncomingBankTransaction::IncomingReserveTransaction { + IncomingBankTransaction::Reserve { reserve_pub, amount, .. diff --git a/wire-gateway/src/main.rs b/wire-gateway/src/main.rs @@ -169,7 +169,7 @@ impl WireGatewayImpl for ServerState { ) }, |r| { - Ok(IncomingBankTransaction::IncomingReserveTransaction { + Ok(IncomingBankTransaction::Reserve { row_id: r.try_get_safeu64(0)?, date: r.try_get_timestamp(1)?, amount: r.try_get_amount_i(2, self.currency())?,