mouseless-eth/rusty-sando

Thread 'tokio-runtime-worker' panicked at 'arithmetic operation overflow'

e7172 opened this issue · 3 comments

e7172 commented

Im having this error:
thread 'tokio-runtime-worker' panicked at 'arithmetic operation overflow'

Running:
cargo run --bin rusty-sando --release

We think is in create_optimal_sandwich func located in /src/simulate/make_sandwich.rs

pub async fn create_optimal_sandwich(
    ingredients: &RawIngredients,
    sandwich_balance: U256,
    next_block: &BlockInfo,
    fork_factory: &mut ForkFactory,
    sandwich_maker: &SandwichMaker,
) -> Result<OptimalRecipe, SimulationError> {
    let optimal = juiced_quadratic_search(
        ingredients,
        U256::zero(),
        sandwich_balance,
        next_block,
        fork_factory,
    )
    .await?;

    #[cfg(test)]
    {
        println!("Optimal amount in: {}", optimal);
    }

    sanity_check(
        sandwich_balance,
        optimal,
        ingredients,
        next_block,
        sandwich_maker,
        fork_factory.new_sandbox_fork(),
    )
}

By running /src/runner/mod.rs

let mut optimal_sandwich = match make_sandwich::create_optimal_sandwich(
                        &raw_ingredients,
                        sandwich_balance,
                        &block_oracle.next_block,
                        &mut fork_factory,
                        &sandwich_maker,
                    )
                    .await
                    {
                        Ok(optimal) => optimal,
                        Err(e) => {
                            log::info!(
                                "{}",
                                format!("{:?} sim failed due to {:?}", &victim_hash, e).yellow()
                            );
                            return;
                        }
                    };

Any idea what may be causing this error?
Thanks!

I get the same error, running Linux. Switched variables from mainnet to goerli. Also my rpc daemon returns an error about tracecallmany. Not sure if related. Went through the code and it seems the intervals variable array is what's the issue however I'm not familiar with rust and am still working this out. Will check back in if I figure it out.

Did you fund the sandwich contract?

I did not, but I'll be sure to do that if it will help