diff --git a/crates/primitives/src/components/challenger.rs b/crates/primitives/src/components/challenger.rs index 664eae0..616e33f 100644 --- a/crates/primitives/src/components/challenger.rs +++ b/crates/primitives/src/components/challenger.rs @@ -5,7 +5,9 @@ use serde::{Deserialize, Serialize}; use strum::EnumIter; /// Challenger Agent Implementations -#[derive(Default, Clone, PartialEq, EnumVariantsStrings, Deserialize, Serialize, EnumIter)] +#[derive( + Default, Copy, Clone, PartialEq, EnumVariantsStrings, Deserialize, Serialize, EnumIter, +)] #[serde(rename_all = "kebab-case")] #[enum_variants_strings_transform(transform = "kebab_case")] pub enum ChallengerAgent { diff --git a/crates/primitives/src/components/layer_two.rs b/crates/primitives/src/components/layer_two.rs index c42341e..b203d57 100644 --- a/crates/primitives/src/components/layer_two.rs +++ b/crates/primitives/src/components/layer_two.rs @@ -9,7 +9,9 @@ use strum::EnumIter; /// The OP Stack L2 client is a minimally modified version of the L1 client /// that supports deposit transactions as well as a few other small OP-specific /// changes. -#[derive(Default, Clone, PartialEq, EnumVariantsStrings, Deserialize, Serialize, EnumIter)] +#[derive( + Default, Copy, Clone, PartialEq, EnumVariantsStrings, Deserialize, Serialize, EnumIter, +)] #[serde(rename_all = "kebab-case")] #[enum_variants_strings_transform(transform = "kebab_case")] pub enum L2Client { diff --git a/crates/primitives/src/components/rollup.rs b/crates/primitives/src/components/rollup.rs index 1bc3a52..c8c2f35 100644 --- a/crates/primitives/src/components/rollup.rs +++ b/crates/primitives/src/components/rollup.rs @@ -8,7 +8,9 @@ use strum::EnumIter; /// /// The OP Stack rollup client performs the derivation of the rollup state /// from the L1 and L2 clients. -#[derive(Default, Clone, PartialEq, EnumVariantsStrings, Deserialize, Serialize, EnumIter)] +#[derive( + Default, Copy, Clone, PartialEq, EnumVariantsStrings, Deserialize, Serialize, EnumIter, +)] #[serde(rename_all = "kebab-case")] #[enum_variants_strings_transform(transform = "kebab_case")] pub enum RollupClient { diff --git a/crates/stages/src/stages.rs b/crates/stages/src/stages.rs index b9a3aad..4599fd4 100644 --- a/crates/stages/src/stages.rs +++ b/crates/stages/src/stages.rs @@ -91,11 +91,11 @@ impl Stages<'_> { Box::new(contracts::Contracts::new()), Box::new(l2_exec::Executor::new( self.config.l2_client_port, - self.config.l2_client.to_string(), + self.config.l2_client, )), Box::new(rollup::Rollup::new( self.config.rollup_client_port, - self.config.rollup_client.to_string(), + self.config.rollup_client, )), Box::new(proposer::Proposer::new(Arc::clone(&artifacts))), Box::new(batcher::Batcher::new( @@ -104,7 +104,7 @@ impl Stages<'_> { )), Box::new(challenger::Challenger::new( Arc::clone(&artifacts), - self.config.challenger.to_string(), + self.config.challenger, )), Box::new(stateviz::Stateviz::new(Arc::clone(&artifacts))), ] diff --git a/crates/stages/src/stages/challenger.rs b/crates/stages/src/stages/challenger.rs index 7ea1f22..18e1b8b 100644 --- a/crates/stages/src/stages/challenger.rs +++ b/crates/stages/src/stages/challenger.rs @@ -1,6 +1,6 @@ use async_trait::async_trait; use eyre::Result; -use op_primitives::Artifacts; +use op_primitives::{Artifacts, ChallengerAgent}; use std::process::Command; use std::sync::Arc; @@ -8,7 +8,7 @@ use std::sync::Arc; #[derive(Debug, Default, Clone, PartialEq)] pub struct Challenger { artifacts: Arc, - challenger: String, + challenger: ChallengerAgent, } #[async_trait] @@ -30,7 +30,7 @@ impl crate::Stage for Challenger { .env("PWD", &docker_dir) .env("L2OO_ADDRESS", addresses["L2OutputOracleProxy"].to_string()) .env("DGF_ADDRESS", addresses["DisputeGameFactory"].to_string()) - .env("CHALLENGER_AGENT_CHOICE", &self.challenger) + .env("CHALLENGER_AGENT_CHOICE", &self.challenger.to_string()) .current_dir(docker_dir) .output()?; @@ -48,7 +48,7 @@ impl crate::Stage for Challenger { impl Challenger { /// Creates a new challenger stage. - pub fn new(artifacts: Arc, challenger: String) -> Self { + pub fn new(artifacts: Arc, challenger: ChallengerAgent) -> Self { Self { artifacts, challenger, diff --git a/crates/stages/src/stages/l2_exec.rs b/crates/stages/src/stages/l2_exec.rs index 97f9543..aa7c8e0 100644 --- a/crates/stages/src/stages/l2_exec.rs +++ b/crates/stages/src/stages/l2_exec.rs @@ -1,12 +1,13 @@ use async_trait::async_trait; use eyre::Result; +use op_primitives::L2Client; use std::process::Command; /// Layer 2 Execution Client Stage #[derive(Debug, Default, Clone, PartialEq)] pub struct Executor { l2_port: Option, - l2_client: String, + l2_client: L2Client, } #[async_trait] @@ -23,7 +24,7 @@ impl crate::Stage for Executor { let start_l2 = Command::new("docker-compose") .args(["up", "-d", "--no-deps", "--build", "l2"]) .env("PWD", &docker_dir) - .env("L2_CLIENT_CHOICE", &self.l2_client) + .env("L2_CLIENT_CHOICE", &self.l2_client.to_string()) .current_dir(docker_dir) .output()?; @@ -41,7 +42,7 @@ impl crate::Stage for Executor { impl Executor { /// Creates a new stage. - pub fn new(l2_port: Option, l2_client: String) -> Self { + pub fn new(l2_port: Option, l2_client: L2Client) -> Self { Self { l2_port, l2_client } } } diff --git a/crates/stages/src/stages/rollup.rs b/crates/stages/src/stages/rollup.rs index 5b8c9c8..b334053 100644 --- a/crates/stages/src/stages/rollup.rs +++ b/crates/stages/src/stages/rollup.rs @@ -1,12 +1,13 @@ use async_trait::async_trait; use eyre::Result; +use op_primitives::RollupClient; use std::process::Command; /// Rollup Stage #[derive(Debug, Default, Clone, PartialEq)] pub struct Rollup { rollup_port: Option, - rollup_client: String, + rollup_client: RollupClient, } #[async_trait] @@ -24,7 +25,7 @@ impl crate::Stage for Rollup { let start_rollup = Command::new("docker-compose") .args(["up", "-d", "--no-deps", "--build", "rollup-client"]) .env("PWD", &docker_dir) - .env("ROLLUP_CLIENT_CHOICE", &self.rollup_client) + .env("ROLLUP_CLIENT_CHOICE", &self.rollup_client.to_string()) .current_dir(docker_dir) .output()?; @@ -42,7 +43,7 @@ impl crate::Stage for Rollup { impl Rollup { /// Creates a new stage. - pub fn new(rollup_port: Option, rollup_client: String) -> Self { + pub fn new(rollup_port: Option, rollup_client: RollupClient) -> Self { Self { rollup_port, rollup_client,