diff --git a/arbitrator/Cargo.lock b/arbitrator/Cargo.lock index 6a0042b3d..c37bb39ee 100644 --- a/arbitrator/Cargo.lock +++ b/arbitrator/Cargo.lock @@ -28,6 +28,18 @@ dependencies = [ "version_check", ] +[[package]] +name = "ahash" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "0.7.19" @@ -62,6 +74,123 @@ dependencies = [ "sha3 0.10.8", ] +[[package]] +name = "ark-bn254" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a22f4561524cd949590d78d7d4c5df8f592430d221f7f3c9497bbafd8972120f" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-std", +] + +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", + "itertools", + "num-traits", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm", + "ark-ff-macros", + "ark-serialize", + "ark-std", + "derivative", + "digest 0.10.7", + "itertools", + "num-bigint", + "num-traits", + "paste", + "rustc_version", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.76", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.76", +] + +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-serialize-derive", + "ark-std", + "digest 0.10.7", + "num-bigint", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.76", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand", +] + [[package]] name = "arrayvec" version = "0.7.1" @@ -95,11 +224,17 @@ dependencies = [ "cc", "cfg-if", "libc", - "miniz_oxide", + "miniz_oxide 0.5.3", "object 0.29.0", "rustc-demangle", ] +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + [[package]] name = "bincode" version = "1.3.3" @@ -393,6 +528,15 @@ version = "0.86.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed16b14363d929b8c37e3c557d0a7396791b383ecc302141643c054343170aad" +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + [[package]] name = "crossbeam-channel" version = "0.5.1" @@ -482,6 +626,17 @@ dependencies = [ "syn 1.0.76", ] +[[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.76", +] + [[package]] name = "digest" version = "0.9.0" @@ -501,6 +656,27 @@ dependencies = [ "crypto-common", ] +[[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-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 = "either" version = "1.6.1" @@ -580,12 +756,31 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" +[[package]] +name = "flate2" +version = "1.0.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +dependencies = [ + "crc32fast", + "miniz_oxide 0.7.3", +] + [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[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 = "fxhash" version = "0.2.1" @@ -607,9 +802,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.7" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -645,7 +840,16 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash", + "ahash 0.7.6", +] + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash 0.8.6", ] [[package]] @@ -684,6 +888,12 @@ 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 = "home" version = "0.5.9" @@ -699,6 +909,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "indenter" version = "0.3.3" @@ -833,9 +1053,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[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 = "libloading" @@ -847,6 +1067,16 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags 2.4.1", + "libc", +] + [[package]] name = "linux-raw-sys" version = "0.4.12" @@ -933,6 +1163,15 @@ dependencies = [ "adler", ] +[[package]] +name = "miniz_oxide" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" +dependencies = [ + "adler", +] + [[package]] name = "more-asserts" version = "0.2.2" @@ -961,6 +1200,16 @@ dependencies = [ "num-traits", ] +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num" version = "0.4.0" @@ -1098,6 +1347,12 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + [[package]] name = "ouroboros" version = "0.16.0" @@ -1122,6 +1377,12 @@ dependencies = [ "syn 2.0.45", ] +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + [[package]] name = "parking_lot" version = "0.11.2" @@ -1170,12 +1431,24 @@ dependencies = [ "windows-sys 0.36.1", ] +[[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 = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + [[package]] name = "pest" version = "2.3.0" @@ -1192,6 +1465,12 @@ version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + [[package]] name = "prettyplease" version = "0.2.9" @@ -1250,6 +1529,11 @@ name = "prover" version = "0.1.0" dependencies = [ "arbutil", + "ark-bn254", + "ark-ec", + "ark-ff", + "ark-serialize", + "ark-std", "bincode", "brotli2", "c-kzg", @@ -1262,7 +1546,9 @@ dependencies = [ "nom", "nom-leb128", "num", + "num-bigint", "rayon", + "rust-kzg-bn254", "rustc-demangle", "serde", "serde_json", @@ -1311,6 +1597,18 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[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", ] @@ -1319,6 +1617,9 @@ name = "rand_core" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +dependencies = [ + "getrandom", +] [[package]] name = "rand_pcg" @@ -1363,6 +1664,17 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "redox_users" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" +dependencies = [ + "getrandom", + "libredox", + "thiserror", +] + [[package]] name = "regalloc2" version = "0.3.2" @@ -1413,6 +1725,21 @@ dependencies = [ "bytecheck", ] +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "spin", + "untrusted", + "windows-sys 0.52.0", +] + [[package]] name = "rkyv" version = "0.7.39" @@ -1439,6 +1766,32 @@ dependencies = [ "syn 1.0.76", ] +[[package]] +name = "rust-kzg-bn254" +version = "0.1.0" +source = "git+https://github.com/afkbyte/rust-kzg-bn254.git?branch=master#56890afb8ab9bb5c289baa6b7899d274e4ab9d19" +dependencies = [ + "ark-bn254", + "ark-ec", + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "byteorder", + "crossbeam-channel", + "directories", + "hex-literal", + "num-bigint", + "num-traits", + "num_cpus", + "rand", + "rayon", + "sha2 0.10.8", + "tracing", + "tracing-subscriber", + "ureq", +] + [[package]] name = "rustc-demangle" version = "0.1.21" @@ -1473,6 +1826,37 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rustls" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" +dependencies = [ + "log", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" + +[[package]] +name = "rustls-webpki" +version = "0.102.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + [[package]] name = "rustversion" version = "1.0.6" @@ -1632,6 +2016,15 @@ dependencies = [ "keccak", ] +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + [[package]] name = "shlex" version = "1.2.0" @@ -1653,6 +2046,12 @@ dependencies = [ "serde", ] +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -1701,6 +2100,12 @@ dependencies = [ "syn 1.0.76", ] +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + [[package]] name = "syn" version = "1.0.76" @@ -1758,6 +2163,16 @@ dependencies = [ "syn 1.0.76", ] +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", +] + [[package]] name = "threadpool" version = "1.8.1" @@ -1767,6 +2182,21 @@ dependencies = [ "num_cpus", ] +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "toml_datetime" version = "0.6.3" @@ -1791,6 +2221,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d0ecdcb44a79f0fe9844f0c4f33a342cbcbb5117de8001e6ba0dc2351327d09" dependencies = [ "cfg-if", + "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -1809,11 +2240,37 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.26" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ - "lazy_static", + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "nu-ansi-term", + "sharded-slab", + "smallvec", + "thread_local", + "tracing-core", + "tracing-log", ] [[package]] @@ -1828,12 +2285,27 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" +[[package]] +name = "unicode-bidi" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" + [[package]] name = "unicode-ident" version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" +[[package]] +name = "unicode-normalization" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-segmentation" version = "1.8.0" @@ -1852,6 +2324,46 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "ureq" +version = "2.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d11a831e3c0b56e438a28308e7c810799e3c118417f342d30ecec080105395cd" +dependencies = [ + "base64", + "flate2", + "log", + "once_cell", + "rustls", + "rustls-pki-types", + "rustls-webpki", + "url", + "webpki-roots", +] + +[[package]] +name = "url" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + [[package]] name = "vec_map" version = "0.8.2" @@ -1860,9 +2372,9 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "version_check" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "wasi" @@ -2136,6 +2648,15 @@ dependencies = [ "wast", ] +[[package]] +name = "webpki-roots" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3de34ae270483955a94f4b21bdaaeb83d508bb84a01435f393818edb0012009" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "which" version = "4.4.2" @@ -2397,6 +2918,26 @@ dependencies = [ "memchr", ] +[[package]] +name = "zerocopy" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.45", +] + [[package]] name = "zeroize" version = "1.7.0" @@ -2415,4 +2956,4 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.45", -] \ No newline at end of file +] diff --git a/arbitrator/jit/src/gostack.rs b/arbitrator/jit/src/gostack.rs index 20b59a247..6434ed36f 100644 --- a/arbitrator/jit/src/gostack.rs +++ b/arbitrator/jit/src/gostack.rs @@ -29,7 +29,7 @@ impl MemoryViewContainer { store: &'a StoreRef, ) -> impl (for<'b> FnOnce(&'b Memory) -> MemoryView<'b>) + 'a { move |memory: &Memory| { - memory.view(&store.clone()) + memory.view(&store) } } diff --git a/arbitrator/prover/Cargo.toml b/arbitrator/prover/Cargo.toml index 51cbe8439..555cd63cf 100644 --- a/arbitrator/prover/Cargo.toml +++ b/arbitrator/prover/Cargo.toml @@ -30,6 +30,14 @@ smallvec = { version = "1.10.0", features = ["serde"] } arbutil = { path = "../arbutil/" } c-kzg = "0.4.0" # TODO: look into switching to rust-kzg (no crates.io release or hosted rustdoc yet) sha2 = "0.9.9" +ark-bn254 = "0.4.0" +ark-std = "0.4.0" +ark-ff = "0.4.0" +ark-ec = "0.4.0" +ark-serialize = "0.4.0" +num-bigint = "0.4" + +kzgbn254 = { git = "https://github.com/afkbyte/rust-kzg-bn254.git", branch = "master", package = "rust-kzg-bn254" } [lib] name = "prover" diff --git a/arbitrator/prover/src/kzgbn254.rs b/arbitrator/prover/src/kzgbn254.rs index f8fdf75ff..3d85791b0 100644 --- a/arbitrator/prover/src/kzgbn254.rs +++ b/arbitrator/prover/src/kzgbn254.rs @@ -1,17 +1,17 @@ use crate::utils::Bytes32; -// use ark_ec::{AffineRepr, CurveGroup,pairing::Pairing}; -// use kzgbn254::{ -// kzg::Kzg, -// blob::Blob, -// helpers::{remove_empty_byte_from_padded_bytes, to_fr_array} -// }; +use ark_ec::{AffineRepr, CurveGroup,pairing::Pairing}; +use kzgbn254::{ + kzg::Kzg, + blob::Blob, + helpers::{remove_empty_byte_from_padded_bytes, to_fr_array} +}; use eyre::{ensure, Result}; -// use ark_bn254::{Bn254, G1Affine, G1Projective, G2Affine}; +use ark_bn254::{Bn254, G1Affine, G1Projective, G2Affine}; use num::BigUint; use sha2::{Digest, Sha256}; use std::{convert::TryFrom, io::Write}; -// use ark_serialize::CanonicalSerialize; +use ark_serialize::CanonicalSerialize; use num::Zero; lazy_static::lazy_static! { @@ -21,13 +21,13 @@ lazy_static::lazy_static! { // srs_order = 268435456 // srs_points_to_load = 131072 - // pub static ref KZG: Kzg = Kzg::setup( - // "./arbitrator/prover/src/test-files/g1.point", - // "./arbitrator/prover/src/test-files/g2.point", - // "./arbitrator/prover/src/test-files/g2.point.powerOf2", - // 3000, - // 3000 - // ).unwrap(); + pub static ref KZG: Kzg = Kzg::setup( + "./arbitrator/prover/src/test-files/g1.point", + "./arbitrator/prover/src/test-files/g2.point", + "./arbitrator/prover/src/test-files/g2.point.powerOf2", + 3000, + 3000 + ).unwrap(); // modulus for the underlying field F_r of the elliptic curve // see https://docs.eigenlayer.xyz/eigenda/integrations-guides/dispersal/blob-serialization-requirements @@ -37,134 +37,134 @@ lazy_static::lazy_static! { pub static ref FIELD_ELEMENTS_PER_BLOB: usize = 65536; } -// pub fn prove_kzg_preimage_bn254( -// hash: Bytes32, -// preimage: &[u8], -// offset: u32, -// out: &mut impl Write, -// ) -> Result<()> { - -// let mut kzg = KZG.clone(); - -// // expand the roots of unity, should work as long as it's longer than chunk length and chunks -// // from my understanding the data_setup_mins pads both min_chunk_len and min_num_chunks to -// // the next power of 2 so we can load a max of 2048 from the test values here -// // then we can take the roots of unity we actually need (len polynomial) and pass them in -// // @anup, this is a really gross way to do this, pls tell better way -// kzg.data_setup_mins(1, 2048)?; - -// // we are expecting the preimage to be unpadded when turned into a blob function so need to unpad it first -// let unpadded_preimage_vec: Vec = remove_empty_byte_from_padded_bytes(preimage); -// let unpadded_preimage = unpadded_preimage_vec.as_slice(); - -// // repad it here, TODO: need to ask to change the interface for this -// let blob = Blob::from_bytes_and_pad(unpadded_preimage); -// let blob_polynomial = blob.to_polynomial().unwrap(); -// let blob_commitment = kzg.commit(&blob_polynomial).unwrap(); - -// let mut commitment_bytes = Vec::new(); -// blob_commitment.serialize_uncompressed(&mut commitment_bytes).unwrap(); - -// let mut expected_hash: Bytes32 = Sha256::digest(&*commitment_bytes).into(); -// expected_hash[0] = 1; - -// ensure!( -// hash == expected_hash, -// "Trying to prove versioned hash {} preimage but recomputed hash {}", -// hash, -// expected_hash, -// ); - -// ensure!( -// offset % 32 == 0, -// "Cannot prove blob preimage at unaligned offset {}", -// offset, -// ); - -// let offset_usize = usize::try_from(offset)?; -// let mut proving_offset = offset; - -// // address proving past end edge case later -// let proving_past_end = offset_usize >= preimage.len(); -// if proving_past_end { -// // Proving any offset proves the length which is all we need here, -// // because we're past the end of the preimage. -// proving_offset = 0; -// } +pub fn prove_kzg_preimage_bn254( + hash: Bytes32, + preimage: &[u8], + offset: u32, + out: &mut impl Write, +) -> Result<()> { + + let mut kzg = KZG.clone(); + + // expand the roots of unity, should work as long as it's longer than chunk length and chunks + // from my understanding the data_setup_mins pads both min_chunk_len and min_num_chunks to + // the next power of 2 so we can load a max of 2048 from the test values here + // then we can take the roots of unity we actually need (len polynomial) and pass them in + // @anup, this is a really gross way to do this, pls tell better way + kzg.data_setup_mins(1, 2048)?; + + // we are expecting the preimage to be unpadded when turned into a blob function so need to unpad it first + let unpadded_preimage_vec: Vec = remove_empty_byte_from_padded_bytes(preimage); + let unpadded_preimage = unpadded_preimage_vec.as_slice(); + + // repad it here, TODO: need to ask to change the interface for this + let blob = Blob::from_bytes_and_pad(unpadded_preimage); + let blob_polynomial = blob.to_polynomial().unwrap(); + let blob_commitment = kzg.commit(&blob_polynomial).unwrap(); + + let mut commitment_bytes = Vec::new(); + blob_commitment.serialize_uncompressed(&mut commitment_bytes).unwrap(); + + let mut expected_hash: Bytes32 = Sha256::digest(&*commitment_bytes).into(); + expected_hash[0] = 1; + + ensure!( + hash == expected_hash, + "Trying to prove versioned hash {} preimage but recomputed hash {}", + hash, + expected_hash, + ); + + ensure!( + offset % 32 == 0, + "Cannot prove blob preimage at unaligned offset {}", + offset, + ); + + let offset_usize = usize::try_from(offset)?; + let mut proving_offset = offset; + + // address proving past end edge case later + let proving_past_end = offset_usize >= preimage.len(); + if proving_past_end { + // Proving any offset proves the length which is all we need here, + // because we're past the end of the preimage. + proving_offset = 0; + } -// let proving_offset_bytes = proving_offset.to_le_bytes(); -// let mut padded_proving_offset_bytes = [0u8; 32]; -// padded_proving_offset_bytes[32 - proving_offset_bytes.len()..].copy_from_slice(&proving_offset_bytes); + let proving_offset_bytes = proving_offset.to_le_bytes(); + let mut padded_proving_offset_bytes = [0u8; 32]; + padded_proving_offset_bytes[32 - proving_offset_bytes.len()..].copy_from_slice(&proving_offset_bytes); -// // in production we will first need to perform an IFFT on the blob data to get the expected y value -// let mut proven_y = blob.get_blob_data(); -// let offset_usize = offset as usize; // Convert offset to usize -// proven_y = proven_y[offset_usize..(offset_usize + 32)].to_vec(); + // in production we will first need to perform an IFFT on the blob data to get the expected y value + let mut proven_y = blob.get_blob_data(); + let offset_usize = offset as usize; // Convert offset to usize + proven_y = proven_y[offset_usize..(offset_usize + 32)].to_vec(); -// let proven_y_fr = to_fr_array(&proven_y); + let proven_y_fr = to_fr_array(&proven_y); -// let polynomial = blob.to_polynomial().unwrap(); + let polynomial = blob.to_polynomial().unwrap(); -// let g2_generator = G2Affine::generator(); -// let z_g2= (g2_generator * proven_y_fr[0]).into_affine(); - -// let g2_tau: G2Affine = kzg.get_g2_points().get(1).unwrap().clone(); -// let g2_tau_minus_g2_z = (g2_tau - z_g2).into_affine(); - -// // required roots of unity are the first polynomial length roots in the expanded set -// let roots_of_unity = kzg.get_expanded_roots_of_unity(); -// let required_roots_of_unity = &roots_of_unity[0..polynomial.len()]; -// // TODO: ask for interface alignment later -// let kzg_proof = match kzg.compute_kzg_proof(&blob_polynomial, offset as u64, &required_roots_of_unity.to_vec()) { -// Ok(proof) => proof, -// Err(err) => return Err(err.into()), -// }; - -// let mut kzg_proof_uncompressed_bytes = Vec::new(); -// kzg_proof.serialize_uncompressed(&mut kzg_proof_uncompressed_bytes).unwrap(); - -// let xminusz_x0: BigUint = g2_tau_minus_g2_z.x.c0.into(); -// let xminusz_x1: BigUint = g2_tau_minus_g2_z.x.c1.into(); -// let xminusz_y0: BigUint = g2_tau_minus_g2_z.y.c0.into(); -// let xminusz_y1: BigUint = g2_tau_minus_g2_z.y.c1.into(); - -// // turn each element of xminusz into bytes, then pad each to 32 bytes, then append in order x1,x0,y1,y0 -// let mut xminusz_encoded_bytes = Vec::with_capacity(128); -// append_left_padded_biguint_be(&mut xminusz_encoded_bytes, &xminusz_x1); -// append_left_padded_biguint_be(&mut xminusz_encoded_bytes, &xminusz_x0); -// append_left_padded_biguint_be(&mut xminusz_encoded_bytes, &xminusz_y1); -// append_left_padded_biguint_be(&mut xminusz_encoded_bytes, &xminusz_y0); - -// // encode the commitment -// let commitment_x_bigint: BigUint = blob_commitment.x.into(); -// let commitment_y_bigint: BigUint = blob_commitment.y.into(); -// let mut commitment_encoded_bytes = Vec::with_capacity(32); -// append_left_padded_biguint_be(&mut commitment_encoded_bytes, &commitment_x_bigint); -// append_left_padded_biguint_be(&mut commitment_encoded_bytes, &commitment_y_bigint); - - -// // encode the proof -// let proof_x_bigint: BigUint = kzg_proof.x.into(); -// let proof_y_bigint: BigUint = kzg_proof.y.into(); -// let mut proof_encoded_bytes = Vec::with_capacity(64); -// append_left_padded_biguint_be(&mut proof_encoded_bytes, &proof_x_bigint); -// append_left_padded_biguint_be(&mut proof_encoded_bytes, &proof_y_bigint); - -// out.write_all(&*hash)?; // hash [:32] -// out.write_all(&padded_proving_offset_bytes)?; // evaluation point [32:64] -// out.write_all(&*proven_y)?; // expected output [64:96] -// out.write_all(&xminusz_encoded_bytes)?; // g2TauMinusG2z [96:224] -// out.write_all(&*commitment_encoded_bytes)?; // kzg commitment [224:288] -// out.write_all(&proof_encoded_bytes)?; // proof [288:352] + let g2_generator = G2Affine::generator(); + let z_g2= (g2_generator * proven_y_fr[0]).into_affine(); + + let g2_tau: G2Affine = kzg.get_g2_points().get(1).unwrap().clone(); + let g2_tau_minus_g2_z = (g2_tau - z_g2).into_affine(); + + // required roots of unity are the first polynomial length roots in the expanded set + let roots_of_unity = kzg.get_expanded_roots_of_unity(); + let required_roots_of_unity = &roots_of_unity[0..polynomial.len()]; + // TODO: ask for interface alignment later + let kzg_proof = match kzg.compute_kzg_proof(&blob_polynomial, offset as u64, &required_roots_of_unity.to_vec()) { + Ok(proof) => proof, + Err(err) => return Err(err.into()), + }; + + let mut kzg_proof_uncompressed_bytes = Vec::new(); + kzg_proof.serialize_uncompressed(&mut kzg_proof_uncompressed_bytes).unwrap(); + + let xminusz_x0: BigUint = g2_tau_minus_g2_z.x.c0.into(); + let xminusz_x1: BigUint = g2_tau_minus_g2_z.x.c1.into(); + let xminusz_y0: BigUint = g2_tau_minus_g2_z.y.c0.into(); + let xminusz_y1: BigUint = g2_tau_minus_g2_z.y.c1.into(); + + // turn each element of xminusz into bytes, then pad each to 32 bytes, then append in order x1,x0,y1,y0 + let mut xminusz_encoded_bytes = Vec::with_capacity(128); + append_left_padded_biguint_be(&mut xminusz_encoded_bytes, &xminusz_x1); + append_left_padded_biguint_be(&mut xminusz_encoded_bytes, &xminusz_x0); + append_left_padded_biguint_be(&mut xminusz_encoded_bytes, &xminusz_y1); + append_left_padded_biguint_be(&mut xminusz_encoded_bytes, &xminusz_y0); + + // encode the commitment + let commitment_x_bigint: BigUint = blob_commitment.x.into(); + let commitment_y_bigint: BigUint = blob_commitment.y.into(); + let mut commitment_encoded_bytes = Vec::with_capacity(32); + append_left_padded_biguint_be(&mut commitment_encoded_bytes, &commitment_x_bigint); + append_left_padded_biguint_be(&mut commitment_encoded_bytes, &commitment_y_bigint); + + + // encode the proof + let proof_x_bigint: BigUint = kzg_proof.x.into(); + let proof_y_bigint: BigUint = kzg_proof.y.into(); + let mut proof_encoded_bytes = Vec::with_capacity(64); + append_left_padded_biguint_be(&mut proof_encoded_bytes, &proof_x_bigint); + append_left_padded_biguint_be(&mut proof_encoded_bytes, &proof_y_bigint); + + out.write_all(&*hash)?; // hash [:32] + out.write_all(&padded_proving_offset_bytes)?; // evaluation point [32:64] + out.write_all(&*proven_y)?; // expected output [64:96] + out.write_all(&xminusz_encoded_bytes)?; // g2TauMinusG2z [96:224] + out.write_all(&*commitment_encoded_bytes)?; // kzg commitment [224:288] + out.write_all(&proof_encoded_bytes)?; // proof [288:352] -// Ok(()) -// } -// // Helper function to append BigUint bytes into the vector with padding; left padded big endian bytes to 32 -// fn append_left_padded_biguint_be(vec: &mut Vec, biguint: &BigUint) { -// let bytes = biguint.to_bytes_be(); -// let padding = 32 - bytes.len(); -// vec.extend_from_slice(&vec![0; padding]); -// vec.extend_from_slice(&bytes); -// } + Ok(()) +} +// Helper function to append BigUint bytes into the vector with padding; left padded big endian bytes to 32 +fn append_left_padded_biguint_be(vec: &mut Vec, biguint: &BigUint) { + let bytes = biguint.to_bytes_be(); + let padding = 32 - bytes.len(); + vec.extend_from_slice(&vec![0; padding]); + vec.extend_from_slice(&bytes); +} diff --git a/arbitrator/prover/src/machine.rs b/arbitrator/prover/src/machine.rs index e9f1b909f..849a419a2 100644 --- a/arbitrator/prover/src/machine.rs +++ b/arbitrator/prover/src/machine.rs @@ -5,7 +5,7 @@ use crate::{ binary::{parse, FloatInstruction, Local, NameCustomSection, WasmBinary}, host, kzg::prove_kzg_preimage, - // kzgbn254::prove_kzg_preimage_bn254, + kzgbn254::prove_kzg_preimage_bn254, memory::Memory, merkle::{Merkle, MerkleType}, reinterpret::{ReinterpretAsSigned, ReinterpretAsUnsigned}, @@ -2331,10 +2331,10 @@ impl Machine { } PreimageType::EigenDAHash => { // TODO - Add eigenDA kzg preimage verification here - // println!("Generating proof for EigenDA preimage"); - // prove_kzg_preimage_bn254(hash, &preimage, offset, &mut data) - // .expect("Failed to generate eigenDA KZG preimage proof"); - data.extend(preimage); + println!("Generating proof for EigenDA preimage"); + prove_kzg_preimage_bn254(hash, &preimage, offset, &mut data) + .expect("Failed to generate eigenDA KZG preimage proof"); + //data.extend(preimage); } } } else if next_inst.opcode == Opcode::ReadInboxMessage { @@ -2423,4 +2423,4 @@ impl Machine { eprintln!(" {} {} @ {}", module, func.mint(), pc.blue()); } } -} +} \ No newline at end of file diff --git a/arbitrator/prover/src/utils.rs b/arbitrator/prover/src/utils.rs index 694789055..b017d3987 100644 --- a/arbitrator/prover/src/utils.rs +++ b/arbitrator/prover/src/utils.rs @@ -3,18 +3,18 @@ use crate::kzg::ETHEREUM_KZG_SETTINGS; use arbutil::PreimageType; -// use ark_ec::AffineRepr; -// use ark_bn254::{Fr, G1Affine, G1Projective, G2Affine}; +use ark_ec::AffineRepr; +use ark_bn254::{Fr, G1Affine, G1Projective, G2Affine}; use c_kzg::{Blob, KzgCommitment}; -// use kzgbn254::{ -// kzg::Kzg as KzgBN254, -// blob::Blob as EigenDABlob, -// helpers::remove_empty_byte_from_padded_bytes, -// }; +use kzgbn254::{ + kzg::Kzg as KzgBN254, + blob::Blob as EigenDABlob, + helpers::remove_empty_byte_from_padded_bytes, +}; use digest::Digest; use eyre::{eyre, Result}; use serde::{Deserialize, Serialize}; -// use ark_serialize::CanonicalSerialize; +use ark_serialize::CanonicalSerialize; use sha2::Sha256; use sha3::Keccak256; use std::{ @@ -290,36 +290,35 @@ pub fn hash_preimage(preimage: &[u8], ty: PreimageType) -> Result<[u8; 32]> { Ok(commitment_hash) } PreimageType::EigenDAHash => { - Ok(Sha256::digest(preimage).into()) - - // let kzg_bn254: KzgBN254 = KzgBN254::setup( - // "./arbitrator/prover/src/test-files/g1.point", - // "./arbitrator/prover/src/test-files/g2.point", - // "./arbitrator/prover/src/test-files/g2.point.powerOf2", - // 3000, - // 3000 - // ).unwrap(); - - // // we are expecting the preimage to be unpadded when turned into a blob function so need to unpad it first - // let unpadded_preimage_vec = remove_empty_byte_from_padded_bytes(preimage); - // let unpadded_preimage = unpadded_preimage_vec.as_slice(); - - // // repad it here, TODO: need to ask to change the interface for this - // let blob = EigenDABlob::from_bytes_and_pad(unpadded_preimage); + + let kzg_bn254: KzgBN254 = KzgBN254::setup( + "./arbitrator/prover/src/test-files/g1.point", + "./arbitrator/prover/src/test-files/g2.point", + "./arbitrator/prover/src/test-files/g2.point.powerOf2", + 3000, + 3000 + ).unwrap(); + + // we are expecting the preimage to be unpadded when turned into a blob function so need to unpad it first + let unpadded_preimage_vec = remove_empty_byte_from_padded_bytes(preimage); + let unpadded_preimage = unpadded_preimage_vec.as_slice(); + + // repad it here, TODO: need to ask to change the interface for this + let blob = EigenDABlob::from_bytes_and_pad(unpadded_preimage); - // let commitment = kzg_bn254.blob_to_kzg_commitment(&blob).unwrap(); + let commitment = kzg_bn254.blob_to_kzg_commitment(&blob).unwrap(); - // let mut commitment_bytes = Vec::new(); - // commitment.serialize_uncompressed(&mut commitment_bytes).unwrap(); + let mut commitment_bytes = Vec::new(); + commitment.serialize_uncompressed(&mut commitment_bytes).unwrap(); - // let mut commitment_hash: [u8; 32] = Sha256::digest(&commitment_bytes).into(); - // commitment_hash[0] = 1; + let mut commitment_hash: [u8; 32] = Sha256::digest(&commitment_bytes).into(); + commitment_hash[0] = 1; - // println!("commitment_hash UTILS.rs: {:?}", commitment_hash); + println!("commitment_hash UTILS.rs: {:?}", commitment_hash); - // Ok(commitment_hash) + Ok(commitment_hash) //Ok(Sha256::digest(preimage).into()) } } -} +} \ No newline at end of file diff --git a/nitro-testnode b/nitro-testnode index 3922df9ca..05587bc61 160000 --- a/nitro-testnode +++ b/nitro-testnode @@ -1 +1 @@ -Subproject commit 3922df9caf7a65dd4168b8158c1244c5fe88780e +Subproject commit 05587bc6169ef9b5ba2a800ac41c578777941bad