Skip to content

Commit

Permalink
chore: set hard fork London and add more quickly option to simulator
Browse files Browse the repository at this point in the history
  • Loading branch information
thuchoskym committed Aug 13, 2024
1 parent ccbf0b5 commit a888531
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
6 changes: 3 additions & 3 deletions server/src/cmd/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ pub struct RunArgs {
}

impl RunArgs {
pub const fn new(rpc_url: String, tx_hash: String) -> Self {
pub const fn new(rpc_url: String, tx_hash: String, quick: bool) -> Self {
let rpc_opts = RpcOpts { url: Some(rpc_url), flashbots: false, jwt_secret: None };
let evm_version = Some(EvmVersion::Istanbul);
let evm_version = Some(EvmVersion::London);

Self {
tx_hash,
debug: false,
trace_printer: false,
quick: false,
quick,
verbose: false,
label: Vec::new(),
decode_internal: false,
Expand Down
17 changes: 11 additions & 6 deletions server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@ use actix_web::{get, web, App, HttpResponse, HttpServer, Responder};
use cmd::{chain::ChainId, run::RunArgs};
use std::{thread, time::Duration};

async fn run_cast_command(chain: ChainId, tx: String) -> Result<String, String> {
async fn run_cast_command(chain: ChainId, tx: String, quick: u64) -> Result<String, String> {
let chain_info = chain.info();
let args: RunArgs = RunArgs::new(chain_info.rpc_url.to_string(), tx);
let quickly_option = match quick {
1 => true,
_ => false,
};

let args: RunArgs = RunArgs::new(chain_info.rpc_url.to_string(), tx, quickly_option);
// Run on another thread
let handle = thread::spawn(move || {
tokio::runtime::Runtime::new().unwrap().block_on(async { args.run().await })
Expand All @@ -22,15 +27,15 @@ async fn run_cast_command(chain: ChainId, tx: String) -> Result<String, String>
}

#[get("/run_cast/{chain_id}/{tx}")]
async fn cast_command_handler(path: web::Path<(u64, String)>) -> impl Responder {
let (chain_id, tx) = path.into_inner();
async fn cast_command_handler(path: web::Path<(u64, String, u64)>) -> impl Responder {
let (chain_id, tx, quick) = path.into_inner();

let chain = match ChainId::from_id(chain_id) {
Some(chain) => chain,
None => ChainId::RoninMainnet,
};

match run_cast_command(chain, tx).await {
match run_cast_command(chain, tx, quick).await {
Ok(output) => HttpResponse::Ok().content_type("text/plain").body(output),
Err(e) => {
println!("Error response: {}", e);
Expand All @@ -45,7 +50,7 @@ async fn main() -> std::io::Result<()> {
let cors = Cors::permissive();
App::new().wrap(cors).service(cast_command_handler)
})
.keep_alive(Duration::from_secs(600))
.keep_alive(Duration::from_secs(900))
.bind("0.0.0.0:8080")?
.workers(5)
.run()
Expand Down

0 comments on commit a888531

Please sign in to comment.