flashbots / mev-geth

Go implementation of MEV-Auction for Ethereum
GNU Lesser General Public License v3.0
788 stars 198 forks source link

Executing on Uniswap Lookup contract getPairsByIndexRange takes very long #122

Closed LuckyLukeArbitrage closed 2 years ago

LuckyLukeArbitrage commented 2 years ago

System information

Geth version: geth version Geth Version: 1.10.16-stable Git Commit: ec93a8f2559390c94517a87234a6ebd322088c1e Git Commit Date: 20220302 Architecture: amd64 Go Version: go1.18 Operating System: linux GOPATH= GOROOT=go

OS & Version: Linux Ubunut 20.04 Commit hash : (if develop)

mv-geth config: [Eth] NetworkId = 1 SyncMode = "light" EthDiscoveryURLs = ["enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@les.mainnet.ethdisco.net"] SnapDiscoveryURLs = ["enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@les.mainnet.ethdisco.net"] NoPruning = false NoPrefetch = false TxLookupLimit = 2350000 LightPeers = 100 UltraLightFraction = 75 DatabaseCache = 512 DatabaseFreezer = "" TrieCleanCache = 154 TrieCleanCacheJournal = "triecache" TrieCleanCacheRejournal = 3600000000000 TrieDirtyCache = 256 TrieTimeout = 3600000000000 SnapshotCache = 102 Preimages = false EnablePreimageRecording = false RPCGasCap = 50000000 RPCEVMTimeout = 0 RPCTxFeeCap = 1e+00

[Eth.Miner] GasFloor = 0 GasCeil = 8000000 GasPrice = 1000000000 Recommit = 3000000000 Noverify = false MaxMergedBundles = 3 TrustedRelays = ["0x870e2734ddbe2fba9864f33f3420d59bc641f2be"]

[Eth.Ethash] CacheDir = "ethash" CachesInMem = 2 CachesOnDisk = 3 CachesLockMmap = false DatasetDir = "/home/david/.ethash" DatasetsInMem = 1 DatasetsOnDisk = 2 DatasetsLockMmap = false PowMode = 0 NotifyFull = false

[Eth.TxPool] Locals = [] NoLocals = false Journal = "transactions.rlp" Rejournal = 3600000000000 PriceLimit = 1 PriceBump = 10 AccountSlots = 16 GlobalSlots = 5120 AccountQueue = 64 GlobalQueue = 1024 Lifetime = 10800000000000 PrivateTxLifetime = 259200000000000 TrustedRelays = ["0x870e2734ddbe2fba9864f33f3420d59bc641f2be"]

[Eth.GPO] Blocks = 2 Percentile = 60 MaxHeaderHistory = 300 MaxBlockHistory = 5 MaxPrice = 500000000000 IgnorePrice = 2

[Node] DataDir = "/home/david/.ethereum" IPCPath = "geth.ipc" HTTPHost = "localhost" HTTPPort = 8545 HTTPVirtualHosts = ["localhost"] HTTPModules = ["eth", "net", "web3"] WSHost = "" WSPort = 8546 WSModules = ["net", "web3", "eth"] GraphQLVirtualHosts = ["localhost"]

[Node.P2P] MaxPeers = 50 NoDiscovery = true DiscoveryV5 = true BootstrapNodes = ["enode://d860a01f9722d78051619d1e2351aba3f43f943f6f00718d1b9baa4101932a1f5011f16bb2b1bb35db20d6fe28fa0bf09636d26a87d31de9ec6203eeedb1f666@18.138.108.67:30303", "enode://22a8232c3abc76a16ae9d6c3b164f98775fe226f0917b0ca871128a74a8e9630b458460865bab457221f1d448dd9791d24c4e5d88786180ac185df813a68d4de@3.209.45.79:30303", "enode://ca6de62fce278f96aea6ec5a2daadb877e51651247cb96ee310a318def462913b653963c155a0ef6c7d50048bba6e6cea881130857413d9f50a621546b590758@34.255.23.113:30303", "enode://279944d8dcd428dffaa7436f25ca0ca43ae19e7bcf94a8fb7d1641651f92d121e972ac2e8f381414b80cc8e5555811c2ec6e1a99bb009b3f53c4c69923e11bd8@35.158.244.151:30303", "enode://8499da03c47d637b20eee24eec3c356c9a2e6148d6fe25ca195c7949ab8ec2c03e3556126b0d7ed644675e78c4318b08691b7b57de10e5f0d40d05b09238fa0a@52.187.207.27:30303", "enode://103858bdb88756c71f15e9b5e09b56dc1be52f0a5021d46301dbbfb7e130029cc9d0d6f73f693bc29b665770fff7da4d34f3c6379fe12721b5d7a0bcb5ca1fc1@191.234.162.198:30303", "enode://715171f50508aba88aecd1250af392a45a330af91d7b90701c436b618c86aaa1589c9184561907bebbb56439b8f8787bc01f49a7c77276c58c1b09822d75e8e8@52.231.165.108:30303", "enode://5d6d7cd20d6da4bb83a1d28cadb5d409b64edf314c0335df658c1a54e32c7c4a7ab7823d57c39b6a757556e68ff1df17c748b698544a55cb488b52479a92b60f@104.42.217.25:30303"] BootstrapNodesV5 = ["enr:-KG4QOtcP9X1FbIMOe17QNMKqDxCpm14jcX5tiOE4_TyMrFqbmhPZHK_ZPG2Gxb1GE2xdtodOfx9-cgvNtxnRyHEmC0ghGV0aDKQ9aX9QgAAAAD__4JpZIJ2NIJpcIQDE8KdiXNlY3AyNTZrMaEDhpehBDbZjM_L9ek699Y7vhUJ-eAdMyQW_Fil522Y0fODdGNwgiMog3VkcIIjKA", "enr:-KG4QDyytgmE4f7AnvW-ZaUOIi9i79qX4JwjRAiXBZCU65wOfBu-3Nb5I7b_Rmg3KCOcZM_C3y5pg7EBU5XGrcLTduQEhGV0aDKQ9aX9QgAAAAD__4JpZIJ2NIJpcIQ2DUbiXNlY3AyNTZrMaEDKnz-ps3UUOfHWVYaskI5kWYO_vtYMGYCQRAR3gHDouDdGNwgiMog3VkcIIjKA", "enr:-Ku4QImhMc1z8yCiNJ1TyUxdcfNucje3BGwEHzodEZUan8PherEo4sF7pPHPSIB1NNuSg5fZy7qFsjmUKs2ea1Whi0EBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpD1pf1CAAAAAP__gmlkgnY0gmlwhBLf22SJc2VjcDI1NmsxoQOVphkDqal4QzPMksc5wnpuC3gvSC8AfbFOnZY_On34wIN1ZHCCIyg", "enr:-Ku4QP2xDnEtUXIjzJ_DhlCRN9SN99RYQPJL92TMlSv7U5C1YnYLjwOQHgZIUXw6c-BvRg2Yc2QsZxxoS_pPRVe0yK8Bh2F0dG5ldHOIAAAAAAAAAACEZXRoMpD1pf1CAAAAAP__gmlkgnY0gmlwhBLf22SJc2VjcDI1NmsxoQMeFF5GrS7UZpAH2Ly84aLK-TyvH-dRo0JM1i8yygH50YN1ZHC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Ku4QPn5eVhcoF1opaFEvg1b6JNFD2rqVkHQ8HApOKK61OIcIXD127bKWgAtbwI7pnxx6cDyk_nI88TrZKQaGMZj0q0Bh2F0dG5ldHOIAAAAAAAAAACEZXRoMpC1MD8qAAAAAP__gmlkgnY0gmlwhDayLMaJc2VjcDI1NmsxoQK2sBOLGcUb4AwuYzFuAVCaNHA-dy24UuEKkeFNgCVCsIN1ZHCCIyg", "enr:-Ku4QEWzdnVtXc2Q0ZVigfCGggOVB2Vc1ZCPEc6j21NIFLODSJbvNaef1g4PxhPwl_3kax86YPheFUSLXPRs98vvYsoBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpC1MD8qAAAAAP__gmlkgnY0gmlwhDZBrP2Jc2VjcDI1NmsxoQM6jr8Rb1ktLEsVcKAPa08wCsKUmvoQ8khiOl_SLozf9IN1ZHCCIyg"] StaticNodes = [] TrustedNodes = [] ListenAddr = ":30303" EnableMsgEvents = false

[Node.HTTPTimeouts] ReadTimeout = 30000000000 WriteTimeout = 30000000000 IdleTimeout = 120000000000

[Metrics] HTTP = "127.0.0.1" Port = 6060 InfluxDBEndpoint = "http://localhost:8086" InfluxDBDatabase = "geth" InfluxDBUsername = "test" InfluxDBPassword = "test" InfluxDBTags = "host=localhost" InfluxDBToken = "test" InfluxDBBucket = "geth" InfluxDBOrganization = "geth"

Expected behaviour

Expecting same performance when calling the getPairsByIndexRange from Uniswap Lookup contract (0x5EF1009b9FCD4fec3094a5564047e190D72Bd511) like with "naked" Geth.

Actual behaviour

When calling getPairsByIndexRange on Uniswap Loopup contract (0x5EF1009b9FCD4fec3094a5564047e190D72Bd511) mev-geth never answers and timeout occurs.

Steps to reproduce the behaviour

  1. Build and setup mev-geth
  2. Run simple-arbitage example from flashbot

Backtrace

mev-get loggin:
INFO [03-17|19:21:10.730] Looking for peers                        peercount=2 tried=7  static=0
WARN [03-17|19:21:11.664] Served eth_call                          conn=127.0.0.1:37068 reqid=54 duration=1m58.94807364s err="getDeleteStateObject (9f1f56944016a42001ab2df0a16d1f0907708f2b) error: context canceled"
WARN [03-17|19:21:11.664] Served eth_call                          conn=127.0.0.1:37066 reqid=53 duration=2m0.022351454s err="getDeleteStateObject (829bd824b016326a401d083b33d092293333a830) error: context canceled"
INFO [03-17|19:21:22.044] Looking for peers                        peercount=2 tried=6  static=0
simple arbitage response:
Uncaught Error Error: timeout (requestBody="{\"method\":\"eth_call\",\"params\":[{\"to\":\"0x5ef1009b9fcd4fec3094a5564047e190d72bd511\",\"data\":\"0xab2217e4000000000000000000000000c0aee478e3658e2610c5f7a4a2e1777ce9e4f2ac00000000000000000000000000000000000000000000000000000000000003e800000000000000000000000000000000000000000000000000000000000007d0\"},\"latest\"],\"id\":53,\"jsonrpc\":\"2.0\"}", requestMethod="POST", timeout=120000, url="http://127.0.0.1:8545", code=TIMEOUT, version=web/5.6.0)
    at Logger.makeError (/home/david/development/flashbot/samples/simple-arbitrage/node_modules/@ethersproject/logger/src.ts/index.ts:261:28)
    at <anonymous> (/home/david/development/flashbot/samples/simple-arbitrage/node_modules/@ethersproject/web/src.ts/index.ts:216:35)
    at listOnTimeout (node:internal/timers:559:17)
    at processTimers (node:internal/timers:502:7)
bertmiller commented 2 years ago

There's not much we can do about this, that query returns an insane amount of data. It'll eventually resolve, but if you want to run a competitive bot you will need to rearchitect simple arb bot or get that data in another way.