This repository was archived by the owner on Sep 8, 2025. It is now read-only.
EIP-3529 Reduction in Refunds#2020
Merged
Merged
Conversation
82e3e29 to
f489f70
Compare
a416b74 to
17dcdac
Compare
carver
approved these changes
Sep 10, 2021
| transaction: SignedTransactionAPI, | ||
| computation: ComputationAPI) -> ComputationAPI: | ||
| transaction_context = self.vm_state.get_transaction_context(transaction) | ||
| def calculate_gas_refund(self, |
Contributor
There was a problem hiding this comment.
Looks like this could be a classmethod. That helps show that it doesn't depend on anything besides the passed-in variables.
| gas_remaining = computation.get_gas_remaining() | ||
| gas_used = transaction.gas - gas_remaining | ||
| gas_refund = min(gas_refunded, gas_used // 2) | ||
| gas_refund = self.calculate_gas_refund(computation, gas_used) |
Contributor
There was a problem hiding this comment.
Cool, seems like a good refactor to avoid too much duplication.
Comment on lines
+92
to
+97
| def calculate_gas_refund(self, | ||
| computation: ComputationAPI, | ||
| gas_used: int) -> int: | ||
| gas_refunded = computation.get_gas_refund() |
Contributor
There was a problem hiding this comment.
Maybe note in a comment the intentional exclusion of selfdestruct refunds?
Comment on lines
+10
to
+11
| SSTORE_CLEARS_SCHEDULE_EIP_3529 = GAS_SCHEDULE_EIP2929.sstore_reset_gas + \ | ||
| berlin_constants.ACCESS_LIST_STORAGE_KEY_COST_EIP_2930 |
Contributor
There was a problem hiding this comment.
nit: I'll do almost anything to avoid the \ continuation. I prefer this style:
Suggested change
| SSTORE_CLEARS_SCHEDULE_EIP_3529 = GAS_SCHEDULE_EIP2929.sstore_reset_gas + \ | |
| berlin_constants.ACCESS_LIST_STORAGE_KEY_COST_EIP_2930 | |
| SSTORE_CLEARS_SCHEDULE_EIP_3529 = ( | |
| GAS_SCHEDULE_EIP2929.sstore_reset_gas | |
| + berlin_constants.ACCESS_LIST_STORAGE_KEY_COST_EIP_2930 | |
| ) |
Contributor
|
I've got the PR ready that flips on the London tests, after this is merged. Curious to see how many failures we have left! |
Collaborator
Author
|
Me too! I'm cleaning up commits now, and then I'll merge! |
- Replace SSTORE_CLEARS_SCHEDULE, - Remove SELFDESTRUCT refund, - Add new MAX_REFUND_QUOTIENT
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
What was wrong?
EIP-3529 was missing
How was it fixed?
Added it!
To-Do
Cute Animal Picture