EIP-7742 - gas calculation using target_blobs_per_block #7823
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.
PR description
The approach uses the Optional
targetBlobsPerBlock
field to trigger the new behaviour rather than explicitly checking the fork.targetBlobsPerGas
is sent to Besu via newPayloadV4 (see #7840) where it will be added to the block header (see #7808).CancunGasCalculator.computeExcessBlobGas
was pulled up as default method onGasCalculator
interface so it can be inherited byPragueGasCalculator
as well as future gas calculators.It was not desirable to leave
CancunGasCalculator
untouched and override inPragueGasCalculator
(the typical pattern for forks) because the method signature needed to change in order to avoid leaking conditional fork behaviour to the callers (BlobGasValidationRule
andExcessBlobGasCalculator
).In
GasCalculator
, the presence of the dynamictargetBlobsPerBlock
(on the parent header) causes its value to replace the staticCancunGasCalculator.TARGET_BLOB_GAS_PER_BLOCK
(equivalent to 3 blobs).Instead of the hardcoded value from 4844 (
TARGET_BLOB_GAS_PER_BLOCK
),parentTargetBlobGas
is now calculated viablobGasCost(parentTargetBlobsPerBlock)
Part of #7605
Implemented as written in https://github.com/ethereum/EIPs/blob/a78f470331f2150aa1640f348ab4343127d212af/EIPS/eip-7742.mdbut note there are further changes likely coming: ethereum/EIPs#8994Spec for https://eips.ethereum.org/EIPS/eip-7742 was finalized with no further changes
Thanks for sending a pull request! Have you done the following?
doc-change-required
label to this PR if updates are required.Locally, you can run these tests to catch failures early:
./gradlew build
./gradlew acceptanceTest
./gradlew integrationTest
./gradlew ethereum:referenceTests:referenceTests