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

Fix logic async gas consumption #316

Merged
merged 3 commits into from
Apr 5, 2023
Merged

Fix logic async gas consumption #316

merged 3 commits into from
Apr 5, 2023

Conversation

amimart
Copy link
Member

@amimart amimart commented Mar 21, 2023

Context

When prolog executing query through the logic Ask gRPC query, the prolog predicates are executed in a separate goroutine. In case this goroutine panic we are not able to recover from it, so the #312 introduced a change in the gas consumption handling, making the goroutine stop instead of panic. This works on async parts, but may be problematic on synchronous parts.

Description

Since ichiban/prolog#290 released in the v1.1.0 version any panics occurring while executing predicates are recovered and an error is returned back to the interpreter client through the Solutions.Err() func. The panic being recovered, this PR adds a check on gas consumption to panic again with the ErrorOutOfGas error letting the gRPC Ask query handle it.

@amimart amimart self-assigned this Mar 21, 2023
@amimart amimart requested review from bdeneux and ccamel and removed request for bdeneux March 21, 2023 07:43
@amimart amimart marked this pull request as ready for review April 4, 2023 21:35
Copy link
Member

@ccamel ccamel left a comment

Choose a reason for hiding this comment

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

Super! 😌

Copy link
Contributor

@bdeneux bdeneux left a comment

Choose a reason for hiding this comment

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

Great 😍!

@amimart amimart merged commit bc3c817 into main Apr 5, 2023
@amimart amimart deleted the fix/logic-async-panic branch April 5, 2023 08:34
@bot-anik
Copy link
Member

🎉 This PR is included in version 5.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants