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

add gas refund handler to refund the remaining gas fee at the end of transaction #8993

Closed

Conversation

AaronZgl
Copy link

@AaronZgl AaronZgl commented Mar 25, 2021

Description

add the gas refund handler to refund the remaining gas fee at the end of transaction.

closes: #2150


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

@fdymylja
Copy link
Contributor

@AaronZgl, from my reading of your code, I understand that in case gas provided is 1000 and gas used is 100, then you refund the 900 gas fully.

Now if this is the case, I'd suggest you to give a read to #2150 and how refunding the whole amount can provide a dos attack vector.

@fdymylja
Copy link
Contributor

On a side note, probably it'd make sense to provide the option to set a custom gas refund handler if we agree that this is something that happens after each TX is processed (in the linked issue there were proposals to handle this at endblock level), to allow devs to inject their own custom gas handlers.

But I wouldn't support adding a default gas refund handler mechanism until a spec is written and there is consensus around that.

Copy link
Contributor

@alessio alessio left a comment

Choose a reason for hiding this comment

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

Blocking as per #8993 (comment)

@tac0turtle
Copy link
Member

@AaronZgl Thank you for taking this on. We are all excited for such a feature to land. Like @fdymylja mentioned we would want a spec or ADR to flesh out the design before the implementation can be merged. Could you write such a document, I can help push it along by getting all the required parties involved.

@AaronZgl
Copy link
Author

@AaronZgl, from my reading of your code, I understand that in case gas provided is 1000 and gas used is 100, then you refund the 900 gas fully.

Now if this is the case, I'd suggest you to give a read to #2150 and how refunding the whole amount can provide a dos attack vector.

If block gas limit is set to infinity, dos attack can be avoided, block gas limit can be limited by transaction gas limt and transaction quantity

@amaury1093
Copy link
Contributor

@AaronZgl are you planning to write an ADR for this?

@amaury1093 amaury1093 self-assigned this May 17, 2021
@tac0turtle
Copy link
Member

@AaronZgl I'm closing this PR. Let's write an ADR for a design, and then we can reopen this PR.

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.

Refunding unused but allocated gas
5 participants