Skip to content

t8n: Return InvalidBlock exception in result.blockException #1182

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 3 commits into from
Apr 22, 2025

Conversation

marioevz
Copy link
Member

@marioevz marioevz commented Apr 4, 2025

What was wrong?

Block-level exceptions, such the ones raised when the system contract calls failed, resulted in t8n returning an empty response instead of parseable JSON.

How was it fixed?

Added a new field in the T8N's response's field result that is called blockException, which is populated in case of an error.

In this PR only an exception in process_general_purpose_requests will be caught and populate the extra field, so every other exception is not caught and will still result in the same behavior, but I think each case should be analyzed separately.

Cute Animal Picture

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

Comment on lines 462 to 251
except InvalidBlock as e:
self.result.block_exception = f"{e}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we hoist this up into:

def run_blockchain_test(self) -> None:

?

We can wrap the whole function body in a try/except, since per-transaction exceptions are caught here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes that sounds better. Is run_blockchain_test part of forks/prague? I cannot see it in this version of the file.

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe so, yeah.

@marioevz marioevz force-pushed the t8n-return-block-exception branch from d615cb5 to 9b677f4 Compare April 15, 2025 12:47
@marioevz marioevz changed the base branch from devnets/prague/6 to forks/prague April 15, 2025 12:48
@marioevz marioevz force-pushed the t8n-return-block-exception branch from 81aef27 to d9af838 Compare April 15, 2025 12:57
@marioevz
Copy link
Member Author

marioevz commented Apr 15, 2025

@SamWilsn I've rebased to forks/prague and applied your suggestion.

Let me know if it's ok.

Just tested and it's not working anymore, I need to take another look.

@marioevz
Copy link
Member Author

@SamWilsn I've rebased to forks/prague, applied your suggestion, fixed my code and now it's working finally.

Let me know if it's ok.

@marioevz
Copy link
Member Author

Copy link
Contributor

@gurukamath gurukamath left a comment

Choose a reason for hiding this comment

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

LGTM! The only nit would perhaps be to avoid the huge try-except block in run_blockchain_test. Defining the logic in the try block as a separate function.

PS: Perhaps that was the original implementation.

@SamWilsn SamWilsn merged commit 9a6b298 into ethereum:forks/prague Apr 22, 2025
3 of 5 checks passed
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