diff --git a/.gitignore b/.gitignore index 1cdfff6..b58012b 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,5 @@ __pycache__/ # Virtual env for sideload (macOS and Windows) ledger/ # Build directory -build/ \ No newline at end of file +build/ +target-rust-analyzer/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..deb5230 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,18 @@ +[submodule "deps/sapling-crypto"] + path = deps/sapling-crypto + url = https://github.com/zcash/sapling-crypto.git +[submodule "deps/rust-secp256k1"] + path = deps/rust-secp256k1 + url = https://github.com/rust-bitcoin/rust-secp256k1.git +[submodule "deps/radium"] + path = deps/radium + url = https://github.com/ferrilab/radium.git +[submodule "deps/orchard"] + path = deps/orchard + url = https://github.com/zcash/orchard.git +[submodule "deps/librustzcash"] + path = deps/librustzcash + url = https://github.com/zcash/librustzcash.git +[submodule "deps/spin"] + path = deps/spin + url = https://github.com/zesterer/spin-rs.git diff --git a/Cargo.lock b/Cargo.lock index 0f2d124..b01f86a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,6 +8,27 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common 0.1.6", + "generic-array", +] + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -33,16 +54,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100" [[package]] -name = "app-boilerplate-rust" -version = "1.7.6" +name = "app-zcash-rust" +version = "0.0.1" dependencies = [ "hex", "image 0.25.7", "include_gif", "ledger_device_sdk", "numtoa", + "orchard", + "sapling-crypto", + "secp256k1", "serde", "serde-json-core", + "zcash_address", + "zcash_primitives", + "zcash_transparent", ] [[package]] @@ -62,6 +89,12 @@ dependencies = [ "syn 2.0.98", ] +[[package]] +name = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + [[package]] name = "arrayvec" version = "0.7.6" @@ -97,6 +130,12 @@ dependencies = [ "arrayvec", ] +[[package]] +name = "bech32" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" + [[package]] name = "bindgen" version = "0.65.1" @@ -120,6 +159,22 @@ dependencies = [ "which", ] +[[package]] +name = "bip32" +version = "0.6.0-pre.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "143f5327f23168716be068f8e1014ba2ea16a6c91e8777bc8927da7b51e1df1f" +dependencies = [ + "bs58", + "hmac", + "rand_core", + "ripemd 0.2.0-pre.4", + "secp256k1", + "sha2 0.11.0-pre.4", + "subtle", + "zeroize", +] + [[package]] name = "bit_field" version = "0.10.2" @@ -144,6 +199,89 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6099cdc01846bc367c4e7dd630dc5966dccf36b652fae7a74e17b640411a91b2" +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "blake2b_simd" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06e903a20b159e944f91ec8499fe1e55651480c541ea0a584f5d967c49ad9d99" +dependencies = [ + "arrayref", + "arrayvec", + "constant_time_eq", +] + +[[package]] +name = "blake2s_simd" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e90f7deecfac93095eb874a40febd69427776e24e1bd7f87f33ac62d6f0174df" +dependencies = [ + "arrayref", + "arrayvec", + "constant_time_eq", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-buffer" +version = "0.11.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fd016a0ddc7cb13661bf5576073ce07330a693f8608a1320b4e20561cc12cdc" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "bls12_381" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7bc6d6292be3a19e6379786dac800f551e5865a5bb51ebbe3064ab80433f403" +dependencies = [ + "ff", + "group", + "rand_core", + "subtle", +] + +[[package]] +name = "bounded-vec" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09dc0086e469182132244e9b8d313a0742e1132da43a08c24b9dd3c18e0faf3a" +dependencies = [ + "thiserror 2.0.17", +] + +[[package]] +name = "bs58" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" +dependencies = [ + "sha2 0.10.9", + "tinyvec", +] + [[package]] name = "built" version = "0.7.7" @@ -174,6 +312,15 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" +[[package]] +name = "cbc" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" +dependencies = [ + "cipher", +] + [[package]] name = "cc" version = "1.2.13" @@ -210,6 +357,41 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common 0.1.6", + "inout", + "zeroize", +] + [[package]] name = "clang-sys" version = "1.8.1" @@ -233,6 +415,30 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3c6565524986fe3225da0beb9b4aa55ebc73cd57ff8cb4ccf016ca4c8d006af" +[[package]] +name = "constant_time_eq" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" + +[[package]] +name = "core2" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "239fa3ae9b63c2dc74bd3fa852d4792b8b305ae64eeede946265b6af62f1fff3" +dependencies = [ + "memchr", +] + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.4.2" @@ -279,6 +485,46 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "crypto-common" +version = "0.2.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0b8ce8218c97789f16356e7896b3714f26c2ee1079b79c0b7ae7064bb9089fa" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer 0.10.4", + "crypto-common 0.1.6", +] + +[[package]] +name = "digest" +version = "0.11.0-pre.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf2e3d6615d99707295a9673e889bf363a04b2a466bd320c65a72536f7577379" +dependencies = [ + "block-buffer 0.11.0-rc.3", + "crypto-common 0.2.0-rc.1", + "subtle", +] + [[package]] name = "either" version = "1.13.0" @@ -315,6 +561,14 @@ dependencies = [ "syn 2.0.98", ] +[[package]] +name = "equihash" +version = "0.2.2" +dependencies = [ + "blake2b_simd", + "core2", +] + [[package]] name = "equivalent" version = "1.0.2" @@ -346,6 +600,13 @@ dependencies = [ "zune-inflate", ] +[[package]] +name = "f4jumble" +version = "0.1.1" +dependencies = [ + "blake2b_simd", +] + [[package]] name = "fax" version = "0.2.6" @@ -375,6 +636,17 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "bitvec", + "rand_core", + "subtle", +] + [[package]] name = "flate2" version = "1.0.35" @@ -385,6 +657,36 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "fpe" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26c4b37de5ae15812a764c958297cfc50f5c010438f60c6ce75d11b802abd404" +dependencies = [ + "cbc", + "cipher", + "libm", + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "generic-array" +version = "0.14.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bb6743198531e02858aeaea5398fcc883e71851fcbcb5a2f773e2fb6cb1edf2" +dependencies = [ + "typenum", + "version_check", +] + [[package]] name = "getrandom" version = "0.2.16" @@ -396,6 +698,18 @@ dependencies = [ "wasi", ] +[[package]] +name = "getset" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf0fc11e47561d47397154977bc219f4cf809b2974facc3ccb3b89e2436f912" +dependencies = [ + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.98", +] + [[package]] name = "gif" version = "0.13.1" @@ -412,6 +726,17 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + [[package]] name = "half" version = "2.4.1" @@ -422,6 +747,18 @@ dependencies = [ "crunchy", ] +[[package]] +name = "halo2_poseidon" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa3da60b81f02f9b33ebc6252d766f843291fb4d2247a07ae73d20b791fc56f" +dependencies = [ + "bitvec", + "ff", + "group", + "pasta_curves", +] + [[package]] name = "hash32" version = "0.3.1" @@ -463,6 +800,15 @@ dependencies = [ "serde", ] +[[package]] +name = "hmac" +version = "0.13.0-pre.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4b1fb14e4df79f9406b434b60acef9f45c26c50062cccf1346c6103b8c47d58" +dependencies = [ + "digest 0.11.0-pre.9", +] + [[package]] name = "home" version = "0.5.11" @@ -472,6 +818,15 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "hybrid-array" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2d35805454dc9f8662a98d6d61886ffe26bd465f5960e0e55345c70d5c0d2a9" +dependencies = [ + "typenum", +] + [[package]] name = "image" version = "0.24.9" @@ -541,6 +896,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "incrementalmerkletree" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30821f91f0fa8660edca547918dc59812893b497d07c1144f326f07fdd94aba9" +dependencies = [ + "either", +] + [[package]] name = "indexmap" version = "2.11.0" @@ -551,6 +915,15 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "interpolate_name" version = "0.2.4" @@ -589,11 +962,28 @@ dependencies = [ "rayon", ] +[[package]] +name = "jubjub" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8499f7a74008aafbecb2a2e608a3e13e4dd3e84df198b604451efe93f2de6e61" +dependencies = [ + "bitvec", + "bls12_381", + "ff", + "group", + "rand_core", + "subtle", +] + [[package]] name = "lazy_static" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +dependencies = [ + "spin", +] [[package]] name = "lazycell" @@ -661,6 +1051,12 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "libm" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" + [[package]] name = "linked_list_allocator" version = "0.10.5" @@ -704,6 +1100,12 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "memuse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d97bbf43eb4f088f8ca469930cde17fa036207c9a5e02ccc5107c4e8b17c964" + [[package]] name = "minimal-lexical" version = "0.2.1" @@ -746,6 +1148,12 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "nonempty" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "549e471b99ccaf2f89101bec68f4d244457d5a95a9c3d0672e9564124397741d" + [[package]] name = "noop_proc_macro" version = "0.3.0" @@ -814,6 +1222,58 @@ version = "1.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + +[[package]] +name = "orchard" +version = "0.11.0" +dependencies = [ + "aes", + "bitvec", + "blake2b_simd", + "core2", + "ff", + "fpe", + "getset", + "group", + "halo2_poseidon", + "hex", + "incrementalmerkletree", + "lazy_static", + "memuse", + "nonempty", + "pasta_curves", + "rand", + "rand_core", + "reddsa", + "serde", + "sinsemilla", + "subtle", + "visibility", + "zcash_note_encryption", + "zcash_spec", + "zip32", +] + +[[package]] +name = "pasta_curves" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e57598f73cc7e1b2ac63c79c517b31a0877cd7c402cdcaa311b5208de7a095" +dependencies = [ + "blake2b_simd", + "ff", + "group", + "lazy_static", + "rand", + "static_assertions", + "subtle", +] + [[package]] name = "paste" version = "1.0.15" @@ -858,6 +1318,23 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "portable-atomic" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -877,6 +1354,28 @@ dependencies = [ "syn 2.0.98", ] +[[package]] +name = "proc-macro-error-attr2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "proc-macro-error2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" +dependencies = [ + "proc-macro-error-attr2", + "proc-macro2", + "quote", + "syn 2.0.98", +] + [[package]] name = "proc-macro2" version = "1.0.93" @@ -938,6 +1437,10 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "radium" +version = "0.7.0" + [[package]] name = "rand" version = "0.8.5" @@ -998,7 +1501,7 @@ dependencies = [ "rand_chacha", "simd_helpers", "system-deps", - "thiserror", + "thiserror 1.0.69", "v_frame", "wasm-bindgen", ] @@ -1038,6 +1541,32 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "reddsa" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78a5191930e84973293aa5f532b513404460cd2216c1cfb76d08748c15b40b02" +dependencies = [ + "blake2b_simd", + "byteorder", + "group", + "hex", + "jubjub", + "pasta_curves", + "rand_core", +] + +[[package]] +name = "redjubjub" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b0ac1bc6bb3696d2c6f52cff8fba57238b81da8c0214ee6cd146eb8fde364e" +dependencies = [ + "rand_core", + "reddsa", + "zeroize", +] + [[package]] name = "regex" version = "1.11.1" @@ -1073,6 +1602,24 @@ version = "0.8.52" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c6a884d2998352bb4daf0183589aec883f16a6da1f4dde84d8e2e9a5409a1ce" +[[package]] +name = "ripemd" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "ripemd" +version = "0.2.0-pre.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48cf93482ea998ad1302c42739bc73ab3adc574890c373ec89710e219357579" +dependencies = [ + "digest 0.11.0-pre.9", +] + [[package]] name = "rustc-hash" version = "1.1.0" @@ -1104,6 +1651,48 @@ version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ea1a2d0a644769cc99faa24c3ad26b379b786fe7c36fd3c546254801650e6dd" +[[package]] +name = "sapling-crypto" +version = "0.5.0" +dependencies = [ + "aes", + "bitvec", + "blake2b_simd", + "blake2s_simd", + "bls12_381", + "core2", + "ff", + "fpe", + "getset", + "group", + "hex", + "incrementalmerkletree", + "jubjub", + "lazy_static", + "memuse", + "rand", + "rand_core", + "redjubjub", + "subtle", + "zcash_note_encryption", + "zcash_spec", + "zip32", +] + +[[package]] +name = "secp256k1" +version = "0.29.1" +dependencies = [ + "secp256k1-sys", +] + +[[package]] +name = "secp256k1-sys" +version = "0.10.0" +dependencies = [ + "cc", +] + [[package]] name = "serde" version = "1.0.217" @@ -1143,6 +1732,39 @@ dependencies = [ "serde", ] +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "sha2" +version = "0.11.0-pre.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "540c0893cce56cdbcfebcec191ec8e0f470dd1889b6e7a0b503e310a94a168f5" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.11.0-pre.9", +] + [[package]] name = "shlex" version = "1.3.0" @@ -1164,18 +1786,48 @@ dependencies = [ "quote", ] +[[package]] +name = "sinsemilla" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d268ae0ea06faafe1662e9967cd4f9022014f5eeb798e0c302c876df8b7af9c" +dependencies = [ + "group", + "pasta_curves", + "subtle", +] + [[package]] name = "smallvec" version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +[[package]] +name = "spin" +version = "0.9.8" +dependencies = [ + "portable-atomic", +] + [[package]] name = "stable_deref_trait" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "1.0.109" @@ -1211,6 +1863,12 @@ dependencies = [ "version-compare", ] +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "target-lexicon" version = "0.12.16" @@ -1223,7 +1881,16 @@ version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +dependencies = [ + "thiserror-impl 2.0.17", ] [[package]] @@ -1237,6 +1904,17 @@ dependencies = [ "syn 2.0.98", ] +[[package]] +name = "thiserror-impl" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.98", +] + [[package]] name = "tiff" version = "0.9.1" @@ -1262,6 +1940,21 @@ dependencies = [ "zune-jpeg", ] +[[package]] +name = "tinyvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "toml" version = "0.8.23" @@ -1296,12 +1989,28 @@ dependencies = [ "winnow", ] +[[package]] +name = "typenum" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" + [[package]] name = "unicode-ident" version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a210d160f08b701c8721ba1c726c11662f877ea6b7094007e1ca9a1041945034" +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common 0.1.6", + "subtle", +] + [[package]] name = "v_frame" version = "0.3.9" @@ -1319,6 +2028,23 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "visibility" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d674d135b4a8c1d7e813e2f8d1c9a58308aee4a680323066025e53132218bd91" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.98", +] + [[package]] name = "wasi" version = "0.11.1+wasi-snapshot-preview1" @@ -1483,6 +2209,143 @@ dependencies = [ "memchr", ] +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "zcash_address" +version = "0.10.1" +dependencies = [ + "bech32", + "bs58", + "core2", + "f4jumble", + "zcash_encoding", + "zcash_protocol", +] + +[[package]] +name = "zcash_encoding" +version = "0.3.0" +dependencies = [ + "core2", + "hex", + "nonempty", +] + +[[package]] +name = "zcash_note_encryption" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77efec759c3798b6e4d829fcc762070d9b229b0f13338c40bf993b7b609c2272" +dependencies = [ + "chacha20", + "chacha20poly1305", + "cipher", + "rand_core", + "subtle", +] + +[[package]] +name = "zcash_primitives" +version = "0.26.1" +dependencies = [ + "bip32", + "blake2b_simd", + "block-buffer 0.11.0-rc.3", + "bs58", + "core2", + "crypto-common 0.2.0-rc.1", + "equihash", + "ff", + "fpe", + "getset", + "group", + "hex", + "incrementalmerkletree", + "jubjub", + "memuse", + "nonempty", + "orchard", + "rand", + "rand_core", + "redjubjub", + "ripemd 0.1.3", + "sapling-crypto", + "sha2 0.10.9", + "subtle", + "zcash_address", + "zcash_encoding", + "zcash_note_encryption", + "zcash_protocol", + "zcash_script", + "zcash_spec", + "zcash_transparent", + "zip32", +] + +[[package]] +name = "zcash_protocol" +version = "0.7.1" +dependencies = [ + "core2", + "hex", + "zcash_encoding", +] + +[[package]] +name = "zcash_script" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bed6cf5b2b4361105d4ea06b2752f0c8af4641756c7fbc9858a80af186c234f" +dependencies = [ + "bip32", + "bitflags 2.8.0", + "bounded-vec", + "hex", + "ripemd 0.1.3", + "secp256k1", + "sha1", + "sha2 0.10.9", + "thiserror 2.0.17", +] + +[[package]] +name = "zcash_spec" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded3f58b93486aa79b85acba1001f5298f27a46489859934954d262533ee2915" +dependencies = [ + "blake2b_simd", +] + +[[package]] +name = "zcash_transparent" +version = "0.6.1" +dependencies = [ + "bip32", + "blake2b_simd", + "bs58", + "core2", + "getset", + "hex", + "ripemd 0.1.3", + "sha2 0.10.9", + "subtle", + "zcash_address", + "zcash_encoding", + "zcash_protocol", + "zcash_script", + "zcash_spec", + "zip32", +] + [[package]] name = "zerocopy" version = "0.8.26" @@ -1508,6 +2371,33 @@ name = "zeroize" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.98", +] + +[[package]] +name = "zip32" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64bf5186a8916f7a48f2a98ef599bf9c099e2458b36b819e393db1c0e768c4b" +dependencies = [ + "bech32", + "blake2b_simd", + "memuse", + "subtle", + "zcash_spec", +] [[package]] name = "zune-core" diff --git a/Cargo.toml b/Cargo.toml index 935e3ae..018b6d6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "app-boilerplate-rust" -version = "1.7.6" +name = "app-zcash-rust" +version = "0.0.1" authors = ["Ledger"] edition = "2021" @@ -12,11 +12,32 @@ serde-json-core = { git = "https://github.com/rust-embedded-community/serde-json hex = { version = "0.4.3", default-features = false, features = ["serde", "alloc"] } numtoa = "0.2.4" +# librustzcash deps +orchard = { path = "./deps/orchard", default-features = false } +sapling = { package = "sapling-crypto", path = "./deps/sapling-crypto", default-features = false } +secp256k1 = { path = "./deps/rust-secp256k1", default-features = false } + +# librustzcash packages +zcash_primitives = { path = "./deps/librustzcash/zcash_primitives", default-features = false } +zcash_transparent = { path = "./deps/librustzcash/zcash_transparent", default-features = false } +zcash_address = { path = "./deps/librustzcash/components/zcash_address", default-features = false } + [build-dependencies] image = "0.25.7" +[patch.crates-io] +# Used in orchard +radium = { path = "./deps/radium" } +# Used in bip32 in librustzcash +secp256k1 = { path = "./deps/rust-secp256k1" } +# Used in librustzcash +orchard = { path = "./deps/orchard" } +sapling-crypto = { path = "./deps/sapling-crypto" } +# Used by multiple deps +spin = { path = "./deps/spin" } + [profile.release] -opt-level = 'z' +opt-level = 3 lto = true [features] diff --git a/deps/librustzcash b/deps/librustzcash new file mode 160000 index 0000000..a40ee35 --- /dev/null +++ b/deps/librustzcash @@ -0,0 +1 @@ +Subproject commit a40ee353bba84d1cb3eaf1889df433d3be9c79e5 diff --git a/deps/orchard b/deps/orchard new file mode 160000 index 0000000..9d89b50 --- /dev/null +++ b/deps/orchard @@ -0,0 +1 @@ +Subproject commit 9d89b504c52dc69064ca431e8311a4cd1c279b44 diff --git a/deps/patches/librustzcash_dep.patch b/deps/patches/librustzcash_dep.patch new file mode 100644 index 0000000..86d5be0 --- /dev/null +++ b/deps/patches/librustzcash_dep.patch @@ -0,0 +1,26 @@ +diff --git a/Cargo.toml b/Cargo.toml +index 7fd4f9cfc..59c751aea 100644 +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -23,7 +23,7 @@ resolver = "2" + + [workspace.package] + edition = "2024" +-rust-version = "1.85.1" ++rust-version = "1.85.0" + repository = "https://github.com/zcash/librustzcash" + license = "MIT OR Apache-2.0" + categories = ["cryptography::cryptocurrencies"] +diff --git a/zcash_primitives/Cargo.toml b/zcash_primitives/Cargo.toml +index 2b74e67a4..819971082 100644 +--- a/zcash_primitives/Cargo.toml ++++ b/zcash_primitives/Cargo.toml +@@ -38,7 +38,7 @@ sha2.workspace = true + + # - Logging and metrics + memuse.workspace = true +-tracing = { workspace = true, default-features = false } ++#tracing = { workspace = true, default-features = false } + + # - Secret management + subtle.workspace = true diff --git a/deps/patches/orchard_dep.patch b/deps/patches/orchard_dep.patch new file mode 100644 index 0000000..d0ee0a0 --- /dev/null +++ b/deps/patches/orchard_dep.patch @@ -0,0 +1,13 @@ +diff --git a/Cargo.toml b/Cargo.toml +index 07b1a66..9295680 100644 +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -56,7 +56,7 @@ halo2_proofs = { version = "0.3", optional = true, default-features = false, fea + getset = "0.1" + + # Logging +-tracing = { version = "0.1", default-features = false } ++#tracing = { version = "0.1", default-features = false } + + # No-std support + core2 = { version = "0.3", default-features = false, features = ["alloc"] } diff --git a/deps/patches/radium_dep.patch b/deps/patches/radium_dep.patch new file mode 100644 index 0000000..3534a72 --- /dev/null +++ b/deps/patches/radium_dep.patch @@ -0,0 +1,39 @@ +diff --git a/Cargo.toml b/Cargo.toml +index 8204e6d..4b691cf 100644 +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -22,3 +22,13 @@ edition = "2018" + + [dev-dependencies] + static_assertions = "1" ++ ++ ++[lints.rust] ++unexpected_cfgs = { level = "warn", check-cfg = [ ++ 'cfg(radium_atomic_8)', ++ 'cfg(radium_atomic_16)', ++ 'cfg(radium_atomic_32)', ++ 'cfg(radium_atomic_64)', ++ 'cfg(radium_atomic_ptr)' ++] } +\ No newline at end of file +diff --git a/build.rs b/build.rs +index 884ec99..eb26703 100644 +--- a/build.rs ++++ b/build.rs +@@ -83,13 +83,14 @@ fn main() -> Result<(), Box> { + match tgt_arch { + "armv5te" | "mips" | "mipsel" | "powerpc" | "riscv32imac" | "thumbv7em" | "thumbv7m" + | "thumbv8m.base" | "thumbv8m.main" | "armebv7r" | "armv7r" => atomics.has_64 = false, ++ "nanosplus" | "stax" | "flex" | "apex_p" => atomics.has_64 = false, + // These ARMv7 targets have 32-bit pointers and 64-bit atomics. + "armv7" | "armv7a" | "armv7s" => atomics.has_64 = true, + // "riscv32imc-unknown-none-elf" and "riscv32imac-unknown-none-elf" are + // both `target_arch = "riscv32", and have no stable `cfg`-discoverable + // distinction. As such, the non-atomic RISC-V targets must be + // discovered here. +- "riscv32i" | "riscv32imc" | "thumbv6m" => atomics = Atomics::NONE, ++ "riscv32i" | "riscv32imc" | "thumbv6m" | "nanox" => atomics = Atomics::NONE, + _ => {} + } + #[allow(clippy::match_single_binding, clippy::single_match)] diff --git a/deps/patches/rust-secp256k1_dep.patch b/deps/patches/rust-secp256k1_dep.patch new file mode 100644 index 0000000..090dad5 --- /dev/null +++ b/deps/patches/rust-secp256k1_dep.patch @@ -0,0 +1,112 @@ +diff --git a/secp256k1-sys/build.rs b/secp256k1-sys/build.rs +index 49d02e35..87247500 100644 +--- a/secp256k1-sys/build.rs ++++ b/secp256k1-sys/build.rs +@@ -11,55 +11,57 @@ + + extern crate cc; + +-use std::env; ++fn main() {} + +-fn main() { +- // Actual build +- let mut base_config = cc::Build::new(); +- base_config.include("depend/secp256k1/") +- .include("depend/secp256k1/include") +- .include("depend/secp256k1/src") +- .flag_if_supported("-Wno-unused-function") // some ecmult stuff is defined but not used upstream +- .flag_if_supported("-Wno-unused-parameter") // patching out printf causes this warning +- .define("SECP256K1_API", Some("")) +- .define("ENABLE_MODULE_ECDH", Some("1")) +- .define("ENABLE_MODULE_SCHNORRSIG", Some("1")) +- .define("ENABLE_MODULE_EXTRAKEYS", Some("1")) +- .define("ENABLE_MODULE_ELLSWIFT", Some("1")) +- // upstream sometimes introduces calls to printf, which we cannot compile +- // with WASM due to its lack of libc. printf is never necessary and we can +- // just #define it away. +- .define("printf(...)", Some("")); +- +- if cfg!(feature = "lowmemory") { +- base_config.define("ECMULT_WINDOW_SIZE", Some("4")); // A low-enough value to consume negligible memory +- base_config.define("ECMULT_GEN_PREC_BITS", Some("2")); +- } else { +- base_config.define("ECMULT_GEN_PREC_BITS", Some("4")); +- base_config.define("ECMULT_WINDOW_SIZE", Some("15")); // This is the default in the configure file (`auto`) +- } +- base_config.define("USE_EXTERNAL_DEFAULT_CALLBACKS", Some("1")); +- #[cfg(feature = "recovery")] +- base_config.define("ENABLE_MODULE_RECOVERY", Some("1")); +- +- // WASM headers and size/align defines. +- if env::var("CARGO_CFG_TARGET_ARCH").unwrap() == "wasm32" { +- base_config.include("wasm/wasm-sysroot") +- .file("wasm/wasm.c"); +- } +- +- // secp256k1 +- base_config.file("depend/secp256k1/contrib/lax_der_parsing.c") +- .file("depend/secp256k1/src/precomputed_ecmult_gen.c") +- .file("depend/secp256k1/src/precomputed_ecmult.c") +- .file("depend/secp256k1/src/secp256k1.c"); +- +- if base_config.try_compile("libsecp256k1.a").is_err() { +- // Some embedded platforms may not have, eg, string.h available, so if the build fails +- // simply try again with the wasm sysroot (but without the wasm type sizes) in the hopes +- // that it works. +- base_config.include("wasm/wasm-sysroot"); +- base_config.compile("libsecp256k1.a"); +- } +-} ++//use std::env; ++// ++//fn main() { ++// // Actual build ++// let mut base_config = cc::Build::new(); ++// base_config.include("depend/secp256k1/") ++// .include("depend/secp256k1/include") ++// .include("depend/secp256k1/src") ++// .flag_if_supported("-Wno-unused-function") // some ecmult stuff is defined but not used upstream ++// .flag_if_supported("-Wno-unused-parameter") // patching out printf causes this warning ++// .define("SECP256K1_API", Some("")) ++// .define("ENABLE_MODULE_ECDH", Some("1")) ++// .define("ENABLE_MODULE_SCHNORRSIG", Some("1")) ++// .define("ENABLE_MODULE_EXTRAKEYS", Some("1")) ++// .define("ENABLE_MODULE_ELLSWIFT", Some("1")) ++// // upstream sometimes introduces calls to printf, which we cannot compile ++// // with WASM due to its lack of libc. printf is never necessary and we can ++// // just #define it away. ++// .define("printf(...)", Some("")); ++// ++// if cfg!(feature = "lowmemory") { ++// base_config.define("ECMULT_WINDOW_SIZE", Some("4")); // A low-enough value to consume negligible memory ++// base_config.define("ECMULT_GEN_PREC_BITS", Some("2")); ++// } else { ++// base_config.define("ECMULT_GEN_PREC_BITS", Some("4")); ++// base_config.define("ECMULT_WINDOW_SIZE", Some("15")); // This is the default in the configure file (`auto`) ++// } ++// base_config.define("USE_EXTERNAL_DEFAULT_CALLBACKS", Some("1")); ++// #[cfg(feature = "recovery")] ++// base_config.define("ENABLE_MODULE_RECOVERY", Some("1")); ++// ++// // WASM headers and size/align defines. ++// if env::var("CARGO_CFG_TARGET_ARCH").unwrap() == "wasm32" { ++// base_config.include("wasm/wasm-sysroot") ++// .file("wasm/wasm.c"); ++// } ++// ++// // secp256k1 ++// base_config.file("depend/secp256k1/contrib/lax_der_parsing.c") ++// .file("depend/secp256k1/src/precomputed_ecmult_gen.c") ++// .file("depend/secp256k1/src/precomputed_ecmult.c") ++// .file("depend/secp256k1/src/secp256k1.c"); ++// ++// if base_config.try_compile("libsecp256k1.a").is_err() { ++// // Some embedded platforms may not have, eg, string.h available, so if the build fails ++// // simply try again with the wasm sysroot (but without the wasm type sizes) in the hopes ++// // that it works. ++// base_config.include("wasm/wasm-sysroot"); ++// base_config.compile("libsecp256k1.a"); ++// } ++//} + diff --git a/deps/patches/sapling-crypto_dep.patch b/deps/patches/sapling-crypto_dep.patch new file mode 100644 index 0000000..ee92654 --- /dev/null +++ b/deps/patches/sapling-crypto_dep.patch @@ -0,0 +1,31 @@ +diff --git a/Cargo.toml b/Cargo.toml +index 868d316..42121a7 100644 +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -51,7 +51,7 @@ hex = { version = "0.4", default-features = false, features = ["alloc"] } + + # Logging and metrics + memuse = { version = "0.2.2", default-features = false } +-tracing = { version = "0.1", default-features = false } ++#tracing = { version = "0.1", default-features = false } + + # Note Commitment Trees + bitvec = { version = "1", default-features = false } +@@ -64,7 +64,7 @@ zcash_note_encryption = { version = "0.4", features = ["pre-zip-212"] } + subtle = { version = "2.2.3", default-features = false } + + # Static constants +-lazy_static = "1" ++lazy_static = { version = "1", default-features = false, features = ["spin_no_std"] } + + # Test dependencies + proptest = { version = "1", optional = true } +@@ -104,6 +104,8 @@ circuit = [ + "std" + ] + ++#no_std = [ "lazy_static/spin_no_std" ] ++ + ## Enables multithreading support for creating proofs. + multicore = ["bellman?/multicore"] + diff --git a/deps/patches/spin_dep.patch b/deps/patches/spin_dep.patch new file mode 100644 index 0000000..e887efa --- /dev/null +++ b/deps/patches/spin_dep.patch @@ -0,0 +1,39 @@ +diff --git a/Cargo.toml b/Cargo.toml +index 24761ec..eb9862b 100644 +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -14,7 +14,7 @@ rust-version = "1.38" + + [dependencies] + lock_api_crate = { package = "lock_api", version = "0.4", optional = true } +-portable-atomic = { version = "1", optional = true, default-features = false } ++portable-atomic = { version = "1", default-features = false, features = ["unsafe-assume-single-core"] } + + [features] + default = ["lock_api", "mutex", "spin_mutex", "rwlock", "once", "lazy", "barrier"] +@@ -60,7 +60,7 @@ std = [] + # implementation that sound for your system by implementing an unsafe trait. + # See the documentation for the `portable-atomic` crate for more information: + # https://docs.rs/portable-atomic/latest/portable_atomic/#optional-cfg +-portable_atomic = ["portable-atomic"] ++#portable_atomic = ["portable-atomic"] + + [package.metadata.docs.rs] + all-features = true +diff --git a/src/lib.rs b/src/lib.rs +index 50768bc..692e6eb 100644 +--- a/src/lib.rs ++++ b/src/lib.rs +@@ -63,12 +63,7 @@ + #[cfg(any(test, feature = "std"))] + extern crate core; + +-#[cfg(feature = "portable_atomic")] + extern crate portable_atomic; +- +-#[cfg(not(feature = "portable_atomic"))] +-use core::sync::atomic; +-#[cfg(feature = "portable_atomic")] + use portable_atomic as atomic; + + #[cfg(feature = "barrier")] diff --git a/deps/radium b/deps/radium new file mode 160000 index 0000000..3f27e0d --- /dev/null +++ b/deps/radium @@ -0,0 +1 @@ +Subproject commit 3f27e0d827338aee919213fd071b99819a1b9fff diff --git a/deps/rust-secp256k1 b/deps/rust-secp256k1 new file mode 160000 index 0000000..1a1fc57 --- /dev/null +++ b/deps/rust-secp256k1 @@ -0,0 +1 @@ +Subproject commit 1a1fc57fb99a5a42b996d3cdde5c48fda3797709 diff --git a/deps/sapling-crypto b/deps/sapling-crypto new file mode 160000 index 0000000..6a8282b --- /dev/null +++ b/deps/sapling-crypto @@ -0,0 +1 @@ +Subproject commit 6a8282be0959b410a0b622cd5eb84f8c3c134078 diff --git a/deps/spin b/deps/spin new file mode 160000 index 0000000..502c9dc --- /dev/null +++ b/deps/spin @@ -0,0 +1 @@ +Subproject commit 502c9dca17c99762184095c9d64c0aedd1db97ff diff --git a/init_deps.sh b/init_deps.sh new file mode 100755 index 0000000..151a655 --- /dev/null +++ b/init_deps.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +set -e +set -o pipefail + +# Initialize and update git submodules +git submodule update --init --recursive + +pushd deps > /dev/null + +# Patch submodule deps +# For every patch file in deps/patches, apply it to the corresponding submodule +for patch_file in patches/*.patch; do + # Extract submodule name from patch file name + patch_filename=$(basename "$patch_file") + submodule_name="${patch_filename%_dep.patch}" + echo "Applying patch $patch_file to submodule $submodule_name" + # Change to submodule directory + pushd "$submodule_name" > /dev/null + # Apply the patch + git apply "../$patch_file" + # Return to original directory + popd > /dev/null +done + +popd > /dev/null + + diff --git a/update_patches.sh b/update_patches.sh new file mode 100755 index 0000000..7cbf468 --- /dev/null +++ b/update_patches.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -e +set -o pipefail + +pushd deps > /dev/null + +# For every submodule, cd into it directory and generate patches +# don't forget to skip the patches directory +for submodule_dir in */ ; do + [[ "$submodule_dir" == "patches/" ]] && continue + submodule_name=$(basename "$submodule_dir") + echo "Generating patch for submodule $submodule_name" + pushd "$submodule_name" > /dev/null + # Generate patch and save it to patches directory + git diff > "../patches/${submodule_name}_dep.patch" + popd > /dev/null +done + +popd > /dev/null \ No newline at end of file