()
| 26 | |
| 27 | #[tokio::test] |
| 28 | async fn test_load_pbs_happy() -> Result<()> { |
| 29 | let config = load_happy_config().await?; |
| 30 | |
| 31 | // Chain and existing header check |
| 32 | assert_eq!(config.chain, Chain::Holesky); |
| 33 | assert_eq!( |
| 34 | config.relays[0].headers.as_ref().unwrap().get("X-MyCustomHeader").unwrap(), |
| 35 | "MyCustomHeader" |
| 36 | ); |
| 37 | |
| 38 | // Docker and general settings |
| 39 | assert_eq!(config.pbs.docker_image, "ghcr.io/commit-boost/pbs:latest"); |
| 40 | assert!(!config.pbs.with_signer); |
| 41 | assert_eq!(config.pbs.pbs_config.host, "127.0.0.1".parse::<Ipv4Addr>().unwrap()); |
| 42 | assert_eq!(config.pbs.pbs_config.port, 18550); |
| 43 | assert!(config.pbs.pbs_config.relay_check); |
| 44 | assert!(config.pbs.pbs_config.wait_all_registrations); |
| 45 | |
| 46 | // Timeouts |
| 47 | assert_eq!(config.pbs.pbs_config.timeout_get_header_ms, 950); |
| 48 | assert_eq!(config.pbs.pbs_config.timeout_get_payload_ms, 4000); |
| 49 | assert_eq!(config.pbs.pbs_config.timeout_register_validator_ms, 3000); |
| 50 | |
| 51 | // Bid settings and validation |
| 52 | assert!(!config.pbs.pbs_config.skip_sigverify); |
| 53 | dbg!(&config.pbs.pbs_config.min_bid_wei); |
| 54 | dbg!(&U256::from(0.5)); |
| 55 | assert_eq!(config.pbs.pbs_config.min_bid_wei, U256::from((0.5 * WEI_PER_ETH as f64) as u64)); |
| 56 | assert_eq!(config.pbs.pbs_config.late_in_slot_time_ms, 2000); |
| 57 | assert!(!config.pbs.pbs_config.extra_validation_enabled); |
| 58 | |
| 59 | // Relay specific settings |
| 60 | let relay = &config.relays[0]; |
| 61 | assert_eq!(relay.id, Some("example-relay".to_string())); |
| 62 | assert_eq!(relay.entry.url, "http://0xa1cec75a3f0661e99299274182938151e8433c61a19222347ea1313d839229cb4ce4e3e5aa2bdeb71c8fcf1b084963c2@abc.xyz".parse::<Url>().unwrap()); |
| 63 | assert!(!relay.enable_timing_games); |
| 64 | assert_eq!(relay.target_first_request_ms, Some(200)); |
| 65 | assert_eq!(relay.frequency_get_header_ms, Some(300)); |
| 66 | |
| 67 | Ok(()) |
| 68 | } |
| 69 | |
| 70 | #[tokio::test] |
| 71 | async fn test_validate_bad_timeout_get_header_ms() -> Result<()> { |
nothing calls this directly
no test coverage detected