From 64e7bed848d6b81cbbbbeabf5394e197d21e22b1 Mon Sep 17 00:00:00 2001 From: BobTheBuidler Date: Wed, 30 Apr 2025 22:40:39 +0000 Subject: [PATCH 1/3] feat: ETH_UTILS_NOVALIDATE env var for optimized prod use cases --- eth_utils/decorators.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eth_utils/decorators.py b/eth_utils/decorators.py index 042713d5..02444d8b 100644 --- a/eth_utils/decorators.py +++ b/eth_utils/decorators.py @@ -1,9 +1,11 @@ import functools import itertools +import os from typing import Any, Callable, Dict, Type, TypeVar from .types import is_text + T = TypeVar("T") @@ -64,6 +66,8 @@ def validate_conversion_arguments(to_wrap: Callable[..., T]) -> Callable[..., T] - Kwarg must be 'primitive' 'hexstr' or 'text' - If it is 'hexstr' or 'text' that it is a text type """ + if os.environ.get("ETH_UTILS_NOVALIDATE"): + return to_wrap @functools.wraps(to_wrap) def wrapper(*args: Any, **kwargs: Any) -> T: From 254442cbfbf9055c9f195672782e55f9118a9a5d Mon Sep 17 00:00:00 2001 From: BobTheBuidler <70677534+BobTheBuidler@users.noreply.github.com> Date: Wed, 30 Apr 2025 19:09:25 -0400 Subject: [PATCH 2/3] Update decorators.py --- eth_utils/decorators.py | 1 - 1 file changed, 1 deletion(-) diff --git a/eth_utils/decorators.py b/eth_utils/decorators.py index 9f1f6d98..7fe0990a 100644 --- a/eth_utils/decorators.py +++ b/eth_utils/decorators.py @@ -14,7 +14,6 @@ is_text, ) - T = TypeVar("T") From bc5dbaedf81ae4cc08f0a1c26c88c4bc9b070e65 Mon Sep 17 00:00:00 2001 From: BobTheBuidler <70677534+BobTheBuidler@users.noreply.github.com> Date: Mon, 19 May 2025 14:22:15 -0400 Subject: [PATCH 3/3] Create 304.feature.rst --- newsfragments/304.feature.rst | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 newsfragments/304.feature.rst diff --git a/newsfragments/304.feature.rst b/newsfragments/304.feature.rst new file mode 100644 index 00000000..8992f51f --- /dev/null +++ b/newsfragments/304.feature.rst @@ -0,0 +1,3 @@ +add ETH_UTILS_NOVALIDATE env var for optimized production deployments + +this env will instruct eth-utils to skip some extra steps that validate its functions are being used correctly, to be used when you're already sure this is true