diff --git a/blueprints/arbitrum-orbit/src/jobs/mod.rs b/blueprints/arbitrum-orbit/src/jobs/mod.rs index 764acb6..7abe693 100644 --- a/blueprints/arbitrum-orbit/src/jobs/mod.rs +++ b/blueprints/arbitrum-orbit/src/jobs/mod.rs @@ -1,10 +1,7 @@ use alloy_primitives::Address; use api::services::events::JobCalled; use gadget_sdk as sdk; -use sdk::event_listener::tangle::{ - jobs::services_pre_processor, - TangleEventListener, -}; +use sdk::event_listener::tangle::{jobs::services_pre_processor, TangleEventListener}; use sdk::tangle_subxt::tangle_testnet_runtime::api; use serde::{Deserialize, Serialize}; use std::convert::Infallible; @@ -65,22 +62,24 @@ pub struct FeeRecipientParams { macro_rules! create_job { ($id:expr, $name:ident, $params_type:ty) => { #[sdk::job( - id = $id, - params(params_bytes), - event_listener( - listener = TangleEventListener::, - pre_processor = services_pre_processor, - ), - )] - pub fn $name( - params_bytes: Vec, - context: ServiceContext, - ) -> Result { - let params: $params_type = serde_json::from_slice(¶ms_bytes) - .expect(&format!("Failed to deserialize {} params", stringify!($name))); + id = $id, + params(params_bytes), + event_listener( + listener = TangleEventListener::, + pre_processor = services_pre_processor, + ), + )] + pub fn $name(params_bytes: Vec, context: ServiceContext) -> Result { + let params: $params_type = serde_json::from_slice(¶ms_bytes).expect(&format!( + "Failed to deserialize {} params", + stringify!($name) + )); let output = Command::new("node") - .arg(format!("scripts/{}.ts", stringify!($name).replace("_", "-"))) + .arg(format!( + "scripts/{}.ts", + stringify!($name).replace("_", "-") + )) .arg(serde_json::to_string(¶ms).unwrap()) .output() .expect("Failed to execute script"); @@ -93,7 +92,7 @@ macro_rules! create_job { // Job to set validators create_job!(1, set_validators, ValidatorParams); -// Job to add privileged executors +// Job to add privileged executors create_job!(2, add_executors, ExecutorParams); // Job to configure fast withdrawals @@ -103,4 +102,4 @@ create_job!(3, configure_fast_withdrawals, FastWithdrawalParams); create_job!(4, manage_batch_posters, BatchPosterParams); // Job to configure fee recipients -create_job!(5, configure_fee_recipients, FeeRecipientParams); \ No newline at end of file +create_job!(5, configure_fee_recipients, FeeRecipientParams); diff --git a/blueprints/arbitrum-orbit/src/main.rs b/blueprints/arbitrum-orbit/src/main.rs index 2bfdc99..97e1a1f 100644 --- a/blueprints/arbitrum-orbit/src/main.rs +++ b/blueprints/arbitrum-orbit/src/main.rs @@ -1,8 +1,12 @@ use alloy_primitives::Address; use arbitrum_orbit_blueprint::{ - deploy_rollup, jobs::{ - AddExecutorsEventHandler, ConfigureFastWithdrawalsEventHandler, ConfigureFeeRecipientsEventHandler, ManageBatchPostersEventHandler, ServiceContext, SetValidatorsEventHandler - }, setup_initial_configuration, OrbitRaaSBlueprint, RollupConfig + deploy_rollup, + jobs::{ + AddExecutorsEventHandler, ConfigureFastWithdrawalsEventHandler, + ConfigureFeeRecipientsEventHandler, ManageBatchPostersEventHandler, ServiceContext, + SetValidatorsEventHandler, + }, + setup_initial_configuration, OrbitRaaSBlueprint, RollupConfig, }; use color_eyre::Result; use gadget_sdk::{self as sdk, utils::evm::get_provider_http}; diff --git a/crates/orbit-sequencer-deployer/src/lib.rs b/crates/orbit-sequencer-deployer/src/lib.rs index ea134ac..f889c9e 100644 --- a/crates/orbit-sequencer-deployer/src/lib.rs +++ b/crates/orbit-sequencer-deployer/src/lib.rs @@ -1,4 +1,7 @@ -use gadget_sdk::docker::{bollard::{self, container::LogsOptions, models::ContainerConfig, Docker}, Container}; +use gadget_sdk::docker::{ + bollard::{self, container::LogsOptions, models::ContainerConfig, Docker}, + Container, +}; use serde::{Deserialize, Serialize}; use std::{collections::HashMap, path::PathBuf, sync::Arc}; use tokio_stream::{Stream, StreamExt}; @@ -49,7 +52,10 @@ impl OrbitNode { // Build command arguments let mut args = vec![ - format!("--parent-chain.connection.url={}", self.config.parent_chain_rpc), + format!( + "--parent-chain.connection.url={}", + self.config.parent_chain_rpc + ), format!("--chain.id={}", self.config.chain_id), format!("--chain.name={}", self.config.chain_name), format!("--chain.info-json={}", self.config.chain_info_json), @@ -95,7 +101,7 @@ impl OrbitNode { // Create and start container let container = Container::new(&self.docker, NITRO_NODE_IMAGE); self.container_id = container.id().map(|id| id.to_string()); - + if let Some(id) = &self.container_id { self.docker.start_container::(id, None).await?; }