Skip to content

Commit

Permalink
don't error out waiting for collectors or executor
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanoroshiba committed Nov 27, 2024
1 parent 3bba951 commit 0801687
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 34 deletions.
30 changes: 6 additions & 24 deletions crates/astria-composer/src/composer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,33 +272,15 @@ impl Composer {
wait_for_collectors(&geth_collector_statuses, composer_status_sender.clone());
let executor_startup_fut = wait_for_executor(executor_status, composer_status_sender);

let startup_success = match join!(collectors_startup_fut, executor_startup_fut) {
(Ok(()), Ok(())) => true,
(Err(e), _) => {
error!(%e, "geth collectors failed to become ready");
let _ = exit_err.set(e);
false
}
(_, Err(e)) => {
error!(%e, "executor failed to become ready");
let _ = exit_err.set(e);
false
match join!(collectors_startup_fut, executor_startup_fut) {
(Ok(()), Ok(())) => {}
(Err(e), Ok(())) => error!(%e, "geth collectors failed to become ready"),
(Ok(()), Err(e)) => error!(%e, "executor failed to become ready"),
(Err(collector_err), Err(executor_err)) => {
error!(%collector_err, %executor_err, "geth collectors and executor failed to become ready");
}
};

if !startup_success {
return ShutdownInfo {
api_server_shutdown_token,
composer_shutdown_token: shutdown_token,
api_server_task_handle: Some(api_task),
executor_task_handle: Some(executor_task),
grpc_server_task_handle: None,
geth_collector_tasks,
}
.run()
.await;
}

// run the grpc server
let mut grpc_server_handle = tokio::spawn(async move {
grpc_server
Expand Down
15 changes: 5 additions & 10 deletions crates/astria-composer/tests/blackbox/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use crate::helper::{
mount_broadcast_tx_sync_rollup_data_submissions_mock,
signed_tx_from_request,
spawn_composer,
TEST_CHAIN_ID,
};

/// Test to check that the executor sends a signed transaction to the sequencer after its
Expand Down Expand Up @@ -203,20 +204,14 @@ async fn two_rollup_data_submissions_single_bundle() {
/// ID
#[tokio::test]
async fn chain_id_mismatch_returns_error() {
// TODO(https://github.com/astriaorg/astria/issues/1833): this test will currently succeed if
// the executor fails for any reason on startup, not just if the chain ID is incorrect. This is
// a symptom of the current implementation of executor, though, which should be propagating
// errors. As such, I think it is out of the scope for the following test-only changes and
// should be fixed in a followup.

let bad_chain_id = "bad_id";
let test_composer = spawn_composer(&["test1"], Some(bad_chain_id), false).await;
let err = test_composer.composer.await.unwrap().unwrap_err();
for cause in err.chain() {
if cause
.to_string()
.contains("executor failed while waiting for it to become ready")
{
println!("{cause}");
if cause.to_string().contains(&format!(
"expected chain ID `{TEST_CHAIN_ID}`, but received `{bad_chain_id}`"
)) {
return;
}
}
Expand Down

0 comments on commit 0801687

Please sign in to comment.