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

get_logs sporadically returns formatter conditions error #2771

Closed
dino-rodriguez opened this issue Jan 5, 2023 · 2 comments
Closed

get_logs sporadically returns formatter conditions error #2771

dino-rodriguez opened this issue Jan 5, 2023 · 2 comments

Comments

@dino-rodriguez
Copy link

dino-rodriguez commented Jan 5, 2023

  • Version: 5.31.3
  • Python: 3.10.6
  • OS: osx/linux

I am connected to an Infura node.

When I call w3.eth.get_logs({"fromBlock": x, "toBlock": y}) I very sporadically get this error. Calling the same get_logs call again with the same parameters resolves as expected. This is the error:

ValueError: The provided value did not satisfy any of the formatter conditions
File "run_radar.py", line 29, in main
radar.start(scan_config)
File "radar/radar.py", line 114, in start
scan_output = _scan(scan_config, contracts)
File "utils.py", line 20, in wrapper
return cast(R, fn(*args, **kwargs))
File "newrelic/api/background_task.py", line 117, in wrapper
return wrapped(*args, **kwargs)
File "radar/radar.py", line 221, in _scan
logs, start_block, end_block, is_caught_up = _get_logs(
File "utils.py", line 20, in wrapper
return cast(R, fn(*args, **kwargs))
File "newrelic/api/background_task.py", line 117, in wrapper
return wrapped(*args, **kwargs)
File "radar/radar.py", line 153, in _get_logs
logs, adjusted_end_block = _get_logs_chunk(
File "utils.py", line 20, in wrapper
return cast(R, fn(*args, **kwargs))
File "newrelic/api/background_task.py", line 117, in wrapper
return wrapped(*args, **kwargs)
File "radar/radar.py", line 206, in _get_logs_chunk
raise e
File "radar/radar.py", line 178, in _get_logs_chunk
return provider.get_logs(start_block, end_block), end_block
File "radar/provider.py", line 20, in get_logs
return w3.eth.get_logs(
File "web3/module.py", line 57, in caller
result = w3.manager.request_blocking(method_str,
File "web3/manager.py", line 197, in request_blocking
response = self._make_request(method, params)
File "web3/manager.py", line 150, in _make_request
return request_func(method, params)
File "web3/middleware/formatting.py", line 94, in middleware
response = make_request(method, params)
File "web3/middleware/gas_price_strategy.py", line 90, in middleware
return make_request(method, params)
File "web3/middleware/formatting.py", line 94, in middleware
response = make_request(method, params)
File "web3/middleware/attrdict.py", line 33, in middleware
response = make_request(method, params)
File "web3/middleware/formatting.py", line 96, in middleware
return _apply_response_formatters(method=method, response=response, **formatters)
File "web3/middleware/formatting.py", line 51, in _apply_response_formatters
return _format_response("result", result_formatters[method])
File "web3/middleware/formatting.py", line 47, in _format_response
response, response_type, method_response_formatter(appropriate_response)
File "cytoolz/functoolz.pyx", line 249, in cytoolz.functoolz.curry.call
File "eth_utils/applicators.py", line 116, in apply_one_of_formatters
raise ValueError(

@dino-rodriguez
Copy link
Author

Saw a similar issue here that was closed but not sure what the solution was: #2165

@kclowes
Copy link
Collaborator

kclowes commented Apr 15, 2024

It's probably the provider limiting how many blocks you can query at once. Try decreasing how many blocks you're querying or use a local node.

@kclowes kclowes closed this as completed Apr 15, 2024
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