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

Commit

Permalink
Merge pull request #255 from EspressoSystems/ab/api-ver
Browse files Browse the repository at this point in the history
separate out Api version from protocol version
  • Loading branch information
imabdulbasit authored Aug 27, 2024
2 parents e4e4c72 + 3708e55 commit 75b204f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hotshot-builder-core"
version = "0.1.43"
version = "0.1.45"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
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 75b204f

Please sign in to comment.