-
Notifications
You must be signed in to change notification settings - Fork 619
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Runtime): Dynamic gas pricing (#2813)
Implement dynamic gas price charging. See NEP for discussion: near/NEPs#67 List of changes: - Introduce a new config `pessimistic_gas_price_inflation_ratio`. Pessimistic inflation ratio, by default `3%` comparing to full block inflation of about `1%` gas price inflation. It's higher to account for potential delayed receipts. - Change `max_total_prepaid_gas` to `300 * 10^12`. It's higher than max burn gas per call, so it shouldn't affect existing contract much. - Receipts gas price is still the gas price at which the gas was purchased, but the actual gas price is used to burn gas. The remaining balance amount of gas is refunded back to the account and to the access key. - If the purchased gas price is lower than the current gas price, we try to use the unused gas amount to compensate for difference. This might happen due to really long delayed queues of receipts. If the difference is not possible to compensate, the amount is added to the `ApplyStats::gas_deficit_amount`. This amount reflect the balance that was not able to charge from the account and is needed for the balance checker. - The actual gas price is used to calculate burnt amount to reward the execution contract and validators. Even if the originator/signer account bought gas at a cheaper price (due to long queues). - Now even non-function call actions may generate refunds. E.g. a transfer from `alice` to `bob` will generate gas refund back to `alice`, to account for the potential increase in gas price. This increases the amount of refunds flying cross shard and likely will decrease our TPS for transfer transactions. Doesn't affect function calls much, because they almost always generate refunds. Fixes most in the near/NEPs#67 This change will introduce the devx issue: - ExecutionOutcome doesn't contain the actual gas_price or the block_height at which it was executed. It's available on the node side, when it pulls ExecutionOutcome for each block, so it can be included later for reporting. Without actual gas price, it's impossible to calculate the actual transaction cost. Depends on near/near-api-js#340
- Loading branch information
Evgeny Kuzyakov
authored
Jun 17, 2020
1 parent
06674af
commit d55c888
Showing
20 changed files
with
642 additions
and
254 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.