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: issue with networks context when networks shared chain ID #980

Merged
merged 8 commits into from
Aug 17, 2022

Conversation

antazoey
Copy link
Member

What I did

Found a weird thing in the networks context manager where would use wrong previously connected provider if two networks shared the same chain ID. In the case for ape-starknet, both testnet and local share the same chain ID for whatever reason. Theoretically though any local network can have any same chain ID.

How I did it

Use full ID pattern of <ecosystem_name>:<network_name>:<provider_name>-<chain_id>

How to verify it

Changing network but not changing chain ID should use different provider instances in the provider context manager.

(alien) ➜  ape git:(ever) ape console --network starknet:local
INFO: Starting 'starknet-devnet' process.

In [1]: id0 = id(provider)
In [2]: with networks.parse_network_choice("starknet:testnet") as provider:
   ...:     id1 = id(provider)
   ...: 
In [3]: id0 != id1
Out[3]: True

This is False on main

Checklist

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

fubuloubu
fubuloubu previously approved these changes Aug 16, 2022
tests/functional/test_networks.py Outdated Show resolved Hide resolved
fubuloubu
fubuloubu previously approved these changes Aug 16, 2022
@antazoey antazoey enabled auto-merge (squash) August 17, 2022 13:20
@antazoey antazoey disabled auto-merge August 17, 2022 13:21
Copy link
Contributor

@sabotagebeats sabotagebeats left a comment

Choose a reason for hiding this comment

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

Reviewed demo by @unparalleled-js
reapproving as previously approved by @fubuloubu

@antazoey antazoey merged commit 39c99ea into ApeWorX:main Aug 17, 2022
@antazoey antazoey deleted the fix/jules/providerid branch August 17, 2022 18:43
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.

3 participants