web3 7.2.0__py3-none-any.whl → 7.3.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ens/_normalization.py +3 -1
- ens/specs/nf.json +1 -1
- ens/specs/normalization_spec.json +1 -1
- web3/_utils/abi.py +3 -11
- web3/_utils/async_transactions.py +27 -16
- web3/_utils/caching/__init__.py +12 -0
- web3/_utils/{caching.py → caching/caching_utils.py} +121 -36
- web3/_utils/caching/request_caching_validation.py +129 -0
- web3/_utils/contract_sources/contract_data/arrays_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/bytes_contracts.py +5 -5
- web3/_utils/contract_sources/contract_data/constructor_contracts.py +7 -7
- web3/_utils/contract_sources/contract_data/contract_caller_tester.py +3 -3
- web3/_utils/contract_sources/contract_data/emitter_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/event_contracts.py +5 -5
- web3/_utils/contract_sources/contract_data/extended_resolver.py +3 -3
- web3/_utils/contract_sources/contract_data/fallback_function_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/function_name_tester_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/math_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/offchain_lookup.py +3 -3
- web3/_utils/contract_sources/contract_data/offchain_resolver.py +3 -3
- web3/_utils/contract_sources/contract_data/panic_errors_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/payable_tester.py +3 -3
- web3/_utils/contract_sources/contract_data/receive_function_contracts.py +5 -5
- web3/_utils/contract_sources/contract_data/reflector_contracts.py +3 -3
- web3/_utils/contract_sources/contract_data/revert_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/simple_resolver.py +3 -3
- web3/_utils/contract_sources/contract_data/storage_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/string_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/tuple_contracts.py +5 -5
- web3/_utils/module_testing/eth_module.py +4 -4
- web3/_utils/transactions.py +14 -13
- web3/beacon/async_beacon.py +4 -1
- web3/contract/base_contract.py +1 -2
- web3/exceptions.py +14 -1
- web3/main.py +23 -0
- web3/providers/async_base.py +12 -0
- web3/providers/base.py +11 -0
- web3/providers/persistent/async_ipc.py +26 -26
- web3/utils/__init__.py +2 -0
- web3/utils/caching.py +8 -0
- {web3-7.2.0.dist-info → web3-7.3.1.dist-info}/METADATA +19 -12
- {web3-7.2.0.dist-info → web3-7.3.1.dist-info}/RECORD +45 -43
- {web3-7.2.0.dist-info → web3-7.3.1.dist-info}/WHEEL +1 -1
- {web3-7.2.0.dist-info → web3-7.3.1.dist-info}/LICENSE +0 -0
- {web3-7.2.0.dist-info → web3-7.3.1.dist-info}/top_level.txt +0 -0
web3/_utils/abi.py
CHANGED
|
@@ -110,19 +110,11 @@ def receive_func_abi_exists(contract_abi: ABI) -> Sequence[ABIReceive]:
|
|
|
110
110
|
|
|
111
111
|
|
|
112
112
|
def get_indexed_event_inputs(event_abi: ABIEvent) -> Sequence[ABIComponentIndexed]:
|
|
113
|
-
return [
|
|
114
|
-
cast(ABIComponentIndexed, arg)
|
|
115
|
-
for arg in event_abi["inputs"]
|
|
116
|
-
if cast(ABIComponentIndexed, arg)["indexed"] is True
|
|
117
|
-
]
|
|
113
|
+
return [arg for arg in event_abi["inputs"] if arg["indexed"] is True]
|
|
118
114
|
|
|
119
115
|
|
|
120
|
-
def exclude_indexed_event_inputs(event_abi: ABIEvent) -> Sequence[
|
|
121
|
-
return [
|
|
122
|
-
arg
|
|
123
|
-
for arg in event_abi["inputs"]
|
|
124
|
-
if cast(ABIComponentIndexed, arg)["indexed"] is False
|
|
125
|
-
]
|
|
116
|
+
def exclude_indexed_event_inputs(event_abi: ABIEvent) -> Sequence[ABIComponentIndexed]:
|
|
117
|
+
return [arg for arg in event_abi["inputs"] if arg["indexed"] is False]
|
|
126
118
|
|
|
127
119
|
|
|
128
120
|
def filter_by_argument_name(
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
from typing import (
|
|
2
2
|
TYPE_CHECKING,
|
|
3
|
+
Dict,
|
|
3
4
|
Optional,
|
|
5
|
+
Union,
|
|
4
6
|
cast,
|
|
5
7
|
)
|
|
6
8
|
|
|
@@ -42,21 +44,32 @@ if TYPE_CHECKING:
|
|
|
42
44
|
)
|
|
43
45
|
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
# unused vars present in these funcs because they all need to have the same signature
|
|
48
|
+
async def _estimate_gas(
|
|
49
|
+
async_w3: "AsyncWeb3", tx: TxParams, _defaults: Dict[str, Union[bytes, int]]
|
|
50
|
+
) -> int:
|
|
46
51
|
return await async_w3.eth.estimate_gas(tx)
|
|
47
52
|
|
|
48
53
|
|
|
49
|
-
async def _max_fee_per_gas(
|
|
54
|
+
async def _max_fee_per_gas(
|
|
55
|
+
async_w3: "AsyncWeb3", tx: TxParams, defaults: Dict[str, Union[bytes, int]]
|
|
56
|
+
) -> Wei:
|
|
50
57
|
block = await async_w3.eth.get_block("latest")
|
|
51
|
-
max_priority_fee =
|
|
52
|
-
|
|
58
|
+
max_priority_fee = tx.get(
|
|
59
|
+
"maxPriorityFeePerGas", defaults.get("maxPriorityFeePerGas")
|
|
60
|
+
)
|
|
61
|
+
return Wei(int(max_priority_fee) + (2 * int(block["baseFeePerGas"])))
|
|
53
62
|
|
|
54
63
|
|
|
55
|
-
async def _max_priority_fee_gas(
|
|
64
|
+
async def _max_priority_fee_gas(
|
|
65
|
+
async_w3: "AsyncWeb3", _tx: TxParams, _defaults: Dict[str, Union[bytes, int]]
|
|
66
|
+
) -> Wei:
|
|
56
67
|
return await async_w3.eth.max_priority_fee
|
|
57
68
|
|
|
58
69
|
|
|
59
|
-
async def _chain_id(
|
|
70
|
+
async def _chain_id(
|
|
71
|
+
async_w3: "AsyncWeb3", _tx: TxParams, _defaults: Dict[str, Union[bytes, int]]
|
|
72
|
+
) -> int:
|
|
60
73
|
return await async_w3.eth.chain_id
|
|
61
74
|
|
|
62
75
|
|
|
@@ -64,9 +77,9 @@ TRANSACTION_DEFAULTS = {
|
|
|
64
77
|
"value": 0,
|
|
65
78
|
"data": b"",
|
|
66
79
|
"gas": _estimate_gas,
|
|
67
|
-
"gasPrice": lambda async_w3, tx: async_w3.eth.generate_gas_price(tx),
|
|
68
|
-
"maxFeePerGas": _max_fee_per_gas,
|
|
80
|
+
"gasPrice": lambda async_w3, tx, _defaults: async_w3.eth.generate_gas_price(tx),
|
|
69
81
|
"maxPriorityFeePerGas": _max_priority_fee_gas,
|
|
82
|
+
"maxFeePerGas": _max_fee_per_gas,
|
|
70
83
|
"chainId": _chain_id,
|
|
71
84
|
}
|
|
72
85
|
|
|
@@ -74,9 +87,7 @@ TRANSACTION_DEFAULTS = {
|
|
|
74
87
|
async def get_block_gas_limit(
|
|
75
88
|
web3_eth: "AsyncEth", block_identifier: Optional[BlockIdentifier] = None
|
|
76
89
|
) -> int:
|
|
77
|
-
|
|
78
|
-
block_identifier = await web3_eth.block_number
|
|
79
|
-
block = await web3_eth.get_block(block_identifier)
|
|
90
|
+
block = await web3_eth.get_block(block_identifier or "latest")
|
|
80
91
|
return block["gasLimit"]
|
|
81
92
|
|
|
82
93
|
|
|
@@ -91,8 +102,8 @@ async def get_buffered_gas_estimate(
|
|
|
91
102
|
|
|
92
103
|
if gas_estimate > gas_limit:
|
|
93
104
|
raise Web3ValueError(
|
|
94
|
-
"
|
|
95
|
-
f"
|
|
105
|
+
"Gas estimate for transaction is higher than current network gas limits. "
|
|
106
|
+
f"Transaction could not be sent. Estimated: {gas_estimate}. "
|
|
96
107
|
f"Current gas limit: {gas_limit}"
|
|
97
108
|
)
|
|
98
109
|
|
|
@@ -122,7 +133,7 @@ async def async_fill_transaction_defaults(
|
|
|
122
133
|
or any_in_dict(DYNAMIC_FEE_TXN_PARAMS, transaction)
|
|
123
134
|
)
|
|
124
135
|
|
|
125
|
-
defaults = {}
|
|
136
|
+
defaults: Dict[str, Union[bytes, int]] = {}
|
|
126
137
|
for key, default_getter in TRANSACTION_DEFAULTS.items():
|
|
127
138
|
if key not in transaction:
|
|
128
139
|
if (
|
|
@@ -143,9 +154,9 @@ async def async_fill_transaction_defaults(
|
|
|
143
154
|
if key == "gasPrice":
|
|
144
155
|
# `generate_gas_price()` is on the `BaseEth` class and does not
|
|
145
156
|
# need to be awaited
|
|
146
|
-
default_val = default_getter(async_w3, transaction)
|
|
157
|
+
default_val = default_getter(async_w3, transaction, defaults)
|
|
147
158
|
else:
|
|
148
|
-
default_val = await default_getter(async_w3, transaction)
|
|
159
|
+
default_val = await default_getter(async_w3, transaction, defaults)
|
|
149
160
|
else:
|
|
150
161
|
default_val = default_getter
|
|
151
162
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from .request_caching_validation import (
|
|
2
|
+
ASYNC_PROVIDER_TYPE,
|
|
3
|
+
SYNC_PROVIDER_TYPE,
|
|
4
|
+
)
|
|
5
|
+
from .caching_utils import (
|
|
6
|
+
CACHEABLE_REQUESTS,
|
|
7
|
+
async_handle_request_caching,
|
|
8
|
+
generate_cache_key,
|
|
9
|
+
handle_request_caching,
|
|
10
|
+
is_cacheable_request,
|
|
11
|
+
RequestInformation,
|
|
12
|
+
)
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
from asyncio import (
|
|
2
|
+
iscoroutinefunction,
|
|
3
|
+
)
|
|
1
4
|
import collections
|
|
2
5
|
import hashlib
|
|
3
6
|
import threading
|
|
@@ -8,11 +11,9 @@ from typing import (
|
|
|
8
11
|
Coroutine,
|
|
9
12
|
Dict,
|
|
10
13
|
List,
|
|
11
|
-
|
|
14
|
+
Sequence,
|
|
12
15
|
Tuple,
|
|
13
|
-
TypeVar,
|
|
14
16
|
Union,
|
|
15
|
-
cast,
|
|
16
17
|
)
|
|
17
18
|
|
|
18
19
|
from eth_utils import (
|
|
@@ -26,6 +27,23 @@ from eth_utils import (
|
|
|
26
27
|
to_bytes,
|
|
27
28
|
)
|
|
28
29
|
|
|
30
|
+
from web3._utils.caching import (
|
|
31
|
+
ASYNC_PROVIDER_TYPE,
|
|
32
|
+
SYNC_PROVIDER_TYPE,
|
|
33
|
+
)
|
|
34
|
+
from web3._utils.caching.request_caching_validation import (
|
|
35
|
+
UNCACHEABLE_BLOCK_IDS,
|
|
36
|
+
always_cache_request,
|
|
37
|
+
async_validate_blockhash_in_params,
|
|
38
|
+
async_validate_blocknum_in_params,
|
|
39
|
+
async_validate_blocknum_in_result,
|
|
40
|
+
validate_blockhash_in_params,
|
|
41
|
+
validate_blocknum_in_params,
|
|
42
|
+
validate_blocknum_in_result,
|
|
43
|
+
)
|
|
44
|
+
from web3._utils.rpc_abi import (
|
|
45
|
+
RPC,
|
|
46
|
+
)
|
|
29
47
|
from web3.exceptions import (
|
|
30
48
|
Web3TypeError,
|
|
31
49
|
)
|
|
@@ -43,10 +61,6 @@ if TYPE_CHECKING:
|
|
|
43
61
|
)
|
|
44
62
|
|
|
45
63
|
|
|
46
|
-
SYNC_PROVIDER_TYPE = TypeVar("SYNC_PROVIDER_TYPE", bound="BaseProvider")
|
|
47
|
-
ASYNC_PROVIDER_TYPE = TypeVar("ASYNC_PROVIDER_TYPE", bound="AsyncBaseProvider")
|
|
48
|
-
|
|
49
|
-
|
|
50
64
|
def generate_cache_key(value: Any) -> str:
|
|
51
65
|
"""
|
|
52
66
|
Generates a cache key for the *args and **kwargs
|
|
@@ -87,39 +101,72 @@ class RequestInformation:
|
|
|
87
101
|
|
|
88
102
|
|
|
89
103
|
def is_cacheable_request(
|
|
90
|
-
provider: Union[ASYNC_PROVIDER_TYPE, SYNC_PROVIDER_TYPE],
|
|
104
|
+
provider: Union[ASYNC_PROVIDER_TYPE, SYNC_PROVIDER_TYPE],
|
|
105
|
+
method: "RPCEndpoint",
|
|
106
|
+
params: Any,
|
|
91
107
|
) -> bool:
|
|
92
|
-
if provider.cache_allowed_requests and method in provider.cacheable_requests:
|
|
93
|
-
return
|
|
94
|
-
|
|
108
|
+
if not (provider.cache_allowed_requests and method in provider.cacheable_requests):
|
|
109
|
+
return False
|
|
110
|
+
elif method in BLOCKNUM_IN_PARAMS:
|
|
111
|
+
block_id = params[0]
|
|
112
|
+
if block_id in UNCACHEABLE_BLOCK_IDS:
|
|
113
|
+
return False
|
|
114
|
+
return True
|
|
95
115
|
|
|
96
116
|
|
|
97
117
|
# -- request caching -- #
|
|
98
118
|
|
|
119
|
+
ALWAYS_CACHE = {
|
|
120
|
+
RPC.eth_chainId,
|
|
121
|
+
RPC.web3_clientVersion,
|
|
122
|
+
RPC.net_version,
|
|
123
|
+
}
|
|
124
|
+
BLOCKNUM_IN_PARAMS = {
|
|
125
|
+
RPC.eth_getBlockByNumber,
|
|
126
|
+
RPC.eth_getRawTransactionByBlockNumberAndIndex,
|
|
127
|
+
RPC.eth_getBlockTransactionCountByNumber,
|
|
128
|
+
RPC.eth_getUncleByBlockNumberAndIndex,
|
|
129
|
+
RPC.eth_getUncleCountByBlockNumber,
|
|
130
|
+
}
|
|
131
|
+
BLOCKNUM_IN_RESULT = {
|
|
132
|
+
RPC.eth_getBlockByHash,
|
|
133
|
+
RPC.eth_getTransactionByHash,
|
|
134
|
+
RPC.eth_getTransactionByBlockNumberAndIndex,
|
|
135
|
+
RPC.eth_getTransactionByBlockHashAndIndex,
|
|
136
|
+
RPC.eth_getBlockTransactionCountByHash,
|
|
137
|
+
}
|
|
138
|
+
BLOCKHASH_IN_PARAMS = {
|
|
139
|
+
RPC.eth_getRawTransactionByBlockHashAndIndex,
|
|
140
|
+
RPC.eth_getUncleByBlockHashAndIndex,
|
|
141
|
+
RPC.eth_getUncleCountByBlockHash,
|
|
142
|
+
}
|
|
99
143
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
"eth_getUncleByBlockHashAndIndex",
|
|
110
|
-
"eth_getUncleCountByBlockHash",
|
|
111
|
-
"net_version",
|
|
112
|
-
"web3_clientVersion",
|
|
113
|
-
),
|
|
114
|
-
)
|
|
144
|
+
INTERNAL_VALIDATION_MAP: Dict[
|
|
145
|
+
"RPCEndpoint", Callable[[SYNC_PROVIDER_TYPE, Sequence[Any], Dict[str, Any]], bool]
|
|
146
|
+
] = {
|
|
147
|
+
**{endpoint: always_cache_request for endpoint in ALWAYS_CACHE},
|
|
148
|
+
**{endpoint: validate_blocknum_in_params for endpoint in BLOCKNUM_IN_PARAMS},
|
|
149
|
+
**{endpoint: validate_blocknum_in_result for endpoint in BLOCKNUM_IN_RESULT},
|
|
150
|
+
**{endpoint: validate_blockhash_in_params for endpoint in BLOCKHASH_IN_PARAMS},
|
|
151
|
+
}
|
|
152
|
+
CACHEABLE_REQUESTS = tuple(INTERNAL_VALIDATION_MAP.keys())
|
|
115
153
|
|
|
116
154
|
|
|
117
|
-
def _should_cache_response(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
155
|
+
def _should_cache_response(
|
|
156
|
+
provider: SYNC_PROVIDER_TYPE,
|
|
157
|
+
method: "RPCEndpoint",
|
|
158
|
+
params: Sequence[Any],
|
|
159
|
+
response: "RPCResponse",
|
|
160
|
+
) -> bool:
|
|
161
|
+
result = response.get("result", None)
|
|
162
|
+
if "error" in response or is_null(result):
|
|
163
|
+
return False
|
|
164
|
+
if (
|
|
165
|
+
method in INTERNAL_VALIDATION_MAP
|
|
166
|
+
and provider.request_cache_validation_threshold is not None
|
|
167
|
+
):
|
|
168
|
+
return INTERNAL_VALIDATION_MAP[method](provider, params, result)
|
|
169
|
+
return True
|
|
123
170
|
|
|
124
171
|
|
|
125
172
|
def handle_request_caching(
|
|
@@ -128,7 +175,7 @@ def handle_request_caching(
|
|
|
128
175
|
def wrapper(
|
|
129
176
|
provider: SYNC_PROVIDER_TYPE, method: "RPCEndpoint", params: Any
|
|
130
177
|
) -> "RPCResponse":
|
|
131
|
-
if is_cacheable_request(provider, method):
|
|
178
|
+
if is_cacheable_request(provider, method, params):
|
|
132
179
|
request_cache = provider._request_cache
|
|
133
180
|
cache_key = generate_cache_key(
|
|
134
181
|
f"{threading.get_ident()}:{(method, params)}"
|
|
@@ -138,7 +185,7 @@ def handle_request_caching(
|
|
|
138
185
|
return cache_result
|
|
139
186
|
else:
|
|
140
187
|
response = func(provider, method, params)
|
|
141
|
-
if _should_cache_response(response):
|
|
188
|
+
if _should_cache_response(provider, method, params, response):
|
|
142
189
|
with provider._request_cache_lock:
|
|
143
190
|
request_cache.cache(cache_key, response)
|
|
144
191
|
return response
|
|
@@ -152,6 +199,42 @@ def handle_request_caching(
|
|
|
152
199
|
|
|
153
200
|
# -- async -- #
|
|
154
201
|
|
|
202
|
+
ASYNC_VALIDATOR_TYPE = Callable[
|
|
203
|
+
["AsyncBaseProvider", Sequence[Any], Dict[str, Any]],
|
|
204
|
+
Union[bool, Coroutine[Any, Any, bool]],
|
|
205
|
+
]
|
|
206
|
+
|
|
207
|
+
ASYNC_INTERNAL_VALIDATION_MAP: Dict["RPCEndpoint", ASYNC_VALIDATOR_TYPE] = {
|
|
208
|
+
**{endpoint: always_cache_request for endpoint in ALWAYS_CACHE},
|
|
209
|
+
**{endpoint: async_validate_blocknum_in_params for endpoint in BLOCKNUM_IN_PARAMS},
|
|
210
|
+
**{endpoint: async_validate_blocknum_in_result for endpoint in BLOCKNUM_IN_RESULT},
|
|
211
|
+
**{
|
|
212
|
+
endpoint: async_validate_blockhash_in_params for endpoint in BLOCKHASH_IN_PARAMS
|
|
213
|
+
},
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
async def _async_should_cache_response(
|
|
218
|
+
provider: ASYNC_PROVIDER_TYPE,
|
|
219
|
+
method: "RPCEndpoint",
|
|
220
|
+
params: Sequence[Any],
|
|
221
|
+
response: "RPCResponse",
|
|
222
|
+
) -> bool:
|
|
223
|
+
result = response.get("result", None)
|
|
224
|
+
if "error" in response or is_null(result):
|
|
225
|
+
return False
|
|
226
|
+
if (
|
|
227
|
+
method in ASYNC_INTERNAL_VALIDATION_MAP
|
|
228
|
+
and provider.request_cache_validation_threshold is not None
|
|
229
|
+
):
|
|
230
|
+
cache_validator = ASYNC_INTERNAL_VALIDATION_MAP[method]
|
|
231
|
+
return (
|
|
232
|
+
await cache_validator(provider, params, result)
|
|
233
|
+
if iscoroutinefunction(cache_validator)
|
|
234
|
+
else cache_validator(provider, params, result)
|
|
235
|
+
)
|
|
236
|
+
return True
|
|
237
|
+
|
|
155
238
|
|
|
156
239
|
def async_handle_request_caching(
|
|
157
240
|
func: Callable[
|
|
@@ -161,7 +244,7 @@ def async_handle_request_caching(
|
|
|
161
244
|
async def wrapper(
|
|
162
245
|
provider: ASYNC_PROVIDER_TYPE, method: "RPCEndpoint", params: Any
|
|
163
246
|
) -> "RPCResponse":
|
|
164
|
-
if is_cacheable_request(provider, method):
|
|
247
|
+
if is_cacheable_request(provider, method, params):
|
|
165
248
|
request_cache = provider._request_cache
|
|
166
249
|
cache_key = generate_cache_key(
|
|
167
250
|
f"{threading.get_ident()}:{(method, params)}"
|
|
@@ -171,7 +254,9 @@ def async_handle_request_caching(
|
|
|
171
254
|
return cache_result
|
|
172
255
|
else:
|
|
173
256
|
response = await func(provider, method, params)
|
|
174
|
-
if
|
|
257
|
+
if await _async_should_cache_response(
|
|
258
|
+
provider, method, params, response
|
|
259
|
+
):
|
|
175
260
|
async with provider._request_cache_lock:
|
|
176
261
|
request_cache.cache(cache_key, response)
|
|
177
262
|
return response
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
from typing import (
|
|
2
|
+
TYPE_CHECKING,
|
|
3
|
+
Any,
|
|
4
|
+
Dict,
|
|
5
|
+
Sequence,
|
|
6
|
+
TypeVar,
|
|
7
|
+
Union,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
from eth_utils import (
|
|
11
|
+
to_int,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from web3.providers import ( # noqa: F401
|
|
16
|
+
AsyncBaseProvider,
|
|
17
|
+
BaseProvider,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
UNCACHEABLE_BLOCK_IDS = {"finalized", "safe", "latest", "pending"}
|
|
21
|
+
|
|
22
|
+
ASYNC_PROVIDER_TYPE = TypeVar("ASYNC_PROVIDER_TYPE", bound="AsyncBaseProvider")
|
|
23
|
+
SYNC_PROVIDER_TYPE = TypeVar("SYNC_PROVIDER_TYPE", bound="BaseProvider")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _error_log(
|
|
27
|
+
provider: Union[ASYNC_PROVIDER_TYPE, SYNC_PROVIDER_TYPE], e: Exception
|
|
28
|
+
) -> None:
|
|
29
|
+
provider.logger.error(
|
|
30
|
+
"There was an exception while caching the request.", exc_info=e
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def is_beyond_validation_threshold(provider: SYNC_PROVIDER_TYPE, blocknum: int) -> bool:
|
|
35
|
+
try:
|
|
36
|
+
# `threshold` is either "finalized" or "safe"
|
|
37
|
+
threshold = provider.request_cache_validation_threshold.value
|
|
38
|
+
response = provider.make_request("eth_getBlockByNumber", [threshold, False])
|
|
39
|
+
return blocknum <= to_int(hexstr=response["result"]["number"])
|
|
40
|
+
except Exception as e:
|
|
41
|
+
_error_log(provider, e)
|
|
42
|
+
return False
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def always_cache_request(*_args: Any, **_kwargs: Any) -> bool:
|
|
46
|
+
return True
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def validate_blocknum_in_params(
|
|
50
|
+
provider: SYNC_PROVIDER_TYPE, params: Sequence[Any], _result: Dict[str, Any]
|
|
51
|
+
) -> bool:
|
|
52
|
+
block_id = params[0]
|
|
53
|
+
if block_id == "earliest":
|
|
54
|
+
# `earliest` should always be cacheable
|
|
55
|
+
return True
|
|
56
|
+
blocknum = to_int(hexstr=block_id)
|
|
57
|
+
return is_beyond_validation_threshold(provider, blocknum)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def validate_blocknum_in_result(
|
|
61
|
+
provider: SYNC_PROVIDER_TYPE, _params: Sequence[Any], result: Dict[str, Any]
|
|
62
|
+
) -> bool:
|
|
63
|
+
# `number` if block result, `blockNumber` if transaction result
|
|
64
|
+
blocknum = to_int(hexstr=result.get("number", result.get("blockNumber")))
|
|
65
|
+
return is_beyond_validation_threshold(provider, blocknum)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def validate_blockhash_in_params(
|
|
69
|
+
provider: SYNC_PROVIDER_TYPE, params: Sequence[Any], _result: Dict[str, Any]
|
|
70
|
+
) -> bool:
|
|
71
|
+
try:
|
|
72
|
+
# make an extra call to get the block number from the hash
|
|
73
|
+
response = provider.make_request("eth_getBlockByHash", [params[0], False])
|
|
74
|
+
except Exception as e:
|
|
75
|
+
_error_log(provider, e)
|
|
76
|
+
return False
|
|
77
|
+
|
|
78
|
+
blocknum = to_int(hexstr=response["result"]["number"])
|
|
79
|
+
return is_beyond_validation_threshold(provider, blocknum)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
# -- async -- #
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
async def async_is_beyond_validation_threshold(
|
|
86
|
+
provider: ASYNC_PROVIDER_TYPE, blocknum: int
|
|
87
|
+
) -> bool:
|
|
88
|
+
try:
|
|
89
|
+
# `threshold` is either "finalized" or "safe"
|
|
90
|
+
threshold = provider.request_cache_validation_threshold.value
|
|
91
|
+
response = await provider.make_request(
|
|
92
|
+
"eth_getBlockByNumber", [threshold, False]
|
|
93
|
+
)
|
|
94
|
+
return blocknum <= to_int(hexstr=response["result"]["number"])
|
|
95
|
+
except Exception as e:
|
|
96
|
+
_error_log(provider, e)
|
|
97
|
+
return False
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
async def async_validate_blocknum_in_params(
|
|
101
|
+
provider: ASYNC_PROVIDER_TYPE, params: Sequence[Any], _result: Dict[str, Any]
|
|
102
|
+
) -> bool:
|
|
103
|
+
block_id = params[0]
|
|
104
|
+
if block_id == "earliest":
|
|
105
|
+
# `earliest` should always be cacheable
|
|
106
|
+
return True
|
|
107
|
+
blocknum = to_int(hexstr=params[0])
|
|
108
|
+
return await async_is_beyond_validation_threshold(provider, blocknum)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
async def async_validate_blocknum_in_result(
|
|
112
|
+
provider: ASYNC_PROVIDER_TYPE, _params: Sequence[Any], result: Dict[str, Any]
|
|
113
|
+
) -> bool:
|
|
114
|
+
# `number` if block result, `blockNumber` if transaction result
|
|
115
|
+
blocknum = to_int(hexstr=result.get("number", result.get("blockNumber")))
|
|
116
|
+
return await async_is_beyond_validation_threshold(provider, blocknum)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
async def async_validate_blockhash_in_params(
|
|
120
|
+
provider: ASYNC_PROVIDER_TYPE, params: Sequence[Any], _result: Dict[str, Any]
|
|
121
|
+
) -> bool:
|
|
122
|
+
try:
|
|
123
|
+
response = await provider.make_request("eth_getBlockByHash", [params[0], False])
|
|
124
|
+
except Exception as e:
|
|
125
|
+
_error_log(provider, e)
|
|
126
|
+
return False
|
|
127
|
+
|
|
128
|
+
blocknum = to_int(hexstr=response["result"]["number"])
|
|
129
|
+
return await async_is_beyond_validation_threshold(provider, blocknum)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Generated by `compile_contracts.py` script.
|
|
3
|
-
Compiled with Solidity v0.8.
|
|
3
|
+
Compiled with Solidity v0.8.27.
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
6
|
# source: web3/_utils/contract_sources/ArraysContract.sol:ArraysContract
|
|
7
|
-
ARRAYS_CONTRACT_BYTECODE = "
|
|
8
|
-
ARRAYS_CONTRACT_RUNTIME = "
|
|
7
|
+
ARRAYS_CONTRACT_BYTECODE = "0x608060405260405180604001604052807f03783fac2efed8fbc9ad443e592ee30e61d65f471140c10ca155e937b435b76081526020017f1f675bff07515f5df96737194ea945c36c41e7b4fcef307b7cd4d0e602a691118152506001906002610069929190610199565b5060405180604001604052805f7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681526020017f01000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681525060039060026101379291906101e4565b50348015610143575f5ffd5b5060405161128238038061128283398181016040528101906101659190610652565b815f908051906020019061017a929190610286565b5080600290805190602001906101919291906102d1565b5050506106c8565b828054828255905f5260205f209081019282156101d3579160200282015b828111156101d25782518255916020019190600101906101b7565b5b5090506101e09190610373565b5090565b828054828255905f5260205f2090601f01602090048101928215610275579160200282015f5b8382111561024757835183826101000a81548160ff021916908360f81c021790555092602001926001016020815f0104928301926001030261020a565b80156102735782816101000a81549060ff02191690556001016020815f01049283019260010302610247565b505b509050610282919061038e565b5090565b828054828255905f5260205f209081019282156102c0579160200282015b828111156102bf5782518255916020019190600101906102a4565b5b5090506102cd9190610373565b5090565b828054828255905f5260205f2090601f01602090048101928215610362579160200282015f5b8382111561033457835183826101000a81548160ff021916908360f81c021790555092602001926001016020815f010492830192600103026102f7565b80156103605782816101000a81549060ff02191690556001016020815f01049283019260010302610334565b505b50905061036f919061038e565b5090565b5b8082111561038a575f815f905550600101610374565b5090565b5b808211156103a5575f815f90555060010161038f565b5090565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b610404826103be565b810181811067ffffffffffffffff82111715610423576104226103ce565b5b80604052505050565b5f6104356103a9565b905061044182826103fb565b919050565b5f67ffffffffffffffff8211156104605761045f6103ce565b5b602082029050602081019050919050565b5f5ffd5b5f819050919050565b61048781610475565b8114610491575f5ffd5b50565b5f815190506104a28161047e565b92915050565b5f6104ba6104b584610446565b61042c565b905080838252602082019050602084028301858111156104dd576104dc610471565b5b835b8181101561050657806104f28882610494565b8452602084019350506020810190506104df565b5050509392505050565b5f82601f830112610524576105236103ba565b5b81516105348482602086016104a8565b91505092915050565b5f67ffffffffffffffff821115610557576105566103ce565b5b602082029050602081019050919050565b5f7fff0000000000000000000000000000000000000000000000000000000000000082169050919050565b61059c81610568565b81146105a6575f5ffd5b50565b5f815190506105b781610593565b92915050565b5f6105cf6105ca8461053d565b61042c565b905080838252602082019050602084028301858111156105f2576105f1610471565b5b835b8181101561061b578061060788826105a9565b8452602084019350506020810190506105f4565b5050509392505050565b5f82601f830112610639576106386103ba565b5b81516106498482602086016105bd565b91505092915050565b5f5f60408385031215610668576106676103b2565b5b5f83015167ffffffffffffffff811115610685576106846103b6565b5b61069185828601610510565b925050602083015167ffffffffffffffff8111156106b2576106b16103b6565b5b6106be85828601610625565b9150509250929050565b610bad806106d55f395ff3fe608060405234801561000f575f5ffd5b506004361061009c575f3560e01c8063542d83de11610064578063542d83de14610158578063605ba271146101885780638abe51fd146101a6578063962e450c146101c4578063bb69679b146101f45761009c565b80630afe5e33146100a057806312c9dcc8146100be5780631579bf66146100ee5780633ddcea2f1461010c57806351b4878814610128575b5f5ffd5b6100a8610210565b6040516100b591906106a4565b60405180910390f35b6100d860048036038101906100d39190610708565b610266565b6040516100e5919061076d565b60405180910390f35b6100f6610297565b604051610103919061083d565b60405180910390f35b610126600480360381019061012191906109d7565b610330565b005b610142600480360381019061013d9190610708565b61034a565b60405161014f9190610a2d565b60405180910390f35b610172600480360381019061016d9190610708565b61036a565b60405161017f9190610a2d565b60405180910390f35b610190610389565b60405161019d91906106a4565b60405180910390f35b6101ae6103de565b6040516101bb919061083d565b60405180910390f35b6101de60048036038101906101d99190610708565b610477565b6040516101eb919061076d565b60405180910390f35b61020e60048036038101906102099190610b30565b6104a8565b005b6060600180548060200260200160405190810160405280929190818152602001828054801561025c57602002820191905f5260205f20905b815481526020019060010190808311610248575b5050505050905090565b60028181548110610275575f80fd5b905f5260205f209060209182820401919006915054906101000a900460f81b81565b6060600380548060200260200160405190810160405280929190818152602001828054801561032657602002820191905f5260205f20905f905b82829054906101000a900460f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190600101906020825f010492830192600103820291508084116102d15790505b5050505050905090565b80600290805190602001906103469291906104c1565b5050565b60018181548110610359575f80fd5b905f5260205f20015f915090505481565b5f8181548110610378575f80fd5b905f5260205f20015f915090505481565b60605f8054806020026020016040519081016040528092919081815260200182805480156103d457602002820191905f5260205f20905b8154815260200190600101908083116103c0575b5050505050905090565b6060600280548060200260200160405190810160405280929190818152602001828054801561046d57602002820191905f5260205f20905f905b82829054906101000a900460f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190600101906020825f010492830192600103820291508084116104185790505b5050505050905090565b60038181548110610486575f80fd5b905f5260205f209060209182820401919006915054906101000a900460f81b81565b805f90805190602001906104bd929190610563565b5050565b828054828255905f5260205f2090601f01602090048101928215610552579160200282015f5b8382111561052457835183826101000a81548160ff021916908360f81c021790555092602001926001016020815f010492830192600103026104e7565b80156105505782816101000a81549060ff02191690556001016020815f01049283019260010302610524565b505b50905061055f91906105ae565b5090565b828054828255905f5260205f2090810192821561059d579160200282015b8281111561059c578251825591602001919060010190610581565b5b5090506105aa91906105c9565b5090565b5b808211156105c5575f815f9055506001016105af565b5090565b5b808211156105e0575f815f9055506001016105ca565b5090565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f819050919050565b61061f8161060d565b82525050565b5f6106308383610616565b60208301905092915050565b5f602082019050919050565b5f610652826105e4565b61065c81856105ee565b9350610667836105fe565b805f5b8381101561069757815161067e8882610625565b97506106898361063c565b92505060018101905061066a565b5085935050505092915050565b5f6020820190508181035f8301526106bc8184610648565b905092915050565b5f604051905090565b5f5ffd5b5f5ffd5b5f819050919050565b6106e7816106d5565b81146106f1575f5ffd5b50565b5f81359050610702816106de565b92915050565b5f6020828403121561071d5761071c6106cd565b5b5f61072a848285016106f4565b91505092915050565b5f7fff0000000000000000000000000000000000000000000000000000000000000082169050919050565b61076781610733565b82525050565b5f6020820190506107805f83018461075e565b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6107b881610733565b82525050565b5f6107c983836107af565b60208301905092915050565b5f602082019050919050565b5f6107eb82610786565b6107f58185610790565b9350610800836107a0565b805f5b8381101561083057815161081788826107be565b9750610822836107d5565b925050600181019050610803565b5085935050505092915050565b5f6020820190508181035f83015261085581846107e1565b905092915050565b5f5ffd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6108a782610861565b810181811067ffffffffffffffff821117156108c6576108c5610871565b5b80604052505050565b5f6108d86106c4565b90506108e4828261089e565b919050565b5f67ffffffffffffffff82111561090357610902610871565b5b602082029050602081019050919050565b5f5ffd5b61092181610733565b811461092b575f5ffd5b50565b5f8135905061093c81610918565b92915050565b5f61095461094f846108e9565b6108cf565b9050808382526020820190506020840283018581111561097757610976610914565b5b835b818110156109a0578061098c888261092e565b845260208401935050602081019050610979565b5050509392505050565b5f82601f8301126109be576109bd61085d565b5b81356109ce848260208601610942565b91505092915050565b5f602082840312156109ec576109eb6106cd565b5b5f82013567ffffffffffffffff811115610a0957610a086106d1565b5b610a15848285016109aa565b91505092915050565b610a278161060d565b82525050565b5f602082019050610a405f830184610a1e565b92915050565b5f67ffffffffffffffff821115610a6057610a5f610871565b5b602082029050602081019050919050565b610a7a8161060d565b8114610a84575f5ffd5b50565b5f81359050610a9581610a71565b92915050565b5f610aad610aa884610a46565b6108cf565b90508083825260208201905060208402830185811115610ad057610acf610914565b5b835b81811015610af95780610ae58882610a87565b845260208401935050602081019050610ad2565b5050509392505050565b5f82601f830112610b1757610b1661085d565b5b8135610b27848260208601610a9b565b91505092915050565b5f60208284031215610b4557610b446106cd565b5b5f82013567ffffffffffffffff811115610b6257610b616106d1565b5b610b6e84828501610b03565b9150509291505056fea264697066735822122002082625c48029065cb3bd8b70dd32f013425c803e2b69b0044bfb78fa3a1e9064736f6c634300081b0033" # noqa: E501
|
|
8
|
+
ARRAYS_CONTRACT_RUNTIME = "0x608060405234801561000f575f5ffd5b506004361061009c575f3560e01c8063542d83de11610064578063542d83de14610158578063605ba271146101885780638abe51fd146101a6578063962e450c146101c4578063bb69679b146101f45761009c565b80630afe5e33146100a057806312c9dcc8146100be5780631579bf66146100ee5780633ddcea2f1461010c57806351b4878814610128575b5f5ffd5b6100a8610210565b6040516100b591906106a4565b60405180910390f35b6100d860048036038101906100d39190610708565b610266565b6040516100e5919061076d565b60405180910390f35b6100f6610297565b604051610103919061083d565b60405180910390f35b610126600480360381019061012191906109d7565b610330565b005b610142600480360381019061013d9190610708565b61034a565b60405161014f9190610a2d565b60405180910390f35b610172600480360381019061016d9190610708565b61036a565b60405161017f9190610a2d565b60405180910390f35b610190610389565b60405161019d91906106a4565b60405180910390f35b6101ae6103de565b6040516101bb919061083d565b60405180910390f35b6101de60048036038101906101d99190610708565b610477565b6040516101eb919061076d565b60405180910390f35b61020e60048036038101906102099190610b30565b6104a8565b005b6060600180548060200260200160405190810160405280929190818152602001828054801561025c57602002820191905f5260205f20905b815481526020019060010190808311610248575b5050505050905090565b60028181548110610275575f80fd5b905f5260205f209060209182820401919006915054906101000a900460f81b81565b6060600380548060200260200160405190810160405280929190818152602001828054801561032657602002820191905f5260205f20905f905b82829054906101000a900460f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190600101906020825f010492830192600103820291508084116102d15790505b5050505050905090565b80600290805190602001906103469291906104c1565b5050565b60018181548110610359575f80fd5b905f5260205f20015f915090505481565b5f8181548110610378575f80fd5b905f5260205f20015f915090505481565b60605f8054806020026020016040519081016040528092919081815260200182805480156103d457602002820191905f5260205f20905b8154815260200190600101908083116103c0575b5050505050905090565b6060600280548060200260200160405190810160405280929190818152602001828054801561046d57602002820191905f5260205f20905f905b82829054906101000a900460f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190600101906020825f010492830192600103820291508084116104185790505b5050505050905090565b60038181548110610486575f80fd5b905f5260205f209060209182820401919006915054906101000a900460f81b81565b805f90805190602001906104bd929190610563565b5050565b828054828255905f5260205f2090601f01602090048101928215610552579160200282015f5b8382111561052457835183826101000a81548160ff021916908360f81c021790555092602001926001016020815f010492830192600103026104e7565b80156105505782816101000a81549060ff02191690556001016020815f01049283019260010302610524565b505b50905061055f91906105ae565b5090565b828054828255905f5260205f2090810192821561059d579160200282015b8281111561059c578251825591602001919060010190610581565b5b5090506105aa91906105c9565b5090565b5b808211156105c5575f815f9055506001016105af565b5090565b5b808211156105e0575f815f9055506001016105ca565b5090565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f819050919050565b61061f8161060d565b82525050565b5f6106308383610616565b60208301905092915050565b5f602082019050919050565b5f610652826105e4565b61065c81856105ee565b9350610667836105fe565b805f5b8381101561069757815161067e8882610625565b97506106898361063c565b92505060018101905061066a565b5085935050505092915050565b5f6020820190508181035f8301526106bc8184610648565b905092915050565b5f604051905090565b5f5ffd5b5f5ffd5b5f819050919050565b6106e7816106d5565b81146106f1575f5ffd5b50565b5f81359050610702816106de565b92915050565b5f6020828403121561071d5761071c6106cd565b5b5f61072a848285016106f4565b91505092915050565b5f7fff0000000000000000000000000000000000000000000000000000000000000082169050919050565b61076781610733565b82525050565b5f6020820190506107805f83018461075e565b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6107b881610733565b82525050565b5f6107c983836107af565b60208301905092915050565b5f602082019050919050565b5f6107eb82610786565b6107f58185610790565b9350610800836107a0565b805f5b8381101561083057815161081788826107be565b9750610822836107d5565b925050600181019050610803565b5085935050505092915050565b5f6020820190508181035f83015261085581846107e1565b905092915050565b5f5ffd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6108a782610861565b810181811067ffffffffffffffff821117156108c6576108c5610871565b5b80604052505050565b5f6108d86106c4565b90506108e4828261089e565b919050565b5f67ffffffffffffffff82111561090357610902610871565b5b602082029050602081019050919050565b5f5ffd5b61092181610733565b811461092b575f5ffd5b50565b5f8135905061093c81610918565b92915050565b5f61095461094f846108e9565b6108cf565b9050808382526020820190506020840283018581111561097757610976610914565b5b835b818110156109a0578061098c888261092e565b845260208401935050602081019050610979565b5050509392505050565b5f82601f8301126109be576109bd61085d565b5b81356109ce848260208601610942565b91505092915050565b5f602082840312156109ec576109eb6106cd565b5b5f82013567ffffffffffffffff811115610a0957610a086106d1565b5b610a15848285016109aa565b91505092915050565b610a278161060d565b82525050565b5f602082019050610a405f830184610a1e565b92915050565b5f67ffffffffffffffff821115610a6057610a5f610871565b5b602082029050602081019050919050565b610a7a8161060d565b8114610a84575f5ffd5b50565b5f81359050610a9581610a71565b92915050565b5f610aad610aa884610a46565b6108cf565b90508083825260208201905060208402830185811115610ad057610acf610914565b5b835b81811015610af95780610ae58882610a87565b845260208401935050602081019050610ad2565b5050509392505050565b5f82601f830112610b1757610b1661085d565b5b8135610b27848260208601610a9b565b91505092915050565b5f60208284031215610b4557610b446106cd565b5b5f82013567ffffffffffffffff811115610b6257610b616106d1565b5b610b6e84828501610b03565b9150509291505056fea264697066735822122002082625c48029065cb3bd8b70dd32f013425c803e2b69b0044bfb78fa3a1e9064736f6c634300081b0033" # noqa: E501
|
|
9
9
|
ARRAYS_CONTRACT_ABI = [
|
|
10
10
|
{
|
|
11
11
|
"inputs": [
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Generated by `compile_contracts.py` script.
|
|
3
|
-
Compiled with Solidity v0.8.
|
|
3
|
+
Compiled with Solidity v0.8.27.
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
6
|
# source: web3/_utils/contract_sources/BytesContracts.sol:BytesContract
|
|
7
|
-
BYTES_CONTRACT_BYTECODE = "
|
|
8
|
-
BYTES_CONTRACT_RUNTIME = "
|
|
7
|
+
BYTES_CONTRACT_BYTECODE = "0x60806040526040518060400160405280600281526020017f01230000000000000000000000000000000000000000000000000000000000008152505f908161004791906102c8565b50348015610053575f5ffd5b50604051610cd0380380610cd0833981810160405281019061007591906104b7565b80600190816100849190610508565b50506105d7565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061010657607f821691505b602082108103610119576101186100c2565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261017b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610140565b6101858683610140565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f6101c96101c46101bf8461019d565b6101a6565b61019d565b9050919050565b5f819050919050565b6101e2836101af565b6101f66101ee826101d0565b84845461014c565b825550505050565b5f5f905090565b61020d6101fe565b6102188184846101d9565b505050565b5b8181101561023b576102305f82610205565b60018101905061021e565b5050565b601f821115610280576102518161011f565b61025a84610131565b81016020851015610269578190505b61027d61027585610131565b83018261021d565b50505b505050565b5f82821c905092915050565b5f6102a05f1984600802610285565b1980831691505092915050565b5f6102b88383610291565b9150826002028217905092915050565b6102d18261008b565b67ffffffffffffffff8111156102ea576102e9610095565b5b6102f482546100ef565b6102ff82828561023f565b5f60209050601f831160018114610330575f841561031e578287015190505b61032885826102ad565b86555061038f565b601f19841661033e8661011f565b5f5b8281101561036557848901518255600182019150602085019450602081019050610340565b86831015610382578489015161037e601f891682610291565b8355505b6001600288020188555050505b505050505050565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b5f601f19601f8301169050919050565b6103c9826103b0565b810181811067ffffffffffffffff821117156103e8576103e7610095565b5b80604052505050565b5f6103fa610397565b905061040682826103c0565b919050565b5f67ffffffffffffffff82111561042557610424610095565b5b61042e826103b0565b9050602081019050919050565b8281835e5f83830152505050565b5f61045b6104568461040b565b6103f1565b905082815260208101848484011115610477576104766103ac565b5b61048284828561043b565b509392505050565b5f82601f83011261049e5761049d6103a8565b5b81516104ae848260208601610449565b91505092915050565b5f602082840312156104cc576104cb6103a0565b5b5f82015167ffffffffffffffff8111156104e9576104e86103a4565b5b6104f58482850161048a565b91505092915050565b5f81519050919050565b610511826104fe565b67ffffffffffffffff81111561052a57610529610095565b5b61053482546100ef565b61053f82828561023f565b5f60209050601f831160018114610570575f841561055e578287015190505b61056885826102ad565b8655506105cf565b601f19841661057e8661011f565b5f5b828110156105a557848901518255600182019150602085019450602081019050610580565b868310156105c257848901516105be601f891682610291565b8355505b6001600288020188555050505b505050505050565b6106ec806105e45f395ff3fe608060405234801561000f575f5ffd5b506004361061003f575f3560e01c8063209652551461004357806330de3cee14610061578063439970aa1461007f575b5f5ffd5b61004b61009b565b604051610058919061023d565b60405180910390f35b61006961012b565b604051610076919061023d565b60405180910390f35b6100996004803603810190610094919061039a565b6101ba565b005b6060600180546100aa9061040e565b80601f01602080910402602001604051908101604052809291908181526020018280546100d69061040e565b80156101215780601f106100f857610100808354040283529160200191610121565b820191905f5260205f20905b81548152906001019060200180831161010457829003601f168201915b5050505050905090565b60605f80546101399061040e565b80601f01602080910402602001604051908101604052809291908181526020018280546101659061040e565b80156101b05780601f10610187576101008083540402835291602001916101b0565b820191905f5260205f20905b81548152906001019060200180831161019357829003601f168201915b5050505050905090565b80600190816101c991906105e7565b5050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61020f826101cd565b61021981856101d7565b93506102298185602086016101e7565b610232816101f5565b840191505092915050565b5f6020820190508181035f8301526102558184610205565b905092915050565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6102ac826101f5565b810181811067ffffffffffffffff821117156102cb576102ca610276565b5b80604052505050565b5f6102dd61025d565b90506102e982826102a3565b919050565b5f67ffffffffffffffff82111561030857610307610276565b5b610311826101f5565b9050602081019050919050565b828183375f83830152505050565b5f61033e610339846102ee565b6102d4565b90508281526020810184848401111561035a57610359610272565b5b61036584828561031e565b509392505050565b5f82601f8301126103815761038061026e565b5b813561039184826020860161032c565b91505092915050565b5f602082840312156103af576103ae610266565b5b5f82013567ffffffffffffffff8111156103cc576103cb61026a565b5b6103d88482850161036d565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061042557607f821691505b602082108103610438576104376103e1565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261049a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261045f565b6104a4868361045f565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f6104e86104e36104de846104bc565b6104c5565b6104bc565b9050919050565b5f819050919050565b610501836104ce565b61051561050d826104ef565b84845461046b565b825550505050565b5f5f905090565b61052c61051d565b6105378184846104f8565b505050565b5b8181101561055a5761054f5f82610524565b60018101905061053d565b5050565b601f82111561059f576105708161043e565b61057984610450565b81016020851015610588578190505b61059c61059485610450565b83018261053c565b50505b505050565b5f82821c905092915050565b5f6105bf5f19846008026105a4565b1980831691505092915050565b5f6105d783836105b0565b9150826002028217905092915050565b6105f0826101cd565b67ffffffffffffffff81111561060957610608610276565b5b610613825461040e565b61061e82828561055e565b5f60209050601f83116001811461064f575f841561063d578287015190505b61064785826105cc565b8655506106ae565b601f19841661065d8661043e565b5f5b828110156106845784890151825560018201915060208501945060208101905061065f565b868310156106a1578489015161069d601f8916826105b0565b8355505b6001600288020188555050505b50505050505056fea2646970667358221220c78761f5dd632fbb96c0913612aa124af03e2e3649e0fe6988c1e80ec11f13e564736f6c634300081b0033" # noqa: E501
|
|
8
|
+
BYTES_CONTRACT_RUNTIME = "0x608060405234801561000f575f5ffd5b506004361061003f575f3560e01c8063209652551461004357806330de3cee14610061578063439970aa1461007f575b5f5ffd5b61004b61009b565b604051610058919061023d565b60405180910390f35b61006961012b565b604051610076919061023d565b60405180910390f35b6100996004803603810190610094919061039a565b6101ba565b005b6060600180546100aa9061040e565b80601f01602080910402602001604051908101604052809291908181526020018280546100d69061040e565b80156101215780601f106100f857610100808354040283529160200191610121565b820191905f5260205f20905b81548152906001019060200180831161010457829003601f168201915b5050505050905090565b60605f80546101399061040e565b80601f01602080910402602001604051908101604052809291908181526020018280546101659061040e565b80156101b05780601f10610187576101008083540402835291602001916101b0565b820191905f5260205f20905b81548152906001019060200180831161019357829003601f168201915b5050505050905090565b80600190816101c991906105e7565b5050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61020f826101cd565b61021981856101d7565b93506102298185602086016101e7565b610232816101f5565b840191505092915050565b5f6020820190508181035f8301526102558184610205565b905092915050565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6102ac826101f5565b810181811067ffffffffffffffff821117156102cb576102ca610276565b5b80604052505050565b5f6102dd61025d565b90506102e982826102a3565b919050565b5f67ffffffffffffffff82111561030857610307610276565b5b610311826101f5565b9050602081019050919050565b828183375f83830152505050565b5f61033e610339846102ee565b6102d4565b90508281526020810184848401111561035a57610359610272565b5b61036584828561031e565b509392505050565b5f82601f8301126103815761038061026e565b5b813561039184826020860161032c565b91505092915050565b5f602082840312156103af576103ae610266565b5b5f82013567ffffffffffffffff8111156103cc576103cb61026a565b5b6103d88482850161036d565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061042557607f821691505b602082108103610438576104376103e1565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261049a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261045f565b6104a4868361045f565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f6104e86104e36104de846104bc565b6104c5565b6104bc565b9050919050565b5f819050919050565b610501836104ce565b61051561050d826104ef565b84845461046b565b825550505050565b5f5f905090565b61052c61051d565b6105378184846104f8565b505050565b5b8181101561055a5761054f5f82610524565b60018101905061053d565b5050565b601f82111561059f576105708161043e565b61057984610450565b81016020851015610588578190505b61059c61059485610450565b83018261053c565b50505b505050565b5f82821c905092915050565b5f6105bf5f19846008026105a4565b1980831691505092915050565b5f6105d783836105b0565b9150826002028217905092915050565b6105f0826101cd565b67ffffffffffffffff81111561060957610608610276565b5b610613825461040e565b61061e82828561055e565b5f60209050601f83116001811461064f575f841561063d578287015190505b61064785826105cc565b8655506106ae565b601f19841661065d8661043e565b5f5b828110156106845784890151825560018201915060208501945060208101905061065f565b868310156106a1578489015161069d601f8916826105b0565b8355505b6001600288020188555050505b50505050505056fea2646970667358221220c78761f5dd632fbb96c0913612aa124af03e2e3649e0fe6988c1e80ec11f13e564736f6c634300081b0033" # noqa: E501
|
|
9
9
|
BYTES_CONTRACT_ABI = [
|
|
10
10
|
{
|
|
11
11
|
"inputs": [{"internalType": "bytes", "name": "_value", "type": "bytes"}],
|
|
@@ -42,8 +42,8 @@ BYTES_CONTRACT_DATA = {
|
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
# source: web3/_utils/contract_sources/BytesContracts.sol:Bytes32Contract
|
|
45
|
-
BYTES32_CONTRACT_BYTECODE = "
|
|
46
|
-
BYTES32_CONTRACT_RUNTIME = "
|
|
45
|
+
BYTES32_CONTRACT_BYTECODE = "0x60806040527f01230123012301230123012301230123012301230123012301230123012301235f553480156031575f5ffd5b50604051610238380380610238833981810160405281019060519190608f565b806001819055505060b5565b5f5ffd5b5f819050919050565b6071816061565b8114607a575f5ffd5b50565b5f81519050608981606a565b92915050565b5f6020828403121560a15760a0605d565b5b5f60ac84828501607d565b91505092915050565b610176806100c25f395ff3fe608060405234801561000f575f5ffd5b506004361061003f575f3560e01c8063209652551461004357806330de3cee1461006157806358825b101461007f575b5f5ffd5b61004b61009b565b60405161005891906100ce565b60405180910390f35b6100696100a4565b60405161007691906100ce565b60405180910390f35b61009960048036038101906100949190610115565b6100ac565b005b5f600154905090565b5f5f54905090565b8060018190555050565b5f819050919050565b6100c8816100b6565b82525050565b5f6020820190506100e15f8301846100bf565b92915050565b5f5ffd5b6100f4816100b6565b81146100fe575f5ffd5b50565b5f8135905061010f816100eb565b92915050565b5f6020828403121561012a576101296100e7565b5b5f61013784828501610101565b9150509291505056fea2646970667358221220e6edc49e9e9aee19bfd740dba0a81ba19a09999338eaa5607f07ca475d11ec3e64736f6c634300081b0033" # noqa: E501
|
|
46
|
+
BYTES32_CONTRACT_RUNTIME = "0x608060405234801561000f575f5ffd5b506004361061003f575f3560e01c8063209652551461004357806330de3cee1461006157806358825b101461007f575b5f5ffd5b61004b61009b565b60405161005891906100ce565b60405180910390f35b6100696100a4565b60405161007691906100ce565b60405180910390f35b61009960048036038101906100949190610115565b6100ac565b005b5f600154905090565b5f5f54905090565b8060018190555050565b5f819050919050565b6100c8816100b6565b82525050565b5f6020820190506100e15f8301846100bf565b92915050565b5f5ffd5b6100f4816100b6565b81146100fe575f5ffd5b50565b5f8135905061010f816100eb565b92915050565b5f6020828403121561012a576101296100e7565b5b5f61013784828501610101565b9150509291505056fea2646970667358221220e6edc49e9e9aee19bfd740dba0a81ba19a09999338eaa5607f07ca475d11ec3e64736f6c634300081b0033" # noqa: E501
|
|
47
47
|
BYTES32_CONTRACT_ABI = [
|
|
48
48
|
{
|
|
49
49
|
"inputs": [{"internalType": "bytes32", "name": "_value", "type": "bytes32"}],
|