Implement BEP-212 : Reduction of Refunds #1392
Closed
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.
Description
This PR implements BEP-212 . This is done by enabling EIP-3529 for BSC on the next hard fork block.
Concretely this BEP:
SELFDESTRUCT
.SSTORE
to 1/5th of the gas used in the transaction.SstoreClearsScheduleRefund
from 15,000 to 4,800 .Rationale
Currently the code implementing EIP-3592 is present in the repository, but is not enabled.
Moreover, no tests were added in the pull request implementing it in go-ethereum : ethereum/go-ethereum#22733 . Those tests were added in the ethereum git submodules which BSC does not use. For this reason new tests for EIP-3529 are added in this PR.
Since EIP-3529 is built upon EIP-2929, this PR also enables EIP-2929. For this a new VM instructionset is defined with both EIPs enabled.
Changes
Notable changes:
params/config.go
: config changes to include hard fork block.vm/jump_table.go
: defining a new instructionset with EIP3529 and EIP2929 enabled.core/blockchain_eip3529_test.go
: tests for the gas refunds when EIP3529 is enabled or disabled.