diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5009a09db4..b1f8de1d63 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,7 +3,7 @@ name: CI on: pull_request: push: - branches: [main, dev] + branches: [stable, dev] workflow_dispatch: jobs: @@ -20,6 +20,28 @@ jobs: - name: Reject trailing whitespace run: ./utils/trailing-whitespace.sh reject + run-doc-tests: + name: Run doc tests + runs-on: ubuntu-22.04 + env: + RUSTFLAGS: -D warnings + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: stable + + - name: Install protoc + run: sudo apt-get install protobuf-compiler + + - name: Cargo cache + uses: Swatinem/rust-cache@v2 + + - name: Run doc tests + run: cargo test --doc + test: uses: ./.github/workflows/test.yaml with: diff --git a/.gitignore b/.gitignore index 68655b7b53..b6fc1f06ba 100644 --- a/.gitignore +++ b/.gitignore @@ -8,9 +8,7 @@ cobertura.xml docker-ci/lightwalletd target wallets/* -zingocli/regtest/logs/ -zingocli/regtest/data/ -zingocli/regtest/zingo-wallet.dat +zingocli/regtest/ zingocli/target zingocli/tests/data/basic_zcashd.conf zingocli/tests/data/externalwallet_coinbaseaddress.conf diff --git a/Cargo.lock b/Cargo.lock index cb52c58750..6f2ec44def 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -40,9 +40,9 @@ 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", ] @@ -123,9 +123,9 @@ source = "git+https://github.com/zancas/append-only-vec.git?branch=add_debug_imp [[package]] name = "arc-swap" -version = "1.7.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b3d0060af21e8d11a926981cc00c6c1541aa91dd64b9f881985c3da1094425f" +checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" [[package]] name = "arrayref" @@ -158,25 +158,25 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] name = "async-trait" -version = "0.1.77" +version = "0.1.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" +checksum = "a507401cad91ec6a857ed5513a2073c82a9b9048762b885bb98655b306964681" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "axum" @@ -187,7 +187,7 @@ dependencies = [ "async-trait", "axum-core", "bitflags 1.3.2", - "bytes 1.5.0", + "bytes 1.6.0", "futures-util", "http", "http-body", @@ -213,7 +213,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" dependencies = [ "async-trait", - "bytes 1.5.0", + "bytes 1.6.0", "futures-util", "http", "http-body", @@ -225,9 +225,9 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line", "cc", @@ -326,9 +326,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[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" @@ -397,9 +397,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 0.10.8", "tinyvec", @@ -433,9 +433,9 @@ dependencies = [ [[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" @@ -484,9 +484,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.35" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a" +checksum = "8a0d04d43504c61aa6c7531f1871dd0d418d91130162063b789da00fd7057a5e" dependencies = [ "android-tzdata", "iana-time-zone", @@ -507,9 +507,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.2" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b230ab84b0ffdf890d5a10abdbc8b83ae1c4918275daea1ab8801f71536b2651" +checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" dependencies = [ "clap_builder", ] @@ -556,7 +556,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f76990911f2267d837d9d0ad060aa63aaad170af40904b29461734c339030d4d" dependencies = [ "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] @@ -673,7 +673,7 @@ dependencies = [ "tonic-build", "tower", "tracing", - "tracing-log 0.1.4", + "tracing-log", "tracing-subscriber", "tracing-test", "zcash_address", @@ -745,9 +745,9 @@ dependencies = [ [[package]] name = "dirs" -version = "3.0.2" +version = "5.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30baa043103c9d0c2a57cf537cc2f35623889dc0d405e6c3cccfadbc81c71309" +checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" dependencies = [ "dirs-sys", ] @@ -764,13 +764,14 @@ dependencies = [ [[package]] name = "dirs-sys" -version = "0.3.7" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" dependencies = [ "libc", + "option-ext", "redox_users", - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -823,17 +824,27 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" +[[package]] +name = "env_filter" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a009aa4810eb158359dda09d0c87378e4bbb89b5a801f016885a4707ba24f7ea" +dependencies = [ + "log", + "regex", +] + [[package]] name = "env_logger" -version = "0.10.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" +checksum = "38b35839ba51819680ba087cd351788c9a3c476841207e0b8cee0b04722343b9" dependencies = [ + "anstream", + "anstyle", + "env_filter", "humantime", - "is-terminal", "log", - "regex", - "termcolor", ] [[package]] @@ -881,9 +892,9 @@ dependencies = [ [[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 = "fd-lock" @@ -1025,7 +1036,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] @@ -1099,17 +1110,17 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +checksum = "4fbd2820c5e49886948654ab546d0688ff24530286bdcf8fca3cefb16d4618eb" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "fnv", "futures-core", "futures-sink", "futures-util", "http", - "indexmap 2.2.5", + "indexmap 2.2.6", "slab", "tokio", "tokio-util", @@ -1223,7 +1234,7 @@ version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "fnv", "itoa", ] @@ -1234,7 +1245,7 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "http", "pin-project-lite", ] @@ -1269,7 +1280,7 @@ version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "futures-channel", "futures-core", "futures-util", @@ -1320,7 +1331,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "hyper", "native-tls", "tokio", @@ -1381,9 +1392,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 0.14.3", @@ -1391,9 +1402,9 @@ dependencies = [ [[package]] name = "indoc" -version = "2.0.4" +version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" +checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" [[package]] name = "inout" @@ -1440,17 +1451,6 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" -[[package]] -name = "is-terminal" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "itertools" version = "0.10.5" @@ -1471,9 +1471,9 @@ dependencies = [ [[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 = "js-sys" @@ -1536,13 +1536,12 @@ checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "libredox" -version = "0.0.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "libc", - "redox_syscall", ] [[package]] @@ -1649,9 +1648,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" @@ -1837,7 +1836,7 @@ version = "0.10.64" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "cfg-if", "foreign-types", "libc", @@ -1854,7 +1853,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] @@ -1865,9 +1864,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.101" +version = "0.9.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dda2b0f344e78efc2facf7d195d098df0dd72151b26ab98da807afc26c198dff" +checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" dependencies = [ "cc", "libc", @@ -1875,6 +1874,12 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + [[package]] name = "orchard" version = "0.7.1" @@ -2000,7 +2005,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.2.5", + "indexmap 2.2.6", ] [[package]] @@ -2020,14 +2025,14 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[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 = "pin-utils" @@ -2075,12 +2080,12 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "prettyplease" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" +checksum = "8d3928fb5db768cb86f891ff014f0144589297e3c6a1aba6ed7cecfdace270c7" dependencies = [ "proc-macro2", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] @@ -2100,13 +2105,13 @@ checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" dependencies = [ "bit-set", "bit-vec", - "bitflags 2.4.2", + "bitflags 2.5.0", "lazy_static", "num-traits", "rand 0.8.5", "rand_chacha", "rand_xorshift", - "regex-syntax 0.8.2", + "regex-syntax 0.8.3", "rusty-fork", "tempfile", "unarray", @@ -2118,7 +2123,7 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "prost-derive", ] @@ -2128,7 +2133,7 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c55e02e35260070b6f716a2423c2ff1c3bb1642ddca6f99e1f26d06268a0e2d2" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "heck", "itertools 0.11.0", "log", @@ -2139,7 +2144,7 @@ dependencies = [ "prost", "prost-types", "regex", - "syn 2.0.52", + "syn 2.0.58", "tempfile", "which", ] @@ -2154,7 +2159,7 @@ dependencies = [ "itertools 0.11.0", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] @@ -2266,9 +2271,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", @@ -2335,9 +2340,9 @@ dependencies = [ [[package]] name = "redox_users" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" +checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" dependencies = [ "getrandom", "libredox", @@ -2346,14 +2351,14 @@ 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", "regex-automata 0.4.6", - "regex-syntax 0.8.2", + "regex-syntax 0.8.3", ] [[package]] @@ -2373,7 +2378,7 @@ checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.2", + "regex-syntax 0.8.3", ] [[package]] @@ -2384,9 +2389,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[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 = "remove_dir_all" @@ -2399,12 +2404,12 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.26" +version = "0.11.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78bf93c4af7a8bb7d879d51cebe797356ff10ae8516ace542b5182d9dcac10b2" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" dependencies = [ "base64 0.21.7", - "bytes 1.5.0", + "bytes 1.6.0", "encoding_rs", "futures-core", "futures-util", @@ -2507,7 +2512,7 @@ dependencies = [ "proc-macro2", "quote", "rust-embed-utils", - "syn 2.0.52", + "syn 2.0.58", "walkdir", ] @@ -2538,11 +2543,11 @@ dependencies = [ [[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 2.4.2", + "bitflags 2.5.0", "errno", "libc", "linux-raw-sys", @@ -2662,9 +2667,9 @@ dependencies = [ [[package]] name = "sapling-crypto" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0db258736b34dfc6bec50fab2afb94c1845d90370b38309ebf9bb166cc951251" +checksum = "02f4270033afcb0c74c5c7d59c73cfd1040367f67f224fe7ed9a919ae618f1b7" dependencies = [ "aes", "bellman", @@ -2746,9 +2751,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.9.2" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -2759,9 +2764,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.1" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +checksum = "41f3cc463c0ef97e11c3461a9d3787412d30e8e7eb907c79180c4a57bf7c04ef" dependencies = [ "core-foundation-sys", "libc", @@ -2800,14 +2805,14 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] name = "serde_json" -version = "1.0.114" +version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" dependencies = [ "itoa", "ryu", @@ -2828,11 +2833,11 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.9.32" +version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fd075d994154d4a774f95b51fb96bdc2832b0ea48425c92546073816cda1f2f" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ - "indexmap 2.2.5", + "indexmap 2.2.6", "itoa", "ryu", "serde", @@ -2877,7 +2882,7 @@ name = "shardtree" version = "0.2.0" source = "git+https://github.com/nuttycom/incrementalmerkletree?rev=fa147c89c6c98a03bba745538f4e68d4eaed5146#fa147c89c6c98a03bba745538f4e68d4eaed5146" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "either", "incrementalmerkletree", "tracing", @@ -2919,9 +2924,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 = "socket2" @@ -2971,9 +2976,9 @@ checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0" [[package]] name = "strsim" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "subtle" @@ -2994,9 +2999,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.52" +version = "2.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" +checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687" dependencies = [ "proc-macro2", "quote", @@ -3058,15 +3063,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - [[package]] name = "thiserror" version = "1.0.58" @@ -3084,7 +3080,7 @@ checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] @@ -3143,12 +3139,12 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.36.0" +version = "1.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" +checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" dependencies = [ "backtrace", - "bytes 1.5.0", + "bytes 1.6.0", "libc", "mio", "num_cpus", @@ -3178,7 +3174,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] @@ -3229,7 +3225,7 @@ version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "futures-core", "futures-sink", "pin-project-lite", @@ -3247,7 +3243,7 @@ dependencies = [ "async-trait", "axum", "base64 0.21.7", - "bytes 1.5.0", + "bytes 1.6.0", "h2", "http", "http-body", @@ -3279,7 +3275,7 @@ dependencies = [ "proc-macro2", "prost-build", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] @@ -3309,7 +3305,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aba3f3efabf7fb41fae8534fc20a817013dd1c12cb45441efb6c82e6556b4cd8" dependencies = [ "bitflags 1.3.2", - "bytes 1.5.0", + "bytes 1.6.0", "futures-core", "futures-util", "http", @@ -3352,7 +3348,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] @@ -3365,17 +3361,6 @@ dependencies = [ "valuable", ] -[[package]] -name = "tracing-log" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - [[package]] name = "tracing-log" version = "0.2.0" @@ -3402,7 +3387,7 @@ dependencies = [ "thread_local", "tracing", "tracing-core", - "tracing-log 0.2.0", + "tracing-log", ] [[package]] @@ -3521,9 +3506,9 @@ dependencies = [ [[package]] name = "unsafe-libyaml" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab4c90930b95a82d00dc9e9ac071b4991924390d46cbd0dfe566148667605e4b" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" [[package]] name = "untrusted" @@ -3627,7 +3612,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", "wasm-bindgen-shared", ] @@ -3661,7 +3646,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4125,7 +4110,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] @@ -4144,7 +4129,7 @@ dependencies = [ "tokio", "tokio-rustls 0.23.4", "tokio-stream", - "webpki-roots 0.21.1", + "webpki-roots 0.25.4", "zingo-testutils", "zingoconfig", "zingolib", @@ -4292,6 +4277,7 @@ dependencies = [ "tower-http", "tracing", "tracing-subscriber", + "webpki-roots 0.25.4", "zcash_address", "zcash_client_backend", "zcash_encoding", @@ -4309,9 +4295,9 @@ dependencies = [ [[package]] name = "zip32" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d724a63be4dfb50b7f3617e542984e22e4b4a5b8ca5de91f55613152885e6b22" +checksum = "4226d0aee9c9407c27064dfeec9d7b281c917de3374e1e5a2e2cfad9e09de19e" dependencies = [ "blake2b_simd", "memuse", diff --git a/Cargo.toml b/Cargo.toml index 9522899c0c..7decb003df 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,6 +46,7 @@ prost = "0.12.0" tower = { version = "0.4" } hex = "0.4" tokio-rustls = "0.23" +webpki-roots = "0.25" [profile.release] debug = false diff --git a/darkside-tests/Cargo.toml b/darkside-tests/Cargo.toml index 07423d663f..2bcba4abd2 100644 --- a/darkside-tests/Cargo.toml +++ b/darkside-tests/Cargo.toml @@ -23,14 +23,14 @@ hex = { workspace = true } zcash_primitives = { workspace = true } tempdir = { workspace = true } portpicker = { workspace = true } -env_logger = "0.10.0" +env_logger = "0.11.3" bech32 = "0.9.0" rand = "0.8.5" tracing-subscriber = "0.3.15" itertools = "0.10.5" tracing-test = { version = "0.2.4", features = ["no-env-filter"] } tracing = "0.1.37" -tracing-log = "0.1.3" +tracing-log = "0.2.0" futures-util = "0.3.28" orchard = { workspace = true } zcash_address = { workspace = true } diff --git a/docker/Dockerfile b/docker/Dockerfile index c47488aa2d..3eb15323a3 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -8,7 +8,7 @@ RUN apt install -y build-essential mingw-w64 gcc-aarch64-linux-gnu gcc-arm-linux RUN curl https://sh.rustup.rs -sSf | bash -s -- --default-toolchain none -y ENV PATH="/root/.cargo/bin:${PATH}" -RUN rustup toolchain install 1.69.0 +RUN rustup toolchain install stable RUN rustup target add x86_64-pc-windows-gnu RUN rustup target add aarch64-unknown-linux-gnu diff --git a/integration-tests/tests/integrations.rs b/integration-tests/tests/integrations.rs index 8cec35c4f3..c9aa49c467 100644 --- a/integration-tests/tests/integrations.rs +++ b/integration-tests/tests/integrations.rs @@ -3619,6 +3619,7 @@ mod slow { load_wallet_from_data_and_assert(data, 0, 3).await; } + #[ignore = "flakey test"] #[tokio::test] async fn load_wallet_from_v26_2_dat_file() { // We test that the LightWallet can be read from v26 .dat file @@ -3639,6 +3640,7 @@ mod slow { load_wallet_from_data_and_assert(data, 10177826, 1).await; } + #[ignore = "flakey test"] #[tokio::test] async fn load_wallet_from_v28_dat_file() { // We test that the LightWallet can be read from v28 .dat file diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 1eb4605782..2b9b1f1767 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.76.0" +channel = "stable" components = [ "clippy", "rustfmt" ] diff --git a/zingo-status/src/confirmation_status.rs b/zingo-status/src/confirmation_status.rs index 7783559620..4e8727e221 100644 --- a/zingo-status/src/confirmation_status.rs +++ b/zingo-status/src/confirmation_status.rs @@ -32,9 +32,11 @@ impl ConfirmationStatus { /// /// let status = ConfirmationStatus::Broadcast(10.into()); /// assert_eq!(status.is_broadcast(), true); + /// assert_eq!(status.is_confirmed(), false); /// /// let status = ConfirmationStatus::Confirmed(10.into()); /// assert_eq!(status.is_broadcast(), false); + /// assert_eq!(status.is_confirmed(), true); /// ``` pub fn is_broadcast(&self) -> bool { matches!(self, Self::Broadcast(_)) @@ -48,9 +50,11 @@ impl ConfirmationStatus { /// /// let status = ConfirmationStatus::Broadcast(10.into()); /// assert_eq!(status.is_confirmed(), false); + /// assert_eq!(status.is_broadcast(), true); /// /// let status = ConfirmationStatus::Confirmed(10.into()); /// assert_eq!(status.is_confirmed(), true); + /// assert_eq!(status.is_broadcast(), false); /// ``` pub fn is_confirmed(&self) -> bool { matches!(self, Self::Confirmed(_)) @@ -63,13 +67,13 @@ impl ConfirmationStatus { /// use zcash_primitives::consensus::BlockHeight; /// /// let status = ConfirmationStatus::Confirmed(10.into()); - /// assert_eq!(status.is_confirmed_after_or_at(&8.into()), true); + /// assert_eq!(status.is_confirmed_after_or_at(&9.into()), true); /// /// let status = ConfirmationStatus::Broadcast(10.into()); /// assert_eq!(status.is_confirmed_after_or_at(&10.into()), false); /// /// let status = ConfirmationStatus::Confirmed(10.into()); - /// assert_eq!(status.is_confirmed_after_or_at(&12.into()), false); + /// assert_eq!(status.is_confirmed_after_or_at(&11.into()), false); /// ``` pub fn is_confirmed_after_or_at(&self, comparison_height: &BlockHeight) -> bool { match self { @@ -85,17 +89,19 @@ impl ConfirmationStatus { /// use zcash_primitives::consensus::BlockHeight; /// /// let status = ConfirmationStatus::Confirmed(10.into()); - /// assert_eq!(status.is_confirmed_before_or_at(&8.into()), false); + /// assert_eq!(status.is_confirmed_before_or_at(&9.into()), false); /// /// let status = ConfirmationStatus::Broadcast(10.into()); /// assert_eq!(status.is_confirmed_before_or_at(&10.into()), false); /// /// let status = ConfirmationStatus::Confirmed(10.into()); - /// assert_eq!(status.is_confirmed_before_or_at(&12.into()), true); + /// assert_eq!(status.is_confirmed_before_or_at(&11.into()), true); /// ``` pub fn is_confirmed_before_or_at(&self, comparison_height: &BlockHeight) -> bool { match self { - Self::Confirmed(self_height) => self_height <= comparison_height, + Self::Confirmed(self_height) => { + self.is_confirmed_before(comparison_height) || self_height == comparison_height + } _ => false, } } @@ -107,13 +113,13 @@ impl ConfirmationStatus { /// use zcash_primitives::consensus::BlockHeight; /// /// let status = ConfirmationStatus::Confirmed(10.into()); - /// assert_eq!(status.is_confirmed_before(&8.into()), false, "1"); + /// assert_eq!(status.is_confirmed_before(&9.into()), false); /// /// let status = ConfirmationStatus::Confirmed(10.into()); - /// assert_eq!(status.is_confirmed_before(&10.into()), false, "2"); + /// assert_eq!(status.is_confirmed_before(&10.into()), false); /// /// let status = ConfirmationStatus::Confirmed(10.into()); - /// assert_eq!(status.is_confirmed_before(&12.into()), true, "3"); + /// assert_eq!(status.is_confirmed_before(&11.into()), true); /// ``` pub fn is_confirmed_before(&self, comparison_height: &BlockHeight) -> bool { match self { @@ -129,13 +135,13 @@ impl ConfirmationStatus { /// use zcash_primitives::consensus::BlockHeight; /// /// let status = ConfirmationStatus::Confirmed(10.into()); - /// assert_eq!(status.is_broadcast_after_or_at(&8.into()), false); + /// assert_eq!(status.is_broadcast_after_or_at(&9.into()), false); /// /// let status = ConfirmationStatus::Broadcast(10.into()); /// assert_eq!(status.is_broadcast_after_or_at(&10.into()), true); /// /// let status = ConfirmationStatus::Broadcast(10.into()); - /// assert_eq!(status.is_broadcast_after_or_at(&12.into()), false); + /// assert_eq!(status.is_broadcast_after_or_at(&11.into()), false); /// ``` pub fn is_broadcast_after_or_at(&self, comparison_height: &BlockHeight) -> bool { match self { @@ -151,10 +157,10 @@ impl ConfirmationStatus { /// use zcash_primitives::consensus::BlockHeight; /// /// let status = ConfirmationStatus::Confirmed(16.into()); - /// assert_eq!(status.is_broadcast_before(&14.into()), false); + /// assert_eq!(status.is_broadcast_before(&15.into()), false); /// /// let status = ConfirmationStatus::Broadcast(12.into()); - /// assert_eq!(status.is_broadcast_before(&14.into()), true); + /// assert_eq!(status.is_broadcast_before(&13.into()), true); /// /// let status = ConfirmationStatus::Broadcast(14.into()); /// assert_eq!(status.is_broadcast_before(&14.into()), false); @@ -203,7 +209,6 @@ impl ConfirmationStatus { _ => None, } } - /// this function and the placeholder is not a preferred pattern. please use match whenever possible. /// # Examples /// /// ``` diff --git a/zingo-testutils/Cargo.toml b/zingo-testutils/Cargo.toml index b6e6c02e9c..ace85b0d6d 100644 --- a/zingo-testutils/Cargo.toml +++ b/zingo-testutils/Cargo.toml @@ -26,7 +26,7 @@ incrementalmerkletree = { workspace = true } json = "0.12.4" log = "0.4.19" tokio = "1.28.2" -http = "0.2.4" +http.workspace = true tonic = { workspace = true, optional = true } tracing = "0.1.37" serde_json = "1.0.100" diff --git a/zingo-testutils/src/regtest.rs b/zingo-testutils/src/regtest.rs index 784c7cb540..8ee36e85e8 100644 --- a/zingo-testutils/src/regtest.rs +++ b/zingo-testutils/src/regtest.rs @@ -75,6 +75,11 @@ pub enum LaunchChildProcessError { stderr: String, }, } +impl From for String { + fn from(underlyingerror: LaunchChildProcessError) -> Self { + format!("LaunchChildProcessError from {:?}", underlyingerror) + } +} pub fn launch_lightwalletd( logsdir: PathBuf, confsdir: PathBuf, @@ -175,11 +180,22 @@ pub fn launch_lightwalletd( } lightwalletd_child } +fn write_zcash_conf(location: &PathBuf) { + // This is the only data we need to supply *to* the zcashd, the other files are created by zcashd and lightwalletd + use std::io::Write; + let conf_bytes: &'static [u8] = include_bytes!("../regtest/conf/zcash.conf"); + File::create(location) + .unwrap() + .write_all(conf_bytes) + .unwrap(); +} impl RegtestManager { pub fn new(rootpathname: PathBuf) -> Self { let regtest_dir = rootpathname; let confs_dir = regtest_dir.join("conf"); + let zcashd_config = confs_dir.join("zcash.conf"); std::fs::create_dir_all(&confs_dir).expect("Couldn't create dir."); + write_zcash_conf(&zcashd_config); let bin_dir = super::paths::get_bin_dir(); std::fs::create_dir_all(&bin_dir).expect("Couldn't create dir."); let cli_bin = bin_dir.join("zcash-cli"); @@ -190,7 +206,6 @@ impl RegtestManager { let zcashd_logs_dir = logs_dir.join("zcashd"); std::fs::create_dir_all(&zcashd_logs_dir).expect("Couldn't create dir."); let zcashd_stdout_log = zcashd_logs_dir.join("stdout.log"); - let zcashd_config = confs_dir.join("zcash.conf"); let lightwalletd_config = confs_dir.join("lightwalletd.yml"); let lightwalletd_logs_dir = logs_dir.join("lightwalletd"); std::fs::create_dir_all(&lightwalletd_logs_dir).expect("Couldn't create dir."); diff --git a/zingocli/Cargo.toml b/zingocli/Cargo.toml index a9d5f065f2..7fab1d0133 100644 --- a/zingocli/Cargo.toml +++ b/zingocli/Cargo.toml @@ -20,5 +20,5 @@ rustls-pemfile = "1.0.0" tokio = { version = "1.24.2", features = ["full"] } tokio-stream = "0.1.6" tokio-rustls = { workspace = true } -webpki-roots = "0.21.0" +webpki-roots.workspace = true json = "0.12.4" diff --git a/zingocli/regtest/conf/zcash.conf b/zingocli/regtest/conf/zcash.conf deleted file mode 100644 index 463d73aa0d..0000000000 --- a/zingocli/regtest/conf/zcash.conf +++ /dev/null @@ -1,19 +0,0 @@ -## Default zingolib zcash.conf for regtest mode ## -regtest=1 -nuparams=5ba81b19:1 # Overwinter -nuparams=76b809bb:1 # Sapling -nuparams=2bb40e60:1 # Blossom -nuparams=f5b9230b:1 # Heartwood -nuparams=e9ff75a6:1 # Canopy -nuparams=c2d6d0b4:1 # NU5 - -txindex=1 -insightexplorer=1 -experimentalfeatures=1 -rpcuser=xxxxxx -rpcpassword=xxxxxx -rpcport=18232 -rpcallowip=127.0.0.1 - -minetolocalwallet=0 -mineraddress=zregtestsapling1fmq2ufux3gm0v8qf7x585wj56le4wjfsqsj27zprjghntrerntggg507hxh2ydcdkn7sx8kya7p diff --git a/zingocli/src/lib.rs b/zingocli/src/lib.rs index 662be73eba..a6ce508da4 100644 --- a/zingocli/src/lib.rs +++ b/zingocli/src/lib.rs @@ -262,22 +262,7 @@ fn short_circuit_on_help(params: Vec) { } std::process::exit(0x0100); } -use std::string::String; -#[derive(Debug)] -enum TemplateFillError { - BirthdaylessSeed(String), - InvalidBirthday(String), - MalformedServerURL(String), - ChildLaunchError(regtest::LaunchChildProcessError), - InvalidChain(String), - RegtestAndChainSpecified(String), -} -impl From for TemplateFillError { - fn from(underlyingerror: regtest::LaunchChildProcessError) -> Self { - Self::ChildLaunchError(underlyingerror) - } -} /// This type manages setup of the zingo-cli utility among its responsibilities: /// * parse arguments with standard clap: /// * behave correctly as a function of each parameter that may have been passed @@ -287,7 +272,7 @@ impl From for TemplateFillError { /// is specified, then the system should execute only logic necessary to support that command, /// in other words "help" the ShortCircuitCommand _MUST_ not launch either zcashd or lightwalletd impl ConfigTemplate { - fn fill(matches: clap::ArgMatches) -> Result { + fn fill(matches: clap::ArgMatches) -> Result { let is_regtest = matches.get_flag("regtest"); // Begin short_circuit section let params = if let Some(vals) = matches.get_many::("extra_args") { vals.cloned().collect() @@ -311,26 +296,23 @@ impl ConfigTemplate { eprintln!( "Please specify the wallet birthday (eg. '--birthday 600000') to restore a wallet. (If you want to load the entire blockchain instead, you can use birthday 0. /this would require extensive time and computational resources)" ); - return Err(TemplateFillError::BirthdaylessSeed( + return Err( "This should be the block height where the wallet was created.\ -If you don't remember the block height, you can pass '--birthday 0'\ -to scan from the start of the blockchain." +If you don't remember the block height, you can pass '--birthday 0' to scan from the start of the blockchain." .to_string(), - )); + ); } let from = from.map(|seed| seed.to_string()); if matches.contains_id("chain") && is_regtest { - return Err(TemplateFillError::RegtestAndChainSpecified( - "regtest mode incompatible with custom chain selection".to_string(), - )); + return Err("regtest mode incompatible with custom chain selection".to_string()); } let birthday = match maybe_birthday.unwrap_or("0".to_string()).parse::() { Ok(b) => b, Err(e) => { - return Err(TemplateFillError::InvalidBirthday(format!( + return Err(format!( "Couldn't parse birthday. This should be a block number. Error={}", e - ))); + )); } }; @@ -364,7 +346,7 @@ to scan from the start of the blockchain." "mainnet" => ChainType::Mainnet, "testnet" => ChainType::Testnet, "regtest" => ChainType::Regtest(zingoconfig::RegtestNetwork::all_upgrades_active()), - _ => return Err(TemplateFillError::InvalidChain(chain.clone())), + _ => return Err(chain.clone()), } } else if is_regtest { ChainType::Regtest(zingoconfig::RegtestNetwork::all_upgrades_active()) @@ -374,9 +356,9 @@ to scan from the start of the blockchain." // Test to make sure the server has all of scheme, host and port if server.scheme_str().is_none() || server.host().is_none() || server.port().is_none() { - return Err(TemplateFillError::MalformedServerURL(format!( + return Err(format!( "Please provide the --server parameter as [scheme]://[host]:[port].\nYou provided: {}", - server ))); + server )); } let sync = !matches.get_flag("nosync"); @@ -523,6 +505,8 @@ pub fn run_cli() { if let Err(e) = LightClient::init_logging() { eprintln!("Could not initialize logging: {e}") }; - let cli_config = ConfigTemplate::fill(build_clap_app()).unwrap(); - dispatch_command_or_start_interactive(&cli_config); + match ConfigTemplate::fill(build_clap_app()) { + Ok(cli_config) => dispatch_command_or_start_interactive(&cli_config), + Err(e) => eprintln!("Error filling config template: {:?}", e), + } } diff --git a/zingoconfig/Cargo.toml b/zingoconfig/Cargo.toml index 9c52268a8d..67fa61c5db 100644 --- a/zingoconfig/Cargo.toml +++ b/zingoconfig/Cargo.toml @@ -6,11 +6,11 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -zcash_address = { workspace = true } -zcash_primitives = { workspace = true } +zcash_address.workspace = true +zcash_primitives.workspace = true +tempdir.workspace = true +http.workspace = true log4rs = "1.1.1" log = "0.4.14" -http = "0.2.4" -dirs = "3.0.2" -tempdir.workspace = true +dirs = "5.0" diff --git a/zingoconfig/src/lib.rs b/zingoconfig/src/lib.rs index b7b82abbc3..e27b300e6e 100644 --- a/zingoconfig/src/lib.rs +++ b/zingoconfig/src/lib.rs @@ -23,6 +23,7 @@ use zcash_primitives::consensus::{ TEST_NETWORK, }; +pub const DEVELOPER_DONATION_ADDRESS: &str = "u1w47nzy4z5g9zvm4h2s4ztpl8vrdmlclqz5sz02742zs5j3tz232u4safvv9kplg7g06wpk5fx0k0rx3r9gg4qk6nkg4c0ey57l0dyxtatqf8403xat7vyge7mmen7zwjcgvryg22khtg3327s6mqqkxnpwlnrt27kxhwg37qys2kpn2d2jl2zkk44l7j7hq9az82594u3qaescr3c9v"; pub const DEFAULT_LIGHTWALLETD_SERVER: &str = "https://mainnet.lightwalletd.com:9067"; pub const MAX_REORG: usize = 100; pub const DEFAULT_WALLET_NAME: &str = "zingo-wallet.dat"; @@ -36,6 +37,9 @@ pub const GAP_RULE_UNUSED_ADDRESSES: usize = 0; #[cfg(not(any(target_os = "ios", target_os = "android")))] pub const GAP_RULE_UNUSED_ADDRESSES: usize = 5; +pub fn margin_fee() -> u64 { + zcash_primitives::transaction::fees::zip317::MARGINAL_FEE.into_u64() +} pub fn load_clientconfig( lightwallet_uri: http::Uri, data_dir: Option, @@ -287,7 +291,6 @@ impl ZingoConfig { ChainType::Testnet => zcash_data_location.push("testnet3"), ChainType::Regtest(_) => zcash_data_location.push("regtest"), ChainType::Mainnet => {} - ChainType::FakeMainnet => zcash_data_location.push("fakemainnet"), }; } @@ -430,7 +433,7 @@ impl ZingoConfig { #[deprecated(since = "0.1.0", note = "prefix not known to be used")] pub fn base58_secretkey_prefix(&self) -> [u8; 1] { match self.chain { - ChainType::Testnet | ChainType::Regtest(_) | ChainType::FakeMainnet => [0xEF], + ChainType::Testnet | ChainType::Regtest(_) => [0xEF], ChainType::Mainnet => [0x80], } } @@ -440,24 +443,24 @@ pub enum ChainType { Testnet, Regtest(RegtestNetwork), Mainnet, - FakeMainnet, } impl ChainType { + #[deprecated(since = "0.1.0", note = "prefix not known to be used")] pub fn hrp_orchard_spending_key(&self) -> &str { match self { ChainType::Testnet => "secret-orchard-sk-test", ChainType::Regtest(_) => "secret-orchard-sk-regtest", ChainType::Mainnet => "secret-orchard-sk-main", - ChainType::FakeMainnet => "secret-orchard-sk-main", } } + + #[deprecated(since = "0.1.0", note = "prefix not known to be used")] pub fn hrp_unified_full_viewing_key(&self) -> &str { match self { ChainType::Testnet => "uviewtest", ChainType::Regtest(_) => "uviewregtest", ChainType::Mainnet => "uview", - ChainType::FakeMainnet => "uview", } } } @@ -469,7 +472,6 @@ impl std::fmt::Display for ChainType { Testnet => "test", Regtest(_) => "regtest", Mainnet => "main", - FakeMainnet => "fakemainnet", }; write!(f, "{name}") } @@ -479,7 +481,7 @@ impl Parameters for ChainType { fn network_type(&self) -> NetworkType { use ChainType::*; match self { - Mainnet | FakeMainnet => NetworkType::Main, + Mainnet => NetworkType::Main, Testnet => NetworkType::Test, Regtest(_) => NetworkType::Regtest, } @@ -491,7 +493,6 @@ impl Parameters for ChainType { Mainnet => MAIN_NETWORK.activation_height(nu), Testnet => TEST_NETWORK.activation_height(nu), Regtest(regtest_network) => regtest_network.activation_height(nu), - FakeMainnet => Some(BlockHeight::from_u32(1)), } } } diff --git a/zingolib/Cargo.toml b/zingolib/Cargo.toml index fed27fcc3c..b971585be8 100644 --- a/zingolib/Cargo.toml +++ b/zingolib/Cargo.toml @@ -11,9 +11,10 @@ deprecations = ["lightclient-deprecated"] test = ["lightclient-deprecated", "test-features"] lightclient-deprecated = [] test-features = ["zingo-testvectors"] -default = ["embed_params"] +default = ["embed_params", "send"] embed_params = [] darkside_tests = [] +send = [] [dependencies] zingoconfig = { path = "../zingoconfig" } @@ -44,7 +45,7 @@ hyper-rustls = { workspace = true } append-only-vec = { git = "https://github.com/zancas/append-only-vec.git", branch = "add_debug_impl" } log = "0.4.14" -http = "0.2.4" +http.workspace = true log4rs = "1.1.1" base64 = "0.13.0" bytes = "0.4" @@ -58,6 +59,7 @@ futures = { workspace = true } hex = { workspace = true } ring = "0.17.0" json = "0.12.4" +webpki-roots.workspace = true lazy_static = "1.4.0" secp256k1 = "=0.26.0" ripemd160 = "0.9.1" diff --git a/zingolib/src/commands.rs b/zingolib/src/commands.rs index 180c680ad6..b3e794dbd0 100644 --- a/zingolib/src/commands.rs +++ b/zingolib/src/commands.rs @@ -192,7 +192,6 @@ impl Command for ParseAddressCommand { zingoconfig::ChainType::Mainnet => "main", zingoconfig::ChainType::Testnet => "test", zingoconfig::ChainType::Regtest(_) => "regtest", - zingoconfig::ChainType::FakeMainnet => unreachable!(), }; match recipient_address { diff --git a/zingolib/src/error.rs b/zingolib/src/error.rs index 4edf688dcc..1154ccbd0a 100644 --- a/zingolib/src/error.rs +++ b/zingolib/src/error.rs @@ -100,7 +100,7 @@ impl std::fmt::Display for ZingoLibError { MissingOutputIndex(txid) => format!( "{txid} is missing output_index for note, cannot mark change" ), - + ViewkeyCantSpend => "viewkey cannot spend".to_string(), RequestConstruction(err) => format!( "transaction request {}", @@ -116,7 +116,7 @@ impl std::fmt::Display for ZingoLibError { string, ), CalculatedTransactionEncode(string) => format!( - "encoding newly created transaction {}", + "encoding newly created transaction {}", string, ), CalculatedTransactionDecode(string) => format!( diff --git a/zingolib/src/lightclient.rs b/zingolib/src/lightclient.rs index 705eebbdd9..4470900262 100644 --- a/zingolib/src/lightclient.rs +++ b/zingolib/src/lightclient.rs @@ -24,8 +24,6 @@ use zingoconfig::ZingoConfig; static LOG_INIT: std::sync::Once = std::sync::Once::new(); -const MARGINAL_FEE: u64 = 5_000; // From ZIP-317 - #[derive(Clone, Debug, Default)] pub struct WalletStatus { pub is_syncing: bool, @@ -67,6 +65,7 @@ pub struct LightClient { pub mod describe; pub mod disk; +#[cfg(feature = "send")] pub mod send; pub mod sync; @@ -430,11 +429,10 @@ async fn get_recent_median_price_from_gemini() -> Result { } #[cfg(test)] -#[cfg(feature = "test-features")] mod tests { use tokio::runtime::Runtime; use zingo_testvectors::seeds::CHIMNEY_BETTER_SEED; - use zingoconfig::{ChainType, ZingoConfig}; + use zingoconfig::{ChainType, RegtestNetwork, ZingoConfig}; use crate::{lightclient::LightClient, wallet::WalletBase}; @@ -447,7 +445,8 @@ mod tests { .expect("This path is available."); let wallet_name = data_dir.join("zingo-wallet.dat"); - let config = ZingoConfig::build(ChainType::FakeMainnet) + let regtest_network = RegtestNetwork::all_upgrades_active(); + let config = ZingoConfig::build(ChainType::Regtest(regtest_network)) .set_wallet_dir(data_dir) .create(); let lc = LightClient::create_from_wallet_base( @@ -482,12 +481,12 @@ mod tests { Runtime::new().unwrap().block_on(async move { let addresses = lc.do_addresses().await; assert_eq!( - "zs1q6xk3q783t5k92kjqt2rkuuww8pdw2euzy5rk6jytw97enx8fhpazdv3th4xe7vsk6e9sfpawfg" + "zregtestsapling1etnl5s47cqves0g5hk2dx5824rme4xv4aeauwzp4d6ys3qxykt5sw5rnaqh9syxry8vgxr7x3x4" .to_string(), addresses[0]["receivers"]["sapling"] ); assert_eq!( - "t1eQ63fwkQ4n4Eo5uCrPGaAV8FWB2tmx7ui", + "tmYd5GP6JxUxTUcz98NLPumEotvaMPaXytz".to_string(), addresses[0]["receivers"]["transparent"] ); }); diff --git a/zingolib/src/lightclient/describe.rs b/zingolib/src/lightclient/describe.rs index f1199c29a3..2c3d6a02d0 100644 --- a/zingolib/src/lightclient/describe.rs +++ b/zingolib/src/lightclient/describe.rs @@ -18,6 +18,7 @@ use serde::Serialize; use std::collections::HashMap; use tokio::runtime::Runtime; use zcash_address::ZcashAddress; +use zingoconfig::margin_fee; use zcash_client_backend::encoding::encode_payment_address; use zcash_primitives::{ @@ -30,8 +31,6 @@ use super::LightClient; static LOG_INIT: std::sync::Once = std::sync::Once::new(); -const MARGINAL_FEE: u64 = 5_000; // From ZIP-317 - #[derive(Clone, Debug, PartialEq, Serialize)] pub struct AccountBackupInfo { #[serde(rename = "seed")] @@ -201,7 +200,7 @@ impl LightClient { change += value; change_note_count += 1; } else if incoming { - if value > MARGINAL_FEE { + if value > margin_fee() { useful_value += value; inbound_note_count_nodust += 1; } else { @@ -219,7 +218,7 @@ impl LightClient { change += value; change_note_count += 1; } else if incoming { - if value > MARGINAL_FEE { + if value > margin_fee() { useful_value += value; inbound_note_count_nodust += 1; } else { @@ -234,7 +233,7 @@ impl LightClient { .for_each(|n| { // UTXOs are never 'change', as change would have been shielded. if incoming { - if n.value > MARGINAL_FEE { + if n.value > margin_fee() { utxo_value += n.value; inbound_utxo_count_nodust += 1; } else { @@ -244,15 +243,15 @@ impl LightClient { }); // The fee field only tracks mature income and change. - balances.minimum_fees += change_note_count * MARGINAL_FEE; + balances.minimum_fees += change_note_count * margin_fee(); if mature { - balances.minimum_fees += inbound_note_count_nodust * MARGINAL_FEE; + balances.minimum_fees += inbound_note_count_nodust * margin_fee(); } // If auto-shielding, UTXOs are considered immature and do not fall into any of the buckets that // the fee balance covers. if !auto_shielding { - balances.minimum_fees += inbound_utxo_count_nodust * MARGINAL_FEE; + balances.minimum_fees += inbound_utxo_count_nodust * margin_fee(); } if auto_shielding { @@ -286,7 +285,7 @@ impl LightClient { // Add the minimum fee for the receiving note, // but only if there exists notes to spend in the buckets that are covered by the minimum_fee. if balances.minimum_fees > 0 { - balances.minimum_fees += MARGINAL_FEE; // The receiving note. + balances.minimum_fees += margin_fee(); // The receiving note. } Ok(balances) diff --git a/zingolib/src/lightclient/disk.rs b/zingolib/src/lightclient/disk.rs index 331601b00f..6db55bae31 100644 --- a/zingolib/src/lightclient/disk.rs +++ b/zingolib/src/lightclient/disk.rs @@ -23,8 +23,6 @@ use super::LightClient; static LOG_INIT: std::sync::Once = std::sync::Once::new(); -const MARGINAL_FEE: u64 = 5_000; // From ZIP-317 - pub(super) struct ZingoSaveBuffer { pub buffer: Arc>>, } diff --git a/zingolib/src/lightclient/send.rs b/zingolib/src/lightclient/send.rs index da038177e1..300e0c08c8 100644 --- a/zingolib/src/lightclient/send.rs +++ b/zingolib/src/lightclient/send.rs @@ -1,3 +1,12 @@ +//! The sequence of steps necessary to send a zingo transaction are as follows: +//! +//! (1) create a proposed transaction +//! +//! (2) request that Thor bless the proposal with a thunderbolt +//! +//! (3) tie the proposal to a European swallow +//! +//! (4) slap the swallow on the ass and yell: Hee-aw! use crate::{ error::ZingoLibError, wallet::{ @@ -21,8 +30,6 @@ use super::LightClient; static LOG_INIT: std::sync::Once = std::sync::Once::new(); -const MARGINAL_FEE: u64 = 5_000; // From ZIP-317 - #[derive(Debug, Clone)] pub struct LightWalletSendProgress { pub progress: SendProgress, diff --git a/zingolib/src/lightclient/sync.rs b/zingolib/src/lightclient/sync.rs index c2c93ee459..98358c76eb 100644 --- a/zingolib/src/lightclient/sync.rs +++ b/zingolib/src/lightclient/sync.rs @@ -35,8 +35,6 @@ use super::LightClient; static LOG_INIT: std::sync::Once = std::sync::Once::new(); -const MARGINAL_FEE: u64 = 5_000; // From ZIP-317 - #[derive(Clone, Debug, Default)] pub struct SyncResult { pub success: bool, diff --git a/zingolib/src/wallet/data.rs b/zingolib/src/wallet/data.rs index eb4d17769e..3f119b2114 100644 --- a/zingolib/src/wallet/data.rs +++ b/zingolib/src/wallet/data.rs @@ -573,8 +573,6 @@ pub mod finsight { } } pub mod summaries { - use std::collections::HashMap; - use json::{object, JsonValue}; use zcash_primitives::transaction::TxId; @@ -697,8 +695,6 @@ pub mod summaries { } } } - - pub struct TransactionIndex(HashMap); } pub use crate::wallet::transaction_record::TransactionRecord; diff --git a/zingolib/src/wallet/record_book.rs b/zingolib/src/wallet/record_book.rs index ec0f113768..c3696bc642 100644 --- a/zingolib/src/wallet/record_book.rs +++ b/zingolib/src/wallet/record_book.rs @@ -1,11 +1,9 @@ -use std::{collections::HashMap}; +use std::collections::HashMap; use orchard::note_encryption::OrchardDomain; use sapling_crypto::note_encryption::SaplingDomain; use zcash_client_backend::ShieldedProtocol; -use zcash_primitives::transaction::{TxId}; - - +use zcash_primitives::transaction::TxId; use super::transaction_record::TransactionRecord; @@ -69,17 +67,14 @@ impl<'a> RefRecordBook<'a> { >, > { let transaction = self.remote_transactions.get(¬e_record_reference.txid); - transaction - .and_then(|transaction_record| match note_record_reference.shielded_protocol { - zcash_client_backend::ShieldedProtocol::Sapling => { - transaction_record - .get_received_note::(note_record_reference.index) - } - zcash_client_backend::ShieldedProtocol::Orchard => { - transaction_record - .get_received_note::(note_record_reference.index) - } - }) + transaction.and_then( + |transaction_record| match note_record_reference.shielded_protocol { + zcash_client_backend::ShieldedProtocol::Sapling => transaction_record + .get_received_note::(note_record_reference.index), + zcash_client_backend::ShieldedProtocol::Orchard => transaction_record + .get_received_note::(note_record_reference.index), + }, + ) } } diff --git a/zingolib/src/wallet/record_book/trait_inputsource.rs b/zingolib/src/wallet/record_book/trait_inputsource.rs index f9dc0a2600..8bac5272cb 100644 --- a/zingolib/src/wallet/record_book/trait_inputsource.rs +++ b/zingolib/src/wallet/record_book/trait_inputsource.rs @@ -1,13 +1,9 @@ -use std::{collections::BTreeMap}; - - +use std::collections::BTreeMap; use zcash_client_backend::{data_api::InputSource, ShieldedProtocol}; use zcash_primitives::{transaction::components::amount::NonNegativeAmount, zip32::AccountId}; -use crate::{ - error::{ZingoLibError, ZingoLibResult}, -}; +use crate::error::{ZingoLibError, ZingoLibResult}; use super::{NoteRecordIdentifier, RefRecordBook}; diff --git a/zingolib/src/wallet/spend_kit/trait_inputsource.rs b/zingolib/src/wallet/spend_kit/trait_inputsource.rs index 5711ce4d38..e2177f43f5 100644 --- a/zingolib/src/wallet/spend_kit/trait_inputsource.rs +++ b/zingolib/src/wallet/spend_kit/trait_inputsource.rs @@ -1,9 +1,4 @@ - - - - -use zcash_client_backend::{data_api::InputSource}; - +use zcash_client_backend::data_api::InputSource; use crate::{error::ZingoLibError, wallet::record_book::NoteRecordIdentifier};