Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supports tags filter for nodes #741

Merged
merged 6 commits into from
Jan 16, 2023
Merged

Supports tags filter for nodes #741

merged 6 commits into from
Jan 16, 2023

Conversation

kompotkot
Copy link
Contributor

Changes

Nobebalancer support of filter by tag.

How to test these changes?

Tested locally

Related issues

@kompotkot kompotkot requested a review from a team December 19, 2022 12:19
@kompotkot
Copy link
Contributor Author

kompotkot commented Jan 11, 2023

@bugout-dev check

  • Merge and deploy in prod config with tags

@zomglings
Copy link
Contributor

I tested locally using the modifications on this branch: #747

My config (~/.nodebalancer/config.json):

[
  {
    "blockchain": "ethereum",
    "endpoint": "<Infura URL>",
    "tags": ["infura"]
  },
  {
    "blockchain": "polygon",
    "endpoint": "<Infura URL>",
    "tags": ["infura"]
  },
  {
    "blockchain": "polygon",
    "endpoint": "<Alchemy URL>",
    "tags": ["alchemy"]
  }
]

When I ran this request, I sometimes got the Infura URL in the x-node-url response header and sometimes the Alchemy URL:

curl -v --request POST "https://127.0.0.1:8544/nb/polygon/jsonrpc?access_id=$NB_CONTROLLER_ACCESS_ID&data_source=blockchain&tags=alchemy" \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "jsonrpc":"2.0",
        "method":"eth_blockNumber",
        "id":1
    }'

Am I using the wrong query parameter?

@zomglings
Copy link
Contributor

@kompotkot : I think it needs documentation for how to use tags, and I think you can probably also write unit tests for the node selection function.

The unit tests are currently failing. This should be fixed, as well. If necessary, remove tests, but there should be a working test framework.

@zomglings
Copy link
Contributor

@kompotkot : My bad. I was using tags for query parameter when I should have used tag.

This request is working well:

curl -v --request POST "https://127.0.0.1:8544/nb/polygon/jsonrpc?access_id=$NB_CONTROLLER_ACCESS_ID&data_source=blockchain&tag=alchemy" \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "jsonrpc":"2.0",
        "method":"eth_blockNumber",
        "id":1
    }'

Copy link
Contributor

@Andrei-Dolgolev Andrei-Dolgolev left a comment

Choose a reason for hiding this comment

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

Looks correct

@kompotkot kompotkot merged commit 2659ad9 into main Jan 16, 2023
@kompotkot kompotkot deleted the nodebalancer-tags branch January 16, 2023 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants