diff --git a/Cargo.lock b/Cargo.lock index 2e8eeb10a58..b21bc9f81c3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -117,7 +117,7 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" dependencies = [ - "gimli 0.27.3", + "gimli", ] [[package]] @@ -132,7 +132,7 @@ version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ - "getrandom 0.2.10", + "getrandom 0.2.15", "once_cell", "version_check", ] @@ -144,7 +144,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if 1.0.0", - "getrandom 0.2.10", + "getrandom 0.2.15", "once_cell", "version_check", "zerocopy", @@ -563,18 +563,6 @@ dependencies = [ "typenum", ] -[[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" @@ -617,16 +605,11 @@ dependencies = [ "ark-std", "cfg-if 1.0.0", "criterion", - "getrandom 0.2.10", "hex", - "js-sys", "lazy_static", "noir_grumpkin", "num-bigint", "pprof 0.12.1", - "thiserror", - "wasm-bindgen-futures", - "wasmer", ] [[package]] @@ -693,28 +676,6 @@ version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" -[[package]] -name = "bytecheck" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627" -dependencies = [ - "bytecheck_derive", - "ptr_meta", - "simdutf8", -] - -[[package]] -name = "bytecheck_derive" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "bytecount" version = "0.6.3" @@ -850,9 +811,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.7" +version = "4.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b" +checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2" dependencies = [ "clap_builder", "clap_derive", @@ -868,9 +829,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.7" +version = "4.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663" +checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb" dependencies = [ "anstream", "anstyle", @@ -887,7 +848,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.64", ] [[package]] @@ -925,7 +886,7 @@ checksum = "fc4159b76af02757139baf42c0c971c6dc155330999fbfd8eddb29b97fb2db68" dependencies = [ "codespan-reporting", "lsp-types 0.88.0", - "url 2.4.0", + "url 2.5.0", ] [[package]] @@ -1059,19 +1020,6 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" -[[package]] -name = "corosensei" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80128832c58ea9cbd041d2a759ec449224487b2c1e400453d99d244eead87a8e" -dependencies = [ - "autocfg", - "cfg-if 1.0.0", - "libc", - "scopeguard", - "windows-sys 0.33.0", -] - [[package]] name = "cpp_demangle" version = "0.4.2" @@ -1090,89 +1038,6 @@ dependencies = [ "libc", ] -[[package]] -name = "cranelift-bforest" -version = "0.91.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2ab4512dfd3a6f4be184403a195f76e81a8a9f9e6c898e19d2dc3ce20e0115" -dependencies = [ - "cranelift-entity", -] - -[[package]] -name = "cranelift-codegen" -version = "0.91.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98b022ed2a5913a38839dfbafe6cf135342661293b08049843362df4301261dc" -dependencies = [ - "arrayvec", - "bumpalo", - "cranelift-bforest", - "cranelift-codegen-meta", - "cranelift-codegen-shared", - "cranelift-egraph", - "cranelift-entity", - "cranelift-isle", - "gimli 0.26.2", - "log", - "regalloc2", - "smallvec", - "target-lexicon", -] - -[[package]] -name = "cranelift-codegen-meta" -version = "0.91.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "639307b45434ad112a98f8300c0f0ab085cbefcd767efcdef9ef19d4c0756e74" -dependencies = [ - "cranelift-codegen-shared", -] - -[[package]] -name = "cranelift-codegen-shared" -version = "0.91.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "278e52e29c53fcf32431ef08406c295699a70306d05a0715c5b1bf50e33a9ab7" - -[[package]] -name = "cranelift-egraph" -version = "0.91.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624b54323b06e675293939311943ba82d323bb340468ce1889be5da7932c8d73" -dependencies = [ - "cranelift-entity", - "fxhash", - "hashbrown 0.12.3", - "indexmap 1.9.3", - "log", - "smallvec", -] - -[[package]] -name = "cranelift-entity" -version = "0.91.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a59bcbca89c3f1b70b93ab3cbba5e5e0cbf3e63dadb23c7525cb142e21a9d4c" - -[[package]] -name = "cranelift-frontend" -version = "0.91.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d70abacb8cfef3dc8ff7e8836e9c1d70f7967dfdac824a4cd5e30223415aca6" -dependencies = [ - "cranelift-codegen", - "log", - "smallvec", - "target-lexicon", -] - -[[package]] -name = "cranelift-isle" -version = "0.91.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "393bc73c451830ff8dbb3a07f61843d6cb41a084f9996319917c0b291ed785bb" - [[package]] name = "crc32fast" version = "1.3.2" @@ -1252,24 +1117,11 @@ dependencies = [ "scopeguard", ] -[[package]] -name = "crossbeam-queue" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils", -] - [[package]] name = "crossbeam-utils" -version = "0.8.17" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d96137f14f244c37f989d9fff8f95e6c18b918e71f36638f8c49112e4c78f" -dependencies = [ - "cfg-if 1.0.0", -] +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] name = "crunchy" @@ -1352,7 +1204,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.32", + "syn 2.0.64", ] [[package]] @@ -1363,20 +1215,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core", "quote", - "syn 2.0.32", -] - -[[package]] -name = "dashmap" -version = "5.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" -dependencies = [ - "cfg-if 1.0.0", - "hashbrown 0.14.0", - "lock_api", - "once_cell", - "parking_lot_core 0.9.8", + "syn 2.0.64", ] [[package]] @@ -1584,47 +1423,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" -[[package]] -name = "enum-iterator" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eeac5c5edb79e4e39fe8439ef35207780a11f69c52cbe424ce3dfad4cb78de6" -dependencies = [ - "enum-iterator-derive", -] - -[[package]] -name = "enum-iterator-derive" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c134c37760b27a871ba422106eedbb8247da973a09e82558bf26d619c882b159" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "enumset" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e875f1719c16de097dee81ed675e2d9bb63096823ed3f0ca827b7dea3028bbbb" -dependencies = [ - "enumset_derive", -] - -[[package]] -name = "enumset_derive" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08b6c6ab82d70f08844964ba10c7babb716de2ecaeab9be5717918a5177d3af" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.32", -] - [[package]] name = "equivalent" version = "1.0.1" @@ -1661,12 +1459,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "fallible-iterator" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" - [[package]] name = "fastrand" version = "2.0.1" @@ -1779,11 +1571,11 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "form_urlencoded" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ - "percent-encoding 2.3.0", + "percent-encoding 2.3.1", ] [[package]] @@ -1795,12 +1587,6 @@ dependencies = [ "libc", ] -[[package]] -name = "funty" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" - [[package]] name = "futures" version = "0.1.31" @@ -1864,7 +1650,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.64", ] [[package]] @@ -1930,9 +1716,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -1941,17 +1727,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "gimli" -version = "0.26.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" -dependencies = [ - "fallible-iterator", - "indexmap 1.9.3", - "stable_deref_trait", -] - [[package]] name = "gimli" version = "0.27.3" @@ -2024,7 +1799,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 2.0.0", + "indexmap 2.2.6", "slab", "tokio", "tokio-util 0.7.10", @@ -2051,9 +1826,6 @@ 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" @@ -2066,9 +1838,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.0" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] name = "heck" @@ -2226,9 +1998,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -2309,12 +2081,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.0" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", - "hashbrown 0.14.0", + "hashbrown 0.14.5", "serde", ] @@ -2611,12 +2383,6 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -[[package]] -name = "leb128" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" - [[package]] name = "libaes" version = "0.7.0" @@ -2625,9 +2391,9 @@ checksum = "82903360c009b816f5ab72a9b68158c27c301ee2c3f20655b55c5e589e7d3bb7" [[package]] name = "libc" -version = "0.2.151" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -2687,7 +2453,7 @@ dependencies = [ "serde", "serde_json", "serde_repr", - "url 2.4.0", + "url 2.5.0", ] [[package]] @@ -2700,16 +2466,7 @@ dependencies = [ "serde", "serde_json", "serde_repr", - "url 2.4.0", -] - -[[package]] -name = "mach" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" -dependencies = [ - "libc", + "url 2.5.0", ] [[package]] @@ -2742,15 +2499,6 @@ dependencies = [ "libc", ] -[[package]] -name = "memmap2" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d28bba84adfe6646737845bc5ebbfa2c08424eb1c37e94a1fd2a82adb56a872" -dependencies = [ - "libc", -] - [[package]] name = "memoffset" version = "0.6.5" @@ -2807,12 +2555,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "more-asserts" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389" - [[package]] name = "nargo" version = "0.29.0" @@ -2917,7 +2659,7 @@ dependencies = [ "serde", "thiserror", "toml 0.7.6", - "url 2.4.0", + "url 2.5.0", ] [[package]] @@ -3053,7 +2795,7 @@ dependencies = [ "build-data", "console_error_panic_hook", "fm", - "getrandom 0.2.10", + "getrandom 0.2.15", "gloo-utils", "js-sys", "nargo", @@ -3093,7 +2835,7 @@ dependencies = [ "acvm", "build-data", "console_error_panic_hook", - "getrandom 0.2.10", + "getrandom 0.2.15", "gloo-utils", "iter-extended", "js-sys", @@ -3417,9 +3159,9 @@ checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" [[package]] name = "percent-encoding" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "petgraph" @@ -3428,7 +3170,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.0.0", + "indexmap 2.2.6", ] [[package]] @@ -3658,30 +3400,6 @@ dependencies = [ "toml 0.5.11", ] -[[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-macro-hack" version = "0.5.20+deprecated" @@ -3690,9 +3408,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" dependencies = [ "unicode-ident", ] @@ -3717,26 +3435,6 @@ dependencies = [ "unarray", ] -[[package]] -name = "ptr_meta" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" -dependencies = [ - "ptr_meta_derive", -] - -[[package]] -name = "ptr_meta_derive" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "quick-error" version = "1.2.3" @@ -3754,19 +3452,13 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.31" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] -[[package]] -name = "radium" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" - [[package]] name = "radix_trie" version = "0.2.1" @@ -3836,7 +3528,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.10", + "getrandom 0.2.15", ] [[package]] @@ -3925,23 +3617,11 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.10", + "getrandom 0.2.15", "redox_syscall 0.2.16", "thiserror", ] -[[package]] -name = "regalloc2" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "300d4fbfb40c1c66a78ba3ddd41c1110247cf52f97b87d0f2fc9209bd49b030c" -dependencies = [ - "fxhash", - "log", - "slice-group-by", - "smallvec", -] - [[package]] name = "regex" version = "1.10.3" @@ -3998,27 +3678,6 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" -[[package]] -name = "region" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76e189c2369884dce920945e2ddf79b3dff49e071a167dd1817fa9c4c00d512e" -dependencies = [ - "bitflags 1.3.2", - "libc", - "mach", - "winapi", -] - -[[package]] -name = "rend" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581008d2099240d37fb08d77ad713bcaec2c4d89d50b5b21a8bb1996bbab68ab" -dependencies = [ - "bytecheck", -] - [[package]] name = "reqwest" version = "0.11.20" @@ -4040,7 +3699,7 @@ dependencies = [ "log", "mime", "once_cell", - "percent-encoding 2.3.0", + "percent-encoding 2.3.1", "pin-project-lite", "rustls", "rustls-pemfile", @@ -4050,7 +3709,7 @@ dependencies = [ "tokio", "tokio-rustls", "tower-service", - "url 2.4.0", + "url 2.5.0", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -4114,42 +3773,13 @@ checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", "cfg-if 1.0.0", - "getrandom 0.2.10", + "getrandom 0.2.15", "libc", "spin 0.9.8", "untrusted 0.9.0", "windows-sys 0.52.0", ] -[[package]] -name = "rkyv" -version = "0.7.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0200c8230b013893c0b2d6213d6ec64ed2b9be2e0e016682b7224ff82cff5c58" -dependencies = [ - "bitvec", - "bytecheck", - "hashbrown 0.12.3", - "indexmap 1.9.3", - "ptr_meta", - "rend", - "rkyv_derive", - "seahash", - "tinyvec", - "uuid", -] - -[[package]] -name = "rkyv_derive" -version = "0.7.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2e06b915b5c230a17d7a736d1e2e63ee753c256a8614ef3f5147b13a4f5541d" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "rust-embed" version = "6.8.1" @@ -4170,7 +3800,7 @@ dependencies = [ "proc-macro2", "quote", "rust-embed-utils", - "syn 2.0.32", + "syn 2.0.64", "walkdir", ] @@ -4391,12 +4021,6 @@ dependencies = [ "untrusted 0.7.1", ] -[[package]] -name = "seahash" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" - [[package]] name = "sec1" version = "0.3.0" @@ -4411,12 +4035,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "self_cell" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e388332cd64eb80cd595a00941baf513caffae8dce9cfd0467fc9c66397dade6" - [[package]] name = "semver" version = "1.0.20" @@ -4428,9 +4046,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.179" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a5bf42b8d227d4abf38a1ddb08602e229108a517cd4e5bb28f9c7eaafdce5c0" +checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" dependencies = [ "serde_derive", ] @@ -4469,26 +4087,15 @@ dependencies = [ "thiserror", ] -[[package]] -name = "serde-wasm-bindgen" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b4c031cd0d9014307d82b8abf653c0290fbdaeb4c02d00c63cf52f728628bf" -dependencies = [ - "js-sys", - "serde", - "wasm-bindgen", -] - [[package]] name = "serde_derive" -version = "1.0.179" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "741e124f5485c7e60c03b043f79f320bff3527f4bbf12cf3831750dc46a0ec2c" +checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.64", ] [[package]] @@ -4510,7 +4117,7 @@ checksum = "1d89a8107374290037607734c0b73a85db7ed80cae314b3c5791f192a496e731" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.64", ] [[package]] @@ -4544,7 +4151,7 @@ dependencies = [ "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.0.0", + "indexmap 2.2.6", "serde", "serde_json", "serde_with_macros", @@ -4560,7 +4167,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.64", ] [[package]] @@ -4593,16 +4200,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "shared-buffer" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6c99835bad52957e7aa241d3975ed17c1e5f8c92026377d117a606f36b84b16" -dependencies = [ - "bytes", - "memmap2 0.6.2", -] - [[package]] name = "shell-words" version = "1.1.0" @@ -4619,12 +4216,6 @@ dependencies = [ "rand_core 0.6.4", ] -[[package]] -name = "simdutf8" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" - [[package]] name = "similar" version = "2.3.0" @@ -4670,12 +4261,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "slice-group-by" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" - [[package]] name = "small-ord-set" version = "0.1.3" @@ -4807,7 +4392,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "167a4ffd7c35c143fd1030aa3c2caf76ba42220bd5a6b5f4781896434723b8c3" dependencies = [ "debugid", - "memmap2 0.5.10", + "memmap2", "stable_deref_trait", "uuid", ] @@ -4836,21 +4421,15 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.32" +version = "2.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2" +checksum = "7ad3dee41f36859875573074334c200d1add8e4a87bb37113ebd31d926b7b11f" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "tap" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" - [[package]] name = "tar" version = "0.4.40" @@ -4862,12 +4441,6 @@ dependencies = [ "xattr", ] -[[package]] -name = "target-lexicon" -version = "0.12.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d0e916b1148c8e263850e1ebcbd046f333e0683c724876bb0da63ea4373dc8a" - [[package]] name = "tempfile" version = "3.8.0" @@ -4970,7 +4543,7 @@ checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.64", ] [[package]] @@ -5070,7 +4643,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.64", ] [[package]] @@ -5159,7 +4732,7 @@ version = "0.19.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.2.6", "serde", "serde_spanned", "toml_datetime", @@ -5221,7 +4794,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.64", ] [[package]] @@ -5392,13 +4965,13 @@ dependencies = [ [[package]] name = "url" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", - "idna 0.4.0", - "percent-encoding 2.3.0", + "idna 0.5.0", + "percent-encoding 2.3.1", "serde", ] @@ -5499,7 +5072,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.64", "wasm-bindgen-shared", ] @@ -5533,7 +5106,7 @@ checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.64", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5568,179 +5141,6 @@ dependencies = [ "quote", ] -[[package]] -name = "wasm-encoder" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ba64e81215916eaeb48fee292f29401d69235d62d8b8fd92a7b2844ec5ae5f7" -dependencies = [ - "leb128", -] - -[[package]] -name = "wasmer" -version = "4.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c15724dc25d1ee57962334aea8e41ade2675e5ea2ac6b8d42da6051b0face66" -dependencies = [ - "bytes", - "cfg-if 1.0.0", - "derivative", - "indexmap 1.9.3", - "js-sys", - "more-asserts", - "rustc-demangle", - "serde", - "serde-wasm-bindgen", - "shared-buffer", - "target-lexicon", - "thiserror", - "tracing", - "wasm-bindgen", - "wasmer-compiler", - "wasmer-compiler-cranelift", - "wasmer-derive", - "wasmer-types", - "wasmer-vm", - "wasmparser", - "wat", - "winapi", -] - -[[package]] -name = "wasmer-compiler" -version = "4.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55a7f3b3a96f8d844c25e2c032af9572306dd63fa93dc17bcca4c5458ac569bd" -dependencies = [ - "backtrace", - "bytes", - "cfg-if 1.0.0", - "enum-iterator", - "enumset", - "lazy_static", - "leb128", - "memmap2 0.5.10", - "more-asserts", - "region", - "rkyv", - "self_cell", - "shared-buffer", - "smallvec", - "thiserror", - "wasmer-types", - "wasmer-vm", - "wasmparser", - "winapi", -] - -[[package]] -name = "wasmer-compiler-cranelift" -version = "4.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "102e2c5bacac69495c4025767e2fa26797ffb27f242dccb7cf57d9cefd944386" -dependencies = [ - "cranelift-codegen", - "cranelift-entity", - "cranelift-frontend", - "gimli 0.26.2", - "more-asserts", - "rayon", - "smallvec", - "target-lexicon", - "tracing", - "wasmer-compiler", - "wasmer-types", -] - -[[package]] -name = "wasmer-derive" -version = "4.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ea737fa08f95d6abc4459f42a70a9833e8974b814e74971d77ef473814f4d4c" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "wasmer-types" -version = "4.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0689110e291b0f07fc665f2824e5ff81df120848e8a9acfbf1a9bf7990773f9" -dependencies = [ - "bytecheck", - "enum-iterator", - "enumset", - "indexmap 1.9.3", - "more-asserts", - "rkyv", - "target-lexicon", - "thiserror", -] - -[[package]] -name = "wasmer-vm" -version = "4.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd41f822a1ac4242d478754e8ceba2806a00ea5072803622e1fe91e8e28b2a1" -dependencies = [ - "backtrace", - "cc", - "cfg-if 1.0.0", - "corosensei", - "crossbeam-queue", - "dashmap", - "derivative", - "enum-iterator", - "fnv", - "indexmap 1.9.3", - "lazy_static", - "libc", - "mach", - "memoffset 0.9.0", - "more-asserts", - "region", - "scopeguard", - "thiserror", - "wasmer-types", - "winapi", -] - -[[package]] -name = "wasmparser" -version = "0.121.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dbe55c8f9d0dbd25d9447a5a889ff90c0cc3feaa7395310d3d826b2c703eaab" -dependencies = [ - "bitflags 2.5.0", - "indexmap 2.0.0", - "semver", -] - -[[package]] -name = "wast" -version = "64.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a259b226fd6910225aa7baeba82f9d9933b6d00f2ce1b49b80fa4214328237cc" -dependencies = [ - "leb128", - "memchr", - "unicode-width", - "wasm-encoder", -] - -[[package]] -name = "wat" -version = "1.0.71" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53253d920ab413fca1c7dc2161d601c79b4fdf631d0ba51dd4343bf9b556c3f6" -dependencies = [ - "wast", -] - [[package]] name = "web-sys" version = "0.3.63" @@ -5797,19 +5197,6 @@ dependencies = [ "windows-targets 0.48.1", ] -[[package]] -name = "windows-sys" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43dbb096663629518eb1dfa72d80243ca5a6aca764cae62a2df70af760a9be75" -dependencies = [ - "windows_aarch64_msvc 0.33.0", - "windows_i686_gnu 0.33.0", - "windows_i686_msvc 0.33.0", - "windows_x86_64_gnu 0.33.0", - "windows_x86_64_msvc 0.33.0", -] - [[package]] name = "windows-sys" version = "0.48.0" @@ -5870,12 +5257,6 @@ version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" -[[package]] -name = "windows_aarch64_msvc" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd761fd3eb9ab8cc1ed81e56e567f02dd82c4c837e48ac3b2181b9ffc5060807" - [[package]] name = "windows_aarch64_msvc" version = "0.48.0" @@ -5888,12 +5269,6 @@ version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" -[[package]] -name = "windows_i686_gnu" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab0cf703a96bab2dc0c02c0fa748491294bf9b7feb27e1f4f96340f208ada0e" - [[package]] name = "windows_i686_gnu" version = "0.48.0" @@ -5906,12 +5281,6 @@ version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" -[[package]] -name = "windows_i686_msvc" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cfdbe89cc9ad7ce618ba34abc34bbb6c36d99e96cae2245b7943cd75ee773d0" - [[package]] name = "windows_i686_msvc" version = "0.48.0" @@ -5924,12 +5293,6 @@ version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" -[[package]] -name = "windows_x86_64_gnu" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4dd9b0c0e9ece7bb22e84d70d01b71c6d6248b81a3c60d11869451b4cb24784" - [[package]] name = "windows_x86_64_gnu" version = "0.48.0" @@ -5954,12 +5317,6 @@ version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" -[[package]] -name = "windows_x86_64_msvc" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1e4aa646495048ec7f3ffddc411e1d829c026a2ec62b39da15c1055e406eaa" - [[package]] name = "windows_x86_64_msvc" version = "0.48.0" @@ -5991,15 +5348,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "wyz" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" -dependencies = [ - "tap", -] - [[package]] name = "xattr" version = "1.0.1" @@ -6026,7 +5374,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.64", ] [[package]] @@ -6046,5 +5394,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.64", ] diff --git a/acvm-repo/bn254_blackbox_solver/Cargo.toml b/acvm-repo/bn254_blackbox_solver/Cargo.toml index b261be65735..931952343d4 100644 --- a/acvm-repo/bn254_blackbox_solver/Cargo.toml +++ b/acvm-repo/bn254_blackbox_solver/Cargo.toml @@ -15,7 +15,6 @@ repository.workspace = true [dependencies] acir.workspace = true acvm_blackbox_solver.workspace = true -thiserror.workspace = true cfg-if = "1.0.0" hex.workspace = true lazy_static = "1.4" @@ -26,19 +25,6 @@ ark-ec = { version = "^0.4.0", default-features = false } ark-ff = { version = "^0.4.0", default-features = false } num-bigint.workspace = true -[target.'cfg(target_arch = "wasm32")'.dependencies] -wasmer = { version = "4.2.6", default-features = false, features = [ - "js-default", -] } - -getrandom = { workspace = true, features = ["js"] } -wasm-bindgen-futures.workspace = true -js-sys.workspace = true - -[target.'cfg(not(target_arch = "wasm32"))'.dependencies] -getrandom.workspace = true -wasmer = "4.2.6" - [dev-dependencies] ark-std = { version = "^0.4.0", default-features = false } criterion = "0.5.0" diff --git a/acvm-repo/bn254_blackbox_solver/src/lib.rs b/acvm-repo/bn254_blackbox_solver/src/lib.rs index ae6fb7999a0..6610b04fdc0 100644 --- a/acvm-repo/bn254_blackbox_solver/src/lib.rs +++ b/acvm-repo/bn254_blackbox_solver/src/lib.rs @@ -2,25 +2,20 @@ #![warn(clippy::semicolon_if_nothing_returned)] #![cfg_attr(not(test), warn(unused_crate_dependencies, unused_extern_crates))] -use acir::{BlackBoxFunc, FieldElement}; +use acir::FieldElement; use acvm_blackbox_solver::{BlackBoxFunctionSolver, BlackBoxResolutionError}; mod embedded_curve_ops; mod generator; mod pedersen; mod poseidon2; -mod wasm; +mod schnorr; use ark_ec::AffineRepr; pub use embedded_curve_ops::{embedded_curve_add, multi_scalar_mul}; pub use poseidon2::poseidon2_permutation; -use wasm::Barretenberg; -use self::wasm::SchnorrSig; - -pub struct Bn254BlackBoxSolver { - blackbox_vendor: Barretenberg, -} +pub struct Bn254BlackBoxSolver; impl Bn254BlackBoxSolver { pub async fn initialize() -> Bn254BlackBoxSolver { @@ -38,8 +33,7 @@ impl Bn254BlackBoxSolver { #[cfg(not(target_arch = "wasm32"))] pub fn new() -> Bn254BlackBoxSolver { - let blackbox_vendor = Barretenberg::new(); - Bn254BlackBoxSolver { blackbox_vendor } + Bn254BlackBoxSolver } } @@ -58,16 +52,16 @@ impl BlackBoxFunctionSolver for Bn254BlackBoxSolver { signature: &[u8; 64], message: &[u8], ) -> Result { - let pub_key_bytes: Vec = - public_key_x.to_be_bytes().iter().copied().chain(public_key_y.to_be_bytes()).collect(); - - let pub_key: [u8; 64] = pub_key_bytes.try_into().unwrap(); let sig_s: [u8; 32] = signature[0..32].try_into().unwrap(); let sig_e: [u8; 32] = signature[32..64].try_into().unwrap(); - self.blackbox_vendor.verify_signature(pub_key, sig_s, sig_e, message).map_err(|err| { - BlackBoxResolutionError::Failed(BlackBoxFunc::SchnorrVerify, err.to_string()) - }) + Ok(schnorr::verify_signature( + public_key_x.into_repr(), + public_key_y.into_repr(), + sig_s, + sig_e, + message, + )) } fn pedersen_commitment( diff --git a/acvm-repo/bn254_blackbox_solver/src/schnorr/mod.rs b/acvm-repo/bn254_blackbox_solver/src/schnorr/mod.rs new file mode 100644 index 00000000000..8950317aba4 --- /dev/null +++ b/acvm-repo/bn254_blackbox_solver/src/schnorr/mod.rs @@ -0,0 +1,66 @@ +use acvm_blackbox_solver::blake2s; +use ark_ec::{ + short_weierstrass::{Affine, SWCurveConfig}, + AffineRepr, CurveConfig, CurveGroup, +}; +use ark_ff::{BigInteger, PrimeField, Zero}; +use grumpkin::{Fq, GrumpkinParameters}; + +pub(crate) fn verify_signature( + pub_key_x: Fq, + pub_key_y: Fq, + sig_s_bytes: [u8; 32], + sig_e_bytes: [u8; 32], + message: &[u8], +) -> bool { + let pub_key = Affine::::new_unchecked(pub_key_x, pub_key_y); + + // TODO: Check for correct subgroup isn't done in Barretenberg, is it necessary? + if !pub_key.is_on_curve() + || !pub_key.is_in_correct_subgroup_assuming_on_curve() + || pub_key.is_zero() + { + return false; + } + + let sig_s = + ::ScalarField::from_be_bytes_mod_order(&sig_s_bytes); + let sig_e = + ::ScalarField::from_be_bytes_mod_order(&sig_e_bytes); + + if sig_s.is_zero() || sig_e.is_zero() { + return false; + } + + // R = g^{sig.s} • pub^{sig.e} + let r = pub_key * sig_e + GrumpkinParameters::GENERATOR * sig_s; + if r.is_zero() { + // this result implies k == 0, which would be catastrophic for the prover. + // it is a cheap check that ensures this doesn't happen. + return false; + } + + // compare the _hashes_ rather than field elements modulo r + // e = H(pedersen(r, pk.x, pk.y), m), where r = x(R) + let target_e_bytes = schnorr_generate_challenge(message, pub_key, r.into_affine()); + + sig_e_bytes == target_e_bytes +} + +fn schnorr_generate_challenge( + message: &[u8], + pubkey: Affine, + r: Affine, +) -> [u8; 32] { + // create challenge message pedersen_commitment(R.x, pubkey) + + let pedersen_hash = crate::pedersen::hash::hash_with_index( + &[*r.x().unwrap(), *pubkey.x().unwrap(), *pubkey.y().unwrap()], + 0, + ); + + let mut hash_input: Vec = pedersen_hash.into_bigint().to_bytes_be(); + hash_input.extend(message); + + blake2s(&hash_input).unwrap() +} diff --git a/acvm-repo/bn254_blackbox_solver/src/wasm/acvm_backend.wasm b/acvm-repo/bn254_blackbox_solver/src/wasm/acvm_backend.wasm deleted file mode 100755 index bcf3bbf27ee..00000000000 Binary files a/acvm-repo/bn254_blackbox_solver/src/wasm/acvm_backend.wasm and /dev/null differ diff --git a/acvm-repo/bn254_blackbox_solver/src/wasm/mod.rs b/acvm-repo/bn254_blackbox_solver/src/wasm/mod.rs deleted file mode 100644 index e0a5c4c9069..00000000000 --- a/acvm-repo/bn254_blackbox_solver/src/wasm/mod.rs +++ /dev/null @@ -1,332 +0,0 @@ -//! ACVM execution is independent of the proving backend against which the ACIR code is being proven. -//! However there are currently a few opcodes for which there is currently no rust implementation so we must -//! use the C++ implementations included in Aztec Lab's Barretenberg library. -//! -//! As [`acvm`] includes rust implementations for these opcodes, this module can be removed. - -mod schnorr; - -pub(crate) use schnorr::SchnorrSig; - -/// The number of bytes necessary to store a `FieldElement`. -const FIELD_BYTES: usize = 32; - -#[derive(Debug, thiserror::Error)] -pub(crate) enum Error { - #[error(transparent)] - FromFeature(#[from] FeatureError), -} - -#[derive(Debug, thiserror::Error)] -pub(crate) enum FeatureError { - #[error("Trying to call {name} resulted in an error")] - FunctionCallFailed { name: String, source: wasmer::RuntimeError }, - #[error("Could not find function export named {name}")] - InvalidExport { name: String, source: wasmer::ExportError }, - #[error("No value available when value was expected")] - NoValue, - #[error("Value expected to be i32")] - InvalidI32, - #[error("Could not convert value {value} from i32 to u32")] - InvalidU32 { value: i32, source: std::num::TryFromIntError }, - #[error("Could not convert value {value} from i32 to usize")] - InvalidUsize { value: i32, source: std::num::TryFromIntError }, - #[error("Value expected to be 0 or 1 representing a boolean")] - InvalidBool, -} -#[derive(Debug, thiserror::Error)] -#[error(transparent)] -pub(crate) struct BackendError(#[from] Error); - -impl From for BackendError { - fn from(value: FeatureError) -> Self { - BackendError(Error::FromFeature(value)) - } -} - -#[derive(Debug)] -pub(crate) struct Barretenberg { - store: std::cell::RefCell, - memory: wasmer::Memory, - instance: wasmer::Instance, -} - -use std::cell::RefCell; - -use wasmer::{ - imports, Function, FunctionEnv, FunctionEnvMut, Imports, Instance, Memory, MemoryType, Store, - Value, WasmPtr, -}; - -/// The number of bytes necessary to represent a pointer to memory inside the wasm. -// pub(super) const POINTER_BYTES: usize = 4; - -/// The Barretenberg WASM gives us 1024 bytes of scratch space which we can use without -/// needing to allocate/free it ourselves. This can be useful for when we need to pass in several small variables -/// when calling functions on the wasm, however it's important to not overrun this scratch space as otherwise -/// the written data will begin to corrupt the stack. -/// -/// Using this scratch space isn't particularly safe if we have multiple threads interacting with the wasm however, -/// each thread could write to the same pointer address simultaneously. -pub(super) const WASM_SCRATCH_BYTES: usize = 1024; - -/// Embed the Barretenberg WASM file -const WASM_BIN: &[u8] = include_bytes!("./acvm_backend.wasm"); - -impl Barretenberg { - #[cfg(not(target_arch = "wasm32"))] - pub(crate) fn new() -> Barretenberg { - let (instance, memory, store) = instance_load(); - let barretenberg = Barretenberg { memory, instance, store: RefCell::new(store) }; - barretenberg.call_wasi_initialize(); - barretenberg - } - - #[cfg(target_arch = "wasm32")] - pub(crate) async fn initialize() -> Barretenberg { - let (instance, memory, store) = instance_load().await; - let barretenberg = Barretenberg { memory, instance, store: RefCell::new(store) }; - barretenberg.call_wasi_initialize(); - barretenberg - } - /// Call initialization function for WASI, to initialize all of the appropriate - /// globals. - fn call_wasi_initialize(&self) { - self.call_multiple("_initialize", vec![]) - .expect("expected call to WASI initialization function to not fail"); - } -} - -/// A wrapper around the arguments or return value from a WASM call. -/// Notice, `Option` is used because not every call returns a value, -/// some calls are simply made to free a pointer or manipulate the heap. -#[derive(Debug, Clone)] -pub(crate) struct WASMValue(Option); - -impl From for WASMValue { - fn from(value: usize) -> Self { - WASMValue(Some(Value::I32(value as i32))) - } -} - -impl From for WASMValue { - fn from(value: u32) -> Self { - WASMValue(Some(Value::I32(value as i32))) - } -} - -impl From for WASMValue { - fn from(value: i32) -> Self { - WASMValue(Some(Value::I32(value))) - } -} - -impl From for WASMValue { - fn from(value: Value) -> Self { - WASMValue(Some(value)) - } -} - -impl TryFrom for bool { - type Error = FeatureError; - - fn try_from(value: WASMValue) -> Result { - match value.try_into()? { - 0 => Ok(false), - 1 => Ok(true), - _ => Err(FeatureError::InvalidBool), - } - } -} - -impl TryFrom for usize { - type Error = FeatureError; - - fn try_from(value: WASMValue) -> Result { - let value: i32 = value.try_into()?; - value.try_into().map_err(|source| FeatureError::InvalidUsize { value, source }) - } -} - -impl TryFrom for u32 { - type Error = FeatureError; - - fn try_from(value: WASMValue) -> Result { - let value = value.try_into()?; - u32::try_from(value).map_err(|source| FeatureError::InvalidU32 { value, source }) - } -} - -impl TryFrom for i32 { - type Error = FeatureError; - - fn try_from(value: WASMValue) -> Result { - value.0.map_or(Err(FeatureError::NoValue), |val| val.i32().ok_or(FeatureError::InvalidI32)) - } -} - -impl TryFrom for Value { - type Error = FeatureError; - - fn try_from(value: WASMValue) -> Result { - value.0.ok_or(FeatureError::NoValue) - } -} - -impl Barretenberg { - /// Transfer bytes to WASM heap - // TODO: Consider making this Result-returning - pub(crate) fn transfer_to_heap(&self, data: &[u8], offset: usize) { - let memory = &self.memory; - let store = self.store.borrow(); - let memory_view = memory.view(&store); - - memory_view.write(offset as u64, data).unwrap(); - } - - // TODO: Consider making this Result-returning - pub(crate) fn read_memory(&self, start: usize) -> [u8; SIZE] { - self.read_memory_variable_length(start, SIZE) - .try_into() - .expect("Read memory should be of the specified length") - } - - // TODO: Consider making this Result-returning - pub(crate) fn read_memory_variable_length(&self, offset: usize, length: usize) -> Vec { - let memory = &self.memory; - let store = &self.store.borrow(); - let memory_view = memory.view(&store); - - let mut buf = vec![0; length]; - - memory_view.read(offset as u64, &mut buf).unwrap(); - buf - } - - pub(crate) fn call_multiple( - &self, - name: &str, - params: Vec<&WASMValue>, - ) -> Result { - // We take in a reference to values, since they do not implement Copy. - // We then clone them inside of this function, so that the API does not have a bunch of Clones everywhere - - let mut args: Vec = vec![]; - for param in params.into_iter().cloned() { - args.push(param.try_into()?); - } - let func = self - .instance - .exports - .get_function(name) - .map_err(|source| FeatureError::InvalidExport { name: name.to_string(), source })?; - let boxed_value = func.call(&mut self.store.borrow_mut(), &args).map_err(|source| { - FeatureError::FunctionCallFailed { name: name.to_string(), source } - })?; - let option_value = boxed_value.first().cloned(); - - Ok(WASMValue(option_value)) - } -} - -fn init_memory_and_state() -> (Memory, Store, Imports) { - let mut store = Store::default(); - - let mem_type = MemoryType::new(18, Some(65536), false); - let memory = Memory::new(&mut store, mem_type).unwrap(); - - let function_env = FunctionEnv::new(&mut store, memory.clone()); - let custom_imports = imports! { - "env" => { - "logstr" => Function::new_typed_with_env( - &mut store, - &function_env, - logstr, - ), - "memory" => memory.clone(), - }, - "wasi_snapshot_preview1" => { - "proc_exit" => Function::new_typed(&mut store, proc_exit), - "random_get" => Function::new_typed_with_env( - &mut store, - &function_env, - random_get - ), - }, - }; - - (memory, store, custom_imports) -} - -#[cfg(not(target_arch = "wasm32"))] -fn instance_load() -> (Instance, Memory, Store) { - use wasmer::Module; - - let (memory, mut store, custom_imports) = init_memory_and_state(); - - let module = Module::new(&store, WASM_BIN).unwrap(); - - (Instance::new(&mut store, &module, &custom_imports).unwrap(), memory, store) -} - -#[cfg(target_arch = "wasm32")] -async fn instance_load() -> (Instance, Memory, Store) { - use js_sys::WebAssembly::{self}; - use wasmer::AsJs; - - let (memory, mut store, custom_imports) = init_memory_and_state(); - - let js_bytes = unsafe { js_sys::Uint8Array::view(&WASM_BIN) }; - let js_module_promise = WebAssembly::compile(&js_bytes); - let js_module: js_sys::WebAssembly::Module = - wasm_bindgen_futures::JsFuture::from(js_module_promise).await.unwrap().into(); - - let js_instance_promise = - WebAssembly::instantiate_module(&js_module, &custom_imports.as_jsvalue(&store).into()); - let js_instance = wasm_bindgen_futures::JsFuture::from(js_instance_promise).await.unwrap(); - let module = wasmer::Module::from((js_module, WASM_BIN)); - let instance: wasmer::Instance = Instance::from_jsvalue(&mut store, &module, &js_instance) - .map_err(|_| "Error while creating BlackBox Functions vendor instance") - .unwrap(); - - (instance, memory, store) -} - -fn logstr(mut env: FunctionEnvMut, ptr: i32) { - let (memory, store) = env.data_and_store_mut(); - let memory_view = memory.view(&store); - - let log_str_wasm_ptr: WasmPtr = WasmPtr::new(ptr as u32); - - match log_str_wasm_ptr.read_utf8_string_with_nul(&memory_view) { - Ok(log_string) => println!("{log_string}"), - Err(err) => println!("Error while reading log string from memory: {err}"), - }; -} - -// Based on https://github.com/wasmerio/wasmer/blob/2.3.0/lib/wasi/src/syscalls/mod.rs#L2537 -fn random_get(mut env: FunctionEnvMut, buf_ptr: i32, buf_len: i32) -> i32 { - let mut u8_buffer = vec![0; buf_len as usize]; - let res = getrandom::getrandom(&mut u8_buffer); - match res { - Ok(()) => { - let (memory, store) = env.data_and_store_mut(); - let memory_view = memory.view(&store); - match memory_view.write(buf_ptr as u64, u8_buffer.as_mut_slice()) { - Ok(_) => { - 0_i32 // __WASI_ESUCCESS - } - Err(_) => { - 29_i32 // __WASI_EIO - } - } - } - Err(_) => { - 29_i32 // __WASI_EIO - } - } -} - -fn proc_exit(_: i32) { - unimplemented!("proc_exit is not implemented") -} diff --git a/acvm-repo/bn254_blackbox_solver/src/wasm/schnorr.rs b/acvm-repo/bn254_blackbox_solver/src/wasm/schnorr.rs deleted file mode 100644 index 18c4f04ef64..00000000000 --- a/acvm-repo/bn254_blackbox_solver/src/wasm/schnorr.rs +++ /dev/null @@ -1,104 +0,0 @@ -use super::{Barretenberg, Error, FIELD_BYTES, WASM_SCRATCH_BYTES}; - -pub(crate) trait SchnorrSig { - fn construct_signature( - &self, - message: &[u8], - private_key: [u8; 32], - ) -> Result<([u8; 32], [u8; 32]), Error>; - fn construct_public_key(&self, private_key: [u8; 32]) -> Result<[u8; 64], Error>; - fn verify_signature( - &self, - pub_key: [u8; 64], - sig_s: [u8; 32], - sig_e: [u8; 32], - message: &[u8], - ) -> Result; -} - -impl SchnorrSig for Barretenberg { - fn construct_signature( - &self, - message: &[u8], - private_key: [u8; 32], - ) -> Result<([u8; 32], [u8; 32]), Error> { - let sig_s_ptr: usize = 0; - let sig_e_ptr: usize = sig_s_ptr + FIELD_BYTES; - let private_key_ptr: usize = sig_e_ptr + FIELD_BYTES; - let message_ptr: usize = private_key_ptr + private_key.len(); - assert!( - message_ptr + message.len() < WASM_SCRATCH_BYTES, - "Message overran wasm scratch space" - ); - - self.transfer_to_heap(&private_key, private_key_ptr); - self.transfer_to_heap(message, message_ptr); - self.call_multiple( - "construct_signature", - vec![ - &message_ptr.into(), - &message.len().into(), - &private_key_ptr.into(), - &sig_s_ptr.into(), - &sig_e_ptr.into(), - ], - )?; - - let sig_s: [u8; FIELD_BYTES] = self.read_memory(sig_s_ptr); - let sig_e: [u8; FIELD_BYTES] = self.read_memory(sig_e_ptr); - - Ok((sig_s, sig_e)) - } - - #[allow(dead_code)] - fn construct_public_key(&self, private_key: [u8; 32]) -> Result<[u8; 64], Error> { - let private_key_ptr: usize = 0; - let result_ptr: usize = private_key_ptr + FIELD_BYTES; - - self.transfer_to_heap(&private_key, private_key_ptr); - - self.call_multiple( - "compute_public_key", - vec![&private_key_ptr.into(), &result_ptr.into()], - )?; - - Ok(self.read_memory(result_ptr)) - } - - fn verify_signature( - &self, - pub_key: [u8; 64], - sig_s: [u8; 32], - sig_e: [u8; 32], - message: &[u8], - ) -> Result { - let public_key_ptr: usize = 0; - let sig_s_ptr: usize = public_key_ptr + pub_key.len(); - let sig_e_ptr: usize = sig_s_ptr + sig_s.len(); - let message_ptr: usize = sig_e_ptr + sig_e.len(); - assert!( - message_ptr + message.len() < WASM_SCRATCH_BYTES, - "Message overran wasm scratch space" - ); - - self.transfer_to_heap(&pub_key, public_key_ptr); - self.transfer_to_heap(&sig_s, sig_s_ptr); - self.transfer_to_heap(&sig_e, sig_e_ptr); - self.transfer_to_heap(message, message_ptr); - - let verified = self.call_multiple( - "verify_signature", - vec![ - &message_ptr.into(), - &message.len().into(), - &public_key_ptr.into(), - &sig_s_ptr.into(), - &sig_e_ptr.into(), - ], - )?; - - // Note, currently for Barretenberg plonk, if the signature fails - // then the whole circuit fails. - Ok(verified.try_into()?) - } -}