From 6927c87133522b56b8437723f2900872af3200ea Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Sat, 23 Jul 2022 00:36:07 +0000 Subject: [PATCH] fix copypasta and improve logs --- web3-proxy/src/main.rs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/web3-proxy/src/main.rs b/web3-proxy/src/main.rs index 283bf9c7..ebca18e5 100644 --- a/web3-proxy/src/main.rs +++ b/web3-proxy/src/main.rs @@ -159,9 +159,9 @@ mod tests { println!("path: {}", path); - // TODO: opton for super verbose option + // TODO: how should we handle logs in this? + // TODO: option for super verbose logs std::env::set_var("RUST_LOG", "info,web3_proxy=debug"); - // install global collector configured based on RUST_LOG env var. tracing_subscriber::fmt() .with_env_filter(EnvFilter::from_default_env()) @@ -172,11 +172,14 @@ mod tests { println!("Anvil running at `{}`", anvil.endpoint()); - let provider = Provider::::try_from(anvil.endpoint()).unwrap(); + let anvil_provider = Provider::::try_from(anvil.endpoint()).unwrap(); // mine a block because my code doesn't like being on block 0 // TODO: make block 0 okay? - let _: U256 = provider.request("evm_mine", None::<()>).await.unwrap(); + let _: U256 = anvil_provider + .request("evm_mine", None::<()>) + .await + .unwrap(); // make a test CliConfig let cli_config = CliConfig { @@ -209,13 +212,13 @@ mod tests { let (shutdown_sender, shutdown_receiver) = flume::bounded(1); // spawn another thread for running the app - // TODO: + // TODO: allow launching into the local tokio runtime instead of creating a new one? let handle = thread::spawn(move || run(shutdown_receiver, cli_config, app_config)); // TODO: do something to the node. query latest block, mine another block, query again let proxy_provider = Provider::::try_from(anvil.endpoint()).unwrap(); - let anvil_result: Block = proxy_provider + let anvil_result: Block = anvil_provider .request("eth_getBlockByNumber", ("latest", true)) .await .unwrap(); @@ -228,9 +231,12 @@ mod tests { let first_block_num = anvil_result.number.unwrap(); - let _: U256 = provider.request("evm_mine", None::<()>).await.unwrap(); + let _: U256 = anvil_provider + .request("evm_mine", None::<()>) + .await + .unwrap(); - let anvil_result: Block = proxy_provider + let anvil_result: Block = anvil_provider .request("eth_getBlockByNumber", ("latest", true)) .await .unwrap();