这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@fengtality
Copy link
Contributor

@fengtality fengtality commented Jun 2, 2023

A description of the changes proposed in the pull request:

  • Since default token lists are stored in src, Docker users have been unable to easily add new tokens
  • Changes in this PR (for Ethereum only)
    • Moves the default list location to conf/[list].json
    • Moves the token lists for Ethereum into src/templates
    • Modifies gateway-setup.sh so that it creates all files from templates directory, including the new lists

Tests performed by the developer:

I tested this with a random Arbitrum new token: https://arbiscan.io/token/0xBfbCFe8873fE28Dfa25f1099282b088D52bbAD9C

Added token info to Arbitrum list in conf/lists
Screen Shot 2023-06-02 at 3 01 49 PM

Postman returns a 0 balance for EQR - if no token is found, it would not return a value
Screen Shot 2023-06-02 at 3 01 57 PM

Hummingbot client (after restarting) also shows EQR balance
Screen Shot 2023-06-02 at 3 03 53 PM

Tips for QA testing:

  • Please test Docker build
  • There may be permissions issues with new lists folder

@fengtality fengtality added the enhancement New feature or request label Jun 2, 2023
@fengtality fengtality requested a review from rapcmia June 2, 2023 22:13
@rapcmia
Copy link
Contributor

rapcmia commented Jun 6, 2023

PR update:

  • Overview of PR, changes are applied only for Ethereum
  • Setup this gateway PR and latest client development
    • Confirmed no tokenlist.json file is located on previous folder for Ethereum (others are still on default src/chain folders
    • gateway-setup.sh now copies src/template/list to conf/list
    • Check gateway config ethereum
      image
      • confirmed new location is available 💯
  • Build docker image successful for this PR
  • Confirm gateway config ethereum changes worked, location is the same like the screenshot above however:

Due to location of tokenListSource it is now returning an error when setting up wallet on ethereum connectors:
image

2023-06-06 03:52:33,214 - 1 - hummingbot.core.gateway.gateway_http_client - WARNING - Call to https://localhost:15888/wallet/add failed. See logs for more details.
2023-06-06 03:52:33,214 - 1 - hummingbot.core.utils.async_utils - ERROR - Unhandled error in background task: Error on POST https://localhost:15888/wallet/add Error: {'message': 'Unknown error.', 'httpErrorCode': 503, 'errorCode': 1099, 'stack': "Error: ENOENT: no such file or directory, open 'conf/lists/arbitrum_one_tokens.json'"}
Traceback (most recent call last):
  File "/home/hummingbot/hummingbot/core/utils/async_utils.py", line 9, in safe_wrapper
    return await c
  File "/home/hummingbot/hummingbot/client/command/gateway_command.py", line 256, in _gateway_connect
    wallet_address, additional_prompt_values = await self._prompt_for_wallet_address(
  File "/home/hummingbot/hummingbot/client/command/gateway_command.py", line 382, in _prompt_for_wallet_address
    response: Dict[str, Any] = await self._get_gateway_instance().add_wallet(
  File "/home/hummingbot/hummingbot/core/gateway/gateway_http_client.py", line 265, in add_wallet
    return await self.api_request(method="post", path_url="wallet/add", params=request)
  File "/home/hummingbot/hummingbot/core/gateway/gateway_http_client.py", line 218, in api_request
    raise e
  File "/home/hummingbot/hummingbot/core/gateway/gateway_http_client.py", line 206, in api_request
    raise ValueError(f"Error on {method.upper()} {url} Error: {parsed_response}")
ValueError: Error on POST https://localhost:15888/wallet/add Error: {'message': 'Unknown error.', 'httpErrorCode': 503, 'errorCode': 1099, 'stack': "Error: ENOENT: no such file or directory, open 'conf/lists/arbitrum_one_tokens.json'"}
  • the gateway_container_file/conf/ does not have list folder
  • This is most likely due to the helper or compose script when creating image, does not copy the src/templates/list to the gateway_container_file/conf/list
  • Tried to modify the script and was able to create the conf/list folder but there are no default tokenlist that can be modified like on source build.
  • Change permission sudo chmod -R a+rw has been applied too the test but no go
    image

Steps to reproduce:

  • Build docker image for this PR docker build -t hummingbot/gateway:126 .
  • Setup latest docker image for client development and this PR126
  • Run gateway config ethereum and observe the tokenListSource dir
  • Added any wallet from supported uniswap connectors
  • Observe error messages after adding the connector

logs_hummingbot.log

@fengtality
Copy link
Contributor Author

@cardosofede for this to work when users install Gateway using Docker, I think the lists stored in /src/templates/lists to /conf/lists locally.

I tried to do this in the last commit, but the JSON files are still not being copied over.

@fengtality
Copy link
Contributor Author

I changed the Dockerfile and created this PR in the deploy-examples repo: hummingbot/deploy#19

Tips for QA

  • Test this PR by installing Gateway from 1) source using gateway-setup.sh and 2) Docker using the Hummingbot+Gateway example from this PR Fix/add copy scripts deploy#19
  • Follow the instructionsin docs and README as if you are a new user
  • In both cases, you should be able to add a DEX connector with gateway connect uniswap
  • You should also be able to see WETH balances after gateway connector-tokens [exchange] WETH
  • Add a token entry to the list in the local directory
  • Afterwards you should be able to query for that token's balance from Hummingbot

@rapcmia
Copy link
Contributor

rapcmia commented Jun 9, 2023

PR update:

  • Test commit 143fa04b08ede19e84f7f11f8cdc3785e5e5aaff
  • Test this PR and latest client development version using source

Test macbook pro (m1)

image
image

  • Balance command works ✅
  • Ran gateway approve-token command and able to approve ✅
  • Setup simple AMM-ARB strategy and observed expected behavior ✅

Test WSL ubuntu 20.04LTS

image

  • Getting an error of sed: can't read s|/home/gateway/conf/lists/|conf/lists/|g: No such file or directory which seems to be on line 83 under replace_list_source()
    image
  • While this happened client and gateway successfully connected ✅
    image
    • tokenListSource is changed which is correct base on the src/templates/ folder for both WSL ubuntu 20.04 and MBP(m1) but we are assuming that the error from line 83 of gateway_setup.sh could be the reason.
      image
      • Due to the changes on the default tokenListSource we are now getting the following error:
        • Call to https://localhost:15888/wallet/add failed. See logs for more details.
        • Error: ENOENT: no such file or directory, open '/home/gateway/conf/lists/arbitrum_one_tokens.json’
         2023-06-09 12:08:14,017 - 6264 - hummingbot.core.gateway.gateway_status_monitor - INFO - Gateway Service is ONLINE.
         2023-06-09 12:15:22,348 - 6264 - hummingbot.core.gateway.gateway_http_client - WARNING - Call to https://localhost:15888/wallet/add failed. See logs for more details.
         2023-06-09 12:15:22,348 - 6264 - hummingbot.core.utils.async_utils - ERROR - Unhandled error in background task: Error on POST https://localhost:15888/wallet/add Error: {'message': 'Unknown error.', 'httpErrorCode': 503, 'errorCode': 1099, 'stack': "Error: ENOENT: no such file or directory, open '/home/gateway/conf/lists/arbitrum_one_tokens.json'"}
         Traceback (most recent call last):
           File "/home/rapcmia/github/hummingbot/dev/hummingbot/core/utils/async_utils.py", line 9, in safe_wrapper
             return await c
           File "/home/rapcmia/github/hummingbot/dev/hummingbot/client/command/gateway_command.py", line 256, in _gateway_connect
             wallet_address, additional_prompt_values = await self._prompt_for_wallet_address(
           File "/home/rapcmia/github/hummingbot/dev/hummingbot/client/command/gateway_command.py", line 382, in _prompt_for_wallet_address
             response: Dict[str, Any] = await self._get_gateway_instance().add_wallet(
           File "/home/rapcmia/github/hummingbot/dev/hummingbot/core/gateway/gateway_http_client.py", line 265, in add_wallet
             return await self.api_request(method="post", path_url="wallet/add", params=request)
           File "/home/rapcmia/github/hummingbot/dev/hummingbot/core/gateway/gateway_http_client.py", line 218, in api_request
             raise e
           File "/home/rapcmia/github/hummingbot/dev/hummingbot/core/gateway/gateway_http_client.py", line 206, in api_request
             raise ValueError(f"Error on {method.upper()} {url} Error: {parsed_response}")
         ValueError: Error on POST https://localhost:15888/wallet/add Error: {'message': 'Unknown error.', 'httpErrorCode': 503, 'errorCode': 1099, 'stack': "Error: ENOENT: no such file or directory, open '/home/gateway/conf/lists/arbitrum_one_tokens.json'"}
        
        • Able to have connect wallet successfully by changing the tokenListSource using the full directory where the .json files are located
          image

Pending:

  • Docker using Hummingbot + gateway from PR19

@nikspz
Copy link
Contributor

nikspz commented Jun 9, 2023

Docker using the Hummingbot+Gateway example from this PR hummingbot/deploy#19

Steps:

  1. manually created docker image from gwPR126 and development branch
  2. cloned Fix/add copy scripts deploy#19 and used hummingbot_gateway_compose/docker-compose.yml filed
  3. used installation instructions from hummingbot_gateway_compose example
  4. reviewed hummingbot client run and gateway ONLINE
  5. gateway connect uniswap arbitrum

Actual:
Got an issue: Failed to add wallet. Also review lists folder not created in /conf/lists

image
image

Exit the Client and tried to connect wallet again - successfully connected, however still no lists folder created, Failed to ran amm_arb / approve tokens (on development branch same command approve tokens successfully/ amm_arb showing profitability on dev)

@fengtality
Copy link
Contributor Author

@nikspz Did you see this line in the new instructions in the deploy-examples README?

Populate Gateway lists folder from token lists from the Gateway image:

docker cp gateway:/home/gateway/src/templates/lists ./gateway_files/conf/lists

@david-hummingbot
Copy link
Contributor

Was able to replicate Ralph's issue on Source (amd64)

  • Got the sed -i '' 's|/home/gateway/conf/lists/|conf/lists/|g' $file error after running the gateway_setup.sh script.

2023-06-10_000210

  • Got an error in Gateway saying ENOENT: no such file or directory, open '/home/gateway/conf/lists/arbitrum_one_tokens.json' when trying to connect to uniswap arbitrum_one but running gateway config ethereum shows that there is an arbitrum_one_tokens.json file in the correct directory.

2023-06-10_010704

2023-06-10_011626

@fengtality
Copy link
Contributor Author

fengtality commented Jun 10, 2023

@david-hummingbot I changed the sed command to perl in the setup script since ChatGPT told me it should work on all systems =)

If you see that the ethereum.yml file has been modified afterwards so that tokenListSource is conf/lists/...json, then it worked.

When the tokenListSource is /home/gateway/, it should work without modification for Docker users, since that is the location in the Docker volume that is mapped to the user's local gateway_files/conf/lists folder.

When the user is running from source, the perl command in gateway-setup.sh should replace the /home/gateway/ references with the local conf/lists folder location.

@nikspz
Copy link
Contributor

nikspz commented Jun 13, 2023

https://github.com/hummingbot/gateway/pull/126/files#diff-046085b9f807c9537072f01918c95c25b997d185a4acbf552b26f691a7f67aefR107

https://github.com/hummingbot/gateway/pull/126/files#diff-046085b9f807c9537072f01918c95c25b997d185a4acbf552b26f691a7f67aefR17

We should add Yes and True as an option as well (as we do in hummingbot PRs before)

Steps:
Clone and install PR6373 and #126
Open Client generate certs
in the terminal cd gateway folder and yarn + yarn build
on ./gateway-setup.sh
Do you want to copy over client certificates (Y/N) >>> Yes

Actual:
Skipping copying client certificates

Expected:
Yes and True promt supported

image

image

Copy link
Contributor

@david-hummingbot david-hummingbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docker

  • initial test using hummingbot/hummingbot:scripts-copy image - ok
  • test using deploy-examples PR#19 - ok
  • Docker image built locally - ok
  • docker compose up -d
  • sudo chmod -R a+rw ./hummingbot_files
  • docker cp hummingbot:/home/hummingbot/scripts-copy/. ./hummingbot_files/scripts/
  • verified scripts files are present in the /scripts folder
  • docker attach hummingbot
  • run start --script and made sure scripts are showing - ok
  • run script - ok

Source install

  • install gateway ok
  • run ./gateway-setup.sh, no errors
  • checked ethereum.yml file and verified tokenlistsource shows conf/lists
  • checked conf/lists folder and .json files are present
  • start up gateway and client shows online
  • gateway connect uniswap arbitrum
  • run gateway config ethereum and confirm tokenListSource directory

@fengtality
Copy link
Contributor Author

We should add Yes and True as an option as well (as we do in hummingbot PRs before)

@nikspz For bash scripts, we previously only supported "Y" or "y" - see https://github.com/hummingbot/gateway/tree/main/docker. I think we only try to support Yes or True in the client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants