bancorprotocol / fastlane-bot

Fast Lane, an open-source arbitrage protocol, allows any user to perform arbitrage between Bancor ecosystem protocols and external exchanges and redirect arbitrage profits back to the protocol.
https://github.com/bancorprotocol/fastlane-bot
MIT License
124 stars 53 forks source link

Error occurring when fetching pool information on Fantom #550

Open Lesigh-3100 opened 3 months ago

Lesigh-3100 commented 3 months ago

Bug Description

This bug was reported when running the bot on Fantom:

2024-04-16 10:09:00,727 [fastlane:ERROR] - Error in main loop: Traceback (most recent call last):
2024-04-16T10:09:00.728333936Z stderr F   File "/app/main.py", line 385, in run
2024-04-16T10:09:00.728339063Z stderr F     run_async_update_with_retries(
2024-04-16T10:09:00.728342702Z stderr F   File "/app/main.py", line 578, in run_async_update_with_retries
2024-04-16T10:09:00.728345523Z stderr F     async_update_pools_from_contracts(mgr, current_block, logging_path)
2024-04-16T10:09:00.728349159Z stderr F   File "/app/fastlane_bot/events/async_event_update_utils.py", line 469, in async_update_pools_from_contracts
2024-04-16T10:09:00.72835226Z stderr F     new_pool_data = get_new_pool_data(
2024-04-16T10:09:00.728355249Z stderr F                     ^^^^^^^^^^^^^^^^^^
2024-04-16T10:09:00.72835893Z stderr F   File "/app/fastlane_bot/events/async_event_update_utils.py", line 293, in get_new_pool_data
2024-04-16T10:09:00.728361848Z stderr F     pool_info = get_pool_info(pool, mgr, current_block, tkn0, tkn1, pool_data_keys)
2024-04-16T10:09:00.728364979Z stderr F                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-04-16T10:09:00.728367998Z stderr F   File "/app/fastlane_bot/events/async_event_update_utils.py", line 176, in get_pool_info
2024-04-16T10:09:00.72837079Z stderr F     fee_raw = eval(str(pool["fee"]))
2024-04-16T10:09:00.728374Z stderr F               ^^^^^^^^^^^^^^^^^^^^^^
2024-04-16T10:09:00.728377911Z stderr F   File "<string>", line 1, in <module>
2024-04-16T10:09:00.728380769Z stderr F NameError: name 'nan' is not defined

Relevant configuration:

--arb_mode=multi --blockchain=fantom --default_min_profit_gas_token=0.0005 --exchanges=fraxswap_v2,velocimeter_v2,sushiswap_v2,equalizer_v2,wigoswap_v2,knightswap_v2,sushiswap_v3,spookyswap_v2,soulswap_v2,carbon_v1,hyperjump_v2 --flashloan_tokens=0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83,0x28a92dde19D9989F39A49905d7C9C2FAc7799bDf,0x1B6382DBDEa11d97f24495C9A90b7c88469134a4 --alchemy_max_block_fetch=1000

Severity (High/Medium/Low)

High

Steps to Reproduce

Config in description

Expected Behavior

Error should not occur when fetching new pool data.

Actual Behavior

Error occurs when getting new pool data.

Impact Analysis (to be filled by contributors)

sklbancor commented 3 months ago
2024-04-16T10:09:00.72837079Z stderr F     fee_raw = eval(str(pool["fee"]))
2024-04-16T10:09:00.728380769Z stderr F NameError: name 'nan' is not defined

1/ why do we use eval here? 2/ clearly we did not get the pool fee; where is this data created and why is it NaN (not a number)?

Lesigh-3100 commented 3 months ago

This error is a result of running the bot with the fraxswap_v2 exchange, which is implemented in multichain_addresses but not supported by the bot.

To resolve this, references to fraxswap_v2 should be removed.