Skip to content

Commit

Permalink
chore: fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
drewstone committed Nov 18, 2024
1 parent 0b157f0 commit bbe525e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 26 deletions.
39 changes: 19 additions & 20 deletions blueprints/arbitrum-orbit/src/jobs/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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::<ServiceContext, JobCalled>,
pre_processor = services_pre_processor,
),
)]
pub fn $name(
params_bytes: Vec<u8>,
context: ServiceContext,
) -> Result<String, Infallible> {
let params: $params_type = serde_json::from_slice(&params_bytes)
.expect(&format!("Failed to deserialize {} params", stringify!($name)));
id = $id,
params(params_bytes),
event_listener(
listener = TangleEventListener::<ServiceContext, JobCalled>,
pre_processor = services_pre_processor,
),
)]
pub fn $name(params_bytes: Vec<u8>, context: ServiceContext) -> Result<String, Infallible> {
let params: $params_type = serde_json::from_slice(&params_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(&params).unwrap())
.output()
.expect("Failed to execute script");
Expand All @@ -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
Expand All @@ -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);
create_job!(5, configure_fee_recipients, FeeRecipientParams);
10 changes: 7 additions & 3 deletions blueprints/arbitrum-orbit/src/main.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
12 changes: 9 additions & 3 deletions crates/orbit-sequencer-deployer/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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::<String>(id, None).await?;
}
Expand Down

0 comments on commit bbe525e

Please sign in to comment.