banteg / multicall.py

aggregate results of multiple smart contract calls into one
MIT License
251 stars 108 forks source link

Handle both int and ClientTimeout-based values for Async timeout #54

Closed DefiDebauchery closed 1 year ago

DefiDebauchery commented 1 year ago

Timeout values are ints, but an attribute .total was being called, leading to errors when passing in web3 instances into Call

BobTheBuidler commented 1 year ago

Can you paste a pip list here so I can take a look? I know the .total was necessary for at least one version of aiohttp

DefiDebauchery commented 1 year ago

Apologies for the delay ... Interesting; I do see that ClientTimeout is an object provided by aiohttp, but when I define my timeout in my web3 instance as request_kwargs in web3py (per their docs), it remains an int.

Perhaps this block of code could be updated to determine whether it's a ClientTimeout class? I am definitely not having any issues since changing my local install to be an int.

Anyway, relevant pip list:

Package                                           Version
------------------------------------------------- -----------
aiohttp                                           3.8.3
aiohttp-socks                                     0.7.1
eth-abi                                           4.0.0b2
eth-account                                       0.8.0
eth-hash                                          0.5.1
eth-keyfile                                       0.6.0
eth-keys                                          0.4.0
eth-retry                                         0.1.15
eth-rlp                                           0.3.0
eth-typing                                        3.2.0
eth-utils                                         2.1.0
multicall                                         0.7.0
requests                                          2.28.1
web3                                              6.0.0b9
websockets                                        10.4
BobTheBuidler commented 1 year ago

If you update your PR with an if, else to account for both cases, I can go ahead and get it merged. What do you think?

On Fri, Jan 27, 2023 at 4:04 PM DefiDebauchery @.***> wrote:

Apologies for the delay ... Interesting; I do see that ClientTimeout is an object provided by aiohttp, but when I define my timeout in my web3 instance as request_kwargs in web3py (per their docs https://web3py.readthedocs.io/en/latest/providers.html#web3.providers.rpc.HTTPProvider), it remains an int.

Perhaps this block of code could be updated to determine whether it's a ClientTimeout class? I am definitely not having any issues since changing my local install to be an int.

Anyway, relevant pip list:

Package Version


aiohttp 3.8.3 aiohttp-socks 0.7.1 eth-abi 4.0.0b2 eth-account 0.8.0 eth-hash 0.5.1 eth-keyfile 0.6.0 eth-keys 0.4.0 eth-retry 0.1.15 eth-rlp 0.3.0 eth-typing 3.2.0 eth-utils 2.1.0 multicall 0.7.0 requests 2.28.1 web3 6.0.0b9 websockets 10.4

— Reply to this email directly, view it on GitHub https://github.com/banteg/multicall.py/pull/54#issuecomment-1407018209, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ3HIHT5XDOGV3K7DXXU32LWUQS6HANCNFSM6AAAAAAT2YE7XA . You are receiving this because you commented.Message ID: <banteg/multicall .@.***>

DefiDebauchery commented 1 year ago

@BobTheBuidler - See updated PR. Format suggestions welcome, if needed.

BobTheBuidler commented 1 year ago

Left one comment to clean up the code a bit, other than that it looks good to me

BobTheBuidler commented 1 year ago

I fixed it myself, merging

DefiDebauchery commented 1 year ago

Sorry for that. Thanks for the correction!