From 86950187ddc308d07b0ea2adeccc58005ff2a708 Mon Sep 17 00:00:00 2001 From: Artemii Gerasimovich Date: Thu, 28 Nov 2024 00:26:02 +0100 Subject: [PATCH] Bump HotShot --- Cargo.lock | 453 ++++++++++--------------- Cargo.toml | 48 +-- examples/simple-server.rs | 18 +- flake.nix | 17 +- src/availability.rs | 7 +- src/availability/query_data.rs | 32 +- src/data_source.rs | 40 ++- src/data_source/storage/sql/queries.rs | 8 +- src/data_source/update.rs | 4 +- src/lib.rs | 11 +- src/testing/consensus.rs | 18 +- 11 files changed, 280 insertions(+), 376 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1c05dafd..f99ba98b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -498,7 +498,7 @@ dependencies = [ "nom", "num-traits", "rusticata-macros", - "thiserror", + "thiserror 1.0.68", "time 0.3.36", ] @@ -511,7 +511,7 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.87", - "synstructure 0.13.1", + "synstructure", ] [[package]] @@ -699,7 +699,7 @@ checksum = "9e9e7a929bd34c68a82d58a4de7f86fffdaf97fb2af850162a7bb19dd7269b33" dependencies = [ "async-std", "native-tls", - "thiserror", + "thiserror 1.0.68", "url", ] @@ -1173,6 +1173,12 @@ version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +[[package]] +name = "byte-slice-cast" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" + [[package]] name = "bytecheck" version = "0.6.12" @@ -1212,18 +1218,18 @@ dependencies = [ [[package]] name = "capnp" -version = "0.19.8" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e985a566bdaae9a428a957d12b10c318d41b2afddb54cfbb764878059df636e" +checksum = "bce4e2d41c16cf9188f47ca4d59fdcdca1f33705af211bdb41f0afbd3442f8b5" dependencies = [ "embedded-io", ] [[package]] name = "capnpc" -version = "0.19.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75ba30e0f08582d53c2f3710cf4bb65ff562614b1ba86906d7391adffe189ec" +checksum = "1aa3d5f01e69ed11656d2c7c47bf34327ea9bfb5c85c7de787fcd7b6c5e45b61" dependencies = [ "capnp", ] @@ -1249,14 +1255,14 @@ dependencies = [ [[package]] name = "cdn-broker" version = "0.4.0" -source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.4.7#5406fde54e61058428a7b55e1a98b699f0f606f1" +source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.5.6#9409763dbcb726e43218c3c4cfde91c7d5de6a52" dependencies = [ "cdn-proto", "clap", "console-subscriber", "dashmap", "derivative", - "jf-signature 0.1.0", + "jf-signature", "lazy_static", "local-ip-address", "parking_lot", @@ -1272,11 +1278,12 @@ dependencies = [ [[package]] name = "cdn-client" version = "0.4.0" -source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.4.7#5406fde54e61058428a7b55e1a98b699f0f606f1" +source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.5.6#9409763dbcb726e43218c3c4cfde91c7d5de6a52" dependencies = [ "cdn-proto", "clap", - "jf-signature 0.1.0", + "derive_more 1.0.0", + "jf-signature", "parking_lot", "rand 0.8.5", "tokio", @@ -1287,11 +1294,11 @@ dependencies = [ [[package]] name = "cdn-marshal" version = "0.4.0" -source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.4.7#5406fde54e61058428a7b55e1a98b699f0f606f1" +source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.5.6#9409763dbcb726e43218c3c4cfde91c7d5de6a52" dependencies = [ "cdn-proto", "clap", - "jf-signature 0.1.0", + "jf-signature", "tokio", "tracing", "tracing-subscriber 0.3.18", @@ -1300,7 +1307,7 @@ dependencies = [ [[package]] name = "cdn-proto" version = "0.4.0" -source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.4.7#5406fde54e61058428a7b55e1a98b699f0f606f1" +source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.5.6#9409763dbcb726e43218c3c4cfde91c7d5de6a52" dependencies = [ "anyhow", "ark-serialize", @@ -1308,7 +1315,8 @@ dependencies = [ "capnp", "capnpc", "derivative", - "jf-signature 0.1.0", + "derive_more 1.0.0", + "jf-signature", "kanal", "lazy_static", "mnemonic", @@ -1323,7 +1331,7 @@ dependencies = [ "rustls 0.23.16", "rustls-pki-types", "sqlx", - "thiserror", + "thiserror 1.0.68", "tokio", "tokio-rustls", "tracing", @@ -1731,27 +1739,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "csv" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe" -dependencies = [ - "csv-core", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "csv-core" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5efa2b3d7902f4b634a20cae3c9c4e6209dc4779feb6863329607560143efa70" -dependencies = [ - "memchr", -] - [[package]] name = "ctr" version = "0.6.0" @@ -1788,33 +1775,13 @@ dependencies = [ "syn 2.0.87", ] -[[package]] -name = "custom_debug" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89e0ae2c2a42be29595d05c50e3ce6096c0698a97e021c3289790f0750cc8e2" -dependencies = [ - "custom_debug_derive 0.5.1", -] - [[package]] name = "custom_debug" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14e715bf0e503e909c7076c052e39dd215202e8edeb32f1c194fd630c314d256" dependencies = [ - "custom_debug_derive 0.6.1", -] - -[[package]] -name = "custom_debug_derive" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08a9f3941234c9f62ceaa2782974827749de9b0a8a6487275a278da068e1baf7" -dependencies = [ - "proc-macro2", - "syn 1.0.109", - "synstructure 0.12.6", + "custom_debug_derive", ] [[package]] @@ -1828,7 +1795,7 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.87", - "synstructure 0.13.1", + "synstructure", ] [[package]] @@ -2036,6 +2003,7 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.87", + "unicode-xid", ] [[package]] @@ -2248,11 +2216,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "espresso-systems-common" -version = "0.4.1" -source = "git+https://github.com/espressosystems/espresso-systems-common?tag=0.4.1#2e889e878866c2a5cce1daaab947f7c93d5811ae" - [[package]] name = "etcetera" version = "0.8.0" @@ -2264,31 +2227,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "ethbloom" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" -dependencies = [ - "crunchy", - "fixed-hash", - "impl-serde", - "tiny-keccak", -] - -[[package]] -name = "ethereum-types" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" -dependencies = [ - "ethbloom", - "fixed-hash", - "impl-serde", - "primitive-types", - "uint", -] - [[package]] name = "event-listener" version = "2.5.3" @@ -2350,6 +2288,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" dependencies = [ "byteorder", + "rand 0.8.5", "rustc-hex", "static_assertions", ] @@ -2843,7 +2782,7 @@ dependencies = [ "once_cell", "rand 0.8.5", "socket2 0.5.7", - "thiserror", + "thiserror 1.0.68", "tinyvec", "tokio", "tracing", @@ -2866,7 +2805,7 @@ dependencies = [ "rand 0.8.5", "resolv-conf", "smallvec", - "thiserror", + "thiserror 1.0.68", "tokio", "tracing", ] @@ -2952,8 +2891,8 @@ dependencies = [ [[package]] name = "hotshot" -version = "0.5.81" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.81#4ed1df20f793b947d5c9f90a1cb10e4177f8521d" +version = "0.5.79" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=rc-0.5.82#8485af8e3b182c84c4725060e4ad875276bc3e1d" dependencies = [ "anyhow", "async-broadcast", @@ -2967,27 +2906,23 @@ dependencies = [ "cdn-marshal", "chrono", "committable", - "custom_debug 0.5.1", "dashmap", "derive_more 1.0.0", "either", - "ethereum-types", "futures", "hotshot-task", "hotshot-task-impls", "hotshot-types", - "jf-signature 0.2.0", "libp2p-identity", "libp2p-networking", "lru 0.12.5", "num_enum", "parking_lot", "portpicker", + "primitive-types", "rand 0.8.5", "serde", "sha2 0.10.8", - "surf-disco", - "thiserror", "time 0.3.36", "tokio", "tracing", @@ -3000,7 +2935,7 @@ dependencies = [ [[package]] name = "hotshot-builder-api" version = "0.1.7" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.81#4ed1df20f793b947d5c9f90a1cb10e4177f8521d" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=rc-0.5.82#8485af8e3b182c84c4725060e4ad875276bc3e1d" dependencies = [ "async-trait", "clap", @@ -3010,7 +2945,7 @@ dependencies = [ "hotshot-types", "serde", "tagged-base64", - "thiserror", + "thiserror 2.0.3", "tide-disco", "toml", "vbs", @@ -3018,21 +2953,14 @@ dependencies = [ [[package]] name = "hotshot-example-types" -version = "0.5.81" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.81#4ed1df20f793b947d5c9f90a1cb10e4177f8521d" +version = "0.5.79" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=rc-0.5.82#8485af8e3b182c84c4725060e4ad875276bc3e1d" dependencies = [ "anyhow", - "async-broadcast", "async-lock 3.4.0", "async-trait", - "bitvec", "committable", - "either", - "ethereum-types", - "futures", "hotshot", - "hotshot-builder-api", - "hotshot-task", "hotshot-task-impls", "hotshot-types", "jf-vid", @@ -3041,18 +2969,17 @@ dependencies = [ "serde", "sha2 0.10.8", "sha3", - "thiserror", + "thiserror 2.0.3", "time 0.3.36", "tokio", - "tracing", "url", "vbs", ] [[package]] name = "hotshot-fakeapi" -version = "0.5.81" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.81#4ed1df20f793b947d5c9f90a1cb10e4177f8521d" +version = "0.5.79" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=rc-0.5.82#8485af8e3b182c84c4725060e4ad875276bc3e1d" dependencies = [ "anyhow", "async-lock 3.4.0", @@ -3061,18 +2988,16 @@ dependencies = [ "hotshot-example-types", "hotshot-types", "rand 0.8.5", - "serde", "tide-disco", "tokio", "toml", - "tracing", "vbs", ] [[package]] name = "hotshot-macros" -version = "0.5.81" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.81#4ed1df20f793b947d5c9f90a1cb10e4177f8521d" +version = "0.5.79" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=rc-0.5.82#8485af8e3b182c84c4725060e4ad875276bc3e1d" dependencies = [ "derive_builder", "proc-macro2", @@ -3080,36 +3005,9 @@ dependencies = [ "syn 2.0.87", ] -[[package]] -name = "hotshot-orchestrator" -version = "0.5.81" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.81#4ed1df20f793b947d5c9f90a1cb10e4177f8521d" -dependencies = [ - "anyhow", - "async-lock 3.4.0", - "bincode", - "blake3", - "clap", - "csv", - "futures", - "hotshot-types", - "libp2p", - "multiaddr", - "serde", - "serde_json", - "surf-disco", - "thiserror", - "tide-disco", - "tokio", - "toml", - "tracing", - "vbs", - "vec1", -] - [[package]] name = "hotshot-query-service" -version = "0.1.62" +version = "0.1.63" dependencies = [ "anyhow", "ark-serialize", @@ -3122,7 +3020,7 @@ dependencies = [ "chrono", "clap", "committable", - "custom_debug 0.6.1", + "custom_debug", "derivative", "derive_more 0.99.18", "either", @@ -3167,10 +3065,9 @@ dependencies = [ [[package]] name = "hotshot-task" -version = "0.5.81" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.81#4ed1df20f793b947d5c9f90a1cb10e4177f8521d" +version = "0.5.79" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=rc-0.5.82#8485af8e3b182c84c4725060e4ad875276bc3e1d" dependencies = [ - "anyhow", "async-broadcast", "async-trait", "futures", @@ -3181,16 +3078,14 @@ dependencies = [ [[package]] name = "hotshot-task-impls" -version = "0.5.81" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.81#4ed1df20f793b947d5c9f90a1cb10e4177f8521d" +version = "0.5.79" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=rc-0.5.82#8485af8e3b182c84c4725060e4ad875276bc3e1d" dependencies = [ "anyhow", "async-broadcast", "async-lock 3.4.0", "async-trait", "bincode", - "bitvec", - "cdn-proto", "chrono", "committable", "either", @@ -3198,7 +3093,6 @@ dependencies = [ "hotshot-builder-api", "hotshot-task", "hotshot-types", - "jf-signature 0.2.0", "jf-vid", "lru 0.12.5", "rand 0.8.5", @@ -3206,7 +3100,7 @@ dependencies = [ "sha2 0.10.8", "surf-disco", "tagged-base64", - "thiserror", + "thiserror 2.0.3", "time 0.3.36", "tokio", "tracing", @@ -3218,8 +3112,8 @@ dependencies = [ [[package]] name = "hotshot-testing" -version = "0.5.81" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.81#4ed1df20f793b947d5c9f90a1cb10e4177f8521d" +version = "0.5.79" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=rc-0.5.82#8485af8e3b182c84c4725060e4ad875276bc3e1d" dependencies = [ "anyhow", "async-broadcast", @@ -3229,29 +3123,26 @@ dependencies = [ "bitvec", "committable", "either", - "ethereum-types", "futures", "hotshot", "hotshot-builder-api", "hotshot-example-types", "hotshot-fakeapi", "hotshot-macros", - "hotshot-orchestrator", "hotshot-task", "hotshot-task-impls", "hotshot-types", "itertools 0.13.0", - "jf-signature 0.2.0", "jf-vid", "lru 0.12.5", "portpicker", + "primitive-types", "rand 0.8.5", "reqwest", "serde", "sha2 0.10.8", - "sha3", "tagged-base64", - "thiserror", + "thiserror 2.0.3", "tide-disco", "tokio", "tracing", @@ -3263,7 +3154,7 @@ dependencies = [ [[package]] name = "hotshot-types" version = "0.1.11" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.81#4ed1df20f793b947d5c9f90a1cb10e4177f8521d" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=rc-0.5.82#8485af8e3b182c84c4725060e4ad875276bc3e1d" dependencies = [ "anyhow", "ark-bn254", @@ -3277,36 +3168,33 @@ dependencies = [ "bincode", "bitvec", "blake3", - "cdn-proto", "clap", "committable", - "custom_debug 0.5.1", - "derivative", + "derive_more 1.0.0", "digest 0.10.7", "displaydoc", "dyn-clone", "either", - "espresso-systems-common", - "ethereum-types", "futures", "jf-pcs", - "jf-signature 0.2.0", + "jf-signature", "jf-utils", "jf-vid", "lazy_static", - "libp2p", + "libp2p-identity", "memoize", + "mnemonic", + "multiaddr", + "primitive-types", "rand 0.8.5", "rand_chacha 0.3.1", - "reqwest", "serde", "serde-inline-default", "serde_bytes", "serde_json", "sha2 0.10.8", - "surf-disco", "tagged-base64", - "thiserror", + "thiserror 2.0.3", "time 0.3.36", "tokio", "toml", @@ -3760,15 +3648,35 @@ dependencies = [ "xmltree", ] +[[package]] +name = "impl-codec" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67aa010c1e3da95bf151bd8b4c059b2ed7e75387cdb969b4f8f2723a43f9941" +dependencies = [ + "parity-scale-codec", +] + [[package]] name = "impl-serde" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +checksum = "4a143eada6a1ec4aefa5049037a26a6d597bfd64f8c026d07b77133e02b7dd0b" dependencies = [ "serde", ] +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "include_dir" version = "0.7.4" @@ -4032,35 +3940,6 @@ dependencies = [ "jf-utils", ] -[[package]] -name = "jf-signature" -version = "0.1.0" -source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" -dependencies = [ - "ark-bls12-381", - "ark-bn254", - "ark-ec", - "ark-ff", - "ark-serialize", - "ark-std", - "blst", - "derivative", - "digest 0.10.7", - "displaydoc", - "hashbrown 0.14.5", - "itertools 0.12.1", - "jf-crhf", - "jf-relation", - "jf-rescue", - "jf-utils", - "num-bigint", - "num-traits", - "serde", - "sha3", - "tagged-base64", - "zeroize", -] - [[package]] name = "jf-signature" version = "0.2.0" @@ -4235,7 +4114,7 @@ dependencies = [ "multiaddr", "pin-project", "rw-stream-sink", - "thiserror", + "thiserror 1.0.68", ] [[package]] @@ -4305,7 +4184,7 @@ dependencies = [ "rw-stream-sink", "serde", "smallvec", - "thiserror", + "thiserror 1.0.68", "tracing", "unsigned-varint 0.8.0", "void", @@ -4378,7 +4257,7 @@ dependencies = [ "quick-protobuf", "quick-protobuf-codec 0.3.1", "smallvec", - "thiserror", + "thiserror 1.0.68", "tracing", "void", ] @@ -4399,7 +4278,7 @@ dependencies = [ "rand 0.8.5", "serde", "sha2 0.10.8", - "thiserror", + "thiserror 1.0.68", "tracing", "zeroize", ] @@ -4428,9 +4307,9 @@ dependencies = [ "serde", "sha2 0.10.8", "smallvec", - "thiserror", + "thiserror 1.0.68", "tracing", - "uint", + "uint 0.9.5", "void", ] @@ -4475,19 +4354,17 @@ dependencies = [ [[package]] name = "libp2p-networking" -version = "0.5.81" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.81#4ed1df20f793b947d5c9f90a1cb10e4177f8521d" +version = "0.5.79" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=rc-0.5.82#8485af8e3b182c84c4725060e4ad875276bc3e1d" dependencies = [ "anyhow", - "async-lock 3.4.0", "async-trait", "bincode", "blake3", "cbor4ii", - "custom_debug 0.5.1", "delegate", "derive_builder", - "either", + "derive_more 1.0.0", "futures", "hotshot-types", "lazy_static", @@ -4495,17 +4372,10 @@ dependencies = [ "libp2p-identity", "libp2p-swarm-derive", "pin-project", - "portpicker", "rand 0.8.5", "serde", - "serde_bytes", - "serde_json", - "thiserror", "tokio", - "tokio-stream", "tracing", - "tracing-subscriber 0.3.18", - "void", ] [[package]] @@ -4527,7 +4397,7 @@ dependencies = [ "ring 0.17.8", "rustls 0.23.16", "socket2 0.5.7", - "thiserror", + "thiserror 1.0.68", "tokio", "tracing", ] @@ -4621,7 +4491,7 @@ dependencies = [ "ring 0.17.8", "rustls 0.23.16", "rustls-webpki 0.101.7", - "thiserror", + "thiserror 1.0.68", "x509-parser", "yasna", ] @@ -4743,7 +4613,7 @@ checksum = "3669cf5561f8d27e8fc84cc15e58350e70f557d4d65f70e3154e54cd2f8e1782" dependencies = [ "libc", "neli", - "thiserror", + "thiserror 1.0.68", "windows-sys 0.59.0", ] @@ -5089,7 +4959,7 @@ dependencies = [ "anyhow", "byteorder", "paste", - "thiserror", + "thiserror 1.0.68", ] [[package]] @@ -5103,7 +4973,7 @@ dependencies = [ "log", "netlink-packet-core", "netlink-sys", - "thiserror", + "thiserror 1.0.68", "tokio", ] @@ -5354,6 +5224,32 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +[[package]] +name = "parity-scale-codec" +version = "3.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "306800abfa29c7f16596b5970a588435e3d5b3149683d00c12b699cc19f895ee" +dependencies = [ + "arrayvec", + "bitvec", + "byte-slice-cast", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8781a75c6205af67215f382092b6e0a4ff3734798523e69073d4bcd294ec767b" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "parking" version = "2.2.1" @@ -5427,7 +5323,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" dependencies = [ "memchr", - "thiserror", + "thiserror 1.0.68", "ucd-trie", ] @@ -5662,13 +5558,14 @@ dependencies = [ [[package]] name = "primitive-types" -version = "0.12.2" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" +checksum = "d15600a7d856470b7d278b3fe0e311fe28c2526348549f8ef2ff7db3299c87f5" dependencies = [ "fixed-hash", + "impl-codec", "impl-serde", - "uint", + "uint 0.10.0", ] [[package]] @@ -5730,7 +5627,7 @@ dependencies = [ "memchr", "parking_lot", "protobuf", - "thiserror", + "thiserror 1.0.68", ] [[package]] @@ -5838,7 +5735,7 @@ dependencies = [ "asynchronous-codec 0.6.2", "bytes", "quick-protobuf", - "thiserror", + "thiserror 1.0.68", "unsigned-varint 0.7.2", ] @@ -5851,7 +5748,7 @@ dependencies = [ "asynchronous-codec 0.7.0", "bytes", "quick-protobuf", - "thiserror", + "thiserror 1.0.68", "unsigned-varint 0.8.0", ] @@ -5869,7 +5766,7 @@ dependencies = [ "rustc-hash", "rustls 0.23.16", "socket2 0.5.7", - "thiserror", + "thiserror 1.0.68", "tokio", "tracing", ] @@ -5886,7 +5783,7 @@ dependencies = [ "rustc-hash", "rustls 0.23.16", "slab", - "thiserror", + "thiserror 1.0.68", "tinyvec", "tracing", ] @@ -6039,9 +5936,9 @@ dependencies = [ [[package]] name = "redis" -version = "0.26.1" +version = "0.27.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e902a69d09078829137b4a5d9d082e0490393537badd7c91a3d69d14639e115f" +checksum = "81cccf17a692ce51b86564334614d72dcae1def0fd5ecebc9f02956da74352b5" dependencies = [ "arc-swap", "async-trait", @@ -6055,7 +5952,7 @@ dependencies = [ "pin-project-lite 0.2.15", "ryu", "tokio", - "tokio-retry", + "tokio-retry2", "tokio-util", "url", ] @@ -6077,7 +5974,7 @@ checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom 0.2.15", "libredox", - "thiserror", + "thiserror 1.0.68", ] [[package]] @@ -6102,7 +5999,7 @@ dependencies = [ "regex", "serde", "siphasher 1.0.1", - "thiserror", + "thiserror 1.0.68", "time 0.3.36", "tokio", "tokio-postgres", @@ -6349,7 +6246,7 @@ dependencies = [ "netlink-packet-route", "netlink-proto", "nix 0.24.3", - "thiserror", + "thiserror 1.0.68", "tokio", ] @@ -6681,7 +6578,7 @@ checksum = "c7715380eec75f029a4ef7de39a9200e0a63823176b759d055b613f5a87df6a6" dependencies = [ "percent-encoding", "serde", - "thiserror", + "thiserror 1.0.68", ] [[package]] @@ -7084,7 +6981,7 @@ dependencies = [ "sha2 0.10.8", "smallvec", "sqlformat", - "thiserror", + "thiserror 1.0.68", "time 0.3.36", "tokio", "tokio-stream", @@ -7168,7 +7065,7 @@ dependencies = [ "smallvec", "sqlx-core", "stringprep", - "thiserror", + "thiserror 1.0.68", "time 0.3.36", "tracing", "whoami", @@ -7208,7 +7105,7 @@ dependencies = [ "smallvec", "sqlx-core", "stringprep", - "thiserror", + "thiserror 1.0.68", "time 0.3.36", "tracing", "whoami", @@ -7484,18 +7381,6 @@ dependencies = [ "futures-core", ] -[[package]] -name = "synstructure" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "unicode-xid", -] - [[package]] name = "synstructure" version = "0.13.1" @@ -7600,7 +7485,16 @@ version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02dd99dc800bbb97186339685293e1cc5d9df1f8fae2d0aecd9ff1c77efea892" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.68", +] + +[[package]] +name = "thiserror" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa" +dependencies = [ + "thiserror-impl 2.0.3", ] [[package]] @@ -7614,6 +7508,17 @@ dependencies = [ "syn 2.0.87", ] +[[package]] +name = "thiserror-impl" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "thread_local" version = "1.1.8" @@ -7906,10 +7811,10 @@ dependencies = [ ] [[package]] -name = "tokio-retry" -version = "0.3.0" +name = "tokio-retry2" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f57eb36ecbe0fc510036adff84824dd3c24bb781e21bfa67b69d556aa85214f" +checksum = "903934dba1c4c2f2e9cb460ef10b5695e0b0ecad3bf9ee7c8675e540c5e8b2d1" dependencies = [ "pin-project", "rand 0.8.5", @@ -8183,7 +8088,7 @@ dependencies = [ "native-tls", "rand 0.8.5", "sha-1", - "thiserror", + "thiserror 1.0.68", "url", "utf-8", ] @@ -8218,6 +8123,18 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "uint" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "909988d098b2f738727b161a106cfc7cab00c539c2687a8836f8e565976fb53e" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + [[package]] name = "unicase" version = "2.8.0" @@ -8361,8 +8278,8 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "utils" -version = "0.5.81" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.81#4ed1df20f793b947d5c9f90a1cb10e4177f8521d" +version = "0.5.79" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=rc-0.5.82#8485af8e3b182c84c4725060e4ad875276bc3e1d" dependencies = [ "tracing", ] @@ -8949,7 +8866,7 @@ dependencies = [ "oid-registry", "ring 0.17.8", "rusticata-macros", - "thiserror", + "thiserror 1.0.68", "time 0.3.36", ] @@ -9009,7 +8926,7 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.87", - "synstructure 0.13.1", + "synstructure", ] [[package]] @@ -9051,7 +8968,7 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.87", - "synstructure 0.13.1", + "synstructure", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index e279aa46..23a30f1b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "hotshot-query-service" -version = "0.1.62" +version = "0.1.63" authors = ["Espresso Systems "] edition = "2021" license = "GPL-3.0-or-later" @@ -43,12 +43,12 @@ sql-data-source = ["include_dir", "refinery", "refinery-core", "sqlx", "log"] # Enable extra features useful for writing tests with a query service. testing = [ - "espresso-macros", - "hotshot-example-types", - "portpicker", - "rand", - "spin_sleep", - "tempfile", + "espresso-macros", + "hotshot-example-types", + "portpicker", + "rand", + "spin_sleep", + "tempfile", ] [[example]] @@ -69,16 +69,16 @@ derivative = "2.2" derive_more = "0.99" either = "1.12" futures = "0.3" -hotshot = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.81" } -hotshot-testing = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.81" } -hotshot-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.81" } +hotshot = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "rc-0.5.82" } +hotshot-testing = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "rc-0.5.82" } +hotshot-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "rc-0.5.82" } itertools = "0.12.1" jf-merkle-tree = { version = "0.1.0", git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5", features = [ - "std", + "std", ] } jf-vid = { version = "0.1.0", git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5", features = [ - "std", - "parallel", + "std", + "parallel", ] } prometheus = "0.13" serde = { version = "1.0", features = ["derive"] } @@ -89,10 +89,10 @@ tagged-base64 = "0.4" tide-disco = "0.9" time = "0.3" tokio = { version = "1", default-features = false, features = [ - "rt-multi-thread", - "macros", - "parking_lot", - "sync", + "rt-multi-thread", + "macros", + "parking_lot", + "sync", ] } toml = "0.8" tracing = "0.1" @@ -112,16 +112,16 @@ log = { version = "0.4", optional = true } refinery = { version = "0.8", features = ["tokio-postgres"], optional = true } refinery-core = { version = "0.8", optional = true } sqlx = { version = "0.8", features = [ - "bit-vec", - "postgres", - "runtime-tokio", - "sqlite", - "tls-native-tls", + "bit-vec", + "postgres", + "runtime-tokio", + "sqlite", + "tls-native-tls", ], optional = true } # Dependencies enabled by feature "testing". espresso-macros = { git = "https://github.com/EspressoSystems/espresso-macros.git", tag = "0.1.0", optional = true } -hotshot-example-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.81", optional = true } +hotshot-example-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "rc-0.5.82", optional = true } portpicker = { version = "0.1", optional = true } rand = { version = "0.8", optional = true } spin_sleep = { version = "1.2", optional = true } @@ -142,7 +142,7 @@ backtrace-on-stack-overflow = { version = "0.3", optional = true } clap = { version = "4.5", features = ["derive", "env"] } espresso-macros = { git = "https://github.com/EspressoSystems/espresso-macros.git", tag = "0.1.0" } generic-array = "0.14" -hotshot-example-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.81" } +hotshot-example-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "rc-0.5.82" } portpicker = "0.1" rand = "0.8" reqwest = "0.12.3" diff --git a/examples/simple-server.rs b/examples/simple-server.rs index 42fdba6f..fa3e9a8c 100644 --- a/examples/simple-server.rs +++ b/examples/simple-server.rs @@ -21,7 +21,7 @@ use futures::future::{join_all, try_join_all}; use hotshot::{ traits::implementations::{MasterMap, MemoryNetwork}, types::{SignatureKey, SystemContextHandle}, - HotShotInitializer, MarketplaceConfig, Memberships, SystemContext, + HotShotInitializer, MarketplaceConfig, SystemContext, }; use hotshot_example_types::{ auction_results_provider_types::TestAuctionResultsProvider, state_types::TestInstanceState, @@ -169,20 +169,10 @@ async fn init_consensus( // Get the number of nodes with stake let num_nodes_with_stake = NonZeroUsize::new(pub_keys.len()).unwrap(); - let da_membership = MockMembership::new( + let membership = MockMembership::new( known_nodes_with_stake.clone(), known_nodes_with_stake.clone(), - Topic::Da, ); - let non_da_membership = MockMembership::new( - known_nodes_with_stake.clone(), - known_nodes_with_stake.clone(), - Topic::Global, - ); - let memberships = Memberships { - quorum_membership: non_da_membership.clone(), - da_membership: da_membership.clone(), - }; // Pick a random, unused port for the builder server let builder_port = portpicker::pick_unused_port().expect("No ports available"); @@ -234,7 +224,7 @@ async fn init_consensus( let config = config.clone(); let master_map = master_map.clone(); - let memberships = memberships.clone(); + let membership = membership.clone(); async move { let network = Arc::new(MemoryNetwork::new( &pub_keys[node_id], @@ -250,7 +240,7 @@ async fn init_consensus( priv_key, node_id as u64, config, - memberships, + membership, network, HotShotInitializer::from_genesis::(TestInstanceState::default()) .await diff --git a/flake.nix b/flake.nix index 5868aa77..39a567c2 100644 --- a/flake.nix +++ b/flake.nix @@ -26,19 +26,13 @@ inputs.pre-commit-hooks.inputs.flake-utils.follows = "flake-utils"; inputs.pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs"; - inputs.poetry2nixFlake = { - url = "github:nix-community/poetry2nix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - outputs = { self, nixpkgs, flake-utils, rust-overlay, pre-commit-hooks, poetry2nixFlake, ... }: + outputs = { self, nixpkgs, flake-utils, rust-overlay, pre-commit-hooks, ... }: flake-utils.lib.eachDefaultSystem (system: let overlays = [ (import rust-overlay) ]; pkgs = import nixpkgs { inherit system overlays; }; - poetry2nix = poetry2nixFlake.lib.mkPoetry2Nix { inherit pkgs; }; rustToolchain = pkgs.rust-bin.stable.latest.minimal.override { extensions = [ "rustfmt" "clippy" "llvm-tools-preview" "rust-src" ]; }; @@ -102,8 +96,6 @@ license = with licenses; [ mit asl20 ]; }; }; - pythonEnv = poetry2nix.mkPoetryEnv { projectDir = ./.; }; - myPython = with pkgs; [ poetry pythonEnv ]; shellHook = '' # Prevent cargo aliases from using programs in `~/.cargo` to avoid conflicts with rustup # installations. @@ -182,7 +174,7 @@ git mdbook # make-doc, documentation generation rustToolchain - ] ++ myPython ++ rustDeps; + ] ++ rustDeps; inherit RUST_SRC_PATH RUST_BACKTRACE RUST_LOG RUSTFLAGS CARGO_TARGET_DIR; }; @@ -194,12 +186,11 @@ nixWithFlakes git nightlyToolchain - ] ++ myPython ++ rustDeps; + ] ++ rustDeps; }; perfShell = pkgs.mkShell { shellHook = shellHook; - buildInputs = with pkgs; - [ nixWithFlakes cargo-llvm-cov rustToolchain ] ++ rustDeps; + buildInputs = [ nixWithFlakes cargo-llvm-cov rustToolchain ] ++ rustDeps; inherit RUST_SRC_PATH RUST_BACKTRACE RUST_LOG RUSTFLAGS CARGO_TARGET_DIR; }; diff --git a/src/availability.rs b/src/availability.rs index d105e195..ef45b93a 100644 --- a/src/availability.rs +++ b/src/availability.rs @@ -914,10 +914,13 @@ mod test { ); // mock up some consensus data. - let leaf = Leaf::::genesis(&Default::default(), &Default::default()).await; + let leaf = Leaf::::genesis(&Default::default(), &Default::default()) + .await + .into(); let qc = QuorumCertificate::genesis::(&Default::default(), &Default::default()) - .await; + .await + .to_qc2(); let leaf = LeafQueryData::new(leaf, qc).unwrap(); let block = BlockQueryData::new(leaf.header().clone(), MockPayload::genesis()); data_source diff --git a/src/availability/query_data.rs b/src/availability/query_data.rs index 3aa660ab..fbf191c5 100644 --- a/src/availability/query_data.rs +++ b/src/availability/query_data.rs @@ -13,8 +13,8 @@ use crate::{types::HeightIndexed, Header, Metadata, Payload, Transaction, VidCommon, VidShare}; use committable::{Commitment, Committable}; use hotshot_types::{ - data::Leaf, - simple_certificate::QuorumCertificate, + data::{Leaf, Leaf2}, + simple_certificate::{QuorumCertificate, QuorumCertificate2}, traits::{ self, block_contents::{BlockHeader, GENESIS_VID_NUM_STORAGE_NODES}, @@ -28,7 +28,7 @@ use serde::{de::DeserializeOwned, Deserialize, Serialize}; use snafu::{ensure, Snafu}; use std::fmt::Debug; -pub type LeafHash = Commitment>; +pub type LeafHash = Commitment>; /// A block hash is the hash of the block header. /// /// A block consists of a header and a payload. But the header itself contains a commitment to the @@ -190,8 +190,8 @@ pub trait QueryablePayload: traits::BlockPayload { #[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] #[serde(bound = "")] pub struct LeafQueryData { - pub(crate) leaf: Leaf, - pub(crate) qc: QuorumCertificate, + pub(crate) leaf: Leaf2, + pub(crate) qc: QuorumCertificate2, } #[derive(Clone, Debug, Snafu)] @@ -210,13 +210,13 @@ impl LeafQueryData { /// /// Fails with an [`InconsistentLeafError`] if `qc` does not reference `leaf`. pub fn new( - mut leaf: Leaf, - qc: QuorumCertificate, + mut leaf: Leaf2, + qc: QuorumCertificate2, ) -> Result> { // TODO: Replace with the new `commit` function in HotShot. Add an `upgrade_lock` parameter // and a `HsVer: Versions` bound, then call `leaf.commit(upgrade_lock).await`. This will // require updates in callers and relevant types as well. - let leaf_commit = as Committable>::commit(&leaf); + let leaf_commit = as Committable>::commit(&leaf); ensure!( qc.data.leaf_commit == leaf_commit, InconsistentLeafSnafu { @@ -237,16 +237,18 @@ impl LeafQueryData { instance_state: &Types::InstanceState, ) -> Self { Self { - leaf: Leaf::genesis(validated_state, instance_state).await, - qc: QuorumCertificate::genesis::(validated_state, instance_state).await, + leaf: Leaf::genesis(validated_state, instance_state).await.into(), + qc: QuorumCertificate::genesis::(validated_state, instance_state) + .await + .to_qc2(), } } - pub fn leaf(&self) -> &Leaf { + pub fn leaf(&self) -> &Leaf2 { &self.leaf } - pub fn qc(&self) -> &QuorumCertificate { + pub fn qc(&self) -> &QuorumCertificate2 { &self.qc } @@ -258,7 +260,7 @@ impl LeafQueryData { // TODO: Replace with the new `commit` function in HotShot. Add an `upgrade_lock` parameter // and a `HsVer: Versions` bound, then call `leaf.commit(upgrade_lock).await`. This will // require updates in callers and relevant types as well. - as Committable>::commit(&self.leaf) + as Committable>::commit(&self.leaf) } pub fn block_hash(&self) -> BlockHash { @@ -457,7 +459,9 @@ impl VidCommonQueryData { validated_state: &Types::ValidatedState, instance_state: &Types::InstanceState, ) -> Self { - let leaf = Leaf::::genesis(validated_state, instance_state).await; + let leaf: Leaf2 = Leaf::::genesis(validated_state, instance_state) + .await + .into(); let payload = leaf.block_payload().unwrap(); let bytes = payload.encode(); let disperse = vid_scheme(GENESIS_VID_NUM_STORAGE_NODES) diff --git a/src/data_source.rs b/src/data_source.rs index a4c614ad..ac6482d3 100644 --- a/src/data_source.rs +++ b/src/data_source.rs @@ -133,7 +133,7 @@ pub mod availability_tests { }; use committable::Committable; use futures::stream::StreamExt; - use hotshot_types::data::Leaf; + use hotshot_types::data::Leaf2; use std::collections::HashMap; use std::fmt::Debug; use std::ops::{Bound, RangeBounds}; @@ -148,7 +148,7 @@ pub mod availability_tests { assert_eq!(leaf.height(), i as u64); assert_eq!( leaf.hash(), - as Committable>::commit(&leaf.leaf) + as Committable>::commit(&leaf.leaf) ); // Check indices. @@ -484,11 +484,11 @@ pub mod persistence_tests { setup_test, }, types::HeightIndexed, - Leaf, + Leaf2, }; use committable::Committable; use hotshot_example_types::state_types::{TestInstanceState, TestValidatedState}; - use hotshot_types::simple_certificate::QuorumCertificate; + use hotshot_types::{data::Leaf, simple_certificate::QuorumCertificate}; #[tokio::test(flavor = "multi_thread")] pub async fn test_revert() @@ -509,16 +509,18 @@ pub mod persistence_tests { &TestValidatedState::default(), &TestInstanceState::default(), ) - .await; - let mut leaf = Leaf::::genesis( + .await + .to_qc2(); + let mut leaf: Leaf2<_> = Leaf::::genesis( &TestValidatedState::default(), &TestInstanceState::default(), ) - .await; + .await + .into(); // Increment the block number, to distinguish this block from the genesis block, which // already exists. leaf.block_header_mut().block_number += 1; - qc.data.leaf_commit = as Committable>::commit(&leaf); + qc.data.leaf_commit = as Committable>::commit(&leaf); let block = BlockQueryData::new(leaf.block_header().clone(), MockPayload::genesis()); let leaf = LeafQueryData::new(leaf, qc).unwrap(); @@ -561,16 +563,18 @@ pub mod persistence_tests { &TestValidatedState::default(), &TestInstanceState::default(), ) - .await; - let mut leaf = Leaf::::genesis( + .await + .to_qc2(); + let mut leaf: Leaf2<_> = Leaf::::genesis( &TestValidatedState::default(), &TestInstanceState::default(), ) - .await; + .await + .into(); // Increment the block number, to distinguish this block from the genesis block, which // already exists. leaf.block_header_mut().block_number += 1; - qc.data.leaf_commit = as Committable>::commit(&leaf); + qc.data.leaf_commit = as Committable>::commit(&leaf); let block = BlockQueryData::new(leaf.block_header().clone(), MockPayload::genesis()); let leaf = LeafQueryData::new(leaf, qc).unwrap(); @@ -624,16 +628,18 @@ pub mod persistence_tests { &TestValidatedState::default(), &TestInstanceState::default(), ) - .await; - let mut mock_leaf = Leaf::::genesis( + .await + .to_qc2(); + let mut mock_leaf: Leaf2<_> = Leaf::::genesis( &TestValidatedState::default(), &TestInstanceState::default(), ) - .await; + .await + .into(); // Increment the block number, to distinguish this block from the genesis block, which // already exists. mock_leaf.block_header_mut().block_number += 1; - mock_qc.data.leaf_commit = as Committable>::commit(&mock_leaf); + mock_qc.data.leaf_commit = as Committable>::commit(&mock_leaf); let block = BlockQueryData::new(mock_leaf.block_header().clone(), MockPayload::genesis()); let leaf = LeafQueryData::new(mock_leaf.clone(), mock_qc.clone()).unwrap(); @@ -659,7 +665,7 @@ pub mod persistence_tests { // Get a mutable transaction again, insert different data. mock_leaf.block_header_mut().block_number += 1; - mock_qc.data.leaf_commit = as Committable>::commit(&mock_leaf); + mock_qc.data.leaf_commit = as Committable>::commit(&mock_leaf); let block = BlockQueryData::new(mock_leaf.block_header().clone(), MockPayload::genesis()); let leaf = LeafQueryData::new(mock_leaf, mock_qc).unwrap(); diff --git a/src/data_source/storage/sql/queries.rs b/src/data_source/storage/sql/queries.rs index d2a94063..99ce9d8d 100644 --- a/src/data_source/storage/sql/queries.rs +++ b/src/data_source/storage/sql/queries.rs @@ -19,12 +19,12 @@ use crate::{ VidCommonQueryData, }, data_source::storage::{PayloadMetadata, VidCommonMetadata}, - Header, Leaf, Payload, QueryError, QueryResult, + Header, Leaf2, Payload, QueryError, QueryResult, }; use anyhow::Context; use derivative::Derivative; use hotshot_types::{ - simple_certificate::QuorumCertificate, + simple_certificate::QuorumCertificate2, traits::{ block_contents::{BlockHeader, BlockPayload}, node_implementation::NodeType, @@ -170,10 +170,10 @@ where { fn from_row(row: &'r ::Row) -> sqlx::Result { let leaf = row.try_get("leaf")?; - let leaf: Leaf = serde_json::from_value(leaf).decode_error("malformed leaf")?; + let leaf: Leaf2 = serde_json::from_value(leaf).decode_error("malformed leaf")?; let qc = row.try_get("qc")?; - let qc: QuorumCertificate = + let qc: QuorumCertificate2 = serde_json::from_value(qc).decode_error("malformed QC")?; Ok(Self { leaf, qc }) diff --git a/src/data_source/update.rs b/src/data_source/update.rs index 785d45e5..df1dd6d8 100644 --- a/src/data_source/update.rs +++ b/src/data_source/update.rs @@ -16,7 +16,7 @@ use crate::{ BlockInfo, BlockQueryData, LeafQueryData, QueryablePayload, UpdateAvailabilityData, VidCommonQueryData, }, - Leaf, Payload, VidShare, + Leaf2, Payload, VidShare, }; use anyhow::{ensure, Context}; use async_trait::async_trait; @@ -152,7 +152,7 @@ where } fn genesis_vid( - leaf: &Leaf, + leaf: &Leaf2, ) -> anyhow::Result<(VidCommonQueryData, VidShare)> { let payload = Payload::::empty().0; let bytes = payload.encode(); diff --git a/src/lib.rs b/src/lib.rs index 7bf465fc..52a082db 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -460,7 +460,7 @@ use tide_disco::{method::ReadState, App, StatusCode}; use vbs::version::StaticVersionType; pub use hotshot_types::{ - data::Leaf, + data::Leaf2, vid::{VidCommitment, VidCommon, VidShare}, }; @@ -609,7 +609,7 @@ mod test { use async_trait::async_trait; use atomic_store::{load_store::BincodeLoadStore, AtomicStore, AtomicStoreLoader, RollingLog}; use futures::future::FutureExt; - use hotshot_types::simple_certificate::QuorumCertificate; + use hotshot_types::{data::Leaf, simple_certificate::QuorumCertificate}; use portpicker::pick_unused_port; use std::ops::RangeBounds; use std::time::Duration; @@ -808,10 +808,13 @@ mod test { .unwrap(); // Mock up some data and add a block to the store. - let leaf = Leaf::::genesis(&Default::default(), &Default::default()).await; + let leaf: Leaf2<_> = Leaf::::genesis(&Default::default(), &Default::default()) + .await + .into(); let qc = QuorumCertificate::genesis::(&Default::default(), &Default::default()) - .await; + .await + .to_qc2(); let leaf = LeafQueryData::new(leaf, qc).unwrap(); let block = BlockQueryData::new(leaf.header().clone(), MockPayload::genesis()); hotshot_qs diff --git a/src/testing/consensus.rs b/src/testing/consensus.rs index 23bb7ad4..12ec260c 100644 --- a/src/testing/consensus.rs +++ b/src/testing/consensus.rs @@ -28,7 +28,7 @@ use futures::{ use hotshot::{ traits::implementations::{MasterMap, MemoryNetwork}, types::{Event, SystemContextHandle}, - HotShotInitializer, MarketplaceConfig, Memberships, SystemContext, + HotShotInitializer, MarketplaceConfig, SystemContext, }; use hotshot_example_types::{ auction_results_provider_types::TestAuctionResultsProvider, state_types::TestInstanceState, @@ -96,20 +96,10 @@ impl MockNetwork { }) .collect::>(); - let da_membership = MockMembership::new( + let membership = MockMembership::new( known_nodes_with_stake.clone(), known_nodes_with_stake.clone(), - Topic::Da, ); - let non_da_membership = MockMembership::new( - known_nodes_with_stake.clone(), - known_nodes_with_stake.clone(), - Topic::Global, - ); - let memberships = Memberships { - quorum_membership: non_da_membership.clone(), - da_membership: da_membership.clone(), - }; // Pick a random, unused port for the builder server let builder_port = portpicker::pick_unused_port().expect("No ports available"); @@ -161,7 +151,7 @@ impl MockNetwork { .into_iter() .enumerate() .map(|(node_id, priv_key)| { - let memberships = memberships.clone(); + let membership = membership.clone(); let config = config.clone(); let pub_keys = pub_keys.clone(); @@ -186,7 +176,7 @@ impl MockNetwork { priv_key, node_id as u64, config, - memberships, + membership, network, HotShotInitializer::from_genesis::( TestInstanceState::default(),