Skip to content

Add update op to network monitor #1578

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
May 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 21 additions & 94 deletions 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 crates/core/src/client_events/combinator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl<const N: usize> super::ClientEventsProxy for ClientEventsCombinator<N> {
fn recv(&mut self) -> BoxFuture<'_, Result<OpenRequest<'static>, ClientError>> {
async {
let Some((idx, mut rx, res)) = self.pending_futs.next().await else {
unreachable!();
unreachable!("pending_futs should always have a future unless the combinator is dropped");
};

let res = res
Expand Down
10 changes: 6 additions & 4 deletions crates/core/src/client_events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ where
}
res = results.next(), if !results.is_empty() => {
let Some(f_res) = res else {
unreachable!();
unreachable!("results.next() should only return None if results is empty, which is guarded against");
};
match f_res {
(cli_id, Ok(Some(res))) => {
Expand Down Expand Up @@ -592,14 +592,14 @@ async fn process_open_request(
})));
}
ClientRequest::Disconnect { .. } => {
unreachable!();
tracing::debug!("Received disconnect from user event");
}
ClientRequest::NodeQueries(_) => {
tracing::debug!("Received node queries from user event");

let Some(tx) = callback_tx else {
tracing::error!("callback_tx not available for NodeQueries");
unreachable!();
unreachable!("callback_tx should always be Some for NodeQueries based on initialization logic");
};

if let Err(err) = op_manager
Expand Down Expand Up @@ -1041,7 +1041,9 @@ pub(crate) mod test {
};
return Some(request.into());
}
_ => unreachable!(),
_ => unreachable!(
"gen_range(0..100) should always fall into one of the defined ranges"
),
}
}
None
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/client_events/websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ async fn new_client_connection(
match response_recv.recv().await {
Some(HostCallbackResult::NewId { id: client_id, .. }) => Ok((response_recv, client_id)),
None => Err(ErrorKind::NodeUnavailable.into()),
other => unreachable!("received unexpected message: {other:?}"),
other => unreachable!("received unexpected message after NewConnection: {other:?}"),
}
}

Expand Down
6 changes: 3 additions & 3 deletions crates/core/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ impl ConfigPathsArgs {
.unwrap_or_else(|| {
let default_dirs = Self::default_dirs(id)?;
let Either::Left(defaults) = default_dirs else {
unreachable!()
unreachable!("default_dirs should return Left if data_dir is None and id is not set for temp dir")
};
Ok(defaults.data_dir().to_path_buf())
})?;
Expand Down Expand Up @@ -712,7 +712,7 @@ impl ConfigPathsArgs {
.unwrap_or_else(|| {
let default_dirs = Self::default_dirs(id)?;
let Either::Left(defaults) = default_dirs else {
unreachable!()
unreachable!("default_dirs should return Left if config_dir is None and id is not set for temp dir")
};
Ok(defaults.config_dir().to_path_buf())
})?;
Expand Down Expand Up @@ -968,7 +968,7 @@ impl GlobalExecutor {
} else if let Some(rt) = &*ASYNC_RT {
rt.spawn(f)
} else {
unreachable!("the executor must have been initialized")
unreachable!("ASYNC_RT should be initialized if Handle::try_current fails")
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/core/src/contract/executor/mock_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl Executor<MockRuntime> {
_req: ClientRequest<'_>,
_updates: Option<mpsc::UnboundedSender<Result<HostResponse, WsClientError>>>,
) -> Response {
unreachable!()
unreachable!("MockRuntime does not handle client requests directly")
}
}

Expand Down Expand Up @@ -105,7 +105,7 @@ impl ContractExecutor for Executor<MockRuntime> {
.map_err(ExecutorError::other)?;
Ok(UpsertResult::Updated(incoming_state))
}
(update, contract) => unreachable!("{update:?}, {contract:?}"),
(update, contract) => unreachable!("Invalid combination of state/delta and contract presence: {update:?}, {contract:?}"),
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/core/src/contract/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ where
ContractHandlerEvent::PutResponse {
new_value: Err(err),
}
}
} // UpsertResult::NotAvailable is not used in this path
};

contract_handler
Expand Down Expand Up @@ -228,7 +228,7 @@ where
tracing::debug!(%error, "shutting down contract handler");
})?;
}
_ => unreachable!(),
_ => unreachable!("ContractHandlerEvent enum should be exhaustive here"),
}
}
}
Expand Down
Loading
Loading