-
Notifications
You must be signed in to change notification settings - Fork 1k
Exclude halt-burned gas from block regular gas #10225
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
Changes from all commits
178549d
cf149e3
e0ee355
be95948
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -239,9 +239,24 @@ public boolean chargeCodeDelegationStateGas( | |
| } | ||
| // New empty accounts incur additional state gas (112 * cpsb) | ||
| final long newEmptyAccounts = totalDelegations - alreadyExistingDelegators; | ||
| if (newEmptyAccounts > 0) { | ||
| return frame.consumeStateGas( | ||
| emptyAccountDelegationStateGas(blockGasLimit) * newEmptyAccounts); | ||
| if (newEmptyAccounts > 0 | ||
| && !frame.consumeStateGas( | ||
| emptyAccountDelegationStateGas(blockGasLimit) * newEmptyAccounts)) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why this modification and it is not inline anymore ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We must continue here and check for alreadyExistingDelegators a bit below as well if we still have state gas here. If we do not have enough state gas |
||
| return false; | ||
| } | ||
| // EIP-8037: the intrinsic state gas is sized assuming every authority is a new empty | ||
| // account (emptyAccountDelegationStateGas per auth). For authorities that already exist, | ||
| // that pre-charge was not consumed, park it in the state gas reservoir so it is returned | ||
| // to the sender alongside any unused gas on halt/revert, matching the specification's | ||
| // set_delegation behavior (intrinsic_state_gas -= refund; state_gas_reservoir += refund). | ||
| if (alreadyExistingDelegators > 0) { | ||
| final long reservoirCredit = | ||
| emptyAccountDelegationStateGas(blockGasLimit) * alreadyExistingDelegators; | ||
| if (frame.getRemainingGas() < reservoirCredit) { | ||
| return false; | ||
| } | ||
| frame.decrementRemainingGas(reservoirCredit); | ||
| frame.incrementStateGasReservoir(reservoirCredit); | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.