darkforestry / amms-rs

A Rust library to interact with automated market makers across EVM chains.
458 stars 124 forks source link

sync too slow #77

Closed AmazingGame closed 5 months ago

AmazingGame commented 1 year ago

I use the local erigon archive node. It takes a long time to try to synchronize the pool. Is there a synchronized checkpoint for download, which can save me a lot of time

0xKitsune commented 1 year ago

Thanks for opening the issue. Can you provide more information on how long syncing is taking? Also how many factories you are syncing? Unfortunately, there are not currently sync checkpoints.

akenshin commented 1 year ago

Hello. I also have slow synchronization. I'm using a remote erigon node. Amms version 0.6.1. Uniswap V2 synchronizes in 6 minutes. Uniswap V2 + Uniswap V3 synchronize for 52 minutes. The checkpoint for Uniswap V2 weighs about 100 MB, the Uniswap V2 + Uniswap V3 checkpoint weighs 119 MB. Synchronization from checkpoint after 1 minute of waiting for Uniswap V2 takes 3 minutes. Synchronization from checkpoint after 6 hours of waiting for Uniswap V2 + Uniswap V3 takes 35 minutes.

For cfmms, Uniswap V2 + Uniswap V3 synchronization took 6 minutes. Uniswap V3 separately loaded faster than V2.

let factories = vec![
        // UniswapV2
        Factory::UniswapV2Factory(UniswapV2Factory::new(
            H160::from_str("0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f")?,
            2638438,
            300,
        )),
        //Add UniswapV3
       Factory::UniswapV3Factory(UniswapV3Factory::new(
            H160::from_str("0x1F98431c8aD98523631AE4a59f267346ea31F984")?,
            12369621,
        )),
    ];
let (mut amms, last_synced_block) = sync::sync_amms(factories.clone(), provider.clone(), None, 1000).await?;
yijingping commented 8 months ago

@0xKitsune @akenshin @AmazingGame It is too slow to sync mint/burn logs every 10k blocks. For most pools, they have logs less than 1k, so i use a binary search to fetch all logs. the pr is tested with alchemy rpc node.

124

0xKitsune commented 5 months ago

Closing for now, feel free to open another issue if you are still encountering this.