anthias-labs / arbiter

A blazing-fast Ethereum sandbox that lets developers orchestrate event-driven simulations.
https://github.com/anthias-labs/arbiter
Apache License 2.0
674 stars 65 forks source link

Error Encountered: "Only handling one map deep for now" When Forking Uniswap V3 Factory #979

Open Akbar30Bill opened 5 months ago

Akbar30Bill commented 5 months ago

Problem

I am using Arbiter to fork a Uniswap V3 Factory. My goal is to subsequently use this fork to run some benchmarks with a newly created pool. To achieve this, I plan to call the createPool function of the Uniswap Factory. However, during the forking process, I encountered the following error:

Only handling one map deep for now. A map of a map was found and ignored.

Subsequently, when I try to use the contract, the transactions fail and do not work as expected.


Steps to reproduce

  1. Use arbiter to fork polygon mainnet
    arbiter fork fork_conf.toml --overwrite
  2. Observe the error message: Only handling one map deep for now. A map of a map was found and ignored.
  3. Attempt to call the createPool function on the forked factory.
  4. Observe the revert transaction error

Expected behavior

The fork command should create a state on disk which is usable and the functions of the Uniswap V3 Factory could be called in the environment

Code snippets/links or screenshots

Here is my fork_conf.toml

# Basic configuration
output_directory = "fork/"
output_filename = "polygon.json"
provider = "<my-chain-provider>"
block_number = 57446120

# Contracts stored in a mapping
# Try this out with the weth contract
[contracts.UniswapV3Factory]
address = "0x1F98431c8aD98523631AE4a59f267346ea31F984"
artifacts_path = "out/UniswapV3Factory.sol/UniswapV3Factory.json"

[contracts.SwapRouter]
address = "0xE592427A0AEce92De3Edee1F18E0157C05861564"
artifacts_path = "out/SwapRouter.sol/SwapRouter.json"

# EOAs
[externally_owned_accounts]
vitalik = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" # vitalik.eth as of 10/2/2023

[contracts.UniswapV3Factory.mappings]
balanceOf = [
    "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", # vitalik.eth as of 10/2/2023
]

[contracts.SwapRouter.mappings]
balanceOf = [
    "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", # vitalik.eth as of 10/2/2023
]

Additional context

The error that i get while calling the create pool function:

called `Result::unwrap()` on an `Err` value: MiddlewareError { e: ExecutionRevert { gas_used: 24738, output: [] } }

the way that i load the contract using ethers rs

let cl = Arc::new(client);
let uni_v3_factory = uniswap_v3_factory::UniswapV3Factory::new(factory_address, cl);

the way that i call the createPool function

let create_pool_function = uni_v3_factory.create_pool(token1.address(), token0.address(), 500);
let pool_create_transaction_hash = create_pool_function.send().await.unwrap().await.expect("Could not create pool").unwrap().transaction_hash;

Note: that the token0 and token1 are being deployed in the same script

Provide an adequate title with tags and a brief description The tags should be in the format of "tag:" Description. Since this is a bug report, please use: