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

Catch newly raised geth errors when tx indexing in progress #3216

Merged
merged 3 commits into from Feb 2, 2024

Conversation

fselmo
Copy link
Collaborator

@fselmo fselmo commented Feb 1, 2024

What was wrong?

Related to Issue #3212

  • Geth 1.13.11 started to return an error when transaction indexing is in progress and a eth_getTransactionReceipt call is made.

How was it fixed?

  • Handle this in the wait_for_transaction_receipt method by catching the error in order to continue waiting.

Todo:

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@fselmo fselmo force-pushed the handle-geth-indexing-waiting-for-tx branch from f109627 to 7993f54 Compare February 1, 2024 20:14
- Geth ``1.13.11`` started to return an error when transaction indexing
is in progress and a ``eth_getTransactionReceipt`` call is made.
Handle this in the ``wait_for_transaction_receipt`` method by catching
the error in order to continue waiting.
@fselmo fselmo force-pushed the handle-geth-indexing-waiting-for-tx branch from 7993f54 to b68cd9f Compare February 1, 2024 20:16
@fselmo fselmo marked this pull request as ready for review February 1, 2024 21:17
fselmo added a commit to fselmo/web3.py that referenced this pull request Feb 1, 2024
@fselmo fselmo force-pushed the handle-geth-indexing-waiting-for-tx branch from b757af7 to 9435474 Compare February 1, 2024 21:26
@fselmo fselmo force-pushed the handle-geth-indexing-waiting-for-tx branch from 9435474 to 91aa57b Compare February 1, 2024 21:35
Copy link
Contributor

@reedsa reedsa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

i = _tx_indexing_response_iterator()
with request_mocker(
w3,
mock_responses={"eth_getTransactionReceipt": lambda *_: next(i)},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This iterator approach is really cool! 😎

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, this is way cleaner than the v6 way! nice!

the RPC response. ``mock_errors`` is a dict mapping method names to the desired
"error" object of the RPC response. If a method name is not in either dict,
the request is made as usual.
Example with async and a mocked response object:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 Thanks for expanding this with a nice example!

Copy link
Collaborator

@kclowes kclowes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

i = _tx_indexing_response_iterator()
with request_mocker(
w3,
mock_responses={"eth_getTransactionReceipt": lambda *_: next(i)},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, this is way cleaner than the v6 way! nice!

@fselmo fselmo merged commit 3cd9572 into ethereum:main Feb 2, 2024
81 checks passed
fselmo added a commit that referenced this pull request Feb 2, 2024
@fselmo fselmo deleted the handle-geth-indexing-waiting-for-tx branch February 5, 2024 16:37
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

Successfully merging this pull request may close these issues.

None yet

3 participants