Skip to content
This repository has been archived by the owner on Dec 3, 2024. It is now read-only.

Commit

Permalink
separate out Api version from protocol version
Browse files Browse the repository at this point in the history
  • Loading branch information
imabdulbasit committed Aug 27, 2024
1 parent e4e4c72 commit a4f286c
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use hotshot_types::{
vid::{VidCommitment, VidPrecomputeData},
};
use lru::LruCache;
use vbs::version::StaticVersionType;

use crate::WaitAndKeep;
use crate::{
Expand Down Expand Up @@ -814,18 +815,18 @@ impl<Types: NodeType> ReadState for ProxyGlobalState<Types> {
}
}

async fn connect_to_events_service<Types: NodeType, V: Versions>(
async fn connect_to_events_service<Types: NodeType, ApiVer: StaticVersionType>(
hotshot_events_api_url: Url,
) -> Option<(
surf_disco::socket::Connection<
Event<Types>,
surf_disco::socket::Unsupported,
EventStreamError,
V::Base,
ApiVer,
>,
GeneralStaticCommittee<Types, <Types as NodeType>::SignatureKey>,
)> {
let client = surf_disco::Client::<hotshot_events_service::events::Error, V::Base>::new(
let client = surf_disco::Client::<hotshot_events_service::events::Error, ApiVer>::new(
hotshot_events_api_url.clone(),
);

Expand Down Expand Up @@ -874,7 +875,10 @@ async fn connect_to_events_service<Types: NodeType, V: Versions>(
/*
Running Non-Permissioned Builder Service
*/
pub async fn run_non_permissioned_standalone_builder_service<Types: NodeType, V: Versions>(
pub async fn run_non_permissioned_standalone_builder_service<
Types: NodeType,
ApiVer: StaticVersionType,
>(
// sending a DA proposal from the hotshot to the builder states
da_sender: BroadcastSender<MessageType<Types>>,

Expand All @@ -891,7 +895,7 @@ pub async fn run_non_permissioned_standalone_builder_service<Types: NodeType, V:
global_state: Arc<RwLock<GlobalState<Types>>>,
) -> Result<(), anyhow::Error> {
// connection to the events stream
let connected = connect_to_events_service::<_, V>(hotshot_events_api_url.clone()).await;
let connected = connect_to_events_service::<_, ApiVer>(hotshot_events_api_url.clone()).await;
if connected.is_none() {
return Err(anyhow!(
"failed to connect to API at {hotshot_events_api_url}"
Expand Down Expand Up @@ -975,7 +979,7 @@ pub async fn run_non_permissioned_standalone_builder_service<Types: NodeType, V:
None => {
tracing::error!("Event stream ended");
let connected =
connect_to_events_service::<_, V>(hotshot_events_api_url.clone()).await;
connect_to_events_service::<_, ApiVer>(hotshot_events_api_url.clone()).await;
if connected.is_none() {
return Err(anyhow!(
"failed to reconnect to API at {hotshot_events_api_url}"
Expand Down

0 comments on commit a4f286c

Please sign in to comment.