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

fix: include URI in provider.network_choice #2449

Merged

Conversation

antazoey
Copy link
Member

@antazoey antazoey commented Dec 24, 2024

What I did

fixes: ApeWorX/silverback#179

How I did it

When a URI is configured or passed in for a connection, use that in provider.network_choice

How to verify it

silverback uses the configured URI everywhere now.

I made sure:

  • ape-foundry tests still pass
  • ape-alchemy tests still pass
  • silverback tests pass (though you may want to add a new one for the reported issue)

Checklist

  • All changes are completed
  • New test cases have been added
  • Documentation has been updated

@@ -72,14 +71,6 @@ def test_uri(geth_provider):
assert geth_provider.uri == GETH_URI


@geth_process_test
def test_uri_localhost_not_running_uses_random_default(config):
Copy link
Member Author

Choose a reason for hiding this comment

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

this now happens at the provider-connection level, so the config value is None when not actually configured (and doesn't get set to random RPC). So the behavior is the same, just happens at a different spot, it helps us know when a value was specifically configured by the user (and not injected here)

@antazoey antazoey force-pushed the feat/network-choice-when-configured-uri branch from 2305bda to a78af4b Compare December 24, 2024 20:30
@antazoey antazoey requested a review from fubuloubu December 24, 2024 21:51
@antazoey antazoey enabled auto-merge (squash) January 1, 2025 22:57
@antazoey antazoey merged commit 309d0c7 into ApeWorX:main Jan 1, 2025
18 checks passed
@stas
Copy link

stas commented Jan 11, 2025

I'm afraid this release (or more likely #2464) broke the custom networks support:
https://github.com/velodrome-finance/sugar/actions/runs/12713130520/job/35440324276

Using this config:

networks:
  custom:
    - name: mainnet
      ecosystem: mode
      chain_id: 34443

node:
  mode:
    mainnet:
      uri: https://mode.drpc.org

Running:

docker run --rm --env-file=deployments/mode.env -v $(pwd):/app -w /app -t velodrome/sugar sh -c 'python -m black . && ape test --network mode --disable-isolation'

Ape seems to be connecting to Sepolia

ape.exceptions.NetworkMismatchError: Provider connected to chain ID '1337', which does not match network chain ID '34443'. Are you connected to 'mainnet'?

@antazoey antazoey deleted the feat/network-choice-when-configured-uri branch January 13, 2025 02:18
@antazoey
Copy link
Member Author

I'm afraid this release (or more likely #2464) broke the custom networks support:

#2464 has not been released yet. Are you using the main branch or 0.8.24?
Either way, I am looking into it.

@antazoey
Copy link
Member Author

@stas OK I believe I have figured it out: #2466
Can you let me know if this works for you?

@stas
Copy link

stas commented Jan 13, 2025

@stas OK I believe I have figured it out: #2466
Can you let me know if this works for you?

Thanks so much! Will switch back to the latest for our CI to confirm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

invalid network provider used during bot setup
4 participants