Deploys L2 contracts.
(&self, l1_internal_rpc_url: &str)
| 333 | |
| 334 | /// Deploys L2 contracts. |
| 335 | pub fn deploy_l2_contracts(&self, l1_internal_rpc_url: &str) -> Result<L2DeploymentOutput> { |
| 336 | SetupImage::ensure_built()?; |
| 337 | |
| 338 | let net = self.network_name.as_deref().unwrap_or_else(|| network_name()); |
| 339 | if self.network_name.is_some() { |
| 340 | crate::network::ensure_network_exists_with_name(net)?; |
| 341 | } else { |
| 342 | ensure_network_exists()?; |
| 343 | } |
| 344 | |
| 345 | std::fs::create_dir_all(self.output_dir.join("l2")) |
| 346 | .wrap_err("Failed to create l2 output dir")?; |
| 347 | |
| 348 | let shared_mount = self.output_dir.join("shared").to_string_lossy().to_string(); |
| 349 | let l2_output_mount = self.output_dir.join("l2").to_string_lossy().to_string(); |
| 350 | |
| 351 | let deployer_key = format!("0x{}", hex::encode(DEPLOYER.private_key.as_slice())); |
| 352 | |
| 353 | let image = SetupImage::request() |
| 354 | .with_wait_for(WaitFor::exit(ExitWaitStrategy::default().with_exit_code(0))); |
| 355 | |
| 356 | let mut container = image |
| 357 | .with_network(net) |
| 358 | .with_startup_timeout(Duration::from_secs(DEPLOY_TIMEOUT_SECS)) |
| 359 | .with_env_var("OUTPUT_DIR", "/output/l2") |
| 360 | .with_env_var("SHARED_DIR", "/shared") |
| 361 | .with_env_var("TEMPLATE_DIR", "/templates") |
| 362 | .with_env_var("L1_RPC_URL", l1_internal_rpc_url) |
| 363 | .with_env_var("L1_CHAIN_ID", self.chain_id.to_string()) |
| 364 | .with_env_var("L2_CHAIN_ID", self.l2_chain_id.to_string()) |
| 365 | .with_env_var("DEPLOYER_KEY", &deployer_key) |
| 366 | .with_env_var("DEPLOYER_ADDR", format!("{:#x}", DEPLOYER.address)) |
| 367 | .with_env_var("SEQUENCER_ADDR", format!("{:#x}", SEQUENCER.address)) |
| 368 | .with_env_var("BATCHER_ADDR", format!("{:#x}", BATCHER.address)) |
| 369 | .with_env_var("PROPOSER_ADDR", format!("{:#x}", PROPOSER.address)) |
| 370 | .with_env_var("CHALLENGER_ADDR", format!("{:#x}", CHALLENGER.address)) |
| 371 | .with_env_var("BUILDER_P2P_KEY", format!("{:#x}", BUILDER.private_key)) |
| 372 | .with_env_var("BUILDER_ENODE_ID", BUILDER_ENODE_ID) |
| 373 | .with_env_var("L2_EL_BOOTNODE_P2P_KEY", EL_BOOTNODE_P2P_KEY) |
| 374 | .with_env_var("L2_EL_BOOTNODE_ENODE_ID", EL_BOOTNODE_ENODE_ID) |
| 375 | .with_env_var("L2_EL_BOOTNODE_ENODE", EL_BOOTNODE_ENODE) |
| 376 | .with_env_var("L2_CL_BOOTNODE_P2P_KEY", CL_BOOTNODE_P2P_KEY) |
| 377 | .with_env_var("L2_CL_BOOTNODE_ENR_PATH", CL_BOOTNODE_ENR_PATH); |
| 378 | |
| 379 | if let Some(block) = self.isthmus_activation_block { |
| 380 | container = container.with_env_var("L2_ISTHMUS_BLOCK", block.to_string()); |
| 381 | } |
| 382 | |
| 383 | if let Some(block) = self.base_azul_activation_block { |
| 384 | container = container.with_env_var("L2_BASE_AZUL_BLOCK", block.to_string()); |
| 385 | } |
| 386 | |
| 387 | if let Some(block) = self.base_beryl_activation_block { |
| 388 | container = container.with_env_var("L2_BASE_BERYL_BLOCK", block.to_string()); |
| 389 | } |
| 390 | |
| 391 | if let Some(block) = self.base_cobalt_activation_block { |
| 392 | container = container.with_env_var("L2_BASE_COBALT_BLOCK", block.to_string()); |
no test coverage detected