From 7632755d8fe7c53d4e5964b94e3a388706849a2e Mon Sep 17 00:00:00 2001 From: Himanshu Goyal Date: Thu, 4 Apr 2024 12:54:40 -0400 Subject: [PATCH] Support Non-permissioned builder/ logic refactoring (#68) * working changes * fix qc validation * do cleaning * still vid handler issue * fixing vid join handle WIP * fix test * Rename * pass joinhandle * integraing events streaming api * fix name * WIP committee construction * renaming * remove fetch * update events api * revent events service * serial tempo * build error * fix types * add membership in standalone permissionless * update events-service * update version * fix lint * updates * tag events-service * fix join handle * replace with swap and add await * fix lint * resolve PR comments --- .gitignore | 2 +- Cargo.lock | 1009 ++++++++++++++++++++----------------- Cargo.toml | 25 +- README.md | 5 +- examples/basic.rs | 3 - src/builder_state.rs | 280 +++++----- src/lib.rs | 26 + src/service.rs | 474 ++++++++++++----- src/testing/basic_test.rs | 105 ++-- 9 files changed, 1130 insertions(+), 799 deletions(-) delete mode 100644 examples/basic.rs diff --git a/.gitignore b/.gitignore index e70e9784..b0f0bddc 100644 --- a/.gitignore +++ b/.gitignore @@ -16,5 +16,5 @@ Cargo.lock # Added by cargo -/target +/target* /.vscode \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index b9626f89..55ce6c4f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -82,7 +82,7 @@ dependencies = [ "aes 0.8.4", "cipher 0.4.4", "ctr 0.9.2", - "ghash 0.5.0", + "ghash 0.5.1", "subtle", ] @@ -119,9 +119,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b79b82693f705137f8fb9b37871d99e4f9a7df12b917eed79c3d3954830a60b" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", "getrandom 0.2.12", @@ -132,9 +132,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] @@ -210,9 +210,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.80" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1" +checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" [[package]] name = "arbitrary" @@ -225,9 +225,9 @@ dependencies = [ [[package]] name = "arc-swap" -version = "1.7.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b3d0060af21e8d11a926981cc00c6c1541aa91dd64b9f881985c3da1094425f" +checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" [[package]] name = "ark-bls12-377" @@ -576,6 +576,26 @@ dependencies = [ "pin-project-lite 0.2.13", ] +[[package]] +name = "async-compatibility-layer" +version = "1.0.0" +source = "git+https://github.com/EspressoSystems/async-compatibility-layer.git?tag=1.4.1#568122b0ef39648daee91d16546985d41c3b0b15" +dependencies = [ + "async-channel 1.9.0", + "async-lock 2.8.0", + "async-std", + "async-trait", + "color-eyre", + "console-subscriber 0.1.10", + "flume 0.11.0", + "futures", + "tokio", + "tokio-stream", + "tracing", + "tracing-error", + "tracing-subscriber", +] + [[package]] name = "async-compatibility-layer" version = "1.0.0" @@ -586,7 +606,7 @@ dependencies = [ "async-std", "async-trait", "color-eyre", - "console-subscriber", + "console-subscriber 0.2.0", "flume 0.11.0", "futures", "tokio", @@ -615,8 +635,8 @@ dependencies = [ "async-lock 3.3.0", "async-task", "concurrent-queue", - "fastrand 2.0.1", - "futures-lite 2.2.0", + "fastrand 2.0.2", + "futures-lite 2.3.0", "slab", ] @@ -640,10 +660,10 @@ checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" dependencies = [ "async-channel 2.2.0", "async-executor", - "async-io 2.3.1", + "async-io 2.3.2", "async-lock 3.3.0", "blocking", - "futures-lite 2.2.0", + "futures-lite 2.3.0", "once_cell", "tokio", ] @@ -687,18 +707,18 @@ dependencies = [ [[package]] name = "async-io" -version = "2.3.1" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f97ab0c5b00a7cdbe5a371b9a782ee7be1316095885c8a4ea1daf490eb0ef65" +checksum = "dcccb0f599cfa2f8ace422d3555572f47424da5648a4382a9dd0310ff8210884" dependencies = [ "async-lock 3.3.0", "cfg-if", "concurrent-queue", "futures-io", - "futures-lite 2.2.0", + "futures-lite 2.3.0", "parking", - "polling 3.5.0", - "rustix 0.38.31", + "polling 3.6.0", + "rustix 0.38.32", "slab", "tracing", "windows-sys 0.52.0", @@ -760,7 +780,7 @@ dependencies = [ "cfg-if", "event-listener 3.1.0", "futures-lite 1.13.0", - "rustix 0.38.31", + "rustix 0.38.32", "windows-sys 0.48.0", ] @@ -770,13 +790,13 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e47d90f65a225c4527103a8d747001fc56e375203592b25ad103e1ca13124c5" dependencies = [ - "async-io 2.3.1", + "async-io 2.3.2", "async-lock 2.8.0", "atomic-waker", "cfg-if", "futures-core", "futures-io", - "rustix 0.38.31", + "rustix 0.38.32", "signal-hook-registry", "slab", "windows-sys 0.48.0", @@ -858,7 +878,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -882,13 +902,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.77" +version = "0.1.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" +checksum = "a507401cad91ec6a857ed5513a2073c82a9b9048762b885bb98655b306964681" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -913,7 +933,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4057f2c32adbb2fc158e22fb38433c8e9bbf76b75a4732c7c0cbaf695fb65568" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "futures-sink", "futures-util", "memchr", @@ -926,7 +946,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a860072022177f903e59730004fb5dc13db9275b79bb2aef7ba8ce831956c233" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "futures-sink", "futures-util", "memchr", @@ -954,16 +974,16 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d9a9bf8b79a749ee0b911b91b671cc2b6c670bdbc7e3dfd537576ddc94bb2a2" dependencies = [ - "http 0.2.11", + "http 0.2.12", "log", "url", ] [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "axum" @@ -974,9 +994,9 @@ dependencies = [ "async-trait", "axum-core", "bitflags 1.3.2", - "bytes 1.5.0", + "bytes 1.6.0", "futures-util", - "http 0.2.11", + "http 0.2.12", "http-body", "hyper", "itoa", @@ -1000,9 +1020,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" dependencies = [ "async-trait", - "bytes 1.5.0", + "bytes 1.6.0", "futures-util", - "http 0.2.11", + "http 0.2.12", "http-body", "mime", "rustversion", @@ -1012,9 +1032,9 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line", "cc", @@ -1078,9 +1098,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" dependencies = [ "serde", ] @@ -1109,9 +1129,9 @@ dependencies = [ [[package]] name = "blake3" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0231f06152bf547e9c2b5194f247cd97aacf6dcd8b15d8e5ec0663f64580da87" +checksum = "30cca6d3674597c30ddf2c587bf8d9d65c9a84d2326d941cc79c9842dfe0ef52" dependencies = [ "arrayref", "arrayvec", @@ -1147,9 +1167,9 @@ dependencies = [ "async-channel 2.2.0", "async-lock 3.3.0", "async-task", - "fastrand 2.0.1", + "fastrand 2.0.2", "futures-io", - "futures-lite 2.2.0", + "futures-lite 2.3.0", "piper", "tracing", ] @@ -1168,18 +1188,18 @@ dependencies = [ [[package]] name = "bs58" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" dependencies = [ "tinyvec", ] [[package]] name = "bumpalo" -version = "3.15.3" +version = "3.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea184aa71bb362a1157c896979544cc23974e08fd265f29ea96b59f0b4a555b" +checksum = "7ff69b9dd49fd426c69a0db9fc04dd934cdb6645ff000864d98f7e2af8830eaa" [[package]] name = "byte-slice-cast" @@ -1223,9 +1243,9 @@ checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" [[package]] name = "bytes" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" dependencies = [ "serde", ] @@ -1239,15 +1259,6 @@ dependencies = [ "embedded-io", ] -[[package]] -name = "capnpc" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75ba30e0f08582d53c2f3710cf4bb65ff562614b1ba86906d7391adffe189ec" -dependencies = [ - "capnp", -] - [[package]] name = "cbor4ii" version = "0.3.2" @@ -1259,28 +1270,27 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.88" +version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02f341c093d19155a6e41631ce5971aac4e9a868262212153124c15fa22d1cdc" +checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" [[package]] name = "cdn-broker" version = "0.1.0" -source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.1.9#8f9cc2d56e725a6cc29a792c6ed67e2e9efee756" +source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.1.19#b9b6424db150aee7f78db8172f1324ecc757cc74" dependencies = [ "async-std", "cdn-proto", "clap", "dashmap", - "delegate", "derivative", - "derive_builder 0.13.1", + "derive_builder", "jf-primitives", "lazy_static", "local-ip-address", "parking_lot", - "paste", "prometheus", + "rand 0.8.5", "rkyv", "tokio", "tracing", @@ -1290,12 +1300,12 @@ dependencies = [ [[package]] name = "cdn-client" version = "0.1.0" -source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.1.9#8f9cc2d56e725a6cc29a792c6ed67e2e9efee756" +source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.1.19#b9b6424db150aee7f78db8172f1324ecc757cc74" dependencies = [ "async-std", "cdn-proto", "clap", - "derive_builder 0.13.1", + "derive_builder", "jf-primitives", "rand 0.8.5", "tokio", @@ -1306,12 +1316,12 @@ dependencies = [ [[package]] name = "cdn-marshal" version = "0.1.0" -source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.1.9#8f9cc2d56e725a6cc29a792c6ed67e2e9efee756" +source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.1.19#b9b6424db150aee7f78db8172f1324ecc757cc74" dependencies = [ "async-std", "cdn-proto", "clap", - "derive_builder 0.13.1", + "derive_builder", "jf-primitives", "tokio", "tracing", @@ -1321,14 +1331,13 @@ dependencies = [ [[package]] name = "cdn-proto" version = "0.1.0" -source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.1.9#8f9cc2d56e725a6cc29a792c6ed67e2e9efee756" +source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.1.19#b9b6424db150aee7f78db8172f1324ecc757cc74" dependencies = [ "anyhow", "ark-serialize", "async-std", "async-trait", "capnp", - "capnpc", "derivative", "jf-primitives", "kanal", @@ -1384,9 +1393,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.34" +version = "0.4.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" +checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a" dependencies = [ "android-tzdata", "iana-time-zone", @@ -1419,9 +1428,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.1" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da" +checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" dependencies = [ "clap_builder", "clap_derive", @@ -1429,9 +1438,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.1" +version = "4.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb" +checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" dependencies = [ "anstream", "anstyle", @@ -1441,14 +1450,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.0" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" +checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" dependencies = [ - "heck", + "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -1459,9 +1468,9 @@ checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "color-eyre" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a667583cca8c4f8436db8de46ea8233c42a7d9ae424a82d338f2e4675229204" +checksum = "55146f5e46f237f7423d74111267d4597b59b0dad0ffaf7303bce9945d843ad5" dependencies = [ "backtrace", "color-spantrace", @@ -1496,7 +1505,7 @@ version = "4.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "futures-core", "memchr", "pin-project-lite 0.2.13", @@ -1550,6 +1559,18 @@ dependencies = [ "yaml-rust", ] +[[package]] +name = "console-api" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2895653b4d9f1538a83970077cb01dfc77a4810524e51a110944688e916b18e" +dependencies = [ + "prost 0.11.9", + "prost-types 0.11.9", + "tonic 0.9.2", + "tracing-core", +] + [[package]] name = "console-api" version = "0.6.0" @@ -1557,31 +1578,55 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd326812b3fd01da5bb1af7d340d0d555fd3d4b641e7f1dfcf5962a902952787" dependencies = [ "futures-core", - "prost", - "prost-types", - "tonic", + "prost 0.12.3", + "prost-types 0.12.3", + "tonic 0.10.2", "tracing-core", ] +[[package]] +name = "console-subscriber" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4cf42660ac07fcebed809cfe561dd8730bcd35b075215e6479c516bcd0d11cb" +dependencies = [ + "console-api 0.5.0", + "crossbeam-channel", + "crossbeam-utils", + "futures", + "hdrhistogram", + "humantime", + "prost-types 0.11.9", + "serde", + "serde_json", + "thread_local", + "tokio", + "tokio-stream", + "tonic 0.9.2", + "tracing", + "tracing-core", + "tracing-subscriber", +] + [[package]] name = "console-subscriber" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7481d4c57092cd1c19dd541b92bdce883de840df30aa5d03fd48a3935c01842e" dependencies = [ - "console-api", + "console-api 0.6.0", "crossbeam-channel", "crossbeam-utils", "futures-task", "hdrhistogram", "humantime", - "prost-types", + "prost-types 0.12.3", "serde", "serde_json", "thread_local", "tokio", "tokio-stream", - "tonic", + "tonic 0.10.2", "tracing", "tracing-core", "tracing-subscriber", @@ -1925,7 +1970,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -1948,38 +1993,14 @@ dependencies = [ "synstructure", ] -[[package]] -name = "darling" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" -dependencies = [ - "darling_core 0.14.4", - "darling_macro 0.14.4", -] - [[package]] name = "darling" version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" dependencies = [ - "darling_core 0.20.8", - "darling_macro 0.20.8", -] - -[[package]] -name = "darling_core" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn 1.0.109", + "darling_core", + "darling_macro", ] [[package]] @@ -1993,18 +2014,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.10.0", - "syn 2.0.52", -] - -[[package]] -name = "darling_macro" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" -dependencies = [ - "darling_core 0.14.4", - "quote", - "syn 1.0.109", + "syn 2.0.55", ] [[package]] @@ -2013,9 +2023,9 @@ version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" dependencies = [ - "darling_core 0.20.8", + "darling_core", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -2057,17 +2067,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "delegate" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e018fccbeeb50ff26562ece792ed06659b9c2dae79ece77c4456bb10d9bf79b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.52", -] - [[package]] name = "der" version = "0.7.8" @@ -2122,16 +2121,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", -] - -[[package]] -name = "derive_builder" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f59169f400d8087f238c5c0c7db6a28af18681717f3b623227d92f397e938c7" -dependencies = [ - "derive_builder_macro 0.13.1", + "syn 2.0.55", ] [[package]] @@ -2140,19 +2130,7 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0350b5cb0331628a5916d6c5c0b72e97393b8b6b03b47a9284f4e7f5a405ffd7" dependencies = [ - "derive_builder_macro 0.20.0", -] - -[[package]] -name = "derive_builder_core" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4ec317cc3e7ef0928b0ca6e4a634a4d6c001672ae210438cf114a83e56b018d" -dependencies = [ - "darling 0.14.4", - "proc-macro2", - "quote", - "syn 1.0.109", + "derive_builder_macro", ] [[package]] @@ -2161,20 +2139,10 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d48cda787f839151732d396ac69e3473923d54312c070ee21e9effcaa8ca0b1d" dependencies = [ - "darling 0.20.8", + "darling", "proc-macro2", "quote", - "syn 2.0.52", -] - -[[package]] -name = "derive_builder_macro" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870368c3fb35b8031abb378861d4460f573b92238ec2152c927a21f77e3e0127" -dependencies = [ - "derive_builder_core 0.13.1", - "syn 1.0.109", + "syn 2.0.55", ] [[package]] @@ -2183,8 +2151,8 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "206868b8242f27cecce124c19fd88157fbd0dd334df2587f36417bafbc85097b" dependencies = [ - "derive_builder_core 0.20.0", - "syn 2.0.52", + "derive_builder_core", + "syn 2.0.55", ] [[package]] @@ -2256,7 +2224,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -2349,18 +2317,6 @@ dependencies = [ "serde", ] -[[package]] -name = "embed-doc-image" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af36f591236d9d822425cb6896595658fa558fcebf5ee8accac1d4b92c47166e" -dependencies = [ - "base64 0.13.1", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "embedded-io" version = "0.6.1" @@ -2382,10 +2338,10 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ffccbb6966c05b32ef8fbac435df276c4ae4d3dc55a8cd0eb9745e6c12f546a" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -2396,9 +2352,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "erased-serde" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388979d208a049ffdfb22fa33b9c81942215b940910bccfe258caeb25d125cb3" +checksum = "2b73807008a3c7f171cc40312f37d95ef0396e048b5848d775f54b1a4dd4a0d3" dependencies = [ "serde", ] @@ -2541,15 +2497,15 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" [[package]] name = "fiat-crypto" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1676f435fc1dadde4d03e43f5d62b259e1ce5f40bd4ffb21db2b42ebe59c1382" +checksum = "c007b1ae3abe1cb6f85a16305acd418b7ca6343b953633fee2b76d8f108b830f" [[package]] name = "finl_unicode" @@ -2731,11 +2687,11 @@ dependencies = [ [[package]] name = "futures-lite" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445ba825b27408685aaecefd65178908c36c6e96aaf6d8599419d46e624192ba" +checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" dependencies = [ - "fastrand 2.0.1", + "fastrand 2.0.2", "futures-core", "futures-io", "parking", @@ -2750,7 +2706,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -2857,12 +2813,12 @@ dependencies = [ [[package]] name = "ghash" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" +checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1" dependencies = [ "opaque-debug", - "polyval 0.6.1", + "polyval 0.6.2", ] [[package]] @@ -2891,17 +2847,17 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +checksum = "4fbd2820c5e49886948654ab546d0688ff24530286bdcf8fca3cefb16d4618eb" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "fnv", "futures-core", "futures-sink", "futures-util", - "http 0.2.11", - "indexmap 2.2.5", + "http 0.2.12", + "indexmap 2.2.6", "slab", "tokio", "tokio-util", @@ -2923,7 +2879,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash 0.8.10", + "ahash 0.8.11", ] [[package]] @@ -2932,7 +2888,7 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ - "ahash 0.8.10", + "ahash 0.8.11", "allocator-api2", ] @@ -2965,9 +2921,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270" dependencies = [ "base64 0.21.7", - "bytes 1.5.0", + "bytes 1.6.0", "headers-core", - "http 0.2.11", + "http 0.2.12", "httpdate", "mime", "sha1 0.10.6", @@ -2979,7 +2935,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" dependencies = [ - "http 0.2.11", + "http 0.2.12", ] [[package]] @@ -2991,6 +2947,12 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" version = "0.3.9" @@ -3137,16 +3099,17 @@ dependencies = [ [[package]] name = "hotshot" version = "0.5.26" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.27#8bf55cfb3a1d096c0330ba62d03ed1e5f7298cf8" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.32#10dfcc7065ae99462cdf87538a225e5a562df2a4" dependencies = [ "anyhow", "async-broadcast", - "async-compatibility-layer", + "async-compatibility-layer 1.0.0 (git+https://github.com/EspressoSystems/async-compatibility-layer.git?tag=1.4.2)", "async-lock 2.8.0", "async-std", "async-trait", "bimap", "bincode", + "blake3", "cdn-broker", "cdn-client", "cdn-marshal", @@ -3155,7 +3118,6 @@ dependencies = [ "dashmap", "derive_more", "either", - "embed-doc-image", "ethereum-types", "futures", "hotshot-orchestrator", @@ -3163,9 +3125,10 @@ dependencies = [ "hotshot-task-impls", "hotshot-types", "hotshot-web-server", + "jf-primitives", "libp2p-identity", "libp2p-networking", - "lru", + "lru 0.12.3", "portpicker", "rand 0.8.5", "serde", @@ -3180,10 +3143,11 @@ dependencies = [ [[package]] name = "hotshot-builder-api" version = "0.1.6" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.27#8bf55cfb3a1d096c0330ba62d03ed1e5f7298cf8" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.32#10dfcc7065ae99462cdf87538a225e5a562df2a4" dependencies = [ "async-trait", "clap", + "commit", "derive_more", "futures", "hotshot-types", @@ -3195,14 +3159,66 @@ dependencies = [ "versioned-binary-serialization", ] +[[package]] +name = "hotshot-builder-core" +version = "0.1.2" +dependencies = [ + "async-broadcast", + "async-compatibility-layer 1.0.0 (git+https://github.com/EspressoSystems/async-compatibility-layer.git?tag=1.4.1)", + "async-lock 2.8.0", + "async-std", + "async-trait", + "clap", + "commit", + "futures", + "hotshot", + "hotshot-builder-api", + "hotshot-events-service", + "hotshot-example-types", + "hotshot-types", + "serde", + "sha2 0.10.8", + "snafu 0.8.2", + "surf-disco", + "tagged-base64", + "tide-disco", + "tracing", + "versioned-binary-serialization", +] + +[[package]] +name = "hotshot-events-service" +version = "0.1.1" +source = "git+https://github.com/EspressoSystems/hotshot-events-service.git?tag=0.1.1#ddb375d9bdd857fa5f2ef0255d6f0c24ce4779f3" +dependencies = [ + "async-broadcast", + "async-compatibility-layer 1.0.0 (git+https://github.com/EspressoSystems/async-compatibility-layer.git?tag=1.4.1)", + "async-lock 2.8.0", + "async-std", + "async-trait", + "clap", + "derivative", + "derive_more", + "either", + "futures", + "hotshot-types", + "serde", + "snafu 0.8.2", + "tagged-base64", + "tide-disco", + "toml", + "tracing", + "versioned-binary-serialization", +] + [[package]] name = "hotshot-example-types" version = "0.5.26" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.27#8bf55cfb3a1d096c0330ba62d03ed1e5f7298cf8" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.32#10dfcc7065ae99462cdf87538a225e5a562df2a4" dependencies = [ "anyhow", "async-broadcast", - "async-compatibility-layer", + "async-compatibility-layer 1.0.0 (git+https://github.com/EspressoSystems/async-compatibility-layer.git?tag=1.4.2)", "async-lock 2.8.0", "async-std", "async-trait", @@ -3212,7 +3228,6 @@ dependencies = [ "ethereum-types", "futures", "hotshot", - "hotshot-orchestrator", "hotshot-task", "hotshot-task-impls", "hotshot-types", @@ -3229,17 +3244,20 @@ dependencies = [ [[package]] name = "hotshot-orchestrator" version = "0.5.26" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.27#8bf55cfb3a1d096c0330ba62d03ed1e5f7298cf8" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.32#10dfcc7065ae99462cdf87538a225e5a562df2a4" dependencies = [ - "async-compatibility-layer", + "anyhow", + "async-compatibility-layer 1.0.0 (git+https://github.com/EspressoSystems/async-compatibility-layer.git?tag=1.4.2)", "async-lock 2.8.0", "async-std", + "bincode", "blake3", "clap", "csv", "futures", "hotshot-types", "libp2p", + "multiaddr", "serde", "serde-inline-default", "serde_json", @@ -3255,10 +3273,10 @@ dependencies = [ [[package]] name = "hotshot-task" version = "0.5.26" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.27#8bf55cfb3a1d096c0330ba62d03ed1e5f7298cf8" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.32#10dfcc7065ae99462cdf87538a225e5a562df2a4" dependencies = [ "async-broadcast", - "async-compatibility-layer", + "async-compatibility-layer 1.0.0 (git+https://github.com/EspressoSystems/async-compatibility-layer.git?tag=1.4.2)", "async-std", "futures", "tokio", @@ -3268,10 +3286,10 @@ dependencies = [ [[package]] name = "hotshot-task-impls" version = "0.5.26" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.27#8bf55cfb3a1d096c0330ba62d03ed1e5f7298cf8" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.32#10dfcc7065ae99462cdf87538a225e5a562df2a4" dependencies = [ "async-broadcast", - "async-compatibility-layer", + "async-compatibility-layer 1.0.0 (git+https://github.com/EspressoSystems/async-compatibility-layer.git?tag=1.4.2)", "async-lock 2.8.0", "async-std", "async-trait", @@ -3285,6 +3303,7 @@ dependencies = [ "hotshot-task", "hotshot-types", "jf-primitives", + "memoize", "rand 0.8.5", "serde", "sha2 0.10.8", @@ -3300,7 +3319,7 @@ dependencies = [ [[package]] name = "hotshot-types" version = "0.1.11" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.27#8bf55cfb3a1d096c0330ba62d03ed1e5f7298cf8" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.32#10dfcc7065ae99462cdf87538a225e5a562df2a4" dependencies = [ "anyhow", "ark-bls12-381", @@ -3310,7 +3329,7 @@ dependencies = [ "ark-ff", "ark-serialize", "ark-std", - "async-compatibility-layer", + "async-compatibility-layer 1.0.0 (git+https://github.com/EspressoSystems/async-compatibility-layer.git?tag=1.4.2)", "async-lock 2.8.0", "async-std", "async-trait", @@ -3348,9 +3367,9 @@ dependencies = [ [[package]] name = "hotshot-web-server" version = "0.5.26" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.27#8bf55cfb3a1d096c0330ba62d03ed1e5f7298cf8" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.32#10dfcc7065ae99462cdf87538a225e5a562df2a4" dependencies = [ - "async-compatibility-layer", + "async-compatibility-layer 1.0.0 (git+https://github.com/EspressoSystems/async-compatibility-layer.git?tag=1.4.2)", "async-lock 2.8.0", "async-std", "clap", @@ -3364,47 +3383,24 @@ dependencies = [ "versioned-binary-serialization", ] -[[package]] -name = "hs-builder-core" -version = "0.1.1" -dependencies = [ - "async-broadcast", - "async-compatibility-layer", - "async-lock 2.8.0", - "async-std", - "async-trait", - "clap", - "commit", - "futures", - "hotshot", - "hotshot-builder-api", - "hotshot-example-types", - "hotshot-types", - "serde", - "sha2 0.10.8", - "tagged-base64", - "tide-disco", - "tracing", -] - [[package]] name = "http" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "fnv", "itoa", ] [[package]] name = "http" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "fnv", "itoa", ] @@ -3415,8 +3411,8 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ - "bytes 1.5.0", - "http 0.2.11", + "bytes 1.6.0", + "http 0.2.12", "pin-project-lite 0.2.13", ] @@ -3480,12 +3476,12 @@ version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "futures-channel", "futures-core", "futures-util", "h2", - "http 0.2.11", + "http 0.2.12", "http-body", "httparse", "httpdate", @@ -3521,7 +3517,7 @@ dependencies = [ "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows-core", + "windows-core 0.52.0", ] [[package]] @@ -3575,7 +3571,7 @@ version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6b0422c86d7ce0e97169cc42e04ae643caf278874a7a3c87b8150a220dc7e1e" dependencies = [ - "async-io 2.3.1", + "async-io 2.3.2", "core-foundation", "fnv", "futures", @@ -3597,9 +3593,9 @@ checksum = "064d90fec10d541084e7b39ead8875a5a80d9114a2b18791565253bae25f49e4" dependencies = [ "async-trait", "attohttpc", - "bytes 1.5.0", + "bytes 1.6.0", "futures", - "http 0.2.11", + "http 0.2.12", "hyper", "log", "rand 0.8.5", @@ -3684,9 +3680,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.5" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -3714,7 +3710,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f97967975f448f1a7ddb12b0bc41069d09ed6a1c161a92687e057325db35d413" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", ] [[package]] @@ -3767,7 +3763,7 @@ dependencies = [ "curl-sys", "flume 0.9.2", "futures-lite 1.13.0", - "http 0.2.11", + "http 0.2.12", "log", "once_cell", "slab", @@ -3796,6 +3792,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.12.1" @@ -3807,9 +3812,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jf-plonk" @@ -3929,9 +3934,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.68" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -4012,7 +4017,7 @@ version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "681fb3f183edfbedd7a57d32ebe5dcdc0b9f94061185acf3c30249349cc6fc99" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "either", "futures", "futures-timer", @@ -4148,7 +4153,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fd9bc67af5415858262de3b37eb777159f10c0c349ff3214842faf8179ee087" dependencies = [ "asynchronous-codec 0.6.2", - "bytes 1.5.0", + "bytes 1.6.0", "cuckoofilter", "fnv", "futures", @@ -4172,7 +4177,7 @@ dependencies = [ "asynchronous-codec 0.7.0", "base64 0.21.7", "byteorder", - "bytes 1.5.0", + "bytes 1.6.0", "either", "fnv", "futures", @@ -4209,7 +4214,7 @@ dependencies = [ "libp2p-core", "libp2p-identity", "libp2p-swarm", - "lru", + "lru 0.12.3", "quick-protobuf", "quick-protobuf-codec 0.3.1", "smallvec", @@ -4247,7 +4252,7 @@ checksum = "5cc5767727d062c4eac74dd812c998f0e488008e82cce9c33b463d38423f9ad2" dependencies = [ "arrayvec", "asynchronous-codec 0.7.0", - "bytes 1.5.0", + "bytes 1.6.0", "either", "fnv", "futures", @@ -4275,7 +4280,7 @@ version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49007d9a339b3e1d7eeebc4d67c05dbf23d300b7d091193ec2d3f26802d7faf2" dependencies = [ - "async-io 2.3.1", + "async-io 2.3.2", "async-std", "data-encoding", "futures", @@ -4315,17 +4320,16 @@ dependencies = [ [[package]] name = "libp2p-networking" version = "0.5.26" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.27#8bf55cfb3a1d096c0330ba62d03ed1e5f7298cf8" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.32#10dfcc7065ae99462cdf87538a225e5a562df2a4" dependencies = [ "anyhow", - "async-compatibility-layer", + "async-compatibility-layer 1.0.0 (git+https://github.com/EspressoSystems/async-compatibility-layer.git?tag=1.4.2)", "async-lock 2.8.0", "async-std", "async-trait", "blake3", "custom_debug", - "dashmap", - "derive_builder 0.20.0", + "derive_builder", "either", "futures", "hotshot-types", @@ -4352,7 +4356,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecd0545ce077f6ea5434bcb76e8d0fe942693b4380aaad0d34a358c2bd05793" dependencies = [ "asynchronous-codec 0.7.0", - "bytes 1.5.0", + "bytes 1.6.0", "curve25519-dalek", "futures", "libp2p-core", @@ -4396,7 +4400,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67330af40b67217e746d42551913cfb7ad04c74fa300fb329660a56318590b3f" dependencies = [ "asynchronous-codec 0.6.2", - "bytes 1.5.0", + "bytes 1.6.0", "futures", "libp2p-core", "libp2p-identity", @@ -4426,7 +4430,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0375cdfee57b47b313ef1f0fdb625b78aed770d33a40cf1c294a371ff5e6666" dependencies = [ "async-std", - "bytes 1.5.0", + "bytes 1.6.0", "futures", "futures-timer", "if-watch", @@ -4451,7 +4455,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0aadb213ffc8e1a6f2b9c48dcf0fc07bf370f2ea4db7981813d45e50671c8d9d" dependencies = [ "asynchronous-codec 0.7.0", - "bytes 1.5.0", + "bytes 1.6.0", "either", "futures", "futures-bounded", @@ -4545,10 +4549,10 @@ version = "0.34.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b644268b4acfdaa6a6100b31226ee7a36d96ab4c43287d113bfd2308607d8b6f" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -4656,7 +4660,7 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "libc", "redox_syscall", ] @@ -4722,9 +4726,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.15" +version = "1.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037731f5d3aaa87a5675e895b63ddff1a87624bc29f77004ea829809654e48f6" +checksum = "5e143b5e666b2695d28f6bca6497720813f699c9602dd7f5cac91008b8ada7f9" dependencies = [ "cc", "libc", @@ -4752,9 +4756,9 @@ checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "local-ip-address" -version = "0.5.7" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "612ed4ea9ce5acfb5d26339302528a5e1e59dfed95e9e11af3c083236ff1d15d" +checksum = "136ef34e18462b17bf39a7826f8f3bbc223341f8e83822beb8b77db9a3d49696" dependencies = [ "libc", "neli", @@ -4781,6 +4785,15 @@ dependencies = [ "value-bag", ] +[[package]] +name = "lru" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" +dependencies = [ + "hashbrown 0.12.3", +] + [[package]] name = "lru" version = "0.12.3" @@ -4851,7 +4864,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -4870,6 +4883,29 @@ version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +[[package]] +name = "memoize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5df4051db13d0816cf23196d3baa216385ae099339f5d0645a8d9ff2305e82b8" +dependencies = [ + "lazy_static", + "lru 0.7.8", + "memoize-inner", +] + +[[package]] +name = "memoize-inner" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27bdece7e91f0d1e33df7b46ec187a93ea0d4e642113a1039ac8bfdd4a3273ac" +dependencies = [ + "lazy_static", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "merlin" version = "3.0.0" @@ -4926,13 +4962,9 @@ dependencies = [ [[package]] name = "mnemonic" -version = "1.0.1" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29fae0e4c0b155d3b019a7cbc27abe4a90e15c06814d27889ce9f5f44e2faf77" -dependencies = [ - "byteorder", - "lazy_static", -] +checksum = "f2b8f3a258db515d5e91a904ce4ae3f73e091149b90cadbdb93d210bee07f63b" [[package]] name = "mockall" @@ -4958,7 +4990,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -4967,10 +4999,10 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01acbdc23469fd8fe07ab135923371d5f5a422fbf9c522158677c8eb15bc51c2" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "encoding_rs", "futures-util", - "http 0.2.11", + "http 0.2.12", "httparse", "log", "memchr", @@ -5026,7 +5058,7 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea0df8e5eec2298a62b326ee4f0d7fe1a6b90a09dfcf9df37b38f947a8c42f19" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "futures", "log", "pin-project", @@ -5130,7 +5162,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65b4b14489ab424703c092062176d52ba55485a89c076b4f9db05092b7223aa6" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "futures", "log", "netlink-packet-core", @@ -5146,7 +5178,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6471bf08e7ac0135876a9581bf3217ef0333c191c128d34878079f42ee150411" dependencies = [ "async-io 1.13.0", - "bytes 1.5.0", + "bytes 1.6.0", "futures", "libc", "log", @@ -5232,7 +5264,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -5311,7 +5343,7 @@ version = "0.10.64" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "cfg-if", "foreign-types", "libc", @@ -5328,7 +5360,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -5471,9 +5503,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.7" +version = "2.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "219c0dcc30b6a27553f9cc242972b67f75b60eb0db71f0b5462f38b058c41546" +checksum = "56f8023d0fb78c8e03784ea1c7f3fa36e68a723138990b8d5a47d916b651e7a8" dependencies = [ "memchr", "thiserror", @@ -5482,9 +5514,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.7" +version = "2.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e1288dbd7786462961e69bfd4df7848c1e37e8b74303dbdab82c3a9cdd2809" +checksum = "b0d24f72393fd16ab6ac5738bc33cdb6a9aa73f8b902e8fe29cf4e67d7dd1026" dependencies = [ "pest", "pest_generator", @@ -5492,22 +5524,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.7" +version = "2.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1381c29a877c6d34b8c176e734f35d7f7f5b3adaefe940cb4d1bb7af94678e2e" +checksum = "fdc17e2a6c7d0a492f0158d7a4bd66cc17280308bbaff78d5bef566dca35ab80" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] name = "pest_meta" -version = "2.7.7" +version = "2.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0934d6907f148c22a3acbda520c7eed243ad7487a30f51f6ce52b58b7077a8a" +checksum = "934cd7631c050f4674352a6e835d5f6711ffbfb9345c2fc0107155ac495ae293" dependencies = [ "once_cell", "pest", @@ -5516,22 +5548,22 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -5565,7 +5597,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" dependencies = [ "atomic-waker", - "fastrand 2.0.1", + "fastrand 2.0.2", "futures-io", ] @@ -5620,14 +5652,15 @@ dependencies = [ [[package]] name = "polling" -version = "3.5.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24f040dee2588b4963afb4e420540439d126f73fdacf4a9c486a96d840bac3c9" +checksum = "e0c976a60b2d7e99d6f229e414670a9b85d13ac305cc6d1e9c134de58c5aaaf6" dependencies = [ "cfg-if", "concurrent-queue", + "hermit-abi", "pin-project-lite 0.2.13", - "rustix 0.38.31", + "rustix 0.38.32", "tracing", "windows-sys 0.52.0", ] @@ -5656,9 +5689,9 @@ dependencies = [ [[package]] name = "polyval" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52cff9d1d4dee5fe6d03729099f4a310a41179e0a10dbf542039873f2e826fb" +checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" dependencies = [ "cfg-if", "cpufeatures", @@ -5766,9 +5799,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" dependencies = [ "unicode-ident", ] @@ -5790,9 +5823,9 @@ dependencies = [ [[package]] name = "prometheus-client" -version = "0.22.1" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f87c10af16e0af74010d2a123d202e8363c04db5acfa91d8747f64a8524da3a" +checksum = "c1ca959da22a332509f2a73ae9e5f23f9dcfc31fd3a54d71f159495bd5909baa" dependencies = [ "dtoa", "itoa", @@ -5808,7 +5841,17 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", +] + +[[package]] +name = "prost" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" +dependencies = [ + "bytes 1.6.0", + "prost-derive 0.11.9", ] [[package]] @@ -5817,8 +5860,21 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a" dependencies = [ - "bytes 1.5.0", - "prost-derive", + "bytes 1.6.0", + "prost-derive 0.12.3", +] + +[[package]] +name = "prost-derive" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" +dependencies = [ + "anyhow", + "itertools 0.10.5", + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] @@ -5828,10 +5884,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e" dependencies = [ "anyhow", - "itertools 0.10.5", + "itertools 0.11.0", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", +] + +[[package]] +name = "prost-types" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" +dependencies = [ + "prost 0.11.9", ] [[package]] @@ -5840,7 +5905,7 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "193898f59edcf43c26227dcd4c8427f00d99d61e95dcde58dabd49fa291d470e" dependencies = [ - "prost", + "prost 0.12.3", ] [[package]] @@ -5891,7 +5956,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8ededb1cd78531627244d51dd0c7139fbe736c7d57af0092a76f0ffb2f56e98" dependencies = [ "asynchronous-codec 0.6.2", - "bytes 1.5.0", + "bytes 1.6.0", "quick-protobuf", "thiserror", "unsigned-varint 0.7.2", @@ -5904,7 +5969,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15a0580ab32b169745d7a39db2ba969226ca16738931be152a3209b409de2474" dependencies = [ "asynchronous-codec 0.7.0", - "bytes 1.5.0", + "bytes 1.6.0", "quick-protobuf", "thiserror", "unsigned-varint 0.8.0", @@ -5918,7 +5983,7 @@ checksum = "8cc2c5017e4b43d5995dcea317bc46c1e09404c0a9664d2908f7f02dfe943d75" dependencies = [ "async-io 1.13.0", "async-std", - "bytes 1.5.0", + "bytes 1.6.0", "futures-io", "pin-project-lite 0.2.13", "quinn-proto", @@ -5936,7 +6001,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "141bf7dfde2fbc246bfd3fe12f2455aa24b0fbd9af535d8c86c7bd1381ff2b1a" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "rand 0.8.5", "ring 0.16.20", "rustc-hash", @@ -5954,7 +6019,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "055b4e778e8feb9f93c4e439f71dc2156ef13360b432b799e179a8c4cdf0b1d7" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "libc", "socket2 0.5.6", "tracing", @@ -6049,9 +6114,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4963ed1bc86e4f3ee217022bd855b297cef07fb9eac5dfa1f788b220b49b3bd" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ "either", "rayon-core", @@ -6088,6 +6153,7 @@ dependencies = [ "pem", "ring 0.17.8", "time 0.3.34", + "x509-parser", "yasna", ] @@ -6099,7 +6165,7 @@ checksum = "c580d9cbbe1d1b479e8d67cf9daf6a62c957e6846048408b80b43ac3f6af84cd" dependencies = [ "arc-swap", "async-trait", - "bytes 1.5.0", + "bytes 1.6.0", "combine", "futures", "futures-util", @@ -6137,14 +6203,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.3" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.5", - "regex-syntax 0.8.2", + "regex-automata 0.4.6", + "regex-syntax 0.8.3", ] [[package]] @@ -6158,13 +6224,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.2", + "regex-syntax 0.8.3", ] [[package]] @@ -6175,9 +6241,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "rend" @@ -6236,7 +6302,7 @@ checksum = "5cba464629b3394fc4dbc6f940ff8f5b4ff5c7aef40f29166fd4ad12acbc99c0" dependencies = [ "bitvec", "bytecheck", - "bytes 1.5.0", + "bytes 1.6.0", "hashbrown 0.12.3", "ptr_meta", "rend", @@ -6263,7 +6329,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "rustc-hex", ] @@ -6274,7 +6340,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94" dependencies = [ "base64 0.21.7", - "bitflags 2.4.2", + "bitflags 2.5.0", "serde", "serde_derive", ] @@ -6402,11 +6468,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.31" +version = "0.38.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" +checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "errno", "libc", "linux-raw-sys 0.4.13", @@ -6629,7 +6695,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -6643,9 +6709,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.114" +version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" dependencies = [ "itoa", "ryu", @@ -6694,7 +6760,7 @@ dependencies = [ "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.2.5", + "indexmap 2.2.6", "serde", "serde_derive", "serde_json", @@ -6708,10 +6774,10 @@ version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6561dc161a9224638a31d876ccdfefbc1df91d3f3a8342eddb35f055d48c7655" dependencies = [ - "darling 0.20.8", + "darling", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -6884,9 +6950,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "smartcow" @@ -6951,7 +7017,7 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "990079665f075b699031e9c08fd3ab99be5029b96f3b78dc0709e8f77e4efebf" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "syn 1.0.109", @@ -6963,10 +7029,10 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4b19911debfb8c2fb1107bc6cb2d61868aaf53a988449213959bb1b5b1ed95f" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -7013,7 +7079,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" dependencies = [ "base64 0.13.1", - "bytes 1.5.0", + "bytes 1.6.0", "futures", "httparse", "log", @@ -7085,10 +7151,12 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24ba59a9342a3d9bab6c56c118be528b27c9b60e490080e9711a04dccac83ef6" dependencies = [ - "ahash 0.8.10", + "ahash 0.8.11", + "async-io 1.13.0", + "async-std", "atoi", "byteorder", - "bytes 1.5.0", + "bytes 1.6.0", "crc", "crossbeam-queue", "either", @@ -7100,7 +7168,7 @@ dependencies = [ "futures-util", "hashlink", "hex", - "indexmap 2.2.5", + "indexmap 2.2.6", "log", "memchr", "once_cell", @@ -7138,9 +7206,10 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5833ef53aaa16d860e92123292f1f6a3d53c34ba8b1969f152ef1a7bb803f3c8" dependencies = [ + "async-std", "dotenvy", "either", - "heck", + "heck 0.4.1", "hex", "once_cell", "proc-macro2", @@ -7166,9 +7235,9 @@ checksum = "1ed31390216d20e538e447a7a9b959e06ed9fc51c37b514b46eb758016ecd418" dependencies = [ "atoi", "base64 0.21.7", - "bitflags 2.4.2", + "bitflags 2.5.0", "byteorder", - "bytes 1.5.0", + "bytes 1.6.0", "crc", "digest 0.10.7", "dotenvy", @@ -7209,7 +7278,7 @@ checksum = "7c824eb80b894f926f89a0b9da0c7f435d27cdd35b8c655b114e58223918577e" dependencies = [ "atoi", "base64 0.21.7", - "bitflags 2.4.2", + "bitflags 2.5.0", "byteorder", "crc", "dotenvy", @@ -7363,11 +7432,11 @@ version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6cf59daf282c0a494ba14fd21610a0325f9f90ec9d1231dea26bcb1d696c946" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "rustversion", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -7402,7 +7471,7 @@ dependencies = [ [[package]] name = "surf-disco" version = "0.5.0" -source = "git+https://github.com/EspressoSystems/surf-disco.git?tag=v0.5.0#956cebd8d9784de42ea41fd30ec382de8246cb9c" +source = "git+https://github.com/EspressoSystems/surf-disco?tag=v0.5.0#956cebd8d9784de42ea41fd30ec382de8246cb9c" dependencies = [ "async-std", "async-tungstenite", @@ -7507,9 +7576,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.52" +version = "2.0.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" +checksum = "002a1b3dbf967edfafc32655d0f377ab0bb7b994aa1d32c8cc7e9b8bf3ebb8f0" dependencies = [ "proc-macro2", "quote", @@ -7592,8 +7661,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", - "fastrand 2.0.1", - "rustix 0.38.31", + "fastrand 2.0.2", + "rustix 0.38.32", "windows-sys 0.52.0", ] @@ -7605,22 +7674,22 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "thiserror" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" +checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" +checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -7679,7 +7748,7 @@ dependencies = [ "edit-distance", "futures", "futures-util", - "http 1.0.0", + "http 1.1.0", "include_dir", "lazy_static", "libc", @@ -7832,7 +7901,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", - "bytes 1.5.0", + "bytes 1.6.0", "libc", "mio", "num_cpus", @@ -7863,7 +7932,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -7879,9 +7948,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" +checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" dependencies = [ "futures-core", "pin-project-lite 0.2.13", @@ -7906,7 +7975,7 @@ version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "futures-core", "futures-sink", "pin-project-lite 0.2.13", @@ -7916,14 +7985,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.11" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af06656561d28735e9c1cd63dfd57132c8155426aa6af24f36a00a351f88c48e" +checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.7", + "toml_edit 0.22.9", ] [[package]] @@ -7941,24 +8010,52 @@ version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" dependencies = [ - "indexmap 2.2.5", + "indexmap 2.2.6", "toml_datetime", "winnow 0.5.40", ] [[package]] name = "toml_edit" -version = "0.22.7" +version = "0.22.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18769cd1cec395d70860ceb4d932812a0b4d06b1a4bb336745a4d21b9496e992" +checksum = "8e40bb779c5187258fd7aad0eb68cb8706a0a81fa712fbea808ab43c4b8374c4" dependencies = [ - "indexmap 2.2.5", + "indexmap 2.2.6", "serde", "serde_spanned", "toml_datetime", "winnow 0.6.5", ] +[[package]] +name = "tonic" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3082666a3a6433f7f511c7192923fa1fe07c69332d3c6a2e6bb040b569199d5a" +dependencies = [ + "async-trait", + "axum", + "base64 0.21.7", + "bytes 1.6.0", + "futures-core", + "futures-util", + "h2", + "http 0.2.12", + "http-body", + "hyper", + "hyper-timeout", + "percent-encoding", + "pin-project", + "prost 0.11.9", + "tokio", + "tokio-stream", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + [[package]] name = "tonic" version = "0.10.2" @@ -7969,15 +8066,15 @@ dependencies = [ "async-trait", "axum", "base64 0.21.7", - "bytes 1.5.0", + "bytes 1.6.0", "h2", - "http 0.2.11", + "http 0.2.12", "http-body", "hyper", "hyper-timeout", "percent-encoding", "pin-project", - "prost", + "prost 0.12.3", "tokio", "tokio-stream", "tower", @@ -8038,7 +8135,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -8139,8 +8236,8 @@ checksum = "5fe8dada8c1a3aeca77d6b51a4f1314e0f4b8e438b7b1b71e3ddaca8080e4093" dependencies = [ "base64 0.13.1", "byteorder", - "bytes 1.5.0", - "http 0.2.11", + "bytes 1.6.0", + "http 0.2.12", "httparse", "input_buffer", "log", @@ -8159,9 +8256,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9" dependencies = [ "byteorder", - "bytes 1.5.0", + "bytes 1.6.0", "data-encoding", - "http 0.2.11", + "http 0.2.12", "httparse", "log", "rand 0.8.5", @@ -8270,7 +8367,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6889a77d49f1f013504cec6bf97a2c730394adedaeb1deb5ea08949a50541105" dependencies = [ "asynchronous-codec 0.6.2", - "bytes 1.5.0", + "bytes 1.6.0", ] [[package]] @@ -8323,9 +8420,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" [[package]] name = "valuable" @@ -8335,9 +8432,9 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "value-bag" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126e423afe2dd9ac52142e7e9d5ce4135d7e13776c529d27fd6bc49f19e3280b" +checksum = "74797339c3b98616c009c7c3eb53a0ce41e85c8ec66bd3db96ed132d20cfdee8" dependencies = [ "value-bag-serde1", "value-bag-sval2", @@ -8345,9 +8442,9 @@ dependencies = [ [[package]] name = "value-bag-serde1" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ede32f342edc46e84bd41fd394ce2192b553de11725dd83b6223150610c21b44" +checksum = "cc35703541cbccb5278ef7b589d79439fc808ff0b5867195a3230f9a47421d39" dependencies = [ "erased-serde", "serde", @@ -8356,9 +8453,9 @@ dependencies = [ [[package]] name = "value-bag-sval2" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0024e44b25144c2f4d0ed35d39688e0090d57753e20fef38d08e0c1a40bdf23d" +checksum = "285b43c29d0b4c0e65aad24561baee67a1b69dc9be9375d4a85138cbf556f7f8" dependencies = [ "sval", "sval_buffer", @@ -8420,11 +8517,11 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1e92e22e03ff1230c03a1a8ee37d2f89cd489e2e541b7550d6afad96faed169" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "futures-channel", "futures-util", "headers", - "http 0.2.11", + "http 0.2.12", "hyper", "log", "mime", @@ -8465,9 +8562,9 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" [[package]] name = "wasm-bindgen" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "serde", @@ -8477,24 +8574,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.41" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" dependencies = [ "cfg-if", "js-sys", @@ -8504,9 +8601,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -8514,28 +8611,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "web-sys" -version = "0.3.68" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" dependencies = [ "js-sys", "wasm-bindgen", @@ -8610,7 +8707,7 @@ version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9" dependencies = [ - "windows-core", + "windows-core 0.51.1", "windows-targets 0.48.5", ] @@ -8623,6 +8720,15 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets 0.52.4", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -8816,6 +8922,7 @@ dependencies = [ "lazy_static", "nom", "oid-registry", + "ring 0.16.20", "rusticata-macros", "thiserror", "time 0.3.34", @@ -8902,7 +9009,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] [[package]] @@ -8922,5 +9029,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.55", ] diff --git a/Cargo.toml b/Cargo.toml index e0ce8651..dc940709 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,13 +1,12 @@ [package] -name = "hs-builder-core" -version = "0.1.1" +name = "hotshot-builder-core" +version = "0.1.2" edition = "2021" - # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] async-broadcast = "0.7.0" -async-compatibility-layer = { git = "https://github.com/EspressoSystems/async-compatibility-layer.git", tag = "1.4.2", features = [ +async-compatibility-layer = { git = "https://github.com/EspressoSystems/async-compatibility-layer.git", tag = "1.4.1", features = [ "logging-utils", ] } async-lock = "2.8" @@ -16,12 +15,18 @@ async-trait = "0.1" clap = { version = "4.4", features = ["derive", "env"] } commit = { git = "https://github.com/EspressoSystems/commit.git" } futures = "0.3" -hotshot = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.27" } -hotshot-example-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.27" } -hotshot-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.27" } -hotshot-builder-api = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.27" } -sha2 = "0.10" +hotshot = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.32" } +hotshot-builder-api = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.32" } +hotshot-events-service = { git = "https://github.com/EspressoSystems/hotshot-events-service.git", tag = "0.1.1" } +hotshot-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.32" } serde = { version = "1.0", features = ["derive"] } -tide-disco = { git = "https://github.com/EspressoSystems/tide-disco", tag = "v0.5.0" } +sha2 = "0.10" +snafu = "0.8" +surf-disco = { git = "https://github.com/EspressoSystems/surf-disco", tag = "v0.5.0" } tagged-base64 = { git = "https://github.com/EspressoSystems/tagged-base64", tag = "0.3.4" } +tide-disco = { git = "https://github.com/EspressoSystems/tide-disco", tag = "v0.5.0" } tracing = "0.1" +versioned-binary-serialization = { git = "https://github.com/EspressoSystems/versioned-binary-serialization.git", tag = "0.1.2" } + +[dev-dependencies] +hotshot-example-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.32" } diff --git a/README.md b/README.md index af4e6c8e..65c26e72 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ -# hs-builder-core -Builder support libraries for hotshot +# hotshot-builder-core + +Builder support library for hotshot diff --git a/examples/basic.rs b/examples/basic.rs deleted file mode 100644 index c89b901b..00000000 --- a/examples/basic.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - todo!(); -} diff --git a/src/builder_state.rs b/src/builder_state.rs index 08017a36..850b2ea2 100644 --- a/src/builder_state.rs +++ b/src/builder_state.rs @@ -1,13 +1,7 @@ -// Copyright (c) 2024 Espresso Systems (espressosys.com) -// This file is part of the HotShot Builder Protocol. -// -#![allow(clippy::redundant_field_names)] -#![allow(clippy::too_many_arguments)] use hotshot_types::{ data::{DAProposal, Leaf, QuorumProposal}, - event::LeafChain, + event::{LeafChain, LeafInfo}, message::Proposal, - simple_certificate::QuorumCertificate, traits::block_contents::{BlockHeader, BlockPayload}, traits::{ block_contents::vid_commitment, @@ -20,25 +14,22 @@ use hotshot_types::{ use commit::{Commitment, Committable}; +use crate::service::GlobalState; +use crate::WaitAndKeep; use async_broadcast::Receiver as BroadcastReceiver; -use async_compatibility_layer::art::async_spawn; -use async_compatibility_layer::channel::UnboundedSender; +use async_compatibility_layer::channel::{unbounded, UnboundedSender}; +use async_compatibility_layer::{art::async_spawn, channel::UnboundedReceiver}; use async_lock::RwLock; -use async_std::task; -use async_std::task::JoinHandle; use async_trait::async_trait; -use futures::StreamExt; //::select_all; - use core::panic; -use std::collections::hash_map::Entry; +use futures::StreamExt; +use std::collections::{hash_map::Entry, BTreeSet}; use std::collections::{BTreeMap, HashMap, HashSet}; use std::fmt::Debug; use std::sync::Arc; use std::time::SystemTime; use std::{cmp::PartialEq, num::NonZeroUsize}; -use crate::service::GlobalState; - pub type TxTimeStamp = u128; /// Enum to hold the different sources of the transaction @@ -58,7 +49,6 @@ pub struct TransactionMessage { #[derive(Clone, Debug)] pub struct DecideMessage { pub leaf_chain: Arc>, - pub qc: Arc>, pub block_size: Option, } /// DA Proposal Message to be put on the da proposal channel @@ -78,23 +68,22 @@ pub struct QCMessage { #[derive(Clone, Debug, PartialEq)] pub struct RequestMessage { pub requested_vid_commitment: VidCommitment, - //pub total_nodes: usize } /// Response Message to be put on the response channel #[derive(Debug)] pub struct BuildBlockInfo { - pub builder_hash: BuilderCommitment, //TODO: Need to pull out from hotshot + pub builder_hash: BuilderCommitment, pub block_size: u64, pub offered_fee: u64, pub block_payload: TYPES::BlockPayload, pub metadata: <::BlockPayload as BlockPayload>::Metadata, - pub join_handle: Arc>, + pub vid_receiver: UnboundedReceiver, } /// Response Message to be put on the response channel #[derive(Debug, Clone)] pub struct ResponseMessage { - pub builder_hash: BuilderCommitment, //TODO: Need to pull out from hotshot + pub builder_hash: BuilderCommitment, pub block_size: u64, pub offered_fee: u64, } @@ -162,7 +151,14 @@ pub struct BuilderState { // builder Commitements pub builder_commitments: Vec, + + // bootstrapped view number + pub bootstrap_view_number: TYPES::Time, + + // list of views for which we have builder spwaned clones + pub spawned_clones_views_list: Arc>>, } + /// Trait to hold the helper functions for the builder #[async_trait] pub trait BuilderProgress { @@ -173,16 +169,16 @@ pub trait BuilderProgress { fn process_hotshot_transaction(&mut self, tx: TYPES::Transaction); /// process the DA proposal - fn process_da_proposal(&mut self, da_msg: DAProposalMessage); + async fn process_da_proposal(&mut self, da_msg: DAProposalMessage); /// process the quorum proposal - fn process_quorum_proposal(&mut self, qc_msg: QCMessage); + async fn process_quorum_proposal(&mut self, qc_msg: QCMessage); /// process the decide event async fn process_decide_event(&mut self, decide_msg: DecideMessage) -> Option; /// spawn a clone of builder - fn spawn_clone( + async fn spawn_clone( self, da_proposal: DAProposal, quorum_proposal: QuorumProposal, @@ -190,7 +186,7 @@ pub trait BuilderProgress { ); /// build a block - fn build_block(&mut self, matching_vid: VidCommitment) -> Option>; + async fn build_block(&mut self, matching_vid: VidCommitment) -> Option>; /// Event Loop fn event_loop(self); @@ -206,10 +202,6 @@ impl BuilderProgress for BuilderState { fn process_external_transaction(&mut self, tx: TYPES::Transaction) { // PRIVATE MEMPOOL TRANSACTION PROCESSING tracing::info!("Processing external transaction"); - // check if the transaction already exists in either the included set or the local tx pool - // if it exits, then we can ignore it and return - // else we can insert it into local tx pool - // get tx_hash as keu let tx_hash = tx.commit(); // If it already exists, then discard it. Decide the existence based on the tx_hash_tx and check in both the local pool and already included txns if self.tx_hash_to_available_txns.contains_key(&tx_hash) @@ -259,22 +251,34 @@ impl BuilderProgress for BuilderState { } /// processing the DA proposal - #[tracing::instrument(skip_all, name = "process da proposal", + #[tracing::instrument(skip_all, name = "process da proposal", fields(builder_view=%self.built_from_view_vid_leaf.0.get_u64(), builder_vid=%self.built_from_view_vid_leaf.1.clone(), builder_leaf=%self.built_from_view_vid_leaf.2.clone()))] - fn process_da_proposal(&mut self, da_msg: DAProposalMessage) { - // Validation - // check for view number - // check for signature validation and correct leader (both of these are done in the service.rs i.e. before putting hotshot events onto the da channel) - - // bootstrapping part - // if the view number is 0 and no more clone is active then keep going, and don't return from it - if self.built_from_view_vid_leaf.0.get_u64() == 0 && self.tx_receiver.receiver_count() <= 1 + async fn process_da_proposal(&mut self, da_msg: DAProposalMessage) { + tracing::debug!("Builder Received DA message {:?}", da_msg); + + // Two cases to handle: + // Case 1: Bootstrapping phase + // Case 2: No intended builder state exist + // To handle both cases, we can have the bootstrap builder running, + // and only doing the insertion if and only if intended builder state for a particulat view is not present + // check the presense of da_msg.proposal.data.view_number-1 in the spawned_clones_views_list + if self.built_from_view_vid_leaf.0.get_u64() == self.bootstrap_view_number.get_u64() + && (da_msg.proposal.data.view_number.get_u64() == 0 + || !self + .spawned_clones_views_list + .read() + .await + .contains(&(da_msg.proposal.data.view_number - 1))) { - tracing::info!("In bootstrapping phase"); - } else if da_msg.proposal.data.view_number <= self.built_from_view_vid_leaf.0 { - tracing::info!("View number is lesser or equal from the built_from_view, so returning"); + tracing::info!("DA Proposal handled by bootstrapped builder state"); + } + // Do the validation check + else if da_msg.proposal.data.view_number.get_u64() + != self.built_from_view_vid_leaf.0.get_u64() + 1 + { + tracing::info!("View number is not equal to built_from_view + 1, so returning"); return; } @@ -311,7 +315,7 @@ impl BuilderProgress for BuilderState { let da_proposal_data = DAProposal { encoded_transactions: encoded_txns.clone(), metadata: metadata.clone(), - view_number: view_number, + view_number, }; // if we have matching da and quorum proposals, we can skip storing the one, and remove the other from storage, and call build_block with both, to save a little space. @@ -322,16 +326,30 @@ impl BuilderProgress for BuilderState { let qc_proposal_data = qc_proposal_data.remove(); // make sure we don't clone for the bootstrapping da and qc proposals - if qc_proposal_data.view_number.get_u64() != 0 { - tracing::info!("Spawning a clone"); + // also make sure we clone for the same view number( check incase payload commitments are same) + // this will handle the case when the intended builder state can spwan + if qc_proposal_data.view_number == view_number { + tracing::info!("Spawning a clone from process DA proposal"); + // remove this entry from the qc_proposal_payload_commit_to_quorum_proposal hashmap + self.quorum_proposal_payload_commit_to_quorum_proposal + .remove(&payload_vid_commitment); + + // Before spawning a clone add the view number to the spawned_clones_views_list + self.spawned_clones_views_list + .write() + .await + .insert(qc_proposal_data.view_number); self.clone() - .spawn_clone(da_proposal_data, qc_proposal_data, sender); + .spawn_clone(da_proposal_data, qc_proposal_data, sender) + .await; } else { - tracing::info!("Not spawning a clone despite matching DA and QC proposals, as they corresponds to bootstrapping phase"); + tracing::info!("Not spawning a clone despite matching DA and QC payload commitments, as they corresponds to different view numbers"); } } else { e.insert(da_proposal_data); } + } else { + tracing::info!("Payload commitment already exists in the da_proposal_payload_commit_to_da_proposal hashmap, so ignoring it"); } } @@ -341,28 +359,34 @@ impl BuilderProgress for BuilderState { fields(builder_view=%self.built_from_view_vid_leaf.0.get_u64(), builder_vid=%self.built_from_view_vid_leaf.1.clone(), builder_leaf=%self.built_from_view_vid_leaf.2.clone()))] - fn process_quorum_proposal(&mut self, qc_msg: QCMessage) { - // Validation - // check for view number - // check for the leaf commitment - // check for signature validation and correct leader (both of these are done in the service.rs i.e. before putting hotshot events onto the da channel) - // can use this commitment to match the da proposal or vice-versa - - // bootstrapping part - // if the view number is 0 and no more clone is active then keep going, and don't return from it - if self.built_from_view_vid_leaf.0.get_u64() == 0 && self.tx_receiver.receiver_count() <= 1 + async fn process_quorum_proposal(&mut self, qc_msg: QCMessage) { + tracing::debug!("Builder Received QC Message{:?}", qc_msg); + // Two cases to handle: + // Case 1: Bootstrapping phase + // Case 2: No intended builder state exist + // To handle both cases, we can have the bootstrap builder running, + // and only doing the insertion if and only if intended builder state for a particulat view is not present + // check the presense of da_msg.proposal.data.view_number-1 in the spawned_clones_views_list + if self.built_from_view_vid_leaf.0.get_u64() == self.bootstrap_view_number.get_u64() + && (qc_msg.proposal.data.view_number.get_u64() == 0 + || !self + .spawned_clones_views_list + .read() + .await + .contains(&(qc_msg.proposal.data.view_number - 1))) { - tracing::info!("In bootstrapping phase"); + tracing::info!("QC Proposal handled by bootstrapped builder state"); } else if qc_msg.proposal.data.justify_qc.view_number != self.built_from_view_vid_leaf.0 || qc_msg.proposal.data.justify_qc.get_data().leaf_commit != self.built_from_view_vid_leaf.2 { - tracing::info!("Either View number or leaf commit from justify qc does not match the built-in info, so returning"); + tracing::info!("Either View number {:?} or leaf commit{:?} from justify qc does not match the built-in info {:?}, so returning", + qc_msg.proposal.data.justify_qc.view_number, qc_msg.proposal.data.justify_qc.get_data().leaf_commit, self.built_from_view_vid_leaf); return; } let qc_proposal_data = qc_msg.proposal.data; let sender = qc_msg.sender; - + let view_number = qc_proposal_data.view_number; let payload_vid_commitment = qc_proposal_data.block_header.payload_commitment(); tracing::debug!( "Extracted payload commitment from the quorum proposal: {:?}", @@ -380,17 +404,28 @@ impl BuilderProgress for BuilderState { { let da_proposal_data = da_proposal_data.remove(); - // make sure we don't clone for the bootstrapping da and qc proposals - if da_proposal_data.view_number.get_u64() != 0 { - tracing::info!("Spawning a clone"); + // remove the entry from the da_proposal_payload_commit_to_da_proposal hashmap + self.da_proposal_payload_commit_to_da_proposal + .remove(&payload_vid_commitment); + + // also make sure we clone for the same view number( check incase payload commitments are same) + if da_proposal_data.view_number == view_number { + tracing::info!("Spawning a clone from process QC proposal"); + self.spawned_clones_views_list + .write() + .await + .insert(da_proposal_data.view_number); self.clone() - .spawn_clone(da_proposal_data, qc_proposal_data, sender); + .spawn_clone(da_proposal_data, qc_proposal_data, sender) + .await; } else { - tracing::info!("Not spawning a clone despite matching DA and QC proposals, as they corresponds to bootstrapping phase"); + tracing::info!("Not spawning a clone despite matching DA and QC payload commitments, as they corresponds to different view numbers"); } } else { e.insert(qc_proposal_data.clone()); } + } else { + tracing::info!("Payload commitment already exists in the quorum_proposal_payload_commit_to_quorum_proposal hashmap, so ignoring it"); } } @@ -404,29 +439,36 @@ impl BuilderProgress for BuilderState { // if you haven't launched the clone, then you don't exit, you need atleast one clone to function properly // the special value can be 0 itself, or a view number 0 is also right answer let leaf_chain = decide_msg.leaf_chain; - let _qc = decide_msg.qc; + //let _qc = decide_msg.qc; let _block_size = decide_msg.block_size; - let _latest_decide_parent_commitment = leaf_chain[0].leaf.parent_commitment; + let _latest_decide_parent_commitment = leaf_chain[0].leaf.get_parent_commitment(); let _latest_decide_commitment = leaf_chain[0].leaf.commit(); - let leaf_view_number = leaf_chain[0].leaf.view_number; + let latest_leaf_view_number = leaf_chain[0].leaf.get_view_number(); // bootstrapping case // handle the case when we hear a decide event before we have atleast one clone, in that case, we might exit the builder // and not make any progress; so we need to handle that case // Adhoc logic: if the number of subscrived receivers are more than 1, it means that there exists a clone and we can safely exit - if self.built_from_view_vid_leaf.0.get_u64() == 0 && self.tx_receiver.receiver_count() <= 1 - { - tracing::info!("In bootstrapping phase"); + if self.built_from_view_vid_leaf.0.get_u64() == self.bootstrap_view_number.get_u64() { + tracing::info!("Bootstrapped builder state, should continue"); + // split_off returns greater than equal to set, so we want everything after the latest decide event + let split_list = self + .spawned_clones_views_list + .write() + .await + .split_off(&(latest_leaf_view_number + 1)); + + // update the spawned_clones_views_list with the splitted list now + *self.spawned_clones_views_list.write().await = split_list; //return Some(Status::ShouldContinue); - } else if self.built_from_view_vid_leaf.0 <= leaf_view_number { - tracing::info!("The decide event is not for the next view, so ignoring it"); + } else if self.built_from_view_vid_leaf.0 <= latest_leaf_view_number { + tracing::info!("Built-in view is less than equal to the currently decided leaf so exiting the builder state"); // convert leaf commitments into buildercommiments - //let leaf_commitments:Vec = leaf_chain.iter().map(|leaf| leaf.get_block_payload().unwrap().builder_commitment(&leaf.get_block_header().metadata())).collect(); - // remove the handles from the global state + // TODO: Does it make sense to remove it here or should we remove in api responses? self.global_state.write_arc().await.remove_handles( self.built_from_view_vid_leaf.1, self.builder_commitments.clone(), @@ -436,8 +478,8 @@ impl BuilderProgress for BuilderState { } // go through all the leafs - for leaf in leaf_chain.iter() { - let block_payload = leaf.leaf.get_block_payload(); + for LeafInfo { leaf, .. } in leaf_chain.iter() { + let block_payload = leaf.get_block_payload(); match block_payload { Some(block_payload) => { tracing::debug!("Block payload in decide event {:?}", block_payload); @@ -472,30 +514,23 @@ impl BuilderProgress for BuilderState { fields(builder_view=%self.built_from_view_vid_leaf.0.get_u64(), builder_vid=%self.built_from_view_vid_leaf.1.clone(), builder_leaf=%self.built_from_view_vid_leaf.2.clone()))] - fn spawn_clone( + async fn spawn_clone( mut self, da_proposal: DAProposal, quorum_proposal: QuorumProposal, - leader: TYPES::SignatureKey, + _leader: TYPES::SignatureKey, ) { self.built_from_view_vid_leaf.0 = quorum_proposal.view_number; self.built_from_view_vid_leaf.1 = quorum_proposal.block_header.payload_commitment(); - let leaf: Leaf<_> = Leaf { - view_number: quorum_proposal.view_number, - justify_qc: quorum_proposal.justify_qc.clone(), - parent_commitment: quorum_proposal.justify_qc.get_data().leaf_commit, - block_header: quorum_proposal.block_header.clone(), - block_payload: None, - proposer_id: leader, - }; + let leaf = Leaf::from_quorum_proposal(&quorum_proposal); + self.built_from_view_vid_leaf.2 = leaf.commit(); let payload = ::from_bytes( da_proposal.encoded_transactions.clone().into_iter(), quorum_proposal.block_header.metadata(), ); - payload .transaction_commitments(quorum_proposal.block_header.metadata()) .iter() @@ -515,7 +550,7 @@ impl BuilderProgress for BuilderState { fields(builder_view=%self.built_from_view_vid_leaf.0.get_u64(), builder_vid=%self.built_from_view_vid_leaf.1.clone(), builder_leaf=%self.built_from_view_vid_leaf.2.clone()))] - fn build_block(&mut self, _matching_vid: VidCommitment) -> Option> { + async fn build_block(&mut self, _matching_vid: VidCommitment) -> Option> { if let Ok((payload, metadata)) = ::from_transactions( self.timestamp_to_tx.iter().filter_map(|(_ts, tx_hash)| { self.tx_hash_to_available_txns @@ -528,49 +563,48 @@ impl BuilderProgress for BuilderState { // add the local builder commitment list self.builder_commitments.push(builder_hash.clone()); - //let num_txns = ::txn_count(&payload); let encoded_txns: Vec = payload.encode().unwrap().collect(); - let block_size: u64 = encoded_txns.len() as u64; - let offered_fee: u64 = 0; // get the total nodes from the builder state. // stored while processing the DA Proposal let vid_num_nodes = self.total_nodes.get(); - // convert vid_num_nodes to usize - // spawn a task to calculate the VID commitment, and pass the builder handle to the global state + // spawn a task to calculate the VID commitment, and pass the handle to the global state // later global state can await on it before replying to the proposer - let join_handle = - task::spawn(async move { vid_commitment(&encoded_txns, vid_num_nodes) }); - - //let signature = self.builder_keys.0.sign(&block_hash); - return Some(BuildBlockInfo { - builder_hash: builder_hash, - block_size: block_size, - offered_fee: offered_fee, - block_payload: payload, - metadata: metadata, - join_handle: Arc::new(join_handle), + let (unbounded_sender, unbounded_reciever) = unbounded(); + #[allow(unused_must_use)] + async_spawn(async move { + let vidc = vid_commitment(&encoded_txns, vid_num_nodes); + unbounded_sender.send(vidc).await; }); - }; - tracing::warn!("build block, returning None"); - None + Some(BuildBlockInfo { + builder_hash, + block_size, + offered_fee, + block_payload: payload, + metadata, + vid_receiver: unbounded_reciever, + }) + } else { + tracing::warn!("build block, returning None"); + None + } } async fn process_block_request(&mut self, req: RequestMessage) { let requested_vid_commitment = req.requested_vid_commitment; - //let vid_nodes = req.total_nodes; if requested_vid_commitment == self.built_from_view_vid_leaf.1 { - let response = self.build_block(requested_vid_commitment); + let response = self.build_block(requested_vid_commitment).await; + match response { Some(response) => { tracing::info!( "Builder {:?} Sending response {:?} to the request{:?}", self.built_from_view_vid_leaf, - response, + response.builder_hash, req ); @@ -580,7 +614,9 @@ impl BuilderProgress for BuilderState { block_size: response.block_size, offered_fee: response.offered_fee, }; + self.response_sender.send(response_msg).await.unwrap(); + // write to global state as well self.global_state .write_arc() @@ -591,7 +627,7 @@ impl BuilderProgress for BuilderState { ( response.block_payload, response.metadata, - response.join_handle, + Arc::new(RwLock::new(WaitAndKeep::Wait(response.vid_receiver))), ), ); } @@ -659,7 +695,7 @@ impl BuilderProgress for BuilderState { Some(da) => { if let MessageType::DAProposalMessage(rda_msg) = da { tracing::debug!("Received da proposal msg in builder {:?}:\n {:?}", self.built_from_view_vid_leaf, rda_msg); - self.process_da_proposal(rda_msg); + self.process_da_proposal(rda_msg).await; } } None => { @@ -672,7 +708,7 @@ impl BuilderProgress for BuilderState { Some(qc) => { if let MessageType::QCMessage(rqc_msg) = qc { tracing::debug!("Received qc msg in builder {:?}:\n {:?} from index", self.built_from_view_vid_leaf, rqc_msg); - self.process_quorum_proposal(rqc_msg); + self.process_quorum_proposal(rqc_msg).await; } } None => { @@ -722,6 +758,7 @@ pub enum MessageType { RequestMessage(RequestMessage), } +#[allow(clippy::too_many_arguments)] impl BuilderState { pub fn new( view_vid_leaf: (TYPES::Time, VidCommitment, Commitment>), @@ -733,6 +770,7 @@ impl BuilderState { global_state: Arc>>, response_sender: UnboundedSender, num_nodes: NonZeroUsize, + bootstrap_view_number: TYPES::Time, ) -> Self { BuilderState { timestamp_to_tx: BTreeMap::new(), @@ -740,17 +778,19 @@ impl BuilderState { included_txns: HashSet::new(), block_hash_to_block: HashMap::new(), built_from_view_vid_leaf: view_vid_leaf, - tx_receiver: tx_receiver, - decide_receiver: decide_receiver, - da_proposal_receiver: da_proposal_receiver, - qc_receiver: qc_receiver, - req_receiver: req_receiver, + tx_receiver, + decide_receiver, + da_proposal_receiver, + qc_receiver, + req_receiver, da_proposal_payload_commit_to_da_proposal: HashMap::new(), quorum_proposal_payload_commit_to_quorum_proposal: HashMap::new(), - global_state: global_state, - response_sender: response_sender, + global_state, + response_sender, builder_commitments: vec![], total_nodes: num_nodes, + bootstrap_view_number, + spawned_clones_views_list: Arc::new(RwLock::new(BTreeSet::new())), } } } diff --git a/src/lib.rs b/src/lib.rs index f128f98d..75f9329a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,3 +19,29 @@ pub mod service; // tracking the testing pub mod testing; + +use async_compatibility_layer::channel::UnboundedReceiver; +use hotshot_builder_api::builder::BuildError; +#[derive(Debug)] +pub enum WaitAndKeep { + Keep(T), + Wait(UnboundedReceiver), +} + +impl WaitAndKeep { + pub async fn get(&mut self) -> Result { + match self { + WaitAndKeep::Keep(t) => Ok(t.clone()), + WaitAndKeep::Wait(fut) => { + let got = fut.recv().await.map_err(|_| BuildError::Error { + message: "failed to resolve VidCommitment from channel".to_string(), + }); + if got.is_ok() { + let mut replace = WaitAndKeep::Keep(got.clone().unwrap()); + core::mem::swap(self, &mut replace); + } + got + } + } + } +} diff --git a/src/service.rs b/src/service.rs index 482fe0f4..becfdcce 100644 --- a/src/service.rs +++ b/src/service.rs @@ -1,46 +1,51 @@ -// Copyright (c) 2024 Espresso Systems (espressosys.com) -// This file is part of the HotShot Builder Protocol. -// - -#![allow(clippy::redundant_field_names)] -use hotshot::{traits::NodeImplementation, types::SystemContextHandle}; +use hotshot::{ + traits::{ + election::static_committee::{GeneralStaticCommittee, StaticElectionConfig}, + NodeImplementation, + }, + types::SystemContextHandle, +}; use hotshot_builder_api::{ block_info::{AvailableBlockData, AvailableBlockHeaderInput, AvailableBlockInfo}, builder::BuildError, data_source::{AcceptsTxnSubmits, BuilderDataSource}, }; use hotshot_types::{ - event::EventType, + data::{DAProposal, Leaf, QuorumProposal}, + event::{EventType, LeafInfo}, + message::Proposal, traits::{ - block_contents::{BlockHeader, BlockPayload}, - consensus_api::ConsensusApi, - node_implementation::NodeType, - signature_key::SignatureKey, + block_contents::BlockPayload, consensus_api::ConsensusApi, election::Membership, + node_implementation::NodeType, signature_key::SignatureKey, }, utils::BuilderCommitment, vid::VidCommitment, }; +use crate::builder_state::{ + DAProposalMessage, DecideMessage, QCMessage, TransactionMessage, TransactionSource, +}; +use crate::builder_state::{MessageType, RequestMessage, ResponseMessage}; +use crate::WaitAndKeep; use async_broadcast::Sender as BroadcastSender; +pub use async_broadcast::{broadcast, RecvError, TryRecvError}; use async_compatibility_layer::channel::UnboundedReceiver; use async_lock::RwLock; -use async_std::task::JoinHandle; use async_trait::async_trait; +use commit::Committable; +use futures::future::BoxFuture; use futures::stream::StreamExt; - -use crate::builder_state::{ - DAProposalMessage, DecideMessage, QCMessage, TransactionMessage, TransactionSource, +use hotshot_events_service::{ + events::Error as EventStreamError, + events_source::{BuilderEvent, BuilderEventType}, }; -use crate::builder_state::{MessageType, RequestMessage, ResponseMessage}; use sha2::{Digest, Sha256}; -use std::{collections::HashMap, sync::Arc}; -use tracing::error; -#[derive(clap::Args, Default)] -pub struct Options { - #[clap(short, long, env = "ESPRESSO_BUILDER_PORT")] - pub port: u16, -} -// +use std::collections::HashMap; +use std::num::NonZeroUsize; +use std::sync::Arc; +use tide_disco::method::ReadState; +use tracing; + #[allow(clippy::type_complexity)] #[derive(Debug)] pub struct GlobalState { @@ -51,14 +56,13 @@ pub struct GlobalState { Types::SignatureKey, // pub key <::SignatureKey as SignatureKey>::PrivateKey, // private key ), - // data store for the blocks pub block_hash_to_block: HashMap< BuilderCommitment, ( Types::BlockPayload, <::BlockPayload as BlockPayload>::Metadata, - Arc>, + Arc>>, ), >, // sending a request from the hotshot to the builder states @@ -70,6 +74,9 @@ pub struct GlobalState { // sending a transaction from the hotshot/private mempool to the builder states // NOTE: Currently, we don't differentiate between the transactions from the hotshot and the private mempool pub tx_sender: BroadcastSender>, + + // Instance state + pub instance_state: Types::InstanceState, } impl GlobalState { @@ -81,13 +88,15 @@ impl GlobalState { request_sender: BroadcastSender>, response_receiver: UnboundedReceiver, tx_sender: BroadcastSender>, + instance_state: Types::InstanceState, ) -> Self { GlobalState { - builder_keys: builder_keys, + builder_keys, block_hash_to_block: Default::default(), - request_sender: request_sender, - response_receiver: response_receiver, - tx_sender: tx_sender, + request_sender, + response_receiver, + tx_sender, + instance_state, } } @@ -104,13 +113,13 @@ impl GlobalState { } // private mempool submit txn // Currenlty, we don't differentiate between the transactions from the hotshot and the private mempool - pub async fn submit_txn( + pub async fn submit_client_txn( &self, txn: ::Transaction, ) -> Result<(), BuildError> { let tx_msg = TransactionMessage:: { tx: txn, - tx_type: TransactionSource::HotShot, + tx_type: TransactionSource::External, }; self.tx_sender .broadcast(MessageType::TransactionMessage(tx_msg)) @@ -122,6 +131,9 @@ impl GlobalState { } } +/* +Handling Builder API responses +*/ #[async_trait] impl BuilderDataSource for GlobalState where @@ -136,12 +148,16 @@ where requested_vid_commitment: *for_parent, }; self.request_sender - .broadcast(MessageType::RequestMessage(req_msg)) + .broadcast(MessageType::RequestMessage(req_msg.clone())) .await .unwrap(); let response_received = self.response_receiver.recv().await; - + tracing::debug!( + "Response received for request{:?} {:?}", + req_msg, + response_received + ); match response_received { Ok(response) => { // to sign combine the block_hash i.e builder commitment, block size and offered fee @@ -157,6 +173,7 @@ where ) .expect("Available block info signing failed"); + // insert the block info into local hashmap let initial_block_info = AvailableBlockInfo:: { block_hash: response.builder_hash, block_size: response.block_size, @@ -165,6 +182,7 @@ where sender: self.builder_keys.0.clone(), _phantom: Default::default(), }; + tracing::debug!("Initial block info: {:?}", initial_block_info); Ok(vec![initial_block_info]) } _ => Err(BuildError::Error { @@ -205,19 +223,15 @@ where _signature: &<::SignatureKey as SignatureKey>::PureAssembledSignatureType, ) -> Result, BuildError> { if let Some(block) = self.block_hash_to_block.get(block_hash) { - // wait on the handle for the vid computation before returning the response - - // clone the arc handle - let vid_handle = Arc::into_inner(block.2.clone()).unwrap(); - let vid_commitement = vid_handle.await; - + tracing::debug!("Waiting for vid commitment for block {:?}", block_hash); + let vid_commitment = block.2.write().await.get().await?; let signature_over_vid_commitment = ::SignatureKey::sign( &self.builder_keys.1, - vid_commitement.as_ref(), + vid_commitment.as_ref(), ) .expect("Claim block header input signing failed"); let reponse = AvailableBlockHeaderInput:: { - vid_commitment: vid_commitement, + vid_commitment, signature: signature_over_vid_commitment, sender: self.builder_keys.0.clone(), _phantom: Default::default(), @@ -229,28 +243,174 @@ where }) } } + async fn get_builder_address(&self) -> Result<::SignatureKey, BuildError> { + Ok(self.builder_keys.0.clone()) + } } - -pub struct GlobalStateTxnSubmitter { - pub global_state_handle: Arc>>, -} - #[async_trait] -impl AcceptsTxnSubmits for GlobalStateTxnSubmitter { +impl AcceptsTxnSubmits for GlobalState { async fn submit_txn( &mut self, txn: ::Transaction, ) -> Result<(), BuildError> { - self.global_state_handle - .read_arc() - .await - .submit_txn(txn) - .await + tracing::debug!("Submitting transaction to the builder states{:?}", txn); + let response = self.submit_client_txn(txn).await; + tracing::info!( + "Transaction submitted to the builder states, sending response: {:?}", + response + ); + response + } +} +#[async_trait] +impl ReadState for GlobalState { + type State = Self; + + async fn read( + &self, + op: impl Send + for<'a> FnOnce(&'a Self::State) -> BoxFuture<'a, T> + 'async_trait, + ) -> T { + op(self).await } } -/// Listen to the events from the HotShot and pass onto to the builder states -pub async fn run_standalone_builder_service>( +/* +Running Non-Permissioned Builder Service +*/ +pub async fn run_non_permissioned_standalone_builder_service< + Types: NodeType, +>( + // sending a transaction from the hotshot mempool to the builder states + tx_sender: BroadcastSender>, + + // sending a DA proposal from the hotshot to the builder states + da_sender: BroadcastSender>, + + // sending a QC proposal from the hotshot to the builder states + qc_sender: BroadcastSender>, + + // sending a Decide event from the hotshot to the builder states + decide_sender: BroadcastSender>, + + // connection to the events stream + mut subscribed_events: surf_disco::socket::Connection< + BuilderEvent, + surf_disco::socket::Unsupported, + EventStreamError, + versioned_binary_serialization::version::StaticVersion<0, 1>, + >, + + // instance state + instance_state: Types::InstanceState, +) { + // handle the starup event at the start + let membership = if let Some(Ok(event)) = subscribed_events.next().await { + match event.event { + BuilderEventType::StartupInfo { + known_node_with_stake, + non_staked_node_count, + } => { + // Create membership. It is similar to init() in sequencer/src/context.rs + let election_config: StaticElectionConfig = GeneralStaticCommittee::< + Types, + ::SignatureKey, + >::default_election_config( + known_node_with_stake.len() as u64, + non_staked_node_count as u64, + ); + + let membership: GeneralStaticCommittee< + Types, + ::SignatureKey, + > = GeneralStaticCommittee::::SignatureKey>::create_election( + known_node_with_stake.clone(), + election_config, + 0, + ); + + tracing::info!( + "Startup info: Known nodes with stake: {:?}, Non-staked node count: {:?}", + known_node_with_stake, + non_staked_node_count + ); + membership + } + _ => { + tracing::error!("Startup info event not received as first event"); + return; + } + } + } else { + return; + }; + + loop { + let event = subscribed_events.next().await.unwrap(); + tracing::debug!("Builder Event received from HotShot: {:?}", event); + match event { + Ok(event) => { + match event.event { + BuilderEventType::HotshotError { error } => { + tracing::error!("Error event in HotShot: {:?}", error); + } + // starup event + BuilderEventType::StartupInfo { .. } => { + tracing::warn!("Startup info event received again"); + } + // tx event + BuilderEventType::HotshotTransactions { transactions } => { + handle_tx_event(&tx_sender, transactions).await; + } + // decide event + BuilderEventType::HotshotDecide { + leaf_chain, + block_size, + } => { + handle_decide_event(&decide_sender, leaf_chain, block_size).await; + } + // DA proposal event + BuilderEventType::HotshotDAProposal { proposal, sender } => { + // get the leader for current view + let leader = membership.get_leader(proposal.data.view_number); + // get the committee mstatked node count + let total_nodes = membership.total_nodes(); + + handle_da_event( + &da_sender, + proposal, + sender, + leader, + NonZeroUsize::new(total_nodes).unwrap(), + ) + .await; + } + // QC proposal event + BuilderEventType::HotshotQuorumProposal { proposal, sender } => { + // get the leader for current view + let leader = membership.get_leader(proposal.data.view_number); + handle_qc_event(&qc_sender, proposal, sender, leader, &instance_state) + .await; + } + _ => { + tracing::error!("Unhandled event from Builder"); + } + } + } + Err(e) => { + tracing::error!("Error in the event stream: {:?}", e); + } + } + } +} + +/* +Running Permissioned Builder Service +*/ +pub async fn run_permissioned_standalone_builder_service< + Types: NodeType, + I: NodeImplementation, +>( // sending a transaction from the hotshot mempool to the builder states tx_sender: BroadcastSender>, @@ -265,114 +425,156 @@ pub async fn run_standalone_builder_service, -) -> Result<(), ()> { + + // pass the instance state + instance_state: Types::InstanceState, +) { + let mut event_stream = hotshot_handle.get_event_stream(); loop { tracing::debug!("Waiting for events from HotShot"); - let mut event_stream = hotshot_handle.get_event_stream(); match event_stream.next().await { None => { - //TODO should we panic here? - //TODO or should we just continue just because we might trasaxtions from private mempool - panic!("Didn't receive any event from the HotShot event stream"); + tracing::error!("Didn't receive any event from the HotShot event stream"); } Some(event) => { match event.event { // error event EventType::Error { error } => { - error!("Error event in HotShot: {:?}", error); + tracing::error!("Error event in HotShot: {:?}", error); } // tx event EventType::Transactions { transactions } => { - // iterate over the transactions and send them to the tx_sender, might get duplicate transactions but builder needs to filter them - // TODO: check do we need to change the type or struct of the transaction here - for tx_message in transactions { - let tx_msg = TransactionMessage:: { - tx: tx_message, - tx_type: TransactionSource::HotShot, - }; - tx_sender - .broadcast(MessageType::TransactionMessage(tx_msg)) - .await - .unwrap(); - } + handle_tx_event(&tx_sender, transactions).await; + } + // decide event + EventType::Decide { + leaf_chain, + block_size, + .. + } => { + handle_decide_event(&decide_sender, leaf_chain, block_size).await; } // DA proposal event EventType::DAProposal { proposal, sender } => { - // process the DA proposal // get the leader for current view let leader = hotshot_handle.get_leader(proposal.data.view_number).await; - // get the encoded transactions hash - let encoded_txns_hash = Sha256::digest(&proposal.data.encoded_transactions); - // check if the sender is the leader and the signature is valid; if yes, broadcast the DA proposal - if leader == sender - && sender.validate(&proposal.signature, &encoded_txns_hash) - { - // // get the num of VID nodes - // let c_api: HotShotConsensusApi = HotShotConsensusApi { - // inner: hotshot_handle.hotshot.clone(), - // }; - - let total_nodes = hotshot_handle.total_nodes(); - - let da_msg = DAProposalMessage:: { - proposal: proposal, - sender: sender, - total_nodes: total_nodes.into(), - }; - da_sender - .broadcast(MessageType::DAProposalMessage(da_msg)) - .await - .unwrap(); - } + // get the committe staked node count + let total_nodes = hotshot_handle.total_nodes(); + + handle_da_event(&da_sender, proposal, sender, leader, total_nodes).await; } // QC proposal event EventType::QuorumProposal { proposal, sender } => { - // process the QC proposal // get the leader for current view let leader = hotshot_handle.get_leader(proposal.data.view_number).await; - // get the payload commitment - let payload_commitment = proposal.data.block_header.payload_commitment(); - - // check if the sender is the leader and the signature is valid; if yes, broadcast the QC proposal - if sender == leader - && sender.validate(&proposal.signature, payload_commitment.as_ref()) - { - let qc_msg = QCMessage:: { - proposal: proposal, - sender: sender, - }; - qc_sender - .broadcast(MessageType::QCMessage(qc_msg)) - .await - .unwrap(); - } - } - // decide event - EventType::Decide { - leaf_chain, - qc, - block_size, - } => { - let decide_msg: DecideMessage = DecideMessage:: { - leaf_chain: leaf_chain, - qc: qc, - block_size: block_size, - }; - decide_sender - .broadcast(MessageType::DecideMessage(decide_msg)) - .await - .unwrap(); - } - // not sure whether we need it or not //TODO - EventType::ViewFinished { view_number } => { - tracing::info!("View Finished Event for view number: {:?}", view_number); - unimplemented!("View Finished Event"); + handle_qc_event(&qc_sender, proposal, sender, leader, &instance_state) + .await; } _ => { - unimplemented!(); + tracing::error!("Unhandled event from Builder: {:?}", event.event); } } } } } } + +/* +Utility functions to handle the hotshot events +*/ +async fn handle_da_event( + da_channel_sender: &BroadcastSender>, + da_proposal: Proposal>, + sender: ::SignatureKey, + leader: ::SignatureKey, + total_nodes: NonZeroUsize, +) { + tracing::debug!( + "DAProposal: Leader: {:?} for the view: {:?}", + leader, + da_proposal.data.view_number + ); + + // get the encoded transactions hash + let encoded_txns_hash = Sha256::digest(&da_proposal.data.encoded_transactions); + // check if the sender is the leader and the signature is valid; if yes, broadcast the DA proposal + if leader == sender && sender.validate(&da_proposal.signature, &encoded_txns_hash) { + let da_msg = DAProposalMessage:: { + proposal: da_proposal, + sender: leader, + total_nodes: total_nodes.into(), + }; + tracing::debug!("Sending DA proposal to the builder states{:?}", da_msg); + da_channel_sender + .broadcast(MessageType::DAProposalMessage(da_msg)) + .await + .unwrap(); + } else { + tracing::error!("Validation Failure on DAProposal for view {:?}: Leader for the current view: {:?} and sender: {:?}", da_proposal.data.view_number, leader, sender); + } +} + +async fn handle_qc_event( + qc_channel_sender: &BroadcastSender>, + qc_proposal: Proposal>, + sender: ::SignatureKey, + leader: ::SignatureKey, + _instance_state: &Types::InstanceState, +) { + tracing::debug!( + "QCProposal: Leader: {:?} for the view: {:?}", + leader, + qc_proposal.data.view_number + ); + + let leaf = Leaf::from_proposal(&qc_proposal); + + // check if the sender is the leader and the signature is valid; if yes, broadcast the QC proposal + if sender == leader && sender.validate(&qc_proposal.signature, leaf.commit().as_ref()) { + let qc_msg = QCMessage:: { + proposal: qc_proposal, + sender: leader, + }; + tracing::debug!("Sending QC proposal to the builder states{:?}", qc_msg); + qc_channel_sender + .broadcast(MessageType::QCMessage(qc_msg)) + .await + .unwrap(); + } else { + tracing::error!("Validation Failure on QCProposal for view {:?}: Leader for the current view: {:?} and sender: {:?}", qc_proposal.data.view_number, leader, sender); + } +} + +async fn handle_decide_event( + decide_channel_sender: &BroadcastSender>, + leaf_chain: Arc>>, + block_size: Option, +) { + let decide_msg: DecideMessage = DecideMessage:: { + leaf_chain, + block_size, + }; + tracing::debug!("Sending Decide event to the builder states{:?}", decide_msg); + decide_channel_sender + .broadcast(MessageType::DecideMessage(decide_msg)) + .await + .unwrap(); +} + +async fn handle_tx_event( + tx_channel_sender: &BroadcastSender>, + transactions: Vec, +) { + // iterate over the transactions and send them to the tx_sender, might get duplicate transactions but builder needs to filter them + for tx_message in transactions { + let tx_msg = TransactionMessage:: { + tx: tx_message, + tx_type: TransactionSource::HotShot, + }; + tracing::debug!("Sending transaction to the builder states{:?}", tx_msg); + tx_channel_sender + .broadcast(MessageType::TransactionMessage(tx_msg)) + .await + .unwrap(); + } +} diff --git a/src/testing/basic_test.rs b/src/testing/basic_test.rs index 544477ad..0f846421 100644 --- a/src/testing/basic_test.rs +++ b/src/testing/basic_test.rs @@ -1,13 +1,3 @@ -// Copyright (c) 2024 Espresso Systems (espressosys.com) -// This file is part of the HotShot Builder Protocol. -// - -// Builder Phase 1 Testing -// - -#![allow(unused_imports)] -#![allow(clippy::redundant_field_names)] -use async_std::task; pub use hotshot::traits::election::static_committee::{ GeneralStaticCommittee, StaticElectionConfig, }; @@ -21,38 +11,25 @@ pub use hotshot_types::{ node_implementation::{ConsensusTime, NodeType}, }, }; -use sha2::{Digest, Sha256}; -use std::sync::{Arc, Mutex}; pub use crate::builder_state::{BuilderProgress, BuilderState, MessageType, ResponseMessage}; pub use async_broadcast::{ broadcast, Receiver as BroadcastReceiver, RecvError, Sender as BroadcastSender, TryRecvError, }; -// tests -use async_compatibility_layer::art::{async_sleep, async_spawn}; -use commit::{Commitment, CommitmentBoundsArkless}; -use tracing; /// The following tests are performed: #[cfg(test)] mod tests { - + use super::*; use std::{hash::Hash, marker::PhantomData, num::NonZeroUsize}; + use async_compatibility_layer::art::async_spawn; use async_compatibility_layer::channel::unbounded; - use commit::Committable; use hotshot::types::SignatureKey; use hotshot_types::{ data::QuorumProposal, event::LeafInfo, - message::Message, - simple_certificate::Threshold, simple_vote::QuorumData, - traits::{ - block_contents::{vid_commitment, BlockHeader}, - election::Membership, - }, - utils::View, - vote::{Certificate, HasViewNumber}, + traits::block_contents::{vid_commitment, BlockHeader}, }; use hotshot_example_types::{ @@ -66,6 +43,10 @@ mod tests { }; use crate::service::GlobalState; use async_lock::RwLock; + use async_std::task; + use commit::{Commitment, CommitmentBoundsArkless, Committable}; + use sha2::{Digest, Sha256}; + use std::sync::Arc; #[derive(Debug, Clone)] pub struct CustomError { @@ -73,7 +54,6 @@ mod tests { pub error: TryRecvError, } - use super::*; use serde::{Deserialize, Serialize}; /// This test simulates multiple builder states receiving messages from the channels and processing them #[async_std::test] @@ -136,6 +116,7 @@ mod tests { req_sender, res_receiver, tx_sender.clone(), + TestInstanceState {}, ); // to store all the sent messages @@ -163,7 +144,7 @@ mod tests { let da_proposal = DAProposal { encoded_transactions: encoded_transactions.clone(), metadata: (), - view_number: ViewNumber::new((i + 1) as u64), + view_number: ViewNumber::new(i as u64), }; let encoded_transactions_hash = Sha256::digest(&encoded_transactions); let seed = [i as u8; 32]; @@ -214,7 +195,7 @@ mod tests { let block_header = TestBlockHeader { block_number: i as u64, payload_commitment: encoded_txns_vid_commitment, - timestamp: i as u64 + 1u64, + timestamp: i as u64, }; let justify_qc = match i { @@ -226,24 +207,7 @@ mod tests { let _metadata = >::metadata( &sqc_msgs[(i - 1) as usize].proposal.data.block_header, ); - // Construct a leaf - let leaf: Leaf<_> = Leaf { - view_number: sqc_msgs[(i - 1) as usize].proposal.data.view_number, - justify_qc: sqc_msgs[(i - 1) as usize].proposal.data.justify_qc.clone(), - parent_commitment: sqc_msgs[(i - 1) as usize] - .proposal - .data - .justify_qc - .get_data() - .leaf_commit, - block_header: sqc_msgs[(i - 1) as usize] - .proposal - .data - .block_header - .clone(), - block_payload: None, - proposer_id: sqc_msgs[(i - 1) as usize].proposal.data.proposer_id, - }; + let leaf = Leaf::from_proposal(&sqc_msgs[(i - 1) as usize].proposal); let q_data = QuorumData:: { leaf_commit: leaf.commit(), @@ -265,7 +229,7 @@ mod tests { SimpleCertificate::, SuccessThreshold> { data: q_data.clone(), vote_commitment: q_data.commit(), - view_number: view_number, + view_number, signatures: previous_justify_qc.signatures.clone(), is_genesis: true, // todo setting true because we don't have signatures of QCType _pd: PhantomData, @@ -275,14 +239,11 @@ mod tests { tracing::debug!("Iteration: {} justify_qc: {:?}", i, justify_qc); let qc_proposal = QuorumProposal:: { - //block_header: TestBlockHeader::genesis(&TestInstanceState {}).0, - block_header: block_header, + block_header, view_number: ViewNumber::new(i as u64), justify_qc: justify_qc.clone(), - timeout_certificate: None, upgrade_certificate: None, - proposer_id: pub_key, - view_sync_certificate: None, + proposal_certificate: None, }; let payload_commitment = @@ -309,24 +270,16 @@ mod tests { let leaf = match i { 0 => Leaf::genesis(&TestInstanceState {}), _ => { - let current_leaf: Leaf<_> = Leaf { - view_number: ViewNumber::new(i as u64), - justify_qc: justify_qc.clone(), - parent_commitment: sqc_msgs[(i - 1) as usize] - .proposal - .data - .justify_qc - .get_data() - .leaf_commit, - block_header: qc_proposal.block_header.clone(), - block_payload: Some(BlockPayload::from_bytes( - encoded_transactions.clone().into_iter(), - >::metadata( - &qc_proposal.block_header, - ), - )), - proposer_id: qc_proposal.proposer_id, - }; + let block_payload = BlockPayload::from_bytes( + encoded_transactions.clone().into_iter(), + >::metadata( + &qc_proposal.block_header, + ), + ); + let mut current_leaf = Leaf::from_quorum_proposal(&qc_proposal); + current_leaf + .fill_block_payload(block_payload, TEST_NUM_NODES_IN_VID_COMPUTATION) + .unwrap(); current_leaf } }; @@ -338,7 +291,6 @@ mod tests { None, None, )]), - qc: Arc::new(justify_qc), block_size: Some(encoded_transactions.len() as u64), }; @@ -361,7 +313,7 @@ mod tests { // send decide and request messages later let requested_vid_commitment = payload_commitment; let request_message = MessageType::::RequestMessage(RequestMessage { - requested_vid_commitment: requested_vid_commitment, + requested_vid_commitment, }); stx_msgs.push(stx_msg); @@ -389,6 +341,7 @@ mod tests { arc_rwlock_global_state_clone, res_sender, NonZeroUsize::new(TEST_NUM_NODES_IN_VID_COMPUTATION).unwrap(), + ViewNumber::new(0), ); //builder_state.event_loop().await; @@ -426,9 +379,9 @@ mod tests { .try_recv() { rres_msgs.push(res_msg); - // if rres_msgs.len() == (num_test_messages-1) as usize{ - // break; - // } + if rres_msgs.len() == (num_test_messages - 1) { + break; + } } assert_eq!(rres_msgs.len(), (num_test_messages - 1)); //task::sleep(std::time::Duration::from_secs(60)).await;