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

Cannot refund GasConsumed - tx times out #10213

Closed
4 tasks
albertchon opened this issue Sep 22, 2021 · 5 comments
Closed
4 tasks

Cannot refund GasConsumed - tx times out #10213

albertchon opened this issue Sep 22, 2021 · 5 comments
Labels
C: gas S:needs more info This bug can't be addressed until more information is provided by the reporter. T:Bug

Comments

@albertchon
Copy link
Contributor

albertchon commented Sep 22, 2021

Summary of Bug

Empirically, I've found that when the entire gas consumed is refunded, the tx will timeout. However if one refunds a smaller value up to the gas consumed in the handler execution, the tx will succeed.

// always times out
ctx.GasMeter().RefundGas(ctx.GasMeter().GasConsumed(), "test")

// succeeds
// beginning of handler
startGas := ctx.GasMeter().GasConsumed()
...
ctx.GasMeter().RefundGas(ctx.GasMeter().GasConsumed() - startGas, "test")

Version

v0.44.0

Also previously noted this observation here #9403 (comment)


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@alexanderbez
Copy link
Contributor

the tx will timeout while one refunds a smaller value up to the gas consumed in the handler execution, it'll succeed.

I don't understand this :-/

@fedekunze can you add to anything here pls?

@albertchon
Copy link
Contributor Author

Edited grammar in OP to make it more clear. Basically one cannot refund the gas consumed in the antehandler.

@robert-zaremba
Copy link
Collaborator

robert-zaremba commented Sep 23, 2021

Isn't this duplicating / extending #2150?

@robert-zaremba
Copy link
Collaborator

Isn't this duplicating / extending #2150?

hmm, it's not related.

@robert-zaremba
Copy link
Collaborator

@albertchon would you be able to provide a test case (as a pr)?

@tac0turtle tac0turtle added the S:needs more info This bug can't be addressed until more information is provided by the reporter. label Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: gas S:needs more info This bug can't be addressed until more information is provided by the reporter. T:Bug
Projects
None yet
Development

No branches or pull requests

4 participants