diff --git a/backend-lib/Cargo.lock b/backend-lib/Cargo.lock index 8fb6a9c4..49cc9d62 100644 --- a/backend-lib/Cargo.lock +++ b/backend-lib/Cargo.lock @@ -2,21 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "addr2line" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - [[package]] name = "aead" version = "0.5.2" @@ -52,24 +37,24 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] [[package]] name = "allocator-api2" -version = "0.2.16" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "anyhow" -version = "1.0.80" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1" +checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" [[package]] name = "arrayref" @@ -85,24 +70,9 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "backtrace" -version = "0.3.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "base58" @@ -165,9 +135,9 @@ dependencies = [ [[package]] name = "bitflags" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "bitvec" @@ -227,9 +197,9 @@ dependencies = [ [[package]] name = "bs58" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" dependencies = [ "sha2", "tinyvec", @@ -237,9 +207,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.15.4" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ff69b9dd49fd426c69a0db9fc04dd934cdb6645ff000864d98f7e2af8830eaa" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "byteorder" @@ -249,9 +219,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cbc" @@ -264,9 +234,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.90" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" +checksum = "17f6e324229dc011159fcc089755d1e2e216a90d43a7dea6853ca740b84f35e7" [[package]] name = "cesu8" @@ -317,9 +287,9 @@ dependencies = [ [[package]] name = "combine" -version = "4.6.6" +version = "4.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" dependencies = [ "bytes", "memchr", @@ -421,9 +391,9 @@ dependencies = [ [[package]] name = "dlopen2" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bc2c7ed06fd72a8513ded8d0d2f6fd2655a85d6885c48cae8625d80faf28c03" +checksum = "9e1297103d2bbaea85724fcee6294c2d50b1081f9ad47d0f6f6f61eda65315a6" dependencies = [ "dlopen2_derive", "libc", @@ -439,7 +409,7 @@ checksum = "f2b99bf03862d7f545ebc28ddd33a665b50865f4dfd84031a393823879bd4c54" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -453,9 +423,9 @@ dependencies = [ [[package]] name = "either" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" +checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" [[package]] name = "equihash" @@ -492,28 +462,6 @@ dependencies = [ "blake2b_simd", ] -[[package]] -name = "failure" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" -dependencies = [ - "backtrace", - "failure_derive", -] - -[[package]] -name = "failure_derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "synstructure", -] - [[package]] name = "fallible-iterator" version = "0.2.0" @@ -528,9 +476,9 @@ checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" [[package]] name = "fastrand" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" [[package]] name = "ff" @@ -581,21 +529,15 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" dependencies = [ "cfg-if", "libc", "wasi", ] -[[package]] -name = "gimli" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" - [[package]] name = "group" version = "0.13.0" @@ -694,9 +636,9 @@ dependencies = [ [[package]] name = "heck" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" @@ -739,9 +681,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.5" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown", @@ -758,18 +700,18 @@ dependencies = [ [[package]] name = "itertools" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ "either", ] [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jni" @@ -896,9 +838,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "memuse" @@ -915,26 +857,17 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" -[[package]] -name = "miniz_oxide" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" -dependencies = [ - "adler", -] - [[package]] name = "multimap" -version = "0.8.3" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" +checksum = "defc4c55412d89136f966bbb339008b474350e5e6e78d2714439c386b3137a03" [[package]] name = "ndk-sys" -version = "0.3.0" +version = "0.5.0+25.2.9519653" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e5a6ae77c8ee183dcbbba6150e2e6b9f3f4196a7666c02a715a95692ec1fa97" +checksum = "8c196769dd60fd4f363e11d948139556a344e79d451aeb2fa2fd040738ef7691" dependencies = [ "jni-sys", ] @@ -1010,15 +943,6 @@ dependencies = [ "libc", ] -[[package]] -name = "object" -version = "0.32.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" -dependencies = [ - "memchr", -] - [[package]] name = "once_cell" version = "1.19.0" @@ -1078,9 +1002,9 @@ dependencies = [ [[package]] name = "paranoid-android" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e736c9fbaf42b43459cd1fded3dd272968daadfcbc5660ee231a12899f092289" +checksum = "101795d63d371b43e38d6e7254677657be82f17022f7f7893c268f33ac0caadc" dependencies = [ "lazy_static", "ndk-sys", @@ -1144,9 +1068,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pkg-config" @@ -1179,28 +1103,28 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "prettyplease" -version = "0.2.16" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" +checksum = "5ac2cf0f2e4f42b49f5ffd07dae8d746508ef7526c13940e5f524012ae6c6550" dependencies = [ "proc-macro2", - "syn 2.0.52", + "syn", ] [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" dependencies = [ "unicode-ident", ] [[package]] name = "prost" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a" +checksum = "d0f5d036824e4761737860779c906171497f6d55681139d8312388f8fe398922" dependencies = [ "bytes", "prost-derive", @@ -1208,9 +1132,9 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c55e02e35260070b6f716a2423c2ff1c3bb1642ddca6f99e1f26d06268a0e2d2" +checksum = "80b776a1b2dc779f5ee0641f8ade0125bc1298dd41a9a0c16d8bd57b42d222b1" dependencies = [ "bytes", "heck", @@ -1223,38 +1147,37 @@ dependencies = [ "prost", "prost-types", "regex", - "syn 2.0.52", + "syn", "tempfile", - "which", ] [[package]] name = "prost-derive" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e" +checksum = "19de2de2a00075bf566bee3bd4db014b11587e84184d3f7a791bc17f1a8e9e48" dependencies = [ "anyhow", "itertools", "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] name = "prost-types" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "193898f59edcf43c26227dcd4c8427f00d99d61e95dcde58dabd49fa291d470e" +checksum = "3235c33eb02c1f1e212abdbe34c78b264b038fb58ca612664343271e36e55ffe" dependencies = [ "prost", ] [[package]] name = "quote" -version = "1.0.35" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -1297,9 +1220,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4963ed1bc86e4f3ee217022bd855b297cef07fb9eac5dfa1f788b220b49b3bd" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ "either", "rayon-core", @@ -1348,9 +1271,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.3" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", @@ -1371,9 +1294,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "ring" @@ -1414,17 +1337,11 @@ dependencies = [ "time", ] -[[package]] -name = "rustc-demangle" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" - [[package]] name = "rustix" -version = "0.38.31" +version = "0.38.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" +checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" dependencies = [ "bitflags", "errno", @@ -1526,22 +1443,22 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.197" +version = "1.0.198" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.198" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -1566,9 +1483,9 @@ dependencies = [ [[package]] name = "shardtree" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d766257c56a1bdd75479c256b97c92e72788a9afb18b5199f58faf7188dc99d9" +checksum = "3b3cdd24424ce0b381646737fedddc33c4dcf7dcd2d545056b53f7982097bef5" dependencies = [ "bitflags", "either", @@ -1578,9 +1495,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "spin" @@ -1602,38 +1519,15 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.109" +version = "2.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "syn" -version = "2.0.52" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "synstructure" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "unicode-xid", -] - [[package]] name = "tap" version = "1.0.1" @@ -1654,22 +1548,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" +checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" +checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -1684,9 +1578,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.34" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", @@ -1705,9 +1599,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ "num-conv", "time-core", @@ -1738,7 +1632,7 @@ dependencies = [ "proc-macro2", "prost-build", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -1760,7 +1654,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -1831,12 +1725,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - [[package]] name = "universal-hash" version = "0.5.1" @@ -1855,9 +1743,9 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "uuid" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" [[package]] name = "valuable" @@ -1914,7 +1802,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.52", + "syn", "wasm-bindgen-shared", ] @@ -1936,7 +1824,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2015,7 +1903,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.4", + "windows-targets 0.52.5", ] [[package]] @@ -2035,17 +1923,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" dependencies = [ - "windows_aarch64_gnullvm 0.52.4", - "windows_aarch64_msvc 0.52.4", - "windows_i686_gnu 0.52.4", - "windows_i686_msvc 0.52.4", - "windows_x86_64_gnu 0.52.4", - "windows_x86_64_gnullvm 0.52.4", - "windows_x86_64_msvc 0.52.4", + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "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", ] [[package]] @@ -2056,9 +1945,9 @@ checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" [[package]] name = "windows_aarch64_msvc" @@ -2068,9 +1957,9 @@ checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_aarch64_msvc" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" [[package]] name = "windows_i686_gnu" @@ -2080,9 +1969,15 @@ checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_gnu" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" [[package]] name = "windows_i686_msvc" @@ -2092,9 +1987,9 @@ checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_i686_msvc" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" [[package]] name = "windows_x86_64_gnu" @@ -2104,9 +1999,9 @@ checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" [[package]] name = "windows_x86_64_gnullvm" @@ -2116,9 +2011,9 @@ checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" [[package]] name = "windows_x86_64_msvc" @@ -2128,9 +2023,9 @@ checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "windows_x86_64_msvc" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "wyz" @@ -2151,8 +2046,8 @@ checksum = "213b7324336b53d2414b2db8537e56544d981803139155afa84f76eeebb7a546" name = "zcash-android-wallet-sdk" version = "0.0.4" dependencies = [ + "anyhow", "dlopen2", - "failure", "hdwallet", "hdwallet-bitcoin", "hex", @@ -2418,7 +2313,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -2438,7 +2333,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] diff --git a/backend-lib/Cargo.toml b/backend-lib/Cargo.toml index b1954be9..95311ab1 100644 --- a/backend-lib/Cargo.toml +++ b/backend-lib/Cargo.toml @@ -8,14 +8,12 @@ authors = [ description = "JNI backend for the Android wallet SDK" publish = false edition = "2018" -rust-version = "1.75" +rust-version = "1.77" [dependencies] -failure = "0.1" hdwallet = "0.4" hdwallet-bitcoin = "0.4" hex = "0.4" -jni = { version = "0.21", default-features = false } orchard = "0.8" prost = "0.12" rusqlite = "0.29" @@ -32,6 +30,10 @@ zcash_proofs = "0.15" # Initialization rayon = "1.7" +# JNI +anyhow = "1" +jni = { version = "0.21", default-features = false } + # Logging log-panics = "2.0.0" paranoid-android = "0.2" @@ -39,7 +41,7 @@ tracing = "0.1" tracing-subscriber = "0.3" # Conditional access to newer NDK features -dlopen2 = "0.6" +dlopen2 = "0.7" libc = "0.2" ## Uncomment this to test librustzcash changes locally diff --git a/backend-lib/src/main/rust/lib.rs b/backend-lib/src/main/rust/lib.rs index cb81ec8b..de4099b3 100644 --- a/backend-lib/src/main/rust/lib.rs +++ b/backend-lib/src/main/rust/lib.rs @@ -5,7 +5,7 @@ use std::panic; use std::path::Path; use std::ptr; -use failure::format_err; +use anyhow::anyhow; use jni::objects::{JByteArray, JObject, JObjectArray, JValue}; use jni::{ objects::{JClass, JString}, @@ -87,27 +87,27 @@ fn wallet_db( env: &mut JNIEnv, params: P, db_data: JString, -) -> Result, failure::Error> { +) -> anyhow::Result> { WalletDb::for_path(utils::java_string_to_rust(env, &db_data), params) - .map_err(|e| format_err!("Error opening wallet database connection: {}", e)) + .map_err(|e| anyhow!("Error opening wallet database connection: {}", e)) } -fn block_db(env: &mut JNIEnv, fsblockdb_root: JString) -> Result { +fn block_db(env: &mut JNIEnv, fsblockdb_root: JString) -> anyhow::Result { FsBlockDb::for_path(utils::java_string_to_rust(env, &fsblockdb_root)) - .map_err(|e| format_err!("Error opening block source database connection: {:?}", e)) + .map_err(|e| anyhow!("Error opening block source database connection: {:?}", e)) } -fn account_id_from_jint(account: jint) -> Result { +fn account_id_from_jint(account: jint) -> anyhow::Result { u32::try_from(account) .map_err(|_| ()) .and_then(|id| zip32::AccountId::try_from(id).map_err(|_| ())) - .map_err(|_| format_err!("Invalid account ID")) + .map_err(|_| anyhow!("Invalid account ID")) } fn account_id_from_jni<'local, P: Parameters>( db_data: &WalletDb, account_index: jint, -) -> Result { +) -> anyhow::Result { let requested_account_index = account_id_from_jint(account_index)?; // Find the single account matching the given ZIP 32 account index. @@ -118,7 +118,7 @@ fn account_id_from_jni<'local, P: Parameters>( db_data .get_account(account_id) .map_err(|e| { - format_err!( + anyhow!( "Database error encountered retrieving account {:?}: {}", account_id, e @@ -126,7 +126,7 @@ fn account_id_from_jni<'local, P: Parameters>( }) .and_then(|acct_opt| acct_opt.ok_or_else(|| - format_err!( + anyhow!( "Wallet data corrupted: unable to retrieve account data for account {:?}", account_id ) @@ -140,8 +140,8 @@ fn account_id_from_jni<'local, P: Parameters>( match (accounts.next(), accounts.next()) { (Some(account), None) => Ok(account?.id()), - (None, None) => Err(format_err!("Account does not exist")), - (_, Some(_)) => Err(format_err!("Account index matches more than one account")), + (None, None) => Err(anyhow!("Account does not exist")), + (_, Some(_)) => Err(anyhow!("Account index matches more than one account")), } } @@ -201,10 +201,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_initBlock match init_blockmeta_db(&mut db_meta) { Ok(()) => Ok(0), - Err(e) => Err(format_err!( - "Error while initializing block metadata DB: {}", - e - )), + Err(e) => Err(anyhow!("Error while initializing block metadata DB: {}", e)), } }); unwrap_exc_or(&mut env, res, -1) @@ -229,7 +226,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_initDataD let res = catch_unwind(&mut env, |env| { let network = parse_network(network_id as u32)?; let mut db_data = wallet_db(env, network, db_data) - .map_err(|e| format_err!("Error while opening data DB: {}", e))?; + .map_err(|e| anyhow!("Error while opening data DB: {}", e))?; let seed = (!seed.is_null()).then(|| SecretVec::new(env.convert_byte_array(seed).unwrap())); @@ -251,7 +248,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_initDataD { Ok(2) } - Err(e) => Err(format_err!("Error while initializing data DB: {}", e)), + Err(e) => Err(anyhow!("Error while initializing data DB: {}", e)), } }); unwrap_exc_or(&mut env, res, -1) @@ -271,17 +268,17 @@ fn encode_usk<'a>( ) } -fn decode_usk(env: &JNIEnv, usk: JByteArray) -> Result { +fn decode_usk(env: &JNIEnv, usk: JByteArray) -> anyhow::Result { let usk_bytes = SecretVec::new(env.convert_byte_array(usk).unwrap()); // The remainder of the function is safe. UnifiedSpendingKey::from_bytes(Era::Orchard, usk_bytes.expose_secret()).map_err(|e| match e { - DecodingError::EraMismatch(era) => format_err!( + DecodingError::EraMismatch(era) => anyhow!( "Spending key was from era {:?}, but {:?} was expected.", era, Era::Orchard ), - e => format_err!( + e => anyhow!( "An error occurred decoding the provided unified spending key: {:?}", e ), @@ -321,22 +318,22 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_createAcc let mut db_data = wallet_db(env, network, db_data)?; let seed = SecretVec::new(env.convert_byte_array(seed).unwrap()); let treestate = TreeState::decode(&env.convert_byte_array(treestate).unwrap()[..]) - .map_err(|e| format_err!("Invalid TreeState: {}", e))?; + .map_err(|e| anyhow!("Invalid TreeState: {}", e))?; let recover_until = recover_until.try_into().ok(); let birthday = AccountBirthday::from_treestate(treestate, recover_until).map_err(|e| match e { BirthdayError::HeightInvalid(e) => { - format_err!("Invalid TreeState: Invalid height: {}", e) + anyhow!("Invalid TreeState: Invalid height: {}", e) } BirthdayError::Decode(e) => { - format_err!("Invalid TreeState: Invalid frontier encoding: {}", e) + anyhow!("Invalid TreeState: Invalid frontier encoding: {}", e) } })?; let (account_id, usk) = db_data .create_account(&seed, &birthday) - .map_err(|e| format_err!("Error while initializing accounts: {}", e))?; + .map_err(|e| anyhow!("Error while initializing accounts: {}", e))?; let account = db_data.get_account(account_id)?.expect("just created"); let account_index = match account.source() { @@ -396,7 +393,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustDerivationTool_de let account = account_id_from_jint(account)?; let usk = UnifiedSpendingKey::from_seed(&network, seed.expose_secret(), account) - .map_err(|e| format_err!("error generating unified spending key from seed: {:?}", e))?; + .map_err(|e| anyhow!("error generating unified spending key from seed: {:?}", e))?; Ok(encode_usk(env, account, usk)?.into_raw()) }); @@ -421,16 +418,16 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustDerivationTool_de let accounts = if accounts > 0 { accounts as u32 } else { - return Err(format_err!("accounts argument must be greater than zero")); + return Err(anyhow!("accounts argument must be greater than zero")); }; let ufvks: Vec<_> = (0..accounts) .map(|account| { let account_id = zip32::AccountId::try_from(account) - .map_err(|_| format_err!("Invalid account ID"))?; + .map_err(|_| anyhow!("Invalid account ID"))?; UnifiedSpendingKey::from_seed(&network, &seed, account_id) .map_err(|e| { - format_err!("error generating unified spending key from seed: {:?}", e) + anyhow!("error generating unified spending key from seed: {:?}", e) }) .map(|usk| usk.to_unified_full_viewing_key().encode(&network)) }) @@ -466,7 +463,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustDerivationTool_de let account_id = account_id_from_jint(account_index)?; let ufvk = UnifiedSpendingKey::from_seed(&network, &seed, account_id) - .map_err(|e| format_err!("error generating unified spending key from seed: {:?}", e)) + .map_err(|e| anyhow!("error generating unified spending key from seed: {:?}", e)) .map(|usk| usk.to_unified_full_viewing_key())?; let (ua, _) = ufvk @@ -498,7 +495,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustDerivationTool_de let ufvk = match UnifiedFullViewingKey::decode(&network, &ufvk_string) { Ok(ufvk) => ufvk, Err(e) => { - return Err(format_err!( + return Err(anyhow!( "Error while deriving viewing key from string input: {}", e, )); @@ -564,8 +561,8 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_getCurren .expect("Couldn't create Java string!"); Ok(output.into_raw()) } - Ok(None) => Err(format_err!("{:?} is not known to the wallet", account)), - Err(e) => Err(format_err!("Error while fetching address: {}", e)), + Ok(None) => Err(anyhow!("{:?} is not known to the wallet", account)), + Err(e) => Err(anyhow!("Error while fetching address: {}", e)), } }); @@ -575,14 +572,14 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_getCurren struct UnifiedAddressParser(UnifiedAddress); impl zcash_address::TryFromRawAddress for UnifiedAddressParser { - type Error = failure::Error; + type Error = anyhow::Error; fn try_from_raw_unified( data: zcash_address::unified::Address, ) -> Result> { data.try_into() .map(UnifiedAddressParser) - .map_err(|e| format_err!("Invalid Unified Address: {}", e).into()) + .map_err(|e| anyhow!("Invalid Unified Address: {}", e).into()) } } @@ -603,8 +600,8 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_getTransp let (network, ua) = match ZcashAddress::try_from_encoded(&ua_str) { Ok(addr) => addr .convert::<(_, UnifiedAddressParser)>() - .map_err(|e| format_err!("Not a Unified Address: {}", e)), - Err(e) => return Err(format_err!("Invalid Zcash address: {}", e)), + .map_err(|e| anyhow!("Not a Unified Address: {}", e)), + Err(e) => return Err(anyhow!("Invalid Zcash address: {}", e)), }?; if let Some(taddr) = ua.0.transparent() { @@ -622,7 +619,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_getTransp .expect("Couldn't create Java string!"); Ok(output.into_raw()) } else { - Err(format_err!( + Err(anyhow!( "Unified Address doesn't contain a transparent receiver" )) } @@ -647,8 +644,8 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_getSaplin let (network, ua) = match ZcashAddress::try_from_encoded(&ua_str) { Ok(addr) => addr .convert::<(_, UnifiedAddressParser)>() - .map_err(|e| format_err!("Not a Unified Address: {}", e)), - Err(e) => return Err(format_err!("Invalid Zcash address: {}", e)), + .map_err(|e| anyhow!("Not a Unified Address: {}", e)), + Err(e) => return Err(anyhow!("Invalid Zcash address: {}", e)), }?; if let Some(addr) = ua.0.sapling() { @@ -657,7 +654,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_getSaplin .expect("Couldn't create Java string!"); Ok(output.into_raw()) } else { - Err(format_err!( + Err(anyhow!( "Unified Address doesn't contain a Sapling receiver" )) } @@ -700,7 +697,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_isValidSa Address::Sapling(_) => Ok(JNI_TRUE), Address::Transparent(_) | Address::Unified(_) => Ok(JNI_FALSE), }, - None => Err(format_err!("Address is for the wrong network")), + None => Err(anyhow!("Address is for the wrong network")), } }); unwrap_exc_or(&mut env, res, JNI_FALSE) @@ -725,7 +722,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_isValidTr Address::Sapling(_) | Address::Unified(_) => Ok(JNI_FALSE), Address::Transparent(_) => Ok(JNI_TRUE), }, - None => Err(format_err!("Address is for the wrong network")), + None => Err(anyhow!("Address is for the wrong network")), } }); unwrap_exc_or(&mut env, res, JNI_FALSE) @@ -750,7 +747,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_isValidUn Address::Unified(_) => Ok(JNI_TRUE), Address::Sapling(_) | Address::Transparent(_) => Ok(JNI_FALSE), }, - None => Err(format_err!("Address is for the wrong network")), + None => Err(anyhow!("Address is for the wrong network")), } }); unwrap_exc_or(&mut env, res, JNI_FALSE) @@ -777,21 +774,21 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_getTotalT let amount = (&db_data) .get_target_and_anchor_heights(min_confirmations) - .map_err(|e| format_err!("Error while fetching anchor height: {}", e)) + .map_err(|e| anyhow!("Error while fetching anchor height: {}", e)) .and_then(|opt_anchor| { opt_anchor .map(|(target, _)| target) // Include unconfirmed funds. - .ok_or(format_err!("Anchor height not available; scan required.")) + .ok_or(anyhow!("Anchor height not available; scan required.")) }) .and_then(|anchor| { (&db_data) .get_unspent_transparent_outputs(&taddr, anchor, &[]) - .map_err(|e| format_err!("Error while fetching verified balance: {}", e)) + .map_err(|e| anyhow!("Error while fetching verified balance: {}", e)) })? .iter() .map(|utxo| utxo.txout().value) .sum::>() - .ok_or_else(|| format_err!("Balance overflowed MAX_MONEY"))?; + .ok_or_else(|| anyhow!("Balance overflowed MAX_MONEY"))?; Ok(Amount::from(amount).into()) }); @@ -803,7 +800,7 @@ fn parse_protocol(code: i32) -> Option { match code { 2 => Some(ShieldedProtocol::Sapling), 3 => Some(ShieldedProtocol::Orchard), - _ => None + _ => None, } } @@ -817,7 +814,6 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_getMemoAs output_index: jint, network_id: jint, ) -> jstring { - let res = catch_unwind(&mut env, |env| { let _span = tracing::info_span!("RustBackend.getMemoAsUtf8").entered(); let network = parse_network(network_id as u32)?; @@ -825,17 +821,18 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_getMemoAs let txid_bytes = env.convert_byte_array(txid_bytes)?; let txid = TxId::read(&txid_bytes[..])?; - let protocol = parse_protocol(pool_type).ok_or(format_err!("Shielded protocol not recognized: {}", pool_type))?; + let protocol = parse_protocol(pool_type) + .ok_or(anyhow!("Shielded protocol not recognized: {}", pool_type))?; let output_index = u16::try_from(output_index)?; let memo = (&db_data) .get_memo(NoteId::new(txid, protocol, output_index)) - .map_err(|e| format_err!("An error occurred retrieving the memo, {}", e)) + .map_err(|e| anyhow!("An error occurred retrieving the memo, {}", e)) .and_then(|memo| match memo { Some(Memo::Empty) => Ok("".to_string()), Some(Memo::Text(memo)) => Ok(memo.into()), - None => Err(format_err!("Memo not available")), - _ => Err(format_err!("This memo does not contain UTF-8 text")), + None => Err(anyhow!("Memo not available")), + _ => Err(anyhow!("This memo does not contain UTF-8 text")), })?; let output = env.new_string(memo).expect("Couldn't create Java string!"); @@ -860,8 +857,8 @@ fn encode_blockmeta<'a>(env: &mut JNIEnv<'a>, meta: BlockMeta) -> jni::errors::R ) } -fn decode_blockmeta(env: &mut JNIEnv, obj: JObject) -> Result { - fn long_as_u32(env: &mut JNIEnv, obj: &JObject, name: &str) -> Result { +fn decode_blockmeta(env: &mut JNIEnv, obj: JObject) -> anyhow::Result { + fn long_as_u32(env: &mut JNIEnv, obj: &JObject, name: &str) -> anyhow::Result { Ok(u32::try_from(env.get_field(obj, name, "J")?.j()?)?) } @@ -869,7 +866,7 @@ fn decode_blockmeta(env: &mut JNIEnv, obj: JObject) -> Result Result<[u8; N], failure::Error> { + ) -> anyhow::Result<[u8; N]> { let field = JByteArray::from(env.get_field(obj, name, "[B")?.l()?); Ok(env.convert_byte_array(field)?[..].try_into()?) } @@ -911,7 +908,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_writeBloc match block_db.write_block_metadata(&block_meta) { Ok(()) => Ok(JNI_TRUE), - Err(e) => Err(format_err!( + Err(e) => Err(anyhow!( "Failed to write block metadata to FsBlockDb: {:?}", e )), @@ -936,7 +933,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_getLatest Ok(Some(block_height)) => Ok(i64::from(u32::from(block_height))), // Use -1 to return null across the FFI. Ok(None) => Ok(-1), - Err(e) => Err(format_err!( + Err(e) => Err(anyhow!( "Failed to read block metadata from FsBlockDb: {:?}", e )), @@ -960,7 +957,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_findBlock match block_db.find_block(height) { Ok(Some(meta)) => Ok(encode_blockmeta(env, meta)?.into_raw()), Ok(None) => Ok(ptr::null_mut()), - Err(e) => Err(format_err!( + Err(e) => Err(anyhow!( "Failed to read block metadata from FsBlockDb: {:?}", e )), @@ -984,7 +981,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_rewindBlo let height = BlockHeight::try_from(height)?; block_db.truncate_to_height(height).map_err(|e| { - format_err!( + anyhow!( "Error while rewinding block metadata DB to height {}: {}", height, e @@ -1022,7 +1019,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_getNeares )) } Ok(None) => Ok(height as i64), - Err(e) => Err(format_err!( + Err(e) => Err(anyhow!( "Error while getting nearest rewind height for {}: {}", height, e @@ -1051,7 +1048,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_rewindToH db_data .truncate_to_height(height) .map(|_| 1) - .map_err(|e| format_err!("Error while rewinding data DB to height {}: {}", height, e)) + .map_err(|e| anyhow!("Error while rewinding data DB to height {}: {}", height, e)) }); unwrap_exc_or(&mut env, res, JNI_FALSE) @@ -1061,12 +1058,12 @@ fn decode_subtree_root( env: &mut JNIEnv, obj: JObject, node_parser: impl FnOnce(&[u8]) -> std::io::Result, -) -> Result, failure::Error> { - fn long_as_u32(env: &mut JNIEnv, obj: &JObject, name: &str) -> Result { +) -> anyhow::Result> { + fn long_as_u32(env: &mut JNIEnv, obj: &JObject, name: &str) -> anyhow::Result { Ok(u32::try_from(env.get_field(obj, name, "J")?.j()?)?) } - fn byte_array(env: &mut JNIEnv, obj: &JObject, name: &str) -> Result, failure::Error> { + fn byte_array(env: &mut JNIEnv, obj: &JObject, name: &str) -> anyhow::Result> { let field = JByteArray::from(env.get_field(obj, name, "[B")?.l()?); Ok(env.convert_byte_array(field)?[..].try_into()?) } @@ -1097,7 +1094,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_putSubtre env: &mut JNIEnv, roots: JObjectArray, node_parser: impl Fn(&[u8]) -> std::io::Result, - ) -> Result>, failure::Error> { + ) -> anyhow::Result>> { let count = env.get_array_length(&roots).unwrap(); (0..count) .scan(env, |env, i| { @@ -1113,14 +1110,14 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_putSubtre let sapling_start_index = if sapling_start_index >= 0 { sapling_start_index as u64 } else { - return Err(format_err!("Sapling start index must be nonnegative.")); + return Err(anyhow!("Sapling start index must be nonnegative.")); }; let sapling_roots = parse_roots(env, sapling_roots, |n| sapling::Node::read(n))?; let orchard_start_index = if orchard_start_index >= 0 { orchard_start_index as u64 } else { - return Err(format_err!("Orchard start index must be nonnegative.")); + return Err(anyhow!("Orchard start index must be nonnegative.")); }; let orchard_roots = parse_roots(env, orchard_roots, |n| { orchard::tree::MerkleHashOrchard::read(n) @@ -1128,11 +1125,11 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_putSubtre db_data .put_sapling_subtree_roots(sapling_start_index, &sapling_roots) - .map_err(|e| format_err!("Error while storing Sapling subtree roots: {}", e))?; + .map_err(|e| anyhow!("Error while storing Sapling subtree roots: {}", e))?; db_data .put_orchard_subtree_roots(orchard_start_index, &orchard_roots) - .map_err(|e| format_err!("Error while storing Orchard subtree roots: {}", e))?; + .map_err(|e| anyhow!("Error while storing Orchard subtree roots: {}", e))?; Ok(JNI_TRUE) }); @@ -1157,7 +1154,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_updateCha db_data .update_chain_tip(height) .map(|()| JNI_TRUE) - .map_err(|e| format_err!("Error while updating chain tip to height {}: {}", height, e)) + .map_err(|e| anyhow!("Error while updating chain tip to height {}: {}", height, e)) }); unwrap_exc_or(&mut env, res, JNI_FALSE) @@ -1181,7 +1178,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_getFullyS Ok(Some(metadata)) => Ok(i64::from(u32::from(metadata.block_height()))), // Use -1 to return null across the FFI. Ok(None) => Ok(-1), - Err(e) => Err(format_err!( + Err(e) => Err(anyhow!( "Failed to read block metadata from WalletDb: {:?}", e )), @@ -1208,7 +1205,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_getMaxSca Ok(Some(metadata)) => Ok(i64::from(u32::from(metadata.block_height()))), // Use -1 to return null across the FFI. Ok(None) => Ok(-1), - Err(e) => Err(format_err!( + Err(e) => Err(anyhow!( "Failed to read block metadata from WalletDb: {:?}", e )), @@ -1264,7 +1261,7 @@ fn encode_wallet_summary<'a, P: Parameters>( env: &mut JNIEnv<'a>, db_data: &WalletDb, summary: WalletSummary, -) -> Result, failure::Error> { +) -> anyhow::Result> { let account_balances = utils::rust_vec_to_java( env, summary @@ -1279,7 +1276,7 @@ fn encode_wallet_summary<'a, P: Parameters>( AccountSource::Derived { account_index, .. } => account_index, AccountSource::Imported => unreachable!("Imported accounts are unimplemented"), }; - Ok::<_, failure::Error>((account_index, balance)) + Ok::<_, anyhow::Error>((account_index, balance)) }) .collect::>()?, JNI_ACCOUNT_BALANCE, @@ -1321,7 +1318,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_getWallet match db_data .get_wallet_summary(ANCHOR_OFFSET_U32) - .map_err(|e| format_err!("Error while fetching scan progress: {}", e))? + .map_err(|e| anyhow!("Error while fetching scan progress: {}", e))? .filter(|summary| { summary .scan_progress() @@ -1373,7 +1370,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_suggestSc let ranges = db_data .suggest_scan_ranges() - .map_err(|e| format_err!("Error while fetching suggested scan ranges: {}", e))?; + .map_err(|e| anyhow!("Error while fetching suggested scan ranges: {}", e))?; Ok(utils::rust_vec_to_java( env, @@ -1395,7 +1392,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_suggestSc fn encode_scan_summary<'a>( env: &mut JNIEnv<'a>, scan_summary: ScanSummary, -) -> Result, failure::Error> { +) -> anyhow::Result> { let scanned_range = scan_summary.scanned_range(); Ok(env.new_object( "cash/z/ecc/android/sdk/internal/model/JniScanSummary", @@ -1427,7 +1424,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_scanBlock let mut db_data = wallet_db(env, network, db_data)?; let from_height = BlockHeight::try_from(from_height)?; let from_state = TreeState::decode(&env.convert_byte_array(from_state).unwrap()[..]) - .map_err(|e| format_err!("Invalid TreeState: {}", e))? + .map_err(|e| anyhow!("Invalid TreeState: {}", e))? .to_chain_state()?; let limit = usize::try_from(limit)?; @@ -1440,7 +1437,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_scanBlock limit, ) { Ok(scan_summary) => Ok(encode_scan_summary(env, scan_summary)?.into_raw()), - Err(e) => Err(format_err!( + Err(e) => Err(anyhow!( "Rust error while scanning blocks (limit {:?}): {}", limit, e @@ -1482,17 +1479,17 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_putUtxo<' OutPoint::new(txid, index as u32), TxOut { value: NonNegativeAmount::from_nonnegative_i64(value) - .map_err(|_| format_err!("Invalid UTXO value"))?, + .map_err(|_| anyhow!("Invalid UTXO value"))?, script_pubkey, }, BlockHeight::from(height as u32), ) - .ok_or_else(|| format_err!("UTXO is not P2PKH or P2SH"))?; + .ok_or_else(|| anyhow!("UTXO is not P2PKH or P2SH"))?; debug!("Storing UTXO in db_data"); match db_data.put_received_transparent_utxo(&output) { Ok(_) => Ok(JNI_TRUE), - Err(e) => Err(format_err!("Error while inserting UTXO: {}", e)), + Err(e) => Err(anyhow!("Error while inserting UTXO: {}", e)), } }); unwrap_exc_or(&mut env, res, JNI_FALSE) @@ -1523,7 +1520,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_decryptAn match decrypt_and_store_transaction(&network, &mut db_data, &tx) { Ok(()) => Ok(JNI_TRUE), - Err(e) => Err(format_err!("Error while decrypting transaction: {}", e)), + Err(e) => Err(anyhow!("Error while decrypting transaction: {}", e)), } }); @@ -1565,13 +1562,13 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_proposeTr let account = account_id_from_jni(&db_data, account)?; let to = utils::java_string_to_rust(env, &to); let value = NonNegativeAmount::from_nonnegative_i64(value) - .map_err(|_| format_err!("Invalid amount, out of range"))?; + .map_err(|_| anyhow!("Invalid amount, out of range"))?; let memo_bytes = env.convert_byte_array(memo).unwrap(); let to = match Address::decode(&network, &to) { Some(to) => to, None => { - return Err(format_err!("Address is for the wrong network")); + return Err(anyhow!("Address is for the wrong network")); } }; @@ -1579,7 +1576,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_proposeTr let memo = match to { Address::Sapling(_) | Address::Unified(_) => { let memo_value = - Memo::from_bytes(&memo_bytes).map_err(|_| format_err!("Invalid memo"))?; + Memo::from_bytes(&memo_bytes).map_err(|_| anyhow!("Invalid memo"))?; Some(MemoBytes::from(&memo_value)) } Address::Transparent(_) => None, @@ -1595,7 +1592,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_proposeTr message: None, other_params: vec![], }]) - .map_err(|e| format_err!("Error creating transaction request: {:?}", e))?; + .map_err(|e| anyhow!("Error creating transaction request: {:?}", e))?; let proposal = propose_transfer::<_, _, _, Infallible>( &mut db_data, @@ -1605,7 +1602,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_proposeTr request, ANCHOR_OFFSET, ) - .map_err(|e| format_err!("Error creating transaction proposal: {}", e))?; + .map_err(|e| anyhow!("Error creating transaction proposal: {}", e))?; Ok(utils::rust_bytes_to_java( &env, @@ -1636,18 +1633,18 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_proposeSh let mut db_data = wallet_db(env, network, db_data)?; let account = account_id_from_jni(&db_data, account)?; let shielding_threshold = NonNegativeAmount::from_nonnegative_i64(shielding_threshold) - .map_err(|_| format_err!("Invalid shielding threshold, out of range"))?; + .map_err(|_| anyhow!("Invalid shielding threshold, out of range"))?; let memo_bytes = env.convert_byte_array(memo).unwrap(); let transparent_receiver = match utils::java_nullable_string_to_rust(env, &transparent_receiver) { None => Ok(None), Some(addr) => match Address::decode(&network, &addr) { - None => Err(format_err!("Transparent receiver is for the wrong network")), + None => Err(anyhow!("Transparent receiver is for the wrong network")), Some(addr) => match addr { - Address::Sapling(_) | Address::Unified(_) => Err(format_err!( - "Transparent receiver is not a transparent address" - )), + Address::Sapling(_) | Address::Unified(_) => { + Err(anyhow!("Transparent receiver is not a transparent address")) + } Address::Transparent(addr) => { if db_data .get_transparent_receivers(account)? @@ -1655,9 +1652,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_proposeSh { Ok(Some(addr)) } else { - Err(format_err!( - "Transparent receiver does not belong to account", - )) + Err(anyhow!("Transparent receiver does not belong to account")) } } }, @@ -1669,17 +1664,17 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_proposeSh let account_receivers = db_data .get_target_and_anchor_heights(min_confirmations_for_heights) - .map_err(|e| format_err!("Error while fetching anchor height: {}", e)) + .map_err(|e| anyhow!("Error while fetching anchor height: {}", e)) .and_then(|opt_anchor| { opt_anchor .map(|(target, _)| target) // Include unconfirmed funds. - .ok_or(format_err!("Anchor height not available; scan required.")) + .ok_or(anyhow!("Anchor height not available; scan required.")) }) .and_then(|anchor| { db_data .get_transparent_balances(account, anchor) .map_err(|e| { - format_err!( + anyhow!( "Error while fetching transparent balances for {:?}: {}", account, e @@ -1689,7 +1684,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_proposeSh let from_addrs = if let Some((addr, _)) = transparent_receiver.map_or_else(|| if account_receivers.len() > 1 { - Err(format_err!( + Err(anyhow!( "Account has more than one transparent receiver with funds to shield; this is not yet supported by the SDK. Provide a specific transparent receiver to shield funds from." )) } else { @@ -1715,7 +1710,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_proposeSh &from_addrs, min_confirmations, ) - .map_err(|e| format_err!("Error while shielding transaction: {}", e))?; + .map_err(|e| anyhow!("Error while shielding transaction: {}", e))?; Ok(utils::rust_bytes_to_java( &env, @@ -1752,7 +1747,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_createPro let prover = LocalTxProver::new(Path::new(&spend_params), Path::new(&output_params)); let proposal = Proposal::decode(&env.convert_byte_array(proposal)?[..]) - .map_err(|e| format_err!("Invalid proposal: {}", e))? + .map_err(|e| anyhow!("Invalid proposal: {}", e))? .try_into_standard_proposal(&network, &db_data)?; let txids = create_proposed_transactions::<_, _, Infallible, _, _>( @@ -1764,7 +1759,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_createPro OvkPolicy::Sender, &proposal, ) - .map_err(|e| format_err!("Error while creating transactions: {}", e))?; + .map_err(|e| anyhow!("Error while creating transactions: {}", e))?; Ok(utils::rust_vec_to_java( env, @@ -1803,11 +1798,11 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_branchIdF // Utility functions // -fn parse_network(value: u32) -> Result { +fn parse_network(value: u32) -> anyhow::Result { match value { 0 => Ok(TestNetwork), 1 => Ok(MainNetwork), - _ => Err(format_err!("Invalid network type: {}. Expected either 0 or 1 for Testnet or Mainnet, respectively.", value)) + _ => Err(anyhow!("Invalid network type: {}. Expected either 0 or 1 for Testnet or Mainnet, respectively.", value)) } } @@ -1867,7 +1862,7 @@ pub extern "C" fn Java_cash_z_ecc_android_sdk_internal_jni_RustBackend_listTrans )? .into_raw()) } - Err(e) => Err(format_err!("Error while fetching address: {}", e)), + Err(e) => Err(anyhow!("Error while fetching address: {}", e)), } }); unwrap_exc_or(&mut env, res, ptr::null_mut()) diff --git a/backend-lib/src/main/rust/utils/exception.rs b/backend-lib/src/main/rust/utils/exception.rs index 3da224c0..cb9d593b 100644 --- a/backend-lib/src/main/rust/utils/exception.rs +++ b/backend-lib/src/main/rust/utils/exception.rs @@ -12,13 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -use failure::Error; use jni::JNIEnv; use std::any::Any; use std::thread; use tracing::error; -type ExceptionResult = thread::Result>; +type ExceptionResult = thread::Result>; // Returns value or "throws" exception. `error_val` is returned, because exception will be thrown // at the Java side. So this function should be used only for the `panic::catch_unwind` result. diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 747b5814..2990cbc8 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "1.75.0" +channel = "1.77.2" targets = [ "armv7-linux-androideabi", "aarch64-linux-android",