Skip to content
472 changes: 331 additions & 141 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "hyperdrive_lib"
authors = ["Sybil Technologies AG"]
version = "1.9.1"
version = "1.9.2"
edition = "2021"
description = "A general-purpose sovereign cloud computing platform"
homepage = "https://hyperware.ai"
Expand Down
2 changes: 1 addition & 1 deletion hyperdrive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "hyperdrive"
authors = ["Sybil Technologies AG"]
version = "1.9.1"
version = "1.9.2"
edition = "2021"
description = "A general-purpose sovereign cloud computing platform"
homepage = "https://hyperware.ai"
Expand Down
74 changes: 38 additions & 36 deletions hyperdrive/packages/app-store/chain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,43 +733,45 @@ fn handle_message(our: &Address, state: &mut State, message: &Message) -> anyhow
} else {
if message.source().process == "eth:distro:sys" {
let eth_result = serde_json::from_slice::<eth::EthSubResult>(message.body())?;
if let Ok(eth::EthSub { id, result }) = eth_result {
if let Ok(eth::SubscriptionResult::Log(ref log)) =
serde_json::from_value::<eth::SubscriptionResult>(result)
{
// Determine which subscription this is from
// Note: log is Box<eth::Log>, we need to dereference it
let log_ref: &eth::Log = &**log;
let context = if id == SUBSCRIPTION_NUMBER {
LogContext::Hypermap(log_ref.clone())
} else if id == BINDINGS_SUBSCRIPTION {
LogContext::Bindings(log_ref.clone())
} else {
return Ok(false); // Unknown subscription
};
// delay handling of ETH RPC subscriptions by DELAY_MS
// to allow hns to have a chance to process block
timer::set_timer(DELAY_MS, Some(serde_json::to_vec(&context)?));
match eth_result {
Ok(eth::EthSub { id, result }) => {
if let Ok(eth::SubscriptionResult::Log(ref log)) =
serde_json::from_value::<eth::SubscriptionResult>(result)
{
// Determine which subscription this is from
// Note: log is Box<eth::Log>, we need to dereference it
let log_ref: &eth::Log = &**log;
let context = if id == SUBSCRIPTION_NUMBER {
LogContext::Hypermap(log_ref.clone())
} else if id == BINDINGS_SUBSCRIPTION {
LogContext::Bindings(log_ref.clone())
} else {
return Ok(false); // Unknown subscription
};
// delay handling of ETH RPC subscriptions by DELAY_MS
// to allow hns to have a chance to process block
timer::set_timer(DELAY_MS, Some(serde_json::to_vec(&context)?));
}
}
Err(err) => {
if err.id == SUBSCRIPTION_NUMBER {
let _ = state.hypermap.provider.unsubscribe(SUBSCRIPTION_NUMBER);
state.hypermap.provider.subscribe_loop(
SUBSCRIPTION_NUMBER,
app_store_filter(state),
1,
0,
);
} else if err.id == BINDINGS_SUBSCRIPTION {
let _ = state.bindings.provider.unsubscribe(BINDINGS_SUBSCRIPTION);
state.bindings.provider.subscribe_loop(
BINDINGS_SUBSCRIPTION,
bindings_filter(&state.bindings),
1,
0,
);
}
}
} else {
// unsubscribe to make sure we have cleaned up after ourselves;
// drop Result since we don't care if no subscription exists,
// just being diligent in case it does!
let _ = state.hypermap.provider.unsubscribe(SUBSCRIPTION_NUMBER);
let _ = state.bindings.provider.unsubscribe(BINDINGS_SUBSCRIPTION);
// re-subscribe if error
state.hypermap.provider.subscribe_loop(
SUBSCRIPTION_NUMBER,
app_store_filter(state),
1,
0,
);
state.bindings.provider.subscribe_loop(
BINDINGS_SUBSCRIPTION,
bindings_filter(&state.bindings),
1,
0,
);
}
} else {
let req = serde_json::from_slice::<ChainRequest>(message.body())?;
Expand Down
1 change: 1 addition & 0 deletions hyperdrive/packages/app-store/downloads/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ type ManualDownloads = HashMap<(PackageId, String), ManualDownloadStatus>;
#[derive(Debug, Serialize, Deserialize)]
pub struct State {
// persisted metadata about which packages we are mirroring
#[serde(default)]
mirroring: HashSet<PackageId>,
// note, pending auto_updates are not persisted.
}
Expand Down
6 changes: 6 additions & 0 deletions hyperdrive/packages/hypermap-cacher/binding-cacher/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ const DEFAULT_NODES: &[&str] = &[
#[cfg(feature = "simulation-mode")]
const DEFAULT_NODES: &[&str] = &["fake.os"];

fn default_nodes() -> Vec<String> {
DEFAULT_NODES.iter().map(|s| s.to_string()).collect()
}

// Internal representation of LogsMetadata, similar to WIT but for Rust logic.
#[derive(Serialize, Deserialize, Debug, Clone)]
struct LogsMetadataInternal {
Expand Down Expand Up @@ -105,7 +109,9 @@ struct State {
block_batch_size: u64,
is_cache_timer_live: bool,
drive_path: String,
#[serde(default)]
is_providing: bool,
#[serde(default = "default_nodes")]
nodes: Vec<String>,
#[serde(skip)]
is_starting: bool,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ const DEFAULT_NODES: &[&str] = &[
#[cfg(feature = "simulation-mode")]
const DEFAULT_NODES: &[&str] = &["fake.os"];

fn default_nodes() -> Vec<String> {
DEFAULT_NODES.iter().map(|s| s.to_string()).collect()
}

// Internal representation of LogsMetadata, similar to WIT but for Rust logic.
#[derive(Serialize, Deserialize, Debug, Clone)]
struct LogsMetadataInternal {
Expand Down Expand Up @@ -102,7 +106,9 @@ struct State {
block_batch_size: u64,
is_cache_timer_live: bool,
drive_path: String,
#[serde(default)]
is_providing: bool,
#[serde(default = "default_nodes")]
nodes: Vec<String>,
#[serde(skip)]
is_starting: bool,
Expand Down
Loading
Loading