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

Stucked at _get_semaphore() while using python to execute the script directly #91

Closed
r-hou opened this issue Nov 1, 2023 · 1 comment

Comments

@r-hou
Copy link

r-hou commented Nov 1, 2023

I am trying to use this package to get the balance of ETH from multiple addresses, below is my code

node_url = 'xxxx'
w3 = Web3(Web3.HTTPProvider(node_url))
addresses = ["0xxxxx", "0xxxxx"]
def from_wei(status, value):
    print(status, value)
    return value / 1e18
multi = Multicall([
    Call(multi_call_address, ['getEthBalance(address)(uint256)', addresses[0]], [(addresses[0], from_wei)]),
    Call(multi_call_address, ['getEthBalance(address)(uint256)', addresses[1]], [(addresses[1], from_wei)]),
], require_success=False, _w3=w3)
results = multi()
print(results)

then I run the script from console,

python test.py

however, the code doesn't output anything and hang, I try to debug it and find the code gets stucked at

@lru_cache(maxsize=1)
def _get_semaphore() -> asyncio.Semaphore:
    return asyncio.Semaphore()

interestingly, the code can run correctly if I remove the decorator @lru_cache(maxsize=1), may I know how to run it corretly without removing the decorator? Thanks!

abhguptaDS added a commit to abhguptaDS/multicall.py that referenced this issue Dec 19, 2023
try to set cache as multiple of 2. There is issue with this decorator
banteg#91
@BobTheBuidler
Copy link
Collaborator

fixed in #95, closing this issue

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

No branches or pull requests

2 participants