|
3 | 3 | #[cfg(test)] |
4 | 4 | mod tests { |
5 | 5 | use builder::tasks::submit::flashbots::FlashbotsProvider; |
| 6 | + use alloy::{ |
| 7 | + primitives::FixedBytes, |
| 8 | + rpc::types::mev::{EthBundleHash, MevSendBundle}, |
| 9 | + }; |
| 10 | + use builder::test_utils::{setup_logging, setup_test_config}; |
| 11 | + |
| 12 | + #[tokio::test] |
| 13 | + #[ignore = "integration test"] |
| 14 | + async fn smoke_root_provider() { |
| 15 | + setup_logging(); |
| 16 | + let flashbots = get_test_provider().await; |
| 17 | + assert_eq!(flashbots.relay_url.as_str(), "http://localhost:9062/"); |
| 18 | + |
| 19 | + let status = flashbots |
| 20 | + .bundle_status(EthBundleHash { bundle_hash: FixedBytes::default() }, 0) |
| 21 | + .await; |
| 22 | + assert!(status.is_err()); |
| 23 | + } |
6 | 24 |
|
7 | | - #[cfg(test)] |
8 | | - mod tests { |
9 | | - use super::*; |
10 | | - use alloy::{ |
11 | | - primitives::FixedBytes, |
12 | | - rpc::types::mev::{EthBundleHash, MevSendBundle}, |
13 | | - }; |
14 | | - use builder::{ |
15 | | - config::BuilderConfig, |
16 | | - test_utils::{setup_logging, setup_test_config}, |
17 | | - }; |
18 | | - use init4_bin_base::{ |
19 | | - deps::tracing::{error, info}, |
20 | | - utils::from_env::FromEnv, |
21 | | - }; |
| 25 | + #[tokio::test] |
| 26 | + #[ignore = "integration test"] |
| 27 | + async fn smoke_simulate_bundle() { |
| 28 | + let flashbots = get_test_provider().await; |
22 | 29 |
|
23 | | - #[tokio::test] |
24 | | - #[ignore = "integration test"] |
25 | | - async fn smoke_root_provider() { |
26 | | - setup_logging(); |
27 | | - let flashbots = get_test_provider().await; |
28 | | - assert_eq!(flashbots.relay_url.as_str(), "http://localhost:9062/"); |
| 30 | + let res = flashbots.simulate_bundle(MevSendBundle::default()).await; |
29 | 31 |
|
30 | | - let status = flashbots |
31 | | - .bundle_status(EthBundleHash { bundle_hash: FixedBytes::default() }, 0) |
32 | | - .await; |
33 | | - assert!(status.is_err()); |
| 32 | + if let Err(err) = &res { |
| 33 | + let msg = format!("{err}"); |
| 34 | + assert!(msg.contains("mev_simBundle")); |
34 | 35 | } |
35 | 36 |
|
36 | | - #[tokio::test] |
37 | | - #[ignore = "integration test"] |
38 | | - async fn smoke_simulate_bundle() { |
39 | | - let flashbots = get_test_provider().await; |
40 | | - |
41 | | - let res = flashbots.simulate_bundle(MevSendBundle::default()).await; |
| 37 | + assert!(res.is_err()); |
| 38 | + } |
42 | 39 |
|
43 | | - if let Err(err) = &res { |
44 | | - let msg = format!("{err}"); |
45 | | - assert!(msg.contains("mev_simBundle")); |
46 | | - } |
| 40 | + #[tokio::test] |
| 41 | + #[ignore = "integration test"] |
| 42 | + async fn smoke_send_bundle() { |
| 43 | + let flashbots = get_test_provider().await; |
| 44 | + let res = flashbots.send_bundle(MevSendBundle::default()).await; |
47 | 45 |
|
48 | | - assert!(res.is_err()); |
| 46 | + if let Err(err) = &res { |
| 47 | + let msg = format!("{err}"); |
| 48 | + assert!(msg.contains("mev_sendBundle")); |
49 | 49 | } |
50 | 50 |
|
51 | | - #[tokio::test] |
52 | | - #[ignore = "integration test"] |
53 | | - async fn smoke_send_bundle() { |
54 | | - let flashbots = get_test_provider().await; |
55 | | - let res = flashbots.send_bundle(MevSendBundle::default()).await; |
56 | | - |
57 | | - if let Err(err) = &res { |
58 | | - let msg = format!("{err}"); |
59 | | - assert!(msg.contains("mev_sendBundle")); |
60 | | - } |
61 | | - |
62 | | - assert!(res.is_ok() || res.is_err()); |
63 | | - } |
| 51 | + assert!(res.is_ok() || res.is_err()); |
| 52 | + } |
64 | 53 |
|
65 | | - async fn get_test_provider() -> FlashbotsProvider { |
66 | | - let config = setup_test_config().unwrap(); |
67 | | - FlashbotsProvider::new(&config.clone()) |
68 | | - } |
| 54 | + async fn get_test_provider() -> FlashbotsProvider { |
| 55 | + let config = setup_test_config().unwrap(); |
| 56 | + FlashbotsProvider::new(&config.clone()) |
69 | 57 | } |
70 | 58 | } |
0 commit comments