diff --git a/.gitignore b/.gitignore index 8f6f072..fbe892d 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ data/ .idea/ .vscode/ rocksdb +Cargo.lock diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index 51ba37d..0000000 --- a/Cargo.lock +++ /dev/null @@ -1,6124 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "accounts" -version = "0.1.0" -dependencies = [ - "aes-gcm", - "anyhow", - "common", - "elliptic-curve", - "env_logger", - "hex", - "k256", - "lazy_static", - "log", - "rand 0.8.5", - "serde", - "serde_json", - "sha2", - "tiny-keccak", - "utxo", -] - -[[package]] -name = "actix" -version = "0.13.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de7fa236829ba0841304542f7614c42b80fca007455315c45c785ccfa873a85b" -dependencies = [ - "actix-macros", - "actix-rt", - "actix_derive", - "bitflags 2.9.1", - "bytes", - "crossbeam-channel", - "futures-core", - "futures-sink", - "futures-task", - "futures-util", - "log", - "once_cell", - "parking_lot", - "pin-project-lite", - "smallvec", - "tokio", - "tokio-util", -] - -[[package]] -name = "actix-codec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f7b0a21988c1bf877cf4759ef5ddaac04c1c9fe808c9142ecb78ba97d97a28a" -dependencies = [ - "bitflags 2.9.1", - "bytes", - "futures-core", - "futures-sink", - "memchr", - "pin-project-lite", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "actix-cors" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0346d8c1f762b41b458ed3145eea914966bb9ad20b9be0d6d463b20d45586370" -dependencies = [ - "actix-utils", - "actix-web", - "derive_more 0.99.20", - "futures-util", - "log", - "once_cell", - "smallvec", -] - -[[package]] -name = "actix-http" -version = "3.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44dfe5c9e0004c623edc65391dfd51daa201e7e30ebd9c9bedf873048ec32bc2" -dependencies = [ - "actix-codec", - "actix-rt", - "actix-service", - "actix-utils", - "base64 0.22.1", - "bitflags 2.9.1", - "bytes", - "bytestring", - "derive_more 2.0.1", - "encoding_rs", - "foldhash", - "futures-core", - "h2", - "http 0.2.12", - "httparse", - "httpdate", - "itoa", - "language-tags", - "local-channel", - "mime", - "percent-encoding", - "pin-project-lite", - "rand 0.9.2", - "sha1", - "smallvec", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "actix-macros" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" -dependencies = [ - "quote", - "syn 2.0.104", -] - -[[package]] -name = "actix-router" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13d324164c51f63867b57e73ba5936ea151b8a41a1d23d1031eeb9f70d0236f8" -dependencies = [ - "bytestring", - "cfg-if", - "http 0.2.12", - "regex", - "regex-lite", - "serde", - "tracing", -] - -[[package]] -name = "actix-rt" -version = "2.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24eda4e2a6e042aa4e55ac438a2ae052d3b5da0ecf83d7411e1a368946925208" -dependencies = [ - "futures-core", - "tokio", -] - -[[package]] -name = "actix-server" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a65064ea4a457eaf07f2fba30b4c695bf43b721790e9530d26cb6f9019ff7502" -dependencies = [ - "actix-rt", - "actix-service", - "actix-utils", - "futures-core", - "futures-util", - "mio", - "socket2 0.5.10", - "tokio", - "tracing", -] - -[[package]] -name = "actix-service" -version = "2.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e46f36bf0e5af44bdc4bdb36fbbd421aa98c79a9bce724e1edeb3894e10dc7f" -dependencies = [ - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "actix-utils" -version = "3.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88a1dcdff1466e3c2488e1cb5c36a71822750ad43839937f85d2f4d9f8b705d8" -dependencies = [ - "local-waker", - "pin-project-lite", -] - -[[package]] -name = "actix-web" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a27e8fe9ba4ae613c21f677c2cfaf0696c3744030c6f485b34634e502d6bb379" -dependencies = [ - "actix-codec", - "actix-http", - "actix-macros", - "actix-router", - "actix-rt", - "actix-server", - "actix-service", - "actix-utils", - "actix-web-codegen", - "ahash 0.7.8", - "bytes", - "bytestring", - "cfg-if", - "derive_more 0.99.20", - "encoding_rs", - "futures-core", - "futures-util", - "itoa", - "language-tags", - "log", - "mime", - "once_cell", - "pin-project-lite", - "regex", - "serde", - "serde_json", - "serde_urlencoded", - "smallvec", - "socket2 0.4.10", - "time", - "url", -] - -[[package]] -name = "actix-web-codegen" -version = "4.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f591380e2e68490b5dfaf1dd1aa0ebe78d84ba7067078512b4ea6e4492d622b8" -dependencies = [ - "actix-router", - "proc-macro2", - "quote", - "syn 2.0.104", -] - -[[package]] -name = "actix_derive" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6ac1e58cded18cb28ddc17143c4dea5345b3ad575e14f32f66e4054a56eb271" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", -] - -[[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.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" -dependencies = [ - "cpp_demangle", - "fallible-iterator", - "gimli 0.29.0", - "memmap2", - "object 0.35.0", - "rustc-demangle", - "smallvec", -] - -[[package]] -name = "addr2line" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" -dependencies = [ - "gimli 0.31.1", -] - -[[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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" -dependencies = [ - "crypto-common", - "generic-array", -] - -[[package]] -name = "aes" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", -] - -[[package]] -name = "aes-gcm" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" -dependencies = [ - "aead", - "aes", - "cipher", - "ctr", - "ghash", - "subtle", -] - -[[package]] -name = "ahash" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" -dependencies = [ - "getrandom 0.2.16", - "once_cell", - "version_check", -] - -[[package]] -name = "ahash" -version = "0.8.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy", -] - -[[package]] -name = "aho-corasick" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", -] - -[[package]] -name = "allocator-api2" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" - -[[package]] -name = "anyhow" -version = "1.0.98" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" -dependencies = [ - "backtrace", -] - -[[package]] -name = "approx" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" -dependencies = [ - "num-traits", -] - -[[package]] -name = "arbitrary" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" -dependencies = [ - "derive_arbitrary", -] - -[[package]] -name = "ark-bn254" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d69eab57e8d2663efa5c63135b2af4f396d66424f88954c21104125ab6b3e6bc" -dependencies = [ - "ark-ec", - "ark-ff", - "ark-r1cs-std", - "ark-std", -] - -[[package]] -name = "ark-crypto-primitives" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0c292754729c8a190e50414fd1a37093c786c709899f29c9f7daccecfa855e" -dependencies = [ - "ahash 0.8.12", - "ark-crypto-primitives-macros", - "ark-ec", - "ark-ff", - "ark-relations", - "ark-serialize", - "ark-snark", - "ark-std", - "blake2", - "derivative", - "digest", - "fnv", - "merlin", - "sha2", -] - -[[package]] -name = "ark-crypto-primitives-macros" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7e89fe77d1f0f4fe5b96dfc940923d88d17b6a773808124f21e764dfb063c6a" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", -] - -[[package]] -name = "ark-ec" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43d68f2d516162846c1238e755a7c4d131b892b70cc70c471a8e3ca3ed818fce" -dependencies = [ - "ahash 0.8.12", - "ark-ff", - "ark-poly", - "ark-serialize", - "ark-std", - "educe", - "fnv", - "hashbrown 0.15.4", - "itertools 0.13.0", - "num-bigint 0.4.6", - "num-integer", - "num-traits", - "zeroize", -] - -[[package]] -name = "ark-ff" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a177aba0ed1e0fbb62aa9f6d0502e9b46dad8c2eab04c14258a1212d2557ea70" -dependencies = [ - "ark-ff-asm", - "ark-ff-macros", - "ark-serialize", - "ark-std", - "arrayvec", - "digest", - "educe", - "itertools 0.13.0", - "num-bigint 0.4.6", - "num-traits", - "paste", - "zeroize", -] - -[[package]] -name = "ark-ff-asm" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62945a2f7e6de02a31fe400aa489f0e0f5b2502e69f95f853adb82a96c7a6b60" -dependencies = [ - "quote", - "syn 2.0.104", -] - -[[package]] -name = "ark-ff-macros" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09be120733ee33f7693ceaa202ca41accd5653b779563608f1234f78ae07c4b3" -dependencies = [ - "num-bigint 0.4.6", - "num-traits", - "proc-macro2", - "quote", - "syn 2.0.104", -] - -[[package]] -name = "ark-groth16" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88f1d0f3a534bb54188b8dcc104307db6c56cdae574ddc3212aec0625740fc7e" -dependencies = [ - "ark-crypto-primitives", - "ark-ec", - "ark-ff", - "ark-poly", - "ark-relations", - "ark-serialize", - "ark-std", -] - -[[package]] -name = "ark-poly" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "579305839da207f02b89cd1679e50e67b4331e2f9294a57693e5051b7703fe27" -dependencies = [ - "ahash 0.8.12", - "ark-ff", - "ark-serialize", - "ark-std", - "educe", - "fnv", - "hashbrown 0.15.4", -] - -[[package]] -name = "ark-r1cs-std" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "941551ef1df4c7a401de7068758db6503598e6f01850bdb2cfdb614a1f9dbea1" -dependencies = [ - "ark-ec", - "ark-ff", - "ark-relations", - "ark-std", - "educe", - "num-bigint 0.4.6", - "num-integer", - "num-traits", - "tracing", -] - -[[package]] -name = "ark-relations" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec46ddc93e7af44bcab5230937635b06fb5744464dd6a7e7b083e80ebd274384" -dependencies = [ - "ark-ff", - "ark-std", - "tracing", - "tracing-subscriber", -] - -[[package]] -name = "ark-serialize" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f4d068aaf107ebcd7dfb52bc748f8030e0fc930ac8e360146ca54c1203088f7" -dependencies = [ - "ark-serialize-derive", - "ark-std", - "arrayvec", - "digest", - "num-bigint 0.4.6", -] - -[[package]] -name = "ark-serialize-derive" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213888f660fddcca0d257e88e54ac05bca01885f258ccdf695bafd77031bb69d" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", -] - -[[package]] -name = "ark-snark" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d368e2848c2d4c129ce7679a7d0d2d612b6a274d3ea6a13bad4445d61b381b88" -dependencies = [ - "ark-ff", - "ark-relations", - "ark-serialize", - "ark-std", -] - -[[package]] -name = "ark-std" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "246a225cc6131e9ee4f24619af0f19d67761fff15d7ccc22e42b80846e69449a" -dependencies = [ - "num-traits", - "rand 0.8.5", -] - -[[package]] -name = "arraydeque" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d902e3d592a523def97af8f317b08ce16b7ab854c1985a0c671e6f15cebc236" - -[[package]] -name = "arrayvec" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" - -[[package]] -name = "atomic-polyfill" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cf2bce30dfe09ef0bfaef228b9d414faaf7e563035494d7fe092dba54b300f4" -dependencies = [ - "critical-section", -] - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] - -[[package]] -name = "auto_ops" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7460f7dd8e100147b82a63afca1a20eb6c231ee36b90ba7272e14951cb58af59" - -[[package]] -name = "autocfg" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" - -[[package]] -name = "backtrace" -version = "0.3.75" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002" -dependencies = [ - "addr2line 0.24.2", - "cfg-if", - "libc", - "miniz_oxide", - "object 0.36.7", - "rustc-demangle", - "windows-targets 0.52.6", -] - -[[package]] -name = "base16ct" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" - -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - -[[package]] -name = "base64" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" - -[[package]] -name = "base64ct" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" - -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - -[[package]] -name = "bindgen" -version = "0.65.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5" -dependencies = [ - "bitflags 1.3.2", - "cexpr", - "clang-sys", - "lazy_static", - "lazycell", - "peeking_take_while", - "prettyplease", - "proc-macro2", - "quote", - "regex", - "rustc-hash 1.1.0", - "shlex", - "syn 2.0.104", -] - -[[package]] -name = "bit-vec" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" - -[[package]] -name = "bitcoin-private" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73290177011694f38ec25e165d0387ab7ea749a4b81cd4c80dae5988229f7a57" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" - -[[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" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" -dependencies = [ - "digest", -] - -[[package]] -name = "block" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "bonsai-sdk" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bce8d6acc5286a16e94c29e9c885d1869358885e08a6feeb6bc54e36fe20055" -dependencies = [ - "duplicate", - "maybe-async", - "reqwest 0.12.22", - "serde", - "thiserror 1.0.69", -] - -[[package]] -name = "bonsai-sdk" -version = "1.4.0" -source = "git+https://github.com/risc0/risc0.git?branch=release-2.3#03853380e36e1a093bf06d306601f7358151e2ed" -dependencies = [ - "duplicate", - "maybe-async", - "reqwest 0.12.22", - "serde", - "thiserror 1.0.69", -] - -[[package]] -name = "borsh" -version = "1.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad8646f98db542e39fc66e68a20b2144f6a732636df7c2354e74645faaa433ce" -dependencies = [ - "borsh-derive", - "cfg_aliases", -] - -[[package]] -name = "borsh-derive" -version = "1.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdd1d3c0c2f5833f22386f252fe8ed005c7f59fdcddeef025c01b4c3b9fd9ac3" -dependencies = [ - "once_cell", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.104", -] - -[[package]] -name = "bumpalo" -version = "3.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" - -[[package]] -name = "bytemuck" -version = "1.23.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c76a5792e44e4abe34d3abf15636779261d45a7450612059293d1d2cfc63422" -dependencies = [ - "bytemuck_derive", -] - -[[package]] -name = "bytemuck_derive" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fa76293b4f7bb636ab88fd78228235b5248b4d05cc589aed610f954af5d7c7a" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", -] - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "bytes" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" -dependencies = [ - "serde", -] - -[[package]] -name = "bytestring" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e465647ae23b2823b0753f50decb2d5a86d2bb2cac04788fafd1f80e45378e5f" -dependencies = [ - "bytes", -] - -[[package]] -name = "bzip2-sys" -version = "0.1.13+1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225bff33b2141874fe80d71e07d6eec4f85c5c216453dd96388240f96e1acc14" -dependencies = [ - "cc", - "pkg-config", -] - -[[package]] -name = "camino" -version = "1.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0da45bc31171d8d6960122e222a67740df867c1dd53b4d51caa297084c185cab" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo-platform" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo_metadata" -version = "0.19.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba" -dependencies = [ - "camino", - "cargo-platform", - "semver", - "serde", - "serde_json", - "thiserror 2.0.12", -] - -[[package]] -name = "cc" -version = "1.2.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3a42d84bb6b69d3a8b3eaacf0d88f179e1929695e1ad012b6cf64d9caaa5fd2" -dependencies = [ - "jobserver", - "libc", - "shlex", -] - -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" -dependencies = [ - "nom", -] - -[[package]] -name = "cfg-if" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" - -[[package]] -name = "cfg_aliases" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" - -[[package]] -name = "cipher" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" -dependencies = [ - "crypto-common", - "inout", -] - -[[package]] -name = "clang-sys" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" -dependencies = [ - "glob", - "libc", - "libloading", -] - -[[package]] -name = "clap" -version = "3.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" -dependencies = [ - "atty", - "bitflags 1.3.2", - "clap_derive", - "clap_lex", - "indexmap 1.9.3", - "once_cell", - "strsim 0.10.0", - "termcolor", - "textwrap", -] - -[[package]] -name = "clap_derive" -version = "3.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae6371b8bdc8b7d3959e9cf7b22d4435ef3e79e138688421ec654acf8c81b008" -dependencies = [ - "heck 0.4.1", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "clap_lex" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" -dependencies = [ - "os_str_bytes", -] - -[[package]] -name = "cobs" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1" -dependencies = [ - "thiserror 2.0.12", -] - -[[package]] -name = "common" -version = "0.1.0" -dependencies = [ - "anyhow", - "elliptic-curve", - "hex", - "k256", - "log", - "nssa", - "reqwest 0.11.27", - "rs_merkle", - "secp256k1-zkp", - "serde", - "serde_json", - "sha2", - "thiserror 1.0.69", -] - -[[package]] -name = "consensus" -version = "0.1.0" -dependencies = [ - "anyhow", - "env_logger", - "log", - "networking", - "serde", - "serde_json", - "tokio", -] - -[[package]] -name = "const-oid" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" - -[[package]] -name = "convert_case" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" - -[[package]] -name = "core-foundation" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - -[[package]] -name = "core-graphics-types" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "libc", -] - -[[package]] -name = "cpp_demangle" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96e58d342ad113c2b878f16d5d034c03be492ae460cdbc02b7f0f2284d310c7d" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "cpufeatures" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" -dependencies = [ - "libc", -] - -[[package]] -name = "crc32fast" -version = "1.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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" -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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" - -[[package]] -name = "crunchy" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" - -[[package]] -name = "crypto-bigint" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" -dependencies = [ - "generic-array", - "rand_core 0.6.4", - "subtle", - "zeroize", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "rand_core 0.6.4", - "typenum", -] - -[[package]] -name = "ctr" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" -dependencies = [ - "cipher", -] - -[[package]] -name = "cust" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d6cc71911e179f12483b9734120b45bd00bf64fab085cc4818428523eedd469" -dependencies = [ - "bitflags 1.3.2", - "bytemuck", - "cust_core", - "cust_derive", - "cust_raw", - "find_cuda_helper", -] - -[[package]] -name = "cust_core" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "039f79662cb8f890cbf335e818cd522d6e3a53fe63f61d1aaaf859cd3d975f06" -dependencies = [ - "cust_derive", - "glam", - "mint", - "vek", -] - -[[package]] -name = "cust_derive" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8a3bc95fe629aed92b2423de6ccff9e40174b21d19cb6ee6281a4d04ac72f66" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "cust_raw" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbf40d6ade12cb9828bbc844b9875c7b93d25e67a3c9bf61c7aa3ae09e402bf8" -dependencies = [ - "find_cuda_helper", -] - -[[package]] -name = "darling" -version = "0.20.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.20.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.11.1", - "syn 2.0.104", -] - -[[package]] -name = "darling_macro" -version = "0.20.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" -dependencies = [ - "darling_core", - "quote", - "syn 2.0.104", -] - -[[package]] -name = "der" -version = "0.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" -dependencies = [ - "const-oid", - "pem-rfc7468", - "zeroize", -] - -[[package]] -name = "deranged" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e" -dependencies = [ - "powerfmt", -] - -[[package]] -name = "derivative" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "derive_arbitrary" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30542c1ad912e0e3d22a1935c290e12e8a29d704a420177a31faad4a601a0800" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", -] - -[[package]] -name = "derive_builder" -version = "0.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "507dfb09ea8b7fa618fcf76e953f4f5e192547945816d5358edffe39f6f94947" -dependencies = [ - "derive_builder_macro", -] - -[[package]] -name = "derive_builder_core" -version = "0.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.104", -] - -[[package]] -name = "derive_builder_macro" -version = "0.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" -dependencies = [ - "derive_builder_core", - "syn 2.0.104", -] - -[[package]] -name = "derive_more" -version = "0.99.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6edb4b64a43d977b8e99788fe3a04d483834fba1215a7e02caa415b626497f7f" -dependencies = [ - "convert_case", - "proc-macro2", - "quote", - "rustc_version", - "syn 2.0.104", -] - -[[package]] -name = "derive_more" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678" -dependencies = [ - "derive_more-impl", -] - -[[package]] -name = "derive_more-impl" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", - "unicode-xid", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "const-oid", - "crypto-common", - "subtle", -] - -[[package]] -name = "directories" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" -dependencies = [ - "libc", - "option-ext", - "redox_users", - "windows-sys 0.48.0", -] - -[[package]] -name = "displaydoc" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", -] - -[[package]] -name = "docker-generate" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf673e0848ef09fa4aeeba78e681cf651c0c7d35f76ee38cec8e55bc32fa111" - -[[package]] -name = "downcast-rs" -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 0.12.22", - "thiserror 1.0.69", - "tokio", -] - -[[package]] -name = "duplicate" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de78e66ac9061e030587b2a2e75cc88f22304913c907b11307bca737141230cb" -dependencies = [ - "heck 0.4.1", - "proc-macro-error", -] - -[[package]] -name = "ecdsa" -version = "0.16.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" -dependencies = [ - "der", - "digest", - "elliptic-curve", - "rfc6979", - "serdect", - "signature", - "spki", -] - -[[package]] -name = "educe" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7bc049e1bd8cdeb31b68bbd586a9464ecf9f3944af3958a7a9d0f8b9799417" -dependencies = [ - "enum-ordinalize", - "proc-macro2", - "quote", - "syn 2.0.104", -] - -[[package]] -name = "either" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" - -[[package]] -name = "elf" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4445909572dbd556c457c849c4ca58623d84b27c8fff1e74b0b4227d8b90d17b" - -[[package]] -name = "elliptic-curve" -version = "0.13.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" -dependencies = [ - "base16ct", - "crypto-bigint", - "digest", - "ff", - "generic-array", - "group", - "pem-rfc7468", - "pkcs8", - "rand_core 0.6.4", - "sec1", - "serdect", - "subtle", - "zeroize", -] - -[[package]] -name = "embedded-io" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" - -[[package]] -name = "embedded-io" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" - -[[package]] -name = "encoding_rs" -version = "0.8.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" -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.104", -] - -[[package]] -name = "enum-ordinalize" -version = "4.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea0dcfa4e54eeb516fe454635a95753ddd39acda650ce703031c6973e315dd5" -dependencies = [ - "enum-ordinalize-derive", -] - -[[package]] -name = "enum-ordinalize-derive" -version = "4.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d28318a75d4aead5c4db25382e8ef717932d0346600cacae6357eb5941bc5ff" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", -] - -[[package]] -name = "env_logger" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" -dependencies = [ - "humantime", - "is-terminal", - "log", - "regex", - "termcolor", -] - -[[package]] -name = "equivalent" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" - -[[package]] -name = "erased-serde" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e004d887f51fcb9fef17317a2f3525c887d8aa3f4f50fed920816a688284a5b7" -dependencies = [ - "serde", - "typeid", -] - -[[package]] -name = "errno" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" -dependencies = [ - "libc", - "windows-sys 0.60.2", -] - -[[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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" - -[[package]] -name = "ff" -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 = "find_cuda_helper" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9f9e65c593dd01ac77daad909ea4ad17f0d6d1776193fc8ea766356177abdad" -dependencies = [ - "glob", -] - -[[package]] -name = "flate2" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "foldhash" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" - -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared 0.1.1", -] - -[[package]] -name = "foreign-types" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" -dependencies = [ - "foreign-types-macros", - "foreign-types-shared 0.3.1", -] - -[[package]] -name = "foreign-types-macros" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - -[[package]] -name = "foreign-types-shared" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" - -[[package]] -name = "form_urlencoded" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "funty" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" - -[[package]] -name = "futures" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" - -[[package]] -name = "futures-executor" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" - -[[package]] -name = "futures-macro" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", -] - -[[package]] -name = "futures-sink" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" - -[[package]] -name = "futures-task" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" - -[[package]] -name = "futures-util" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", - "zeroize", -] - -[[package]] -name = "getrandom" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi 0.11.1+wasi-snapshot-preview1", - "wasm-bindgen", -] - -[[package]] -name = "getrandom" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "r-efi", - "wasi 0.14.2+wasi-0.2.4", - "wasm-bindgen", -] - -[[package]] -name = "ghash" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1" -dependencies = [ - "opaque-debug", - "polyval", -] - -[[package]] -name = "gimli" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" -dependencies = [ - "fallible-iterator", - "stable_deref_trait", -] - -[[package]] -name = "gimli" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" - -[[package]] -name = "glam" -version = "0.20.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43e957e744be03f5801a55472f593d43fabdebf25a4585db250f04d86b1675f" -dependencies = [ - "num-traits", -] - -[[package]] -name = "glob" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" - -[[package]] -name = "group" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" -dependencies = [ - "ff", - "rand_core 0.6.4", - "subtle", -] - -[[package]] -name = "h2" -version = "0.3.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0beca50380b1fc32983fc1cb4587bfa4bb9e78fc259aad4a0032d2080309222d" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 0.2.12", - "indexmap 2.10.0", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "half" -version = "1.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403" - -[[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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -dependencies = [ - "ahash 0.7.8", -] - -[[package]] -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" -version = "0.15.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" -dependencies = [ - "allocator-api2", -] - -[[package]] -name = "hashlink" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" -dependencies = [ - "hashbrown 0.14.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.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "hermit-abi" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "hex-literal" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest", -] - -[[package]] -name = "home" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "http" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" -dependencies = [ - "bytes", - "http 0.2.12", - "pin-project-lite", -] - -[[package]] -name = "http-body" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" -dependencies = [ - "bytes", - "http 1.3.1", -] - -[[package]] -name = "http-body-util" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" -dependencies = [ - "bytes", - "futures-core", - "http 1.3.1", - "http-body 1.0.1", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" - -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - -[[package]] -name = "humantime" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b112acc8b3adf4b107a8ec20977da0273a8c386765a3ec0229bd500a1443f9f" - -[[package]] -name = "hyper" -version = "0.14.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http 0.2.12", - "http-body 0.4.6", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2 0.5.10", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "hyper" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "http 1.3.1", - "http-body 1.0.1", - "httparse", - "itoa", - "pin-project-lite", - "smallvec", - "tokio", - "want", -] - -[[package]] -name = "hyper-rustls" -version = "0.27.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" -dependencies = [ - "http 1.3.1", - "hyper 1.6.0", - "hyper-util", - "rustls", - "rustls-pki-types", - "tokio", - "tokio-rustls", - "tower-service", - "webpki-roots", -] - -[[package]] -name = "hyper-tls" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" -dependencies = [ - "bytes", - "hyper 0.14.32", - "native-tls", - "tokio", - "tokio-native-tls", -] - -[[package]] -name = "hyper-util" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d9b05277c7e8da2c93a568989bb6207bef0112e8d17df7a6eda4a3cf143bc5e" -dependencies = [ - "base64 0.22.1", - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "http 1.3.1", - "http-body 1.0.1", - "hyper 1.6.0", - "ipnet", - "libc", - "percent-encoding", - "pin-project-lite", - "socket2 0.6.0", - "tokio", - "tower-service", - "tracing", -] - -[[package]] -name = "icu_collections" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" -dependencies = [ - "displaydoc", - "potential_utf", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locale_core" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_normalizer" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" - -[[package]] -name = "icu_properties" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_locale_core", - "icu_properties_data", - "icu_provider", - "potential_utf", - "zerotrie", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" - -[[package]] -name = "icu_provider" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" -dependencies = [ - "displaydoc", - "icu_locale_core", - "stable_deref_trait", - "tinystr", - "writeable", - "yoke", - "zerofrom", - "zerotrie", - "zerovec", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "idna" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" -dependencies = [ - "idna_adapter", - "smallvec", - "utf8_iter", -] - -[[package]] -name = "idna_adapter" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" -dependencies = [ - "icu_normalizer", - "icu_properties", -] - -[[package]] -name = "include_bytes_aligned" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ee796ad498c8d9a1d68e477df8f754ed784ef875de1414ebdaf169f70a6a784" - -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - -[[package]] -name = "indexmap" -version = "2.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" -dependencies = [ - "equivalent", - "hashbrown 0.15.4", -] - -[[package]] -name = "inout" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" -dependencies = [ - "generic-array", -] - -[[package]] -name = "inventory" -version = "0.3.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab08d7cd2c5897f2c949e5383ea7c7db03fb19130ffcfbf7eda795137ae3cb83" -dependencies = [ - "rustversion", -] - -[[package]] -name = "io-uring" -version = "0.7.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d93587f37623a1a17d94ef2bc9ada592f5465fe7732084ab7beefabe5c77c0c4" -dependencies = [ - "bitflags 2.9.1", - "cfg-if", - "libc", -] - -[[package]] -name = "ipnet" -version = "2.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" - -[[package]] -name = "iri-string" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbc5ebe9c3a1a7a5127f920a418f7585e9e758e911d0466ed004f393b0e380b2" -dependencies = [ - "memchr", - "serde", -] - -[[package]] -name = "is-terminal" -version = "0.4.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e04d7f318608d35d4b61ddd75cbdaee86b023ebe2bd5a66ee0915f0bf93095a9" -dependencies = [ - "hermit-abi 0.5.2", - "libc", - "windows-sys 0.59.0", -] - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" -dependencies = [ - "either", -] - -[[package]] -name = "itertools" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" - -[[package]] -name = "jobserver" -version = "0.1.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a" -dependencies = [ - "getrandom 0.3.3", - "libc", -] - -[[package]] -name = "js-sys" -version = "0.3.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" -dependencies = [ - "once_cell", - "wasm-bindgen", -] - -[[package]] -name = "k256" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" -dependencies = [ - "cfg-if", - "ecdsa", - "elliptic-curve", - "once_cell", - "serdect", - "sha2", - "signature", -] - -[[package]] -name = "keccak" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" -dependencies = [ - "cpufeatures", -] - -[[package]] -name = "language-tags" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388" - -[[package]] -name = "lazy-regex" -version = "3.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60c7310b93682b36b98fa7ea4de998d3463ccbebd94d935d6b48ba5b6ffa7126" -dependencies = [ - "lazy-regex-proc_macros", - "once_cell", - "regex", -] - -[[package]] -name = "lazy-regex-proc_macros" -version = "3.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ba01db5ef81e17eb10a5e0f2109d1b3a3e29bac3070fdbd7d156bf7dbd206a1" -dependencies = [ - "proc-macro2", - "quote", - "regex", - "syn 2.0.104", -] - -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" -dependencies = [ - "spin", -] - -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - -[[package]] -name = "libc" -version = "0.2.174" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" - -[[package]] -name = "libloading" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667" -dependencies = [ - "cfg-if", - "windows-targets 0.53.3", -] - -[[package]] -name = "libm" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" - -[[package]] -name = "libredox" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "391290121bad3d37fbddad76d8f5d1c1c314cfc646d143d7e07a3086ddff0ce3" -dependencies = [ - "bitflags 2.9.1", - "libc", -] - -[[package]] -name = "librocksdb-sys" -version = "0.11.0+8.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3386f101bcb4bd252d8e9d2fb41ec3b0862a15a62b478c355b2982efa469e3e" -dependencies = [ - "bindgen", - "bzip2-sys", - "cc", - "glob", - "libc", - "libz-sys", -] - -[[package]] -name = "libz-sys" -version = "1.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b70e7a7df205e92a1a4cd9aaae7898dac0aa555503cc0a649494d0d60e7651d" -dependencies = [ - "cc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "light-poseidon" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3d87542063daaccbfecd78b60f988079b6ec4e089249658b9455075c78d42" -dependencies = [ - "ark-bn254", - "ark-ff", - "num-bigint 0.4.6", - "thiserror 1.0.69", -] - -[[package]] -name = "linux-raw-sys" -version = "0.4.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" - -[[package]] -name = "linux-raw-sys" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" - -[[package]] -name = "litemap" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" - -[[package]] -name = "local-channel" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6cbc85e69b8df4b8bb8b89ec634e7189099cea8927a276b7384ce5488e53ec8" -dependencies = [ - "futures-core", - "futures-sink", - "local-waker", -] - -[[package]] -name = "local-waker" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d873d7c67ce09b42110d801813efbc9364414e356be9935700d368351657487" - -[[package]] -name = "lock_api" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" - -[[package]] -name = "lru" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" -dependencies = [ - "hashbrown 0.12.3", -] - -[[package]] -name = "lru-slab" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" - -[[package]] -name = "lzma-sys" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fda04ab3764e6cde78b9974eec4f779acaba7c4e84b36eca3cf77c581b85d27" -dependencies = [ - "cc", - "libc", - "pkg-config", -] - -[[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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" -dependencies = [ - "libc", -] - -[[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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cf92c10c7e361d6b99666ec1c6f9805b0bea2c3bd8c78dc6fe98ac5bd78db11" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", -] - -[[package]] -name = "memchr" -version = "2.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" - -[[package]] -name = "memmap2" -version = "0.9.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "483758ad303d734cec05e5c12b41d7e93e6a6390c5e9dae6bdeb7c1259012d28" -dependencies = [ - "libc", -] - -[[package]] -name = "mempool" -version = "0.1.0" -dependencies = [ - "anyhow", - "env_logger", - "log", - "serde", - "serde_json", -] - -[[package]] -name = "merlin" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d" -dependencies = [ - "byteorder", - "keccak", - "rand_core 0.6.4", - "zeroize", -] - -[[package]] -name = "metal" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ecfd3296f8c56b7c1f6fbac3c71cefa9d78ce009850c45000015f206dc7fa21" -dependencies = [ - "bitflags 2.9.1", - "block", - "core-graphics-types", - "foreign-types 0.5.0", - "log", - "objc", - "paste", -] - -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - -[[package]] -name = "miniz_oxide" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" -dependencies = [ - "adler2", -] - -[[package]] -name = "mint" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e53debba6bda7a793e5f99b8dacf19e626084f525f7829104ba9898f367d85ff" - -[[package]] -name = "mio" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" -dependencies = [ - "libc", - "log", - "wasi 0.11.1+wasi-snapshot-preview1", - "windows-sys 0.59.0", -] - -[[package]] -name = "native-tls" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" -dependencies = [ - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "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 = "networking" -version = "0.1.0" -dependencies = [ - "anyhow", - "env_logger", - "log", - "serde", - "serde_json", -] - -[[package]] -name = "no_std_strings" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5b0c77c1b780822bc749a33e39aeb2c07584ab93332303babeabb645298a76e" - -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "nssa" -version = "0.1.0" -dependencies = [ - "nssa-core", - "program-methods", - "risc0-zkvm 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde", - "serde_cbor", - "sha2", -] - -[[package]] -name = "nssa-core" -version = "0.1.0" -dependencies = [ - "risc0-zkvm 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde", -] - -[[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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" -dependencies = [ - "num-integer", - "num-traits", -] - -[[package]] -name = "num-complex" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-conv" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" - -[[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.104", -] - -[[package]] -name = "num-integer" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", - "libm", -] - -[[package]] -name = "nvtx" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad2e855e8019f99e4b94ac33670eb4e4f570a2e044f3749a0b2c7f83b841e52c" -dependencies = [ - "cc", -] - -[[package]] -name = "objc" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" -dependencies = [ - "malloc_buf", -] - -[[package]] -name = "object" -version = "0.35.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8ec7ab813848ba4522158d5517a6093db1ded27575b070f4177b8d12b41db5e" -dependencies = [ - "flate2", - "memchr", - "ruzstd", -] - -[[package]] -name = "object" -version = "0.36.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" - -[[package]] -name = "opaque-debug" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" - -[[package]] -name = "openssl" -version = "0.10.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8" -dependencies = [ - "bitflags 2.9.1", - "cfg-if", - "foreign-types 0.3.2", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", -] - -[[package]] -name = "openssl-probe" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" - -[[package]] -name = "openssl-sys" -version = "0.9.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90096e2e47630d78b7d1c20952dc621f957103f8bc2c8359ec81290d75238571" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "option-ext" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" - -[[package]] -name = "os_str_bytes" -version = "6.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" - -[[package]] -name = "parking_lot" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets 0.52.6", -] - -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - -[[package]] -name = "pem-rfc7468" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" -dependencies = [ - "base64ct", -] - -[[package]] -name = "percent-encoding" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" - -[[package]] -name = "pin-project-lite" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkcs8" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" -dependencies = [ - "der", - "spki", -] - -[[package]] -name = "pkg-config" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" - -[[package]] -name = "polyval" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" -dependencies = [ - "cfg-if", - "cpufeatures", - "opaque-debug", - "universal-hash", -] - -[[package]] -name = "portable-atomic" -version = "1.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" - -[[package]] -name = "portable-atomic-util" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" -dependencies = [ - "portable-atomic", -] - -[[package]] -name = "postcard" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24" -dependencies = [ - "cobs", - "embedded-io 0.4.0", - "embedded-io 0.6.1", - "heapless", - "serde", -] - -[[package]] -name = "potential_utf" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5a7c30837279ca13e7c867e9e40053bc68740f988cb07f7ca6df43cc734b585" -dependencies = [ - "zerovec", -] - -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - -[[package]] -name = "ppv-lite86" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" -dependencies = [ - "zerocopy", -] - -[[package]] -name = "prettyplease" -version = "0.2.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff24dfcda44452b9816fff4cd4227e1bb73ff5a2f1bc1105aa92fb8565ce44d2" -dependencies = [ - "proc-macro2", - "syn 2.0.104", -] - -[[package]] -name = "proc-macro-crate" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35" -dependencies = [ - "toml_edit 0.22.27", -] - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - -[[package]] -name = "proc-macro2" -version = "1.0.95" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "program-methods" -version = "0.1.0" -dependencies = [ - "risc0-build 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "prost" -version = "0.13.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2796faa41db3ec313a31f7624d9286acf277b52de526150b7e69f3debf891ee5" -dependencies = [ - "bytes", - "prost-derive", -] - -[[package]] -name = "prost-derive" -version = "0.13.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d" -dependencies = [ - "anyhow", - "itertools 0.14.0", - "proc-macro2", - "quote", - "syn 2.0.104", -] - -[[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.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "626214629cda6781b6dc1d316ba307189c85ba657213ce642d9c77670f8202c8" -dependencies = [ - "bytes", - "cfg_aliases", - "pin-project-lite", - "quinn-proto", - "quinn-udp", - "rustc-hash 2.1.1", - "rustls", - "socket2 0.5.10", - "thiserror 2.0.12", - "tokio", - "tracing", - "web-time", -] - -[[package]] -name = "quinn-proto" -version = "0.11.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49df843a9161c85bb8aae55f101bc0bac8bcafd637a620d9122fd7e0b2f7422e" -dependencies = [ - "bytes", - "getrandom 0.3.3", - "lru-slab", - "rand 0.9.2", - "ring", - "rustc-hash 2.1.1", - "rustls", - "rustls-pki-types", - "slab", - "thiserror 2.0.12", - "tinyvec", - "tracing", - "web-time", -] - -[[package]] -name = "quinn-udp" -version = "0.5.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcebb1209ee276352ef14ff8732e24cc2b02bbac986cd74a4c81bcb2f9881970" -dependencies = [ - "cfg_aliases", - "libc", - "once_cell", - "socket2 0.5.10", - "tracing", - "windows-sys 0.59.0", -] - -[[package]] -name = "quote" -version = "1.0.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "r-efi" -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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", -] - -[[package]] -name = "rand" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" -dependencies = [ - "rand_chacha 0.9.0", - "rand_core 0.9.3", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_chacha" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" -dependencies = [ - "ppv-lite86", - "rand_core 0.9.3", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.16", -] - -[[package]] -name = "rand_core" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" -dependencies = [ - "getrandom 0.3.3", -] - -[[package]] -name = "rawpointer" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" - -[[package]] -name = "rayon" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - -[[package]] -name = "redox_syscall" -version = "0.5.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77" -dependencies = [ - "bitflags 2.9.1", -] - -[[package]] -name = "redox_users" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" -dependencies = [ - "getrandom 0.2.16", - "libredox", - "thiserror 1.0.69", -] - -[[package]] -name = "regex" -version = "1.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-lite" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53a49587ad06b26609c52e423de037e7f57f20d53535d66e08c695f347df952a" - -[[package]] -name = "regex-syntax" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" - -[[package]] -name = "reqwest" -version = "0.11.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" -dependencies = [ - "base64 0.21.7", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.32", - "hyper-tls", - "ipnet", - "js-sys", - "log", - "mime", - "native-tls", - "once_cell", - "percent-encoding", - "pin-project-lite", - "rustls-pemfile", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper 0.1.2", - "system-configuration", - "tokio", - "tokio-native-tls", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winreg", -] - -[[package]] -name = "reqwest" -version = "0.12.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbc931937e6ca3a06e3b6c0aa7841849b160a90351d6ab467a8b9b9959767531" -dependencies = [ - "base64 0.22.1", - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "http 1.3.1", - "http-body 1.0.1", - "http-body-util", - "hyper 1.6.0", - "hyper-rustls", - "hyper-util", - "js-sys", - "log", - "percent-encoding", - "pin-project-lite", - "quinn", - "rustls", - "rustls-pki-types", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper 1.0.2", - "tokio", - "tokio-rustls", - "tokio-util", - "tower", - "tower-http", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "wasm-streams", - "web-sys", - "webpki-roots", -] - -[[package]] -name = "rfc6979" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" -dependencies = [ - "hmac", - "subtle", -] - -[[package]] -name = "ring" -version = "0.17.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" -dependencies = [ - "cc", - "cfg-if", - "getrandom 0.2.16", - "libc", - "untrusted", - "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 = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62eb7025356a233c1bc267c458a2ce56fcfc89b136d813c8a77be14ef1eaf2b1" -dependencies = [ - "anyhow", - "borsh", - "derive_more 2.0.1", - "elf", - "lazy_static", - "postcard", - "risc0-zkp 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-zkvm-platform 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "semver", - "serde", - "tracing", -] - -[[package]] -name = "risc0-binfmt" -version = "2.0.2" -source = "git+https://github.com/risc0/risc0.git?branch=release-2.3#03853380e36e1a093bf06d306601f7358151e2ed" -dependencies = [ - "anyhow", - "borsh", - "derive_more 2.0.1", - "elf", - "lazy_static", - "postcard", - "risc0-zkp 2.0.2 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "risc0-zkvm-platform 2.0.3 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "semver", - "serde", - "tracing", -] - -[[package]] -name = "risc0-build" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62ffc0f135e6c1e9851e7e19438d03ff41a9d49199ee4f6c17b8bb30b4f83910" -dependencies = [ - "anyhow", - "cargo_metadata", - "derive_builder", - "dirs", - "docker-generate", - "hex", - "risc0-binfmt 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-zkos-v1compat 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-zkp 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-zkvm-platform 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rzup 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "semver", - "serde", - "serde_json", - "stability", - "tempfile", -] - -[[package]] -name = "risc0-build" -version = "2.3.1" -source = "git+https://github.com/risc0/risc0.git?branch=release-2.3#03853380e36e1a093bf06d306601f7358151e2ed" -dependencies = [ - "anyhow", - "cargo_metadata", - "derive_builder", - "dirs", - "docker-generate", - "hex", - "risc0-binfmt 2.0.2 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "risc0-zkos-v1compat 2.0.1 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "risc0-zkp 2.0.2 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "risc0-zkvm-platform 2.0.3 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "rzup 0.4.1 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "semver", - "serde", - "serde_json", - "stability", - "tempfile", -] - -[[package]] -name = "risc0-build-kernel" -version = "2.0.0" -source = "git+https://github.com/risc0/risc0.git?branch=release-2.3#03853380e36e1a093bf06d306601f7358151e2ed" -dependencies = [ - "cc", - "directories", - "glob", - "hex", - "rayon", - "sha2", - "tempfile", -] - -[[package]] -name = "risc0-circuit-keccak" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0094af5a57b020388a03bdd3834959c7d62723f1687be81414ade25104d93263" -dependencies = [ - "anyhow", - "bytemuck", - "paste", - "risc0-binfmt 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-circuit-recursion 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-core 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-zkp 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tracing", -] - -[[package]] -name = "risc0-circuit-keccak" -version = "3.0.0" -source = "git+https://github.com/risc0/risc0.git?branch=release-2.3#03853380e36e1a093bf06d306601f7358151e2ed" -dependencies = [ - "anyhow", - "bytemuck", - "cfg-if", - "keccak", - "paste", - "rayon", - "risc0-binfmt 2.0.2 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "risc0-circuit-keccak-sys", - "risc0-circuit-recursion 3.0.0 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "risc0-core 2.0.0 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "risc0-sys", - "risc0-zkp 2.0.2 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "tracing", - "xz2", -] - -[[package]] -name = "risc0-circuit-keccak-sys" -version = "3.0.0" -source = "git+https://github.com/risc0/risc0.git?branch=release-2.3#03853380e36e1a093bf06d306601f7358151e2ed" -dependencies = [ - "cc", - "cust", - "derive_more 2.0.1", - "glob", - "risc0-build-kernel", - "risc0-core 2.0.0 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "risc0-sys", - "sppark", -] - -[[package]] -name = "risc0-circuit-recursion" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76ebded45c902c2b6939924a1cddd1d06b5d1d4ad1531e8798ebfee78f9c038d" -dependencies = [ - "anyhow", - "bytemuck", - "hex", - "metal", - "risc0-core 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-zkp 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tracing", -] - -[[package]] -name = "risc0-circuit-recursion" -version = "3.0.0" -source = "git+https://github.com/risc0/risc0.git?branch=release-2.3#03853380e36e1a093bf06d306601f7358151e2ed" -dependencies = [ - "anyhow", - "bytemuck", - "cfg-if", - "cust", - "downloader", - "hex", - "lazy-regex", - "metal", - "rand 0.8.5", - "rayon", - "risc0-circuit-recursion-sys", - "risc0-core 2.0.0 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "risc0-sys", - "risc0-zkp 2.0.2 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "serde", - "sha2", - "tracing", - "zip", -] - -[[package]] -name = "risc0-circuit-recursion-sys" -version = "3.0.0" -source = "git+https://github.com/risc0/risc0.git?branch=release-2.3#03853380e36e1a093bf06d306601f7358151e2ed" -dependencies = [ - "glob", - "risc0-build-kernel", - "risc0-core 2.0.0 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "risc0-sys", - "sppark", -] - -[[package]] -name = "risc0-circuit-rv32im" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15030849f8356f01f23c74b37dbfa4283100b594eb634109993e9e005ef45f64" -dependencies = [ - "anyhow", - "bit-vec", - "bytemuck", - "derive_more 2.0.1", - "paste", - "risc0-binfmt 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-core 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-zkp 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde", - "tracing", -] - -[[package]] -name = "risc0-circuit-rv32im" -version = "3.0.0" -source = "git+https://github.com/risc0/risc0.git?branch=release-2.3#03853380e36e1a093bf06d306601f7358151e2ed" -dependencies = [ - "anyhow", - "auto_ops", - "bit-vec", - "bytemuck", - "byteorder", - "cfg-if", - "derive_more 2.0.1", - "enum-map", - "malachite", - "num-derive", - "num-traits", - "paste", - "postcard", - "rand 0.8.5", - "rayon", - "ringbuffer", - "risc0-binfmt 2.0.2 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "risc0-circuit-rv32im-sys", - "risc0-core 2.0.0 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "risc0-sys", - "risc0-zkp 2.0.2 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "serde", - "smallvec", - "tracing", -] - -[[package]] -name = "risc0-circuit-rv32im-sys" -version = "3.0.0" -source = "git+https://github.com/risc0/risc0.git?branch=release-2.3#03853380e36e1a093bf06d306601f7358151e2ed" -dependencies = [ - "cc", - "cust", - "derive_more 2.0.1", - "glob", - "risc0-build-kernel", - "risc0-core 2.0.0 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "risc0-sys", - "sppark", -] - -[[package]] -name = "risc0-core" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317bbf70a8750b64d4fd7a2bdc9d7d5f30d8bb305cae486962c797ef35c8d08e" -dependencies = [ - "bytemuck", - "bytemuck_derive", - "rand_core 0.6.4", -] - -[[package]] -name = "risc0-core" -version = "2.0.0" -source = "git+https://github.com/risc0/risc0.git?branch=release-2.3#03853380e36e1a093bf06d306601f7358151e2ed" -dependencies = [ - "bytemuck", - "bytemuck_derive", - "nvtx", - "puffin", - "rand_core 0.6.4", -] - -[[package]] -name = "risc0-groth16" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cf5d0b673d5fc67a89147c2e9c53134707dcc8137a43d1ef06b4ff68e99b74f" -dependencies = [ - "anyhow", - "ark-bn254", - "ark-ec", - "ark-groth16", - "ark-serialize", - "bytemuck", - "hex", - "num-bigint 0.4.6", - "num-traits", - "risc0-binfmt 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-zkp 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde", - "stability", -] - -[[package]] -name = "risc0-groth16" -version = "2.0.2" -source = "git+https://github.com/risc0/risc0.git?branch=release-2.3#03853380e36e1a093bf06d306601f7358151e2ed" -dependencies = [ - "anyhow", - "ark-bn254", - "ark-ec", - "ark-groth16", - "ark-serialize", - "bytemuck", - "hex", - "num-bigint 0.4.6", - "num-traits", - "risc0-binfmt 2.0.2 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "risc0-core 2.0.0 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "risc0-zkp 2.0.2 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "serde", - "serde_json", - "stability", - "tempfile", - "tracing", -] - -[[package]] -name = "risc0-sys" -version = "1.4.0" -source = "git+https://github.com/risc0/risc0.git?branch=release-2.3#03853380e36e1a093bf06d306601f7358151e2ed" -dependencies = [ - "anyhow", - "cust", - "risc0-build-kernel", - "sppark", -] - -[[package]] -name = "risc0-zkos-v1compat" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f76c479b69d1987cb54ac72dcc017197296fdcd6daf78fafc10cbbd3a167a7de" -dependencies = [ - "include_bytes_aligned", - "no_std_strings", -] - -[[package]] -name = "risc0-zkos-v1compat" -version = "2.0.1" -source = "git+https://github.com/risc0/risc0.git?branch=release-2.3#03853380e36e1a093bf06d306601f7358151e2ed" -dependencies = [ - "include_bytes_aligned", - "no_std_strings", -] - -[[package]] -name = "risc0-zkp" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a287e9cd6d7b3b38eeb49c62090c46a1935922309fbd997a9143ed8c43c8f3cb" -dependencies = [ - "anyhow", - "blake2", - "borsh", - "bytemuck", - "cfg-if", - "digest", - "hex", - "hex-literal", - "metal", - "paste", - "rand_core 0.6.4", - "risc0-core 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-zkvm-platform 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde", - "sha2", - "stability", - "tracing", -] - -[[package]] -name = "risc0-zkp" -version = "2.0.2" -source = "git+https://github.com/risc0/risc0.git?branch=release-2.3#03853380e36e1a093bf06d306601f7358151e2ed" -dependencies = [ - "anyhow", - "blake2", - "borsh", - "bytemuck", - "cfg-if", - "cust", - "digest", - "ff", - "hex", - "hex-literal", - "metal", - "ndarray", - "parking_lot", - "paste", - "rand 0.8.5", - "rand_core 0.6.4", - "rayon", - "risc0-core 2.0.0 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "risc0-sys", - "risc0-zkvm-platform 2.0.3 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "serde", - "sha2", - "stability", - "tracing", -] - -[[package]] -name = "risc0-zkvm" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9684b333c1c5d83f29ce2a92314ccfafd9d8cdfa6c4e19c07b97015d2f1eb9d0" -dependencies = [ - "anyhow", - "bincode", - "bonsai-sdk 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "borsh", - "bytemuck", - "bytes", - "derive_more 2.0.1", - "getrandom 0.2.16", - "hex", - "lazy-regex", - "prost", - "risc0-binfmt 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-build 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-circuit-keccak 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-circuit-recursion 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-circuit-rv32im 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-core 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-groth16 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-zkos-v1compat 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-zkp 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-zkvm-platform 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rrs-lib", - "rzup 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "semver", - "serde", - "sha2", - "stability", - "tempfile", - "tracing", -] - -[[package]] -name = "risc0-zkvm" -version = "2.3.1" -source = "git+https://github.com/risc0/risc0.git?branch=release-2.3#03853380e36e1a093bf06d306601f7358151e2ed" -dependencies = [ - "addr2line 0.22.0", - "anyhow", - "bincode", - "bonsai-sdk 1.4.0 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "borsh", - "bytemuck", - "bytes", - "derive_more 2.0.1", - "elf", - "enum-map", - "getrandom 0.2.16", - "hex", - "keccak", - "lazy-regex", - "num-bigint 0.4.6", - "num-traits", - "prost", - "rand 0.8.5", - "rayon", - "risc0-binfmt 2.0.2 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "risc0-build 2.3.1 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "risc0-circuit-keccak 3.0.0 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "risc0-circuit-recursion 3.0.0 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "risc0-circuit-rv32im 3.0.0 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "risc0-core 2.0.0 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "risc0-groth16 2.0.2 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "risc0-zkos-v1compat 2.0.1 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "risc0-zkp 2.0.2 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "risc0-zkvm-platform 2.0.3 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "rrs-lib", - "rustc-demangle", - "rzup 0.4.1 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "semver", - "serde", - "sha2", - "stability", - "tempfile", - "tracing", - "typetag", -] - -[[package]] -name = "risc0-zkvm-platform" -version = "2.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cae9cb2c2f6cab2dfa395ea6e2576713929040c7fb0c5f4150d13e1119d18686" -dependencies = [ - "bytemuck", - "cfg-if", - "getrandom 0.2.16", - "getrandom 0.3.3", - "libm", - "stability", -] - -[[package]] -name = "risc0-zkvm-platform" -version = "2.0.3" -source = "git+https://github.com/risc0/risc0.git?branch=release-2.3#03853380e36e1a093bf06d306601f7358151e2ed" -dependencies = [ - "bytemuck", - "cfg-if", - "getrandom 0.2.16", - "getrandom 0.3.3", - "libm", - "stability", -] - -[[package]] -name = "rocksdb" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb6f170a4041d50a0ce04b0d2e14916d6ca863ea2e422689a5b694395d299ffe" -dependencies = [ - "libc", - "librocksdb-sys", -] - -[[package]] -name = "rrs-lib" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4382d3af3a4ebdae7f64ba6edd9114fff92c89808004c4943b393377a25d001" -dependencies = [ - "downcast-rs", - "paste", -] - -[[package]] -name = "rs_merkle" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb09b49230ba22e8c676e7b75dfe2887dea8121f18b530ae0ba519ce442d2b21" -dependencies = [ - "sha2", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustc-hash" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" - -[[package]] -name = "rustc_version" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" -dependencies = [ - "semver", -] - -[[package]] -name = "rustix" -version = "0.38.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" -dependencies = [ - "bitflags 2.9.1", - "errno", - "libc", - "linux-raw-sys 0.4.15", - "windows-sys 0.52.0", -] - -[[package]] -name = "rustix" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8" -dependencies = [ - "bitflags 2.9.1", - "errno", - "libc", - "linux-raw-sys 0.9.4", - "windows-sys 0.60.2", -] - -[[package]] -name = "rustls" -version = "0.23.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0ebcbd2f03de0fc1122ad9bb24b127a5a6cd51d72604a3f3c50ac459762b6cc" -dependencies = [ - "once_cell", - "ring", - "rustls-pki-types", - "rustls-webpki", - "subtle", - "zeroize", -] - -[[package]] -name = "rustls-pemfile" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" -dependencies = [ - "base64 0.21.7", -] - -[[package]] -name = "rustls-pki-types" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79" -dependencies = [ - "web-time", - "zeroize", -] - -[[package]] -name = "rustls-webpki" -version = "0.103.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a17884ae0c1b773f1ccd2bd4a8c72f16da897310a98b0e84bf349ad5ead92fc" -dependencies = [ - "ring", - "rustls-pki-types", - "untrusted", -] - -[[package]] -name = "rustversion" -version = "1.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" - -[[package]] -name = "ruzstd" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5174a470eeb535a721ae9fdd6e291c2411a906b96592182d05217591d5c5cf7b" -dependencies = [ - "byteorder", - "derive_more 0.99.20", - "twox-hash", -] - -[[package]] -name = "ryu" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" - -[[package]] -name = "rzup" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "400558bf12d4292a7804093b60a437ba8b0219ea7d53716b2c010a0d31e5f4a8" -dependencies = [ - "semver", - "serde", - "strum", - "tempfile", - "thiserror 2.0.12", - "toml 0.8.23", - "yaml-rust2", -] - -[[package]] -name = "rzup" -version = "0.4.1" -source = "git+https://github.com/risc0/risc0.git?branch=release-2.3#03853380e36e1a093bf06d306601f7358151e2ed" -dependencies = [ - "semver", - "serde", - "strum", - "tempfile", - "thiserror 2.0.12", - "toml 0.8.23", - "yaml-rust2", -] - -[[package]] -name = "sc_core" -version = "0.1.0" -dependencies = [ - "accounts", - "anyhow", - "ark-bn254", - "ark-ff", - "bincode", - "common", - "elliptic-curve", - "env_logger", - "hex", - "k256", - "light-poseidon", - "log", - "rand 0.8.5", - "risc0-zkvm 2.3.1 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "secp256k1-zkp", - "serde", - "serde_json", - "sha2", - "storage", - "utxo", -] - -[[package]] -name = "schannel" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "sec1" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" -dependencies = [ - "base16ct", - "der", - "generic-array", - "pkcs8", - "serdect", - "subtle", - "zeroize", -] - -[[package]] -name = "secp256k1" -version = "0.29.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9465315bc9d4566e1724f0fffcbcc446268cb522e60f9a27bcded6b19c108113" -dependencies = [ - "rand 0.8.5", - "secp256k1-sys", - "serde", -] - -[[package]] -name = "secp256k1-sys" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4387882333d3aa8cb20530a17c69a3752e97837832f34f6dccc760e715001d9" -dependencies = [ - "cc", -] - -[[package]] -name = "secp256k1-zkp" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52a44aed3002b5ae975f8624c5df3a949cfbf00479e18778b6058fcd213b76e3" -dependencies = [ - "bitcoin-private", - "rand 0.8.5", - "secp256k1", - "secp256k1-zkp-sys", - "serde", -] - -[[package]] -name = "secp256k1-zkp-sys" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57f08b2d0b143a22e07f798ae4f0ab20d5590d7c68e0d090f2088a48a21d1654" -dependencies = [ - "cc", - "secp256k1-sys", -] - -[[package]] -name = "security-framework" -version = "2.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" -dependencies = [ - "bitflags 2.9.1", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "semver" -version = "1.0.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" -dependencies = [ - "serde", -] - -[[package]] -name = "sequencer_core" -version = "0.1.0" -dependencies = [ - "accounts", - "anyhow", - "common", - "elliptic-curve", - "env_logger", - "hex", - "k256", - "log", - "mempool", - "nssa", - "rand 0.8.5", - "secp256k1-zkp", - "serde", - "serde_json", - "storage", - "tempfile", - "tiny-keccak", -] - -[[package]] -name = "sequencer_rpc" -version = "0.1.0" -dependencies = [ - "accounts", - "actix", - "actix-cors", - "actix-web", - "anyhow", - "common", - "consensus", - "env_logger", - "futures", - "hex", - "log", - "mempool", - "networking", - "nssa", - "sequencer_core", - "serde", - "serde_json", - "storage", - "tempfile", - "tokio", -] - -[[package]] -name = "sequencer_runner" -version = "0.1.0" -dependencies = [ - "actix", - "actix-web", - "anyhow", - "clap", - "common", - "consensus", - "env_logger", - "log", - "mempool", - "networking", - "sequencer_core", - "sequencer_rpc", - "serde", - "serde_json", - "tokio", - "toml 0.7.8", -] - -[[package]] -name = "serde" -version = "1.0.219" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_cbor" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5" -dependencies = [ - "half", - "serde", -] - -[[package]] -name = "serde_derive" -version = "1.0.219" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", -] - -[[package]] -name = "serde_json" -version = "1.0.142" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "030fedb782600dcbd6f02d479bf0d817ac3bb40d644745b769d6a96bc3afc5a7" -dependencies = [ - "itoa", - "memchr", - "ryu", - "serde", -] - -[[package]] -name = "serde_spanned" -version = "0.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serdect" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a84f14a19e9a014bb9f4512488d9829a68e04ecabffb0f9904cd1ace94598177" -dependencies = [ - "base16ct", - "serde", -] - -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "sha2" -version = "0.10.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "signal-hook-registry" -version = "1.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2a4719bff48cee6b39d12c020eeb490953ad2443b7055bd0b21fca26bd8c28b" -dependencies = [ - "libc", -] - -[[package]] -name = "signature" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" -dependencies = [ - "digest", - "rand_core 0.6.4", -] - -[[package]] -name = "simd-adler32" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" - -[[package]] -name = "slab" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04dc19736151f35336d325007ac991178d504a119863a2fcb3758cdb5e52c50d" - -[[package]] -name = "smallvec" -version = "1.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" - -[[package]] -name = "socket2" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "socket2" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "socket2" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807" -dependencies = [ - "libc", - "windows-sys 0.59.0", -] - -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" -dependencies = [ - "lock_api", -] - -[[package]] -name = "spki" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" -dependencies = [ - "base64ct", - "der", -] - -[[package]] -name = "sppark" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdc4f02f557e3037bbe2a379cac8be6e014a67beb7bf0996b536979392f6361" -dependencies = [ - "cc", - "which", -] - -[[package]] -name = "stability" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d904e7009df136af5297832a3ace3370cd14ff1546a232f4f185036c2736fcac" -dependencies = [ - "quote", - "syn 2.0.104", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "storage" -version = "0.1.0" -dependencies = [ - "anyhow", - "common", - "env_logger", - "hex", - "log", - "lru", - "rocksdb", - "serde", - "serde_json", - "thiserror 1.0.69", -] - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - -[[package]] -name = "strum" -version = "0.26.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" -dependencies = [ - "strum_macros", -] - -[[package]] -name = "strum_macros" -version = "0.26.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" -dependencies = [ - "heck 0.5.0", - "proc-macro2", - "quote", - "rustversion", - "syn 2.0.104", -] - -[[package]] -name = "subtle" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "sync_wrapper" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" - -[[package]] -name = "sync_wrapper" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" -dependencies = [ - "futures-core", -] - -[[package]] -name = "synstructure" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", -] - -[[package]] -name = "system-configuration" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "system-configuration-sys", -] - -[[package]] -name = "system-configuration-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "tap" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" - -[[package]] -name = "tempfile" -version = "3.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1" -dependencies = [ - "fastrand", - "getrandom 0.3.3", - "once_cell", - "rustix 1.0.8", - "windows-sys 0.59.0", -] - -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "test-methods" -version = "0.1.0" -dependencies = [ - "risc0-build 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "textwrap" -version = "0.16.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c13547615a44dc9c452a8a534638acdf07120d4b6847c8178705da06306a3057" - -[[package]] -name = "thiserror" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" -dependencies = [ - "thiserror-impl 1.0.69", -] - -[[package]] -name = "thiserror" -version = "2.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" -dependencies = [ - "thiserror-impl 2.0.12", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", -] - -[[package]] -name = "thiserror-impl" -version = "2.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", -] - -[[package]] -name = "time" -version = "0.3.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40" -dependencies = [ - "deranged", - "itoa", - "num-conv", - "powerfmt", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c" - -[[package]] -name = "time-macros" -version = "0.2.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49" -dependencies = [ - "num-conv", - "time-core", -] - -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - -[[package]] -name = "tinystr" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" -dependencies = [ - "displaydoc", - "zerovec", -] - -[[package]] -name = "tinyvec" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "tokio" -version = "1.47.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89e49afdadebb872d3145a5638b59eb0691ea23e46ca484037cfab3b76b95038" -dependencies = [ - "backtrace", - "bytes", - "io-uring", - "libc", - "mio", - "parking_lot", - "pin-project-lite", - "signal-hook-registry", - "slab", - "socket2 0.6.0", - "windows-sys 0.59.0", -] - -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", -] - -[[package]] -name = "tokio-rustls" -version = "0.26.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e727b36a1a0e8b74c376ac2211e40c2c8af09fb4013c60d910495810f008e9b" -dependencies = [ - "rustls", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.7.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14307c986784f72ef81c89db7d9e28d6ac26d16213b109ea501696195e6e3ce5" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "toml" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit 0.19.15", -] - -[[package]] -name = "toml" -version = "0.8.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit 0.22.27", -] - -[[package]] -name = "toml_datetime" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.19.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" -dependencies = [ - "indexmap 2.10.0", - "serde", - "serde_spanned", - "toml_datetime", - "winnow 0.5.40", -] - -[[package]] -name = "toml_edit" -version = "0.22.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" -dependencies = [ - "indexmap 2.10.0", - "serde", - "serde_spanned", - "toml_datetime", - "toml_write", - "winnow 0.7.12", -] - -[[package]] -name = "toml_write" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" - -[[package]] -name = "tower" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" -dependencies = [ - "futures-core", - "futures-util", - "pin-project-lite", - "sync_wrapper 1.0.2", - "tokio", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-http" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2" -dependencies = [ - "bitflags 2.9.1", - "bytes", - "futures-util", - "http 1.3.1", - "http-body 1.0.1", - "iri-string", - "pin-project-lite", - "tower", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-layer" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" - -[[package]] -name = "tower-service" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" - -[[package]] -name = "tracing" -version = "0.1.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" -dependencies = [ - "log", - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", -] - -[[package]] -name = "tracing-core" -version = "0.1.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-subscriber" -version = "0.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" -dependencies = [ - "tracing-core", -] - -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - -[[package]] -name = "twox-hash" -version = "1.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" -dependencies = [ - "cfg-if", - "static_assertions", -] - -[[package]] -name = "typeid" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" - -[[package]] -name = "typenum" -version = "1.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" - -[[package]] -name = "typetag" -version = "0.2.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73f22b40dd7bfe8c14230cf9702081366421890435b2d625fa92b4acc4c3de6f" -dependencies = [ - "erased-serde", - "inventory", - "once_cell", - "serde", - "typetag-impl", -] - -[[package]] -name = "typetag-impl" -version = "0.2.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35f5380909ffc31b4de4f4bdf96b877175a016aa2ca98cee39fcfd8c4d53d952" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", -] - -[[package]] -name = "unicode-ident" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" - -[[package]] -name = "unicode-xid" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" - -[[package]] -name = "universal-hash" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" -dependencies = [ - "crypto-common", - "subtle", -] - -[[package]] -name = "untrusted" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" - -[[package]] -name = "url" -version = "2.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", -] - -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - -[[package]] -name = "utxo" -version = "0.1.0" -dependencies = [ - "anyhow", - "common", - "env_logger", - "hex", - "log", - "rand 0.8.5", - "serde", - "serde_json", - "sha2", -] - -[[package]] -name = "valuable" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "vek" -version = "0.15.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8085882662f9bc47fc8b0cdafa5e19df8f592f650c02b9083da8d45ac9eebd17" -dependencies = [ - "approx", - "num-integer", - "num-traits", - "rustc_version", -] - -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "vm" -version = "0.1.0" -dependencies = [ - "anyhow", - "env_logger", - "log", - "serde", - "serde_json", -] - -[[package]] -name = "want" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] - -[[package]] -name = "wasi" -version = "0.11.1+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" - -[[package]] -name = "wasi" -version = "0.14.2+wasi-0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" -dependencies = [ - "wit-bindgen-rt", -] - -[[package]] -name = "wasm-bindgen" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" -dependencies = [ - "cfg-if", - "once_cell", - "rustversion", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" -dependencies = [ - "bumpalo", - "log", - "proc-macro2", - "quote", - "syn 2.0.104", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" -dependencies = [ - "cfg-if", - "js-sys", - "once_cell", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "wasm-streams" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65" -dependencies = [ - "futures-util", - "js-sys", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - -[[package]] -name = "web-sys" -version = "0.3.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "web-time" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webpki-roots" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8983c3ab33d6fb807cfcdad2491c4ea8cbc8ed839181c7dfd9c67c83e261b2" -dependencies = [ - "rustls-pki-types", -] - -[[package]] -name = "which" -version = "4.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" -dependencies = [ - "either", - "home", - "once_cell", - "rustix 0.38.44", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-link" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.60.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" -dependencies = [ - "windows-targets 0.53.3", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm 0.52.6", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", -] - -[[package]] -name = "windows-targets" -version = "0.53.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" -dependencies = [ - "windows-link", - "windows_aarch64_gnullvm 0.53.0", - "windows_aarch64_msvc 0.53.0", - "windows_i686_gnu 0.53.0", - "windows_i686_gnullvm 0.53.0", - "windows_i686_msvc 0.53.0", - "windows_x86_64_gnu 0.53.0", - "windows_x86_64_gnullvm 0.53.0", - "windows_x86_64_msvc 0.53.0", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnu" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_i686_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" - -[[package]] -name = "winnow" -version = "0.5.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" -dependencies = [ - "memchr", -] - -[[package]] -name = "winnow" -version = "0.7.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3edebf492c8125044983378ecb5766203ad3b4c2f7a922bd7dd207f6d443e95" -dependencies = [ - "memchr", -] - -[[package]] -name = "winreg" -version = "0.50.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - -[[package]] -name = "wit-bindgen-rt" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" -dependencies = [ - "bitflags 2.9.1", -] - -[[package]] -name = "writeable" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" - -[[package]] -name = "wyz" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" -dependencies = [ - "tap", -] - -[[package]] -name = "xz2" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388c44dc09d76f1536602ead6d325eb532f5c122f17782bd57fb47baeeb767e2" -dependencies = [ - "lzma-sys", -] - -[[package]] -name = "yaml-rust2" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a1a1c0bc9823338a3bdf8c61f994f23ac004c6fa32c08cd152984499b445e8d" -dependencies = [ - "arraydeque", - "encoding_rs", - "hashlink", -] - -[[package]] -name = "yoke" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" -dependencies = [ - "serde", - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", - "synstructure", -] - -[[package]] -name = "zerocopy" -version = "0.8.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.8.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", -] - -[[package]] -name = "zerofrom" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", - "synstructure", -] - -[[package]] -name = "zeroize" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", -] - -[[package]] -name = "zerotrie" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", -] - -[[package]] -name = "zerovec" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a05eb080e015ba39cc9e23bbe5e7fb04d5fb040350f99f34e338d5fdd294428" -dependencies = [ - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", -] - -[[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.10.0", - "memchr", - "thiserror 2.0.12", - "zopfli", -] - -[[package]] -name = "zkvm" -version = "0.1.0" -dependencies = [ - "accounts", - "anyhow", - "common", - "env_logger", - "log", - "rand 0.8.5", - "risc0-zkvm 2.3.1 (git+https://github.com/risc0/risc0.git?branch=release-2.3)", - "serde", - "serde_json", - "test-methods", - "thiserror 1.0.69", - "utxo", -] - -[[package]] -name = "zopfli" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edfc5ee405f504cd4984ecc6f14d02d55cfda60fa4b689434ef4102aae150cd7" -dependencies = [ - "bumpalo", - "crc32fast", - "log", - "simd-adler32", -] diff --git a/Cargo.toml b/Cargo.toml index d29e39a..4a938b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,16 +1,15 @@ [workspace] resolver = "2" members = [ + "integration_tests", "sequencer_runner", "storage", "accounts", "utxo", - "vm", - "networking", - "consensus", "sequencer_rpc", "mempool", "zkvm", + "wallet", "sequencer_core", "common", "sc_core", @@ -72,7 +71,7 @@ version = "=4.1.0" [workspace.dependencies.clap] features = ["derive", "env"] -version = "3.1.6" +version = "4.5.42" [workspace.dependencies.tokio-retry] version = "0.3.0" diff --git a/accounts/Cargo.toml b/accounts/Cargo.toml index ffd500a..d4bc3fa 100644 --- a/accounts/Cargo.toml +++ b/accounts/Cargo.toml @@ -23,3 +23,6 @@ path = "../utxo" [dependencies.common] path = "../common" + +[dependencies.nssa] +path = "../nssa" diff --git a/accounts/src/account_core/address.rs b/accounts/src/account_core/address.rs index 2fadacd..3b61521 100644 --- a/accounts/src/account_core/address.rs +++ b/accounts/src/account_core/address.rs @@ -4,33 +4,3 @@ use tiny_keccak::{Hasher, Keccak}; // TODO: Consider wrapping `AccountAddress` in a struct. pub type AccountAddress = [u8; 32]; - -/// Returns the address associated with a public key -pub fn from_public_key(public_key: &SignaturePublicKey) -> AccountAddress { - let mut address = [0; 32]; - let mut keccak_hasher = Keccak::v256(); - keccak_hasher.update(&public_key.to_sec1_bytes()); - keccak_hasher.finalize(&mut address); - address -} - -#[cfg(test)] -mod tests { - use common::transaction::SignaturePrivateKey; - - use super::*; - use crate::account_core::address; - - #[test] - fn test_address_key_equal_keccak_pub_sign_key() { - let signing_key = SignaturePrivateKey::from_slice(&[1; 32]).unwrap(); - let public_key = signing_key.verifying_key(); - - let mut expected_address = [0; 32]; - let mut keccak_hasher = Keccak::v256(); - keccak_hasher.update(&public_key.to_sec1_bytes()); - keccak_hasher.finalize(&mut expected_address); - - assert_eq!(expected_address, address::from_public_key(public_key)); - } -} diff --git a/accounts/src/account_core/mod.rs b/accounts/src/account_core/mod.rs index 1926649..6b8384d 100644 --- a/accounts/src/account_core/mod.rs +++ b/accounts/src/account_core/mod.rs @@ -117,14 +117,14 @@ impl AccountPublicMask { impl Account { pub fn new() -> Self { let key_holder = AddressKeyHolder::new_os_random(); - let public_key = *key_holder.get_pub_account_signing_key().verifying_key(); - let address = address::from_public_key(&public_key); + let public_key = nssa::PublicKey::new(&key_holder.get_pub_account_signing_key()); + let address = nssa::Address::from_public_key(&public_key); let balance = 0; let utxos = HashMap::new(); Self { key_holder, - address, + address: *address.value(), balance, utxos, } @@ -132,13 +132,13 @@ impl Account { pub fn new_with_balance(balance: u64) -> Self { let key_holder = AddressKeyHolder::new_os_random(); - let public_key = *key_holder.get_pub_account_signing_key().verifying_key(); - let address = address::from_public_key(&public_key); + let public_key = nssa::PublicKey::new(&key_holder.get_pub_account_signing_key()); + let address = nssa::Address::from_public_key(&public_key); let utxos = HashMap::new(); Self { key_holder, - address, + address: *address.value(), balance, utxos, } diff --git a/accounts/src/key_management/mod.rs b/accounts/src/key_management/mod.rs index c1a78fb..055b34d 100644 --- a/accounts/src/key_management/mod.rs +++ b/accounts/src/key_management/mod.rs @@ -3,12 +3,13 @@ use constants_types::{CipherText, Nonce}; use elliptic_curve::point::AffineCoordinates; use k256::{ecdsa::SigningKey, AffinePoint, FieldBytes}; use log::info; -use rand::{rngs::OsRng, RngCore}; +use rand::{rngs::OsRng, Rng, RngCore}; use secret_holders::{SeedHolder, TopSecretKeyHolder, UTXOSecretKeyHolder}; use serde::{Deserialize, Serialize}; use crate::account_core::PublicKey; pub type PublicAccountSigningKey = [u8; 32]; +use nssa::{self, PrivateKey}; pub mod constants_types; pub mod ephemeral_key_holder; @@ -19,7 +20,7 @@ pub mod secret_holders; pub struct AddressKeyHolder { top_secret_key_holder: TopSecretKeyHolder, pub utxo_secret_key_holder: UTXOSecretKeyHolder, - pub_account_signing_key: PublicAccountSigningKey, + pub_account_signing_key: nssa::PrivateKey, pub nullifer_public_key: PublicKey, pub viewing_public_key: PublicKey, } @@ -37,9 +38,8 @@ impl AddressKeyHolder { let viewing_public_key = utxo_secret_key_holder.generate_viewing_public_key(); let pub_account_signing_key = { - let mut bytes = [0; 32]; - OsRng.fill_bytes(&mut bytes); - bytes + let mut rng = OsRng; + nssa::PrivateKey::new(rng.gen()) }; Self { @@ -52,10 +52,8 @@ impl AddressKeyHolder { } /// Returns the signing key for public transaction signatures - pub fn get_pub_account_signing_key(&self) -> SigningKey { - let field_bytes = FieldBytes::from_slice(&self.pub_account_signing_key); - // TODO: remove unwrap - SigningKey::from_bytes(field_bytes).unwrap() + pub fn get_pub_account_signing_key(&self) -> &nssa::PrivateKey { + &self.pub_account_signing_key } pub fn calculate_shared_secret_receiver( @@ -319,10 +317,7 @@ mod tests { fn test_get_public_account_signing_key() { let address_key_holder = AddressKeyHolder::new_os_random(); let signing_key = address_key_holder.get_pub_account_signing_key(); - assert_eq!( - signing_key.to_bytes().as_slice(), - address_key_holder.pub_account_signing_key - ); + assert_eq!(signing_key, &address_key_holder.pub_account_signing_key); } #[test] @@ -336,18 +331,13 @@ mod tests { let viewing_public_key = utxo_secret_key_holder.generate_viewing_public_key(); let pub_account_signing_key = { - let mut bytes = [0; 32]; - OsRng.fill_bytes(&mut bytes); - bytes + let mut rng = OsRng; + nssa::PrivateKey::new(rng.gen()) }; - //Address is a Keccak(verification_key) - let field_bytes = FieldBytes::from_slice(&pub_account_signing_key); - let signing_key = SigningKey::from_bytes(field_bytes).unwrap(); + let public_key = nssa::PublicKey::new(&pub_account_signing_key); - let verifying_key = signing_key.verifying_key(); - - let address = address::from_public_key(verifying_key); + let address = nssa::Address::from_public_key(&public_key); println!("======Prerequisites======"); println!(); @@ -373,7 +363,7 @@ mod tests { println!("======Public data======"); println!(); - println!("Address{:?}", hex::encode(address)); + println!("Address{:?}", hex::encode(address.value())); println!( "Nulifier public key {:?}", hex::encode(serde_json::to_vec(&nullifer_public_key).unwrap()) diff --git a/ci_scripts/test-ubuntu.sh b/ci_scripts/test-ubuntu.sh index 47d79fa..90aa19e 100644 --- a/ci_scripts/test-ubuntu.sh +++ b/ci_scripts/test-ubuntu.sh @@ -6,4 +6,5 @@ source env.sh cargo test --release cd integration_tests +export NSSA_WALLET_HOME_DIR=$(pwd)/configs/debug/node/ cargo run $(pwd)/configs/debug all \ No newline at end of file diff --git a/common/Cargo.toml b/common/Cargo.toml index 8bfc317..4e29b1e 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -10,6 +10,7 @@ serde_json.workspace = true serde.workspace = true reqwest.workspace = true k256.workspace = true +rand.workspace = true rs_merkle.workspace = true sha2.workspace = true diff --git a/common/src/block.rs b/common/src/block.rs index bc62dca..52d70ba 100644 --- a/common/src/block.rs +++ b/common/src/block.rs @@ -27,19 +27,19 @@ pub struct HashableBlockData { pub data: Data, } -impl Block { - pub fn produce_block_from_hashable_data(hashable_data: HashableBlockData) -> Self { - let data = serde_json::to_vec(&hashable_data).unwrap(); +impl From for Block { + fn from(value: HashableBlockData) -> Self { + let data = serde_json::to_vec(&value).unwrap(); let hash = OwnHasher::hash(&data); Self { - block_id: hashable_data.block_id, - prev_block_id: hashable_data.prev_block_id, + block_id: value.block_id, + prev_block_id: value.prev_block_id, hash, - transactions: hashable_data.transactions, - data: hashable_data.data, - prev_block_hash: hashable_data.prev_block_hash, + transactions: value.transactions, + data: value.data, + prev_block_hash: value.prev_block_hash, } } } diff --git a/common/src/lib.rs b/common/src/lib.rs index 9ef0653..b7f45ab 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -7,9 +7,13 @@ pub mod execution_input; pub mod merkle_tree_public; pub mod nullifier; pub mod rpc_primitives; +pub mod sequencer_client; pub mod transaction; pub mod utxo_commitment; +//Module for tests utility functions +pub mod test_utils; + use rpc_primitives::errors::RpcError; ///Account id on blockchain diff --git a/common/src/rpc_primitives/requests.rs b/common/src/rpc_primitives/requests.rs index 4a46162..fa78f74 100644 --- a/common/src/rpc_primitives/requests.rs +++ b/common/src/rpc_primitives/requests.rs @@ -19,8 +19,6 @@ pub struct RegisterAccountRequest { #[derive(Serialize, Deserialize, Debug)] pub struct SendTxRequest { pub transaction: nssa::PublicTransaction, - ///UTXO Commitment Root, Pub Tx Root - pub tx_roots: [[u8; 32]; 2], } #[derive(Serialize, Deserialize, Debug)] diff --git a/node_core/src/sequencer_client/json.rs b/common/src/sequencer_client/json.rs similarity index 88% rename from node_core/src/sequencer_client/json.rs rename to common/src/sequencer_client/json.rs index ad1d746..11a8888 100644 --- a/node_core/src/sequencer_client/json.rs +++ b/common/src/sequencer_client/json.rs @@ -1,13 +1,12 @@ -use common::transaction::Transaction; use serde::{Deserialize, Serialize}; +use crate::transaction::Transaction; + //Requests #[derive(Serialize, Deserialize, Debug)] pub struct SendTxRequest { - pub transaction: Transaction, - ///UTXO Commitment Root, Pub Tx Root - pub tx_roots: [[u8; 32]; 2], + pub transaction: nssa::PublicTransaction, } //Responses diff --git a/node_core/src/sequencer_client/mod.rs b/common/src/sequencer_client/mod.rs similarity index 76% rename from node_core/src/sequencer_client/mod.rs rename to common/src/sequencer_client/mod.rs index 834e862..7fcca2d 100644 --- a/node_core/src/sequencer_client/mod.rs +++ b/common/src/sequencer_client/mod.rs @@ -1,35 +1,32 @@ -use accounts::account_core::Account; -use anyhow::Result; -use common::rpc_primitives::requests::{ +use super::rpc_primitives::requests::{ GetAccountBalanceRequest, GetAccountBalanceResponse, GetBlockDataRequest, GetBlockDataResponse, GetGenesisIdRequest, GetGenesisIdResponse, GetInitialTestnetAccountsRequest, - RegisterAccountRequest, RegisterAccountResponse, }; -use common::transaction::Transaction; -use common::{SequencerClientError, SequencerRpcError}; +use anyhow::Result; use json::{SendTxRequest, SendTxResponse, SequencerRpcRequest, SequencerRpcResponse}; use reqwest::Client; use serde_json::Value; -use crate::config::NodeConfig; use crate::sequencer_client::json::AccountInitialData; +use crate::transaction::Transaction; +use crate::{SequencerClientError, SequencerRpcError}; pub mod json; #[derive(Clone)] pub struct SequencerClient { pub client: reqwest::Client, - pub config: NodeConfig, + pub sequencer_addr: String, } impl SequencerClient { - pub fn new(config: NodeConfig) -> Result { + pub fn new(sequencer_addr: String) -> Result { Ok(Self { client: Client::builder() //Add more fiedls if needed .timeout(std::time::Duration::from_secs(60)) .build()?, - config, + sequencer_addr, }) } @@ -40,7 +37,7 @@ impl SequencerClient { ) -> Result { let request = SequencerRpcRequest::from_payload_version_2_0(method.to_string(), payload); - let call_builder = self.client.post(&self.config.sequencer_addr); + let call_builder = self.client.post(&self.sequencer_addr); let call_res = call_builder.json(&request).send().await?; @@ -56,6 +53,7 @@ impl SequencerClient { } } + ///Get block data at `block_id` from sequencer pub async fn get_block( &self, block_id: u64, @@ -71,6 +69,7 @@ impl SequencerClient { Ok(resp_deser) } + ///Get account public balance for `address`. `address` must be a valid hex-string for 32 bytes. pub async fn get_account_balance( &self, address: String, @@ -88,15 +87,12 @@ impl SequencerClient { Ok(resp_deser) } + ///Send transaction to sequencer pub async fn send_tx( &self, - transaction: Transaction, - tx_roots: [[u8; 32]; 2], + transaction: nssa::PublicTransaction, ) -> Result { - let tx_req = SendTxRequest { - transaction, - tx_roots, - }; + let tx_req = SendTxRequest { transaction }; let req = serde_json::to_value(tx_req)?; @@ -107,25 +103,7 @@ impl SequencerClient { Ok(resp_deser) } - pub async fn register_account( - &self, - account: &Account, - ) -> Result { - let acc_req = RegisterAccountRequest { - address: account.address, - }; - - let req = serde_json::to_value(acc_req)?; - - let resp = self - .call_method_with_payload("register_account", req) - .await?; - - let resp_deser = serde_json::from_value(resp)?; - - Ok(resp_deser) - } - + ///Get genesis id from sequencer pub async fn get_genesis_id(&self) -> Result { let genesis_req = GetGenesisIdRequest {}; @@ -141,6 +119,7 @@ impl SequencerClient { Ok(resp_deser) } + ///Get initial testnet accounts from sequencer pub async fn get_initial_testnet_accounts( &self, ) -> Result, SequencerClientError> { diff --git a/common/src/test_utils.rs b/common/src/test_utils.rs new file mode 100644 index 0000000..0a98dd2 --- /dev/null +++ b/common/src/test_utils.rs @@ -0,0 +1,90 @@ +use k256::ecdsa::SigningKey; +use nssa; +use secp256k1_zkp::Tweak; + +use crate::{ + block::{Block, HashableBlockData}, + execution_input::PublicNativeTokenSend, + transaction::{SignaturePrivateKey, Transaction, TransactionBody, TxKind}, +}; + +//Dummy producers + +///Produce dummy block with +/// +/// `id` - block id, provide zero for genesis +/// +/// `prev_hash` - hash of previous block, provide None for genesis +/// +/// `transactions` - vector of `Transaction` objects +/// +/// `additional_data` - vector with additional data +pub fn produce_dummy_block( + id: u64, + prev_hash: Option<[u8; 32]>, + transactions: Vec, + additional_data: Vec, +) -> Block { + let block_data = HashableBlockData { + block_id: id, + prev_block_id: id.saturating_sub(1), + prev_block_hash: prev_hash.unwrap_or_default(), + transactions, + data: additional_data, + }; + + block_data.into() +} + +pub fn produce_dummy_empty_transaction() -> nssa::PublicTransaction { + let program_id = nssa::AUTHENTICATED_TRANSFER_PROGRAM.id; + let addresses = vec![]; + let nonces = vec![]; + let instruction_data = 0; + let message = + nssa::public_transaction::Message::new(program_id, addresses, nonces, instruction_data); + let private_key = nssa::PrivateKey::new(1); + let witness_set = nssa::public_transaction::WitnessSet::for_message(&message, &[&private_key]); + nssa::PublicTransaction::new(message, witness_set) +} + +// pub fn create_dummy_private_transaction_random_signer( +// nullifier_created_hashes: Vec<[u8; 32]>, +// utxo_commitments_spent_hashes: Vec<[u8; 32]>, +// utxo_commitments_created_hashes: Vec<[u8; 32]>, +// ) -> Transaction { +// let mut rng = rand::thread_rng(); +// +// let body = TransactionBody { +// tx_kind: TxKind::Private, +// execution_input: vec![], +// execution_output: vec![], +// utxo_commitments_spent_hashes, +// utxo_commitments_created_hashes, +// nullifier_created_hashes, +// execution_proof_private: "dummy_proof".to_string(), +// encoded_data: vec![], +// ephemeral_pub_key: vec![10, 11, 12], +// commitment: vec![], +// tweak: Tweak::new(&mut rng), +// secret_r: [0; 32], +// sc_addr: "sc_addr".to_string(), +// }; +// Transaction::new(body, SignaturePrivateKey::random(&mut rng)) +// } + +pub fn create_dummy_transaction_native_token_transfer( + from: [u8; 32], + nonce: u128, + to: [u8; 32], + balance_to_move: u128, + signing_key: nssa::PrivateKey, +) -> nssa::PublicTransaction { + let addresses = vec![nssa::Address::new(from), nssa::Address::new(to)]; + let nonces = vec![nonce]; + let program_id = nssa::AUTHENTICATED_TRANSFER_PROGRAM.id; + let message = + nssa::public_transaction::Message::new(program_id, addresses, nonces, balance_to_move); + let witness_set = nssa::public_transaction::WitnessSet::for_message(&message, &[&signing_key]); + nssa::PublicTransaction::new(message, witness_set) +} diff --git a/common/src/transaction.rs b/common/src/transaction.rs index 2ba78e9..afc4559 100644 --- a/common/src/transaction.rs +++ b/common/src/transaction.rs @@ -58,10 +58,6 @@ pub struct TransactionBody { pub secret_r: [u8; 32], ///Hex-encoded address of a smart contract account called pub sc_addr: String, - ///Recorded changes in state of smart contract - /// - /// First value represents vector of changes, second is new length of a state - pub state_changes: (serde_json::Value, usize), } #[derive(Debug, Serialize, Deserialize)] @@ -325,7 +321,6 @@ mod tests { tweak: Tweak::from_slice(&[7; SECRET_KEY_SIZE]).unwrap(), secret_r: [8; 32], sc_addr: "someAddress".to_string(), - state_changes: (serde_json::Value::Null, 10), } } diff --git a/consensus/Cargo.toml b/consensus/Cargo.toml deleted file mode 100644 index 664f53d..0000000 --- a/consensus/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "consensus" -version = "0.1.0" -edition = "2021" - -[dependencies] -anyhow.workspace = true -serde_json.workspace = true -env_logger.workspace = true -log.workspace = true -serde.workspace = true -tokio.workspace = true - -[dependencies.networking] -path = "../networking" diff --git a/consensus/src/lib.rs b/consensus/src/lib.rs deleted file mode 100644 index 3d4e60e..0000000 --- a/consensus/src/lib.rs +++ /dev/null @@ -1,22 +0,0 @@ -use std::sync::Arc; - -use networking::peer_manager::PeerManager; -use tokio::sync::Mutex; - -#[derive(Debug)] -///Entrypoint to consensus. -/// Manages consensus protocol. -pub struct ConsensusManager { - pub peer_manager: Arc>, -} - -impl ConsensusManager { - pub fn new(peer_manager: Arc>) -> Self { - Self { peer_manager } - } - - //ToDo: change block from generic value into struct, when data block will be defined - pub fn vote(&self, _block: serde_json::Value) -> bool { - todo!() - } -} diff --git a/integration_tests/Cargo.toml b/integration_tests/Cargo.toml index 0e96490..10c49fb 100644 --- a/integration_tests/Cargo.toml +++ b/integration_tests/Cargo.toml @@ -30,14 +30,8 @@ path = "../sequencer_core" [dependencies.sequencer_runner] path = "../sequencer_runner" -[dependencies.node_rpc] -path = "../node_rpc" - -[dependencies.node_core] -path = "../node_core" - -[dependencies.node_runner] -path = "../node_runner" +[dependencies.wallet] +path = "../wallet" [dependencies.common] path = "../common" diff --git a/integration_tests/configs/debug/node/node_config.json b/integration_tests/configs/debug/node/node_config.json index ec27ac4..00913c4 100644 --- a/integration_tests/configs/debug/node/node_config.json +++ b/integration_tests/configs/debug/node/node_config.json @@ -1,253 +1,45 @@ { - "home": "./node", - "override_rust_log": null, - "sequencer_addr": "http://127.0.0.1:3040", - "seq_poll_timeout_secs": 10, - "port": 3041, - "gas_config": { - "gas_fee_per_byte_deploy": 100, - "gas_fee_per_input_buffer_runtime": 1000, - "gas_fee_per_byte_runtime": 10, - "gas_cost_runtime": 100, - "gas_cost_deploy": 1000, - "gas_limit_deploy": 30000000, - "gas_limit_runtime": 30000000 - }, - "shapshot_frequency_in_blocks": 10, - "initial_accounts": [ - { - "address": [ - 13, - 150, - 223, - 204, - 65, - 64, - 25, - 56, - 12, - 157, - 222, - 12, - 211, - 220, - 229, - 170, - 201, - 15, - 181, - 68, - 59, - 248, - 113, - 16, - 135, - 65, - 174, - 175, - 222, - 85, - 42, - 215 - ], - "balance": 10000, - "key_holder": { - "address": [ - 13, - 150, - 223, - 204, - 65, - 64, - 25, - 56, - 12, - 157, - 222, - 12, - 211, - 220, - 229, - 170, - 201, - 15, - 181, - 68, - 59, - 248, - 113, - 16, - 135, - 65, - 174, - 175, - 222, - 85, - 42, - 215 - ], - "nullifer_public_key": "03A340BECA9FAAB444CED0140681D72EA1318B5C611704FEE017DA9836B17DB718", - "pub_account_signing_key": [ - 133, - 143, - 177, - 187, - 252, - 66, - 237, - 236, - 234, - 252, - 244, - 138, - 5, - 151, - 3, - 99, - 217, - 231, - 112, - 217, - 77, - 211, - 58, - 218, - 176, - 68, - 99, - 53, - 152, - 228, - 198, - 190 - ], - "top_secret_key_holder": { - "secret_spending_key": "7BC46784DB1BC67825D8F029436846712BFDF9B5D79EA3AB11D39A52B9B229D4" - }, - "utxo_secret_key_holder": { - "nullifier_secret_key": "BB54A8D3C9C51B82C431082D1845A74677B0EF829A11B517E1D9885DE3139506", - "viewing_secret_key": "AD923E92F6A5683E30140CEAB2702AFB665330C1EE4EFA70FAF29767B6B52BAF" - }, - "viewing_public_key": "0361220C5D277E7A1709340FD31A52600C1432B9C45B9BCF88A43581D58824A8B6" - }, - "utxos": {} + "home": "./node", + "override_rust_log": null, + "sequencer_addr": "http://127.0.0.1:3040", + "seq_poll_timeout_secs": 10, + "initial_accounts": [ + { + "address": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + "balance": 10000, + "key_holder": { + "address": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + "nullifer_public_key": "03A340BECA9FAAB444CED0140681D72EA1318B5C611704FEE017DA9836B17DB718", + "pub_account_signing_key": 1, + "top_secret_key_holder": { + "secret_spending_key": "7BC46784DB1BC67825D8F029436846712BFDF9B5D79EA3AB11D39A52B9B229D4" }, - { - "address": [ - 151, - 72, - 112, - 233, - 190, - 141, - 10, - 192, - 138, - 168, - 59, - 63, - 199, - 167, - 166, - 134, - 41, - 29, - 135, - 50, - 80, - 138, - 186, - 152, - 179, - 96, - 128, - 243, - 156, - 44, - 243, - 100 - ], - "balance": 20000, - "key_holder": { - "address": [ - 151, - 72, - 112, - 233, - 190, - 141, - 10, - 192, - 138, - 168, - 59, - 63, - 199, - 167, - 166, - 134, - 41, - 29, - 135, - 50, - 80, - 138, - 186, - 152, - 179, - 96, - 128, - 243, - 156, - 44, - 243, - 100 - ], - "nullifer_public_key": "02172F50274DE67C4087C344F5D58E11DF761D90285B095060E0994FAA6BCDE271", - "pub_account_signing_key": [ - 54, - 90, - 62, - 225, - 71, - 225, - 228, - 148, - 143, - 53, - 210, - 23, - 137, - 158, - 171, - 156, - 48, - 7, - 139, - 52, - 117, - 242, - 214, - 7, - 99, - 29, - 122, - 184, - 59, - 116, - 144, - 107 - ], - "top_secret_key_holder": { - "secret_spending_key": "80A186737C8D38B4288A03F0F589957D9C040D79C19F3E0CC4BA80F8494E5179" - }, - "utxo_secret_key_holder": { - "nullifier_secret_key": "746928E63F0984F6F4818933493CE9C067562D9CB932FDC06D82C86CDF6D7122", - "viewing_secret_key": "89176CF4BC9E673807643FD52110EF99D4894335AFB10D881AC0B5041FE1FCB7" - }, - "viewing_public_key": "026072A8F83FEC3472E30CDD4767683F30B91661D25B1040AD9A5FC2E01D659F99" - }, - "utxos": {} - } - ] -} \ No newline at end of file + "utxo_secret_key_holder": { + "nullifier_secret_key": "BB54A8D3C9C51B82C431082D1845A74677B0EF829A11B517E1D9885DE3139506", + "viewing_secret_key": "AD923E92F6A5683E30140CEAB2702AFB665330C1EE4EFA70FAF29767B6B52BAF" + }, + "viewing_public_key": "0361220C5D277E7A1709340FD31A52600C1432B9C45B9BCF88A43581D58824A8B6" + }, + "utxos": {} + }, + { + "address": [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], + "balance": 20000, + "key_holder": { + "address": [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], + "nullifer_public_key": "02172F50274DE67C4087C344F5D58E11DF761D90285B095060E0994FAA6BCDE271", + "pub_account_signing_key": 2, + "top_secret_key_holder": { + "secret_spending_key": "80A186737C8D38B4288A03F0F589957D9C040D79C19F3E0CC4BA80F8494E5179" + }, + "utxo_secret_key_holder": { + "nullifier_secret_key": "746928E63F0984F6F4818933493CE9C067562D9CB932FDC06D82C86CDF6D7122", + "viewing_secret_key": "89176CF4BC9E673807643FD52110EF99D4894335AFB10D881AC0B5041FE1FCB7" + }, + "viewing_public_key": "026072A8F83FEC3472E30CDD4767683F30B91661D25B1040AD9A5FC2E01D659F99" + }, + "utxos": {} + } + ] +} + diff --git a/integration_tests/configs/debug/sequencer/sequencer_config.json b/integration_tests/configs/debug/sequencer/sequencer_config.json index 9eb086a..5546a37 100644 --- a/integration_tests/configs/debug/sequencer/sequencer_config.json +++ b/integration_tests/configs/debug/sequencer/sequencer_config.json @@ -8,12 +8,12 @@ "port": 3040, "initial_accounts": [ { - "addr": "0d96dfcc414019380c9dde0cd3dce5aac90fb5443bf871108741aeafde552ad7", + "addr": "0101010101010101010101010101010101010101010101010101010101010101", "balance": 10000 }, { - "addr": "974870e9be8d0ac08aa83b3fc7a7a686291d8732508aba98b36080f39c2cf364", + "addr": "0202020202020202020202020202020202020202020202020202020202020202", "balance": 20000 } ] -} \ No newline at end of file +} diff --git a/integration_tests/src/lib.rs b/integration_tests/src/lib.rs index a2c10c5..dfa8388 100644 --- a/integration_tests/src/lib.rs +++ b/integration_tests/src/lib.rs @@ -1,15 +1,15 @@ -use std::{path::PathBuf, sync::Arc, time::Duration}; +use std::{path::PathBuf, time::Duration}; use actix_web::dev::ServerHandle; use anyhow::Result; use clap::Parser; -use common::rpc_primitives::RpcConfig; +use common::sequencer_client::SequencerClient; use log::info; -use node_core::{NodeCore, config::NodeConfig}; use sequencer_core::config::SequencerConfig; use sequencer_runner::startup_sequencer; use tempfile::TempDir; -use tokio::{sync::Mutex, task::JoinHandle}; +use tokio::task::JoinHandle; +use wallet::{Command, helperfunctions::fetch_config}; #[derive(Parser, Debug)] #[clap(version)] @@ -20,92 +20,49 @@ struct Args { test_name: String, } -pub const ACC_SENDER: &str = "0d96dfcc414019380c9dde0cd3dce5aac90fb5443bf871108741aeafde552ad7"; -pub const ACC_RECEIVER: &str = "974870e9be8d0ac08aa83b3fc7a7a686291d8732508aba98b36080f39c2cf364"; +pub const ACC_SENDER: &str = "0101010101010101010101010101010101010101010101010101010101010101"; +pub const ACC_RECEIVER: &str = "0202020202020202020202020202020202020202020202020202020202020202"; pub const TIME_TO_WAIT_FOR_BLOCK_SECONDS: u64 = 12; #[allow(clippy::type_complexity)] pub async fn pre_test( home_dir: PathBuf, -) -> Result<( - ServerHandle, - JoinHandle>, - ServerHandle, - TempDir, - TempDir, - Arc>, -)> { +) -> Result<(ServerHandle, JoinHandle>, TempDir)> { let home_dir_sequencer = home_dir.join("sequencer"); - let home_dir_node = home_dir.join("node"); let mut sequencer_config = sequencer_runner::config::from_file(home_dir_sequencer.join("sequencer_config.json")) .unwrap(); - let mut node_config = - node_runner::config::from_file(home_dir_node.join("node_config.json")).unwrap(); - let (temp_dir_node, temp_dir_sequencer) = - replace_home_dir_with_temp_dir_in_configs(&mut node_config, &mut sequencer_config); + let temp_dir_sequencer = replace_home_dir_with_temp_dir_in_configs(&mut sequencer_config); let (seq_http_server_handle, sequencer_loop_handle) = startup_sequencer(sequencer_config).await?; - let node_port = node_config.port; - - let node_core = NodeCore::start_from_config_update_chain(node_config.clone()).await?; - - let wrapped_node_core = Arc::new(Mutex::new(node_core)); - - let http_server = node_rpc::new_http_server( - RpcConfig::with_port(node_port), - node_config.clone(), - wrapped_node_core.clone(), - )?; - info!("HTTP server started"); - let node_http_server_handle = http_server.handle(); - tokio::spawn(http_server); - Ok(( seq_http_server_handle, sequencer_loop_handle, - node_http_server_handle, - temp_dir_node, temp_dir_sequencer, - wrapped_node_core, )) } pub fn replace_home_dir_with_temp_dir_in_configs( - node_config: &mut NodeConfig, sequencer_config: &mut SequencerConfig, -) -> (TempDir, TempDir) { - let temp_dir_node = tempfile::tempdir().unwrap(); +) -> TempDir { let temp_dir_sequencer = tempfile::tempdir().unwrap(); - node_config.home = temp_dir_node.path().to_path_buf(); sequencer_config.home = temp_dir_sequencer.path().to_path_buf(); - (temp_dir_node, temp_dir_sequencer) + temp_dir_sequencer } #[allow(clippy::type_complexity)] -pub async fn post_test( - residual: ( - ServerHandle, - JoinHandle>, - ServerHandle, - TempDir, - TempDir, - Arc>, - ), -) { - let (seq_http_server_handle, sequencer_loop_handle, node_http_server_handle, _, _, _) = - residual; +pub async fn post_test(residual: (ServerHandle, JoinHandle>, TempDir)) { + let (seq_http_server_handle, sequencer_loop_handle, _) = residual; info!("Cleanup"); - node_http_server_handle.stop(true).await; sequencer_loop_handle.abort(); seq_http_server_handle.stop(true).await; @@ -113,28 +70,28 @@ pub async fn post_test( //So they are dropped and tempdirs will be dropped too, } -pub async fn test_success(wrapped_node_core: Arc>) { - let acc_sender = hex::decode(ACC_SENDER).unwrap().try_into().unwrap(); - let acc_receiver = hex::decode(ACC_RECEIVER).unwrap().try_into().unwrap(); +pub async fn test_success() { + let command = Command::SendNativeTokenTransfer { + from: ACC_SENDER.to_string(), + to: ACC_RECEIVER.to_string(), + amount: 100, + }; - let guard = wrapped_node_core.lock().await; + let node_config = fetch_config().unwrap(); - let _res = guard - .send_public_native_token_transfer(acc_sender, 0, acc_receiver, 100) - .await - .unwrap(); + let seq_client = SequencerClient::new(node_config.sequencer_addr.clone()).unwrap(); + + wallet::execute_subcommand(command).await.unwrap(); info!("Waiting for next block creation"); tokio::time::sleep(Duration::from_secs(TIME_TO_WAIT_FOR_BLOCK_SECONDS)).await; info!("Checking correct balance move"); - let acc_1_balance = guard - .sequencer_client + let acc_1_balance = seq_client .get_account_balance(ACC_SENDER.to_string()) .await .unwrap(); - let acc_2_balance = guard - .sequencer_client + let acc_2_balance = seq_client .get_account_balance(ACC_RECEIVER.to_string()) .await .unwrap(); @@ -148,30 +105,30 @@ pub async fn test_success(wrapped_node_core: Arc>) { info!("Success!"); } -pub async fn test_success_move_to_another_account(wrapped_node_core: Arc>) { - let acc_sender = hex::decode(ACC_SENDER).unwrap().try_into().unwrap(); - let acc_receiver_new_acc = [42; 32]; +pub async fn test_success_move_to_another_account() { + let hex_acc_receiver_new_acc = hex::encode([42; 32]); - let hex_acc_receiver_new_acc = hex::encode(acc_receiver_new_acc); + let command = Command::SendNativeTokenTransfer { + from: ACC_SENDER.to_string(), + to: hex_acc_receiver_new_acc.clone(), + amount: 100, + }; - let guard = wrapped_node_core.lock().await; + let node_config = fetch_config().unwrap(); - let _res = guard - .send_public_native_token_transfer(acc_sender, 0, acc_receiver_new_acc, 100) - .await - .unwrap(); + let seq_client = SequencerClient::new(node_config.sequencer_addr.clone()).unwrap(); + + wallet::execute_subcommand(command).await.unwrap(); info!("Waiting for next block creation"); tokio::time::sleep(Duration::from_secs(TIME_TO_WAIT_FOR_BLOCK_SECONDS)).await; info!("Checking correct balance move"); - let acc_1_balance = guard - .sequencer_client + let acc_1_balance = seq_client .get_account_balance(ACC_SENDER.to_string()) .await .unwrap(); - let acc_2_balance = guard - .sequencer_client + let acc_2_balance = seq_client .get_account_balance(hex_acc_receiver_new_acc) .await .unwrap(); @@ -185,28 +142,28 @@ pub async fn test_success_move_to_another_account(wrapped_node_core: Arc>) { - let acc_sender = hex::decode(ACC_SENDER).unwrap().try_into().unwrap(); - let acc_receiver = hex::decode(ACC_RECEIVER).unwrap().try_into().unwrap(); +pub async fn test_failure() { + let command = Command::SendNativeTokenTransfer { + from: ACC_SENDER.to_string(), + to: ACC_RECEIVER.to_string(), + amount: 1000000, + }; - let guard = wrapped_node_core.lock().await; + let node_config = fetch_config().unwrap(); - let _res = guard - .send_public_native_token_transfer(acc_sender, 0, acc_receiver, 100000) - .await - .unwrap(); + let seq_client = SequencerClient::new(node_config.sequencer_addr.clone()).unwrap(); + + wallet::execute_subcommand(command).await.unwrap(); info!("Waiting for next block creation"); tokio::time::sleep(Duration::from_secs(TIME_TO_WAIT_FOR_BLOCK_SECONDS)).await; info!("Checking correct balance move"); - let acc_1_balance = guard - .sequencer_client + let acc_1_balance = seq_client .get_account_balance(ACC_SENDER.to_string()) .await .unwrap(); - let acc_2_balance = guard - .sequencer_client + let acc_2_balance = seq_client .get_account_balance(ACC_RECEIVER.to_string()) .await .unwrap(); @@ -224,12 +181,10 @@ macro_rules! test_cleanup_wrap { ($home_dir:ident, $test_func:ident) => {{ let res = pre_test($home_dir.clone()).await.unwrap(); - let wrapped_node_core = res.5.clone(); - info!("Waiting for first block creation"); tokio::time::sleep(Duration::from_secs(TIME_TO_WAIT_FOR_BLOCK_SECONDS)).await; - $test_func(wrapped_node_core.clone()).await; + $test_func().await; post_test(res).await; }}; diff --git a/networking/Cargo.toml b/networking/Cargo.toml deleted file mode 100644 index 5649f66..0000000 --- a/networking/Cargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "networking" -version = "0.1.0" -edition = "2021" - -[dependencies] -anyhow.workspace = true -serde_json.workspace = true -env_logger.workspace = true -log.workspace = true -serde.workspace = true diff --git a/networking/src/lib.rs b/networking/src/lib.rs deleted file mode 100644 index 77025d9..0000000 --- a/networking/src/lib.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub mod network_protocol; -pub mod peer; -pub mod peer_manager; -pub mod rate_limiter; -pub mod tcp; diff --git a/networking/src/network_protocol.rs b/networking/src/network_protocol.rs deleted file mode 100644 index 333887b..0000000 --- a/networking/src/network_protocol.rs +++ /dev/null @@ -1,19 +0,0 @@ -#[derive(Debug)] -pub enum MessageKind {} - -pub type PeerId = u64; -pub type PeerDistance = u32; - -#[derive(Debug)] -pub struct PeerAddr { - pub id: PeerId, - //Probably will be socket address in the future - pub addr: String, -} - -#[derive(Debug)] -///Structure, which contains all necessary fields for handshake -pub struct Handshake {} - -#[derive(Debug)] -pub enum HandshakeFailedReason {} diff --git a/networking/src/peer.rs b/networking/src/peer.rs deleted file mode 100644 index c7775d8..0000000 --- a/networking/src/peer.rs +++ /dev/null @@ -1,18 +0,0 @@ -use crate::{ - network_protocol::{HandshakeFailedReason, PeerAddr}, - tcp::Connection, -}; - -#[derive(Debug)] -/// Structure, which stores all of the peer interaction data. -/// Created at per-peer connection basis at `PeerManager` -pub struct Peer { - pub connection: Connection, - pub peer_addr: PeerAddr, -} - -impl Peer { - pub fn handshake(&mut self) -> Result<(), HandshakeFailedReason> { - todo!(); - } -} diff --git a/networking/src/peer_manager.rs b/networking/src/peer_manager.rs deleted file mode 100644 index f75cb81..0000000 --- a/networking/src/peer_manager.rs +++ /dev/null @@ -1,20 +0,0 @@ -use anyhow::Result; - -use crate::{network_protocol::PeerId, peer::Peer}; - -#[derive(Debug)] -///Entrypoint to network module. -/// Manages connections with peers in network -pub struct PeerManager { - pub my_peer_id: PeerId, -} - -impl PeerManager { - pub async fn start_peer_manager(_num_threads: u8, my_peer_id: PeerId) -> Result { - Ok(Self { my_peer_id }) - } - - pub async fn connect(&self, _peer_id: PeerId) -> Peer { - todo!() - } -} diff --git a/networking/src/rate_limiter.rs b/networking/src/rate_limiter.rs deleted file mode 100644 index 316e5a3..0000000 --- a/networking/src/rate_limiter.rs +++ /dev/null @@ -1,16 +0,0 @@ -use std::collections::HashMap; - -use crate::network_protocol::MessageKind; - -#[derive(Debug)] -/// Object responsible to manage the rate limits of all network messages -/// for a single connection/peer. -pub struct RateLimiter { - pub limits: HashMap, -} - -impl RateLimiter { - pub fn is_allowed(&self, _message: MessageKind) -> bool { - todo!(); - } -} diff --git a/networking/src/tcp.rs b/networking/src/tcp.rs deleted file mode 100644 index 406c64f..0000000 --- a/networking/src/tcp.rs +++ /dev/null @@ -1,11 +0,0 @@ -use crate::network_protocol::PeerAddr; - -#[derive(Debug)] -///Structure, representing peer connection -pub struct Connection {} - -#[derive(Debug)] -pub enum ConnectionType { - Inbound { conn: Connection }, - Outbound { conn: Connection, peer: PeerAddr }, -} diff --git a/node_core/src/chain_storage/block_store.rs b/node_core/src/chain_storage/block_store.rs deleted file mode 100644 index ba97c3c..0000000 --- a/node_core/src/chain_storage/block_store.rs +++ /dev/null @@ -1,269 +0,0 @@ -use std::collections::{HashMap, HashSet}; -use std::path::Path; - -use accounts::account_core::Account; -use anyhow::{anyhow, Result}; -use common::block::Block; -use common::merkle_tree_public::merkle_tree::HashStorageMerkleTree; -use common::nullifier::UTXONullifier; -use common::transaction::Transaction; -use common::utxo_commitment::UTXOCommitment; -use log::error; -use storage::sc_db_utils::{DataBlob, DataBlobChangeVariant}; -use storage::RocksDBIO; - -use crate::chain_storage::AccMap; - -pub struct NodeBlockStore { - dbio: RocksDBIO, -} - -impl NodeBlockStore { - ///Starting database at the start of new chain. - /// Creates files if necessary. - /// - /// ATTENTION: Will overwrite genesis block. - pub fn open_db_with_genesis(location: &Path, genesis_block: Option) -> Result { - Ok(Self { - dbio: RocksDBIO::new(location, genesis_block)?, - }) - } - - ///Reopening existing database - pub fn open_db_restart(location: &Path, genesis_block: Block) -> Result { - NodeBlockStore::db_destroy(location)?; - NodeBlockStore::open_db_with_genesis(location, Some(genesis_block)) - } - - ///Reloading existing database - pub fn open_db_reload(location: &Path) -> Result { - NodeBlockStore::open_db_with_genesis(location, None) - } - - ///Destroying existing database - fn db_destroy(location: &Path) -> Result<()> { - RocksDBIO::destroy(location).map_err(|err| anyhow!("RocksDBIO error: {}", err)) - } - - pub fn get_block_at_id(&self, id: u64) -> Result { - Ok(self.dbio.get_block(id)?) - } - - pub fn put_block_at_id(&self, block: Block) -> Result<()> { - Ok(self.dbio.put_block(block, false)?) - } - - pub fn put_sc_sc_state( - &self, - sc_addr: &str, - length: usize, - modifications: Vec, - ) -> Result<()> { - Ok(self.dbio.put_sc_sc_state(sc_addr, length, modifications)?) - } - - pub fn get_sc_sc_state(&self, sc_addr: &str) -> Result> { - Ok(self.dbio.get_sc_sc_state(sc_addr)?) - } - - pub fn get_snapshot_block_id(&self) -> Result { - Ok(self.dbio.get_snapshot_block_id()?) - } - - pub fn get_snapshot_account(&self) -> Result> { - let temp: AccMap = serde_json::from_slice(&self.dbio.get_snapshot_account()?)?; - Ok(temp.into()) - } - - pub fn get_snapshot_commitment(&self) -> Result> { - Ok(serde_json::from_slice( - &self.dbio.get_snapshot_commitment()?, - )?) - } - - pub fn get_snapshot_nullifier(&self) -> Result> { - Ok(serde_json::from_slice( - &self.dbio.get_snapshot_nullifier()?, - )?) - } - - pub fn get_snapshot_transaction(&self) -> Result> { - Ok(serde_json::from_slice( - &self.dbio.get_snapshot_transaction()?, - )?) - } - - pub fn put_snapshot_at_block_id( - &self, - id: u64, - accounts_ser: Vec, - comm_ser: Vec, - txs_ser: Vec, - nullifiers_ser: Vec, - ) -> Result<()> { - //Error notification for writing into DB error - self.dbio - .put_snapshot_block_id_db(id) - .inspect_err(|err| error!("Failed to store snapshot block id with error {err:#?}"))?; - self.dbio - .put_snapshot_account_db(accounts_ser) - .inspect_err(|err| error!("Failed to store snapshot accounts with error {err:#?}"))?; - self.dbio - .put_snapshot_commitement_db(comm_ser) - .inspect_err(|err| { - error!("Failed to store snapshot commitments with error {err:#?}") - })?; - self.dbio - .put_snapshot_transaction_db(txs_ser) - .inspect_err(|err| { - error!("Failed to store snapshot transactions with error {err:#?}") - })?; - self.dbio - .put_snapshot_nullifier_db(nullifiers_ser) - .inspect_err(|err| error!("Failed to store snapshot nullifiers with error {err:#?}"))?; - - Ok(()) - } -} - -#[cfg(test)] -mod tests { - use super::*; - use common::block::Data; - use tempfile::tempdir; - - fn create_genesis_block() -> Block { - Block { - block_id: 0, - prev_block_id: 0, - prev_block_hash: [0; 32], - hash: [1; 32], - transactions: vec![], - data: Data::default(), - } - } - - fn create_sample_block(block_id: u64, prev_block_id: u64) -> Block { - Block { - block_id, - prev_block_id, - prev_block_hash: [0; 32], - hash: [1; 32], - transactions: vec![], - data: Data::default(), - } - } - - #[test] - fn test_open_db_with_genesis() { - let temp_dir = tempdir().unwrap(); - let path = temp_dir.path(); - - let genesis_block = create_genesis_block(); - let node_store = - NodeBlockStore::open_db_with_genesis(path, Some(genesis_block.clone())).unwrap(); - - // Verify the genesis block is stored - let stored_block = node_store.get_block_at_id(0).unwrap(); - assert_eq!(stored_block.block_id, genesis_block.block_id); - assert_eq!(stored_block.hash, genesis_block.hash); - } - - #[test] - fn test_open_db_restart() { - let temp_dir = tempdir().unwrap(); - let path = temp_dir.path(); - - let genesis_block = create_genesis_block(); - { - let node_store_old = - NodeBlockStore::open_db_with_genesis(path, Some(genesis_block.clone())).unwrap(); - - let block = create_sample_block(1, 0); - node_store_old.put_block_at_id(block.clone()).unwrap(); - } - - // Check that the first block is still in the old database - { - let node_store_old = NodeBlockStore::open_db_reload(path).unwrap(); - let result = node_store_old.get_block_at_id(1); - assert!(result.is_ok()); - } - - // Restart the database - let node_store = NodeBlockStore::open_db_restart(path, genesis_block).unwrap(); - - // The block should no longer be available since no first block is set on restart - let result = node_store.get_block_at_id(1); - assert!(result.is_err()); - } - - #[test] - fn test_open_db_reload() { - let temp_dir = tempdir().unwrap(); - let path = temp_dir.path(); - - let genesis_block = create_genesis_block(); - let _ = NodeBlockStore::open_db_with_genesis(path, Some(genesis_block)).unwrap(); - - // Reload the database - let node_store = NodeBlockStore::open_db_reload(path).unwrap(); - - // The genesis block should be available on reload - let result = node_store.get_block_at_id(0); - assert!(result.is_ok()); - } - - #[test] - fn test_put_and_get_block() { - let temp_dir = tempdir().unwrap(); - let path = temp_dir.path(); - - let genesis_block = create_genesis_block(); - let node_store = NodeBlockStore::open_db_with_genesis(path, Some(genesis_block)).unwrap(); - - let block = create_sample_block(1, 0); - node_store.put_block_at_id(block.clone()).unwrap(); - - let retrieved_block = node_store.get_block_at_id(1).unwrap(); - assert_eq!(retrieved_block.block_id, block.block_id); - assert_eq!(retrieved_block.hash, block.hash); - } - - #[test] - fn test_put_snapshot_at_block_id() { - let temp_dir = tempdir().unwrap(); - let path = temp_dir.path(); - - let genesis_block = create_genesis_block(); - let node_store = NodeBlockStore::open_db_with_genesis(path, Some(genesis_block)).unwrap(); - - let id = 3; - let accounts_ser = vec![1, 2, 3, 4]; - let comm_ser = vec![5, 6, 7, 8]; - let txs_ser = vec![9, 10, 11, 12]; - let nullifiers_ser = vec![13, 14, 15, 16]; - - node_store - .put_snapshot_at_block_id( - id, - accounts_ser.clone(), - comm_ser.clone(), - txs_ser.clone(), - nullifiers_ser.clone(), - ) - .unwrap(); - - assert_eq!(node_store.dbio.get_snapshot_block_id().unwrap(), id); - assert_eq!( - node_store.dbio.get_snapshot_account().unwrap(), - accounts_ser - ); - assert_eq!(node_store.dbio.get_snapshot_commitment().unwrap(), comm_ser); - assert_eq!(node_store.dbio.get_snapshot_transaction().unwrap(), txs_ser); - assert_eq!( - node_store.dbio.get_snapshot_nullifier().unwrap(), - nullifiers_ser - ); - } -} diff --git a/node_core/src/chain_storage/mod.rs b/node_core/src/chain_storage/mod.rs deleted file mode 100644 index 8e36dc5..0000000 --- a/node_core/src/chain_storage/mod.rs +++ /dev/null @@ -1,632 +0,0 @@ -use std::collections::{BTreeMap, HashMap, HashSet}; - -use accounts::account_core::{address::AccountAddress, Account}; -use anyhow::Result; -use block_store::NodeBlockStore; -use common::{ - block::Block, - execution_input::PublicNativeTokenSend, - merkle_tree_public::merkle_tree::{PublicTransactionMerkleTree, UTXOCommitmentsMerkleTree}, - nullifier::UTXONullifier, - utxo_commitment::UTXOCommitment, -}; -use k256::AffinePoint; -use log::{info, warn}; -use sc_core::public_context::PublicSCContext; -use serde::{Deserialize, Serialize}; -use utxo::utxo_core::UTXO; - -use crate::{config::NodeConfig, ActionData}; - -pub mod accounts_store; -pub mod block_store; - -#[derive(Deserialize, Serialize)] -pub struct AccMap { - pub acc_map: HashMap, -} - -impl From> for AccMap { - fn from(value: HashMap<[u8; 32], Account>) -> Self { - AccMap { - acc_map: value - .into_iter() - .map(|(key, val)| (hex::encode(key), val)) - .collect(), - } - } -} - -impl From for HashMap<[u8; 32], Account> { - fn from(value: AccMap) -> Self { - value - .acc_map - .into_iter() - .map(|(key, val)| (hex::decode(key).unwrap().try_into().unwrap(), val)) - .collect() - } -} - -pub struct NodeChainStore { - pub acc_map: HashMap, - pub block_store: NodeBlockStore, - pub nullifier_store: HashSet, - pub utxo_commitments_store: UTXOCommitmentsMerkleTree, - pub pub_tx_store: PublicTransactionMerkleTree, - pub node_config: NodeConfig, -} - -impl NodeChainStore { - pub fn new(config: NodeConfig, genesis_block: Block) -> Result<(Self, u64)> { - let mut acc_map = HashMap::new(); - let mut nullifier_store = HashSet::new(); - let mut utxo_commitments_store = UTXOCommitmentsMerkleTree::new(vec![]); - let mut pub_tx_store = PublicTransactionMerkleTree::new(vec![]); - let mut block_id = genesis_block.block_id; - - //Sequencer should panic if unable to open db, - //as fixing this issue may require actions non-native to program scope - let block_store = - NodeBlockStore::open_db_with_genesis(&config.home.join("rocksdb"), Some(genesis_block)) - .unwrap(); - - if let Ok(temp_block_id) = block_store.get_snapshot_block_id() { - utxo_commitments_store = block_store.get_snapshot_commitment()?; - nullifier_store = block_store.get_snapshot_nullifier()?; - acc_map = block_store.get_snapshot_account()?; - pub_tx_store = block_store.get_snapshot_transaction()?; - block_id = temp_block_id; - } - - Ok(( - Self { - acc_map, - block_store, - nullifier_store, - utxo_commitments_store, - pub_tx_store, - node_config: config, - }, - block_id, - )) - } - - pub fn new_after_restart(config: NodeConfig, genesis_block: Block) -> Result<(Self, u64)> { - let mut acc_map = HashMap::new(); - let mut nullifier_store = HashSet::new(); - let mut utxo_commitments_store = UTXOCommitmentsMerkleTree::new(vec![]); - let mut pub_tx_store = PublicTransactionMerkleTree::new(vec![]); - let mut block_id = genesis_block.block_id; - - //Sequencer should panic if unable to open db, - //as fixing this issue may require actions non-native to program scope - let block_store = NodeBlockStore::open_db_reload(&config.home.join("rocksdb")).unwrap(); - - if let Ok(temp_block_id) = block_store.get_snapshot_block_id() { - utxo_commitments_store = block_store.get_snapshot_commitment()?; - nullifier_store = block_store.get_snapshot_nullifier()?; - acc_map = block_store.get_snapshot_account()?; - pub_tx_store = block_store.get_snapshot_transaction()?; - block_id = temp_block_id; - } - - Ok(( - Self { - acc_map, - block_store, - nullifier_store, - utxo_commitments_store, - pub_tx_store, - node_config: config, - }, - block_id, - )) - } - - pub fn dissect_insert_block(&mut self, block: Block) -> Result<()> { - let block_id = block.block_id; - - for tx in &block.transactions { - if !tx.body().execution_input.is_empty() { - let public_action = - serde_json::from_slice::(&tx.body().execution_input); - - if let Ok(public_action) = public_action { - match public_action { - ActionData::MintMoneyPublicTx(action) => { - let acc_mut = self.acc_map.get_mut(&action.acc); - - if let Some(acc_mut) = acc_mut { - acc_mut.balance += action.amount as u64; - } - } - ActionData::SendMoneyDeshieldedTx(action) => { - for (balance, acc_addr) in action.receiver_data { - let acc_mut = self.acc_map.get_mut(&acc_addr); - - if let Some(acc_mut) = acc_mut { - acc_mut.balance += balance as u64; - } - } - } - ActionData::SendMoneyShieldedTx(action) => { - let acc_mut = self.acc_map.get_mut(&action.acc_sender); - - if let Some(acc_mut) = acc_mut { - acc_mut.balance = - acc_mut.balance.saturating_sub(action.amount as u64); - } - } - _ => {} - } - } else { - let native_transfer = - serde_json::from_slice::(&tx.body().execution_input); - - if let Ok(transfer) = native_transfer { - if let Some(acc_sender) = self.acc_map.get_mut(&transfer.from) { - //Can panic, we depend on sequencer maintaining chain consistency here - acc_sender.balance -= transfer.balance_to_move; - - if let Some(acc_rec) = self.acc_map.get_mut(&transfer.to) { - acc_rec.balance += transfer.balance_to_move; - } - } - } - } - } - - self.utxo_commitments_store.add_tx_multiple( - tx.body() - .utxo_commitments_created_hashes - .clone() - .into_iter() - .map(|hash| UTXOCommitment { hash }) - .collect(), - ); - - for nullifier in tx.body().nullifier_created_hashes.iter() { - self.nullifier_store.insert(UTXONullifier { - utxo_hash: *nullifier, - }); - } - - if !tx.body().encoded_data.is_empty() { - let ephemeral_public_key_sender = - serde_json::from_slice::(&tx.body().ephemeral_pub_key)?; - - for (ciphertext, nonce, tag) in tx.body().encoded_data.clone() { - let slice = nonce.as_slice(); - let nonce = - accounts::key_management::constants_types::Nonce::clone_from_slice(slice); - for (acc_id, acc) in self.acc_map.iter_mut() { - if hex::decode(acc_id).unwrap()[0] == tag { - let decoded_data_curr_acc = acc.decrypt_data( - ephemeral_public_key_sender, - ciphertext.clone(), - nonce, - ); - if let Ok(decoded_data_curr_acc) = decoded_data_curr_acc { - let decoded_utxo_try = - serde_json::from_slice::(&decoded_data_curr_acc); - if let Ok(utxo) = decoded_utxo_try { - if &utxo.owner == acc_id { - acc.utxos.insert(utxo.hash, utxo); - } - } - } - } - } - } - } - - self.pub_tx_store.add_tx(tx); - } - - self.block_store.put_block_at_id(block)?; - - //Snapshot - if block_id.is_multiple_of(self.node_config.shapshot_frequency_in_blocks) { - //Serializing all important data structures - - //If we fail serialization, it is not the reason to stop running - //Logging on warn level in this cases - let acc_map: AccMap = self.acc_map.clone().into(); - - if let Ok(accounts_ser) = serde_json::to_vec(&acc_map).inspect_err(|err| { - warn!("Failed to serialize accounts data {err:#?}"); - }) { - if let Ok(comm_ser) = - serde_json::to_vec(&self.utxo_commitments_store).inspect_err(|err| { - warn!("Failed to serialize commitments {err:#?}"); - }) - { - if let Ok(txs_ser) = serde_json::to_vec(&self.pub_tx_store).inspect_err(|err| { - warn!("Failed to serialize transactions {err:#?}"); - }) { - if let Ok(nullifiers_ser) = serde_json::to_vec(&self.nullifier_store) - .inspect_err(|err| { - warn!("Failed to serialize nullifiers {err:#?}"); - }) - { - let snapshot_trace = self.block_store.put_snapshot_at_block_id( - block_id, - accounts_ser, - comm_ser, - txs_ser, - nullifiers_ser, - ); - - info!( - "Snapshot executed at {block_id:?} with results {snapshot_trace:#?}" - ); - } - } - } - } - } - - Ok(()) - } - - pub fn produce_context(&self, caller: AccountAddress) -> PublicSCContext { - let mut account_masks = BTreeMap::new(); - - for (acc_addr, acc) in &self.acc_map { - account_masks.insert(*acc_addr, acc.make_account_public_mask()); - } - - PublicSCContext { - caller_address: caller, - caller_balance: self.acc_map.get(&caller).unwrap().balance, - account_masks, - comitment_store_root: self.utxo_commitments_store.get_root().unwrap_or([0; 32]), - pub_tx_store_root: self.pub_tx_store.get_root().unwrap_or([0; 32]), - nullifiers_set: self - .nullifier_store - .iter() - .map(|item| item.utxo_hash) - .collect(), - commitments_tree: self.utxo_commitments_store.clone(), - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::config::GasConfig; - use accounts::account_core::Account; - use common::block::{Block, Data}; - use common::merkle_tree_public::TreeHashType; - use common::transaction::{SignaturePrivateKey, Transaction, TransactionBody, TxKind}; - use secp256k1_zkp::Tweak; - use std::path::PathBuf; - use tempfile::tempdir; - - fn create_initial_accounts() -> Vec { - let initial_acc1 = serde_json::from_str(r#"{ - "address": [ - 244, - 55, - 238, - 205, - 74, - 115, - 179, - 192, - 65, - 186, - 166, - 169, - 221, - 45, - 6, - 57, - 200, - 65, - 195, - 70, - 118, - 252, - 206, - 100, - 215, - 250, - 72, - 230, - 19, - 71, - 217, - 249 - ], - "balance": 100, - "key_holder": { - "nullifer_public_key": "03A340BECA9FAAB444CED0140681D72EA1318B5C611704FEE017DA9836B17DB718", - "pub_account_signing_key": [ - 244, - 88, - 134, - 61, - 35, - 209, - 229, - 101, - 85, - 35, - 140, - 140, - 192, - 226, - 83, - 83, - 190, - 189, - 110, - 8, - 89, - 127, - 147, - 142, - 157, - 204, - 51, - 109, - 189, - 92, - 144, - 68 - ], - "top_secret_key_holder": { - "secret_spending_key": "7BC46784DB1BC67825D8F029436846712BFDF9B5D79EA3AB11D39A52B9B229D4" - }, - "utxo_secret_key_holder": { - "nullifier_secret_key": "BB54A8D3C9C51B82C431082D1845A74677B0EF829A11B517E1D9885DE3139506", - "viewing_secret_key": "AD923E92F6A5683E30140CEAB2702AFB665330C1EE4EFA70FAF29767B6B52BAF" - }, - "viewing_public_key": "0361220C5D277E7A1709340FD31A52600C1432B9C45B9BCF88A43581D58824A8B6" - }, - "utxos": {} - }"#).unwrap(); - - let initial_acc2 = serde_json::from_str(r#"{ - "address": [ - 72, - 169, - 70, - 237, - 1, - 96, - 35, - 157, - 25, - 15, - 83, - 18, - 52, - 206, - 202, - 63, - 48, - 59, - 173, - 76, - 78, - 7, - 254, - 229, - 28, - 45, - 194, - 79, - 6, - 89, - 58, - 85 - ], - "balance": 200, - "key_holder": { - "nullifer_public_key": "02172F50274DE67C4087C344F5D58E11DF761D90285B095060E0994FAA6BCDE271", - "pub_account_signing_key": [ - 136, - 105, - 9, - 53, - 180, - 145, - 64, - 5, - 235, - 174, - 62, - 211, - 206, - 116, - 185, - 24, - 214, - 62, - 244, - 64, - 224, - 59, - 120, - 150, - 30, - 249, - 160, - 46, - 189, - 254, - 47, - 244 - ], - "top_secret_key_holder": { - "secret_spending_key": "80A186737C8D38B4288A03F0F589957D9C040D79C19F3E0CC4BA80F8494E5179" - }, - "utxo_secret_key_holder": { - "nullifier_secret_key": "746928E63F0984F6F4818933493CE9C067562D9CB932FDC06D82C86CDF6D7122", - "viewing_secret_key": "89176CF4BC9E673807643FD52110EF99D4894335AFB10D881AC0B5041FE1FCB7" - }, - "viewing_public_key": "026072A8F83FEC3472E30CDD4767683F30B91661D25B1040AD9A5FC2E01D659F99" - }, - "utxos": {} - }"#).unwrap(); - - let initial_accounts = vec![initial_acc1, initial_acc2]; - - initial_accounts - } - - fn create_genesis_block() -> Block { - Block { - block_id: 0, - prev_block_id: 0, - prev_block_hash: [0; 32], - hash: [1; 32], - transactions: vec![], - data: Data::default(), - } - } - - fn create_dummy_transaction( - nullifier_created_hashes: Vec<[u8; 32]>, - utxo_commitments_spent_hashes: Vec<[u8; 32]>, - utxo_commitments_created_hashes: Vec<[u8; 32]>, - ) -> Transaction { - let mut rng = rand::thread_rng(); - - let body = TransactionBody { - tx_kind: TxKind::Private, - execution_input: vec![], - execution_output: vec![], - utxo_commitments_spent_hashes, - utxo_commitments_created_hashes, - nullifier_created_hashes, - execution_proof_private: "dummy_proof".to_string(), - encoded_data: vec![], - ephemeral_pub_key: vec![10, 11, 12], - commitment: vec![], - tweak: Tweak::new(&mut rng), - secret_r: [0; 32], - sc_addr: "sc_addr".to_string(), - state_changes: (serde_json::Value::Null, 0), - }; - Transaction::new(body, SignaturePrivateKey::random(&mut rng)) - } - - fn create_sample_block(block_id: u64, prev_block_id: u64) -> Block { - Block { - block_id, - prev_block_id, - prev_block_hash: [0; 32], - hash: [1; 32], - transactions: vec![], - data: Data::default(), - } - } - - fn create_sample_node_config(home: PathBuf) -> NodeConfig { - NodeConfig { - home, - override_rust_log: None, - sequencer_addr: "http://127.0.0.1".to_string(), - seq_poll_timeout_secs: 1, - port: 8000, - gas_config: create_sample_gas_config(), - shapshot_frequency_in_blocks: 1, - initial_accounts: create_initial_accounts(), - } - } - - fn create_sample_gas_config() -> GasConfig { - GasConfig { - gas_fee_per_byte_deploy: 0, - gas_fee_per_input_buffer_runtime: 0, - gas_fee_per_byte_runtime: 0, - gas_cost_runtime: 0, - gas_cost_deploy: 0, - gas_limit_deploy: 0, - gas_limit_runtime: 0, - } - } - - fn generate_dummy_utxo(address: TreeHashType, amount: u128) -> UTXO { - UTXO::new(address, vec![], amount, false) - } - - #[test] - fn test_new_initializes_correctly() { - let temp_dir = tempdir().unwrap(); - let path = temp_dir.path(); - - let config = create_sample_node_config(path.to_path_buf()); - - let genesis_block = create_genesis_block(); - - let (store, block_id) = NodeChainStore::new(config.clone(), genesis_block.clone()).unwrap(); - - assert_eq!(block_id, 0); - assert!(store.acc_map.is_empty()); - assert!(store.nullifier_store.is_empty()); - assert_eq!( - store.utxo_commitments_store.get_root().unwrap_or([0; 32]), - [0; 32] - ); - } - - #[test] - fn test_new_recovers_from_snapshot() { - let temp_dir = tempdir().unwrap(); - let path = temp_dir.path().to_path_buf(); - - let config = create_sample_node_config(path); - - let nullifier_secret_const = - "261d61d294ac4bdc24f91b6f490efa263757a4a95f65871cd4f16b2ea23c3b5d"; - std::env::set_var("NULLIFIER_SECRET_CONST", nullifier_secret_const); - - let viewing_secret_const = - "6117af750b30d7a296672ec3b3b25d3489beca3cfe5770fa39f275cec395d5ce"; - std::env::set_var("VIEWING_SECRET_CONST", viewing_secret_const); - - let genesis_block = create_genesis_block(); - - // Initialize once to create DB and store fake snapshot - { - let (mut store, _) = - NodeChainStore::new(config.clone(), genesis_block.clone()).unwrap(); - - // Insert state - let mut account = Account::new(); - account - .add_new_utxo_outputs(vec![generate_dummy_utxo(account.address, 100)]) - .unwrap(); - store.acc_map.insert(account.address, account); - store.nullifier_store.insert(UTXONullifier { - utxo_hash: [2u8; 32], - }); - store - .utxo_commitments_store - .add_tx_multiple(vec![UTXOCommitment { hash: [3u8; 32] }]); - store.pub_tx_store.add_tx(&create_dummy_transaction( - vec![[9; 32]], - vec![[7; 32]], - vec![[8; 32]], - )); - - // Put block snapshot to trigger snapshot recovery on next load - let dummy_block = create_sample_block(1, 0); - - store.dissect_insert_block(dummy_block).unwrap(); - } - - // Now reload and verify snapshot is used - let (recovered_store, block_id) = - NodeChainStore::new_after_restart(config.clone(), genesis_block).unwrap(); - - assert_eq!(block_id, 1); - assert_eq!(recovered_store.acc_map.len(), 1); - assert!(recovered_store.utxo_commitments_store.get_root().is_some()); - } -} diff --git a/node_core/src/lib.rs b/node_core/src/lib.rs deleted file mode 100644 index f613dbb..0000000 --- a/node_core/src/lib.rs +++ /dev/null @@ -1,1746 +0,0 @@ -use std::sync::{ - atomic::{AtomicU64, Ordering}, - Arc, -}; - -use common::{ - execution_input::PublicNativeTokenSend, transaction::Transaction, ExecutionFailureKind, -}; - -use accounts::{ - account_core::{address::AccountAddress, Account}, - key_management::ephemeral_key_holder::EphemeralKeyHolder, -}; -use anyhow::Result; -use chain_storage::NodeChainStore; -use common::transaction::{TransactionBody, TxKind}; -use config::NodeConfig; -use log::info; -use sc_core::proofs_circuits::{ - generate_commitments, generate_nullifiers, generate_nullifiers_se, pedersen_commitment_vec, -}; -use sequencer_client::{json::SendTxResponse, SequencerClient}; -use serde::{Deserialize, Serialize}; -use storage::sc_db_utils::DataBlobChangeVariant; -use tokio::{sync::RwLock, task::JoinHandle}; -use utxo::utxo_core::UTXO; -use zkvm::{ - gas_calculator::GasCalculator, prove_mint_utxo, prove_mint_utxo_multiple_assets, - prove_send_utxo, prove_send_utxo_deshielded, prove_send_utxo_multiple_assets_one_receiver, - prove_send_utxo_shielded, -}; - -pub const BLOCK_GEN_DELAY_SECS: u64 = 20; - -pub mod chain_storage; -pub mod config; -///Module, which includes pre start setup helperfunctions -pub mod pre_start; -pub mod sequencer_client; - -fn vec_u8_to_vec_u64(bytes: Vec) -> Vec { - // Pad with zeros to make sure it's a multiple of 8 - let mut padded = bytes.clone(); - while !padded.len().is_multiple_of(8) { - padded.push(0); - } - - padded - .chunks(8) - .map(|chunk| { - let mut array = [0u8; 8]; - array.copy_from_slice(chunk); - u64::from_le_bytes(array) - }) - .collect() -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct MintMoneyPublicTx { - pub acc: AccountAddress, - pub amount: u128, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct SendMoneyShieldedTx { - pub acc_sender: AccountAddress, - pub amount: u128, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct SendMoneyDeshieldedTx { - pub receiver_data: Vec<(u128, AccountAddress)>, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct UTXOPublication { - pub utxos: Vec, -} - -#[derive(Debug, Serialize, Deserialize)] -pub enum ActionData { - MintMoneyPublicTx(MintMoneyPublicTx), - SendMoneyShieldedTx(SendMoneyShieldedTx), - SendMoneyDeshieldedTx(SendMoneyDeshieldedTx), - UTXOPublication(UTXOPublication), -} - -pub struct NodeCore { - pub storage: Arc>, - pub curr_height: Arc, - pub node_config: NodeConfig, - pub db_updater_handle: JoinHandle>, - pub sequencer_client: Arc, - pub gas_calculator: GasCalculator, -} - -impl NodeCore { - pub async fn start_from_config_update_chain(config: NodeConfig) -> Result { - let client = Arc::new(SequencerClient::new(config.clone())?); - - let genesis_id = client.get_genesis_id().await?; - info!("Genesis id is {genesis_id:?}"); - - let genesis_block = client.get_block(genesis_id.genesis_id).await?.block; - - let (mut storage, mut chain_height) = NodeChainStore::new(config.clone(), genesis_block)?; - for acc in config.clone().initial_accounts { - storage.acc_map.insert(acc.address, acc); - } - - pre_start::setup_empty_sc_states(&storage).await?; - - //Chain update loop - loop { - let next_block = chain_height + 1; - - if let Ok(block) = client.get_block(next_block).await { - storage.dissect_insert_block(block.block)?; - info!("Preprocessed block with id {next_block:?}"); - } else { - break; - } - - chain_height += 1; - } - - let wrapped_storage = Arc::new(RwLock::new(storage)); - let chain_height_wrapped = Arc::new(AtomicU64::new(chain_height)); - - let wrapped_storage_thread = wrapped_storage.clone(); - let wrapped_chain_height_thread = chain_height_wrapped.clone(); - let client_thread = client.clone(); - - let updater_handle = tokio::spawn(async move { - loop { - let next_block = wrapped_chain_height_thread.load(Ordering::Relaxed) + 1; - - if let Ok(block) = client_thread.get_block(next_block).await { - { - let mut storage_guard = wrapped_storage_thread.write().await; - - let block_insertion_result = - storage_guard.dissect_insert_block(block.block); - - if block_insertion_result.is_err() { - info!("Block insertion failed due to {block_insertion_result:?}"); - - block_insertion_result?; - } - info!("Processed block with id {next_block:?}"); - } - - wrapped_chain_height_thread.store(next_block, Ordering::Relaxed); - } else { - tokio::time::sleep(std::time::Duration::from_secs( - config.seq_poll_timeout_secs, - )) - .await; - } - } - }); - - Ok(Self { - storage: wrapped_storage, - curr_height: chain_height_wrapped, - node_config: config.clone(), - db_updater_handle: updater_handle, - sequencer_client: client.clone(), - gas_calculator: GasCalculator::from(config.gas_config), - }) - } - - pub async fn get_roots(&self) -> [[u8; 32]; 2] { - let storage = self.storage.read().await; - [ - storage.utxo_commitments_store.get_root().unwrap_or([0; 32]), - storage.pub_tx_store.get_root().unwrap_or([0; 32]), - ] - } - - pub async fn create_new_account(&mut self) -> AccountAddress { - let account = Account::new(); - account.log(); - - let addr = account.address; - - { - let mut write_guard = self.storage.write().await; - - write_guard.acc_map.insert(account.address, account); - } - - addr - } - - pub async fn mint_utxo_private( - &self, - acc: AccountAddress, - amount: u128, - ) -> Result<(Transaction, [u8; 32]), ExecutionFailureKind> { - let (utxo, receipt) = prove_mint_utxo(amount, acc)?; - let result_hash = utxo.hash; - - let acc_map_read_guard = self.storage.read().await; - - let account = acc_map_read_guard.acc_map.get(&acc).unwrap(); - - let ephm_key_holder = EphemeralKeyHolder::new_os_random(); - ephm_key_holder.log(); - - let eph_pub_key = - serde_json::to_vec(&ephm_key_holder.generate_ephemeral_public_key()).unwrap(); - - let encoded_data = Account::encrypt_data( - &ephm_key_holder, - account.key_holder.viewing_public_key, - &serde_json::to_vec(&utxo).unwrap(), - ); - - let tag = account.make_tag(); - - let comm = generate_commitments(&[utxo]); - - let mint_utxo_addr_bytes: Vec = zkvm::test_methods::MINT_UTXO_ID - .iter() - .flat_map(|num| num.to_le_bytes()) - .collect(); - let sc_addr = hex::encode(mint_utxo_addr_bytes); - - //Sc does not change its state - let state_changes: Vec = vec![]; - let new_len = 0; - let state_changes = (serde_json::to_value(state_changes).unwrap(), new_len); - - let sc_state = acc_map_read_guard - .block_store - .get_sc_sc_state(&sc_addr) - .map_err(ExecutionFailureKind::db_error)?; - - let mut vec_values_u64: Vec> = sc_state - .into_iter() - .map(|slice| vec_u8_to_vec_u64(slice.to_vec())) - .collect(); - - let context = acc_map_read_guard.produce_context(account.address); - - //Will not panic, as PublicScContext is serializable - let context_public_info: Vec = context.produce_u64_list_from_context().unwrap(); - vec_values_u64.push(context_public_info); - - let vec_public_info: Vec = vec_values_u64.into_iter().flatten().collect(); - - let (tweak, secret_r, commitment) = pedersen_commitment_vec(vec_public_info); - let transaction_body = TransactionBody { - tx_kind: TxKind::Private, - execution_input: vec![], - execution_output: vec![], - utxo_commitments_spent_hashes: vec![], - utxo_commitments_created_hashes: comm - .into_iter() - .map(|hash_data| hash_data.try_into().unwrap()) - .collect(), - nullifier_created_hashes: vec![], - execution_proof_private: sc_core::transaction_payloads_tools::encode_receipt(receipt) - .unwrap(), - encoded_data: vec![(encoded_data.0, encoded_data.1.to_vec(), tag)], - ephemeral_pub_key: eph_pub_key.to_vec(), - commitment, - tweak, - secret_r, - sc_addr, - state_changes, - }; - let key_to_sign_transaction = account.key_holder.get_pub_account_signing_key(); - - Ok(( - Transaction::new(transaction_body, key_to_sign_transaction), - result_hash, - )) - } - - pub async fn mint_utxo_multiple_assets_private( - &self, - acc: AccountAddress, - amount: u128, - number_of_assets: usize, - ) -> Result<(Transaction, Vec<[u8; 32]>), ExecutionFailureKind> { - let (utxos, receipt) = prove_mint_utxo_multiple_assets(amount, number_of_assets, acc)?; - let result_hashes = utxos.iter().map(|utxo| utxo.hash).collect(); - - let acc_map_read_guard = self.storage.read().await; - - let account = acc_map_read_guard.acc_map.get(&acc).unwrap(); - - let ephm_key_holder = EphemeralKeyHolder::new_os_random(); - ephm_key_holder.log(); - - let eph_pub_key = - serde_json::to_vec(&ephm_key_holder.generate_ephemeral_public_key()).unwrap(); - - let encoded_data = utxos - .iter() - .map(|utxo| { - ( - Account::encrypt_data( - &ephm_key_holder, - account.key_holder.viewing_public_key, - &serde_json::to_vec(&utxo).unwrap(), - ), - account.make_tag(), - ) - }) - .map(|((ciphertext, nonce), tag)| (ciphertext, nonce.to_vec(), tag)) - .collect(); - - let comm = generate_commitments(&utxos); - - let mint_multiple_utxo_addr_bytes: Vec = - zkvm::test_methods::MINT_UTXO_MULTIPLE_ASSETS_ID - .iter() - .flat_map(|num| num.to_le_bytes()) - .collect(); - let sc_addr = hex::encode(mint_multiple_utxo_addr_bytes); - - //Sc does not change its state - let state_changes: Vec = vec![]; - let new_len = 0; - let state_changes = (serde_json::to_value(state_changes).unwrap(), new_len); - - let sc_state = acc_map_read_guard - .block_store - .get_sc_sc_state(&sc_addr) - .map_err(ExecutionFailureKind::db_error)?; - - let mut vec_values_u64: Vec> = sc_state - .into_iter() - .map(|slice| vec_u8_to_vec_u64(slice.to_vec())) - .collect(); - - let context = acc_map_read_guard.produce_context(account.address); - - //Will not panic, as PublicScContext is serializable - let context_public_info: Vec = context.produce_u64_list_from_context().unwrap(); - vec_values_u64.push(context_public_info); - - let vec_public_info: Vec = vec_values_u64.into_iter().flatten().collect(); - - let (tweak, secret_r, commitment) = pedersen_commitment_vec(vec_public_info); - - let transaction_body = TransactionBody { - tx_kind: TxKind::Private, - execution_input: vec![], - execution_output: vec![], - utxo_commitments_spent_hashes: vec![], - utxo_commitments_created_hashes: comm - .into_iter() - .map(|hash_data| hash_data.try_into().unwrap()) - .collect(), - nullifier_created_hashes: vec![], - execution_proof_private: sc_core::transaction_payloads_tools::encode_receipt(receipt) - .unwrap(), - encoded_data, - ephemeral_pub_key: eph_pub_key.to_vec(), - commitment, - tweak, - secret_r, - sc_addr, - state_changes, - }; - let key_to_sign_transaction = account.key_holder.get_pub_account_signing_key(); - - Ok(( - Transaction::new(transaction_body, key_to_sign_transaction), - result_hashes, - )) - } - - pub async fn transfer_utxo_private( - &self, - utxo: UTXO, - commitment_in: [u8; 32], - receivers: Vec<(u128, AccountAddress)>, - ) -> Result<(Transaction, Vec<(AccountAddress, [u8; 32])>), ExecutionFailureKind> { - let acc_map_read_guard = self.storage.read().await; - - let account = acc_map_read_guard.acc_map.get(&utxo.owner).unwrap(); - - let nullifier = generate_nullifiers( - &utxo, - &account - .key_holder - .utxo_secret_key_holder - .nullifier_secret_key - .to_bytes(), - ); - - let (resulting_utxos, receipt) = prove_send_utxo(utxo, receivers)?; - let utxo_hashes = resulting_utxos - .iter() - .map(|(utxo, addr)| (*addr, utxo.hash)) - .collect(); - - let utxos: Vec = resulting_utxos - .iter() - .map(|(utxo, _)| utxo.clone()) - .collect(); - - let ephm_key_holder = EphemeralKeyHolder::new_os_random(); - ephm_key_holder.log(); - - let eph_pub_key = - serde_json::to_vec(&ephm_key_holder.generate_ephemeral_public_key()).unwrap(); - - let encoded_data: Vec<(Vec, Vec, u8)> = utxos - .iter() - .map(|utxo_enc| { - let accout_enc = acc_map_read_guard.acc_map.get(&utxo_enc.owner).unwrap(); - - let (ciphertext, nonce) = Account::encrypt_data( - &ephm_key_holder, - accout_enc.key_holder.viewing_public_key, - &serde_json::to_vec(&utxo_enc).unwrap(), - ); - - let tag = accout_enc.make_tag(); - - (ciphertext, nonce.to_vec(), tag) - }) - .collect(); - - let commitments = generate_commitments(&utxos); - - let send_utxo_addr_bytes: Vec = zkvm::test_methods::SEND_UTXO_ID - .iter() - .flat_map(|num| num.to_le_bytes()) - .collect(); - let sc_addr = hex::encode(send_utxo_addr_bytes); - - //Sc does not change its state - let state_changes: Vec = vec![]; - let new_len = 0; - let state_changes = (serde_json::to_value(state_changes).unwrap(), new_len); - - let sc_state = acc_map_read_guard - .block_store - .get_sc_sc_state(&sc_addr) - .map_err(ExecutionFailureKind::db_error)?; - - let mut vec_values_u64: Vec> = sc_state - .into_iter() - .map(|slice| vec_u8_to_vec_u64(slice.to_vec())) - .collect(); - - let context = acc_map_read_guard.produce_context(account.address); - - //Will not panic, as PublicScContext is serializable - let context_public_info: Vec = context.produce_u64_list_from_context().unwrap(); - vec_values_u64.push(context_public_info); - - let vec_public_info: Vec = vec_values_u64.into_iter().flatten().collect(); - - let (tweak, secret_r, commitment) = pedersen_commitment_vec(vec_public_info); - - let transaction_body = TransactionBody { - tx_kind: TxKind::Private, - execution_input: vec![], - execution_output: vec![], - utxo_commitments_spent_hashes: vec![commitment_in], - utxo_commitments_created_hashes: commitments - .into_iter() - .map(|hash_data| hash_data.try_into().unwrap()) - .collect(), - nullifier_created_hashes: vec![nullifier.try_into().unwrap()], - execution_proof_private: sc_core::transaction_payloads_tools::encode_receipt(receipt) - .unwrap(), - encoded_data, - ephemeral_pub_key: eph_pub_key.to_vec(), - commitment, - tweak, - secret_r, - sc_addr, - state_changes, - }; - - let key_to_sign_transaction = account.key_holder.get_pub_account_signing_key(); - - Ok(( - Transaction::new(transaction_body, key_to_sign_transaction), - utxo_hashes, - )) - } - - pub async fn transfer_utxo_multiple_assets_private( - &self, - utxos: Vec, - commitments_in: Vec<[u8; 32]>, - number_to_send: usize, - receiver: AccountAddress, - ) -> Result<(Transaction, Vec<[u8; 32]>, Vec<[u8; 32]>), ExecutionFailureKind> { - let acc_map_read_guard = self.storage.read().await; - - let account = acc_map_read_guard.acc_map.get(&utxos[0].owner).unwrap(); - - let nsk = account - .key_holder - .utxo_secret_key_holder - .nullifier_secret_key - .to_bytes() - .to_vec(); - - let nullifiers = utxos - .iter() - .map(|utxo| generate_nullifiers(utxo, &nsk)) - .map(|vecc| vecc.try_into().unwrap()) - .collect(); - - let (resulting_utxos_receiver, resulting_utxos_not_spent, receipt) = - prove_send_utxo_multiple_assets_one_receiver(utxos, number_to_send, receiver)?; - - let utxo_hashes_receiver = resulting_utxos_receiver - .iter() - .map(|utxo| utxo.hash) - .collect(); - - let utxo_hashes_not_spent = resulting_utxos_not_spent - .iter() - .map(|utxo| utxo.hash) - .collect(); - - let ephm_key_holder = EphemeralKeyHolder::new_os_random(); - ephm_key_holder.log(); - - let eph_pub_key = - serde_json::to_vec(&ephm_key_holder.generate_ephemeral_public_key()).unwrap(); - - let mut encoded_data: Vec<(Vec, Vec, u8)> = resulting_utxos_receiver - .iter() - .map(|utxo_enc| { - let accout_enc = acc_map_read_guard.acc_map.get(&utxo_enc.owner).unwrap(); - - let (ciphertext, nonce) = Account::encrypt_data( - &ephm_key_holder, - accout_enc.key_holder.viewing_public_key, - &serde_json::to_vec(&utxo_enc).unwrap(), - ); - - let tag = accout_enc.make_tag(); - - (ciphertext, nonce.to_vec(), tag) - }) - .collect(); - - let encoded_data_1: Vec<(Vec, Vec, u8)> = resulting_utxos_not_spent - .iter() - .map(|utxo_enc| { - let accout_enc = acc_map_read_guard.acc_map.get(&utxo_enc.owner).unwrap(); - - let (ciphertext, nonce) = Account::encrypt_data( - &ephm_key_holder, - accout_enc.key_holder.viewing_public_key, - &serde_json::to_vec(&utxo_enc).unwrap(), - ); - - let tag = accout_enc.make_tag(); - - (ciphertext, nonce.to_vec(), tag) - }) - .collect(); - - encoded_data.extend(encoded_data_1); - - let mut commitments = generate_commitments(&resulting_utxos_receiver); - let commitments_1 = generate_commitments(&resulting_utxos_not_spent); - - commitments.extend(commitments_1); - - let send_multiple_utxo_addr_bytes: Vec = - zkvm::test_methods::SEND_UTXO_MULTIPLE_ASSETS_ID - .iter() - .flat_map(|num| num.to_le_bytes()) - .collect(); - let sc_addr = hex::encode(send_multiple_utxo_addr_bytes); - - //Sc does not change its state - let state_changes: Vec = vec![]; - let new_len = 0; - let state_changes = (serde_json::to_value(state_changes).unwrap(), new_len); - - let sc_state = acc_map_read_guard - .block_store - .get_sc_sc_state(&sc_addr) - .map_err(ExecutionFailureKind::db_error)?; - - let mut vec_values_u64: Vec> = sc_state - .into_iter() - .map(|slice| vec_u8_to_vec_u64(slice.to_vec())) - .collect(); - - let context = acc_map_read_guard.produce_context(account.address); - - //Will not panic, as PublicScContext is serializable - let context_public_info: Vec = context.produce_u64_list_from_context().unwrap(); - vec_values_u64.push(context_public_info); - - let vec_public_info: Vec = vec_values_u64.into_iter().flatten().collect(); - - let (tweak, secret_r, commitment) = pedersen_commitment_vec(vec_public_info); - - let transaction_body = TransactionBody { - tx_kind: TxKind::Private, - execution_input: vec![], - execution_output: vec![], - utxo_commitments_spent_hashes: commitments_in, - utxo_commitments_created_hashes: commitments - .into_iter() - .map(|hash_data| hash_data.try_into().unwrap()) - .collect(), - nullifier_created_hashes: nullifiers, - execution_proof_private: sc_core::transaction_payloads_tools::encode_receipt(receipt) - .unwrap(), - encoded_data, - ephemeral_pub_key: eph_pub_key.to_vec(), - commitment, - tweak, - secret_r, - sc_addr, - state_changes, - }; - - let key_to_sign_transaction = account.key_holder.get_pub_account_signing_key(); - - Ok(( - Transaction::new(transaction_body, key_to_sign_transaction), - utxo_hashes_receiver, - utxo_hashes_not_spent, - )) - } - - pub async fn transfer_balance_shielded( - &self, - acc: AccountAddress, - balance: u64, - receivers: Vec<(u128, AccountAddress)>, - ) -> Result<(Transaction, Vec<(AccountAddress, [u8; 32])>), ExecutionFailureKind> { - let acc_map_read_guard = self.storage.read().await; - - let account = acc_map_read_guard.acc_map.get(&acc).unwrap(); - - // TODO: add to transaction structure and do the check. Research has to update the scheme as well. - let commitment = sc_core::transaction_payloads_tools::generate_secret_random_commitment( - balance, account, - ) - .unwrap(); - - let nullifier = generate_nullifiers_se( - &commitment, - &account - .key_holder - .utxo_secret_key_holder - .nullifier_secret_key - .to_bytes(), - ); - - let (resulting_utxos, receipt) = prove_send_utxo_shielded(acc, balance as u128, receivers)?; - let utxo_hashes = resulting_utxos - .iter() - .map(|(utxo, addr)| (*addr, utxo.hash)) - .collect(); - - let utxos: Vec = resulting_utxos - .iter() - .map(|(utxo, _)| utxo.clone()) - .collect(); - - let ephm_key_holder = EphemeralKeyHolder::new_os_random(); - ephm_key_holder.log(); - - let eph_pub_key = - serde_json::to_vec(&ephm_key_holder.generate_ephemeral_public_key()).unwrap(); - - let encoded_data: Vec<(Vec, Vec, u8)> = utxos - .iter() - .map(|utxo_enc| { - let accout_enc = acc_map_read_guard.acc_map.get(&utxo_enc.owner).unwrap(); - - let (ciphertext, nonce) = Account::encrypt_data( - &ephm_key_holder, - accout_enc.key_holder.viewing_public_key, - &serde_json::to_vec(&utxo_enc).unwrap(), - ); - - let tag = accout_enc.make_tag(); - - (ciphertext, nonce.to_vec(), tag) - }) - .collect(); - - let commitments = generate_commitments(&utxos); - - let mint_utxo_addr_bytes: Vec = zkvm::test_methods::SEND_UTXO_ID - .iter() - .flat_map(|num| num.to_le_bytes()) - .collect(); - let sc_addr = hex::encode(mint_utxo_addr_bytes); - - //Sc does not change its state - let state_changes: Vec = vec![]; - let new_len = 0; - let state_changes = (serde_json::to_value(state_changes).unwrap(), new_len); - - let sc_state = acc_map_read_guard - .block_store - .get_sc_sc_state(&sc_addr) - .map_err(ExecutionFailureKind::db_error)?; - - let mut vec_values_u64: Vec> = sc_state - .into_iter() - .map(|slice| vec_u8_to_vec_u64(slice.to_vec())) - .collect(); - - let context = acc_map_read_guard.produce_context(account.address); - - //Will not panic, as PublicScContext is serializable - let context_public_info: Vec = context.produce_u64_list_from_context().unwrap(); - vec_values_u64.push(context_public_info); - - let vec_public_info: Vec = vec_values_u64.into_iter().flatten().collect(); - - let (tweak, secret_r, commitment) = pedersen_commitment_vec(vec_public_info); - - let transaction_body = TransactionBody { - tx_kind: TxKind::Shielded, - execution_input: serde_json::to_vec(&ActionData::SendMoneyShieldedTx( - SendMoneyShieldedTx { - acc_sender: acc, - amount: balance as u128, - }, - )) - .unwrap(), - execution_output: vec![], - utxo_commitments_spent_hashes: vec![], - utxo_commitments_created_hashes: commitments - .into_iter() - .map(|hash_data| hash_data.try_into().unwrap()) - .collect(), - nullifier_created_hashes: vec![nullifier.try_into().unwrap()], - execution_proof_private: sc_core::transaction_payloads_tools::encode_receipt(receipt) - .unwrap(), - encoded_data, - ephemeral_pub_key: eph_pub_key.to_vec(), - commitment, - tweak, - secret_r, - sc_addr, - state_changes, - }; - - let key_to_sign_transaction = account.key_holder.get_pub_account_signing_key(); - - Ok(( - Transaction::new(transaction_body, key_to_sign_transaction), - utxo_hashes, - )) - } - - pub async fn transfer_utxo_deshielded( - &self, - utxo: UTXO, - comm_gen_hash: [u8; 32], - receivers: Vec<(u128, AccountAddress)>, - ) -> Result { - let acc_map_read_guard = self.storage.read().await; - - let commitment_in = acc_map_read_guard - .utxo_commitments_store - .get_tx(comm_gen_hash) - .unwrap() - .hash; - - let account = acc_map_read_guard.acc_map.get(&utxo.owner).unwrap(); - - let nullifier = generate_nullifiers( - &utxo, - &account - .key_holder - .utxo_secret_key_holder - .nullifier_secret_key - .to_bytes(), - ); - - let (resulting_balances, receipt) = prove_send_utxo_deshielded(utxo, receivers)?; - - let send_utxo_addr_bytes: Vec = zkvm::test_methods::SEND_UTXO_ID - .iter() - .flat_map(|num| num.to_le_bytes()) - .collect(); - let sc_addr = hex::encode(send_utxo_addr_bytes); - - //Sc does not change its state - let state_changes: Vec = vec![]; - let new_len = 0; - let state_changes = (serde_json::to_value(state_changes).unwrap(), new_len); - - let sc_state = acc_map_read_guard - .block_store - .get_sc_sc_state(&sc_addr) - .map_err(ExecutionFailureKind::db_error)?; - - let mut vec_values_u64: Vec> = sc_state - .into_iter() - .map(|slice| vec_u8_to_vec_u64(slice.to_vec())) - .collect(); - - let context = acc_map_read_guard.produce_context(account.address); - - //Will not panic, as PublicScContext is serializable - let context_public_info: Vec = context.produce_u64_list_from_context().unwrap(); - vec_values_u64.push(context_public_info); - - let vec_public_info: Vec = vec_values_u64.into_iter().flatten().collect(); - - let (tweak, secret_r, commitment) = pedersen_commitment_vec(vec_public_info); - - let transaction_body = TransactionBody { - tx_kind: TxKind::Deshielded, - execution_input: serde_json::to_vec(&ActionData::SendMoneyDeshieldedTx( - SendMoneyDeshieldedTx { - receiver_data: resulting_balances, - }, - )) - .unwrap(), - execution_output: vec![], - utxo_commitments_spent_hashes: vec![commitment_in], - utxo_commitments_created_hashes: vec![], - nullifier_created_hashes: vec![nullifier.try_into().unwrap()], - execution_proof_private: sc_core::transaction_payloads_tools::encode_receipt(receipt) - .unwrap(), - encoded_data: vec![], - ephemeral_pub_key: vec![], - commitment, - tweak, - secret_r, - sc_addr, - state_changes, - }; - - let key_to_sign_transaction = account.key_holder.get_pub_account_signing_key(); - - Ok(Transaction::new(transaction_body, key_to_sign_transaction)) - } - - pub async fn send_private_mint_tx( - &self, - acc: AccountAddress, - amount: u128, - ) -> Result<(SendTxResponse, [u8; 32], [u8; 32]), ExecutionFailureKind> { - //Considering proof time, needs to be done before proof - let tx_roots = self.get_roots().await; - - let point_before_prove = std::time::Instant::now(); - let (tx, utxo_hash) = self.mint_utxo_private(acc, amount).await?; - tx.body().log(); - let point_after_prove = std::time::Instant::now(); - - let commitment_generated_hash = tx.body().utxo_commitments_created_hashes[0]; - - let timedelta = (point_after_prove - point_before_prove).as_millis(); - info!("Mint utxo proof spent {timedelta:?} milliseconds"); - - Ok(( - self.sequencer_client.send_tx(tx, tx_roots).await?, - utxo_hash, - commitment_generated_hash, - )) - } - - pub async fn send_private_mint_multiple_assets_tx( - &self, - acc: AccountAddress, - amount: u128, - number_of_assets: usize, - ) -> Result<(SendTxResponse, Vec<[u8; 32]>, Vec<[u8; 32]>), ExecutionFailureKind> { - //Considering proof time, needs to be done before proof - let tx_roots = self.get_roots().await; - - let point_before_prove = std::time::Instant::now(); - let (tx, utxo_hashes) = self - .mint_utxo_multiple_assets_private(acc, amount, number_of_assets) - .await?; - tx.body().log(); - let point_after_prove = std::time::Instant::now(); - - let commitment_generated_hashes = tx.body().utxo_commitments_created_hashes.clone(); - - let timedelta = (point_after_prove - point_before_prove).as_millis(); - info!("Mint utxo proof spent {timedelta:?} milliseconds"); - - Ok(( - self.sequencer_client.send_tx(tx, tx_roots).await?, - utxo_hashes, - commitment_generated_hashes, - )) - } - - // pub async fn send_public_deposit( - // &self, - // acc: AccountAddress, - // amount: u128, - // ) -> Result { - // //Considering proof time, needs to be done before proof - // let tx_roots = self.get_roots().await; - // - // let public_context = { - // let read_guard = self.storage.read().await; - // - // read_guard.produce_context(acc) - // }; - // - // let (tweak, secret_r, commitment) = pedersen_commitment_vec( - // //Will not panic, as public context is serializable - // public_context.produce_u64_list_from_context().unwrap(), - // ); - // - // let sc_addr = hex::encode([0; 32]); - // - // //Sc does not change its state - // let state_changes: Vec = vec![]; - // let new_len = 0; - // let state_changes = (serde_json::to_value(state_changes).unwrap(), new_len); - // - // let tx: TransactionBody = - // sc_core::transaction_payloads_tools::create_public_transaction_payload( - // serde_json::to_vec(&ActionData::MintMoneyPublicTx(MintMoneyPublicTx { - // acc, - // amount, - // })) - // .unwrap(), - // commitment, - // tweak, - // secret_r, - // sc_addr, - // state_changes, - // ) - // .into(); - // tx.log(); - // - // Ok(self.sequencer_client.send_tx(tx, tx_roots).await?) - // } - - pub async fn send_public_native_token_transfer( - &self, - from: AccountAddress, - nonce: u64, - to: AccountAddress, - balance_to_move: u64, - ) -> Result { - let tx_roots = self.get_roots().await; - - let public_context = { - let read_guard = self.storage.read().await; - - read_guard.produce_context(from) - }; - - let (tweak, secret_r, commitment) = pedersen_commitment_vec( - //Will not panic, as public context is serializable - public_context.produce_u64_list_from_context().unwrap(), - ); - - let sc_addr = hex::encode([0; 32]); - - //Native contract does not change its state - let state_changes: Vec = vec![]; - let new_len = 0; - let state_changes = (serde_json::to_value(state_changes).unwrap(), new_len); - - let tx: TransactionBody = - sc_core::transaction_payloads_tools::create_public_transaction_payload( - serde_json::to_vec(&PublicNativeTokenSend { - from, - nonce, - to, - balance_to_move, - }) - .unwrap(), - commitment, - tweak, - secret_r, - sc_addr, - state_changes, - ); - tx.log(); - - { - let read_guard = self.storage.read().await; - - let account = read_guard.acc_map.get(&from); - - if let Some(account) = account { - let key_to_sign_transaction = account.key_holder.get_pub_account_signing_key(); - - let signed_transaction = Transaction::new(tx, key_to_sign_transaction); - - Ok(self - .sequencer_client - .send_tx(signed_transaction, tx_roots) - .await?) - } else { - Err(ExecutionFailureKind::AmountMismatchError) - } - } - } - - pub async fn send_private_send_tx( - &self, - utxo: UTXO, - comm_hash: [u8; 32], - receivers: Vec<(u128, AccountAddress)>, - ) -> Result<(SendTxResponse, Vec<([u8; 32], [u8; 32])>), ExecutionFailureKind> { - //Considering proof time, needs to be done before proof - let tx_roots = self.get_roots().await; - - let point_before_prove = std::time::Instant::now(); - let (tx, utxo_hashes) = self - .transfer_utxo_private(utxo, comm_hash, receivers) - .await?; - tx.body().log(); - let point_after_prove = std::time::Instant::now(); - - let timedelta = (point_after_prove - point_before_prove).as_millis(); - info!("Send private utxo proof spent {timedelta:?} milliseconds"); - - Ok(( - self.sequencer_client.send_tx(tx, tx_roots).await?, - utxo_hashes, - )) - } - - pub async fn send_private_multiple_assets_send_tx( - &self, - utxos: Vec, - comm_hashes: Vec<[u8; 32]>, - number_to_send: usize, - receiver: AccountAddress, - ) -> Result<(SendTxResponse, Vec<[u8; 32]>, Vec<[u8; 32]>), ExecutionFailureKind> { - //Considering proof time, needs to be done before proof - let tx_roots = self.get_roots().await; - - let point_before_prove = std::time::Instant::now(); - let (tx, utxo_hashes_received, utxo_hashes_not_spent) = self - .transfer_utxo_multiple_assets_private(utxos, comm_hashes, number_to_send, receiver) - .await?; - tx.body().log(); - let point_after_prove = std::time::Instant::now(); - - let timedelta = (point_after_prove - point_before_prove).as_millis(); - info!("Send private utxo proof spent {timedelta:?} milliseconds"); - - Ok(( - self.sequencer_client.send_tx(tx, tx_roots).await?, - utxo_hashes_received, - utxo_hashes_not_spent, - )) - } - - pub async fn send_shielded_send_tx( - &self, - acc: AccountAddress, - amount: u64, - receivers: Vec<(u128, AccountAddress)>, - ) -> Result<(SendTxResponse, Vec<([u8; 32], [u8; 32])>), ExecutionFailureKind> { - //Considering proof time, needs to be done before proof - let tx_roots = self.get_roots().await; - - let point_before_prove = std::time::Instant::now(); - let (tx, utxo_hashes) = self - .transfer_balance_shielded(acc, amount, receivers) - .await?; - tx.body().log(); - let point_after_prove = std::time::Instant::now(); - - let timedelta = (point_after_prove - point_before_prove).as_millis(); - info!("Send balance shielded proof spent {timedelta:?} milliseconds"); - - Ok(( - self.sequencer_client.send_tx(tx, tx_roots).await?, - utxo_hashes, - )) - } - - pub async fn send_deshielded_send_tx( - &self, - utxo: UTXO, - comm_gen_hash: [u8; 32], - receivers: Vec<(u128, AccountAddress)>, - ) -> Result { - //Considering proof time, needs to be done before proof - let tx_roots = self.get_roots().await; - - let point_before_prove = std::time::Instant::now(); - let tx = self - .transfer_utxo_deshielded(utxo, comm_gen_hash, receivers) - .await?; - tx.body().log(); - let point_after_prove = std::time::Instant::now(); - - let timedelta = (point_after_prove - point_before_prove).as_millis(); - info!("Send deshielded utxo proof spent {timedelta:?} milliseconds"); - - Ok(self.sequencer_client.send_tx(tx, tx_roots).await?) - } - - pub async fn operate_account_mint_private( - &mut self, - acc_addr: AccountAddress, - amount: u128, - ) -> Result<(UTXO, [u8; 32]), ExecutionFailureKind> { - let (resp, new_utxo_hash, comm_gen_hash) = - self.send_private_mint_tx(acc_addr, amount).await?; - info!("Response for mint private is {resp:?}"); - - info!("Awaiting new blocks"); - tokio::time::sleep(std::time::Duration::from_secs(BLOCK_GEN_DELAY_SECS)).await; - - let new_utxo = { - let mut write_guard = self.storage.write().await; - - let acc = write_guard.acc_map.get_mut(&acc_addr).unwrap(); - - acc.utxos.get(&new_utxo_hash).unwrap().clone() - }; - - new_utxo.log(); - info!( - "Account address is {:?} ,new utxo owner address is {:?}", - hex::encode(acc_addr), - hex::encode(new_utxo.owner) - ); - info!( - "Account {:?} got new utxo with amount {amount:?}", - hex::encode(acc_addr) - ); - - Ok((new_utxo, comm_gen_hash)) - } - - pub async fn operate_account_mint_multiple_assets_private( - &mut self, - acc_addr: AccountAddress, - amount: u128, - number_of_assets: usize, - ) -> Result<(Vec, Vec<[u8; 32]>), ExecutionFailureKind> { - let (resp, new_utxo_hashes, comm_gen_hashes) = self - .send_private_mint_multiple_assets_tx(acc_addr, amount, number_of_assets) - .await?; - info!("Response for mint multiple assets private is {resp:?}"); - - info!("Awaiting new blocks"); - tokio::time::sleep(std::time::Duration::from_secs(BLOCK_GEN_DELAY_SECS)).await; - - let new_utxos = { - let mut write_guard = self.storage.write().await; - - new_utxo_hashes - .into_iter() - .map(|new_utxo_hash| { - let acc = write_guard.acc_map.get_mut(&acc_addr).unwrap(); - - let new_utxo = acc.utxos.get(&new_utxo_hash).unwrap().clone(); - - new_utxo.log(); - info!( - "Account address is {:?} ,new utxo owner address is {:?}", - hex::encode(acc_addr), - hex::encode(new_utxo.owner) - ); - info!( - "Account {:?} got new utxo with amount {amount:?} and asset {:?}", - hex::encode(acc_addr), - new_utxo.asset - ); - - new_utxo - }) - .collect() - }; - - Ok((new_utxos, comm_gen_hashes)) - } - - pub async fn operate_account_send_deshielded_one_receiver( - &mut self, - acc_addr_rec: AccountAddress, - utxo: UTXO, - comm_gen_hash: [u8; 32], - ) -> Result<(), ExecutionFailureKind> { - let amount = utxo.amount; - - let old_balance = { - let acc_map_read_guard = self.storage.read().await; - - let acc = acc_map_read_guard.acc_map.get(&acc_addr_rec).unwrap(); - - acc.balance - }; - - info!( - "Balance of receiver {:?} now is {old_balance:?}", - hex::encode(acc_addr_rec) - ); - - let resp = self - .send_deshielded_send_tx(utxo, comm_gen_hash, vec![(amount, acc_addr_rec)]) - .await?; - info!("Response for send deshielded is {resp:?}"); - - info!("Awaiting new blocks"); - tokio::time::sleep(std::time::Duration::from_secs(BLOCK_GEN_DELAY_SECS)).await; - - let new_balance = { - let acc_map_read_guard = self.storage.read().await; - - let acc = acc_map_read_guard.acc_map.get(&acc_addr_rec).unwrap(); - - acc.balance - }; - - info!( - "Balance of receiver {:?} now is {:?}, delta is {:?}", - hex::encode(acc_addr_rec), - new_balance, - new_balance - old_balance - ); - - Ok(()) - } - - // pub async fn operate_account_deposit_public( - // &mut self, - // acc_addr: AccountAddress, - // amount: u128, - // ) -> Result<(), ExecutionFailureKind> { - // let old_balance = { - // let acc_map_read_guard = self.storage.read().await; - // - // let acc = acc_map_read_guard.acc_map.get(&acc_addr).unwrap(); - // - // acc.balance - // }; - // - // info!( - // "Balance of {:?} now is {old_balance:?}", - // hex::encode(acc_addr) - // ); - // - // let resp = self.send_public_deposit(acc_addr, amount).await?; - // info!("Response for public deposit is {resp:?}"); - // - // info!("Awaiting new blocks"); - // tokio::time::sleep(std::time::Duration::from_secs(BLOCK_GEN_DELAY_SECS)).await; - // - // let new_balance = { - // let acc_map_read_guard = self.storage.read().await; - // - // let acc = acc_map_read_guard.acc_map.get(&acc_addr).unwrap(); - // - // acc.balance - // }; - // - // info!( - // "Balance of {:?} now is {new_balance:?}, delta is {:?}", - // hex::encode(acc_addr), - // new_balance - old_balance - // ); - // - // Ok(()) - // } - - pub async fn operate_account_send_shielded_one_receiver( - &mut self, - acc_addr_sender: AccountAddress, - acc_addr_rec: AccountAddress, - amount: u128, - ) -> Result { - let (resp, new_utxo_hashes) = self - .send_shielded_send_tx(acc_addr_sender, amount as u64, vec![(amount, acc_addr_rec)]) - .await?; - info!("Response for send shielded is {resp:?}"); - - let new_utxo_hash = new_utxo_hashes[0].1; - - info!("Awaiting new blocks"); - tokio::time::sleep(std::time::Duration::from_secs(BLOCK_GEN_DELAY_SECS)).await; - - let new_utxo = { - let mut write_guard = self.storage.write().await; - - let acc = write_guard.acc_map.get_mut(&acc_addr_rec).unwrap(); - acc.log(); - - acc.utxos.get(&new_utxo_hash).unwrap().clone() - }; - new_utxo.log(); - info!( - "Account address is {:?} ,new utxo owner address is {:?}", - hex::encode(acc_addr_rec), - hex::encode(new_utxo.owner) - ); - info!( - "Account {:?} got new utxo with amount {amount:?}", - hex::encode(acc_addr_rec) - ); - - Ok(new_utxo) - } - - pub async fn operate_account_send_private_one_receiver( - &mut self, - acc_addr_rec: AccountAddress, - utxo: UTXO, - comm_gen_hash: [u8; 32], - ) -> Result { - let amount = utxo.amount; - - let (resp, new_utxo_hashes) = self - .send_private_send_tx(utxo, comm_gen_hash, vec![(amount, acc_addr_rec)]) - .await?; - info!("Response for send private is {resp:?}"); - - let new_utxo_hash = new_utxo_hashes[0].1; - - info!("Awaiting new blocks"); - tokio::time::sleep(std::time::Duration::from_secs(BLOCK_GEN_DELAY_SECS)).await; - - let new_utxo = { - let mut write_guard = self.storage.write().await; - - let acc = write_guard.acc_map.get_mut(&acc_addr_rec).unwrap(); - acc.log(); - - acc.utxos.get(&new_utxo_hash).unwrap().clone() - }; - new_utxo.log(); - info!( - "Account address is {:?} ,new utxo owner address is {:?}", - hex::encode(acc_addr_rec), - hex::encode(new_utxo.owner) - ); - info!( - "Account {:?} got new utxo with amount {:?}", - hex::encode(acc_addr_rec), - new_utxo.amount - ); - - Ok(new_utxo) - } - - pub async fn operate_account_send_private_multiple_assets_one_receiver( - &mut self, - acc_addr: AccountAddress, - acc_addr_rec: AccountAddress, - utxos: Vec, - comm_gen_hashes: Vec<[u8; 32]>, - number_to_send: usize, - ) -> Result<(), ExecutionFailureKind> { - let (resp, new_utxo_hashes_rec, new_utxo_hashes_not_sp) = self - .send_private_multiple_assets_send_tx( - utxos, - comm_gen_hashes, - number_to_send, - acc_addr_rec, - ) - .await?; - info!("Response for send private multiple assets is {resp:?}"); - - info!("Awaiting new blocks"); - tokio::time::sleep(std::time::Duration::from_secs(BLOCK_GEN_DELAY_SECS)).await; - - { - let mut write_guard = self.storage.write().await; - - for new_utxo_hash in new_utxo_hashes_rec { - let acc = write_guard.acc_map.get_mut(&acc_addr_rec).unwrap(); - acc.log(); - - let new_utxo = acc.utxos.get(&new_utxo_hash).unwrap().clone(); - - new_utxo.log(); - info!( - "Account address is {:?} ,new utxo owner address is {:?}", - hex::encode(acc_addr_rec), - hex::encode(new_utxo.owner) - ); - info!( - "Account {:?} got new utxo with amount {:?} and asset {:?}", - hex::encode(acc_addr_rec), - new_utxo.amount, - new_utxo.asset, - ); - } - - for new_utxo_hash in new_utxo_hashes_not_sp { - let acc = write_guard.acc_map.get_mut(&acc_addr).unwrap(); - acc.log(); - - let new_utxo = acc.utxos.get(&new_utxo_hash).unwrap().clone(); - - new_utxo.log(); - info!( - "Account address is {:?} ,new utxo owner address is {:?}", - hex::encode(acc_addr), - hex::encode(new_utxo.owner) - ); - info!( - "Account {:?} got new utxo with amount {:?} and asset {:?}", - hex::encode(acc_addr), - new_utxo.amount, - new_utxo.asset, - ); - } - } - - Ok(()) - } - - pub async fn split_utxo( - &self, - utxo: UTXO, - commitment_in: [u8; 32], - receivers: Vec<(u128, AccountAddress)>, - visibility_list: [bool; 3], - ) -> Result<(Transaction, Vec<(AccountAddress, [u8; 32])>), ExecutionFailureKind> { - let acc_map_read_guard = self.storage.read().await; - - let account = acc_map_read_guard.acc_map.get(&utxo.owner).unwrap(); - - let nullifier = generate_nullifiers( - &utxo, - &account - .key_holder - .utxo_secret_key_holder - .nullifier_secret_key - .to_bytes(), - ); - - let (resulting_utxos, receipt) = prove_send_utxo(utxo, receivers)?; - let utxo_hashes = resulting_utxos - .iter() - .map(|(utxo, addr)| (*addr, utxo.hash)) - .collect(); - - let utxos: Vec = resulting_utxos - .iter() - .map(|(utxo, _)| utxo.clone()) - .collect(); - - let ephm_key_holder = EphemeralKeyHolder::new_os_random(); - ephm_key_holder.log(); - - let eph_pub_key = - serde_json::to_vec(&ephm_key_holder.generate_ephemeral_public_key()).unwrap(); - - let encoded_data: Vec<(Vec, Vec, u8)> = utxos - .iter() - .map(|utxo_enc| { - let accout_enc = acc_map_read_guard.acc_map.get(&utxo_enc.owner).unwrap(); - - let (ciphertext, nonce) = Account::encrypt_data( - &ephm_key_holder, - accout_enc.key_holder.viewing_public_key, - &serde_json::to_vec(&utxo_enc).unwrap(), - ); - - let tag = accout_enc.make_tag(); - - (ciphertext, nonce.to_vec(), tag) - }) - .collect(); - - let commitments = generate_commitments(&utxos); - - let publication = ActionData::UTXOPublication(UTXOPublication { - utxos: utxos - .iter() - .enumerate() - .filter_map(|(id, item)| { - if visibility_list[id] { - Some(item.clone()) - } else { - None - } - }) - .collect(), - }); - - let send_utxo_addr_bytes: Vec = zkvm::test_methods::SEND_UTXO_ID - .iter() - .flat_map(|num| num.to_le_bytes()) - .collect(); - let sc_addr = hex::encode(send_utxo_addr_bytes); - - //Sc does not change its state - let state_changes: Vec = vec![]; - let new_len = 0; - let state_changes = (serde_json::to_value(state_changes).unwrap(), new_len); - - let sc_state = acc_map_read_guard - .block_store - .get_sc_sc_state(&sc_addr) - .map_err(ExecutionFailureKind::db_error)?; - - let mut vec_values_u64: Vec> = sc_state - .into_iter() - .map(|slice| vec_u8_to_vec_u64(slice.to_vec())) - .collect(); - - let context = acc_map_read_guard.produce_context(account.address); - - //Will not panic, as PublicScContext is serializable - let context_public_info: Vec = context.produce_u64_list_from_context().unwrap(); - vec_values_u64.push(context_public_info); - - let vec_public_info: Vec = vec_values_u64.into_iter().flatten().collect(); - - let (tweak, secret_r, commitment) = pedersen_commitment_vec(vec_public_info); - - let transaction_body = TransactionBody { - tx_kind: TxKind::Shielded, - execution_input: vec![], - execution_output: serde_json::to_vec(&publication).unwrap(), - utxo_commitments_spent_hashes: vec![commitment_in], - utxo_commitments_created_hashes: commitments - .clone() - .into_iter() - .map(|hash_data| hash_data.try_into().unwrap()) - .collect(), - nullifier_created_hashes: vec![nullifier.try_into().unwrap()], - execution_proof_private: sc_core::transaction_payloads_tools::encode_receipt(receipt) - .unwrap(), - encoded_data, - ephemeral_pub_key: eph_pub_key.to_vec(), - commitment, - tweak, - secret_r, - sc_addr, - state_changes, - }; - let key_to_sign_transaction = account.key_holder.get_pub_account_signing_key(); - - Ok(( - Transaction::new(transaction_body, key_to_sign_transaction), - utxo_hashes, - )) - } - - pub async fn send_split_tx( - &self, - utxo: UTXO, - comm_hash: [u8; 32], - receivers: Vec<(u128, AccountAddress)>, - visibility_list: [bool; 3], - ) -> Result<(SendTxResponse, Vec<([u8; 32], [u8; 32])>, Vec<[u8; 32]>), ExecutionFailureKind> - { - //Considering proof time, needs to be done before proof - let tx_roots = self.get_roots().await; - - let point_before_prove = std::time::Instant::now(); - let (tx, utxo_hashes) = self - .split_utxo(utxo, comm_hash, receivers, visibility_list) - .await?; - tx.body().log(); - let point_after_prove = std::time::Instant::now(); - - let timedelta = (point_after_prove - point_before_prove).as_millis(); - info!("Send private utxo proof spent {timedelta:?} milliseconds"); - - let commitments = tx.body().utxo_commitments_created_hashes.clone(); - - Ok(( - self.sequencer_client.send_tx(tx, tx_roots).await?, - utxo_hashes, - commitments, - )) - } - - pub async fn operate_account_send_split_utxo( - &mut self, - addrs_receivers: [AccountAddress; 3], - utxo: UTXO, - comm_gen_hash: [u8; 32], - visibility_list: [bool; 3], - ) -> Result<(Vec, Vec<[u8; 32]>), ExecutionFailureKind> { - let (resp, new_utxo_hashes, commitments_hashes) = self - .send_split_tx( - utxo.clone(), - comm_gen_hash, - addrs_receivers.map(|addr| (utxo.amount / 3, addr)).to_vec(), - visibility_list, - ) - .await?; - info!("Response for send shielded is {resp:?}"); - - info!("Awaiting new blocks"); - tokio::time::sleep(std::time::Duration::from_secs(BLOCK_GEN_DELAY_SECS)).await; - - let new_utxos: Vec = { - let mut write_guard = self.storage.write().await; - - new_utxo_hashes - .into_iter() - .map(|(acc_addr_rec, new_utxo_hash)| { - let acc = write_guard.acc_map.get_mut(&acc_addr_rec).unwrap(); - - let new_utxo = acc.utxos.get(&new_utxo_hash).unwrap().clone(); - new_utxo.log(); - - info!( - "Account address is {:?} ,new utxo owner address is {:?}", - hex::encode(acc_addr_rec), - hex::encode(new_utxo.owner) - ); - info!( - "Account {:?} got new utxo with amount {:?}", - hex::encode(acc_addr_rec), - new_utxo.amount - ); - - new_utxo - }) - .collect() - }; - - Ok((new_utxos, commitments_hashes)) - } - - ///Mint utxo, make it public - pub async fn subscenario_1(&mut self) -> Result<(), ExecutionFailureKind> { - let acc_addr = self.create_new_account().await; - - let (new_utxo, comm_gen_hash) = self.operate_account_mint_private(acc_addr, 100).await?; - - self.operate_account_send_deshielded_one_receiver(acc_addr, new_utxo, comm_gen_hash) - .await?; - - Ok(()) - } - - ///Mint utxo, privately send it to another user - pub async fn subscenario_2(&mut self) -> Result<(), ExecutionFailureKind> { - let acc_addr = self.create_new_account().await; - let acc_addr_rec = self.create_new_account().await; - - let (new_utxo, comm_gen_hash) = self.operate_account_mint_private(acc_addr, 100).await?; - - self.operate_account_send_private_one_receiver(acc_addr_rec, new_utxo, comm_gen_hash) - .await?; - - Ok(()) - } - - ///Mint utxo, deshielded send it to another user - pub async fn subscenario_3(&mut self) -> Result<(), ExecutionFailureKind> { - let acc_addr = self.create_new_account().await; - let acc_addr_rec = self.create_new_account().await; - - let (new_utxo, comm_gen_hash) = self.operate_account_mint_private(acc_addr, 100).await?; - - self.operate_account_send_deshielded_one_receiver(acc_addr_rec, new_utxo, comm_gen_hash) - .await?; - - Ok(()) - } - - ///First complex scenario. - /// Creating accounts A, B, C, D. - /// Minting UTXO for A, splitting it between B, C, D. - /// Variable `visibility_list` decides, which of actions will be visible on blockchain. - /// Variable `publication index` decides, who of B, C or D moves its UTXO into public state. - pub async fn scenario_1( - &mut self, - visibility_list: [bool; 3], - publication_index: usize, - ) -> Result<(), ExecutionFailureKind> { - let acc_addr_sender = self.create_new_account().await; - - let acc_addr_rec_1 = self.create_new_account().await; - let acc_addr_rec_2 = self.create_new_account().await; - let acc_addr_rec_3 = self.create_new_account().await; - - let addrs_receivers = [acc_addr_rec_1, acc_addr_rec_2, acc_addr_rec_3]; - - let (new_utxo, comm_gen_hash) = self - .operate_account_mint_private(acc_addr_sender, 99) - .await?; - - let (new_utxos, comm_gen_hashes) = self - .operate_account_send_split_utxo( - addrs_receivers, - new_utxo, - comm_gen_hash, - visibility_list, - ) - .await?; - - self.operate_account_send_deshielded_one_receiver( - addrs_receivers[publication_index], - new_utxos[publication_index].clone(), - comm_gen_hashes[publication_index], - ) - .await?; - - Ok(()) - } - - ///Mint number of different assets with same amount for account - pub async fn scenario_2( - &mut self, - number_of_assets: usize, - number_to_send: usize, - ) -> Result<(), ExecutionFailureKind> { - let acc_addr_sender = self.create_new_account().await; - let acc_addr_receiver = self.create_new_account().await; - - let (utxos, comm_gen_hashes) = self - .operate_account_mint_multiple_assets_private(acc_addr_sender, 100, number_of_assets) - .await?; - - self.operate_account_send_private_multiple_assets_one_receiver( - acc_addr_sender, - acc_addr_receiver, - utxos, - comm_gen_hashes, - number_to_send, - ) - .await?; - - Ok(()) - } -} - -pub fn generate_commitments_helper(input_utxos: &[UTXO]) -> Vec<[u8; 32]> { - generate_commitments(input_utxos) - .into_iter() - .map(|comm_raw| comm_raw.try_into().unwrap()) - .collect() -} diff --git a/node_core/src/pre_start.rs b/node_core/src/pre_start.rs deleted file mode 100644 index e79dafc..0000000 --- a/node_core/src/pre_start.rs +++ /dev/null @@ -1,71 +0,0 @@ -use anyhow::Result; -use log::info; - -use crate::chain_storage::NodeChainStore; - -///Addres of public fund transfer account, as no such binary exists for zkVM -pub const PUBLIC_DEPOSIT_ID: [u8; 32] = [0; 32]; - -///Setups public states of default smart conracts as empty -pub async fn setup_empty_sc_states(node: &NodeChainStore) -> Result<()> { - info!("Filling up public states of default smart contracts"); - - let empty_state = vec![]; - - let public_deposit_addr = hex::encode(PUBLIC_DEPOSIT_ID); - node.block_store.put_sc_sc_state( - &public_deposit_addr, - empty_state.len(), - empty_state.clone(), - )?; - info!("Public transfer state set"); - - let mint_utxo_addr_bytes: Vec = zkvm::test_methods::MINT_UTXO_ID - .iter() - .flat_map(|num| num.to_le_bytes()) - .collect(); - let mint_utxo_addr = hex::encode(mint_utxo_addr_bytes); - node.block_store - .put_sc_sc_state(&mint_utxo_addr, empty_state.len(), empty_state.clone())?; - info!("Mint UTXO state set"); - - let single_utxo_transfer_addr_bytes: Vec = zkvm::test_methods::SEND_UTXO_ID - .iter() - .flat_map(|num| num.to_le_bytes()) - .collect(); - let single_utxo_transfer_addr = hex::encode(single_utxo_transfer_addr_bytes); - node.block_store.put_sc_sc_state( - &single_utxo_transfer_addr, - empty_state.len(), - empty_state.clone(), - )?; - info!("Single UTXO transfer state set"); - - let mint_utxo_multiple_assets_addr_bytes: Vec = - zkvm::test_methods::MINT_UTXO_MULTIPLE_ASSETS_ID - .iter() - .flat_map(|num| num.to_le_bytes()) - .collect(); - let mint_utxo_multiple_assets_addr = hex::encode(mint_utxo_multiple_assets_addr_bytes); - node.block_store.put_sc_sc_state( - &mint_utxo_multiple_assets_addr, - empty_state.len(), - empty_state.clone(), - )?; - info!("Mint UTXO multiple assets state set"); - - let multiple_assets_utxo_transfer_addr_bytes: Vec = - zkvm::test_methods::SEND_UTXO_MULTIPLE_ASSETS_ID - .iter() - .flat_map(|num| num.to_le_bytes()) - .collect(); - let multiple_assets_utxo_transfer_addr = hex::encode(multiple_assets_utxo_transfer_addr_bytes); - node.block_store.put_sc_sc_state( - &multiple_assets_utxo_transfer_addr, - empty_state.len(), - empty_state.clone(), - )?; - info!("Multiple_assets UTXO transfer state set"); - - Ok(()) -} diff --git a/node_rpc/Cargo.toml b/node_rpc/Cargo.toml deleted file mode 100644 index 25c5365..0000000 --- a/node_rpc/Cargo.toml +++ /dev/null @@ -1,45 +0,0 @@ -[package] -name = "node_rpc" -version = "0.1.0" -edition = "2021" - -[dependencies] -anyhow.workspace = true -serde_json.workspace = true -env_logger.workspace = true -log.workspace = true -serde.workspace = true -actix.workspace = true -actix-cors.workspace = true -futures.workspace = true -tokio.workspace = true -hex.workspace = true - -actix-web.workspace = true - -[dependencies.accounts] -path = "../accounts" - -[dependencies.consensus] -path = "../consensus" - -[dependencies.networking] -path = "../networking" - -[dependencies.storage] -path = "../storage" - -[dependencies.utxo] -path = "../utxo" - -[dependencies.vm] -path = "../vm" - -[dependencies.zkvm] -path = "../zkvm" - -[dependencies.node_core] -path = "../node_core" - -[dependencies.common] -path = "../common" diff --git a/node_rpc/src/lib.rs b/node_rpc/src/lib.rs deleted file mode 100644 index e4475fc..0000000 --- a/node_rpc/src/lib.rs +++ /dev/null @@ -1,45 +0,0 @@ -pub mod net_utils; -pub mod process; -pub mod types; - -use std::sync::Arc; - -use common::rpc_primitives::{ - errors::{RpcError, RpcErrorKind}, - RpcPollingConfig, -}; -use node_core::{config::NodeConfig, NodeCore}; -use serde::Serialize; -use serde_json::Value; - -pub use net_utils::*; -use tokio::sync::Mutex; - -use self::types::err_rpc::RpcErr; - -//ToDo: Add necessary fields -pub struct JsonHandler { - pub polling_config: RpcPollingConfig, - pub node_core_config: NodeConfig, - pub node_chain_store: Arc>, -} - -fn respond(val: T) -> Result { - Ok(serde_json::to_value(val)?) -} - -pub fn rpc_error_responce_inverter(err: RpcError) -> RpcError { - let mut content: Option = None; - if err.error_struct.is_some() { - content = match err.error_struct.clone().unwrap() { - RpcErrorKind::HandlerError(val) | RpcErrorKind::InternalError(val) => Some(val), - RpcErrorKind::RequestValidationError(vall) => Some(serde_json::to_value(vall).unwrap()), - }; - } - RpcError { - error_struct: None, - code: err.code, - message: err.message, - data: content, - } -} diff --git a/node_rpc/src/net_utils.rs b/node_rpc/src/net_utils.rs deleted file mode 100644 index 215106c..0000000 --- a/node_rpc/src/net_utils.rs +++ /dev/null @@ -1,76 +0,0 @@ -use std::io; -use std::sync::Arc; - -use actix_cors::Cors; -use actix_web::{http, middleware, web, App, Error as HttpError, HttpResponse, HttpServer}; -use futures::Future; -use futures::FutureExt; -use log::info; - -use common::rpc_primitives::message::Message; -use common::rpc_primitives::RpcConfig; -use node_core::config::NodeConfig; -use node_core::NodeCore; -use tokio::sync::Mutex; - -use super::JsonHandler; - -pub const SHUTDOWN_TIMEOUT_SECS: u64 = 10; - -fn rpc_handler( - message: web::Json, - handler: web::Data, -) -> impl Future> { - let response = async move { - let message = handler.process(message.0).await?; - Ok(HttpResponse::Ok().json(&message)) - }; - response.boxed() -} - -fn get_cors(cors_allowed_origins: &[String]) -> Cors { - let mut cors = Cors::permissive(); - if cors_allowed_origins != ["*".to_string()] { - for origin in cors_allowed_origins { - cors = cors.allowed_origin(origin); - } - } - cors.allowed_methods(vec!["GET", "POST"]) - .allowed_headers(vec![http::header::AUTHORIZATION, http::header::ACCEPT]) - .allowed_header(http::header::CONTENT_TYPE) - .max_age(3600) -} - -#[allow(clippy::too_many_arguments)] -pub fn new_http_server( - config: RpcConfig, - node_config: NodeConfig, - node_chain_store: Arc>, -) -> io::Result { - let RpcConfig { - addr, - cors_allowed_origins, - polling_config, - limits_config, - } = config; - info!(target:"network", "Starting http server at {addr}"); - let handler = web::Data::new(JsonHandler { - polling_config, - node_core_config: node_config, - node_chain_store, - }); - - // HTTP server - Ok(HttpServer::new(move || { - App::new() - .wrap(get_cors(&cors_allowed_origins)) - .app_data(handler.clone()) - .app_data(web::JsonConfig::default().limit(limits_config.json_payload_max_size)) - .wrap(middleware::Logger::default()) - .service(web::resource("/").route(web::post().to(rpc_handler))) - }) - .bind(addr)? - .shutdown_timeout(SHUTDOWN_TIMEOUT_SECS) - .disable_signals() - .run()) -} diff --git a/node_rpc/src/process.rs b/node_rpc/src/process.rs deleted file mode 100644 index 29ac787..0000000 --- a/node_rpc/src/process.rs +++ /dev/null @@ -1,755 +0,0 @@ -use std::sync::atomic::Ordering; - -use actix_web::Error as HttpError; -use node_core::generate_commitments_helper; -use serde_json::Value; - -use common::rpc_primitives::{ - errors::RpcError, - message::{Message, Request}, - parser::RpcRequest, -}; -use common::transaction::ActionData; - -use common::rpc_primitives::requests::{ - GetBlockDataRequest, GetBlockDataResponse, GetLastBlockRequest, GetLastBlockResponse, -}; - -use crate::types::{ - err_rpc::cast_common_execution_error_into_rpc_error, - rpc_structs::{ - CreateAccountRequest, CreateAccountResponse, ExecuteScenarioMultipleSendRequest, - ExecuteScenarioMultipleSendResponse, ExecuteScenarioSplitRequest, - ExecuteScenarioSplitResponse, ExecuteSubscenarioRequest, ExecuteSubscenarioResponse, - ShowAccountPublicBalanceRequest, ShowAccountPublicBalanceResponse, ShowAccountUTXORequest, - ShowAccountUTXOResponse, ShowTransactionRequest, ShowTransactionResponse, - UTXOShortEssentialStruct, WriteMintPrivateUTXOMultipleAssetsRequest, - WriteMintPrivateUTXOMultipleAssetsResponse, WriteMintPrivateUTXORequest, - WriteMintPrivateUTXOResponse, WriteSendDeshieldedBalanceRequest, - WriteSendDeshieldedUTXOResponse, WriteSendPrivateUTXORequest, WriteSendPrivateUTXOResponse, - WriteSendShieldedUTXORequest, WriteSendShieldedUTXOResponse, WriteSendSplitUTXOResponse, - WriteSplitUTXORequest, - }, -}; - -pub const CREATE_ACCOUNT: &str = "create_account"; -pub const EXECUTE_SUBSCENARIO: &str = "execute_subscenario"; -pub const GET_BLOCK: &str = "get_block"; -pub const GET_LAST_BLOCK: &str = "get_last_block"; -pub const EXECUTE_SCENARIO_SPLIT: &str = "execute_scenario_split"; -pub const EXECUTE_SCENARIO_MULTIPLE_SEND: &str = "execute_scenario_multiple_send"; -pub const SHOW_ACCOUNT_PUBLIC_BALANCE: &str = "show_account_public_balance"; -pub const SHOW_ACCOUNT_UTXO: &str = "show_account_utxo"; -pub const SHOW_TRANSACTION: &str = "show_transaction"; -pub const WRITE_MINT_UTXO: &str = "write_mint_utxo"; -pub const WRITE_MINT_UTXO_MULTIPLE_ASSETS: &str = "write_mint_utxo_multiple_assets"; -pub const WRITE_SEND_UTXO_PRIVATE: &str = "write_send_utxo_private"; -pub const WRITE_SEND_UTXO_SHIELDED: &str = "write_send_utxo_shielded"; -pub const WRITE_SEND_UTXO_DESHIELDED: &str = "write_send_utxo_deshielded"; -pub const WRITE_SPLIT_UTXO: &str = "write_split_utxo"; - -pub const SUCCESS: &str = "success"; - -pub const ACCOUNT_NOT_FOUND: &str = "Account not found"; -pub const TRANSACTION_NOT_FOUND: &str = "Transaction not found"; - -use super::{respond, types::err_rpc::RpcErr, JsonHandler}; - -impl JsonHandler { - pub async fn process(&self, message: Message) -> Result { - let id = message.id(); - if let Message::Request(request) = message { - let message_inner = self - .process_request_internal(request) - .await - .map_err(|e| e.0); - Ok(Message::response(id, message_inner)) - } else { - Ok(Message::error(RpcError::parse_error( - "JSON RPC Request format was expected".to_owned(), - ))) - } - } - - async fn process_request_execute_subscenario(&self, request: Request) -> Result { - let req = ExecuteSubscenarioRequest::parse(Some(request.params))?; - - { - let mut store = self.node_chain_store.lock().await; - - match req.scenario_id { - 1 => store - .subscenario_1() - .await - .map_err(cast_common_execution_error_into_rpc_error)?, - 2 => store - .subscenario_2() - .await - .map_err(cast_common_execution_error_into_rpc_error)?, - 3 => store - .subscenario_3() - .await - .map_err(cast_common_execution_error_into_rpc_error)?, - _ => return Err(RpcErr(RpcError::invalid_params("Scenario id not found"))), - } - } - - let helperstruct = ExecuteSubscenarioResponse { - scenario_result: SUCCESS.to_string(), - }; - - respond(helperstruct) - } - - async fn process_request_execute_scenario_split( - &self, - request: Request, - ) -> Result { - let req = ExecuteScenarioSplitRequest::parse(Some(request.params))?; - - { - let mut store = self.node_chain_store.lock().await; - - store - .scenario_1(req.visibility_list, req.publication_index) - .await - .map_err(cast_common_execution_error_into_rpc_error)?; - } - - let helperstruct = ExecuteScenarioSplitResponse { - scenario_result: SUCCESS.to_string(), - }; - - respond(helperstruct) - } - - async fn process_request_execute_scenario_multiple_send( - &self, - request: Request, - ) -> Result { - let req = ExecuteScenarioMultipleSendRequest::parse(Some(request.params))?; - - { - let mut store = self.node_chain_store.lock().await; - - store - .scenario_2(req.number_of_assets, req.number_to_send) - .await - .map_err(cast_common_execution_error_into_rpc_error)?; - } - - let helperstruct = ExecuteScenarioMultipleSendResponse { - scenario_result: SUCCESS.to_string(), - }; - - respond(helperstruct) - } - - async fn process_create_account(&self, request: Request) -> Result { - let _req = CreateAccountRequest::parse(Some(request.params))?; - - let acc_addr = { - let mut guard = self.node_chain_store.lock().await; - - guard.create_new_account().await - }; - - let helperstruct = CreateAccountResponse { - status: hex::encode(acc_addr), - }; - - respond(helperstruct) - } - - async fn process_get_block_data(&self, request: Request) -> Result { - let req = GetBlockDataRequest::parse(Some(request.params))?; - - let block = { - let guard = self.node_chain_store.lock().await; - - { - let read_guard = guard.storage.read().await; - - read_guard.block_store.get_block_at_id(req.block_id)? - } - }; - - let helperstruct = GetBlockDataResponse { block }; - - respond(helperstruct) - } - - async fn process_get_last_block(&self, request: Request) -> Result { - let _req = GetLastBlockRequest::parse(Some(request.params))?; - - let last_block = { - let guard = self.node_chain_store.lock().await; - - guard.curr_height.load(Ordering::Relaxed) - }; - - let helperstruct = GetLastBlockResponse { last_block }; - - respond(helperstruct) - } - - async fn process_show_account_public_balance(&self, request: Request) -> Result { - let req = ShowAccountPublicBalanceRequest::parse(Some(request.params))?; - - let acc_addr_hex_dec = hex::decode(req.account_addr.clone()).map_err(|_| { - RpcError::parse_error("Failed to decode account address from hex string".to_string()) - })?; - - let acc_addr: [u8; 32] = acc_addr_hex_dec.try_into().map_err(|_| { - RpcError::parse_error("Failed to parse account address from bytes".to_string()) - })?; - - let balance = { - let cover_guard = self.node_chain_store.lock().await; - - { - let under_guard = cover_guard.storage.read().await; - - let acc = under_guard - .acc_map - .get(&acc_addr) - .ok_or(RpcError::new_internal_error(None, ACCOUNT_NOT_FOUND))?; - - acc.balance - } - }; - - let helperstruct = ShowAccountPublicBalanceResponse { - addr: req.account_addr, - balance, - }; - - respond(helperstruct) - } - - async fn process_show_account_utxo_request(&self, request: Request) -> Result { - let req = ShowAccountUTXORequest::parse(Some(request.params))?; - - let acc_addr_hex_dec = hex::decode(req.account_addr.clone()).map_err(|_| { - RpcError::parse_error("Failed to decode account address from hex string".to_string()) - })?; - - let acc_addr: [u8; 32] = acc_addr_hex_dec.try_into().map_err(|_| { - RpcError::parse_error("Failed to parse account address from bytes".to_string()) - })?; - - let utxo_hash_hex_dec = hex::decode(req.utxo_hash.clone()).map_err(|_| { - RpcError::parse_error("Failed to decode hash from hex string".to_string()) - })?; - - let utxo_hash: [u8; 32] = utxo_hash_hex_dec - .try_into() - .map_err(|_| RpcError::parse_error("Failed to parse hash from bytes".to_string()))?; - - let (asset, amount) = { - let cover_guard = self.node_chain_store.lock().await; - - { - let mut under_guard = cover_guard.storage.write().await; - - let acc = under_guard - .acc_map - .get_mut(&acc_addr) - .ok_or(RpcError::new_internal_error(None, ACCOUNT_NOT_FOUND))?; - - let utxo = acc - .utxos - .get(&utxo_hash) - .ok_or(RpcError::new_internal_error( - None, - "UTXO does not exist in the tree", - ))?; - - (utxo.asset.clone(), utxo.amount) - } - }; - - let helperstruct = ShowAccountUTXOResponse { - hash: req.utxo_hash, - asset, - amount, - }; - - respond(helperstruct) - } - - async fn process_show_transaction(&self, request: Request) -> Result { - let req = ShowTransactionRequest::parse(Some(request.params))?; - - let tx_hash_hex_dec = hex::decode(req.tx_hash.clone()).map_err(|_| { - RpcError::parse_error("Failed to decode hash from hex string".to_string()) - })?; - - let tx_hash: [u8; 32] = tx_hash_hex_dec - .try_into() - .map_err(|_| RpcError::parse_error("Failed to parse hash from bytes".to_string()))?; - - let helperstruct = { - let cover_guard = self.node_chain_store.lock().await; - - { - let under_guard = cover_guard.storage.read().await; - - let tx = under_guard - .pub_tx_store - .get_tx(tx_hash) - .ok_or(RpcError::new_internal_error(None, TRANSACTION_NOT_FOUND))?; - - ShowTransactionResponse { - hash: req.tx_hash, - tx_kind: tx.body().tx_kind, - public_input: if let Ok(action) = - serde_json::from_slice::(&tx.body().execution_input) - { - action.into_hexed_print() - } else { - "".to_string() - }, - public_output: if let Ok(action) = - serde_json::from_slice::(&tx.body().execution_output) - { - action.into_hexed_print() - } else { - "".to_string() - }, - utxo_commitments_created_hashes: tx - .body() - .utxo_commitments_created_hashes - .iter() - .map(hex::encode) - .collect::>(), - utxo_commitments_spent_hashes: tx - .body() - .utxo_commitments_spent_hashes - .iter() - .map(hex::encode) - .collect::>(), - utxo_nullifiers_created_hashes: tx - .body() - .nullifier_created_hashes - .iter() - .map(hex::encode) - .collect::>(), - encoded_data: tx - .body() - .encoded_data - .iter() - .map(|val| (hex::encode(val.0.clone()), hex::encode(val.1.clone()))) - .collect::>(), - ephemeral_pub_key: hex::encode(tx.body().ephemeral_pub_key.clone()), - } - } - }; - - respond(helperstruct) - } - - pub async fn process_write_mint_utxo(&self, request: Request) -> Result { - let req = WriteMintPrivateUTXORequest::parse(Some(request.params))?; - - let acc_addr_hex_dec = hex::decode(req.account_addr.clone()).map_err(|_| { - RpcError::parse_error("Failed to decode account address from hex string".to_string()) - })?; - - let acc_addr: [u8; 32] = acc_addr_hex_dec.try_into().map_err(|_| { - RpcError::parse_error("Failed to parse account address from bytes".to_string()) - })?; - - let (utxo, commitment_hash) = { - let mut cover_guard = self.node_chain_store.lock().await; - - cover_guard - .operate_account_mint_private(acc_addr, req.amount as u128) - .await - .map_err(cast_common_execution_error_into_rpc_error)? - }; - - let helperstruct = WriteMintPrivateUTXOResponse { - status: SUCCESS.to_string(), - utxo: UTXOShortEssentialStruct { - hash: hex::encode(utxo.hash), - commitment_hash: hex::encode(commitment_hash), - asset: utxo.asset, - }, - }; - - respond(helperstruct) - } - - pub async fn process_write_mint_utxo_multiple_assets( - &self, - request: Request, - ) -> Result { - let req = WriteMintPrivateUTXOMultipleAssetsRequest::parse(Some(request.params))?; - - let acc_addr_hex_dec = hex::decode(req.account_addr.clone()).map_err(|_| { - RpcError::parse_error("Failed to decode account address from hex string".to_string()) - })?; - - let acc_addr: [u8; 32] = acc_addr_hex_dec.try_into().map_err(|_| { - RpcError::parse_error("Failed to parse account address from bytes".to_string()) - })?; - - let (utxos, commitment_hashes) = { - let mut cover_guard = self.node_chain_store.lock().await; - - cover_guard - .operate_account_mint_multiple_assets_private( - acc_addr, - req.amount as u128, - req.num_of_assets, - ) - .await - .map_err(cast_common_execution_error_into_rpc_error)? - }; - - let helperstruct = WriteMintPrivateUTXOMultipleAssetsResponse { - status: SUCCESS.to_string(), - utxos: utxos - .into_iter() - .zip(commitment_hashes) - .map(|(utxo, comm_hash)| UTXOShortEssentialStruct { - hash: hex::encode(utxo.hash), - commitment_hash: hex::encode(comm_hash), - asset: utxo.asset, - }) - .collect(), - }; - - respond(helperstruct) - } - - pub async fn process_write_send_private_utxo(&self, request: Request) -> Result { - let req = WriteSendPrivateUTXORequest::parse(Some(request.params))?; - - let acc_addr_hex_dec_sender = - hex::decode(req.account_addr_sender.clone()).map_err(|_| { - RpcError::parse_error( - "Failed to decode account address from hex string".to_string(), - ) - })?; - - let acc_addr_sender: [u8; 32] = acc_addr_hex_dec_sender.try_into().map_err(|_| { - RpcError::parse_error("Failed to parse account address from bytes".to_string()) - })?; - - let acc_addr_hex_dec = hex::decode(req.account_addr_receiver.clone()).map_err(|_| { - RpcError::parse_error("Failed to decode account address from hex string".to_string()) - })?; - - let acc_addr: [u8; 32] = acc_addr_hex_dec.try_into().map_err(|_| { - RpcError::parse_error("Failed to parse account address from bytes".to_string()) - })?; - - let utxo_hash_hex_dec = hex::decode(req.utxo_hash.clone()).map_err(|_| { - RpcError::parse_error("Failed to decode utxo hash from hex string".to_string()) - })?; - - let utxo_hash: [u8; 32] = utxo_hash_hex_dec.try_into().map_err(|_| { - RpcError::parse_error("Failed to parse utxo hash from bytes".to_string()) - })?; - - let comm_hash_hex_dec = hex::decode(req.utxo_commitment.clone()).map_err(|_| { - RpcError::parse_error("Failed to decode commitment hash from hex string".to_string()) - })?; - - let comm_hash: [u8; 32] = comm_hash_hex_dec.try_into().map_err(|_| { - RpcError::parse_error("Failed to parse commitment hash from bytes".to_string()) - })?; - - let new_utxo_rec = { - let mut cover_guard = self.node_chain_store.lock().await; - - let utxo_to_send = { - let mut under_guard = cover_guard.storage.write().await; - - let acc = under_guard - .acc_map - .get_mut(&acc_addr_sender) - .ok_or(RpcError::new_internal_error(None, ACCOUNT_NOT_FOUND))?; - - acc.utxos - .get(&utxo_hash) - .ok_or(RpcError::new_internal_error( - None, - "UTXO does not exist in tree", - ))? - .clone() - }; - - cover_guard - .operate_account_send_private_one_receiver(acc_addr, utxo_to_send, comm_hash) - .await - .map_err(cast_common_execution_error_into_rpc_error)? - }; - - let helperstruct = WriteSendPrivateUTXOResponse { - status: SUCCESS.to_string(), - utxo_result: UTXOShortEssentialStruct { - hash: hex::encode(new_utxo_rec.hash), - asset: new_utxo_rec.asset.clone(), - commitment_hash: hex::encode(generate_commitments_helper(&[new_utxo_rec])[0]), - }, - }; - - respond(helperstruct) - } - - pub async fn process_write_send_shielded_utxo( - &self, - request: Request, - ) -> Result { - let req = WriteSendShieldedUTXORequest::parse(Some(request.params))?; - - let acc_addr_hex_dec_sender = - hex::decode(req.account_addr_sender.clone()).map_err(|_| { - RpcError::parse_error( - "Failed to decode account address sender from hex string".to_string(), - ) - })?; - - let acc_addr_sender: [u8; 32] = acc_addr_hex_dec_sender.try_into().map_err(|_| { - RpcError::parse_error("Failed to parse account address sender from bytes".to_string()) - })?; - - let acc_addr_hex_dec_rec = - hex::decode(req.account_addr_receiver.clone()).map_err(|_| { - RpcError::parse_error( - "Failed to decode account address receiver from hex string".to_string(), - ) - })?; - - let acc_addr_rec: [u8; 32] = acc_addr_hex_dec_rec.try_into().map_err(|_| { - RpcError::parse_error("Failed to parse account address receiver from bytes".to_string()) - })?; - - let new_utxo_rec = { - let mut cover_guard = self.node_chain_store.lock().await; - - cover_guard - .operate_account_send_shielded_one_receiver( - acc_addr_sender, - acc_addr_rec, - req.amount as u128, - ) - .await - .map_err(cast_common_execution_error_into_rpc_error)? - }; - - let helperstruct = WriteSendShieldedUTXOResponse { - status: SUCCESS.to_string(), - utxo_result: UTXOShortEssentialStruct { - hash: hex::encode(new_utxo_rec.hash), - asset: new_utxo_rec.asset.clone(), - commitment_hash: hex::encode(generate_commitments_helper(&[new_utxo_rec])[0]), - }, - }; - - respond(helperstruct) - } - - pub async fn process_write_send_deshielded_utxo( - &self, - request: Request, - ) -> Result { - let req = WriteSendDeshieldedBalanceRequest::parse(Some(request.params))?; - - let acc_addr_hex_dec_sender = - hex::decode(req.account_addr_sender.clone()).map_err(|_| { - RpcError::parse_error( - "Failed to decode account address from hex string".to_string(), - ) - })?; - - let acc_addr_sender: [u8; 32] = acc_addr_hex_dec_sender.try_into().map_err(|_| { - RpcError::parse_error("Failed to parse account address from bytes".to_string()) - })?; - - let acc_addr_hex_dec = hex::decode(req.account_addr_receiver.clone()).map_err(|_| { - RpcError::parse_error("Failed to decode account address from hex string".to_string()) - })?; - - let acc_addr: [u8; 32] = acc_addr_hex_dec.try_into().map_err(|_| { - RpcError::parse_error("Failed to parse account address from bytes".to_string()) - })?; - - let utxo_hash_hex_dec = hex::decode(req.utxo_hash.clone()).map_err(|_| { - RpcError::parse_error("Failed to decode utxo hash from hex string".to_string()) - })?; - - let utxo_hash: [u8; 32] = utxo_hash_hex_dec.try_into().map_err(|_| { - RpcError::parse_error("Failed to parse utxo hash from bytes".to_string()) - })?; - - let comm_hash_hex_dec = hex::decode(req.utxo_commitment.clone()).map_err(|_| { - RpcError::parse_error("Failed to decode commitment hash from hex string".to_string()) - })?; - - let comm_hash: [u8; 32] = comm_hash_hex_dec.try_into().map_err(|_| { - RpcError::parse_error("Failed to parse commitment hash from bytes".to_string()) - })?; - - { - let mut cover_guard = self.node_chain_store.lock().await; - - let utxo_to_send = { - let mut under_guard = cover_guard.storage.write().await; - - let acc = under_guard - .acc_map - .get_mut(&acc_addr_sender) - .ok_or(RpcError::new_internal_error(None, ACCOUNT_NOT_FOUND))?; - - acc.utxos - .get(&utxo_hash) - .ok_or(RpcError::new_internal_error( - None, - "UTXO does not exist in tree", - ))? - .clone() - }; - - cover_guard - .operate_account_send_deshielded_one_receiver(acc_addr, utxo_to_send, comm_hash) - .await - .map_err(cast_common_execution_error_into_rpc_error)? - }; - - let helperstruct = WriteSendDeshieldedUTXOResponse { - status: SUCCESS.to_string(), - }; - - respond(helperstruct) - } - - pub async fn process_write_send_split_utxo(&self, request: Request) -> Result { - let req = WriteSplitUTXORequest::parse(Some(request.params))?; - - let acc_addr_hex_dec_sender = - hex::decode(req.account_addr_sender.clone()).map_err(|_| { - RpcError::parse_error( - "Failed to decode account address from hex string".to_string(), - ) - })?; - - let acc_addr_sender: [u8; 32] = acc_addr_hex_dec_sender.try_into().map_err(|_| { - RpcError::parse_error("Failed to parse account address from bytes".to_string()) - })?; - - let acc_addresses = { - let mut res_addrs = vec![]; - - for item in req.account_addr_receivers { - let hex_dec_item = hex::decode(item).map_err(|_| { - RpcError::parse_error( - "Failed to decode account address from hex string".to_string(), - ) - })?; - - let dec_item = hex_dec_item.try_into().map_err(|_| { - RpcError::parse_error( - "Failed to decode account address from hex string".to_string(), - ) - })?; - - res_addrs.push(dec_item); - } - - res_addrs.try_into().unwrap() - }; - - let utxo_hash_hex_dec = hex::decode(req.utxo_hash.clone()).map_err(|_| { - RpcError::parse_error("Failed to decode utxo hash from hex string".to_string()) - })?; - - let utxo_hash: [u8; 32] = utxo_hash_hex_dec.try_into().map_err(|_| { - RpcError::parse_error("Failed to parse utxo hash from bytes".to_string()) - })?; - - let comm_hash_hex_dec = hex::decode(req.utxo_commitment.clone()).map_err(|_| { - RpcError::parse_error("Failed to decode commitment hash from hex string".to_string()) - })?; - - let comm_hash: [u8; 32] = comm_hash_hex_dec.try_into().map_err(|_| { - RpcError::parse_error("Failed to parse commitment hash from bytes".to_string()) - })?; - - let (new_utxos, commitment_hashes) = { - let mut cover_guard = self.node_chain_store.lock().await; - - let utxo_to_send = { - let mut under_guard = cover_guard.storage.write().await; - - let acc = under_guard - .acc_map - .get_mut(&acc_addr_sender) - .ok_or(RpcError::new_internal_error(None, ACCOUNT_NOT_FOUND))?; - - acc.utxos - .get(&utxo_hash) - .ok_or(RpcError::new_internal_error( - None, - "UTXO does not exist in tree", - ))? - .clone() - }; - - cover_guard - .operate_account_send_split_utxo( - acc_addresses, - utxo_to_send, - comm_hash, - req.visibility_list, - ) - .await - .map_err(cast_common_execution_error_into_rpc_error)? - }; - - let helperstruct = WriteSendSplitUTXOResponse { - status: SUCCESS.to_string(), - utxo_results: new_utxos - .into_iter() - .zip(commitment_hashes) - .map(|(utxo, comm_hash)| UTXOShortEssentialStruct { - hash: hex::encode(utxo.hash), - commitment_hash: hex::encode(comm_hash), - asset: utxo.asset, - }) - .collect(), - }; - - respond(helperstruct) - } - - pub async fn process_request_internal(&self, request: Request) -> Result { - match request.method.as_ref() { - //Todo : Add handling of more JSON RPC methods - CREATE_ACCOUNT => self.process_create_account(request).await, - EXECUTE_SUBSCENARIO => self.process_request_execute_subscenario(request).await, - GET_BLOCK => self.process_get_block_data(request).await, - GET_LAST_BLOCK => self.process_get_last_block(request).await, - EXECUTE_SCENARIO_SPLIT => self.process_request_execute_scenario_split(request).await, - EXECUTE_SCENARIO_MULTIPLE_SEND => { - self.process_request_execute_scenario_multiple_send(request) - .await - } - SHOW_ACCOUNT_PUBLIC_BALANCE => self.process_show_account_public_balance(request).await, - SHOW_ACCOUNT_UTXO => self.process_show_account_utxo_request(request).await, - SHOW_TRANSACTION => self.process_show_transaction(request).await, - WRITE_MINT_UTXO => self.process_write_mint_utxo(request).await, - WRITE_MINT_UTXO_MULTIPLE_ASSETS => { - self.process_write_mint_utxo_multiple_assets(request).await - } - WRITE_SEND_UTXO_PRIVATE => self.process_write_send_private_utxo(request).await, - WRITE_SEND_UTXO_SHIELDED => self.process_write_send_shielded_utxo(request).await, - WRITE_SEND_UTXO_DESHIELDED => self.process_write_send_deshielded_utxo(request).await, - WRITE_SPLIT_UTXO => self.process_write_send_split_utxo(request).await, - _ => Err(RpcErr(RpcError::method_not_found(request.method))), - } - } -} diff --git a/node_rpc/src/types/err_rpc.rs b/node_rpc/src/types/err_rpc.rs deleted file mode 100644 index 0e75f7a..0000000 --- a/node_rpc/src/types/err_rpc.rs +++ /dev/null @@ -1,85 +0,0 @@ -use common::{ExecutionFailureKind, SequencerClientError}; -use log::debug; - -use common::rpc_primitives::errors::{RpcError, RpcParseError}; - -pub struct RpcErr(pub RpcError); - -pub type RpcErrInternal = anyhow::Error; - -pub trait RpcErrKind: 'static { - fn into_rpc_err(self) -> RpcError; -} - -impl From for RpcErr { - fn from(e: T) -> Self { - Self(e.into_rpc_err()) - } -} - -macro_rules! standard_rpc_err_kind { - ($type_name:path) => { - impl RpcErrKind for $type_name { - fn into_rpc_err(self) -> RpcError { - self.into() - } - } - }; -} -standard_rpc_err_kind!(RpcError); -standard_rpc_err_kind!(RpcParseError); - -impl RpcErrKind for serde_json::Error { - fn into_rpc_err(self) -> RpcError { - RpcError::serialization_error(&self.to_string()) - } -} - -impl RpcErrKind for RpcErrInternal { - fn into_rpc_err(self) -> RpcError { - RpcError::new_internal_error(None, &format!("{self:#?}")) - } -} - -#[allow(clippy::needless_pass_by_value)] -pub fn from_rpc_err_into_anyhow_err(rpc_err: RpcError) -> anyhow::Error { - debug!("Rpc error cast to anyhow error : err {rpc_err:?}"); - anyhow::anyhow!(format!("{rpc_err:#?}")) -} - -pub fn cast_seq_client_error_into_rpc_error(seq_cli_err: SequencerClientError) -> RpcError { - let error_string = seq_cli_err.to_string(); - - match seq_cli_err { - SequencerClientError::SerdeError(_) => RpcError::serialization_error(&error_string), - SequencerClientError::HTTPError(_) => RpcError::new_internal_error(None, &error_string), - SequencerClientError::InternalError(err) => RpcError::new_internal_error( - err.error.data, - &serde_json::to_string(&err.error.error_struct).unwrap_or(String::default()), - ), - } -} - -pub fn cast_common_execution_error_into_rpc_error(comm_exec_err: ExecutionFailureKind) -> RpcError { - let error_string = comm_exec_err.to_string(); - - match comm_exec_err { - ExecutionFailureKind::BuilderError(_) => RpcError::new_internal_error(None, &error_string), - ExecutionFailureKind::WriteError(_) => RpcError::new_internal_error(None, &error_string), - ExecutionFailureKind::DBError(_) => RpcError::new_internal_error(None, &error_string), - ExecutionFailureKind::DecodeError(_) => RpcError::new_internal_error(None, &error_string), - ExecutionFailureKind::ProveError(_) => RpcError::new_internal_error(None, &error_string), - ExecutionFailureKind::AmountMismatchError => { - RpcError::new_internal_error(None, &error_string) - } - ExecutionFailureKind::InsufficientGasError => { - RpcError::new_internal_error(None, &error_string) - } - ExecutionFailureKind::InsufficientFundsError => { - RpcError::new_internal_error(None, &error_string) - } - ExecutionFailureKind::SequencerClientError(seq_cli_err) => { - cast_seq_client_error_into_rpc_error(seq_cli_err) - } - } -} diff --git a/node_rpc/src/types/mod.rs b/node_rpc/src/types/mod.rs deleted file mode 100644 index 4901b7f..0000000 --- a/node_rpc/src/types/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod err_rpc; -pub mod rpc_structs; diff --git a/node_rpc/src/types/rpc_structs.rs b/node_rpc/src/types/rpc_structs.rs deleted file mode 100644 index 3ae8694..0000000 --- a/node_rpc/src/types/rpc_structs.rs +++ /dev/null @@ -1,206 +0,0 @@ -use common::parse_request; -use common::rpc_primitives::errors::RpcParseError; -use common::rpc_primitives::parser::parse_params; -use common::rpc_primitives::parser::RpcRequest; -use common::transaction::TxKind; -use serde::{Deserialize, Serialize}; -use serde_json::Value; - -#[derive(Serialize, Deserialize, Debug)] -pub struct ExecuteSubscenarioRequest { - pub scenario_id: u64, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct ExecuteScenarioSplitRequest { - pub visibility_list: [bool; 3], - pub publication_index: usize, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct ExecuteScenarioMultipleSendRequest { - pub number_of_assets: usize, - pub number_to_send: usize, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct ShowAccountPublicBalanceRequest { - pub account_addr: String, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct ShowAccountUTXORequest { - pub account_addr: String, - pub utxo_hash: String, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct ShowTransactionRequest { - pub tx_hash: String, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct WriteDepositPublicBalanceRequest { - pub account_addr: String, - pub amount: u64, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct WriteMintPrivateUTXORequest { - pub account_addr: String, - pub amount: u64, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct WriteMintPrivateUTXOMultipleAssetsRequest { - pub account_addr: String, - pub num_of_assets: usize, - pub amount: u64, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct WriteSendPrivateUTXORequest { - pub account_addr_sender: String, - pub account_addr_receiver: String, - pub utxo_hash: String, - pub utxo_commitment: String, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct WriteSendShieldedUTXORequest { - pub account_addr_sender: String, - pub account_addr_receiver: String, - pub amount: u64, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct WriteSendDeshieldedBalanceRequest { - pub account_addr_sender: String, - pub account_addr_receiver: String, - pub utxo_hash: String, - pub utxo_commitment: String, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct WriteSplitUTXORequest { - pub account_addr_sender: String, - pub account_addr_receivers: [String; 3], - pub visibility_list: [bool; 3], - pub utxo_hash: String, - pub utxo_commitment: String, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct CreateAccountRequest {} - -// parse_request!(GetGenesisIdRequest); -parse_request!(ExecuteSubscenarioRequest); -parse_request!(ExecuteScenarioSplitRequest); -parse_request!(ExecuteScenarioMultipleSendRequest); -// parse_request!(GetLastBlockRequest); - -parse_request!(ShowAccountPublicBalanceRequest); -parse_request!(ShowAccountUTXORequest); -parse_request!(ShowTransactionRequest); - -parse_request!(WriteDepositPublicBalanceRequest); -parse_request!(WriteMintPrivateUTXORequest); -parse_request!(WriteMintPrivateUTXOMultipleAssetsRequest); -parse_request!(WriteSendPrivateUTXORequest); -parse_request!(WriteSendShieldedUTXORequest); -parse_request!(WriteSendDeshieldedBalanceRequest); -parse_request!(WriteSplitUTXORequest); -parse_request!(CreateAccountRequest); - -#[derive(Serialize, Deserialize, Debug)] -pub struct ExecuteSubscenarioResponse { - pub scenario_result: String, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct ExecuteScenarioSplitResponse { - pub scenario_result: String, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct ExecuteScenarioMultipleSendResponse { - pub scenario_result: String, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct ShowAccountPublicBalanceResponse { - pub addr: String, - pub balance: u64, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct ShowAccountUTXOResponse { - pub hash: String, - pub asset: Vec, - pub amount: u128, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct ShowTransactionResponse { - pub hash: String, - pub tx_kind: TxKind, - pub public_input: String, - pub public_output: String, - pub utxo_commitments_created_hashes: Vec, - pub utxo_commitments_spent_hashes: Vec, - pub utxo_nullifiers_created_hashes: Vec, - pub encoded_data: Vec<(String, String)>, - pub ephemeral_pub_key: String, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct WriteDepositPublicBalanceResponse { - pub status: String, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct UTXOShortEssentialStruct { - pub hash: String, - pub commitment_hash: String, - pub asset: Vec, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct WriteMintPrivateUTXOResponse { - pub status: String, - pub utxo: UTXOShortEssentialStruct, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct WriteMintPrivateUTXOMultipleAssetsResponse { - pub status: String, - pub utxos: Vec, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct WriteSendPrivateUTXOResponse { - pub status: String, - pub utxo_result: UTXOShortEssentialStruct, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct WriteSendShieldedUTXOResponse { - pub status: String, - pub utxo_result: UTXOShortEssentialStruct, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct WriteSendDeshieldedUTXOResponse { - pub status: String, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct WriteSendSplitUTXOResponse { - pub status: String, - pub utxo_results: Vec, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct CreateAccountResponse { - pub status: String, -} diff --git a/node_runner/Cargo.toml b/node_runner/Cargo.toml deleted file mode 100644 index d63c39a..0000000 --- a/node_runner/Cargo.toml +++ /dev/null @@ -1,50 +0,0 @@ -[package] -name = "node_runner" -version = "0.1.0" -edition = "2021" - -[dependencies] -hex.workspace = true -anyhow.workspace = true -serde_json.workspace = true -env_logger.workspace = true -log.workspace = true -serde.workspace = true -actix.workspace = true - -actix-web.workspace = true -tokio.workspace = true - -[dependencies.clap] -features = ["derive", "env"] -workspace = true - -[dependencies.accounts] -path = "../accounts" - -[dependencies.consensus] -path = "../consensus" - -[dependencies.networking] -path = "../networking" - -[dependencies.storage] -path = "../storage" - -[dependencies.utxo] -path = "../utxo" - -[dependencies.vm] -path = "../vm" - -[dependencies.zkvm] -path = "../zkvm" - -[dependencies.node_rpc] -path = "../node_rpc" - -[dependencies.node_core] -path = "../node_core" - -[dependencies.common] -path = "../common" diff --git a/node_runner/configs/debug/node_config.json b/node_runner/configs/debug/node_config.json deleted file mode 100644 index 6c39f15..0000000 --- a/node_runner/configs/debug/node_config.json +++ /dev/null @@ -1,253 +0,0 @@ -{ - "home": ".", - "override_rust_log": null, - "sequencer_addr": "http://127.0.0.1:3040", - "seq_poll_timeout_secs": 10, - "port": 3041, - "gas_config": { - "gas_fee_per_byte_deploy": 100, - "gas_fee_per_input_buffer_runtime": 1000, - "gas_fee_per_byte_runtime": 10, - "gas_cost_runtime": 100, - "gas_cost_deploy": 1000, - "gas_limit_deploy": 30000000, - "gas_limit_runtime": 30000000 - }, - "shapshot_frequency_in_blocks": 10, - "initial_accounts": [ - { - "address": [ - 13, - 150, - 223, - 204, - 65, - 64, - 25, - 56, - 12, - 157, - 222, - 12, - 211, - 220, - 229, - 170, - 201, - 15, - 181, - 68, - 59, - 248, - 113, - 16, - 135, - 65, - 174, - 175, - 222, - 85, - 42, - 215 - ], - "balance": 10000, - "key_holder": { - "address": [ - 13, - 150, - 223, - 204, - 65, - 64, - 25, - 56, - 12, - 157, - 222, - 12, - 211, - 220, - 229, - 170, - 201, - 15, - 181, - 68, - 59, - 248, - 113, - 16, - 135, - 65, - 174, - 175, - 222, - 85, - 42, - 215 - ], - "nullifer_public_key": "03A340BECA9FAAB444CED0140681D72EA1318B5C611704FEE017DA9836B17DB718", - "pub_account_signing_key": [ - 133, - 143, - 177, - 187, - 252, - 66, - 237, - 236, - 234, - 252, - 244, - 138, - 5, - 151, - 3, - 99, - 217, - 231, - 112, - 217, - 77, - 211, - 58, - 218, - 176, - 68, - 99, - 53, - 152, - 228, - 198, - 190 - ], - "top_secret_key_holder": { - "secret_spending_key": "7BC46784DB1BC67825D8F029436846712BFDF9B5D79EA3AB11D39A52B9B229D4" - }, - "utxo_secret_key_holder": { - "nullifier_secret_key": "BB54A8D3C9C51B82C431082D1845A74677B0EF829A11B517E1D9885DE3139506", - "viewing_secret_key": "AD923E92F6A5683E30140CEAB2702AFB665330C1EE4EFA70FAF29767B6B52BAF" - }, - "viewing_public_key": "0361220C5D277E7A1709340FD31A52600C1432B9C45B9BCF88A43581D58824A8B6" - }, - "utxos": {} - }, - { - "address": [ - 151, - 72, - 112, - 233, - 190, - 141, - 10, - 192, - 138, - 168, - 59, - 63, - 199, - 167, - 166, - 134, - 41, - 29, - 135, - 50, - 80, - 138, - 186, - 152, - 179, - 96, - 128, - 243, - 156, - 44, - 243, - 100 - ], - "balance": 20000, - "key_holder": { - "address": [ - 151, - 72, - 112, - 233, - 190, - 141, - 10, - 192, - 138, - 168, - 59, - 63, - 199, - 167, - 166, - 134, - 41, - 29, - 135, - 50, - 80, - 138, - 186, - 152, - 179, - 96, - 128, - 243, - 156, - 44, - 243, - 100 - ], - "nullifer_public_key": "02172F50274DE67C4087C344F5D58E11DF761D90285B095060E0994FAA6BCDE271", - "pub_account_signing_key": [ - 54, - 90, - 62, - 225, - 71, - 225, - 228, - 148, - 143, - 53, - 210, - 23, - 137, - 158, - 171, - 156, - 48, - 7, - 139, - 52, - 117, - 242, - 214, - 7, - 99, - 29, - 122, - 184, - 59, - 116, - 144, - 107 - ], - "top_secret_key_holder": { - "secret_spending_key": "80A186737C8D38B4288A03F0F589957D9C040D79C19F3E0CC4BA80F8494E5179" - }, - "utxo_secret_key_holder": { - "nullifier_secret_key": "746928E63F0984F6F4818933493CE9C067562D9CB932FDC06D82C86CDF6D7122", - "viewing_secret_key": "89176CF4BC9E673807643FD52110EF99D4894335AFB10D881AC0B5041FE1FCB7" - }, - "viewing_public_key": "026072A8F83FEC3472E30CDD4767683F30B91661D25B1040AD9A5FC2E01D659F99" - }, - "utxos": {} - } - ] -} \ No newline at end of file diff --git a/node_runner/src/config.rs b/node_runner/src/config.rs deleted file mode 100644 index 988b0f2..0000000 --- a/node_runner/src/config.rs +++ /dev/null @@ -1,14 +0,0 @@ -use std::path::PathBuf; - -use anyhow::Result; -use node_core::config::NodeConfig; - -use std::fs::File; -use std::io::BufReader; - -pub fn from_file(config_home: PathBuf) -> Result { - let file = File::open(config_home)?; - let reader = BufReader::new(file); - - Ok(serde_json::from_reader(reader)?) -} diff --git a/node_runner/src/lib.rs b/node_runner/src/lib.rs deleted file mode 100644 index cbede4e..0000000 --- a/node_runner/src/lib.rs +++ /dev/null @@ -1,56 +0,0 @@ -use std::{path::PathBuf, sync::Arc}; - -use anyhow::Result; -use clap::Parser; -use common::rpc_primitives::RpcConfig; -use consensus::ConsensusManager; -use log::info; -use networking::peer_manager::PeerManager; -use node_core::NodeCore; -use node_rpc::new_http_server; -use tokio::sync::Mutex; - -pub mod config; - -#[derive(Parser, Debug)] -#[clap(version)] -struct Args { - /// Path to configs - home_dir: PathBuf, -} - -pub async fn main_runner() -> Result<()> { - env_logger::init(); - - let args = Args::parse(); - let Args { home_dir } = args; - - let app_config = config::from_file(home_dir.join("node_config.json"))?; - - let port = app_config.port; - - let node_core = NodeCore::start_from_config_update_chain(app_config.clone()).await?; - let wrapped_node_core = Arc::new(Mutex::new(node_core)); - - let http_server = new_http_server( - RpcConfig::with_port(port), - app_config.clone(), - wrapped_node_core.clone(), - )?; - info!("HTTP server started"); - let _http_server_handle = http_server.handle(); - tokio::spawn(http_server); - - let peer_manager = PeerManager::start_peer_manager(4, 0).await?; - info!("Peer manager mock started"); - - let peer_manager_shared = Arc::new(Mutex::new(peer_manager)); - - let _consensus_manager = ConsensusManager::new(peer_manager_shared.clone()); - info!("Consensus manger mock started"); - - #[allow(clippy::empty_loop)] - loop { - //ToDo: Insert activity into main loop - } -} diff --git a/node_runner/src/main.rs b/node_runner/src/main.rs deleted file mode 100644 index 2bc288d..0000000 --- a/node_runner/src/main.rs +++ /dev/null @@ -1,16 +0,0 @@ -use anyhow::Result; - -use node_runner::main_runner; - -pub const NUM_THREADS: usize = 4; - -fn main() -> Result<()> { - actix::System::with_tokio_rt(|| { - tokio::runtime::Builder::new_multi_thread() - .worker_threads(NUM_THREADS) - .enable_all() - .build() - .unwrap() - }) - .block_on(main_runner()) -} diff --git a/nssa/program_methods/build.rs b/nssa/program_methods/build.rs index aa600df..08a8a4e 100644 --- a/nssa/program_methods/build.rs +++ b/nssa/program_methods/build.rs @@ -1,4 +1,3 @@ fn main() { risc0_build::embed_methods(); } - diff --git a/nssa/src/address.rs b/nssa/src/address.rs index 4267397..c5f37a6 100644 --- a/nssa/src/address.rs +++ b/nssa/src/address.rs @@ -12,8 +12,12 @@ impl Address { Self { value } } - pub(crate) fn from_public_key(public_key: &PublicKey) -> Self { + pub fn from_public_key(public_key: &PublicKey) -> Self { // TODO: implement Address::new([public_key.0; 32]) } + + pub fn value(&self) -> &[u8; 32] { + &self.value + } } diff --git a/nssa/src/lib.rs b/nssa/src/lib.rs index d911d78..455afa2 100644 --- a/nssa/src/lib.rs +++ b/nssa/src/lib.rs @@ -14,6 +14,7 @@ pub use address::Address; pub use nssa_core::program::Program; pub use public_transaction::PublicTransaction; pub use signature::PrivateKey; +pub use signature::PublicKey; pub use state::V01State; pub const AUTHENTICATED_TRANSFER_PROGRAM: Program = Program { diff --git a/nssa/src/public_transaction.rs b/nssa/src/public_transaction.rs index 7c150db..828e906 100644 --- a/nssa/src/public_transaction.rs +++ b/nssa/src/public_transaction.rs @@ -3,7 +3,7 @@ use nssa_core::{ program::ProgramId, }; use serde::{Deserialize, Serialize}; -use sha2::{digest::FixedOutput, Digest}; +use sha2::{Digest, digest::FixedOutput}; use crate::{ address::Address, @@ -46,11 +46,11 @@ pub struct WitnessSet { } impl WitnessSet { - pub fn for_message(message: &Message, private_keys: &[PrivateKey]) -> Self { + pub fn for_message(message: &Message, private_keys: &[&PrivateKey]) -> Self { let message_bytes = message.to_bytes(); let signatures_and_public_keys = private_keys .iter() - .map(|key| (Signature::new(key, &message_bytes), PublicKey::new(key))) + .map(|&key| (Signature::new(key, &message_bytes), PublicKey::new(key))) .collect(); Self { signatures_and_public_keys, diff --git a/nssa/src/signature.rs b/nssa/src/signature.rs index 2f018f1..be8b937 100644 --- a/nssa/src/signature.rs +++ b/nssa/src/signature.rs @@ -6,6 +6,8 @@ use crate::{address::Address, public_transaction::Message}; pub(crate) struct Signature; // TODO: Dummy impl. Replace by actual private key. +// TODO: Remove Debug, Clone, Serialize, Deserialize, PartialEq and Eq for security reasons +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] pub struct PrivateKey(pub(crate) u8); impl PrivateKey { @@ -16,10 +18,10 @@ impl PrivateKey { // TODO: Dummy impl. Replace by actual public key. #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] -pub(crate) struct PublicKey(pub(crate) u8); +pub struct PublicKey(pub(crate) u8); impl PublicKey { - pub(crate) fn new(key: &PrivateKey) -> Self { + pub fn new(key: &PrivateKey) -> Self { // TODO: implement Self(key.0) } diff --git a/nssa/src/state.rs b/nssa/src/state.rs index a16f013..986073c 100644 --- a/nssa/src/state.rs +++ b/nssa/src/state.rs @@ -158,7 +158,7 @@ mod tests { let nonces = vec![nonce]; let program_id = AUTHENTICATED_TRANSFER_PROGRAM.id; let message = public_transaction::Message::new(program_id, addresses, nonces, balance); - let witness_set = public_transaction::WitnessSet::for_message(&message, &[from_key]); + let witness_set = public_transaction::WitnessSet::for_message(&message, &[&from_key]); PublicTransaction::new(message, witness_set) } diff --git a/sc_core/Cargo.toml b/sc_core/Cargo.toml index bc6bade..d83264b 100644 --- a/sc_core/Cargo.toml +++ b/sc_core/Cargo.toml @@ -19,7 +19,7 @@ light-poseidon.workspace = true ark-bn254.workspace = true ark-ff.workspace = true -risc0-zkvm = { git = "https://github.com/risc0/risc0.git", branch = "release-2.3" } +risc0-zkvm = "2.3.1" [dependencies.accounts] path = "../accounts" diff --git a/sc_core/src/transaction_payloads_tools.rs b/sc_core/src/transaction_payloads_tools.rs index fa0e28e..543cfa8 100644 --- a/sc_core/src/transaction_payloads_tools.rs +++ b/sc_core/src/transaction_payloads_tools.rs @@ -14,7 +14,6 @@ pub fn create_public_transaction_payload( tweak: Tweak, secret_r: [u8; 32], sc_addr: String, - state_changes: (serde_json::Value, usize), ) -> TransactionBody { TransactionBody { tx_kind: TxKind::Public, @@ -30,7 +29,6 @@ pub fn create_public_transaction_payload( tweak, secret_r, sc_addr, - state_changes, } } diff --git a/sequencer_core/src/lib.rs b/sequencer_core/src/lib.rs index 392d772..33e00df 100644 --- a/sequencer_core/src/lib.rs +++ b/sequencer_core/src/lib.rs @@ -3,7 +3,7 @@ use std::fmt::Display; use accounts::account_core::address::{self, AccountAddress}; use anyhow::Result; use common::{ - block::{Block, HashableBlockData}, + block::HashableBlockData, execution_input::PublicNativeTokenSend, merkle_tree_public::TreeHashType, nullifier::UTXONullifier, @@ -129,7 +129,7 @@ impl SequencerCore { prev_block_hash, }; - let block = Block::produce_block_from_hashable_data(hashable_data); + let block = hashable_data.into(); self.store.block_store.put_block_at_id(block)?; @@ -144,11 +144,7 @@ mod tests { use crate::config::AccountInitialData; use super::*; - - use common::transaction::{SignaturePrivateKey, Transaction, TransactionBody, TxKind}; - use k256::{ecdsa::SigningKey, FieldBytes}; use nssa::Program; - use secp256k1_zkp::Tweak; fn setup_sequencer_config_variable_initial_accounts( initial_accounts: Vec, @@ -196,35 +192,35 @@ mod tests { setup_sequencer_config_variable_initial_accounts(initial_accounts) } - fn create_dummy_transaction() -> nssa::PublicTransaction { - let program_id = nssa::AUTHENTICATED_TRANSFER_PROGRAM.id; - let addresses = vec![]; - let nonces = vec![]; - let instruction_data = 0; - let message = - nssa::public_transaction::Message::new(program_id, addresses, nonces, instruction_data); - let private_key = nssa::PrivateKey::new(1); - let witness_set = - nssa::public_transaction::WitnessSet::for_message(&message, &[private_key]); - nssa::PublicTransaction::new(message, witness_set) - } - - fn create_dummy_transaction_native_token_transfer( - from: [u8; 32], - nonce: u128, - to: [u8; 32], - balance_to_move: u128, - signing_key: nssa::PrivateKey, - ) -> nssa::PublicTransaction { - let addresses = vec![nssa::Address::new(from), nssa::Address::new(to)]; - let nonces = vec![nonce]; - let program_id = nssa::AUTHENTICATED_TRANSFER_PROGRAM.id; - let message = - nssa::public_transaction::Message::new(program_id, addresses, nonces, balance_to_move); - let witness_set = - nssa::public_transaction::WitnessSet::for_message(&message, &[signing_key]); - nssa::PublicTransaction::new(message, witness_set) - } + // fn create_dummy_transaction() -> nssa::PublicTransaction { + // let program_id = nssa::AUTHENTICATED_TRANSFER_PROGRAM.id; + // let addresses = vec![]; + // let nonces = vec![]; + // let instruction_data = 0; + // let message = + // nssa::public_transaction::Message::new(program_id, addresses, nonces, instruction_data); + // let private_key = nssa::PrivateKey::new(1); + // let witness_set = + // nssa::public_transaction::WitnessSet::for_message(&message, &[&private_key]); + // nssa::PublicTransaction::new(message, witness_set) + // } + // + // fn create_dummy_transaction_native_token_transfer( + // from: [u8; 32], + // nonce: u128, + // to: [u8; 32], + // balance_to_move: u128, + // signing_key: nssa::PrivateKey, + // ) -> nssa::PublicTransaction { + // let addresses = vec![nssa::Address::new(from), nssa::Address::new(to)]; + // let nonces = vec![nonce]; + // let program_id = nssa::AUTHENTICATED_TRANSFER_PROGRAM.id; + // let message = + // nssa::public_transaction::Message::new(program_id, addresses, nonces, balance_to_move); + // let witness_set = + // nssa::public_transaction::WitnessSet::for_message(&message, &[&signing_key]); + // nssa::PublicTransaction::new(message, witness_set) + // } fn create_signing_key_for_account1() -> nssa::PrivateKey { // let pub_sign_key_acc1 = [ @@ -249,7 +245,7 @@ mod tests { } fn common_setup(sequencer: &mut SequencerCore) { - let tx = create_dummy_transaction(); + let tx = common::test_utils::produce_dummy_empty_transaction(); sequencer.mempool.push_item(tx); sequencer @@ -353,7 +349,7 @@ mod tests { common_setup(&mut sequencer); - let tx = create_dummy_transaction(); + let tx = common::test_utils::produce_dummy_empty_transaction(); // let tx_roots = sequencer.get_tree_roots(); let result = sequencer.transaction_pre_check(tx); @@ -378,7 +374,9 @@ mod tests { let sign_key1 = create_signing_key_for_account1(); - let tx = create_dummy_transaction_native_token_transfer(acc1, 0, acc2, 10, sign_key1); + let tx = common::test_utils::create_dummy_transaction_native_token_transfer( + acc1, 0, acc2, 10, sign_key1, + ); let result = sequencer.transaction_pre_check(tx); assert!(result.is_ok()); @@ -402,7 +400,9 @@ mod tests { let sign_key2 = create_signing_key_for_account2(); - let tx = create_dummy_transaction_native_token_transfer(acc1, 0, acc2, 10, sign_key2); + let tx = common::test_utils::create_dummy_transaction_native_token_transfer( + acc1, 0, acc2, 10, sign_key2, + ); // let tx_roots = sequencer.get_tree_roots(); let tx = sequencer.transaction_pre_check(tx).unwrap(); @@ -429,7 +429,9 @@ mod tests { let sign_key1 = create_signing_key_for_account1(); - let tx = create_dummy_transaction_native_token_transfer(acc1, 0, acc2, 10000000, sign_key1); + let tx = common::test_utils::create_dummy_transaction_native_token_transfer( + acc1, 0, acc2, 10000000, sign_key1, + ); // let tx_roots = sequencer.get_tree_roots(); let result = sequencer.transaction_pre_check(tx); @@ -464,7 +466,9 @@ mod tests { let sign_key1 = create_signing_key_for_account1(); - let tx = create_dummy_transaction_native_token_transfer(acc1, 0, acc2, 100, sign_key1); + let tx = common::test_utils::create_dummy_transaction_native_token_transfer( + acc1, 0, acc2, 100, sign_key1, + ); sequencer.execute_check_transaction_on_state(tx).unwrap(); @@ -493,7 +497,7 @@ mod tests { common_setup(&mut sequencer); - let tx = create_dummy_transaction(); + let tx = common::test_utils::produce_dummy_empty_transaction(); // let tx_roots = sequencer.get_tree_roots(); // Fill the mempool @@ -514,8 +518,7 @@ mod tests { common_setup(&mut sequencer); - let tx = create_dummy_transaction(); - // let tx_roots = sequencer.get_tree_roots(); + let tx = common::test_utils::produce_dummy_empty_transaction(); let result = sequencer.push_tx_into_mempool_pre_check(tx); assert!(result.is_ok()); @@ -528,7 +531,7 @@ mod tests { let mut sequencer = SequencerCore::start_from_config(config); let genesis_height = sequencer.chain_height; - let tx = create_dummy_transaction(); + let tx = common::test_utils::produce_dummy_empty_transaction(); sequencer.mempool.push_item(tx); let block_id = sequencer.produce_new_block_with_mempool_transactions(); @@ -554,7 +557,9 @@ mod tests { let sign_key1 = create_signing_key_for_account1(); - let tx = create_dummy_transaction_native_token_transfer(acc1, 0, acc2, 100, sign_key1); + let tx = common::test_utils::create_dummy_transaction_native_token_transfer( + acc1, 0, acc2, 100, sign_key1, + ); let tx_original = tx.clone(); let tx_replay = tx.clone(); @@ -594,7 +599,9 @@ mod tests { let sign_key1 = create_signing_key_for_account1(); - let tx = create_dummy_transaction_native_token_transfer(acc1, 0, acc2, 100, sign_key1); + let tx = common::test_utils::create_dummy_transaction_native_token_transfer( + acc1, 0, acc2, 100, sign_key1, + ); // The transaction should be included the first time sequencer.mempool.push_item(tx.clone()); diff --git a/sequencer_core/src/sequencer_store/block_store.rs b/sequencer_core/src/sequencer_store/block_store.rs index 36dbee8..ca31c8f 100644 --- a/sequencer_core/src/sequencer_store/block_store.rs +++ b/sequencer_core/src/sequencer_store/block_store.rs @@ -76,34 +76,33 @@ fn block_to_transactions_map(block: &Block) -> HashMap { #[cfg(test)] mod tests { use super::*; - use common::transaction::{SignaturePrivateKey, TransactionBody}; use nssa::Program; use tempfile::tempdir; - - fn create_dummy_block_with_transaction(block_id: u64) -> (Block, nssa::PublicTransaction) { - let program_id = nssa::AUTHENTICATED_TRANSFER_PROGRAM.id; - let addresses = vec![]; - let nonces = vec![]; - let instruction_data = 0; - let message = - nssa::public_transaction::Message::new(program_id, addresses, nonces, instruction_data); - let private_key = nssa::PrivateKey::new(1); - let witness_set = - nssa::public_transaction::WitnessSet::for_message(&message, &[private_key]); - let tx = nssa::PublicTransaction::new(message, witness_set); - ( - Block { - block_id, - prev_block_id: block_id - 1, - prev_block_hash: [0; 32], - hash: [1; 32], - transactions: vec![tx.clone()], - data: vec![], - }, - tx, - ) - } - + // + // fn create_dummy_block_with_transaction(block_id: u64) -> (Block, nssa::PublicTransaction) { + // let program_id = nssa::AUTHENTICATED_TRANSFER_PROGRAM.id; + // let addresses = vec![]; + // let nonces = vec![]; + // let instruction_data = 0; + // let message = + // nssa::public_transaction::Message::new(program_id, addresses, nonces, instruction_data); + // let private_key = nssa::PrivateKey::new(1); + // let witness_set = + // nssa::public_transaction::WitnessSet::for_message(&message, &[private_key]); + // let tx = nssa::PublicTransaction::new(message, witness_set); + // ( + // Block { + // block_id, + // prev_block_id: block_id - 1, + // prev_block_hash: [0; 32], + // hash: [1; 32], + // transactions: vec![tx.clone()], + // data: vec![], + // }, + // tx, + // ) + // } + // #[test] fn test_get_transaction_by_hash() { let temp_dir = tempdir().unwrap(); @@ -119,7 +118,10 @@ mod tests { // Start an empty node store let mut node_store = SequecerBlockStore::open_db_with_genesis(path, Some(genesis_block)).unwrap(); - let (block, tx) = create_dummy_block_with_transaction(1); + + let tx = common::test_utils::produce_dummy_empty_transaction(); + let block = common::test_utils::produce_dummy_block(1, None, vec![tx.clone()], vec![]); + // Try retrieve a tx that's not in the chain yet. let retrieved_tx = node_store.get_transaction_by_hash(tx.hash()); assert_eq!(None, retrieved_tx); diff --git a/sequencer_core/src/sequencer_store/mod.rs b/sequencer_core/src/sequencer_store/mod.rs index d77af1c..9fc266c 100644 --- a/sequencer_core/src/sequencer_store/mod.rs +++ b/sequencer_core/src/sequencer_store/mod.rs @@ -3,12 +3,12 @@ use std::{collections::HashSet, path::Path}; use accounts::account_core::address::AccountAddress; use block_store::SequecerBlockStore; use common::{ - block::{Block, HashableBlockData}, + block::HashableBlockData, merkle_tree_public::merkle_tree::{PublicTransactionMerkleTree, UTXOCommitmentsMerkleTree}, nullifier::UTXONullifier, }; -use rand::{rngs::OsRng, RngCore}; use nssa; +use rand::{rngs::OsRng, RngCore}; use crate::config::AccountInitialData; @@ -57,7 +57,7 @@ impl SequecerChainStore { prev_block_hash, }; - let genesis_block = Block::produce_block_from_hashable_data(hashable_data); + let genesis_block = hashable_data.into(); //Sequencer should panic if unable to open db, //as fixing this issue may require actions non-native to program scope @@ -67,9 +67,6 @@ impl SequecerChainStore { ) .unwrap(); - Self { - state, - block_store, - } + Self { state, block_store } } } diff --git a/sequencer_rpc/Cargo.toml b/sequencer_rpc/Cargo.toml index 1c1de4a..ceb43f7 100644 --- a/sequencer_rpc/Cargo.toml +++ b/sequencer_rpc/Cargo.toml @@ -24,12 +24,6 @@ path = "../mempool" [dependencies.accounts] path = "../accounts" -[dependencies.consensus] -path = "../consensus" - -[dependencies.networking] -path = "../networking" - [dependencies.sequencer_core] path = "../sequencer_core" diff --git a/sequencer_rpc/src/process.rs b/sequencer_rpc/src/process.rs index adba07a..066700c 100644 --- a/sequencer_rpc/src/process.rs +++ b/sequencer_rpc/src/process.rs @@ -275,7 +275,7 @@ mod tests { let message = nssa::public_transaction::Message::new(program_id, addresses, nonces, balance_to_move); let witness_set = - nssa::public_transaction::WitnessSet::for_message(&message, &[signing_key]); + nssa::public_transaction::WitnessSet::for_message(&message, &[&signing_key]); let tx = nssa::PublicTransaction::new(message, witness_set); sequencer_core diff --git a/sequencer_runner/Cargo.toml b/sequencer_runner/Cargo.toml index 286ee76..b42fcb6 100644 --- a/sequencer_runner/Cargo.toml +++ b/sequencer_runner/Cargo.toml @@ -22,12 +22,6 @@ workspace = true [dependencies.mempool] path = "../mempool" -[dependencies.consensus] -path = "../consensus" - -[dependencies.networking] -path = "../networking" - [dependencies.sequencer_rpc] path = "../sequencer_rpc" diff --git a/vm/Cargo.toml b/vm/Cargo.toml deleted file mode 100644 index b69c32f..0000000 --- a/vm/Cargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "vm" -version = "0.1.0" -edition = "2021" - -[dependencies] -anyhow.workspace = true -serde_json.workspace = true -env_logger.workspace = true -log.workspace = true -serde.workspace = true diff --git a/vm/src/lib.rs b/vm/src/lib.rs deleted file mode 100644 index c94d4d0..0000000 --- a/vm/src/lib.rs +++ /dev/null @@ -1 +0,0 @@ -//ToDo: Add vm module diff --git a/node_core/Cargo.toml b/wallet/Cargo.toml similarity index 84% rename from node_core/Cargo.toml rename to wallet/Cargo.toml index 969e4ec..2d7b770 100644 --- a/node_core/Cargo.toml +++ b/wallet/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "node_core" +name = "wallet" version = "0.1.0" edition = "2021" @@ -18,9 +18,10 @@ reqwest.workspace = true thiserror.workspace = true tokio.workspace = true tempfile.workspace = true -risc0-zkvm = { git = "https://github.com/risc0/risc0.git", branch = "release-2.3" } +risc0-zkvm = "2.3.1" hex.workspace = true actix-rt.workspace = true +clap.workspace = true [dependencies.sc_core] path = "../sc_core" @@ -28,15 +29,15 @@ path = "../sc_core" [dependencies.accounts] path = "../accounts" -[dependencies.storage] -path = "../storage" - [dependencies.utxo] path = "../utxo" [dependencies.zkvm] path = "../zkvm" +[dependencies.nssa] +path = "../nssa" + [dependencies.common] path = "../common" diff --git a/node_core/src/chain_storage/accounts_store.rs b/wallet/src/chain_storage/accounts_store.rs similarity index 100% rename from node_core/src/chain_storage/accounts_store.rs rename to wallet/src/chain_storage/accounts_store.rs diff --git a/wallet/src/chain_storage/mod.rs b/wallet/src/chain_storage/mod.rs new file mode 100644 index 0000000..f6d2ab8 --- /dev/null +++ b/wallet/src/chain_storage/mod.rs @@ -0,0 +1,164 @@ +use std::collections::{BTreeMap, HashMap, HashSet}; + +use accounts::account_core::{address::AccountAddress, Account}; +use anyhow::Result; +use common::{ + merkle_tree_public::merkle_tree::{PublicTransactionMerkleTree, UTXOCommitmentsMerkleTree}, + nullifier::UTXONullifier, +}; +use sc_core::public_context::PublicSCContext; +use serde::{Deserialize, Serialize}; + +use crate::config::NodeConfig; + +pub mod accounts_store; + +#[derive(Deserialize, Serialize)] +pub struct AccMap { + pub acc_map: HashMap, +} + +impl From> for AccMap { + fn from(value: HashMap<[u8; 32], Account>) -> Self { + AccMap { + acc_map: value + .into_iter() + .map(|(key, val)| (hex::encode(key), val)) + .collect(), + } + } +} + +impl From for HashMap<[u8; 32], Account> { + fn from(value: AccMap) -> Self { + value + .acc_map + .into_iter() + .map(|(key, val)| (hex::decode(key).unwrap().try_into().unwrap(), val)) + .collect() + } +} + +pub struct NodeChainStore { + pub acc_map: HashMap, + pub nullifier_store: HashSet, + pub utxo_commitments_store: UTXOCommitmentsMerkleTree, + pub pub_tx_store: PublicTransactionMerkleTree, + pub node_config: NodeConfig, +} + +impl NodeChainStore { + pub fn new(config: NodeConfig) -> Result { + let acc_map = HashMap::new(); + let nullifier_store = HashSet::new(); + let utxo_commitments_store = UTXOCommitmentsMerkleTree::new(vec![]); + let pub_tx_store = PublicTransactionMerkleTree::new(vec![]); + + Ok(Self { + acc_map, + nullifier_store, + utxo_commitments_store, + pub_tx_store, + node_config: config, + }) + } + + pub fn produce_context(&self, caller: AccountAddress) -> PublicSCContext { + let mut account_masks = BTreeMap::new(); + + for (acc_addr, acc) in &self.acc_map { + account_masks.insert(*acc_addr, acc.make_account_public_mask()); + } + + PublicSCContext { + caller_address: caller, + caller_balance: self.acc_map.get(&caller).unwrap().balance, + account_masks, + comitment_store_root: self.utxo_commitments_store.get_root().unwrap_or([0; 32]), + pub_tx_store_root: self.pub_tx_store.get_root().unwrap_or([0; 32]), + nullifiers_set: self + .nullifier_store + .iter() + .map(|item| item.utxo_hash) + .collect(), + commitments_tree: self.utxo_commitments_store.clone(), + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use accounts::account_core::Account; + use std::path::PathBuf; + use tempfile::tempdir; + + fn create_initial_accounts() -> Vec { + let initial_acc1 = serde_json::from_str(r#"{ + "address": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + "balance": 100, + "key_holder": { + "nullifer_public_key": "03A340BECA9FAAB444CED0140681D72EA1318B5C611704FEE017DA9836B17DB718", + "pub_account_signing_key": 1, + "top_secret_key_holder": { + "secret_spending_key": "7BC46784DB1BC67825D8F029436846712BFDF9B5D79EA3AB11D39A52B9B229D4" + }, + "utxo_secret_key_holder": { + "nullifier_secret_key": "BB54A8D3C9C51B82C431082D1845A74677B0EF829A11B517E1D9885DE3139506", + "viewing_secret_key": "AD923E92F6A5683E30140CEAB2702AFB665330C1EE4EFA70FAF29767B6B52BAF" + }, + "viewing_public_key": "0361220C5D277E7A1709340FD31A52600C1432B9C45B9BCF88A43581D58824A8B6" + }, + "utxos": {} + }"#).unwrap(); + + let initial_acc2 = serde_json::from_str(r#"{ + "address": [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], + "balance": 200, + "key_holder": { + "nullifer_public_key": "02172F50274DE67C4087C344F5D58E11DF761D90285B095060E0994FAA6BCDE271", + "pub_account_signing_key": 2, + "top_secret_key_holder": { + "secret_spending_key": "80A186737C8D38B4288A03F0F589957D9C040D79C19F3E0CC4BA80F8494E5179" + }, + "utxo_secret_key_holder": { + "nullifier_secret_key": "746928E63F0984F6F4818933493CE9C067562D9CB932FDC06D82C86CDF6D7122", + "viewing_secret_key": "89176CF4BC9E673807643FD52110EF99D4894335AFB10D881AC0B5041FE1FCB7" + }, + "viewing_public_key": "026072A8F83FEC3472E30CDD4767683F30B91661D25B1040AD9A5FC2E01D659F99" + }, + "utxos": {} + }"#).unwrap(); + + let initial_accounts = vec![initial_acc1, initial_acc2]; + + initial_accounts + } + + fn create_sample_node_config(home: PathBuf) -> NodeConfig { + NodeConfig { + home, + override_rust_log: None, + sequencer_addr: "http://127.0.0.1".to_string(), + seq_poll_timeout_secs: 1, + initial_accounts: create_initial_accounts(), + } + } + + #[test] + fn test_new_initializes_correctly() { + let temp_dir = tempdir().unwrap(); + let path = temp_dir.path(); + + let config = create_sample_node_config(path.to_path_buf()); + + let store = NodeChainStore::new(config.clone()).unwrap(); + + assert!(store.acc_map.is_empty()); + assert!(store.nullifier_store.is_empty()); + assert_eq!( + store.utxo_commitments_store.get_root().unwrap_or([0; 32]), + [0; 32] + ); + } +} diff --git a/node_core/src/config.rs b/wallet/src/config.rs similarity index 91% rename from node_core/src/config.rs rename to wallet/src/config.rs index e2ddf83..29a22f9 100644 --- a/node_core/src/config.rs +++ b/wallet/src/config.rs @@ -46,12 +46,6 @@ pub struct NodeConfig { pub sequencer_addr: String, ///Sequencer polling duration for new blocks in seconds pub seq_poll_timeout_secs: u64, - ///Port to listen - pub port: u16, - ///Gas config - pub gas_config: GasConfig, - ///Frequency of snapshots - pub shapshot_frequency_in_blocks: u64, ///Initial accounts for wallet pub initial_accounts: Vec, } diff --git a/wallet/src/helperfunctions.rs b/wallet/src/helperfunctions.rs new file mode 100644 index 0000000..8f6af22 --- /dev/null +++ b/wallet/src/helperfunctions.rs @@ -0,0 +1,43 @@ +use std::{fs::File, io::BufReader, path::PathBuf, str::FromStr}; + +use anyhow::{anyhow, Result}; + +use crate::{config::NodeConfig, HOME_DIR_ENV_VAR}; + +pub fn vec_u8_to_vec_u64(bytes: Vec) -> Vec { + // Pad with zeros to make sure it's a multiple of 8 + let mut padded = bytes.clone(); + while !padded.len().is_multiple_of(8) { + padded.push(0); + } + + padded + .chunks(8) + .map(|chunk| { + let mut array = [0u8; 8]; + array.copy_from_slice(chunk); + u64::from_le_bytes(array) + }) + .collect() +} + +///Get home dir for wallet. Env var `NSSA_WALLET_HOME_DIR` must be set before execution to succeed. +pub fn get_home() -> Result { + Ok(PathBuf::from_str(&std::env::var(HOME_DIR_ENV_VAR)?)?) +} + +///Fetch config from `NSSA_WALLET_HOME_DIR` +pub fn fetch_config() -> Result { + let config_home = get_home()?; + let file = File::open(config_home.join("node_config.json"))?; + let reader = BufReader::new(file); + + Ok(serde_json::from_reader(reader)?) +} + +//ToDo: Replace with structures conversion in future +pub fn produce_account_addr_from_hex(hex_str: String) -> Result<[u8; 32]> { + hex::decode(hex_str)? + .try_into() + .map_err(|_| anyhow!("Failed conversion to 32 bytes")) +} diff --git a/wallet/src/lib.rs b/wallet/src/lib.rs new file mode 100644 index 0000000..26a4fe3 --- /dev/null +++ b/wallet/src/lib.rs @@ -0,0 +1,162 @@ +use std::sync::Arc; + +use common::{ + execution_input::PublicNativeTokenSend, + sequencer_client::{json::SendTxResponse, SequencerClient}, + transaction::Transaction, + ExecutionFailureKind, +}; + +use accounts::account_core::{address::AccountAddress, Account}; +use anyhow::Result; +use chain_storage::NodeChainStore; +use common::transaction::TransactionBody; +use config::NodeConfig; +use log::info; +use sc_core::proofs_circuits::pedersen_commitment_vec; +use tokio::sync::RwLock; + +use clap::{Parser, Subcommand}; +use nssa; + +use crate::helperfunctions::{fetch_config, produce_account_addr_from_hex}; + +pub const HOME_DIR_ENV_VAR: &str = "NSSA_WALLET_HOME_DIR"; +pub const BLOCK_GEN_DELAY_SECS: u64 = 20; + +pub mod chain_storage; +pub mod config; +pub mod helperfunctions; +pub mod requests_structs; + +pub struct NodeCore { + pub storage: Arc>, + pub node_config: NodeConfig, + pub sequencer_client: Arc, +} + +impl NodeCore { + pub async fn start_from_config_update_chain(config: NodeConfig) -> Result { + let client = Arc::new(SequencerClient::new(config.sequencer_addr.clone())?); + + let mut storage = NodeChainStore::new(config.clone())?; + for acc in config.clone().initial_accounts { + storage.acc_map.insert(acc.address, acc); + } + + let wrapped_storage = Arc::new(RwLock::new(storage)); + + Ok(Self { + storage: wrapped_storage, + node_config: config.clone(), + sequencer_client: client.clone(), + }) + } + + pub async fn get_roots(&self) -> [[u8; 32]; 2] { + let storage = self.storage.read().await; + [ + storage.utxo_commitments_store.get_root().unwrap_or([0; 32]), + storage.pub_tx_store.get_root().unwrap_or([0; 32]), + ] + } + + pub async fn create_new_account(&mut self) -> AccountAddress { + let account = Account::new(); + account.log(); + + let addr = account.address; + + { + let mut write_guard = self.storage.write().await; + + write_guard.acc_map.insert(account.address, account); + } + + addr + } + + pub async fn send_public_native_token_transfer( + &self, + from: AccountAddress, + nonce: u128, + to: AccountAddress, + balance_to_move: u128, + ) -> Result { + { + let read_guard = self.storage.read().await; + + let account = read_guard.acc_map.get(&from); + + if let Some(account) = account { + let addresses = vec![nssa::Address::new(from), nssa::Address::new(to)]; + let nonces = vec![nonce]; + let program_id = nssa::AUTHENTICATED_TRANSFER_PROGRAM.id; + let message = nssa::public_transaction::Message::new( + program_id, + addresses, + nonces, + balance_to_move, + ); + + let signing_key = account.key_holder.get_pub_account_signing_key(); + let witness_set = + nssa::public_transaction::WitnessSet::for_message(&message, &[&signing_key]); + + let tx = nssa::PublicTransaction::new(message, witness_set); + + Ok(self.sequencer_client.send_tx(tx).await?) + } else { + Err(ExecutionFailureKind::AmountMismatchError) + } + } + } +} + +///Represents CLI command for a wallet +#[derive(Subcommand, Debug, Clone)] +#[clap(about)] +pub enum Command { + SendNativeTokenTransfer { + ///from - valid 32 byte hex string + #[arg(long)] + from: String, + ///to - valid 32 byte hex string + #[arg(long)] + to: String, + ///amount - amount of balance to move + #[arg(long)] + amount: u128, + }, +} + +///To execute commands, env var NSSA_WALLET_HOME_DIR must be set into directory with config +#[derive(Parser, Debug)] +#[clap(version, about)] +pub struct Args { + /// Wallet command + #[command(subcommand)] + pub command: Command, +} + +pub async fn execute_subcommand(command: Command) -> Result<()> { + match command { + Command::SendNativeTokenTransfer { from, to, amount } => { + let node_config = fetch_config()?; + + let from = produce_account_addr_from_hex(from)?; + let to = produce_account_addr_from_hex(to)?; + + let wallet_core = NodeCore::start_from_config_update_chain(node_config).await?; + + //ToDo: Nonce management + let res = wallet_core + .send_public_native_token_transfer(from, 0, to, amount) + .await?; + + info!("Results of tx send is {res:#?}"); + } + } + + Ok(()) +} diff --git a/wallet/src/main.rs b/wallet/src/main.rs new file mode 100644 index 0000000..f8c91f8 --- /dev/null +++ b/wallet/src/main.rs @@ -0,0 +1,24 @@ +use anyhow::Result; +use clap::Parser; +use tokio::runtime::Builder; +use wallet::{execute_subcommand, Args}; + +pub const NUM_THREADS: usize = 2; + +fn main() -> Result<()> { + let runtime = Builder::new_multi_thread() + .worker_threads(NUM_THREADS) + .enable_all() + .build() + .unwrap(); + + let args = Args::parse(); + + env_logger::init(); + + runtime.block_on(async move { + execute_subcommand(args.command).await.unwrap(); + }); + + Ok(()) +} diff --git a/wallet/src/requests_structs.rs b/wallet/src/requests_structs.rs new file mode 100644 index 0000000..e7bb935 --- /dev/null +++ b/wallet/src/requests_structs.rs @@ -0,0 +1,33 @@ +use accounts::account_core::address::AccountAddress; +use serde::{Deserialize, Serialize}; +use utxo::utxo_core::UTXO; + +#[derive(Debug, Serialize, Deserialize)] +pub struct MintMoneyPublicTx { + pub acc: AccountAddress, + pub amount: u128, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct SendMoneyShieldedTx { + pub acc_sender: AccountAddress, + pub amount: u128, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct SendMoneyDeshieldedTx { + pub receiver_data: Vec<(u128, AccountAddress)>, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct UTXOPublication { + pub utxos: Vec, +} + +#[derive(Debug, Serialize, Deserialize)] +pub enum ActionData { + MintMoneyPublicTx(MintMoneyPublicTx), + SendMoneyShieldedTx(SendMoneyShieldedTx), + SendMoneyDeshieldedTx(SendMoneyDeshieldedTx), + UTXOPublication(UTXOPublication), +} diff --git a/zkvm/Cargo.toml b/zkvm/Cargo.toml index d87d142..b518109 100644 --- a/zkvm/Cargo.toml +++ b/zkvm/Cargo.toml @@ -12,7 +12,7 @@ serde.workspace = true thiserror.workspace = true rand.workspace = true -risc0-zkvm = { git = "https://github.com/risc0/risc0.git", branch = "release-2.3" } +risc0-zkvm = "2.3.1" test-methods = { path = "test_methods" } [dependencies.accounts]