Rejects missing roles and credential-bearing URLs before any network operation.
(config: &ScenarioConfig, endpoints: &EndpointMap)
| 475 | |
| 476 | /// Rejects missing roles and credential-bearing URLs before any network operation. |
| 477 | pub fn validate_endpoints(config: &ScenarioConfig, endpoints: &EndpointMap) -> Result<()> { |
| 478 | for role in Self::required_roles(config) { |
| 479 | if !endpoints.contains_key(&role) { |
| 480 | bail!("required endpoint {role} missing"); |
| 481 | } |
| 482 | } |
| 483 | for (role, url) in endpoints { |
| 484 | if !matches!(role.as_str(), "l1" | "builder" | "validator" | "rpc" | "shadow") { |
| 485 | bail!("unknown endpoint role"); |
| 486 | } |
| 487 | let parsed = |
| 488 | reqwest::Url::parse(url).map_err(|_| eyre::eyre!("invalid URL for {role}"))?; |
| 489 | if !matches!(parsed.scheme(), "http" | "https") |
| 490 | || parsed.host_str().is_none() |
| 491 | || !parsed.username().is_empty() |
| 492 | || parsed.password().is_some() |
| 493 | || parsed.query().is_some() |
| 494 | || parsed.fragment().is_some() |
| 495 | { |
| 496 | bail!("{role} requires an HTTP URL without credentials, query, or fragment"); |
| 497 | } |
| 498 | } |
| 499 | Ok(()) |
| 500 | } |
| 501 | |
| 502 | /// Builds a lifecycle stage without interpreting an error as an assertion failure. |
| 503 | pub fn stage(id: &str, status: Status, started: Instant, message: &str) -> StageResult { |
nothing calls this directly
no test coverage detected