From 45d4dc02da64347ce02c8c976a5b9d25a4c5850f Mon Sep 17 00:00:00 2001 From: Marko Atanasievski Date: Tue, 9 Jan 2024 12:47:42 +0100 Subject: [PATCH] fix: error messages --- crates/topos-sequencer-subnet-client/src/lib.rs | 8 ++++---- .../tests/subnet_contract.rs | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/crates/topos-sequencer-subnet-client/src/lib.rs b/crates/topos-sequencer-subnet-client/src/lib.rs index cc02e075a..74e983396 100644 --- a/crates/topos-sequencer-subnet-client/src/lib.rs +++ b/crates/topos-sequencer-subnet-client/src/lib.rs @@ -172,8 +172,8 @@ impl SubnetClientListener { Err(Error::EventDecodingError(e)) => { // FIXME: Happens in block before subnet contract is deployed, seems like bug in ethers error!( - "Error decoding events from block {}: {e} \nTopos smart contracts may not be \ - deployed?", + "Error decoding events from block {}: {e}. Topos smart contracts may not be \ + deployed before the parsed block?", block_number ); Vec::new() @@ -221,8 +221,8 @@ impl SubnetClientListener { Err(Error::EventDecodingError(e)) => { // FIXME: Happens in block before subnet contract is deployed, seems like bug in ethers error!( - "Error decoding events from block {}: {e} \nTopos smart contracts may not \ - be deployed?", + "Error decoding events from block {}: {e}. Topos smart contracts may not \ + be deployed before the parsed block?", block_number ); Vec::new() diff --git a/crates/topos-sequencer-subnet-runtime/tests/subnet_contract.rs b/crates/topos-sequencer-subnet-runtime/tests/subnet_contract.rs index 3d21c864b..5b0629cbe 100644 --- a/crates/topos-sequencer-subnet-runtime/tests/subnet_contract.rs +++ b/crates/topos-sequencer-subnet-runtime/tests/subnet_contract.rs @@ -347,6 +347,12 @@ async fn deploy_test_token( .event::() .from_block(0); let events = events.query().await?; + if events.is_empty() { + panic!( + "Missing TokenDeployed event. Token contract is not deployed to test subnet. Could \ + not execute test" + ); + } let token_address = events[0].token_address; info!("Token contract deployed to {}", token_address.to_string()); @@ -432,7 +438,14 @@ async fn context_running_subnet_node( let subnet_node_handle = match spawn_subnet_node(port, block_time) { Ok(subnet_node_handle) => subnet_node_handle, Err(e) => { - panic!("Failed to start the subnet node as part of test context: {e}"); + if e.kind() == std::io::ErrorKind::NotFound { + panic!( + "Could not find Anvil binary. Please install and add to path Foundy tools \ + including Anvil" + ); + } else { + panic!("Failed to start the Anvil subnet node as part of test context: {e}"); + } } }; // Wait a bit for anvil subprocess to spin itself up