diff --git a/Cargo.lock b/Cargo.lock index a673600..94da8ef 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -866,19 +866,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" @@ -2855,8 +2842,8 @@ dependencies = [ [[package]] name = "hotshot" -version = "0.5.79" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.82#ecfd22a4b3d20b7cf89282b172f178ab2ebf81a4" +version = "0.5.83" +source = "git+https://github.com/EspressoSystems/HotShot.git?branch=bump%2F0.5.83#f9bf48ebf53a5fa934614a13f4cbb3069c1e0fda" dependencies = [ "anyhow", "async-broadcast", @@ -2899,7 +2886,7 @@ dependencies = [ [[package]] name = "hotshot-builder-api" version = "0.1.7" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.82#ecfd22a4b3d20b7cf89282b172f178ab2ebf81a4" +source = "git+https://github.com/EspressoSystems/HotShot.git?branch=bump%2F0.5.83#f9bf48ebf53a5fa934614a13f4cbb3069c1e0fda" dependencies = [ "async-trait", "clap", @@ -2995,8 +2982,8 @@ dependencies = [ [[package]] name = "hotshot-events-service" -version = "0.1.56" -source = "git+https://github.com/EspressoSystems/hotshot-events-service.git?tag=0.1.56#c8046e6debb533c6abf431866ccf1d3787338982" +version = "0.1.57" +source = "git+https://github.com/EspressoSystems/hotshot-events-service.git?branch=ma%2Fhotshot-0.5.83#89b06b6007e88fd20bfc855d3f400b8fa045f379" dependencies = [ "async-broadcast", "async-lock 2.8.0", @@ -3022,8 +3009,8 @@ dependencies = [ [[package]] name = "hotshot-example-types" -version = "0.5.79" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.82#ecfd22a4b3d20b7cf89282b172f178ab2ebf81a4" +version = "0.5.83" +source = "git+https://github.com/EspressoSystems/HotShot.git?branch=bump%2F0.5.83#f9bf48ebf53a5fa934614a13f4cbb3069c1e0fda" dependencies = [ "anyhow", "async-lock 3.4.0", @@ -3047,8 +3034,8 @@ dependencies = [ [[package]] name = "hotshot-fakeapi" -version = "0.5.79" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.82#ecfd22a4b3d20b7cf89282b172f178ab2ebf81a4" +version = "0.5.83" +source = "git+https://github.com/EspressoSystems/HotShot.git?branch=bump%2F0.5.83#f9bf48ebf53a5fa934614a13f4cbb3069c1e0fda" dependencies = [ "anyhow", "async-lock 3.4.0", @@ -3065,8 +3052,8 @@ dependencies = [ [[package]] name = "hotshot-macros" -version = "0.5.79" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.82#ecfd22a4b3d20b7cf89282b172f178ab2ebf81a4" +version = "0.5.83" +source = "git+https://github.com/EspressoSystems/HotShot.git?branch=bump%2F0.5.83#f9bf48ebf53a5fa934614a13f4cbb3069c1e0fda" dependencies = [ "derive_builder", "proc-macro2", @@ -3076,8 +3063,8 @@ dependencies = [ [[package]] name = "hotshot-task" -version = "0.5.79" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.82#ecfd22a4b3d20b7cf89282b172f178ab2ebf81a4" +version = "0.5.83" +source = "git+https://github.com/EspressoSystems/HotShot.git?branch=bump%2F0.5.83#f9bf48ebf53a5fa934614a13f4cbb3069c1e0fda" dependencies = [ "async-broadcast", "async-trait", @@ -3089,8 +3076,8 @@ dependencies = [ [[package]] name = "hotshot-task-impls" -version = "0.5.79" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.82#ecfd22a4b3d20b7cf89282b172f178ab2ebf81a4" +version = "0.5.83" +source = "git+https://github.com/EspressoSystems/HotShot.git?branch=bump%2F0.5.83#f9bf48ebf53a5fa934614a13f4cbb3069c1e0fda" dependencies = [ "anyhow", "async-broadcast", @@ -3123,8 +3110,8 @@ dependencies = [ [[package]] name = "hotshot-testing" -version = "0.5.79" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.82#ecfd22a4b3d20b7cf89282b172f178ab2ebf81a4" +version = "0.5.83" +source = "git+https://github.com/EspressoSystems/HotShot.git?branch=bump%2F0.5.83#f9bf48ebf53a5fa934614a13f4cbb3069c1e0fda" dependencies = [ "anyhow", "async-broadcast", @@ -3165,7 +3152,7 @@ dependencies = [ [[package]] name = "hotshot-types" version = "0.1.11" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.82#ecfd22a4b3d20b7cf89282b172f178ab2ebf81a4" +source = "git+https://github.com/EspressoSystems/HotShot.git?branch=bump%2F0.5.83#f9bf48ebf53a5fa934614a13f4cbb3069c1e0fda" dependencies = [ "anyhow", "ark-bn254", @@ -4095,16 +4082,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", @@ -4129,9 +4115,9 @@ dependencies = [ [[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", @@ -4141,30 +4127,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.68", "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", @@ -4174,9 +4166,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", @@ -4203,9 +4195,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", @@ -4219,12 +4211,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", @@ -4233,13 +4225,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", @@ -4247,15 +4238,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", @@ -4265,7 +4257,7 @@ dependencies = [ "libp2p-swarm", "lru 0.12.5", "quick-protobuf", - "quick-protobuf-codec 0.3.1", + "quick-protobuf-codec", "smallvec", "thiserror 1.0.68", "tracing", @@ -4295,24 +4287,23 @@ dependencies = [ [[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", @@ -4321,13 +4312,14 @@ dependencies = [ "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", @@ -4346,12 +4338,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", @@ -4360,12 +4351,13 @@ dependencies = [ "libp2p-swarm", "pin-project", "prometheus-client", + "web-time", ] [[package]] name = "libp2p-networking" -version = "0.5.79" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.82#ecfd22a4b3d20b7cf89282b172f178ab2ebf81a4" +version = "0.5.83" +source = "git+https://github.com/EspressoSystems/HotShot.git?branch=bump%2F0.5.83#f9bf48ebf53a5fa934614a13f4cbb3069c1e0fda" dependencies = [ "anyhow", "async-trait", @@ -4391,9 +4383,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", @@ -4415,16 +4407,15 @@ dependencies = [ [[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", @@ -4433,19 +4424,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", @@ -4457,13 +4448,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", @@ -4473,9 +4465,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", @@ -4490,9 +4482,9 @@ dependencies = [ [[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", @@ -4509,9 +4501,9 @@ dependencies = [ [[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", @@ -5765,26 +5757,13 @@ 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", @@ -8170,10 +8149,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" @@ -8247,8 +8222,8 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "utils" -version = "0.5.79" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.82#ecfd22a4b3d20b7cf89282b172f178ab2ebf81a4" +version = "0.5.83" +source = "git+https://github.com/EspressoSystems/HotShot.git?branch=bump%2F0.5.83#f9bf48ebf53a5fa934614a13f4cbb3069c1e0fda" dependencies = [ "tracing", ] diff --git a/Cargo.toml b/Cargo.toml index 6fa0bd8..ce1a358 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,14 +7,14 @@ version = "0.1.58" edition = "2021" [workspace.dependencies] -hotshot = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.82" } -hotshot-builder-api = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.82" } -hotshot-events-service = { git = "https://github.com/EspressoSystems/hotshot-events-service.git", tag = "0.1.56" } -hotshot-macros = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.82" } -hotshot-task-impls = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.82" } -hotshot-testing = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.82" } -hotshot-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.82" } -hotshot-example-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.82" } +hotshot = { git = "https://github.com/EspressoSystems/HotShot.git", branch = "bump/0.5.83" } +hotshot-builder-api = { git = "https://github.com/EspressoSystems/HotShot.git", branch = "bump/0.5.83" } +hotshot-events-service = { git = "https://github.com/EspressoSystems/hotshot-events-service.git", branch = "ma/hotshot-0.5.83" } +hotshot-macros = { git = "https://github.com/EspressoSystems/HotShot.git", branch = "bump/0.5.83" } +hotshot-task-impls = { git = "https://github.com/EspressoSystems/HotShot.git", branch = "bump/0.5.83" } +hotshot-testing = { git = "https://github.com/EspressoSystems/HotShot.git", branch = "bump/0.5.83" } +hotshot-types = { git = "https://github.com/EspressoSystems/HotShot.git", branch = "bump/0.5.83" } +hotshot-example-types = { git = "https://github.com/EspressoSystems/HotShot.git", branch = "bump/0.5.83" } anyhow = "1" async-broadcast = "0.7" diff --git a/crates/legacy/src/builder_state.rs b/crates/legacy/src/builder_state.rs index dabcc91..4c0effa 100644 --- a/crates/legacy/src/builder_state.rs +++ b/crates/legacy/src/builder_state.rs @@ -1,5 +1,5 @@ use hotshot_types::{ - data::{DaProposal, Leaf2, QuorumProposal2}, + data::{DaProposal2, Leaf2, QuorumProposal2}, message::Proposal, traits::{ block_contents::{precompute_vid_commitment, BlockHeader, BlockPayload}, @@ -55,7 +55,7 @@ pub struct DecideMessage { /// DA Proposal Message to be put on the da proposal channel #[derive(Clone, Debug, PartialEq)] pub struct DaProposalMessage { - pub proposal: Arc>>, + pub proposal: Arc>>, pub sender: Types::SignatureKey, } /// Quorum proposal message to be put on the quorum proposal channel @@ -108,7 +108,7 @@ pub enum Status { #[derive(Debug, Clone, PartialEq)] pub struct DAProposalInfo { pub view_number: Types::View, - pub proposal: Arc>>, + pub proposal: Arc>>, } /// [`ALLOW_EMPTY_BLOCK_PERIOD`] is a constant that is used to determine the diff --git a/crates/legacy/src/service.rs b/crates/legacy/src/service.rs index c026ca3..294bf1f 100644 --- a/crates/legacy/src/service.rs +++ b/crates/legacy/src/service.rs @@ -8,7 +8,7 @@ use hotshot_builder_api::{ v0_2::builder::TransactionStatus, }; use hotshot_types::{ - data::{DaProposal, Leaf2, QuorumProposal2}, + data::{DaProposal2, Leaf2, QuorumProposal2}, event::EventType, message::Proposal, traits::{ @@ -1287,7 +1287,7 @@ enum HandleDaEventError { /// still open. async fn handle_da_event( da_channel_sender: &BroadcastSender>, - da_proposal: Arc>>, + da_proposal: Arc>>, sender: ::SignatureKey, ) { // We're explicitly not inspecting this error, as this function is not @@ -1309,7 +1309,7 @@ async fn handle_da_event( /// This function is the implementation for [`handle_da_event`]. async fn handle_da_event_implementation( da_channel_sender: &BroadcastSender>, - da_proposal: Arc>>, + da_proposal: Arc>>, sender: ::SignatureKey, ) -> Result<(), HandleDaEventError> { tracing::debug!( @@ -1642,13 +1642,15 @@ mod test { node_types::{TestTypes, TestVersions}, state_types::{TestInstanceState, TestValidatedState}, }; + use hotshot_types::data::DaProposal2; + use hotshot_types::data::EpochNumber; use hotshot_types::data::Leaf2; use hotshot_types::data::QuorumProposal2; use hotshot_types::drb::INITIAL_DRB_RESULT; use hotshot_types::drb::INITIAL_DRB_SEED_INPUT; use hotshot_types::traits::block_contents::Transaction; use hotshot_types::{ - data::{DaProposal, Leaf, ViewNumber}, + data::{Leaf, ViewNumber}, message::Proposal, simple_certificate::QuorumCertificate, traits::{ @@ -4140,13 +4142,15 @@ mod test { ::generated_from_seed_indexed([0; 32], 1); let (da_channel_sender, _) = async_broadcast::broadcast(10); let view_number = ViewNumber::new(10); + let epoch = EpochNumber::new(1); - let da_proposal = DaProposal:: { + let da_proposal = DaProposal2:: { encoded_transactions: Arc::new([1, 2, 3, 4, 5, 6]), metadata: TestMetadata { num_transactions: 1, }, // arbitrary view_number, + epoch, }; let encoded_txns_hash = Sha256::digest(&da_proposal.encoded_transactions); @@ -4196,13 +4200,15 @@ mod test { }; let view_number = ViewNumber::new(10); + let epoch = EpochNumber::new(1); - let da_proposal = DaProposal:: { + let da_proposal = DaProposal2:: { encoded_transactions: Arc::new([1, 2, 3, 4, 5, 6]), metadata: TestMetadata { num_transactions: 1, }, // arbitrary view_number, + epoch, }; let encoded_txns_hash = Sha256::digest(&da_proposal.encoded_transactions); @@ -4243,13 +4249,15 @@ mod test { ::generated_from_seed_indexed([0; 32], 0); let (da_channel_sender, da_channel_receiver) = async_broadcast::broadcast(10); let view_number = ViewNumber::new(10); + let epoch = EpochNumber::new(1); - let da_proposal = DaProposal:: { + let da_proposal = DaProposal2:: { encoded_transactions: Arc::new([1, 2, 3, 4, 5, 6]), metadata: TestMetadata { num_transactions: 1, }, // arbitrary view_number, + epoch, }; let encoded_txns_hash = Sha256::digest(&da_proposal.encoded_transactions); @@ -4330,6 +4338,7 @@ mod test { view_change_evidence: None, drb_seed: INITIAL_DRB_SEED_INPUT, drb_result: INITIAL_DRB_RESULT, + next_epoch_justify_qc: None, } }; @@ -4403,6 +4412,7 @@ mod test { view_change_evidence: None, drb_seed: INITIAL_DRB_SEED_INPUT, drb_result: INITIAL_DRB_RESULT, + next_epoch_justify_qc: None, } }; @@ -4467,6 +4477,7 @@ mod test { view_change_evidence: None, drb_seed: INITIAL_DRB_SEED_INPUT, drb_result: INITIAL_DRB_RESULT, + next_epoch_justify_qc: None, } }; diff --git a/crates/legacy/src/testing/basic_test.rs b/crates/legacy/src/testing/basic_test.rs index 926c9da..4a92ca7 100644 --- a/crates/legacy/src/testing/basic_test.rs +++ b/crates/legacy/src/testing/basic_test.rs @@ -1,6 +1,6 @@ pub use hotshot::traits::election::static_committee::StaticCommittee; pub use hotshot_types::{ - data::{DaProposal, EpochNumber, Leaf, ViewNumber}, + data::{EpochNumber, Leaf, ViewNumber}, message::Proposal, signature_key::BLSPubKey, simple_certificate::{QuorumCertificate, SimpleCertificate, SuccessThreshold}, @@ -23,7 +23,7 @@ mod tests { use hotshot_builder_api::v0_2::data_source::BuilderDataSource; use hotshot_example_types::auction_results_provider_types::TestAuctionResult; use hotshot_example_types::node_types::TestVersions; - use hotshot_types::data::{Leaf2, QuorumProposal2}; + use hotshot_types::data::{DaProposal2, Leaf2, QuorumProposal2}; use hotshot_types::drb::{INITIAL_DRB_RESULT, INITIAL_DRB_SEED_INPUT}; use hotshot_types::simple_vote::QuorumData2; use hotshot_types::{ @@ -93,6 +93,7 @@ mod tests { type Membership = StaticCommittee; type BuilderSignatureKey = BuilderKey; type AuctionResult = TestAuctionResult; + const EPOCH_HEIGHT: u64 = 1000; // arbitrary } // no of test messages to send let num_test_messages = 5; @@ -192,6 +193,7 @@ mod tests { view_change_evidence: None, drb_seed: INITIAL_DRB_SEED_INPUT, drb_result: INITIAL_DRB_RESULT, + next_epoch_justify_qc: None, } }; @@ -290,12 +292,13 @@ mod tests { // Prepare the DA proposal message let da_proposal_message = { - let da_proposal = DaProposal { + let da_proposal = DaProposal2 { encoded_transactions: encoded_transactions.clone().into(), metadata: TestMetadata { num_transactions: encoded_transactions.len() as u64, }, view_number: ViewNumber::new(round as u64), + epoch: EpochNumber::genesis(), // TODO: check if this is okay }; let encoded_transactions_hash = Sha256::digest(&encoded_transactions); let seed = [round as u8; 32]; @@ -363,6 +366,7 @@ mod tests { let q_data = QuorumData2:: { leaf_commit: leaf.commit(), + epoch: EpochNumber::genesis(), // TODO: check if this is okay }; let previous_quorum_view_number = @@ -394,6 +398,7 @@ mod tests { view_change_evidence: None, drb_seed: INITIAL_DRB_SEED_INPUT, drb_result: INITIAL_DRB_RESULT, + next_epoch_justify_qc: None, }; let payload_vid_commitment = diff --git a/crates/legacy/src/testing/finalization_test.rs b/crates/legacy/src/testing/finalization_test.rs index 3ec611d..4d93db7 100644 --- a/crates/legacy/src/testing/finalization_test.rs +++ b/crates/legacy/src/testing/finalization_test.rs @@ -22,7 +22,7 @@ use hotshot_example_types::{ state_types::{TestInstanceState, TestValidatedState}, }; use hotshot_types::{ - data::{DaProposal, QuorumProposal2, ViewNumber}, + data::{DaProposal2, EpochNumber, QuorumProposal2, ViewNumber}, drb::{INITIAL_DRB_RESULT, INITIAL_DRB_SEED_INPUT}, message::Proposal, simple_certificate::QuorumCertificate, @@ -278,10 +278,11 @@ async fn progress_round_with_transactions( da_proposal_sender .broadcast(MessageType::DaProposalMessage(DaProposalMessage { proposal: Arc::new(Proposal { - data: DaProposal:: { + data: DaProposal2:: { encoded_transactions: encoded_transactions.clone().into(), metadata, view_number: next_view, + epoch: EpochNumber::genesis(), // TODO }, signature: da_signature, _pd: Default::default(), @@ -330,6 +331,7 @@ async fn progress_round_with_transactions( view_change_evidence: None, drb_seed: INITIAL_DRB_SEED_INPUT, drb_result: INITIAL_DRB_RESULT, + next_epoch_justify_qc: None, // TODO }; let payload_vid_commitment = diff --git a/crates/legacy/src/testing/mod.rs b/crates/legacy/src/testing/mod.rs index 00787a4..3610eac 100644 --- a/crates/legacy/src/testing/mod.rs +++ b/crates/legacy/src/testing/mod.rs @@ -13,7 +13,7 @@ use hotshot::{ types::{BLSPubKey, SignatureKey}, }; use hotshot_types::{ - data::{DaProposal, Leaf2, QuorumProposal2, ViewNumber}, + data::{DaProposal2, EpochNumber, Leaf2, QuorumProposal2, ViewNumber}, drb::{INITIAL_DRB_RESULT, INITIAL_DRB_SEED_INPUT}, message::Proposal, simple_certificate::{QuorumCertificate, SimpleCertificate, SuccessThreshold}, @@ -139,12 +139,13 @@ pub async fn calc_proposal_msg( // Prepare the DA proposal message let da_proposal_message: DaProposalMessage = { - let da_proposal = DaProposal { + let da_proposal = DaProposal2 { encoded_transactions: encoded_transactions.clone().into(), metadata: TestMetadata { num_transactions: encoded_transactions.len() as u64, }, view_number: ViewNumber::new(round as u64), + epoch: EpochNumber::new(1), }; let encoded_transactions_hash = Sha256::digest(&encoded_transactions); let da_signature = @@ -184,6 +185,7 @@ pub async fn calc_proposal_msg( let prev_justify_qc = &prev_proposal.justify_qc; let quorum_data = QuorumData2:: { leaf_commit: Leaf2::from_quorum_proposal(prev_proposal).commit(), + epoch: EpochNumber::new(1), }; // form a justify qc @@ -207,6 +209,7 @@ pub async fn calc_proposal_msg( view_change_evidence: None, drb_seed: INITIAL_DRB_SEED_INPUT, drb_result: INITIAL_DRB_RESULT, + next_epoch_justify_qc: None, // TODO }; let quorum_signature = diff --git a/crates/legacy_refactored/src/testing/basic.rs b/crates/legacy_refactored/src/testing/basic.rs index f3b1733..0f6cde4 100644 --- a/crates/legacy_refactored/src/testing/basic.rs +++ b/crates/legacy_refactored/src/testing/basic.rs @@ -205,6 +205,7 @@ async fn test_pruning() { view_change_evidence: None, drb_seed: INITIAL_DRB_SEED_INPUT, drb_result: INITIAL_DRB_RESULT, + next_epoch_justify_qc: None, // TODO }); event_stream_sender .broadcast(hotshot::types::Event { diff --git a/crates/shared/src/coordinator/mod.rs b/crates/shared/src/coordinator/mod.rs index c7f0974..56a500e 100644 --- a/crates/shared/src/coordinator/mod.rs +++ b/crates/shared/src/coordinator/mod.rs @@ -12,7 +12,7 @@ use either::Either; use hotshot::traits::BlockPayload; use hotshot_builder_api::v0_1::builder::TransactionStatus; use hotshot_types::{ - data::{DaProposal, QuorumProposal2}, + data::{DaProposal2, QuorumProposal2}, event::LeafInfo, traits::{ block_contents::BlockHeader, @@ -33,7 +33,7 @@ use crate::{ pub mod tiered_view_map; type ProposalMap = - HashMap, Either, DaProposal>>; + HashMap, Either, DaProposal2>>; type BuilderStateMap = TieredViewMap, Arc>>; @@ -213,7 +213,7 @@ where /// This function should be called whenever new DA Proposal is recieved from HotShot. /// Coordinator uses matching Quorum and DA proposals to track creation of new blocks /// and spawning corresponding builder states for those. - pub async fn handle_da_proposal(&self, da_proposal: DaProposal) { + pub async fn handle_da_proposal(&self, da_proposal: DaProposal2) { let proposal_id = ProposalId::from_da_proposal(&da_proposal); self.handle_proposal(proposal_id, Either::Right(da_proposal)) .await; @@ -238,7 +238,7 @@ where async fn handle_proposal( &self, proposal_id: ProposalId, - proposal: Either, DaProposal>, + proposal: Either, DaProposal2>, ) { match self.proposals.lock().await.entry(proposal_id) { Entry::Occupied(entry) => { @@ -308,7 +308,7 @@ where async fn spawn_builder_state( &self, quorum_proposal: QuorumProposal2, - da_proposal: DaProposal, + da_proposal: DaProposal2, ) { assert_eq!(quorum_proposal.view_number, da_proposal.view_number); diff --git a/crates/shared/src/state.rs b/crates/shared/src/state.rs index 0f3fcf6..943b65b 100644 --- a/crates/shared/src/state.rs +++ b/crates/shared/src/state.rs @@ -13,7 +13,7 @@ use async_lock::{Mutex, RwLock}; use committable::{Commitment, Committable}; use hotshot::traits::{BlockPayload, ValidatedState}; use hotshot_types::{ - data::{DaProposal, Leaf2, QuorumProposal2}, + data::{DaProposal2, Leaf2, QuorumProposal2}, traits::{block_contents::BlockHeader, node_implementation::NodeType}, }; @@ -143,7 +143,7 @@ where pub(crate) async fn new_child( self: Arc, quorum_proposal: QuorumProposal2, - da_proposal: DaProposal, + da_proposal: DaProposal2, ) -> Arc { let leaf = Leaf2::from_quorum_proposal(&quorum_proposal); diff --git a/crates/shared/src/testing/consensus.rs b/crates/shared/src/testing/consensus.rs index 20f7b6b..1f3f8af 100644 --- a/crates/shared/src/testing/consensus.rs +++ b/crates/shared/src/testing/consensus.rs @@ -17,7 +17,7 @@ use hotshot_example_types::{ state_types::{TestInstanceState, TestValidatedState}, }; use hotshot_types::{ - data::{DaProposal, Leaf2, QuorumProposal2, ViewNumber}, + data::{DaProposal2, EpochNumber, Leaf2, QuorumProposal2, ViewNumber}, drb::{INITIAL_DRB_RESULT, INITIAL_DRB_SEED_INPUT}, message::Proposal, simple_certificate::{QuorumCertificate, SimpleCertificate, SuccessThreshold}, @@ -27,6 +27,7 @@ use hotshot_types::{ use sha2::{Digest, Sha256}; pub struct SimulatedChainState { + epoch: EpochNumber, round: ViewNumber, previous_quorum_proposal: Option>, event_stream_sender: Sender>, @@ -35,6 +36,7 @@ pub struct SimulatedChainState { impl SimulatedChainState { pub fn new(event_stream_sender: Sender>) -> Self { Self { + epoch: EpochNumber::genesis(), round: ViewNumber::genesis(), previous_quorum_proposal: None, event_stream_sender, @@ -75,10 +77,11 @@ impl SimulatedChainState { ) .expect("Failed to sign payload commitment while preparing DA proposal"); - let da_proposal = DaProposal { + let da_proposal = DaProposal2 { encoded_transactions: encoded_transactions.into(), metadata, view_number: self.round, + epoch: self.epoch, }; let block_header = TestBlockHeader { @@ -101,6 +104,7 @@ impl SimulatedChainState { let prev_justify_qc = &prev_proposal.justify_qc; let quorum_data = QuorumData2:: { leaf_commit: Committable::commit(&Leaf2::from_quorum_proposal(prev_proposal)), + epoch: self.epoch, }; // form a justify qc @@ -125,6 +129,7 @@ impl SimulatedChainState { drb_seed: INITIAL_DRB_SEED_INPUT, drb_result: INITIAL_DRB_RESULT, + next_epoch_justify_qc: None, }; let quorum_proposal_event = EventType::QuorumProposal { diff --git a/crates/shared/src/testing/mock.rs b/crates/shared/src/testing/mock.rs index 1d9e494..537ddd7 100644 --- a/crates/shared/src/testing/mock.rs +++ b/crates/shared/src/testing/mock.rs @@ -9,6 +9,8 @@ use hotshot_example_types::{ node_types::{TestTypes, TestVersions}, state_types::{TestInstanceState, TestValidatedState}, }; +use hotshot_types::data::DaProposal2; +use hotshot_types::data::EpochNumber; use hotshot_types::data::QuorumProposal2; use hotshot_types::data::ViewNumber; use hotshot_types::drb::INITIAL_DRB_RESULT; @@ -18,7 +20,7 @@ use hotshot_types::simple_certificate::QuorumCertificate2; use hotshot_types::simple_vote::QuorumData2; use hotshot_types::traits::block_contents::{vid_commitment, GENESIS_VID_NUM_STORAGE_NODES}; use hotshot_types::{ - data::{random_commitment, DaProposal, Leaf, Leaf2}, + data::{random_commitment, Leaf, Leaf2}, message::UpgradeLock, simple_certificate::QuorumCertificate, simple_vote::VersionedVoteData, @@ -69,7 +71,7 @@ pub async fn decide_leaf_chain_with_transactions( } /// Create mock pair of DA and Quorum proposals -pub async fn proposals(view: u64) -> (DaProposal, QuorumProposal2) { +pub async fn proposals(view: u64) -> (DaProposal2, QuorumProposal2) { let transaction = transaction(); proposals_with_transactions(view, vec![transaction]).await } @@ -78,7 +80,8 @@ pub async fn proposals(view: u64) -> (DaProposal, QuorumProposal2, -) -> (DaProposal, QuorumProposal2) { +) -> (DaProposal2, QuorumProposal2) { + let epoch = EpochNumber::genesis(); let view_number = ::View::new(view); let upgrade_lock = UpgradeLock::::new(); let validated_state = TestValidatedState::default(); @@ -116,11 +119,13 @@ pub async fn proposals_with_transactions( view_change_evidence: None, drb_seed: INITIAL_DRB_SEED_INPUT, drb_result: INITIAL_DRB_RESULT, + next_epoch_justify_qc: None, }; let leaf = Leaf2::from_quorum_proposal(&parent_proposal); let quorum_data = QuorumData2 { leaf_commit: leaf.commit(), + epoch, }; let versioned_data = VersionedVoteData::<_, _, _>::new_infallible( @@ -136,10 +141,11 @@ pub async fn proposals_with_transactions( QuorumCertificate2::new(quorum_data, commitment, view_number, None, PhantomData); ( - DaProposal { + DaProposal2 { encoded_transactions: encoded_transactions.into(), metadata, view_number, + epoch, }, QuorumProposal2 { block_header: leaf.block_header().clone(), @@ -149,6 +155,7 @@ pub async fn proposals_with_transactions( view_change_evidence: None, drb_seed: INITIAL_DRB_SEED_INPUT, drb_result: INITIAL_DRB_RESULT, + next_epoch_justify_qc: None, }, ) } diff --git a/crates/shared/src/utils/mod.rs b/crates/shared/src/utils/mod.rs index e826a4a..96bfe7b 100644 --- a/crates/shared/src/utils/mod.rs +++ b/crates/shared/src/utils/mod.rs @@ -6,7 +6,7 @@ use futures::{ }; use hotshot::traits::BlockPayload; use hotshot_types::{ - data::{DaProposal, QuorumProposal2}, + data::{DaProposal2, QuorumProposal2}, traits::{ block_contents::BlockHeader, node_implementation::NodeType, signature_key::BuilderSignatureKey, @@ -48,7 +48,7 @@ where } } - pub fn from_da_proposal(proposal: &DaProposal) -> Self { + pub fn from_da_proposal(proposal: &DaProposal2) -> Self { let builder_commitment = >::from_bytes( &proposal.encoded_transactions, &proposal.metadata,