diff --git a/.deny.toml b/.deny.toml index 1cb3879c..ed628f09 100644 --- a/.deny.toml +++ b/.deny.toml @@ -12,6 +12,7 @@ ignore = [ { id = "RUSTSEC-2024-0436", reason = "`paste` has a security vulnerability; consider using an alternative. Use `cargo tree -p paste -i > tmp.txt` to check the dependency tree." }, { id = "RUSTSEC-2025-0055", reason = "`tracing-subscriber` v0.2.25 pulled in by ark-relations v0.4.0 - will be addressed before mainnet" }, { id = "RUSTSEC-2025-0141", reason = "`bincode` is unmaintained but continuing to use it." }, + { id = "RUSTSEC-2023-0089", reason = "atomic-polyfill is pulled transitively via risc0-zkvm; waiting on upstream fix (see https://github.com/risc0/risc0/issues/3453)" }, ] yanked = "deny" unused-ignored-advisory = "deny" @@ -35,6 +36,16 @@ allow = [ "Unicode-3.0", "Zlib", ] +exceptions = [ + # TEMP: Pending legal review. Pulled transitively via `risc0-zkvm` + { name = "downloader", version = "0.2.8", allow = ["LGPL-3.0-or-later"] }, + { name = "malachite", version = "0.4.22", allow = ["LGPL-3.0-only"] }, + { name = "malachite-base", version = "0.4.22", allow = ["LGPL-3.0-only"] }, + { name = "malachite-float", version = "0.4.22", allow = ["LGPL-3.0-only"] }, + { name = "malachite-nz", version = "0.4.22", allow = ["LGPL-3.0-only"] }, + { name = "malachite-q", version = "0.4.22", allow = ["LGPL-3.0-only"] }, + { name = "managed", version = "0.8.0", allow = ["0BSD"] }, +] private = { ignore = false } unused-allowed-license = "deny" diff --git a/Cargo.lock b/Cargo.lock index dd898c8a..8dddcb92 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11,7 +11,7 @@ dependencies = [ "actix-macros", "actix-rt", "actix_derive", - "bitflags 2.10.0", + "bitflags 2.11.0", "bytes", "crossbeam-channel", "futures-core", @@ -33,7 +33,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f7b0a21988c1bf877cf4759ef5ddaac04c1c9fe808c9142ecb78ba97d97a28a" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", "bytes", "futures-core", "futures-sink", @@ -70,7 +70,7 @@ dependencies = [ "actix-service", "actix-utils", "base64 0.22.1", - "bitflags 2.10.0", + "bitflags 2.11.0", "bytes", "bytestring", "derive_more 2.1.1", @@ -102,7 +102,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -215,7 +215,7 @@ dependencies = [ "actix-router", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -226,9 +226,51 @@ checksum = "b6ac1e58cded18cb28ddc17143c4dea5345b3ad575e14f32f66e4054a56eb271" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] +[[package]] +name = "addchain" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b2e69442aa5628ea6951fa33e24efe8313f4321a91bd729fc2f75bdfc858570" +dependencies = [ + "num-bigint 0.3.3", + "num-integer", + "num-traits", +] + +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "cpp_demangle", + "fallible-iterator", + "gimli 0.31.1", + "memmap2", + "object 0.36.7", + "rustc-demangle", + "smallvec", + "typed-arena", +] + +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli 0.32.3", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + [[package]] name = "aead" version = "0.5.2" @@ -397,12 +439,24 @@ name = "anyhow" version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f0e0fee31ef5ed1ba1316088939cea399010ed7731dba877ed44aeb407a75ea" +dependencies = [ + "backtrace", +] + +[[package]] +name = "arbitrary" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" +dependencies = [ + "derive_arbitrary", +] [[package]] name = "arc-swap" -version = "1.8.1" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ded5f9a03ac8f24d1b8a25101ee812cd32cdc8c50a4c50237de2c4915850e73" +checksum = "f9f3647c145568cec02c42054e07bdf9a5a698e15b466fb2341bfc393cd24aa5" dependencies = [ "rustversion", ] @@ -487,7 +541,7 @@ checksum = "e7e89fe77d1f0f4fe5b96dfc940923d88d17b6a773808124f21e764dfb063c6a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -522,7 +576,7 @@ dependencies = [ "fnv", "hashbrown 0.15.5", "itertools 0.13.0", - "num-bigint", + "num-bigint 0.4.6", "num-integer", "num-traits", "zeroize", @@ -541,7 +595,7 @@ dependencies = [ "derivative", "digest", "itertools 0.10.5", - "num-bigint", + "num-bigint 0.4.6", "num-traits", "paste", "rustc_version", @@ -562,7 +616,7 @@ dependencies = [ "digest", "educe", "itertools 0.13.0", - "num-bigint", + "num-bigint 0.4.6", "num-traits", "paste", "zeroize", @@ -585,7 +639,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62945a2f7e6de02a31fe400aa489f0e0f5b2502e69f95f853adb82a96c7a6b60" dependencies = [ "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -594,7 +648,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" dependencies = [ - "num-bigint", + "num-bigint 0.4.6", "num-traits", "proc-macro2", "quote", @@ -607,11 +661,11 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09be120733ee33f7693ceaa202ca41accd5653b779563608f1234f78ae07c4b3" dependencies = [ - "num-bigint", + "num-bigint 0.4.6", "num-traits", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -683,7 +737,7 @@ dependencies = [ "ark-relations 0.5.1", "ark-std 0.5.0", "educe", - "num-bigint", + "num-bigint 0.4.6", "num-integer", "num-traits", "tracing", @@ -722,7 +776,7 @@ dependencies = [ "ark-serialize-derive 0.4.2", "ark-std 0.4.0", "digest", - "num-bigint", + "num-bigint 0.4.6", ] [[package]] @@ -735,7 +789,7 @@ dependencies = [ "ark-std 0.5.0", "arrayvec", "digest", - "num-bigint", + "num-bigint 0.4.6", ] [[package]] @@ -757,7 +811,7 @@ checksum = "213888f660fddcca0d257e88e54ac05bca01885f258ccdf695bafd77031bb69d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -874,7 +928,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -885,7 +939,16 @@ checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", +] + +[[package]] +name = "atomic-polyfill" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cf2bce30dfe09ef0bfaef228b9d414faaf7e563035494d7fe092dba54b300f4" +dependencies = [ + "critical-section", ] [[package]] @@ -905,7 +968,7 @@ dependencies = [ "manyhow", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -921,7 +984,7 @@ dependencies = [ "proc-macro2", "quote", "quote-use", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -1039,6 +1102,21 @@ dependencies = [ "tracing", ] +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line 0.25.1", + "cfg-if", + "libc", + "miniz_oxide", + "object 0.37.3", + "rustc-demangle", + "windows-link", +] + [[package]] name = "base-x" version = "0.2.11" @@ -1122,7 +1200,7 @@ version = "0.72.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", "cexpr", "clang-sys", "itertools 0.13.0", @@ -1131,7 +1209,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -1175,9 +1253,21 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.10.0" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" +checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" + +[[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 = "blake2" @@ -1211,7 +1301,7 @@ checksum = "227aa051deec8d16bd9c34605e7aaf153f240e35483dd42f6f78903847934738" dependencies = [ "async-stream", "base64 0.22.1", - "bitflags 2.10.0", + "bitflags 2.11.0", "bollard-buildkit-proto", "bollard-stubs", "bytes", @@ -1310,7 +1400,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -1345,7 +1435,7 @@ checksum = "f9abbd1bc6865053c427f7198e6af43bfdedc55ab791faed4fbd361d789575ff" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -1428,7 +1518,7 @@ dependencies = [ "quote", "serde", "serde_json", - "syn 2.0.115", + "syn 2.0.116", "tempfile", "toml 0.9.12+spec-1.1.0", ] @@ -1480,7 +1570,7 @@ checksum = "45565fc9416b9896014f5732ac776f810ee53a66730c17e4020c3ec064a8f88f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -1531,9 +1621,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.58" +version = "4.5.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63be97961acde393029492ce0be7a1af7e323e6bae9511ebfac33751be5e6806" +checksum = "c5caf74d17c3aec5495110c34cc3f78644bfa89af6c8993ed4de2790e49b6499" dependencies = [ "clap_builder", "clap_derive", @@ -1541,9 +1631,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.58" +version = "4.5.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f13174bda5dfd69d7e947827e5af4b0f2f94a4a3ee92912fba07a66150f21e2" +checksum = "370daa45065b80218950227371916a1633217ae42b2715b2287b606dcd618e24" dependencies = [ "anstream", "anstyle", @@ -1560,7 +1650,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -1713,9 +1803,9 @@ checksum = "2f421161cb492475f1661ddc9815a745a1c894592070661180fdec3d4872e9c3" [[package]] name = "const-str" -version = "0.7.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0664d2867b4a32697dfe655557f5c3b187e9b605b38612a748e5ec99811d160" +checksum = "18f12cc9948ed9604230cdddc7c86e270f9401ccbe3c2e98a4378c5e7632212f" [[package]] name = "const_format" @@ -1776,6 +1866,24 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "convert_case" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "affbf0190ed2caf063e3def54ff444b449371d55c58e513a95ab98eca50adb49" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "convert_case_extras" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589c70f0faf8aa9d17787557d5eae854d7755cac50f5c3d12c81d3d57661cebb" +dependencies = [ + "convert_case 0.11.0", +] + [[package]] name = "core-foundation" version = "0.9.4" @@ -1822,6 +1930,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "cpp_demangle" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2bb79cb74d735044c972aae58ed0aaa9a837e85b01106a54c39e42e97f62253" +dependencies = [ + "cfg-if", +] + [[package]] name = "cpufeatures" version = "0.2.17" @@ -1831,6 +1948,21 @@ dependencies = [ "libc", ] +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "critical-section" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" + [[package]] name = "crossbeam-channel" version = "0.5.15" @@ -1840,6 +1972,25 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "crossbeam-utils" version = "0.8.21" @@ -1909,7 +2060,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -1943,7 +2094,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -1957,7 +2108,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -1968,7 +2119,7 @@ checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ "darling_core 0.20.11", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -1979,21 +2130,7 @@ checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ "darling_core 0.21.3", "quote", - "syn 2.0.115", -] - -[[package]] -name = "dashmap" -version = "6.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf" -dependencies = [ - "cfg-if", - "crossbeam-utils", - "hashbrown 0.14.5", - "lock_api", - "once_cell", - "parking_lot_core", + "syn 2.0.116", ] [[package]] @@ -2019,7 +2156,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ab67060fc6b8ef687992d439ca0fa36e7ed17e9a0b16b25b601e8757df720de" dependencies = [ "data-encoding", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -2062,7 +2199,18 @@ checksum = "ef941ded77d15ca19b40374869ac6000af1c9f2a4c0f3d4c70926287e6364a8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", +] + +[[package]] +name = "derive_arbitrary" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.116", ] [[package]] @@ -2083,7 +2231,7 @@ dependencies = [ "darling 0.20.11", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -2093,7 +2241,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" dependencies = [ "derive_builder_core", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -2106,7 +2254,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -2128,7 +2276,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.115", + "syn 2.0.116", "unicode-xid", ] @@ -2144,6 +2292,15 @@ dependencies = [ "subtle", ] +[[package]] +name = "directories" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16f5094c54661b38d03bd7e50df373292118db60b585c08a411c6d840017fe7d" +dependencies = [ + "dirs-sys", +] + [[package]] name = "dirs" version = "6.0.0" @@ -2173,7 +2330,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -2211,6 +2368,20 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" +[[package]] +name = "downloader" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ac1e888d6830712d565b2f3a974be3200be9296bc1b03db8251a4cbf18a4a34" +dependencies = [ + "digest", + "futures", + "rand 0.8.5", + "reqwest", + "thiserror 1.0.69", + "tokio", +] + [[package]] name = "drain_filter_polyfill" version = "0.1.3" @@ -2283,7 +2454,7 @@ dependencies = [ "enum-ordinalize", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -2356,6 +2527,26 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "enum-map" +version = "2.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6866f3bfdf8207509a033af1a75a7b08abda06bbaaeae6669323fd5a097df2e9" +dependencies = [ + "enum-map-derive", +] + +[[package]] +name = "enum-map-derive" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.116", +] + [[package]] name = "enum-ordinalize" version = "4.3.2" @@ -2373,7 +2564,7 @@ checksum = "8ca9601fb2d62598ee17836250842873a413586e5d7ed88b356e38ddbb0ec631" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -2401,6 +2592,17 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1731451909bde27714eacba19c2566362a7f35224f52b153d3f42cf60f72472" +[[package]] +name = "erased-serde" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89e8918065695684b2b0702da20382d5ae6065cf3327bc2d6436bd49a71ce9f3" +dependencies = [ + "serde", + "serde_core", + "typeid", +] + [[package]] name = "errno" version = "0.3.14" @@ -2485,6 +2687,12 @@ dependencies = [ "web-sys", ] +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + [[package]] name = "fastrand" version = "2.3.0" @@ -2508,10 +2716,28 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" dependencies = [ + "bitvec", + "byteorder", + "ff_derive", "rand_core 0.6.4", "subtle", ] +[[package]] +name = "ff_derive" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f10d12652036b0e99197587c6ba87a8fc3031986499973c030d8b44fcc151b60" +dependencies = [ + "addchain", + "num-bigint 0.3.3", + "num-integer", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "fiat-crypto" version = "0.2.9" @@ -2535,6 +2761,16 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" +[[package]] +name = "flate2" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + [[package]] name = "fnv" version = "1.0.7" @@ -2574,7 +2810,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -2599,10 +2835,16 @@ dependencies = [ ] [[package]] -name = "futures" -version = "0.3.31" +name = "funty" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d" dependencies = [ "futures-channel", "futures-core", @@ -2615,9 +2857,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" dependencies = [ "futures-core", "futures-sink", @@ -2625,50 +2867,49 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" [[package]] name = "futures-executor" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d" dependencies = [ "futures-core", "futures-task", "futures-util", - "num_cpus", ] [[package]] name = "futures-io" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" [[package]] name = "futures-macro" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] name = "futures-sink" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" [[package]] name = "futures-task" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" [[package]] name = "futures-timer" @@ -2682,9 +2923,9 @@ dependencies = [ [[package]] name = "futures-util" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" dependencies = [ "futures-channel", "futures-core", @@ -2694,10 +2935,33 @@ dependencies = [ "futures-task", "memchr", "pin-project-lite", - "pin-utils", "slab", ] +[[package]] +name = "gdbstub" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bf845b08f7c2ef3b5ad19f80779d43ae20d278652b91bb80adda65baf2d8ed6" +dependencies = [ + "bitflags 2.11.0", + "cfg-if", + "log", + "managed", + "num-traits", + "paste", +] + +[[package]] +name = "gdbstub_arch" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22dde0e1b68787036ccedd0b1ff6f953527a0e807e571fbe898975203027278f" +dependencies = [ + "gdbstub", + "num-traits", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -2754,10 +3018,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "139ef39800118c7683f2fd3c98c1b23c09ae076556b435f8e9064ae108aaeeec" dependencies = [ "cfg-if", + "js-sys", "libc", "r-efi", "wasip2", "wasip3", + "wasm-bindgen", ] [[package]] @@ -2770,6 +3036,23 @@ dependencies = [ "polyval", ] +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" +dependencies = [ + "fallible-iterator", + "indexmap 2.13.0", + "stable_deref_trait", +] + +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + [[package]] name = "glob" version = "0.3.3" @@ -2877,6 +3160,15 @@ dependencies = [ "tracing", ] +[[package]] +name = "hash32" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" +dependencies = [ + "byteorder", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -2897,6 +3189,9 @@ name = "hashbrown" version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash 0.8.12", +] [[package]] name = "hashbrown" @@ -2923,6 +3218,20 @@ dependencies = [ "hashbrown 0.15.5", ] +[[package]] +name = "heapless" +version = "0.7.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdc6457c0eb62c71aac4bc17216026d8410337c4126773b9c5daba343f17964f" +dependencies = [ + "atomic-polyfill", + "hash32", + "rustc_version", + "serde", + "spin", + "stable_deref_trait", +] + [[package]] name = "heck" version = "0.5.0" @@ -3449,9 +3758,9 @@ dependencies = [ [[package]] name = "indicatif" -version = "0.18.3" +version = "0.18.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9375e112e4b463ec1b1c6c011953545c65a30164fbab5b581df32b3abf0dcb88" +checksum = "25470f23803092da7d239834776d653104d551bc4d7eacaf31e6837854b8e9eb" dependencies = [ "console", "portable-atomic", @@ -3556,6 +3865,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.13.0" @@ -3751,7 +4069,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -3891,7 +4209,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -3911,16 +4229,16 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" [[package]] name = "leptos" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f9569fc37575a5d64c0512145af7630bf651007237ef67a8a77328199d315bb" +checksum = "43ad8042559850ee5253293b8460a75513f7d542021b9303083d5c236bcdd16f" dependencies = [ "any_spawner", "base64 0.22.1", "cfg-if", "either_of", "futures", - "getrandom 0.3.4", + "getrandom 0.4.1", "hydration_context", "leptos_config", "leptos_dom", @@ -3943,8 +4261,8 @@ dependencies = [ "tachys", "thiserror 2.0.18", "throw_error", - "typed-builder 0.23.2", - "typed-builder-macro 0.23.2", + "typed-builder", + "typed-builder-macro", "wasm-bindgen", "wasm-bindgen-futures", "wasm_split_helpers", @@ -3953,13 +4271,12 @@ dependencies = [ [[package]] name = "leptos_axum" -version = "0.8.7" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0caa95760f87f3067e05025140becefdbdfd36cbc2adac4519f06e1f1edf4af" +checksum = "196de3f5cde6a4c4cd254bb16dc6abd2efbf46cc3ae1b6c7da0731f77b4bdf61" dependencies = [ "any_spawner", "axum 0.8.8", - "dashmap", "futures", "hydration_context", "leptos", @@ -3967,7 +4284,7 @@ dependencies = [ "leptos_macro", "leptos_meta", "leptos_router", - "parking_lot", + "or_poisoned", "server_fn", "tachys", "tokio", @@ -3977,22 +4294,22 @@ dependencies = [ [[package]] name = "leptos_config" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071fc40aeb9fcab885965bad1887990477253ad51f926cd19068f45a44c59e89" +checksum = "19a2ac32008dda0d657f2147cc33336f4e743e091597db10f7a99d668e92a46d" dependencies = [ "config", "regex", "serde", "thiserror 2.0.18", - "typed-builder 0.21.2", + "typed-builder", ] [[package]] name = "leptos_dom" -version = "0.8.7" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78f4330c88694c5575e0bfe4eecf81b045d14e76a4f8b00d5fd2a63f8779f895" +checksum = "35742e9ed8f8aaf9e549b454c68a7ac0992536e06856365639b111f72ab07884" dependencies = [ "js-sys", "or_poisoned", @@ -4005,27 +4322,27 @@ dependencies = [ [[package]] name = "leptos_hot_reload" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d61ec3e1ff8aaee8c5151688550c0363f85bc37845450764c31ff7584a33f38" +checksum = "9d2a0f220c8a5ef3c51199dfb9cdd702bc0eb80d52fbe70c7890adfaaae8a4b1" dependencies = [ "anyhow", "camino", "indexmap 2.13.0", - "parking_lot", + "or_poisoned", "proc-macro2", "quote", "rstml", "serde", - "syn 2.0.115", + "syn 2.0.116", "walkdir", ] [[package]] name = "leptos_integration_utils" -version = "0.8.7" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13cccc9305df53757bae61bf15641bfa6a667b5f78456ace4879dfe0591ae0e8" +checksum = "c097f89cd9aa606297672f56fa5bdda09f01609a9f4eefaccdbb5ab5afea4279" dependencies = [ "futures", "hydration_context", @@ -4038,13 +4355,14 @@ dependencies = [ [[package]] name = "leptos_macro" -version = "0.8.14" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c86ffd2e9cf3e264e9b3e16bdb086cefa26bd0fa7bc6a26b0cc5f6c1fd3178ed" +checksum = "712325a77f1d050bf2897061ccaf2b075930aab36954980d658f04452686c474" dependencies = [ "attribute-derive", "cfg-if", - "convert_case 0.10.0", + "convert_case 0.11.0", + "convert_case_extras", "html-escape", "itertools 0.14.0", "leptos_hot_reload", @@ -4055,15 +4373,15 @@ dependencies = [ "rstml", "rustc_version", "server_fn_macro", - "syn 2.0.115", + "syn 2.0.116", "uuid", ] [[package]] name = "leptos_meta" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d489e38d3f541e9e43ecc2e3a815527840345a2afca629b3e23fcc1dd254578" +checksum = "6c3efe657b4c55ed2e078922786ffe20acfb71767c3dd913767b09a35c75c890" dependencies = [ "futures", "indexmap 2.13.0", @@ -4076,9 +4394,9 @@ dependencies = [ [[package]] name = "leptos_router" -version = "0.8.11" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01e573711f2fb9ab5d655ec38115220d359eaaf1dcb93cc0ea624543b6dba959" +checksum = "35058d4096407b8369843b5b5d227588dfd57ecc9e9bda0567523f084dce69e8" dependencies = [ "any_spawner", "either_of", @@ -4108,14 +4426,14 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] name = "leptos_server" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf1045af93050bf3388d1c138426393fc131f6d9e46a65519da884c033ed730" +checksum = "da974775c5ccbb6bd64be7f53f75e8321542e28f21563a416574dbe4d5447eae" dependencies = [ "any_spawner", "base64 0.22.1", @@ -4147,6 +4465,26 @@ dependencies = [ "windows-link", ] +[[package]] +name = "liblzma" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73c36d08cad03a3fbe2c4e7bb3a9e84c57e4ee4135ed0b065cade3d98480c648" +dependencies = [ + "liblzma-sys", +] + +[[package]] +name = "liblzma-sys" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f2db66f3268487b5033077f266da6777d057949b8f93c8ad82e441df25e6186" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + [[package]] name = "libm" version = "0.2.16" @@ -4173,7 +4511,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", "libc", "redox_syscall 0.7.1", ] @@ -4210,16 +4548,10 @@ checksum = "47a1ccadd0bb5a32c196da536fd72c59183de24a055f6bf0513bf845fefab862" dependencies = [ "ark-bn254 0.5.0", "ark-ff 0.5.0", - "num-bigint", + "num-bigint 0.4.6", "thiserror 1.0.69", ] -[[package]] -name = "linear-map" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfae20f6b19ad527b550c223fddc3077a547fc70cda94b9b566575423fd303ee" - [[package]] name = "linux-raw-sys" version = "0.11.0" @@ -4267,7 +4599,7 @@ checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "logos-blockchain-blend-crypto" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "blake2", "logos-blockchain-groth16", @@ -4281,7 +4613,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-message" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "blake2", "derivative", @@ -4303,14 +4635,14 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-proofs" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "ed25519-dalek", "generic-array 1.3.5", "logos-blockchain-blend-crypto", "logos-blockchain-groth16", "logos-blockchain-poq", - "num-bigint", + "num-bigint 0.4.6", "serde", "thiserror 1.0.69", ] @@ -4318,7 +4650,7 @@ dependencies = [ [[package]] name = "logos-blockchain-chain-broadcast-service" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "async-trait", "derivative", @@ -4334,7 +4666,7 @@ dependencies = [ [[package]] name = "logos-blockchain-chain-service" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "async-trait", "bytes", @@ -4350,7 +4682,7 @@ dependencies = [ "logos-blockchain-storage-service", "logos-blockchain-time-service", "logos-blockchain-utils", - "num-bigint", + "num-bigint 0.4.6", "overwatch", "serde", "serde_with", @@ -4364,7 +4696,7 @@ dependencies = [ [[package]] name = "logos-blockchain-circuits-prover" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "logos-blockchain-circuits-utils", "tempfile", @@ -4373,7 +4705,7 @@ dependencies = [ [[package]] name = "logos-blockchain-circuits-utils" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "dirs", ] @@ -4381,7 +4713,7 @@ dependencies = [ [[package]] name = "logos-blockchain-common-http-client" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "futures", "hex", @@ -4401,7 +4733,7 @@ dependencies = [ [[package]] name = "logos-blockchain-core" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "ark-ff 0.4.2", "bincode", @@ -4421,7 +4753,7 @@ dependencies = [ "logos-blockchain-utxotree", "multiaddr", "nom 8.0.0", - "num-bigint", + "num-bigint 0.4.6", "serde", "strum", "thiserror 1.0.69", @@ -4431,7 +4763,7 @@ dependencies = [ [[package]] name = "logos-blockchain-cryptarchia-engine" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "cfg_eval", "logos-blockchain-utils", @@ -4446,7 +4778,7 @@ dependencies = [ [[package]] name = "logos-blockchain-cryptarchia-sync" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "bytes", "futures", @@ -4463,7 +4795,7 @@ dependencies = [ [[package]] name = "logos-blockchain-groth16" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "ark-bn254 0.4.0", "ark-ec 0.4.2", @@ -4472,7 +4804,7 @@ dependencies = [ "ark-serialize 0.4.2", "generic-array 1.3.5", "hex", - "num-bigint", + "num-bigint 0.4.6", "serde", "serde_json", "thiserror 2.0.18", @@ -4481,7 +4813,7 @@ dependencies = [ [[package]] name = "logos-blockchain-http-api-common" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "axum 0.7.9", "logos-blockchain-core", @@ -4495,7 +4827,7 @@ dependencies = [ [[package]] name = "logos-blockchain-key-management-system-keys" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "async-trait", "bytes", @@ -4506,7 +4838,7 @@ dependencies = [ "logos-blockchain-poseidon2", "logos-blockchain-utils", "logos-blockchain-zksign", - "num-bigint", + "num-bigint 0.4.6", "rand_core 0.6.4", "serde", "subtle", @@ -4520,17 +4852,17 @@ dependencies = [ [[package]] name = "logos-blockchain-key-management-system-macros" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] name = "logos-blockchain-key-management-system-operators" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "async-trait", "logos-blockchain-blend-proofs", @@ -4546,7 +4878,7 @@ dependencies = [ [[package]] name = "logos-blockchain-key-management-system-service" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "async-trait", "log", @@ -4562,7 +4894,7 @@ dependencies = [ [[package]] name = "logos-blockchain-ledger" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "derivative", "logos-blockchain-blend-crypto", @@ -4575,7 +4907,7 @@ dependencies = [ "logos-blockchain-pol", "logos-blockchain-utils", "logos-blockchain-utxotree", - "num-bigint", + "num-bigint 0.4.6", "rand 0.8.5", "rpds", "serde", @@ -4586,7 +4918,7 @@ dependencies = [ [[package]] name = "logos-blockchain-network-service" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "async-trait", "futures", @@ -4602,13 +4934,13 @@ dependencies = [ [[package]] name = "logos-blockchain-poc" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "logos-blockchain-circuits-prover", "logos-blockchain-circuits-utils", "logos-blockchain-groth16", "logos-blockchain-witness-generator", - "num-bigint", + "num-bigint 0.4.6", "serde", "serde_json", "thiserror 2.0.18", @@ -4618,13 +4950,13 @@ dependencies = [ [[package]] name = "logos-blockchain-pol" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "logos-blockchain-circuits-prover", "logos-blockchain-circuits-utils", "logos-blockchain-groth16", "logos-blockchain-witness-generator", - "num-bigint", + "num-bigint 0.4.6", "num-traits", "serde", "serde_json", @@ -4635,14 +4967,14 @@ dependencies = [ [[package]] name = "logos-blockchain-poq" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "logos-blockchain-circuits-prover", "logos-blockchain-circuits-utils", "logos-blockchain-groth16", "logos-blockchain-pol", "logos-blockchain-witness-generator", - "num-bigint", + "num-bigint 0.4.6", "serde", "serde_json", "thiserror 2.0.18", @@ -4652,18 +4984,18 @@ dependencies = [ [[package]] name = "logos-blockchain-poseidon2" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "ark-bn254 0.4.0", "ark-ff 0.4.2", "jf-poseidon2", - "num-bigint", + "num-bigint 0.4.6", ] [[package]] name = "logos-blockchain-services-utils" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "async-trait", "futures", @@ -4678,7 +5010,7 @@ dependencies = [ [[package]] name = "logos-blockchain-storage-service" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "async-trait", "bytes", @@ -4695,7 +5027,7 @@ dependencies = [ [[package]] name = "logos-blockchain-time-service" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "async-trait", "futures", @@ -4713,7 +5045,7 @@ dependencies = [ [[package]] name = "logos-blockchain-utils" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "async-trait", "blake2", @@ -4730,12 +5062,12 @@ dependencies = [ [[package]] name = "logos-blockchain-utxotree" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "ark-ff 0.4.2", "logos-blockchain-groth16", "logos-blockchain-poseidon2", - "num-bigint", + "num-bigint 0.4.6", "rpds", "serde", "thiserror 1.0.69", @@ -4744,7 +5076,7 @@ dependencies = [ [[package]] name = "logos-blockchain-witness-generator" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "tempfile", ] @@ -4752,14 +5084,14 @@ dependencies = [ [[package]] name = "logos-blockchain-zksign" version = "0.1.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git#c0334554f70f626155953a8e83fa7104fa825fcd" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git#fe11562ea895b2d39af9d9c97c561cd14cbcedbe" dependencies = [ "logos-blockchain-circuits-prover", "logos-blockchain-circuits-utils", "logos-blockchain-groth16", "logos-blockchain-poseidon2", "logos-blockchain-witness-generator", - "num-bigint", + "num-bigint 0.4.6", "serde", "serde_json", "thiserror 2.0.18", @@ -4772,6 +5104,64 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" +[[package]] +name = "malachite" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fbdf9cb251732db30a7200ebb6ae5d22fe8e11397364416617d2c2cf0c51cb5" +dependencies = [ + "malachite-base", + "malachite-float", + "malachite-nz", + "malachite-q", +] + +[[package]] +name = "malachite-base" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ea0ed76adf7defc1a92240b5c36d5368cfe9251640dcce5bd2d0b7c1fd87aeb" +dependencies = [ + "hashbrown 0.14.5", + "itertools 0.11.0", + "libm", + "ryu", +] + +[[package]] +name = "malachite-float" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af9d20db1c73759c1377db7b27575df6f2eab7368809dd62c0a715dc1bcc39f7" +dependencies = [ + "itertools 0.11.0", + "malachite-base", + "malachite-nz", + "malachite-q", +] + +[[package]] +name = "malachite-nz" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34a79feebb2bc9aa7762047c8e5495269a367da6b5a90a99882a0aeeac1841f7" +dependencies = [ + "itertools 0.11.0", + "libm", + "malachite-base", +] + +[[package]] +name = "malachite-q" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f235d5747b1256b47620f5640c2a17a88c7569eebdf27cd9cb130e1a619191" +dependencies = [ + "itertools 0.11.0", + "malachite-base", + "malachite-nz", +] + [[package]] name = "malloc_buf" version = "0.0.6" @@ -4781,6 +5171,12 @@ dependencies = [ "libc", ] +[[package]] +name = "managed" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ca88d725a0a943b096803bd34e73a4437208b6077654cc4ecb2947a5f91618d" + [[package]] name = "manyhow" version = "0.11.4" @@ -4790,7 +5186,7 @@ dependencies = [ "manyhow-macros", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -4812,7 +5208,7 @@ checksum = "757aee279b8bdbb9f9e676796fd459e4207a1f986e87886700abf589f5abf771" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -4827,6 +5223,16 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" +[[package]] +name = "matrixmultiply" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06de3016e9fae57a36fd14dba131fccf49f74b40b7fbdb472f96e361ec71a08" +dependencies = [ + "autocfg", + "rawpointer", +] + [[package]] name = "maybe-async" version = "0.2.10" @@ -4835,7 +5241,7 @@ checksum = "5cf92c10c7e361d6b99666ec1c6f9805b0bea2c3bd8c78dc6fe98ac5bd78db11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -4844,6 +5250,15 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" +[[package]] +name = "memmap2" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "714098028fe011992e1c3962653c96b2d578c4b4bce9036e15ff220319b1e0e3" +dependencies = [ + "libc", +] + [[package]] name = "mempool" version = "0.1.0" @@ -4869,7 +5284,7 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ecfd3296f8c56b7c1f6fbac3c71cefa9d78ce009850c45000015f206dc7fa21" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", "block", "core-graphics-types", "foreign-types 0.5.0", @@ -4900,6 +5315,16 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + [[package]] name = "mio" version = "1.1.1" @@ -4971,21 +5396,37 @@ dependencies = [ [[package]] name = "native-tls" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cdede44f9a69cab2899a2049e2c3bd49bf911a157f6a3353d4a91c61abbce44" +checksum = "9d5d26952a508f321b4d3d2e80e78fc2603eaefcdf0c30783867f19586518bdc" dependencies = [ "libc", "log", "openssl", - "openssl-probe 0.1.6", + "openssl-probe", "openssl-sys", "schannel", - "security-framework 2.11.1", + "security-framework", "security-framework-sys", "tempfile", ] +[[package]] +name = "ndarray" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "882ed72dce9365842bf196bdeedf5055305f11fc8c03dee7bb0194a6cad34841" +dependencies = [ + "matrixmultiply", + "num-complex", + "num-integer", + "num-traits", + "portable-atomic", + "portable-atomic-util", + "rawpointer", + "rayon", +] + [[package]] name = "next_tuple" version = "0.1.0" @@ -5081,7 +5522,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ - "num-bigint", + "num-bigint 0.4.6", "num-complex", "num-integer", "num-iter", @@ -5089,6 +5530,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-bigint" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-bigint" version = "0.4.6" @@ -5130,6 +5582,17 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.116", +] + [[package]] name = "num-integer" version = "0.1.46" @@ -5156,7 +5619,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "num-bigint", + "num-bigint 0.4.6", "num-integer", "num-traits", ] @@ -5171,16 +5634,6 @@ dependencies = [ "libm", ] -[[package]] -name = "num_cpus" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b" -dependencies = [ - "hermit-abi", - "libc", -] - [[package]] name = "num_enum" version = "0.7.5" @@ -5199,7 +5652,16 @@ checksum = "ff32365de1b6743cb203b710788263c44a03de03802daf96092f2da4fe6ba4d7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", +] + +[[package]] +name = "nvtx" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad2e855e8019f99e4b94ac33670eb4e4f570a2e044f3749a0b2c7f83b841e52c" +dependencies = [ + "cc", ] [[package]] @@ -5211,6 +5673,26 @@ dependencies = [ "malloc_buf", ] +[[package]] +name = "object" +version = "0.36.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +dependencies = [ + "flate2", + "memchr", + "ruzstd", +] + +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + [[package]] name = "oco_ref" version = "0.2.1" @@ -5245,7 +5727,7 @@ version = "0.10.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08838db121398ad17ab8531ce9de97b244589089e290a384c900cb9ff7434328" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", "cfg-if", "foreign-types 0.3.2", "libc", @@ -5262,15 +5744,9 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] -[[package]] -name = "openssl-probe" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" - [[package]] name = "openssl-probe" version = "0.2.1" @@ -5297,7 +5773,7 @@ checksum = "969ccca8ffc4fb105bd131a228107d5c9dd89d9d627edf3295cbe979156f9712" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -5336,7 +5812,7 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -5390,7 +5866,7 @@ dependencies = [ "regex", "regex-syntax", "structmeta", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -5437,7 +5913,7 @@ checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -5497,6 +5973,15 @@ version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" +[[package]] +name = "portable-atomic-util" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a9db96d7fa8782dd8c15ce32ffe8680bbd1e978a43bf51a34d39483540495f5" +dependencies = [ + "portable-atomic", +] + [[package]] name = "postcard" version = "1.1.3" @@ -5506,6 +5991,7 @@ dependencies = [ "cobs", "embedded-io 0.4.0", "embedded-io 0.6.1", + "heapless", "serde", ] @@ -5540,7 +6026,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -5571,7 +6057,7 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -5602,7 +6088,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", "version_check", "yansi", ] @@ -5644,7 +6130,7 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37566cb3fdacef14c0737f9546df7cfeadbfbc9fef10991038bf5015d0c80532" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", "num-traits", "rand 0.9.2", "rand_chacha 0.9.0", @@ -5682,7 +6168,7 @@ dependencies = [ "itertools 0.14.0", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -5695,7 +6181,7 @@ dependencies = [ "itertools 0.14.0", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -5707,6 +6193,20 @@ dependencies = [ "prost 0.14.3", ] +[[package]] +name = "puffin" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa9dae7b05c02ec1a6bc9bcf20d8bc64a7dcbf57934107902a872014899b741f" +dependencies = [ + "anyhow", + "byteorder", + "cfg-if", + "itertools 0.10.5", + "once_cell", + "parking_lot", +] + [[package]] name = "quinn" version = "0.11.9" @@ -5790,7 +6290,7 @@ dependencies = [ "proc-macro-utils", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -5799,6 +6299,12 @@ version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + [[package]] name = "rand" version = "0.8.5" @@ -5868,10 +6374,36 @@ dependencies = [ ] [[package]] -name = "reactive_graph" -version = "0.2.12" +name = "rawpointer" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f0df355582937223ea403e52490201d65295bd6981383c69bfae5a1f8730c2" +checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "reactive_graph" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35774620b3da884a07341e9e36612e1509b1eb0553ef3bb76f1547dd1b797417" dependencies = [ "any_spawner", "async-lock", @@ -5893,11 +6425,10 @@ dependencies = [ [[package]] name = "reactive_stores" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35372f05664a62a3dd389503371a15b8feb3396f99f6ec000de651fddb030942" +checksum = "1bf38a5454bf67993426cf59469b6637ea9e1eefc8cab618df9a56fb2b684cc7" dependencies = [ - "dashmap", "guardian", "itertools 0.14.0", "or_poisoned", @@ -5918,7 +6449,7 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -5927,7 +6458,7 @@ version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", ] [[package]] @@ -5936,7 +6467,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35985aa610addc02e24fc232012c86fd11f14111180f902b67e2d5331f8ebf2b" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", ] [[package]] @@ -5967,7 +6498,7 @@ checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -6048,7 +6579,7 @@ dependencies = [ "url", "wasm-bindgen", "wasm-bindgen-futures", - "wasm-streams", + "wasm-streams 0.4.2", "web-sys", "webpki-roots", ] @@ -6077,6 +6608,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "ringbuffer" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3df6368f71f205ff9c33c076d170dd56ebf68e8161c733c0caa07a7a5509ed53" + [[package]] name = "risc0-binfmt" version = "3.0.4" @@ -6123,6 +6660,20 @@ dependencies = [ "tempfile", ] +[[package]] +name = "risc0-build-kernel" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaaa3e04c71e4244354dd9e3f8b89378cfecfbb03f9c72de4e2e7e0482b30c9a" +dependencies = [ + "cc", + "directories", + "hex", + "rayon", + "sha2", + "tempfile", +] + [[package]] name = "risc0-circuit-keccak" version = "4.0.5" @@ -6131,14 +6682,34 @@ checksum = "5f543c60287fece797a5da4209384ab1bfebd9644fcfe591e11b1aa85f1a02f8" dependencies = [ "anyhow", "bytemuck", + "cfg-if", + "keccak", + "liblzma", "paste", + "rayon", "risc0-binfmt", + "risc0-circuit-keccak-sys", "risc0-circuit-recursion", "risc0-core", + "risc0-sys", "risc0-zkp", "tracing", ] +[[package]] +name = "risc0-circuit-keccak-sys" +version = "4.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8eae53a7bf1c09828dfd46ed5c942cefbf4bef3c4400f6758001569a834c462" +dependencies = [ + "cc", + "derive_more 2.1.1", + "glob", + "risc0-build-kernel", + "risc0-core", + "risc0-sys", +] + [[package]] name = "risc0-circuit-recursion" version = "4.0.4" @@ -6147,11 +6718,33 @@ checksum = "2347e909c6b2a65584b5898f3802eec5b8c1b4b45329edfdd8587b6a04dd3357" dependencies = [ "anyhow", "bytemuck", + "cfg-if", + "downloader", "hex", + "lazy-regex", "metal", + "rand 0.9.2", + "rayon", + "risc0-circuit-recursion-sys", "risc0-core", + "risc0-sys", "risc0-zkp", + "serde", + "sha2", "tracing", + "zip", +] + +[[package]] +name = "risc0-circuit-recursion-sys" +version = "4.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "132be7ccca4b39ec957cc37d5083ca2aee171407922352002c9812452a890b39" +dependencies = [ + "glob", + "risc0-build-kernel", + "risc0-core", + "risc0-sys", ] [[package]] @@ -6163,13 +6756,43 @@ dependencies = [ "anyhow", "bit-vec", "bytemuck", + "byteorder", + "cfg-if", "derive_more 2.1.1", + "enum-map", + "gdbstub", + "gdbstub_arch", + "malachite", + "num-derive", + "num-traits", "paste", + "postcard", + "rand 0.9.2", + "rayon", + "ringbuffer", "risc0-binfmt", + "risc0-circuit-rv32im-sys", "risc0-core", + "risc0-sys", "risc0-zkp", "serde", + "smallvec", "tracing", + "wide", +] + +[[package]] +name = "risc0-circuit-rv32im-sys" +version = "4.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69d677ec41e475534e18e58889ef0626dcdabf5e918804ef847da0c0bbf300b3" +dependencies = [ + "cc", + "derive_more 2.1.1", + "glob", + "risc0-build-kernel", + "risc0-core", + "risc0-sys", ] [[package]] @@ -6179,6 +6802,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5b956a976b8ce4713694dcc6c370b522a42ccef4ba45da5b6e57dbf26cdb7b1" dependencies = [ "bytemuck", + "nvtx", + "puffin", "rand_core 0.9.5", ] @@ -6195,12 +6820,28 @@ dependencies = [ "ark-groth16 0.5.0", "ark-serialize 0.5.0", "bytemuck", + "cfg-if", "hex", - "num-bigint", + "num-bigint 0.4.6", "num-traits", "risc0-binfmt", + "risc0-core", "risc0-zkp", + "rzup", "serde", + "serde_json", + "tempfile", + "tracing", +] + +[[package]] +name = "risc0-sys" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960c8295fbb87e1e73e332f8f7de2fba0252377575042d9d3e9a4eb50a38e078" +dependencies = [ + "anyhow", + "risc0-build-kernel", ] [[package]] @@ -6226,12 +6867,18 @@ dependencies = [ "bytemuck", "cfg-if", "digest", + "ff", "hex", "hex-literal 0.4.1", "metal", + "ndarray", + "parking_lot", "paste", + "rand 0.9.2", "rand_core 0.9.5", + "rayon", "risc0-core", + "risc0-sys", "risc0-zkvm-platform", "serde", "sha2", @@ -6245,6 +6892,7 @@ version = "3.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22b7eafb5d85be59cbd9da83f662cf47d834f1b836e14f675d1530b12c666867" dependencies = [ + "addr2line 0.24.2", "anyhow", "bincode", "bonsai-sdk", @@ -6252,9 +6900,20 @@ dependencies = [ "bytemuck", "bytes", "derive_more 2.1.1", + "elf", + "enum-map", + "gdbstub", + "gdbstub_arch", + "gimli 0.31.1", "hex", + "keccak", "lazy-regex", + "num-bigint 0.4.6", + "num-traits", + "object 0.36.7", "prost 0.13.5", + "rand 0.9.2", + "rayon", "risc0-binfmt", "risc0-build", "risc0-circuit-keccak", @@ -6266,6 +6925,7 @@ dependencies = [ "risc0-zkp", "risc0-zkvm-platform", "rrs-lib", + "rustc-demangle", "rzup", "semver", "serde", @@ -6273,6 +6933,7 @@ dependencies = [ "stability", "tempfile", "tracing", + "typetag", ] [[package]] @@ -6376,7 +7037,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.115", + "syn 2.0.116", "syn_derive", "thiserror 2.0.18", ] @@ -6403,6 +7064,12 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" +[[package]] +name = "rustc-demangle" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" + [[package]] name = "rustc-hash" version = "2.1.1" @@ -6424,7 +7091,7 @@ version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", "errno", "libc", "linux-raw-sys", @@ -6452,10 +7119,10 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "612460d5f7bea540c490b2b6395d8e34a953e52b491accd6c86c8164c5932a63" dependencies = [ - "openssl-probe 0.2.1", + "openssl-probe", "rustls-pki-types", "schannel", - "security-framework 3.5.1", + "security-framework", ] [[package]] @@ -6483,7 +7150,7 @@ dependencies = [ "rustls-native-certs", "rustls-platform-verifier-android", "rustls-webpki", - "security-framework 3.5.1", + "security-framework", "security-framework-sys", "webpki-root-certs 0.26.11", "windows-sys 0.59.0", @@ -6512,6 +7179,15 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" +[[package]] +name = "ruzstd" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fad02996bfc73da3e301efe90b1837be9ed8f4a462b6ed410aa35d00381de89f" +dependencies = [ + "twox-hash", +] + [[package]] name = "ryu" version = "1.0.23" @@ -6537,6 +7213,15 @@ dependencies = [ "yaml-rust2", ] +[[package]] +name = "safe_arch" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96b02de82ddbe1b636e6170c21be622223aea188ef2e139be0a5b219ec215323" +dependencies = [ + "bytemuck", +] + [[package]] name = "same-file" version = "1.0.6" @@ -6589,7 +7274,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -6635,24 +7320,11 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.11.1" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +checksum = "d17b898a6d6948c3a8ee4372c17cb384f90d2e6e912ef00895b14fd7ab54ec38" dependencies = [ - "bitflags 2.10.0", - "core-foundation 0.9.4", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework" -version = "3.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3297343eaf830f66ede390ea39da1d462b6b0c1b000f420d0a83f898bbbe6ef" -dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", "core-foundation 0.10.1", "core-foundation-sys", "libc", @@ -6661,9 +7333,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.15.0" +version = "2.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0" +checksum = "321c8673b092a9a42605034a9879d73cb79101ed5fd117bc9a597b89b4e9e61a" dependencies = [ "core-foundation-sys", "libc", @@ -6800,7 +7472,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -6811,7 +7483,7 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -6857,7 +7529,7 @@ checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -6918,7 +7590,7 @@ dependencies = [ "darling 0.21.3", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -6946,16 +7618,15 @@ dependencies = [ [[package]] name = "server_fn" -version = "0.8.9" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "353d02fa2886cd8dae0b8da0965289fa8f2ecc7df633d1ce965f62fdf9644d29" +checksum = "0fafe3a832a747ded8dc4827c538a2a064284f150c1c44c51ec56b58bd947dd7" dependencies = [ "axum 0.8.8", "base64 0.22.1", "bytes", - "const-str 0.7.1", + "const-str 1.1.0", "const_format", - "dashmap", "futures", "gloo-net", "http 1.4.0", @@ -6963,6 +7634,7 @@ dependencies = [ "hyper", "inventory", "js-sys", + "or_poisoned", "pin-project-lite", "rustc_version", "rustversion", @@ -6979,23 +7651,23 @@ dependencies = [ "url", "wasm-bindgen", "wasm-bindgen-futures", - "wasm-streams", + "wasm-streams 0.5.0", "web-sys", "xxhash-rust", ] [[package]] name = "server_fn_macro" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "950b8cfc9ff5f39ca879c5a7c5e640de2695a199e18e424c3289d0964cabe642" +checksum = "14faf423aab09f8c3eb2d9785bb37f11a255cdf01857d3c6083eacc82269c191" dependencies = [ "const_format", - "convert_case 0.8.0", + "convert_case 0.11.0", "proc-macro2", "quote", "rustc_version", - "syn 2.0.115", + "syn 2.0.116", "xxhash-rust", ] @@ -7006,7 +7678,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63eb08f80db903d3c42f64e60ebb3875e0305be502bdc064ec0a0eab42207f00" dependencies = [ "server_fn_macro", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -7057,6 +7729,12 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "simd-adler32" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" + [[package]] name = "slab" version = "0.4.12" @@ -7139,6 +7817,9 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] [[package]] name = "spki" @@ -7157,7 +7838,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d904e7009df136af5297832a3ace3370cd14ff1546a232f4f185036c2736fcac" dependencies = [ "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -7199,7 +7880,7 @@ dependencies = [ "proc-macro2", "quote", "structmeta-derive", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -7210,7 +7891,7 @@ checksum = "152a0b65a590ff6c3da95cabe2353ee04e6167c896b28e3b14478c2636c922fc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -7231,7 +7912,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -7253,9 +7934,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.115" +version = "2.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e614ed320ac28113fa64972c4262d5dbc89deacdfd00c34a3e4cea073243c12" +checksum = "3df424c70518695237746f84cede799c9c58fcb37450d7b23716568cc8bc69cb" dependencies = [ "proc-macro2", "quote", @@ -7271,7 +7952,7 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -7291,7 +7972,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -7300,7 +7981,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", "core-foundation 0.9.4", "system-configuration-sys", ] @@ -7317,9 +7998,9 @@ dependencies = [ [[package]] name = "tachys" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2b2db11e455f7e84e2cc3e76f8a3f3843f7956096265d5ecff781eabe235077" +checksum = "f359078998dd35834c814d8667763d3bbb6fff1bdbba07fed483e25bbf083c61" dependencies = [ "any_spawner", "async-trait", @@ -7332,11 +8013,9 @@ dependencies = [ "indexmap 2.13.0", "itertools 0.14.0", "js-sys", - "linear-map", "next_tuple", "oco_ref", "or_poisoned", - "parking_lot", "paste", "reactive_graph", "reactive_stores", @@ -7349,6 +8028,12 @@ dependencies = [ "web-sys", ] +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "tempfile" version = "3.25.0" @@ -7389,7 +8074,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -7400,7 +8085,7 @@ checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", "test-case-core", ] @@ -7478,7 +8163,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -7489,7 +8174,7 @@ checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -7608,7 +8293,7 @@ checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -7753,9 +8438,9 @@ dependencies = [ [[package]] name = "toml_parser" -version = "1.0.8+spec-1.1.0" +version = "1.0.9+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0742ff5ff03ea7e67c8ae6c93cac239e0d9784833362da3f9a9c1da8dfefcbdc" +checksum = "702d4415e08923e7e1ef96cd5727c0dfed80b4d2fa25db9647fe5eb6f7c5a4c4" dependencies = [ "winnow", ] @@ -7774,9 +8459,9 @@ checksum = "ab16f14aed21ee8bfd8ec22513f7287cd4a91aa92e44edfe2c17ddd004e92607" [[package]] name = "tonic" -version = "0.14.3" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a286e33f82f8a1ee2df63f4fa35c0becf4a85a0cb03091a15fd7bf0b402dc94a" +checksum = "7f32a6f80051a4111560201420c7885d0082ba9efe2ab61875c587bb6b18b9a0" dependencies = [ "async-trait", "axum 0.8.8", @@ -7803,9 +8488,9 @@ dependencies = [ [[package]] name = "tonic-prost" -version = "0.14.3" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c55a2d6a14174563de34409c9f92ff981d006f56da9c6ecd40d9d4a31500b0" +checksum = "9f86539c0089bfd09b1f8c0ab0239d80392af74c21bc9e0f15e1b4aca4c1647f" dependencies = [ "bytes", "prost 0.14.3", @@ -7837,7 +8522,7 @@ version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", "bytes", "futures-core", "futures-util", @@ -7891,7 +8576,7 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -7953,32 +8638,28 @@ dependencies = [ ] [[package]] -name = "typed-builder" -version = "0.21.2" +name = "twox-hash" +version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fef81aec2ca29576f9f6ae8755108640d0a86dd3161b2e8bca6cfa554e98f77d" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ - "typed-builder-macro 0.21.2", + "cfg-if", + "static_assertions", ] +[[package]] +name = "typed-arena" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" + [[package]] name = "typed-builder" version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31aa81521b70f94402501d848ccc0ecaa8f93c8eb6999eb9747e72287757ffda" dependencies = [ - "typed-builder-macro 0.23.2", -] - -[[package]] -name = "typed-builder-macro" -version = "0.21.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ecb9ecf7799210407c14a8cfdfe0173365780968dc57973ed082211958e0b18" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.115", + "typed-builder-macro", ] [[package]] @@ -7989,15 +8670,45 @@ checksum = "076a02dc54dd46795c2e9c8282ed40bcfb1e22747e955de9389a1de28190fb26" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] +[[package]] +name = "typeid" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" + [[package]] name = "typenum" version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" +[[package]] +name = "typetag" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be2212c8a9b9bcfca32024de14998494cf9a5dfa59ea1b829de98bac374b86bf" +dependencies = [ + "erased-serde", + "inventory", + "once_cell", + "serde", + "typetag-impl", +] + +[[package]] +name = "typetag-impl" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27a7a9b72ba121f6f1f6c3632b85604cac41aedb5ddc70accbebb6cac83de846" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.116", +] + [[package]] name = "unarray" version = "0.1.4" @@ -8012,9 +8723,9 @@ checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142" [[package]] name = "unicode-ident" -version = "1.0.23" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "537dd038a89878be9b64dd4bd1b260315c1bb94f4d784956b81e27a088d9a09e" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" [[package]] name = "unicode-normalization" @@ -8149,11 +8860,11 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.20.0" +version = "1.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee48d38b119b0cd71fe4141b30f5ba9c7c5d9f4e7a3a8b4a674e4b6ef789976f" +checksum = "b672338555252d43fd2240c714dc444b8c6fb0a5c5335e65a07bba7742735ddb" dependencies = [ - "getrandom 0.3.4", + "getrandom 0.4.1", "js-sys", "wasm-bindgen", ] @@ -8309,7 +9020,7 @@ dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", "wasm-bindgen-shared", ] @@ -8357,6 +9068,19 @@ dependencies = [ "web-sys", ] +[[package]] +name = "wasm-streams" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1ec4f6517c9e11ae630e200b2b65d193279042e28edd4a2cda233e46670bbb" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "wasm_split_helpers" version = "0.2.0" @@ -8376,7 +9100,7 @@ dependencies = [ "base16", "quote", "sha2", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -8385,7 +9109,7 @@ version = "0.244.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", "hashbrown 0.15.5", "indexmap 2.13.0", "semver", @@ -8438,6 +9162,16 @@ dependencies = [ "rustls-pki-types", ] +[[package]] +name = "wide" +version = "0.7.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce5da8ecb62bcd8ec8b7ea19f69a51275e91299be594ea5cc6ef7819e16cd03" +dependencies = [ + "bytemuck", + "safe_arch", +] + [[package]] name = "winapi" version = "0.3.9" @@ -8490,7 +9224,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -8501,7 +9235,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -8809,7 +9543,7 @@ dependencies = [ "heck", "indexmap 2.13.0", "prettyplease", - "syn 2.0.115", + "syn 2.0.116", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -8825,7 +9559,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -8837,7 +9571,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" dependencies = [ "anyhow", - "bitflags 2.10.0", + "bitflags 2.11.0", "indexmap 2.13.0", "log", "serde", @@ -8873,6 +9607,15 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + [[package]] name = "x25519-dalek" version = "2.0.1" @@ -8937,7 +9680,7 @@ checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", "synstructure", ] @@ -8958,7 +9701,7 @@ checksum = "4122cd3169e94605190e77839c9a40d40ed048d305bfdc146e7df40ab0f3e517" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -8978,7 +9721,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", "synstructure", ] @@ -8999,7 +9742,7 @@ checksum = "85a5b4158499876c763cb03bc4e49185d3cccbabb15b33c627f7884f43db852e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", ] [[package]] @@ -9032,7 +9775,24 @@ checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.115", + "syn 2.0.116", +] + +[[package]] +name = "zip" +version = "2.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fabe6324e908f85a1c52063ce7aa26b68dcb7eb6dbc83a2d148403c9bc3eba50" +dependencies = [ + "arbitrary", + "crc32fast", + "crossbeam-utils", + "displaydoc", + "flate2", + "indexmap 2.13.0", + "memchr", + "thiserror 2.0.18", + "zopfli", ] [[package]] @@ -9040,3 +9800,15 @@ name = "zmij" version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" + +[[package]] +name = "zopfli" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f05cd8797d63865425ff89b5c4a48804f35ba0ce8d125800027ad6017d2b5249" +dependencies = [ + "bumpalo", + "crc32fast", + "log", + "simd-adler32", +] diff --git a/Cargo.toml b/Cargo.toml index 696a0bac..5f2a7033 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -67,8 +67,8 @@ tokio = { version = "1.28.2", features = [ "fs", ] } tokio-util = "0.7.18" -risc0-zkvm = { version = "3.0.3", features = ['std'] } -risc0-build = "3.0.3" +risc0-zkvm = { version = "3.0.5", features = ['std'] } +risc0-build = "3.0.5" anyhow = "1.0.98" num_cpus = "1.13.1" openssl = { version = "0.10", features = ["vendored"] } diff --git a/LEZ testnet v0.1 tutorials/custom-tokens.md b/LEZ testnet v0.1 tutorials/custom-tokens.md index ea647696..f99f29e5 100644 --- a/LEZ testnet v0.1 tutorials/custom-tokens.md +++ b/LEZ testnet v0.1 tutorials/custom-tokens.md @@ -92,7 +92,7 @@ wallet account new private # Output: Generated new account with account_id Private/HMRHZdPw4pbyPVZHNGrV6K5AA95wACFsHTRST84fr3CF With npk 6a2dfe433cf28e525aa0196d719be3c16146f7ee358ca39595323f94fde38f93 -With ipk 03d59abf4bee974cc12ddb44641c19f0b5441fef39191f047c988c29a77252a577 +With vpk 03d59abf4bee974cc12ddb44641c19f0b5441fef39191f047c988c29a77252a577 ``` 2. Create the token (Token B): diff --git a/LEZ testnet v0.1 tutorials/token-transfer.md b/LEZ testnet v0.1 tutorials/token-transfer.md index 8019ae56..156f0b1f 100644 --- a/LEZ testnet v0.1 tutorials/token-transfer.md +++ b/LEZ testnet v0.1 tutorials/token-transfer.md @@ -154,11 +154,11 @@ wallet account new private # Output: Generated new account with account_id Private/HacPU3hakLYzWtSqUPw6TUr8fqoMieVWovsUR6sJf7cL With npk e6366f79d026c8bd64ae6b3d601f0506832ec682ab54897f205fffe64ec0d951 -With ipk 02ddc96d0eb56e00ce14994cfdaec5ae1f76244180a919545983156e3519940a17 +With vpk 02ddc96d0eb56e00ce14994cfdaec5ae1f76244180a919545983156e3519940a17 ``` > [!Tip] -> Focus on the account ID for now. The `npk` and `ipk` values are stored locally and used to build privacy-preserving transactions. The private account ID is derived from `npk`. +> Focus on the account ID for now. The `npk` and `vpk` values are stored locally and used to build privacy-preserving transactions. The private account ID is derived from `npk`. Just like public accounts, new private accounts start out uninitialized: @@ -228,17 +228,17 @@ wallet account new private # Output: Generated new account with account_id Private/AukXPRBmrYVqoqEW2HTs7N3hvTn3qdNFDcxDHVr5hMm5 With npk 0c95ebc4b3830f53da77bb0b80a276a776cdcf6410932acc718dcdb3f788a00e -With ipk 039fd12a3674a880d3e917804129141e4170d419d1f9e28a3dcf979c1f2369cb72 +With vpk 039fd12a3674a880d3e917804129141e4170d419d1f9e28a3dcf979c1f2369cb72 ``` > [!Tip] -> Ignore the private account ID here and use the `npk` and `ipk` values to send to a foreign private account. +> Ignore the private account ID here and use the `npk` and `vpk` values to send to a foreign private account. ```bash wallet auth-transfer send \ --from Public/Ev1JprP9BmhbFVQyBcbznU8bAXcwrzwRoPTetXdQPAWS \ --to-npk 0c95ebc4b3830f53da77bb0b80a276a776cdcf6410932acc718dcdb3f788a00e \ - --to-ipk 039fd12a3674a880d3e917804129141e4170d419d1f9e28a3dcf979c1f2369cb72 \ + --to-vpk 039fd12a3674a880d3e917804129141e4170d419d1f9e28a3dcf979c1f2369cb72 \ --amount 3 ``` diff --git a/artifacts/program_methods/amm.bin b/artifacts/program_methods/amm.bin index 70ac8af9..55dfea0d 100644 Binary files a/artifacts/program_methods/amm.bin and b/artifacts/program_methods/amm.bin differ diff --git a/artifacts/program_methods/authenticated_transfer.bin b/artifacts/program_methods/authenticated_transfer.bin index 89549491..a99aea50 100644 Binary files a/artifacts/program_methods/authenticated_transfer.bin and b/artifacts/program_methods/authenticated_transfer.bin differ diff --git a/artifacts/program_methods/pinata.bin b/artifacts/program_methods/pinata.bin index 5b8cbacc..b901243f 100644 Binary files a/artifacts/program_methods/pinata.bin and b/artifacts/program_methods/pinata.bin differ diff --git a/artifacts/program_methods/pinata_token.bin b/artifacts/program_methods/pinata_token.bin index d5d058e8..63b17a35 100644 Binary files a/artifacts/program_methods/pinata_token.bin and b/artifacts/program_methods/pinata_token.bin differ diff --git a/artifacts/program_methods/privacy_preserving_circuit.bin b/artifacts/program_methods/privacy_preserving_circuit.bin index c4cc7c87..4bbfac21 100644 Binary files a/artifacts/program_methods/privacy_preserving_circuit.bin and b/artifacts/program_methods/privacy_preserving_circuit.bin differ diff --git a/artifacts/program_methods/token.bin b/artifacts/program_methods/token.bin index 692c1836..90d52232 100644 Binary files a/artifacts/program_methods/token.bin and b/artifacts/program_methods/token.bin differ diff --git a/artifacts/test_program_methods/burner.bin b/artifacts/test_program_methods/burner.bin index c35e8932..c143aa3c 100644 Binary files a/artifacts/test_program_methods/burner.bin and b/artifacts/test_program_methods/burner.bin differ diff --git a/artifacts/test_program_methods/chain_caller.bin b/artifacts/test_program_methods/chain_caller.bin index cf929fe0..439cc765 100644 Binary files a/artifacts/test_program_methods/chain_caller.bin and b/artifacts/test_program_methods/chain_caller.bin differ diff --git a/artifacts/test_program_methods/changer_claimer.bin b/artifacts/test_program_methods/changer_claimer.bin index c4cd1614..53ee1041 100644 Binary files a/artifacts/test_program_methods/changer_claimer.bin and b/artifacts/test_program_methods/changer_claimer.bin differ diff --git a/artifacts/test_program_methods/claimer.bin b/artifacts/test_program_methods/claimer.bin index b29dc87f..83c18dca 100644 Binary files a/artifacts/test_program_methods/claimer.bin and b/artifacts/test_program_methods/claimer.bin differ diff --git a/artifacts/test_program_methods/data_changer.bin b/artifacts/test_program_methods/data_changer.bin index 3c377fa5..13936cbf 100644 Binary files a/artifacts/test_program_methods/data_changer.bin and b/artifacts/test_program_methods/data_changer.bin differ diff --git a/artifacts/test_program_methods/extra_output.bin b/artifacts/test_program_methods/extra_output.bin index eb810348..7479bad9 100644 Binary files a/artifacts/test_program_methods/extra_output.bin and b/artifacts/test_program_methods/extra_output.bin differ diff --git a/artifacts/test_program_methods/malicious_authorization_changer.bin b/artifacts/test_program_methods/malicious_authorization_changer.bin index 1312bd0e..8c51807c 100644 Binary files a/artifacts/test_program_methods/malicious_authorization_changer.bin and b/artifacts/test_program_methods/malicious_authorization_changer.bin differ diff --git a/artifacts/test_program_methods/minter.bin b/artifacts/test_program_methods/minter.bin index 11c9a16a..fcdf47de 100644 Binary files a/artifacts/test_program_methods/minter.bin and b/artifacts/test_program_methods/minter.bin differ diff --git a/artifacts/test_program_methods/missing_output.bin b/artifacts/test_program_methods/missing_output.bin index e220732b..3d1f52a8 100644 Binary files a/artifacts/test_program_methods/missing_output.bin and b/artifacts/test_program_methods/missing_output.bin differ diff --git a/artifacts/test_program_methods/modified_transfer.bin b/artifacts/test_program_methods/modified_transfer.bin index aa261086..8611238c 100644 Binary files a/artifacts/test_program_methods/modified_transfer.bin and b/artifacts/test_program_methods/modified_transfer.bin differ diff --git a/artifacts/test_program_methods/nonce_changer.bin b/artifacts/test_program_methods/nonce_changer.bin index 9fefe14b..f046b041 100644 Binary files a/artifacts/test_program_methods/nonce_changer.bin and b/artifacts/test_program_methods/nonce_changer.bin differ diff --git a/artifacts/test_program_methods/noop.bin b/artifacts/test_program_methods/noop.bin index 0d6323f0..6ef6047f 100644 Binary files a/artifacts/test_program_methods/noop.bin and b/artifacts/test_program_methods/noop.bin differ diff --git a/artifacts/test_program_methods/program_owner_changer.bin b/artifacts/test_program_methods/program_owner_changer.bin index 5c2857a7..5b45a151 100644 Binary files a/artifacts/test_program_methods/program_owner_changer.bin and b/artifacts/test_program_methods/program_owner_changer.bin differ diff --git a/artifacts/test_program_methods/simple_balance_transfer.bin b/artifacts/test_program_methods/simple_balance_transfer.bin index a4d7081a..bd43e33a 100644 Binary files a/artifacts/test_program_methods/simple_balance_transfer.bin and b/artifacts/test_program_methods/simple_balance_transfer.bin differ diff --git a/completions/zsh/_wallet b/completions/zsh/_wallet index c90dadc4..9f40c4fb 100644 --- a/completions/zsh/_wallet +++ b/completions/zsh/_wallet @@ -97,7 +97,7 @@ _wallet_auth_transfer() { '--from[Source account ID]:from_account:_wallet_account_ids' \ '--to[Destination account ID (for owned accounts)]:to_account:_wallet_account_ids' \ '--to-npk[Destination nullifier public key (for foreign private accounts)]:npk:' \ - '--to-ipk[Destination viewing public key (for foreign private accounts)]:ipk:' \ + '--to-vpk[Destination viewing public key (for foreign private accounts)]:vpk:' \ '--amount[Amount of native tokens to send]:amount:' ;; esac @@ -164,7 +164,7 @@ _wallet_account() { get) _arguments \ '(-r --raw)'{-r,--raw}'[Get raw account data]' \ - '(-k --keys)'{-k,--keys}'[Display keys (pk for public accounts, npk/ipk for private accounts)]' \ + '(-k --keys)'{-k,--keys}'[Display keys (pk for public accounts, npk/vpk for private accounts)]' \ '(-a --account-id)'{-a,--account-id}'[Account ID to query]:account_id:_wallet_account_ids' ;; list|ls) @@ -255,7 +255,7 @@ _wallet_token() { '--from[Source holding account ID]:from_account:_wallet_account_ids' \ '--to[Destination holding account ID (for owned accounts)]:to_account:_wallet_account_ids' \ '--to-npk[Destination nullifier public key (for foreign private accounts)]:npk:' \ - '--to-ipk[Destination viewing public key (for foreign private accounts)]:ipk:' \ + '--to-vpk[Destination viewing public key (for foreign private accounts)]:vpk:' \ '--amount[Amount of tokens to send]:amount:' ;; burn) @@ -269,7 +269,7 @@ _wallet_token() { '--definition[Definition account ID]:definition_account:_wallet_account_ids' \ '--holder[Holder account ID (for owned accounts)]:holder_account:_wallet_account_ids' \ '--holder-npk[Holder nullifier public key (for foreign private accounts)]:npk:' \ - '--holder-ipk[Holder viewing public key (for foreign private accounts)]:ipk:' \ + '--holder-vpk[Holder viewing public key (for foreign private accounts)]:vpk:' \ '--amount[Amount of tokens to mint]:amount:' ;; esac diff --git a/configs/docker-all-in-one/sequencer/sequencer_config.json b/configs/docker-all-in-one/sequencer/sequencer_config.json index 4acabb95..579253dc 100644 --- a/configs/docker-all-in-one/sequencer/sequencer_config.json +++ b/configs/docker-all-in-one/sequencer/sequencer_config.json @@ -29,40 +29,7 @@ ], "initial_commitments": [ { - "npk": [ - 63, - 202, - 178, - 231, - 183, - 82, - 237, - 212, - 216, - 221, - 215, - 255, - 153, - 101, - 177, - 161, - 254, - 210, - 128, - 122, - 54, - 190, - 230, - 151, - 183, - 64, - 225, - 229, - 113, - 1, - 228, - 97 - ], + "npk": [13, 25, 40, 5, 198, 248, 210, 248, 237, 121, 124, 145, 186, 142, 253, 216, 236, 69, 193, 32, 166, 167, 49, 133, 172, 111, 159, 46, 84, 17, 157, 23], "account": { "program_owner": [ 0, @@ -80,40 +47,7 @@ } }, { - "npk": [ - 192, - 251, - 166, - 243, - 167, - 236, - 84, - 249, - 35, - 136, - 130, - 172, - 219, - 225, - 161, - 139, - 229, - 89, - 243, - 125, - 194, - 213, - 209, - 30, - 23, - 174, - 100, - 244, - 124, - 74, - 140, - 47 - ], + "npk": [32, 67, 72, 164, 106, 53, 66, 239, 141, 15, 52, 230, 136, 177, 2, 236, 207, 243, 134, 135, 210, 143, 87, 232, 215, 128, 194, 120, 113, 224, 4, 165], "account": { "program_owner": [ 0, diff --git a/indexer/service/src/mock_service.rs b/indexer/service/src/mock_service.rs index b6b444e2..3343e9cc 100644 --- a/indexer/service/src/mock_service.rs +++ b/indexer/service/src/mock_service.rs @@ -263,7 +263,7 @@ impl indexer_service_rpc::RpcServer for MockIndexerService { .collect(); // Sort by block ID descending (most recent first) - account_txs.sort_by(|a, b| b.1.cmp(&a.1)); + account_txs.sort_by_key(|b| std::cmp::Reverse(b.1)); let start = offset as usize; if start >= account_txs.len() { diff --git a/integration_tests/tests/amm.rs b/integration_tests/tests/amm.rs index ac8815e0..3f513d70 100644 --- a/integration_tests/tests/amm.rs +++ b/integration_tests/tests/amm.rs @@ -102,7 +102,7 @@ async fn amm_public() -> Result<()> { from: format_public_account_id(supply_account_id_1), to: Some(format_public_account_id(recipient_account_id_1)), to_npk: None, - to_ipk: None, + to_vpk: None, amount: 7, }; @@ -126,7 +126,7 @@ async fn amm_public() -> Result<()> { from: format_public_account_id(supply_account_id_2), to: Some(format_public_account_id(recipient_account_id_2)), to_npk: None, - to_ipk: None, + to_vpk: None, amount: 7, }; diff --git a/integration_tests/tests/auth_transfer/private.rs b/integration_tests/tests/auth_transfer/private.rs index 03cb20e4..bf2ed8b1 100644 --- a/integration_tests/tests/auth_transfer/private.rs +++ b/integration_tests/tests/auth_transfer/private.rs @@ -26,7 +26,7 @@ async fn private_transfer_to_owned_account() -> Result<()> { from: format_private_account_id(from), to: Some(format_private_account_id(to)), to_npk: None, - to_ipk: None, + to_vpk: None, amount: 100, }); @@ -59,13 +59,13 @@ async fn private_transfer_to_foreign_account() -> Result<()> { let from: AccountId = ctx.existing_private_accounts()[0]; let to_npk = NullifierPublicKey([42; 32]); let to_npk_string = hex::encode(to_npk.0); - let to_ipk = Secp256k1Point::from_scalar(to_npk.0); + let to_vpk = Secp256k1Point::from_scalar(to_npk.0); let command = Command::AuthTransfer(AuthTransferSubcommand::Send { from: format_private_account_id(from), to: None, to_npk: Some(to_npk_string), - to_ipk: Some(hex::encode(to_ipk.0)), + to_vpk: Some(hex::encode(to_vpk.0)), amount: 100, }); @@ -113,7 +113,7 @@ async fn deshielded_transfer_to_public_account() -> Result<()> { from: format_private_account_id(from), to: Some(format_public_account_id(to)), to_npk: None, - to_ipk: None, + to_vpk: None, amount: 100, }); @@ -168,12 +168,12 @@ async fn private_transfer_to_owned_account_using_claiming_path() -> Result<()> { .cloned() .context("Failed to get private account")?; - // Send to this account using claiming path (using npk and ipk instead of account ID) + // Send to this account using claiming path (using npk and vpk instead of account ID) let command = Command::AuthTransfer(AuthTransferSubcommand::Send { from: format_private_account_id(from), to: None, to_npk: Some(hex::encode(to_keys.nullifer_public_key.0)), - to_ipk: Some(hex::encode(to_keys.incoming_viewing_public_key.0)), + to_vpk: Some(hex::encode(to_keys.viewing_public_key.0)), amount: 100, }); @@ -221,7 +221,7 @@ async fn shielded_transfer_to_owned_private_account() -> Result<()> { from: format_public_account_id(from), to: Some(format_private_account_id(to)), to_npk: None, - to_ipk: None, + to_vpk: None, amount: 100, }); @@ -256,14 +256,14 @@ async fn shielded_transfer_to_foreign_account() -> Result<()> { let to_npk = NullifierPublicKey([42; 32]); let to_npk_string = hex::encode(to_npk.0); - let to_ipk = Secp256k1Point::from_scalar(to_npk.0); + let to_vpk = Secp256k1Point::from_scalar(to_npk.0); let from: AccountId = ctx.existing_public_accounts()[0]; let command = Command::AuthTransfer(AuthTransferSubcommand::Send { from: format_public_account_id(from), to: None, to_npk: Some(to_npk_string), - to_ipk: Some(hex::encode(to_ipk.0)), + to_vpk: Some(hex::encode(to_vpk.0)), amount: 100, }); @@ -325,12 +325,12 @@ async fn private_transfer_to_owned_account_continuous_run_path() -> Result<()> { .cloned() .context("Failed to get private account")?; - // Send transfer using nullifier and incoming viewing public keys + // Send transfer using nullifier and viewing public keys let command = Command::AuthTransfer(AuthTransferSubcommand::Send { from: format_private_account_id(from), to: None, to_npk: Some(hex::encode(to_keys.nullifer_public_key.0)), - to_ipk: Some(hex::encode(to_keys.incoming_viewing_public_key.0)), + to_vpk: Some(hex::encode(to_keys.viewing_public_key.0)), amount: 100, }); diff --git a/integration_tests/tests/auth_transfer/public.rs b/integration_tests/tests/auth_transfer/public.rs index d4a7167a..da30fe5a 100644 --- a/integration_tests/tests/auth_transfer/public.rs +++ b/integration_tests/tests/auth_transfer/public.rs @@ -19,7 +19,7 @@ async fn successful_transfer_to_existing_account() -> Result<()> { from: format_public_account_id(ctx.existing_public_accounts()[0]), to: Some(format_public_account_id(ctx.existing_public_accounts()[1])), to_npk: None, - to_ipk: None, + to_vpk: None, amount: 100, }); @@ -72,7 +72,7 @@ pub async fn successful_transfer_to_new_account() -> Result<()> { from: format_public_account_id(ctx.existing_public_accounts()[0]), to: Some(format_public_account_id(new_persistent_account_id)), to_npk: None, - to_ipk: None, + to_vpk: None, amount: 100, }); @@ -108,7 +108,7 @@ async fn failed_transfer_with_insufficient_balance() -> Result<()> { from: format_public_account_id(ctx.existing_public_accounts()[0]), to: Some(format_public_account_id(ctx.existing_public_accounts()[1])), to_npk: None, - to_ipk: None, + to_vpk: None, amount: 1000000, }); @@ -146,7 +146,7 @@ async fn two_consecutive_successful_transfers() -> Result<()> { from: format_public_account_id(ctx.existing_public_accounts()[0]), to: Some(format_public_account_id(ctx.existing_public_accounts()[1])), to_npk: None, - to_ipk: None, + to_vpk: None, amount: 100, }); @@ -178,7 +178,7 @@ async fn two_consecutive_successful_transfers() -> Result<()> { from: format_public_account_id(ctx.existing_public_accounts()[0]), to: Some(format_public_account_id(ctx.existing_public_accounts()[1])), to_npk: None, - to_ipk: None, + to_vpk: None, amount: 100, }); diff --git a/integration_tests/tests/indexer.rs b/integration_tests/tests/indexer.rs index d247dcbd..afca7d41 100644 --- a/integration_tests/tests/indexer.rs +++ b/integration_tests/tests/indexer.rs @@ -12,7 +12,7 @@ use tokio::test; use wallet::cli::{Command, programs::native_token_transfer::AuthTransferSubcommand}; /// Timeout in milliseconds to reliably await for block finalization -const L2_TO_L1_TIMEOUT_MILLIS: u64 = 220000; +const L2_TO_L1_TIMEOUT_MILLIS: u64 = 300000; #[test] async fn indexer_test_run() -> Result<()> { @@ -45,6 +45,7 @@ async fn indexer_test_run() -> Result<()> { } #[test] +#[ignore = "Not reliable with current bedrock node"] async fn indexer_block_batching() -> Result<()> { let ctx = TestContext::new().await?; @@ -80,6 +81,7 @@ async fn indexer_block_batching() -> Result<()> { } #[test] +#[ignore = "Not reliable with current bedrock node"] async fn indexer_state_consistency() -> Result<()> { let mut ctx = TestContext::new().await?; @@ -87,7 +89,7 @@ async fn indexer_state_consistency() -> Result<()> { from: format_public_account_id(ctx.existing_public_accounts()[0]), to: Some(format_public_account_id(ctx.existing_public_accounts()[1])), to_npk: None, - to_ipk: None, + to_vpk: None, amount: 100, }); @@ -119,7 +121,7 @@ async fn indexer_state_consistency() -> Result<()> { from: format_private_account_id(from), to: Some(format_private_account_id(to)), to_npk: None, - to_ipk: None, + to_vpk: None, amount: 100, }); diff --git a/integration_tests/tests/keys_restoration.rs b/integration_tests/tests/keys_restoration.rs index 94e4aad0..b1d9edcb 100644 --- a/integration_tests/tests/keys_restoration.rs +++ b/integration_tests/tests/keys_restoration.rs @@ -50,7 +50,7 @@ async fn restore_keys_from_seed() -> Result<()> { from: format_private_account_id(from), to: Some(format_private_account_id(to_account_id1)), to_npk: None, - to_ipk: None, + to_vpk: None, amount: 100, }); wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?; @@ -60,7 +60,7 @@ async fn restore_keys_from_seed() -> Result<()> { from: format_private_account_id(from), to: Some(format_private_account_id(to_account_id2)), to_npk: None, - to_ipk: None, + to_vpk: None, amount: 101, }); wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?; @@ -96,7 +96,7 @@ async fn restore_keys_from_seed() -> Result<()> { from: format_public_account_id(from), to: Some(format_public_account_id(to_account_id3)), to_npk: None, - to_ipk: None, + to_vpk: None, amount: 102, }); wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?; @@ -106,7 +106,7 @@ async fn restore_keys_from_seed() -> Result<()> { from: format_public_account_id(from), to: Some(format_public_account_id(to_account_id4)), to_npk: None, - to_ipk: None, + to_vpk: None, amount: 103, }); wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?; @@ -169,7 +169,7 @@ async fn restore_keys_from_seed() -> Result<()> { from: format_private_account_id(to_account_id1), to: Some(format_private_account_id(to_account_id2)), to_npk: None, - to_ipk: None, + to_vpk: None, amount: 10, }); wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?; @@ -178,7 +178,7 @@ async fn restore_keys_from_seed() -> Result<()> { from: format_public_account_id(to_account_id3), to: Some(format_public_account_id(to_account_id4)), to_npk: None, - to_ipk: None, + to_vpk: None, amount: 11, }); wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?; diff --git a/integration_tests/tests/token.rs b/integration_tests/tests/token.rs index b735f484..506c250f 100644 --- a/integration_tests/tests/token.rs +++ b/integration_tests/tests/token.rs @@ -115,7 +115,7 @@ async fn create_and_transfer_public_token() -> Result<()> { from: format_public_account_id(supply_account_id), to: Some(format_public_account_id(recipient_account_id)), to_npk: None, - to_ipk: None, + to_vpk: None, amount: transfer_amount, }; @@ -208,7 +208,7 @@ async fn create_and_transfer_public_token() -> Result<()> { definition: format_public_account_id(definition_account_id), holder: Some(format_public_account_id(recipient_account_id)), holder_npk: None, - holder_ipk: None, + holder_vpk: None, amount: mint_amount, }; @@ -343,7 +343,7 @@ async fn create_and_transfer_token_with_private_supply() -> Result<()> { from: format_private_account_id(supply_account_id), to: Some(format_private_account_id(recipient_account_id)), to_npk: None, - to_ipk: None, + to_vpk: None, amount: transfer_amount, }; @@ -525,7 +525,7 @@ async fn create_token_with_private_definition() -> Result<()> { definition: format_private_account_id(definition_account_id), holder: Some(format_public_account_id(recipient_account_id_public)), holder_npk: None, - holder_ipk: None, + holder_vpk: None, amount: mint_amount_public, }; @@ -572,7 +572,7 @@ async fn create_token_with_private_definition() -> Result<()> { definition: format_private_account_id(definition_account_id), holder: Some(format_private_account_id(recipient_account_id_private)), holder_npk: None, - holder_ipk: None, + holder_vpk: None, amount: mint_amount_private, }; @@ -701,7 +701,7 @@ async fn create_token_with_private_definition_and_supply() -> Result<()> { from: format_private_account_id(supply_account_id), to: Some(format_private_account_id(recipient_account_id)), to_npk: None, - to_ipk: None, + to_vpk: None, amount: transfer_amount, }; @@ -819,7 +819,7 @@ async fn shielded_token_transfer() -> Result<()> { from: format_public_account_id(supply_account_id), to: Some(format_private_account_id(recipient_account_id)), to_npk: None, - to_ipk: None, + to_vpk: None, amount: transfer_amount, }; @@ -933,7 +933,7 @@ async fn deshielded_token_transfer() -> Result<()> { from: format_private_account_id(supply_account_id), to: Some(format_public_account_id(recipient_account_id)), to_npk: None, - to_ipk: None, + to_vpk: None, amount: transfer_amount, }; @@ -1056,7 +1056,7 @@ async fn token_claiming_path_with_private_accounts() -> Result<()> { definition: format_private_account_id(definition_account_id), holder: None, holder_npk: Some(hex::encode(holder_keys.nullifer_public_key.0)), - holder_ipk: Some(hex::encode(holder_keys.incoming_viewing_public_key.0)), + holder_vpk: Some(hex::encode(holder_keys.viewing_public_key.0)), amount: mint_amount, }; diff --git a/integration_tests/tests/tps.rs b/integration_tests/tests/tps.rs index aa86d465..2c58721e 100644 --- a/integration_tests/tests/tps.rs +++ b/integration_tests/tests/tps.rs @@ -16,7 +16,7 @@ use nssa::{ use nssa_core::{ MembershipProof, NullifierPublicKey, account::{AccountWithMetadata, data::Data}, - encryption::IncomingViewingPublicKey, + encryption::ViewingPublicKey, }; use tokio::test; @@ -192,8 +192,8 @@ impl TpsTestManager { fn build_privacy_transaction() -> PrivacyPreservingTransaction { let program = Program::authenticated_transfer_program(); let sender_nsk = [1; 32]; - let sender_isk = [99; 32]; - let sender_ipk = IncomingViewingPublicKey::from_scalar(sender_isk); + let sender_vsk = [99; 32]; + let sender_vpk = ViewingPublicKey::from_scalar(sender_vsk); let sender_npk = NullifierPublicKey::from(&sender_nsk); let sender_pre = AccountWithMetadata::new( Account { @@ -206,18 +206,18 @@ fn build_privacy_transaction() -> PrivacyPreservingTransaction { AccountId::from(&sender_npk), ); let recipient_nsk = [2; 32]; - let recipient_isk = [99; 32]; - let recipient_ipk = IncomingViewingPublicKey::from_scalar(recipient_isk); + let recipient_vsk = [99; 32]; + let recipient_vpk = ViewingPublicKey::from_scalar(recipient_vsk); let recipient_npk = NullifierPublicKey::from(&recipient_nsk); let recipient_pre = AccountWithMetadata::new(Account::default(), false, AccountId::from(&recipient_npk)); let eph_holder_from = EphemeralKeyHolder::new(&sender_npk); - let sender_ss = eph_holder_from.calculate_shared_secret_sender(&sender_ipk); + let sender_ss = eph_holder_from.calculate_shared_secret_sender(&sender_vpk); let sender_epk = eph_holder_from.generate_ephemeral_public_key(); let eph_holder_to = EphemeralKeyHolder::new(&recipient_npk); - let recipient_ss = eph_holder_to.calculate_shared_secret_sender(&recipient_ipk); + let recipient_ss = eph_holder_to.calculate_shared_secret_sender(&recipient_vpk); let recipient_epk = eph_holder_from.generate_ephemeral_public_key(); let balance_to_move: u128 = 1; @@ -246,8 +246,8 @@ fn build_privacy_transaction() -> PrivacyPreservingTransaction { vec![], vec![], vec![ - (sender_npk, sender_ipk, sender_epk), - (recipient_npk, recipient_ipk, recipient_epk), + (sender_npk, sender_vpk, sender_epk), + (recipient_npk, recipient_vpk, recipient_epk), ], output, ) diff --git a/integration_tests/tests/wallet_ffi.rs b/integration_tests/tests/wallet_ffi.rs index 2afd162c..e57e6b13 100644 --- a/integration_tests/tests/wallet_ffi.rs +++ b/integration_tests/tests/wallet_ffi.rs @@ -2,6 +2,7 @@ use std::{ collections::HashSet, ffi::{CStr, CString, c_char}, io::Write, + path::Path, time::Duration, }; @@ -24,6 +25,11 @@ unsafe extern "C" { password: *const c_char, ) -> *mut WalletHandle; + fn wallet_ffi_open( + config_path: *const c_char, + storage_path: *const c_char, + ) -> *mut WalletHandle; + fn wallet_ffi_destroy(handle: *mut WalletHandle); fn wallet_ffi_create_account_public( @@ -56,6 +62,12 @@ unsafe extern "C" { out_account: *mut FfiAccount, ) -> error::WalletFfiError; + fn wallet_ffi_get_account_private( + handle: *mut WalletHandle, + account_id: *const FfiBytes32, + out_account: *mut FfiAccount, + ) -> error::WalletFfiError; + fn wallet_ffi_free_account_data(account: *mut FfiAccount); fn wallet_ffi_get_public_account_key( @@ -89,6 +101,30 @@ unsafe extern "C" { out_result: *mut FfiTransferResult, ) -> error::WalletFfiError; + fn wallet_ffi_transfer_shielded( + handle: *mut WalletHandle, + from: *const FfiBytes32, + to_keys: *const FfiPrivateAccountKeys, + amount: *const [u8; 16], + out_result: *mut FfiTransferResult, + ) -> error::WalletFfiError; + + fn wallet_ffi_transfer_deshielded( + handle: *mut WalletHandle, + from: *const FfiBytes32, + to: *const FfiBytes32, + amount: *const [u8; 16], + out_result: *mut FfiTransferResult, + ) -> error::WalletFfiError; + + fn wallet_ffi_transfer_private( + handle: *mut WalletHandle, + from: *const FfiBytes32, + to_keys: *const FfiPrivateAccountKeys, + amount: *const [u8; 16], + out_result: *mut FfiTransferResult, + ) -> error::WalletFfiError; + fn wallet_ffi_free_transfer_result(result: *mut FfiTransferResult); fn wallet_ffi_register_public_account( @@ -96,12 +132,29 @@ unsafe extern "C" { account_id: *const FfiBytes32, out_result: *mut FfiTransferResult, ) -> error::WalletFfiError; + + fn wallet_ffi_register_private_account( + handle: *mut WalletHandle, + account_id: *const FfiBytes32, + out_result: *mut FfiTransferResult, + ) -> error::WalletFfiError; + + fn wallet_ffi_save(handle: *mut WalletHandle) -> error::WalletFfiError; + + fn wallet_ffi_sync_to_block(handle: *mut WalletHandle, block_id: u64) -> error::WalletFfiError; + + fn wallet_ffi_get_current_block_height( + handle: *mut WalletHandle, + out_block_height: *mut u64, + ) -> error::WalletFfiError; } -fn new_wallet_ffi_with_test_context_config(ctx: &BlockingTestContext) -> *mut WalletHandle { - let tempdir = tempfile::tempdir().unwrap(); - let config_path = tempdir.path().join("wallet_config.json"); - let storage_path = tempdir.path().join("storage.json"); +fn new_wallet_ffi_with_test_context_config( + ctx: &BlockingTestContext, + home: &Path, +) -> *mut WalletHandle { + let config_path = home.join("wallet_config.json"); + let storage_path = home.join("storage.json"); let mut config = ctx.ctx().wallet().config().to_owned(); if let Some(config_overrides) = ctx.ctx().wallet().config_overrides().clone() { config.apply_overrides(config_overrides); @@ -161,6 +214,15 @@ fn new_wallet_rust_with_default_config(password: &str) -> WalletCore { .unwrap() } +fn load_existing_ffi_wallet(home: &Path) -> *mut WalletHandle { + let config_path = home.join("wallet_config.json"); + let storage_path = home.join("storage.json"); + let config_path = CString::new(config_path.to_str().unwrap()).unwrap(); + let storage_path = CString::new(storage_path.to_str().unwrap()).unwrap(); + + unsafe { wallet_ffi_open(config_path.as_ptr(), storage_path.as_ptr()) } +} + #[test] fn test_wallet_ffi_create_public_accounts() { let password = "password_for_tests"; @@ -232,6 +294,56 @@ fn test_wallet_ffi_create_private_accounts() { assert_eq!(new_private_account_ids_ffi, new_private_account_ids_rust) } +#[test] +fn test_wallet_ffi_save_and_load_persistent_storage() -> Result<()> { + let ctx = BlockingTestContext::new()?; + let mut out_private_account_id = FfiBytes32::from_bytes([0; 32]); + let home = tempfile::tempdir().unwrap(); + + // Create a private account with the wallet FFI and save it + unsafe { + let wallet_ffi_handle = new_wallet_ffi_with_test_context_config(&ctx, home.path()); + wallet_ffi_create_account_private( + wallet_ffi_handle, + (&mut out_private_account_id) as *mut FfiBytes32, + ); + + wallet_ffi_save(wallet_ffi_handle); + wallet_ffi_destroy(wallet_ffi_handle); + } + + let private_account_keys = unsafe { + let wallet_ffi_handle = load_existing_ffi_wallet(home.path()); + + let mut private_account = FfiAccount::default(); + + let result = wallet_ffi_get_account_private( + wallet_ffi_handle, + (&out_private_account_id) as *const FfiBytes32, + (&mut private_account) as *mut FfiAccount, + ); + assert_eq!(result, error::WalletFfiError::Success); + + let mut out_keys = FfiPrivateAccountKeys::default(); + let result = wallet_ffi_get_private_account_keys( + wallet_ffi_handle, + (&out_private_account_id) as *const FfiBytes32, + (&mut out_keys) as *mut FfiPrivateAccountKeys, + ); + assert_eq!(result, error::WalletFfiError::Success); + + wallet_ffi_destroy(wallet_ffi_handle); + + out_keys + }; + + assert_eq!( + nssa::AccountId::from(&private_account_keys.npk()), + out_private_account_id.into() + ); + + Ok(()) +} #[test] fn test_wallet_ffi_list_accounts() { @@ -326,7 +438,8 @@ fn test_wallet_ffi_list_accounts() { fn test_wallet_ffi_get_balance_public() -> Result<()> { let ctx = BlockingTestContext::new()?; let account_id: AccountId = ctx.ctx().existing_public_accounts()[0]; - let wallet_ffi_handle = new_wallet_ffi_with_test_context_config(&ctx); + let home = tempfile::tempdir().unwrap(); + let wallet_ffi_handle = new_wallet_ffi_with_test_context_config(&ctx, home.path()); let balance = unsafe { let mut out_balance: [u8; 16] = [0; 16]; @@ -354,7 +467,8 @@ fn test_wallet_ffi_get_balance_public() -> Result<()> { fn test_wallet_ffi_get_account_public() -> Result<()> { let ctx = BlockingTestContext::new()?; let account_id: AccountId = ctx.ctx().existing_public_accounts()[0]; - let wallet_ffi_handle = new_wallet_ffi_with_test_context_config(&ctx); + let home = tempfile::tempdir().unwrap(); + let wallet_ffi_handle = new_wallet_ffi_with_test_context_config(&ctx, home.path()); let mut out_account = FfiAccount::default(); let account: Account = unsafe { @@ -385,11 +499,48 @@ fn test_wallet_ffi_get_account_public() -> Result<()> { Ok(()) } +#[test] +fn test_wallet_ffi_get_account_private() -> Result<()> { + let ctx = BlockingTestContext::new()?; + let account_id: AccountId = ctx.ctx().existing_private_accounts()[0]; + let home = tempfile::tempdir().unwrap(); + let wallet_ffi_handle = new_wallet_ffi_with_test_context_config(&ctx, home.path()); + let mut out_account = FfiAccount::default(); + + let account: Account = unsafe { + let ffi_account_id = FfiBytes32::from(&account_id); + let _result = wallet_ffi_get_account_private( + wallet_ffi_handle, + (&ffi_account_id) as *const FfiBytes32, + (&mut out_account) as *mut FfiAccount, + ); + (&out_account).try_into().unwrap() + }; + + assert_eq!( + account.program_owner, + Program::authenticated_transfer_program().id() + ); + assert_eq!(account.balance, 10000); + assert!(account.data.is_empty()); + assert_eq!(account.nonce, 0); + + unsafe { + wallet_ffi_free_account_data((&mut out_account) as *mut FfiAccount); + wallet_ffi_destroy(wallet_ffi_handle); + } + + info!("Successfully retrieved account with correct details"); + + Ok(()) +} + #[test] fn test_wallet_ffi_get_public_account_keys() -> Result<()> { let ctx = BlockingTestContext::new()?; let account_id: AccountId = ctx.ctx().existing_public_accounts()[0]; - let wallet_ffi_handle = new_wallet_ffi_with_test_context_config(&ctx); + let home = tempfile::tempdir().unwrap(); + let wallet_ffi_handle = new_wallet_ffi_with_test_context_config(&ctx, home.path()); let mut out_key = FfiPublicAccountKey::default(); let key: PublicKey = unsafe { @@ -426,7 +577,8 @@ fn test_wallet_ffi_get_public_account_keys() -> Result<()> { fn test_wallet_ffi_get_private_account_keys() -> Result<()> { let ctx = BlockingTestContext::new()?; let account_id: AccountId = ctx.ctx().existing_private_accounts()[0]; - let wallet_ffi_handle = new_wallet_ffi_with_test_context_config(&ctx); + let home = tempfile::tempdir().unwrap(); + let wallet_ffi_handle = new_wallet_ffi_with_test_context_config(&ctx, home.path()); let mut keys = FfiPrivateAccountKeys::default(); unsafe { @@ -448,10 +600,10 @@ fn test_wallet_ffi_get_private_account_keys() -> Result<()> { .0; let expected_npk = &key_chain.nullifer_public_key; - let expected_ivk = &key_chain.incoming_viewing_public_key; + let expected_vpk = &key_chain.viewing_public_key; assert_eq!(&keys.npk(), expected_npk); - assert_eq!(&keys.ivk().unwrap(), expected_ivk); + assert_eq!(&keys.vpk().unwrap(), expected_vpk); unsafe { wallet_ffi_free_private_account_keys((&mut keys) as *mut FfiPrivateAccountKeys); @@ -504,7 +656,8 @@ fn test_wallet_ffi_base58_to_account_id() { #[test] fn test_wallet_ffi_init_public_account_auth_transfer() -> Result<()> { let ctx = BlockingTestContext::new().unwrap(); - let wallet_ffi_handle = new_wallet_ffi_with_test_context_config(&ctx); + let home = tempfile::tempdir().unwrap(); + let wallet_ffi_handle = new_wallet_ffi_with_test_context_config(&ctx, home.path()); // Create a new uninitialized public account let mut out_account_id = FfiBytes32::from_bytes([0; 32]); @@ -563,10 +716,81 @@ fn test_wallet_ffi_init_public_account_auth_transfer() -> Result<()> { Ok(()) } +#[test] +fn test_wallet_ffi_init_private_account_auth_transfer() -> Result<()> { + let ctx = BlockingTestContext::new().unwrap(); + let home = tempfile::tempdir().unwrap(); + let wallet_ffi_handle = new_wallet_ffi_with_test_context_config(&ctx, home.path()); + + // Create a new uninitialized public account + let mut out_account_id = FfiBytes32::from_bytes([0; 32]); + unsafe { + wallet_ffi_create_account_private( + wallet_ffi_handle, + (&mut out_account_id) as *mut FfiBytes32, + ); + } + + // Check its program owner is the default program id + let account: Account = unsafe { + let mut out_account = FfiAccount::default(); + wallet_ffi_get_account_private( + wallet_ffi_handle, + (&out_account_id) as *const FfiBytes32, + (&mut out_account) as *mut FfiAccount, + ); + (&out_account).try_into().unwrap() + }; + assert_eq!(account.program_owner, DEFAULT_PROGRAM_ID); + + // Call the init funciton + let mut transfer_result = FfiTransferResult::default(); + unsafe { + wallet_ffi_register_private_account( + wallet_ffi_handle, + (&out_account_id) as *const FfiBytes32, + (&mut transfer_result) as *mut FfiTransferResult, + ); + } + + info!("Waiting for next block creation"); + std::thread::sleep(Duration::from_secs(TIME_TO_WAIT_FOR_BLOCK_SECONDS)); + + // Sync private account local storage with onchain encrypted state + unsafe { + let mut current_height = 0; + wallet_ffi_get_current_block_height(wallet_ffi_handle, (&mut current_height) as *mut u64); + wallet_ffi_sync_to_block(wallet_ffi_handle, current_height); + }; + + // Check that the program owner is now the authenticated transfer program + let account: Account = unsafe { + let mut out_account = FfiAccount::default(); + let _result = wallet_ffi_get_account_private( + wallet_ffi_handle, + (&out_account_id) as *const FfiBytes32, + (&mut out_account) as *mut FfiAccount, + ); + (&out_account).try_into().unwrap() + }; + assert_eq!( + account.program_owner, + Program::authenticated_transfer_program().id() + ); + + unsafe { + wallet_ffi_free_transfer_result((&mut transfer_result) as *mut FfiTransferResult); + wallet_ffi_destroy(wallet_ffi_handle); + } + + Ok(()) +} + #[test] fn test_wallet_ffi_transfer_public() -> Result<()> { let ctx = BlockingTestContext::new().unwrap(); - let wallet_ffi_handle = new_wallet_ffi_with_test_context_config(&ctx); + let home = tempfile::tempdir().unwrap(); + let wallet_ffi_handle = new_wallet_ffi_with_test_context_config(&ctx, home.path()); let from: FfiBytes32 = (&ctx.ctx().existing_public_accounts()[0]).into(); let to: FfiBytes32 = (&ctx.ctx().existing_public_accounts()[1]).into(); let amount: [u8; 16] = 100u128.to_le_bytes(); @@ -617,3 +841,220 @@ fn test_wallet_ffi_transfer_public() -> Result<()> { Ok(()) } + +#[test] +fn test_wallet_ffi_transfer_shielded() -> Result<()> { + let ctx = BlockingTestContext::new().unwrap(); + let home = tempfile::tempdir().unwrap(); + let wallet_ffi_handle = new_wallet_ffi_with_test_context_config(&ctx, home.path()); + let from: FfiBytes32 = (&ctx.ctx().existing_public_accounts()[0]).into(); + let (to, to_keys) = unsafe { + let mut out_account_id = FfiBytes32::default(); + let mut out_keys = FfiPrivateAccountKeys::default(); + wallet_ffi_create_account_private( + wallet_ffi_handle, + (&mut out_account_id) as *mut FfiBytes32, + ); + wallet_ffi_get_private_account_keys( + wallet_ffi_handle, + (&out_account_id) as *const FfiBytes32, + (&mut out_keys) as *mut FfiPrivateAccountKeys, + ); + (out_account_id, out_keys) + }; + let amount: [u8; 16] = 100u128.to_le_bytes(); + + let mut transfer_result = FfiTransferResult::default(); + unsafe { + wallet_ffi_transfer_shielded( + wallet_ffi_handle, + (&from) as *const FfiBytes32, + (&to_keys) as *const FfiPrivateAccountKeys, + (&amount) as *const [u8; 16], + (&mut transfer_result) as *mut FfiTransferResult, + ); + } + + info!("Waiting for next block creation"); + std::thread::sleep(Duration::from_secs(TIME_TO_WAIT_FOR_BLOCK_SECONDS)); + + // Sync private account local storage with onchain encrypted state + unsafe { + let mut current_height = 0; + wallet_ffi_get_current_block_height(wallet_ffi_handle, (&mut current_height) as *mut u64); + wallet_ffi_sync_to_block(wallet_ffi_handle, current_height); + }; + + let from_balance = unsafe { + let mut out_balance: [u8; 16] = [0; 16]; + let _result = wallet_ffi_get_balance( + wallet_ffi_handle, + (&from) as *const FfiBytes32, + true, + (&mut out_balance) as *mut [u8; 16], + ); + u128::from_le_bytes(out_balance) + }; + + let to_balance = unsafe { + let mut out_balance: [u8; 16] = [0; 16]; + let _result = wallet_ffi_get_balance( + wallet_ffi_handle, + (&to) as *const FfiBytes32, + false, + (&mut out_balance) as *mut [u8; 16], + ); + u128::from_le_bytes(out_balance) + }; + + assert_eq!(from_balance, 9900); + assert_eq!(to_balance, 100); + + unsafe { + wallet_ffi_free_transfer_result((&mut transfer_result) as *mut FfiTransferResult); + wallet_ffi_destroy(wallet_ffi_handle); + } + + Ok(()) +} + +#[test] +fn test_wallet_ffi_transfer_deshielded() -> Result<()> { + let ctx = BlockingTestContext::new().unwrap(); + let home = tempfile::tempdir().unwrap(); + let wallet_ffi_handle = new_wallet_ffi_with_test_context_config(&ctx, home.path()); + let from: FfiBytes32 = (&ctx.ctx().existing_private_accounts()[0]).into(); + let to = FfiBytes32::from_bytes([37; 32]); + let amount: [u8; 16] = 100u128.to_le_bytes(); + + let mut transfer_result = FfiTransferResult::default(); + unsafe { + wallet_ffi_transfer_deshielded( + wallet_ffi_handle, + (&from) as *const FfiBytes32, + (&to) as *const FfiBytes32, + (&amount) as *const [u8; 16], + (&mut transfer_result) as *mut FfiTransferResult, + ); + } + + info!("Waiting for next block creation"); + std::thread::sleep(Duration::from_secs(TIME_TO_WAIT_FOR_BLOCK_SECONDS)); + + // Sync private account local storage with onchain encrypted state + unsafe { + let mut current_height = 0; + wallet_ffi_get_current_block_height(wallet_ffi_handle, (&mut current_height) as *mut u64); + wallet_ffi_sync_to_block(wallet_ffi_handle, current_height); + }; + + let from_balance = unsafe { + let mut out_balance: [u8; 16] = [0; 16]; + let _result = wallet_ffi_get_balance( + wallet_ffi_handle, + (&from) as *const FfiBytes32, + false, + (&mut out_balance) as *mut [u8; 16], + ); + u128::from_le_bytes(out_balance) + }; + + let to_balance = unsafe { + let mut out_balance: [u8; 16] = [0; 16]; + let _result = wallet_ffi_get_balance( + wallet_ffi_handle, + (&to) as *const FfiBytes32, + true, + (&mut out_balance) as *mut [u8; 16], + ); + u128::from_le_bytes(out_balance) + }; + + assert_eq!(from_balance, 9900); + assert_eq!(to_balance, 100); + + unsafe { + wallet_ffi_free_transfer_result((&mut transfer_result) as *mut FfiTransferResult); + wallet_ffi_destroy(wallet_ffi_handle); + } + + Ok(()) +} + +#[test] +fn test_wallet_ffi_transfer_private() -> Result<()> { + let ctx = BlockingTestContext::new().unwrap(); + let home = tempfile::tempdir().unwrap(); + let wallet_ffi_handle = new_wallet_ffi_with_test_context_config(&ctx, home.path()); + + let from: FfiBytes32 = (&ctx.ctx().existing_private_accounts()[0]).into(); + let (to, to_keys) = unsafe { + let mut out_account_id = FfiBytes32::default(); + let mut out_keys = FfiPrivateAccountKeys::default(); + wallet_ffi_create_account_private( + wallet_ffi_handle, + (&mut out_account_id) as *mut FfiBytes32, + ); + wallet_ffi_get_private_account_keys( + wallet_ffi_handle, + (&out_account_id) as *const FfiBytes32, + (&mut out_keys) as *mut FfiPrivateAccountKeys, + ); + (out_account_id, out_keys) + }; + + let amount: [u8; 16] = 100u128.to_le_bytes(); + + let mut transfer_result = FfiTransferResult::default(); + unsafe { + wallet_ffi_transfer_private( + wallet_ffi_handle, + (&from) as *const FfiBytes32, + (&to_keys) as *const FfiPrivateAccountKeys, + (&amount) as *const [u8; 16], + (&mut transfer_result) as *mut FfiTransferResult, + ); + } + + info!("Waiting for next block creation"); + std::thread::sleep(Duration::from_secs(TIME_TO_WAIT_FOR_BLOCK_SECONDS)); + + // Sync private account local storage with onchain encrypted state + unsafe { + let mut current_height = 0; + wallet_ffi_get_current_block_height(wallet_ffi_handle, (&mut current_height) as *mut u64); + wallet_ffi_sync_to_block(wallet_ffi_handle, current_height); + }; + + let from_balance = unsafe { + let mut out_balance: [u8; 16] = [0; 16]; + let _result = wallet_ffi_get_balance( + wallet_ffi_handle, + (&from) as *const FfiBytes32, + false, + (&mut out_balance) as *mut [u8; 16], + ); + u128::from_le_bytes(out_balance) + }; + + let to_balance = unsafe { + let mut out_balance: [u8; 16] = [0; 16]; + let _result = wallet_ffi_get_balance( + wallet_ffi_handle, + (&to) as *const FfiBytes32, + false, + (&mut out_balance) as *mut [u8; 16], + ); + u128::from_le_bytes(out_balance) + }; + + assert_eq!(from_balance, 9900); + assert_eq!(to_balance, 100); + + unsafe { + wallet_ffi_free_transfer_result((&mut transfer_result) as *mut FfiTransferResult); + wallet_ffi_destroy(wallet_ffi_handle); + } + + Ok(()) +} diff --git a/key_protocol/src/key_management/ephemeral_key_holder.rs b/key_protocol/src/key_management/ephemeral_key_holder.rs index 7a84ec56..4aaea58c 100644 --- a/key_protocol/src/key_management/ephemeral_key_holder.rs +++ b/key_protocol/src/key_management/ephemeral_key_holder.rs @@ -1,6 +1,6 @@ use nssa_core::{ NullifierPublicKey, SharedSecretKey, - encryption::{EphemeralPublicKey, EphemeralSecretKey, IncomingViewingPublicKey}, + encryption::{EphemeralPublicKey, EphemeralSecretKey, ViewingPublicKey}, }; use rand::{RngCore, rngs::OsRng}; use sha2::Digest; @@ -13,12 +13,12 @@ pub struct EphemeralKeyHolder { } pub fn produce_one_sided_shared_secret_receiver( - ipk: &IncomingViewingPublicKey, + vpk: &ViewingPublicKey, ) -> (SharedSecretKey, EphemeralPublicKey) { let mut esk = [0; 32]; OsRng.fill_bytes(&mut esk); ( - SharedSecretKey::new(&esk, ipk), + SharedSecretKey::new(&esk, vpk), EphemeralPublicKey::from_scalar(esk), ) } @@ -42,11 +42,8 @@ impl EphemeralKeyHolder { pub fn calculate_shared_secret_sender( &self, - receiver_incoming_viewing_public_key: &IncomingViewingPublicKey, + receiver_viewing_public_key: &ViewingPublicKey, ) -> SharedSecretKey { - SharedSecretKey::new( - &self.ephemeral_secret_key, - receiver_incoming_viewing_public_key, - ) + SharedSecretKey::new(&self.ephemeral_secret_key, receiver_viewing_public_key) } } diff --git a/key_protocol/src/key_management/key_tree/keys_private.rs b/key_protocol/src/key_management/key_tree/keys_private.rs index c91f03e8..1ff7095e 100644 --- a/key_protocol/src/key_management/key_tree/keys_private.rs +++ b/key_protocol/src/key_management/key_tree/keys_private.rs @@ -1,5 +1,5 @@ use k256::{Scalar, elliptic_curve::PrimeField}; -use nssa_core::encryption::IncomingViewingPublicKey; +use nssa_core::{NullifierPublicKey, encryption::ViewingPublicKey}; use serde::{Deserialize, Serialize}; use crate::key_management::{ @@ -18,7 +18,7 @@ pub struct ChildKeysPrivate { impl KeyNode for ChildKeysPrivate { fn root(seed: [u8; 64]) -> Self { - let hash_value = hmac_sha512::HMAC::mac(seed, "NSSA_master_priv"); + let hash_value = hmac_sha512::HMAC::mac(seed, b"LEE_master_priv"); let ssk = SecretSpendingKey( *hash_value @@ -29,23 +29,21 @@ impl KeyNode for ChildKeysPrivate { .last_chunk::<32>() .expect("hash_value is 64 bytes, must be safe to get last 32"); - let nsk = ssk.generate_nullifier_secret_key(); - let isk = ssk.generate_incoming_viewing_secret_key(); - let ovk = ssk.generate_outgoing_viewing_secret_key(); + let nsk = ssk.generate_nullifier_secret_key(None); + let vsk = ssk.generate_viewing_secret_key(None); - let npk = (&nsk).into(); - let ipk = IncomingViewingPublicKey::from_scalar(isk); + let npk = NullifierPublicKey::from(&nsk); + let vpk = ViewingPublicKey::from_scalar(vsk); Self { value: ( KeyChain { secret_spending_key: ssk, nullifer_public_key: npk, - incoming_viewing_public_key: ipk, + viewing_public_key: vpk, private_key_holder: PrivateKeyHolder { nullifier_secret_key: nsk, - incoming_viewing_secret_key: isk, - outgoing_viewing_secret_key: ovk, + viewing_secret_key: vsk, }, }, nssa::Account::default(), @@ -56,27 +54,14 @@ impl KeyNode for ChildKeysPrivate { } fn nth_child(&self, cci: u32) -> Self { - let parent_pt = Scalar::from_repr( - self.value - .0 - .private_key_holder - .outgoing_viewing_secret_key - .into(), - ) - .expect("Key generated as scalar, must be valid representation") - + Scalar::from_repr(self.value.0.private_key_holder.nullifier_secret_key.into()) + let parent_pt = + Scalar::from_repr(self.value.0.private_key_holder.nullifier_secret_key.into()) .expect("Key generated as scalar, must be valid representation") - * Scalar::from_repr( - self.value - .0 - .private_key_holder - .incoming_viewing_secret_key - .into(), - ) - .expect("Key generated as scalar, must be valid representation"); + * Scalar::from_repr(self.value.0.private_key_holder.viewing_secret_key.into()) + .expect("Key generated as scalar, must be valid representation"); let mut input = vec![]; - input.extend_from_slice(b"NSSA_seed_priv"); + input.extend_from_slice(b"LEE_seed_priv"); input.extend_from_slice(&parent_pt.to_bytes()); input.extend_from_slice(&cci.to_le_bytes()); @@ -91,23 +76,21 @@ impl KeyNode for ChildKeysPrivate { .last_chunk::<32>() .expect("hash_value is 64 bytes, must be safe to get last 32"); - let nsk = ssk.generate_nullifier_secret_key(); - let isk = ssk.generate_incoming_viewing_secret_key(); - let ovk = ssk.generate_outgoing_viewing_secret_key(); + let nsk = ssk.generate_nullifier_secret_key(Some(cci)); + let vsk = ssk.generate_viewing_secret_key(Some(cci)); - let npk = (&nsk).into(); - let ipk = IncomingViewingPublicKey::from_scalar(isk); + let npk = NullifierPublicKey::from(&nsk); + let vpk = ViewingPublicKey::from_scalar(vsk); Self { value: ( KeyChain { secret_spending_key: ssk, nullifer_public_key: npk, - incoming_viewing_public_key: ipk, + viewing_public_key: vpk, private_key_holder: PrivateKeyHolder { nullifier_secret_key: nsk, - incoming_viewing_secret_key: isk, - outgoing_viewing_secret_key: ovk, + viewing_secret_key: vsk, }, }, nssa::Account::default(), @@ -144,120 +127,98 @@ impl<'a> From<&'a mut ChildKeysPrivate> for &'a mut (KeyChain, nssa::Account) { #[cfg(test)] mod tests { + use nssa_core::{NullifierPublicKey, NullifierSecretKey}; + use super::*; + use crate::key_management::{self, secret_holders::ViewingSecretKey}; #[test] - fn test_keys_deterministic_generation() { - let root_keys = ChildKeysPrivate::root([42; 64]); - let child_keys = root_keys.nth_child(5); + fn test_master_key_generation() { + let seed: [u8; 64] = [ + 252, 56, 204, 83, 232, 123, 209, 188, 187, 167, 39, 213, 71, 39, 58, 65, 125, 134, 255, + 49, 43, 108, 92, 53, 173, 164, 94, 142, 150, 74, 21, 163, 43, 144, 226, 87, 199, 18, + 129, 223, 176, 198, 5, 150, 157, 70, 210, 254, 14, 105, 89, 191, 246, 27, 52, 170, 56, + 114, 39, 38, 118, 197, 205, 225, + ]; - assert_eq!(root_keys.cci, None); - assert_eq!(child_keys.cci, Some(5)); + let keys = ChildKeysPrivate::root(seed); - assert_eq!( - root_keys.value.0.secret_spending_key.0, - [ - 249, 83, 253, 32, 174, 204, 185, 44, 253, 167, 61, 92, 128, 5, 152, 4, 220, 21, 88, - 84, 167, 180, 154, 249, 44, 77, 33, 136, 59, 131, 203, 152 - ] - ); - assert_eq!( - child_keys.value.0.secret_spending_key.0, - [ - 16, 242, 229, 242, 252, 158, 153, 210, 234, 120, 70, 85, 83, 196, 5, 53, 28, 26, - 187, 230, 22, 193, 146, 232, 237, 3, 166, 184, 122, 1, 233, 93 - ] - ); + let expected_ssk: SecretSpendingKey = key_management::secret_holders::SecretSpendingKey([ + 246, 79, 26, 124, 135, 95, 52, 51, 201, 27, 48, 194, 2, 144, 51, 219, 245, 128, 139, + 222, 42, 195, 105, 33, 115, 97, 186, 0, 97, 14, 218, 191, + ]); - assert_eq!( - root_keys.value.0.private_key_holder.nullifier_secret_key, - [ - 38, 195, 52, 182, 16, 66, 167, 156, 9, 14, 65, 100, 17, 93, 166, 71, 27, 148, 93, - 85, 116, 109, 130, 8, 195, 222, 159, 214, 141, 41, 124, 57 - ] - ); - assert_eq!( - child_keys.value.0.private_key_holder.nullifier_secret_key, - [ - 215, 46, 2, 151, 174, 60, 86, 154, 5, 3, 175, 245, 12, 176, 220, 58, 250, 118, 236, - 49, 254, 221, 229, 58, 40, 1, 170, 145, 175, 108, 23, 170 - ] - ); + let expected_ccc = [ + 56, 114, 70, 249, 67, 169, 206, 9, 192, 11, 180, 168, 149, 129, 42, 95, 43, 157, 130, + 111, 13, 5, 195, 75, 20, 255, 162, 85, 40, 251, 8, 168, + ]; - assert_eq!( - root_keys - .value - .0 - .private_key_holder - .incoming_viewing_secret_key, - [ - 153, 161, 15, 34, 96, 184, 165, 165, 27, 244, 155, 40, 70, 5, 241, 133, 78, 40, 61, - 118, 48, 148, 226, 5, 97, 18, 201, 128, 82, 248, 163, 72 - ] - ); - assert_eq!( - child_keys - .value - .0 - .private_key_holder - .incoming_viewing_secret_key, - [ - 192, 155, 55, 43, 164, 115, 71, 145, 227, 225, 21, 57, 55, 12, 226, 44, 10, 103, - 39, 73, 230, 173, 60, 69, 69, 122, 110, 241, 164, 3, 192, 57 - ] - ); + let expected_nsk: NullifierSecretKey = [ + 154, 102, 103, 5, 34, 235, 227, 13, 22, 182, 226, 11, 7, 67, 110, 162, 99, 193, 174, + 34, 234, 19, 222, 2, 22, 12, 163, 252, 88, 11, 0, 163, + ]; - assert_eq!( - root_keys - .value - .0 - .private_key_holder - .outgoing_viewing_secret_key, - [ - 205, 87, 71, 129, 90, 242, 217, 200, 140, 252, 124, 46, 207, 7, 33, 156, 83, 166, - 150, 81, 98, 131, 182, 156, 110, 92, 78, 140, 125, 218, 152, 154 - ] - ); - assert_eq!( - child_keys - .value - .0 - .private_key_holder - .outgoing_viewing_secret_key, - [ - 131, 202, 219, 172, 219, 29, 48, 120, 226, 209, 209, 10, 216, 173, 48, 167, 233, - 17, 35, 155, 30, 217, 176, 120, 72, 146, 250, 226, 165, 178, 255, 90 - ] - ); + let expected_npk: NullifierPublicKey = nssa_core::NullifierPublicKey([ + 7, 123, 125, 191, 233, 183, 201, 4, 20, 214, 155, 210, 45, 234, 27, 240, 194, 111, 97, + 247, 155, 113, 122, 246, 192, 0, 70, 61, 76, 71, 70, 2, + ]); + let expected_vsk: ViewingSecretKey = [ + 155, 90, 54, 75, 228, 130, 68, 201, 129, 251, 180, 195, 250, 64, 34, 230, 241, 204, + 216, 50, 149, 156, 10, 67, 208, 74, 9, 10, 47, 59, 50, 202, + ]; - assert_eq!( - root_keys.value.0.nullifer_public_key.0, - [ - 65, 176, 149, 243, 192, 45, 216, 177, 169, 56, 229, 7, 28, 66, 204, 87, 109, 83, - 152, 64, 14, 188, 179, 210, 147, 60, 22, 251, 203, 70, 89, 215 - ] - ); - assert_eq!( - child_keys.value.0.nullifer_public_key.0, - [ - 69, 104, 130, 115, 48, 134, 19, 188, 67, 148, 163, 54, 155, 237, 57, 27, 136, 228, - 111, 233, 205, 158, 149, 31, 84, 11, 241, 176, 243, 12, 138, 249 - ] - ); + let expected_vpk_as_bytes: [u8; 33] = [ + 2, 191, 99, 102, 114, 40, 131, 109, 166, 8, 222, 186, 107, 29, 156, 106, 206, 96, 127, + 80, 170, 66, 217, 79, 38, 80, 11, 74, 147, 123, 221, 159, 166, + ]; - assert_eq!( - root_keys.value.0.incoming_viewing_public_key.0, - &[ - 3, 174, 56, 136, 244, 179, 18, 122, 38, 220, 36, 50, 200, 41, 104, 167, 70, 18, 60, - 202, 93, 193, 29, 16, 125, 252, 96, 51, 199, 152, 47, 233, 178 - ] - ); - assert_eq!( - child_keys.value.0.incoming_viewing_public_key.0, - &[ - 3, 18, 202, 246, 79, 141, 169, 51, 55, 202, 120, 169, 244, 201, 156, 162, 216, 115, - 126, 53, 46, 94, 235, 125, 114, 178, 215, 81, 171, 93, 93, 88, 117 - ] - ); + assert!(expected_ssk == keys.value.0.secret_spending_key); + assert!(expected_ccc == keys.ccc); + assert!(expected_nsk == keys.value.0.private_key_holder.nullifier_secret_key); + assert!(expected_npk == keys.value.0.nullifer_public_key); + assert!(expected_vsk == keys.value.0.private_key_holder.viewing_secret_key); + assert!(expected_vpk_as_bytes == keys.value.0.viewing_public_key.to_bytes()); + } + + #[test] + fn test_child_keys_generation() { + let seed: [u8; 64] = [ + 252, 56, 204, 83, 232, 123, 209, 188, 187, 167, 39, 213, 71, 39, 58, 65, 125, 134, 255, + 49, 43, 108, 92, 53, 173, 164, 94, 142, 150, 74, 21, 163, 43, 144, 226, 87, 199, 18, + 129, 223, 176, 198, 5, 150, 157, 70, 210, 254, 14, 105, 89, 191, 246, 27, 52, 170, 56, + 114, 39, 38, 118, 197, 205, 225, + ]; + + let root_node = ChildKeysPrivate::root(seed); + let child_node = ChildKeysPrivate::nth_child(&root_node, 42u32); + + let expected_ccc: [u8; 32] = [ + 145, 59, 225, 32, 54, 168, 14, 45, 60, 253, 57, 202, 31, 86, 142, 234, 51, 57, 154, 88, + 132, 200, 92, 191, 220, 144, 42, 184, 108, 35, 226, 146, + ]; + + let expected_nsk: NullifierSecretKey = [ + 19, 100, 119, 73, 191, 225, 234, 219, 129, 88, 40, 229, 63, 225, 189, 136, 69, 172, + 221, 186, 147, 83, 150, 207, 70, 17, 228, 70, 113, 87, 227, 31, + ]; + let expected_npk: NullifierPublicKey = nssa_core::NullifierPublicKey([ + 133, 235, 223, 151, 12, 69, 26, 222, 60, 125, 235, 125, 167, 212, 201, 168, 101, 242, + 111, 239, 1, 228, 12, 252, 146, 53, 75, 17, 187, 255, 122, 181, + ]); + + let expected_vsk: ViewingSecretKey = [ + 218, 219, 193, 132, 160, 6, 178, 194, 139, 248, 199, 81, 17, 133, 37, 201, 58, 104, 49, + 222, 187, 46, 156, 93, 14, 118, 209, 243, 38, 101, 77, 45, + ]; + let expected_vpk_as_bytes: [u8; 33] = [ + 3, 164, 65, 167, 88, 167, 179, 51, 159, 27, 241, 174, 77, 174, 142, 106, 128, 96, 69, + 74, 117, 231, 42, 193, 235, 153, 206, 116, 102, 7, 101, 192, 45, + ]; + + assert!(expected_ccc == child_node.ccc); + assert!(expected_nsk == child_node.value.0.private_key_holder.nullifier_secret_key); + assert!(expected_npk == child_node.value.0.nullifer_public_key); + assert!(expected_vsk == child_node.value.0.private_key_holder.viewing_secret_key); + assert!(expected_vpk_as_bytes == child_node.value.0.viewing_public_key.to_bytes()); } } diff --git a/key_protocol/src/key_management/mod.rs b/key_protocol/src/key_management/mod.rs index 5f896532..d46dcf35 100644 --- a/key_protocol/src/key_management/mod.rs +++ b/key_protocol/src/key_management/mod.rs @@ -1,6 +1,6 @@ use nssa_core::{ NullifierPublicKey, SharedSecretKey, - encryption::{EphemeralPublicKey, IncomingViewingPublicKey}, + encryption::{EphemeralPublicKey, ViewingPublicKey}, }; use secret_holders::{PrivateKeyHolder, SecretSpendingKey, SeedHolder}; use serde::{Deserialize, Serialize}; @@ -17,7 +17,7 @@ pub struct KeyChain { pub secret_spending_key: SecretSpendingKey, pub private_key_holder: PrivateKeyHolder, pub nullifer_public_key: NullifierPublicKey, - pub incoming_viewing_public_key: IncomingViewingPublicKey, + pub viewing_public_key: ViewingPublicKey, } impl KeyChain { @@ -27,16 +27,16 @@ impl KeyChain { let seed_holder = SeedHolder::new_os_random(); let secret_spending_key = seed_holder.produce_top_secret_key_holder(); - let private_key_holder = secret_spending_key.produce_private_key_holder(); + let private_key_holder = secret_spending_key.produce_private_key_holder(None); let nullifer_public_key = private_key_holder.generate_nullifier_public_key(); - let incoming_viewing_public_key = private_key_holder.generate_incoming_viewing_public_key(); + let viewing_public_key = private_key_holder.generate_viewing_public_key(); Self { secret_spending_key, private_key_holder, nullifer_public_key, - incoming_viewing_public_key, + viewing_public_key, } } @@ -46,16 +46,16 @@ impl KeyChain { let seed_holder = SeedHolder::new_mnemonic(passphrase); let secret_spending_key = seed_holder.produce_top_secret_key_holder(); - let private_key_holder = secret_spending_key.produce_private_key_holder(); + let private_key_holder = secret_spending_key.produce_private_key_holder(None); let nullifer_public_key = private_key_holder.generate_nullifier_public_key(); - let incoming_viewing_public_key = private_key_holder.generate_incoming_viewing_public_key(); + let viewing_public_key = private_key_holder.generate_viewing_public_key(); Self { secret_spending_key, private_key_holder, nullifer_public_key, - incoming_viewing_public_key, + viewing_public_key, } } @@ -64,9 +64,7 @@ impl KeyChain { ephemeral_public_key_sender: EphemeralPublicKey, ) -> SharedSecretKey { SharedSecretKey::new( - &self - .secret_spending_key - .generate_incoming_viewing_secret_key(), + &self.secret_spending_key.generate_viewing_secret_key(None), &ephemeral_public_key_sender, ) } @@ -112,10 +110,10 @@ mod tests { let seed_holder = SeedHolder::new_os_random(); let top_secret_key_holder = seed_holder.produce_top_secret_key_holder(); - let utxo_secret_key_holder = top_secret_key_holder.produce_private_key_holder(); + let utxo_secret_key_holder = top_secret_key_holder.produce_private_key_holder(None); let nullifer_public_key = utxo_secret_key_holder.generate_nullifier_public_key(); - let viewing_public_key = utxo_secret_key_holder.generate_incoming_viewing_public_key(); + let viewing_public_key = utxo_secret_key_holder.generate_viewing_public_key(); let pub_account_signing_key = nssa::PrivateKey::new_os_random(); diff --git a/key_protocol/src/key_management/secret_holders.rs b/key_protocol/src/key_management/secret_holders.rs index 705e7037..d5aac258 100644 --- a/key_protocol/src/key_management/secret_holders.rs +++ b/key_protocol/src/key_management/secret_holders.rs @@ -2,7 +2,7 @@ use bip39::Mnemonic; use common::HashType; use nssa_core::{ NullifierPublicKey, NullifierSecretKey, - encryption::{IncomingViewingPublicKey, Scalar}, + encryption::{Scalar, ViewingPublicKey}, }; use rand::{RngCore, rngs::OsRng}; use serde::{Deserialize, Serialize}; @@ -18,20 +18,18 @@ pub struct SeedHolder { pub(crate) seed: Vec, } -#[derive(Serialize, Deserialize, Debug, Clone)] +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)] /// Secret spending key object. Can produce `PrivateKeyHolder` objects. pub struct SecretSpendingKey(pub(crate) [u8; 32]); -pub type IncomingViewingSecretKey = Scalar; -pub type OutgoingViewingSecretKey = Scalar; +pub type ViewingSecretKey = Scalar; #[derive(Serialize, Deserialize, Debug, Clone)] /// Private key holder. Produces public keys. Can produce account_id. Can produce shared secret for /// recepient. pub struct PrivateKeyHolder { pub nullifier_secret_key: NullifierSecretKey, - pub(crate) incoming_viewing_secret_key: IncomingViewingSecretKey, - pub outgoing_viewing_secret_key: OutgoingViewingSecretKey, + pub(crate) viewing_secret_key: ViewingSecretKey, } impl SeedHolder { @@ -75,44 +73,49 @@ impl SeedHolder { } impl SecretSpendingKey { - pub fn generate_nullifier_secret_key(&self) -> NullifierSecretKey { - let mut hasher = sha2::Sha256::new(); + pub fn generate_nullifier_secret_key(&self, index: Option) -> NullifierSecretKey { + let index = match index { + None => 0u32, + _ => index.expect("Expect a valid u32"), + }; - hasher.update("NSSA_keys"); + const PREFIX: &[u8; 8] = b"LEE/keys"; + const SUFFIX_1: &[u8; 1] = &[1]; + const SUFFIX_2: &[u8; 19] = &[0; 19]; + + let mut hasher = sha2::Sha256::new(); + hasher.update(PREFIX); hasher.update(self.0); - hasher.update([1u8]); - hasher.update([0u8; 22]); + hasher.update(SUFFIX_1); + hasher.update(index.to_le_bytes()); + hasher.update(SUFFIX_2); ::from(hasher.finalize_fixed()) } - pub fn generate_incoming_viewing_secret_key(&self) -> IncomingViewingSecretKey { - let mut hasher = sha2::Sha256::new(); + pub fn generate_viewing_secret_key(&self, index: Option) -> ViewingSecretKey { + let index = match index { + None => 0u32, + _ => index.expect("Expect a valid u32"), + }; + const PREFIX: &[u8; 8] = b"LEE/keys"; + const SUFFIX_1: &[u8; 1] = &[2]; + const SUFFIX_2: &[u8; 19] = &[0; 19]; - hasher.update("NSSA_keys"); + let mut hasher = sha2::Sha256::new(); + hasher.update(PREFIX); hasher.update(self.0); - hasher.update([2u8]); - hasher.update([0u8; 22]); + hasher.update(SUFFIX_1); + hasher.update(index.to_le_bytes()); + hasher.update(SUFFIX_2); hasher.finalize_fixed().into() } - pub fn generate_outgoing_viewing_secret_key(&self) -> OutgoingViewingSecretKey { - let mut hasher = sha2::Sha256::new(); - - hasher.update("NSSA_keys"); - hasher.update(self.0); - hasher.update([3u8]); - hasher.update([0u8; 22]); - - hasher.finalize_fixed().into() - } - - pub fn produce_private_key_holder(&self) -> PrivateKeyHolder { + pub fn produce_private_key_holder(&self, index: Option) -> PrivateKeyHolder { PrivateKeyHolder { - nullifier_secret_key: self.generate_nullifier_secret_key(), - incoming_viewing_secret_key: self.generate_incoming_viewing_secret_key(), - outgoing_viewing_secret_key: self.generate_outgoing_viewing_secret_key(), + nullifier_secret_key: self.generate_nullifier_secret_key(index), + viewing_secret_key: self.generate_viewing_secret_key(index), } } } @@ -122,8 +125,8 @@ impl PrivateKeyHolder { (&self.nullifier_secret_key).into() } - pub fn generate_incoming_viewing_public_key(&self) -> IncomingViewingPublicKey { - IncomingViewingPublicKey::from_scalar(self.incoming_viewing_secret_key) + pub fn generate_viewing_public_key(&self) -> ViewingPublicKey { + ViewingPublicKey::from_scalar(self.viewing_secret_key) } } @@ -131,6 +134,7 @@ impl PrivateKeyHolder { mod tests { use super::*; + // TODO? are these necessary? #[test] fn seed_generation_test() { let seed_holder = SeedHolder::new_os_random(); @@ -155,18 +159,7 @@ mod tests { let top_secret_key_holder = seed_holder.produce_top_secret_key_holder(); - let _ = top_secret_key_holder.generate_incoming_viewing_secret_key(); - } - - #[test] - fn ovs_generation_test() { - let seed_holder = SeedHolder::new_os_random(); - - assert_eq!(seed_holder.seed.len(), 64); - - let top_secret_key_holder = seed_holder.produce_top_secret_key_holder(); - - let _ = top_secret_key_holder.generate_outgoing_viewing_secret_key(); + let _ = top_secret_key_holder.generate_viewing_secret_key(None); } #[test] diff --git a/nssa/Cargo.toml b/nssa/Cargo.toml index 7efa2006..fe74b7a3 100644 --- a/nssa/Cargo.toml +++ b/nssa/Cargo.toml @@ -33,3 +33,4 @@ test-case = "3.3.1" [features] default = [] +prove = ["risc0-zkvm/prove"] diff --git a/nssa/core/src/account.rs b/nssa/core/src/account.rs index 4e523e9b..9bcdcd4b 100644 --- a/nssa/core/src/account.rs +++ b/nssa/core/src/account.rs @@ -159,6 +159,7 @@ mod tests { assert_eq!(new_acc_with_metadata.account_id, fingerprint); } + #[cfg(feature = "host")] #[test] fn parse_valid_account_id() { let base58_str = "11111111111111111111111111111111"; @@ -166,6 +167,7 @@ mod tests { assert_eq!(account_id.value, [0u8; 32]); } + #[cfg(feature = "host")] #[test] fn parse_invalid_base58() { let base58_str = "00".repeat(32); // invalid base58 chars @@ -173,6 +175,7 @@ mod tests { assert!(matches!(result, AccountIdError::InvalidBase58(_))); } + #[cfg(feature = "host")] #[test] fn parse_wrong_length_short() { let base58_str = "11".repeat(31); // 62 chars = 31 bytes @@ -180,6 +183,7 @@ mod tests { assert!(matches!(result, AccountIdError::InvalidLength(_))); } + #[cfg(feature = "host")] #[test] fn parse_wrong_length_long() { let base58_str = "11".repeat(33); // 66 chars = 33 bytes diff --git a/nssa/core/src/encryption/mod.rs b/nssa/core/src/encryption/mod.rs index c953d4d3..9ccbf2c8 100644 --- a/nssa/core/src/encryption/mod.rs +++ b/nssa/core/src/encryption/mod.rs @@ -10,7 +10,7 @@ use serde::{Deserialize, Serialize}; pub mod shared_key_derivation; #[cfg(feature = "host")] -pub use shared_key_derivation::{EphemeralPublicKey, EphemeralSecretKey, IncomingViewingPublicKey}; +pub use shared_key_derivation::{EphemeralPublicKey, EphemeralSecretKey, ViewingPublicKey}; use crate::{Commitment, account::Account}; diff --git a/nssa/core/src/encryption/shared_key_derivation.rs b/nssa/core/src/encryption/shared_key_derivation.rs index b1a572e5..e946d5e3 100644 --- a/nssa/core/src/encryption/shared_key_derivation.rs +++ b/nssa/core/src/encryption/shared_key_derivation.rs @@ -28,7 +28,7 @@ impl Secp256k1Point { pub type EphemeralSecretKey = Scalar; pub type EphemeralPublicKey = Secp256k1Point; -pub type IncomingViewingPublicKey = Secp256k1Point; +pub type ViewingPublicKey = Secp256k1Point; impl From<&EphemeralSecretKey> for EphemeralPublicKey { fn from(value: &EphemeralSecretKey) -> Self { Secp256k1Point::from_scalar(*value) diff --git a/nssa/core/src/nullifier.rs b/nssa/core/src/nullifier.rs index 5c420cb1..c019b185 100644 --- a/nssa/core/src/nullifier.rs +++ b/nssa/core/src/nullifier.rs @@ -10,7 +10,8 @@ pub struct NullifierPublicKey(pub [u8; 32]); impl From<&NullifierPublicKey> for AccountId { fn from(value: &NullifierPublicKey) -> Self { - const PRIVATE_ACCOUNT_ID_PREFIX: &[u8; 32] = b"/NSSA/v0.2/AccountId/Private/\x00\x00\x00"; + const PRIVATE_ACCOUNT_ID_PREFIX: &[u8; 32] = + b"/LEE/v0.3/AccountId/Private/\x00\x00\x00\x00"; let mut bytes = [0; 64]; bytes[0..32].copy_from_slice(PRIVATE_ACCOUNT_ID_PREFIX); @@ -28,9 +29,9 @@ impl AsRef<[u8]> for NullifierPublicKey { impl From<&NullifierSecretKey> for NullifierPublicKey { fn from(value: &NullifierSecretKey) -> Self { let mut bytes = Vec::new(); - const PREFIX: &[u8; 9] = b"NSSA_keys"; + const PREFIX: &[u8; 8] = b"LEE/keys"; const SUFFIX_1: &[u8; 1] = &[7]; - const SUFFIX_2: &[u8; 22] = &[0; 22]; + const SUFFIX_2: &[u8; 23] = &[0; 23]; bytes.extend_from_slice(PREFIX); bytes.extend_from_slice(value); bytes.extend_from_slice(SUFFIX_1); @@ -102,8 +103,8 @@ mod tests { 196, 134, 22, 224, 211, 237, 120, 136, 225, 188, 220, 249, 28, ]; let expected_npk = NullifierPublicKey([ - 202, 120, 42, 189, 194, 218, 78, 244, 31, 6, 108, 169, 29, 61, 22, 221, 69, 138, 197, - 161, 241, 39, 142, 242, 242, 50, 188, 201, 99, 28, 176, 238, + 78, 20, 20, 5, 177, 198, 233, 100, 175, 134, 174, 200, 24, 205, 68, 215, 130, 74, 35, + 54, 154, 184, 219, 42, 168, 106, 126, 147, 133, 244, 18, 218, ]); let npk = NullifierPublicKey::from(&nsk); assert_eq!(npk, expected_npk); @@ -117,8 +118,8 @@ mod tests { ]; let npk = NullifierPublicKey::from(&nsk); let expected_account_id = AccountId::new([ - 18, 153, 225, 78, 35, 214, 212, 205, 152, 83, 18, 246, 69, 41, 20, 217, 85, 1, 108, 7, - 87, 133, 181, 53, 247, 221, 174, 12, 112, 194, 34, 121, + 139, 72, 194, 222, 215, 187, 147, 56, 55, 35, 222, 205, 156, 12, 204, 227, 166, 44, 30, + 81, 186, 14, 167, 234, 28, 236, 32, 213, 125, 251, 193, 233, ]); let account_id = AccountId::from(&npk); diff --git a/nssa/src/privacy_preserving_transaction/circuit.rs b/nssa/src/privacy_preserving_transaction/circuit.rs index 1ebe90f3..9a28badd 100644 --- a/nssa/src/privacy_preserving_transaction/circuit.rs +++ b/nssa/src/privacy_preserving_transaction/circuit.rs @@ -223,7 +223,7 @@ mod tests { let expected_sender_pre = sender.clone(); let esk = [3; 32]; - let shared_secret = SharedSecretKey::new(&esk, &recipient_keys.ivk()); + let shared_secret = SharedSecretKey::new(&esk, &recipient_keys.vpk()); let (output, proof) = execute_and_prove( vec![sender, recipient], @@ -316,10 +316,10 @@ mod tests { ]; let esk_1 = [3; 32]; - let shared_secret_1 = SharedSecretKey::new(&esk_1, &sender_keys.ivk()); + let shared_secret_1 = SharedSecretKey::new(&esk_1, &sender_keys.vpk()); let esk_2 = [5; 32]; - let shared_secret_2 = SharedSecretKey::new(&esk_2, &recipient_keys.ivk()); + let shared_secret_2 = SharedSecretKey::new(&esk_2, &recipient_keys.vpk()); let (output, proof) = execute_and_prove( vec![sender_pre.clone(), recipient], diff --git a/nssa/src/privacy_preserving_transaction/message.rs b/nssa/src/privacy_preserving_transaction/message.rs index f507e65c..47b0aa42 100644 --- a/nssa/src/privacy_preserving_transaction/message.rs +++ b/nssa/src/privacy_preserving_transaction/message.rs @@ -2,7 +2,7 @@ use borsh::{BorshDeserialize, BorshSerialize}; use nssa_core::{ Commitment, CommitmentSetDigest, Nullifier, NullifierPublicKey, PrivacyPreservingCircuitOutput, account::{Account, Nonce}, - encryption::{Ciphertext, EphemeralPublicKey, IncomingViewingPublicKey}, + encryption::{Ciphertext, EphemeralPublicKey, ViewingPublicKey}, }; use sha2::{Digest, Sha256}; @@ -21,10 +21,10 @@ impl EncryptedAccountData { fn new( ciphertext: Ciphertext, npk: NullifierPublicKey, - ivk: IncomingViewingPublicKey, + vpk: ViewingPublicKey, epk: EphemeralPublicKey, ) -> Self { - let view_tag = Self::compute_view_tag(npk, ivk); + let view_tag = Self::compute_view_tag(npk, vpk); Self { ciphertext, epk, @@ -32,12 +32,12 @@ impl EncryptedAccountData { } } - /// Computes the tag as the first byte of SHA256("/NSSA/v0.2/ViewTag/" || Npk || Ivk) - pub fn compute_view_tag(npk: NullifierPublicKey, ivk: IncomingViewingPublicKey) -> ViewTag { + /// Computes the tag as the first byte of SHA256("/NSSA/v0.2/ViewTag/" || Npk || vpk) + pub fn compute_view_tag(npk: NullifierPublicKey, vpk: ViewingPublicKey) -> ViewTag { let mut hasher = Sha256::new(); hasher.update(b"/NSSA/v0.2/ViewTag/"); hasher.update(npk.to_byte_array()); - hasher.update(ivk.to_bytes()); + hasher.update(vpk.to_bytes()); let digest: [u8; 32] = hasher.finalize().into(); digest[0] } @@ -57,11 +57,7 @@ impl Message { pub fn try_from_circuit_output( public_account_ids: Vec, nonces: Vec, - public_keys: Vec<( - NullifierPublicKey, - IncomingViewingPublicKey, - EphemeralPublicKey, - )>, + public_keys: Vec<(NullifierPublicKey, ViewingPublicKey, EphemeralPublicKey)>, output: PrivacyPreservingCircuitOutput, ) -> Result { if public_keys.len() != output.ciphertexts.len() { @@ -74,8 +70,8 @@ impl Message { .ciphertexts .into_iter() .zip(public_keys) - .map(|(ciphertext, (npk, ivk, epk))| { - EncryptedAccountData::new(ciphertext, npk, ivk, epk) + .map(|(ciphertext, (npk, vpk, epk))| { + EncryptedAccountData::new(ciphertext, npk, vpk, epk) }) .collect(); Ok(Self { @@ -94,7 +90,7 @@ pub mod tests { use nssa_core::{ Commitment, EncryptionScheme, Nullifier, NullifierPublicKey, SharedSecretKey, account::Account, - encryption::{EphemeralPublicKey, IncomingViewingPublicKey}, + encryption::{EphemeralPublicKey, ViewingPublicKey}, }; use sha2::{Digest, Sha256}; @@ -142,21 +138,21 @@ pub mod tests { #[test] fn test_encrypted_account_data_constructor() { let npk = NullifierPublicKey::from(&[1; 32]); - let ivk = IncomingViewingPublicKey::from_scalar([2; 32]); + let vpk = ViewingPublicKey::from_scalar([2; 32]); let account = Account::default(); let commitment = Commitment::new(&npk, &account); let esk = [3; 32]; - let shared_secret = SharedSecretKey::new(&esk, &ivk); + let shared_secret = SharedSecretKey::new(&esk, &vpk); let epk = EphemeralPublicKey::from_scalar(esk); let ciphertext = EncryptionScheme::encrypt(&account, &shared_secret, &commitment, 2); let encrypted_account_data = - EncryptedAccountData::new(ciphertext.clone(), npk.clone(), ivk.clone(), epk.clone()); + EncryptedAccountData::new(ciphertext.clone(), npk.clone(), vpk.clone(), epk.clone()); let expected_view_tag = { let mut hasher = Sha256::new(); hasher.update(b"/NSSA/v0.2/ViewTag/"); hasher.update(npk.to_byte_array()); - hasher.update(ivk.to_bytes()); + hasher.update(vpk.to_bytes()); let digest: [u8; 32] = hasher.finalize().into(); digest[0] }; @@ -165,7 +161,7 @@ pub mod tests { assert_eq!(encrypted_account_data.epk, epk); assert_eq!( encrypted_account_data.view_tag, - EncryptedAccountData::compute_view_tag(npk, ivk) + EncryptedAccountData::compute_view_tag(npk, vpk) ); assert_eq!(encrypted_account_data.view_tag, expected_view_tag); } diff --git a/nssa/src/state.rs b/nssa/src/state.rs index cd45b403..f5ec2b46 100644 --- a/nssa/src/state.rs +++ b/nssa/src/state.rs @@ -315,7 +315,7 @@ pub mod tests { use nssa_core::{ Commitment, Nullifier, NullifierPublicKey, NullifierSecretKey, SharedSecretKey, account::{Account, AccountId, AccountWithMetadata, Nonce, data::Data}, - encryption::{EphemeralPublicKey, IncomingViewingPublicKey, Scalar}, + encryption::{EphemeralPublicKey, Scalar, ViewingPublicKey}, program::{PdaSeed, ProgramId}, }; use token_core::{TokenDefinition, TokenHolding}; @@ -864,7 +864,7 @@ pub mod tests { pub struct TestPrivateKeys { pub nsk: NullifierSecretKey, - pub isk: Scalar, + pub vsk: Scalar, } impl TestPrivateKeys { @@ -872,22 +872,22 @@ pub mod tests { NullifierPublicKey::from(&self.nsk) } - pub fn ivk(&self) -> IncomingViewingPublicKey { - IncomingViewingPublicKey::from_scalar(self.isk) + pub fn vpk(&self) -> ViewingPublicKey { + ViewingPublicKey::from_scalar(self.vsk) } } pub fn test_private_account_keys_1() -> TestPrivateKeys { TestPrivateKeys { nsk: [13; 32], - isk: [31; 32], + vsk: [31; 32], } } pub fn test_private_account_keys_2() -> TestPrivateKeys { TestPrivateKeys { nsk: [38; 32], - isk: [83; 32], + vsk: [83; 32], } } @@ -908,7 +908,7 @@ pub mod tests { let recipient = AccountWithMetadata::new(Account::default(), false, &recipient_keys.npk()); let esk = [3; 32]; - let shared_secret = SharedSecretKey::new(&esk, &recipient_keys.ivk()); + let shared_secret = SharedSecretKey::new(&esk, &recipient_keys.vpk()); let epk = EphemeralPublicKey::from_scalar(esk); let (output, proof) = circuit::execute_and_prove( @@ -926,7 +926,7 @@ pub mod tests { let message = Message::try_from_circuit_output( vec![sender_keys.account_id()], vec![sender_nonce], - vec![(recipient_keys.npk(), recipient_keys.ivk(), epk)], + vec![(recipient_keys.npk(), recipient_keys.vpk(), epk)], output, ) .unwrap(); @@ -951,11 +951,11 @@ pub mod tests { AccountWithMetadata::new(Account::default(), false, &recipient_keys.npk()); let esk_1 = [3; 32]; - let shared_secret_1 = SharedSecretKey::new(&esk_1, &sender_keys.ivk()); + let shared_secret_1 = SharedSecretKey::new(&esk_1, &sender_keys.vpk()); let epk_1 = EphemeralPublicKey::from_scalar(esk_1); let esk_2 = [3; 32]; - let shared_secret_2 = SharedSecretKey::new(&esk_2, &recipient_keys.ivk()); + let shared_secret_2 = SharedSecretKey::new(&esk_2, &recipient_keys.vpk()); let epk_2 = EphemeralPublicKey::from_scalar(esk_2); let (output, proof) = circuit::execute_and_prove( @@ -977,8 +977,8 @@ pub mod tests { vec![], vec![], vec![ - (sender_keys.npk(), sender_keys.ivk(), epk_1), - (recipient_keys.npk(), recipient_keys.ivk(), epk_2), + (sender_keys.npk(), sender_keys.vpk(), epk_1), + (recipient_keys.npk(), recipient_keys.vpk(), epk_2), ], output, ) @@ -1008,7 +1008,7 @@ pub mod tests { ); let esk = [3; 32]; - let shared_secret = SharedSecretKey::new(&esk, &sender_keys.ivk()); + let shared_secret = SharedSecretKey::new(&esk, &sender_keys.vpk()); let epk = EphemeralPublicKey::from_scalar(esk); let (output, proof) = circuit::execute_and_prove( @@ -1026,7 +1026,7 @@ pub mod tests { let message = Message::try_from_circuit_output( vec![*recipient_account_id], vec![], - vec![(sender_keys.npk(), sender_keys.ivk(), epk)], + vec![(sender_keys.npk(), sender_keys.vpk(), epk)], output, ) .unwrap(); @@ -1538,11 +1538,11 @@ pub mod tests { vec![ ( sender_keys.npk(), - SharedSecretKey::new(&[55; 32], &sender_keys.ivk()), + SharedSecretKey::new(&[55; 32], &sender_keys.vpk()), ), ( recipient_keys.npk(), - SharedSecretKey::new(&[56; 32], &recipient_keys.ivk()), + SharedSecretKey::new(&[56; 32], &recipient_keys.vpk()), ), ], vec![sender_keys.nsk], @@ -1572,7 +1572,7 @@ pub mod tests { // Setting only one key for an execution with two private accounts. let private_account_keys = [( sender_keys.npk(), - SharedSecretKey::new(&[55; 32], &sender_keys.ivk()), + SharedSecretKey::new(&[55; 32], &sender_keys.vpk()), )]; let result = execute_and_prove( vec![private_account_1, private_account_2], @@ -1615,11 +1615,11 @@ pub mod tests { vec![ ( sender_keys.npk(), - SharedSecretKey::new(&[55; 32], &sender_keys.ivk()), + SharedSecretKey::new(&[55; 32], &sender_keys.vpk()), ), ( recipient_keys.npk(), - SharedSecretKey::new(&[56; 32], &recipient_keys.ivk()), + SharedSecretKey::new(&[56; 32], &recipient_keys.vpk()), ), ], vec![sender_keys.nsk], @@ -1657,11 +1657,11 @@ pub mod tests { vec![ ( sender_keys.npk(), - SharedSecretKey::new(&[55; 32], &sender_keys.ivk()), + SharedSecretKey::new(&[55; 32], &sender_keys.vpk()), ), ( recipient_keys.npk(), - SharedSecretKey::new(&[56; 32], &recipient_keys.ivk()), + SharedSecretKey::new(&[56; 32], &recipient_keys.vpk()), ), ], private_account_nsks.to_vec(), @@ -1693,12 +1693,12 @@ pub mod tests { // First private account is the sender ( sender_keys.npk(), - SharedSecretKey::new(&[55; 32], &sender_keys.ivk()), + SharedSecretKey::new(&[55; 32], &sender_keys.vpk()), ), // Second private account is the recipient ( recipient_keys.npk(), - SharedSecretKey::new(&[56; 32], &recipient_keys.ivk()), + SharedSecretKey::new(&[56; 32], &recipient_keys.vpk()), ), ]; @@ -1753,11 +1753,11 @@ pub mod tests { vec![ ( sender_keys.npk(), - SharedSecretKey::new(&[55; 32], &sender_keys.ivk()), + SharedSecretKey::new(&[55; 32], &sender_keys.vpk()), ), ( recipient_keys.npk(), - SharedSecretKey::new(&[56; 32], &recipient_keys.ivk()), + SharedSecretKey::new(&[56; 32], &recipient_keys.vpk()), ), ], vec![sender_keys.nsk], @@ -1801,11 +1801,11 @@ pub mod tests { vec![ ( sender_keys.npk(), - SharedSecretKey::new(&[55; 32], &sender_keys.ivk()), + SharedSecretKey::new(&[55; 32], &sender_keys.vpk()), ), ( recipient_keys.npk(), - SharedSecretKey::new(&[56; 32], &recipient_keys.ivk()), + SharedSecretKey::new(&[56; 32], &recipient_keys.vpk()), ), ], vec![sender_keys.nsk], @@ -1848,11 +1848,11 @@ pub mod tests { vec![ ( sender_keys.npk(), - SharedSecretKey::new(&[55; 32], &sender_keys.ivk()), + SharedSecretKey::new(&[55; 32], &sender_keys.vpk()), ), ( recipient_keys.npk(), - SharedSecretKey::new(&[56; 32], &recipient_keys.ivk()), + SharedSecretKey::new(&[56; 32], &recipient_keys.vpk()), ), ], vec![sender_keys.nsk], @@ -1895,11 +1895,11 @@ pub mod tests { vec![ ( sender_keys.npk(), - SharedSecretKey::new(&[55; 32], &sender_keys.ivk()), + SharedSecretKey::new(&[55; 32], &sender_keys.vpk()), ), ( recipient_keys.npk(), - SharedSecretKey::new(&[56; 32], &recipient_keys.ivk()), + SharedSecretKey::new(&[56; 32], &recipient_keys.vpk()), ), ], vec![sender_keys.nsk], @@ -1940,11 +1940,11 @@ pub mod tests { vec![ ( sender_keys.npk(), - SharedSecretKey::new(&[55; 32], &sender_keys.ivk()), + SharedSecretKey::new(&[55; 32], &sender_keys.vpk()), ), ( recipient_keys.npk(), - SharedSecretKey::new(&[56; 32], &recipient_keys.ivk()), + SharedSecretKey::new(&[56; 32], &recipient_keys.vpk()), ), ], vec![sender_keys.nsk], @@ -2013,11 +2013,11 @@ pub mod tests { vec![ ( sender_keys.npk(), - SharedSecretKey::new(&[55; 32], &sender_keys.ivk()), + SharedSecretKey::new(&[55; 32], &sender_keys.vpk()), ), ( recipient_keys.npk(), - SharedSecretKey::new(&[56; 32], &recipient_keys.ivk()), + SharedSecretKey::new(&[56; 32], &recipient_keys.vpk()), ), ], vec![sender_keys.nsk], @@ -2050,15 +2050,15 @@ pub mod tests { let private_account_keys = [ ( sender_keys.npk(), - SharedSecretKey::new(&[55; 32], &sender_keys.ivk()), + SharedSecretKey::new(&[55; 32], &sender_keys.vpk()), ), ( recipient_keys.npk(), - SharedSecretKey::new(&[56; 32], &recipient_keys.ivk()), + SharedSecretKey::new(&[56; 32], &recipient_keys.vpk()), ), ( sender_keys.npk(), - SharedSecretKey::new(&[57; 32], &sender_keys.ivk()), + SharedSecretKey::new(&[57; 32], &sender_keys.vpk()), ), ]; let result = execute_and_prove( @@ -2105,11 +2105,11 @@ pub mod tests { vec![ ( sender_keys.npk(), - SharedSecretKey::new(&[55; 32], &sender_keys.ivk()), + SharedSecretKey::new(&[55; 32], &sender_keys.vpk()), ), ( recipient_keys.npk(), - SharedSecretKey::new(&[56; 32], &recipient_keys.ivk()), + SharedSecretKey::new(&[56; 32], &recipient_keys.vpk()), ), ], private_account_nsks.to_vec(), @@ -2192,7 +2192,7 @@ pub mod tests { let visibility_mask = [1, 1]; let private_account_nsks = [sender_keys.nsk, sender_keys.nsk]; let private_account_membership_proofs = [Some((1, vec![])), Some((1, vec![]))]; - let shared_secret = SharedSecretKey::new(&[55; 32], &sender_keys.ivk()); + let shared_secret = SharedSecretKey::new(&[55; 32], &sender_keys.vpk()); let result = execute_and_prove( vec![private_account_1.clone(), private_account_1], Program::serialize_instruction(100u128).unwrap(), @@ -3809,11 +3809,11 @@ pub mod tests { ); let from_esk = [3; 32]; - let from_ss = SharedSecretKey::new(&from_esk, &from_keys.ivk()); + let from_ss = SharedSecretKey::new(&from_esk, &from_keys.vpk()); let from_epk = EphemeralPublicKey::from_scalar(from_esk); let to_esk = [3; 32]; - let to_ss = SharedSecretKey::new(&to_esk, &to_keys.ivk()); + let to_ss = SharedSecretKey::new(&to_esk, &to_keys.vpk()); let to_epk = EphemeralPublicKey::from_scalar(to_esk); let mut dependencies = HashMap::new(); @@ -3858,8 +3858,8 @@ pub mod tests { vec![], vec![], vec![ - (to_keys.npk(), to_keys.ivk(), to_epk), - (from_keys.npk(), from_keys.ivk(), from_epk), + (to_keys.npk(), to_keys.vpk(), to_epk), + (from_keys.npk(), from_keys.vpk(), from_epk), ], output, ) @@ -4069,7 +4069,7 @@ pub mod tests { // Set up parameters for the new account let esk = [3; 32]; - let shared_secret = SharedSecretKey::new(&esk, &private_keys.ivk()); + let shared_secret = SharedSecretKey::new(&esk, &private_keys.vpk()); let epk = EphemeralPublicKey::from_scalar(esk); // Balance to initialize the account with (0 for a new account) @@ -4094,7 +4094,7 @@ pub mod tests { let message = Message::try_from_circuit_output( vec![], vec![], - vec![(private_keys.npk(), private_keys.ivk(), epk)], + vec![(private_keys.npk(), private_keys.vpk(), epk)], output, ) .unwrap(); @@ -4124,7 +4124,7 @@ pub mod tests { // Set up parameters for claiming the new account let esk = [3; 32]; - let shared_secret = SharedSecretKey::new(&esk, &private_keys.ivk()); + let shared_secret = SharedSecretKey::new(&esk, &private_keys.vpk()); let epk = EphemeralPublicKey::from_scalar(esk); let balance: u128 = 0; @@ -4146,7 +4146,7 @@ pub mod tests { let message = Message::try_from_circuit_output( vec![], vec![], - vec![(private_keys.npk(), private_keys.ivk(), epk)], + vec![(private_keys.npk(), private_keys.vpk(), epk)], output, ) .unwrap(); @@ -4174,7 +4174,7 @@ pub mod tests { let noop_program = Program::noop(); let esk2 = [4; 32]; - let shared_secret2 = SharedSecretKey::new(&esk2, &private_keys.ivk()); + let shared_secret2 = SharedSecretKey::new(&esk2, &private_keys.vpk()); let nonce2 = 0xdeadbeef2; @@ -4256,7 +4256,7 @@ pub mod tests { vec![2], vec![( sender_keys.npk(), - SharedSecretKey::new(&[3; 32], &sender_keys.ivk()), + SharedSecretKey::new(&[3; 32], &sender_keys.vpk()), )], vec![sender_keys.nsk], vec![Some((0, vec![]))], @@ -4284,7 +4284,7 @@ pub mod tests { vec![2], vec![( sender_keys.npk(), - SharedSecretKey::new(&[3; 32], &sender_keys.ivk()), + SharedSecretKey::new(&[3; 32], &sender_keys.vpk()), )], vec![sender_keys.nsk], vec![Some((0, vec![]))], @@ -4327,7 +4327,7 @@ pub mod tests { let instruction = (balance_to_transfer, auth_transfers.id()); let recipient_esk = [3; 32]; - let recipient = SharedSecretKey::new(&recipient_esk, &recipient_keys.ivk()); + let recipient = SharedSecretKey::new(&recipient_esk, &recipient_keys.vpk()); let mut dependencies = HashMap::new(); dependencies.insert(auth_transfers.id(), auth_transfers); diff --git a/programs/amm/src/add.rs b/programs/amm/src/add.rs index cbecaa34..28b4661c 100644 --- a/programs/amm/src/add.rs +++ b/programs/amm/src/add.rs @@ -118,7 +118,7 @@ pub fn add_liquidity( assert!(delta_lp != 0, "Payable LP must be nonzero"); assert!( - delta_lp >= min_amount_liquidity.into(), + delta_lp >= min_amount_liquidity.get(), "Payable LP is less than provided minimum LP amount" ); diff --git a/storage/src/indexer.rs b/storage/src/indexer.rs index ea98155b..98a9a629 100644 --- a/storage/src/indexer.rs +++ b/storage/src/indexer.rs @@ -870,15 +870,15 @@ mod tests { fn acc1() -> AccountId { AccountId::new([ - 208, 122, 210, 232, 75, 39, 250, 0, 194, 98, 240, 161, 238, 160, 255, 53, 202, 9, 115, - 84, 126, 106, 16, 111, 114, 241, 147, 194, 220, 131, 139, 68, + 148, 179, 206, 253, 199, 51, 82, 86, 232, 2, 152, 122, 80, 243, 54, 207, 237, 112, 83, + 153, 44, 59, 204, 49, 128, 84, 160, 227, 216, 149, 97, 102, ]) } fn acc2() -> AccountId { AccountId::new([ - 231, 174, 119, 197, 239, 26, 5, 153, 147, 68, 175, 73, 159, 199, 138, 23, 5, 57, 141, - 98, 237, 6, 207, 46, 20, 121, 246, 222, 248, 154, 57, 188, + 30, 145, 107, 3, 207, 73, 192, 230, 160, 63, 238, 207, 18, 69, 54, 216, 103, 244, 92, + 94, 124, 248, 42, 16, 141, 19, 119, 18, 14, 226, 140, 204, ]) } diff --git a/wallet-ffi/Cargo.toml b/wallet-ffi/Cargo.toml index 4305226b..693a0120 100644 --- a/wallet-ffi/Cargo.toml +++ b/wallet-ffi/Cargo.toml @@ -19,3 +19,7 @@ cbindgen = "0.29" [dev-dependencies] tempfile = "3" + +[features] +default = [] +prove = ["nssa/prove"] diff --git a/wallet-ffi/src/account.rs b/wallet-ffi/src/account.rs index 1a90683a..08e0138a 100644 --- a/wallet-ffi/src/account.rs +++ b/wallet-ffi/src/account.rs @@ -354,6 +354,61 @@ pub unsafe extern "C" fn wallet_ffi_get_account_public( WalletFfiError::Success } +/// Get full private account data from the local storage. +/// +/// # Parameters +/// - `handle`: Valid wallet handle +/// - `account_id`: The account ID (32 bytes) +/// - `out_account`: Output pointer for account data +/// +/// # Returns +/// - `Success` on successful query +/// - Error code on failure +/// +/// # Memory +/// The account data must be freed with `wallet_ffi_free_account_data()`. +/// +/// # Safety +/// - `handle` must be a valid wallet handle from `wallet_ffi_create_new` or `wallet_ffi_open` +/// - `account_id` must be a valid pointer to a `FfiBytes32` struct +/// - `out_account` must be a valid pointer to a `FfiAccount` struct +#[no_mangle] +pub unsafe extern "C" fn wallet_ffi_get_account_private( + handle: *mut WalletHandle, + account_id: *const FfiBytes32, + out_account: *mut FfiAccount, +) -> WalletFfiError { + let wrapper = match get_wallet(handle) { + Ok(w) => w, + Err(e) => return e, + }; + + if account_id.is_null() || out_account.is_null() { + print_error("Null pointer argument"); + return WalletFfiError::NullPointer; + } + + let wallet = match wrapper.core.lock() { + Ok(w) => w, + Err(e) => { + print_error(format!("Failed to lock wallet: {}", e)); + return WalletFfiError::InternalError; + } + }; + + let account_id = AccountId::new(unsafe { (*account_id).data }); + + let Some(account) = wallet.get_account_private(account_id) else { + return WalletFfiError::AccountNotFound; + }; + + unsafe { + *out_account = account.into(); + } + + WalletFfiError::Success +} + /// Free account data returned by `wallet_ffi_get_account_public`. /// /// # Safety diff --git a/wallet-ffi/src/keys.rs b/wallet-ffi/src/keys.rs index 1bd51c54..bd26fa8c 100644 --- a/wallet-ffi/src/keys.rs +++ b/wallet-ffi/src/keys.rs @@ -73,7 +73,7 @@ pub unsafe extern "C" fn wallet_ffi_get_public_account_key( /// Get keys for a private account. /// -/// Returns the nullifier public key (NPK) and incoming viewing public key (IPK) +/// Returns the nullifier public key (NPK) and viewing public key (VPK) /// for the specified private account. These keys are safe to share publicly. /// /// # Parameters @@ -130,17 +130,17 @@ pub unsafe extern "C" fn wallet_ffi_get_private_account_keys( // NPK is a 32-byte array let npk_bytes = key_chain.nullifer_public_key.0; - // IPK is a compressed secp256k1 point (33 bytes) - let ipk_bytes = key_chain.incoming_viewing_public_key.to_bytes(); - let ipk_len = ipk_bytes.len(); - let ipk_vec = ipk_bytes.to_vec(); - let ipk_boxed = ipk_vec.into_boxed_slice(); - let ipk_ptr = Box::into_raw(ipk_boxed) as *const u8; + // VPK is a compressed secp256k1 point (33 bytes) + let vpk_bytes = key_chain.viewing_public_key.to_bytes(); + let vpk_len = vpk_bytes.len(); + let vpk_vec = vpk_bytes.to_vec(); + let vpk_boxed = vpk_vec.into_boxed_slice(); + let vpk_ptr = Box::into_raw(vpk_boxed) as *const u8; unsafe { (*out_keys).nullifier_public_key.data = npk_bytes; - (*out_keys).incoming_viewing_public_key = ipk_ptr; - (*out_keys).incoming_viewing_public_key_len = ipk_len; + (*out_keys).viewing_public_key = vpk_ptr; + (*out_keys).viewing_public_key_len = vpk_len; } WalletFfiError::Success @@ -159,10 +159,10 @@ pub unsafe extern "C" fn wallet_ffi_free_private_account_keys(keys: *mut FfiPriv unsafe { let keys = &*keys; - if !keys.incoming_viewing_public_key.is_null() && keys.incoming_viewing_public_key_len > 0 { + if !keys.viewing_public_key.is_null() && keys.viewing_public_key_len > 0 { let slice = std::slice::from_raw_parts_mut( - keys.incoming_viewing_public_key as *mut u8, - keys.incoming_viewing_public_key_len, + keys.viewing_public_key as *mut u8, + keys.viewing_public_key_len, ); drop(Box::from_raw(slice as *mut [u8])); } diff --git a/wallet-ffi/src/transfer.rs b/wallet-ffi/src/transfer.rs index a7f970b9..2c0ccc7c 100644 --- a/wallet-ffi/src/transfer.rs +++ b/wallet-ffi/src/transfer.rs @@ -11,6 +11,7 @@ use crate::{ error::{print_error, WalletFfiError}, types::{FfiBytes32, FfiTransferResult, WalletHandle}, wallet::get_wallet, + FfiPrivateAccountKeys, }; /// Send a public token transfer. @@ -89,13 +90,270 @@ pub unsafe extern "C" fn wallet_ffi_transfer_public( (*out_result).tx_hash = ptr::null_mut(); (*out_result).success = false; } - match e { - ExecutionFailureKind::InsufficientFundsError => WalletFfiError::InsufficientFunds, - ExecutionFailureKind::KeyNotFoundError => WalletFfiError::KeyNotFound, - ExecutionFailureKind::SequencerError => WalletFfiError::NetworkError, - ExecutionFailureKind::SequencerClientError(_) => WalletFfiError::NetworkError, - _ => WalletFfiError::InternalError, + map_execution_error(e) + } + Err(e) => e, + } +} + +/// Send a shielded token transfer. +/// +/// Transfers tokens from a public account to a private account. +/// +/// # Parameters +/// - `handle`: Valid wallet handle +/// - `from`: Source account ID (must be owned by this wallet) +/// - `to_keys`: Destination account keys +/// - `amount`: Amount to transfer as little-endian [u8; 16] +/// - `out_result`: Output pointer for transfer result +/// +/// # Returns +/// - `Success` if the transfer was submitted successfully +/// - `InsufficientFunds` if the source account doesn't have enough balance +/// - `KeyNotFound` if the source account's signing key is not in this wallet +/// - Error code on other failures +/// +/// # Memory +/// The result must be freed with `wallet_ffi_free_transfer_result()`. +/// +/// # Safety +/// - `handle` must be a valid wallet handle from `wallet_ffi_create_new` or `wallet_ffi_open` +/// - `from` must be a valid pointer to a `FfiBytes32` struct +/// - `to_keys` must be a valid pointer to a `FfiPrivateAccountKeys` struct +/// - `amount` must be a valid pointer to a `[u8; 16]` array +/// - `out_result` must be a valid pointer to a `FfiTransferResult` struct +#[no_mangle] +pub unsafe extern "C" fn wallet_ffi_transfer_shielded( + handle: *mut WalletHandle, + from: *const FfiBytes32, + to_keys: *const FfiPrivateAccountKeys, + amount: *const [u8; 16], + out_result: *mut FfiTransferResult, +) -> WalletFfiError { + let wrapper = match get_wallet(handle) { + Ok(w) => w, + Err(e) => return e, + }; + + if from.is_null() || to_keys.is_null() || amount.is_null() || out_result.is_null() { + print_error("Null pointer argument"); + return WalletFfiError::NullPointer; + } + + let wallet = match wrapper.core.lock() { + Ok(w) => w, + Err(e) => { + print_error(format!("Failed to lock wallet: {}", e)); + return WalletFfiError::InternalError; + } + }; + + let from_id = AccountId::new(unsafe { (*from).data }); + let to_npk = (*to_keys).npk(); + let to_vpk = match (*to_keys).vpk() { + Ok(vpk) => vpk, + Err(e) => { + print_error("Invalid viewing key"); + return e; + } + }; + let amount = u128::from_le_bytes(unsafe { *amount }); + + let transfer = NativeTokenTransfer(&wallet); + + match block_on( + transfer.send_shielded_transfer_to_outer_account(from_id, to_npk, to_vpk, amount), + ) { + Ok(Ok((response, _shared_key))) => { + let tx_hash = CString::new(response.tx_hash) + .map(|s| s.into_raw()) + .unwrap_or(ptr::null_mut()); + + unsafe { + (*out_result).tx_hash = tx_hash; + (*out_result).success = true; } + WalletFfiError::Success + } + Ok(Err(e)) => { + print_error(format!("Transfer failed: {:?}", e)); + unsafe { + (*out_result).tx_hash = ptr::null_mut(); + (*out_result).success = false; + } + map_execution_error(e) + } + Err(e) => e, + } +} + +/// Send a deshielded token transfer. +/// +/// Transfers tokens from a private account to a public account. +/// +/// # Parameters +/// - `handle`: Valid wallet handle +/// - `from`: Source account ID (must be owned by this wallet) +/// - `to`: Destination account ID +/// - `amount`: Amount to transfer as little-endian [u8; 16] +/// - `out_result`: Output pointer for transfer result +/// +/// # Returns +/// - `Success` if the transfer was submitted successfully +/// - `InsufficientFunds` if the source account doesn't have enough balance +/// - `KeyNotFound` if the source account's signing key is not in this wallet +/// - Error code on other failures +/// +/// # Memory +/// The result must be freed with `wallet_ffi_free_transfer_result()`. +/// +/// # Safety +/// - `handle` must be a valid wallet handle from `wallet_ffi_create_new` or `wallet_ffi_open` +/// - `from` must be a valid pointer to a `FfiBytes32` struct +/// - `to` must be a valid pointer to a `FfiBytes32` struct +/// - `amount` must be a valid pointer to a `[u8; 16]` array +/// - `out_result` must be a valid pointer to a `FfiTransferResult` struct +#[no_mangle] +pub unsafe extern "C" fn wallet_ffi_transfer_deshielded( + handle: *mut WalletHandle, + from: *const FfiBytes32, + to: *const FfiBytes32, + amount: *const [u8; 16], + out_result: *mut FfiTransferResult, +) -> WalletFfiError { + let wrapper = match get_wallet(handle) { + Ok(w) => w, + Err(e) => return e, + }; + + if from.is_null() || to.is_null() || amount.is_null() || out_result.is_null() { + print_error("Null pointer argument"); + return WalletFfiError::NullPointer; + } + + let wallet = match wrapper.core.lock() { + Ok(w) => w, + Err(e) => { + print_error(format!("Failed to lock wallet: {}", e)); + return WalletFfiError::InternalError; + } + }; + + let from_id = AccountId::new(unsafe { (*from).data }); + let to_id = AccountId::new(unsafe { (*to).data }); + let amount = u128::from_le_bytes(unsafe { *amount }); + + let transfer = NativeTokenTransfer(&wallet); + + match block_on(transfer.send_deshielded_transfer(from_id, to_id, amount)) { + Ok(Ok((response, _shared_key))) => { + let tx_hash = CString::new(response.tx_hash) + .map(|s| s.into_raw()) + .unwrap_or(ptr::null_mut()); + + unsafe { + (*out_result).tx_hash = tx_hash; + (*out_result).success = true; + } + WalletFfiError::Success + } + Ok(Err(e)) => { + print_error(format!("Transfer failed: {:?}", e)); + unsafe { + (*out_result).tx_hash = ptr::null_mut(); + (*out_result).success = false; + } + map_execution_error(e) + } + Err(e) => e, + } +} + +/// Send a private token transfer. +/// +/// Transfers tokens from a private account to another private account. +/// +/// # Parameters +/// - `handle`: Valid wallet handle +/// - `from`: Source account ID (must be owned by this wallet) +/// - `to_keys`: Destination account keys +/// - `amount`: Amount to transfer as little-endian [u8; 16] +/// - `out_result`: Output pointer for transfer result +/// +/// # Returns +/// - `Success` if the transfer was submitted successfully +/// - `InsufficientFunds` if the source account doesn't have enough balance +/// - `KeyNotFound` if the source account's signing key is not in this wallet +/// - Error code on other failures +/// +/// # Memory +/// The result must be freed with `wallet_ffi_free_transfer_result()`. +/// +/// # Safety +/// - `handle` must be a valid wallet handle from `wallet_ffi_create_new` or `wallet_ffi_open` +/// - `from` must be a valid pointer to a `FfiBytes32` struct +/// - `to_keys` must be a valid pointer to a `FfiPrivateAccountKeys` struct +/// - `amount` must be a valid pointer to a `[u8; 16]` array +/// - `out_result` must be a valid pointer to a `FfiTransferResult` struct +#[no_mangle] +pub unsafe extern "C" fn wallet_ffi_transfer_private( + handle: *mut WalletHandle, + from: *const FfiBytes32, + to_keys: *const FfiPrivateAccountKeys, + amount: *const [u8; 16], + out_result: *mut FfiTransferResult, +) -> WalletFfiError { + let wrapper = match get_wallet(handle) { + Ok(w) => w, + Err(e) => return e, + }; + + if from.is_null() || to_keys.is_null() || amount.is_null() || out_result.is_null() { + print_error("Null pointer argument"); + return WalletFfiError::NullPointer; + } + + let wallet = match wrapper.core.lock() { + Ok(w) => w, + Err(e) => { + print_error(format!("Failed to lock wallet: {}", e)); + return WalletFfiError::InternalError; + } + }; + + let from_id = AccountId::new(unsafe { (*from).data }); + let to_npk = (*to_keys).npk(); + let to_vpk = match (*to_keys).vpk() { + Ok(vpk) => vpk, + Err(e) => { + print_error("Invalid viewing key"); + return e; + } + }; + let amount = u128::from_le_bytes(unsafe { *amount }); + + let transfer = NativeTokenTransfer(&wallet); + + match block_on(transfer.send_private_transfer_to_outer_account(from_id, to_npk, to_vpk, amount)) + { + Ok(Ok((response, _shared_key))) => { + let tx_hash = CString::new(response.tx_hash) + .map(|s| s.into_raw()) + .unwrap_or(ptr::null_mut()); + + unsafe { + (*out_result).tx_hash = tx_hash; + (*out_result).success = true; + } + WalletFfiError::Success + } + Ok(Err(e)) => { + print_error(format!("Transfer failed: {:?}", e)); + unsafe { + (*out_result).tx_hash = ptr::null_mut(); + (*out_result).success = false; + } + map_execution_error(e) } Err(e) => e, } @@ -168,12 +426,80 @@ pub unsafe extern "C" fn wallet_ffi_register_public_account( (*out_result).tx_hash = ptr::null_mut(); (*out_result).success = false; } - match e { - ExecutionFailureKind::KeyNotFoundError => WalletFfiError::KeyNotFound, - ExecutionFailureKind::SequencerError => WalletFfiError::NetworkError, - ExecutionFailureKind::SequencerClientError(_) => WalletFfiError::NetworkError, - _ => WalletFfiError::InternalError, + map_execution_error(e) + } + Err(e) => e, + } +} + +/// Register a private account on the network. +/// +/// This initializes a private account. The account must be +/// owned by this wallet. +/// +/// # Parameters +/// - `handle`: Valid wallet handle +/// - `account_id`: Account ID to register +/// - `out_result`: Output pointer for registration result +/// +/// # Returns +/// - `Success` if the registration was submitted successfully +/// - Error code on failure +/// +/// # Memory +/// The result must be freed with `wallet_ffi_free_transfer_result()`. +/// +/// # Safety +/// - `handle` must be a valid wallet handle from `wallet_ffi_create_new` or `wallet_ffi_open` +/// - `account_id` must be a valid pointer to a `FfiBytes32` struct +/// - `out_result` must be a valid pointer to a `FfiTransferResult` struct +#[no_mangle] +pub unsafe extern "C" fn wallet_ffi_register_private_account( + handle: *mut WalletHandle, + account_id: *const FfiBytes32, + out_result: *mut FfiTransferResult, +) -> WalletFfiError { + let wrapper = match get_wallet(handle) { + Ok(w) => w, + Err(e) => return e, + }; + + if account_id.is_null() || out_result.is_null() { + print_error("Null pointer argument"); + return WalletFfiError::NullPointer; + } + + let wallet = match wrapper.core.lock() { + Ok(w) => w, + Err(e) => { + print_error(format!("Failed to lock wallet: {}", e)); + return WalletFfiError::InternalError; + } + }; + + let account_id = AccountId::new(unsafe { (*account_id).data }); + + let transfer = NativeTokenTransfer(&wallet); + + match block_on(transfer.register_account_private(account_id)) { + Ok(Ok((res, _secret))) => { + let tx_hash = CString::new(res.tx_hash) + .map(|s| s.into_raw()) + .unwrap_or(ptr::null_mut()); + + unsafe { + (*out_result).tx_hash = tx_hash; + (*out_result).success = true; } + WalletFfiError::Success + } + Ok(Err(e)) => { + print_error(format!("Registration failed: {:?}", e)); + unsafe { + (*out_result).tx_hash = ptr::null_mut(); + (*out_result).success = false; + } + map_execution_error(e) } Err(e) => e, } @@ -197,3 +523,13 @@ pub unsafe extern "C" fn wallet_ffi_free_transfer_result(result: *mut FfiTransfe } } } + +fn map_execution_error(e: ExecutionFailureKind) -> WalletFfiError { + match e { + ExecutionFailureKind::InsufficientFundsError => WalletFfiError::InsufficientFunds, + ExecutionFailureKind::KeyNotFoundError => WalletFfiError::KeyNotFound, + ExecutionFailureKind::SequencerError => WalletFfiError::NetworkError, + ExecutionFailureKind::SequencerClientError(_) => WalletFfiError::NetworkError, + _ => WalletFfiError::InternalError, + } +} diff --git a/wallet-ffi/src/types.rs b/wallet-ffi/src/types.rs index fe16ce73..e99286c7 100644 --- a/wallet-ffi/src/types.rs +++ b/wallet-ffi/src/types.rs @@ -72,18 +72,18 @@ impl Default for FfiAccount { pub struct FfiPrivateAccountKeys { /// Nullifier public key (32 bytes) pub nullifier_public_key: FfiBytes32, - /// Incoming viewing public key (compressed secp256k1 point) - pub incoming_viewing_public_key: *const u8, - /// Length of incoming viewing public key (typically 33 bytes) - pub incoming_viewing_public_key_len: usize, + /// viewing public key (compressed secp256k1 point) + pub viewing_public_key: *const u8, + /// Length of viewing public key (typically 33 bytes) + pub viewing_public_key_len: usize, } impl Default for FfiPrivateAccountKeys { fn default() -> Self { Self { nullifier_public_key: FfiBytes32::default(), - incoming_viewing_public_key: std::ptr::null(), - incoming_viewing_public_key_len: 0, + viewing_public_key: std::ptr::null(), + viewing_public_key_len: 0, } } } @@ -157,13 +157,10 @@ impl FfiPrivateAccountKeys { nssa_core::NullifierPublicKey(self.nullifier_public_key.data) } - pub fn ivk(&self) -> Result { - if self.incoming_viewing_public_key_len == 33 { + pub fn vpk(&self) -> Result { + if self.viewing_public_key_len == 33 { let slice = unsafe { - slice::from_raw_parts( - self.incoming_viewing_public_key, - self.incoming_viewing_public_key_len, - ) + slice::from_raw_parts(self.viewing_public_key, self.viewing_public_key_len) }; Ok(Secp256k1Point(slice.to_vec())) } else { diff --git a/wallet-ffi/wallet_ffi.h b/wallet-ffi/wallet_ffi.h index 4d282221..d909e14b 100644 --- a/wallet-ffi/wallet_ffi.h +++ b/wallet-ffi/wallet_ffi.h @@ -198,13 +198,13 @@ typedef struct FfiPrivateAccountKeys { */ struct FfiBytes32 nullifier_public_key; /** - * Incoming viewing public key (compressed secp256k1 point) + * viewing public key (compressed secp256k1 point) */ - const uint8_t *incoming_viewing_public_key; + const uint8_t *viewing_public_key; /** - * Length of incoming viewing public key (typically 33 bytes) + * Length of viewing public key (typically 33 bytes) */ - uintptr_t incoming_viewing_public_key_len; + uintptr_t viewing_public_key_len; } FfiPrivateAccountKeys; /** @@ -344,6 +344,30 @@ enum WalletFfiError wallet_ffi_get_account_public(struct WalletHandle *handle, const struct FfiBytes32 *account_id, struct FfiAccount *out_account); +/** + * Get full private account data from the local storage. + * + * # Parameters + * - `handle`: Valid wallet handle + * - `account_id`: The account ID (32 bytes) + * - `out_account`: Output pointer for account data + * + * # Returns + * - `Success` on successful query + * - Error code on failure + * + * # Memory + * The account data must be freed with `wallet_ffi_free_account_data()`. + * + * # Safety + * - `handle` must be a valid wallet handle from `wallet_ffi_create_new` or `wallet_ffi_open` + * - `account_id` must be a valid pointer to a `FfiBytes32` struct + * - `out_account` must be a valid pointer to a `FfiAccount` struct + */ +enum WalletFfiError wallet_ffi_get_account_private(struct WalletHandle *handle, + const struct FfiBytes32 *account_id, + struct FfiAccount *out_account); + /** * Free account data returned by `wallet_ffi_get_account_public`. * @@ -380,7 +404,7 @@ enum WalletFfiError wallet_ffi_get_public_account_key(struct WalletHandle *handl /** * Get keys for a private account. * - * Returns the nullifier public key (NPK) and incoming viewing public key (IPK) + * Returns the nullifier public key (NPK) and viewing public key (VPK) * for the specified private account. These keys are safe to share publicly. * * # Parameters @@ -546,6 +570,108 @@ enum WalletFfiError wallet_ffi_transfer_public(struct WalletHandle *handle, const uint8_t (*amount)[16], struct FfiTransferResult *out_result); +/** + * Send a shielded token transfer. + * + * Transfers tokens from a public account to a private account. + * + * # Parameters + * - `handle`: Valid wallet handle + * - `from`: Source account ID (must be owned by this wallet) + * - `to_keys`: Destination account keys + * - `amount`: Amount to transfer as little-endian [u8; 16] + * - `out_result`: Output pointer for transfer result + * + * # Returns + * - `Success` if the transfer was submitted successfully + * - `InsufficientFunds` if the source account doesn't have enough balance + * - `KeyNotFound` if the source account's signing key is not in this wallet + * - Error code on other failures + * + * # Memory + * The result must be freed with `wallet_ffi_free_transfer_result()`. + * + * # Safety + * - `handle` must be a valid wallet handle from `wallet_ffi_create_new` or `wallet_ffi_open` + * - `from` must be a valid pointer to a `FfiBytes32` struct + * - `to_keys` must be a valid pointer to a `FfiPrivateAccountKeys` struct + * - `amount` must be a valid pointer to a `[u8; 16]` array + * - `out_result` must be a valid pointer to a `FfiTransferResult` struct + */ +enum WalletFfiError wallet_ffi_transfer_shielded(struct WalletHandle *handle, + const struct FfiBytes32 *from, + const struct FfiPrivateAccountKeys *to_keys, + const uint8_t (*amount)[16], + struct FfiTransferResult *out_result); + +/** + * Send a deshielded token transfer. + * + * Transfers tokens from a private account to a public account. + * + * # Parameters + * - `handle`: Valid wallet handle + * - `from`: Source account ID (must be owned by this wallet) + * - `to`: Destination account ID + * - `amount`: Amount to transfer as little-endian [u8; 16] + * - `out_result`: Output pointer for transfer result + * + * # Returns + * - `Success` if the transfer was submitted successfully + * - `InsufficientFunds` if the source account doesn't have enough balance + * - `KeyNotFound` if the source account's signing key is not in this wallet + * - Error code on other failures + * + * # Memory + * The result must be freed with `wallet_ffi_free_transfer_result()`. + * + * # Safety + * - `handle` must be a valid wallet handle from `wallet_ffi_create_new` or `wallet_ffi_open` + * - `from` must be a valid pointer to a `FfiBytes32` struct + * - `to` must be a valid pointer to a `FfiBytes32` struct + * - `amount` must be a valid pointer to a `[u8; 16]` array + * - `out_result` must be a valid pointer to a `FfiTransferResult` struct + */ +enum WalletFfiError wallet_ffi_transfer_deshielded(struct WalletHandle *handle, + const struct FfiBytes32 *from, + const struct FfiBytes32 *to, + const uint8_t (*amount)[16], + struct FfiTransferResult *out_result); + +/** + * Send a private token transfer. + * + * Transfers tokens from a private account to another private account. + * + * # Parameters + * - `handle`: Valid wallet handle + * - `from`: Source account ID (must be owned by this wallet) + * - `to_keys`: Destination account keys + * - `amount`: Amount to transfer as little-endian [u8; 16] + * - `out_result`: Output pointer for transfer result + * + * # Returns + * - `Success` if the transfer was submitted successfully + * - `InsufficientFunds` if the source account doesn't have enough balance + * - `KeyNotFound` if the source account's signing key is not in this wallet + * - Error code on other failures + * + * # Memory + * The result must be freed with `wallet_ffi_free_transfer_result()`. + * + * # Safety + * - `handle` must be a valid wallet handle from `wallet_ffi_create_new` or `wallet_ffi_open` + * - `from` must be a valid pointer to a `FfiBytes32` struct + * - `to_keys` must be a valid pointer to a `FfiPrivateAccountKeys` struct + * - `amount` must be a valid pointer to a `[u8; 16]` array + * - `out_result` must be a valid pointer to a `FfiTransferResult` struct + */ +enum WalletFfiError wallet_ffi_transfer_private(struct WalletHandle *handle, + const struct FfiBytes32 *from, + const struct FfiPrivateAccountKeys *to_keys, + const uint8_t (*amount)[16], + struct FfiTransferResult *out_result); + /** * Register a public account on the network. * @@ -573,6 +699,33 @@ enum WalletFfiError wallet_ffi_register_public_account(struct WalletHandle *hand const struct FfiBytes32 *account_id, struct FfiTransferResult *out_result); +/** + * Register a private account on the network. + * + * This initializes a private account. The account must be + * owned by this wallet. + * + * # Parameters + * - `handle`: Valid wallet handle + * - `account_id`: Account ID to register + * - `out_result`: Output pointer for registration result + * + * # Returns + * - `Success` if the registration was submitted successfully + * - Error code on failure + * + * # Memory + * The result must be freed with `wallet_ffi_free_transfer_result()`. + * + * # Safety + * - `handle` must be a valid wallet handle from `wallet_ffi_create_new` or `wallet_ffi_open` + * - `account_id` must be a valid pointer to a `FfiBytes32` struct + * - `out_result` must be a valid pointer to a `FfiTransferResult` struct + */ +enum WalletFfiError wallet_ffi_register_private_account(struct WalletHandle *handle, + const struct FfiBytes32 *account_id, + struct FfiTransferResult *out_result); + /** * Free a transfer result returned by `wallet_ffi_transfer_public` or * `wallet_ffi_register_public_account`. diff --git a/wallet/configs/debug/wallet_config.json b/wallet/configs/debug/wallet_config.json index 12ce44a8..512a9a16 100644 --- a/wallet/configs/debug/wallet_config.json +++ b/wallet/configs/debug/wallet_config.json @@ -84,9 +84,9 @@ ] } }, - { + { "Private": { - "account_id": "3oCG8gqdKLMegw4rRfyaMQvuPHpcASt7xwttsmnZLSkw", + "account_id": "2ECgkFTaXzwjJBXR7ZKmXYQtpHbvTTHK9Auma4NL9AUo", "account": { "program_owner": [ 0, @@ -103,219 +103,19 @@ "nonce": 0 }, "key_chain": { - "secret_spending_key": [ - 251, - 82, - 235, - 1, - 146, - 96, - 30, - 81, - 162, - 234, - 33, - 15, - 123, - 129, - 116, - 0, - 84, - 136, - 176, - 70, - 190, - 224, - 161, - 54, - 134, - 142, - 154, - 1, - 18, - 251, - 242, - 189 - ], + "secret_spending_key": [112, 17, 152, 192, 217, 201, 142, 92, 111, 68, 85, 222, 107, 73, 78, 196, 118, 226, 37, 17, 185, 177, 149, 182, 9, 85, 187, 152, 163, 144, 68, 121], "private_key_holder": { - "nullifier_secret_key": [ - 29, - 250, - 10, - 187, - 35, - 123, - 180, - 250, - 246, - 97, - 216, - 153, - 44, - 156, - 16, - 93, - 241, - 26, - 174, - 219, - 72, - 84, - 34, - 247, - 112, - 101, - 217, - 243, - 189, - 173, - 75, - 20 - ], - "incoming_viewing_secret_key": [ - 251, - 201, - 22, - 154, - 100, - 165, - 218, - 108, - 163, - 190, - 135, - 91, - 145, - 84, - 69, - 241, - 46, - 117, - 217, - 110, - 197, - 248, - 91, - 193, - 14, - 104, - 88, - 103, - 67, - 153, - 182, - 158 - ], - "outgoing_viewing_secret_key": [ - 25, - 67, - 121, - 76, - 175, - 100, - 30, - 198, - 105, - 123, - 49, - 169, - 75, - 178, - 75, - 210, - 100, - 143, - 210, - 243, - 228, - 243, - 21, - 18, - 36, - 84, - 164, - 186, - 139, - 113, - 214, - 12 - ] + "nullifier_secret_key": [52, 33, 235, 245, 42, 132, 163, 182, 114, 56, 144, 187, 147, 23, 184, 227, 128, 12, 180, 142, 217, 110, 188, 177, 155, 141, 23, 127, 216, 185, 33, 126], + "viewing_secret_key": [44, 81, 165, 166, 34, 188, 192, 240, 40, 9, 83, 189, 215, 184, 246, 154, 247, 227, 155, 16, 121, 238, 4, 245, 63, 135, 192, 213, 222, 247, 120, 86] }, - "nullifer_public_key": [ - 63, - 202, - 178, - 231, - 183, - 82, - 237, - 212, - 216, - 221, - 215, - 255, - 153, - 101, - 177, - 161, - 254, - 210, - 128, - 122, - 54, - 190, - 230, - 151, - 183, - 64, - 225, - 229, - 113, - 1, - 228, - 97 - ], - "incoming_viewing_public_key": [ - 3, - 235, - 139, - 131, - 237, - 177, - 122, - 189, - 6, - 177, - 167, - 178, - 202, - 117, - 246, - 58, - 28, - 65, - 132, - 79, - 220, - 139, - 119, - 243, - 187, - 160, - 212, - 121, - 61, - 247, - 116, - 72, - 205 - ] + "nullifer_public_key": [13, 25, 40, 5, 198, 248, 210, 248, 237, 121, 124, 145, 186, 142, 253, 216, 236, 69, 193, 32, 166, 167, 49, 133, 172, 111, 159, 46, 84, 17, 157, 23], + "viewing_public_key": [3, 43, 116, 165, 161, 27, 150, 158, 175, 198, 215, 27, 121, 126, 158, 224, 249, 92, 168, 163, 173, 115, 120, 122, 89, 173, 133, 94, 39, 238, 62, 52, 193] } } }, { "Private": { - "account_id": "AKTcXgJ1xoynta1Ec7y6Jso1z1JQtHqd7aPQ1h9er6xX", + "account_id": "E8HwiTyQe4H9HK7icTvn95HQMnzx49mP9A2ddtMLpNaN", "account": { "program_owner": [ 0, @@ -332,213 +132,13 @@ "nonce": 0 }, "key_chain": { - "secret_spending_key": [ - 238, - 171, - 241, - 69, - 111, - 217, - 85, - 64, - 19, - 82, - 18, - 189, - 32, - 91, - 78, - 175, - 107, - 7, - 109, - 60, - 52, - 44, - 243, - 230, - 72, - 244, - 192, - 92, - 137, - 33, - 118, - 254 - ], + "secret_spending_key": [48, 175, 124, 10, 230, 240, 166, 14, 249, 254, 157, 226, 208, 124, 122, 177, 203, 139, 192, 180, 43, 120, 55, 151, 50, 21, 113, 22, 254, 83, 148, 56], "private_key_holder": { - "nullifier_secret_key": [ - 25, - 211, - 215, - 119, - 57, - 223, - 247, - 37, - 245, - 144, - 122, - 29, - 118, - 245, - 83, - 228, - 23, - 9, - 101, - 120, - 88, - 33, - 238, - 207, - 128, - 61, - 110, - 2, - 89, - 62, - 164, - 13 - ], - "incoming_viewing_secret_key": [ - 193, - 181, - 14, - 196, - 142, - 84, - 15, - 65, - 128, - 101, - 70, - 196, - 241, - 47, - 130, - 221, - 23, - 146, - 161, - 237, - 221, - 40, - 19, - 126, - 59, - 15, - 169, - 236, - 25, - 105, - 104, - 231 - ], - "outgoing_viewing_secret_key": [ - 20, - 170, - 220, - 108, - 41, - 23, - 155, - 217, - 247, - 190, - 175, - 168, - 247, - 34, - 105, - 134, - 114, - 74, - 104, - 91, - 211, - 62, - 126, - 13, - 130, - 100, - 241, - 214, - 250, - 236, - 38, - 150 - ] + "nullifier_secret_key": [99, 82, 190, 140, 234, 10, 61, 163, 15, 211, 179, 54, 70, 166, 87, 5, 182, 68, 117, 244, 217, 23, 99, 9, 4, 177, 230, 125, 109, 91, 160, 30], + "viewing_secret_key": [205, 32, 76, 251, 255, 236, 96, 119, 61, 111, 65, 100, 75, 218, 12, 22, 17, 170, 55, 226, 21, 154, 161, 34, 208, 74, 27, 1, 119, 13, 88, 128] }, - "nullifer_public_key": [ - 192, - 251, - 166, - 243, - 167, - 236, - 84, - 249, - 35, - 136, - 130, - 172, - 219, - 225, - 161, - 139, - 229, - 89, - 243, - 125, - 194, - 213, - 209, - 30, - 23, - 174, - 100, - 244, - 124, - 74, - 140, - 47 - ], - "incoming_viewing_public_key": [ - 2, - 181, - 98, - 93, - 216, - 241, - 241, - 110, - 58, - 198, - 119, - 174, - 250, - 184, - 1, - 204, - 200, - 173, - 44, - 238, - 37, - 247, - 170, - 156, - 100, - 254, - 116, - 242, - 28, - 183, - 187, - 77, - 255 - ] + "nullifer_public_key": [32, 67, 72, 164, 106, 53, 66, 239, 141, 15, 52, 230, 136, 177, 2, 236, 207, 243, 134, 135, 210, 143, 87, 232, 215, 128, 194, 120, 113, 224, 4, 165], + "viewing_public_key": [2, 79, 110, 46, 203, 29, 206, 205, 18, 86, 27, 189, 104, 103, 113, 181, 110, 53, 78, 172, 11, 171, 190, 18, 126, 214, 81, 77, 192, 154, 58, 195, 238] } } } diff --git a/wallet/src/cli/account.rs b/wallet/src/cli/account.rs index c28138b1..8ef45c29 100644 --- a/wallet/src/cli/account.rs +++ b/wallet/src/cli/account.rs @@ -20,7 +20,7 @@ pub enum AccountSubcommand { /// Flag to get raw account data #[arg(short, long)] raw: bool, - /// Display keys (pk for public accounts, npk/ipk for private accounts) + /// Display keys (pk for public accounts, npk/vpk for private accounts) #[arg(short, long)] keys: bool, /// Valid 32 byte base58 string with privacy prefix @@ -107,8 +107,8 @@ impl WalletSubcommand for NewSubcommand { ); println!("With npk {}", hex::encode(key.nullifer_public_key.0)); println!( - "With ipk {}", - hex::encode(key.incoming_viewing_public_key.to_bytes()) + "With vpk {}", + hex::encode(key.viewing_public_key.to_bytes()) ); wallet_core.store_persistent_data().await?; @@ -207,10 +207,7 @@ impl WalletSubcommand for AccountSubcommand { .ok_or(anyhow::anyhow!("Private account not found in storage"))?; println!("npk {}", hex::encode(key.nullifer_public_key.0)); - println!( - "ipk {}", - hex::encode(key.incoming_viewing_public_key.to_bytes()) - ); + println!("vpk {}", hex::encode(key.viewing_public_key.to_bytes())); } } Ok(()) diff --git a/wallet/src/cli/programs/native_token_transfer.rs b/wallet/src/cli/programs/native_token_transfer.rs index 35c79f86..9dd4fca6 100644 --- a/wallet/src/cli/programs/native_token_transfer.rs +++ b/wallet/src/cli/programs/native_token_transfer.rs @@ -22,7 +22,7 @@ pub enum AuthTransferSubcommand { }, /// Send native tokens from one account to another with variable privacy /// - /// If receiver is private, then `to` and (`to_npk` , `to_ipk`) is a mutually exclusive + /// If receiver is private, then `to` and (`to_npk` , `to_vpk`) is a mutually exclusive /// patterns. /// /// First is used for owned accounts, second otherwise. @@ -36,9 +36,9 @@ pub enum AuthTransferSubcommand { /// to_npk - valid 32 byte hex string #[arg(long)] to_npk: Option, - /// to_ipk - valid 33 byte hex string + /// to_vpk - valid 33 byte hex string #[arg(long)] - to_ipk: Option, + to_vpk: Option, /// amount - amount of balance to move #[arg(long)] amount: u128, @@ -102,10 +102,10 @@ impl WalletSubcommand for AuthTransferSubcommand { from, to, to_npk, - to_ipk, + to_vpk, amount, } => { - let underlying_subcommand = match (to, to_npk, to_ipk) { + let underlying_subcommand = match (to, to_npk, to_vpk) { (None, None, None) => { anyhow::bail!( "Provide either account account_id of receiver or their public keys" @@ -154,7 +154,7 @@ impl WalletSubcommand for AuthTransferSubcommand { } } } - (None, Some(to_npk), Some(to_ipk)) => { + (None, Some(to_npk), Some(to_vpk)) => { let (from, from_privacy) = parse_addr_with_privacy_prefix(&from)?; match from_privacy { @@ -163,7 +163,7 @@ impl WalletSubcommand for AuthTransferSubcommand { NativeTokenTransferProgramSubcommandPrivate::PrivateForeign { from, to_npk, - to_ipk, + to_vpk, amount, }, ) @@ -173,7 +173,7 @@ impl WalletSubcommand for AuthTransferSubcommand { NativeTokenTransferProgramSubcommandShielded::ShieldedForeign { from, to_npk, - to_ipk, + to_vpk, amount, }, ) @@ -255,9 +255,9 @@ pub enum NativeTokenTransferProgramSubcommandShielded { /// to_npk - valid 32 byte hex string #[arg(long)] to_npk: String, - /// to_ipk - valid 33 byte hex string + /// to_vpk - valid 33 byte hex string #[arg(long)] - to_ipk: String, + to_vpk: String, /// amount - amount of balance to move #[arg(long)] amount: u128, @@ -292,9 +292,9 @@ pub enum NativeTokenTransferProgramSubcommandPrivate { /// to_npk - valid 32 byte hex string #[arg(long)] to_npk: String, - /// to_ipk - valid 33 byte hex string + /// to_vpk - valid 33 byte hex string #[arg(long)] - to_ipk: String, + to_vpk: String, /// amount - amount of balance to move #[arg(long)] amount: u128, @@ -336,7 +336,7 @@ impl WalletSubcommand for NativeTokenTransferProgramSubcommandPrivate { NativeTokenTransferProgramSubcommandPrivate::PrivateForeign { from, to_npk, - to_ipk, + to_vpk, amount, } => { let from: AccountId = from.parse().unwrap(); @@ -345,14 +345,14 @@ impl WalletSubcommand for NativeTokenTransferProgramSubcommandPrivate { to_npk.copy_from_slice(&to_npk_res); let to_npk = nssa_core::NullifierPublicKey(to_npk); - let to_ipk_res = hex::decode(to_ipk)?; - let mut to_ipk = [0u8; 33]; - to_ipk.copy_from_slice(&to_ipk_res); - let to_ipk = - nssa_core::encryption::shared_key_derivation::Secp256k1Point(to_ipk.to_vec()); + let to_vpk_res = hex::decode(to_vpk)?; + let mut to_vpk = [0u8; 33]; + to_vpk.copy_from_slice(&to_vpk_res); + let to_vpk = + nssa_core::encryption::shared_key_derivation::Secp256k1Point(to_vpk.to_vec()); let (res, [secret_from, _]) = NativeTokenTransfer(wallet_core) - .send_private_transfer_to_outer_account(from, to_npk, to_ipk, amount) + .send_private_transfer_to_outer_account(from, to_npk, to_vpk, amount) .await?; println!("Results of tx send are {res:#?}"); @@ -412,7 +412,7 @@ impl WalletSubcommand for NativeTokenTransferProgramSubcommandShielded { NativeTokenTransferProgramSubcommandShielded::ShieldedForeign { from, to_npk, - to_ipk, + to_vpk, amount, } => { let from: AccountId = from.parse().unwrap(); @@ -422,14 +422,14 @@ impl WalletSubcommand for NativeTokenTransferProgramSubcommandShielded { to_npk.copy_from_slice(&to_npk_res); let to_npk = nssa_core::NullifierPublicKey(to_npk); - let to_ipk_res = hex::decode(to_ipk)?; - let mut to_ipk = [0u8; 33]; - to_ipk.copy_from_slice(&to_ipk_res); - let to_ipk = - nssa_core::encryption::shared_key_derivation::Secp256k1Point(to_ipk.to_vec()); + let to_vpk_res = hex::decode(to_vpk)?; + let mut to_vpk = [0u8; 33]; + to_vpk.copy_from_slice(&to_vpk_res); + let to_vpk = + nssa_core::encryption::shared_key_derivation::Secp256k1Point(to_vpk.to_vec()); let (res, _) = NativeTokenTransfer(wallet_core) - .send_shielded_transfer_to_outer_account(from, to_npk, to_ipk, amount) + .send_shielded_transfer_to_outer_account(from, to_npk, to_vpk, amount) .await?; println!("Results of tx send are {res:#?}"); diff --git a/wallet/src/cli/programs/token.rs b/wallet/src/cli/programs/token.rs index 5237d117..2f83d4ce 100644 --- a/wallet/src/cli/programs/token.rs +++ b/wallet/src/cli/programs/token.rs @@ -29,7 +29,7 @@ pub enum TokenProgramAgnosticSubcommand { }, /// Send tokens from one account to another with variable privacy /// - /// If receiver is private, then `to` and (`to_npk` , `to_ipk`) is a mutually exclusive + /// If receiver is private, then `to` and (`to_npk` , `to_vpk`) is a mutually exclusive /// patterns. /// /// First is used for owned accounts, second otherwise. @@ -43,9 +43,9 @@ pub enum TokenProgramAgnosticSubcommand { /// to_npk - valid 32 byte hex string #[arg(long)] to_npk: Option, - /// to_ipk - valid 33 byte hex string + /// to_vpk - valid 33 byte hex string #[arg(long)] - to_ipk: Option, + to_vpk: Option, /// amount - amount of balance to move #[arg(long)] amount: u128, @@ -71,7 +71,7 @@ pub enum TokenProgramAgnosticSubcommand { /// /// `definition` is owned /// - /// If `holder` is private, then `holder` and (`holder_npk` , `holder_ipk`) is a mutually + /// If `holder` is private, then `holder` and (`holder_npk` , `holder_vpk`) is a mutually /// exclusive patterns. /// /// First is used for owned accounts, second otherwise. @@ -85,9 +85,9 @@ pub enum TokenProgramAgnosticSubcommand { /// holder_npk - valid 32 byte hex string #[arg(long)] holder_npk: Option, - /// to_ipk - valid 33 byte hex string + /// to_vpk - valid 33 byte hex string #[arg(long)] - holder_ipk: Option, + holder_vpk: Option, /// amount - amount of balance to mint #[arg(long)] amount: u128, @@ -160,10 +160,10 @@ impl WalletSubcommand for TokenProgramAgnosticSubcommand { from, to, to_npk, - to_ipk, + to_vpk, amount, } => { - let underlying_subcommand = match (to, to_npk, to_ipk) { + let underlying_subcommand = match (to, to_npk, to_vpk) { (None, None, None) => { anyhow::bail!( "Provide either account account_id of receiver or their public keys" @@ -220,7 +220,7 @@ impl WalletSubcommand for TokenProgramAgnosticSubcommand { } } } - (None, Some(to_npk), Some(to_ipk)) => { + (None, Some(to_npk), Some(to_vpk)) => { let (from, from_privacy) = parse_addr_with_privacy_prefix(&from)?; match from_privacy { @@ -228,7 +228,7 @@ impl WalletSubcommand for TokenProgramAgnosticSubcommand { TokenProgramSubcommandPrivate::TransferTokenPrivateForeign { sender_account_id: from, recipient_npk: to_npk, - recipient_ipk: to_ipk, + recipient_vpk: to_vpk, balance_to_move: amount, }, ), @@ -236,7 +236,7 @@ impl WalletSubcommand for TokenProgramAgnosticSubcommand { TokenProgramSubcommandShielded::TransferTokenShieldedForeign { sender_account_id: from, recipient_npk: to_npk, - recipient_ipk: to_ipk, + recipient_vpk: to_vpk, balance_to_move: amount, }, ), @@ -302,10 +302,10 @@ impl WalletSubcommand for TokenProgramAgnosticSubcommand { definition, holder, holder_npk, - holder_ipk, + holder_vpk, amount, } => { - let underlying_subcommand = match (holder, holder_npk, holder_ipk) { + let underlying_subcommand = match (holder, holder_npk, holder_vpk) { (None, None, None) => { anyhow::bail!( "Provide either account account_id of holder or their public keys" @@ -363,7 +363,7 @@ impl WalletSubcommand for TokenProgramAgnosticSubcommand { } } } - (None, Some(holder_npk), Some(holder_ipk)) => { + (None, Some(holder_npk), Some(holder_vpk)) => { let (definition, definition_privacy) = parse_addr_with_privacy_prefix(&definition)?; @@ -372,7 +372,7 @@ impl WalletSubcommand for TokenProgramAgnosticSubcommand { TokenProgramSubcommandPrivate::MintTokenPrivateForeign { definition_account_id: definition, holder_npk, - holder_ipk, + holder_vpk, amount, }, ), @@ -380,7 +380,7 @@ impl WalletSubcommand for TokenProgramAgnosticSubcommand { TokenProgramSubcommandShielded::MintTokenShieldedForeign { definition_account_id: definition, holder_npk, - holder_ipk, + holder_vpk, amount, }, ), @@ -465,9 +465,9 @@ pub enum TokenProgramSubcommandPrivate { /// recipient_npk - valid 32 byte hex string #[arg(long)] recipient_npk: String, - /// recipient_ipk - valid 33 byte hex string + /// recipient_vpk - valid 33 byte hex string #[arg(long)] - recipient_ipk: String, + recipient_vpk: String, #[arg(short, long)] balance_to_move: u128, }, @@ -496,7 +496,7 @@ pub enum TokenProgramSubcommandPrivate { #[arg(short, long)] holder_npk: String, #[arg(short, long)] - holder_ipk: String, + holder_vpk: String, #[arg(short, long)] amount: u128, }, @@ -553,9 +553,9 @@ pub enum TokenProgramSubcommandShielded { /// recipient_npk - valid 32 byte hex string #[arg(long)] recipient_npk: String, - /// recipient_ipk - valid 33 byte hex string + /// recipient_vpk - valid 33 byte hex string #[arg(long)] - recipient_ipk: String, + recipient_vpk: String, #[arg(short, long)] balance_to_move: u128, }, @@ -584,7 +584,7 @@ pub enum TokenProgramSubcommandShielded { #[arg(short, long)] holder_npk: String, #[arg(short, long)] - holder_ipk: String, + holder_vpk: String, #[arg(short, long)] amount: u128, }, @@ -745,7 +745,7 @@ impl WalletSubcommand for TokenProgramSubcommandPrivate { TokenProgramSubcommandPrivate::TransferTokenPrivateForeign { sender_account_id, recipient_npk, - recipient_ipk, + recipient_vpk, balance_to_move, } => { let sender_account_id: AccountId = sender_account_id.parse().unwrap(); @@ -754,18 +754,18 @@ impl WalletSubcommand for TokenProgramSubcommandPrivate { recipient_npk.copy_from_slice(&recipient_npk_res); let recipient_npk = nssa_core::NullifierPublicKey(recipient_npk); - let recipient_ipk_res = hex::decode(recipient_ipk)?; - let mut recipient_ipk = [0u8; 33]; - recipient_ipk.copy_from_slice(&recipient_ipk_res); - let recipient_ipk = nssa_core::encryption::shared_key_derivation::Secp256k1Point( - recipient_ipk.to_vec(), + let recipient_vpk_res = hex::decode(recipient_vpk)?; + let mut recipient_vpk = [0u8; 33]; + recipient_vpk.copy_from_slice(&recipient_vpk_res); + let recipient_vpk = nssa_core::encryption::shared_key_derivation::Secp256k1Point( + recipient_vpk.to_vec(), ); let (res, [secret_sender, _]) = Token(wallet_core) .send_transfer_transaction_private_foreign_account( sender_account_id, recipient_npk, - recipient_ipk, + recipient_vpk, balance_to_move, ) .await?; @@ -865,7 +865,7 @@ impl WalletSubcommand for TokenProgramSubcommandPrivate { TokenProgramSubcommandPrivate::MintTokenPrivateForeign { definition_account_id, holder_npk, - holder_ipk, + holder_vpk, amount, } => { let definition_account_id: AccountId = definition_account_id.parse().unwrap(); @@ -875,18 +875,18 @@ impl WalletSubcommand for TokenProgramSubcommandPrivate { holder_npk.copy_from_slice(&holder_npk_res); let holder_npk = nssa_core::NullifierPublicKey(holder_npk); - let holder_ipk_res = hex::decode(holder_ipk)?; - let mut holder_ipk = [0u8; 33]; - holder_ipk.copy_from_slice(&holder_ipk_res); - let holder_ipk = nssa_core::encryption::shared_key_derivation::Secp256k1Point( - holder_ipk.to_vec(), + let holder_vpk_res = hex::decode(holder_vpk)?; + let mut holder_vpk = [0u8; 33]; + holder_vpk.copy_from_slice(&holder_vpk_res); + let holder_vpk = nssa_core::encryption::shared_key_derivation::Secp256k1Point( + holder_vpk.to_vec(), ); let (res, [secret_definition, _]) = Token(wallet_core) .send_mint_transaction_private_foreign_account( definition_account_id, holder_npk, - holder_ipk, + holder_vpk, amount, ) .await?; @@ -1034,7 +1034,7 @@ impl WalletSubcommand for TokenProgramSubcommandShielded { TokenProgramSubcommandShielded::TransferTokenShieldedForeign { sender_account_id, recipient_npk, - recipient_ipk, + recipient_vpk, balance_to_move, } => { let sender_account_id: AccountId = sender_account_id.parse().unwrap(); @@ -1043,18 +1043,18 @@ impl WalletSubcommand for TokenProgramSubcommandShielded { recipient_npk.copy_from_slice(&recipient_npk_res); let recipient_npk = nssa_core::NullifierPublicKey(recipient_npk); - let recipient_ipk_res = hex::decode(recipient_ipk)?; - let mut recipient_ipk = [0u8; 33]; - recipient_ipk.copy_from_slice(&recipient_ipk_res); - let recipient_ipk = nssa_core::encryption::shared_key_derivation::Secp256k1Point( - recipient_ipk.to_vec(), + let recipient_vpk_res = hex::decode(recipient_vpk)?; + let mut recipient_vpk = [0u8; 33]; + recipient_vpk.copy_from_slice(&recipient_vpk_res); + let recipient_vpk = nssa_core::encryption::shared_key_derivation::Secp256k1Point( + recipient_vpk.to_vec(), ); let (res, _) = Token(wallet_core) .send_transfer_transaction_shielded_foreign_account( sender_account_id, recipient_npk, - recipient_ipk, + recipient_vpk, balance_to_move, ) .await?; @@ -1177,7 +1177,7 @@ impl WalletSubcommand for TokenProgramSubcommandShielded { TokenProgramSubcommandShielded::MintTokenShieldedForeign { definition_account_id, holder_npk, - holder_ipk, + holder_vpk, amount, } => { let definition_account_id: AccountId = definition_account_id.parse().unwrap(); @@ -1187,18 +1187,18 @@ impl WalletSubcommand for TokenProgramSubcommandShielded { holder_npk.copy_from_slice(&holder_npk_res); let holder_npk = nssa_core::NullifierPublicKey(holder_npk); - let holder_ipk_res = hex::decode(holder_ipk)?; - let mut holder_ipk = [0u8; 33]; - holder_ipk.copy_from_slice(&holder_ipk_res); - let holder_ipk = nssa_core::encryption::shared_key_derivation::Secp256k1Point( - holder_ipk.to_vec(), + let holder_vpk_res = hex::decode(holder_vpk)?; + let mut holder_vpk = [0u8; 33]; + holder_vpk.copy_from_slice(&holder_vpk_res); + let holder_vpk = nssa_core::encryption::shared_key_derivation::Secp256k1Point( + holder_vpk.to_vec(), ); let (res, _) = Token(wallet_core) .send_mint_transaction_shielded_foreign_account( definition_account_id, holder_npk, - holder_ipk, + holder_vpk, amount, ) .await?; diff --git a/wallet/src/config.rs b/wallet/src/config.rs index baa569f6..08bb610d 100644 --- a/wallet/src/config.rs +++ b/wallet/src/config.rs @@ -292,7 +292,7 @@ impl Default for WalletConfig { }, { "Private": { - "account_id": "3oCG8gqdKLMegw4rRfyaMQvuPHpcASt7xwttsmnZLSkw", + "account_id": "FpdcxBrMkHWqXCBQ6FG98eYfWGY6jWZRsKNSi1FwDMxy", "account": { "program_owner": [ 0, @@ -310,218 +310,151 @@ impl Default for WalletConfig { }, "key_chain": { "secret_spending_key": [ - 251, - 82, - 235, - 1, - 146, - 96, - 30, - 81, - 162, - 234, + 239, + 27, + 159, + 83, + 199, + 194, + 132, 33, - 15, - 123, - 129, - 116, - 0, + 20, + 28, + 217, + 103, + 101, + 57, + 27, + 125, 84, - 136, - 176, - 70, - 190, - 224, + 57, + 19, + 86, + 98, + 135, 161, - 54, - 134, - 142, - 154, - 1, - 18, - 251, - 242, - 189 + 221, + 108, + 125, + 152, + 174, + 161, + 64, + 16, + 200 ], "private_key_holder": { "nullifier_secret_key": [ - 29, - 250, - 10, - 187, - 35, - 123, - 180, - 250, - 246, - 97, - 216, - 153, - 44, - 156, + 71, + 195, 16, - 93, - 241, - 26, - 174, - 219, - 72, - 84, - 34, - 247, - 112, - 101, - 217, - 243, - 189, - 173, - 75, - 20 - ], - "incoming_viewing_secret_key": [ - 251, - 201, - 22, - 154, - 100, - 165, - 218, - 108, - 163, - 190, - 135, - 91, - 145, - 84, - 69, - 241, - 46, - 117, - 217, - 110, - 197, - 248, - 91, - 193, - 14, - 104, - 88, - 103, - 67, - 153, - 182, - 158 - ], - "outgoing_viewing_secret_key": [ - 25, - 67, - 121, - 76, - 175, - 100, - 30, - 198, - 105, - 123, - 49, - 169, - 75, - 178, - 75, - 210, - 100, - 143, - 210, - 243, - 228, - 243, - 21, - 18, - 36, - 84, - 164, - 186, + 119, + 0, + 98, + 35, + 106, 139, - 113, - 214, - 12 + 82, + 145, + 50, + 27, + 140, + 206, + 19, + 53, + 122, + 166, + 76, + 195, + 0, + 16, + 19, + 21, + 143, + 155, + 119, + 9, + 200, + 81, + 105 + ], + "viewing_secret_key": [ + 5, + 117, + 221, + 27, + 236, + 199, + 53, + 22, + 249, + 231, + 98, + 147, + 213, + 116, + 191, + 82, + 188, + 148, + 175, + 98, + 139, + 52, + 232, + 249, + 220, + 217, + 83, + 58, + 112, + 155, + 197, + 196 ] }, "nullifer_public_key": [ - 63, - 202, - 178, - 231, - 183, - 82, - 237, - 212, - 216, - 221, - 215, - 255, - 153, - 101, 177, - 161, - 254, - 210, - 128, - 122, - 54, - 190, - 230, - 151, - 183, 64, - 225, - 229, - 113, 1, - 228, - 97 - ], - "incoming_viewing_public_key": [ - 3, - 235, - 139, - 131, - 237, - 177, - 122, - 189, - 6, - 177, - 167, - 178, - 202, - 117, - 246, - 58, - 28, - 65, - 132, - 79, - 220, - 139, - 119, + 11, + 87, + 38, + 254, + 159, + 231, + 165, + 1, + 94, + 64, + 137, 243, - 187, - 160, - 212, - 121, - 61, - 247, - 116, - 72, - 205 - ] + 76, + 249, + 101, + 251, + 129, + 33, + 101, + 189, + 30, + 42, + 11, + 191, + 34, + 103, + 186, + 227, + 230 + ], + "viewing_public_key": [ + 2, 69, 126, 43, 158, 209, 172, 144, 23, 185, 208, 25, 163, 166, 176, 200, 225, 251, 106, 211, 4, 199, 112, 243, 207, 144, 135, 56, 157, 167, 32, 219, 38] } } }, { "Private": { - "account_id": "AKTcXgJ1xoynta1Ec7y6Jso1z1JQtHqd7aPQ1h9er6xX", + "account_id": "E8HwiTyQe4H9HK7icTvn95HQMnzx49mP9A2ddtMLpNaN", "account": { "program_owner": [ 0, @@ -539,211 +472,20 @@ impl Default for WalletConfig { }, "key_chain": { "secret_spending_key": [ - 238, - 171, - 241, - 69, - 111, - 217, - 85, - 64, - 19, - 82, - 18, - 189, - 32, - 91, - 78, - 175, - 107, - 7, - 109, - 60, - 52, - 44, - 243, - 230, - 72, - 244, - 192, - 92, - 137, - 33, - 118, - 254 - ], + 48, 175, 124, 10, 230, 240, 166, 14, 249, 254, 157, 226, 208, 124, 122, 177, 203, 139, 192, 180, 43, 120, 55, 151, 50, 21, 113, 22, 254, 83, 148, 56], "private_key_holder": { "nullifier_secret_key": [ - 25, - 211, - 215, - 119, - 57, - 223, - 247, - 37, - 245, - 144, - 122, - 29, - 118, - 245, - 83, - 228, - 23, - 9, - 101, - 120, - 88, - 33, - 238, - 207, - 128, - 61, - 110, - 2, - 89, - 62, - 164, - 13 + 99, 82, 190, 140, 234, 10, 61, 163, 15, 211, 179, 54, 70, 166, 87, 5, 182, 68, 117, 244, 217, 23, 99, 9, 4, 177, 230, 125, 109, 91, 160, 30 ], - "incoming_viewing_secret_key": [ - 193, - 181, - 14, - 196, - 142, - 84, - 15, - 65, - 128, - 101, - 70, - 196, - 241, - 47, - 130, - 221, - 23, - 146, - 161, - 237, - 221, - 40, - 19, - 126, - 59, - 15, - 169, - 236, - 25, - 105, - 104, - 231 - ], - "outgoing_viewing_secret_key": [ - 20, - 170, - 220, - 108, - 41, - 23, - 155, - 217, - 247, - 190, - 175, - 168, - 247, - 34, - 105, - 134, - 114, - 74, - 104, - 91, - 211, - 62, - 126, - 13, - 130, - 100, - 241, - 214, - 250, - 236, - 38, - 150 + "viewing_secret_key": [ + 205, 32, 76, 251, 255, 236, 96, 119, 61, 111, 65, 100, 75, 218, 12, 22, 17, 170, 55, 226, 21, 154, 161, 34, 208, 74, 27, 1, 119, 13, 88, 128 ] }, "nullifer_public_key": [ - 192, - 251, - 166, - 243, - 167, - 236, - 84, - 249, - 35, - 136, - 130, - 172, - 219, - 225, - 161, - 139, - 229, - 89, - 243, - 125, - 194, - 213, - 209, - 30, - 23, - 174, - 100, - 244, - 124, - 74, - 140, - 47 + 32, 67, 72, 164, 106, 53, 66, 239, 141, 15, 52, 230, 136, 177, 2, 236, 207, 243, 134, 135, 210, 143, 87, 232, 215, 128, 194, 120, 113, 224, 4, 165 ], - "incoming_viewing_public_key": [ - 2, - 181, - 98, - 93, - 216, - 241, - 241, - 110, - 58, - 198, - 119, - 174, - 250, - 184, - 1, - 204, - 200, - 173, - 44, - 238, - 37, - 247, - 170, - 156, - 100, - 254, - 116, - 242, - 28, - 183, - 187, - 77, - 255 + "viewing_public_key": [ + 2, 79, 110, 46, 203, 29, 206, 205, 18, 86, 27, 189, 104, 103, 113, 181, 110, 53, 78, 172, 11, 171, 190, 18, 126, 214, 81, 77, 192, 154, 58, 195, 238 ] } } diff --git a/wallet/src/lib.rs b/wallet/src/lib.rs index 66d0d3ec..cb364fd3 100644 --- a/wallet/src/lib.rs +++ b/wallet/src/lib.rs @@ -298,6 +298,8 @@ impl WalletCore { instruction_data: InstructionData, program: &ProgramWithDependencies, ) -> Result<(SendTxResponse, Vec), ExecutionFailureKind> { + // TODO: handle large Err-variant properly + #[allow(clippy::result_large_err)] self.send_privacy_preserving_tx_with_pre_check(accounts, instruction_data, program, |_| { Ok(()) }) @@ -343,7 +345,7 @@ impl WalletCore { Vec::from_iter(acc_manager.public_account_nonces()), private_account_keys .iter() - .map(|keys| (keys.npk.clone(), keys.ipk.clone(), keys.epk.clone())) + .map(|keys| (keys.npk.clone(), keys.vpk.clone(), keys.epk.clone())) .collect(), output, ) @@ -427,7 +429,7 @@ impl WalletCore { .flat_map(|(acc_account_id, key_chain)| { let view_tag = EncryptedAccountData::compute_view_tag( key_chain.nullifer_public_key.clone(), - key_chain.incoming_viewing_public_key.clone(), + key_chain.viewing_public_key.clone(), ); tx.message() diff --git a/wallet/src/pinata_interactions.rs b/wallet/src/pinata_interactions.rs index 58047688..e588f400 100644 --- a/wallet/src/pinata_interactions.rs +++ b/wallet/src/pinata_interactions.rs @@ -36,7 +36,7 @@ impl WalletCore { let AccountPreparedData { nsk: winner_nsk, npk: winner_npk, - ipk: winner_ipk, + vpk: winner_vpk, auth_acc: winner_pre, proof: _, } = self @@ -50,7 +50,7 @@ impl WalletCore { let pinata_pre = AccountWithMetadata::new(pinata_acc.clone(), false, pinata_account_id); let eph_holder_winner = EphemeralKeyHolder::new(&winner_npk); - let shared_secret_winner = eph_holder_winner.calculate_shared_secret_sender(&winner_ipk); + let shared_secret_winner = eph_holder_winner.calculate_shared_secret_sender(&winner_vpk); let (output, proof) = circuit::execute_and_prove( &[pinata_pre, winner_pre], @@ -70,7 +70,7 @@ impl WalletCore { vec![], vec![( winner_npk.clone(), - winner_ipk.clone(), + winner_vpk.clone(), eph_holder_winner.generate_ephemeral_public_key(), )], output, @@ -103,7 +103,7 @@ impl WalletCore { let AccountPreparedData { nsk: _, npk: winner_npk, - ipk: winner_ipk, + vpk: winner_vpk, auth_acc: winner_pre, proof: _, } = self @@ -117,7 +117,7 @@ impl WalletCore { let pinata_pre = AccountWithMetadata::new(pinata_acc.clone(), false, pinata_account_id); let eph_holder_winner = EphemeralKeyHolder::new(&winner_npk); - let shared_secret_winner = eph_holder_winner.calculate_shared_secret_sender(&winner_ipk); + let shared_secret_winner = eph_holder_winner.calculate_shared_secret_sender(&winner_vpk); let (output, proof) = circuit::execute_and_prove( &[pinata_pre, winner_pre], @@ -137,7 +137,7 @@ impl WalletCore { vec![], vec![( winner_npk.clone(), - winner_ipk.clone(), + winner_vpk.clone(), eph_holder_winner.generate_ephemeral_public_key(), )], output, diff --git a/wallet/src/privacy_preserving_tx.rs b/wallet/src/privacy_preserving_tx.rs index 36b56024..e43966d4 100644 --- a/wallet/src/privacy_preserving_tx.rs +++ b/wallet/src/privacy_preserving_tx.rs @@ -5,7 +5,7 @@ use nssa::{AccountId, PrivateKey}; use nssa_core::{ MembershipProof, NullifierPublicKey, NullifierSecretKey, SharedSecretKey, account::{AccountWithMetadata, Nonce}, - encryption::{EphemeralPublicKey, IncomingViewingPublicKey}, + encryption::{EphemeralPublicKey, ViewingPublicKey}, }; use crate::WalletCore; @@ -16,7 +16,7 @@ pub enum PrivacyPreservingAccount { PrivateOwned(AccountId), PrivateForeign { npk: NullifierPublicKey, - ipk: IncomingViewingPublicKey, + vpk: ViewingPublicKey, }, } @@ -28,7 +28,7 @@ impl PrivacyPreservingAccount { pub fn is_private(&self) -> bool { matches!( &self, - Self::PrivateOwned(_) | Self::PrivateForeign { npk: _, ipk: _ } + Self::PrivateOwned(_) | Self::PrivateForeign { npk: _, vpk: _ } ) } } @@ -36,7 +36,7 @@ impl PrivacyPreservingAccount { pub struct PrivateAccountKeys { pub npk: NullifierPublicKey, pub ssk: SharedSecretKey, - pub ipk: IncomingViewingPublicKey, + pub vpk: ViewingPublicKey, pub epk: EphemeralPublicKey, } @@ -80,13 +80,13 @@ impl AccountManager { (State::Private(pre), mask) } - PrivacyPreservingAccount::PrivateForeign { npk, ipk } => { + PrivacyPreservingAccount::PrivateForeign { npk, vpk } => { let acc = nssa_core::account::Account::default(); let auth_acc = AccountWithMetadata::new(acc, false, &npk); let pre = AccountPreparedData { nsk: None, npk, - ipk, + vpk, pre_state: auth_acc, proof: None, }; @@ -138,8 +138,8 @@ impl AccountManager { Some(PrivateAccountKeys { npk: pre.npk.clone(), - ssk: eph_holder.calculate_shared_secret_sender(&pre.ipk), - ipk: pre.ipk.clone(), + ssk: eph_holder.calculate_shared_secret_sender(&pre.vpk), + vpk: pre.vpk.clone(), epk: eph_holder.generate_ephemeral_public_key(), }) } @@ -192,7 +192,7 @@ impl AccountManager { struct AccountPreparedData { nsk: Option, npk: NullifierPublicKey, - ipk: IncomingViewingPublicKey, + vpk: ViewingPublicKey, pre_state: AccountWithMetadata, proof: Option, } @@ -213,7 +213,7 @@ async fn private_acc_preparation( let nsk = from_keys.private_key_holder.nullifier_secret_key; let from_npk = from_keys.nullifer_public_key; - let from_ipk = from_keys.incoming_viewing_public_key; + let from_vpk = from_keys.viewing_public_key; // TODO: Remove this unwrap, error types must be compatible let proof = wallet @@ -228,7 +228,7 @@ async fn private_acc_preparation( Ok(AccountPreparedData { nsk: Some(nsk), npk: from_npk, - ipk: from_ipk, + vpk: from_vpk, pre_state: sender_pre, proof, }) diff --git a/wallet/src/program_facades/native_token_transfer/mod.rs b/wallet/src/program_facades/native_token_transfer/mod.rs index 693ef8d5..6d55ac0f 100644 --- a/wallet/src/program_facades/native_token_transfer/mod.rs +++ b/wallet/src/program_facades/native_token_transfer/mod.rs @@ -20,6 +20,9 @@ fn auth_transfer_preparation( ) { let instruction_data = Program::serialize_instruction(balance_to_move).unwrap(); let program = Program::authenticated_transfer_program(); + + // TODO: handle large Err-variant properly + #[allow(clippy::result_large_err)] let tx_pre_check = move |accounts: &[&Account]| { let from = accounts[0]; if from.balance >= balance_to_move { diff --git a/wallet/src/program_facades/native_token_transfer/private.rs b/wallet/src/program_facades/native_token_transfer/private.rs index eabf1b60..eb37ec94 100644 --- a/wallet/src/program_facades/native_token_transfer/private.rs +++ b/wallet/src/program_facades/native_token_transfer/private.rs @@ -2,7 +2,7 @@ use std::vec; use common::{error::ExecutionFailureKind, rpc_primitives::requests::SendTxResponse}; use nssa::{AccountId, program::Program}; -use nssa_core::{NullifierPublicKey, SharedSecretKey, encryption::IncomingViewingPublicKey}; +use nssa_core::{NullifierPublicKey, SharedSecretKey, encryption::ViewingPublicKey}; use super::{NativeTokenTransfer, auth_transfer_preparation}; use crate::PrivacyPreservingAccount; @@ -32,7 +32,7 @@ impl NativeTokenTransfer<'_> { &self, from: AccountId, to_npk: NullifierPublicKey, - to_ipk: IncomingViewingPublicKey, + to_vpk: ViewingPublicKey, balance_to_move: u128, ) -> Result<(SendTxResponse, [SharedSecretKey; 2]), ExecutionFailureKind> { let (instruction_data, program, tx_pre_check) = auth_transfer_preparation(balance_to_move); @@ -43,7 +43,7 @@ impl NativeTokenTransfer<'_> { PrivacyPreservingAccount::PrivateOwned(from), PrivacyPreservingAccount::PrivateForeign { npk: to_npk, - ipk: to_ipk, + vpk: to_vpk, }, ], instruction_data, diff --git a/wallet/src/program_facades/native_token_transfer/shielded.rs b/wallet/src/program_facades/native_token_transfer/shielded.rs index 85c8145c..22897502 100644 --- a/wallet/src/program_facades/native_token_transfer/shielded.rs +++ b/wallet/src/program_facades/native_token_transfer/shielded.rs @@ -1,6 +1,6 @@ use common::{error::ExecutionFailureKind, rpc_primitives::requests::SendTxResponse}; use nssa::AccountId; -use nssa_core::{NullifierPublicKey, SharedSecretKey, encryption::IncomingViewingPublicKey}; +use nssa_core::{NullifierPublicKey, SharedSecretKey, encryption::ViewingPublicKey}; use super::{NativeTokenTransfer, auth_transfer_preparation}; use crate::PrivacyPreservingAccount; @@ -38,7 +38,7 @@ impl NativeTokenTransfer<'_> { &self, from: AccountId, to_npk: NullifierPublicKey, - to_ipk: IncomingViewingPublicKey, + to_vpk: ViewingPublicKey, balance_to_move: u128, ) -> Result<(SendTxResponse, SharedSecretKey), ExecutionFailureKind> { let (instruction_data, program, tx_pre_check) = auth_transfer_preparation(balance_to_move); @@ -49,7 +49,7 @@ impl NativeTokenTransfer<'_> { PrivacyPreservingAccount::Public(from), PrivacyPreservingAccount::PrivateForeign { npk: to_npk, - ipk: to_ipk, + vpk: to_vpk, }, ], instruction_data, diff --git a/wallet/src/program_facades/token.rs b/wallet/src/program_facades/token.rs index 65ae641d..9543f593 100644 --- a/wallet/src/program_facades/token.rs +++ b/wallet/src/program_facades/token.rs @@ -1,6 +1,6 @@ use common::{error::ExecutionFailureKind, rpc_primitives::requests::SendTxResponse}; use nssa::{AccountId, program::Program}; -use nssa_core::{NullifierPublicKey, SharedSecretKey, encryption::IncomingViewingPublicKey}; +use nssa_core::{NullifierPublicKey, SharedSecretKey, encryption::ViewingPublicKey}; use token_core::Instruction; use crate::{PrivacyPreservingAccount, WalletCore}; @@ -194,7 +194,7 @@ impl Token<'_> { &self, sender_account_id: AccountId, recipient_npk: NullifierPublicKey, - recipient_ipk: IncomingViewingPublicKey, + recipient_vpk: ViewingPublicKey, amount: u128, ) -> Result<(SendTxResponse, [SharedSecretKey; 2]), ExecutionFailureKind> { let instruction = Instruction::Transfer { @@ -209,7 +209,7 @@ impl Token<'_> { PrivacyPreservingAccount::PrivateOwned(sender_account_id), PrivacyPreservingAccount::PrivateForeign { npk: recipient_npk, - ipk: recipient_ipk, + vpk: recipient_vpk, }, ], instruction_data, @@ -290,7 +290,7 @@ impl Token<'_> { &self, sender_account_id: AccountId, recipient_npk: NullifierPublicKey, - recipient_ipk: IncomingViewingPublicKey, + recipient_vpk: ViewingPublicKey, amount: u128, ) -> Result<(SendTxResponse, SharedSecretKey), ExecutionFailureKind> { let instruction = Instruction::Transfer { @@ -305,7 +305,7 @@ impl Token<'_> { PrivacyPreservingAccount::Public(sender_account_id), PrivacyPreservingAccount::PrivateForeign { npk: recipient_npk, - ipk: recipient_ipk, + vpk: recipient_vpk, }, ], instruction_data, @@ -525,7 +525,7 @@ impl Token<'_> { &self, definition_account_id: AccountId, holder_npk: NullifierPublicKey, - holder_ipk: IncomingViewingPublicKey, + holder_vpk: ViewingPublicKey, amount: u128, ) -> Result<(SendTxResponse, [SharedSecretKey; 2]), ExecutionFailureKind> { let instruction = Instruction::Mint { @@ -540,7 +540,7 @@ impl Token<'_> { PrivacyPreservingAccount::PrivateOwned(definition_account_id), PrivacyPreservingAccount::PrivateForeign { npk: holder_npk, - ipk: holder_ipk, + vpk: holder_vpk, }, ], instruction_data, @@ -621,7 +621,7 @@ impl Token<'_> { &self, definition_account_id: AccountId, holder_npk: NullifierPublicKey, - holder_ipk: IncomingViewingPublicKey, + holder_vpk: ViewingPublicKey, amount: u128, ) -> Result<(SendTxResponse, SharedSecretKey), ExecutionFailureKind> { let instruction = Instruction::Mint { @@ -636,7 +636,7 @@ impl Token<'_> { PrivacyPreservingAccount::Public(definition_account_id), PrivacyPreservingAccount::PrivateForeign { npk: holder_npk, - ipk: holder_ipk, + vpk: holder_vpk, }, ], instruction_data, diff --git a/wallet/src/transaction_utils.rs b/wallet/src/transaction_utils.rs index 123e49d3..2a48d3e6 100644 --- a/wallet/src/transaction_utils.rs +++ b/wallet/src/transaction_utils.rs @@ -7,7 +7,7 @@ use nssa::{ }; use nssa_core::{ Commitment, MembershipProof, NullifierPublicKey, NullifierSecretKey, SharedSecretKey, - account::AccountWithMetadata, encryption::IncomingViewingPublicKey, program::InstructionData, + account::AccountWithMetadata, encryption::ViewingPublicKey, program::InstructionData, }; use crate::{WalletCore, helperfunctions::produce_random_nonces}; @@ -15,7 +15,7 @@ use crate::{WalletCore, helperfunctions::produce_random_nonces}; pub(crate) struct AccountPreparedData { pub nsk: Option, pub npk: NullifierPublicKey, - pub ipk: IncomingViewingPublicKey, + pub vpk: ViewingPublicKey, pub auth_acc: AccountWithMetadata, pub proof: Option, } @@ -40,7 +40,7 @@ impl WalletCore { let mut proof = None; let from_npk = from_keys.nullifer_public_key; - let from_ipk = from_keys.incoming_viewing_public_key; + let from_vpk = from_keys.viewing_public_key; let sender_commitment = Commitment::new(&from_npk, &from_acc); @@ -61,7 +61,7 @@ impl WalletCore { Ok(AccountPreparedData { nsk, npk: from_npk, - ipk: from_ipk, + vpk: from_vpk, auth_acc: sender_pre, proof, }) @@ -79,7 +79,7 @@ impl WalletCore { let AccountPreparedData { nsk: from_nsk, npk: from_npk, - ipk: from_ipk, + vpk: from_vpk, auth_acc: sender_pre, proof: from_proof, } = self.private_acc_preparation(from, true, true).await?; @@ -87,7 +87,7 @@ impl WalletCore { let AccountPreparedData { nsk: to_nsk, npk: to_npk, - ipk: to_ipk, + vpk: to_vpk, auth_acc: recipient_pre, proof: _, } = self.private_acc_preparation(to, true, false).await?; @@ -95,10 +95,10 @@ impl WalletCore { tx_pre_check(&sender_pre.account, &recipient_pre.account)?; let eph_holder_from = EphemeralKeyHolder::new(&from_npk); - let shared_secret_from = eph_holder_from.calculate_shared_secret_sender(&from_ipk); + let shared_secret_from = eph_holder_from.calculate_shared_secret_sender(&from_vpk); let eph_holder_to = EphemeralKeyHolder::new(&to_npk); - let shared_secret_to = eph_holder_to.calculate_shared_secret_sender(&to_ipk); + let shared_secret_to = eph_holder_to.calculate_shared_secret_sender(&to_vpk); let (output, proof) = circuit::execute_and_prove( &[sender_pre, recipient_pre], @@ -123,12 +123,12 @@ impl WalletCore { vec![ ( from_npk.clone(), - from_ipk.clone(), + from_vpk.clone(), eph_holder_from.generate_ephemeral_public_key(), ), ( to_npk.clone(), - to_ipk.clone(), + to_vpk.clone(), eph_holder_to.generate_ephemeral_public_key(), ), ], @@ -156,7 +156,7 @@ impl WalletCore { let AccountPreparedData { nsk: from_nsk, npk: from_npk, - ipk: from_ipk, + vpk: from_vpk, auth_acc: sender_pre, proof: from_proof, } = self.private_acc_preparation(from, true, true).await?; @@ -164,7 +164,7 @@ impl WalletCore { let AccountPreparedData { nsk: _, npk: to_npk, - ipk: to_ipk, + vpk: to_vpk, auth_acc: recipient_pre, proof: _, } = self.private_acc_preparation(to, false, false).await?; @@ -172,10 +172,10 @@ impl WalletCore { tx_pre_check(&sender_pre.account, &recipient_pre.account)?; let eph_holder_from = EphemeralKeyHolder::new(&from_npk); - let shared_secret_from = eph_holder_from.calculate_shared_secret_sender(&from_ipk); + let shared_secret_from = eph_holder_from.calculate_shared_secret_sender(&from_vpk); let eph_holder_to = EphemeralKeyHolder::new(&to_npk); - let shared_secret_to = eph_holder_to.calculate_shared_secret_sender(&to_ipk); + let shared_secret_to = eph_holder_to.calculate_shared_secret_sender(&to_vpk); let (output, proof) = circuit::execute_and_prove( &[sender_pre, recipient_pre], @@ -197,12 +197,12 @@ impl WalletCore { vec![ ( from_npk.clone(), - from_ipk.clone(), + from_vpk.clone(), eph_holder_from.generate_ephemeral_public_key(), ), ( to_npk.clone(), - to_ipk.clone(), + to_vpk.clone(), eph_holder_to.generate_ephemeral_public_key(), ), ], @@ -223,7 +223,7 @@ impl WalletCore { &self, from: AccountId, to_npk: NullifierPublicKey, - to_ipk: IncomingViewingPublicKey, + to_vpk: ViewingPublicKey, instruction_data: InstructionData, tx_pre_check: impl FnOnce(&Account, &Account) -> Result<(), ExecutionFailureKind>, program: Program, @@ -231,7 +231,7 @@ impl WalletCore { let AccountPreparedData { nsk: from_nsk, npk: from_npk, - ipk: from_ipk, + vpk: from_vpk, auth_acc: sender_pre, proof: from_proof, } = self.private_acc_preparation(from, true, true).await?; @@ -244,8 +244,8 @@ impl WalletCore { let eph_holder = EphemeralKeyHolder::new(&to_npk); - let shared_secret_from = eph_holder.calculate_shared_secret_sender(&from_ipk); - let shared_secret_to = eph_holder.calculate_shared_secret_sender(&to_ipk); + let shared_secret_from = eph_holder.calculate_shared_secret_sender(&from_vpk); + let shared_secret_to = eph_holder.calculate_shared_secret_sender(&to_vpk); let (output, proof) = circuit::execute_and_prove( &[sender_pre, recipient_pre], @@ -267,12 +267,12 @@ impl WalletCore { vec![ ( from_npk.clone(), - from_ipk.clone(), + from_vpk.clone(), eph_holder.generate_ephemeral_public_key(), ), ( to_npk.clone(), - to_ipk.clone(), + to_vpk.clone(), eph_holder.generate_ephemeral_public_key(), ), ], @@ -301,7 +301,7 @@ impl WalletCore { let AccountPreparedData { nsk: from_nsk, npk: from_npk, - ipk: from_ipk, + vpk: from_vpk, auth_acc: sender_pre, proof: from_proof, } = self.private_acc_preparation(from, true, true).await?; @@ -315,7 +315,7 @@ impl WalletCore { let recipient_pre = AccountWithMetadata::new(to_acc.clone(), false, to); let eph_holder = EphemeralKeyHolder::new(&from_npk); - let shared_secret = eph_holder.calculate_shared_secret_sender(&from_ipk); + let shared_secret = eph_holder.calculate_shared_secret_sender(&from_vpk); let (output, proof) = circuit::execute_and_prove( &[sender_pre, recipient_pre], @@ -333,7 +333,7 @@ impl WalletCore { vec![], vec![( from_npk.clone(), - from_ipk.clone(), + from_vpk.clone(), eph_holder.generate_ephemeral_public_key(), )], output, @@ -366,7 +366,7 @@ impl WalletCore { let AccountPreparedData { nsk: to_nsk, npk: to_npk, - ipk: to_ipk, + vpk: to_vpk, auth_acc: recipient_pre, proof: _, } = self.private_acc_preparation(to, true, false).await?; @@ -376,7 +376,7 @@ impl WalletCore { let sender_pre = AccountWithMetadata::new(from_acc.clone(), true, from); let eph_holder = EphemeralKeyHolder::new(&to_npk); - let shared_secret = eph_holder.calculate_shared_secret_sender(&to_ipk); + let shared_secret = eph_holder.calculate_shared_secret_sender(&to_vpk); let (output, proof) = circuit::execute_and_prove( &[sender_pre, recipient_pre], @@ -394,7 +394,7 @@ impl WalletCore { vec![from_acc.nonce], vec![( to_npk.clone(), - to_ipk.clone(), + to_vpk.clone(), eph_holder.generate_ephemeral_public_key(), )], output, @@ -432,7 +432,7 @@ impl WalletCore { let AccountPreparedData { nsk: _, npk: to_npk, - ipk: to_ipk, + vpk: to_vpk, auth_acc: recipient_pre, proof: _, } = self.private_acc_preparation(to, false, false).await?; @@ -442,7 +442,7 @@ impl WalletCore { let sender_pre = AccountWithMetadata::new(from_acc.clone(), true, from); let eph_holder = EphemeralKeyHolder::new(&to_npk); - let shared_secret = eph_holder.calculate_shared_secret_sender(&to_ipk); + let shared_secret = eph_holder.calculate_shared_secret_sender(&to_vpk); let (output, proof) = circuit::execute_and_prove( &[sender_pre, recipient_pre], @@ -460,7 +460,7 @@ impl WalletCore { vec![from_acc.nonce], vec![( to_npk.clone(), - to_ipk.clone(), + to_vpk.clone(), eph_holder.generate_ephemeral_public_key(), )], output, @@ -487,7 +487,7 @@ impl WalletCore { &self, from: AccountId, to_npk: NullifierPublicKey, - to_ipk: IncomingViewingPublicKey, + to_vpk: ViewingPublicKey, instruction_data: InstructionData, tx_pre_check: impl FnOnce(&Account, &Account) -> Result<(), ExecutionFailureKind>, program: Program, @@ -504,7 +504,7 @@ impl WalletCore { let recipient_pre = AccountWithMetadata::new(to_acc.clone(), false, &to_npk); let eph_holder = EphemeralKeyHolder::new(&to_npk); - let shared_secret = eph_holder.calculate_shared_secret_sender(&to_ipk); + let shared_secret = eph_holder.calculate_shared_secret_sender(&to_vpk); let (output, proof) = circuit::execute_and_prove( &[sender_pre, recipient_pre], @@ -522,7 +522,7 @@ impl WalletCore { vec![from_acc.nonce], vec![( to_npk.clone(), - to_ipk.clone(), + to_vpk.clone(), eph_holder.generate_ephemeral_public_key(), )], output, @@ -548,13 +548,13 @@ impl WalletCore { let AccountPreparedData { nsk: _, npk: from_npk, - ipk: from_ipk, + vpk: from_vpk, auth_acc: sender_pre, proof: _, } = self.private_acc_preparation(from, false, false).await?; let eph_holder_from = EphemeralKeyHolder::new(&from_npk); - let shared_secret_from = eph_holder_from.calculate_shared_secret_sender(&from_ipk); + let shared_secret_from = eph_holder_from.calculate_shared_secret_sender(&from_vpk); let instruction: u128 = 0; @@ -574,7 +574,7 @@ impl WalletCore { vec![], vec![( from_npk.clone(), - from_ipk.clone(), + from_vpk.clone(), eph_holder_from.generate_ephemeral_public_key(), )], output,