hummingbot / backend-api

Backend API to orchestrate multiple bots
MIT License
18 stars 25 forks source link

Unable to start due to ValidationError and ValuError related to Dexalot connector #43

Open rapcmia opened 1 week ago

rapcmia commented 1 week ago

Describe the bug

After we successfully build again the backend-api from staging/development branch, it kept on failing with errors that seem related to dexalot connector

                                                                                             ✔  1m 38s
 ~/github/hummingbot/backend-api/dev-backendapi  development ⇣2 !1  make run                                                                                                            ✔  backend-api 
uvicorn main:app --reload
INFO:     Will watch for changes in these directories: ['/Users/rapcomia/github/hummingbot/backend-api/dev-backendapi']
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO:     Started reloader process [27116] using WatchFiles
Process SpawnProcess-1:
Traceback (most recent call last):
  File "/Users/rapcomia/miniconda3/envs/backend-api/lib/python3.10/site-packages/eth_account/account.py", line 823, in _parsePrivateKey
    return self._keys.PrivateKey(HexBytes(key))
  File "/Users/rapcomia/miniconda3/envs/backend-api/lib/python3.10/site-packages/eth_keys/datatypes.py", line 246, in __init__
    validate_private_key_bytes(private_key_bytes)
  File "/Users/rapcomia/miniconda3/envs/backend-api/lib/python3.10/site-packages/eth_keys/validation.py", line 81, in validate_private_key_bytes
    validate_bytes_length(value, 32, "private key")
  File "/Users/rapcomia/miniconda3/envs/backend-api/lib/python3.10/site-packages/eth_keys/validation.py", line 52, in validate_bytes_length
    raise ValidationError(
eth_utils.exceptions.ValidationError: Unexpected private key length: Expected 32, but got 0 bytes

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/rapcomia/miniconda3/envs/backend-api/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/Users/rapcomia/miniconda3/envs/backend-api/lib/python3.10/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/rapcomia/miniconda3/envs/backend-api/lib/python3.10/site-packages/uvicorn/_subprocess.py", line 80, in subprocess_started
    target(sockets=sockets)
  File "/Users/rapcomia/miniconda3/envs/backend-api/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/Users/rapcomia/miniconda3/envs/backend-api/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "uvloop/loop.pyx", line 1518, in uvloop.loop.Loop.run_until_complete
  File "/Users/rapcomia/miniconda3/envs/backend-api/lib/python3.10/site-packages/uvicorn/server.py", line 69, in serve
    await self._serve(sockets)
  File "/Users/rapcomia/miniconda3/envs/backend-api/lib/python3.10/site-packages/uvicorn/server.py", line 76, in _serve
    config.load()
  File "/Users/rapcomia/miniconda3/envs/backend-api/lib/python3.10/site-packages/uvicorn/config.py", line 434, in load
    self.loaded_app = import_from_string(self.app)
  File "/Users/rapcomia/miniconda3/envs/backend-api/lib/python3.10/site-packages/uvicorn/importer.py", line 19, in import_from_string
    module = importlib.import_module(module_str)
  File "/Users/rapcomia/miniconda3/envs/backend-api/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Users/rapcomia/github/hummingbot/backend-api/dev-backendapi/main.py", line 4, in <module>
    from routers import manage_accounts, manage_backtesting, manage_broker_messages, manage_docker, manage_files, manage_market_data
  File "/Users/rapcomia/github/hummingbot/backend-api/dev-backendapi/routers/manage_backtesting.py", line 16, in <module>
    directional_trading_backtesting = DirectionalTradingBacktesting()
  File "/Users/rapcomia/miniconda3/envs/backend-api/lib/python3.10/site-packages/hummingbot/strategy_v2/backtesting/backtesting_engine_base.py", line 36, in __init__
    self.backtesting_data_provider = BacktestingDataProvider(connectors={})
  File "/Users/rapcomia/miniconda3/envs/backend-api/lib/python3.10/site-packages/hummingbot/strategy_v2/backtesting/backtesting_data_provider.py", line 35, in __init__
    self.connectors = {name: self.get_connector(name) for name, settings in self.conn_settings.items()
  File "/Users/rapcomia/miniconda3/envs/backend-api/lib/python3.10/site-packages/hummingbot/strategy_v2/backtesting/backtesting_data_provider.py", line 35, in <dictcomp>
    self.connectors = {name: self.get_connector(name) for name, settings in self.conn_settings.items()
  File "/Users/rapcomia/miniconda3/envs/backend-api/lib/python3.10/site-packages/hummingbot/strategy_v2/backtesting/backtesting_data_provider.py", line 53, in get_connector
    connector = connector_class(**init_params)
  File "/Users/rapcomia/miniconda3/envs/backend-api/lib/python3.10/site-packages/hummingbot/connector/exchange/dexalot/dexalot_exchange.py", line 65, in __init__
    self._tx_client: DexalotClient = self._create_tx_client()
  File "/Users/rapcomia/miniconda3/envs/backend-api/lib/python3.10/site-packages/hummingbot/connector/exchange/dexalot/dexalot_exchange.py", line 205, in _create_tx_client
    return DexalotClient(
  File "/Users/rapcomia/miniconda3/envs/backend-api/lib/python3.10/site-packages/hummingbot/connector/exchange/dexalot/data_sources/dexalot_data_source.py", line 36, in __init__
    self.account: LocalAccount = Account.from_key(dexalot_api_secret)
  File "/Users/rapcomia/miniconda3/envs/backend-api/lib/python3.10/site-packages/eth_utils/decorators.py", line 31, in _wrapper
    return self.method(objtype, *args, **kwargs)
  File "/Users/rapcomia/miniconda3/envs/backend-api/lib/python3.10/site-packages/eth_account/account.py", line 266, in from_key
    key = self._parsePrivateKey(private_key)
  File "/Users/rapcomia/miniconda3/envs/backend-api/lib/python3.10/site-packages/eth_utils/decorators.py", line 31, in _wrapper
    return self.method(objtype, *args, **kwargs)
  File "/Users/rapcomia/miniconda3/envs/backend-api/lib/python3.10/site-packages/eth_account/account.py", line 825, in _parsePrivateKey
    raise ValueError(
ValueError: The private key must be exactly 32 bytes long, instead of 0 bytes.

Steps to reproduce bug

  1. For hummingbot, first clone the hummingbot using the staging/development branch
    • Build local .whl and copy the dir from ./dist/your_local.whl backend-api's environment.yml
  2. On Backend-api, run make install && make run
  3. Observed after 1-2mins and error will occur
rapcmia commented 1 week ago

Tried to copy dexalot.yml file see if this fixed the issue but nogo, getting same error causing backend-api to not start and sync with dashboard and broker image

yancong001 commented 2 days ago

here https://github.com/hummingbot/hummingbot/pull/7287