diff --git a/.github/workflows/typos.yml b/.github/workflows/typos.yml index bfe2701855..8bb0c13d33 100644 --- a/.github/workflows/typos.yml +++ b/.github/workflows/typos.yml @@ -20,4 +20,4 @@ jobs: name: Checkout Repository - name: typos-action - uses: crate-ci/typos@v1.28.2 + uses: crate-ci/typos@v1.28.3 diff --git a/Cargo.lock b/Cargo.lock index a97145b4fc..59931ea318 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -105,9 +105,9 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.18" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "android-tzdata" @@ -498,7 +498,7 @@ dependencies = [ "nom", "num-traits", "rusticata-macros", - "thiserror 1.0.68", + "thiserror 1.0.69", "time 0.3.37", ] @@ -594,8 +594,8 @@ checksum = "30ca9a001c1e8ba5149f91a74362376cc6bc5b919d92d988668657bd570bdcec" dependencies = [ "async-task", "concurrent-queue", - "fastrand 2.1.1", - "futures-lite 2.4.0", + "fastrand 2.3.0", + "futures-lite 2.5.0", "slab", ] @@ -607,10 +607,10 @@ checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" dependencies = [ "async-channel 2.3.1", "async-executor", - "async-io 2.3.4", + "async-io 2.4.0", "async-lock 3.4.0", "blocking", - "futures-lite 2.4.0", + "futures-lite 2.5.0", "once_cell", "tokio", ] @@ -654,18 +654,18 @@ dependencies = [ [[package]] name = "async-io" -version = "2.3.4" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "444b0228950ee6501b3568d3c93bf1176a1fdbc3b758dcd9475046d30f4dc7e8" +checksum = "43a2b323ccce0a1d90b449fd71f2a06ca7faa7c54c2751f06c9bd851fc061059" dependencies = [ "async-lock 3.4.0", "cfg-if", "concurrent-queue", "futures-io", - "futures-lite 2.4.0", + "futures-lite 2.5.0", "parking", "polling 3.7.4", - "rustix 0.38.39", + "rustix 0.38.42", "slab", "tracing", "windows-sys 0.59.0", @@ -699,7 +699,7 @@ checksum = "9e9e7a929bd34c68a82d58a4de7f86fffdaf97fb2af850162a7bb19dd7269b33" dependencies = [ "async-std", "native-tls", - "thiserror 1.0.68", + "thiserror 1.0.69", "url", ] @@ -710,15 +710,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63255f1dc2381611000436537bbedfe83183faa303a5a0edaf191edef06526bb" dependencies = [ "async-channel 2.3.1", - "async-io 2.3.4", + "async-io 2.4.0", "async-lock 3.4.0", "async-signal", "async-task", "blocking", "cfg-if", "event-listener 5.3.1", - "futures-lite 2.4.0", - "rustix 0.38.39", + "futures-lite 2.5.0", + "rustix 0.38.42", "tracing", ] @@ -728,13 +728,13 @@ version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "637e00349800c0bdf8bfc21ebbc0b6524abea702b0da4168ac00d070d0c0b9f3" dependencies = [ - "async-io 2.3.4", + "async-io 2.4.0", "async-lock 3.4.0", "atomic-waker", "cfg-if", "futures-core", "futures-io", - "rustix 0.38.39", + "rustix 0.38.42", "signal-hook-registry", "slab", "windows-sys 0.59.0", @@ -763,14 +763,14 @@ dependencies = [ "async-attributes", "async-channel 1.9.0", "async-global-executor", - "async-io 2.3.4", + "async-io 2.4.0", "async-lock 3.4.0", "async-process", "crossbeam-utils", "futures-channel", "futures-core", "futures-io", - "futures-lite 2.4.0", + "futures-lite 2.5.0", "gloo-timers", "kv-log-macro", "log", @@ -850,19 +850,6 @@ dependencies = [ "tungstenite", ] -[[package]] -name = "asynchronous-codec" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4057f2c32adbb2fc158e22fb38433c8e9bbf76b75a4732c7c0cbaf695fb65568" -dependencies = [ - "bytes", - "futures-sink", - "futures-util", - "memchr", - "pin-project-lite 0.2.15", -] - [[package]] name = "asynchronous-codec" version = "0.7.0" @@ -964,6 +951,15 @@ dependencies = [ "tower-service", ] +[[package]] +name = "backon" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5289ec98f68f28dd809fd601059e6aa908bb8f6108620930828283d4ee23d7" +dependencies = [ + "fastrand 2.3.0", +] + [[package]] name = "backtrace" version = "0.3.74" @@ -1026,9 +1022,9 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.70.1" +version = "0.71.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" +checksum = "5f58bf3d7db68cfbac37cfc485a8d711e87e064c3d0fe0435b92f7a407f9d6b3" dependencies = [ "bitflags 2.6.0", "cexpr", @@ -1039,7 +1035,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "rustc-hash 1.1.0", + "rustc-hash", "shlex", "syn 2.0.90", ] @@ -1121,7 +1117,7 @@ dependencies = [ "async-channel 2.3.1", "async-task", "futures-io", - "futures-lite 2.4.0", + "futures-lite 2.5.0", "piper", ] @@ -1188,9 +1184,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" +checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" dependencies = [ "serde", ] @@ -1206,9 +1202,9 @@ dependencies = [ [[package]] name = "capnpc" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d13cb6e2643fd1f9fb804ba938323636ef52e07d6e495e372d933ad0cb98207" +checksum = "1aa3d5f01e69ed11656d2c7c47bf34327ea9bfb5c85c7de787fcd7b6c5e45b61" dependencies = [ "capnp", ] @@ -1224,9 +1220,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.36" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baee610e9452a8f6f0a1b6194ec09ff9e2d85dea54432acdae41aa0761c95d70" +checksum = "27f657647bcff5394bf56c7317665bbf790a137a50eaaa5c6bfbb9e27a518f2d" dependencies = [ "shlex", ] @@ -1307,10 +1303,10 @@ dependencies = [ "rcgen 0.13.1", "redis", "rkyv", - "rustls 0.23.18", + "rustls 0.23.19", "rustls-pki-types", "sqlx", - "thiserror 1.0.68", + "thiserror 1.0.69", "tokio", "tokio-rustls", "tracing", @@ -1341,9 +1337,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "chrono" -version = "0.4.38" +version = "0.4.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" dependencies = [ "android-tzdata", "iana-time-zone", @@ -1374,9 +1370,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.22" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69371e34337c4c984bbe322360c2547210bf632eb2814bbe78a6e87a2935bd2b" +checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" dependencies = [ "clap_builder", "clap_derive", @@ -1384,9 +1380,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.22" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e24c1b4099818523236a8ca881d2b45db98dadfb4625cf6608c12069fcbbde1" +checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" dependencies = [ "anstream", "anstyle", @@ -1408,15 +1404,15 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "cmake" -version = "0.1.51" +version = "0.1.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb1e43aa7fd152b1f968787f7dbcdeb306d1867ff373c69955211876c053f91a" +checksum = "c682c223677e0e5b6b7f63a64b9351844c3f1b1678a68b7ee617e30fb082620e" dependencies = [ "cc", ] @@ -1622,9 +1618,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.14" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" dependencies = [ "libc", ] @@ -2196,12 +2192,12 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2234,9 +2230,9 @@ dependencies = [ [[package]] name = "event-listener-strategy" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1" +checksum = "3c3e4e0dd3673c1139bf041f3008816d9cf2946bbfac2945c09e523b8d7b05b2" dependencies = [ "event-listener 5.3.1", "pin-project-lite 0.2.15", @@ -2253,9 +2249,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "fiat-crypto" @@ -2277,9 +2273,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.34" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" +checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" dependencies = [ "crc32fast", "miniz_oxide", @@ -2425,11 +2421,11 @@ dependencies = [ [[package]] name = "futures-lite" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f1fa2f9765705486b33fd2acf1577f8ec449c2ba1f318ae5447697b7c08d210" +checksum = "cef40d21ae2c515b51041df9ed313ed21e572df340ea58a922a0aefe7e8891a1" dependencies = [ - "fastrand 2.1.1", + "fastrand 2.3.0", "futures-core", "futures-io", "parking", @@ -2454,7 +2450,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f2f12607f92c69b12ed746fabf9ca4f5c482cba46679c1a75b874ed7c26adb" dependencies = [ "futures-io", - "rustls 0.23.18", + "rustls 0.23.19", "rustls-pki-types", ] @@ -2534,8 +2530,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -2584,7 +2582,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.6.0", + "indexmap 2.7.0", "slab", "tokio", "tokio-util", @@ -2593,17 +2591,17 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" +checksum = "ccae279728d634d083c00f6099cb58f01cc99c145b84b8be2f6c74618d79922e" dependencies = [ "atomic-waker", "bytes", "fnv", "futures-core", "futures-sink", - "http 1.1.0", - "indexmap 2.6.0", + "http 1.2.0", + "indexmap 2.7.0", "slab", "tokio", "tokio-util", @@ -2640,9 +2638,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.1" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" dependencies = [ "allocator-api2", "equivalent", @@ -2742,9 +2740,9 @@ checksum = "b07f60793ff0a4d9cef0f18e63b5357e06209987153a64648c972c1e5aff336f" [[package]] name = "hickory-proto" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07698b8420e2f0d6447a436ba999ec85d8fbf2a398bbd737b82cac4a2e96e512" +checksum = "447afdcdb8afb9d0a852af6dc65d9b285ce720ed7a59e42a8bf2e931c67bc1b5" dependencies = [ "async-trait", "cfg-if", @@ -2753,12 +2751,12 @@ dependencies = [ "futures-channel", "futures-io", "futures-util", - "idna 0.4.0", + "idna", "ipnet", "once_cell", "rand 0.8.5", - "socket2 0.5.7", - "thiserror 1.0.68", + "socket2 0.5.8", + "thiserror 1.0.69", "tinyvec", "tokio", "tracing", @@ -2767,9 +2765,9 @@ dependencies = [ [[package]] name = "hickory-resolver" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28757f23aa75c98f254cf0405e6d8c25b831b32921b050a66692427679b1f243" +checksum = "0a2e2aba9c389ce5267d31cf1e4dace82390ae276b0b364ea55630b1fa1b44b4" dependencies = [ "cfg-if", "futures-util", @@ -2781,7 +2779,7 @@ dependencies = [ "rand 0.8.5", "resolv-conf", "smallvec", - "thiserror 1.0.68", + "thiserror 1.0.69", "tokio", "tracing", ] @@ -2919,7 +2917,7 @@ dependencies = [ "hotshot-types", "serde", "tagged-base64", - "thiserror 2.0.4", + "thiserror 2.0.6", "tide-disco", "toml", "vbs", @@ -2942,7 +2940,7 @@ dependencies = [ "serde", "sha2 0.10.8", "sha3", - "thiserror 2.0.4", + "thiserror 2.0.6", "time 0.3.37", "tokio", "url", @@ -3085,7 +3083,7 @@ dependencies = [ "sha2 0.10.8", "surf-disco", "tagged-base64", - "thiserror 2.0.4", + "thiserror 2.0.6", "time 0.3.37", "tokio", "tracing", @@ -3126,7 +3124,7 @@ dependencies = [ "serde", "sha2 0.10.8", "tagged-base64", - "thiserror 2.0.4", + "thiserror 2.0.6", "tide-disco", "tokio", "tracing", @@ -3177,7 +3175,7 @@ dependencies = [ "serde_json", "sha2 0.10.8", "tagged-base64", - "thiserror 2.0.4", + "thiserror 2.0.6", "time 0.3.37", "tokio", "toml", @@ -3202,9 +3200,9 @@ dependencies = [ [[package]] name = "http" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" dependencies = [ "bytes", "fnv", @@ -3229,7 +3227,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "http 1.1.0", + "http 1.2.0", ] [[package]] @@ -3240,7 +3238,7 @@ checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "pin-project-lite 0.2.15", ] @@ -3314,7 +3312,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite 0.2.15", - "socket2 0.5.7", + "socket2 0.5.8", "tokio", "tower-service", "tracing", @@ -3323,15 +3321,15 @@ dependencies = [ [[package]] name = "hyper" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" +checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f" dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.6", - "http 1.1.0", + "h2 0.4.7", + "http 1.2.0", "http-body 1.0.1", "httparse", "itoa", @@ -3348,10 +3346,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", - "http 1.1.0", - "hyper 1.5.0", + "http 1.2.0", + "hyper 1.5.1", "hyper-util", - "rustls 0.23.18", + "rustls 0.23.19", "rustls-pki-types", "tokio", "tokio-rustls", @@ -3378,7 +3376,7 @@ checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", "http-body-util", - "hyper 1.5.0", + "hyper 1.5.1", "hyper-util", "native-tls", "tokio", @@ -3395,11 +3393,11 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", - "hyper 1.5.0", + "hyper 1.5.1", "pin-project-lite 0.2.15", - "socket2 0.5.7", + "socket2 0.5.8", "tokio", "tower-service", "tracing", @@ -3585,16 +3583,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" -[[package]] -name = "idna" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "idna" version = "1.0.3" @@ -3628,19 +3616,23 @@ dependencies = [ [[package]] name = "if-watch" -version = "3.2.0" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6b0422c86d7ce0e97169cc42e04ae643caf278874a7a3c87b8150a220dc7e1e" +checksum = "cdf9d64cfcf380606e64f9a0bcf493616b65331199f984151a6fa11a7b3cde38" dependencies = [ - "async-io 2.3.4", + "async-io 2.4.0", "core-foundation", "fnv", "futures", "if-addrs", "ipnet", "log", + "netlink-packet-core", + "netlink-packet-route", + "netlink-proto", + "netlink-sys", "rtnetlink", - "system-configuration 0.5.1", + "system-configuration", "tokio", "windows", ] @@ -3684,13 +3676,13 @@ dependencies = [ [[package]] name = "impl-trait-for-tuples" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.90", ] [[package]] @@ -3725,12 +3717,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" dependencies = [ "equivalent", - "hashbrown 0.15.1", + "hashbrown 0.15.2", "serde", ] @@ -3775,7 +3767,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" dependencies = [ - "socket2 0.5.7", + "socket2 0.5.8", "widestring", "windows-sys 0.48.0", "winreg", @@ -3831,9 +3823,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.11" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "jf-commitment" @@ -4036,10 +4028,11 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.72" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" +checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" dependencies = [ + "once_cell", "wasm-bindgen", ] @@ -4093,18 +4086,18 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.162" +version = "0.2.168" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398" +checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" [[package]] name = "libloading" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" +checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -4115,16 +4108,15 @@ checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" [[package]] name = "libp2p" -version = "0.53.2" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "681fb3f183edfbedd7a57d32ebe5dcdc0b9f94061185acf3c30249349cc6fc99" +checksum = "bbbe80f9c7e00526cd6b838075b9c171919404a4732cb2fa8ece0a093223bfc4" dependencies = [ "bytes", "either", "futures", "futures-timer", "getrandom 0.2.15", - "instant", "libp2p-allow-block-list", "libp2p-autonat", "libp2p-connection-limits", @@ -4144,14 +4136,14 @@ dependencies = [ "multiaddr", "pin-project", "rw-stream-sink", - "thiserror 1.0.68", + "thiserror 1.0.69", ] [[package]] name = "libp2p-allow-block-list" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "107b238b794cb83ab53b74ad5dcf7cca3200899b72fe662840cfb52f5b0a32e6" +checksum = "d1027ccf8d70320ed77e984f273bc8ce952f623762cb9bf2d126df73caef8041" dependencies = [ "libp2p-core", "libp2p-identity", @@ -4161,30 +4153,36 @@ dependencies = [ [[package]] name = "libp2p-autonat" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d95151726170e41b591735bf95c42b888fe4aa14f65216a9fbf0edcc04510586" +checksum = "a083675f189803d0682a2726131628e808144911dad076858bfbe30b13065499" dependencies = [ "async-trait", - "asynchronous-codec 0.6.2", + "asynchronous-codec", + "bytes", + "either", "futures", + "futures-bounded", "futures-timer", - "instant", "libp2p-core", "libp2p-identity", "libp2p-request-response", "libp2p-swarm", "quick-protobuf", - "quick-protobuf-codec 0.2.0", + "quick-protobuf-codec", "rand 0.8.5", + "rand_core 0.6.4", + "thiserror 1.0.69", "tracing", + "void", + "web-time", ] [[package]] name = "libp2p-connection-limits" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7cd50a78ccfada14de94cbacd3ce4b0138157f376870f13d3a8422cd075b4fd" +checksum = "8d003540ee8baef0d254f7b6bfd79bac3ddf774662ca0abf69186d517ef82ad8" dependencies = [ "libp2p-core", "libp2p-identity", @@ -4194,9 +4192,9 @@ dependencies = [ [[package]] name = "libp2p-core" -version = "0.41.3" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5a8920cbd8540059a01950c1e5c96ea8d89eb50c51cd366fc18bdf540a6e48f" +checksum = "a61f26c83ed111104cd820fe9bc3aaabbac5f1652a1d213ed6e900b7918a1298" dependencies = [ "either", "fnv", @@ -4214,7 +4212,7 @@ dependencies = [ "rw-stream-sink", "serde", "smallvec", - "thiserror 1.0.68", + "thiserror 1.0.69", "tracing", "unsigned-varint 0.8.0", "void", @@ -4223,9 +4221,9 @@ dependencies = [ [[package]] name = "libp2p-dns" -version = "0.41.1" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d17cbcf7160ff35c3e8e560de4a068fe9d6cb777ea72840e48eb76ff9576c4b6" +checksum = "97f37f30d5c7275db282ecd86e54f29dd2176bd3ac656f06abf43bedb21eb8bd" dependencies = [ "async-trait", "futures", @@ -4239,12 +4237,12 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" -version = "0.46.1" +version = "0.47.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d665144a616dadebdc5fff186b1233488cdcd8bfb1223218ff084b6d052c94f7" +checksum = "b4e830fdf24ac8c444c12415903174d506e1e077fbe3875c404a78c5935a8543" dependencies = [ - "asynchronous-codec 0.7.0", - "base64 0.21.7", + "asynchronous-codec", + "base64 0.22.1", "byteorder", "bytes", "either", @@ -4253,13 +4251,12 @@ dependencies = [ "futures-ticker", "getrandom 0.2.15", "hex_fmt", - "instant", "libp2p-core", "libp2p-identity", "libp2p-swarm", "prometheus-client", "quick-protobuf", - "quick-protobuf-codec 0.3.1", + "quick-protobuf-codec", "rand 0.8.5", "regex", "serde", @@ -4267,15 +4264,16 @@ dependencies = [ "smallvec", "tracing", "void", + "web-time", ] [[package]] name = "libp2p-identify" -version = "0.44.2" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5d635ebea5ca0c3c3e77d414ae9b67eccf2a822be06091b9c1a0d13029a1e2f" +checksum = "1711b004a273be4f30202778856368683bd9a83c4c7dcc8f848847606831a4e3" dependencies = [ - "asynchronous-codec 0.7.0", + "asynchronous-codec", "either", "futures", "futures-bounded", @@ -4285,9 +4283,9 @@ dependencies = [ "libp2p-swarm", "lru 0.12.5", "quick-protobuf", - "quick-protobuf-codec 0.3.1", + "quick-protobuf-codec", "smallvec", - "thiserror 1.0.68", + "thiserror 1.0.69", "tracing", "void", ] @@ -4308,46 +4306,46 @@ dependencies = [ "rand 0.8.5", "serde", "sha2 0.10.8", - "thiserror 1.0.68", + "thiserror 1.0.69", "tracing", "zeroize", ] [[package]] name = "libp2p-kad" -version = "0.45.3" +version = "0.46.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc5767727d062c4eac74dd812c998f0e488008e82cce9c33b463d38423f9ad2" +checksum = "ced237d0bd84bbebb7c2cad4c073160dacb4fe40534963c32ed6d4c6bb7702a3" dependencies = [ "arrayvec", - "asynchronous-codec 0.7.0", + "asynchronous-codec", "bytes", "either", "fnv", "futures", "futures-bounded", "futures-timer", - "instant", "libp2p-core", "libp2p-identity", "libp2p-swarm", "quick-protobuf", - "quick-protobuf-codec 0.3.1", + "quick-protobuf-codec", "rand 0.8.5", "serde", "sha2 0.10.8", "smallvec", - "thiserror 1.0.68", + "thiserror 1.0.69", "tracing", "uint", "void", + "web-time", ] [[package]] name = "libp2p-mdns" -version = "0.45.1" +version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49007d9a339b3e1d7eeebc4d67c05dbf23d300b7d091193ec2d3f26802d7faf2" +checksum = "14b8546b6644032565eb29046b42744aee1e9f261ed99671b2c93fb140dba417" dependencies = [ "data-encoding", "futures", @@ -4358,7 +4356,7 @@ dependencies = [ "libp2p-swarm", "rand 0.8.5", "smallvec", - "socket2 0.5.7", + "socket2 0.5.8", "tokio", "tracing", "void", @@ -4366,12 +4364,11 @@ dependencies = [ [[package]] name = "libp2p-metrics" -version = "0.14.1" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdac91ae4f291046a3b2660c039a2830c931f84df2ee227989af92f7692d3357" +checksum = "77ebafa94a717c8442d8db8d3ae5d1c6a15e30f2d347e0cd31d057ca72e42566" dependencies = [ "futures", - "instant", "libp2p-core", "libp2p-gossipsub", "libp2p-identify", @@ -4380,6 +4377,7 @@ dependencies = [ "libp2p-swarm", "pin-project", "prometheus-client", + "web-time", ] [[package]] @@ -4411,9 +4409,9 @@ dependencies = [ [[package]] name = "libp2p-quic" -version = "0.10.3" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c67296ad4e092e23f92aea3d2bdb6f24eab79c0929ed816dfb460ea2f4567d2b" +checksum = "46352ac5cd040c70e88e7ff8257a2ae2f891a4076abad2c439584a31c15fd24e" dependencies = [ "bytes", "futures", @@ -4426,25 +4424,24 @@ dependencies = [ "quinn", "rand 0.8.5", "ring 0.17.8", - "rustls 0.23.18", - "socket2 0.5.7", - "thiserror 1.0.68", + "rustls 0.23.19", + "socket2 0.5.8", + "thiserror 1.0.69", "tokio", "tracing", ] [[package]] name = "libp2p-request-response" -version = "0.26.3" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c314fe28368da5e3a262553fb0ad575c1c8934c461e10de10265551478163836" +checksum = "1356c9e376a94a75ae830c42cdaea3d4fe1290ba409a22c809033d1b7dcab0a6" dependencies = [ "async-trait", "cbor4ii", "futures", "futures-bounded", "futures-timer", - "instant", "libp2p-core", "libp2p-identity", "libp2p-swarm", @@ -4453,19 +4450,19 @@ dependencies = [ "smallvec", "tracing", "void", + "web-time", ] [[package]] name = "libp2p-swarm" -version = "0.44.2" +version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80cae6cb75f89dbca53862f9ebe0b9f463aa7b302762fcfaafb9e51dcc9b0f7e" +checksum = "d7dd6741793d2c1fb2088f67f82cf07261f25272ebe3c0b0c311e0c6b50e851a" dependencies = [ "either", "fnv", "futures", "futures-timer", - "instant", "libp2p-core", "libp2p-identity", "libp2p-swarm-derive", @@ -4477,13 +4474,14 @@ dependencies = [ "tokio", "tracing", "void", + "web-time", ] [[package]] name = "libp2p-swarm-derive" -version = "0.34.2" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5daceb9dd908417b6dfcfe8e94098bc4aac54500c282e78120b885dadc09b999" +checksum = "206e0aa0ebe004d778d79fb0966aa0de996c19894e2c0605ba2f8524dd4443d8" dependencies = [ "heck", "proc-macro2", @@ -4493,9 +4491,9 @@ dependencies = [ [[package]] name = "libp2p-tcp" -version = "0.41.0" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b2460fc2748919adff99ecbc1aab296e4579e41f374fb164149bd2c9e529d4c" +checksum = "ad964f312c59dcfcac840acd8c555de8403e295d39edf96f5240048b5fcaa314" dependencies = [ "futures", "futures-timer", @@ -4503,16 +4501,16 @@ dependencies = [ "libc", "libp2p-core", "libp2p-identity", - "socket2 0.5.7", + "socket2 0.5.8", "tokio", "tracing", ] [[package]] name = "libp2p-tls" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b7b831e55ce2aa6c354e6861a85fdd4dd0a2b97d5e276fabac0e4810a71776" +checksum = "47b23dddc2b9c355f73c1e36eb0c3ae86f7dc964a3715f0731cfad352db4d847" dependencies = [ "futures", "futures-rustls", @@ -4520,18 +4518,18 @@ dependencies = [ "libp2p-identity", "rcgen 0.11.3", "ring 0.17.8", - "rustls 0.23.18", + "rustls 0.23.19", "rustls-webpki 0.101.7", - "thiserror 1.0.68", + "thiserror 1.0.69", "x509-parser", "yasna", ] [[package]] name = "libp2p-upnp" -version = "0.2.2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccf04b0e3ff3de52d07d5fd6c3b061d0e7f908ffc683c32d9638caedce86fc8" +checksum = "01bf2d1b772bd3abca049214a3304615e6a36fa6ffc742bdd1ba774486200b8f" dependencies = [ "futures", "futures-timer", @@ -4632,9 +4630,9 @@ checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "litemap" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" [[package]] name = "local-ip-address" @@ -4644,7 +4642,7 @@ checksum = "3669cf5561f8d27e8fc84cc15e58350e70f557d4d65f70e3154e54cd2f8e1782" dependencies = [ "libc", "neli", - "thiserror 1.0.68", + "thiserror 1.0.69", "windows-sys 0.59.0", ] @@ -4682,7 +4680,7 @@ version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" dependencies = [ - "hashbrown 0.15.1", + "hashbrown 0.15.2", ] [[package]] @@ -4833,11 +4831,10 @@ dependencies = [ [[package]] name = "mio" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ - "hermit-abi 0.3.9", "libc", "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys 0.52.0", @@ -4881,9 +4878,9 @@ dependencies = [ [[package]] name = "multihash" -version = "0.19.2" +version = "0.19.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc41f430805af9d1cf4adae4ed2149c759b877b01d909a1f40256188d09345d2" +checksum = "6b430e7953c29dd6a09afc29ff0bb69c6e306329ee6794700aee27b76a1aea8d" dependencies = [ "core2", "serde", @@ -4948,21 +4945,20 @@ dependencies = [ [[package]] name = "netlink-packet-core" -version = "0.4.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345b8ab5bd4e71a2986663e88c56856699d060e78e152e6e9d7966fcd5491297" +checksum = "72724faf704479d67b388da142b186f916188505e7e0b26719019c525882eda4" dependencies = [ "anyhow", "byteorder", - "libc", "netlink-packet-utils", ] [[package]] name = "netlink-packet-route" -version = "0.12.0" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9ea4302b9759a7a88242299225ea3688e63c85ea136371bb6cf94fd674efaab" +checksum = "053998cea5a306971f88580d0829e90f270f940befd7cf928da179d4187a5a66" dependencies = [ "anyhow", "bitflags 1.3.2", @@ -4981,29 +4977,29 @@ dependencies = [ "anyhow", "byteorder", "paste", - "thiserror 1.0.68", + "thiserror 1.0.69", ] [[package]] name = "netlink-proto" -version = "0.10.0" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65b4b14489ab424703c092062176d52ba55485a89c076b4f9db05092b7223aa6" +checksum = "86b33524dc0968bfad349684447bfce6db937a9ac3332a1fe60c0c5a5ce63f21" dependencies = [ "bytes", "futures", "log", "netlink-packet-core", "netlink-sys", - "thiserror 1.0.68", + "thiserror 1.0.69", "tokio", ] [[package]] name = "netlink-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "416060d346fbaf1f23f9512963e3e878f1a78e707cb699ba9215761754244307" +checksum = "16c903aa70590cb93691bf97a767c8d1d6122d2cc9070433deb3bbf36ce8bd23" dependencies = [ "bytes", "futures", @@ -5014,9 +5010,9 @@ dependencies = [ [[package]] name = "nix" -version = "0.24.3" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" dependencies = [ "bitflags 1.3.2", "cfg-if", @@ -5249,14 +5245,14 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.7.0" +version = "3.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8781a75c6205af67215f382092b6e0a4ff3734798523e69073d4bcd294ec767b" +checksum = "d830939c76d294956402033aee57a6da7b438f2294eb94864c37b0569053a42c" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.90", + "syn 1.0.109", ] [[package]] @@ -5296,9 +5292,9 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pathdiff" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61c5ce1153ab5b689d0c074c4e7fc613e942dfb7dd9eea5ab202d2ad91fe361" +checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3" [[package]] name = "pem" @@ -5327,20 +5323,20 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.14" +version = "2.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" +checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc" dependencies = [ "memchr", - "thiserror 1.0.68", + "thiserror 2.0.6", "ucd-trie", ] [[package]] name = "pest_derive" -version = "2.7.14" +version = "2.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d214365f632b123a47fd913301e14c946c61d1c183ee245fa76eb752e59a02dd" +checksum = "816518421cfc6887a0d62bf441b6ffb4536fcc926395a69e1a85852d4363f57e" dependencies = [ "pest", "pest_generator", @@ -5348,9 +5344,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.14" +version = "2.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb55586734301717aea2ac313f50b2eb8f60d2fc3dc01d190eefa2e625f60c4e" +checksum = "7d1396fd3a870fc7838768d171b4616d5c91f6cc25e377b673d714567d99377b" dependencies = [ "pest", "pest_meta", @@ -5361,9 +5357,9 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.7.14" +version = "2.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b75da2a70cf4d9cb76833c990ac9cd3923c9a8905a8929789ce347c84564d03d" +checksum = "e1e58089ea25d717bfd31fb534e4f3afcc2cc569c70de3e239778991ea3b7dea" dependencies = [ "once_cell", "pest", @@ -5421,7 +5417,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" dependencies = [ "atomic-waker", - "fastrand 2.1.1", + "fastrand 2.3.0", "futures-io", ] @@ -5478,7 +5474,7 @@ dependencies = [ "concurrent-queue", "hermit-abi 0.4.0", "pin-project-lite 0.2.15", - "rustix 0.38.39", + "rustix 0.38.42", "tracing", "windows-sys 0.59.0", ] @@ -5599,7 +5595,7 @@ dependencies = [ "memchr", "parking_lot", "protobuf", - "thiserror 1.0.68", + "thiserror 1.0.69", ] [[package]] @@ -5698,80 +5694,70 @@ dependencies = [ "byteorder", ] -[[package]] -name = "quick-protobuf-codec" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ededb1cd78531627244d51dd0c7139fbe736c7d57af0092a76f0ffb2f56e98" -dependencies = [ - "asynchronous-codec 0.6.2", - "bytes", - "quick-protobuf", - "thiserror 1.0.68", - "unsigned-varint 0.7.2", -] - [[package]] name = "quick-protobuf-codec" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15a0580ab32b169745d7a39db2ba969226ca16738931be152a3209b409de2474" dependencies = [ - "asynchronous-codec 0.7.0", + "asynchronous-codec", "bytes", "quick-protobuf", - "thiserror 1.0.68", + "thiserror 1.0.69", "unsigned-varint 0.8.0", ] [[package]] name = "quinn" -version = "0.11.5" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c7c5fdde3cdae7203427dc4f0a68fe0ed09833edc525a03456b153b79828684" +checksum = "62e96808277ec6f97351a2380e6c25114bc9e67037775464979f3037c92d05ef" dependencies = [ "bytes", "futures-io", "pin-project-lite 0.2.15", "quinn-proto", "quinn-udp", - "rustc-hash 2.0.0", - "rustls 0.23.18", - "socket2 0.5.7", - "thiserror 1.0.68", + "rustc-hash", + "rustls 0.23.19", + "socket2 0.5.8", + "thiserror 2.0.6", "tokio", "tracing", ] [[package]] name = "quinn-proto" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fadfaed2cd7f389d0161bb73eeb07b7b78f8691047a6f3e73caaeae55310a4a6" +checksum = "a2fe5ef3495d7d2e377ff17b1a8ce2ee2ec2a18cde8b6ad6619d65d0701c135d" dependencies = [ "bytes", + "getrandom 0.2.15", "rand 0.8.5", "ring 0.17.8", - "rustc-hash 2.0.0", - "rustls 0.23.18", + "rustc-hash", + "rustls 0.23.19", + "rustls-pki-types", "slab", - "thiserror 1.0.68", + "thiserror 2.0.6", "tinyvec", "tracing", + "web-time", ] [[package]] name = "quinn-udp" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d5a626c6807713b15cac82a6acaccd6043c9a5408c24baae07611fec3f243da" +checksum = "52cd4b1eff68bf27940dd39811292c49e007f4d0b4c357358dc9b0197be6b527" dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2 0.5.7", + "socket2 0.5.8", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -5908,23 +5894,24 @@ dependencies = [ [[package]] name = "redis" -version = "0.27.5" +version = "0.27.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cccf17a692ce51b86564334614d72dcae1def0fd5ecebc9f02956da74352b5" +checksum = "09d8f99a4090c89cc489a94833c901ead69bfbf3877b4867d5482e321ee875bc" dependencies = [ "arc-swap", "async-trait", + "backon", "bytes", "combine", "futures", "futures-util", + "itertools 0.13.0", "itoa", "num-bigint", "percent-encoding", "pin-project-lite 0.2.15", "ryu", "tokio", - "tokio-retry2", "tokio-util", "url", ] @@ -5946,7 +5933,7 @@ checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom 0.2.15", "libredox", - "thiserror 1.0.68", + "thiserror 1.0.69", ] [[package]] @@ -5957,7 +5944,7 @@ checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.8", + "regex-automata 0.4.9", "regex-syntax 0.8.5", ] @@ -5972,9 +5959,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -6013,11 +6000,11 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2 0.4.6", - "http 1.1.0", + "h2 0.4.7", + "http 1.2.0", "http-body 1.0.1", "http-body-util", - "hyper 1.5.0", + "hyper 1.5.1", "hyper-rustls", "hyper-tls", "hyper-util", @@ -6033,8 +6020,8 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper 1.0.1", - "system-configuration 0.6.1", + "sync_wrapper 1.0.2", + "system-configuration", "tokio", "tokio-native-tls", "tower-service", @@ -6144,9 +6131,9 @@ dependencies = [ [[package]] name = "rsa" -version = "0.9.6" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc" +checksum = "47c75d7c5c6b673e58bf54d8544a9f432e3a925b0e80f7cd3602ab5c50c55519" dependencies = [ "const-oid", "digest 0.10.7", @@ -6164,16 +6151,19 @@ dependencies = [ [[package]] name = "rtnetlink" -version = "0.10.1" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322c53fd76a18698f1c27381d58091de3a043d356aa5bd0d510608b565f469a0" +checksum = "7a552eb82d19f38c3beed3f786bd23aa434ceb9ac43ab44419ca6d67a7e186c0" dependencies = [ "futures", "log", + "netlink-packet-core", "netlink-packet-route", + "netlink-packet-utils", "netlink-proto", + "netlink-sys", "nix", - "thiserror 1.0.68", + "thiserror 1.0.69", "tokio", ] @@ -6195,15 +6185,9 @@ checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustc-hash" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" +checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" [[package]] name = "rustc-hex" @@ -6254,15 +6238,15 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.39" +version = "0.38.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "375116bee2be9ed569afe2154ea6a99dfdffd257f533f187498c2a8f5feaf4ee" +checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" dependencies = [ "bitflags 2.6.0", "errno", "libc", "linux-raw-sys 0.4.14", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -6280,9 +6264,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.18" +version = "0.23.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c9cc1d47e243d655ace55ed38201c19ae02c148ae56412ab8750e8f0166ab7f" +checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1" dependencies = [ "log", "once_cell", @@ -6307,6 +6291,9 @@ name = "rustls-pki-types" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" +dependencies = [ + "web-time", +] [[package]] name = "rustls-webpki" @@ -6354,9 +6341,9 @@ checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "schannel" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" dependencies = [ "windows-sys 0.59.0", ] @@ -6404,9 +6391,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.12.0" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6" +checksum = "fa39c7303dc58b5543c94d22c1766b0d31f2ee58306363ea622b10bbc075eaa2" dependencies = [ "core-foundation-sys", "libc", @@ -6435,9 +6422,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.215" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" +checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" dependencies = [ "serde_derive", ] @@ -6464,9 +6451,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.215" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" +checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" dependencies = [ "proc-macro2", "quote", @@ -6502,7 +6489,7 @@ checksum = "c7715380eec75f029a4ef7de39a9200e0a63823176b759d055b613f5a87df6a6" dependencies = [ "percent-encoding", "serde", - "thiserror 1.0.68", + "thiserror 1.0.69", ] [[package]] @@ -6536,7 +6523,7 @@ dependencies = [ "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.6.0", + "indexmap 2.7.0", "serde", "serde_derive", "serde_json", @@ -6771,9 +6758,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" dependencies = [ "libc", "windows-sys 0.52.0", @@ -6848,7 +6835,7 @@ dependencies = [ "hashbrown 0.14.5", "hashlink 0.9.1", "hex", - "indexmap 2.6.0", + "indexmap 2.7.0", "log", "memchr", "once_cell", @@ -6859,7 +6846,7 @@ dependencies = [ "sha2 0.10.8", "smallvec", "sqlformat", - "thiserror 1.0.68", + "thiserror 1.0.69", "time 0.3.37", "tokio", "tokio-stream", @@ -6943,7 +6930,7 @@ dependencies = [ "smallvec", "sqlx-core", "stringprep", - "thiserror 1.0.68", + "thiserror 1.0.69", "time 0.3.37", "tracing", "whoami", @@ -6982,7 +6969,7 @@ dependencies = [ "smallvec", "sqlx-core", "stringprep", - "thiserror 1.0.68", + "thiserror 1.0.69", "time 0.3.37", "tracing", "whoami", @@ -7251,9 +7238,9 @@ checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] name = "sync_wrapper" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" dependencies = [ "futures-core", ] @@ -7269,17 +7256,6 @@ dependencies = [ "syn 2.0.90", ] -[[package]] -name = "system-configuration" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "system-configuration-sys 0.5.0", -] - [[package]] name = "system-configuration" version = "0.6.1" @@ -7288,17 +7264,7 @@ checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ "bitflags 2.6.0", "core-foundation", - "system-configuration-sys 0.6.0", -] - -[[package]] -name = "system-configuration-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" -dependencies = [ - "core-foundation-sys", - "libc", + "system-configuration-sys", ] [[package]] @@ -7345,40 +7311,40 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", - "fastrand 2.1.1", + "fastrand 2.3.0", "once_cell", - "rustix 0.38.39", + "rustix 0.38.42", "windows-sys 0.59.0", ] [[package]] name = "thiserror" -version = "1.0.68" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02dd99dc800bbb97186339685293e1cc5d9df1f8fae2d0aecd9ff1c77efea892" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl 1.0.68", + "thiserror-impl 1.0.69", ] [[package]] name = "thiserror" -version = "2.0.4" +version = "2.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f49a1853cf82743e3b7950f77e0f4d622ca36cf4317cba00c767838bac8d490" +checksum = "8fec2a1820ebd077e2b90c4df007bebf344cd394098a13c563957d0afc83ea47" dependencies = [ - "thiserror-impl 2.0.4", + "thiserror-impl 2.0.6", ] [[package]] name = "thiserror-impl" -version = "1.0.68" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7c61ec9a6f64d2793d8a45faba21efbe3ced62a886d44c36a009b2b519b4c7e" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", @@ -7387,9 +7353,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.4" +version = "2.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8381894bb3efe0c4acac3ded651301ceee58a15d47c2e34885ed1908ad667061" +checksum = "d65750cab40f4ff1929fb1ba509e9914eb756131cef4210da8d5d700d26f6312" dependencies = [ "proc-macro2", "quote", @@ -7455,7 +7421,7 @@ dependencies = [ "edit-distance", "futures", "futures-util", - "http 1.1.0", + "http 1.2.0", "include_dir", "itertools 0.12.1", "lazy_static", @@ -7624,7 +7590,7 @@ dependencies = [ "mio", "parking_lot", "pin-project-lite 0.2.15", - "socket2 0.5.7", + "socket2 0.5.8", "tokio-macros", "tracing", "windows-sys 0.52.0", @@ -7661,33 +7627,21 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-retry2" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "903934dba1c4c2f2e9cb460ef10b5695e0b0ecad3bf9ee7c8675e540c5e8b2d1" -dependencies = [ - "pin-project", - "rand 0.8.5", - "tokio", -] - [[package]] name = "tokio-rustls" -version = "0.26.0" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37" dependencies = [ - "rustls 0.23.18", - "rustls-pki-types", + "rustls 0.23.19", "tokio", ] [[package]] name = "tokio-stream" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" dependencies = [ "futures-core", "pin-project-lite 0.2.15", @@ -7696,9 +7650,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.12" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" +checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" dependencies = [ "bytes", "futures-core", @@ -7734,7 +7688,7 @@ version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ - "indexmap 2.6.0", + "indexmap 2.7.0", "serde", "serde_spanned", "toml_datetime", @@ -7928,7 +7882,7 @@ dependencies = [ "native-tls", "rand 0.8.5", "sha-1", - "thiserror 1.0.68", + "thiserror 1.0.69", "url", "utf-8", ] @@ -7977,9 +7931,9 @@ checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" [[package]] name = "unicode-ident" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] name = "unicode-normalization" @@ -8029,10 +7983,6 @@ name = "unsigned-varint" version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6889a77d49f1f013504cec6bf97a2c730394adedaeb1deb5ea08949a50541105" -dependencies = [ - "asynchronous-codec 0.6.2", - "bytes", -] [[package]] name = "unsigned-varint" @@ -8054,18 +8004,18 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "ureq" -version = "2.10.1" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b74fc6b57825be3373f7054754755f03ac3a8f5d70015ccad699ba2029956f4a" +checksum = "02d1a66277ed75f640d608235660df48c8e3c19f3b4edb6a263315626cc3c01d" dependencies = [ "base64 0.22.1", "flate2", "log", "once_cell", - "rustls 0.23.18", + "rustls 0.23.19", "rustls-pki-types", "url", - "webpki-roots 0.26.6", + "webpki-roots 0.26.7", ] [[package]] @@ -8075,7 +8025,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", - "idna 1.0.3", + "idna", "percent-encoding", "serde", ] @@ -8260,9 +8210,9 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" [[package]] name = "wasm-bindgen" -version = "0.2.95" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" +checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" dependencies = [ "cfg-if", "once_cell", @@ -8273,13 +8223,12 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.95" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" +checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", "syn 2.0.90", @@ -8288,21 +8237,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.45" +version = "0.4.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" +checksum = "38176d9b44ea84e9184eff0bc34cc167ed044f816accfe5922e54d84cf48eca2" dependencies = [ "cfg-if", "js-sys", + "once_cell", "wasm-bindgen", "web-sys", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.95" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" +checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -8310,9 +8260,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.95" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" +checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", "quote", @@ -8323,15 +8273,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.95" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" +checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" [[package]] name = "web-sys" -version = "0.3.72" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" +checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc" dependencies = [ "js-sys", "wasm-bindgen", @@ -8368,9 +8318,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.26.6" +version = "0.26.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" +checksum = "5d642ff16b7e79272ae451b7322067cdc17cadf68c23264be9d94a32319efe7e" dependencies = [ "rustls-pki-types", ] @@ -8415,29 +8365,30 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows" -version = "0.51.1" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9" +checksum = "efc5cf48f83140dcaab716eeaea345f9e93d0018fb81162753a3f76c3397b538" dependencies = [ - "windows-core 0.51.1", - "windows-targets 0.48.5", + "windows-core 0.53.0", + "windows-targets 0.52.6", ] [[package]] name = "windows-core" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] name = "windows-core" -version = "0.52.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +checksum = "9dcc5b895a6377f1ab9fa55acedab1fd5ac0db66ad1e6c7f47e28a22e446a5dd" dependencies = [ + "windows-result 0.1.2", "windows-targets 0.52.6", ] @@ -8447,11 +8398,20 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" dependencies = [ - "windows-result", + "windows-result 0.2.0", "windows-strings", "windows-targets 0.52.6", ] +[[package]] +name = "windows-result" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-result" version = "0.2.0" @@ -8467,7 +8427,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" dependencies = [ - "windows-result", + "windows-result 0.2.0", "windows-targets 0.52.6", ] @@ -8673,15 +8633,15 @@ dependencies = [ "oid-registry", "ring 0.17.8", "rusticata-macros", - "thiserror 1.0.68", + "thiserror 1.0.69", "time 0.3.37", ] [[package]] name = "xml-rs" -version = "0.8.23" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af310deaae937e48a26602b730250b4949e125f468f11e6990be3e5304ddd96f" +checksum = "ea8b391c9a790b496184c29f7f93b9ed5b16abb306c05415b68bcc16e4d06432" [[package]] name = "xmltree" @@ -8714,9 +8674,9 @@ dependencies = [ [[package]] name = "yoke" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" dependencies = [ "serde", "stable_deref_trait", @@ -8726,9 +8686,9 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", @@ -8759,18 +8719,18 @@ dependencies = [ [[package]] name = "zerofrom" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" +checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" dependencies = [ "zerofrom-derive", ] [[package]] name = "zerofrom-derive" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 4ebda6b06d..2ea7c703f1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -65,7 +65,7 @@ jf-utils = { version = "0.4.4", git = "https://github.com/espressosystems/jellyf lazy_static = "1" libp2p-identity = "0.2" libp2p-networking = { path = "./crates/libp2p-networking", version = "0.5", default-features = false } -libp2p-swarm-derive = { version = "0.34" } +libp2p-swarm-derive = { version = "0.35" } lru = "0.12" multiaddr = { version = "0.18" } portpicker = "0.1" @@ -91,7 +91,7 @@ url = { version = "2", features = ["serde"] } vec1 = { version = "1", features = ["serde"] } reqwest = { version = "0.12", features = ["json"] } -libp2p = { package = "libp2p", version = "0.53", default-features = false, features = [ +libp2p = { package = "libp2p", version = "0.54", default-features = false, features = [ "macros", "autonat", "cbor", diff --git a/README.md b/README.md index dc1b35ed97..784c0776b2 100644 --- a/README.md +++ b/README.md @@ -133,7 +133,7 @@ This second window should now display task usage. To view distributed logs with just the centralized server and one client, first edit the `centralized_server/orchestrator` file to include have a threshold and num_nodes of 1. -Then open 3 terminals. +Then open three separate terminals. ```bash # Terminal 1 diff --git a/audits/README.md b/audits/README.md index 49e3c6039c..1df2944f3b 100644 --- a/audits/README.md +++ b/audits/README.md @@ -5,4 +5,4 @@ Internal audits | Scope & Delivery date | Report | |-----------------------------|---------------------------------------------------------------| -| HotShot - July 29, 2024 | [Report](./internal-reviews/EspressoHotShot-2024internal.pdf) | \ No newline at end of file +| HotShot - July 29, 2024 | [Report](./internal-reviews/EspressoHotshot-2024internal.pdf) | diff --git a/crates/example-types/src/node_types.rs b/crates/example-types/src/node_types.rs index 1adcfb08f2..c7899aa3de 100644 --- a/crates/example-types/src/node_types.rs +++ b/crates/example-types/src/node_types.rs @@ -52,6 +52,8 @@ use crate::{ /// to select our traits pub struct TestTypes; impl NodeType for TestTypes { + const EPOCH_HEIGHT: u64 = 10; + type AuctionResult = TestAuctionResult; type View = ViewNumber; type Epoch = EpochNumber; @@ -82,6 +84,8 @@ impl NodeType for TestTypes { /// to select our traits pub struct TestTypesRandomizedLeader; impl NodeType for TestTypesRandomizedLeader { + const EPOCH_HEIGHT: u64 = 10; + type AuctionResult = TestAuctionResult; type View = ViewNumber; type Epoch = EpochNumber; @@ -115,6 +119,8 @@ pub struct TestTypesRandomizedCommitteeMembers { } impl NodeType for TestTypesRandomizedCommitteeMembers { + const EPOCH_HEIGHT: u64 = 10; + type AuctionResult = TestAuctionResult; type View = ViewNumber; type Epoch = EpochNumber; @@ -146,6 +152,8 @@ impl NodeType for TestTypesRandomizedCommitteeMember /// to select our traits pub struct TestConsecutiveLeaderTypes; impl NodeType for TestConsecutiveLeaderTypes { + const EPOCH_HEIGHT: u64 = 10; + type AuctionResult = TestAuctionResult; type View = ViewNumber; type Epoch = EpochNumber; @@ -176,6 +184,8 @@ impl NodeType for TestConsecutiveLeaderTypes { /// to select our traits pub struct TestTwoStakeTablesTypes; impl NodeType for TestTwoStakeTablesTypes { + const EPOCH_HEIGHT: u64 = 10; + type AuctionResult = TestAuctionResult; type View = ViewNumber; type Epoch = EpochNumber; @@ -295,7 +305,7 @@ impl Versions for EpochsTestVersions { 0, 0, ]; - type Marketplace = StaticVersion<0, 99>; + type Marketplace = StaticVersion<0, 3>; type Epochs = StaticVersion<0, 4>; } diff --git a/crates/example-types/src/storage_types.rs b/crates/example-types/src/storage_types.rs index 1a0cc1afc7..b5f3610f21 100644 --- a/crates/example-types/src/storage_types.rs +++ b/crates/example-types/src/storage_types.rs @@ -9,13 +9,15 @@ use std::{ sync::Arc, }; -use crate::testable_delay::{DelayConfig, SupportedTraitTypesForAsyncDelay, TestableDelay}; use anyhow::{bail, Result}; use async_lock::RwLock; use async_trait::async_trait; use hotshot_types::{ consensus::CommitmentMap, - data::{DaProposal, Leaf, Leaf2, QuorumProposal, QuorumProposal2, VidDisperseShare}, + data::{ + DaProposal, DaProposal2, Leaf, Leaf2, QuorumProposal, QuorumProposal2, VidDisperseShare, + VidDisperseShare2, + }, event::HotShotAction, message::Proposal, simple_certificate::{NextEpochQuorumCertificate2, QuorumCertificate2, UpgradeCertificate}, @@ -29,14 +31,23 @@ use hotshot_types::{ }; use jf_vid::VidScheme; +use crate::testable_delay::{DelayConfig, SupportedTraitTypesForAsyncDelay, TestableDelay}; + type VidShares = HashMap< ::View, HashMap<::SignatureKey, Proposal>>, >; +type VidShares2 = HashMap< + ::View, + HashMap<::SignatureKey, Proposal>>, +>; + #[derive(Clone, Debug)] pub struct TestStorageState { vids: VidShares, + vid2: VidShares2, das: HashMap>>, + da2s: HashMap>>, proposals: BTreeMap>>, proposals2: BTreeMap>>, high_qc: Option>, @@ -51,7 +62,9 @@ impl Default for TestStorageState { fn default() -> Self { Self { vids: HashMap::new(), + vid2: HashMap::new(), das: HashMap::new(), + da2s: HashMap::new(), proposals: BTreeMap::new(), proposals2: BTreeMap::new(), high_qc: None, @@ -132,6 +145,23 @@ impl Storage for TestStorage { Ok(()) } + async fn append_vid2( + &self, + proposal: &Proposal>, + ) -> Result<()> { + if self.should_return_err { + bail!("Failed to append VID proposal to storage"); + } + Self::run_delay_settings_from_config(&self.delay_config).await; + let mut inner = self.inner.write().await; + inner + .vid2 + .entry(proposal.data.view_number) + .or_default() + .insert(proposal.data.recipient_key.clone(), proposal.clone()); + Ok(()) + } + async fn append_da( &self, proposal: &Proposal>, @@ -147,6 +177,21 @@ impl Storage for TestStorage { .insert(proposal.data.view_number, proposal.clone()); Ok(()) } + async fn append_da2( + &self, + proposal: &Proposal>, + _vid_commit: ::Commit, + ) -> Result<()> { + if self.should_return_err { + bail!("Failed to append VID proposal to storage"); + } + Self::run_delay_settings_from_config(&self.delay_config).await; + let mut inner = self.inner.write().await; + inner + .da2s + .insert(proposal.data.view_number, proposal.clone()); + Ok(()) + } async fn append_proposal( &self, proposal: &Proposal>, diff --git a/crates/examples/infra/mod.rs b/crates/examples/infra/mod.rs index 2462215dd9..88a2ff900b 100755 --- a/crates/examples/infra/mod.rs +++ b/crates/examples/infra/mod.rs @@ -736,7 +736,7 @@ where .to_string() }; - // Create the qurorum membership from the list of known nodes + // Create the quorum membership from the list of known nodes let all_nodes = config.config.known_nodes_with_stake.clone(); let da_nodes = config.config.known_da_nodes.clone(); let quorum_membership = TYPES::Membership::new(all_nodes, da_nodes); diff --git a/crates/hotshot/src/lib.rs b/crates/hotshot/src/lib.rs index bc6e7f3d54..d5d0432bfe 100644 --- a/crates/hotshot/src/lib.rs +++ b/crates/hotshot/src/lib.rs @@ -70,6 +70,7 @@ use hotshot_types::{ pub use rand; use tokio::{spawn, time::sleep}; use tracing::{debug, instrument, trace}; + // -- Rexports // External use crate::{ @@ -493,6 +494,7 @@ impl, V: Versions> SystemContext = @@ -518,7 +520,7 @@ impl, V: Versions> SystemContext { /// than `inner`s view number for the non genesis case because we must have seen higher QCs /// to decide on the leaf. high_qc: QuorumCertificate2, - /// Next epoch highest QC that was seen + /// Next epoch highest QC that was seen. This is needed to propose during epoch transition after restart. next_epoch_high_qc: Option>, /// Previously decided upgrade certificate; this is necessary if an upgrade has happened and we are not restarting with the new version decided_upgrade_certificate: Option>, diff --git a/crates/libp2p-networking/src/network/node.rs b/crates/libp2p-networking/src/network/node.rs index 1ea25a36d0..279d035949 100644 --- a/crates/libp2p-networking/src/network/node.rs +++ b/crates/libp2p-networking/src/network/node.rs @@ -233,7 +233,7 @@ impl NetworkNode { let identify = IdentifyBehaviour::new(identify_cfg); // - Build DHT needed for peer discovery - let mut kconfig = Config::default(); + let mut kconfig = Config::new(StreamProtocol::new("/ipfs/kad/1.0.0")); // 8 hours by default let record_republication_interval = config .republication_interval @@ -603,6 +603,7 @@ impl NetworkNode { agent_version: _, observed_addr: _, }, + connection_id: _, } = *e { let behaviour = self.swarm.behaviour_mut(); diff --git a/crates/libp2p-networking/src/network/transport.rs b/crates/libp2p-networking/src/network/transport.rs index 0f3bdf80a9..aac8a66b60 100644 --- a/crates/libp2p-networking/src/network/transport.rs +++ b/crates/libp2p-networking/src/network/transport.rs @@ -14,7 +14,11 @@ use hotshot_types::traits::{ signature_key::SignatureKey, }; use libp2p::{ - core::{muxing::StreamMuxerExt, transport::TransportEvent, StreamMuxer}, + core::{ + muxing::StreamMuxerExt, + transport::{DialOpts, TransportEvent}, + StreamMuxer, + }, identity::PeerId, Transport, }; @@ -314,9 +318,10 @@ where fn dial( &mut self, addr: libp2p::Multiaddr, + opts: DialOpts, ) -> Result> { // Perform the inner dial - let res = self.inner.dial(addr); + let res = self.inner.dial(addr, opts); // Clone the necessary fields let auth_message = Arc::clone(&self.auth_message); @@ -329,27 +334,6 @@ where } } - /// Dial a remote peer as a listener. This function is changed to perform an authentication - /// handshake on top. The flow should be the reverse of the `dial` function and the - /// same as the `poll` function. - fn dial_as_listener( - &mut self, - addr: libp2p::Multiaddr, - ) -> Result> { - // Perform the inner dial - let res = self.inner.dial(addr); - - // Clone the necessary fields - let auth_message = Arc::clone(&self.auth_message); - let stake_table = Arc::clone(&self.stake_table); - - // If the dial was successful, perform the authentication handshake on top - match res { - Ok(dial) => Ok(Self::gen_handshake(dial, false, stake_table, auth_message)), - Err(err) => Err(err), - } - } - /// This function is where we perform the authentication handshake for _incoming_ connections. /// The flow in this case is the reverse of the `dial` function: we first verify the remote peer's /// authentication, and then authenticate with them. @@ -420,13 +404,6 @@ where fn remove_listener(&mut self, id: libp2p::core::transport::ListenerId) -> bool { self.inner.remove_listener(id) } - fn address_translation( - &self, - listen: &libp2p::Multiaddr, - observed: &libp2p::Multiaddr, - ) -> Option { - self.inner.address_translation(listen, observed) - } fn listen_on( &mut self, id: libp2p::core::transport::ListenerId, diff --git a/crates/macros/src/lib.rs b/crates/macros/src/lib.rs index 80f49e1d6a..c409cb6b58 100644 --- a/crates/macros/src/lib.rs +++ b/crates/macros/src/lib.rs @@ -27,7 +27,7 @@ struct TypePathBracketedArray { /// description of a crosstest #[derive(derive_builder::Builder, Debug, Clone)] struct CrossTestData { - /// imlementations + /// implementations impls: ExprArray, /// builder impl diff --git a/crates/orchestrator/api.toml b/crates/orchestrator/api.toml index 25fcb2b7c2..7a18fbb193 100644 --- a/crates/orchestrator/api.toml +++ b/crates/orchestrator/api.toml @@ -44,7 +44,7 @@ Supply whether or not we are DA. [route.peer_pubconfig_ready] PATH = ["peer_pub_ready"] DOC = """ -Get whether the node can collect the final config which includs all peer's public config/info like public keys, returns a boolean. +Get whether the node can collect the final config which includes all peer's public config/info like public keys, returns a boolean. """ # POST the updated config with all peers' public keys / configs diff --git a/crates/task-impls/src/consensus/handlers.rs b/crates/task-impls/src/consensus/handlers.rs index 856cbe85ec..3a9f44c34f 100644 --- a/crates/task-impls/src/consensus/handlers.rs +++ b/crates/task-impls/src/consensus/handlers.rs @@ -6,30 +6,29 @@ use std::{sync::Arc, time::Duration}; -use super::ConsensusTaskState; -use crate::{ - consensus::Versions, events::HotShotEvent, helpers::broadcast_event, - vote_collection::handle_vote, -}; use async_broadcast::Sender; use chrono::Utc; -use hotshot_types::simple_vote::HasEpoch; -use hotshot_types::vote::Vote; use hotshot_types::{ event::{Event, EventType}, - simple_vote::{QuorumVote2, TimeoutData, TimeoutVote}, + simple_vote::{HasEpoch, QuorumVote2, TimeoutData2, TimeoutVote2}, traits::{ election::Membership, node_implementation::{ConsensusTime, NodeImplementation, NodeType}, }, utils::EpochTransitionIndicator, - vote::HasViewNumber, + vote::{HasViewNumber, Vote}, }; use tokio::{spawn, time::sleep}; use tracing::instrument; use utils::anytrace::*; use vbs::version::StaticVersionType; +use super::ConsensusTaskState; +use crate::{ + consensus::Versions, events::HotShotEvent, helpers::broadcast_event, + vote_collection::handle_vote, +}; + /// Handle a `QuorumVoteRecv` event. pub(crate) async fn handle_quorum_vote_recv< TYPES: NodeType, @@ -68,6 +67,7 @@ pub(crate) async fn handle_quorum_vote_recv< vote, task_state.public_key.clone(), &task_state.membership, + vote.data.epoch, task_state.id, &event, sender, @@ -86,6 +86,7 @@ pub(crate) async fn handle_quorum_vote_recv< &vote.clone().into(), task_state.public_key.clone(), &task_state.membership, + vote.data.epoch, task_state.id, &event, sender, @@ -104,7 +105,7 @@ pub(crate) async fn handle_timeout_vote_recv< I: NodeImplementation, V: Versions, >( - vote: &TimeoutVote, + vote: &TimeoutVote2, event: Arc>, sender: &Sender>>, task_state: &mut ConsensusTaskState, @@ -126,6 +127,7 @@ pub(crate) async fn handle_timeout_vote_recv< vote, task_state.public_key.clone(), &task_state.membership, + vote.data.epoch, task_state.id, &event, sender, @@ -325,8 +327,8 @@ pub(crate) async fn handle_timeout ) ); - let vote = TimeoutVote::create_signed_vote( - TimeoutData:: { + let vote = TimeoutVote2::create_signed_vote( + TimeoutData2:: { view: view_number, epoch, }, diff --git a/crates/task-impls/src/consensus/mod.rs b/crates/task-impls/src/consensus/mod.rs index c44b35e42f..e6897a2fe5 100644 --- a/crates/task-impls/src/consensus/mod.rs +++ b/crates/task-impls/src/consensus/mod.rs @@ -10,14 +10,12 @@ use async_broadcast::{Receiver, Sender}; use async_trait::async_trait; use either::Either; use hotshot_task::task::TaskState; -use hotshot_types::simple_certificate::NextEpochQuorumCertificate2; -use hotshot_types::simple_vote::NextEpochQuorumVote2; use hotshot_types::{ consensus::OuterConsensus, event::Event, message::UpgradeLock, - simple_certificate::{QuorumCertificate2, TimeoutCertificate}, - simple_vote::{QuorumVote2, TimeoutVote}, + simple_certificate::{NextEpochQuorumCertificate2, QuorumCertificate2, TimeoutCertificate2}, + simple_vote::{NextEpochQuorumVote2, QuorumVote2, TimeoutVote2}, traits::{ node_implementation::{ConsensusTime, NodeImplementation, NodeType, Versions}, signature_key::SignatureKey, @@ -67,7 +65,7 @@ pub struct ConsensusTaskState, V: /// A map of `TimeoutVote` collector tasks. pub timeout_vote_collectors: - VoteCollectorsMap, TimeoutCertificate, V>, + VoteCollectorsMap, TimeoutCertificate2, V>, /// The view number that this node is currently executing in. pub cur_view: TYPES::View, diff --git a/crates/task-impls/src/da.rs b/crates/task-impls/src/da.rs index 8c7a6fbcd5..b292814e24 100644 --- a/crates/task-impls/src/da.rs +++ b/crates/task-impls/src/da.rs @@ -10,14 +10,13 @@ use async_broadcast::{Receiver, Sender}; use async_lock::RwLock; use async_trait::async_trait; use hotshot_task::task::TaskState; -use hotshot_types::utils::EpochTransitionIndicator; use hotshot_types::{ consensus::{Consensus, OuterConsensus}, - data::{DaProposal, PackedBundle}, + data::{DaProposal2, PackedBundle}, event::{Event, EventType}, message::{Proposal, UpgradeLock}, - simple_certificate::DaCertificate, - simple_vote::{DaData, DaVote, HasEpoch}, + simple_certificate::DaCertificate2, + simple_vote::{DaData2, DaVote2}, traits::{ block_contents::vid_commitment, election::Membership, @@ -26,6 +25,7 @@ use hotshot_types::{ signature_key::SignatureKey, storage::Storage, }, + utils::EpochTransitionIndicator, vote::HasViewNumber, }; use sha2::{Digest, Sha256}; @@ -62,7 +62,7 @@ pub struct DaTaskState, V: Version pub network: Arc, /// A map of `DaVote` collector tasks. - pub vote_collectors: VoteCollectorsMap, DaCertificate, V>, + pub vote_collectors: VoteCollectorsMap, DaCertificate2, V>, /// This Nodes public key pub public_key: TYPES::SignatureKey, @@ -115,7 +115,7 @@ impl, V: Versions> DaTaskState, V: Versions> DaTaskState { let cur_view = self.consensus.read().await.cur_view(); + let view_number = proposal.data.view_number(); + let epoch_number = proposal.data.epoch; + ensure!( - cur_view <= proposal.data.view_number() + 1, + cur_view <= view_number + 1, debug!( "Validated DA proposal for prior view but it's too old now Current view {:?}, DA Proposal view {:?}", cur_view, @@ -150,7 +153,7 @@ impl, V: Versions> DaTaskState, V: Versions> DaTaskState, V: Versions> DaTaskState, V: Versions> DaTaskState, V: Versions> DaTaskState, V: Versions> DaTaskState = DaProposal { + let data: DaProposal2 = DaProposal2 { encoded_transactions: Arc::clone(encoded_transactions), metadata: metadata.clone(), // Upon entering a new view we want to send a DA Proposal for the next view -> Is it always the case that this is cur_view + 1? diff --git a/crates/task-impls/src/events.rs b/crates/task-impls/src/events.rs index a856c1bdbd..195b2137cd 100644 --- a/crates/task-impls/src/events.rs +++ b/crates/task-impls/src/events.rs @@ -6,26 +6,24 @@ use std::fmt::Display; -use crate::view_sync::ViewSyncPhase; use async_broadcast::Sender; use either::Either; use hotshot_task::task::TaskEvent; -use hotshot_types::simple_certificate::NextEpochQuorumCertificate2; use hotshot_types::{ data::{ - DaProposal, Leaf2, PackedBundle, QuorumProposal2, UpgradeProposal, VidDisperse, - VidDisperseShare, + DaProposal2, Leaf2, PackedBundle, QuorumProposal2, UpgradeProposal, VidDisperse, + VidDisperseShare2, }, message::Proposal, request_response::ProposalRequestPayload, simple_certificate::{ - DaCertificate, QuorumCertificate, QuorumCertificate2, TimeoutCertificate, - UpgradeCertificate, ViewSyncCommitCertificate2, ViewSyncFinalizeCertificate2, - ViewSyncPreCommitCertificate2, + DaCertificate2, NextEpochQuorumCertificate2, QuorumCertificate, QuorumCertificate2, + TimeoutCertificate, TimeoutCertificate2, UpgradeCertificate, ViewSyncCommitCertificate2, + ViewSyncFinalizeCertificate2, ViewSyncPreCommitCertificate2, }, simple_vote::{ - DaVote, QuorumVote2, TimeoutVote, UpgradeVote, ViewSyncCommitVote, ViewSyncFinalizeVote, - ViewSyncPreCommitVote, + DaVote2, QuorumVote2, TimeoutVote2, UpgradeVote, ViewSyncCommitVote2, + ViewSyncFinalizeVote2, ViewSyncPreCommitVote2, }, traits::{ block_contents::BuilderFee, network::DataRequest, node_implementation::NodeType, @@ -37,6 +35,8 @@ use hotshot_types::{ }; use vec1::Vec1; +use crate::view_sync::ViewSyncPhase; + impl TaskEvent for HotShotEvent { fn shutdown_event() -> Self { HotShotEvent::Shutdown @@ -76,19 +76,19 @@ pub enum HotShotEvent { /// A quorum vote has been received from the network; handled by the consensus task QuorumVoteRecv(QuorumVote2), /// A timeout vote received from the network; handled by consensus task - TimeoutVoteRecv(TimeoutVote), + TimeoutVoteRecv(TimeoutVote2), /// Send a timeout vote to the network; emitted by consensus task replicas - TimeoutVoteSend(TimeoutVote), + TimeoutVoteSend(TimeoutVote2), /// A DA proposal has been received from the network; handled by the DA task - DaProposalRecv(Proposal>, TYPES::SignatureKey), + DaProposalRecv(Proposal>, TYPES::SignatureKey), /// A DA proposal has been validated; handled by the DA task and VID task - DaProposalValidated(Proposal>, TYPES::SignatureKey), + DaProposalValidated(Proposal>, TYPES::SignatureKey), /// A DA vote has been received by the network; handled by the DA task - DaVoteRecv(DaVote), + DaVoteRecv(DaVote2), /// A Data Availability Certificate (DAC) has been received by the network; handled by the consensus task - DaCertificateRecv(DaCertificate), + DaCertificateRecv(DaCertificate2), /// A DAC is validated. - DaCertificateValidated(DaCertificate), + DaCertificateValidated(DaCertificate2), /// Send a quorum proposal to the network; emitted by the leader in the consensus task QuorumProposalSend(Proposal>, TYPES::SignatureKey), /// Send a quorum vote to the next leader; emitted by a replica in the consensus task after seeing a valid quorum proposal @@ -117,49 +117,49 @@ pub enum HotShotEvent { /// A quorum proposal was requested by a node for a view. QuorumProposalResponseRecv(Proposal>), /// Send a DA proposal to the DA committee; emitted by the DA leader (which is the same node as the leader of view v + 1) in the DA task - DaProposalSend(Proposal>, TYPES::SignatureKey), + DaProposalSend(Proposal>, TYPES::SignatureKey), /// Send a DA vote to the DA leader; emitted by DA committee members in the DA task after seeing a valid DA proposal - DaVoteSend(DaVote), + DaVoteSend(DaVote2), /// The next leader has collected enough votes to form a QC; emitted by the next leader in the consensus task; an internal event only QcFormed(Either, TimeoutCertificate>), /// The next leader has collected enough votes to form a QC; emitted by the next leader in the consensus task; an internal event only - Qc2Formed(Either, TimeoutCertificate>), + Qc2Formed(Either, TimeoutCertificate2>), /// The next leader has collected enough votes from the next epoch nodes to form a QC; emitted by the next leader in the consensus task; an internal event only NextEpochQc2Formed(Either, TimeoutCertificate>), /// The DA leader has collected enough votes to form a DAC; emitted by the DA leader in the DA task; sent to the entire network via the networking task - DacSend(DaCertificate, TYPES::SignatureKey), + DacSend(DaCertificate2, TYPES::SignatureKey), /// The current view has changed; emitted by the replica in the consensus task or replica in the view sync task; received by almost all other tasks ViewChange(TYPES::View, TYPES::Epoch), /// Timeout for the view sync protocol; emitted by a replica in the view sync task ViewSyncTimeout(TYPES::View, u64, ViewSyncPhase), /// Receive a `ViewSyncPreCommitVote` from the network; received by a relay in the view sync task - ViewSyncPreCommitVoteRecv(ViewSyncPreCommitVote), + ViewSyncPreCommitVoteRecv(ViewSyncPreCommitVote2), /// Receive a `ViewSyncCommitVote` from the network; received by a relay in the view sync task - ViewSyncCommitVoteRecv(ViewSyncCommitVote), + ViewSyncCommitVoteRecv(ViewSyncCommitVote2), /// Receive a `ViewSyncFinalizeVote` from the network; received by a relay in the view sync task - ViewSyncFinalizeVoteRecv(ViewSyncFinalizeVote), + ViewSyncFinalizeVoteRecv(ViewSyncFinalizeVote2), /// Send a `ViewSyncPreCommitVote` from the network; emitted by a replica in the view sync task - ViewSyncPreCommitVoteSend(ViewSyncPreCommitVote), + ViewSyncPreCommitVoteSend(ViewSyncPreCommitVote2), /// Send a `ViewSyncCommitVote` from the network; emitted by a replica in the view sync task - ViewSyncCommitVoteSend(ViewSyncCommitVote), + ViewSyncCommitVoteSend(ViewSyncCommitVote2), /// Send a `ViewSyncFinalizeVote` from the network; emitted by a replica in the view sync task - ViewSyncFinalizeVoteSend(ViewSyncFinalizeVote), + ViewSyncFinalizeVoteSend(ViewSyncFinalizeVote2), - /// Receive a `ViewSyncPreCommitCertificate2` from the network; received by a replica in the view sync task - ViewSyncPreCommitCertificate2Recv(ViewSyncPreCommitCertificate2), - /// Receive a `ViewSyncCommitCertificate2` from the network; received by a replica in the view sync task - ViewSyncCommitCertificate2Recv(ViewSyncCommitCertificate2), - /// Receive a `ViewSyncFinalizeCertificate2` from the network; received by a replica in the view sync task - ViewSyncFinalizeCertificate2Recv(ViewSyncFinalizeCertificate2), + /// Receive a `ViewSyncPreCommitCertificate` from the network; received by a replica in the view sync task + ViewSyncPreCommitCertificateRecv(ViewSyncPreCommitCertificate2), + /// Receive a `ViewSyncCommitCertificate` from the network; received by a replica in the view sync task + ViewSyncCommitCertificateRecv(ViewSyncCommitCertificate2), + /// Receive a `ViewSyncFinalizeCertificate` from the network; received by a replica in the view sync task + ViewSyncFinalizeCertificateRecv(ViewSyncFinalizeCertificate2), - /// Send a `ViewSyncPreCommitCertificate2` from the network; emitted by a relay in the view sync task - ViewSyncPreCommitCertificate2Send(ViewSyncPreCommitCertificate2, TYPES::SignatureKey), - /// Send a `ViewSyncCommitCertificate2` from the network; emitted by a relay in the view sync task - ViewSyncCommitCertificate2Send(ViewSyncCommitCertificate2, TYPES::SignatureKey), - /// Send a `ViewSyncFinalizeCertificate2` from the network; emitted by a relay in the view sync task - ViewSyncFinalizeCertificate2Send(ViewSyncFinalizeCertificate2, TYPES::SignatureKey), + /// Send a `ViewSyncPreCommitCertificate` from the network; emitted by a relay in the view sync task + ViewSyncPreCommitCertificateSend(ViewSyncPreCommitCertificate2, TYPES::SignatureKey), + /// Send a `ViewSyncCommitCertificate` from the network; emitted by a relay in the view sync task + ViewSyncCommitCertificateSend(ViewSyncCommitCertificate2, TYPES::SignatureKey), + /// Send a `ViewSyncFinalizeCertificate` from the network; emitted by a relay in the view sync task + ViewSyncFinalizeCertificateSend(ViewSyncFinalizeCertificate2, TYPES::SignatureKey), /// Trigger the start of the view sync protocol; emitted by view sync task; internal trigger only ViewSyncTrigger(TYPES::View), @@ -189,10 +189,10 @@ pub enum HotShotEvent { /// Like [`HotShotEvent::DaProposalRecv`]. VidShareRecv( TYPES::SignatureKey, - Proposal>, + Proposal>, ), /// VID share data is validated. - VidShareValidated(Proposal>), + VidShareValidated(Proposal>), /// Upgrade proposal has been received from the network UpgradeProposalRecv(Proposal>, TYPES::SignatureKey), /// Upgrade proposal has been sent to the network @@ -231,13 +231,13 @@ pub enum HotShotEvent { TYPES::SignatureKey, /// Recipient key TYPES::SignatureKey, - Proposal>, + Proposal>, ), /// Receive a VID response from the network; received by the node that triggered the VID request. VidResponseRecv( TYPES::SignatureKey, - Proposal>, + Proposal>, ), /// A replica send us a High QC @@ -295,12 +295,12 @@ impl HotShotEvent { | HotShotEvent::ViewSyncPreCommitVoteSend(vote) => Some(vote.view_number()), HotShotEvent::ViewSyncFinalizeVoteRecv(vote) | HotShotEvent::ViewSyncFinalizeVoteSend(vote) => Some(vote.view_number()), - HotShotEvent::ViewSyncPreCommitCertificate2Recv(cert) - | HotShotEvent::ViewSyncPreCommitCertificate2Send(cert, _) => Some(cert.view_number()), - HotShotEvent::ViewSyncCommitCertificate2Recv(cert) - | HotShotEvent::ViewSyncCommitCertificate2Send(cert, _) => Some(cert.view_number()), - HotShotEvent::ViewSyncFinalizeCertificate2Recv(cert) - | HotShotEvent::ViewSyncFinalizeCertificate2Send(cert, _) => Some(cert.view_number()), + HotShotEvent::ViewSyncPreCommitCertificateRecv(cert) + | HotShotEvent::ViewSyncPreCommitCertificateSend(cert, _) => Some(cert.view_number()), + HotShotEvent::ViewSyncCommitCertificateRecv(cert) + | HotShotEvent::ViewSyncCommitCertificateSend(cert, _) => Some(cert.view_number()), + HotShotEvent::ViewSyncFinalizeCertificateRecv(cert) + | HotShotEvent::ViewSyncFinalizeCertificateSend(cert, _) => Some(cert.view_number()), HotShotEvent::SendPayloadCommitmentAndMetadata(_, _, _, view_number, _, _) => { Some(*view_number) } @@ -465,45 +465,45 @@ impl Display for HotShotEvent { "ViewSyncFinalizeVoteSend(view_number={:?})", vote.view_number() ), - HotShotEvent::ViewSyncPreCommitCertificate2Recv(cert) => { + HotShotEvent::ViewSyncPreCommitCertificateRecv(cert) => { write!( f, - "ViewSyncPreCommitCertificate2Recv(view_number={:?})", + "ViewSyncPreCommitCertificateRecv(view_number={:?})", cert.view_number() ) } - HotShotEvent::ViewSyncCommitCertificate2Recv(cert) => { + HotShotEvent::ViewSyncCommitCertificateRecv(cert) => { write!( f, - "ViewSyncCommitCertificate2Recv(view_number={:?})", + "ViewSyncCommitCertificateRecv(view_number={:?})", cert.view_number() ) } - HotShotEvent::ViewSyncFinalizeCertificate2Recv(cert) => { + HotShotEvent::ViewSyncFinalizeCertificateRecv(cert) => { write!( f, - "ViewSyncFinalizeCertificate2Recv(view_number={:?})", + "ViewSyncFinalizeCertificateRecv(view_number={:?})", cert.view_number() ) } - HotShotEvent::ViewSyncPreCommitCertificate2Send(cert, _) => { + HotShotEvent::ViewSyncPreCommitCertificateSend(cert, _) => { write!( f, - "ViewSyncPreCommitCertificate2Send(view_number={:?})", + "ViewSyncPreCommitCertificateSend(view_number={:?})", cert.view_number() ) } - HotShotEvent::ViewSyncCommitCertificate2Send(cert, _) => { + HotShotEvent::ViewSyncCommitCertificateSend(cert, _) => { write!( f, - "ViewSyncCommitCertificate2Send(view_number={:?})", + "ViewSyncCommitCertificateSend(view_number={:?})", cert.view_number() ) } - HotShotEvent::ViewSyncFinalizeCertificate2Send(cert, _) => { + HotShotEvent::ViewSyncFinalizeCertificateSend(cert, _) => { write!( f, - "ViewSyncFinalizeCertificate2Send(view_number={:?})", + "ViewSyncFinalizeCertificateSend(view_number={:?})", cert.view_number() ) } diff --git a/crates/task-impls/src/helpers.rs b/crates/task-impls/src/helpers.rs index 3bef521d50..898ee8e1ee 100644 --- a/crates/task-impls/src/helpers.rs +++ b/crates/task-impls/src/helpers.rs @@ -24,7 +24,7 @@ use hotshot_types::{ traits::{ block_contents::BlockHeader, election::Membership, - node_implementation::{NodeImplementation, NodeType, Versions}, + node_implementation::{ConsensusTime, NodeImplementation, NodeType, Versions}, signature_key::SignatureKey, BlockPayload, ValidatedState, }, @@ -513,6 +513,8 @@ pub async fn validate_proposal_safety_and_liveness< proposed_leaf.parent_commitment() == parent_leaf.commit(), "Proposed leaf does not extend the parent leaf." ); + let proposal_epoch = + epoch_from_block_number(proposed_leaf.height(), validation_info.epoch_height); let state = Arc::new( >::from_header(&proposal.data.block_header), @@ -531,16 +533,13 @@ pub async fn validate_proposal_safety_and_liveness< }; } - if let Some(ref upgrade_certificate) = proposal.data.upgrade_certificate { - let upgrade_certificate_epoch = upgrade_certificate.data.epoch(); - UpgradeCertificate::validate( - &proposal.data.upgrade_certificate, - &validation_info.quorum_membership, - upgrade_certificate_epoch, - &validation_info.upgrade_lock, - ) - .await?; - } + UpgradeCertificate::validate( + &proposal.data.upgrade_certificate, + &validation_info.quorum_membership, + TYPES::Epoch::new(proposal_epoch), + &validation_info.upgrade_lock, + ) + .await?; // Validate that the upgrade certificate is re-attached, if we saw one on the parent proposed_leaf @@ -560,8 +559,6 @@ pub async fn validate_proposal_safety_and_liveness< // The proposal is safe if // 1. the proposed block and the justify QC block belong to the same epoch or // 2. the justify QC is the eQC for the previous block - let proposal_epoch = - epoch_from_block_number(proposed_leaf.height(), validation_info.epoch_height); let justify_qc_epoch = epoch_from_block_number(parent_leaf.height(), validation_info.epoch_height); ensure!( @@ -730,12 +727,15 @@ pub(crate) async fn validate_proposal_view_and_certs< // Validate the upgrade certificate -- this is just a signature validation. // Note that we don't do anything with the certificate directly if this passes; it eventually gets stored as part of the leaf if nothing goes wrong. - if let Some(ref upgrade_certificate) = proposal.data.upgrade_certificate { - let upgrade_certificate_epoch = upgrade_certificate.data.epoch(); + { + let epoch = TYPES::Epoch::new(epoch_from_block_number( + proposal.data.block_header.block_number(), + TYPES::EPOCH_HEIGHT, + )); UpgradeCertificate::validate( &proposal.data.upgrade_certificate, &validation_info.quorum_membership, - upgrade_certificate_epoch, + epoch, &validation_info.upgrade_lock, ) .await?; diff --git a/crates/task-impls/src/network.rs b/crates/task-impls/src/network.rs index 3e770c2458..139269ae4b 100644 --- a/crates/task-impls/src/network.rs +++ b/crates/task-impls/src/network.rs @@ -10,13 +10,18 @@ use std::{ sync::Arc, }; +use crate::{ + events::{HotShotEvent, HotShotTaskCompleted}, + helpers::broadcast_event, +}; use async_broadcast::{Receiver, Sender}; use async_lock::RwLock; use async_trait::async_trait; use hotshot_task::task::TaskState; +use hotshot_types::data::{VidDisperseShare, VidDisperseShare2}; use hotshot_types::{ consensus::OuterConsensus, - data::{VidDisperse, VidDisperseShare}, + data::VidDisperse, event::{Event, EventType, HotShotAction}, message::{ convert_proposal, DaConsensusMessage, DataMessage, GeneralConsensusMessage, Message, @@ -39,11 +44,6 @@ use tracing::instrument; use utils::anytrace::*; use vbs::version::StaticVersionType; -use crate::{ - events::{HotShotEvent, HotShotTaskCompleted}, - helpers::broadcast_event, -}; - /// the network message task state #[derive(Clone)] pub struct NetworkMessageTaskState { @@ -56,7 +56,7 @@ pub struct NetworkMessageTaskState { /// This nodes public key pub public_key: TYPES::SignatureKey, - /// Transaction Cache to ignore previously seen transatctions + /// Transaction Cache to ignore previously seen transactions pub transactions_cache: lru::LruCache, } @@ -93,26 +93,49 @@ impl NetworkMessageTaskState { } GeneralConsensusMessage::Vote2(vote) => HotShotEvent::QuorumVoteRecv(vote), GeneralConsensusMessage::ViewSyncPreCommitVote(view_sync_message) => { + HotShotEvent::ViewSyncPreCommitVoteRecv(view_sync_message.to_vote2()) + } + GeneralConsensusMessage::ViewSyncPreCommitVote2(view_sync_message) => { HotShotEvent::ViewSyncPreCommitVoteRecv(view_sync_message) } GeneralConsensusMessage::ViewSyncPreCommitCertificate( view_sync_message, - ) => HotShotEvent::ViewSyncPreCommitCertificate2Recv(view_sync_message), - + ) => HotShotEvent::ViewSyncPreCommitCertificateRecv( + view_sync_message.to_vsc2(), + ), + GeneralConsensusMessage::ViewSyncPreCommitCertificate2( + view_sync_message, + ) => HotShotEvent::ViewSyncPreCommitCertificateRecv(view_sync_message), GeneralConsensusMessage::ViewSyncCommitVote(view_sync_message) => { + HotShotEvent::ViewSyncCommitVoteRecv(view_sync_message.to_vote2()) + } + GeneralConsensusMessage::ViewSyncCommitVote2(view_sync_message) => { HotShotEvent::ViewSyncCommitVoteRecv(view_sync_message) } GeneralConsensusMessage::ViewSyncCommitCertificate(view_sync_message) => { - HotShotEvent::ViewSyncCommitCertificate2Recv(view_sync_message) + HotShotEvent::ViewSyncCommitCertificateRecv(view_sync_message.to_vsc2()) + } + GeneralConsensusMessage::ViewSyncCommitCertificate2(view_sync_message) => { + HotShotEvent::ViewSyncCommitCertificateRecv(view_sync_message) } - GeneralConsensusMessage::ViewSyncFinalizeVote(view_sync_message) => { + HotShotEvent::ViewSyncFinalizeVoteRecv(view_sync_message.to_vote2()) + } + GeneralConsensusMessage::ViewSyncFinalizeVote2(view_sync_message) => { HotShotEvent::ViewSyncFinalizeVoteRecv(view_sync_message) } GeneralConsensusMessage::ViewSyncFinalizeCertificate(view_sync_message) => { - HotShotEvent::ViewSyncFinalizeCertificate2Recv(view_sync_message) + HotShotEvent::ViewSyncFinalizeCertificateRecv( + view_sync_message.to_vsc2(), + ) } + GeneralConsensusMessage::ViewSyncFinalizeCertificate2( + view_sync_message, + ) => HotShotEvent::ViewSyncFinalizeCertificateRecv(view_sync_message), GeneralConsensusMessage::TimeoutVote(message) => { + HotShotEvent::TimeoutVoteRecv(message.to_vote2()) + } + GeneralConsensusMessage::TimeoutVote2(message) => { HotShotEvent::TimeoutVoteRecv(message) } GeneralConsensusMessage::UpgradeProposal(message) => { @@ -126,15 +149,27 @@ impl NetworkMessageTaskState { }, SequencingMessage::Da(da_message) => match da_message { DaConsensusMessage::DaProposal(proposal) => { - HotShotEvent::DaProposalRecv(proposal, sender) + HotShotEvent::DaProposalRecv(convert_proposal(proposal), sender) + } + DaConsensusMessage::DaVote(vote) => { + HotShotEvent::DaVoteRecv(vote.clone().to_vote2()) } - DaConsensusMessage::DaVote(vote) => HotShotEvent::DaVoteRecv(vote.clone()), DaConsensusMessage::DaCertificate(cert) => { - HotShotEvent::DaCertificateRecv(cert) + HotShotEvent::DaCertificateRecv(cert.to_dac2()) } DaConsensusMessage::VidDisperseMsg(proposal) => { + HotShotEvent::VidShareRecv(sender, convert_proposal(proposal)) + } + DaConsensusMessage::VidDisperseMsg2(proposal) => { HotShotEvent::VidShareRecv(sender, proposal) } + DaConsensusMessage::DaProposal2(proposal) => { + HotShotEvent::DaProposalRecv(proposal, sender) + } + DaConsensusMessage::DaVote2(vote) => HotShotEvent::DaVoteRecv(vote.clone()), + DaConsensusMessage::DaCertificate2(cert) => { + HotShotEvent::DaCertificateRecv(cert) + } }, }; broadcast_event(Arc::new(event), &self.internal_event_stream).await; @@ -157,16 +192,26 @@ impl NetworkMessageTaskState { DataMessage::DataResponse(response) => { if let ResponseMessage::Found(message) = response { match message { - SequencingMessage::Da(da_message) => { - if let DaConsensusMessage::VidDisperseMsg(proposal) = da_message { - broadcast_event( - Arc::new(HotShotEvent::VidResponseRecv(sender, proposal)), - &self.internal_event_stream, - ) - .await; - } + SequencingMessage::Da(DaConsensusMessage::VidDisperseMsg(proposal)) => { + broadcast_event( + Arc::new(HotShotEvent::VidResponseRecv( + sender, + convert_proposal(proposal), + )), + &self.internal_event_stream, + ) + .await; + } + SequencingMessage::Da(DaConsensusMessage::VidDisperseMsg2( + proposal, + )) => { + broadcast_event( + Arc::new(HotShotEvent::VidResponseRecv(sender, proposal)), + &self.internal_event_stream, + ) + .await; } - SequencingMessage::General(_) => {} + _ => {} } } } @@ -277,16 +322,35 @@ impl< sender: &::SignatureKey, ) -> Option { let view = vid_proposal.data.view_number; - let vid_share_proposals = VidDisperseShare::to_vid_share_proposals(vid_proposal.clone()); + let vid_share_proposals = VidDisperseShare2::to_vid_share_proposals(vid_proposal); let mut messages = HashMap::new(); for proposal in vid_share_proposals { let recipient = proposal.data.recipient_key.clone(); - let message = Message { - sender: sender.clone(), - kind: MessageKind::::from_consensus_message(SequencingMessage::Da( - DaConsensusMessage::VidDisperseMsg(proposal), - )), + let message = if self + .upgrade_lock + .version_infallible(proposal.data.view_number()) + .await + >= V::Epochs::VERSION + { + Message { + sender: sender.clone(), + kind: MessageKind::::from_consensus_message(SequencingMessage::Da( + DaConsensusMessage::VidDisperseMsg2(proposal), + )), + } + } else { + let vid_share_proposal = Proposal { + data: VidDisperseShare::from(proposal.data), + signature: proposal.signature, + _pd: proposal._pd, + }; + Message { + sender: sender.clone(), + kind: MessageKind::::from_consensus_message(SequencingMessage::Da( + DaConsensusMessage::VidDisperseMsg(vid_share_proposal), + )), + } }; let serialized_message = match self.upgrade_lock.serialize(&message).await { Ok(serialized) => serialized, @@ -381,6 +445,7 @@ impl< match event.as_ref().clone() { HotShotEvent::QuorumProposalSend(proposal, sender) => { *maybe_action = Some(HotShotAction::Propose); + let message = if self .upgrade_lock .version_infallible(proposal.data.view_number()) @@ -414,6 +479,7 @@ impl< return None; } }; + let message = if self .upgrade_lock .version_infallible(vote.view_number()) @@ -485,18 +551,28 @@ impl< } HotShotEvent::DaProposalSend(proposal, sender) => { *maybe_action = Some(HotShotAction::DaPropose); - Some(( - sender, + + let message = if self + .upgrade_lock + .version_infallible(proposal.data.view_number()) + .await + >= V::Epochs::VERSION + { MessageKind::::from_consensus_message(SequencingMessage::Da( - DaConsensusMessage::DaProposal(proposal), - )), - TransmitType::DaCommitteeBroadcast, - )) + DaConsensusMessage::DaProposal2(proposal), + )) + } else { + MessageKind::::from_consensus_message(SequencingMessage::Da( + DaConsensusMessage::DaProposal(convert_proposal(proposal)), + )) + }; + + Some((sender, message, TransmitType::DaCommitteeBroadcast)) } HotShotEvent::DaVoteSend(vote) => { *maybe_action = Some(HotShotAction::DaVote); let view_number = vote.view_number(); - let epoch = vote.data.epoch(); + let epoch = vote.data.epoch; let leader = match self.membership.leader(view_number, epoch) { Ok(l) => l, Err(e) => { @@ -509,23 +585,38 @@ impl< } }; - Some(( - vote.signing_key(), + let message = if self.upgrade_lock.version_infallible(view_number).await + >= V::Epochs::VERSION + { MessageKind::::from_consensus_message(SequencingMessage::Da( - DaConsensusMessage::DaVote(vote.clone()), - )), - TransmitType::Direct(leader), - )) + DaConsensusMessage::DaVote2(vote.clone()), + )) + } else { + MessageKind::::from_consensus_message(SequencingMessage::Da( + DaConsensusMessage::DaVote(vote.clone().to_vote()), + )) + }; + + Some((vote.signing_key(), message, TransmitType::Direct(leader))) } HotShotEvent::DacSend(certificate, sender) => { *maybe_action = Some(HotShotAction::DaCert); - Some(( - sender, + let message = if self + .upgrade_lock + .version_infallible(certificate.view_number()) + .await + >= V::Epochs::VERSION + { MessageKind::::from_consensus_message(SequencingMessage::Da( - DaConsensusMessage::DaCertificate(certificate), - )), - TransmitType::Broadcast, - )) + DaConsensusMessage::DaCertificate2(certificate), + )) + } else { + MessageKind::::from_consensus_message(SequencingMessage::Da( + DaConsensusMessage::DaCertificate(certificate.to_dac()), + )) + }; + + Some((sender, message, TransmitType::Broadcast)) } HotShotEvent::ViewSyncPreCommitVoteSend(vote) => { let view_number = vote.view_number() + vote.date().relay; @@ -540,14 +631,22 @@ impl< return None; } }; - - Some(( - vote.signing_key(), + let message = if self + .upgrade_lock + .version_infallible(vote.view_number()) + .await + >= V::Epochs::VERSION + { MessageKind::::from_consensus_message(SequencingMessage::General( - GeneralConsensusMessage::ViewSyncPreCommitVote(vote.clone()), - )), - TransmitType::Direct(leader), - )) + GeneralConsensusMessage::ViewSyncPreCommitVote2(vote.clone()), + )) + } else { + MessageKind::::from_consensus_message(SequencingMessage::General( + GeneralConsensusMessage::ViewSyncPreCommitVote(vote.clone().to_vote()), + )) + }; + + Some((vote.signing_key(), message, TransmitType::Direct(leader))) } HotShotEvent::ViewSyncCommitVoteSend(vote) => { *maybe_action = Some(HotShotAction::ViewSyncVote); @@ -563,14 +662,22 @@ impl< return None; } }; - - Some(( - vote.signing_key(), + let message = if self + .upgrade_lock + .version_infallible(vote.view_number()) + .await + >= V::Epochs::VERSION + { MessageKind::::from_consensus_message(SequencingMessage::General( - GeneralConsensusMessage::ViewSyncCommitVote(vote.clone()), - )), - TransmitType::Direct(leader), - )) + GeneralConsensusMessage::ViewSyncCommitVote2(vote.clone()), + )) + } else { + MessageKind::::from_consensus_message(SequencingMessage::General( + GeneralConsensusMessage::ViewSyncCommitVote(vote.clone().to_vote()), + )) + }; + + Some((vote.signing_key(), message, TransmitType::Direct(leader))) } HotShotEvent::ViewSyncFinalizeVoteSend(vote) => { *maybe_action = Some(HotShotAction::ViewSyncVote); @@ -586,36 +693,71 @@ impl< return None; } }; + let message = if self + .upgrade_lock + .version_infallible(vote.view_number()) + .await + >= V::Epochs::VERSION + { + MessageKind::::from_consensus_message(SequencingMessage::General( + GeneralConsensusMessage::ViewSyncFinalizeVote2(vote.clone()), + )) + } else { + MessageKind::::from_consensus_message(SequencingMessage::General( + GeneralConsensusMessage::ViewSyncFinalizeVote(vote.clone().to_vote()), + )) + }; - Some(( - vote.signing_key(), + Some((vote.signing_key(), message, TransmitType::Direct(leader))) + } + HotShotEvent::ViewSyncPreCommitCertificateSend(certificate, sender) => { + let view_number = certificate.view_number(); + let message = if self.upgrade_lock.version_infallible(view_number).await + >= V::Epochs::VERSION + { MessageKind::::from_consensus_message(SequencingMessage::General( - GeneralConsensusMessage::ViewSyncFinalizeVote(vote.clone()), - )), - TransmitType::Direct(leader), - )) + GeneralConsensusMessage::ViewSyncPreCommitCertificate2(certificate), + )) + } else { + MessageKind::::from_consensus_message(SequencingMessage::General( + GeneralConsensusMessage::ViewSyncPreCommitCertificate(certificate.to_vsc()), + )) + }; + + Some((sender, message, TransmitType::Broadcast)) + } + HotShotEvent::ViewSyncCommitCertificateSend(certificate, sender) => { + let view_number = certificate.view_number(); + let message = if self.upgrade_lock.version_infallible(view_number).await + >= V::Epochs::VERSION + { + MessageKind::::from_consensus_message(SequencingMessage::General( + GeneralConsensusMessage::ViewSyncCommitCertificate2(certificate), + )) + } else { + MessageKind::::from_consensus_message(SequencingMessage::General( + GeneralConsensusMessage::ViewSyncCommitCertificate(certificate.to_vsc()), + )) + }; + + Some((sender, message, TransmitType::Broadcast)) + } + HotShotEvent::ViewSyncFinalizeCertificateSend(certificate, sender) => { + let view_number = certificate.view_number(); + let message = if self.upgrade_lock.version_infallible(view_number).await + >= V::Epochs::VERSION + { + MessageKind::::from_consensus_message(SequencingMessage::General( + GeneralConsensusMessage::ViewSyncFinalizeCertificate2(certificate), + )) + } else { + MessageKind::::from_consensus_message(SequencingMessage::General( + GeneralConsensusMessage::ViewSyncFinalizeCertificate(certificate.to_vsc()), + )) + }; + + Some((sender, message, TransmitType::Broadcast)) } - HotShotEvent::ViewSyncPreCommitCertificate2Send(certificate, sender) => Some(( - sender, - MessageKind::::from_consensus_message(SequencingMessage::General( - GeneralConsensusMessage::ViewSyncPreCommitCertificate(certificate), - )), - TransmitType::Broadcast, - )), - HotShotEvent::ViewSyncCommitCertificate2Send(certificate, sender) => Some(( - sender, - MessageKind::::from_consensus_message(SequencingMessage::General( - GeneralConsensusMessage::ViewSyncCommitCertificate(certificate), - )), - TransmitType::Broadcast, - )), - HotShotEvent::ViewSyncFinalizeCertificate2Send(certificate, sender) => Some(( - sender, - MessageKind::::from_consensus_message(SequencingMessage::General( - GeneralConsensusMessage::ViewSyncFinalizeCertificate(certificate), - )), - TransmitType::Broadcast, - )), HotShotEvent::TimeoutVoteSend(vote) => { *maybe_action = Some(HotShotAction::Vote); let view_number = vote.view_number() + 1; @@ -630,13 +772,22 @@ impl< return None; } }; - Some(( - vote.signing_key(), + let message = if self + .upgrade_lock + .version_infallible(vote.view_number()) + .await + >= V::Epochs::VERSION + { MessageKind::::from_consensus_message(SequencingMessage::General( - GeneralConsensusMessage::TimeoutVote(vote.clone()), - )), - TransmitType::Direct(leader), - )) + GeneralConsensusMessage::TimeoutVote2(vote.clone()), + )) + } else { + MessageKind::::from_consensus_message(SequencingMessage::General( + GeneralConsensusMessage::TimeoutVote(vote.clone().to_vote()), + )) + }; + + Some((vote.signing_key(), message, TransmitType::Direct(leader))) } HotShotEvent::UpgradeProposalSend(proposal, sender) => Some(( sender, @@ -688,14 +839,23 @@ impl< TransmitType::Direct(to), )), HotShotEvent::VidResponseSend(sender, to, proposal) => { - let da_message = DaConsensusMessage::VidDisperseMsg(proposal); - let sequencing_msg = SequencingMessage::Da(da_message); - let response_message = ResponseMessage::Found(sequencing_msg); - Some(( - sender, - MessageKind::Data(DataMessage::DataResponse(response_message)), - TransmitType::Direct(to), - )) + let message = if self + .upgrade_lock + .version_infallible(proposal.data.view_number()) + .await + >= V::Epochs::VERSION + { + MessageKind::Data(DataMessage::DataResponse(ResponseMessage::Found( + SequencingMessage::Da(DaConsensusMessage::VidDisperseMsg2(proposal)), + ))) + } else { + MessageKind::Data(DataMessage::DataResponse(ResponseMessage::Found( + SequencingMessage::Da(DaConsensusMessage::VidDisperseMsg( + convert_proposal(proposal), + )), + ))) + }; + Some((sender, message, TransmitType::Direct(to))) } HotShotEvent::HighQcSend(quorum_cert, leader, sender) => Some(( sender, diff --git a/crates/task-impls/src/quorum_proposal/handlers.rs b/crates/task-impls/src/quorum_proposal/handlers.rs index 1ce7c4bdb6..7dbedb9107 100644 --- a/crates/task-impls/src/quorum_proposal/handlers.rs +++ b/crates/task-impls/src/quorum_proposal/handlers.rs @@ -13,11 +13,6 @@ use std::{ time::{Duration, Instant}, }; -use crate::{ - events::HotShotEvent, - helpers::{broadcast_event, parent_leaf_and_state}, - quorum_proposal::{UpgradeLock, Versions}, -}; use anyhow::{ensure, Context, Result}; use async_broadcast::{Receiver, Sender}; use async_lock::RwLock; @@ -30,6 +25,7 @@ use hotshot_task::{ use hotshot_types::{ consensus::{CommitmentAndMetadata, OuterConsensus}, data::{Leaf2, QuorumProposal2, VidDisperse, ViewChangeEvidence}, + drb::{INITIAL_DRB_RESULT, INITIAL_DRB_SEED_INPUT}, message::Proposal, simple_certificate::{NextEpochQuorumCertificate2, QuorumCertificate2, UpgradeCertificate}, traits::{ @@ -45,6 +41,12 @@ use tracing::instrument; use utils::anytrace::*; use vbs::version::StaticVersionType; +use crate::{ + events::HotShotEvent, + helpers::{broadcast_event, parent_leaf_and_state}, + quorum_proposal::{UpgradeLock, Versions}, +}; + /// Proposal dependency types. These types represent events that precipitate a proposal. #[derive(PartialEq, Debug)] pub(crate) enum ProposalDependency { @@ -54,7 +56,7 @@ pub(crate) enum ProposalDependency { /// For the `Qc2Formed` event. Qc, - /// For the `ViewSyncFinalizeCertificate2Recv` event. + /// For the `ViewSyncFinalizeCertificateRecv` event. ViewSyncCert, /// For the `Qc2Formed` event timeout branch. @@ -195,12 +197,7 @@ impl ProposalDependencyHandle { ) -> Option> { tracing::debug!("getting the next epoch QC"); // If we haven't upgraded to Epochs just return None right away - if self - .upgrade_lock - .version(self.view_number) - .await - .is_ok_and(|version| version < V::Epochs::VERSION) - { + if self.upgrade_lock.version_infallible(self.view_number).await < V::Epochs::VERSION { return None; } if let Some(next_epoch_qc) = self.consensus.read().await.next_epoch_high_qc() { @@ -243,7 +240,6 @@ impl ProposalDependencyHandle { // Check again, there is a chance we missed it if let Some(next_epoch_qc) = self.consensus.read().await.next_epoch_high_qc() { if next_epoch_qc.data.leaf_commit == high_qc.data.leaf_commit { - // We have it already, no reason to wait return Some(next_epoch_qc.clone()); } }; @@ -393,14 +389,12 @@ impl ProposalDependencyHandle { let proposal = QuorumProposal2 { block_header, view_number: self.view_number, - epoch, justify_qc: parent_qc, next_epoch_justify_qc: next_epoch_qc, upgrade_certificate, view_change_evidence: proposal_certificate, - // TODO fix these to use the proper values - drb_seed: [0; 32], - drb_result: [0; 32], + drb_seed: INITIAL_DRB_SEED_INPUT, + drb_result: INITIAL_DRB_RESULT, }; let proposed_leaf = Leaf2::from_quorum_proposal(&proposal); @@ -420,9 +414,8 @@ impl ProposalDependencyHandle { _pd: PhantomData, }; tracing::debug!( - "Sending proposal for view {:?}, proposal: {:?}", + "Sending proposal for view {:?}", proposed_leaf.view_number(), - message, ); broadcast_event( @@ -475,7 +468,7 @@ impl HandleDepOutput for ProposalDependencyHandle< parent_qc = Some(qc.clone()); } }, - HotShotEvent::ViewSyncFinalizeCertificate2Recv(cert) => { + HotShotEvent::ViewSyncFinalizeCertificateRecv(cert) => { view_sync_finalize_cert = Some(cert.clone()); } HotShotEvent::VidDisperseSend(share, _) => { diff --git a/crates/task-impls/src/quorum_proposal/mod.rs b/crates/task-impls/src/quorum_proposal/mod.rs index 8e0423c423..77bfef856c 100644 --- a/crates/task-impls/src/quorum_proposal/mod.rs +++ b/crates/task-impls/src/quorum_proposal/mod.rs @@ -122,8 +122,7 @@ impl, V: Versions> } } ProposalDependency::ViewSyncCert => { - if let HotShotEvent::ViewSyncFinalizeCertificate2Recv(view_sync_cert) = - event + if let HotShotEvent::ViewSyncFinalizeCertificateRecv(view_sync_cert) = event { view_sync_cert.view_number() } else { @@ -230,7 +229,7 @@ impl, V: Versions> qc_dependency.mark_as_completed(event); } }, - HotShotEvent::ViewSyncFinalizeCertificate2Recv(_) => { + HotShotEvent::ViewSyncFinalizeCertificateRecv(_) => { view_sync_dependency.mark_as_completed(event); } HotShotEvent::VidDisperseSend(_, _) => { @@ -462,14 +461,14 @@ impl, V: Versions> EpochTransitionIndicator::NotInTransition, )?; } - HotShotEvent::ViewSyncFinalizeCertificate2Recv(certificate) => { - let cert_epoch_number = certificate.data.epoch; + HotShotEvent::ViewSyncFinalizeCertificateRecv(certificate) => { + let epoch_number = certificate.data.epoch; ensure!( certificate .is_valid_cert( - self.quorum_membership.stake_table(cert_epoch_number), - self.quorum_membership.success_threshold(cert_epoch_number), + self.quorum_membership.stake_table(epoch_number), + self.quorum_membership.success_threshold(epoch_number), &self.upgrade_lock ) .await, @@ -554,13 +553,10 @@ impl, V: Versions> // Only update if the qc is from a newer view let current_next_epoch_qc = self.consensus.read().await.next_epoch_high_qc().cloned(); - if current_next_epoch_qc.is_some() - && next_epoch_qc.view_number <= current_next_epoch_qc.unwrap().view_number - { - tracing::trace!( - "Received a next epoch QC for a view that was not > than our current next epoch high QC" - ); - } + ensure!(current_next_epoch_qc.is_none() || + next_epoch_qc.view_number > current_next_epoch_qc.unwrap().view_number, + debug!("Received a next epoch QC for a view that was not > than our current next epoch high QC") + ); self.consensus .write() .await diff --git a/crates/task-impls/src/quorum_proposal_recv/handlers.rs b/crates/task-impls/src/quorum_proposal_recv/handlers.rs index 72ca2374b0..d6a768c2cd 100644 --- a/crates/task-impls/src/quorum_proposal_recv/handlers.rs +++ b/crates/task-impls/src/quorum_proposal_recv/handlers.rs @@ -152,31 +152,24 @@ pub(crate) async fn handle_quorum_proposal_recv< .context(warn!("Failed to validate proposal view or attached certs"))?; let view_number = proposal.data.view_number(); + let justify_qc = proposal.data.justify_qc.clone(); let maybe_next_epoch_justify_qc = proposal.data.next_epoch_justify_qc.clone(); + let proposal_block_number = proposal.data.block_header.block_number(); let proposal_epoch = TYPES::Epoch::new(epoch_from_block_number( proposal_block_number, validation_info.epoch_height, )); - let justify_qc_epoch = if validation_info.epoch_height != 0 - && proposal_block_number % validation_info.epoch_height == 1 - { - // if the proposal is for the first block in an epoch, the justify QC must be from the previous epoch - proposal_epoch - 1 - } else { - // otherwise justify QC is from the same epoch - proposal_epoch - }; if !justify_qc .is_valid_cert( validation_info .quorum_membership - .stake_table(justify_qc_epoch), + .stake_table(justify_qc.data.epoch), validation_info .quorum_membership - .success_threshold(justify_qc_epoch), + .success_threshold(justify_qc.data.epoch), &validation_info.upgrade_lock, ) .await @@ -199,10 +192,10 @@ pub(crate) async fn handle_quorum_proposal_recv< .is_valid_cert( validation_info .quorum_membership - .stake_table(justify_qc_epoch + 1), + .stake_table(justify_qc.data.epoch + 1), validation_info .quorum_membership - .success_threshold(justify_qc_epoch + 1), + .success_threshold(justify_qc.data.epoch + 1), &validation_info.upgrade_lock, ) .await diff --git a/crates/task-impls/src/quorum_vote/handlers.rs b/crates/task-impls/src/quorum_vote/handlers.rs index 2d010e6c65..577c5325e6 100644 --- a/crates/task-impls/src/quorum_vote/handlers.rs +++ b/crates/task-impls/src/quorum_vote/handlers.rs @@ -6,23 +6,13 @@ use std::sync::Arc; -use super::QuorumVoteTaskState; -use crate::{ - events::HotShotEvent, - helpers::{ - broadcast_event, decide_from_proposal, decide_from_proposal_2, fetch_proposal, - LeafChainTraversalOutcome, - }, - quorum_vote::Versions, -}; use async_broadcast::{InactiveReceiver, Sender}; use async_lock::RwLock; use chrono::Utc; use committable::Committable; -use hotshot_types::utils::is_last_block_in_epoch; use hotshot_types::{ consensus::OuterConsensus, - data::{Leaf2, QuorumProposal2, VidDisperseShare}, + data::{Leaf2, QuorumProposal2, VidDisperseShare2}, event::{Event, EventType, LeafInfo}, message::{Proposal, UpgradeLock}, simple_vote::{QuorumData2, QuorumVote2}, @@ -34,13 +24,23 @@ use hotshot_types::{ storage::Storage, ValidatedState, }, - utils::epoch_from_block_number, + utils::{epoch_from_block_number, is_last_block_in_epoch}, vote::HasViewNumber, }; use tracing::instrument; use utils::anytrace::*; use vbs::version::StaticVersionType; +use super::QuorumVoteTaskState; +use crate::{ + events::HotShotEvent, + helpers::{ + broadcast_event, decide_from_proposal, decide_from_proposal_2, fetch_proposal, + LeafChainTraversalOutcome, + }, + quorum_vote::Versions, +}; + /// Handles starting the DRB calculation. Uses the seed previously stored in /// handle_quorum_proposal_validated_drb_calculation_seed async fn handle_quorum_proposal_validated_drb_calculation_start< @@ -53,7 +53,7 @@ async fn handle_quorum_proposal_validated_drb_calculation_start< ) { let current_epoch_number = TYPES::Epoch::new(epoch_from_block_number( proposal.block_header.block_number(), - task_state.epoch_height, + TYPES::EPOCH_HEIGHT, )); // Start the new task if we're in the committee for this epoch @@ -278,14 +278,14 @@ pub(crate) async fn update_shared_state< instance_state: Arc, storage: Arc>, proposed_leaf: &Leaf2, - vid_share: &Proposal>, + vid_share: &Proposal>, parent_view_number: Option, epoch_height: u64, ) -> Result<()> { let justify_qc = &proposed_leaf.justify_qc(); let consensus_reader = consensus.read().await; - // Try to find the validated vview within the validasted state map. This will be present + // Try to find the validated view within the validated state map. This will be present // if we have the saved leaf, but if not we'll get it when we fetch_proposal. let mut maybe_validated_view = parent_view_number.and_then(|view_number| { consensus_reader @@ -401,18 +401,22 @@ pub(crate) async fn submit_vote, V private_key: ::PrivateKey, upgrade_lock: UpgradeLock, view_number: TYPES::View, - epoch_number: TYPES::Epoch, storage: Arc>, leaf: Leaf2, - vid_share: Proposal>, + vid_share: Proposal>, extended_vote: bool, - epoch_height: u64, ) -> Result<()> { + let epoch_number = TYPES::Epoch::new(epoch_from_block_number( + leaf.block_header().block_number(), + TYPES::EPOCH_HEIGHT, + )); + let committee_member_in_current_epoch = quorum_membership.has_stake(&public_key, epoch_number); // If the proposed leaf is for the last block in the epoch and the node is part of the quorum committee // in the next epoch, the node should vote to achieve the double quorum. - let committee_member_in_next_epoch = is_last_block_in_epoch(leaf.height(), epoch_height) + let committee_member_in_next_epoch = is_last_block_in_epoch(leaf.height(), TYPES::EPOCH_HEIGHT) && quorum_membership.has_stake(&public_key, epoch_number + 1); + ensure!( committee_member_in_current_epoch || committee_member_in_next_epoch, info!( @@ -439,7 +443,7 @@ pub(crate) async fn submit_vote, V storage .write() .await - .append_vid(&vid_share) + .append_vid2(&vid_share) .await .wrap() .context(error!("Failed to store VID share"))?; diff --git a/crates/task-impls/src/quorum_vote/mod.rs b/crates/task-impls/src/quorum_vote/mod.rs index b71a61e747..519c434d81 100644 --- a/crates/task-impls/src/quorum_vote/mod.rs +++ b/crates/task-impls/src/quorum_vote/mod.rs @@ -21,7 +21,6 @@ use hotshot_types::{ data::{Leaf2, QuorumProposal2}, event::Event, message::{Proposal, UpgradeLock}, - simple_vote::HasEpoch, traits::{ block_contents::BlockHeader, election::Membership, @@ -239,12 +238,10 @@ impl + 'static, V: Versions> Handl self.private_key.clone(), self.upgrade_lock.clone(), self.view_number, - current_epoch, Arc::clone(&self.storage), leaf, vid_share, false, - self.epoch_height, ) .await { @@ -507,7 +504,8 @@ impl, V: Versions> QuorumVoteTaskS "Received DAC for an older view." ); - let cert_epoch = cert.data.epoch(); + let cert_epoch = cert.data.epoch; + // Validate the DAC. ensure!( cert.is_valid_cert( @@ -548,7 +546,7 @@ impl, V: Versions> QuorumVoteTaskS // Validate the VID share. let payload_commitment = &disperse.data.payload_commitment; - let disperse_epoch = disperse.data.epoch(); + let disperse_epoch = disperse.data.epoch; // Check that the signature is valid ensure!( @@ -740,12 +738,10 @@ impl, V: Versions> QuorumVoteTaskS self.private_key.clone(), self.upgrade_lock.clone(), proposal.data.view_number(), - current_epoch, Arc::clone(&self.storage), proposed_leaf, updated_vid, is_vote_leaf_extended, - self.epoch_height, ) .await { diff --git a/crates/task-impls/src/request.rs b/crates/task-impls/src/request.rs index 3ea5c53383..62ba74edb7 100644 --- a/crates/task-impls/src/request.rs +++ b/crates/task-impls/src/request.rs @@ -21,13 +21,14 @@ use hotshot_task::{ }; use hotshot_types::{ consensus::OuterConsensus, - simple_vote::HasEpoch, traits::{ + block_contents::BlockHeader, election::Membership, network::{ConnectedNetwork, DataRequest, RequestKind}, - node_implementation::{NodeImplementation, NodeType}, + node_implementation::{ConsensusTime, NodeImplementation, NodeType}, signature_key::SignatureKey, }, + utils::epoch_from_block_number, vote::HasViewNumber, }; use rand::{seq::SliceRandom, thread_rng}; @@ -98,7 +99,10 @@ impl> TaskState for NetworkRequest match event.as_ref() { HotShotEvent::QuorumProposalValidated(proposal, _) => { let prop_view = proposal.data.view_number(); - let prop_epoch = proposal.data.epoch(); + let prop_epoch = TYPES::Epoch::new(epoch_from_block_number( + proposal.data.block_header.block_number(), + TYPES::EPOCH_HEIGHT, + )); // If we already have the VID shares for the next view, do nothing. if prop_view >= self.view diff --git a/crates/task-impls/src/response.rs b/crates/task-impls/src/response.rs index 700560c146..27983cdffa 100644 --- a/crates/task-impls/src/response.rs +++ b/crates/task-impls/src/response.rs @@ -10,7 +10,7 @@ use async_broadcast::{Receiver, Sender}; use committable::Committable; use hotshot_types::{ consensus::{Consensus, LockedConsensusState, OuterConsensus}, - data::VidDisperseShare, + data::VidDisperseShare2, message::Proposal, traits::{ election::Membership, network::DataRequest, node_implementation::NodeType, @@ -138,7 +138,7 @@ impl NetworkResponseState { &self, view: TYPES::View, key: &TYPES::SignatureKey, - ) -> Option>> { + ) -> Option>> { let consensus_reader = self.consensus.read().await; if let Some(view) = consensus_reader.vid_shares().get(&view) { if let Some(share) = view.get(key) { diff --git a/crates/task-impls/src/transactions.rs b/crates/task-impls/src/transactions.rs index 1ed7941524..1ba24f4f2b 100644 --- a/crates/task-impls/src/transactions.rs +++ b/crates/task-impls/src/transactions.rs @@ -130,6 +130,7 @@ impl, V: Versions> TransactionTask &mut self, event_stream: &Sender>>, block_view: TYPES::View, + block_epoch: TYPES::Epoch, ) -> Option { let version = match self.upgrade_lock.version(block_view).await { Ok(v) => v, @@ -140,10 +141,10 @@ impl, V: Versions> TransactionTask }; if version < V::Marketplace::VERSION { - self.handle_view_change_legacy(event_stream, block_view) + self.handle_view_change_legacy(event_stream, block_view, block_epoch) .await } else { - self.handle_view_change_marketplace(event_stream, block_view) + self.handle_view_change_marketplace(event_stream, block_view, block_epoch) .await } } @@ -154,6 +155,7 @@ impl, V: Versions> TransactionTask &mut self, event_stream: &Sender>>, block_view: TYPES::View, + block_epoch: TYPES::Epoch, ) -> Option { let version = match self.upgrade_lock.version(block_view).await { Ok(v) => v, @@ -191,6 +193,7 @@ impl, V: Versions> TransactionTask block_payload.encode(), metadata, block_view, + block_epoch, vec1::vec1![fee], precompute_data, None, @@ -234,6 +237,7 @@ impl, V: Versions> TransactionTask vec![].into(), metadata, block_view, + block_epoch, vec1::vec1![null_fee], Some(precompute_data), None, @@ -254,6 +258,7 @@ impl, V: Versions> TransactionTask async fn produce_block_marketplace( &mut self, block_view: TYPES::View, + block_epoch: TYPES::Epoch, task_start_time: Instant, ) -> Result> { ensure!( @@ -346,6 +351,7 @@ impl, V: Versions> TransactionTask block_payload.encode(), metadata, block_view, + block_epoch, sequencing_fees, None, Some(auction_result), @@ -356,6 +362,7 @@ impl, V: Versions> TransactionTask pub fn null_block( &self, block_view: TYPES::View, + block_epoch: TYPES::Epoch, version: Version, ) -> Option> { let membership_total_nodes = self.membership.total_nodes(self.cur_epoch); @@ -377,6 +384,7 @@ impl, V: Versions> TransactionTask vec![].into(), metadata, block_view, + block_epoch, vec1::vec1![null_fee], Some(precompute_data), Some(TYPES::AuctionResult::default()), @@ -389,6 +397,7 @@ impl, V: Versions> TransactionTask &mut self, event_stream: &Sender>>, block_view: TYPES::View, + block_epoch: TYPES::Epoch, ) -> Option { let task_start_time = Instant::now(); @@ -401,7 +410,7 @@ impl, V: Versions> TransactionTask }; let packed_bundle = match self - .produce_block_marketplace(block_view, task_start_time) + .produce_block_marketplace(block_view, block_epoch, task_start_time) .await { Ok(b) => b, @@ -412,7 +421,7 @@ impl, V: Versions> TransactionTask e ); - let null_block = self.null_block(block_view, version)?; + let null_block = self.null_block(block_view, block_epoch, version)?; // Increment the metric for number of empty blocks proposed self.consensus @@ -441,12 +450,13 @@ impl, V: Versions> TransactionTask &mut self, event_stream: &Sender>>, block_view: TYPES::View, + block_epoch: TYPES::Epoch, ) -> Option { if self.consensus.read().await.is_high_qc_forming_eqc() { tracing::info!("Reached end of epoch. Not getting a new block until we form an eQC."); None } else { - self.handle_view_change_marketplace(event_stream, block_view) + self.handle_view_change_marketplace(event_stream, block_view, block_epoch) .await } } @@ -487,9 +497,10 @@ impl, V: Versions> TransactionTask ) ); self.cur_view = view; - self.cur_epoch = epoch; + self.cur_epoch = *epoch; + if self.membership.leader(view, epoch)? == self.public_key { - self.handle_view_change(&event_stream, view).await; + self.handle_view_change(&event_stream, view, epoch).await; return Ok(()); } } diff --git a/crates/task-impls/src/upgrade.rs b/crates/task-impls/src/upgrade.rs index a017a04ba1..16f8c7e555 100644 --- a/crates/task-impls/src/upgrade.rs +++ b/crates/task-impls/src/upgrade.rs @@ -6,16 +6,10 @@ use std::{marker::PhantomData, sync::Arc, time::SystemTime}; -use crate::{ - events::HotShotEvent, - helpers::broadcast_event, - vote_collection::{handle_vote, VoteCollectorsMap}, -}; use async_broadcast::{Receiver, Sender}; use async_trait::async_trait; use committable::Committable; use hotshot_task::task::TaskState; -use hotshot_types::utils::EpochTransitionIndicator; use hotshot_types::{ constants::{ UPGRADE_BEGIN_OFFSET, UPGRADE_DECIDE_BY_OFFSET, UPGRADE_FINISH_OFFSET, @@ -31,12 +25,19 @@ use hotshot_types::{ node_implementation::{ConsensusTime, NodeType, Versions}, signature_key::SignatureKey, }, + utils::EpochTransitionIndicator, vote::HasViewNumber, }; use tracing::instrument; use utils::anytrace::*; use vbs::version::StaticVersionType; +use crate::{ + events::HotShotEvent, + helpers::broadcast_event, + vote_collection::{handle_vote, VoteCollectorsMap}, +}; + /// Tracks state of an upgrade task pub struct UpgradeTaskState { /// Output events to application @@ -238,6 +239,7 @@ impl UpgradeTaskState { vote, self.public_key.clone(), &self.quorum_membership, + self.cur_epoch, self.id, &event, &tx, @@ -281,7 +283,6 @@ impl UpgradeTaskState { old_version_last_view: TYPES::View::new(view + UPGRADE_BEGIN_OFFSET), new_version_first_view: TYPES::View::new(view + UPGRADE_FINISH_OFFSET), decide_by: TYPES::View::new(view + UPGRADE_DECIDE_BY_OFFSET), - epoch: self.cur_epoch, }; let upgrade_proposal = UpgradeProposal { diff --git a/crates/task-impls/src/vid.rs b/crates/task-impls/src/vid.rs index 79d32b32c6..b27038fabf 100644 --- a/crates/task-impls/src/vid.rs +++ b/crates/task-impls/src/vid.rs @@ -9,18 +9,18 @@ use std::{marker::PhantomData, sync::Arc}; use async_broadcast::{Receiver, Sender}; use async_trait::async_trait; use hotshot_task::task::TaskState; -use hotshot_types::traits::block_contents::BlockHeader; -use hotshot_types::utils::epoch_from_block_number; use hotshot_types::{ consensus::OuterConsensus, - data::{PackedBundle, VidDisperse, VidDisperseShare}, + data::{PackedBundle, VidDisperse, VidDisperseShare2}, message::Proposal, traits::{ + block_contents::BlockHeader, election::Membership, node_implementation::{ConsensusTime, NodeImplementation, NodeType}, signature_key::SignatureKey, BlockPayload, }, + utils::epoch_from_block_number, }; use tracing::{debug, error, info, instrument}; use utils::anytrace::Result; @@ -99,7 +99,7 @@ impl> VidTaskState { ) .await; let payload_commitment = vid_disperse.payload_commitment; - let shares = VidDisperseShare::from_vid_disperse(vid_disperse.clone()); + let shares = VidDisperseShare2::from_vid_disperse(vid_disperse.clone()); let mut consensus_writer = self.consensus.write().await; for share in shares { if let Some(disperse) = share.to_proposal(&self.private_key) { @@ -175,7 +175,10 @@ impl> VidTaskState { // We just sent a proposal for the last block in the epoch. We need to calculate // and send VID for the nodes in the next epoch so that they can vote. let proposal_view_number = proposal.data.view_number; - let sender_epoch = proposal.data.epoch; + let sender_epoch = TYPES::Epoch::new(epoch_from_block_number( + proposed_block_number, + self.epoch_height, + )); let target_epoch = TYPES::Epoch::new( epoch_from_block_number(proposed_block_number, self.epoch_height) + 1, ); diff --git a/crates/task-impls/src/view_sync.rs b/crates/task-impls/src/view_sync.rs index 2431adc253..65e1ad7d6b 100644 --- a/crates/task-impls/src/view_sync.rs +++ b/crates/task-impls/src/view_sync.rs @@ -15,21 +15,21 @@ use async_broadcast::{Receiver, Sender}; use async_lock::RwLock; use async_trait::async_trait; use hotshot_task::task::TaskState; -use hotshot_types::utils::EpochTransitionIndicator; use hotshot_types::{ - message::{GeneralConsensusMessage, UpgradeLock}, + message::UpgradeLock, simple_certificate::{ ViewSyncCommitCertificate2, ViewSyncFinalizeCertificate2, ViewSyncPreCommitCertificate2, }, simple_vote::{ - ViewSyncCommitData, ViewSyncCommitVote, ViewSyncFinalizeData, ViewSyncFinalizeVote, - ViewSyncPreCommitData, ViewSyncPreCommitVote, + ViewSyncCommitData2, ViewSyncCommitVote2, ViewSyncFinalizeData2, ViewSyncFinalizeVote2, + ViewSyncPreCommitData2, ViewSyncPreCommitVote2, }, traits::{ election::Membership, node_implementation::{ConsensusTime, NodeType, Versions}, signature_key::SignatureKey, }, + utils::EpochTransitionIndicator, vote::{Certificate, HasViewNumber, Vote}, }; use tokio::{spawn, task::JoinHandle, time::sleep}; @@ -93,16 +93,16 @@ pub struct ViewSyncTaskState { /// Map of pre-commit vote accumulates for the relay pub pre_commit_relay_map: RwLock< - RelayMap, ViewSyncPreCommitCertificate2, V>, + RelayMap, ViewSyncPreCommitCertificate2, V>, >, /// Map of commit vote accumulates for the relay pub commit_relay_map: - RwLock, ViewSyncCommitCertificate2, V>>, + RwLock, ViewSyncCommitCertificate2, V>>, /// Map of finalize vote accumulates for the relay pub finalize_relay_map: RwLock< - RelayMap, ViewSyncFinalizeCertificate2, V>, + RelayMap, ViewSyncFinalizeCertificate2, V>, >, /// Timeout duration for view sync rounds @@ -264,19 +264,19 @@ impl ViewSyncTaskState { event_stream: Sender>>, ) -> Result<()> { match event.as_ref() { - HotShotEvent::ViewSyncPreCommitCertificate2Recv(certificate) => { + HotShotEvent::ViewSyncPreCommitCertificateRecv(certificate) => { tracing::debug!("Received view sync cert for phase {:?}", certificate); let view = certificate.view_number(); self.send_to_or_create_replica(event, view, &event_stream) .await; } - HotShotEvent::ViewSyncCommitCertificate2Recv(certificate) => { + HotShotEvent::ViewSyncCommitCertificateRecv(certificate) => { tracing::debug!("Received view sync cert for phase {:?}", certificate); let view = certificate.view_number(); self.send_to_or_create_replica(event, view, &event_stream) .await; } - HotShotEvent::ViewSyncFinalizeCertificate2Recv(certificate) => { + HotShotEvent::ViewSyncFinalizeCertificateRecv(certificate) => { tracing::debug!("Received view sync cert for phase {:?}", certificate); let view = certificate.view_number(); self.send_to_or_create_replica(event, view, &event_stream) @@ -320,6 +320,7 @@ impl ViewSyncTaskState { membership: Arc::clone(&self.membership), view: vote_view, id: self.id, + epoch: vote.data.epoch, }; let vote_collector = create_vote_accumulator( &info, @@ -364,6 +365,7 @@ impl ViewSyncTaskState { membership: Arc::clone(&self.membership), view: vote_view, id: self.id, + epoch: vote.data.epoch, }; let vote_collector = create_vote_accumulator( @@ -408,6 +410,7 @@ impl ViewSyncTaskState { membership: Arc::clone(&self.membership), view: vote_view, id: self.id, + epoch: vote.data.epoch, }; let vote_collector = create_vote_accumulator( &info, @@ -519,7 +522,7 @@ impl ViewSyncReplicaTaskState { event_stream: Sender>>, ) -> Option { match event.as_ref() { - HotShotEvent::ViewSyncPreCommitCertificate2Recv(certificate) => { + HotShotEvent::ViewSyncPreCommitCertificateRecv(certificate) => { let last_seen_certificate = ViewSyncPhase::PreCommit; // Ignore certificate if it is for an older round @@ -553,8 +556,8 @@ impl ViewSyncReplicaTaskState { self.relay = certificate.data().relay; } - let Ok(vote) = ViewSyncCommitVote::::create_signed_vote( - ViewSyncCommitData { + let Ok(vote) = ViewSyncCommitVote2::::create_signed_vote( + ViewSyncCommitData2 { relay: certificate.data().relay, round: self.next_view, epoch: certificate.data().epoch, @@ -569,15 +572,12 @@ impl ViewSyncReplicaTaskState { tracing::error!("Failed to sign ViewSyncCommitData!"); return None; }; - let message = GeneralConsensusMessage::::ViewSyncCommitVote(vote); - if let GeneralConsensusMessage::ViewSyncCommitVote(vote) = message { - broadcast_event( - Arc::new(HotShotEvent::ViewSyncCommitVoteSend(vote)), - &event_stream, - ) - .await; - } + broadcast_event( + Arc::new(HotShotEvent::ViewSyncCommitVoteSend(vote)), + &event_stream, + ) + .await; if let Some(timeout_task) = self.timeout_task.take() { timeout_task.abort(); @@ -606,7 +606,7 @@ impl ViewSyncReplicaTaskState { })); } - HotShotEvent::ViewSyncCommitCertificate2Recv(certificate) => { + HotShotEvent::ViewSyncCommitCertificateRecv(certificate) => { let last_seen_certificate = ViewSyncPhase::Commit; // Ignore certificate if it is for an older round @@ -640,8 +640,8 @@ impl ViewSyncReplicaTaskState { self.relay = certificate.data().relay; } - let Ok(vote) = ViewSyncFinalizeVote::::create_signed_vote( - ViewSyncFinalizeData { + let Ok(vote) = ViewSyncFinalizeVote2::::create_signed_vote( + ViewSyncFinalizeData2 { relay: certificate.data().relay, round: self.next_view, epoch: certificate.data().epoch, @@ -656,15 +656,12 @@ impl ViewSyncReplicaTaskState { tracing::error!("Failed to sign view sync finalized vote!"); return None; }; - let message = GeneralConsensusMessage::::ViewSyncFinalizeVote(vote); - if let GeneralConsensusMessage::ViewSyncFinalizeVote(vote) = message { - broadcast_event( - Arc::new(HotShotEvent::ViewSyncFinalizeVoteSend(vote)), - &event_stream, - ) - .await; - } + broadcast_event( + Arc::new(HotShotEvent::ViewSyncFinalizeVoteSend(vote)), + &event_stream, + ) + .await; tracing::info!( "View sync protocol has received view sync evidence to update the view to {}", @@ -706,7 +703,7 @@ impl ViewSyncReplicaTaskState { })); } - HotShotEvent::ViewSyncFinalizeCertificate2Recv(certificate) => { + HotShotEvent::ViewSyncFinalizeCertificateRecv(certificate) => { // Ignore certificate if it is for an older round if certificate.view_number() < self.next_view { tracing::warn!("We're already in a higher round"); @@ -759,8 +756,8 @@ impl ViewSyncReplicaTaskState { } let epoch = self.cur_epoch; - let Ok(vote) = ViewSyncPreCommitVote::::create_signed_vote( - ViewSyncPreCommitData { + let Ok(vote) = ViewSyncPreCommitVote2::::create_signed_vote( + ViewSyncPreCommitData2 { relay: 0, round: view_number, epoch, @@ -775,15 +772,12 @@ impl ViewSyncReplicaTaskState { tracing::error!("Failed to sign pre commit vote!"); return None; }; - let message = GeneralConsensusMessage::::ViewSyncPreCommitVote(vote); - if let GeneralConsensusMessage::ViewSyncPreCommitVote(vote) = message { - broadcast_event( - Arc::new(HotShotEvent::ViewSyncPreCommitVoteSend(vote)), - &event_stream, - ) - .await; - } + broadcast_event( + Arc::new(HotShotEvent::ViewSyncPreCommitVoteSend(vote)), + &event_stream, + ) + .await; self.timeout_task = Some(spawn({ let stream = event_stream.clone(); @@ -818,8 +812,8 @@ impl ViewSyncReplicaTaskState { self.relay += 1; match last_seen_certificate { ViewSyncPhase::None | ViewSyncPhase::PreCommit | ViewSyncPhase::Commit => { - let Ok(vote) = ViewSyncPreCommitVote::::create_signed_vote( - ViewSyncPreCommitData { + let Ok(vote) = ViewSyncPreCommitVote2::::create_signed_vote( + ViewSyncPreCommitData2 { relay: self.relay, round: self.next_view, epoch: self.cur_epoch, @@ -834,16 +828,12 @@ impl ViewSyncReplicaTaskState { tracing::error!("Failed to sign ViewSyncPreCommitData!"); return None; }; - let message = - GeneralConsensusMessage::::ViewSyncPreCommitVote(vote); - - if let GeneralConsensusMessage::ViewSyncPreCommitVote(vote) = message { - broadcast_event( - Arc::new(HotShotEvent::ViewSyncPreCommitVoteSend(vote)), - &event_stream, - ) - .await; - } + + broadcast_event( + Arc::new(HotShotEvent::ViewSyncPreCommitVoteSend(vote)), + &event_stream, + ) + .await; } ViewSyncPhase::Finalize => { // This should never occur diff --git a/crates/task-impls/src/vote_collection.rs b/crates/task-impls/src/vote_collection.rs index 8649a8ac97..cc2ec6c7c9 100644 --- a/crates/task-impls/src/vote_collection.rs +++ b/crates/task-impls/src/vote_collection.rs @@ -17,13 +17,13 @@ use either::Either::{self, Left, Right}; use hotshot_types::{ message::UpgradeLock, simple_certificate::{ - DaCertificate, NextEpochQuorumCertificate2, QuorumCertificate, QuorumCertificate2, - TimeoutCertificate, UpgradeCertificate, ViewSyncCommitCertificate2, + DaCertificate2, NextEpochQuorumCertificate2, QuorumCertificate, QuorumCertificate2, + TimeoutCertificate2, UpgradeCertificate, ViewSyncCommitCertificate2, ViewSyncFinalizeCertificate2, ViewSyncPreCommitCertificate2, }, simple_vote::{ - DaVote, HasEpoch, NextEpochQuorumVote2, QuorumVote, QuorumVote2, TimeoutVote, UpgradeVote, - ViewSyncCommitVote, ViewSyncFinalizeVote, ViewSyncPreCommitVote, + DaVote2, NextEpochQuorumVote2, QuorumVote, QuorumVote2, TimeoutVote2, UpgradeVote, + ViewSyncCommitVote2, ViewSyncFinalizeVote2, ViewSyncPreCommitVote2, }, traits::{ election::Membership, @@ -59,10 +59,13 @@ pub struct VoteCollectionTaskState< /// The view which we are collecting votes for pub view: TYPES::View, + /// The epoch which we are collecting votes for + pub epoch: TYPES::Epoch, + /// Node id pub id: u64, - /// Indicates whether we are in the epoch transition + /// Whether we should check if we are the leader when handling a vote pub transition_indicator: EpochTransitionIndicator, } @@ -89,15 +92,13 @@ pub trait AggregatableVote< impl< TYPES: NodeType, - VOTE: Vote + HasEpoch + AggregatableVote, + VOTE: Vote + AggregatableVote, CERT: Certificate + Clone + Debug, V: Versions, > VoteCollectionTaskState { /// Take one vote and accumulate it. Returns either the cert or the updated state /// after the vote is accumulated - /// voter_epoch against which epoch the vote needs to be checked. - /// For `NextEpochQuorumVoteState` the epoch is one greater than the vote's epoch. /// /// # Errors /// If are unable to accumulate the vote @@ -105,18 +106,17 @@ impl< pub async fn accumulate_vote( &mut self, vote: &VOTE, - voter_epoch: TYPES::Epoch, + sender_epoch: TYPES::Epoch, event_stream: &Sender>>, ) -> Result> { - if matches!( - self.transition_indicator, - EpochTransitionIndicator::NotInTransition - ) { - ensure!( - vote.leader(&self.membership, vote.epoch())? == self.public_key, - info!("Received vote for a view in which we were not the leader.") - ); - } + ensure!( + matches!( + self.transition_indicator, + EpochTransitionIndicator::InTransition + ) || vote.leader(&self.membership, self.epoch)? == self.public_key, + info!("Received vote for a view in which we were not the leader.") + ); + ensure!( vote.view_number() == self.view, error!( @@ -131,7 +131,7 @@ impl< ))?; match accumulator - .accumulate(vote, &self.membership, voter_epoch) + .accumulate(vote, &self.membership, sender_epoch) .await { Either::Left(()) => Ok(None), @@ -181,6 +181,8 @@ pub struct AccumulatorInfo { pub membership: Arc, /// View of the votes we are collecting pub view: TYPES::View, + /// Epoch of the votes we are collecting + pub epoch: TYPES::Epoch, /// This nodes id pub id: u64, } @@ -226,6 +228,7 @@ where public_key: info.public_key.clone(), accumulator: Some(new_accumulator), view: info.view, + epoch: info.epoch, id: info.id, transition_indicator, }; @@ -254,6 +257,7 @@ pub async fn handle_vote< vote: &VOTE, public_key: TYPES::SignatureKey, membership: &Arc, + epoch: TYPES::Epoch, id: u64, event: &Arc>, event_stream: &Sender>>, @@ -270,6 +274,7 @@ where public_key, membership: Arc::clone(membership), view: vote.view_number(), + epoch, id, }; let collector = create_vote_accumulator( @@ -313,27 +318,32 @@ type NextEpochQuorumVoteState = VoteCollectionTaskState< V, >; /// Alias for DA vote accumulator -type DaVoteState = VoteCollectionTaskState, DaCertificate, V>; +type DaVoteState = + VoteCollectionTaskState, DaCertificate2, V>; /// Alias for Timeout vote accumulator type TimeoutVoteState = - VoteCollectionTaskState, TimeoutCertificate, V>; + VoteCollectionTaskState, TimeoutCertificate2, V>; /// Alias for upgrade vote accumulator type UpgradeVoteState = VoteCollectionTaskState, UpgradeCertificate, V>; /// Alias for View Sync Pre Commit vote accumulator type ViewSyncPreCommitState = VoteCollectionTaskState< TYPES, - ViewSyncPreCommitVote, + ViewSyncPreCommitVote2, ViewSyncPreCommitCertificate2, V, >; /// Alias for View Sync Commit vote accumulator -type ViewSyncCommitVoteState = - VoteCollectionTaskState, ViewSyncCommitCertificate2, V>; +type ViewSyncCommitVoteState = VoteCollectionTaskState< + TYPES, + ViewSyncCommitVote2, + ViewSyncCommitCertificate2, + V, +>; /// Alias for View Sync Finalize vote accumulator type ViewSyncFinalizeVoteState = VoteCollectionTaskState< TYPES, - ViewSyncFinalizeVote, + ViewSyncFinalizeVote2, ViewSyncFinalizeCertificate2, V, >; @@ -411,8 +421,8 @@ impl AggregatableVote, UpgradeCertifi } } -impl AggregatableVote, DaCertificate> - for DaVote +impl AggregatableVote, DaCertificate2> + for DaVote2 { fn leader( &self, @@ -422,15 +432,15 @@ impl AggregatableVote, DaCertificate, + certificate: DaCertificate2, key: &TYPES::SignatureKey, ) -> HotShotEvent { HotShotEvent::DacSend(certificate, key.clone()) } } -impl AggregatableVote, TimeoutCertificate> - for TimeoutVote +impl AggregatableVote, TimeoutCertificate2> + for TimeoutVote2 { fn leader( &self, @@ -440,7 +450,7 @@ impl AggregatableVote, TimeoutCertifi membership.leader(self.view_number() + 1, epoch) } fn make_cert_event( - certificate: TimeoutCertificate, + certificate: TimeoutCertificate2, _key: &TYPES::SignatureKey, ) -> HotShotEvent { HotShotEvent::Qc2Formed(Right(certificate)) @@ -448,8 +458,8 @@ impl AggregatableVote, TimeoutCertifi } impl - AggregatableVote, ViewSyncCommitCertificate2> - for ViewSyncCommitVote + AggregatableVote, ViewSyncCommitCertificate2> + for ViewSyncCommitVote2 { fn leader( &self, @@ -462,13 +472,13 @@ impl certificate: ViewSyncCommitCertificate2, key: &TYPES::SignatureKey, ) -> HotShotEvent { - HotShotEvent::ViewSyncCommitCertificate2Send(certificate, key.clone()) + HotShotEvent::ViewSyncCommitCertificateSend(certificate, key.clone()) } } impl - AggregatableVote, ViewSyncPreCommitCertificate2> - for ViewSyncPreCommitVote + AggregatableVote, ViewSyncPreCommitCertificate2> + for ViewSyncPreCommitVote2 { fn leader( &self, @@ -481,13 +491,13 @@ impl certificate: ViewSyncPreCommitCertificate2, key: &TYPES::SignatureKey, ) -> HotShotEvent { - HotShotEvent::ViewSyncPreCommitCertificate2Send(certificate, key.clone()) + HotShotEvent::ViewSyncPreCommitCertificateSend(certificate, key.clone()) } } impl - AggregatableVote, ViewSyncFinalizeCertificate2> - for ViewSyncFinalizeVote + AggregatableVote, ViewSyncFinalizeCertificate2> + for ViewSyncFinalizeVote2 { fn leader( &self, @@ -500,7 +510,7 @@ impl certificate: ViewSyncFinalizeCertificate2, key: &TYPES::SignatureKey, ) -> HotShotEvent { - HotShotEvent::ViewSyncFinalizeCertificate2Send(certificate, key.clone()) + HotShotEvent::ViewSyncFinalizeCertificateSend(certificate, key.clone()) } } @@ -517,7 +527,7 @@ impl ) -> Result>> { match event.as_ref() { HotShotEvent::QuorumVoteRecv(vote) => { - self.accumulate_vote(vote, vote.epoch(), sender).await + self.accumulate_vote(vote, self.epoch, sender).await } _ => Ok(None), } @@ -540,7 +550,7 @@ impl ) -> Result>> { match event.as_ref() { HotShotEvent::QuorumVoteRecv(vote) => { - self.accumulate_vote(&vote.clone().into(), vote.epoch() + 1, sender) + self.accumulate_vote(&vote.clone().into(), self.epoch + 1, sender) .await } _ => Ok(None), @@ -564,7 +574,7 @@ impl ) -> Result>> { match event.as_ref() { HotShotEvent::UpgradeVoteRecv(vote) => { - self.accumulate_vote(vote, vote.epoch(), sender).await + self.accumulate_vote(vote, self.epoch, sender).await } _ => Ok(None), } @@ -575,18 +585,16 @@ impl } #[async_trait] -impl HandleVoteEvent, DaCertificate> +impl HandleVoteEvent, DaCertificate2> for DaVoteState { async fn handle_vote_event( &mut self, event: Arc>, sender: &Sender>>, - ) -> Result>> { + ) -> Result>> { match event.as_ref() { - HotShotEvent::DaVoteRecv(vote) => { - self.accumulate_vote(vote, vote.epoch(), sender).await - } + HotShotEvent::DaVoteRecv(vote) => self.accumulate_vote(vote, self.epoch, sender).await, _ => Ok(None), } } @@ -597,17 +605,17 @@ impl HandleVoteEvent, DaCerti #[async_trait] impl - HandleVoteEvent, TimeoutCertificate> + HandleVoteEvent, TimeoutCertificate2> for TimeoutVoteState { async fn handle_vote_event( &mut self, event: Arc>, sender: &Sender>>, - ) -> Result>> { + ) -> Result>> { match event.as_ref() { HotShotEvent::TimeoutVoteRecv(vote) => { - self.accumulate_vote(vote, vote.epoch(), sender).await + self.accumulate_vote(vote, self.epoch, sender).await } _ => Ok(None), } @@ -619,7 +627,7 @@ impl #[async_trait] impl - HandleVoteEvent, ViewSyncPreCommitCertificate2> + HandleVoteEvent, ViewSyncPreCommitCertificate2> for ViewSyncPreCommitState { async fn handle_vote_event( @@ -629,7 +637,7 @@ impl ) -> Result>> { match event.as_ref() { HotShotEvent::ViewSyncPreCommitVoteRecv(vote) => { - self.accumulate_vote(vote, vote.epoch(), sender).await + self.accumulate_vote(vote, self.epoch, sender).await } _ => Ok(None), } @@ -641,7 +649,7 @@ impl #[async_trait] impl - HandleVoteEvent, ViewSyncCommitCertificate2> + HandleVoteEvent, ViewSyncCommitCertificate2> for ViewSyncCommitVoteState { async fn handle_vote_event( @@ -651,7 +659,7 @@ impl ) -> Result>> { match event.as_ref() { HotShotEvent::ViewSyncCommitVoteRecv(vote) => { - self.accumulate_vote(vote, vote.epoch(), sender).await + self.accumulate_vote(vote, self.epoch, sender).await } _ => Ok(None), } @@ -663,7 +671,7 @@ impl #[async_trait] impl - HandleVoteEvent, ViewSyncFinalizeCertificate2> + HandleVoteEvent, ViewSyncFinalizeCertificate2> for ViewSyncFinalizeVoteState { async fn handle_vote_event( @@ -673,7 +681,7 @@ impl ) -> Result>> { match event.as_ref() { HotShotEvent::ViewSyncFinalizeVoteRecv(vote) => { - self.accumulate_vote(vote, vote.epoch(), sender).await + self.accumulate_vote(vote, self.epoch, sender).await } _ => Ok(None), } diff --git a/crates/testing/src/block_builder/simple.rs b/crates/testing/src/block_builder/simple.rs index 8376633afc..e0af714f9a 100644 --- a/crates/testing/src/block_builder/simple.rs +++ b/crates/testing/src/block_builder/simple.rs @@ -238,7 +238,7 @@ where .await; if transactions.is_empty() { - // We don't want to return an empty block if we have no trasnactions, as we would end up + // We don't want to return an empty block if we have no transactions, as we would end up // driving consensus to produce empty blocks extremely quickly when mempool is empty. // Instead, we return no blocks, so that view leader will keep asking for blocks until // either we have something non-trivial to propose, or leader runs out of time to propose, diff --git a/crates/testing/src/helpers.rs b/crates/testing/src/helpers.rs index 2b65c4b113..49aca83652 100644 --- a/crates/testing/src/helpers.rs +++ b/crates/testing/src/helpers.rs @@ -25,12 +25,10 @@ use hotshot_example_types::{ use hotshot_task_impls::events::HotShotEvent; use hotshot_types::{ consensus::ConsensusMetricsValue, - data::{Leaf2, QuorumProposal2, VidDisperse, VidDisperseShare}, + data::{Leaf2, QuorumProposal2, VidDisperse, VidDisperseShare2}, message::{GeneralConsensusMessage, Proposal, UpgradeLock}, - simple_certificate::DaCertificate, - simple_vote::{ - DaData, DaVote, HasEpoch, QuorumData2, QuorumVote2, SimpleVote, VersionedVoteData, - }, + simple_certificate::DaCertificate2, + simple_vote::{DaData2, DaVote2, QuorumData2, QuorumVote2, SimpleVote, VersionedVoteData}, traits::{ block_contents::vid_commitment, consensus_api::ConsensusApi, @@ -138,7 +136,7 @@ pub async fn build_system_handle_from_launcher< pub async fn build_cert< TYPES: NodeType, V: Versions, - DATAType: Committable + HasEpoch + Clone + Eq + Hash + Serialize + Debug + 'static, + DATAType: Committable + Clone + Eq + Hash + Serialize + Debug + 'static, VOTE: Vote, CERT: Certificate, >( @@ -185,9 +183,9 @@ pub async fn build_cert< } pub fn vid_share( - shares: &[Proposal>], + shares: &[Proposal>], pub_key: TYPES::SignatureKey, -) -> Proposal> { +) -> Proposal> { shares .iter() .filter(|s| s.data.recipient_key == pub_key) @@ -206,7 +204,7 @@ pub async fn build_assembled_sig< V: Versions, VOTE: Vote, CERT: Certificate, - DATAType: Committable + HasEpoch + Clone + Eq + Hash + Serialize + Debug + 'static, + DATAType: Committable + Clone + Eq + Hash + Serialize + Debug + 'static, >( data: &DATAType, membership: &TYPES::Membership, @@ -348,7 +346,7 @@ pub fn build_vid_proposal( ( vid_disperse_proposal, - VidDisperseShare::from_vid_disperse(vid_disperse) + VidDisperseShare2::from_vid_disperse(vid_disperse) .into_iter() .map(|vid_disperse| { vid_disperse @@ -368,18 +366,18 @@ pub async fn build_da_certificate( public_key: &TYPES::SignatureKey, private_key: &::PrivateKey, upgrade_lock: &UpgradeLock, -) -> DaCertificate { +) -> DaCertificate2 { let encoded_transactions = TestTransaction::encode(&transactions); let da_payload_commitment = vid_commitment(&encoded_transactions, membership.total_nodes(epoch_number)); - let da_data = DaData { + let da_data = DaData2 { payload_commit: da_payload_commitment, epoch: epoch_number, }; - build_cert::, DaVote, DaCertificate>( + build_cert::, DaVote2, DaCertificate2>( da_data, membership, view_number, diff --git a/crates/testing/src/overall_safety_task.rs b/crates/testing/src/overall_safety_task.rs index ee9a5de856..caf92a87f6 100644 --- a/crates/testing/src/overall_safety_task.rs +++ b/crates/testing/src/overall_safety_task.rs @@ -9,10 +9,6 @@ use std::{ sync::Arc, }; -use crate::{ - test_runner::Node, - test_task::{TestEvent, TestResult, TestTaskState}, -}; use anyhow::Result; use async_broadcast::Sender; use async_lock::RwLock; @@ -31,6 +27,11 @@ use hotshot_types::{ }; use thiserror::Error; use tracing::error; + +use crate::{ + test_runner::Node, + test_task::{TestEvent, TestResult, TestTaskState}, +}; /// convenience type alias for state and block pub type StateAndBlock = (Vec, Vec); diff --git a/crates/testing/src/spinning_task.rs b/crates/testing/src/spinning_task.rs index cd9249d8f8..e9dd819802 100644 --- a/crates/testing/src/spinning_task.rs +++ b/crates/testing/src/spinning_task.rs @@ -9,11 +9,6 @@ use std::{ sync::Arc, }; -use crate::{ - test_launcher::Network, - test_runner::{LateNodeContext, LateNodeContextParameters, LateStartNode, Node, TestRunner}, - test_task::{TestResult, TestTaskState}, -}; use anyhow::Result; use async_broadcast::broadcast; use async_lock::RwLock; @@ -42,6 +37,12 @@ use hotshot_types::{ ValidatorConfig, }; +use crate::{ + test_launcher::Network, + test_runner::{LateNodeContext, LateNodeContextParameters, LateStartNode, Node, TestRunner}, + test_task::{TestResult, TestTaskState}, +}; + /// convenience type for state and block pub type StateAndBlock = (Vec, Vec); diff --git a/crates/testing/src/view_generator.rs b/crates/testing/src/view_generator.rs index dfcadf2bd8..a7390f98ed 100644 --- a/crates/testing/src/view_generator.rs +++ b/crates/testing/src/view_generator.rs @@ -22,18 +22,18 @@ use hotshot_example_types::{ }; use hotshot_types::{ data::{ - DaProposal, EpochNumber, Leaf2, QuorumProposal2, VidDisperse, VidDisperseShare, + DaProposal2, EpochNumber, Leaf2, QuorumProposal2, VidDisperse, VidDisperseShare2, ViewChangeEvidence, ViewNumber, }, drb::{INITIAL_DRB_RESULT, INITIAL_DRB_SEED_INPUT}, message::{Proposal, UpgradeLock}, simple_certificate::{ - DaCertificate, QuorumCertificate2, TimeoutCertificate, UpgradeCertificate, + DaCertificate2, QuorumCertificate2, TimeoutCertificate2, UpgradeCertificate, ViewSyncFinalizeCertificate2, }, simple_vote::{ - DaData, DaVote, QuorumData2, QuorumVote2, TimeoutData, TimeoutVote, UpgradeProposalData, - UpgradeVote, ViewSyncFinalizeData, ViewSyncFinalizeVote, + DaData2, DaVote2, QuorumData2, QuorumVote2, TimeoutData2, TimeoutVote2, + UpgradeProposalData, UpgradeVote, ViewSyncFinalizeData2, ViewSyncFinalizeVote2, }, traits::{ consensus_api::ConsensusApi, @@ -50,7 +50,7 @@ use crate::helpers::{ #[derive(Clone)] pub struct TestView { - pub da_proposal: Proposal>, + pub da_proposal: Proposal>, pub quorum_proposal: Proposal>, pub leaf: Leaf2, pub view_number: ViewNumber, @@ -58,16 +58,16 @@ pub struct TestView { pub membership: ::Membership, pub vid_disperse: Proposal>, pub vid_proposal: ( - Vec>>, + Vec>>, ::SignatureKey, ), pub leader_public_key: ::SignatureKey, - pub da_certificate: DaCertificate, + pub da_certificate: DaCertificate2, pub transactions: Vec, upgrade_data: Option>, formed_upgrade_certificate: Option>, - view_sync_finalize_data: Option>, - timeout_cert_data: Option>, + view_sync_finalize_data: Option>, + timeout_cert_data: Option>, upgrade_lock: UpgradeLock, } @@ -141,7 +141,6 @@ impl TestView { next_epoch_justify_qc: None, upgrade_certificate: None, view_change_evidence: None, - epoch: genesis_epoch, drb_result: INITIAL_DRB_RESULT, drb_seed: INITIAL_DRB_SEED_INPUT, }; @@ -152,7 +151,7 @@ impl TestView { ::SignatureKey::sign(&private_key, &encoded_transactions_hash) .expect("Failed to sign block payload"); - let da_proposal_inner = DaProposal:: { + let da_proposal_inner = DaProposal2:: { encoded_transactions: encoded_transactions.clone(), metadata, view_number: genesis_view, @@ -307,8 +306,8 @@ impl TestView { let cert = build_cert::< TestTypes, TestVersions, - ViewSyncFinalizeData, - ViewSyncFinalizeVote, + ViewSyncFinalizeData2, + ViewSyncFinalizeVote2, ViewSyncFinalizeCertificate2, >( data.clone(), @@ -330,9 +329,9 @@ impl TestView { let cert = build_cert::< TestTypes, TestVersions, - TimeoutData, - TimeoutVote, - TimeoutCertificate, + TimeoutData2, + TimeoutVote2, + TimeoutCertificate2, >( data.clone(), membership, @@ -373,7 +372,6 @@ impl TestView { next_epoch_justify_qc: None, upgrade_certificate: upgrade_certificate.clone(), view_change_evidence, - epoch: old_epoch, drb_result: INITIAL_DRB_RESULT, drb_seed: INITIAL_DRB_SEED_INPUT, }; @@ -398,7 +396,7 @@ impl TestView { ::SignatureKey::sign(&private_key, &encoded_transactions_hash) .expect("Failed to sign block payload"); - let da_proposal_inner = DaProposal:: { + let da_proposal_inner = DaProposal2:: { encoded_transactions: encoded_transactions.clone(), metadata, view_number: next_view, @@ -477,10 +475,10 @@ impl TestView { pub async fn create_da_vote( &self, - data: DaData, + data: DaData2, handle: &SystemContextHandle, - ) -> DaVote { - DaVote::create_signed_vote( + ) -> DaVote2 { + DaVote2::create_signed_vote( data, self.view_number, &handle.public_key(), @@ -529,7 +527,7 @@ impl TestViewGenerator { pub fn add_view_sync_finalize( &mut self, - view_sync_finalize_data: ViewSyncFinalizeData, + view_sync_finalize_data: ViewSyncFinalizeData2, ) { if let Some(ref view) = self.current_view { self.current_view = Some(TestView { @@ -541,7 +539,7 @@ impl TestViewGenerator { } } - pub fn add_timeout(&mut self, timeout_data: TimeoutData) { + pub fn add_timeout(&mut self, timeout_data: TimeoutData2) { if let Some(ref view) = self.current_view { self.current_view = Some(TestView { timeout_cert_data: Some(timeout_data), diff --git a/crates/testing/src/view_sync_task.rs b/crates/testing/src/view_sync_task.rs index 733164d341..914c8279cd 100644 --- a/crates/testing/src/view_sync_task.rs +++ b/crates/testing/src/view_sync_task.rs @@ -48,12 +48,12 @@ impl> TestTaskState | HotShotEvent::ViewSyncPreCommitVoteSend(_) | HotShotEvent::ViewSyncCommitVoteSend(_) | HotShotEvent::ViewSyncFinalizeVoteSend(_) - | HotShotEvent::ViewSyncPreCommitCertificate2Recv(_) - | HotShotEvent::ViewSyncCommitCertificate2Recv(_) - | HotShotEvent::ViewSyncFinalizeCertificate2Recv(_) - | HotShotEvent::ViewSyncPreCommitCertificate2Send(_, _) - | HotShotEvent::ViewSyncCommitCertificate2Send(_, _) - | HotShotEvent::ViewSyncFinalizeCertificate2Send(_, _) + | HotShotEvent::ViewSyncPreCommitCertificateRecv(_) + | HotShotEvent::ViewSyncCommitCertificateRecv(_) + | HotShotEvent::ViewSyncFinalizeCertificateRecv(_) + | HotShotEvent::ViewSyncPreCommitCertificateSend(_, _) + | HotShotEvent::ViewSyncCommitCertificateSend(_, _) + | HotShotEvent::ViewSyncFinalizeCertificateSend(_, _) | HotShotEvent::ViewSyncTrigger(_) => { self.hit_view_sync.insert(id); } diff --git a/crates/testing/tests/tests_1/da_task.rs b/crates/testing/tests/tests_1/da_task.rs index 2335cd70ff..c7af796395 100644 --- a/crates/testing/tests/tests_1/da_task.rs +++ b/crates/testing/tests/tests_1/da_task.rs @@ -23,7 +23,7 @@ use hotshot_testing::{ }; use hotshot_types::{ data::{null_block, EpochNumber, PackedBundle, ViewNumber}, - simple_vote::DaData, + simple_vote::DaData2, traits::{ block_contents::precompute_vid_commitment, election::Membership, @@ -64,7 +64,7 @@ async fn test_da_task() { leaders.push(view.leader_public_key); votes.push( view.create_da_vote( - DaData { + DaData2 { payload_commit, epoch: view.da_proposal.data.epoch, }, @@ -83,7 +83,7 @@ async fn test_da_task() { leaders.push(view.leader_public_key); votes.push( view.create_da_vote( - DaData { + DaData2 { payload_commit, epoch: view.da_proposal.data.epoch, }, @@ -105,6 +105,7 @@ async fn test_da_task() { num_transactions: transactions.len() as u64 }, ViewNumber::new(2), + EpochNumber::new(0), vec1::vec1![null_block::builder_fee::( membership.total_nodes(EpochNumber::new(0)), ::Base::VERSION, @@ -171,7 +172,7 @@ async fn test_da_task_storage_failure() { leaders.push(view.leader_public_key); votes.push( view.create_da_vote( - DaData { + DaData2 { payload_commit, epoch: view.da_proposal.data.epoch, }, @@ -190,7 +191,7 @@ async fn test_da_task_storage_failure() { leaders.push(view.leader_public_key); votes.push( view.create_da_vote( - DaData { + DaData2 { payload_commit, epoch: view.da_proposal.data.epoch, }, @@ -212,6 +213,7 @@ async fn test_da_task_storage_failure() { num_transactions: transactions.len() as u64 }, ViewNumber::new(2), + EpochNumber::new(0), vec1::vec1![null_block::builder_fee::( membership.total_nodes(EpochNumber::new(0)), ::Base::VERSION, diff --git a/crates/testing/tests/tests_1/message.rs b/crates/testing/tests/tests_1/message.rs index 178985b8da..e19cce630b 100644 --- a/crates/testing/tests/tests_1/message.rs +++ b/crates/testing/tests/tests_1/message.rs @@ -13,7 +13,7 @@ use hotshot_types::{ message::{GeneralConsensusMessage, Message, MessageKind, SequencingMessage}, signature_key::BLSPubKey, simple_certificate::SimpleCertificate, - simple_vote::ViewSyncCommitData, + simple_vote::ViewSyncCommitData2, traits::{node_implementation::ConsensusTime, signature_key::SignatureKey}, }; use vbs::{ @@ -38,7 +38,7 @@ fn version_number_at_start_of_serialization() { type TestVersion = StaticVersion; // The specific data we attach to our message shouldn't affect the serialization, // we're using ViewSyncCommitData for simplicity. - let data: ViewSyncCommitData = ViewSyncCommitData { + let data: ViewSyncCommitData2 = ViewSyncCommitData2 { relay: 37, round: view_number, epoch, @@ -48,7 +48,7 @@ fn version_number_at_start_of_serialization() { let message = Message { sender, kind: MessageKind::Consensus(SequencingMessage::General( - GeneralConsensusMessage::ViewSyncCommitCertificate(simple_certificate), + GeneralConsensusMessage::ViewSyncCommitCertificate2(simple_certificate), )), }; let serialized_message: Vec = Serializer::::serialize(&message).unwrap(); diff --git a/crates/testing/tests/tests_1/quorum_proposal_task.rs b/crates/testing/tests/tests_1/quorum_proposal_task.rs index 0be0593cc2..0935aef8f8 100644 --- a/crates/testing/tests/tests_1/quorum_proposal_task.rs +++ b/crates/testing/tests/tests_1/quorum_proposal_task.rs @@ -26,7 +26,7 @@ use hotshot_testing::{ }; use hotshot_types::{ data::{null_block, EpochNumber, Leaf2, ViewChangeEvidence, ViewNumber}, - simple_vote::{TimeoutData, ViewSyncFinalizeData}, + simple_vote::{TimeoutData2, ViewSyncFinalizeData2}, traits::{ election::Membership, node_implementation::{ConsensusTime, Versions}, @@ -331,7 +331,7 @@ async fn test_quorum_proposal_task_qc_timeout() { vid_dispersals.push(view.vid_disperse.clone()); leaves.push(view.leaf.clone()); } - let timeout_data = TimeoutData { + let timeout_data = TimeoutData2 { view: ViewNumber::new(1), epoch: EpochNumber::new(0), }; @@ -421,7 +421,7 @@ async fn test_quorum_proposal_task_view_sync() { leaves.push(view.leaf.clone()); } - let view_sync_finalize_data = ViewSyncFinalizeData { + let view_sync_finalize_data = ViewSyncFinalizeData2 { relay: 2, round: ViewNumber::new(node_id), epoch: EpochNumber::new(0), @@ -442,7 +442,7 @@ async fn test_quorum_proposal_task_view_sync() { }; let inputs = vec![random![ - ViewSyncFinalizeCertificate2Recv(cert.clone()), + ViewSyncFinalizeCertificateRecv(cert.clone()), SendPayloadCommitmentAndMetadata( payload_commitment, builder_commitment, diff --git a/crates/testing/tests/tests_1/test_success.rs b/crates/testing/tests/tests_1/test_success.rs index e4ad1f1b04..552d3c033d 100644 --- a/crates/testing/tests/tests_1/test_success.rs +++ b/crates/testing/tests/tests_1/test_success.rs @@ -4,7 +4,7 @@ // You should have received a copy of the MIT License // along with the HotShot repository. If not, see . -use std::time::Duration; +use std::{sync::Arc, time::Duration}; use hotshot_example_types::{ node_types::{ @@ -18,6 +18,7 @@ use hotshot_macros::cross_tests; use hotshot_testing::{ block_builder::SimpleBuilderImplementation, completion_task::{CompletionTaskDescription, TimeBasedCompletionTaskDescription}, + overall_safety_task::OverallSafetyPropertiesDescription, spinning_task::{ChangeNode, NodeAction, SpinningTaskDescription}, test_builder::TestDescription, view_sync_task::ViewSyncTaskDescription, @@ -283,6 +284,12 @@ cross_tests!( start_nodes: 10, num_bootstrap_nodes: 10, da_staked_committee_size: 10, + overall_safety_properties: OverallSafetyPropertiesDescription { + // Explicitly show that we use normal threshold, i.e. 2 nodes_len / 3 + 1 + // but we divide by two because only half of the nodes are active in each epoch + threshold_calculator: Arc::new(|_, nodes_len| 2 * nodes_len / 2 / 3 + 1), + ..OverallSafetyPropertiesDescription::default() + }, ..TestDescription::default() } diff --git a/crates/testing/tests/tests_1/transaction_task.rs b/crates/testing/tests/tests_1/transaction_task.rs index 43773e63da..e4ed70be64 100644 --- a/crates/testing/tests/tests_1/transaction_task.rs +++ b/crates/testing/tests/tests_1/transaction_task.rs @@ -52,6 +52,7 @@ async fn test_transaction_task_leader_two_views_in_a_row() { num_transactions: 0, }, current_view, + EpochNumber::new(1), vec1::vec1![ null_block::builder_fee::( handle.hotshot.memberships.total_nodes(EpochNumber::new(0)), diff --git a/crates/testing/tests/tests_1/upgrade_task_with_proposal.rs b/crates/testing/tests/tests_1/upgrade_task_with_proposal.rs index 95cfcb448f..44833d7727 100644 --- a/crates/testing/tests/tests_1/upgrade_task_with_proposal.rs +++ b/crates/testing/tests/tests_1/upgrade_task_with_proposal.rs @@ -71,7 +71,6 @@ async fn test_upgrade_task_with_proposal() { new_version_hash: [0u8; 12].to_vec(), old_version_last_view: ViewNumber::new(5), new_version_first_view: ViewNumber::new(7), - epoch: EpochNumber::new(0), }; let mut proposals = Vec::new(); diff --git a/crates/testing/tests/tests_1/upgrade_task_with_vote.rs b/crates/testing/tests/tests_1/upgrade_task_with_vote.rs index 02e90394df..5390f56e03 100644 --- a/crates/testing/tests/tests_1/upgrade_task_with_vote.rs +++ b/crates/testing/tests/tests_1/upgrade_task_with_vote.rs @@ -59,7 +59,6 @@ async fn test_upgrade_task_with_vote() { new_version_hash: [0u8; 12].to_vec(), old_version_last_view: ViewNumber::new(6), new_version_first_view: ViewNumber::new(7), - epoch: EpochNumber::new(0), }; let mut proposals = Vec::new(); diff --git a/crates/testing/tests/tests_1/vid_task.rs b/crates/testing/tests/tests_1/vid_task.rs index 15f39208e3..fc33e7f9a4 100644 --- a/crates/testing/tests/tests_1/vid_task.rs +++ b/crates/testing/tests/tests_1/vid_task.rs @@ -110,6 +110,7 @@ async fn test_vid_task() { num_transactions: transactions.len() as u64 }, ViewNumber::new(2), + EpochNumber::new(0), vec1::vec1![null_block::builder_fee::( membership.total_nodes(EpochNumber::new(0)), ::Base::VERSION, diff --git a/crates/testing/tests/tests_1/view_sync_task.rs b/crates/testing/tests/tests_1/view_sync_task.rs index ae98f2c864..255ca4cfa0 100644 --- a/crates/testing/tests/tests_1/view_sync_task.rs +++ b/crates/testing/tests/tests_1/view_sync_task.rs @@ -12,7 +12,7 @@ use hotshot_task_impls::{ use hotshot_testing::helpers::build_system_handle; use hotshot_types::{ data::{EpochNumber, ViewNumber}, - simple_vote::ViewSyncPreCommitData, + simple_vote::ViewSyncPreCommitData2, traits::node_implementation::ConsensusTime, }; @@ -26,12 +26,12 @@ async fn test_view_sync_task() { .await .0; - let vote_data = ViewSyncPreCommitData { + let vote_data = ViewSyncPreCommitData2 { relay: 0, round: ::View::new(4), epoch: EpochNumber::new(0), }; - let vote = hotshot_types::simple_vote::ViewSyncPreCommitVote::::create_signed_vote( + let vote = hotshot_types::simple_vote::ViewSyncPreCommitVote2::::create_signed_vote( vote_data, ::View::new(4), hotshot_types::traits::consensus_api::ConsensusApi::public_key(&handle), diff --git a/crates/testing/tests/tests_3/memory_network.rs b/crates/testing/tests/tests_3/memory_network.rs index 875e5b40e9..b99961af3e 100644 --- a/crates/testing/tests/tests_3/memory_network.rs +++ b/crates/testing/tests/tests_3/memory_network.rs @@ -52,6 +52,8 @@ use tracing::{instrument, trace}; pub struct Test; impl NodeType for Test { + const EPOCH_HEIGHT: u64 = 10; + type AuctionResult = TestAuctionResult; type View = ViewNumber; type Epoch = EpochNumber; diff --git a/crates/types/src/consensus.rs b/crates/types/src/consensus.rs index b310b9e6ab..edbf78acab 100644 --- a/crates/types/src/consensus.rs +++ b/crates/types/src/consensus.rs @@ -19,14 +19,13 @@ use tracing::instrument; use utils::anytrace::*; use vec1::Vec1; -use crate::utils::is_last_block_in_epoch; pub use crate::utils::{View, ViewInner}; use crate::{ - data::{Leaf2, QuorumProposal2, VidDisperse, VidDisperseShare}, + data::{Leaf2, QuorumProposal2, VidDisperse, VidDisperseShare2}, error::HotShotError, event::{HotShotAction, LeafInfo}, message::Proposal, - simple_certificate::{DaCertificate, NextEpochQuorumCertificate2, QuorumCertificate2}, + simple_certificate::{DaCertificate2, NextEpochQuorumCertificate2, QuorumCertificate2}, traits::{ block_contents::BuilderFee, metrics::{Counter, Gauge, Histogram, Metrics, NoMetrics}, @@ -35,7 +34,8 @@ use crate::{ BlockPayload, ValidatedState, }, utils::{ - epoch_from_block_number, BuilderCommitment, LeafCommitment, StateAndDelta, Terminator, + epoch_from_block_number, is_last_block_in_epoch, BuilderCommitment, LeafCommitment, + StateAndDelta, Terminator, }, vid::VidCommitment, vote::{Certificate, HasViewNumber}, @@ -47,7 +47,7 @@ pub type CommitmentMap = HashMap, T>; /// A type alias for `BTreeMap>>>` pub type VidShares = BTreeMap< ::View, - HashMap<::SignatureKey, Proposal>>, + HashMap<::SignatureKey, Proposal>>, >; /// Type alias for consensus state wrapped in a lock. @@ -282,7 +282,7 @@ pub struct Consensus { /// All the DA certs we've received for current and future views. /// view -> DA cert - saved_da_certs: HashMap>, + saved_da_certs: HashMap>, /// View number that is currently on. cur_view: TYPES::View, @@ -490,7 +490,7 @@ impl Consensus { } /// Get the saved DA certs. - pub fn saved_da_certs(&self) -> &HashMap> { + pub fn saved_da_certs(&self) -> &HashMap> { &self.saved_da_certs } @@ -760,12 +760,13 @@ impl Consensus { &mut self, high_qc: NextEpochQuorumCertificate2, ) -> Result<()> { - ensure!( - self.next_epoch_high_qc().is_none() - || high_qc.view_number > self.next_epoch_high_qc.as_ref().unwrap().view_number - || high_qc == *self.next_epoch_high_qc.as_ref().unwrap(), - debug!("Next epoch high QC with an equal or higher view exists.") - ); + if let Some(next_epoch_high_qc) = self.next_epoch_high_qc() { + ensure!( + high_qc.view_number > next_epoch_high_qc.view_number + || high_qc == *next_epoch_high_qc, + debug!("Next epoch high QC with an equal or higher view exists.") + ); + } tracing::debug!("Updating next epoch high QC"); self.next_epoch_high_qc = Some(high_qc); @@ -776,7 +777,7 @@ impl Consensus { pub fn update_vid_shares( &mut self, view_number: TYPES::View, - disperse: Proposal>, + disperse: Proposal>, ) { self.vid_shares .entry(view_number) @@ -785,7 +786,7 @@ impl Consensus { } /// Add a new entry to the da_certs map. - pub fn update_saved_da_certs(&mut self, view_number: TYPES::View, cert: DaCertificate) { + pub fn update_saved_da_certs(&mut self, view_number: TYPES::View, cert: DaCertificate2) { self.saved_da_certs.insert(view_number, cert); } @@ -950,7 +951,7 @@ impl Consensus { .epoch()?; let vid = VidDisperse::calculate_vid_disperse(txns, &membership, view, epoch, None, None).await; - let shares = VidDisperseShare::from_vid_disperse(vid); + let shares = VidDisperseShare2::from_vid_disperse(vid); let mut consensus_writer = consensus.write().await; for share in shares { if let Some(prop) = share.to_proposal(private_key) { diff --git a/crates/types/src/data.rs b/crates/types/src/data.rs index 5b6bda2716..f3853e412e 100644 --- a/crates/types/src/data.rs +++ b/crates/types/src/data.rs @@ -34,7 +34,7 @@ use crate::{ impl_has_epoch, message::{Proposal, UpgradeLock}, simple_certificate::{ - NextEpochQuorumCertificate2, QuorumCertificate, QuorumCertificate2, TimeoutCertificate, + NextEpochQuorumCertificate2, QuorumCertificate, QuorumCertificate2, TimeoutCertificate2, UpgradeCertificate, ViewSyncFinalizeCertificate2, }, simple_vote::{HasEpoch, QuorumData, QuorumData2, UpgradeProposalData, VersionedVoteData}, @@ -49,7 +49,7 @@ use crate::{ states::TestableState, BlockPayload, }, - utils::bincode_opts, + utils::{bincode_opts, epoch_from_block_number}, vid::{vid_scheme, VidCommitment, VidCommon, VidPrecomputeData, VidSchemeType, VidShare}, vote::{Certificate, HasViewNumber}, }; @@ -150,6 +150,42 @@ pub struct DaProposal { pub epoch: TYPES::Epoch, } +/// A proposal to start providing data availability for a block. +#[derive(derive_more::Debug, Serialize, Deserialize, Clone, Eq, PartialEq, Hash)] +#[serde(bound = "TYPES: NodeType")] +pub struct DaProposal2 { + /// Encoded transactions in the block to be applied. + pub encoded_transactions: Arc<[u8]>, + /// Metadata of the block to be applied. + pub metadata: >::Metadata, + /// View this proposal applies to + pub view_number: TYPES::View, + /// Epoch this proposal applies to + pub epoch: TYPES::Epoch, +} + +impl From> for DaProposal2 { + fn from(da_proposal: DaProposal) -> Self { + Self { + encoded_transactions: da_proposal.encoded_transactions, + metadata: da_proposal.metadata, + view_number: da_proposal.view_number, + epoch: TYPES::Epoch::new(0), + } + } +} + +impl From> for DaProposal { + fn from(da_proposal2: DaProposal2) -> Self { + Self { + encoded_transactions: da_proposal2.encoded_transactions, + metadata: da_proposal2.metadata, + view_number: da_proposal2.view_number, + epoch: TYPES::Epoch::new(0), + } + } +} + /// A proposal to upgrade the network #[derive(derive_more::Debug, Serialize, Deserialize, Clone, Eq, PartialEq, Hash)] #[serde(bound = "TYPES: NodeType")] @@ -254,7 +290,7 @@ impl VidDisperse { #[serde(bound(deserialize = ""))] pub enum ViewChangeEvidence { /// Holds a timeout certificate. - Timeout(TimeoutCertificate), + Timeout(TimeoutCertificate2), /// Holds a view sync finalized certificate. ViewSync(ViewSyncFinalizeCertificate2), } @@ -274,8 +310,6 @@ impl ViewChangeEvidence { pub struct VidDisperseShare { /// The view number for which this VID data is intended pub view_number: TYPES::View, - /// Epoch this proposal applies to - pub epoch: TYPES::Epoch, /// Block payload commitment pub payload_commitment: VidCommitment, /// A storage node's key and its corresponding VID share @@ -287,13 +321,156 @@ pub struct VidDisperseShare { } impl VidDisperseShare { + /// Create a vector of `VidDisperseShare` from `VidDisperse` + pub fn from_vid_disperse(vid_disperse: VidDisperse) -> Vec { + vid_disperse + .shares + .into_iter() + .map(|(recipient_key, share)| Self { + share, + recipient_key, + view_number: vid_disperse.view_number, + common: vid_disperse.common.clone(), + payload_commitment: vid_disperse.payload_commitment, + }) + .collect() + } + + /// Consume `self` and return a `Proposal` + pub fn to_proposal( + self, + private_key: &::PrivateKey, + ) -> Option> { + let Ok(signature) = + TYPES::SignatureKey::sign(private_key, self.payload_commitment.as_ref()) + else { + error!("VID: failed to sign dispersal share payload"); + return None; + }; + Some(Proposal { + signature, + _pd: PhantomData, + data: self, + }) + } + + /// Create `VidDisperse` out of an iterator to `VidDisperseShare`s + pub fn to_vid_disperse<'a, I>(mut it: I) -> Option> + where + I: Iterator, + { + let first_vid_disperse_share = it.next()?.clone(); + let mut share_map = BTreeMap::new(); + share_map.insert( + first_vid_disperse_share.recipient_key, + first_vid_disperse_share.share, + ); + let mut vid_disperse = VidDisperse { + view_number: first_vid_disperse_share.view_number, + epoch: TYPES::Epoch::new(0), + payload_commitment: first_vid_disperse_share.payload_commitment, + common: first_vid_disperse_share.common, + shares: share_map, + }; + let _ = it.map(|vid_disperse_share| { + vid_disperse.shares.insert( + vid_disperse_share.recipient_key.clone(), + vid_disperse_share.share.clone(), + ) + }); + Some(vid_disperse) + } + + /// Split a VID share proposal into a proposal for each recipient. + pub fn to_vid_share_proposals( + vid_disperse_proposal: Proposal>, + ) -> Vec> { + vid_disperse_proposal + .data + .shares + .into_iter() + .map(|(recipient_key, share)| Proposal { + data: Self { + share, + recipient_key, + view_number: vid_disperse_proposal.data.view_number, + common: vid_disperse_proposal.data.common.clone(), + payload_commitment: vid_disperse_proposal.data.payload_commitment, + }, + signature: vid_disperse_proposal.signature.clone(), + _pd: vid_disperse_proposal._pd, + }) + .collect() + } +} + +#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq, Hash)] +/// VID share and associated metadata for a single node +pub struct VidDisperseShare2 { + /// The view number for which this VID data is intended + pub view_number: TYPES::View, + /// The epoch number for which this VID data is intended + pub epoch: TYPES::Epoch, + /// Block payload commitment + pub payload_commitment: VidCommitment, + /// A storage node's key and its corresponding VID share + pub share: VidShare, + /// VID common data sent to all storage nodes + pub common: VidCommon, + /// a public key of the share recipient + pub recipient_key: TYPES::SignatureKey, +} + +impl From> for VidDisperseShare { + fn from(vid_disperse2: VidDisperseShare2) -> Self { + let VidDisperseShare2 { + view_number, + epoch: _, + payload_commitment, + share, + common, + recipient_key, + } = vid_disperse2; + + Self { + view_number, + payload_commitment, + share, + common, + recipient_key, + } + } +} + +impl From> for VidDisperseShare2 { + fn from(vid_disperse: VidDisperseShare) -> Self { + let VidDisperseShare { + view_number, + payload_commitment, + share, + common, + recipient_key, + } = vid_disperse; + + Self { + view_number, + epoch: TYPES::Epoch::new(0), + payload_commitment, + share, + common, + recipient_key, + } + } +} + +impl VidDisperseShare2 { /// Create a vector of `VidDisperseShare` from `VidDisperse` pub fn from_vid_disperse(vid_disperse: VidDisperse) -> Vec { let epoch = vid_disperse.epoch; vid_disperse .shares .into_iter() - .map(|(recipient_key, share)| VidDisperseShare { + .map(|(recipient_key, share)| Self { share, recipient_key, view_number: vid_disperse.view_number, @@ -325,7 +502,7 @@ impl VidDisperseShare { /// Create `VidDisperse` out of an iterator to `VidDisperseShare`s pub fn to_vid_disperse<'a, I>(mut it: I) -> Option> where - I: Iterator>, + I: Iterator, { let first_vid_disperse_share = it.next()?.clone(); let epoch = first_vid_disperse_share.epoch; @@ -336,10 +513,10 @@ impl VidDisperseShare { ); let mut vid_disperse = VidDisperse { view_number: first_vid_disperse_share.view_number, + epoch, payload_commitment: first_vid_disperse_share.payload_commitment, common: first_vid_disperse_share.common, shares: share_map, - epoch, }; let _ = it.map(|vid_disperse_share| { vid_disperse.shares.insert( @@ -353,14 +530,14 @@ impl VidDisperseShare { /// Split a VID share proposal into a proposal for each recipient. pub fn to_vid_share_proposals( vid_disperse_proposal: Proposal>, - ) -> Vec>> { + ) -> Vec> { let epoch = vid_disperse_proposal.data.epoch; vid_disperse_proposal .data .shares .into_iter() .map(|(recipient_key, share)| Proposal { - data: VidDisperseShare { + data: Self { share, recipient_key, view_number: vid_disperse_proposal.data.view_number, @@ -408,9 +585,6 @@ pub struct QuorumProposal2 { /// view number for the proposal pub view_number: TYPES::View, - /// Epoch this proposal applies to - pub epoch: TYPES::Epoch, - /// certificate that the proposal is chaining from pub justify_qc: QuorumCertificate2, @@ -441,7 +615,6 @@ impl From> for QuorumProposal2 { Self { block_header: quorum_proposal.block_header, view_number: quorum_proposal.view_number, - epoch: TYPES::Epoch::genesis(), justify_qc: quorum_proposal.justify_qc.to_qc2(), next_epoch_justify_qc: None, upgrade_certificate: quorum_proposal.upgrade_certificate, @@ -453,13 +626,13 @@ impl From> for QuorumProposal2 { } impl From> for QuorumProposal { - fn from(quorum_proposal: QuorumProposal2) -> Self { + fn from(quorum_proposal2: QuorumProposal2) -> Self { Self { - block_header: quorum_proposal.block_header, - view_number: quorum_proposal.view_number, - justify_qc: quorum_proposal.justify_qc.to_qc(), - upgrade_certificate: quorum_proposal.upgrade_certificate, - proposal_certificate: quorum_proposal.view_change_evidence, + block_header: quorum_proposal2.block_header, + view_number: quorum_proposal2.view_number, + justify_qc: quorum_proposal2.justify_qc.to_qc(), + upgrade_certificate: quorum_proposal2.upgrade_certificate, + proposal_certificate: quorum_proposal2.view_change_evidence, } } } @@ -490,6 +663,12 @@ impl HasViewNumber for DaProposal { } } +impl HasViewNumber for DaProposal2 { + fn view_number(&self) -> TYPES::View { + self.view_number + } +} + impl HasViewNumber for VidDisperse { fn view_number(&self) -> TYPES::View { self.view_number @@ -502,6 +681,12 @@ impl HasViewNumber for VidDisperseShare { } } +impl HasViewNumber for VidDisperseShare2 { + fn view_number(&self) -> TYPES::View { + self.view_number + } +} + impl HasViewNumber for QuorumProposal { fn view_number(&self) -> TYPES::View { self.view_number @@ -521,11 +706,9 @@ impl HasViewNumber for UpgradeProposal { } impl_has_epoch!( - QuorumProposal2, - DaProposal, - UpgradeProposal, + DaProposal2, VidDisperse, - VidDisperseShare + VidDisperseShare2 ); /// The error type for block and its transactions. @@ -804,31 +987,13 @@ impl Leaf2 { impl Committable for Leaf2 { fn commit(&self) -> committable::Commitment { - let part_commit = if *self.epoch == 0 { - RawCommitmentBuilder::new("leaf commitment").u64_field("view number", *self.view_number) - } else { - RawCommitmentBuilder::new("leaf commitment") - .u64_field("view number", *self.view_number) - .u64_field("epoch number", *self.epoch) - .optional("next epoch justify qc", &self.next_epoch_justify_qc) - }; - if self.drb_seed == [0; 32] && self.drb_result == [0; 32] { - part_commit - .field("parent leaf commitment", self.parent_commitment) - .field("block header", self.block_header.commit()) - .field("justify qc", self.justify_qc.commit()) - .optional("upgrade certificate", &self.upgrade_certificate) - .finalize() - } else { - part_commit - .field("parent leaf commitment", self.parent_commitment) - .field("block header", self.block_header.commit()) - .field("justify qc", self.justify_qc.commit()) - .optional("upgrade certificate", &self.upgrade_certificate) - .fixed_size_bytes(&self.drb_seed) - .fixed_size_bytes(&self.drb_result) - .finalize() - } + RawCommitmentBuilder::new("leaf commitment") + .u64_field("view number", *self.view_number) + .field("parent leaf commitment", self.parent_commitment) + .field("block header", self.block_header.commit()) + .field("justify qc", self.justify_qc.commit()) + .optional("upgrade certificate", &self.upgrade_certificate) + .finalize() } } @@ -1237,7 +1402,6 @@ impl Leaf2 { // The point of this match is that we will get a compile-time error if we add a field without updating this. let QuorumProposal2 { view_number, - epoch, justify_qc, next_epoch_justify_qc, block_header, @@ -1249,7 +1413,10 @@ impl Leaf2 { Self { view_number: *view_number, - epoch: *epoch, + epoch: TYPES::Epoch::new(epoch_from_block_number( + quorum_proposal.block_header.block_number(), + TYPES::EPOCH_HEIGHT, + )), justify_qc: justify_qc.clone(), next_epoch_justify_qc: next_epoch_justify_qc.clone(), parent_commitment: justify_qc.data().leaf_commit, @@ -1382,6 +1549,9 @@ pub struct PackedBundle { /// The view number that this block is associated with. pub view_number: TYPES::View, + /// The view number that this block is associated with. + pub epoch_number: TYPES::Epoch, + /// The sequencing fee for submitting bundles. pub sequencing_fees: Vec1>, @@ -1398,6 +1568,7 @@ impl PackedBundle { encoded_transactions: Arc<[u8]>, metadata: >::Metadata, view_number: TYPES::View, + epoch_number: TYPES::Epoch, sequencing_fees: Vec1>, vid_precompute: Option, auction_result: Option, @@ -1406,6 +1577,7 @@ impl PackedBundle { encoded_transactions, metadata, view_number, + epoch_number, sequencing_fees, vid_precompute, auction_result, diff --git a/crates/types/src/event.rs b/crates/types/src/event.rs index c4ae586866..ae66da6d6d 100644 --- a/crates/types/src/event.rs +++ b/crates/types/src/event.rs @@ -11,12 +11,13 @@ use std::sync::Arc; use serde::{Deserialize, Serialize}; use crate::{ - data::{DaProposal, Leaf2, QuorumProposal2, UpgradeProposal, VidDisperseShare}, + data::{DaProposal2, Leaf2, QuorumProposal2, UpgradeProposal, VidDisperseShare2}, error::HotShotError, message::Proposal, simple_certificate::QuorumCertificate2, traits::{node_implementation::NodeType, ValidatedState}, }; + /// A status event emitted by a `HotShot` instance /// /// This includes some metadata, such as the stage and view number that the event was generated in, @@ -41,7 +42,7 @@ pub struct LeafInfo { /// Optional application-specific state delta. pub delta: Option::ValidatedState as ValidatedState>::Delta>>, /// Optional VID share data. - pub vid_share: Option>, + pub vid_share: Option>, } impl LeafInfo { @@ -50,7 +51,7 @@ impl LeafInfo { leaf: Leaf2, state: Arc<::ValidatedState>, delta: Option::ValidatedState as ValidatedState>::Delta>>, - vid_share: Option>, + vid_share: Option>, ) -> Self { Self { leaf, @@ -151,7 +152,7 @@ pub enum EventType { /// or submitted to the network by us DaProposal { /// Contents of the proposal - proposal: Proposal>, + proposal: Proposal>, /// Public key of the leader submitting the proposal sender: TYPES::SignatureKey, }, diff --git a/crates/types/src/message.rs b/crates/types/src/message.rs index b7259d3408..0f36bae2de 100644 --- a/crates/types/src/message.rs +++ b/crates/types/src/message.rs @@ -26,16 +26,19 @@ use vbs::{ use crate::{ data::{ - DaProposal, Leaf, Leaf2, QuorumProposal, QuorumProposal2, UpgradeProposal, VidDisperseShare, + DaProposal, DaProposal2, Leaf, Leaf2, QuorumProposal, QuorumProposal2, UpgradeProposal, + VidDisperseShare, VidDisperseShare2, }, request_response::ProposalRequestPayload, simple_certificate::{ - DaCertificate, QuorumCertificate2, UpgradeCertificate, ViewSyncCommitCertificate2, - ViewSyncFinalizeCertificate2, ViewSyncPreCommitCertificate2, + DaCertificate, DaCertificate2, QuorumCertificate2, UpgradeCertificate, + ViewSyncCommitCertificate, ViewSyncCommitCertificate2, ViewSyncFinalizeCertificate, + ViewSyncFinalizeCertificate2, ViewSyncPreCommitCertificate, ViewSyncPreCommitCertificate2, }, simple_vote::{ - DaVote, QuorumVote, QuorumVote2, TimeoutVote, UpgradeVote, ViewSyncCommitVote, - ViewSyncFinalizeVote, ViewSyncPreCommitVote, + DaVote, DaVote2, QuorumVote, QuorumVote2, TimeoutVote, TimeoutVote2, UpgradeVote, + ViewSyncCommitVote, ViewSyncCommitVote2, ViewSyncFinalizeVote, ViewSyncFinalizeVote2, + ViewSyncPreCommitVote, ViewSyncPreCommitVote2, }, traits::{ block_contents::BlockHeader, @@ -184,13 +187,13 @@ pub enum GeneralConsensusMessage { ViewSyncFinalizeVote(ViewSyncFinalizeVote), /// Message with a view sync pre-commit certificate - ViewSyncPreCommitCertificate(ViewSyncPreCommitCertificate2), + ViewSyncPreCommitCertificate(ViewSyncPreCommitCertificate), /// Message with a view sync commit certificate - ViewSyncCommitCertificate(ViewSyncCommitCertificate2), + ViewSyncCommitCertificate(ViewSyncCommitCertificate), /// Message with a view sync finalize certificate - ViewSyncFinalizeCertificate(ViewSyncFinalizeCertificate2), + ViewSyncFinalizeCertificate(ViewSyncFinalizeCertificate), /// Message with a Timeout vote TimeoutVote(TimeoutVote), @@ -221,6 +224,27 @@ pub enum GeneralConsensusMessage { /// Message for the next leader containing our highest QC HighQc(QuorumCertificate2), + + /// Message with a view sync pre-commit vote + ViewSyncPreCommitVote2(ViewSyncPreCommitVote2), + + /// Message with a view sync commit vote + ViewSyncCommitVote2(ViewSyncCommitVote2), + + /// Message with a view sync finalize vote + ViewSyncFinalizeVote2(ViewSyncFinalizeVote2), + + /// Message with a view sync pre-commit certificate + ViewSyncPreCommitCertificate2(ViewSyncPreCommitCertificate2), + + /// Message with a view sync commit certificate + ViewSyncCommitCertificate2(ViewSyncCommitCertificate2), + + /// Message with a view sync finalize certificate + ViewSyncFinalizeCertificate2(ViewSyncFinalizeCertificate2), + + /// Message with a Timeout vote + TimeoutVote2(TimeoutVote2), } #[derive(Deserialize, Serialize, Clone, Debug, PartialEq, Hash, Eq)] @@ -240,6 +264,20 @@ pub enum DaConsensusMessage { /// /// Like [`DaProposal`]. Use `Msg` suffix to distinguish from `VidDisperse`. VidDisperseMsg(Proposal>), + + /// Proposal for data availability committee + DaProposal2(Proposal>), + + /// vote for data availability committee + DaVote2(DaVote2), + + /// Certificate data is available + DaCertificate2(DaCertificate2), + + /// Initiate VID dispersal. + /// + /// Like [`DaProposal`]. Use `Msg` suffix to distinguish from `VidDisperse`. + VidDisperseMsg2(Proposal>), } /// Messages for sequencing consensus. @@ -293,6 +331,23 @@ impl SequencingMessage { GeneralConsensusMessage::ViewSyncFinalizeCertificate(message) => { message.view_number() } + GeneralConsensusMessage::TimeoutVote2(message) => message.view_number(), + GeneralConsensusMessage::ViewSyncPreCommitVote2(message) => { + message.view_number() + } + GeneralConsensusMessage::ViewSyncCommitVote2(message) => message.view_number(), + GeneralConsensusMessage::ViewSyncFinalizeVote2(message) => { + message.view_number() + } + GeneralConsensusMessage::ViewSyncPreCommitCertificate2(message) => { + message.view_number() + } + GeneralConsensusMessage::ViewSyncCommitCertificate2(message) => { + message.view_number() + } + GeneralConsensusMessage::ViewSyncFinalizeCertificate2(message) => { + message.view_number() + } GeneralConsensusMessage::UpgradeProposal(message) => message.data.view_number(), GeneralConsensusMessage::UpgradeVote(message) => message.view_number(), GeneralConsensusMessage::HighQc(qc) => qc.view_number(), @@ -308,6 +363,14 @@ impl SequencingMessage { DaConsensusMessage::DaVote(vote_message) => vote_message.view_number(), DaConsensusMessage::DaCertificate(cert) => cert.view_number, DaConsensusMessage::VidDisperseMsg(disperse) => disperse.data.view_number(), + DaConsensusMessage::VidDisperseMsg2(disperse) => disperse.data.view_number(), + DaConsensusMessage::DaProposal2(p) => { + // view of leader in the leaf when proposal + // this should match replica upon receipt + p.data.view_number() + } + DaConsensusMessage::DaVote2(vote_message) => vote_message.view_number(), + DaConsensusMessage::DaCertificate2(cert) => cert.view_number, } } } diff --git a/crates/types/src/simple_certificate.rs b/crates/types/src/simple_certificate.rs index 722da99ae2..5ea857ed21 100644 --- a/crates/types/src/simple_certificate.rs +++ b/crates/types/src/simple_certificate.rs @@ -20,14 +20,14 @@ use primitive_types::U256; use serde::{Deserialize, Serialize}; use utils::anytrace::*; -use crate::simple_vote::NextEpochQuorumData2; use crate::{ data::serialize_signature2, message::UpgradeLock, simple_vote::{ - DaData, QuorumData, QuorumData2, QuorumMarker, TimeoutData, UpgradeProposalData, - VersionedVoteData, ViewSyncCommitData, ViewSyncFinalizeData, ViewSyncPreCommitData, - Voteable, + DaData, DaData2, NextEpochQuorumData2, QuorumData, QuorumData2, QuorumMarker, TimeoutData, + TimeoutData2, UpgradeProposalData, VersionedVoteData, ViewSyncCommitData, + ViewSyncCommitData2, ViewSyncFinalizeData, ViewSyncFinalizeData2, ViewSyncPreCommitData, + ViewSyncPreCommitData2, Voteable, }, traits::{ election::Membership, @@ -142,14 +142,14 @@ impl + Committable, THRESHOLD: Thresh } } -impl> Certificate> - for SimpleCertificate, THRESHOLD> +impl> Certificate + for SimpleCertificate { - type Voteable = DaData; + type Voteable = DaData; type Threshold = THRESHOLD; fn create_signed_certificate( - vote_commitment: Commitment, V>>, + vote_commitment: Commitment>, data: Self::Voteable, sig: ::QcType, view: TYPES::View, @@ -221,7 +221,95 @@ impl> Certificate( &self, upgrade_lock: &UpgradeLock, - ) -> Result, V>>> { + ) -> Result>> { + Ok( + VersionedVoteData::new(self.data.clone(), self.view_number, upgrade_lock) + .await? + .commit(), + ) + } +} + +impl> Certificate> + for SimpleCertificate, THRESHOLD> +{ + type Voteable = DaData2; + type Threshold = THRESHOLD; + + fn create_signed_certificate( + vote_commitment: Commitment, V>>, + data: Self::Voteable, + sig: ::QcType, + view: TYPES::View, + ) -> Self { + let vote_commitment_bytes: [u8; 32] = vote_commitment.into(); + + SimpleCertificate { + data, + vote_commitment: Commitment::from_raw(vote_commitment_bytes), + view_number: view, + signatures: Some(sig), + _pd: PhantomData, + } + } + async fn is_valid_cert( + &self, + stake_table: Vec<::StakeTableEntry>, + threshold: NonZeroU64, + upgrade_lock: &UpgradeLock, + ) -> bool { + if self.view_number == TYPES::View::genesis() { + return true; + } + let real_qc_pp = ::public_parameter( + stake_table, + U256::from(u64::from(threshold)), + ); + let Ok(commit) = self.data_commitment(upgrade_lock).await else { + return false; + }; + ::check( + &real_qc_pp, + commit.as_ref(), + self.signatures.as_ref().unwrap(), + ) + } + /// Proxy's to `Membership.stake` + fn stake_table_entry>( + membership: &MEMBERSHIP, + pub_key: &TYPES::SignatureKey, + epoch: TYPES::Epoch, + ) -> Option<::StakeTableEntry> { + membership.da_stake(pub_key, epoch) + } + + /// Proxy's to `Membership.da_stake_table` + fn stake_table>( + membership: &MEMBERSHIP, + epoch: TYPES::Epoch, + ) -> Vec<::StakeTableEntry> { + membership.da_stake_table(epoch) + } + /// Proxy's to `Membership.da_total_nodes` + fn total_nodes>( + membership: &MEMBERSHIP, + epoch: TYPES::Epoch, + ) -> usize { + membership.da_total_nodes(epoch) + } + fn threshold>( + membership: &MEMBERSHIP, + epoch: TYPES::Epoch, + ) -> u64 { + membership.da_success_threshold(epoch).into() + } + fn data(&self) -> &Self::Voteable { + &self.data + } + async fn data_commitment( + &self, + upgrade_lock: &UpgradeLock, + ) -> Result, V>>> { Ok( VersionedVoteData::new(self.data.clone(), self.view_number, upgrade_lock) .await? @@ -433,6 +521,217 @@ impl QuorumCertificate2 { } } +impl DaCertificate { + /// Convert a `DaCertificate` into a `DaCertificate2` + pub fn to_dac2(self) -> DaCertificate2 { + let data = DaData2 { + payload_commit: self.data.payload_commit, + epoch: TYPES::Epoch::new(0), + }; + + let bytes: [u8; 32] = self.vote_commitment.into(); + let vote_commitment = Commitment::from_raw(bytes); + + SimpleCertificate { + data, + vote_commitment, + view_number: self.view_number, + signatures: self.signatures.clone(), + _pd: PhantomData, + } + } +} + +impl DaCertificate2 { + /// Convert a `DaCertificate` into a `DaCertificate2` + pub fn to_dac(self) -> DaCertificate { + let data = DaData { + payload_commit: self.data.payload_commit, + }; + + let bytes: [u8; 32] = self.vote_commitment.into(); + let vote_commitment = Commitment::from_raw(bytes); + + SimpleCertificate { + data, + vote_commitment, + view_number: self.view_number, + signatures: self.signatures.clone(), + _pd: PhantomData, + } + } +} + +impl ViewSyncPreCommitCertificate { + /// Convert a `DaCertificate` into a `DaCertificate2` + pub fn to_vsc2(self) -> ViewSyncPreCommitCertificate2 { + let data = ViewSyncPreCommitData2 { + relay: self.data.relay, + round: self.data.round, + epoch: TYPES::Epoch::new(0), + }; + + let bytes: [u8; 32] = self.vote_commitment.into(); + let vote_commitment = Commitment::from_raw(bytes); + + SimpleCertificate { + data, + vote_commitment, + view_number: self.view_number, + signatures: self.signatures.clone(), + _pd: PhantomData, + } + } +} + +impl ViewSyncPreCommitCertificate2 { + /// Convert a `DaCertificate` into a `DaCertificate2` + pub fn to_vsc(self) -> ViewSyncPreCommitCertificate { + let data = ViewSyncPreCommitData { + relay: self.data.relay, + round: self.data.round, + }; + + let bytes: [u8; 32] = self.vote_commitment.into(); + let vote_commitment = Commitment::from_raw(bytes); + + SimpleCertificate { + data, + vote_commitment, + view_number: self.view_number, + signatures: self.signatures.clone(), + _pd: PhantomData, + } + } +} + +impl ViewSyncCommitCertificate { + /// Convert a `DaCertificate` into a `DaCertificate2` + pub fn to_vsc2(self) -> ViewSyncCommitCertificate2 { + let data = ViewSyncCommitData2 { + relay: self.data.relay, + round: self.data.round, + epoch: TYPES::Epoch::new(0), + }; + + let bytes: [u8; 32] = self.vote_commitment.into(); + let vote_commitment = Commitment::from_raw(bytes); + + SimpleCertificate { + data, + vote_commitment, + view_number: self.view_number, + signatures: self.signatures.clone(), + _pd: PhantomData, + } + } +} + +impl ViewSyncCommitCertificate2 { + /// Convert a `DaCertificate` into a `DaCertificate2` + pub fn to_vsc(self) -> ViewSyncCommitCertificate { + let data = ViewSyncCommitData { + relay: self.data.relay, + round: self.data.round, + }; + + let bytes: [u8; 32] = self.vote_commitment.into(); + let vote_commitment = Commitment::from_raw(bytes); + + SimpleCertificate { + data, + vote_commitment, + view_number: self.view_number, + signatures: self.signatures.clone(), + _pd: PhantomData, + } + } +} + +impl ViewSyncFinalizeCertificate { + /// Convert a `DaCertificate` into a `DaCertificate2` + pub fn to_vsc2(self) -> ViewSyncFinalizeCertificate2 { + let data = ViewSyncFinalizeData2 { + relay: self.data.relay, + round: self.data.round, + epoch: TYPES::Epoch::new(0), + }; + + let bytes: [u8; 32] = self.vote_commitment.into(); + let vote_commitment = Commitment::from_raw(bytes); + + SimpleCertificate { + data, + vote_commitment, + view_number: self.view_number, + signatures: self.signatures.clone(), + _pd: PhantomData, + } + } +} + +impl ViewSyncFinalizeCertificate2 { + /// Convert a `DaCertificate` into a `DaCertificate2` + pub fn to_vsc(self) -> ViewSyncFinalizeCertificate { + let data = ViewSyncFinalizeData { + relay: self.data.relay, + round: self.data.round, + }; + + let bytes: [u8; 32] = self.vote_commitment.into(); + let vote_commitment = Commitment::from_raw(bytes); + + SimpleCertificate { + data, + vote_commitment, + view_number: self.view_number, + signatures: self.signatures.clone(), + _pd: PhantomData, + } + } +} + +impl TimeoutCertificate { + /// Convert a `DaCertificate` into a `DaCertificate2` + pub fn to_vsc2(self) -> TimeoutCertificate2 { + let data = TimeoutData2 { + view: self.data.view, + epoch: TYPES::Epoch::new(0), + }; + + let bytes: [u8; 32] = self.vote_commitment.into(); + let vote_commitment = Commitment::from_raw(bytes); + + SimpleCertificate { + data, + vote_commitment, + view_number: self.view_number, + signatures: self.signatures.clone(), + _pd: PhantomData, + } + } +} + +impl TimeoutCertificate2 { + /// Convert a `DaCertificate` into a `DaCertificate2` + pub fn to_vsc(self) -> TimeoutCertificate { + let data = TimeoutData { + view: self.data.view, + }; + + let bytes: [u8; 32] = self.vote_commitment.into(); + let vote_commitment = Commitment::from_raw(bytes); + + SimpleCertificate { + data, + vote_commitment, + view_number: self.view_number, + signatures: self.signatures.clone(), + _pd: PhantomData, + } + } +} + /// Type alias for a `QuorumCertificate`, which is a `SimpleCertificate` over `QuorumData` pub type QuorumCertificate = SimpleCertificate, SuccessThreshold>; /// Type alias for a `QuorumCertificate2`, which is a `SimpleCertificate` over `QuorumData2` @@ -440,19 +739,33 @@ pub type QuorumCertificate2 = SimpleCertificate /// Type alias for a `QuorumCertificate2`, which is a `SimpleCertificate` over `QuorumData2` pub type NextEpochQuorumCertificate2 = SimpleCertificate, SuccessThreshold>; -/// Type alias for a DA certificate over `DaData` -pub type DaCertificate = SimpleCertificate, SuccessThreshold>; +/// Type alias for a `DaCertificate`, which is a `SimpleCertificate` over `DaData` +pub type DaCertificate = SimpleCertificate; +/// Type alias for a `DaCertificate2`, which is a `SimpleCertificate` over `DaData2` +pub type DaCertificate2 = SimpleCertificate, SuccessThreshold>; /// Type alias for a Timeout certificate over a view number pub type TimeoutCertificate = SimpleCertificate, SuccessThreshold>; +/// Type alias for a `TimeoutCertificate2`, which is a `SimpleCertificate` over `TimeoutData2` +pub type TimeoutCertificate2 = + SimpleCertificate, SuccessThreshold>; /// Type alias for a `ViewSyncPreCommit` certificate over a view number -pub type ViewSyncPreCommitCertificate2 = +pub type ViewSyncPreCommitCertificate = SimpleCertificate, OneHonestThreshold>; +/// Type alias for a `ViewSyncPreCommitCertificate2`, which is a `SimpleCertificate` over `ViewSyncPreCommitData2` +pub type ViewSyncPreCommitCertificate2 = + SimpleCertificate, OneHonestThreshold>; /// Type alias for a `ViewSyncCommit` certificate over a view number -pub type ViewSyncCommitCertificate2 = +pub type ViewSyncCommitCertificate = SimpleCertificate, SuccessThreshold>; +/// Type alias for a `ViewSyncCommitCertificate2`, which is a `SimpleCertificate` over `ViewSyncCommitData2` +pub type ViewSyncCommitCertificate2 = + SimpleCertificate, SuccessThreshold>; /// Type alias for a `ViewSyncFinalize` certificate over a view number -pub type ViewSyncFinalizeCertificate2 = +pub type ViewSyncFinalizeCertificate = SimpleCertificate, SuccessThreshold>; +/// Type alias for a `ViewSyncFinalizeCertificate2`, which is a `SimpleCertificate` over `ViewSyncFinalizeData2` +pub type ViewSyncFinalizeCertificate2 = + SimpleCertificate, SuccessThreshold>; /// Type alias for a `UpgradeCertificate`, which is a `SimpleCertificate` of `UpgradeProposalData` pub type UpgradeCertificate = SimpleCertificate, UpgradeThreshold>; diff --git a/crates/types/src/simple_vote.rs b/crates/types/src/simple_vote.rs index a844265122..f75d451914 100644 --- a/crates/types/src/simple_vote.rs +++ b/crates/types/src/simple_vote.rs @@ -52,20 +52,18 @@ pub struct QuorumData2 { #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Hash, Eq)] #[serde(bound(deserialize = ""))] pub struct NextEpochQuorumData2(QuorumData2); -// #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Hash, Eq)] -// #[serde(bound(deserialize = ""))] -// pub struct NextEpochQuorumData2 { -// /// Commitment to the leaf -// pub leaf_commit: Commitment>, -// /// An epoch to which the data belongs to. Relevant for validating against the correct stake table -// pub epoch: TYPES::Epoch, -// } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Hash, Eq)] /// Data used for a DA vote. -pub struct DaData { +pub struct DaData { /// Commitment to a block payload pub payload_commit: VidCommitment, - /// An epoch to which the data belongs to. Relevant for validating against the correct stake table +} +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Hash, Eq)] +/// Data used for a DA vote. +pub struct DaData2 { + /// Commitment to a block payload + pub payload_commit: VidCommitment, + /// Epoch number pub epoch: TYPES::Epoch, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Hash, Eq)] @@ -73,10 +71,15 @@ pub struct DaData { pub struct TimeoutData { /// View the timeout is for pub view: TYPES::View, - /// An epoch to which the data belongs to. Relevant for validating against the correct stake table +} +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Hash, Eq)] +/// Data used for a timeout vote. +pub struct TimeoutData2 { + /// View the timeout is for + pub view: TYPES::View, + /// Epoch number pub epoch: TYPES::Epoch, } - #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Hash, Eq)] /// Data used for a Pre Commit vote. pub struct ViewSyncPreCommitData { @@ -84,7 +87,15 @@ pub struct ViewSyncPreCommitData { pub relay: u64, /// The view number we are trying to sync on pub round: TYPES::View, - /// An epoch to which the data belongs to. Relevant for validating against the correct stake table +} +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Hash, Eq)] +/// Data used for a Pre Commit vote. +pub struct ViewSyncPreCommitData2 { + /// The relay this vote is intended for + pub relay: u64, + /// The view number we are trying to sync on + pub round: TYPES::View, + /// Epoch number pub epoch: TYPES::Epoch, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Hash, Eq)] @@ -94,7 +105,15 @@ pub struct ViewSyncCommitData { pub relay: u64, /// The view number we are trying to sync on pub round: TYPES::View, - /// An epoch to which the data belongs to. Relevant for validating against the correct stake table +} +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Hash, Eq)] +/// Data used for a Commit vote. +pub struct ViewSyncCommitData2 { + /// The relay this vote is intended for + pub relay: u64, + /// The view number we are trying to sync on + pub round: TYPES::View, + /// Epoch number pub epoch: TYPES::Epoch, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Hash, Eq)] @@ -104,7 +123,15 @@ pub struct ViewSyncFinalizeData { pub relay: u64, /// The view number we are trying to sync on pub round: TYPES::View, - /// An epoch to which the data belongs to. Relevant for validating against the correct stake table +} +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Hash, Eq)] +/// Data used for a Finalize vote. +pub struct ViewSyncFinalizeData2 { + /// The relay this vote is intended for + pub relay: u64, + /// The view number we are trying to sync on + pub round: TYPES::View, + /// Epoch number pub epoch: TYPES::Epoch, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Hash, Eq)] @@ -123,7 +150,17 @@ pub struct UpgradeProposalData { pub old_version_last_view: TYPES::View, /// The first block for which the new version will be in effect. pub new_version_first_view: TYPES::View, - /// An epoch to which the data belongs to. Relevant for validating against the correct stake table +} + +/// Data used for an upgrade once epochs are implemented +pub struct UpgradeData2 { + /// The old version that we are upgrading from + pub old_version: Version, + /// The new version that we are upgrading to + pub new_version: Version, + /// A unique identifier for the specific protocol being voted on + pub hash: Vec, + /// The first epoch in which the upgrade will be in effect pub epoch: TYPES::Epoch, } @@ -160,9 +197,13 @@ impl QuorumMarker for QuorumData {} impl QuorumMarker for QuorumData2 {} impl QuorumMarker for NextEpochQuorumData2 {} impl QuorumMarker for TimeoutData {} +impl QuorumMarker for TimeoutData2 {} impl QuorumMarker for ViewSyncPreCommitData {} impl QuorumMarker for ViewSyncCommitData {} impl QuorumMarker for ViewSyncFinalizeData {} +impl QuorumMarker for ViewSyncPreCommitData2 {} +impl QuorumMarker for ViewSyncCommitData2 {} +impl QuorumMarker for ViewSyncFinalizeData2 {} impl QuorumMarker for UpgradeProposalData {} /// A simple yes vote over some votable type. @@ -314,31 +355,22 @@ impl Committable for QuorumData { impl Committable for QuorumData2 { fn commit(&self) -> Commitment { - if *self.epoch == 0 { - committable::RawCommitmentBuilder::new("Quorum data") - .var_size_bytes(self.leaf_commit.as_ref()) - .finalize() - } else { - committable::RawCommitmentBuilder::new("Quorum data") - .var_size_bytes(self.leaf_commit.as_ref()) - .u64(*self.epoch) - .finalize() - } + let QuorumData2 { + leaf_commit, + epoch: _, + } = self; + + committable::RawCommitmentBuilder::new("Quorum data") + .var_size_bytes(leaf_commit.as_ref()) + .finalize() } } impl Committable for NextEpochQuorumData2 { fn commit(&self) -> Commitment { - if *self.epoch == 0 { - committable::RawCommitmentBuilder::new("Quorum data") - .var_size_bytes(self.leaf_commit.as_ref()) - .finalize() - } else { - committable::RawCommitmentBuilder::new("Quorum data") - .var_size_bytes(self.leaf_commit.as_ref()) - .u64(*self.epoch) - .finalize() - } + committable::RawCommitmentBuilder::new("Quorum data") + .var_size_bytes(self.leaf_commit.as_ref()) + .finalize() } } @@ -346,16 +378,37 @@ impl Committable for TimeoutData { fn commit(&self) -> Commitment { committable::RawCommitmentBuilder::new("Timeout data") .u64(*self.view) - .u64(*self.epoch) .finalize() } } -impl Committable for DaData { +impl Committable for TimeoutData2 { + fn commit(&self) -> Commitment { + let TimeoutData2 { view, epoch: _ } = self; + + committable::RawCommitmentBuilder::new("Timeout data") + .u64(**view) + .finalize() + } +} + +impl Committable for DaData { fn commit(&self) -> Commitment { committable::RawCommitmentBuilder::new("DA data") .var_size_bytes(self.payload_commit.as_ref()) - .u64(*self.epoch) + .finalize() + } +} + +impl Committable for DaData2 { + fn commit(&self) -> Commitment { + let DaData2 { + payload_commit, + epoch: _, + } = self; + + committable::RawCommitmentBuilder::new("DA data") + .var_size_bytes(payload_commit.as_ref()) .finalize() } } @@ -372,7 +425,26 @@ impl Committable for UpgradeProposalData { .u16(self.new_version.major) .u16(self.old_version.minor) .u16(self.old_version.major) - .u64(*self.epoch) + .finalize() + } +} + +impl Committable for UpgradeData2 { + fn commit(&self) -> Commitment { + let UpgradeData2 { + old_version, + new_version, + hash, + epoch, + } = self; + + committable::RawCommitmentBuilder::new("Upgrade data") + .u16(old_version.minor) + .u16(old_version.major) + .u16(new_version.minor) + .u16(new_version.major) + .var_size_bytes(hash.as_slice()) + .u64(**epoch) .finalize() } } @@ -381,37 +453,63 @@ impl Committable for UpgradeProposalData { fn view_and_relay_commit( view: TYPES::View, relay: u64, - epoch: TYPES::Epoch, tag: &str, ) -> Commitment { let builder = committable::RawCommitmentBuilder::new(tag); - builder.u64(*view).u64(relay).u64(*epoch).finalize() + builder.u64(*view).u64(relay).finalize() } impl Committable for ViewSyncPreCommitData { fn commit(&self) -> Commitment { - view_and_relay_commit::( - self.round, - self.relay, - self.epoch, - "View Sync Precommit", - ) + view_and_relay_commit::(self.round, self.relay, "View Sync Precommit") + } +} + +impl Committable for ViewSyncPreCommitData2 { + fn commit(&self) -> Commitment { + let ViewSyncPreCommitData2 { + relay, + round, + epoch: _, + } = self; + + view_and_relay_commit::(*round, *relay, "View Sync Precommit") } } impl Committable for ViewSyncFinalizeData { fn commit(&self) -> Commitment { - view_and_relay_commit::( - self.round, - self.relay, - self.epoch, - "View Sync Finalize", - ) + view_and_relay_commit::(self.round, self.relay, "View Sync Finalize") } } + +impl Committable for ViewSyncFinalizeData2 { + fn commit(&self) -> Commitment { + let ViewSyncFinalizeData2 { + relay, + round, + epoch: _, + } = self; + + view_and_relay_commit::(*round, *relay, "View Sync Finalize") + } +} + impl Committable for ViewSyncCommitData { fn commit(&self) -> Commitment { - view_and_relay_commit::(self.round, self.relay, self.epoch, "View Sync Commit") + view_and_relay_commit::(self.round, self.relay, "View Sync Commit") + } +} + +impl Committable for ViewSyncCommitData2 { + fn commit(&self) -> Commitment { + let ViewSyncCommitData2 { + relay, + round, + epoch: _, + } = self; + + view_and_relay_commit::(*round, *relay, "View Sync Commit") } } @@ -438,40 +536,22 @@ macro_rules! impl_has_epoch { impl_has_epoch!( QuorumData2, NextEpochQuorumData2, - DaData, - TimeoutData, - ViewSyncPreCommitData, - ViewSyncCommitData, - ViewSyncFinalizeData, - UpgradeProposalData + DaData2, + TimeoutData2, + ViewSyncPreCommitData2, + ViewSyncCommitData2, + ViewSyncFinalizeData2 ); -/// Helper macro for trivial implementation of the `HasEpoch` trait for a vote type -#[macro_export] -macro_rules! impl_vote_has_epoch { - ($($t:ty),*) => { - $( - impl HasEpoch for $t { - fn epoch(&self) -> TYPES::Epoch { - self.data.epoch() - } - } - )* - }; +impl + HasEpoch> HasEpoch + for SimpleVote +{ + fn epoch(&self) -> TYPES::Epoch { + self.data.epoch() + } } -impl_vote_has_epoch!( - QuorumVote2, - NextEpochQuorumVote2, - DaVote, - TimeoutVote, - ViewSyncPreCommitVote, - ViewSyncCommitVote, - ViewSyncFinalizeVote, - UpgradeVote -); - -// impl votable for all the data types in this file sealed marker should ensure nothing is accidently +// impl votable for all the data types in this file sealed marker should ensure nothing is accidentally // implemented for structs that aren't "voteable" impl< TYPES: NodeType, @@ -536,7 +616,189 @@ impl QuorumVote2 { } } +impl DaVote { + /// Convert a `QuorumVote` to a `QuorumVote2` + pub fn to_vote2(self) -> DaVote2 { + let signature = self.signature; + let data = DaData2 { + payload_commit: self.data.payload_commit, + epoch: TYPES::Epoch::new(0), + }; + let view_number = self.view_number; + + SimpleVote { + signature, + data, + view_number, + } + } +} + +impl DaVote2 { + /// Convert a `QuorumVote2` to a `QuorumVote` + pub fn to_vote(self) -> DaVote { + let signature = self.signature; + let data = DaData { + payload_commit: self.data.payload_commit, + }; + let view_number = self.view_number; + + SimpleVote { + signature, + data, + view_number, + } + } +} + +impl TimeoutVote { + /// Convert a `TimeoutVote` to a `TimeoutVote2` + pub fn to_vote2(self) -> TimeoutVote2 { + let signature = self.signature; + let data = TimeoutData2 { + view: self.data.view, + epoch: TYPES::Epoch::new(0), + }; + let view_number = self.view_number; + + SimpleVote { + signature, + data, + view_number, + } + } +} + +impl TimeoutVote2 { + /// Convert a `QuorumVote2` to a `QuorumVote` + pub fn to_vote(self) -> TimeoutVote { + let signature = self.signature; + let data = TimeoutData { + view: self.data.view, + }; + let view_number = self.view_number; + + SimpleVote { + signature, + data, + view_number, + } + } +} + +impl ViewSyncPreCommitVote { + /// Convert a `ViewSyncPreCommitVote` to a `ViewSyncPreCommitVote2` + pub fn to_vote2(self) -> ViewSyncPreCommitVote2 { + let signature = self.signature; + let data = ViewSyncPreCommitData2 { + relay: self.data.relay, + round: self.data.round, + epoch: TYPES::Epoch::new(0), + }; + let view_number = self.view_number; + + SimpleVote { + signature, + data, + view_number, + } + } +} + +impl ViewSyncPreCommitVote2 { + /// Convert a `ViewSyncPreCommitVote2` to a `ViewSyncPreCommitVote` + pub fn to_vote(self) -> ViewSyncPreCommitVote { + let signature = self.signature; + let data = ViewSyncPreCommitData { + relay: self.data.relay, + round: self.data.round, + }; + let view_number = self.view_number; + + SimpleVote { + signature, + data, + view_number, + } + } +} + +impl ViewSyncCommitVote { + /// Convert a `ViewSyncCommitVote` to a `ViewSyncCommitVote2` + pub fn to_vote2(self) -> ViewSyncCommitVote2 { + let signature = self.signature; + let data = ViewSyncCommitData2 { + relay: self.data.relay, + round: self.data.round, + epoch: TYPES::Epoch::new(0), + }; + let view_number = self.view_number; + + SimpleVote { + signature, + data, + view_number, + } + } +} + +impl ViewSyncCommitVote2 { + /// Convert a `ViewSyncCommitVote2` to a `ViewSyncCommitVote` + pub fn to_vote(self) -> ViewSyncCommitVote { + let signature = self.signature; + let data = ViewSyncCommitData { + relay: self.data.relay, + round: self.data.round, + }; + let view_number = self.view_number; + + SimpleVote { + signature, + data, + view_number, + } + } +} + +impl ViewSyncFinalizeVote { + /// Convert a `ViewSyncFinalizeVote` to a `ViewSyncFinalizeVote2` + pub fn to_vote2(self) -> ViewSyncFinalizeVote2 { + let signature = self.signature; + let data = ViewSyncFinalizeData2 { + relay: self.data.relay, + round: self.data.round, + epoch: TYPES::Epoch::new(0), + }; + let view_number = self.view_number; + + SimpleVote { + signature, + data, + view_number, + } + } +} + +impl ViewSyncFinalizeVote2 { + /// Convert a `ViewSyncFinalizeVote2` to a `ViewSyncFinalizeVote` + pub fn to_vote(self) -> ViewSyncFinalizeVote { + let signature = self.signature; + let data = ViewSyncFinalizeData { + relay: self.data.relay, + round: self.data.round, + }; + let view_number = self.view_number; + + SimpleVote { + signature, + data, + view_number, + } + } +} + // Type aliases for simple use of all the main votes. We should never see `SimpleVote` outside this file + /// Quorum vote Alias pub type QuorumVote = SimpleVote>; // Type aliases for simple use of all the main votes. We should never see `SimpleVote` outside this file @@ -545,17 +807,31 @@ pub type QuorumVote2 = SimpleVote>; /// Quorum vote Alias. This type is useful to distinguish the next epoch nodes' votes. pub type NextEpochQuorumVote2 = SimpleVote>; /// DA vote type alias -pub type DaVote = SimpleVote>; +pub type DaVote = SimpleVote; +/// DA vote 2 type alias +pub type DaVote2 = SimpleVote>; + /// Timeout Vote type alias pub type TimeoutVote = SimpleVote>; -/// View Sync Commit Vote type alias -pub type ViewSyncCommitVote = SimpleVote>; +/// Timeout Vote 2 type alias +pub type TimeoutVote2 = SimpleVote>; + /// View Sync Pre Commit Vote type alias pub type ViewSyncPreCommitVote = SimpleVote>; +/// View Sync Pre Commit Vote 2 type alias +pub type ViewSyncPreCommitVote2 = SimpleVote>; /// View Sync Finalize Vote type alias pub type ViewSyncFinalizeVote = SimpleVote>; +/// View Sync Finalize Vote 2 type alias +pub type ViewSyncFinalizeVote2 = SimpleVote>; +/// View Sync Commit Vote type alias +pub type ViewSyncCommitVote = SimpleVote>; +/// View Sync Commit Vote 2 type alias +pub type ViewSyncCommitVote2 = SimpleVote>; /// Upgrade proposal vote pub type UpgradeVote = SimpleVote>; +/// Upgrade proposal 2 vote +pub type UpgradeVote2 = SimpleVote>; impl Deref for NextEpochQuorumData2 { type Target = QuorumData2; diff --git a/crates/types/src/traits/node_implementation.rs b/crates/types/src/traits/node_implementation.rs index 77a4971e24..f783c95dec 100644 --- a/crates/types/src/traits/node_implementation.rs +++ b/crates/types/src/traits/node_implementation.rs @@ -212,6 +212,8 @@ pub trait NodeType: type View: ConsensusTime + Display; /// Same as above but for epoch. type Epoch: ConsensusTime + Display; + /// constant for epoch height + const EPOCH_HEIGHT: u64; /// The AuctionSolverResult is a type that holds the data associated with a particular solver /// run, for a particular view. type AuctionResult: Debug diff --git a/crates/types/src/traits/storage.rs b/crates/types/src/traits/storage.rs index 5abf0c4cab..5a4fdb4586 100644 --- a/crates/types/src/traits/storage.rs +++ b/crates/types/src/traits/storage.rs @@ -18,7 +18,10 @@ use jf_vid::VidScheme; use super::node_implementation::NodeType; use crate::{ consensus::{CommitmentMap, View}, - data::{DaProposal, Leaf, Leaf2, QuorumProposal, QuorumProposal2, VidDisperseShare}, + data::{ + DaProposal, DaProposal2, Leaf, Leaf2, QuorumProposal, QuorumProposal2, VidDisperseShare, + VidDisperseShare2, + }, event::HotShotAction, message::Proposal, simple_certificate::{ @@ -32,12 +35,21 @@ use crate::{ pub trait Storage: Send + Sync + Clone { /// Add a proposal to the stored VID proposals. async fn append_vid(&self, proposal: &Proposal>) -> Result<()>; + /// Add a proposal to the stored VID proposals. + async fn append_vid2(&self, proposal: &Proposal>) + -> Result<()>; /// Add a proposal to the stored DA proposals. async fn append_da( &self, proposal: &Proposal>, vid_commit: ::Commit, ) -> Result<()>; + /// Add a proposal to the stored DA proposals. + async fn append_da2( + &self, + proposal: &Proposal>, + vid_commit: ::Commit, + ) -> Result<()>; /// Add a proposal we sent to the store async fn append_proposal( &self, diff --git a/crates/types/src/vid.rs b/crates/types/src/vid.rs index b36eaf2020..a5462a56c1 100644 --- a/crates/types/src/vid.rs +++ b/crates/types/src/vid.rs @@ -37,7 +37,7 @@ use sha2::Sha256; use crate::{ constants::SRS_DEGREE, - data::{VidDisperse as HotShotVidDisperse, VidDisperseShare}, + data::{VidDisperse as HotShotVidDisperse, VidDisperseShare2}, message::Proposal, }; @@ -114,7 +114,7 @@ pub type VidPrecomputeData = ::PrecomputeData; /// VID proposal type pub type VidProposal = ( Proposal>, - Vec>>, + Vec>>, ); #[cfg(not(feature = "gpu-vid"))] diff --git a/docs/diagrams/HotShotFlow.drawio b/docs/diagrams/HotShotFlow.drawio index c6ac0dafb0..734c88ff2e 100644 --- a/docs/diagrams/HotShotFlow.drawio +++ b/docs/diagrams/HotShotFlow.drawio @@ -1937,7 +1937,7 @@ - + diff --git a/scripts/benchmark_scripts/aws_ecs_benchmarks_cdn_gpu.sh b/scripts/benchmark_scripts/aws_ecs_benchmarks_cdn_gpu.sh index 9e486f9cea..ad8bdb8b87 100755 --- a/scripts/benchmark_scripts/aws_ecs_benchmarks_cdn_gpu.sh +++ b/scripts/benchmark_scripts/aws_ecs_benchmarks_cdn_gpu.sh @@ -165,4 +165,4 @@ done # shut down all related threads echo -e "\e[35mGoing to stop cdn-marshal\e[0m" killall -9 cdn-marshal -# for pid in $(ps -ef | grep "keydb-server" | awk '{print $2}'); do sudo kill -9 $pid; done \ No newline at end of file +# for pid in $(ps -ef | grep "keydb-server" | awk '{print $2}'); do sudo kill -9 $pid; done