Starts Reth and writes the JWT secret if needed.
(config: L1StackConfig)
| 38 | impl L1Execution { |
| 39 | /// Starts Reth and writes the JWT secret if needed. |
| 40 | pub async fn start(config: L1StackConfig) -> Result<Self> { |
| 41 | let jwt_path = config.testnet_dir.parent().unwrap_or(&config.testnet_dir).join("jwt.hex"); |
| 42 | |
| 43 | if !jwt_path.exists() { |
| 44 | std::fs::write(&jwt_path, &config.jwt_secret_hex) |
| 45 | .wrap_err("Failed to write JWT secret")?; |
| 46 | } |
| 47 | |
| 48 | let reth_config = config.container_config.clone(); |
| 49 | let reth = |
| 50 | RethContainer::start(&config.el_genesis_json, &config.jwt_secret_hex, reth_config) |
| 51 | .await |
| 52 | .wrap_err("Failed to start Reth container")?; |
| 53 | |
| 54 | Ok(Self { |
| 55 | reth, |
| 56 | jwt_path, |
| 57 | testnet_dir: config.testnet_dir, |
| 58 | container_config: config.container_config, |
| 59 | }) |
| 60 | } |
| 61 | |
| 62 | /// Returns a reference to the Reth container. |
| 63 | pub const fn reth(&self) -> &RethContainer { |
nothing calls this directly
no test coverage detected