From 06aec03995451073dfcd8cdb9099f25114d5cc6f Mon Sep 17 00:00:00 2001 From: BobTheBuidler Date: Sat, 3 Feb 2024 22:38:51 +0000 Subject: [PATCH 1/4] fix: version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7d1b9070..8b3986da 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "multicall" -version = "0.8.0" +version = "0.8.1" description = "aggregate results from multiple ethereum contract calls" authors = ["banteg"] From 1e5e74823e3df75fc03b5dbeb77d604b246f20cf Mon Sep 17 00:00:00 2001 From: BobTheBuidler Date: Sat, 3 Feb 2024 22:43:47 +0000 Subject: [PATCH 2/4] fix: semaphore value --- multicall/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/multicall/utils.py b/multicall/utils.py index 122bb5bb..990cf11d 100644 --- a/multicall/utils.py +++ b/multicall/utils.py @@ -10,8 +10,8 @@ from web3.eth import AsyncEth from web3.providers.async_base import AsyncBaseProvider -from multicall.constants import (AIOHTTP_TIMEOUT, NO_STATE_OVERRIDE, - NUM_PROCESSES) +from multicall.constants import (AIOHTTP_TIMEOUT, ASYNC_SEMAPHORE, + NO_STATE_OVERRIDE, NUM_PROCESSES) chainids: Dict[Web3,int] = {} @@ -99,4 +99,4 @@ def state_override_supported(w3: Web3) -> bool: @lru_cache(maxsize=1) def _get_semaphore() -> asyncio.Semaphore: - return asyncio.Semaphore() \ No newline at end of file + return asyncio.Semaphore(ASYNC_SEMAPHORE) \ No newline at end of file From 846edb82689aeff3fa1dba848b1720d1c5316fcf Mon Sep 17 00:00:00 2001 From: BobTheBuidler Date: Sat, 3 Feb 2024 22:44:56 +0000 Subject: [PATCH 3/4] chore: bump version to 0.8.2 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 8b3986da..dd1a4c4c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "multicall" -version = "0.8.1" +version = "0.8.2" description = "aggregate results from multiple ethereum contract calls" authors = ["banteg"] From c9e41cb8b617f52325680f9d8138718d5e122e4e Mon Sep 17 00:00:00 2001 From: BobTheBuidler Date: Sat, 3 Feb 2024 22:49:35 +0000 Subject: [PATCH 4/4] fix: "attached to a different loop" edge case --- multicall/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/multicall/utils.py b/multicall/utils.py index 990cf11d..56c2e9c4 100644 --- a/multicall/utils.py +++ b/multicall/utils.py @@ -97,6 +97,11 @@ def state_override_supported(w3: Web3) -> bool: return False return True -@lru_cache(maxsize=1) def _get_semaphore() -> asyncio.Semaphore: + 'Returns a `Semaphore` attached to the current event loop' + return __get_semaphore(asyncio.get_event_loop()) + +@lru_cache(maxsize=1) +def __get_semaphore(loop: asyncio.BaseEventLoop) -> asyncio.Semaphore: + 'This prevents an "attached to a different loop" edge case if the event loop is changed during your script run' return asyncio.Semaphore(ASYNC_SEMAPHORE) \ No newline at end of file