-
Notifications
You must be signed in to change notification settings - Fork 619
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
feat(Runtime): Refund allowance to the access keys #2742
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
evgenykuzyakov
requested review from
bowenwang1996,
frol,
MaksymZavershynskyi and
SkidanovAlex
as code owners
May 28, 2020 18:09
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't forget to bump protocol version.
bowenwang1996
approved these changes
May 28, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Epic 🚀
lexfrl
approved these changes
May 29, 2020
frol
approved these changes
Jun 1, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #2523
This PR introduces access keys allowance refunds using the old Receipt refund data structure by reusing existing fields.
Right now the refund receipt is identified by a receipt with the
predecessor_id == "system"
. These are special type of receipts that don't cost any gas and also don't generate refunds themselves.This change reuses existing fields from the
ActionReceipt
such assigner_id
andsigner_public_key
to distinguish between Gas Refunds and Deposit Refunds.Gas refunds are refunds for the unused amount of Gas, while the Deposit Refunds are for the deposit amounts attached to transfer and function_call actions as well as refund for an action of deleting the account.
New Gas Refund Receipts also have the
predecessor_id == "system"
, butsigner_id == receiver_id
(because gas refunds always sent to the signer). While Deposit refunds still havesigner_id == "system"
. This allows to distinguish between Gas vs Deposit refunds.The Gas Refund also uses the original
signer_public_key
to be able to identify the access key needed to refund the unused gas potion of the allowance.When the Gas refund receipt arrives to the account, the original access key that signed the transaction that spawned this receipt might have been changed (e.g. using delete_key/add_key). This means that in some situation the gas refund towards the allowance can't be made, so we use best effort to refund the allowance, even if the access key is different.
Spec update: near/NEPs#75
Test plan