diff --git a/Cargo.lock b/Cargo.lock index e1bc51e6..966b7eba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -133,15 +133,6 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" -[[package]] -name = "arrayvec" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" -dependencies = [ - "nodrop", -] - [[package]] name = "arrayvec" version = "0.5.2" @@ -175,22 +166,22 @@ version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28" dependencies = [ - "concurrent-queue", + "concurrent-queue 1.2.4", "event-listener", "futures-core", ] [[package]] name = "async-executor" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "871f9bb5e0a22eeb7e8cf16641feb87c9dc67032ccf8ff49e772eb9941d3a965" +checksum = "17adb73da160dfb475c183343c8cccd80721ea5a605d3eb57125f0a7b7a92d0b" dependencies = [ + "async-lock", "async-task", - "concurrent-queue", + "concurrent-queue 2.0.0", "fastrand", "futures-lite", - "once_cell", "slab", ] @@ -217,7 +208,7 @@ checksum = "e8121296a9f05be7f34aa4196b1747243b3b62e048bb7906f644f3fbfc490cf7" dependencies = [ "async-lock", "autocfg", - "concurrent-queue", + "concurrent-queue 1.2.4", "futures-lite", "libc", "log", @@ -329,9 +320,9 @@ dependencies = [ [[package]] name = "asynchronous-codec" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0de5164e5edbf51c45fb8c2d9664ae1c095cce1b265ecf7569093c0d66ef690" +checksum = "06a0daa378f5fd10634e44b0a29b2a87b890657658e072a30d6f26e57ddee182" dependencies = [ "bytes", "futures-sink", @@ -547,16 +538,6 @@ dependencies = [ "digest 0.10.5", ] -[[package]] -name = "blake2-rfc" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" -dependencies = [ - "arrayvec 0.4.12", - "constant_time_eq", -] - [[package]] name = "blake2b_simd" version = "1.0.0" @@ -776,9 +757,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.74" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581f5dba903aac52ea3feb5ec4810848460ee833876f1f9b0fdeab1f19091574" +checksum = "76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f" dependencies = [ "jobserver", ] @@ -946,13 +927,13 @@ dependencies = [ [[package]] name = "clap" -version = "4.0.18" +version = "4.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "335867764ed2de42325fafe6d18b8af74ba97ee0c590fa016f157535b42ab04b" +checksum = "91b9970d7505127a162fdaa9b96428d28a479ba78c9ec7550a63a5d9863db682" dependencies = [ "atty", "bitflags", - "clap_derive 4.0.18", + "clap_derive 4.0.21", "clap_lex 0.3.0", "once_cell", "strsim", @@ -974,9 +955,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.0.18" +version = "4.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16a1b0f6422af32d5da0c58e2703320f379216ee70198241c84173a8c5ac28f3" +checksum = "0177313f9f02afc995627906bbd8967e2be069f5261954222dac78290c2b9014" dependencies = [ "heck", "proc-macro-error", @@ -1101,6 +1082,15 @@ dependencies = [ "cache-padded", ] +[[package]] +name = "concurrent-queue" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd7bef69dc86e3c610e4e7aed41035e2a7ed12e72dd7530f61327a6579a4390b" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "console" version = "0.14.1" @@ -1192,18 +1182,18 @@ dependencies = [ [[package]] name = "cranelift-bforest" -version = "0.88.1" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44409ccf2d0f663920cab563d2b79fcd6b2e9a2bcc6e929fef76c8f82ad6c17a" +checksum = "52056f6d0584484b57fa6c1a65c1fcb15f3780d8b6a758426d9e3084169b2ddd" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.88.1" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98de2018ad96eb97f621f7d6b900a0cc661aec8d02ea4a50e56ecb48e5a2fcaf" +checksum = "18fed94c8770dc25d01154c3ffa64ed0b3ba9d583736f305fed7beebe5d9cf74" dependencies = [ "arrayvec 0.7.2", "bumpalo", @@ -1221,33 +1211,33 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.88.1" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5287ce36e6c4758fbaf298bd1a8697ad97a4f2375a3d1b61142ea538db4877e5" +checksum = "1c451b81faf237d11c7e4f3165eeb6bac61112762c5cfe7b4c0fb7241474358f" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.88.1" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2855c24219e2f08827f3f4ffb2da92e134ae8d8ecc185b11ec8f9878cf5f588e" +checksum = "e7c940133198426d26128f08be2b40b0bd117b84771fd36798969c4d712d81fc" [[package]] name = "cranelift-entity" -version = "0.88.1" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b65673279d75d34bf11af9660ae2dbd1c22e6d28f163f5c72f4e1dc56d56103" +checksum = "87a0f1b2fdc18776956370cf8d9b009ded3f855350c480c1c52142510961f352" dependencies = [ "serde", ] [[package]] name = "cranelift-frontend" -version = "0.88.1" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed2b3d7a4751163f6c4a349205ab1b7d9c00eecf19dcea48592ef1f7688eefc" +checksum = "34897538b36b216cc8dd324e73263596d51b8cf610da6498322838b2546baf8a" dependencies = [ "cranelift-codegen", "log", @@ -1257,15 +1247,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.88.1" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be64cecea9d90105fc6a2ba2d003e98c867c1d6c4c86cc878f97ad9fb916293" +checksum = "1b2629a569fae540f16a76b70afcc87ad7decb38dc28fa6c648ac73b51e78470" [[package]] name = "cranelift-native" -version = "0.88.1" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a03a6ac1b063e416ca4b93f6247978c991475e8271465340caa6f92f3c16a4" +checksum = "20937dab4e14d3e225c5adfc9c7106bafd4ac669bdb43027b911ff794c6fb318" dependencies = [ "cranelift-codegen", "libc", @@ -1274,9 +1264,9 @@ dependencies = [ [[package]] name = "cranelift-wasm" -version = "0.88.1" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c699873f7b30bc5f20dd03a796b4183e073a46616c91704792ec35e45d13f913" +checksum = "80fc2288957a94fd342a015811479de1837850924166d1f1856d8406e6f3609b" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -1448,9 +1438,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.80" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b7d4e43b25d3c994662706a1d4fcfc32aaa6afd287502c111b237093bb23f3a" +checksum = "97abf9f0eca9e52b7f81b945524e76710e6cb2366aead23b7d4fbf72e281f888" dependencies = [ "cc", "cxxbridge-flags", @@ -1460,9 +1450,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.80" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84f8829ddc213e2c1368e51a2564c552b65a8cb6a28f31e576270ac81d5e5827" +checksum = "7cc32cc5fea1d894b77d269ddb9f192110069a8a9c1f1d441195fba90553dea3" dependencies = [ "cc", "codespan-reporting", @@ -1475,15 +1465,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.80" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e72537424b474af1460806647c41d4b6d35d09ef7fe031c5c2fa5766047cc56a" +checksum = "8ca220e4794c934dc6b1207c3b42856ad4c302f2df1712e9f8d2eec5afaacf1f" [[package]] name = "cxxbridge-macro" -version = "1.0.80" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "309e4fb93eed90e1e14bea0da16b209f81813ba9fc7830c20ed151dd7bc0a4d7" +checksum = "b846f081361125bfc8dc9d3940c84e1fd83ba54bbca7b17cd29483c828be0704" dependencies = [ "proc-macro2", "quote", @@ -1657,7 +1647,7 @@ dependencies = [ [[package]] name = "dkg" -version = "0.1.0" +version = "0.2.0" dependencies = [ "chacha20 0.9.0", "ciphersuite", @@ -1677,7 +1667,7 @@ dependencies = [ [[package]] name = "dleq" -version = "0.1.2" +version = "0.2.0" dependencies = [ "blake2", "dalek-ff-group", @@ -1867,9 +1857,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.9.1" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c90bf5f19754d10198ccb95b70664fc925bd1fc090a0fd9a6ebc54acc8cd6272" +checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" dependencies = [ "atty", "humantime", @@ -2295,9 +2285,9 @@ dependencies = [ [[package]] name = "fastrlp-derive" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9e9158c1d8f0a7a716c9191562eaabba70268ba64972ef4871ce8d66fd08872" +checksum = "d6e454d03710df0cd95ce075d7731ce3fa35fb3779c15270cd491bc5f2ef9355" dependencies = [ "bytes", "proc-macro2", @@ -2406,7 +2396,7 @@ dependencies = [ [[package]] name = "flexible-transcript" -version = "0.1.3" +version = "0.2.0" dependencies = [ "blake2", "digest 0.10.5", @@ -2446,7 +2436,7 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "parity-scale-codec", ] @@ -2469,7 +2459,7 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "frame-support", "frame-system", @@ -2492,12 +2482,12 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "Inflector", "array-bytes", "chrono", - "clap 4.0.18", + "clap 4.0.22", "comfy-table", "frame-benchmarking", "frame-support", @@ -2533,6 +2523,7 @@ dependencies = [ "sp-keystore", "sp-runtime", "sp-state-machine", + "sp-std", "sp-storage", "sp-trie", "tempfile", @@ -2543,7 +2534,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "frame-support", "frame-system", @@ -2571,7 +2562,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "bitflags", "frame-metadata", @@ -2603,7 +2594,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "Inflector", "cfg-expr", @@ -2617,7 +2608,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -2629,7 +2620,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "proc-macro2", "quote", @@ -2639,7 +2630,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "frame-support", "log", @@ -2657,7 +2648,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "parity-scale-codec", "sp-api", @@ -3149,9 +3140,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.22" +version = "0.14.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abfba89e19b959ca163c7752ba59d737c1ceea53a5d31a149c805446fc958064" +checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c" dependencies = [ "bytes", "futures-channel", @@ -3562,6 +3553,16 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" +[[package]] +name = "io-lifetimes" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7d367024b3f3414d8e01f437f704f41a9f64ab36f9067fa73e526ad4c763c87" +dependencies = [ + "libc", + "windows-sys 0.42.0", +] + [[package]] name = "ip_network" version = "0.4.1" @@ -3582,9 +3583,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" +checksum = "f88c5561171189e69df9d98bcf18fd5f9558300f7ea7b801eb8a0fd748bd8745" [[package]] name = "itertools" @@ -3843,9 +3844,9 @@ checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" [[package]] name = "libloading" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" dependencies = [ "cfg-if", "winapi", @@ -3853,9 +3854,9 @@ dependencies = [ [[package]] name = "libm" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "292a948cd991e376cf75541fe5b97a1081d713c618b4f1b9500f8844e49eb565" +checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" [[package]] name = "libp2p" @@ -3951,7 +3952,7 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "lru 0.8.1", + "lru", "prost", "prost-build", "prost-codec", @@ -4304,6 +4305,12 @@ version = "0.0.46" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" +[[package]] +name = "linux-raw-sys" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb68f22743a3fb35785f1e7f844ca5a3de2dde5bd0c0ef5b372065814699b121" + [[package]] name = "lock_api" version = "0.4.9" @@ -4324,15 +4331,6 @@ dependencies = [ "value-bag", ] -[[package]] -name = "lru" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" -dependencies = [ - "hashbrown", -] - [[package]] name = "lru" version = "0.8.1" @@ -4427,18 +4425,18 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memfd" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "480b5a5de855d11ff13195950bdc8b98b5e942ef47afc447f6615cdcc4e15d80" +checksum = "b20a59d985586e4a5aef64564ac77299f8586d8be6cf9106a5a40207e8908efb" dependencies = [ - "rustix", + "rustix 0.36.1", ] [[package]] name = "memmap2" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95af15f345b17af2efc8ead6080fb8bc376f8cec1b35277b935637595fe77498" +checksum = "4b182332558b18d807c4ce1ca8ca983b34c3ee32765e47b3f0f69b90355cc1dc" dependencies = [ "libc", ] @@ -4573,7 +4571,7 @@ dependencies = [ [[package]] name = "modular-frost" -version = "0.4.1" +version = "0.5.0" dependencies = [ "chacha20 0.9.0", "ciphersuite", @@ -4619,7 +4617,7 @@ dependencies = [ [[package]] name = "monero-serai" -version = "0.1.1-alpha" +version = "0.1.2-alpha" dependencies = [ "base58-monero", "blake2", @@ -4680,7 +4678,7 @@ dependencies = [ [[package]] name = "multiexp" -version = "0.2.1" +version = "0.2.2" dependencies = [ "dalek-ff-group", "ff", @@ -4880,12 +4878,6 @@ dependencies = [ "libc", ] -[[package]] -name = "nodrop" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" - [[package]] name = "nohash-hasher" version = "0.2.0" @@ -4980,15 +4972,6 @@ dependencies = [ "libc", ] -[[package]] -name = "num_threads" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" -dependencies = [ - "libc", -] - [[package]] name = "number_prefix" version = "0.4.0" @@ -5072,9 +5055,9 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.3.1" +version = "6.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3baf96e39c5359d2eb0dd6ccb42c62b91d9678aa68160d261b9e0ccbf9e9dea9" +checksum = "7b5bf27447411e9ee3ff51186bf7a08e16c341efdde93f4d823e8844429bed7e" [[package]] name = "p256" @@ -5090,7 +5073,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "frame-benchmarking", "frame-support", @@ -5105,7 +5088,7 @@ dependencies = [ [[package]] name = "pallet-contracts" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "bitflags", "frame-benchmarking", @@ -5133,7 +5116,7 @@ dependencies = [ [[package]] name = "pallet-contracts-primitives" version = "6.0.0" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "bitflags", "parity-scale-codec", @@ -5145,7 +5128,7 @@ dependencies = [ [[package]] name = "pallet-contracts-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "proc-macro2", "quote", @@ -5155,7 +5138,7 @@ dependencies = [ [[package]] name = "pallet-randomness-collective-flip" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "frame-support", "frame-system", @@ -5169,7 +5152,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "frame-support", "frame-system", @@ -5203,7 +5186,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "frame-benchmarking", "frame-support", @@ -5221,7 +5204,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "frame-support", "frame-system", @@ -5237,7 +5220,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -5247,26 +5230,28 @@ dependencies = [ "sp-core", "sp-rpc", "sp-runtime", + "sp-weights", ] [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", "sp-api", "sp-runtime", + "sp-weights", ] [[package]] name = "parity-db" -version = "0.3.17" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c8fdb726a43661fa54b43e7114e6b88b2289cae388eb3ad766d9d1754d83fce" +checksum = "3a7511a0bec4a336b5929999d02b560d2439c993cccf98c26481484e811adc43" dependencies = [ - "blake2-rfc", + "blake2", "crc32fast", "fs2", "hex", @@ -5339,15 +5324,6 @@ dependencies = [ "synstructure", ] -[[package]] -name = "parity-wasm" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ad52817c4d343339b3bc2e26861bd21478eda0b7509acf83505727000512ac" -dependencies = [ - "byteorder", -] - [[package]] name = "parity-wasm" version = "0.45.0" @@ -5495,9 +5471,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "pest" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbc7bc69c062e492337d74d59b120c274fd3d261b6bf6d3207d499b4b379c41a" +checksum = "a528564cc62c19a7acac4d81e01f39e53e25e17b934878f4c6d25cc2836e62f8" dependencies = [ "thiserror", "ucd-trie", @@ -5505,9 +5481,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b75706b9642ebcb34dab3bc7750f811609a0eb1dd8b88c2d15bf628c1c65b2" +checksum = "d5fd9bc6500181952d34bd0b2b0163a54d794227b498be0b7afa7698d0a7b18f" dependencies = [ "pest", "pest_generator", @@ -5515,9 +5491,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f9272122f5979a6511a749af9db9bfc810393f63119970d7085fed1c4ea0db" +checksum = "d2610d5ac5156217b4ff8e46ddcef7cdf44b273da2ac5bca2ecbfa86a330e7c4" dependencies = [ "pest", "pest_meta", @@ -5528,9 +5504,9 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8717927f9b79515e565a64fe46c38b8cd0427e64c40680b14a7365ab09ac8d" +checksum = "824749bf7e21dd66b36fbe26b3f45c713879cccd4a009a917ab8e045ca8246fe" dependencies = [ "once_cell", "pest", @@ -5706,9 +5682,9 @@ dependencies = [ [[package]] name = "ppv-lite86" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "precomputed-hash" @@ -5718,9 +5694,9 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] name = "predicates" -version = "2.1.1" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5aab5be6e4732b473071984b3164dbbfb7a3674d30ea5ff44410b6bcd960c3c" +checksum = "ab68289ded120dcbf9d571afcf70163233229052aec9b08ab09532f698d0e1e6" dependencies = [ "difflib", "float-cmp", @@ -5732,20 +5708,30 @@ dependencies = [ [[package]] name = "predicates-core" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da1c2388b1513e1b605fcec39a95e0a9e8ef088f71443ef37099fa9ae6673fcb" +checksum = "a6e7125585d872860e9955ca571650b27a4979c5823084168c5ed5bbfb016b56" [[package]] name = "predicates-tree" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d86de6de25020a36c6d3643a86d9a6a9f552107c0559c60ea03551b5e16c032" +checksum = "ad3f7fa8d61e139cbc7c3edfebf3b6678883a53f5ffac65d1259329a93ee43a5" dependencies = [ "predicates-core", "termtree", ] +[[package]] +name = "prettyplease" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c142c0e46b57171fe0c528bee8c5b7569e80f0c17e377cd0e30ea57dbc11bb51" +dependencies = [ + "proc-macro2", + "syn", +] + [[package]] name = "primitive-types" version = "0.11.1" @@ -5861,9 +5847,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.11.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "399c3c31cdec40583bb68f0b18403400d01ec4289c383aa047560439952c4dd7" +checksum = "a0841812012b2d4a6145fae9a6af1534873c32aa67fff26bd09f8fa42c83f95a" dependencies = [ "bytes", "prost-derive", @@ -5871,9 +5857,9 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f835c582e6bd972ba8347313300219fed5bfa52caf175298d860b61ff6069bb" +checksum = "1d8b442418ea0822409d9e7d047cbf1e7e9e1760b172bf9982cf29d517c93511" dependencies = [ "bytes", "heck", @@ -5882,9 +5868,11 @@ dependencies = [ "log", "multimap", "petgraph", + "prettyplease", "prost", "prost-types", "regex", + "syn", "tempfile", "which", ] @@ -5904,9 +5892,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.11.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7345d5f0e08c0536d7ac7229952590239e77abf0a0100a1b1d890add6ea96364" +checksum = "164ae68b6587001ca506d3bf7f1000bfa248d0e1217b618108fba4ec1d0cc306" dependencies = [ "anyhow", "itertools", @@ -5917,9 +5905,9 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dfaa718ad76a44b3415e6c4d53b17c8f99160dcb3a99b10470fce8ad43f6e3e" +checksum = "747761bc3dc48f9a34553bf65605cf6cb6288ba219f3450b4275dbd81539551a" dependencies = [ "bytes", "prost", @@ -6156,9 +6144,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" dependencies = [ "aho-corasick", "memchr", @@ -6176,9 +6164,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.27" +version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] name = "remove_dir_all" @@ -6393,9 +6381,23 @@ checksum = "727a1a6d65f786ec22df8a81ca3121107f235970dc1705ed681d3e6e8b9cd5f9" dependencies = [ "bitflags", "errno", - "io-lifetimes", + "io-lifetimes 0.7.5", "libc", - "linux-raw-sys", + "linux-raw-sys 0.0.46", + "windows-sys 0.42.0", +] + +[[package]] +name = "rustix" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812a2ec2043c4d6bc6482f5be2ab8244613cac2493d128d36c0759e52a626ab3" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes 1.0.1", + "libc", + "linux-raw-sys 0.1.2", "windows-sys 0.42.0", ] @@ -6485,7 +6487,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "log", "sp-core", @@ -6496,7 +6498,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "futures", "futures-timer", @@ -6519,7 +6521,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -6535,7 +6537,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "impl-trait-for-tuples", "memmap2", @@ -6552,7 +6554,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -6563,11 +6565,11 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "array-bytes", "chrono", - "clap 4.0.18", + "clap 4.0.22", "fdlimit", "futures", "libp2p", @@ -6603,7 +6605,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "fnv", "futures", @@ -6631,7 +6633,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "hash-db", "kvdb", @@ -6656,7 +6658,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "async-trait", "futures", @@ -6680,10 +6682,10 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "lazy_static", - "lru 0.7.8", + "lru", "parity-scale-codec", "parking_lot 0.12.1", "sc-executor-common", @@ -6696,7 +6698,6 @@ dependencies = [ "sp-io", "sp-panic-handler", "sp-runtime-interface", - "sp-tasks", "sp-trie", "sp-version", "sp-wasm-interface", @@ -6707,7 +6708,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "environmental", "parity-scale-codec", @@ -6723,7 +6724,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "log", "parity-scale-codec", @@ -6738,15 +6739,15 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "cfg-if", "libc", "log", "once_cell", "parity-scale-codec", - "parity-wasm 0.45.0", - "rustix", + "parity-wasm", + "rustix 0.35.13", "sc-allocator", "sc-executor-common", "sp-runtime-interface", @@ -6758,7 +6759,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "ansi_term", "futures", @@ -6775,7 +6776,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "array-bytes", "async-trait", @@ -6790,7 +6791,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "array-bytes", "async-trait", @@ -6808,7 +6809,7 @@ dependencies = [ "linked-hash-map", "linked_hash_set", "log", - "lru 0.7.8", + "lru", "parity-scale-codec", "parking_lot 0.12.1", "pin-project", @@ -6837,7 +6838,7 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "cid", "futures", @@ -6857,7 +6858,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "async-trait", "bitflags", @@ -6883,14 +6884,14 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "ahash", "futures", "futures-timer", "libp2p", "log", - "lru 0.7.8", + "lru", "sc-network-common", "sc-peerset", "sp-runtime", @@ -6901,7 +6902,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "array-bytes", "futures", @@ -6922,14 +6923,14 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "array-bytes", "fork-tree", "futures", "libp2p", "log", - "lru 0.7.8", + "lru", "mockall", "parity-scale-codec", "prost", @@ -6952,7 +6953,7 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "array-bytes", "futures", @@ -6971,7 +6972,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "array-bytes", "bytes", @@ -7001,7 +7002,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "futures", "libp2p", @@ -7014,7 +7015,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -7023,7 +7024,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "futures", "hash-db", @@ -7053,7 +7054,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "futures", "jsonrpsee", @@ -7076,7 +7077,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "futures", "jsonrpsee", @@ -7089,7 +7090,7 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "futures", "hex", @@ -7108,7 +7109,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "async-trait", "directories", @@ -7179,7 +7180,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "log", "parity-scale-codec", @@ -7193,7 +7194,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "futures", "libc", @@ -7212,7 +7213,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "chrono", "futures", @@ -7230,7 +7231,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "ansi_term", "atty", @@ -7261,7 +7262,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7272,7 +7273,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "async-trait", "futures", @@ -7299,7 +7300,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "async-trait", "futures", @@ -7313,7 +7314,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "futures", "futures-timer", @@ -7393,7 +7394,7 @@ dependencies = [ [[package]] name = "schnorr-signatures" -version = "0.1.0" +version = "0.2.0" dependencies = [ "blake2", "ciphersuite", @@ -7590,7 +7591,7 @@ name = "serai-node" version = "0.1.0" dependencies = [ "async-trait", - "clap 4.0.18", + "clap 4.0.22", "frame-benchmarking", "frame-benchmarking-cli", "frame-system", @@ -7649,6 +7650,7 @@ dependencies = [ "serde_json", "thiserror", "tokio", + "zeroize", ] [[package]] @@ -7967,7 +7969,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "hash-db", "log", @@ -7985,7 +7987,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "blake2", "proc-macro-crate", @@ -7997,7 +7999,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "6.0.0" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "parity-scale-codec", "scale-info", @@ -8010,7 +8012,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "5.0.0" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "integer-sqrt", "num-traits", @@ -8025,7 +8027,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "parity-scale-codec", "sp-api", @@ -8037,11 +8039,11 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "futures", "log", - "lru 0.7.8", + "lru", "parity-scale-codec", "parking_lot 0.12.1", "sp-api", @@ -8055,7 +8057,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "async-trait", "futures", @@ -8074,7 +8076,7 @@ dependencies = [ [[package]] name = "sp-core" version = "6.0.0" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "array-bytes", "base58 0.2.0", @@ -8093,7 +8095,6 @@ dependencies = [ "merlin 2.0.1", "num-traits", "parity-scale-codec", - "parity-util-mem", "parking_lot 0.12.1", "primitive-types 0.12.1", "rand 0.7.3", @@ -8120,7 +8121,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "4.0.0" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "blake2", "byteorder", @@ -8134,7 +8135,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "proc-macro2", "quote", @@ -8145,7 +8146,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -8154,7 +8155,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "4.0.0" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "proc-macro2", "quote", @@ -8164,7 +8165,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.12.0" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "environmental", "parity-scale-codec", @@ -8175,7 +8176,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "finality-grandpa", "log", @@ -8193,7 +8194,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -8207,7 +8208,7 @@ dependencies = [ [[package]] name = "sp-io" version = "6.0.0" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "bytes", "futures", @@ -8233,7 +8234,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "6.0.0" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "lazy_static", "sp-core", @@ -8244,7 +8245,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.12.0" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "async-trait", "futures", @@ -8261,7 +8262,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "thiserror", "zstd", @@ -8270,7 +8271,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "sp-api", "sp-core", @@ -8280,7 +8281,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "4.0.0" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "backtrace", "lazy_static", @@ -8290,7 +8291,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "rustc-hash", "serde", @@ -8300,7 +8301,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "6.0.0" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "either", "hash256-std-hasher", @@ -8323,7 +8324,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "6.0.0" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -8341,7 +8342,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "5.0.0" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "Inflector", "proc-macro-crate", @@ -8353,7 +8354,7 @@ dependencies = [ [[package]] name = "sp-sandbox" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "log", "parity-scale-codec", @@ -8367,7 +8368,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "parity-scale-codec", "scale-info", @@ -8381,7 +8382,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "parity-scale-codec", "scale-info", @@ -8392,7 +8393,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.12.0" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "hash-db", "log", @@ -8414,12 +8415,12 @@ dependencies = [ [[package]] name = "sp-std" version = "4.0.0" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" [[package]] name = "sp-storage" version = "6.0.0" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "impl-serde 0.4.0", "parity-scale-codec", @@ -8429,19 +8430,6 @@ dependencies = [ "sp-std", ] -[[package]] -name = "sp-tasks" -version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" -dependencies = [ - "log", - "sp-core", - "sp-externalities", - "sp-io", - "sp-runtime-interface", - "sp-std", -] - [[package]] name = "sp-tendermint" version = "0.1.0" @@ -8454,7 +8442,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "async-trait", "futures-timer", @@ -8470,7 +8458,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "5.0.0" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "parity-scale-codec", "sp-std", @@ -8482,7 +8470,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "sp-api", "sp-runtime", @@ -8491,7 +8479,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "async-trait", "log", @@ -8507,13 +8495,13 @@ dependencies = [ [[package]] name = "sp-trie" version = "6.0.0" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "ahash", "hash-db", "hashbrown", "lazy_static", - "lru 0.7.8", + "lru", "memory-db", "nohash-hasher", "parity-scale-codec", @@ -8530,11 +8518,11 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "impl-serde 0.4.0", "parity-scale-codec", - "parity-wasm 0.45.0", + "parity-wasm", "scale-info", "serde", "sp-core-hashing-proc-macro", @@ -8547,7 +8535,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -8558,7 +8546,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "6.0.0" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "impl-trait-for-tuples", "log", @@ -8571,7 +8559,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "4.0.0" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -8602,9 +8590,9 @@ dependencies = [ [[package]] name = "ss58-registry" -version = "1.33.0" +version = "1.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab7554f8a8b6f8d71cd5a8e6536ef116e2ce0504cf97ebf16311d58065dc8a6" +checksum = "37a9821878e1f13aba383aa40a86fb1b33c7265774ec91e32563cb1dd1577496" dependencies = [ "Inflector", "num-format", @@ -8725,7 +8713,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "platforms", ] @@ -8733,7 +8721,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -8754,7 +8742,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "futures-util", "hyper", @@ -8767,7 +8755,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#b62e1a4a520caa986bf7d5fefa24b1f8694b3667" +source = "git+https://github.com/serai-dex/substrate#881cfbc59c8b65bcccc9fa6187e5096ac3594e3a" dependencies = [ "ansi_term", "build-helper", @@ -8778,7 +8766,7 @@ dependencies = [ "tempfile", "toml", "walkdir", - "wasm-gc-api", + "wasm-opt", ] [[package]] @@ -8870,9 +8858,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-lexicon" -version = "0.12.4" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02424087780c9b71cc96799eaeddff35af2bc513278cda5c99fc1f5d026d3c1" +checksum = "9410d0f6853b1d94f0e519fb95df60f29d2c1eff2d921ffdf01a4c8a3b54f12d" [[package]] name = "tempfile" @@ -8932,9 +8920,9 @@ dependencies = [ [[package]] name = "termtree" -version = "0.2.4" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "507e9898683b6c43a9aa55b64259b721b52ba226e0f3779137e50ad114a4c90b" +checksum = "95059e91184749cb66be6dc994f67f182b6d897cb3df74a5bf66b5e709295fd8" [[package]] name = "textwrap" @@ -9010,13 +8998,11 @@ dependencies = [ [[package]] name = "time" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fab5c8b9980850e06d92ddbe3ab839c062c801f3927c0fb8abd6fc8e918fbca" +checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" dependencies = [ "itoa", - "libc", - "num_threads", "serde", "time-core", "time-macros", @@ -9030,9 +9016,9 @@ checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" [[package]] name = "time-macros" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bb801831d812c562ae7d2bfb531f26e66e4e1f6b17307ba4149c5064710e5b" +checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2" dependencies = [ "time-core", ] @@ -9609,24 +9595,54 @@ version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" -[[package]] -name = "wasm-gc-api" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c32691b6c7e6c14e7f8fd55361a9088b507aa49620fcd06c09b3a1082186b9" -dependencies = [ - "log", - "parity-wasm 0.32.0", - "rustc-demangle", -] - [[package]] name = "wasm-instrument" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa1dafb3e60065305741e83db35c6c2584bb3725b692b5b66148a38d72ace6cd" dependencies = [ - "parity-wasm 0.45.0", + "parity-wasm", +] + +[[package]] +name = "wasm-opt" +version = "0.110.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b68e8037b4daf711393f4be2056246d12d975651b14d581520ad5d1f19219cec" +dependencies = [ + "anyhow", + "libc", + "strum", + "strum_macros", + "tempfile", + "thiserror", + "wasm-opt-cxx-sys", + "wasm-opt-sys", +] + +[[package]] +name = "wasm-opt-cxx-sys" +version = "0.110.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91adbad477e97bba3fbd21dd7bfb594e7ad5ceb9169ab1c93ab9cb0ada636b6f" +dependencies = [ + "anyhow", + "cxx", + "cxx-build", + "wasm-opt-sys", +] + +[[package]] +name = "wasm-opt-sys" +version = "0.110.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec4fa5a322a4e6ac22fd141f498d56afbdbf9df5debeac32380d2dcaa3e06941" +dependencies = [ + "anyhow", + "cc", + "cxx", + "cxx-build", + "regex", ] [[package]] @@ -9650,7 +9666,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06c326c93fbf86419608361a2c925a31754cf109da1b8b55737070b4d6669422" dependencies = [ - "parity-wasm 0.45.0", + "parity-wasm", "wasmi-validation", "wasmi_core", ] @@ -9661,7 +9677,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91ff416ad1ff0c42e5a926ed5d5fab74c0f098749aa0ad8b2a34b982ce0e867b" dependencies = [ - "parity-wasm 0.45.0", + "parity-wasm", ] [[package]] @@ -9688,9 +9704,9 @@ dependencies = [ [[package]] name = "wasmtime" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f511c4917c83d04da68333921107db75747c4e11a2f654a8e909cc5e0520dc" +checksum = "4ad5af6ba38311282f2a21670d96e78266e8c8e2f38cbcd52c254df6ccbc7731" dependencies = [ "anyhow", "bincode", @@ -9716,18 +9732,18 @@ dependencies = [ [[package]] name = "wasmtime-asm-macros" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39bf3debfe744bf19dd3732990ce6f8c0ced7439e2370ba4e1d8f5a3660a3178" +checksum = "45de63ddfc8b9223d1adc8f7b2ee5f35d1f6d112833934ad7ea66e4f4339e597" dependencies = [ "cfg-if", ] [[package]] name = "wasmtime-cache" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ece42fa4676a263f7558cdaaf5a71c2592bebcbac22a0580e33cf3406c103da2" +checksum = "bcd849399d17d2270141cfe47fa0d91ee52d5f8ea9b98cf7ddde0d53e5f79882" dependencies = [ "anyhow", "base64 0.13.1", @@ -9735,7 +9751,7 @@ dependencies = [ "directories-next", "file-per-thread-logger", "log", - "rustix", + "rustix 0.35.13", "serde", "sha2 0.9.9", "toml", @@ -9745,9 +9761,9 @@ dependencies = [ [[package]] name = "wasmtime-cranelift" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "058217e28644b012bdcdf0e445f58d496d78c2e0b6a6dd93558e701591dad705" +checksum = "4bd91339b742ff20bfed4532a27b73c86b5bcbfedd6bea2dcdf2d64471e1b5c6" dependencies = [ "anyhow", "cranelift-codegen", @@ -9766,9 +9782,9 @@ dependencies = [ [[package]] name = "wasmtime-environ" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7af06848df28b7661471d9a80d30a973e0f401f2e3ed5396ad7e225ed217047" +checksum = "ebb881c61f4f627b5d45c54e629724974f8a8890d455bcbe634330cc27309644" dependencies = [ "anyhow", "cranelift-entity", @@ -9785,9 +9801,9 @@ dependencies = [ [[package]] name = "wasmtime-jit" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9028fb63a54185b3c192b7500ef8039c7bb8d7f62bfc9e7c258483a33a3d13bb" +checksum = "1985c628011fe26adf5e23a5301bdc79b245e0e338f14bb58b39e4e25e4d8681" dependencies = [ "addr2line", "anyhow", @@ -9798,7 +9814,7 @@ dependencies = [ "log", "object", "rustc-demangle", - "rustix", + "rustix 0.35.13", "serde", "target-lexicon", "thiserror", @@ -9810,20 +9826,20 @@ dependencies = [ [[package]] name = "wasmtime-jit-debug" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25e82d4ef93296785de7efca92f7679dc67fe68a13b625a5ecc8d7503b377a37" +checksum = "f671b588486f5ccec8c5a3dba6b4c07eac2e66ab8c60e6f4e53717c77f709731" dependencies = [ "object", "once_cell", - "rustix", + "rustix 0.35.13", ] [[package]] name = "wasmtime-runtime" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f0e9bea7d517d114fe66b930b2124ee086516ee93eeebfd97f75f366c5b0553" +checksum = "ee8f92ad4b61736339c29361da85769ebc200f184361959d1792832e592a1afd" dependencies = [ "anyhow", "cc", @@ -9836,7 +9852,7 @@ dependencies = [ "memoffset", "paste", "rand 0.8.5", - "rustix", + "rustix 0.35.13", "thiserror", "wasmtime-asm-macros", "wasmtime-environ", @@ -9846,9 +9862,9 @@ dependencies = [ [[package]] name = "wasmtime-types" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69b83e93ed41b8fdc936244cfd5e455480cf1eca1fd60c78a0040038b4ce5075" +checksum = "d23d61cb4c46e837b431196dd06abb11731541021916d03476a178b54dc07aeb" dependencies = [ "cranelift-entity", "serde", @@ -10155,6 +10171,13 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "zalloc" +version = "0.1.0" +dependencies = [ + "zeroize", +] + [[package]] name = "zeroize" version = "1.5.7" @@ -10192,7 +10215,7 @@ dependencies = [ "hmac 0.12.1", "pbkdf2 0.11.0", "sha1", - "time 0.3.16", + "time 0.3.17", "zstd", ] diff --git a/Cargo.toml b/Cargo.toml index 952e20fd..0e3f1b79 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,7 @@ [workspace] members = [ + "common/zalloc", + "crypto/transcript", "crypto/dalek-ff-group", diff --git a/coins/monero/Cargo.toml b/coins/monero/Cargo.toml index 04840a0c..ca42c5f6 100644 --- a/coins/monero/Cargo.toml +++ b/coins/monero/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "monero-serai" -version = "0.1.1-alpha" +version = "0.1.2-alpha" description = "A modern Monero transaction library" license = "MIT" repository = "https://github.com/serai-dex/serai/tree/develop/coins/monero" @@ -33,9 +33,9 @@ group = { version = "0.12" } dalek-ff-group = { path = "../../crypto/dalek-ff-group", version = "0.1" } multiexp = { path = "../../crypto/multiexp", version = "0.2", features = ["batch"] } -transcript = { package = "flexible-transcript", path = "../../crypto/transcript", version = "0.1", features = ["recommended"], optional = true } -frost = { package = "modular-frost", path = "../../crypto/frost", version = "0.4", features = ["ed25519"], optional = true } -dleq = { path = "../../crypto/dleq", version = "0.1", features = ["serialize"], optional = true } +transcript = { package = "flexible-transcript", path = "../../crypto/transcript", version = "0.2", features = ["recommended"], optional = true } +frost = { package = "modular-frost", path = "../../crypto/frost", version = "0.5", features = ["ed25519"], optional = true } +dleq = { path = "../../crypto/dleq", version = "0.2", features = ["serialize"], optional = true } monero-generators = { path = "generators", version = "0.1" } @@ -55,7 +55,7 @@ monero-generators = { path = "generators", version = "0.1" } [dev-dependencies] tokio = { version = "1", features = ["full"] } -frost = { package = "modular-frost", path = "../../crypto/frost", version = "0.4", features = ["ed25519", "tests"] } +frost = { package = "modular-frost", path = "../../crypto/frost", version = "0.5", features = ["ed25519", "tests"] } [features] multisig = ["rand_chacha", "blake2", "transcript", "frost", "dleq"] diff --git a/coins/monero/src/ringct/clsag/mod.rs b/coins/monero/src/ringct/clsag/mod.rs index 80a3e9b3..8582f6b4 100644 --- a/coins/monero/src/ringct/clsag/mod.rs +++ b/coins/monero/src/ringct/clsag/mod.rs @@ -1,10 +1,12 @@ #![allow(non_snake_case)] +use core::ops::Deref; + use lazy_static::lazy_static; use thiserror::Error; use rand_core::{RngCore, CryptoRng}; -use zeroize::{Zeroize, ZeroizeOnDrop}; +use zeroize::{Zeroize, ZeroizeOnDrop, Zeroizing}; use subtle::{ConstantTimeEq, Choice, CtOption}; use curve25519_dalek::{ @@ -233,7 +235,7 @@ impl Clsag { /// sum_outputs is for the sum of the outputs' commitment masks. pub fn sign( rng: &mut R, - mut inputs: Vec<(Scalar, EdwardsPoint, ClsagInput)>, + mut inputs: Vec<(Zeroizing, EdwardsPoint, ClsagInput)>, sum_outputs: Scalar, msg: [u8; 32], ) -> Vec<(Clsag, EdwardsPoint)> { @@ -247,17 +249,19 @@ impl Clsag { sum_pseudo_outs += mask; } - let mut nonce = random_scalar(rng); + let mut nonce = Zeroizing::new(random_scalar(rng)); let (mut clsag, pseudo_out, p, c) = Clsag::sign_core( rng, &inputs[i].1, &inputs[i].2, mask, &msg, - &nonce * &ED25519_BASEPOINT_TABLE, - nonce * hash_to_point(inputs[i].2.decoys.ring[usize::from(inputs[i].2.decoys.i)][0]), + nonce.deref() * &ED25519_BASEPOINT_TABLE, + nonce.deref() * + hash_to_point(inputs[i].2.decoys.ring[usize::from(inputs[i].2.decoys.i)][0]), ); - clsag.s[usize::from(inputs[i].2.decoys.i)] = nonce - ((p * inputs[i].0) + c); + clsag.s[usize::from(inputs[i].2.decoys.i)] = + (-((p * inputs[i].0.deref()) + c)) + nonce.deref(); inputs[i].0.zeroize(); nonce.zeroize(); diff --git a/coins/monero/src/ringct/clsag/multisig.rs b/coins/monero/src/ringct/clsag/multisig.rs index 459a7073..8881e418 100644 --- a/coins/monero/src/ringct/clsag/multisig.rs +++ b/coins/monero/src/ringct/clsag/multisig.rs @@ -1,4 +1,4 @@ -use core::fmt::Debug; +use core::{ops::Deref, fmt::Debug}; use std::{ io::{self, Read, Write}, sync::{Arc, RwLock}, @@ -7,7 +7,7 @@ use std::{ use rand_core::{RngCore, CryptoRng, SeedableRng}; use rand_chacha::ChaCha20Rng; -use zeroize::{Zeroize, ZeroizeOnDrop}; +use zeroize::{Zeroize, ZeroizeOnDrop, Zeroizing}; use curve25519_dalek::{ constants::ED25519_BASEPOINT_TABLE, @@ -41,7 +41,7 @@ impl ClsagInput { // Doesn't domain separate as this is considered part of the larger CLSAG proof // Ring index - transcript.append_message(b"ring_index", &[self.decoys.i]); + transcript.append_message(b"ring_index", [self.decoys.i]); // Ring let mut ring = vec![]; @@ -52,7 +52,7 @@ impl ClsagInput { ring.extend(pair[0].compress().to_bytes()); ring.extend(pair[1].compress().to_bytes()); } - transcript.append_message(b"ring", &ring); + transcript.append_message(b"ring", ring); // Doesn't include the commitment's parts as the above ring + index includes the commitment // The only potential malleability would be if the G/H relationship is known breaking the @@ -157,7 +157,7 @@ impl Algorithm for ClsagMultisig { view: &ThresholdView, ) -> ClsagAddendum { ClsagAddendum { - key_image: dfg::EdwardsPoint(self.H * view.secret_share().0), + key_image: dfg::EdwardsPoint(self.H) * view.secret_share().deref(), dleq: DLEqProof::prove( rng, // Doesn't take in a larger transcript object due to the usage of this @@ -167,7 +167,7 @@ impl Algorithm for ClsagMultisig { // try to merge later in some form, when it should instead just merge xH (as it does) &mut dleq_transcript(), &[dfg::EdwardsPoint::generator(), dfg::EdwardsPoint(self.H)], - dfg::Scalar(view.secret_share().0), + view.secret_share(), ), } } @@ -195,10 +195,10 @@ impl Algorithm for ClsagMultisig { if self.image.is_identity() { self.transcript.domain_separate(b"CLSAG"); self.input().transcript(&mut self.transcript); - self.transcript.append_message(b"mask", &self.mask().to_bytes()); + self.transcript.append_message(b"mask", self.mask().to_bytes()); } - self.transcript.append_message(b"participant", &l.to_be_bytes()); + self.transcript.append_message(b"participant", l.to_be_bytes()); addendum .dleq @@ -209,9 +209,7 @@ impl Algorithm for ClsagMultisig { ) .map_err(|_| FrostError::InvalidPreprocess(l))?; - self - .transcript - .append_message(b"key_image_share", addendum.key_image.compress().to_bytes().as_ref()); + self.transcript.append_message(b"key_image_share", addendum.key_image.compress().to_bytes()); self.image += addendum.key_image.0; Ok(()) @@ -225,7 +223,7 @@ impl Algorithm for ClsagMultisig { &mut self, view: &ThresholdView, nonce_sums: &[Vec], - nonces: &[dfg::Scalar], + nonces: Vec>, msg: &[u8], ) -> dfg::Scalar { // Use the transcript to get a seeded random number generator @@ -249,7 +247,7 @@ impl Algorithm for ClsagMultisig { ); self.interim = Some(Interim { p, c, clsag, pseudo_out }); - nonces[0] - (dfg::Scalar(p) * view.secret_share()) + (-(dfg::Scalar(p) * view.secret_share().deref())) + nonces[0].deref() } #[must_use] diff --git a/coins/monero/src/ringct/mod.rs b/coins/monero/src/ringct/mod.rs index 71c905d7..b81e8651 100644 --- a/coins/monero/src/ringct/mod.rs +++ b/coins/monero/src/ringct/mod.rs @@ -1,4 +1,6 @@ -use zeroize::Zeroize; +use core::ops::Deref; + +use zeroize::Zeroizing; use curve25519_dalek::{constants::ED25519_BASEPOINT_TABLE, scalar::Scalar, edwards::EdwardsPoint}; @@ -17,10 +19,8 @@ use crate::{ }; /// Generate a key image for a given key. Defined as `x * hash_to_point(xG)`. -pub fn generate_key_image(mut secret: Scalar) -> EdwardsPoint { - let res = secret * hash_to_point(&secret * &ED25519_BASEPOINT_TABLE); - secret.zeroize(); - res +pub fn generate_key_image(secret: &Zeroizing) -> EdwardsPoint { + hash_to_point(&ED25519_BASEPOINT_TABLE * secret.deref()) * secret.deref() } #[derive(Clone, PartialEq, Eq, Debug)] diff --git a/coins/monero/src/tests/clsag.rs b/coins/monero/src/tests/clsag.rs index a89f6d3a..90138d9c 100644 --- a/coins/monero/src/tests/clsag.rs +++ b/coins/monero/src/tests/clsag.rs @@ -1,6 +1,8 @@ +use core::ops::Deref; #[cfg(feature = "multisig")] use std::sync::{Arc, RwLock}; +use zeroize::Zeroizing; use rand_core::{RngCore, OsRng}; use curve25519_dalek::{constants::ED25519_BASEPOINT_TABLE, scalar::Scalar}; @@ -35,29 +37,30 @@ fn clsag() { for real in 0 .. RING_LEN { let msg = [1; 32]; - let mut secrets = [Scalar::zero(), Scalar::zero()]; + let mut secrets = (Zeroizing::new(Scalar::zero()), Scalar::zero()); let mut ring = vec![]; for i in 0 .. RING_LEN { - let dest = random_scalar(&mut OsRng); + let dest = Zeroizing::new(random_scalar(&mut OsRng)); let mask = random_scalar(&mut OsRng); let amount; if i == u64::from(real) { - secrets = [dest, mask]; + secrets = (dest.clone(), mask); amount = AMOUNT; } else { amount = OsRng.next_u64(); } - ring.push([&dest * &ED25519_BASEPOINT_TABLE, Commitment::new(mask, amount).calculate()]); + ring + .push([dest.deref() * &ED25519_BASEPOINT_TABLE, Commitment::new(mask, amount).calculate()]); } - let image = generate_key_image(secrets[0]); + let image = generate_key_image(&secrets.0); let (clsag, pseudo_out) = Clsag::sign( &mut OsRng, vec![( - secrets[0], + secrets.0, image, ClsagInput::new( - Commitment::new(secrets[1], AMOUNT), + Commitment::new(secrets.1, AMOUNT), Decoys { i: u8::try_from(real).unwrap(), offsets: (1 ..= RING_LEN).into_iter().collect(), diff --git a/coins/monero/src/wallet/send/mod.rs b/coins/monero/src/wallet/send/mod.rs index 1c8b308d..9be83b9a 100644 --- a/coins/monero/src/wallet/send/mod.rs +++ b/coins/monero/src/wallet/send/mod.rs @@ -1,9 +1,11 @@ +use core::ops::Deref; + use thiserror::Error; use rand_core::{RngCore, CryptoRng}; use rand::seq::SliceRandom; -use zeroize::{Zeroize, ZeroizeOnDrop}; +use zeroize::{Zeroize, ZeroizeOnDrop, Zeroizing}; use curve25519_dalek::{constants::ED25519_BASEPOINT_TABLE, scalar::Scalar, edwards::EdwardsPoint}; @@ -108,9 +110,9 @@ async fn prepare_inputs( rpc: &Rpc, ring_len: usize, inputs: &[SpendableOutput], - spend: &Scalar, + spend: &Zeroizing, tx: &mut Transaction, -) -> Result, TransactionError> { +) -> Result, EdwardsPoint, ClsagInput)>, TransactionError> { let mut signable = Vec::with_capacity(inputs.len()); // Select decoys @@ -125,9 +127,11 @@ async fn prepare_inputs( .map_err(TransactionError::RpcError)?; for (i, input) in inputs.iter().enumerate() { + let input_spend = Zeroizing::new(input.key_offset() + spend.deref()); + let image = generate_key_image(&input_spend); signable.push(( - spend + input.key_offset(), - generate_key_image(spend + input.key_offset()), + input_spend, + image, ClsagInput::new(input.commitment().clone(), decoys[i].clone()) .map_err(TransactionError::ClsagError)?, )); @@ -358,16 +362,16 @@ impl SignableTransaction { &mut self, rng: &mut R, rpc: &Rpc, - spend: &Scalar, + spend: &Zeroizing, ) -> Result { let mut images = Vec::with_capacity(self.inputs.len()); for input in &self.inputs { - let mut offset = spend + input.key_offset(); - if (&offset * &ED25519_BASEPOINT_TABLE) != input.key() { + let mut offset = Zeroizing::new(spend.deref() + input.key_offset()); + if (offset.deref() * &ED25519_BASEPOINT_TABLE) != input.key() { Err(TransactionError::WrongPrivateKey)?; } - images.push(generate_key_image(offset)); + images.push(generate_key_image(&offset)); offset.zeroize(); } images.sort_by(key_image_sort); diff --git a/coins/monero/src/wallet/send/multisig.rs b/coins/monero/src/wallet/send/multisig.rs index 12bd9d4d..a324fb3f 100644 --- a/coins/monero/src/wallet/send/multisig.rs +++ b/coins/monero/src/wallet/send/multisig.rs @@ -90,24 +90,24 @@ impl SignableTransaction { // Include the height we're using for our data // The data itself will be included, making this unnecessary, yet a lot of this is technically // unnecessary. Anything which further increases security at almost no cost should be followed - transcript.append_message(b"height", &u64::try_from(height).unwrap().to_le_bytes()); + transcript.append_message(b"height", u64::try_from(height).unwrap().to_le_bytes()); // Also include the spend_key as below only the key offset is included, so this transcripts the // sum product // Useful as transcripting the sum product effectively transcripts the key image, further // guaranteeing the one time properties noted below - transcript.append_message(b"spend_key", &keys.group_key().0.compress().to_bytes()); + transcript.append_message(b"spend_key", keys.group_key().0.compress().to_bytes()); for input in &self.inputs { // These outputs can only be spent once. Therefore, it forces all RNGs derived from this // transcript (such as the one used to create one time keys) to be unique - transcript.append_message(b"input_hash", &input.output.absolute.tx); - transcript.append_message(b"input_output_index", &[input.output.absolute.o]); + transcript.append_message(b"input_hash", input.output.absolute.tx); + transcript.append_message(b"input_output_index", [input.output.absolute.o]); // Not including this, with a doxxed list of payments, would allow brute forcing the inputs // to determine RNG seeds and therefore the true spends - transcript.append_message(b"input_shared_key", &input.key_offset().to_bytes()); + transcript.append_message(b"input_shared_key", input.key_offset().to_bytes()); } for payment in &self.payments { transcript.append_message(b"payment_address", payment.0.to_string().as_bytes()); - transcript.append_message(b"payment_amount", &payment.1.to_le_bytes()); + transcript.append_message(b"payment_amount", payment.1.to_le_bytes()); } // Sort included before cloning it around @@ -243,7 +243,7 @@ impl SignMachine for TransactionSignMachine { // While each CLSAG will do this as they need to for security, they have their own // transcripts cloned from this TX's initial premise's transcript. For our TX // transcript to have the CLSAG data for entropy, it'll have to be added ourselves here - self.transcript.append_message(b"participant", &(*l).to_be_bytes()); + self.transcript.append_message(b"participant", (*l).to_be_bytes()); let preprocess = if *l == self.i { self.our_preprocess[c].clone() @@ -254,7 +254,7 @@ impl SignMachine for TransactionSignMachine { { let mut buf = vec![]; preprocess.write(&mut buf).unwrap(); - self.transcript.append_message(b"preprocess", &buf); + self.transcript.append_message(b"preprocess", buf); } // While here, calculate the key image diff --git a/coins/monero/tests/send.rs b/coins/monero/tests/send.rs index 2950298a..95aff595 100644 --- a/coins/monero/tests/send.rs +++ b/coins/monero/tests/send.rs @@ -1,9 +1,10 @@ +use core::ops::Deref; use std::{sync::Mutex, collections::HashSet}; #[cfg(feature = "multisig")] use std::collections::HashMap; use lazy_static::lazy_static; - +use zeroize::Zeroizing; use rand_core::OsRng; #[cfg(feature = "multisig")] @@ -55,11 +56,11 @@ async fn send_core(test: usize, multisig: bool) { let rpc = rpc().await; // Generate an address - let spend = random_scalar(&mut OsRng); + let spend = Zeroizing::new(random_scalar(&mut OsRng)); #[allow(unused_mut)] let mut view = random_scalar(&mut OsRng); #[allow(unused_mut)] - let mut spend_pub = &spend * &ED25519_BASEPOINT_TABLE; + let mut spend_pub = spend.deref() * &ED25519_BASEPOINT_TABLE; #[cfg(feature = "multisig")] let keys = key_gen::<_, Ed25519>(&mut OsRng); diff --git a/common/zalloc/Cargo.toml b/common/zalloc/Cargo.toml new file mode 100644 index 00000000..db38f3e2 --- /dev/null +++ b/common/zalloc/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "zalloc" +version = "0.1.0" +description = "An allocator wrapper which zeroizes memory on dealloc" +license = "MIT" +repository = "https://github.com/serai-dex/serai/tree/develop/common/zalloc" +authors = ["Luke Parker "] +keywords = [] +edition = "2021" + +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] + +[dependencies] +zeroize = "1.5" + +[features] +# Commented for now as it requires nightly and we don't use nightly +# allocator = [] diff --git a/common/zalloc/LICENSE b/common/zalloc/LICENSE new file mode 100644 index 00000000..f05b748b --- /dev/null +++ b/common/zalloc/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Luke Parker + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/common/zalloc/src/lib.rs b/common/zalloc/src/lib.rs new file mode 100644 index 00000000..0e4c1f75 --- /dev/null +++ b/common/zalloc/src/lib.rs @@ -0,0 +1,46 @@ +#![cfg_attr(docsrs, feature(doc_cfg))] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] +#![cfg_attr(feature = "allocator", feature(allocator_api))] + +//! Implementation of a Zeroizing Allocator, enabling zeroizing memory on deallocation. +//! This can either be used with Box (requires nightly and the "allocator" feature) to provide the +//! functionality of zeroize on types which don't implement zeroize, or used as a wrapper around +//! the global allocator to ensure *all* memory is zeroized. + +use core::{ + slice, + alloc::{Layout, GlobalAlloc}, +}; + +use zeroize::Zeroize; + +/// An allocator wrapper which zeroizes its memory on dealloc. +pub struct ZeroizingAlloc(pub T); + +#[cfg(feature = "allocator")] +use core::{ + ptr::NonNull, + alloc::{AllocError, Allocator}, +}; +#[cfg(feature = "allocator")] +unsafe impl Allocator for ZeroizingAlloc { + fn allocate(&self, layout: Layout) -> Result, AllocError> { + self.0.allocate(layout) + } + + unsafe fn deallocate(&self, mut ptr: NonNull, layout: Layout) { + slice::from_raw_parts_mut(ptr.as_mut(), layout.size()).zeroize(); + self.0.deallocate(ptr, layout); + } +} + +unsafe impl GlobalAlloc for ZeroizingAlloc { + unsafe fn alloc(&self, layout: Layout) -> *mut u8 { + self.0.alloc(layout) + } + + unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) { + slice::from_raw_parts_mut(ptr, layout.size()).zeroize(); + self.0.dealloc(ptr, layout); + } +} diff --git a/crypto/dkg/Cargo.toml b/crypto/dkg/Cargo.toml index 5e66f467..0a1fcc3c 100644 --- a/crypto/dkg/Cargo.toml +++ b/crypto/dkg/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dkg" -version = "0.1.0" +version = "0.2.0" description = "Distributed key generation over ff/group" license = "MIT" repository = "https://github.com/serai-dex/serai/tree/develop/crypto/dkg" @@ -31,12 +31,12 @@ group = "0.12" ciphersuite = { path = "../ciphersuite", version = "0.1", features = ["std"] } -transcript = { package = "flexible-transcript", path = "../transcript", features = ["recommended"], version = "^0.1.3" } +transcript = { package = "flexible-transcript", path = "../transcript", version = "0.2", features = ["recommended"] } multiexp = { path = "../multiexp", version = "0.2", features = ["batch"] } -schnorr = { package = "schnorr-signatures", path = "../schnorr", version = "0.1.0" } -dleq = { path = "../dleq", version = "^0.1.2", features = ["serialize"] } +schnorr = { package = "schnorr-signatures", path = "../schnorr", version = "0.2" } +dleq = { path = "../dleq", version = "0.2", features = ["serialize"] } [features] tests = [] diff --git a/crypto/dkg/src/frost.rs b/crypto/dkg/src/frost.rs index 9cd6ae2a..343a176f 100644 --- a/crypto/dkg/src/frost.rs +++ b/crypto/dkg/src/frost.rs @@ -1,12 +1,13 @@ use std::{ marker::PhantomData, + ops::Deref, io::{self, Read, Write}, collections::HashMap, }; use rand_core::{RngCore, CryptoRng}; -use zeroize::{Zeroize, ZeroizeOnDrop}; +use zeroize::{Zeroize, ZeroizeOnDrop, Zeroizing}; use digest::Digest; use hkdf::{Hkdf, hmac::SimpleHmac}; @@ -48,12 +49,6 @@ pub struct Commitments { cached_msg: Vec, sig: SchnorrSignature, } -impl Drop for Commitments { - fn drop(&mut self) { - self.zeroize(); - } -} -impl ZeroizeOnDrop for Commitments {} impl Commitments { pub fn read(reader: &mut R, params: ThresholdParams) -> io::Result { @@ -117,9 +112,9 @@ impl KeyGenMachine { for i in 0 .. t { // Step 1: Generate t random values to form a polynomial with - coefficients.push(C::random_nonzero_F(&mut *rng)); + coefficients.push(Zeroizing::new(C::random_nonzero_F(&mut *rng))); // Step 3: Generate public commitments - commitments.push(C::generator() * coefficients[i]); + commitments.push(C::generator() * coefficients[i].deref()); cached_msg.extend(commitments[i].to_bytes().as_ref()); } @@ -127,27 +122,22 @@ impl KeyGenMachine { // It would probably be perfectly fine to use one of our polynomial elements, yet doing so // puts the integrity of FROST at risk. While there's almost no way it could, as it's used in // an ECDH with validated group elemnents, better to avoid any questions on it - let enc_key = C::random_nonzero_F(&mut *rng); - let pub_enc_key = C::generator() * enc_key; + let enc_key = Zeroizing::new(C::random_nonzero_F(&mut *rng)); + let pub_enc_key = C::generator() * enc_key.deref(); cached_msg.extend(pub_enc_key.to_bytes().as_ref()); // Step 2: Provide a proof of knowledge - let mut r = C::random_nonzero_F(rng); + let r = Zeroizing::new(C::random_nonzero_F(rng)); + let nonce = C::generator() * r.deref(); let sig = SchnorrSignature::::sign( - coefficients[0], + &coefficients[0], // This could be deterministic as the PoK is a singleton never opened up to cooperative // discussion // There's no reason to spend the time and effort to make this deterministic besides a // general obsession with canonicity and determinism though r, - challenge::( - &self.context, - self.params.i(), - (C::generator() * r).to_bytes().as_ref(), - &cached_msg, - ), + challenge::(&self.context, self.params.i(), nonce.to_bytes().as_ref(), &cached_msg), ); - r.zeroize(); // Step 4: Broadcast ( @@ -157,19 +147,20 @@ impl KeyGenMachine { coefficients, our_commitments: commitments.clone(), enc_key, + pub_enc_key, }, Commitments { commitments, enc_key: pub_enc_key, cached_msg, sig }, ) } } -fn polynomial(coefficients: &[F], l: u16) -> F { +fn polynomial(coefficients: &[Zeroizing], l: u16) -> Zeroizing { let l = F::from(u64::from(l)); - let mut share = F::zero(); + let mut share = Zeroizing::new(F::zero()); for (idx, coefficient) in coefficients.iter().rev().enumerate() { - share += coefficient; + *share += coefficient.deref(); if idx != (coefficients.len() - 1) { - share *= l; + *share *= l; } } share @@ -250,16 +241,11 @@ fn create_ciphers( pub struct SecretShareMachine { params: ThresholdParams, context: String, - coefficients: Vec, + coefficients: Vec>, our_commitments: Vec, - enc_key: C::F, + enc_key: Zeroizing, + pub_enc_key: C::G, } -impl Drop for SecretShareMachine { - fn drop(&mut self) { - self.zeroize() - } -} -impl ZeroizeOnDrop for SecretShareMachine {} impl SecretShareMachine { /// Verify the data from the previous round (canonicity, PoKs, message authenticity) @@ -276,7 +262,6 @@ impl SecretShareMachine { .drain() .map(|(l, mut msg)| { enc_keys.insert(l, msg.enc_key); - msg.enc_key.zeroize(); // Step 5: Validate each proof of knowledge // This is solely the prep step for the latter batch verification @@ -309,7 +294,7 @@ impl SecretShareMachine { let (commitments, mut enc_keys) = self.verify_r1(&mut *rng, commitments)?; // Step 1: Generate secret shares for all other parties - let mut sender = (C::generator() * self.enc_key).to_bytes(); + let sender = self.pub_enc_key.to_bytes(); let mut ciphers = HashMap::new(); let mut res = HashMap::new(); for l in 1 ..= self.params.n() { @@ -321,7 +306,7 @@ impl SecretShareMachine { let (mut cipher_send, cipher_recv) = { let receiver = enc_keys.get_mut(&l).unwrap(); - let mut ecdh = (*receiver * self.enc_key).to_bytes(); + let mut ecdh = (*receiver * self.enc_key.deref()).to_bytes(); create_ciphers::(sender, &mut receiver.to_bytes(), &mut ecdh) }; @@ -338,11 +323,9 @@ impl SecretShareMachine { share_bytes.as_mut().zeroize(); } self.enc_key.zeroize(); - sender.as_mut().zeroize(); // Calculate our own share let share = polynomial(&self.coefficients, self.params.i()); - self.coefficients.zeroize(); Ok((KeyMachine { params: self.params, secret: share, commitments, ciphers }, res)) @@ -352,7 +335,7 @@ impl SecretShareMachine { /// Final step of the key generation protocol. pub struct KeyMachine { params: ThresholdParams, - secret: C::F, + secret: Zeroizing, ciphers: HashMap, commitments: HashMap>, } @@ -390,9 +373,6 @@ impl KeyMachine { rng: &mut R, mut shares: HashMap>, ) -> Result, DkgError> { - let mut secret_share = self.secret; - self.secret.zeroize(); - validate_map(&shares, &(1 ..= self.params.n()).collect::>(), self.params.i())?; // Calculate the exponent for a given participant and apply it to a series of commitments @@ -414,17 +394,19 @@ impl KeyMachine { cipher.apply_keystream(share_bytes.0.as_mut()); drop(cipher); - let mut share: C::F = - Option::from(C::F::from_repr(share_bytes.0)).ok_or(DkgError::InvalidShare(l))?; + let mut share = Zeroizing::new( + Option::::from(C::F::from_repr(share_bytes.0)).ok_or(DkgError::InvalidShare(l))?, + ); share_bytes.zeroize(); - secret_share += share; + *self.secret += share.deref(); // This can be insecurely linearized from n * t to just n using the below sums for a given // stripe. Doing so uses naive addition which is subject to malleability. The only way to // ensure that malleability isn't present is to use this n * t algorithm, which runs // per sender and not as an aggregate of all senders, which also enables blame let mut values = exponential(self.params.i, &self.commitments[&l]); - values.push((-share, C::generator())); + // multiexp will Zeroize this when it's done with it + values.push((-*share.deref(), C::generator())); share.zeroize(); batch.queue(rng, l, values); @@ -443,14 +425,19 @@ impl KeyMachine { // Calculate each user's verification share let mut verification_shares = HashMap::new(); for i in 1 ..= self.params.n() { - verification_shares.insert(i, multiexp_vartime(&exponential(i, &stripes))); + verification_shares.insert( + i, + if i == self.params.i() { + C::generator() * self.secret.deref() + } else { + multiexp_vartime(&exponential(i, &stripes)) + }, + ); } - // Removing this check would enable optimizing the above from t + (n * t) to t + ((n - 1) * t) - debug_assert_eq!(C::generator() * secret_share, verification_shares[&self.params.i()]); Ok(ThresholdCore { params: self.params, - secret_share, + secret_share: self.secret.clone(), group_key: stripes[0], verification_shares, }) diff --git a/crypto/dkg/src/lib.rs b/crypto/dkg/src/lib.rs index 487513f4..d7239a09 100644 --- a/crypto/dkg/src/lib.rs +++ b/crypto/dkg/src/lib.rs @@ -6,12 +6,12 @@ //! Additional utilities around them, such as promotion from one generator to another, are also //! provided. -use core::fmt::Debug; +use core::{fmt::Debug, ops::Deref}; use std::{io::Read, sync::Arc, collections::HashMap}; use thiserror::Error; -use zeroize::{Zeroize, ZeroizeOnDrop}; +use zeroize::{Zeroize, Zeroizing}; use group::{ ff::{Field, PrimeField}, @@ -153,7 +153,7 @@ pub struct ThresholdCore { params: ThresholdParams, /// Secret share key. - secret_share: C::F, + secret_share: Zeroizing, /// Group key. group_key: C::G, /// Verification shares. @@ -170,17 +170,11 @@ impl Zeroize for ThresholdCore { } } } -impl Drop for ThresholdCore { - fn drop(&mut self) { - self.zeroize() - } -} -impl ZeroizeOnDrop for ThresholdCore {} impl ThresholdCore { pub(crate) fn new( params: ThresholdParams, - secret_share: C::F, + secret_share: Zeroizing, verification_shares: HashMap, ) -> ThresholdCore { #[cfg(debug_assertions)] @@ -198,8 +192,8 @@ impl ThresholdCore { self.params } - pub fn secret_share(&self) -> C::F { - self.secret_share + pub fn secret_share(&self) -> &Zeroizing { + &self.secret_share } pub fn group_key(&self) -> C::G { @@ -253,8 +247,9 @@ impl ThresholdCore { (read_u16()?, read_u16()?, read_u16()?) }; - let secret_share = - C::read_F(reader).map_err(|_| DkgError::InternalError("invalid secret share"))?; + let secret_share = Zeroizing::new( + C::read_F(reader).map_err(|_| DkgError::InternalError("invalid secret share"))?, + ); let mut verification_shares = HashMap::new(); for l in 1 ..= n { @@ -284,32 +279,17 @@ pub struct ThresholdKeys { pub(crate) offset: Option, } -// Manually implement Drop due to https://github.com/RustCrypto/utils/issues/786 -impl Drop for ThresholdKeys { - fn drop(&mut self) { - self.zeroize() - } -} -impl ZeroizeOnDrop for ThresholdKeys {} - /// View of keys passed to algorithm implementations. #[derive(Clone, Zeroize)] pub struct ThresholdView { group_key: C::G, #[zeroize(skip)] included: Vec, - secret_share: C::F, + secret_share: Zeroizing, #[zeroize(skip)] verification_shares: HashMap, } -impl Drop for ThresholdView { - fn drop(&mut self) { - self.zeroize() - } -} -impl ZeroizeOnDrop for ThresholdView {} - impl ThresholdKeys { pub fn new(core: ThresholdCore) -> ThresholdKeys { ThresholdKeys { core: Arc::new(core), offset: None } @@ -336,8 +316,8 @@ impl ThresholdKeys { self.core.params } - pub fn secret_share(&self) -> C::F { - self.core.secret_share + pub fn secret_share(&self) -> &Zeroizing { + &self.core.secret_share } /// Returns the group key with any offset applied. @@ -366,8 +346,9 @@ impl ThresholdKeys { Ok(ThresholdView { group_key: self.group_key(), - secret_share: (self.secret_share() * lagrange::(self.params().i, included)) + - offset_share, + secret_share: Zeroizing::new( + (lagrange::(self.params().i, included) * self.secret_share().deref()) + offset_share, + ), verification_shares: self .verification_shares() .iter() @@ -389,8 +370,8 @@ impl ThresholdView { self.included.clone() } - pub fn secret_share(&self) -> C::F { - self.secret_share + pub fn secret_share(&self) -> &Zeroizing { + &self.secret_share } pub fn verification_share(&self, l: u16) -> C::G { diff --git a/crypto/dkg/src/promote.rs b/crypto/dkg/src/promote.rs index 458c2212..32a410c0 100644 --- a/crypto/dkg/src/promote.rs +++ b/crypto/dkg/src/promote.rs @@ -1,5 +1,5 @@ +use core::{marker::PhantomData, ops::Deref}; use std::{ - marker::PhantomData, io::{self, Read, Write}, sync::Arc, collections::HashMap, @@ -29,8 +29,8 @@ pub trait CiphersuitePromote { fn transcript(key: G, i: u16) -> RecommendedTranscript { let mut transcript = RecommendedTranscript::new(b"FROST Generator Update"); - transcript.append_message(b"group_key", key.to_bytes().as_ref()); - transcript.append_message(b"participant", &i.to_be_bytes()); + transcript.append_message(b"group_key", key.to_bytes()); + transcript.append_message(b"participant", i.to_be_bytes()); transcript } @@ -82,7 +82,7 @@ where ) -> (GeneratorPromotion, GeneratorProof) { // Do a DLEqProof for the new generator let proof = GeneratorProof { - share: C2::generator() * base.secret_share(), + share: C2::generator() * base.secret_share().deref(), proof: DLEqProof::prove( rng, &mut transcript(base.core.group_key(), base.params().i), @@ -120,7 +120,11 @@ where } Ok(ThresholdKeys { - core: Arc::new(ThresholdCore::new(params, self.base.secret_share(), verification_shares)), + core: Arc::new(ThresholdCore::new( + params, + self.base.secret_share().clone(), + verification_shares, + )), offset: None, }) } diff --git a/crypto/dkg/src/tests/mod.rs b/crypto/dkg/src/tests/mod.rs index 2011cd33..999af228 100644 --- a/crypto/dkg/src/tests/mod.rs +++ b/crypto/dkg/src/tests/mod.rs @@ -1,3 +1,4 @@ +use core::ops::Deref; use std::collections::HashMap; use rand_core::{RngCore, CryptoRng}; @@ -38,7 +39,7 @@ pub fn recover_key(keys: &HashMap>) -> C:: let included = keys.keys().cloned().collect::>(); let group_private = keys.iter().fold(C::F::zero(), |accum, (i, keys)| { - accum + (keys.secret_share() * lagrange::(*i, &included)) + accum + (lagrange::(*i, &included) * keys.secret_share().deref()) }); assert_eq!(C::generator() * group_private, first.group_key(), "failed to recover keys"); group_private diff --git a/crypto/dkg/src/tests/promote.rs b/crypto/dkg/src/tests/promote.rs index adc1bd9d..e9fefc07 100644 --- a/crypto/dkg/src/tests/promote.rs +++ b/crypto/dkg/src/tests/promote.rs @@ -1,4 +1,5 @@ -use std::{marker::PhantomData, collections::HashMap}; +use core::{marker::PhantomData, ops::Deref}; +use std::collections::HashMap; use rand_core::{RngCore, CryptoRng}; @@ -54,7 +55,10 @@ pub(crate) fn test_generator_promotion(r assert_eq!(keys[&i].secret_share(), promoted.secret_share()); assert_eq!(new_group_key, promoted.group_key()); for (l, verification_share) in promoted.verification_shares() { - assert_eq!(AltGenerator::::generator() * keys[&l].secret_share(), verification_share); + assert_eq!( + AltGenerator::::generator() * keys[&l].secret_share().deref(), + verification_share + ); } } } diff --git a/crypto/dleq/Cargo.toml b/crypto/dleq/Cargo.toml index dd69598c..15ba6b6d 100644 --- a/crypto/dleq/Cargo.toml +++ b/crypto/dleq/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dleq" -version = "0.1.2" +version = "0.2.0" description = "Implementation of single and cross-curve Discrete Log Equality proofs" license = "MIT" repository = "https://github.com/serai-dex/serai/tree/develop/crypto/dleq" @@ -19,7 +19,7 @@ zeroize = { version = "1.3", features = ["zeroize_derive"] } digest = "0.10" -transcript = { package = "flexible-transcript", path = "../transcript", version = "0.1" } +transcript = { package = "flexible-transcript", path = "../transcript", version = "0.2" } ff = "0.12" group = "0.12" diff --git a/crypto/dleq/src/cross_group/aos.rs b/crypto/dleq/src/cross_group/aos.rs index 0c52d501..3ae5256b 100644 --- a/crypto/dleq/src/cross_group/aos.rs +++ b/crypto/dleq/src/cross_group/aos.rs @@ -62,9 +62,9 @@ where #[allow(non_snake_case)] fn nonces(mut transcript: T, nonces: (G0, G1)) -> (G0::Scalar, G1::Scalar) { transcript.domain_separate(b"aos_membership_proof"); - transcript.append_message(b"ring_len", &u8::try_from(RING_LEN).unwrap().to_le_bytes()); - transcript.append_message(b"nonce_0", nonces.0.to_bytes().as_ref()); - transcript.append_message(b"nonce_1", nonces.1.to_bytes().as_ref()); + transcript.append_message(b"ring_len", u8::try_from(RING_LEN).unwrap().to_le_bytes()); + transcript.append_message(b"nonce_0", nonces.0.to_bytes()); + transcript.append_message(b"nonce_1", nonces.1.to_bytes()); mutual_scalar_from_bytes(transcript.challenge(b"challenge").as_ref()) } diff --git a/crypto/dleq/src/cross_group/bits.rs b/crypto/dleq/src/cross_group/bits.rs index 54774cdd..4f14bda7 100644 --- a/crypto/dleq/src/cross_group/bits.rs +++ b/crypto/dleq/src/cross_group/bits.rs @@ -91,9 +91,9 @@ where { fn transcript(transcript: &mut T, i: usize, commitments: (G0, G1)) { transcript.domain_separate(b"bits"); - transcript.append_message(b"group", &u16::try_from(i).unwrap().to_le_bytes()); - transcript.append_message(b"commitment_0", commitments.0.to_bytes().as_ref()); - transcript.append_message(b"commitment_1", commitments.1.to_bytes().as_ref()); + transcript.append_message(b"group", u16::try_from(i).unwrap().to_le_bytes()); + transcript.append_message(b"commitment_0", commitments.0.to_bytes()); + transcript.append_message(b"commitment_1", commitments.1.to_bytes()); } fn ring(pow_2: (G0, G1), commitments: (G0, G1)) -> Vec<(G0, G1)> { diff --git a/crypto/dleq/src/cross_group/mod.rs b/crypto/dleq/src/cross_group/mod.rs index 57444450..6b5fe2d5 100644 --- a/crypto/dleq/src/cross_group/mod.rs +++ b/crypto/dleq/src/cross_group/mod.rs @@ -1,8 +1,10 @@ +use core::ops::Deref; + use thiserror::Error; use rand_core::{RngCore, CryptoRng}; -use zeroize::Zeroize; +use zeroize::{Zeroize, Zeroizing}; use digest::{Digest, HashMarker}; @@ -18,7 +20,7 @@ pub mod scalar; use scalar::{scalar_convert, mutual_scalar_from_bytes}; pub(crate) mod schnorr; -use schnorr::SchnorrPoK; +use self::schnorr::SchnorrPoK; pub(crate) mod aos; @@ -52,8 +54,8 @@ impl Generators { fn transcript(&self, transcript: &mut T) { transcript.domain_separate(b"generators"); - transcript.append_message(b"primary", self.primary.to_bytes().as_ref()); - transcript.append_message(b"alternate", self.alt.to_bytes().as_ref()); + transcript.append_message(b"primary", self.primary.to_bytes()); + transcript.append_message(b"alternate", self.alt.to_bytes()); } } @@ -153,8 +155,8 @@ where generators.0.transcript(transcript); generators.1.transcript(transcript); transcript.domain_separate(b"points"); - transcript.append_message(b"point_0", keys.0.to_bytes().as_ref()); - transcript.append_message(b"point_1", keys.1.to_bytes().as_ref()); + transcript.append_message(b"point_0", keys.0.to_bytes()); + transcript.append_message(b"point_1", keys.1.to_bytes()); } pub(crate) fn blinding_key( @@ -185,17 +187,17 @@ where rng: &mut R, transcript: &mut T, generators: (Generators, Generators), - f: (G0::Scalar, G1::Scalar), - ) -> (Self, (G0::Scalar, G1::Scalar)) { + f: (Zeroizing, Zeroizing), + ) -> (Self, (Zeroizing, Zeroizing)) { Self::transcript( transcript, generators, - ((generators.0.primary * f.0), (generators.1.primary * f.1)), + ((generators.0.primary * f.0.deref()), (generators.1.primary * f.1.deref())), ); let poks = ( - SchnorrPoK::::prove(rng, transcript, generators.0.primary, f.0), - SchnorrPoK::::prove(rng, transcript, generators.1.primary, f.1), + SchnorrPoK::::prove(rng, transcript, generators.0.primary, &f.0), + SchnorrPoK::::prove(rng, transcript, generators.1.primary, &f.1), ); let mut blinding_key_total = (G0::Scalar::zero(), G1::Scalar::zero()); @@ -269,7 +271,7 @@ where let proof = __DLEqProof { bits, remainder, poks }; debug_assert_eq!( proof.reconstruct_keys(), - (generators.0.primary * f.0, generators.1.primary * f.1) + (generators.0.primary * f.0.deref(), generators.1.primary * f.1.deref()) ); (proof, f) } @@ -286,13 +288,17 @@ where transcript: &mut T, generators: (Generators, Generators), digest: D, - ) -> (Self, (G0::Scalar, G1::Scalar)) { - Self::prove_internal( - rng, - transcript, - generators, - mutual_scalar_from_bytes(digest.finalize().as_ref()), - ) + ) -> (Self, (Zeroizing, Zeroizing)) { + // This pattern theoretically prevents the compiler from moving it, so our protection against + // a copy remaining un-zeroized is actually what's causing a copy. There's still a feeling of + // safety granted by it, even if there's a loss in performance. + let (mut f0, mut f1) = + mutual_scalar_from_bytes::(digest.finalize().as_ref()); + let f = (Zeroizing::new(f0), Zeroizing::new(f1)); + f0.zeroize(); + f1.zeroize(); + + Self::prove_internal(rng, transcript, generators, f) } /// Prove the cross-Group Discrete Log Equality for the points derived from the scalar passed in, @@ -302,9 +308,10 @@ where rng: &mut R, transcript: &mut T, generators: (Generators, Generators), - f0: G0::Scalar, - ) -> Option<(Self, (G0::Scalar, G1::Scalar))> { - scalar_convert(f0).map(|f1| Self::prove_internal(rng, transcript, generators, (f0, f1))) + f0: Zeroizing, + ) -> Option<(Self, (Zeroizing, Zeroizing))> { + scalar_convert(*f0.deref()) // scalar_convert will zeroize it, though this is unfortunate + .map(|f1| Self::prove_internal(rng, transcript, generators, (f0, Zeroizing::new(f1)))) } /// Verify a cross-Group Discrete Log Equality statement, returning the points proven for. diff --git a/crypto/dleq/src/cross_group/schnorr.rs b/crypto/dleq/src/cross_group/schnorr.rs index 564d868e..f6b79dc3 100644 --- a/crypto/dleq/src/cross_group/schnorr.rs +++ b/crypto/dleq/src/cross_group/schnorr.rs @@ -1,6 +1,8 @@ +use core::ops::Deref; + use rand_core::{RngCore, CryptoRng}; -use zeroize::Zeroize; +use zeroize::{Zeroize, Zeroizing}; use transcript::Transcript; @@ -30,13 +32,13 @@ impl SchnorrPoK where G::Scalar: PrimeFieldBits + Zeroize, { - // Not hram due to the lack of m + // Not HRAm due to the lack of m #[allow(non_snake_case)] fn hra(transcript: &mut T, generator: G, R: G, A: G) -> G::Scalar { transcript.domain_separate(b"schnorr_proof_of_knowledge"); - transcript.append_message(b"generator", generator.to_bytes().as_ref()); - transcript.append_message(b"nonce", R.to_bytes().as_ref()); - transcript.append_message(b"public_key", A.to_bytes().as_ref()); + transcript.append_message(b"generator", generator.to_bytes()); + transcript.append_message(b"nonce", R.to_bytes()); + transcript.append_message(b"public_key", A.to_bytes()); challenge(transcript) } @@ -44,18 +46,17 @@ where rng: &mut R, transcript: &mut T, generator: G, - mut private_key: G::Scalar, + private_key: &Zeroizing, ) -> SchnorrPoK { - let mut nonce = G::Scalar::random(rng); + let nonce = Zeroizing::new(G::Scalar::random(rng)); #[allow(non_snake_case)] - let R = generator * nonce; - let res = SchnorrPoK { + let R = generator * nonce.deref(); + SchnorrPoK { R, - s: nonce + (private_key * SchnorrPoK::hra(transcript, generator, R, generator * private_key)), - }; - private_key.zeroize(); - nonce.zeroize(); - res + s: (SchnorrPoK::hra(transcript, generator, R, generator * private_key.deref()) * + private_key.deref()) + + nonce.deref(), + } } pub(crate) fn verify( diff --git a/crypto/dleq/src/lib.rs b/crypto/dleq/src/lib.rs index f170a370..459fe4c9 100644 --- a/crypto/dleq/src/lib.rs +++ b/crypto/dleq/src/lib.rs @@ -1,9 +1,11 @@ #![cfg_attr(docsrs, feature(doc_auto_cfg))] #![cfg_attr(not(feature = "std"), no_std)] +use core::ops::Deref; + use rand_core::{RngCore, CryptoRng}; -use zeroize::Zeroize; +use zeroize::{Zeroize, Zeroizing}; use transcript::Transcript; @@ -70,32 +72,29 @@ pub struct DLEqProof { #[allow(non_snake_case)] impl DLEqProof { fn transcript(transcript: &mut T, generator: G, nonce: G, point: G) { - transcript.append_message(b"generator", generator.to_bytes().as_ref()); - transcript.append_message(b"nonce", nonce.to_bytes().as_ref()); - transcript.append_message(b"point", point.to_bytes().as_ref()); + transcript.append_message(b"generator", generator.to_bytes()); + transcript.append_message(b"nonce", nonce.to_bytes()); + transcript.append_message(b"point", point.to_bytes()); } pub fn prove( rng: &mut R, transcript: &mut T, generators: &[G], - mut scalar: G::Scalar, + scalar: &Zeroizing, ) -> DLEqProof where G::Scalar: Zeroize, { - let mut r = G::Scalar::random(rng); + let r = Zeroizing::new(G::Scalar::random(rng)); transcript.domain_separate(b"dleq"); for generator in generators { - Self::transcript(transcript, *generator, *generator * r, *generator * scalar); + Self::transcript(transcript, *generator, *generator * r.deref(), *generator * scalar.deref()); } let c = challenge(transcript); - let s = r + (c * scalar); - - scalar.zeroize(); - r.zeroize(); + let s = (c * scalar.deref()) + r.deref(); DLEqProof { c, s } } diff --git a/crypto/dleq/src/tests/cross_group/mod.rs b/crypto/dleq/src/tests/cross_group/mod.rs index 84dfcb2a..cabbe9ac 100644 --- a/crypto/dleq/src/tests/cross_group/mod.rs +++ b/crypto/dleq/src/tests/cross_group/mod.rs @@ -1,4 +1,8 @@ +use core::ops::Deref; + use hex_literal::hex; + +use zeroize::Zeroizing; use rand_core::{RngCore, OsRng}; use ff::{Field, PrimeField}; @@ -19,7 +23,6 @@ use crate::{ }; mod scalar; -mod schnorr; mod aos; type G0 = ProjectivePoint; @@ -51,8 +54,8 @@ pub(crate) fn generators() -> (Generators, Generators) { macro_rules! verify_and_deserialize { ($type: ty, $proof: ident, $generators: ident, $keys: ident) => { let public_keys = $proof.verify(&mut OsRng, &mut transcript(), $generators).unwrap(); - assert_eq!($generators.0.primary * $keys.0, public_keys.0); - assert_eq!($generators.1.primary * $keys.1, public_keys.1); + assert_eq!($generators.0.primary * $keys.0.deref(), public_keys.0); + assert_eq!($generators.1.primary * $keys.1.deref(), public_keys.1); #[cfg(feature = "serialize")] { @@ -117,8 +120,8 @@ macro_rules! test_dleq { let mut key; let mut res; while { - key = Scalar::random(&mut OsRng); - res = $type::prove_without_bias(&mut OsRng, &mut transcript(), generators, key); + key = Zeroizing::new(Scalar::random(&mut OsRng)); + res = $type::prove_without_bias(&mut OsRng, &mut transcript(), generators, key.clone()); res.is_none() } {} let res = res.unwrap(); @@ -156,8 +159,13 @@ fn test_rejection_sampling() { assert!( // Either would work - EfficientLinearDLEq::prove_without_bias(&mut OsRng, &mut transcript(), generators(), pow_2) - .is_none() + EfficientLinearDLEq::prove_without_bias( + &mut OsRng, + &mut transcript(), + generators(), + Zeroizing::new(pow_2) + ) + .is_none() ); } @@ -167,13 +175,18 @@ fn test_remainder() { assert_eq!(Scalar::CAPACITY, 255); let generators = (generators().0, generators().0); // This will ignore any unused bits, ensuring every remaining one is set - let keys = mutual_scalar_from_bytes(&[0xFF; 32]); - assert_eq!(keys.0 + Scalar::one(), Scalar::from(2u64).pow_vartime(&[255])); + let keys = mutual_scalar_from_bytes::(&[0xFF; 32]); + let keys = (Zeroizing::new(keys.0), Zeroizing::new(keys.1)); + assert_eq!(Scalar::one() + keys.0.deref(), Scalar::from(2u64).pow_vartime(&[255])); assert_eq!(keys.0, keys.1); - let (proof, res) = - ConciseLinearDLEq::prove_without_bias(&mut OsRng, &mut transcript(), generators, keys.0) - .unwrap(); + let (proof, res) = ConciseLinearDLEq::prove_without_bias( + &mut OsRng, + &mut transcript(), + generators, + keys.0.clone(), + ) + .unwrap(); assert_eq!(keys, res); verify_and_deserialize!( diff --git a/crypto/dleq/src/tests/cross_group/schnorr.rs b/crypto/dleq/src/tests/cross_group/schnorr.rs index 18dd6f1a..e7039e00 100644 --- a/crypto/dleq/src/tests/cross_group/schnorr.rs +++ b/crypto/dleq/src/tests/cross_group/schnorr.rs @@ -1,3 +1,5 @@ +use core::ops::Deref; + use rand_core::OsRng; use zeroize::Zeroize; @@ -20,12 +22,12 @@ where let mut batch = BatchVerifier::new(10); for _ in 0 .. 10 { - let private = G::Scalar::random(&mut OsRng); - SchnorrPoK::prove(&mut OsRng, &mut transcript.clone(), G::generator(), private).verify( + let private = Zeroizing::new(G::Scalar::random(&mut OsRng)); + SchnorrPoK::prove(&mut OsRng, &mut transcript.clone(), G::generator(), &private).verify( &mut OsRng, &mut transcript.clone(), G::generator(), - G::generator() * private, + G::generator() * private.deref(), &mut batch, ); } diff --git a/crypto/dleq/src/tests/mod.rs b/crypto/dleq/src/tests/mod.rs index 115a6fde..099c0d4e 100644 --- a/crypto/dleq/src/tests/mod.rs +++ b/crypto/dleq/src/tests/mod.rs @@ -1,9 +1,11 @@ -#[cfg(feature = "experimental")] -mod cross_group; +use core::ops::Deref; use hex_literal::hex; + use rand_core::OsRng; +use zeroize::Zeroizing; + use ff::Field; use group::GroupEncoding; @@ -13,6 +15,9 @@ use transcript::{Transcript, RecommendedTranscript}; use crate::DLEqProof; +#[cfg(feature = "experimental")] +mod cross_group; + #[test] fn test_dleq() { let transcript = || RecommendedTranscript::new(b"DLEq Proof Test"); @@ -39,12 +44,12 @@ fn test_dleq() { ]; for i in 0 .. 5 { - let key = Scalar::random(&mut OsRng); - let proof = DLEqProof::prove(&mut OsRng, &mut transcript(), &generators[.. i], key); + let key = Zeroizing::new(Scalar::random(&mut OsRng)); + let proof = DLEqProof::prove(&mut OsRng, &mut transcript(), &generators[.. i], &key); let mut keys = [ProjectivePoint::GENERATOR; 5]; for k in 0 .. 5 { - keys[k] = generators[k] * key; + keys[k] = generators[k] * key.deref(); } proof.verify(&mut transcript(), &generators[.. i], &keys[.. i]).unwrap(); diff --git a/crypto/frost/Cargo.toml b/crypto/frost/Cargo.toml index 471af7ad..8d13c657 100644 --- a/crypto/frost/Cargo.toml +++ b/crypto/frost/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "modular-frost" -version = "0.4.1" +version = "0.5.0" description = "Modular implementation of FROST over ff/group" license = "MIT" repository = "https://github.com/serai-dex/serai/tree/develop/crypto/frost" @@ -34,14 +34,14 @@ minimal-ed448 = { path = "../ed448", version = "^0.1.2", optional = true } ciphersuite = { path = "../ciphersuite", version = "0.1", features = ["std"] } -transcript = { package = "flexible-transcript", path = "../transcript", features = ["recommended"], version = "^0.1.3" } +transcript = { package = "flexible-transcript", path = "../transcript", version = "0.2", features = ["recommended"] } multiexp = { path = "../multiexp", version = "0.2", features = ["batch"] } -schnorr = { package = "schnorr-signatures", path = "../schnorr", version = "0.1.0" } -dleq = { path = "../dleq", version = "^0.1.2", features = ["serialize"] } +schnorr = { package = "schnorr-signatures", path = "../schnorr", version = "0.2" } +dleq = { path = "../dleq", version = "0.2", features = ["serialize"] } -dkg = { path = "../dkg", version = "0.1.0" } +dkg = { path = "../dkg", version = "0.2" } [dev-dependencies] serde_json = "1" diff --git a/crypto/frost/src/algorithm.rs b/crypto/frost/src/algorithm.rs index c4f3ceb8..6a0a2ae1 100644 --- a/crypto/frost/src/algorithm.rs +++ b/crypto/frost/src/algorithm.rs @@ -1,6 +1,7 @@ use core::{marker::PhantomData, fmt::Debug}; use std::io::{self, Read, Write}; +use zeroize::Zeroizing; use rand_core::{RngCore, CryptoRng}; use transcript::Transcript; @@ -66,7 +67,7 @@ pub trait Algorithm: Clone { &mut self, params: &ThresholdView, nonce_sums: &[Vec], - nonces: &[C::F], + nonces: Vec>, msg: &[u8], ) -> C::F; @@ -93,8 +94,8 @@ impl Transcript for IetfTranscript { fn domain_separate(&mut self, _: &[u8]) {} - fn append_message(&mut self, _: &'static [u8], message: &[u8]) { - self.0.extend(message); + fn append_message>(&mut self, _: &'static [u8], message: M) { + self.0.extend(message.as_ref()); } fn challenge(&mut self, _: &'static [u8]) -> Vec { @@ -161,12 +162,12 @@ impl> Algorithm for Schnorr { &mut self, params: &ThresholdView, nonce_sums: &[Vec], - nonces: &[C::F], + mut nonces: Vec>, msg: &[u8], ) -> C::F { let c = H::hram(&nonce_sums[0][0], ¶ms.group_key(), msg); self.c = Some(c); - SchnorrSignature::::sign(params.secret_share(), nonces[0], c).s + SchnorrSignature::::sign(params.secret_share(), nonces.swap_remove(0), c).s } #[must_use] diff --git a/crypto/frost/src/curve/mod.rs b/crypto/frost/src/curve/mod.rs index 8fbdd4b8..c9d7cdc6 100644 --- a/crypto/frost/src/curve/mod.rs +++ b/crypto/frost/src/curve/mod.rs @@ -1,8 +1,9 @@ +use core::ops::Deref; use std::io::{self, Read}; use rand_core::{RngCore, CryptoRng}; -use zeroize::Zeroize; +use zeroize::{Zeroize, Zeroizing}; use subtle::ConstantTimeEq; use digest::Digest; @@ -67,26 +68,29 @@ pub trait Curve: Ciphersuite { } /// Securely generate a random nonce. H3 from the IETF draft. - fn random_nonce(mut secret: Self::F, rng: &mut R) -> Self::F { - let mut seed = vec![0; 32]; - rng.fill_bytes(&mut seed); + fn random_nonce( + secret: &Zeroizing, + rng: &mut R, + ) -> Zeroizing { + let mut seed = Zeroizing::new(vec![0; 32]); + rng.fill_bytes(seed.as_mut()); let mut repr = secret.to_repr(); - secret.zeroize(); let mut res; while { seed.extend(repr.as_ref()); - res = ::hash_to_F(b"nonce", &seed); + res = Zeroizing::new(::hash_to_F(b"nonce", seed.deref())); res.ct_eq(&Self::F::zero()).into() } { + seed = Zeroizing::new(vec![0; 32]); rng.fill_bytes(&mut seed); } for i in repr.as_mut() { i.zeroize(); } - seed.zeroize(); + res } diff --git a/crypto/frost/src/nonce.rs b/crypto/frost/src/nonce.rs index 4c80060f..7ea5866b 100644 --- a/crypto/frost/src/nonce.rs +++ b/crypto/frost/src/nonce.rs @@ -8,6 +8,7 @@ // Each nonce remains of the form (d, e) and made into a proper nonce with d + (e * b) // When multiple D, E pairs are provided, a DLEq proof is also provided to confirm their integrity +use core::ops::Deref; use std::{ io::{self, Read, Write}, collections::HashMap, @@ -15,7 +16,7 @@ use std::{ use rand_core::{RngCore, CryptoRng}; -use zeroize::{Zeroize, ZeroizeOnDrop}; +use zeroize::{Zeroize, Zeroizing}; use transcript::Transcript; @@ -33,13 +34,7 @@ fn dleq_transcript() -> T { // Each nonce is actually a pair of random scalars, notated as d, e under the FROST paper // This is considered a single nonce as r = d + be #[derive(Clone, Zeroize)] -pub(crate) struct Nonce(pub(crate) [C::F; 2]); -impl Drop for Nonce { - fn drop(&mut self) { - self.zeroize(); - } -} -impl ZeroizeOnDrop for Nonce {} +pub(crate) struct Nonce(pub(crate) [Zeroizing; 2]); // Commitments to a specific generator for this nonce #[derive(Copy, Clone, PartialEq, Eq)] @@ -70,16 +65,20 @@ pub(crate) struct NonceCommitments { impl NonceCommitments { pub(crate) fn new( rng: &mut R, - mut secret_share: C::F, + secret_share: &Zeroizing, generators: &[C::G], ) -> (Nonce, NonceCommitments) { - let nonce = - Nonce([C::random_nonce(secret_share, &mut *rng), C::random_nonce(secret_share, &mut *rng)]); - secret_share.zeroize(); + let nonce = Nonce::([ + C::random_nonce(secret_share, &mut *rng), + C::random_nonce(secret_share, &mut *rng), + ]); let mut commitments = Vec::with_capacity(generators.len()); for generator in generators { - commitments.push(GeneratorCommitments([*generator * nonce.0[0], *generator * nonce.0[1]])); + commitments.push(GeneratorCommitments([ + *generator * nonce.0[0].deref(), + *generator * nonce.0[1].deref(), + ])); } let mut dleqs = None; @@ -91,7 +90,7 @@ impl NonceCommitments { // TODO: At least include a challenge from the existing transcript DLEqProof::prove(&mut *rng, &mut dleq_transcript::(), generators, nonce) }; - dleqs = Some([dleq(nonce.0[0]), dleq(nonce.0[1])]); + dleqs = Some([dleq(&nonce.0[0]), dleq(&nonce.0[1])]); } (nonce, NonceCommitments { generators: commitments, dleqs }) @@ -145,7 +144,7 @@ pub(crate) struct Commitments { impl Commitments { pub(crate) fn new( rng: &mut R, - secret_share: C::F, + secret_share: &Zeroizing, planned_nonces: &[Vec], ) -> (Vec>, Commitments) { let mut nonces = vec![]; @@ -162,8 +161,8 @@ impl Commitments { pub(crate) fn transcript(&self, t: &mut T) { for nonce in &self.nonces { for commitments in &nonce.generators { - t.append_message(b"commitment_D", commitments.0[0].to_bytes().as_ref()); - t.append_message(b"commitment_E", commitments.0[1].to_bytes().as_ref()); + t.append_message(b"commitment_D", commitments.0[0].to_bytes()); + t.append_message(b"commitment_E", commitments.0[1].to_bytes()); } // Transcripting the DLEqs implicitly transcripts the exact generators used for this nonce @@ -215,7 +214,7 @@ impl BindingFactor { pub(crate) fn calculate_binding_factors(&mut self, transcript: &mut T) { for (l, binding) in self.0.iter_mut() { let mut transcript = transcript.clone(); - transcript.append_message(b"participant", C::F::from(u64::from(*l)).to_repr().as_ref()); + transcript.append_message(b"participant", C::F::from(u64::from(*l)).to_repr()); // It *should* be perfectly fine to reuse a binding factor for multiple nonces // This generates a binding factor per nonce just to ensure it never comes up as a question binding.binding_factors = Some( diff --git a/crypto/frost/src/sign.rs b/crypto/frost/src/sign.rs index a6c4c947..5c70a399 100644 --- a/crypto/frost/src/sign.rs +++ b/crypto/frost/src/sign.rs @@ -1,4 +1,4 @@ -use core::fmt; +use core::{ops::Deref, fmt::Debug}; use std::{ io::{self, Read, Write}, collections::HashMap, @@ -6,7 +6,7 @@ use std::{ use rand_core::{RngCore, CryptoRng}; -use zeroize::{Zeroize, ZeroizeOnDrop}; +use zeroize::Zeroize; use transcript::Transcript; @@ -49,12 +49,6 @@ pub struct Params> { keys: ThresholdKeys, view: ThresholdView, } -impl> Drop for Params { - fn drop(&mut self) { - self.zeroize() - } -} -impl> ZeroizeOnDrop for Params {} impl> Params { pub fn new( @@ -122,7 +116,7 @@ pub trait PreprocessMachine { /// Preprocess message for this machine. type Preprocess: Clone + PartialEq + Writable; /// Signature produced by this machine. - type Signature: Clone + PartialEq + fmt::Debug; + type Signature: Clone + PartialEq + Debug; /// SignMachine this PreprocessMachine turns into. type SignMachine: SignMachine; @@ -213,22 +207,13 @@ pub trait SignMachine { } /// Next step of the state machine for the signing process. +#[derive(Zeroize)] pub struct AlgorithmSignMachine> { params: Params, pub(crate) nonces: Vec>, + #[zeroize(skip)] pub(crate) preprocess: Preprocess, } -impl> Zeroize for AlgorithmSignMachine { - fn zeroize(&mut self) { - self.nonces.zeroize() - } -} -impl> Drop for AlgorithmSignMachine { - fn drop(&mut self) { - self.zeroize() - } -} -impl> ZeroizeOnDrop for AlgorithmSignMachine {} impl> SignMachine for AlgorithmSignMachine { type Preprocess = Preprocess; @@ -266,7 +251,7 @@ impl> SignMachine for AlgorithmSignMachi .params .algorithm .transcript() - .append_message(b"participant", C::F::from(u64::from(*l)).to_repr().as_ref()); + .append_message(b"participant", C::F::from(u64::from(*l)).to_repr()); } if *l == self.params.keys.params().i() { @@ -277,7 +262,7 @@ impl> SignMachine for AlgorithmSignMachi { let mut buf = vec![]; addendum.write(&mut buf).unwrap(); - self.params.algorithm.transcript().append_message(b"addendum", &buf); + self.params.algorithm.transcript().append_message(b"addendum", buf); } B.insert(*l, commitments); @@ -288,7 +273,7 @@ impl> SignMachine for AlgorithmSignMachi { let mut buf = vec![]; preprocess.addendum.write(&mut buf).unwrap(); - self.params.algorithm.transcript().append_message(b"addendum", &buf); + self.params.algorithm.transcript().append_message(b"addendum", buf); } B.insert(*l, preprocess.commitments); @@ -298,7 +283,7 @@ impl> SignMachine for AlgorithmSignMachi // Re-format into the FROST-expected rho transcript let mut rho_transcript = A::Transcript::new(b"FROST_rho"); - rho_transcript.append_message(b"message", &C::hash_msg(msg)); + rho_transcript.append_message(b"message", C::hash_msg(msg)); rho_transcript.append_message( b"preprocesses", &C::hash_commitments( @@ -317,7 +302,7 @@ impl> SignMachine for AlgorithmSignMachi // While further code edits would still be required for such a model (having the offset // communicated as a point along with only a single party applying the offset), this means // it wouldn't require a transcript change as well - rho_transcript.append_message(b"offset", (C::generator() * offset).to_bytes().as_ref()); + rho_transcript.append_message(b"offset", (C::generator() * offset).to_bytes()); } // Generate the per-signer binding factors @@ -329,23 +314,26 @@ impl> SignMachine for AlgorithmSignMachi .params .algorithm .transcript() - .append_message(b"rho_transcript", rho_transcript.challenge(b"merge").as_ref()); + .append_message(b"rho_transcript", rho_transcript.challenge(b"merge")); } #[allow(non_snake_case)] let Rs = B.nonces(&nonces); let our_binding_factors = B.binding_factors(multisig_params.i()); - let mut nonces = self + let nonces = self .nonces - .iter() + .drain(..) .enumerate() - .map(|(n, nonces)| nonces.0[0] + (nonces.0[1] * our_binding_factors[n])) + .map(|(n, nonces)| { + let [base, mut actual] = nonces.0; + *actual *= our_binding_factors[n]; + *actual += base.deref(); + actual + }) .collect::>(); - self.nonces.zeroize(); - let share = self.params.algorithm.sign_share(&self.params.view, &Rs, &nonces, msg); - nonces.zeroize(); + let share = self.params.algorithm.sign_share(&self.params.view, &Rs, nonces, msg); Ok(( AlgorithmSignatureMachine { params: self.params.clone(), B, Rs, share }, diff --git a/crypto/frost/src/tests/vectors.rs b/crypto/frost/src/tests/vectors.rs index 4a64b4ec..f9a6ed23 100644 --- a/crypto/frost/src/tests/vectors.rs +++ b/crypto/frost/src/tests/vectors.rs @@ -1,7 +1,10 @@ +use core::ops::Deref; + use std::collections::HashMap; #[cfg(test)] use std::str::FromStr; +use zeroize::Zeroizing; use rand_core::{RngCore, CryptoRng}; use group::{ff::PrimeField, GroupEncoding}; @@ -103,7 +106,7 @@ fn vectors_to_multisig_keys(vectors: &Vectors) -> HashMap>( let mut machines = machines .drain(..) .map(|(i, machine)| { - let nonces = [ - C::read_F::<&[u8]>(&mut hex::decode(&vectors.nonces[c][0]).unwrap().as_ref()).unwrap(), - C::read_F::<&[u8]>(&mut hex::decode(&vectors.nonces[c][1]).unwrap().as_ref()).unwrap(), - ]; + let nonce = |i| { + Zeroizing::new( + C::read_F::<&[u8]>(&mut hex::decode(&vectors.nonces[c][i]).unwrap().as_ref()).unwrap(), + ) + }; + let nonces = [nonce(0), nonce(1)]; c += 1; - let these_commitments = [C::generator() * nonces[0], C::generator() * nonces[1]]; + let these_commitments = + [C::generator() * nonces[0].deref(), C::generator() * nonces[1].deref()]; let machine = machine.unsafe_override_preprocess( vec![Nonce(nonces)], Preprocess { diff --git a/crypto/multiexp/Cargo.toml b/crypto/multiexp/Cargo.toml index eb107626..0a935289 100644 --- a/crypto/multiexp/Cargo.toml +++ b/crypto/multiexp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "multiexp" -version = "0.2.1" +version = "0.2.2" description = "Multiexponentation algorithms for ff/group" license = "MIT" repository = "https://github.com/serai-dex/serai/tree/develop/crypto/multiexp" diff --git a/crypto/multiexp/src/batch.rs b/crypto/multiexp/src/batch.rs index 398b9b7d..784735f3 100644 --- a/crypto/multiexp/src/batch.rs +++ b/crypto/multiexp/src/batch.rs @@ -7,19 +7,21 @@ use group::Group; use crate::{multiexp, multiexp_vartime}; -#[cfg(feature = "batch")] +/// A batch verifier intended to verify a series of statements are each equivalent to zero. #[derive(Clone, Zeroize)] pub struct BatchVerifier(Vec<(Id, Vec<(G::Scalar, G)>)>); -#[cfg(feature = "batch")] impl BatchVerifier where ::Scalar: PrimeFieldBits + Zeroize, { + /// Create a new batch verifier, expected to verify the following amount of statements. + /// This is a size hint and is not required to be accurate. pub fn new(capacity: usize) -> BatchVerifier { BatchVerifier(Vec::with_capacity(capacity)) } + /// Queue a statement for batch verification. pub fn queue>( &mut self, rng: &mut R, @@ -71,6 +73,7 @@ where self.0.push((id, pairs.into_iter().map(|(scalar, point)| (scalar * u, point)).collect())); } + /// Perform batch verification, returning a boolean of if the statements equaled zero. #[must_use] pub fn verify_core(&self) -> bool { let mut flat = self.0.iter().flat_map(|pairs| pairs.1.iter()).cloned().collect::>(); @@ -79,12 +82,14 @@ where res } + /// Perform batch verification, zeroizing the statements verified. pub fn verify(mut self) -> bool { let res = self.verify_core(); self.zeroize(); res } + /// Perform batch verification in variable time. #[must_use] pub fn verify_vartime(&self) -> bool { multiexp_vartime(&self.0.iter().flat_map(|pairs| pairs.1.iter()).cloned().collect::>()) @@ -92,6 +97,9 @@ where .into() } + /// Perform a binary search to identify which statement does not equal 0, returning None if all + /// statements do. This function will only return the ID of one invalid statement, even if + /// multiple are invalid. // A constant time variant may be beneficial for robust protocols pub fn blame_vartime(&self) -> Option { let mut slice = self.0.as_slice(); @@ -115,12 +123,16 @@ where .map(|(id, _)| *id) } + /// Perform constant time batch verification, and if verification fails, identify one faulty + /// statement in variable time. pub fn verify_with_vartime_blame(mut self) -> Result<(), Id> { let res = if self.verify_core() { Ok(()) } else { Err(self.blame_vartime().unwrap()) }; self.zeroize(); res } + /// Perform variable time batch verification, and if verification fails, identify one faulty + /// statement in variable time. pub fn verify_vartime_with_vartime_blame(&self) -> Result<(), Id> { if self.verify_vartime() { Ok(()) diff --git a/crypto/multiexp/src/lib.rs b/crypto/multiexp/src/lib.rs index d1e5c6f2..d0a4542a 100644 --- a/crypto/multiexp/src/lib.rs +++ b/crypto/multiexp/src/lib.rs @@ -160,7 +160,8 @@ fn algorithm(len: usize) -> Algorithm { } } -// Performs a multiexp, automatically selecting the optimal algorithm based on amount of pairs +/// Performs a multiexponentation, automatically selecting the optimal algorithm based on the +/// amount of pairs. pub fn multiexp(pairs: &[(G::Scalar, G)]) -> G where G::Scalar: PrimeFieldBits + Zeroize, @@ -173,6 +174,8 @@ where } } +/// Performs a multiexponentation in variable time, automatically selecting the optimal algorithm +/// based on the amount of pairs. pub fn multiexp_vartime(pairs: &[(G::Scalar, G)]) -> G where G::Scalar: PrimeFieldBits, diff --git a/crypto/schnorr/Cargo.toml b/crypto/schnorr/Cargo.toml index 2dfd98f4..e99fe96d 100644 --- a/crypto/schnorr/Cargo.toml +++ b/crypto/schnorr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "schnorr-signatures" -version = "0.1.0" +version = "0.2.0" description = "Minimal Schnorr signatures crate hosting common code" license = "MIT" repository = "https://github.com/serai-dex/serai/tree/develop/crypto/schnorr" diff --git a/crypto/schnorr/src/lib.rs b/crypto/schnorr/src/lib.rs index 4a1fc1db..41204688 100644 --- a/crypto/schnorr/src/lib.rs +++ b/crypto/schnorr/src/lib.rs @@ -1,8 +1,9 @@ +use core::ops::Deref; use std::io::{self, Read, Write}; use rand_core::{RngCore, CryptoRng}; -use zeroize::Zeroize; +use zeroize::{Zeroize, Zeroizing}; use group::{ ff::{Field, PrimeField}, @@ -46,11 +47,16 @@ impl SchnorrSignature { } /// Sign a Schnorr signature with the given nonce for the specified challenge. - pub fn sign(mut private_key: C::F, mut nonce: C::F, challenge: C::F) -> SchnorrSignature { - let res = SchnorrSignature { R: C::generator() * nonce, s: nonce + (private_key * challenge) }; - private_key.zeroize(); - nonce.zeroize(); - res + pub fn sign( + private_key: &Zeroizing, + nonce: Zeroizing, + challenge: C::F, + ) -> SchnorrSignature { + SchnorrSignature { + // Uses deref instead of * as * returns C::F yet deref returns &C::F, preventing a copy + R: C::generator() * nonce.deref(), + s: (challenge * private_key.deref()) + nonce.deref(), + } } /// Verify a Schnorr signature for the given key with the specified challenge. diff --git a/crypto/schnorr/src/tests.rs b/crypto/schnorr/src/tests.rs index 280dd6e8..2d24a0a6 100644 --- a/crypto/schnorr/src/tests.rs +++ b/crypto/schnorr/src/tests.rs @@ -1,5 +1,9 @@ +use core::ops::Deref; + use rand_core::OsRng; +use zeroize::Zeroizing; + use blake2::{digest::typenum::U32, Blake2b}; type Blake2b256 = Blake2b; @@ -14,11 +18,11 @@ use crate::{ }; pub(crate) fn sign() { - let private_key = C::random_nonzero_F(&mut OsRng); - let nonce = C::random_nonzero_F(&mut OsRng); + let private_key = Zeroizing::new(C::random_nonzero_F(&mut OsRng)); + let nonce = Zeroizing::new(C::random_nonzero_F(&mut OsRng)); let challenge = C::random_nonzero_F(&mut OsRng); // Doesn't bother to craft an HRAm - assert!(SchnorrSignature::::sign(private_key, nonce, challenge) - .verify(C::generator() * private_key, challenge)); + assert!(SchnorrSignature::::sign(&private_key, nonce, challenge) + .verify(C::generator() * private_key.deref(), challenge)); } // The above sign function verifies signing works @@ -35,16 +39,20 @@ pub(crate) fn batch_verify() { let mut challenges = vec![]; let mut sigs = vec![]; for i in 0 .. 5 { - keys.push(C::random_nonzero_F(&mut OsRng)); + keys.push(Zeroizing::new(C::random_nonzero_F(&mut OsRng))); challenges.push(C::random_nonzero_F(&mut OsRng)); - sigs.push(SchnorrSignature::::sign(keys[i], C::random_nonzero_F(&mut OsRng), challenges[i])); + sigs.push(SchnorrSignature::::sign( + &keys[i], + Zeroizing::new(C::random_nonzero_F(&mut OsRng)), + challenges[i], + )); } // Batch verify { let mut batch = BatchVerifier::new(5); for (i, sig) in sigs.iter().enumerate() { - sig.batch_verify(&mut OsRng, &mut batch, i, C::generator() * keys[i], challenges[i]); + sig.batch_verify(&mut OsRng, &mut batch, i, C::generator() * keys[i].deref(), challenges[i]); } batch.verify_with_vartime_blame().unwrap(); } @@ -60,7 +68,7 @@ pub(crate) fn batch_verify() { if i == 2 { sig.s -= C::F::one(); } - sig.batch_verify(&mut OsRng, &mut batch, i, C::generator() * keys[i], challenges[i]); + sig.batch_verify(&mut OsRng, &mut batch, i, C::generator() * keys[i].deref(), challenges[i]); } if let Err(blame) = batch.verify_with_vartime_blame() { assert!((blame == 1) || (blame == 2)); @@ -76,12 +84,16 @@ pub(crate) fn aggregate() { let mut challenges = vec![]; let mut aggregator = SchnorrAggregator::::new(); for i in 0 .. 5 { - keys.push(C::random_nonzero_F(&mut OsRng)); + keys.push(Zeroizing::new(C::random_nonzero_F(&mut OsRng))); challenges.push(C::random_nonzero_F(&mut OsRng)); aggregator.aggregate( - C::generator() * keys[i], + C::generator() * keys[i].deref(), challenges[i], - SchnorrSignature::::sign(keys[i], C::random_nonzero_F(&mut OsRng), challenges[i]), + SchnorrSignature::::sign( + &keys[i], + Zeroizing::new(C::random_nonzero_F(&mut OsRng)), + challenges[i], + ), ); } @@ -91,7 +103,7 @@ pub(crate) fn aggregate() { assert!(aggregate.verify::( keys .iter() - .map(|key| C::generator() * key) + .map(|key| C::generator() * key.deref()) .zip(challenges.iter().cloned()) .collect::>() .as_ref() diff --git a/crypto/transcript/Cargo.toml b/crypto/transcript/Cargo.toml index 6cffcd94..b75d7173 100644 --- a/crypto/transcript/Cargo.toml +++ b/crypto/transcript/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "flexible-transcript" -version = "0.1.3" +version = "0.2.0" description = "A simple transcript trait definition, along with viable options" license = "MIT" repository = "https://github.com/serai-dex/serai/tree/develop/crypto/transcript" diff --git a/crypto/transcript/src/lib.rs b/crypto/transcript/src/lib.rs index 72324171..b961038a 100644 --- a/crypto/transcript/src/lib.rs +++ b/crypto/transcript/src/lib.rs @@ -18,7 +18,7 @@ pub trait Transcript { fn domain_separate(&mut self, label: &'static [u8]); /// Append a message to the transcript. - fn append_message(&mut self, label: &'static [u8], message: &[u8]); + fn append_message>(&mut self, label: &'static [u8], message: M); /// Produce a challenge. This MUST update the transcript as it does so, preventing the same /// challenge from being generated multiple times. @@ -77,13 +77,13 @@ impl Transcript for DigestTranscript { res } - fn domain_separate(&mut self, label: &[u8]) { + fn domain_separate(&mut self, label: &'static [u8]) { self.append(DigestTranscriptMember::Domain, label); } - fn append_message(&mut self, label: &'static [u8], message: &[u8]) { + fn append_message>(&mut self, label: &'static [u8], message: M) { self.append(DigestTranscriptMember::Label, label); - self.append(DigestTranscriptMember::Value, message); + self.append(DigestTranscriptMember::Value, message.as_ref()); } fn challenge(&mut self, label: &'static [u8]) -> Self::Challenge { diff --git a/crypto/transcript/src/merlin.rs b/crypto/transcript/src/merlin.rs index 242c0249..79f50858 100644 --- a/crypto/transcript/src/merlin.rs +++ b/crypto/transcript/src/merlin.rs @@ -27,8 +27,8 @@ impl Transcript for MerlinTranscript { self.append_message(b"dom-sep", label); } - fn append_message(&mut self, label: &'static [u8], message: &[u8]) { - self.0.append_message(label, message); + fn append_message>(&mut self, label: &'static [u8], message: M) { + self.0.append_message(label, message.as_ref()); } fn challenge(&mut self, label: &'static [u8]) -> Self::Challenge { diff --git a/processor/Cargo.toml b/processor/Cargo.toml index 25eafd5a..695b16e4 100644 --- a/processor/Cargo.toml +++ b/processor/Cargo.toml @@ -15,8 +15,9 @@ rustdoc-args = ["--cfg", "docsrs"] [dependencies] async-trait = "0.1" -rand_core = "0.6" +zeroize = "1.5" thiserror = "1" +rand_core = "0.6" group = "0.12" diff --git a/processor/src/coin/monero.rs b/processor/src/coin/monero.rs index ffa0caf8..322fa3c6 100644 --- a/processor/src/coin/monero.rs +++ b/processor/src/coin/monero.rs @@ -236,6 +236,7 @@ impl Coin for Monero { #[cfg(test)] async fn test_send(&self, address: Self::Address) { + use zeroize::Zeroizing; use rand_core::OsRng; let new_block = self.get_latest_block_number().await.unwrap() + 1; @@ -263,7 +264,7 @@ impl Coin for Monero { self.rpc.get_fee().await.unwrap(), ) .unwrap() - .sign(&mut OsRng, &self.rpc, &Scalar::one()) + .sign(&mut OsRng, &self.rpc, &Zeroizing::new(Scalar::one())) .await .unwrap(); self.rpc.publish_transaction(&tx).await.unwrap(); diff --git a/processor/src/wallet.rs b/processor/src/wallet.rs index 82fadc8a..89bc90f7 100644 --- a/processor/src/wallet.rs +++ b/processor/src/wallet.rs @@ -39,7 +39,7 @@ impl WalletKeys { let mut transcript = RecommendedTranscript::new(DST); transcript.append_message(b"chain", chain); transcript.append_message(b"curve", C::ID); - transcript.append_message(b"group_key", self.keys.group_key().to_bytes().as_ref()); + transcript.append_message(b"group_key", self.keys.group_key().to_bytes()); self.keys.offset(::hash_to_F(DST, &transcript.challenge(b"offset"))) } } @@ -314,12 +314,12 @@ impl Wallet { // Create the transcript for this transaction let mut transcript = RecommendedTranscript::new(b"Serai Processor Wallet Send"); transcript - .append_message(b"canonical_block", &u64::try_from(canonical).unwrap().to_le_bytes()); + .append_message(b"canonical_block", u64::try_from(canonical).unwrap().to_le_bytes()); transcript.append_message( b"acknowledged_block", - &u64::try_from(acknowledged_block).unwrap().to_le_bytes(), + u64::try_from(acknowledged_block).unwrap().to_le_bytes(), ); - transcript.append_message(b"index", &u64::try_from(txs.len()).unwrap().to_le_bytes()); + transcript.append_message(b"index", u64::try_from(txs.len()).unwrap().to_le_bytes()); let tx = self .coin