From 9fdf32825ec363f5783648781b582bb35c319f2e Mon Sep 17 00:00:00 2001 From: tbro <48967308+tbro@users.noreply.github.com> Date: Thu, 15 Aug 2024 11:56:45 +0300 Subject: [PATCH] Update hotshot (#237) bump hotshot version to 0.1.70 --------- Co-authored-by: tbro --- Cargo.lock | 18 +++++++++--------- Cargo.toml | 10 +++++----- src/service.rs | 18 ++++++++++-------- src/testing/basic_test.rs | 29 ++++++++++++++++++----------- 4 files changed, 42 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4117ecd..2edc8c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2958,7 +2958,7 @@ dependencies = [ [[package]] name = "hotshot" version = "0.5.69" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.69#b3796d6abea494780f6220845d729cb186a11f6a" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.70#3e38cdf852816d73a3b4ffc58c5ccd3a0c6e8028" dependencies = [ "anyhow", "async-broadcast", @@ -3005,7 +3005,7 @@ dependencies = [ [[package]] name = "hotshot-builder-api" version = "0.1.7" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.69#b3796d6abea494780f6220845d729cb186a11f6a" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.70#3e38cdf852816d73a3b4ffc58c5ccd3a0c6e8028" dependencies = [ "async-trait", "clap", @@ -3056,7 +3056,7 @@ dependencies = [ [[package]] name = "hotshot-events-service" version = "0.1.38" -source = "git+https://github.com/EspressoSystems/hotshot-events-service.git?tag=0.1.40#9ed690db7a12a4e8a64bb49a0437086232888765" +source = "git+https://github.com/EspressoSystems/hotshot-events-service.git?tag=0.1.41#6812369e20eb2972851690f080a117cae0282a6f" dependencies = [ "async-broadcast", "async-compatibility-layer", @@ -3082,7 +3082,7 @@ dependencies = [ [[package]] name = "hotshot-example-types" version = "0.5.69" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.69#b3796d6abea494780f6220845d729cb186a11f6a" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.70#3e38cdf852816d73a3b4ffc58c5ccd3a0c6e8028" dependencies = [ "anyhow", "async-broadcast", @@ -3115,7 +3115,7 @@ dependencies = [ [[package]] name = "hotshot-orchestrator" version = "0.5.69" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.69#b3796d6abea494780f6220845d729cb186a11f6a" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.70#3e38cdf852816d73a3b4ffc58c5ccd3a0c6e8028" dependencies = [ "anyhow", "async-compatibility-layer", @@ -3145,7 +3145,7 @@ dependencies = [ [[package]] name = "hotshot-task" version = "0.5.69" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.69#b3796d6abea494780f6220845d729cb186a11f6a" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.70#3e38cdf852816d73a3b4ffc58c5ccd3a0c6e8028" dependencies = [ "anyhow", "async-broadcast", @@ -3160,7 +3160,7 @@ dependencies = [ [[package]] name = "hotshot-task-impls" version = "0.5.69" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.69#b3796d6abea494780f6220845d729cb186a11f6a" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.70#3e38cdf852816d73a3b4ffc58c5ccd3a0c6e8028" dependencies = [ "anyhow", "async-broadcast", @@ -3197,7 +3197,7 @@ dependencies = [ [[package]] name = "hotshot-types" version = "0.1.11" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.69#b3796d6abea494780f6220845d729cb186a11f6a" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.70#3e38cdf852816d73a3b4ffc58c5ccd3a0c6e8028" dependencies = [ "anyhow", "ark-bn254", @@ -4359,7 +4359,7 @@ dependencies = [ [[package]] name = "libp2p-networking" version = "0.5.69" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.69#b3796d6abea494780f6220845d729cb186a11f6a" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.70#3e38cdf852816d73a3b4ffc58c5ccd3a0c6e8028" dependencies = [ "anyhow", "async-compatibility-layer", diff --git a/Cargo.toml b/Cargo.toml index eb7f8aa..b26048e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,10 +17,10 @@ clap = { version = "4.5", features = ["derive", "env"] } committable = "0.2" derivative = "2.2" futures = "0.3" -hotshot = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.69" } -hotshot-builder-api = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.69" } -hotshot-events-service = { git = "https://github.com/EspressoSystems/hotshot-events-service.git", tag = "0.1.40" } -hotshot-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.69" } +hotshot = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.70" } +hotshot-builder-api = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.70" } +hotshot-events-service = { git = "https://github.com/EspressoSystems/hotshot-events-service.git", tag = "0.1.41" } +hotshot-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.70" } serde = { version = "1.0", features = ["derive"] } sha2 = "0.10" snafu = "0.8" @@ -34,7 +34,7 @@ lru = "0.12.3" hex = "0.4.3" [dev-dependencies] -hotshot-example-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.69" } +hotshot-example-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.70" } [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(async_executor_impl, values("async-std", "tokio"))'] } diff --git a/src/service.rs b/src/service.rs index fae157f..536b050 100644 --- a/src/service.rs +++ b/src/service.rs @@ -16,7 +16,7 @@ use hotshot_types::{ consensus_api::ConsensusApi, election::Membership, network::Topic, - node_implementation::{ConsensusTime, NodeType}, + node_implementation::{ConsensusTime, NodeType, Versions}, signature_key::{BuilderSignatureKey, SignatureKey}, }, utils::BuilderCommitment, @@ -715,18 +715,18 @@ impl ReadState for ProxyGlobalState { } } -async fn connect_to_events_service( +async fn connect_to_events_service( hotshot_events_api_url: Url, ) -> Option<( surf_disco::socket::Connection< Event, surf_disco::socket::Unsupported, EventStreamError, - Types::Base, + V::Base, >, GeneralStaticCommittee::SignatureKey>, )> { - let client = surf_disco::Client::::new( + let client = surf_disco::Client::::new( hotshot_events_api_url.clone(), ); @@ -775,7 +775,7 @@ async fn connect_to_events_service( /* Running Non-Permissioned Builder Service */ -pub async fn run_non_permissioned_standalone_builder_service( +pub async fn run_non_permissioned_standalone_builder_service( // sending a DA proposal from the hotshot to the builder states da_sender: BroadcastSender>, @@ -792,7 +792,7 @@ pub async fn run_non_permissioned_standalone_builder_service( hotshot_events_api_url: Url, ) -> Result<(), anyhow::Error> { // connection to the events stream - let connected = connect_to_events_service(hotshot_events_api_url.clone()).await; + let connected = connect_to_events_service::(hotshot_events_api_url.clone()).await; if connected.is_none() { return Err(anyhow!( "failed to connect to API at {hotshot_events_api_url}" @@ -856,7 +856,8 @@ pub async fn run_non_permissioned_standalone_builder_service( } None => { tracing::error!("Event stream ended"); - let connected = connect_to_events_service(hotshot_events_api_url.clone()).await; + let connected = + connect_to_events_service::(hotshot_events_api_url.clone()).await; if connected.is_none() { return Err(anyhow!( "failed to reconnect to API at {hotshot_events_api_url}" @@ -875,6 +876,7 @@ Running Permissioned Builder Service pub async fn run_permissioned_standalone_builder_service< Types: NodeType, I: NodeImplementation, + V: Versions, >( // sending received transactions tx_sender: BroadcastSender>>, @@ -889,7 +891,7 @@ pub async fn run_permissioned_standalone_builder_service< decide_sender: BroadcastSender>, // hotshot context handle - hotshot_handle: Arc>, + hotshot_handle: Arc>, ) { let mut event_stream = hotshot_handle.event_stream(); loop { diff --git a/src/testing/basic_test.rs b/src/testing/basic_test.rs index 15ff2a6..4781ab9 100644 --- a/src/testing/basic_test.rs +++ b/src/testing/basic_test.rs @@ -48,7 +48,6 @@ mod tests { use sha2::{Digest, Sha256}; use std::sync::Arc; use std::time::Duration; - use vbs::version::StaticVersion; use serde::{Deserialize, Serialize}; /// This test simulates multiple builder states receiving messages from the channels and processing them @@ -82,12 +81,6 @@ mod tests { type InstanceState = TestInstanceState; type Membership = GeneralStaticCommittee; type BuilderSignatureKey = BuilderKey; - type Base = StaticVersion<0, 1>; - type Upgrade = StaticVersion<0, 2>; - const UPGRADE_HASH: [u8; 32] = [ - 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, - 0, 0, 0, 0, - ]; type AuctionResult = TestAuctionResult; } // no of test messages to send @@ -175,7 +168,9 @@ mod tests { >::from_transactions( vec![tx.clone()], &TestValidatedState::default(), - &TestInstanceState {}, + &TestInstanceState { + ..Default::default() + }, ) .await .unwrap(); @@ -210,7 +205,9 @@ mod tests { 0 => { QuorumCertificate::::genesis( &TestValidatedState::default(), - &TestInstanceState {}, + &TestInstanceState { + ..Default::default() + }, ) .await } @@ -283,7 +280,15 @@ mod tests { // Prepare the decide message // let qc = QuorumCertificate::::genesis(); let leaf = match i { - 0 => Leaf::genesis(&TestValidatedState::default(), &TestInstanceState {}).await, + 0 => { + Leaf::genesis( + &TestValidatedState::default(), + &TestInstanceState { + ..Default::default() + }, + ) + .await + } _ => { let block_payload = BlockPayload::::from_bytes( &encoded_transactions, @@ -369,7 +374,9 @@ mod tests { NonZeroUsize::new(TEST_NUM_NODES_IN_VID_COMPUTATION).unwrap(), Duration::from_millis(10), // max time to wait for non-zero txn block 0, // base fee - Arc::new(TestInstanceState {}), + Arc::new(TestInstanceState { + ..Default::default() + }), Duration::from_secs(3600), // duration for txn garbage collection Arc::new(TestValidatedState::default()), );