Skip to content

[v6] Catch newly raised geth errors when tx indexing in progress #3217

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

Merged
merged 1 commit into from
Feb 2, 2024

Conversation

fselmo
Copy link
Collaborator

@fselmo fselmo commented Feb 1, 2024

What was wrong?

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

Related to Issue #3212

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 added the v6 Breaking changes that were considered for v6 (old) label Feb 1, 2024
@fselmo fselmo marked this pull request as ready for review February 1, 2024 21:17
@fselmo fselmo removed the v6 Breaking changes that were considered for v6 (old) label Feb 1, 2024
@fselmo fselmo requested review from kclowes, reedsa and pacrob February 1, 2024 21:18
- 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 v6-handle-geth-indexing-waiting-for-tx branch from 937d131 to 31c5126 Compare February 1, 2024 21:25
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.

Minor nit, not blocking. lgtm!

error_middleware = construct_error_generator_middleware(
{
RPC.eth_getTransactionReceipt: lambda *_: (
_swap_error_middleware_for_result_middleware_and_return_error(
Copy link
Contributor

Choose a reason for hiding this comment

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

Super funky but this seems like a good way to test the error/response.

receipt = w3.eth.wait_for_transaction_receipt(f"0x{'00' * 32}")
assert receipt == {"status": 1}

assert "error_middleware" not in w3.middleware_onion.middlewares
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: This seems like it would always be true given the expected receipt came back. Curious if you have thoughts for this assertion?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is just to add an extra layer of assertion for better code readability. Sanity check that the error_middleware is getting cleaned up when we add the result_middleware which is why we don't remove it from the onion below.

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.

LGTM! :shipit:

@fselmo fselmo merged commit 565664e into ethereum:v6 Feb 2, 2024
@fselmo fselmo deleted the v6-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.

3 participants