Skip to content

Commit

Permalink
clippy + fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
0xJepsen committed Nov 5, 2023
1 parent 46d3cb9 commit cd825a1
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 34 deletions.
3 changes: 1 addition & 2 deletions src/agents/block_admin.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

use super::*;

/// A structure representing a block admin agent.
Expand Down Expand Up @@ -66,4 +65,4 @@ impl Agent for BlockAdmin {
self.update_block()?;
Ok(())
}
}
}
14 changes: 3 additions & 11 deletions src/agents/mod.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
use super::*;

use crate::settings::{SimulationConfig, parameters::Fixed};
use crate::settings::SimulationConfig;
pub mod block_admin;
use std::sync::Arc;
use arbiter_core::environment::Environment;
use arbiter_core::middleware::RevmMiddleware;
use ethers::providers::Middleware;
use std::sync::Arc;
// use settings::SimulationConfig;
use std::marker::{Send, Sync};
use alloy_primitives::Address;
use durin_fault::{
providers::AlphabetTraceProvider, AlphaClaimSolver, FaultDisputeSolver, FaultDisputeState,
};
use foundry_contracts::{
alphabet_vm::AlphabetVM, block_oracle::BlockOracle, fault_dispute_game::FaultDisputeGame,
l2_output_oracle::L2OutputOracle,
};

// use crate::settings::parameters::Fixed;

Expand Down Expand Up @@ -83,4 +75,4 @@ impl Agent for Agents {
async fn priority_step(&mut self) -> Result<()> {
Ok(())
}
}
}
6 changes: 2 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ use foundry_contracts::{
l2_output_oracle::l2_output_oracle::L2OutputOracle,
};

use std::time::Instant;
use clap::{ArgAction, CommandFactory, Parser, Subcommand};
use std::time::Instant;

pub mod agents;
pub mod settings;
pub mod simulations;
use std::{error::Error, sync::Arc};

const ENV_LABEL: &str = "OPTIMISM_FRAUD_PROOF";
const SUBMISSION_INTERVAL: f64 = 1800.0; // output every 30minutes
Expand All @@ -31,7 +30,6 @@ const FINALIZATION_PERIOD_SECONDS: f64 = 700.0;
// uint256 internal finalizationPeriodSeconds = 7 days;
// https://github.com/ethereum-optimism/optimism/tree/develop/op-challenger


/// Represents command-line arguments passed to this binary.
#[derive(Parser)]
#[clap(name = "Excalibur")]
Expand Down Expand Up @@ -106,4 +104,4 @@ fn main() -> Result<()> {
None => Args::command().print_long_help()?,
}
Ok(())
}
}
2 changes: 1 addition & 1 deletion src/settings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ impl SimulationConfig {
.build()?;
s.try_deserialize()
}
}
}
2 changes: 1 addition & 1 deletion src/settings/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,4 +193,4 @@ impl Parameterized<OUParameters<Fixed>> for OUParameters<Meta> {
}
result
}
}
}
10 changes: 3 additions & 7 deletions src/simulations/dispute_game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ use anyhow::Ok;
use arbiter_core::environment::{builder::EnvironmentBuilder, cheatcodes::Cheatcodes, Environment};
use ethers::types::U256 as eU256;

use super::*;

/// All the possible contracts that this simulation will actively use, but not
/// all that are deployed!
/// Each is bound to a `Client` and can be used to interact with the contract.
Expand All @@ -27,14 +25,12 @@ pub struct SimulationContracts {
pub factory: DisputeGameFactory<RevmMiddleware>,
}

pub async fn setup(config: SimulationConfig) -> Result<Simulation> {
pub async fn setup(_config: SimulationConfig) -> Result<Simulation> {
let (_environment, admin, _alice, _bob, _multisig) = set_up_agents().await?;

let (environment, admin, alice, bob, multisig) = set_up_agents().await?;

let contracts = deploy_contracts(admin.clone()).await?;
let _contracts = deploy_contracts(admin.clone()).await?;

todo!("setup the agents and return them")

}
pub async fn set_up_agents() -> Result<(
Environment,
Expand Down
11 changes: 3 additions & 8 deletions src/simulations/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ use std::sync::Arc;
use tokio::sync::Semaphore;

use super::*;
use crate::{agents::Agents, settings::parameters::Fixed};
use crate::agents::Agents;
pub mod dispute_game;


use crate::settings::SimulationConfig;
use anyhow::Result;
use settings::parameters::Parameterized;
use tokio::runtime::Builder;

/// Represents the main Simulation structure.
Expand Down Expand Up @@ -44,9 +42,7 @@ impl SimulationType {
/// then executes the chosen simulation.
async fn run(config: SimulationConfig) -> Result<()> {
let simulation = match config.simulation {
SimulationType::DisputeGame => {
dispute_game::setup(config.clone()).await?
}
SimulationType::DisputeGame => dispute_game::setup(config.clone()).await?,
};
match looper(simulation.agents, simulation.steps).await {
Result::Ok(_) => {
Expand Down Expand Up @@ -101,7 +97,6 @@ pub fn batch(config_path: &str) -> Result<()> {
Result::Ok(_) => {
drop(permit);
}

}

Ok(())
Expand All @@ -128,4 +123,4 @@ pub async fn looper(mut agents: Agents, steps: usize) -> Result<()> {
}

Ok(())
}
}

0 comments on commit cd825a1

Please sign in to comment.